Skip to content

Commit

Permalink
Merge pull request #2358 from consideRatio/pr/remove-trimsuffix-no-lo…
Browse files Browse the repository at this point in the history
…nger-needed

refactor: remove redundant trimSuffix of new lines after toYaml
  • Loading branch information
manics committed Aug 24, 2021
2 parents 6258e16 + 490dcc6 commit 6ec062d
Show file tree
Hide file tree
Showing 19 changed files with 77 additions and 77 deletions.
4 changes: 2 additions & 2 deletions jupyterhub/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -322,9 +322,9 @@ limits:
{{- if $file_details.data }}
{{- $file_key | quote }}: |
{{- if or (eq (ext $file_name) ".yaml") (eq (ext $file_name) ".yml") }}
{{- $file_details.data | toYaml | trimSuffix "\n" | nindent 2 }}{{ println }}
{{- $file_details.data | toYaml | nindent 2 }}{{ println }}
{{- else if eq (ext $file_name) ".json" }}
{{- $file_details.data | toJson | trimSuffix "\n" | nindent 2 }}{{ println }}
{{- $file_details.data | toJson | nindent 2 }}{{ println }}
{{- else if eq (ext $file_name) ".toml" }}
{{- $file_details.data | toToml | trimSuffix "\n" | nindent 2 }}{{ println }}
{{- else }}
Expand Down
22 changes: 11 additions & 11 deletions jupyterhub/templates/hub/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ spec:
matchLabels:
{{- include "jupyterhub.matchLabels" . | nindent 6 }}
strategy:
{{- .Values.hub.deploymentStrategy | toYaml | trimSuffix "\n" | nindent 4 }}
{{- .Values.hub.deploymentStrategy | toYaml | nindent 4 }}
template:
metadata:
labels:
Expand All @@ -20,14 +20,14 @@ spec:
hub.jupyter.org/network-access-proxy-http: "true"
hub.jupyter.org/network-access-singleuser: "true"
{{- with .Values.hub.labels }}
{{- . | toYaml | trimSuffix "\n" | nindent 8 }}
{{- . | toYaml | nindent 8 }}
{{- end }}
annotations:
{{- /* This lets us autorestart when the secret changes! */}}
checksum/config-map: {{ include (print .Template.BasePath "/hub/configmap.yaml") . | sha256sum }}
checksum/secret: {{ include (print .Template.BasePath "/hub/secret.yaml") . | sha256sum }}
{{- with .Values.hub.annotations }}
{{- . | toYaml | trimSuffix "\n" | nindent 8 }}
{{- . | toYaml | nindent 8 }}
{{- end }}
spec:
{{- if .Values.scheduling.podPriority.enabled }}
Expand Down Expand Up @@ -65,7 +65,7 @@ spec:
{{- end }}
{{- end }}
{{- with .Values.hub.extraVolumes }}
{{- . | toYaml | trimSuffix "\n" | nindent 8 }}
{{- . | toYaml | nindent 8 }}
{{- end }}
{{- if eq .Values.hub.db.type "sqlite-pvc" }}
- name: pvc
Expand All @@ -82,11 +82,11 @@ spec:
{{- end }}
{{- with .Values.hub.initContainers }}
initContainers:
{{- . | toYaml | trimSuffix "\n" | nindent 8 }}
{{- . | toYaml | nindent 8 }}
{{- end }}
containers:
{{- with .Values.hub.extraContainers }}
{{- . | toYaml | trimSuffix "\n" | nindent 8 }}
{{- . | toYaml | nindent 8 }}
{{- end }}
- name: hub
image: {{ .Values.hub.image.name }}:{{ .Values.hub.image.tag }}
Expand Down Expand Up @@ -153,7 +153,7 @@ spec:
name: files
{{- end }}
{{- with .Values.hub.extraVolumeMounts }}
{{- . | toYaml | trimSuffix "\n" | nindent 12 }}
{{- . | toYaml | nindent 12 }}
{{- end }}
{{- if eq .Values.hub.db.type "sqlite-pvc" }}
- mountPath: /srv/jupyterhub
Expand All @@ -164,18 +164,18 @@ spec:
{{- end }}
{{- with .Values.hub.resources }}
resources:
{{- . | toYaml | trimSuffix "\n" | nindent 12 }}
{{- . | toYaml | nindent 12 }}
{{- end }}
{{- with .Values.hub.image.pullPolicy }}
imagePullPolicy: {{ . }}
{{- end }}
{{- with .Values.hub.containerSecurityContext }}
securityContext:
{{- . | toYaml | trimSuffix "\n" | nindent 12 }}
{{- . | toYaml | nindent 12 }}
{{- end }}
{{- with .Values.hub.lifecycle }}
lifecycle:
{{- . | toYaml | trimSuffix "\n" | nindent 12 }}
{{- . | toYaml | nindent 12 }}
{{- end }}
env:
- name: PYTHONUNBUFFERED
Expand Down Expand Up @@ -231,5 +231,5 @@ spec:
port: http
{{- end }}
{{- with .Values.hub.extraPodSpec }}
{{- . | toYaml | trimSuffix "\n" | nindent 6 }}
{{- . | toYaml | nindent 6 }}
{{- end }}
4 changes: 2 additions & 2 deletions jupyterhub/templates/hub/netpol.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ spec:

{{- with .Values.hub.networkPolicy.ingress }}
# depends, but default is nothing --> hub
{{- . | toYaml | trimSuffix "\n" | nindent 4 }}
{{- . | toYaml | nindent 4 }}
{{- end }}

egress:
Expand Down Expand Up @@ -86,6 +86,6 @@ spec:

{{- with .Values.hub.networkPolicy.egress }}
# hub --> depends, but the default is everything
{{- . | toYaml | trimSuffix "\n" | nindent 4 }}
{{- . | toYaml | nindent 4 }}
{{- end }}
{{- end }}
6 changes: 3 additions & 3 deletions jupyterhub/templates/hub/pvc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ metadata:
{{- include "jupyterhub.labels" . | nindent 4 }}
{{- with .Values.hub.db.pvc.annotations }}
annotations:
{{- . | toYaml | trimSuffix "\n" | nindent 4 }}
{{- . | toYaml | nindent 4 }}
{{- end }}
spec:
{{- with .Values.hub.db.pvc.selector }}
selector:
{{- . | toYaml | trimSuffix "\n" | nindent 4 }}
{{- . | toYaml | nindent 4 }}
{{- end }}
{{- if typeIs "string" .Values.hub.db.pvc.storageClassName }}
storageClassName: {{ .Values.hub.db.pvc.storageClassName | quote }}
{{- end }}
accessModes:
{{- .Values.hub.db.pvc.accessModes | toYaml | trimSuffix "\n" | nindent 4 }}
{{- .Values.hub.db.pvc.accessModes | toYaml | nindent 4 }}
resources:
requests:
storage: {{ .Values.hub.db.pvc.storage | quote }}
Expand Down
26 changes: 13 additions & 13 deletions jupyterhub/templates/image-puller/_helpers-daemonset.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ spec:
{{- include "jupyterhub.matchLabels" . | nindent 8 }}
{{- with .Values.prePuller.annotations }}
annotations:
{{- . | toYaml | trimSuffix "\n" | nindent 8 }}
{{- . | toYaml | nindent 8 }}
{{- end }}
spec:
{{- /*
Expand Down Expand Up @@ -82,11 +82,11 @@ spec:
- echo "Pulling complete"
{{- with .Values.prePuller.resources }}
resources:
{{- . | toYaml | trimSuffix "\n" | nindent 12 }}
{{- . | toYaml | nindent 12 }}
{{- end }}
{{- with .Values.prePuller.containerSecurityContext }}
securityContext:
{{- . | toYaml | trimSuffix "\n" | nindent 12 }}
{{- . | toYaml | nindent 12 }}
{{- end }}
{{- end }}

Expand All @@ -99,11 +99,11 @@ spec:
- echo "Pulling complete"
{{- with .Values.prePuller.resources }}
resources:
{{- . | toYaml | trimSuffix "\n" | nindent 12 }}
{{- . | toYaml | nindent 12 }}
{{- end }}
{{- with .Values.prePuller.containerSecurityContext }}
securityContext:
{{- . | toYaml | trimSuffix "\n" | nindent 12 }}
{{- . | toYaml | nindent 12 }}
{{- end }}

{{- /* --- Pull extra containers' images --- */}}
Expand All @@ -116,11 +116,11 @@ spec:
- echo "Pulling complete"
{{- with $.Values.prePuller.resources }}
resources:
{{- . | toYaml | trimSuffix "\n" | nindent 12 }}
{{- . | toYaml | nindent 12 }}
{{- end }}
{{- with $.Values.prePuller.containerSecurityContext }}
securityContext:
{{- . | toYaml | trimSuffix "\n" | nindent 12 }}
{{- . | toYaml | nindent 12 }}
{{- end }}
{{- end }}
Expand All @@ -137,11 +137,11 @@ spec:
- echo "Pulling complete"
{{- with $.Values.prePuller.resources }}
resources:
{{- . | toYaml | trimSuffix "\n" | nindent 12 }}
{{- . | toYaml | nindent 12 }}
{{- end }}
{{- with $.Values.prePuller.containerSecurityContext }}
securityContext:
{{- . | toYaml | trimSuffix "\n" | nindent 12 }}
{{- . | toYaml | nindent 12 }}
{{- end }}
{{- end }}
{{- end }}
Expand All @@ -158,23 +158,23 @@ spec:
- echo "Pulling complete"
{{- with $.Values.prePuller.resources }}
resources:
{{- . | toYaml | trimSuffix "\n" | nindent 12 }}
{{- . | toYaml | nindent 12 }}
{{- end }}
{{- with $.Values.prePuller.containerSecurityContext }}
securityContext:
{{- . | toYaml | trimSuffix "\n" | nindent 12 }}
{{- . | toYaml | nindent 12 }}
{{- end }}
{{- end }}
containers:
- name: pause
image: {{ .Values.prePuller.pause.image.name }}:{{ .Values.prePuller.pause.image.tag }}
{{- with .Values.prePuller.resources }}
resources:
{{- . | toYaml | trimSuffix "\n" | nindent 12 }}
{{- . | toYaml | nindent 12 }}
{{- end }}
{{- with .Values.prePuller.pause.containerSecurityContext }}
securityContext:
{{- . | toYaml | trimSuffix "\n" | nindent 12 }}
{{- . | toYaml | nindent 12 }}
{{- end }}
{{- end }}
Expand Down
6 changes: 3 additions & 3 deletions jupyterhub/templates/image-puller/job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ spec:
{{- include "jupyterhub.matchLabels" . | nindent 8 }}
{{- with .Values.prePuller.annotations }}
annotations:
{{- . | toYaml | trimSuffix "\n" | nindent 8 }}
{{- . | toYaml | nindent 8 }}
{{- end }}
spec:
restartPolicy: Never
Expand Down Expand Up @@ -61,10 +61,10 @@ spec:
- -pod-scheduling-wait-duration={{ .Values.prePuller.hook.podSchedulingWaitDuration }}
{{- with .Values.prePuller.hook.containerSecurityContext }}
securityContext:
{{- . | toYaml | trimSuffix "\n" | nindent 12 }}
{{- . | toYaml | nindent 12 }}
{{- end }}
{{- with .Values.prePuller.hook.resources }}
resources:
{{- . | toYaml | trimSuffix "\n" | nindent 12 }}
{{- . | toYaml | nindent 12 }}
{{- end }}
{{- end }}
4 changes: 2 additions & 2 deletions jupyterhub/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ metadata:
{{- include "jupyterhub.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- . | toYaml | trimSuffix "\n" | nindent 4 }}
{{- . | toYaml | nindent 4 }}
{{- end }}
spec:
rules:
Expand All @@ -37,6 +37,6 @@ spec:
{{- end }}
{{- with .Values.ingress.tls }}
tls:
{{- . | toYaml | trimSuffix "\n" | nindent 4 }}
{{- . | toYaml | nindent 4 }}
{{- end }}
{{- end }}
18 changes: 9 additions & 9 deletions jupyterhub/templates/proxy/autohttps/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ spec:
{{- include "jupyterhub.matchLabels" . | nindent 8 }}
hub.jupyter.org/network-access-proxy-http: "true"
{{- with .Values.proxy.traefik.labels }}
{{- . | toYaml | trimSuffix "\n" | nindent 8 }}
{{- . | toYaml | nindent 8 }}
{{- end }}
annotations:
# Only force a restart through a change to this checksum when the static
Expand Down Expand Up @@ -46,7 +46,7 @@ spec:
configMap:
name: {{ include "jupyterhub.autohttps.fullname" . }}
{{- with .Values.proxy.traefik.extraVolumes }}
{{- . | toYaml | trimSuffix "\n" | nindent 8 }}
{{- . | toYaml | nindent 8 }}
{{- end }}
{{- with include "jupyterhub.imagePullSecrets" (dict "root" . "image" .Values.proxy.traefik.image) }}
imagePullSecrets: {{ . }}
Expand Down Expand Up @@ -74,7 +74,7 @@ spec:
mountPath: /etc/acme
{{- with .Values.proxy.secretSync.containerSecurityContext }}
securityContext:
{{- . | toYaml | trimSuffix "\n" | nindent 12 }}
{{- . | toYaml | nindent 12 }}
{{- end }}
containers:
- name: traefik
Expand All @@ -84,31 +84,31 @@ spec:
{{- end }}
{{- with .Values.proxy.traefik.resources }}
resources:
{{- . | toYaml | trimSuffix "\n" | nindent 12 }}
{{- . | toYaml | nindent 12 }}
{{- end }}
ports:
- name: http
containerPort: 8080
- name: https
containerPort: 8443
{{- with .Values.proxy.traefik.extraPorts }}
{{- . | toYaml | trimSuffix "\n" | nindent 12 }}
{{- . | toYaml | nindent 12 }}
{{- end }}
volumeMounts:
- name: traefik-config
mountPath: /etc/traefik
- name: certificates
mountPath: /etc/acme
{{- with .Values.proxy.traefik.extraVolumeMounts }}
{{- . | toYaml | trimSuffix "\n" | nindent 12 }}
{{- . | toYaml | nindent 12 }}
{{- end }}
{{- with .Values.proxy.traefik.extraEnv }}
env:
{{- include "jupyterhub.extraEnv" . | nindent 12 }}
{{- end }}
{{- with .Values.proxy.traefik.containerSecurityContext }}
securityContext:
{{- . | toYaml | trimSuffix "\n" | nindent 12 }}
{{- . | toYaml | nindent 12 }}
{{- end }}
- name: secret-sync
image: "{{ .Values.proxy.secretSync.image.name }}:{{ .Values.proxy.secretSync.image.tag }}"
Expand All @@ -133,9 +133,9 @@ spec:
mountPath: /etc/acme
{{- with .Values.proxy.secretSync.containerSecurityContext }}
securityContext:
{{- . | toYaml | trimSuffix "\n" | nindent 12 }}
{{- . | toYaml | nindent 12 }}
{{- end }}
{{- with .Values.proxy.traefik.extraPodSpec }}
{{- . | toYaml | trimSuffix "\n" | nindent 6 }}
{{- . | toYaml | nindent 6 }}
{{- end }}
{{- end }}
4 changes: 2 additions & 2 deletions jupyterhub/templates/proxy/autohttps/netpol.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ spec:

{{- with .Values.proxy.traefik.networkPolicy.ingress}}
# depends, but default is nothing --> proxy
{{- . | toYaml | trimSuffix "\n" | nindent 4 }}
{{- . | toYaml | nindent 4 }}
{{- end }}

egress:
Expand All @@ -81,6 +81,6 @@ spec:

{{- with .Values.proxy.traefik.networkPolicy.egress }}
# autohttps --> depends, but the default is everything
{{- . | toYaml | trimSuffix "\n" | nindent 4 }}
{{- . | toYaml | nindent 4 }}
{{- end }}
{{- end }}
4 changes: 2 additions & 2 deletions jupyterhub/templates/proxy/autohttps/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ metadata:
labels:
{{- include "jupyterhub.labels" . | nindent 4 }}
{{- with .Values.proxy.service.labels }}
{{- . | toYaml | trimSuffix "\n" | nindent 4 }}
{{- . | toYaml | nindent 4 }}
{{- end }}
{{- with .Values.proxy.service.annotations }}
annotations:
{{- . | toYaml | trimSuffix "\n" | nindent 4 }}
{{- . | toYaml | nindent 4 }}
{{- end }}
spec:
type: ClusterIP
Expand Down
Loading

0 comments on commit 6ec062d

Please sign in to comment.