Skip to content

Commit

Permalink
Refactor annotation propagation order (#67)
Browse files Browse the repository at this point in the history
Signed-off-by: Waleed Malik <[email protected]>
Co-authored-by: Waleed Malik <[email protected]>
  • Loading branch information
kubermatic-bot and ahmedwaleedmalik authored Sep 30, 2024
1 parent ddc5bb7 commit 50ad2d0
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions internal/controllers/kubelb/shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,16 @@ func GetConfig(ctx context.Context, client ctrlclient.Client, configNamespace st

func GetAnnotations(tenant *kubelbv1alpha1.Tenant, config *kubelbv1alpha1.Config) kubelbv1alpha1.AnnotationSettings {
var annotations kubelbv1alpha1.AnnotationSettings
if tenant.Spec.AnnotationSettings.PropagatedAnnotations != nil {
if tenant.Spec.AnnotationSettings.PropagateAllAnnotations != nil && *tenant.Spec.AnnotationSettings.PropagateAllAnnotations {
annotations.PropagateAllAnnotations = tenant.Spec.AnnotationSettings.PropagateAllAnnotations
} else if tenant.Spec.AnnotationSettings.PropagatedAnnotations != nil {
annotations.PropagatedAnnotations = tenant.Spec.AnnotationSettings.PropagatedAnnotations
} else if config.Spec.AnnotationSettings.PropagatedAnnotations != nil {
annotations.PropagatedAnnotations = config.Spec.AnnotationSettings.PropagatedAnnotations
}
if tenant.Spec.AnnotationSettings.PropagateAllAnnotations == nil {
annotations.PropagateAllAnnotations = tenant.Spec.AnnotationSettings.PropagateAllAnnotations
} else if config.Spec.AnnotationSettings.PropagateAllAnnotations == nil {

if config.Spec.AnnotationSettings.PropagateAllAnnotations != nil && *config.Spec.AnnotationSettings.PropagateAllAnnotations {
annotations.PropagateAllAnnotations = config.Spec.AnnotationSettings.PropagateAllAnnotations
} else if config.Spec.AnnotationSettings.PropagatedAnnotations != nil {
annotations.PropagatedAnnotations = config.Spec.AnnotationSettings.PropagatedAnnotations
}
return annotations
}

0 comments on commit 50ad2d0

Please sign in to comment.