From 4ae52c8bd3d3f4d303196ecb455ae07d9a943ba8 Mon Sep 17 00:00:00 2001 From: "Ethan J. Brown" Date: Tue, 12 Apr 2022 22:54:54 -0700 Subject: [PATCH] Remove unncessary template calls (#712) - As part of VAULT-571 / #703 in 7109159, a new vault.serverEnabled template was added (and included in vault.mode) Various templates were updated accordingly, but those that were already calling vault.mode had an additonal call to vault.serverEnabled made which was unnecessary Remove those --- templates/server-clusterrolebinding.yaml | 1 - templates/server-config-configmap.yaml | 3 +-- templates/server-discovery-role.yaml | 3 +-- templates/server-discovery-rolebinding.yaml | 3 +-- templates/server-disruptionbudget.yaml | 3 +-- templates/server-ha-active-service.yaml | 2 +- templates/server-psp-role.yaml | 3 +-- templates/server-psp-rolebinding.yaml | 3 +-- templates/server-psp.yaml | 3 +-- templates/server-serviceaccount.yaml | 1 - templates/server-statefulset.yaml | 3 +-- templates/tests/server-test.yaml | 1 - 12 files changed, 9 insertions(+), 20 deletions(-) diff --git a/templates/server-clusterrolebinding.yaml b/templates/server-clusterrolebinding.yaml index 2db23a519..e045b9ec3 100644 --- a/templates/server-clusterrolebinding.yaml +++ b/templates/server-clusterrolebinding.yaml @@ -1,5 +1,4 @@ {{ template "vault.mode" . }} -{{- template "vault.serverEnabled" . -}} {{- if .serverEnabled -}} {{- if and (ne .mode "") (eq (.Values.server.authDelegator.enabled | toString) "true") }} {{- if .Capabilities.APIVersions.Has "rbac.authorization.k8s.io/v1" -}} diff --git a/templates/server-config-configmap.yaml b/templates/server-config-configmap.yaml index 969dcf38e..f40c69608 100644 --- a/templates/server-config-configmap.yaml +++ b/templates/server-config-configmap.yaml @@ -1,6 +1,5 @@ {{ template "vault.mode" . }} {{- if ne .mode "external" }} -{{- template "vault.serverEnabled" . -}} {{- if .serverEnabled -}} {{- if ne .mode "dev" -}} {{ if or (.Values.server.standalone.config) (.Values.server.ha.config) -}} @@ -38,4 +37,4 @@ data: {{- end }} {{- end }} {{- end }} -{{- end }} \ No newline at end of file +{{- end }} diff --git a/templates/server-discovery-role.yaml b/templates/server-discovery-role.yaml index 3e8544c77..9ca23dd4c 100644 --- a/templates/server-discovery-role.yaml +++ b/templates/server-discovery-role.yaml @@ -1,6 +1,5 @@ {{ template "vault.mode" . }} {{- if ne .mode "external" }} -{{- template "vault.serverEnabled" . -}} {{- if .serverEnabled -}} {{- if eq .mode "ha" }} apiVersion: rbac.authorization.k8s.io/v1 @@ -19,4 +18,4 @@ rules: verbs: ["get", "watch", "list", "update", "patch"] {{ end }} {{ end }} -{{ end }} \ No newline at end of file +{{ end }} diff --git a/templates/server-discovery-rolebinding.yaml b/templates/server-discovery-rolebinding.yaml index 8ceb48274..6e22e4c2b 100644 --- a/templates/server-discovery-rolebinding.yaml +++ b/templates/server-discovery-rolebinding.yaml @@ -1,6 +1,5 @@ {{ template "vault.mode" . }} {{- if ne .mode "external" }} -{{- template "vault.serverEnabled" . -}} {{- if .serverEnabled -}} {{- if eq .mode "ha" }} {{- if .Capabilities.APIVersions.Has "rbac.authorization.k8s.io/v1" -}} @@ -27,4 +26,4 @@ subjects: namespace: {{ .Release.Namespace }} {{ end }} {{ end }} -{{ end }} \ No newline at end of file +{{ end }} diff --git a/templates/server-disruptionbudget.yaml b/templates/server-disruptionbudget.yaml index fd94ada45..d940fa4da 100644 --- a/templates/server-disruptionbudget.yaml +++ b/templates/server-disruptionbudget.yaml @@ -1,6 +1,5 @@ {{ template "vault.mode" . }} {{- if ne .mode "external" -}} -{{- template "vault.serverEnabled" . -}} {{- if .serverEnabled -}} {{- if and (eq .mode "ha") (eq (.Values.server.ha.disruptionBudget.enabled | toString) "true") -}} # PodDisruptionBudget to prevent degrading the server cluster through @@ -24,4 +23,4 @@ spec: component: server {{- end -}} {{- end -}} -{{- end -}} \ No newline at end of file +{{- end -}} diff --git a/templates/server-ha-active-service.yaml b/templates/server-ha-active-service.yaml index 525fc8c9c..90761a468 100644 --- a/templates/server-ha-active-service.yaml +++ b/templates/server-ha-active-service.yaml @@ -42,4 +42,4 @@ spec: vault-active: "true" {{- end }} {{- end }} -{{- end }} \ No newline at end of file +{{- end }} diff --git a/templates/server-psp-role.yaml b/templates/server-psp-role.yaml index 608624b5b..b8eb897e5 100644 --- a/templates/server-psp-role.yaml +++ b/templates/server-psp-role.yaml @@ -1,5 +1,4 @@ {{ template "vault.mode" . }} -{{- template "vault.serverEnabled" . -}} {{- if .serverEnabled -}} {{- if and (ne .mode "") (eq (.Values.global.psp.enable | toString) "true") }} apiVersion: rbac.authorization.k8s.io/v1 @@ -18,4 +17,4 @@ rules: resourceNames: - {{ template "vault.fullname" . }} {{- end }} -{{- end }} \ No newline at end of file +{{- end }} diff --git a/templates/server-psp-rolebinding.yaml b/templates/server-psp-rolebinding.yaml index f6255ebdf..fded9fbc6 100644 --- a/templates/server-psp-rolebinding.yaml +++ b/templates/server-psp-rolebinding.yaml @@ -1,5 +1,4 @@ {{ template "vault.mode" . }} -{{- template "vault.serverEnabled" . -}} {{- if .serverEnabled -}} {{- if and (ne .mode "") (eq (.Values.global.psp.enable | toString) "true") }} apiVersion: rbac.authorization.k8s.io/v1 @@ -19,4 +18,4 @@ subjects: - kind: ServiceAccount name: {{ template "vault.fullname" . }} {{- end }} -{{- end }} \ No newline at end of file +{{- end }} diff --git a/templates/server-psp.yaml b/templates/server-psp.yaml index cca688373..d210af351 100644 --- a/templates/server-psp.yaml +++ b/templates/server-psp.yaml @@ -1,5 +1,4 @@ {{ template "vault.mode" . }} -{{- template "vault.serverEnabled" . -}} {{- if .serverEnabled -}} {{- if and (ne .mode "") (eq (.Values.global.psp.enable | toString) "true") }} apiVersion: policy/v1beta1 @@ -47,4 +46,4 @@ spec: max: 65535 readOnlyRootFilesystem: false {{- end }} -{{- end }} \ No newline at end of file +{{- end }} diff --git a/templates/server-serviceaccount.yaml b/templates/server-serviceaccount.yaml index 4ff73a687..2d1a104bf 100644 --- a/templates/server-serviceaccount.yaml +++ b/templates/server-serviceaccount.yaml @@ -1,5 +1,4 @@ {{ template "vault.mode" . }} -{{- template "vault.serverEnabled" . -}} {{- if .serverEnabled -}} {{- if (eq (.Values.server.serviceAccount.create | toString) "true" ) }} apiVersion: v1 diff --git a/templates/server-statefulset.yaml b/templates/server-statefulset.yaml index 7deea5ed6..5cf159787 100644 --- a/templates/server-statefulset.yaml +++ b/templates/server-statefulset.yaml @@ -1,7 +1,6 @@ {{ template "vault.mode" . }} {{- if ne .mode "external" }} {{- if ne .mode "" }} -{{- template "vault.serverEnabled" . -}} {{- if .serverEnabled -}} # StatefulSet to run the actual vault server cluster. apiVersion: apps/v1 @@ -208,4 +207,4 @@ spec: {{ template "vault.volumeclaims" . }} {{ end }} {{ end }} -{{ end }} \ No newline at end of file +{{ end }} diff --git a/templates/tests/server-test.yaml b/templates/tests/server-test.yaml index ef1aae848..56dbee78c 100644 --- a/templates/tests/server-test.yaml +++ b/templates/tests/server-test.yaml @@ -1,6 +1,5 @@ {{ template "vault.mode" . }} {{- if ne .mode "external" }} -{{- template "vault.serverEnabled" . -}} {{- if .serverEnabled -}} apiVersion: v1 kind: Pod