Skip to content

Commit

Permalink
fix: convert to comma separated string
Browse files Browse the repository at this point in the history
  • Loading branch information
teselil committed Jul 11, 2023
1 parent 5fe1a6a commit d408dbb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 3 additions & 1 deletion charts/datree-admission-webhook/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,10 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.name
{{- with .Values.datree.enabledWarnings }}
- name: DATREE_ENABLED_WARNINGS
value: "{{.Values.datree.enabledWarnings}}"
value: '{{ join "," . }}'
{{- end }}
{{- with .Values.securityContext }}
securityContext: {{ toYaml . | nindent 12 }}
{{- end }}
Expand Down
6 changes: 2 additions & 4 deletions pkg/serviceState/serviceState.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,9 @@ type EnabledWarnings struct {

func (s *ServiceState) GetEnabledWarnings() EnabledWarnings {
// Environment variables are plain strings and not arrays, so we need to parse the string to get the enabled warnings
// input example [failedPolicyCheck RBACBypassed skippedBySkipList]
// input example failedPolicyChec,RBACBypassed,skippedBySkipList
enabledWarningsStr := s.enabledWarnings
enabledWarningsStr = strings.ReplaceAll(enabledWarningsStr, "[", "")
enabledWarningsStr = strings.ReplaceAll(enabledWarningsStr, "]", "")
enabledWarningsStrList := strings.Split(enabledWarningsStr, " ")
enabledWarningsStrList := strings.Split(enabledWarningsStr, ",")
enabledWarningsTypes := []string{"passedPolicyCheck", "failedPolicyCheck", "RBACBypassed", "skippedBySkipList"}
enabledWarnings := EnabledWarnings{}

Expand Down

0 comments on commit d408dbb

Please sign in to comment.