diff --git a/api/bases/neutron.openstack.org_neutronapis.yaml b/api/bases/neutron.openstack.org_neutronapis.yaml index 47d5714c..3fdd422e 100644 --- a/api/bases/neutron.openstack.org_neutronapis.yaml +++ b/api/bases/neutron.openstack.org_neutronapis.yaml @@ -2096,8 +2096,8 @@ spec: description: RouteAnnotations to be added to the created route properties: timeout: - default: "60" - description: HAProxy Timeout for route + description: Timeout - Provides the HAProxy Timeout value for + the route type: string type: object secret: diff --git a/api/v1beta1/neutronapi_types.go b/api/v1beta1/neutronapi_types.go index 49f51beb..1b9ff39e 100644 --- a/api/v1beta1/neutronapi_types.go +++ b/api/v1beta1/neutronapi_types.go @@ -198,10 +198,10 @@ type NeutronAPIDebug struct { Service bool `json:"service"` } +// NeutronRouteAnnotations defines the route annotations type NeutronRouteAnnotations struct { // +kubebuilder:validation:Optional - // +kubebuilder:default="60" - // HAProxy Timeout for route + // Timeout - Provides the HAProxy Timeout value for the route Timeout string `json:"timeout"` } diff --git a/api/v1beta1/zz_generated.deepcopy.go b/api/v1beta1/zz_generated.deepcopy.go index 7e5b75d0..8e99a257 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]) } } + out.RouteAnnotations = in.RouteAnnotations } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NeutronAPISpec. @@ -268,6 +269,21 @@ 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 *NeutronRouteAnnotations) DeepCopyInto(out *NeutronRouteAnnotations) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NeutronRouteAnnotations. +func (in *NeutronRouteAnnotations) DeepCopy() *NeutronRouteAnnotations { + if in == nil { + return nil + } + out := new(NeutronRouteAnnotations) + 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 47d5714c..3fdd422e 100644 --- a/config/crd/bases/neutron.openstack.org_neutronapis.yaml +++ b/config/crd/bases/neutron.openstack.org_neutronapis.yaml @@ -2096,8 +2096,8 @@ spec: description: RouteAnnotations to be added to the created route properties: timeout: - default: "60" - description: HAProxy Timeout for route + description: Timeout - Provides the HAProxy Timeout value for + the route type: string type: object secret: diff --git a/config/samples/neutron_v1beta1_neutronapi.yaml b/config/samples/neutron_v1beta1_neutronapi.yaml index 822489de..d86dfb44 100644 --- a/config/samples/neutron_v1beta1_neutronapi.yaml +++ b/config/samples/neutron_v1beta1_neutronapi.yaml @@ -19,4 +19,4 @@ spec: replicas: 1 secret: neutron-secret routeAnnotations: - timeout: 120s \ No newline at end of file + timeout: 120s diff --git a/controllers/neutronapi_controller.go b/controllers/neutronapi_controller.go index 039fc0b2..9e7467a4 100644 --- a/controllers/neutronapi_controller.go +++ b/controllers/neutronapi_controller.go @@ -59,6 +59,10 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) +const ( + routeTimeoutAnnotationName string = "haproxy.router.openshift.io/timeout" +) + // NeutronAPIReconciler reconciles a NeutronAPI object type NeutronAPIReconciler struct { client.Client @@ -414,7 +418,7 @@ func (r *NeutronAPIReconciler) reconcileInit( routeAnnotations := make(map[string]string) if instance.Spec.RouteAnnotations.Timeout != "" { - routeAnnotations["haproxy.router.openshift.io/timeout"] = instance.Spec.RouteAnnotations.Timeout + routeAnnotations[routeTimeoutAnnotationName] = instance.Spec.RouteAnnotations.Timeout } apiEndpoints, ctrlResult, err := endpoint.ExposeEndpoints( diff --git a/go.mod b/go.mod index c080e70e..01f1d1c7 100644 --- a/go.mod +++ b/go.mod @@ -89,5 +89,3 @@ require ( ) replace github.com/openstack-k8s-operators/neutron-operator/api => ./api - -replace github.com/openstack-k8s-operators/lib-common/modules/common => /Users/ldenny/Code/openstack/openstack-operators/lib-common/modules/common