Skip to content

Commit

Permalink
Add default timeout for Octavia API route annotations
Browse files Browse the repository at this point in the history
Add the timeout property as required annotation for the Octavia API
Route. This needs to be followed by a commit in openstack-operator
since the route is defined there, where we will call to
GetDefaultRouteAnnotations method added here.
  • Loading branch information
Fernando Royo committed Sep 13, 2024
1 parent 6722dfd commit 1eb1db0
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 0 deletions.
3 changes: 3 additions & 0 deletions api/bases/octavia.openstack.org_octavias.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ spec:
apacheContainerImage:
description: Apache Container Image URL
type: string
apiTimeout:
description: Octavia API timeout
type: string
customServiceConfig:
default: '# add your customization here'
description: CustomServiceConfig - customize the service config using
Expand Down
8 changes: 8 additions & 0 deletions api/v1beta1/octavia_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ const (

// ApacheImage - default fall-back image for Apache
ApacheContainerImage = "registry.redhat.io/ubi9/httpd-24:latest"

// Octavia API timeout
APITimeout = "120"
)

// OctaviaSpec defines the desired state of Octavia
Expand Down Expand Up @@ -201,6 +204,10 @@ type OctaviaSpecBase struct {
// Apache Container Image URL
ApacheContainerImage string `json:"apacheContainerImage"`

// +kubebuilder:validation:Optional
// Octavia API timeout
APITimeout string `json:"apiTimeout,omitempty"`

// +kubebuilder:validation:Required
// +kubebuilder:default=octavia
// OctaviaNetworkAttachment is a NetworkAttachment resource name for the Octavia Management Network
Expand Down Expand Up @@ -343,6 +350,7 @@ func SetupDefaults() {
HealthManagerContainerImageURL: util.GetEnvVar("RELATED_IMAGE_OCTAVIA_HEALTHMANAGER_IMAGE_URL_DEFAULT", OctaviaHealthManagerContainerImage),
WorkerContainerImageURL: util.GetEnvVar("RELATED_IMAGE_OCTAVIA_WORKER_IMAGE_URL_DEFAULT", OctaviaWorkerContainerImage),
ApacheContainerImageURL: util.GetEnvVar("RELATED_IMAGE_OCTAVIA_APACHE_IMAGE_URL_DEFAULT", ApacheContainerImage),
OctaviaAPIRouteTimeout: util.GetEnvVar("OCTAVIA_API_TIMEOUT", APITimeout),
// No default for AmphoraImageContainerImageURL
}

Expand Down
8 changes: 8 additions & 0 deletions api/v1beta1/octavia_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ type OctaviaDefaults struct {
HealthManagerContainerImageURL string
WorkerContainerImageURL string
ApacheContainerImageURL string
OctaviaAPIRouteTimeout string
}

var octaviaDefaults OctaviaDefaults
Expand Down Expand Up @@ -196,3 +197,10 @@ func (r *Octavia) ValidateDelete() (admission.Warnings, error) {
// TODO(user): fill in your validation logic upon object deletion.
return nil, nil
}

func (spec *OctaviaSpec) GetDefaultRouteAnnotations() (annotations map[string]string) {
annotations = map[string]string{
"haproxy.router.openshift.io/timeout": octaviaDefaults.OctaviaAPIRouteTimeout,
}
return
}
3 changes: 3 additions & 0 deletions config/crd/bases/octavia.openstack.org_octavias.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ spec:
apacheContainerImage:
description: Apache Container Image URL
type: string
apiTimeout:
description: Octavia API timeout
type: string
customServiceConfig:
default: '# add your customization here'
description: CustomServiceConfig - customize the service config using
Expand Down
2 changes: 2 additions & 0 deletions config/default/manager_default_images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ spec:
value: quay.io/podified-antelope-centos9/openstack-octavia-worker:current-podified
- name: RELATED_IMAGE_OCTAVIA_APACHE_IMAGE_URL_DEFAULT
value: registry.redhat.io/ubi9/httpd-24:latest
- name: OCTAVIA_API_TIMEOUT
value: "120"

0 comments on commit 1eb1db0

Please sign in to comment.