Enable yamllint rules for templates

- braces
- brackets
- colons
- commas
- comments
- comments-indentation
- document-start
- hyphens
- indentation

With corresponding code changes.

Also idempotency fix for lint script.

Change-Id: Ibe5281cbb4ad7970e92f3d1f921abb1efc89dc3b
This commit is contained in:
Andrii Ostapenko 2020-06-16 19:55:47 -05:00
parent ddfa7a4741
commit dfb32ccf60
35 changed files with 90 additions and 108 deletions

View File

@ -126,8 +126,8 @@ spec:
# conf.controllers expanded values
{{ include "helm-toolkit.utils.to_k8s_env_vars" .Values.conf.controllers | indent 12 }}
# etcd tls files
{{ if .Values.endpoints.etcd.auth.client.tls.ca }}
# etcd tls files
- name: ETCD_CA_CERT_FILE
value: {{ .Values.endpoints.etcd.auth.client.path.ca }}
{{ end }}

View File

@ -83,7 +83,7 @@ spec:
fieldRef:
fieldPath: metadata.namespace
- name: KUBECTL_PARAM
value: {{ tuple $envAll "ceph" "ceph-defragosd" | include "helm-toolkit.snippets.kubernetes_kubectl_params" | indent 10 }}
value: {{ tuple $envAll "ceph" "ceph-defragosd" | include "helm-toolkit.snippets.kubernetes_kubectl_params" }}
command:
- /tmp/utils-defragOSDs.sh
- cron

View File

@ -99,7 +99,7 @@ spec:
- name: MON_PORT_V2
value: {{ tuple "ceph_mon" "internal" "mon_msgr2" $envAll | include "helm-toolkit.endpoints.endpoint_port_lookup" | quote }}
- name: KUBECTL_PARAM
value: {{ tuple $envAll "ceph" "checkdns" | include "helm-toolkit.snippets.kubernetes_kubectl_params" | indent 10 }}
value: {{ tuple $envAll "ceph" "checkdns" | include "helm-toolkit.snippets.kubernetes_kubectl_params" }}
command:
- /tmp/_start.sh
volumeMounts:

View File

@ -136,7 +136,7 @@ spec:
- name: CEPH_PUBLIC_NETWORK
value: {{ .Values.network.public | quote }}
- name: KUBECTL_PARAM
value: {{ tuple $envAll "ceph" "mon" | include "helm-toolkit.snippets.kubernetes_kubectl_params" | indent 10 }}
value: {{ tuple $envAll "ceph" "mon" | include "helm-toolkit.snippets.kubernetes_kubectl_params" }}
- name: MON_PORT
value: {{ tuple "ceph_mon" "internal" "mon" $envAll | include "helm-toolkit.endpoints.endpoint_port_lookup" | quote }}
- name: MON_PORT_V2

View File

@ -33,7 +33,7 @@ spec:
{{ $envAll.Values.labels.test.node_selector_key }}: {{ $envAll.Values.labels.test.node_selector_value | quote }}
restartPolicy: Never
initContainers:
{{ tuple $envAll "tests" $mounts_kubernetes_keystone_webhook_tests_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
{{ tuple $envAll "tests" $mounts_kubernetes_keystone_webhook_tests_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 4 }}
containers:
- name: {{ $envAll.Release.Name }}-kubernetes-keystone-webhook-test
{{ tuple $envAll "scripted_test" | include "helm-toolkit.snippets.image" | indent 6 }}

View File

@ -24,5 +24,5 @@ spec:
- name: ldap
port: {{ tuple "ldap" "internal" "ldap" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
selector:
{{ tuple $envAll "ldap" "server" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
{{ tuple $envAll "ldap" "server" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
{{- end }}

View File

@ -37,7 +37,7 @@ spec:
{{ .Values.labels.test.node_selector_key }}: {{ .Values.labels.test.node_selector_value }}
restartPolicy: Never
initContainers:
{{ tuple $envAll "tests" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
{{ tuple $envAll "tests" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 4 }}
containers:
- name: mariadb-test
{{ dict "envAll" $envAll "application" "tests" "container" "test" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 6 }}

View File

@ -24,5 +24,5 @@ spec:
- name: db
port: {{ tuple "mongodb" "internal" "mongodb" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
selector:
{{ tuple $envAll "mongodb" "server" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
{{ tuple $envAll "mongodb" "server" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
{{- end }}

View File

@ -23,4 +23,3 @@ type: Opaque
data:
admin_user.conf: {{ tuple "secrets/_admin_user.conf.tpl" . | include "helm-toolkit.utils.template" | b64enc }}
{{- end }}

View File

@ -24,5 +24,5 @@ spec:
- name: restapi
port: {{ tuple "postgresql-restapi" "internal" "restapi" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
selector:
{{ tuple $envAll "postgresql" "server" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
{{ tuple $envAll "postgresql" "server" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
{{- end }}

View File

@ -7,10 +7,10 @@ HELM_VERSION=$(yq -r '.version.helm' ${HELM_DATA_YAML})
GOOGLE_HELM_REPO_URL=$(yq -r '.url.google_helm_repo' ${HELM_DATA_YAML})
LINT_DIR=.yamllint
rm -rf */charts/helm-toolkit
mkdir ${LINT_DIR}
cp -r * ${LINT_DIR}
rm -rf ${LINT_DIR}/*/templates
rm -rf */charts/helm-toolkit
wget -qO ${LINT_DIR}/helm.tgz ${GOOGLE_HELM_REPO_URL}/helm-${HELM_VERSION}-linux-amd64.tar.gz
tar xzf ${LINT_DIR}/helm.tgz -C ${LINT_DIR} --strip-components=1 linux-amd64/helm

View File

@ -6,44 +6,27 @@ yaml-files:
- '.yamllint'
rules:
braces:
level: warning
brackets:
level: warning
colons:
level: warning
commas:
level: warning
comments:
level: warning
comments-indentation:
level: warning
braces: enable
brackets: enable
colons: enable
commas: enable
comments: enable
comments-indentation: enable
document-end: disable
document-start:
level: warning
empty-lines:
level: warning
empty-values:
level: warning
hyphens:
level: warning
document-start: enable
empty-lines: disable
empty-values: disable
hyphens: enable
indentation:
spaces: 2
indent-sequences: whatever
level: warning
key-duplicates:
level: warning
key-duplicates: disable
key-ordering: disable
line-length: disable
new-line-at-end-of-file:
level: warning
new-lines:
level: warning
octal-values:
level: warning
new-line-at-end-of-file: disable
new-lines: disable
octal-values: disable
quoted-strings: disable
trailing-spaces:
level: warning
truthy:
level: warning
trailing-spaces: disable
truthy: disable
...