Skip to content

Add labels to secrets - #3537

Closed
thomaspeitz wants to merge 2 commits into
cert-manager:masterfrom
thomaspeitz:add-labels-to-secrets
Closed

thomaspeitz wants to merge 2 commits into
cert-manager:masterfrom
thomaspeitz:add-labels-to-secrets

Conversation

@thomaspeitz

@thomaspeitz thomaspeitz commented Dec 30, 2020 •

Copy link
Copy Markdown

Signed-off-by: Thomas Peitz [email protected]

What this PR does / why we need it:
Add labels from cert-manager and from certificate resource to created TLS secret.

In our example we want to be able to automatically backup TLS secrets via velero (which uses label selectors to backup resources automatically).

Used @meyskens approach and just copied code to fix #2992

Which issue this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close that issue when PR gets merged): fixes #
#2992
#566

Special notes for your reviewer:
Thanks a lot for your review :)

Add labels to secrets

Signed-off-by: Thomas Peitz <[email protected]>
@jetstack-bot jetstack-bot added dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. needs-kind Indicates a PR lacks a `kind/foo` label and requires one. labels Dec 30, 2020
@jetstack-bot

Copy link
Copy Markdown
Contributor

Hi @thomaspeitz. Thanks for your PR.

I'm waiting for a jetstack or cert-manager member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@jetstack-bot jetstack-bot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Dec 30, 2020
@jetstack-bot jetstack-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Dec 30, 2020
@mikebryant

Copy link
Copy Markdown
Member

/ok-to-test

@jetstack-bot jetstack-bot added ok-to-test and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jan 13, 2021
@morremeyer

Copy link
Copy Markdown

/retest

@morremeyer

Copy link
Copy Markdown

@thomaspeitz Could you rebase your commit against master please? The test error does not seem to be related to your change, so I think rebasing should fix it.

@jetstack-bot jetstack-bot added dco-signoff: no Indicates that at least one commit in this pull request is missing the DCO sign-off message. and removed dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. labels Mar 31, 2021
@jetstack-bot

Copy link
Copy Markdown
Contributor

Thanks for your pull request. Before we can look at it, you'll need to add a 'DCO signoff' to your commits.

📝 Please follow instructions in the contributing guide to update your commits with the DCO

Full details of the Developer Certificate of Origin can be found at developercertificate.org.

The list of commits missing DCO signoff:

  • 185d279 Merge remote-tracking branch 'cert-manager/master' into add-labels-to-secrets
Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@jetstack-bot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: thomaspeitz
To complete the pull request process, please assign maelvls
You can assign the PR to them by writing /assign @maelvls in a comment when ready.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@jetstack-bot

Copy link
Copy Markdown
Contributor

@thomaspeitz: The following test failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
pull-cert-manager-bazel 185d279 link /test pull-cert-manager-bazel

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@morremeyer

Copy link
Copy Markdown

@thomaspeitz Could you also Sign-off the commits please? See https://github.com/jetstack/cert-manager/blob/master/CONTRIBUTING.md#dco-sign-off.

And if you’re ready to get it reviewed and merged, please comment /assign maelvls.

@wallrj

wallrj commented May 27, 2021 •

Copy link
Copy Markdown
Member

/milestone Next

I'm adding this to the next milestone during our 2021-05-27 triage session, because it seems like it is close to being mergable and because it solves a much reported issue.

@jetstack-bot

Copy link
Copy Markdown
Contributor

@wallrj: The provided milestone is not valid for this repository. Milestones in this repository: [Next, v1.4]

Use /milestone clear to clear the milestone.

Details

In response to this:

/milestone next

I'm adding this to the next milestone during our 2021-05-27 triage session, because it seems like it is close to being mergable and because it solves a much reported issue.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@wallrj wallrj added this to the Next milestone May 27, 2021
@maelvls

maelvls commented Jul 2, 2021 •

Copy link
Copy Markdown
Member

If I understand correctly, your PR aims at adding "just enough" information in the Secret's labels for Secrets created by cert-manager to be able to "link back" to the owner of that object, which lets you use tools like Velero.

For example, with the following Certificate:

apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
  name: example-com
spec:
  secretName: example-com-tls

Then you expect the Secret created by cert-manager to look like this:

kind: Secret
metadata:
  name: example-com-tls
  labels:
    cert-manager.io/certificate-name: example-com
    cert-manager.io/issuer-name: letsencrypt
    cert-manager.io/issuer-kind: Issuer
    cert-manager.io/issuer-group: cert-manager.io

Do I understand correctly?

Just FYI, #3828 (see associated documentation) will add a field on the Certificate resource that lets you add both labels and annotations to the Secrets generated by cert-manager. An example of Certificate:

apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
  name: example-com
spec:
  secretName: example-com-tls
  # Secret template is optional. If set, these annotations
  # and labels will be copied to the secret named example-com-tls.
  secretTemplate:
    annotations:
      my-secret-annotation-1: "foo"
      my-secret-annotation-2: "bar"
    labels:
      my-secret-environment: example-label

@thomaspeitz

Copy link
Copy Markdown
Author

That would fix my problem completely. No need for my PR anymore. Closing it here :)

@thomaspeitz thomaspeitz closed this Jul 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dco-signoff: no Indicates that at least one commit in this pull request is missing the DCO sign-off message. needs-kind Indicates a PR lacks a `kind/foo` label and requires one. ok-to-test release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Apply Cert Secret Labels

6 participants