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

Add a clusterpolicy to set default for .spec.activeDeadlineSeconds #33

Merged
merged 3 commits into from
Nov 5, 2021

Conversation

simu
Copy link
Member

@simu simu commented Nov 3, 2021

Create a new cluster policy which ensures that .spec.activeDeadlineSeconds is set on all "runonce" pods (pods with .spec.restartPolicy set to "OnFailure" or "Never").

This policy doesn't modify "runonce" pods which already have .spec.activeDeadlineSeconds set.

All other "runonce" pods are configured with the global default activeDeadlineSeconds value extracted from component parameter runOnceActiveDeadlineSeconds.defaultActiveDeadlineSeconds.

Users can override the default value on individual namespaces by setting annotation with key runOnceActiveDeadlineSeconds.overrideAnnotationKey to the desired default value for pods in that namespace.

Checklist

  • Keep pull requests small so they can be easily reviewed.
  • Update the documentation.
  • Categorize the PR by setting a good title and adding one of the labels:
    bug, enhancement, documentation, change, breaking, dependency
    as they show up in the changelog

@simu simu added the enhancement New feature or request label Nov 3, 2021
@simu simu force-pushed the feat/runonce-activedeadlineseconds branch 2 times, most recently from 76b82b9 to 45ce3b4 Compare November 3, 2021 13:45
Create a new cluster policy which ensures that
`.spec.activeDeadlineSeconds` is set on all "runonce" pods (pods with
`.spec.restartPolicy` set to "OnFailure" or "Never").

This policy doesn't modify "runonce" pods which already have
`.spec.activeDeadlineSeconds` set.

All other "runonce" pods are configured with the global default
activeDeadlineSeconds value extracted from component parameter
`runOnceActiveDeadlineSeconds.defaultActiveDeadlineSeconds`.

Users can override the default value on individual namespaces by setting
annotation with key `runOnceActiveDeadlineSeconds.overrideAnnotationKey`
to the desired default value for pods in that namespace.
@simu simu force-pushed the feat/runonce-activedeadlineseconds branch from 45ce3b4 to fad04e6 Compare November 3, 2021 13:46
@simu simu changed the title Create clusterpolicy to configure .spec.activeDeadlineSeconds Add a clusterpolicy to set default for .spec.activeDeadlineSeconds Nov 3, 2021
@simu simu requested review from corvus-ch and glrf November 3, 2021 13:47
Copy link
Contributor

@corvus-ch corvus-ch left a comment

Choose a reason for hiding this comment

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

If the policy acts like it is described, this is looking good to me.

class/defaults.yml Outdated Show resolved Hide resolved
* Default `.metadata.annotations` to the empty object if it's null
* Default to the global default activeDeadlineSeconds if annotation
  cannot be parsed as a number.

Co-authored-by: Fabian Fischer <[email protected]>
@simu simu force-pushed the feat/runonce-activedeadlineseconds branch from 78ff0b8 to f7d3b34 Compare November 3, 2021 14:57
@simu simu requested review from glrf and corvus-ch November 3, 2021 15:01
@simu simu merged commit 5d7683d into master Nov 5, 2021
@simu simu deleted the feat/runonce-activedeadlineseconds branch November 5, 2021 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants