3
0
mirror of https://github.com/mastodon/chart synced 2025-05-18 13:03:21 +00:00

Better control of labels/annotations for deployments and pods

This commit is contained in:
Tim Campbell 2024-09-10 12:41:39 +02:00
parent ba7a1de157
commit a4a59d97c2
4 changed files with 76 additions and 4 deletions

View File

@ -7,12 +7,18 @@ metadata:
name: {{ include "mastodon.fullname" $context }}-sidekiq-{{ .name }} name: {{ include "mastodon.fullname" $context }}-sidekiq-{{ .name }}
labels: labels:
{{- include "mastodon.labels" $context | nindent 4 }} {{- include "mastodon.labels" $context | nindent 4 }}
{{- with $context.Values.mastodon.sidekiq.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
app.kubernetes.io/component: sidekiq-{{ .name }} app.kubernetes.io/component: sidekiq-{{ .name }}
app.kubernetes.io/part-of: rails app.kubernetes.io/part-of: rails
annotations: annotations:
{{- with $context.Values.deploymentAnnotations }} {{- with $context.Values.deploymentAnnotations }}
{{- toYaml . | nindent 4 }} {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
{{- with $context.Values.mastodon.sidekiq.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec: spec:
{{- if (has "scheduler" .queues) }} {{- if (has "scheduler" .queues) }}
{{- if (gt (int .replicas) 1) }} {{- if (gt (int .replicas) 1) }}
@ -37,6 +43,9 @@ spec:
{{- with $context.Values.podAnnotations }} {{- with $context.Values.podAnnotations }}
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
{{- with $context.Values.mastodon.sidekiq.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
# roll the pods to pick up any db migrations or other changes # roll the pods to pick up any db migrations or other changes
{{- include "mastodon.rollingPodAnnotations" $context | nindent 8 }} {{- include "mastodon.rollingPodAnnotations" $context | nindent 8 }}
checksum/config-secrets-smtp: {{ include ( print $.Template.BasePath "/secret-smtp.yaml" ) $context | sha256sum | quote }} checksum/config-secrets-smtp: {{ include ( print $.Template.BasePath "/secret-smtp.yaml" ) $context | sha256sum | quote }}
@ -44,6 +53,9 @@ spec:
{{- include "mastodon.globalLabels" $context | nindent 8 }} {{- include "mastodon.globalLabels" $context | nindent 8 }}
{{- include "mastodon.selectorLabels" $context | nindent 8 }} {{- include "mastodon.selectorLabels" $context | nindent 8 }}
{{- include "mastodon.statsdExporterLabels" $context | nindent 8 }} {{- include "mastodon.statsdExporterLabels" $context | nindent 8 }}
{{- with $context.Values.mastodon.sidekiq.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
app.kubernetes.io/component: sidekiq-{{ .name }} app.kubernetes.io/component: sidekiq-{{ .name }}
app.kubernetes.io/part-of: rails app.kubernetes.io/part-of: rails
spec: spec:

View File

@ -4,8 +4,14 @@ metadata:
name: {{ include "mastodon.fullname" . }}-streaming name: {{ include "mastodon.fullname" . }}-streaming
labels: labels:
{{- include "mastodon.labels" . | nindent 4 }} {{- include "mastodon.labels" . | nindent 4 }}
{{- with .Values.mastodon.streaming.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
annotations: annotations:
{{- with (default .Values.deploymentAnnotations .Values.mastodon.streaming.deploymentAnnotations) }} {{- with .Values.deploymentAnnotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.mastodon.web.annotations }}
{{- toYaml . | nindent 4 }} {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
spec: spec:
@ -23,7 +29,10 @@ spec:
template: template:
metadata: metadata:
annotations: annotations:
{{- with (default .Values.podAnnotations .Values.mastodon.streaming.podAnnotations) }} {{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.mastodon.streaming.podAnnotations }}
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
# roll the pods to pick up any db migrations or other changes # roll the pods to pick up any db migrations or other changes
@ -31,6 +40,9 @@ spec:
labels: labels:
{{- include "mastodon.globalLabels" . | nindent 8 }} {{- include "mastodon.globalLabels" . | nindent 8 }}
{{- include "mastodon.selectorLabels" . | nindent 8 }} {{- include "mastodon.selectorLabels" . | nindent 8 }}
{{- with .Values.mastodon.streaming.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
app.kubernetes.io/component: streaming app.kubernetes.io/component: streaming
spec: spec:
{{- with .Values.imagePullSecrets }} {{- with .Values.imagePullSecrets }}

View File

@ -4,8 +4,14 @@ metadata:
name: {{ include "mastodon.fullname" . }}-web name: {{ include "mastodon.fullname" . }}-web
labels: labels:
{{- include "mastodon.labels" . | nindent 4 }} {{- include "mastodon.labels" . | nindent 4 }}
{{- with .Values.mastodon.web.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
annotations: annotations:
{{- with (default .Values.deploymentAnnotations .Values.mastodon.web.deploymentAnnotations) }} {{- with .Values.deploymentAnnotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.mastodon.web.annotations }}
{{- toYaml . | nindent 4 }} {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
spec: spec:
@ -24,7 +30,10 @@ spec:
template: template:
metadata: metadata:
annotations: annotations:
{{- with (default .Values.podAnnotations .Values.mastodon.web.podAnnotations) }} {{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.mastodon.web.podAnnotations }}
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
# roll the pods to pick up any db migrations or other changes # roll the pods to pick up any db migrations or other changes
@ -33,6 +42,9 @@ spec:
{{- include "mastodon.globalLabels" . | nindent 8 }} {{- include "mastodon.globalLabels" . | nindent 8 }}
{{- include "mastodon.selectorLabels" . | nindent 8 }} {{- include "mastodon.selectorLabels" . | nindent 8 }}
{{- include "mastodon.statsdExporterLabels" . | nindent 8 }} {{- include "mastodon.statsdExporterLabels" . | nindent 8 }}
{{- with .Values.mastodon.web.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
app.kubernetes.io/component: web app.kubernetes.io/component: web
app.kubernetes.io/part-of: rails app.kubernetes.io/part-of: rails
spec: spec:

View File

@ -141,6 +141,18 @@ mastodon:
resources: {} resources: {}
# -- Affinity for all Sidekiq Deployments unless overwritten, overwrites .Values.affinity # -- Affinity for all Sidekiq Deployments unless overwritten, overwrites .Values.affinity
affinity: {} affinity: {}
# -- Annotations to apply to the deployment object(s) for sidekiq.
# -- These are applied in addition to deploymentAnnotations.
annotations: {}
# -- Labels to apply to the deployment object(s) for sidekiq.
# -- These are applied in addition to mastodon.labels.
labels: {}
# -- Annotations to apply to the sidekiq pods.
# -- These are applied in addition to the global podAnnotations.
podAnnotations: {}
# -- Labels to apply to the sidekiq pods.
# -- These are applied in addition to mastodon.labels.
podLabels: {}
# Rollout strategy to use when updating pods. # Rollout strategy to use when updating pods.
# Recreate will help reduce the number of retried jobs when updating when # Recreate will help reduce the number of retried jobs when updating when
# the code introduces a new job as the pods are all replaced immediately. # the code introduces a new job as the pods are all replaced immediately.
@ -255,6 +267,18 @@ mastodon:
replicas: 1 replicas: 1
# -- Affinity for Streaming Pods, overwrites .Values.affinity # -- Affinity for Streaming Pods, overwrites .Values.affinity
affinity: {} affinity: {}
# -- Annotations to apply to the deployment object for streaming.
# -- These are applied in addition to deploymentAnnotations.
annotations: {}
# -- Labels to apply to the deployment object for streaming.
# -- These are applied in addition to mastodon.labels.
labels: {}
# -- Annotations to apply to the streaming pods.
# -- These are applied in addition to the global podAnnotations.
podAnnotations: {}
# -- Labels to apply to the streaming pods.
# -- These are applied in addition to mastodon.labels.
podLabels: {}
# Rollout strategy to use when updating pods # Rollout strategy to use when updating pods
# ref: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#strategy # ref: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#strategy
updateStrategy: updateStrategy:
@ -301,6 +325,18 @@ mastodon:
replicas: 1 replicas: 1
# -- Affinity for Web Pods, overwrites .Values.affinity # -- Affinity for Web Pods, overwrites .Values.affinity
affinity: {} affinity: {}
# -- Annotations to apply to the deployment object for web.
# -- These are applied in addition to deploymentAnnotations.
annotations: {}
# -- Labels to apply to the deployment object for web.
# -- These are applied in addition to mastodon.labels.
labels: {}
# -- Annotations to apply to the web pods.
# -- These are applied in addition to the global podAnnotations.
podAnnotations: {}
# -- Labels to apply to the web pods.
# -- These are applied in addition to mastodon.labels.
podLabels: {}
# Rollout strategy to use when updating pods # Rollout strategy to use when updating pods
# ref: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#strategy # ref: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#strategy
updateStrategy: updateStrategy: