Skip to content

Commit

Permalink
Remove unncessary template calls (#712)
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
Iristyle authored Apr 13, 2022
1 parent 12444bf commit 4ae52c8
Show file tree
Hide file tree
Showing 12 changed files with 9 additions and 20 deletions.
1 change: 0 additions & 1 deletion templates/server-clusterrolebinding.yaml
Original file line number Diff line number Diff line change
@@ -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" -}}
Expand Down
3 changes: 1 addition & 2 deletions templates/server-config-configmap.yaml
Original file line number Diff line number Diff line change
@@ -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) -}}
Expand Down Expand Up @@ -38,4 +37,4 @@ data:
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
3 changes: 1 addition & 2 deletions templates/server-discovery-role.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -19,4 +18,4 @@ rules:
verbs: ["get", "watch", "list", "update", "patch"]
{{ end }}
{{ end }}
{{ end }}
{{ end }}
3 changes: 1 addition & 2 deletions templates/server-discovery-rolebinding.yaml
Original file line number Diff line number Diff line change
@@ -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" -}}
Expand All @@ -27,4 +26,4 @@ subjects:
namespace: {{ .Release.Namespace }}
{{ end }}
{{ end }}
{{ end }}
{{ end }}
3 changes: 1 addition & 2 deletions templates/server-disruptionbudget.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -24,4 +23,4 @@ spec:
component: server
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
2 changes: 1 addition & 1 deletion templates/server-ha-active-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ spec:
vault-active: "true"
{{- end }}
{{- end }}
{{- end }}
{{- end }}
3 changes: 1 addition & 2 deletions templates/server-psp-role.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -18,4 +17,4 @@ rules:
resourceNames:
- {{ template "vault.fullname" . }}
{{- end }}
{{- end }}
{{- end }}
3 changes: 1 addition & 2 deletions templates/server-psp-rolebinding.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -19,4 +18,4 @@ subjects:
- kind: ServiceAccount
name: {{ template "vault.fullname" . }}
{{- end }}
{{- end }}
{{- end }}
3 changes: 1 addition & 2 deletions templates/server-psp.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -47,4 +46,4 @@ spec:
max: 65535
readOnlyRootFilesystem: false
{{- end }}
{{- end }}
{{- end }}
1 change: 0 additions & 1 deletion templates/server-serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{{ template "vault.mode" . }}
{{- template "vault.serverEnabled" . -}}
{{- if .serverEnabled -}}
{{- if (eq (.Values.server.serviceAccount.create | toString) "true" ) }}
apiVersion: v1
Expand Down
3 changes: 1 addition & 2 deletions templates/server-statefulset.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -208,4 +207,4 @@ spec:
{{ template "vault.volumeclaims" . }}
{{ end }}
{{ end }}
{{ end }}
{{ end }}
1 change: 0 additions & 1 deletion templates/tests/server-test.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{{ template "vault.mode" . }}
{{- if ne .mode "external" }}
{{- template "vault.serverEnabled" . -}}
{{- if .serverEnabled -}}
apiVersion: v1
kind: Pod
Expand Down

0 comments on commit 4ae52c8

Please sign in to comment.