Skip to content

Commit

Permalink
Merge pull request #14 from metal-stack/label-inheritance
Browse files Browse the repository at this point in the history
Inherit labels from owner to the children.
  • Loading branch information
majst01 authored Mar 23, 2023
2 parents c80d501 + 0fbc44f commit 5a9c622
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions controllers/deployment/reconcile.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ func (c *controller) createFirewallSet(r *controllers.Ctx[*v2.FirewallDeployment
Annotations: map[string]string{
v2.RevisionAnnotation: strconv.Itoa(revision),
},
Labels: r.Target.Labels,
},
Spec: v2.FirewallSetSpec{
Replicas: r.Target.Spec.Replicas,
Expand Down
5 changes: 5 additions & 0 deletions controllers/set/reconcile.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@ func (c *controller) createFirewall(r *controllers.Ctx[*v2.FirewallSet]) (*v2.Fi
*metav1.NewControllerRef(r.Target, v2.GroupVersion.WithKind("FirewallSet")),
}

for k, v := range r.Target.Labels {
// inheriting labels from the firewall set to the firewall
meta.Labels[k] = v
}

fw := &v2.Firewall{
ObjectMeta: *meta,
Spec: r.Target.Spec.Template.Spec,
Expand Down

0 comments on commit 5a9c622

Please sign in to comment.