-
Notifications
You must be signed in to change notification settings - Fork 19
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
base: main
Are you sure you want to change the base?
Conversation
[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 |
Depends-On: openstack-k8s-operators/placement-operator#270 Depends-On: openstack-k8s-operators/nova-operator#891 ref OSPRH-10962 ref OSPRH-10955
@@ -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")) |
There was a problem hiding this comment.
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 | ||
} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
iirc, neutron was the first one adding this https://github.com/openstack-k8s-operators/neutron-operator/blob/main/api/v1beta1/neutronapi_webhook.go. we have functional tests as part of the openstack-operaotr https://github.com/openstack-k8s-operators/openstack-operator/blob/main/tests/functional/ctlplane/openstackoperator_controller_test.go#L855
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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")) | |||
}) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At least we need to extend https://github.com/openstack-k8s-operators/openstack-operator/blob/main/tests/functional/ctlplane/openstackoperator_controller_test.go#L855 when we integrate this patch into the openstack-operator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
api/v1beta1/placementapi_webhook.go
Outdated
valPlacementAPI, okPlacemenAPI := annotations[placementAnno] | ||
valHAProxy, okHAProxy := annotations[haProxyAnno] | ||
// Human operator set the HAProxy timeout manually | ||
if !okPlacemenAPI && okHAProxy { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this 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 | ||
} |
There was a problem hiding this comment.
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")) | |||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At least we need to extend https://github.com/openstack-k8s-operators/openstack-operator/blob/main/tests/functional/ctlplane/openstackoperator_controller_test.go#L855 when we integrate this patch into the openstack-operator.
Depends-On: openstack-k8s-operators/placement-operator#270 Depends-On: openstack-k8s-operators/nova-operator#891 ref OSPRH-10962 ref OSPRH-10955
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