diff --git a/api/v1beta1/horizon_types.go b/api/v1beta1/horizon_types.go index 14637975..4bc54b73 100644 --- a/api/v1beta1/horizon_types.go +++ b/api/v1beta1/horizon_types.go @@ -103,6 +103,11 @@ type HorizonDebug struct { // HorizonRoute is used to define all of the information for the OpenShift route // todo(bshephar) implement type HorizonRoute struct { + // +kubebuilder:validation:Optional + // RouteAnnotations takes a map of Annotations that will be applied to the + // Horizon OpenShift Route. + RouteAnnotations map[string]string `json:"routeAnnotations,omitempty"` + // +kubebuilder:validation:Optional // +kubebuilder:default=horizon RouteName string `json:"routeName,omitempty"` diff --git a/api/v1beta1/zz_generated.deepcopy.go b/api/v1beta1/zz_generated.deepcopy.go index ec8e88b7..07c9da10 100644 --- a/api/v1beta1/zz_generated.deepcopy.go +++ b/api/v1beta1/zz_generated.deepcopy.go @@ -118,6 +118,13 @@ func (in *HorizonList) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *HorizonRoute) DeepCopyInto(out *HorizonRoute) { *out = *in + if in.RouteAnnotations != nil { + in, out := &in.RouteAnnotations, &out.RouteAnnotations + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HorizonRoute. @@ -149,7 +156,7 @@ func (in *HorizonSpec) DeepCopyInto(out *HorizonSpec) { } } in.Resources.DeepCopyInto(&out.Resources) - out.Route = in.Route + in.Route.DeepCopyInto(&out.Route) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HorizonSpec. diff --git a/config/crd/bases/horizon.openstack.org_horizons.yaml b/config/crd/bases/horizon.openstack.org_horizons.yaml index 474b34ae..ef0add67 100644 --- a/config/crd/bases/horizon.openstack.org_horizons.yaml +++ b/config/crd/bases/horizon.openstack.org_horizons.yaml @@ -145,6 +145,12 @@ spec: Implement everything about this. It's just a placeholder at the moment. properties: + routeAnnotations: + additionalProperties: + type: string + description: RouteAnnotations takes a map of Annotations that + will be applied to the Horizon OpenShift Route. + type: object routeLocation: description: TODO(bshephar) We need to implement TLS handling here to secure the route diff --git a/controllers/horizon_controller.go b/controllers/horizon_controller.go index 4cb8c93f..3fd8aba2 100644 --- a/controllers/horizon_controller.go +++ b/controllers/horizon_controller.go @@ -235,6 +235,11 @@ func (r *HorizonReconciler) reconcileInit( Port: horizon.HorizonPublicPort, }, } + + var routeAnnotations = map[string]string{} + if len(instance.Spec.Route.RouteAnnotations) != 0 { + routeAnnotations = instance.Spec.Route.RouteAnnotations + } apiEndpoints, ctrlResult, err := endpoint.ExposeEndpoints( ctx, @@ -242,6 +247,7 @@ func (r *HorizonReconciler) reconcileInit( horizon.ServiceName, serviceLabels, horizonPorts, + routeAnnotations, time.Duration(5)*time.Second, ) if err != nil {