Skip to content

Configurable default HealthCheck timeout#121

Merged
ameowlia merged 3 commits intocloudfoundry:mainfrom
plamen-bardarov:configurable-hc-timeout
Jun 4, 2025
Merged

Configurable default HealthCheck timeout#121
ameowlia merged 3 commits intocloudfoundry:mainfrom
plamen-bardarov:configurable-hc-timeout

Conversation

@plamen-bardarov
Copy link
Copy Markdown
Contributor

Summary

Make the declarative Liveness Healthcheck default timeout configurable.

Backward Compatibility

Breaking Change? No

if timeout <= 0 {
timeout = int(t.declarativeHealthCheckDefaultTimeout / time.Millisecond)
}
if timeout <= 0 {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you add a test for this case where the declarativeHealthCheckDefaultTimeout is set to a negative number?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Also maybe we should log in this case? Something like: you gave us an invalid value for X we are setting it to Y instead.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think its better if we only accept valid values for this field instead of relying on this default if the job is misconfigured so I added it to the validation method. However since we receive an already validated object from the rep, testing this is not possible in the executor 😕. I left the <=0 check just in case something changes.

}

func (t *transformer) applyCheckDefaults(timeout int, interval time.Duration, path string) (int, time.Duration, string) {
if timeout == 0 {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you move this logic about defaults to the initializer package where the config is read in? That way the t.declarativeHealthCheckDefaultTimeout property is always correct.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Moved it to the configuration option, which is still called only during initialization.

add tests for negative or zero values for `enable_declarative_healthcheck`
move default timeout setting to initialization
@github-project-automation github-project-automation bot moved this from Inbox to Pending Merge | Prioritized in Application Runtime Platform Working Group May 29, 2025
@ameowlia ameowlia merged commit 78ff519 into cloudfoundry:main Jun 4, 2025
1 check passed
@github-project-automation github-project-automation bot moved this from Pending Merge | Prioritized to Done in Application Runtime Platform Working Group Jun 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

2 participants