Skip to content

Commit 2d914cb

Browse files
author
Simon Emms
committed
[installer]: apply labels/annotations to minio and mysql
1 parent 4229efd commit 2d914cb

File tree

3 files changed

+42
-20
lines changed

3 files changed

+42
-20
lines changed

install/installer/cmd/testdata/render/customization/output.golden

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3687,6 +3687,8 @@ data:
36873687
apiVersion: v1
36883688
kind: Service
36893689
metadata:
3690+
annotations:
3691+
hello: world
36903692
creationTimestamp: null
36913693
labels:
36923694
app.kubernetes.io/component: primary
@@ -3749,6 +3751,8 @@ data:
37493751
apiVersion: v1
37503752
kind: Service
37513753
metadata:
3754+
annotations:
3755+
hello: world
37523756
creationTimestamp: null
37533757
labels:
37543758
app.kubernetes.io/instance: Minio
@@ -6331,6 +6335,8 @@ metadata:
63316335
helm.sh/chart: minio-11.6.3
63326336
app.kubernetes.io/instance: Minio
63336337
app.kubernetes.io/managed-by: Helm
6338+
annotations:
6339+
hello: world
63346340
spec:
63356341
type: ClusterIP
63366342
ports:
@@ -6360,6 +6366,7 @@ metadata:
63606366
app.kubernetes.io/managed-by: Helm
63616367
app.kubernetes.io/component: primary
63626368
annotations:
6369+
hello: world
63636370
spec:
63646371
type: ClusterIP
63656372
sessionAffinity: None
@@ -7490,12 +7497,14 @@ spec:
74907497
metadata:
74917498
annotations:
74927499
checksum/configuration: f96f510015050d9b0165d12f144f5eca5641c065ccbe9c75e64f58e81a9b3d8c
7500+
hello: world
74937501
labels:
74947502
app.kubernetes.io/name: mysql
74957503
helm.sh/chart: mysql-9.1.2
74967504
app.kubernetes.io/instance: MySQL
74977505
app.kubernetes.io/managed-by: Helm
74987506
app.kubernetes.io/component: primary
7507+
hello: world
74997508
spec:
75007509
serviceAccountName: db
75017510

@@ -8509,8 +8518,10 @@ spec:
85098518
helm.sh/chart: minio-11.6.3
85108519
app.kubernetes.io/instance: Minio
85118520
app.kubernetes.io/managed-by: Helm
8521+
hello: world
85128522
annotations:
85138523
checksum/credentials-secret: 254e39ef7087b8d977946ed0027240eda9a1c7f64ae430fca5644a50b23cece3
8524+
hello: world
85148525
spec:
85158526

85168527
serviceAccountName: minio

install/installer/pkg/components/database/incluster/helm.go

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,30 +24,37 @@ var Helm = common.CompositeHelmFunc(
2424
return nil, err
2525
}
2626

27+
customization := helm.CustomizeAnnotation([]string{}, "mysql.primary.podAnnotations", cfg, Component, common.TypeMetaDeployment)
28+
customization = helm.CustomizeLabel(customization, "mysql.primary.podLabels", cfg, Component, common.TypeMetaDeployment)
29+
customization = helm.CustomizeAnnotation(customization, "mysql.primary.service.annotations", cfg, Component, common.TypeMetaService)
30+
2731
return &common.HelmConfig{
2832
Enabled: true,
2933
Values: &values.Options{
30-
Values: []string{
31-
helm.KeyValue("mysql.auth.existingSecret", SQLPasswordName),
32-
helm.KeyValue("mysql.auth.database", Database),
33-
helm.KeyValue("mysql.auth.username", Username),
34-
helm.KeyValue("mysql.initdbScriptsConfigMap", SQLInitScripts),
35-
helm.KeyValue("mysql.serviceAccount.name", Component),
36-
helm.ImagePullSecrets("mysql.image.pullSecrets", cfg),
37-
helm.KeyValue("mysql.image.registry", ""),
38-
helm.KeyValue("mysql.image.repository", cfg.RepoName(common.ThirdPartyContainerRepo(cfg.Config.Repository, common.DockerRegistryURL), "bitnami/mysql")),
39-
helm.ImagePullSecrets("mysql.metrics.image.pullSecrets", cfg),
40-
helm.KeyValue("mysql.metrics.image.registry", ""),
41-
helm.KeyValue("mysql.metrics.image.repository", cfg.RepoName(common.ThirdPartyContainerRepo(cfg.Config.Repository, common.DockerRegistryURL), "bitnami/mysqld-exporter")),
42-
helm.ImagePullSecrets("mysql.volumePermissions.image.pullSecrets", cfg),
43-
helm.KeyValue("mysql.volumePermissions.image.pullPolicy", "IfNotPresent"),
44-
helm.KeyValue("mysql.volumePermissions.image.registry", ""),
45-
helm.KeyValue("mysql.volumePermissions.image.repository", cfg.RepoName(common.ThirdPartyContainerRepo(cfg.Config.Repository, common.DockerRegistryURL), "bitnami/bitnami-shell")),
34+
Values: append(
35+
[]string{
36+
helm.KeyValue("mysql.auth.existingSecret", SQLPasswordName),
37+
helm.KeyValue("mysql.auth.database", Database),
38+
helm.KeyValue("mysql.auth.username", Username),
39+
helm.KeyValue("mysql.initdbScriptsConfigMap", SQLInitScripts),
40+
helm.KeyValue("mysql.serviceAccount.name", Component),
41+
helm.ImagePullSecrets("mysql.image.pullSecrets", cfg),
42+
helm.KeyValue("mysql.image.registry", ""),
43+
helm.KeyValue("mysql.image.repository", cfg.RepoName(common.ThirdPartyContainerRepo(cfg.Config.Repository, common.DockerRegistryURL), "bitnami/mysql")),
44+
helm.ImagePullSecrets("mysql.metrics.image.pullSecrets", cfg),
45+
helm.KeyValue("mysql.metrics.image.registry", ""),
46+
helm.KeyValue("mysql.metrics.image.repository", cfg.RepoName(common.ThirdPartyContainerRepo(cfg.Config.Repository, common.DockerRegistryURL), "bitnami/mysqld-exporter")),
47+
helm.ImagePullSecrets("mysql.volumePermissions.image.pullSecrets", cfg),
48+
helm.KeyValue("mysql.volumePermissions.image.pullPolicy", "IfNotPresent"),
49+
helm.KeyValue("mysql.volumePermissions.image.registry", ""),
50+
helm.KeyValue("mysql.volumePermissions.image.repository", cfg.RepoName(common.ThirdPartyContainerRepo(cfg.Config.Repository, common.DockerRegistryURL), "bitnami/bitnami-shell")),
4651

47-
// improve start time
48-
helm.KeyValue("mysql.primary.startupProbe.enabled", "false"),
49-
helm.KeyValue("mysql.primary.livenessProbe.initialDelaySeconds", "30"),
50-
},
52+
// improve start time
53+
helm.KeyValue("mysql.primary.startupProbe.enabled", "false"),
54+
helm.KeyValue("mysql.primary.livenessProbe.initialDelaySeconds", "30"),
55+
},
56+
customization...,
57+
),
5158
// This is too complex to be sent as a string
5259
FileValues: []string{
5360
primaryAffinityTemplate,

install/installer/pkg/components/minio/helm.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ var Helm = common.CompositeHelmFunc(
2626
helm.KeyValue("minio.volumePermissions.image.repository", cfg.RepoName(common.ThirdPartyContainerRepo(cfg.Config.Repository, common.DockerRegistryURL), "bitnami/bitnami-shell")),
2727
}
2828

29+
commonHelmValues = helm.CustomizeAnnotation(commonHelmValues, "minio.podAnnotations", cfg, Component, common.TypeMetaDeployment)
30+
commonHelmValues = helm.CustomizeLabel(commonHelmValues, "minio.podLabels", cfg, Component, common.TypeMetaDeployment)
31+
commonHelmValues = helm.CustomizeAnnotation(commonHelmValues, "minio.service.annotations", cfg, Component, common.TypeMetaService)
32+
2933
if cfg.Config.ObjectStorage.Resources != nil && cfg.Config.ObjectStorage.Resources.Requests.Memory() != nil {
3034
memoryRequests := resource.MustParse(cfg.Config.ObjectStorage.Resources.Requests.Memory().String())
3135
commonHelmValues = append(commonHelmValues, helm.KeyValue("minio.resources.requests.memory", memoryRequests.String()))

0 commit comments

Comments
 (0)