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

Feature Request: annotating rule for spec.matches.labelSelector #93

Closed
dulltz opened this issue Dec 7, 2020 · 4 comments
Closed

Feature Request: annotating rule for spec.matches.labelSelector #93

dulltz opened this issue Dec 7, 2020 · 4 comments
Labels
good first issue Good for newcomers

Comments

@dulltz
Copy link
Contributor

dulltz commented Dec 7, 2020

I would like to use Constraint's spec.match.labelSelector,
but konstraint seems to only supports spec.match.kinds now. (ref)

Also, as described in #56, rerunning of konstraint create erases existing spec.match.labelSelector.

We should support an annotation rule for generating spec.matches.labelSelector.

@dulltz
Copy link
Contributor Author

dulltz commented Dec 7, 2020

I want to add annotation rules like the following example.

Supporting all representations of labelSelector with annotation rules would be complicated, so I think it is simpler to support only matchLabels.

# @matchlabels app=a team=b
package foo

import data.lib.core
...

apiVersion: constraints.gatekeeper.sh/v1beta1
kind: Foo
metadata:
  name: foo
spec:
  match:
    labelSelector:
      matchLabels:
        app: a
        team: b

@jalseth
Copy link
Collaborator

jalseth commented Dec 7, 2020

I think this approach makes sense. We will start with matchLabels and we can look into adding support for matchExpressions if that is requested in the future. If you have the time, we'd welcome a PR to add this!

@dulltz
Copy link
Contributor Author

dulltz commented Dec 8, 2020

@jalseth
I created the PR #94. May I ask for your review?

@jalseth
Copy link
Collaborator

jalseth commented Dec 11, 2020

Implemented in #94

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants