Skip to content

Commit

Permalink
feat(helm): use object instead of list for plugins.policies (#5735)
Browse files Browse the repository at this point in the history
This allows it to be 'appended' to by other charts.

Signed-off-by: Mike Beaumont <[email protected]>
  • Loading branch information
michaelbeaumont authored Jan 18, 2023
1 parent 7ea143f commit 8fb84bf
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -702,13 +702,13 @@ experimental:
# @ignored for helm-docs
plugins:
policies:
- meshaccesslogs
- meshcircuitbreakers
- meshhealthchecks
- meshhttproutes
- meshproxypatches
- meshratelimits
- meshretries
- meshtimeouts
- meshtraces
- meshtrafficpermissions
meshaccesslogs: {}
meshcircuitbreakers: {}
meshhealthchecks: {}
meshhttproutes: {}
meshproxypatches: {}
meshratelimits: {}
meshretries: {}
meshtimeouts: {}
meshtraces: {}
meshtrafficpermissions: {}
2 changes: 1 addition & 1 deletion deployments/charts/kuma/templates/cp-rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ rules:
{{- if .Values.experimental.gatewayAPI }}
- meshgatewayconfigs
{{- end }}
{{- range $idx, $policy := .Values.plugins.policies }}
{{- range $policy, $empty := .Values.plugins.policies }}
- {{ $policy }}
{{- end}}
verbs:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ webhooks:
- UPDATE
resources:
- meshes
{{- range $idx, $policy := .Values.plugins.policies }}
{{- range $policy, $empty := .Values.plugins.policies }}
- {{ $policy }}
{{- end}}
sideEffects: None
Expand Down Expand Up @@ -109,7 +109,7 @@ webhooks:
- trafficroutes
- traffictraces
- virtualoutbounds
{{- range $idx, $policy := .Values.plugins.policies }}
{{- range $policy, $empty := .Values.plugins.policies }}
- {{ $policy }}
{{- end}}
{{ .Values.controlPlane.webhooks.ownerReference.additionalRules | nindent 6 }}
Expand Down Expand Up @@ -225,7 +225,7 @@ webhooks:
- virtualoutbounds
- zones
- containerpatches
{{- range $idx, $policy := .Values.plugins.policies }}
{{- range $policy, $empty := .Values.plugins.policies }}
- {{ $policy }}
{{- end}}
{{ .Values.controlPlane.webhooks.validator.additionalRules | nindent 6 }}
Expand Down
20 changes: 10 additions & 10 deletions deployments/charts/kuma/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -702,13 +702,13 @@ experimental:
# @ignored for helm-docs
plugins:
policies:
- meshaccesslogs
- meshcircuitbreakers
- meshhealthchecks
- meshhttproutes
- meshproxypatches
- meshratelimits
- meshretries
- meshtimeouts
- meshtraces
- meshtrafficpermissions
meshaccesslogs: {}
meshcircuitbreakers: {}
meshhealthchecks: {}
meshhttproutes: {}
meshproxypatches: {}
meshratelimits: {}
meshretries: {}
meshtimeouts: {}
meshtraces: {}
meshtrafficpermissions: {}
6 changes: 3 additions & 3 deletions tools/policy-gen/generate-policy-helm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ for policy in "$@"; do

plural=$(yq e '.spec.names.plural' "${policy_crd_file}")

policies="${policies}${policies:+, }\"${plural}\""
policies="${policies}${policies:+, }\"${plural}\": {}"

done

Expand All @@ -42,5 +42,5 @@ function yq_patch() {
rm "$2.noblank"
}

yq_patch '.plugins.policies = []' "${HELM_VALUES_FILE}"
yq_patch '.plugins.policies = [ '"${policies}"' ]' "${HELM_VALUES_FILE}"
yq_patch '.plugins.policies = {}' "${HELM_VALUES_FILE}"
yq_patch '.plugins.policies = { '"${policies}"' }' "${HELM_VALUES_FILE}"

0 comments on commit 8fb84bf

Please sign in to comment.