Skip to content

Commit

Permalink
fix: set default value for old CA field when missing. (#527)
Browse files Browse the repository at this point in the history
Signed-off-by: José Guilherme Vanz <[email protected]>
  • Loading branch information
jvanz authored Sep 11, 2024
1 parent cd11bee commit f01a6b4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion charts/kubewarden-controller/templates/webhooks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
{{ if $caSecret }}
{{ $caCert = (index $caSecret.data "ca.crt") }}
{{ $caPrivateKey = (index $caSecret.data "ca.key") }}
{{ $oldCaCert = (index $caSecret.data "old-ca.crt") }}
# If the old CA certificate is missing, set it to "". This is to avoid issues
# with b64dec when the old CA certificate is not present in the secret. This
# can happen after an upgrade. The old CA field is removed from the secret
# because it's empty. Therefore, a future upgrade can fail.
{{ $oldCaCert = (index $caSecret.data "old-ca.crt" | default "") }}
{{ $caBundle = printf "%s%s" ($caCert | b64dec) ($oldCaCert | b64dec) | b64enc }}
{{ end }}
{{ $serverCertSecret := (lookup "v1" "Secret" .Release.Namespace "kubewarden-webhook-server-cert") }}
Expand Down

0 comments on commit f01a6b4

Please sign in to comment.