From d902714cee3ba74d0968ce3af6417ffb32d4458a Mon Sep 17 00:00:00 2001 From: Ken Sipe Date: Mon, 16 Nov 2020 10:34:17 -0600 Subject: [PATCH] Fixes nil map bug on creation (#1743) (#1746) Co-authored-by: Alena Varkockova Signed-off-by: Ken Sipe --- pkg/webhook/instance_admission.go | 3 +++ test/upgrade/cert-manager-detection/06-install-kudo.yaml | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/webhook/instance_admission.go b/pkg/webhook/instance_admission.go index 9d8f42e3b..70b8165d0 100644 --- a/pkg/webhook/instance_admission.go +++ b/pkg/webhook/instance_admission.go @@ -464,6 +464,9 @@ func validateParameters(ov *kudoapi.OperatorVersion, instance *kudoapi.Instance) func setImmutableParameterDefaults(ov *kudoapi.OperatorVersion, instance *kudoapi.Instance) { for _, p := range ov.Spec.Parameters { if p.IsImmutable() && p.HasDefault() { + if instance.Spec.Parameters == nil { + instance.Spec.Parameters = map[string]string{} + } if _, ok := instance.Spec.Parameters[p.Name]; !ok { instance.Spec.Parameters[p.Name] = *p.Default } diff --git a/test/upgrade/cert-manager-detection/06-install-kudo.yaml b/test/upgrade/cert-manager-detection/06-install-kudo.yaml index abe271129..1a3d60184 100644 --- a/test/upgrade/cert-manager-detection/06-install-kudo.yaml +++ b/test/upgrade/cert-manager-detection/06-install-kudo.yaml @@ -1,5 +1,5 @@ apiVersion: kudo.dev/v1beta1 kind: TestStep commands: - - command: sleep 10 + - command: sleep 20 - command: kubectl kudo init -v 4 --kudo-image kudobuilder/controller:test --kudo-image-pull-policy IfNotPresent --wait \ No newline at end of file