Skip to content

Commit

Permalink
feat(cluster) add ServiceAccountTemplate annotations and labels
Browse files Browse the repository at this point in the history
Signed-off-by: Dariusch Ochlast <[email protected]>
  • Loading branch information
Dariusch committed Oct 25, 2024
1 parent 3c5dd5d commit e77c4a5
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ schema: cloudnative-pg-schema cluster-schema ## Generate charts' schema using he

cloudnative-pg-schema:
@helm schema-gen charts/cloudnative-pg/values.yaml | cat > charts/cloudnative-pg/values.schema.json || \
(echo "Please, run: helm plugin install https://github.com/karuppiah7890/helm-schema-gen.git" && exit 1)
(echo "Please, run: helm plugin install https://github.com/KnechtionsCoding/helm-schema-gen.git" && exit 1)

cluster-schema:
@helm schema-gen charts/cluster/values.yaml | cat > charts/cluster/values.schema.json || \
(echo "Please, run: helm plugin install https://github.com/karuppiah7890/helm-schema-gen.git" && exit 1)
(echo "Please, run: helm plugin install https://github.com/KnechtionsCoding/helm-schema-gen.git" && exit 1)
3 changes: 2 additions & 1 deletion charts/cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ refer to the [CloudNativePG Documentation](https://cloudnative-pg.io/documentat
| cluster.priorityClassName | string | `""` | |
| cluster.resources | object | `{}` | Resources requirements of every generated Pod. Please refer to https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ for more information. We strongly advise you use the same setting for limits and requests so that your cluster pods are given a Guaranteed QoS. See: https://kubernetes.io/docs/concepts/workloads/pods/pod-qos/ |
| cluster.roles | list | `[]` | This feature enables declarative management of existing roles, as well as the creation of new roles if they are not already present in the database. See: https://cloudnative-pg.io/documentation/current/declarative_role_management/ |
| cluster.serviceAccount.annotations | object | `{}` | Annotations to be added to the ServiceAccount See: https://cloudnative-pg.io/documentation/current/appendixes/object_stores/#running-inside-google-kubernetes-engine See: https://cloudnative-pg.io/documentation/current/appendixes/object_stores/#iam-role-for-service-account-irsa |
| cluster.serviceAccount.labels | object | `{}` | Labels to be added to the ServiceAccount |
| cluster.storage.size | string | `"8Gi"` | |
| cluster.storage.storageClass | string | `""` | |
| cluster.superuserSecret | string | `""` | |
Expand Down Expand Up @@ -274,4 +276,3 @@ TODO
----
* IAM Role for S3 Service Account
* Automatic provisioning of a Alert Manager configuration

3 changes: 0 additions & 3 deletions charts/cluster/README.md.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,3 @@ TODO
----
* IAM Role for S3 Service Account
* Automatic provisioning of a Alert Manager configuration


{{ template "helm-docs.versionFooter" . }}
13 changes: 12 additions & 1 deletion charts/cluster/templates/cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ spec:
walStorage:
size: {{ .Values.cluster.walStorage.size }}
storageClass: {{ .Values.cluster.walStorage.storageClass }}
{{- end }}
{{- end }}
{{- with .Values.cluster.resources }}
resources:
{{- toYaml . | nindent 4 }}
Expand All @@ -39,6 +39,17 @@ spec:
{{- end }}
priorityClassName: {{ .Values.cluster.priorityClassName }}

serviceAccountTemplate:
metadata:
{{- with .Values.cluster.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.cluster.serviceAccount.labels }}
labels:
{{ toYaml . | nindent 8 }}
{{- end }}

primaryUpdateMethod: {{ .Values.cluster.primaryUpdateMethod }}
primaryUpdateStrategy: {{ .Values.cluster.primaryUpdateStrategy }}
logLevel: {{ .Values.cluster.logLevel }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ spec:
values:
- node1
- node2
serviceAccountTemplate:
metadata:
annotations:
foo: bar
labels:
bar: foo
resources:
requests:
cpu: 100m
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ cluster:
inRoles:
- pg_monitor
- pg_signal_backend
serviceAccount:
annotations:
foo: bar
labels:
bar: foo
postgresql:
parameters:
max_connections: "42"
Expand Down
11 changes: 11 additions & 0 deletions charts/cluster/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,17 @@
"roles": {
"type": "array"
},
"serviceAccount": {
"type": "object",
"properties": {
"annotations": {
"type": "object"
},
"labels": {
"type": "object"
}
}
},
"storage": {
"type": "object",
"properties": {
Expand Down
7 changes: 7 additions & 0 deletions charts/cluster/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,13 @@ cluster:
additionalLabels: {}
annotations: {}

serviceAccount:
# -- Annotations to be added to the ServiceAccount
# See: https://cloudnative-pg.io/documentation/current/appendixes/object_stores/#running-inside-google-kubernetes-engine
# See: https://cloudnative-pg.io/documentation/current/appendixes/object_stores/#iam-role-for-service-account-irsa
annotations: {}
# -- Labels to be added to the ServiceAccount
labels: {}

backups:
# -- You need to configure backups manually, so backups are disabled by default.
Expand Down

0 comments on commit e77c4a5

Please sign in to comment.