Skip to content

Commit 39863c9

Browse files
author
Simon Emms
committed
[installer]: add custom annotations to common components
1 parent cebe914 commit 39863c9

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

install/installer/pkg/common/display.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,10 @@ func GenerateInstallationConfigMap(ctx *RenderContext, objects []RuntimeObject)
9999
cfgMap := corev1.ConfigMap{
100100
TypeMeta: TypeMetaConfigmap,
101101
ObjectMeta: metav1.ObjectMeta{
102-
Name: component,
103-
Namespace: ctx.Namespace,
104-
Labels: DefaultLabels(component),
102+
Name: component,
103+
Namespace: ctx.Namespace,
104+
Labels: CustomOverrideLabel(ctx, component, TypeMetaConfigmap),
105+
Annotations: CustomOverrideAnnotation(ctx, component, TypeMetaConfigmap),
105106
},
106107
}
107108

install/installer/pkg/common/objects.go

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,10 @@ func DefaultServiceAccount(component string) RenderFunc {
2828
&corev1.ServiceAccount{
2929
TypeMeta: TypeMetaServiceAccount,
3030
ObjectMeta: metav1.ObjectMeta{
31-
Name: component,
32-
Namespace: cfg.Namespace,
33-
Labels: DefaultLabels(component),
31+
Name: component,
32+
Namespace: cfg.Namespace,
33+
Labels: CustomOverrideLabel(cfg, component, TypeMetaServiceAccount),
34+
Annotations: CustomOverrideAnnotation(cfg, component, TypeMetaServiceAccount),
3435
},
3536
AutomountServiceAccountToken: pointer.Bool(true),
3637
ImagePullSecrets: pullSecrets,
@@ -81,6 +82,18 @@ func GenerateService(component string, ports []ServicePort, mod ...func(spec *co
8182
m(service)
8283
}
8384

85+
// Apply any custom overrides - perform after the custom modifications so they can overridden
86+
87+
// Annotations
88+
service.ObjectMeta.Annotations = CustomOverrideAnnotation(cfg, component, TypeMetaService, func() map[string]string {
89+
return service.ObjectMeta.Annotations
90+
})
91+
92+
// Labels
93+
service.ObjectMeta.Labels = CustomOverrideLabel(cfg, component, TypeMetaService, func() map[string]string {
94+
return service.ObjectMeta.Labels
95+
})
96+
8497
return []runtime.Object{service}, nil
8598
}
8699
}

0 commit comments

Comments
 (0)