diff --git a/chart/templates/cronjob-media-remove.yaml b/chart/templates/cronjob-media-remove.yaml index d3566e32d47e22fffb23794dd26e88f1a65446c2..b175f0ee75a33b8eec92ee2ca3d592f1f23dd697 100644 --- a/chart/templates/cronjob-media-remove.yaml +++ b/chart/templates/cronjob-media-remove.yaml @@ -1,4 +1,4 @@ -{{ if .Values.mastodon.cron.removeMedia.enabled }} +{{ if .Values.mastodon.cron.removeMedia.enabled -}} apiVersion: batch/v1 kind: CronJob metadata: @@ -12,10 +12,10 @@ spec: template: metadata: name: {{ include "mastodon.fullname" . }}-media-remove - {{- with .Values.jobAnnotations }} + {{- with .Values.jobAnnotations }} annotations: {{- toYaml . | nindent 12 }} - {{- end }} + {{- end }} spec: restartPolicy: OnFailure {{- if (not .Values.mastodon.s3.enabled) }} diff --git a/chart/templates/deployment-sidekiq.yaml b/chart/templates/deployment-sidekiq.yaml index 57051870f8a2ff2e574d1dc0a625ce334f7a25e5..878b01150f84c992cc268672f6be2eb3c556f8bc 100644 --- a/chart/templates/deployment-sidekiq.yaml +++ b/chart/templates/deployment-sidekiq.yaml @@ -5,9 +5,9 @@ metadata: labels: {{- include "mastodon.labels" . | nindent 4 }} spec: -{{- if not .Values.autoscaling.enabled }} + {{- if not .Values.autoscaling.enabled }} replicas: {{ .Values.replicaCount }} -{{- end }} + {{- end }} selector: matchLabels: {{- include "mastodon.selectorLabels" . | nindent 6 }} @@ -31,8 +31,10 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} serviceAccountName: {{ include "mastodon.serviceAccountName" . }} + {{- with .Values.podSecurityContext }} securityContext: - {{- toYaml .Values.podSecurityContext | nindent 8 }} + {{- toYaml . | nindent 8 }} + {{- end }} {{- if (not .Values.mastodon.s3.enabled) }} # ensure we run on the same node as the other rails components; only # required when using PVCs that are ReadWriteOnce @@ -95,7 +97,7 @@ spec: secretKeyRef: name: {{ .Values.mastodon.s3.existingSecret }} key: AWS_ACCESS_KEY_ID - {{- end -}} + {{- end }} {{- if .Values.mastodon.smtp.existingSecret }} - name: "SMTP_LOGIN" valueFrom: @@ -108,7 +110,7 @@ spec: secretKeyRef: name: {{ .Values.mastodon.smtp.existingSecret }} key: password - {{- end -}} + {{- end }} {{- if (not .Values.mastodon.s3.enabled) }} volumeMounts: - name: assets diff --git a/chart/templates/deployment-streaming.yaml b/chart/templates/deployment-streaming.yaml index a5007222c2fb31bf3cf3c022a84d24b687d7184b..5d565765ebdace04a2682eaac33c5c930e5771d6 100644 --- a/chart/templates/deployment-streaming.yaml +++ b/chart/templates/deployment-streaming.yaml @@ -5,9 +5,9 @@ metadata: labels: {{- include "mastodon.labels" . | nindent 4 }} spec: -{{- if not .Values.autoscaling.enabled }} + {{- if not .Values.autoscaling.enabled }} replicas: {{ .Values.replicaCount }} -{{- end }} + {{- end }} selector: matchLabels: {{- include "mastodon.selectorLabels" . | nindent 6 }} @@ -29,12 +29,16 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} serviceAccountName: {{ include "mastodon.serviceAccountName" . }} + {{- with .Values.podSecurityContext }} securityContext: - {{- toYaml .Values.podSecurityContext | nindent 8 }} + {{- toYaml . | nindent 8 }} + {{- end }} containers: - name: {{ .Chart.Name }} + {{- with .Values.securityContext }} securityContext: - {{- toYaml .Values.securityContext | nindent 12 }} + {{- toYaml . | nindent 12 }} + {{- end }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.image.pullPolicy }} command: @@ -68,8 +72,10 @@ spec: httpGet: path: /api/v1/streaming/health port: streaming + {{- with .Values.resources }} resources: - {{- toYaml .Values.resources | nindent 12 }} + {{- toYaml . | nindent 12 }} + {{- end }} {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} diff --git a/chart/templates/deployment-web.yaml b/chart/templates/deployment-web.yaml index 5fb316396c09596e14de2d944b2753541580a8b4..ec67481bf1ffb617400999ee9c60c6f1b21e98a0 100644 --- a/chart/templates/deployment-web.yaml +++ b/chart/templates/deployment-web.yaml @@ -5,9 +5,9 @@ metadata: labels: {{- include "mastodon.labels" . | nindent 4 }} spec: -{{- if not .Values.autoscaling.enabled }} + {{- if not .Values.autoscaling.enabled }} replicas: {{ .Values.replicaCount }} -{{- end }} + {{- end }} selector: matchLabels: {{- include "mastodon.selectorLabels" . | nindent 6 }} @@ -16,9 +16,9 @@ spec: template: metadata: annotations: - {{- with .Values.podAnnotations }} + {{- with .Values.podAnnotations }} {{- toYaml . | nindent 8 }} - {{- end }} + {{- end }} # roll the pods to pick up any db migrations or other changes {{- include "mastodon.rollingPodAnnotations" . | nindent 8 }} labels: @@ -31,8 +31,10 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} serviceAccountName: {{ include "mastodon.serviceAccountName" . }} + {{- with .Values.podSecurityContext }} securityContext: - {{- toYaml .Values.podSecurityContext | nindent 8 }} + {{- toYaml . | nindent 8 }} + {{- end }} {{- if (not .Values.mastodon.s3.enabled) }} volumes: - name: assets @@ -44,8 +46,10 @@ spec: {{- end }} containers: - name: {{ .Chart.Name }} + {{- with .Values.securityContext }} securityContext: - {{- toYaml .Values.securityContext | nindent 12 }} + {{- toYaml . | nindent 12 }} + {{- end }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.image.pullPolicy }} command: @@ -83,7 +87,7 @@ spec: secretKeyRef: name: {{ .Values.mastodon.s3.existingSecret }} key: AWS_ACCESS_KEY_ID - {{- end -}} + {{- end }} {{- if (not .Values.mastodon.s3.enabled) }} volumeMounts: - name: assets @@ -108,8 +112,10 @@ spec: port: http failureThreshold: 30 periodSeconds: 5 + {{- with .Values.resources }} resources: - {{- toYaml .Values.resources | nindent 12 }} + {{- toYaml . | nindent 12 }} + {{- end }} {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} diff --git a/chart/templates/hpa.yaml b/chart/templates/hpa.yaml index 3f9aa8a93bf1cdaf214076c215e4fa8bf88ebbe0..b23b2cb168de5b516d5b3b925bd9e84d19e1ebf5 100644 --- a/chart/templates/hpa.yaml +++ b/chart/templates/hpa.yaml @@ -1,4 +1,4 @@ -{{- if .Values.autoscaling.enabled }} +{{- if .Values.autoscaling.enabled -}} apiVersion: autoscaling/v2beta1 kind: HorizontalPodAutoscaler metadata: @@ -13,16 +13,16 @@ spec: minReplicas: {{ .Values.autoscaling.minReplicas }} maxReplicas: {{ .Values.autoscaling.maxReplicas }} metrics: - {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} - type: Resource resource: name: cpu targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} - {{- end }} - {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} - type: Resource resource: name: memory targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} - {{- end }} + {{- end }} {{- end }} diff --git a/chart/templates/ingress.yaml b/chart/templates/ingress.yaml index 0866382973570fcdb879a81e5bf8afc36a9b62f8..e5c5e1dc67b49bd7c8be061bdc7e9dbd8eb276b9 100644 --- a/chart/templates/ingress.yaml +++ b/chart/templates/ingress.yaml @@ -2,7 +2,7 @@ {{- $fullName := include "mastodon.fullname" . -}} {{- $webPort := .Values.mastodon.web.port -}} {{- $streamingPort := .Values.mastodon.streaming.port -}} -{{- if or (.Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress") (not (.Capabilities.APIVersions.Has "networking.k8s.io/v1beta1/Ingress")) }} +{{- if or (.Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress") (not (.Capabilities.APIVersions.Has "networking.k8s.io/v1beta1/Ingress")) -}} apiVersion: networking.k8s.io/v1 {{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} apiVersion: networking.k8s.io/v1beta1 diff --git a/chart/templates/job-assets-precompile.yaml b/chart/templates/job-assets-precompile.yaml index 9bdec2ab7cf76b1f4b108d1de9f05c9d6c489134..30d54b76f508435121096f42158af1883b39e8e7 100644 --- a/chart/templates/job-assets-precompile.yaml +++ b/chart/templates/job-assets-precompile.yaml @@ -12,10 +12,10 @@ spec: template: metadata: name: {{ include "mastodon.fullname" . }}-assets-precompile - {{- with .Values.jobAnnotations }} + {{- with .Values.jobAnnotations }} annotations: {{- toYaml . | nindent 8 }} - {{- end }} + {{- end }} spec: restartPolicy: Never {{- if (not .Values.mastodon.s3.enabled) }} diff --git a/chart/templates/job-chewy-upgrade.yaml b/chart/templates/job-chewy-upgrade.yaml index 556133dd32f09918e213b88c24568fb6c8c73818..5b22a861054db02f707ad13ea7bfef9a2ee57c80 100644 --- a/chart/templates/job-chewy-upgrade.yaml +++ b/chart/templates/job-chewy-upgrade.yaml @@ -1,4 +1,4 @@ -{{- if .Values.elasticsearch.enabled }} +{{- if .Values.elasticsearch.enabled -}} apiVersion: batch/v1 kind: Job metadata: @@ -13,10 +13,10 @@ spec: template: metadata: name: {{ include "mastodon.fullname" . }}-chewy-upgrade - {{- with .Values.jobAnnotations }} + {{- with .Values.jobAnnotations }} annotations: {{- toYaml . | nindent 8 }} - {{- end }} + {{- end }} spec: restartPolicy: Never {{- if (not .Values.mastodon.s3.enabled) }} diff --git a/chart/templates/job-create-admin.yaml b/chart/templates/job-create-admin.yaml index 94d39dcbb56102b9b7c3426bb63eff2643dee0ee..f28cdab4187a2ecfefd09533deff17b5f07b24c9 100644 --- a/chart/templates/job-create-admin.yaml +++ b/chart/templates/job-create-admin.yaml @@ -1,4 +1,4 @@ -{{- if .Values.mastodon.createAdmin.enabled }} +{{- if .Values.mastodon.createAdmin.enabled -}} apiVersion: batch/v1 kind: Job metadata: @@ -13,10 +13,10 @@ spec: template: metadata: name: {{ include "mastodon.fullname" . }}-create-admin - {{- with .Values.jobAnnotations }} + {{- with .Values.jobAnnotations }} annotations: {{- toYaml . | nindent 8 }} - {{- end }} + {{- end }} spec: restartPolicy: Never {{- if (not .Values.mastodon.s3.enabled) }} diff --git a/chart/templates/job-db-migrate.yaml b/chart/templates/job-db-migrate.yaml index e1544d2b66d5b0e08ac1d91ca4edeba0b8559df6..db09c6ea2b2668c1f0fec36ea9915838b2428cc9 100644 --- a/chart/templates/job-db-migrate.yaml +++ b/chart/templates/job-db-migrate.yaml @@ -12,10 +12,10 @@ spec: template: metadata: name: {{ include "mastodon.fullname" . }}-db-migrate - {{- with .Values.jobAnnotations }} + {{- with .Values.jobAnnotations }} annotations: {{- toYaml . | nindent 8 }} - {{- end }} + {{- end }} spec: restartPolicy: Never {{- if (not .Values.mastodon.s3.enabled) }} diff --git a/chart/templates/pvc-assets.yaml b/chart/templates/pvc-assets.yaml index 58b2179df0c8dcda2724e95a123b3b8eebc9c4d7..36d555898e744c7594bdb11eed068c4920193282 100644 --- a/chart/templates/pvc-assets.yaml +++ b/chart/templates/pvc-assets.yaml @@ -1,4 +1,4 @@ -{{- if (not .Values.mastodon.s3.enabled) }} +{{- if (not .Values.mastodon.s3.enabled) -}} apiVersion: v1 kind: PersistentVolumeClaim metadata: @@ -8,7 +8,9 @@ metadata: spec: accessModes: - {{ .Values.mastodon.persistence.system.accessMode }} + {{- with .Values.mastodon.persistence.assets.resources }} resources: - {{- toYaml .Values.mastodon.persistence.assets.resources | nindent 4}} + {{- toYaml . | nindent 4 }} + {{- end }} storageClassName: {{ .Values.mastodon.persistence.assets.storageClassName }} {{- end }} diff --git a/chart/templates/pvc-system.yaml b/chart/templates/pvc-system.yaml index 52398f0daf8f08ae37d6395986b22d3acfc0e1cf..9865346eaac5901bc9d47691cf6e46796491a908 100644 --- a/chart/templates/pvc-system.yaml +++ b/chart/templates/pvc-system.yaml @@ -1,4 +1,4 @@ -{{- if (not .Values.mastodon.s3.enabled) }} +{{- if (not .Values.mastodon.s3.enabled) -}} apiVersion: v1 kind: PersistentVolumeClaim metadata: @@ -8,7 +8,9 @@ metadata: spec: accessModes: - {{ .Values.mastodon.persistence.system.accessMode }} + {{- with .Values.mastodon.persistence.system.resources }} resources: - {{- toYaml .Values.mastodon.persistence.system.resources | nindent 4}} + {{- toYaml . | nindent 4 }} + {{- end }} storageClassName: {{ .Values.mastodon.persistence.system.storageClassName }} {{- end }} diff --git a/chart/templates/secrets.yaml b/chart/templates/secrets.yaml index d7ac936ce50277a3122ce9aca28a5af724bf0c0e..d1776ac590b6ce57e1a2bd5a779aec68f593045a 100644 --- a/chart/templates/secrets.yaml +++ b/chart/templates/secrets.yaml @@ -1,4 +1,4 @@ -{{- if (include "mastodon.createSecret" .) }} +{{- if (include "mastodon.createSecret" .) -}} apiVersion: v1 kind: Secret metadata: @@ -40,4 +40,4 @@ data: password: "{{ .Values.postgresql.auth.password | b64enc }}" {{- end }} {{- end }} -{{- end -}} +{{- end }}