Skip to content

[Merged by Bors] - Mark pods for expiry when secrets are no longer applicable #114

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

Closed
wants to merge 14 commits into from

Conversation

nightkr
Copy link
Member

@nightkr nightkr commented Apr 12, 2022

Description

Fixes #92.

Review Checklist

  • Code contains useful comments
  • (Integration-)Test cases added (or not applicable)
  • Documentation added (or not applicable)
  • Changelog updated (or not applicable)
  • Cargo.toml only contains references to git tags (not specific commits or branches)
  • Helm chart can be installed and deployed operator works (or not applicable)

Once the review is done, comment bors r+ (or bors merge) to merge. Further information

@nightkr nightkr self-assigned this Apr 12, 2022
@nightkr nightkr changed the title Mark pods with expiry time Mark pods for expiry Apr 12, 2022
@nightkr nightkr changed the title Mark pods for expiry Mark pods for expiry when secrets are no longer applicable Apr 12, 2022
@nightkr
Copy link
Member Author

nightkr commented Apr 12, 2022

Do we want this to be opt-in (but disabled by default), opt-out (but enabled by default), or mandatory? Originally the issue was written assuming that this would be opt-in, but thinking about it a bit more I'm leaning towards making it mandatory for now, and transitioning towards opt-out once we implement hot-updating secrets in secret-op.

nightkr added a commit to stackabletech/commons-operator that referenced this pull request Apr 20, 2022
This is the flip side of
stackabletech/secret-operator#114,
and implements the actual deletion of the pods once they expire.
nightkr added a commit to stackabletech/commons-operator that referenced this pull request Apr 20, 2022
This is the flip side of
stackabletech/secret-operator#114,
and implements the actual deletion of the pods once they expire.
@nightkr nightkr marked this pull request as ready for review April 22, 2022 09:27
@nightkr nightkr requested a review from a team April 22, 2022 09:28
bors bot pushed a commit to stackabletech/commons-operator that referenced this pull request Apr 22, 2022
## Description

This is the flip side of stackabletech/secret-operator#114, and implements the actual eviction of the pods once they expire.

- [X] Time-based eviction (`restarter.stackable.tech/expires-at.{TAG}` annotation)
- [ ] Dependency-based eviction (like the current STS eviction)
bors bot pushed a commit to stackabletech/commons-operator that referenced this pull request Apr 22, 2022
## Description

This is the flip side of stackabletech/secret-operator#114, and implements the actual eviction of the pods once they expire.

- [X] Time-based eviction (`restarter.stackable.tech/expires-at.{TAG}` annotation)
- [ ] Dependency-based eviction (like the current STS eviction)
bors bot pushed a commit to stackabletech/commons-operator that referenced this pull request Apr 22, 2022
## Description

This is the flip side of stackabletech/secret-operator#114, and implements the actual eviction of the pods once they expire.

- [X] Time-based eviction (`restarter.stackable.tech/expires-at.{TAG}` annotation)
- [ ] Dependency-based eviction (like the current STS eviction)
Copy link
Member

@sbernauer sbernauer left a comment

Choose a reason for hiding this comment

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

Looks good overall 👍

Could you please add a Changelog entry?

I'm asking myself if having a hash as tag is a good idea of if it would be better to use the volume name as the tag because of the following reasons:

  • Easier to implement
  • Easier to understand for the user (descriptive names) -> They could also set up monitoring based on the descriptive Pod Labels (I'm used to having that metrics in Prometheus already)
  • No hash collisions

The resulting label names should be always valid as the volume names are also enforced to the same extend as the name below AFAIK

Annotations are key/value pairs. Valid annotation keys have two segments: an optional prefix and name, separated by a slash (/). The name segment is required and must be 63 characters or less, beginning and ending with an alphanumeric character ([a-z0-9A-Z]) with dashes (-), underscores (_), dots (.), and alphanumerics between

@nightkr
Copy link
Member Author

nightkr commented Apr 22, 2022

Easier to understand for the user (descriptive names) -> They could also set up monitoring based on the descriptive Pod Labels (I'm used to having that metrics in Prometheus already)

Yeah, this is one reason for the hash IMO, since this is more of an implementation detail than a part of secret-op's public API.

We can always change this to something more human-readable later on, if we want to..

No hash collisions

On the other hand, we increase the risk of name collisions, since we can't really namespace them anymore (without the annotations becoming gargantuan, anyway).

Do you think it is overkill to check if we have a hash collision by reading the existing Pod and make sure we don't have a collision (and if so use another tag)?

Well, there can be valid reasons to overwrite the annotation, if we're retrying a previously failed provisioning (or reprovisioning the secret for an existing pod). If we want to tackle this more seriously then I'd rather switch to a "real" cryptographic hash (like SHA-2 or Blake2...).

@nightkr nightkr requested a review from sbernauer April 22, 2022 14:23
Copy link
Member

@sbernauer sbernauer left a comment

Choose a reason for hiding this comment

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

Please add it to the CHANGELOG and were good to go. Thanks!

@nightkr
Copy link
Member Author

nightkr commented May 3, 2022

@sbernauer Added changelog and replaced fnv with truncated sha2.

@nightkr nightkr requested a review from sbernauer May 3, 2022 14:38
Co-authored-by: Sebastian Bernauer <[email protected]>
@nightkr
Copy link
Member Author

nightkr commented May 4, 2022

bors r+

bors bot pushed a commit that referenced this pull request May 4, 2022
@bors
Copy link
Contributor

bors bot commented May 4, 2022

Build failed:

@nightkr
Copy link
Member Author

nightkr commented May 4, 2022

bors retry

bors bot pushed a commit that referenced this pull request May 4, 2022
@bors
Copy link
Contributor

bors bot commented May 4, 2022

Pull request successfully merged into main.

Build succeeded:

@bors bors bot changed the title Mark pods for expiry when secrets are no longer applicable [Merged by Bors] - Mark pods for expiry when secrets are no longer applicable May 4, 2022
@bors bors bot closed this May 4, 2022
@bors bors bot deleted the feature/expire-pods branch May 4, 2022 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow pods to opt into getting killed when their secrets are about to expire
2 participants