Skip to content

HealthCheck: add validation for minimum accepted start-interval (1ms)#46646

Merged
neersighted merged 1 commit intomoby:masterfrom
thaJeztah:start_interval_validation
Oct 16, 2023
Merged

HealthCheck: add validation for minimum accepted start-interval (1ms)#46646
neersighted merged 1 commit intomoby:masterfrom
thaJeztah:start_interval_validation

Conversation

@thaJeztah
Copy link
Member

This is a follow-up to 2216d3c (#40894), which implemented the StartInterval for health-checks, but did not add validation for the minimum accepted interval;

The time to wait between checks in nanoseconds during the start period.
It should be 0 or at least 1000000 (1 ms). 0 means inherit.

This patch adds validation for the minimum accepted interval (1ms).

- What I did

- How I did it

- How to verify it

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

@thaJeztah thaJeztah added this to the 25.0.0 milestone Oct 14, 2023
@thaJeztah thaJeztah requested a review from cpuguy83 October 14, 2023 16:45
@thaJeztah
Copy link
Member Author

Also wondering if setting a start-interval without a StartPeriod (or StartInterval > StartPeriod ) should be an error-condition 🤔 wdyt?

Copy link
Member

@cpuguy83 cpuguy83 left a comment

Choose a reason for hiding this comment

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

This seems ok however I think the absolute minimum would need to be 1s and that is pushing it.
Really I guess the API type should be in seconds, I just copied what we'd already had for interval IIRC.

@thaJeztah
Copy link
Member Author

Yeah, the currently minimum is quite short. ISTR we had some discussion around that when it was originally implemented, and at the time 1 second was considered possibly too long (or we didn't want to be too restrictive), and we chose to at least set "some" minimum to prevent the accidental invalid value (the integer being used as 'seconds' by the user.. )

Changing the API to use seconds may have been better in hindsight, but I guess that ship has sailed (although second MAY be too large of a precision?)

@thaJeztah
Copy link
Member Author

For a slight bit of context; I arrived here when I was revendoring moby in BuildKit, and noticed that it was using the api/types/container package just for the MinimumDuration const. Looking at that const, I noticed that our image-spec does not mention any of the minimum limits; https://github.com/moby/moby/blob/366a5f1d748659e2776143edbcd148914ab93b42/image/spec/spec.md

So, I was considering to;

  • define the minimum as part of our spec
  • provide the const as part of the go-implementation of the spec
  • possibly add some of the verify utilities in it (so that both buildkit and moby can use the same)

This is a follow-up to 2216d3c, which
implemented the StartInterval for health-checks, but did not add validation
for the minimum accepted interval;

> The time to wait between checks in nanoseconds during the start period.
> It should be 0 or at least 1000000 (1 ms). 0 means inherit.

This patch adds validation for the minimum accepted interval (1ms).

Signed-off-by: Sebastiaan van Stijn <[email protected]>
@thaJeztah thaJeztah force-pushed the start_interval_validation branch from ab148fa to 2df6980 Compare October 16, 2023 08:46
@thaJeztah thaJeztah changed the title HealthCheck: add validation for minimum accepted interval (1ms) HealthCheck: add validation for minimum accepted start-interval (1ms) Oct 16, 2023
@neersighted neersighted merged commit fd3066c into moby:master Oct 16, 2023
@thaJeztah thaJeztah deleted the start_interval_validation branch October 16, 2023 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants