-
Notifications
You must be signed in to change notification settings - Fork 61
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 label selector option for Secret and ConfigMap sources #258
Conversation
Hi @ocampeau. Thanks for your PR. I'm waiting for a cert-manager member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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. |
Signed-off-by: Olivier Campeau <oli.campeau@gmail.com> chore(apis): add comments to new types Signed-off-by: Olivier Campeau <oli.campeau@gmail.com> chore(lint): undo remove whiteline chore(lint): undo remove whiteline chore(lint): undo remove whiteline Signed-off-by: Olivier Campeau <oli.campeau@gmail.com> chore(lint): undo remove whiteline Signed-off-by: Olivier Campeau <oli.campeau@gmail.com>
5e75834
to
6b2c091
Compare
I wonder if we need to extend the API with "new source types"; could we instead just extend the existing source apiVersion: trust.cert-manager.io/v1alpha1
kind: Bundle
metadata:
name: some-bundle
spec:
sources:
- useDefaultCAs: true
- configMap:
key: ca.crt
name: my-configmap
- configMap:
key: ca.crt
selector:
matchLabels:
fruit: apple
- secret:
key: ca.crt
name: my-secret
- secret:
key: ca.crt
selector:
matchLabels:
fruit: banana
target:
configMap:
key: ca.crt |
Yeah definitely! I will update my PR to reuse the existing source type like you mention. It's much better like that. |
Signed-off-by: Olivier Campeau <oli.campeau@gmail.com>
cea1ac1
to
5be4f8b
Compare
Signed-off-by: Olivier Campeau <oli.campeau@gmail.com> improve readability Signed-off-by: Olivier Campeau <oli.campeau@gmail.com> improve readability Signed-off-by: Olivier Campeau <oli.campeau@gmail.com> improve readability Signed-off-by: Olivier Campeau <oli.campeau@gmail.com> improve readability Signed-off-by: Olivier Campeau <oli.campeau@gmail.com> update comments Signed-off-by: Olivier Campeau <oli.campeau@gmail.com> update comment
5be4f8b
to
ac2641b
Compare
It's done. Let me know what you think. |
/ok-to-test |
Signed-off-by: Olivier Campeau <oli.campeau@gmail.com>
Signed-off-by: Olivier Campeau <oli.campeau@gmail.com>
Signed-off-by: Olivier Campeau <oli.campeau@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some review comments, but mostly nits. I am prepared to move forward with this PR when the code looks good. Well done @ocampeau! 😍
Co-authored-by: Erik Godding Boye <egboye@gmail.com> Signed-off-by: Olivier Campeau <40877483+ocampeau@users.noreply.github.com>
Co-authored-by: Erik Godding Boye <egboye@gmail.com> Signed-off-by: Olivier Campeau <40877483+ocampeau@users.noreply.github.com>
Co-authored-by: Erik Godding Boye <egboye@gmail.com> Signed-off-by: Olivier Campeau <40877483+ocampeau@users.noreply.github.com>
Signed-off-by: Olivier Campeau <oli.campeau@gmail.com>
Signed-off-by: Olivier Campeau <oli.campeau@gmail.com>
Signed-off-by: Olivier Campeau <oli.campeau@gmail.com>
/retest-required |
Signed-off-by: Olivier Campeau <oli.campeau@gmail.com>
@ocampeau This is an awesome new feature❤️! |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: inteon The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
I have resolved all conversation except this one: #258 (comment) Let me know if this is acceptable or not. Thanks a lot for accepting this PR by the way, it will really help us. It was a pleasure to contribute to this project. |
a522147
to
aed12bd
Compare
Signed-off-by: Olivier Campeau <oli.campeau@gmail.com> small nits Signed-off-by: Olivier Campeau <oli.campeau@gmail.com> remove file Signed-off-by: Olivier Campeau <oli.campeau@gmail.com>
Any ETA on when this could potentially be merged? Do you have documentation on the release velocity of this project? |
Sorry, I have been very busy lately. Will try to review this weekend if @inteon hasn't reviewed and merged it before. We have a couple of unreleased changes already, so I would suggest considering releasing 0.8.0 after this PR is merged. WDYT, @inteon? Sorry for the delay, @ocampeau! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor nits left, but this is close to a LGTM from me!
pkg/webhook/validation.go
Outdated
el = append(el, field.Invalid(path, "name: ' ', selector: nil", "must validate one and only one schema (oneOf): [name, selector]. Found none valid")) | ||
} | ||
if len(configMap.Name) > 0 && configMap.Selector != nil { | ||
el = append(el, field.Invalid(path, fmt.Sprintf("name: %s, selector: {}", configMap.Name), "must validate one and only one schema (oneOf): [name, selector]. Found none valid")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
el = append(el, field.Invalid(path, fmt.Sprintf("name: %s, selector: {}", configMap.Name), "must validate one and only one schema (oneOf): [name, selector]. Found none valid")) | |
el = append(el, field.Invalid(path, fmt.Sprintf("name: %s, selector: {}", configMap.Name), "must validate one and only one schema (oneOf): [name, selector]. Found both set")) |
I am not sure about the error message here, but it should indicate that we detected both set - which is invalid.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think Found both set
is good. It makes sens to me at least.
Signed-off-by: Olivier Campeau <oli.campeau@gmail.com>
Signed-off-by: Olivier Campeau <oli.campeau@gmail.com>
/lgtm |
Sure I can add documentation. I'll take a look into it |
Documentation added with this PR: cert-manager/website#1391 |
This PR adds support to use label selector for Secret and ConfigMap sources.
Given a
Bundle
that looks like this:this behavior will happen:
Secret
that has labelfruit: banana
and a keyca.crt
will have the value ofca.crt
included in theBundle
ConfigMap
that has labelfruit: apple
and a keyca.crt
will have the value ofca.crt
included in theBundle
Multiple
configMapLabelSelector
andsecretMapLabelSelector
are supported.In a case like this:
then:
ConfigMap
that has labelfruit: banana
and a keyca.crt
will have the value ofca.crt
included in theBundle
ConfigMap
that has labelfruit: apple
and a keyca.crt
will have the value ofca.crt
included in theBundle
fixes #256