Skip to content

Commit

Permalink
Add support for configuring route annotations
Browse files Browse the repository at this point in the history
Remove go.mod replace

Use const for annotation

Remove timeout default

Fix comments

Update openstack-k8s-operators

Remove timeout default

Update openstack-k8s-operators

Add support for configuring route annotations
  • Loading branch information
lewisdenny committed Jun 23, 2023
1 parent efd4186 commit 7c468ae
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 0 deletions.
8 changes: 8 additions & 0 deletions api/bases/neutron.openstack.org_neutronapis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2092,6 +2092,14 @@ spec:
to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
type: object
type: object
routeAnnotations:
description: RouteAnnotations to be added to the created route
properties:
timeout:
default: "60"
description: HAProxy Timeout for route
type: string
type: object
secret:
description: Secret containing OpenStack password information for
NeutronDatabasePassword, NeutronPassword
Expand Down
11 changes: 11 additions & 0 deletions api/v1beta1/neutronapi_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@ type NeutronAPISpec struct {
// ExtraMounts containing conf files
// +kubebuilder:validation:Optional
ExtraMounts []NeutronExtraVolMounts `json:"extraMounts,omitempty"`

// RouteAnnotations to be added to the created route
// +kubebuilder:validation:Optional
RouteAnnotations NeutronRouteAnnotations `json:"routeAnnotations,omitempty"`
}

// MetalLBConfig to configure the MetalLB loadbalancer service
Expand Down Expand Up @@ -194,6 +198,13 @@ type NeutronAPIDebug struct {
Service bool `json:"service"`
}

type NeutronRouteAnnotations struct {
// +kubebuilder:validation:Optional
// +kubebuilder:default="60"
// HAProxy Timeout for route
Timeout string `json:"timeout"`
}

// NeutronAPIStatus defines the observed state of NeutronAPI
type NeutronAPIStatus struct {
// ReadyCount of neutron API instances
Expand Down
8 changes: 8 additions & 0 deletions config/crd/bases/neutron.openstack.org_neutronapis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2092,6 +2092,14 @@ spec:
to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
type: object
type: object
routeAnnotations:
description: RouteAnnotations to be added to the created route
properties:
timeout:
default: "60"
description: HAProxy Timeout for route
type: string
type: object
secret:
description: Secret containing OpenStack password information for
NeutronDatabasePassword, NeutronPassword
Expand Down
2 changes: 2 additions & 0 deletions config/samples/neutron_v1beta1_neutronapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ spec:
containerImage: quay.io/podified-antelope-centos9/openstack-neutron-server:current-podified
replicas: 1
secret: neutron-secret
routeAnnotations:
timeout: 120s
6 changes: 6 additions & 0 deletions controllers/neutronapi_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -412,12 +412,18 @@ func (r *NeutronAPIReconciler) reconcileInit(
ports[metallbcfg.Endpoint] = portCfg
}

routeAnnotations := make(map[string]string)
if instance.Spec.RouteAnnotations.Timeout != "" {
routeAnnotations["haproxy.router.openshift.io/timeout"] = instance.Spec.RouteAnnotations.Timeout
}

apiEndpoints, ctrlResult, err := endpoint.ExposeEndpoints(
ctx,
helper,
neutronapi.ServiceName,
serviceLabels,
ports,
routeAnnotations,
time.Duration(5)*time.Second,
)
if err != nil {
Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,5 @@ 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

0 comments on commit 7c468ae

Please sign in to comment.