diff --git a/api/bases/neutron.openstack.org_neutronapis.yaml b/api/bases/neutron.openstack.org_neutronapis.yaml index 19dbc674..940568ae 100644 --- a/api/bases/neutron.openstack.org_neutronapis.yaml +++ b/api/bases/neutron.openstack.org_neutronapis.yaml @@ -2092,6 +2092,17 @@ spec: to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' type: object type: object + route: + description: NeutronRoute holds all the necessary options for configuring + the Neutron Route object. + properties: + routeAnnotations: + additionalProperties: + type: string + description: RouteAnnotations takes a map of Annotations that + will be applied to the Neutron OpenShift Route. + type: object + type: object secret: description: Secret containing OpenStack password information for NeutronDatabasePassword, NeutronPassword diff --git a/api/v1beta1/neutronapi_types.go b/api/v1beta1/neutronapi_types.go index 1c211b9b..2116f281 100644 --- a/api/v1beta1/neutronapi_types.go +++ b/api/v1beta1/neutronapi_types.go @@ -134,6 +134,10 @@ type NeutronAPISpec struct { // ExtraMounts containing conf files // +kubebuilder:validation:Optional ExtraMounts []NeutronExtraVolMounts `json:"extraMounts,omitempty"` + + // +kubebuilder:validation:Optional + // NeutronRoute holds all the necessary options for configuring the Neutron Route object. + Route NeutronRoute `json:"route,omitempty"` } // MetalLBConfig to configure the MetalLB loadbalancer service @@ -194,6 +198,14 @@ type NeutronAPIDebug struct { Service bool `json:"service"` } +// NeutronRoute is used to define all the information for the OpenShift route +type NeutronRoute struct { + // +kubebuilder:validation:Optional + // RouteAnnotations takes a map of Annotations that will be applied to the + // Neutron OpenShift Route. + RouteAnnotations map[string]string `json:"routeAnnotations,omitempty"` +} + // NeutronAPIStatus defines the observed state of NeutronAPI type NeutronAPIStatus struct { // ReadyCount of neutron API instances diff --git a/api/v1beta1/zz_generated.deepcopy.go b/api/v1beta1/zz_generated.deepcopy.go index 7e5b75d0..6aae4d33 100644 --- a/api/v1beta1/zz_generated.deepcopy.go +++ b/api/v1beta1/zz_generated.deepcopy.go @@ -190,6 +190,7 @@ func (in *NeutronAPISpec) DeepCopyInto(out *NeutronAPISpec) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + in.Route.DeepCopyInto(&out.Route) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NeutronAPISpec. @@ -268,6 +269,28 @@ func (in *NeutronExtraVolMounts) DeepCopy() *NeutronExtraVolMounts { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NeutronRoute) DeepCopyInto(out *NeutronRoute) { + *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 NeutronRoute. +func (in *NeutronRoute) DeepCopy() *NeutronRoute { + if in == nil { + return nil + } + out := new(NeutronRoute) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PasswordSelector) DeepCopyInto(out *PasswordSelector) { *out = *in diff --git a/config/crd/bases/neutron.openstack.org_neutronapis.yaml b/config/crd/bases/neutron.openstack.org_neutronapis.yaml index 19dbc674..940568ae 100644 --- a/config/crd/bases/neutron.openstack.org_neutronapis.yaml +++ b/config/crd/bases/neutron.openstack.org_neutronapis.yaml @@ -2092,6 +2092,17 @@ spec: to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' type: object type: object + route: + description: NeutronRoute holds all the necessary options for configuring + the Neutron Route object. + properties: + routeAnnotations: + additionalProperties: + type: string + description: RouteAnnotations takes a map of Annotations that + will be applied to the Neutron OpenShift Route. + type: object + type: object secret: description: Secret containing OpenStack password information for NeutronDatabasePassword, NeutronPassword diff --git a/config/samples/neutron_v1beta1_neutronapi.yaml b/config/samples/neutron_v1beta1_neutronapi.yaml index 9b3879e0..770d68f9 100644 --- a/config/samples/neutron_v1beta1_neutronapi.yaml +++ b/config/samples/neutron_v1beta1_neutronapi.yaml @@ -17,4 +17,4 @@ spec: preserveJobs: false containerImage: quay.io/podified-antelope-centos9/openstack-neutron-server:current-podified replicas: 1 - secret: neutron-secret + secret: neutron-secret \ No newline at end of file diff --git a/controllers/neutronapi_controller.go b/controllers/neutronapi_controller.go index e56774e9..61420bbf 100644 --- a/controllers/neutronapi_controller.go +++ b/controllers/neutronapi_controller.go @@ -412,12 +412,18 @@ func (r *NeutronAPIReconciler) reconcileInit( ports[metallbcfg.Endpoint] = portCfg } + var routeAnnotations = map[string]string{} + if len(instance.Spec.Route.RouteAnnotations) != 0 { + routeAnnotations = instance.Spec.Route.RouteAnnotations + } + apiEndpoints, ctrlResult, err := endpoint.ExposeEndpoints( ctx, helper, neutronapi.ServiceName, serviceLabels, ports, + routeAnnotations, time.Duration(5)*time.Second, ) if err != nil {