Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a parameter 'apiTimeout' to allow customization #270

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mrkisaolamb
Copy link
Contributor

to the Apache timeout.

The default is set to 60s which we do set for
HAProxy timeouts currently.

To be able to change the HAProxy value based on the apiTimeout with any update (and not just the first time) the code adds a custom annotation "api.placement.openstack.org/timeout" with the value that was initially set, this way flags it as being set by the placement-operator.

Timeout is global for both api and metadata and they are set from placement lvl

There will be follow up patch in openstack-operator to utilize the method 'SetDefaultRouteAnnotations' to set these default route annotations in openstack-operator

resolve: https://issues.redhat.com/browse/OSPRH-10962

@openshift-ci openshift-ci bot requested review from kk7ds and olliewalsh November 26, 2024 08:31
Copy link
Contributor

openshift-ci bot commented Nov 26, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mrkisaolamb

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@@ -344,6 +344,9 @@ var _ = Describe("PlacementAPI controller", func() {
myCnf := cm.Data["my.cnf"]
Expect(myCnf).To(
ContainSubstring("[client]\nssl=0"))
configData := cm.Data["httpd.conf"]
Expect(configData).Should(
ContainSubstring("TimeOut 60"))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

timeout := fmt.Sprintf("%ds", spec.APITimeout)
annotations[placementAnno] = timeout
annotations[haProxyAnno] = timeout
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels sensible. Thanks for taking care of the possible conflicts.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if the other operators using the same logic. At least they should. And then This function can be abstracted to lib-common as it only need the annotations param and a service specific annotation param but it does not depend on the spec at all.

Copy link
Contributor

@stuggi stuggi Dec 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if the other operators using the same logic. At least they should. And then This function can be abstracted to lib-common as it only need the annotations param and a service specific annotation param but it does not depend on the spec at all.

yes all operators use same logic so it can be move to lib-common but maybe as a follow up?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

follow up works for me

@@ -344,6 +344,9 @@ var _ = Describe("PlacementAPI controller", func() {
myCnf := cm.Data["my.cnf"]
Expect(myCnf).To(
ContainSubstring("[client]\nssl=0"))
configData := cm.Data["httpd.conf"]
Expect(configData).Should(
ContainSubstring("TimeOut 60"))
})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have a way to test the annotations on the Route? I guess not in functional env as the Route is only created by the openstack-operator but maybe in the kuttl env?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

valPlacementAPI, okPlacemenAPI := annotations[placementAnno]
valHAProxy, okHAProxy := annotations[haProxyAnno]
// Human operator set the HAProxy timeout manually
if !okPlacemenAPI && okHAProxy {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please log why the annotation wasn't updated

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure if this is good idea to log that nothing happend, this sounds like something that make only noise in logs

to the Apache timeout.

The default is set to 60s which we do set for
HAProxy timeouts currently.

To be able to change the HAProxy value based on the apiTimeout with
any update (and not just the first time) the code adds a custom
annotation "api.placement.openstack.org/timeout" with the value that was
initially set, this way flags it as being set by the placement-operator.

There will be follow up patch in openstack-operator
to utilize the method 'SetDefaultRouteAnnotations' to set
these default route annotations in openstack-operator
Copy link
Collaborator

@gibizer gibizer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a testing question still open. Do you have an openstack-operator patch integrating this change into there?

timeout := fmt.Sprintf("%ds", spec.APITimeout)
annotations[placementAnno] = timeout
annotations[haProxyAnno] = timeout
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

follow up works for me

controllers/placementapi_controller.go Show resolved Hide resolved
@@ -344,6 +344,9 @@ var _ = Describe("PlacementAPI controller", func() {
myCnf := cm.Data["my.cnf"]
Expect(myCnf).To(
ContainSubstring("[client]\nssl=0"))
configData := cm.Data["httpd.conf"]
Expect(configData).Should(
ContainSubstring("TimeOut 60"))
})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mrkisaolamb added a commit to mrkisaolamb/openstack-operator that referenced this pull request Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants