-
Notifications
You must be signed in to change notification settings - Fork 544
[Controller] Enable Readiness and Liveness probes configurations #3629
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
[Controller] Enable Readiness and Liveness probes configurations #3629
Conversation
66e16e9
to
a2885be
Compare
0fed582
to
d309668
Compare
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.
Nice work!
Added some comments regarding the tests.
@@ -751,6 +752,30 @@ func (suite *lazyTestSuite) TestEnrichDeploymentFromPlatformConfiguration() { | |||
suite.Require().True(deployment.Spec.Paused) | |||
} | |||
|
|||
func (suite *lazyTestSuite) TestEnrichProbesInPopulateDeploymentContainer() { | |||
// Prepare | |||
functionInstance := suite.getFunctionInstance("") |
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.
While I understand it is not needed in this test, it's not a good practice to create functions with empty names.
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.
Fixed - here
func (suite *lazyTestSuite) TestEnrichProbesInPopulateDeploymentContainer() { | ||
// Prepare | ||
functionInstance := suite.getFunctionInstance("") | ||
testCtx := context.Background() |
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.
no need for that, you can use suite.ctx
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.
Fixed - here
|
||
// Prepare | ||
functionName := "func-hello-world" | ||
testNum := int32(14) |
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.
Give variables meaningful names.
In this case it should be timeoutSeconds
, or even livenessProbeTimeoutSeconds
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.
Fixed - here
createFunctionOptions.FunctionConfig.Spec.LivenessProbe = &v1.Probe{TimeoutSeconds: testNum} | ||
|
||
// Act | ||
result, deployErr := suite.Platform.CreateFunction(suite.Ctx, createFunctionOptions) |
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.
Use suite.DeployFunction
instead, as it wraps the function creation in extra enrichments, error handling (such as timeouts), and gracefully deletes the function before existing.
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.
Fixed - here
Note- all the changes below this line are basically moving the container's tests inside the suite.DeployFunction
scope.
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.
Very good.
Just a couple of minor things regarding tests.
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.
LGTM :)
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.
Great stuff!
Motivation
Described in the JIRA
Root Cause
Nuclio functions previously used default values for readiness and liveness probes, with no user-facing way to customize them. This limited flexibility in production environments, where probe tuning is often necessary to accommodate different workloads.
Description
This PR introduces support for configuring readiness and liveness probes by propagating the probe configurations to the container-level configuration.
Affected Areas
functionInstance.Spec.LivenessProbe
andfunctionInstance.Spec.ReadinessProbe
to other unit tests.This addition was necessary because some tests invoke lazyClient.CreateOrUpdate which is affected by this PR.
These changes maintain the tests' consistency.
Testing
CreateOrUpdate
changes were Covered by unit testsChanges Made
ReadinessProbe
andLivenessProbe
fields to be taken from the function specification instead of using static values.