Skip to content

Commit

Permalink
Add support for configuring route annotations #168
Browse files Browse the repository at this point in the history
  • Loading branch information
lewisdenny committed Jul 3, 2023
1 parent 9899c31 commit e6d9235
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 1 deletion.
11 changes: 11 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,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
Expand Down
12 changes: 12 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"`

// +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
Expand Down Expand Up @@ -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
Expand Down
23 changes: 23 additions & 0 deletions api/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 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,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
Expand Down
2 changes: 1 addition & 1 deletion config/samples/neutron_v1beta1_neutronapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
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
}

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 {
Expand Down

0 comments on commit e6d9235

Please sign in to comment.