Skip to content
This repository has been archived by the owner on Oct 22, 2021. It is now read-only.

Commit

Permalink
fix: Allow uppercase letters in key label regex
Browse files Browse the repository at this point in the history
This way the error message properly reflects the actual test.

Patch also removes some superfluous quotes.

(cherry picked from commit c7cc84b)
  • Loading branch information
jandubois committed May 19, 2020
1 parent 0a6b0a1 commit d0dcea8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions deploy/helm/kubecf/assets/operations/instance_groups/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,26 +96,26 @@
value: 3600

{{- range $keyLabel := .Values.ccdb.encryption.rotation.key_labels }}
{{- if not (regexMatch "^[a-z]+[a-z0-9_]*[a-z0-9]+$" (lower $keyLabel)) }}
{{ fail "One or more items in ccdb.encryption.rotation.key_labels don't match the regex /^[a-z]+[a-z0-9_]*[a-z0-9]+$/" }}
{{- if not (regexMatch "^[a-zA-Z]+[a-zA-Z0-9_]*[a-zA-Z0-9]+$" $keyLabel) }}
{{ fail "One or more items in ccdb.encryption.rotation.key_labels don't match the regex /^[a-zA-Z]+[a-zA-Z0-9_]*[a-zA-Z0-9]+$/" }}
{{- end }}
{{- if gt (len $keyLabel) 240 }}
{{ fail "One or more items in ccdb.encryption.rotation.key_labels exceed the maximum length of 240 characters" }}
{{- end }}
- type: replace
path: /variables/-
value:
name: "ccdb_key_label_{{ $keyLabel | lower }}"
name: ccdb_key_label_{{ $keyLabel | lower }}
type: password
{{- end }}
- type: replace
path: /instance_groups/name=api/jobs/name=cloud_controller_ng/properties/cc/database_encryption?
value: &encryption_info
keys:
{{- range $keyLabel := .Values.ccdb.encryption.rotation.key_labels }}
"{{ $keyLabel }}": "((ccdb_key_label_{{ $keyLabel | lower }}))"
{{ $keyLabel }}: "((ccdb_key_label_{{ $keyLabel | lower }}))"
{{- end }}
current_key_label: "{{ .Values.ccdb.encryption.rotation.current_key_label }}"
current_key_label: {{ .Values.ccdb.encryption.rotation.current_key_label }}
- type: replace
path: /instance_groups/name=cc-worker/jobs/name=cloud_controller_worker/properties/cc/database_encryption?
value: *encryption_info
Expand Down

0 comments on commit d0dcea8

Please sign in to comment.