Charts: allow setting of labels globally or for a given component

This commit is contained in:
Ben Banfield-Zanin committed 2024-11-22 16:31:22 +00:00
1 parent 641ca76b37
commit 5b4ffb3fe7
16 files changed
+175 -55

No files matched your search

+6 -3
View File
@@ -41,6 +41,12 @@
"ingress": {
"$ref": "file://./../../matrix-stack/sub_schemas/ingress.json"
},
"labels": {
"$ref": "file://./../../matrix-stack/sub_schemas/labels.json"
},
"annotations": {
"$ref": "file://./../../matrix-stack/sub_schemas/workloadAnnotations.json"
},
"containersSecurityContext": {
"$ref": "file://./../../matrix-stack/sub_schemas/containersSecurityContext.json"
},
@@ -55,9 +61,6 @@
},
"tolerations": {
"$ref": "file://./../../matrix-stack/sub_schemas/tolerations.json"
},
"annotations": {
"$ref": "file://./../../matrix-stack/sub_schemas/workloadAnnotations.json"
}
}
}
+2 -1
View File
@@ -20,9 +20,10 @@ defaultMatrixServer: {}
replicas: 2
{{ sub_schema_values.image(registry='docker.io', repository='vectorim/element-web') }}
{{ sub_schema_values.ingress() }}
{{ sub_schema_values.labels() }}
{{ sub_schema_values.workloadAnnotations() }}
{{ sub_schema_values.containersSecurityContext() }}
{{ sub_schema_values.nodeSelector() }}
{{ sub_schema_values.podSecurityContext(user_id='10004', group_id='10004') }}
{{ sub_schema_values.resources(requests_memory='50Mi', requests_cpu='50m', limits_memory='200Mi') }}
{{ sub_schema_values.tolerations() }}
{{ sub_schema_values.workloadAnnotations() }}
+1 -1
View File
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
{{- define "element-io.element-web.labels" -}}
app.kubernetes.io/part-of: matrix-stack
{{ include "element-io.ess-library.labels.common" (list $ .Values.labels) }}
app.kubernetes.io/component: matrix-client
app.kubernetes.io/name: element-web
app.kubernetes.io/instance: {{ .Release.Name }}-element-web
+18 -6
View File
@@ -40,6 +40,12 @@
"server_name": {
"type": "string"
},
"labels": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"imagePullSecrets": {
"type": "array",
"items": {
@@ -141,6 +147,18 @@
},
"additionalProperties": false
},
"labels": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"annotations": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"containersSecurityContext": {
"properties": {
"allowPrivilegeEscalation": {
@@ -322,12 +340,6 @@
"type": "object",
"additionalProperties": false
}
},
"annotations": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"additionalProperties": false
+9 -3
View File
@@ -12,6 +12,9 @@ global:
## It can not change after the initial deployment.
# server_name: ess.localhost
## Labels to add to all manifest in this chart and all sub-charts
labels: {}
## A list of Secrets in this namespace to use as pull Secrets.
## Ignored if a given component specifies its own pull Secrets.
## e.g.
@@ -75,6 +78,12 @@ ingress:
service:
type: ClusterIP
## Labels to add to all manifest in this chart
labels: {}
## Defines the annotations to add to the workload
# annotations: {}
## A subset of SecurityContext. ContainersSecurityContext holds pod-level security attributes and common container settings
containersSecurityContext:
## Controls whether a process can gain more privileges than its parent process.
@@ -181,6 +190,3 @@ resources:
## value:
tolerations: []
## Defines the annotations to add to the workload
# annotations: {}
+24
View File
@@ -0,0 +1,24 @@
# Copyright 2024 New Vector Ltd
#
# SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
{{- define "element-io.ess-library.labels.common" -}}
{{- $ := index . 0 }}
{{- $userLabels := dict -}}
{{- $userLabels = merge $userLabels $.Values.global.ess.labels }}
{{- $userLabels = merge $userLabels ( index . 1) }}
{{- /* These labels are owned by the chart, don't allow overriding */}}
{{- $userLabels = unset $userLabels "helm.sh/chart.sh" }}
{{- $userLabels = unset $userLabels "app.kubernetes.io/managed-by" }}
{{- $userLabels = unset $userLabels "app.kubernetes.io/part-of" }}
{{- $userLabels = unset $userLabels "app.kubernetes.io/component" }}
{{- $userLabels = unset $userLabels "app.kubernetes.io/name" }}
{{- $userLabels = unset $userLabels "app.kubernetes.io/instance" }}
{{- $userLabels = unset $userLabels "app.kubernetes.io/version" }}
{{- if $userLabels }}
{{- toYaml $userLabels }}
{{- end }}
helm.sh/chart: {{ $.Chart.Name }}-{{ $.Chart.Version | replace "+" "_" }}
app.kubernetes.io/managed-by: {{ $.Release.Service }}
app.kubernetes.io/part-of: matrix-stack
{{- end }}
@@ -8,6 +8,9 @@
"server_name": {
"type": "string"
},
"labels": {
"$ref": "file://./../../matrix-stack/sub_schemas/labels.json"
},
"imagePullSecrets": {
"type": "array",
"items": {
@@ -0,0 +1,6 @@
{
"type": "object",
"additionalProperties": {
"type": "string"
}
}
@@ -16,6 +16,7 @@ global:
## The server name of the Matrix Stack. This gets embedded in user IDs & room IDs
## It can not change after the initial deployment.
# server_name: ess.localhost
{{ labels(global=true) | indent(4) }}
## A list of Secrets in this namespace to use as pull Secrets.
## Ignored if a given component specifies its own pull Secrets.
@@ -141,6 +142,11 @@ global:
type: ClusterIP
{%- endmacro %}
{% macro labels(global=false, key='labels') %}
## Labels to add to all manifest in this chart{{ ' and all sub-charts' if global else '' }}
labels: {}
{%- endmacro %}
{% macro nodeSelector(key='nodeSelector') %}
## NodeSelector is a selector which must be true for the pod to fit on a node. Selector which must match a node's labels for the pod to be scheduled on that node. More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/
# {{ key }}: {}
+6
View File
@@ -13,6 +13,12 @@
"server_name": {
"type": "string"
},
"labels": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"imagePullSecrets": {
"type": "array",
"items": {
+3
View File
@@ -12,6 +12,9 @@ global:
## It can not change after the initial deployment.
# server_name: ess.localhost
## Labels to add to all manifest in this chart and all sub-charts
labels: {}
## A list of Secrets in this namespace to use as pull Secrets.
## Ignored if a given component specifies its own pull Secrets.
## e.g.
+18 -9
View File
@@ -107,6 +107,12 @@
"image": {
"$ref": "file://./../../matrix-stack/sub_schemas/image.json"
},
"labels": {
"$ref": "file://./../../matrix-stack/sub_schemas/labels.json"
},
"annotations": {
"$ref": "file://./../../matrix-stack/sub_schemas/workloadAnnotations.json"
},
"containersSecurityContext": {
"$ref": "file://./../../matrix-stack/sub_schemas/containersSecurityContext.json"
},
@@ -131,9 +137,6 @@
"tolerations": {
"$ref": "file://./../../matrix-stack/sub_schemas/tolerations.json"
},
"annotations": {
"$ref": "file://./../../matrix-stack/sub_schemas/workloadAnnotations.json"
},
"workers": {
"type": "object",
"properties": {
@@ -203,6 +206,12 @@
"image": {
"$ref": "file://./../../matrix-stack/sub_schemas/image.json"
},
"labels": {
"$ref": "file://./../../matrix-stack/sub_schemas/labels.json"
},
"annotations": {
"$ref": "file://./../../matrix-stack/sub_schemas/workloadAnnotations.json"
},
"containersSecurityContext": {
"$ref": "file://./../../matrix-stack/sub_schemas/containersSecurityContext.json"
},
@@ -220,9 +229,6 @@
},
"tolerations": {
"$ref": "file://./../../matrix-stack/sub_schemas/tolerations.json"
},
"annotations": {
"$ref": "file://./../../matrix-stack/sub_schemas/workloadAnnotations.json"
}
}
},
@@ -232,6 +238,12 @@
"image": {
"$ref": "file://./../../matrix-stack/sub_schemas/image.json"
},
"labels": {
"$ref": "file://./../../matrix-stack/sub_schemas/labels.json"
},
"annotations": {
"$ref": "file://./../../matrix-stack/sub_schemas/workloadAnnotations.json"
},
"containersSecurityContext": {
"$ref": "file://./../../matrix-stack/sub_schemas/containersSecurityContext.json"
},
@@ -246,9 +258,6 @@
},
"tolerations": {
"$ref": "file://./../../matrix-stack/sub_schemas/tolerations.json"
},
"annotations": {
"$ref": "file://./../../matrix-stack/sub_schemas/workloadAnnotations.json"
}
}
}
+6 -3
View File
@@ -77,6 +77,8 @@ logging:
levelOverrides: {}
{{ sub_schema_values.image(registry='docker.io', repository='matrixdotorg/synapse') }}
{{ sub_schema_values.ingress() }}
{{ sub_schema_values.labels() }}
{{ sub_schema_values.workloadAnnotations() }}
{{ sub_schema_values.containersSecurityContext() }}
{{ sub_schema_values.extraEnv() }}
{{ sub_schema_values.hostAliases() }}
@@ -85,24 +87,25 @@ logging:
{{ sub_schema_values.resources(requests_memory='100Mi', requests_cpu='100m', limits_memory='4Gi') }}
{{ sub_schema_values.serviceMonitors() }}
{{ sub_schema_values.tolerations() }}
{{ sub_schema_values.workloadAnnotations() }}
haproxy:
replicas: 2
{{ sub_schema_values.image(registry='docker.io', repository='library/haproxy', tag='3.0-alpine') | indent(2) }}
{{ sub_schema_values.labels() | indent(2) }}
{{ sub_schema_values.workloadAnnotations() | indent(2) }}
{{ sub_schema_values.containersSecurityContext() | indent(2) }}
{{ sub_schema_values.nodeSelector() | indent(2) }}
{{ sub_schema_values.podSecurityContext(user_id='10001', group_id='10001') | indent(2) }}
{{ sub_schema_values.resources(requests_memory='100Mi', requests_cpu='100m', limits_memory='200Mi') | indent(2) }}
{{ sub_schema_values.serviceMonitors() | indent(2) }}
{{ sub_schema_values.tolerations() | indent(2) }}
{{ sub_schema_values.workloadAnnotations() | indent(2) }}
redis:
{{- sub_schema_values.image(registry='docker.io', repository='library/redis', tag='7.4-alpine') | indent(2) }}
{{ sub_schema_values.labels() | indent(2) }}
{{ sub_schema_values.workloadAnnotations() | indent(2) }}
{{ sub_schema_values.containersSecurityContext() | indent(2) }}
{{ sub_schema_values.nodeSelector() | indent(2) }}
{{ sub_schema_values.podSecurityContext(user_id='10002', group_id='10002') | indent(2) }}
{{ sub_schema_values.resources(requests_memory='50Mi', requests_cpu='50m', limits_memory='50Mi') | indent(2) }}
{{ sub_schema_values.tolerations() | indent(2) }}
{{ sub_schema_values.workloadAnnotations() | indent(2) }}
+4 -2
View File
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
{{- define "element-io.synapse.labels" -}}
app.kubernetes.io/part-of: matrix-stack
{{ include "element-io.ess-library.labels.common" (list $ .Values.labels) }}
app.kubernetes.io/component: matrix-server
app.kubernetes.io/name: synapse
app.kubernetes.io/instance: {{ .Release.Name }}-synapse
@@ -12,7 +12,7 @@ k8s.element.io/synapse-instance: {{ .Release.Name }}-synapse
{{- end }}
{{- define "element-io.synapse.process.labels" -}}
app.kubernetes.io/part-of: matrix-stack
{{ include "element-io.ess-library.labels.common" (list $ .Values.labels) }}
app.kubernetes.io/component: matrix-server
app.kubernetes.io/name: synapse-{{ .ProcessType }}
app.kubernetes.io/instance: {{ .Release.Name }}-synapse-{{ .ProcessType }}
@@ -21,6 +21,7 @@ k8s.element.io/synapse-instance: {{ .Release.Name }}-synapse
{{- end }}
{{- define "element-io.synapse.redis.labels" -}}
{{ include "element-io.ess-library.labels.common" (list $ .Values.redis.labels) }}
app.kubernetes.io/part-of: matrix-stack
app.kubernetes.io/component: matrix-server-pubsub
app.kubernetes.io/name: synapse-redis
@@ -29,6 +30,7 @@ app.kubernetes.io/version: {{ .Values.redis.image.tag }}
{{- end }}
{{- define "element-io.synapse.haproxy.labels" -}}
{{ include "element-io.ess-library.labels.common" (list $ .Values.haproxy.labels) }}
app.kubernetes.io/part-of: matrix-stack
app.kubernetes.io/component: matrix-server-ingress
app.kubernetes.io/name: synapse-haproxy
+42 -18
View File
@@ -302,6 +302,12 @@
"server_name": {
"type": "string"
},
"labels": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"imagePullSecrets": {
"type": "array",
"items": {
@@ -476,6 +482,18 @@
},
"additionalProperties": false
},
"labels": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"annotations": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"containersSecurityContext": {
"properties": {
"allowPrivilegeEscalation": {
@@ -704,12 +722,6 @@
"additionalProperties": false
}
},
"annotations": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"workers": {
"type": "object",
"properties": {
@@ -1601,6 +1613,18 @@
},
"additionalProperties": false
},
"labels": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"annotations": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"containersSecurityContext": {
"properties": {
"allowPrivilegeEscalation": {
@@ -1791,12 +1815,6 @@
"type": "object",
"additionalProperties": false
}
},
"annotations": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"additionalProperties": false
@@ -1845,6 +1863,18 @@
},
"additionalProperties": false
},
"labels": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"annotations": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"containersSecurityContext": {
"properties": {
"allowPrivilegeEscalation": {
@@ -2026,12 +2056,6 @@
"type": "object",
"additionalProperties": false
}
},
"annotations": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"additionalProperties": false
+21 -9
View File
@@ -13,6 +13,9 @@ global:
## It can not change after the initial deployment.
# server_name: ess.localhost
## Labels to add to all manifest in this chart and all sub-charts
labels: {}
## A list of Secrets in this namespace to use as pull Secrets.
## Ignored if a given component specifies its own pull Secrets.
## e.g.
@@ -355,6 +358,12 @@ ingress:
service:
type: ClusterIP
## Labels to add to all manifest in this chart
labels: {}
## Defines the annotations to add to the workload
# annotations: {}
## A subset of SecurityContext. ContainersSecurityContext holds pod-level security attributes and common container settings
containersSecurityContext:
## Controls whether a process can gain more privileges than its parent process.
@@ -487,9 +496,6 @@ serviceMonitors:
tolerations: []
## Defines the annotations to add to the workload
# annotations: {}
haproxy:
replicas: 2
@@ -520,6 +526,12 @@ haproxy:
## - name: dockerhub
pullSecrets: []
## Labels to add to all manifest in this chart
labels: {}
## Defines the annotations to add to the workload
# annotations: {}
## A subset of SecurityContext. ContainersSecurityContext holds pod-level security attributes and common container settings
containersSecurityContext:
## Controls whether a process can gain more privileges than its parent process.
@@ -632,9 +644,6 @@ haproxy:
tolerations: []
## Defines the annotations to add to the workload
# annotations: {}
redis:
# Details of the image to be used
image:
@@ -663,6 +672,12 @@ redis:
## - name: dockerhub
pullSecrets: []
## Labels to add to all manifest in this chart
labels: {}
## Defines the annotations to add to the workload
# annotations: {}
## A subset of SecurityContext. ContainersSecurityContext holds pod-level security attributes and common container settings
containersSecurityContext:
## Controls whether a process can gain more privileges than its parent process.
@@ -769,6 +784,3 @@ redis:
## value:
tolerations: []
## Defines the annotations to add to the workload
# annotations: {}