Skip to content

Commit 3b4c045

Browse files
Merge pull request #821 from bshephar/overrides-nil-pointer
Fix APIOverrides nil pointer in horizon.go
2 parents 14fd1d1 + 38e8434 commit 3b4c045

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

pkg/openstack/horizon.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66

77
"github.com/openstack-k8s-operators/lib-common/modules/common/condition"
88
"github.com/openstack-k8s-operators/lib-common/modules/common/helper"
9+
"github.com/openstack-k8s-operators/lib-common/modules/common/route"
910
"github.com/openstack-k8s-operators/lib-common/modules/common/service"
1011
"github.com/openstack-k8s-operators/lib-common/modules/common/tls"
1112

@@ -82,6 +83,18 @@ func ReconcileHorizon(ctx context.Context, instance *corev1beta1.OpenStackContro
8283
//
8384
apiOverrides := instance.Spec.Horizon.APIOverride
8485

86+
if apiOverrides.Route == nil {
87+
apiOverrides.Route = &route.OverrideSpec{}
88+
}
89+
90+
if apiOverrides.Route.EmbeddedLabelsAnnotations == nil {
91+
apiOverrides.Route.EmbeddedLabelsAnnotations = &route.EmbeddedLabelsAnnotations{}
92+
}
93+
94+
if apiOverrides.Route.Annotations == nil {
95+
apiOverrides.Route.Annotations = map[string]string{}
96+
}
97+
8598
if _, ok := apiOverrides.Route.Annotations[HorizonHSTSHeaderAnnotation]; !ok {
8699
apiOverrides.Route.Annotations[HorizonHSTSHeaderAnnotation] = HorizonHSTSHeaderAnnotationValue
87100
}

tests/functional/base_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,9 @@ func GetDefaultOpenStackControlPlaneSpec() map[string]interface{} {
372372
"glance": map[string]interface{}{
373373
"enabled": false,
374374
},
375+
"horizon": map[string]interface{}{
376+
"enabled": true,
377+
},
375378
"cinder": map[string]interface{}{
376379
"enabled": false,
377380
},

0 commit comments

Comments
 (0)