helm: fix consistent indentation, chomping, and use of with (#19918)

lolsob-rspec
Erik Sundell 2022-11-10 23:24:39 +01:00 committed by GitHub
parent 2fe47bc7db
commit 8aef91d405
13 changed files with 61 additions and 43 deletions

View File

@ -1,4 +1,4 @@
{{ if .Values.mastodon.cron.removeMedia.enabled }} {{ if .Values.mastodon.cron.removeMedia.enabled -}}
apiVersion: batch/v1 apiVersion: batch/v1
kind: CronJob kind: CronJob
metadata: metadata:
@ -12,10 +12,10 @@ spec:
template: template:
metadata: metadata:
name: {{ include "mastodon.fullname" . }}-media-remove name: {{ include "mastodon.fullname" . }}-media-remove
{{- with .Values.jobAnnotations }} {{- with .Values.jobAnnotations }}
annotations: annotations:
{{- toYaml . | nindent 12 }} {{- toYaml . | nindent 12 }}
{{- end }} {{- end }}
spec: spec:
restartPolicy: OnFailure restartPolicy: OnFailure
{{- if (not .Values.mastodon.s3.enabled) }} {{- if (not .Values.mastodon.s3.enabled) }}

View File

@ -5,9 +5,9 @@ metadata:
labels: labels:
{{- include "mastodon.labels" . | nindent 4 }} {{- include "mastodon.labels" . | nindent 4 }}
spec: spec:
{{- if not .Values.autoscaling.enabled }} {{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }} replicas: {{ .Values.replicaCount }}
{{- end }} {{- end }}
selector: selector:
matchLabels: matchLabels:
{{- include "mastodon.selectorLabels" . | nindent 6 }} {{- include "mastodon.selectorLabels" . | nindent 6 }}
@ -31,8 +31,10 @@ spec:
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
serviceAccountName: {{ include "mastodon.serviceAccountName" . }} serviceAccountName: {{ include "mastodon.serviceAccountName" . }}
{{- with .Values.podSecurityContext }}
securityContext: securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }}
{{- if (not .Values.mastodon.s3.enabled) }} {{- if (not .Values.mastodon.s3.enabled) }}
# ensure we run on the same node as the other rails components; only # ensure we run on the same node as the other rails components; only
# required when using PVCs that are ReadWriteOnce # required when using PVCs that are ReadWriteOnce
@ -95,7 +97,7 @@ spec:
secretKeyRef: secretKeyRef:
name: {{ .Values.mastodon.s3.existingSecret }} name: {{ .Values.mastodon.s3.existingSecret }}
key: AWS_ACCESS_KEY_ID key: AWS_ACCESS_KEY_ID
{{- end -}} {{- end }}
{{- if .Values.mastodon.smtp.existingSecret }} {{- if .Values.mastodon.smtp.existingSecret }}
- name: "SMTP_LOGIN" - name: "SMTP_LOGIN"
valueFrom: valueFrom:
@ -108,7 +110,7 @@ spec:
secretKeyRef: secretKeyRef:
name: {{ .Values.mastodon.smtp.existingSecret }} name: {{ .Values.mastodon.smtp.existingSecret }}
key: password key: password
{{- end -}} {{- end }}
{{- if (not .Values.mastodon.s3.enabled) }} {{- if (not .Values.mastodon.s3.enabled) }}
volumeMounts: volumeMounts:
- name: assets - name: assets

View File

@ -5,9 +5,9 @@ metadata:
labels: labels:
{{- include "mastodon.labels" . | nindent 4 }} {{- include "mastodon.labels" . | nindent 4 }}
spec: spec:
{{- if not .Values.autoscaling.enabled }} {{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }} replicas: {{ .Values.replicaCount }}
{{- end }} {{- end }}
selector: selector:
matchLabels: matchLabels:
{{- include "mastodon.selectorLabels" . | nindent 6 }} {{- include "mastodon.selectorLabels" . | nindent 6 }}
@ -29,12 +29,16 @@ spec:
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
serviceAccountName: {{ include "mastodon.serviceAccountName" . }} serviceAccountName: {{ include "mastodon.serviceAccountName" . }}
{{- with .Values.podSecurityContext }}
securityContext: securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }}
containers: containers:
- name: {{ .Chart.Name }} - name: {{ .Chart.Name }}
{{- with .Values.securityContext }}
securityContext: securityContext:
{{- toYaml .Values.securityContext | nindent 12 }} {{- toYaml . | nindent 12 }}
{{- end }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }} imagePullPolicy: {{ .Values.image.pullPolicy }}
command: command:
@ -68,8 +72,10 @@ spec:
httpGet: httpGet:
path: /api/v1/streaming/health path: /api/v1/streaming/health
port: streaming port: streaming
{{- with .Values.resources }}
resources: resources:
{{- toYaml .Values.resources | nindent 12 }} {{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.nodeSelector }} {{- with .Values.nodeSelector }}
nodeSelector: nodeSelector:
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}

View File

@ -5,9 +5,9 @@ metadata:
labels: labels:
{{- include "mastodon.labels" . | nindent 4 }} {{- include "mastodon.labels" . | nindent 4 }}
spec: spec:
{{- if not .Values.autoscaling.enabled }} {{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }} replicas: {{ .Values.replicaCount }}
{{- end }} {{- end }}
selector: selector:
matchLabels: matchLabels:
{{- include "mastodon.selectorLabels" . | nindent 6 }} {{- include "mastodon.selectorLabels" . | nindent 6 }}
@ -16,9 +16,9 @@ spec:
template: template:
metadata: metadata:
annotations: annotations:
{{- with .Values.podAnnotations }} {{- with .Values.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
{{- include "mastodon.rollingPodAnnotations" . | nindent 8 }} {{- include "mastodon.rollingPodAnnotations" . | nindent 8 }}
labels: labels:
@ -31,8 +31,10 @@ spec:
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
serviceAccountName: {{ include "mastodon.serviceAccountName" . }} serviceAccountName: {{ include "mastodon.serviceAccountName" . }}
{{- with .Values.podSecurityContext }}
securityContext: securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }}
{{- if (not .Values.mastodon.s3.enabled) }} {{- if (not .Values.mastodon.s3.enabled) }}
volumes: volumes:
- name: assets - name: assets
@ -44,8 +46,10 @@ spec:
{{- end }} {{- end }}
containers: containers:
- name: {{ .Chart.Name }} - name: {{ .Chart.Name }}
{{- with .Values.securityContext }}
securityContext: securityContext:
{{- toYaml .Values.securityContext | nindent 12 }} {{- toYaml . | nindent 12 }}
{{- end }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }} imagePullPolicy: {{ .Values.image.pullPolicy }}
command: command:
@ -83,7 +87,7 @@ spec:
secretKeyRef: secretKeyRef:
name: {{ .Values.mastodon.s3.existingSecret }} name: {{ .Values.mastodon.s3.existingSecret }}
key: AWS_ACCESS_KEY_ID key: AWS_ACCESS_KEY_ID
{{- end -}} {{- end }}
{{- if (not .Values.mastodon.s3.enabled) }} {{- if (not .Values.mastodon.s3.enabled) }}
volumeMounts: volumeMounts:
- name: assets - name: assets
@ -108,8 +112,10 @@ spec:
port: http port: http
failureThreshold: 30 failureThreshold: 30
periodSeconds: 5 periodSeconds: 5
{{- with .Values.resources }}
resources: resources:
{{- toYaml .Values.resources | nindent 12 }} {{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.nodeSelector }} {{- with .Values.nodeSelector }}
nodeSelector: nodeSelector:
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}

View File

@ -1,4 +1,4 @@
{{- if .Values.autoscaling.enabled }} {{- if .Values.autoscaling.enabled -}}
apiVersion: autoscaling/v2beta1 apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler kind: HorizontalPodAutoscaler
metadata: metadata:
@ -13,16 +13,16 @@ spec:
minReplicas: {{ .Values.autoscaling.minReplicas }} minReplicas: {{ .Values.autoscaling.minReplicas }}
maxReplicas: {{ .Values.autoscaling.maxReplicas }} maxReplicas: {{ .Values.autoscaling.maxReplicas }}
metrics: metrics:
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }} {{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource - type: Resource
resource: resource:
name: cpu name: cpu
targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
{{- end }} {{- end }}
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource - type: Resource
resource: resource:
name: memory name: memory
targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
{{- end }} {{- end }}
{{- end }} {{- end }}

View File

@ -2,7 +2,7 @@
{{- $fullName := include "mastodon.fullname" . -}} {{- $fullName := include "mastodon.fullname" . -}}
{{- $webPort := .Values.mastodon.web.port -}} {{- $webPort := .Values.mastodon.web.port -}}
{{- $streamingPort := .Values.mastodon.streaming.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 apiVersion: networking.k8s.io/v1
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} {{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1beta1 apiVersion: networking.k8s.io/v1beta1

View File

@ -12,10 +12,10 @@ spec:
template: template:
metadata: metadata:
name: {{ include "mastodon.fullname" . }}-assets-precompile name: {{ include "mastodon.fullname" . }}-assets-precompile
{{- with .Values.jobAnnotations }} {{- with .Values.jobAnnotations }}
annotations: annotations:
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
spec: spec:
restartPolicy: Never restartPolicy: Never
{{- if (not .Values.mastodon.s3.enabled) }} {{- if (not .Values.mastodon.s3.enabled) }}

View File

@ -1,4 +1,4 @@
{{- if .Values.elasticsearch.enabled }} {{- if .Values.elasticsearch.enabled -}}
apiVersion: batch/v1 apiVersion: batch/v1
kind: Job kind: Job
metadata: metadata:
@ -13,10 +13,10 @@ spec:
template: template:
metadata: metadata:
name: {{ include "mastodon.fullname" . }}-chewy-upgrade name: {{ include "mastodon.fullname" . }}-chewy-upgrade
{{- with .Values.jobAnnotations }} {{- with .Values.jobAnnotations }}
annotations: annotations:
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
spec: spec:
restartPolicy: Never restartPolicy: Never
{{- if (not .Values.mastodon.s3.enabled) }} {{- if (not .Values.mastodon.s3.enabled) }}

View File

@ -1,4 +1,4 @@
{{- if .Values.mastodon.createAdmin.enabled }} {{- if .Values.mastodon.createAdmin.enabled -}}
apiVersion: batch/v1 apiVersion: batch/v1
kind: Job kind: Job
metadata: metadata:
@ -13,10 +13,10 @@ spec:
template: template:
metadata: metadata:
name: {{ include "mastodon.fullname" . }}-create-admin name: {{ include "mastodon.fullname" . }}-create-admin
{{- with .Values.jobAnnotations }} {{- with .Values.jobAnnotations }}
annotations: annotations:
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
spec: spec:
restartPolicy: Never restartPolicy: Never
{{- if (not .Values.mastodon.s3.enabled) }} {{- if (not .Values.mastodon.s3.enabled) }}

View File

@ -12,10 +12,10 @@ spec:
template: template:
metadata: metadata:
name: {{ include "mastodon.fullname" . }}-db-migrate name: {{ include "mastodon.fullname" . }}-db-migrate
{{- with .Values.jobAnnotations }} {{- with .Values.jobAnnotations }}
annotations: annotations:
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
spec: spec:
restartPolicy: Never restartPolicy: Never
{{- if (not .Values.mastodon.s3.enabled) }} {{- if (not .Values.mastodon.s3.enabled) }}

View File

@ -1,4 +1,4 @@
{{- if (not .Values.mastodon.s3.enabled) }} {{- if (not .Values.mastodon.s3.enabled) -}}
apiVersion: v1 apiVersion: v1
kind: PersistentVolumeClaim kind: PersistentVolumeClaim
metadata: metadata:
@ -8,7 +8,9 @@ metadata:
spec: spec:
accessModes: accessModes:
- {{ .Values.mastodon.persistence.system.accessMode }} - {{ .Values.mastodon.persistence.system.accessMode }}
{{- with .Values.mastodon.persistence.assets.resources }}
resources: resources:
{{- toYaml .Values.mastodon.persistence.assets.resources | nindent 4}} {{- toYaml . | nindent 4 }}
{{- end }}
storageClassName: {{ .Values.mastodon.persistence.assets.storageClassName }} storageClassName: {{ .Values.mastodon.persistence.assets.storageClassName }}
{{- end }} {{- end }}

View File

@ -1,4 +1,4 @@
{{- if (not .Values.mastodon.s3.enabled) }} {{- if (not .Values.mastodon.s3.enabled) -}}
apiVersion: v1 apiVersion: v1
kind: PersistentVolumeClaim kind: PersistentVolumeClaim
metadata: metadata:
@ -8,7 +8,9 @@ metadata:
spec: spec:
accessModes: accessModes:
- {{ .Values.mastodon.persistence.system.accessMode }} - {{ .Values.mastodon.persistence.system.accessMode }}
{{- with .Values.mastodon.persistence.system.resources }}
resources: resources:
{{- toYaml .Values.mastodon.persistence.system.resources | nindent 4}} {{- toYaml . | nindent 4 }}
{{- end }}
storageClassName: {{ .Values.mastodon.persistence.system.storageClassName }} storageClassName: {{ .Values.mastodon.persistence.system.storageClassName }}
{{- end }} {{- end }}

View File

@ -1,4 +1,4 @@
{{- if (include "mastodon.createSecret" .) }} {{- if (include "mastodon.createSecret" .) -}}
apiVersion: v1 apiVersion: v1
kind: Secret kind: Secret
metadata: metadata:
@ -40,4 +40,4 @@ data:
password: "{{ .Values.postgresql.auth.password | b64enc }}" password: "{{ .Values.postgresql.auth.password | b64enc }}"
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- end -}} {{- end }}