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

invalid location for assignmetadata na-assign-label-podsecurity: metadata.labels.pod-security."kubernetes.io/enforce" #2877

Closed
papanito opened this issue Jul 14, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@papanito
Copy link

What steps did you take and what happened:
[A clear and concise description of what the bug is.]

I apply the following yaml file

apiVersion: mutations.gatekeeper.sh/v1alpha1
kind: AssignMetadata
metadata:
  name: na-assign-label-podsecurity
spec:
  match:
    scope: Cluster
    kinds:
      - apiGroups: ["*"]
        kinds: ["Namespace"]
  location: 'metadata.labels.pod-security."kubernetes.io/enforce"'
  parameters:
    assign:
      value: "restricted"

I will get this error:

invalid location for assignmetadata na-assign-label-podsecurity: metadata.labels.pod-security."kubernetes.io/enforce"

What did you expect to happen:

No Errors

Anything else you would like to add:
[Miscellaneous information that will assist in solving the issue.]

N/A

Environment:

  • Gatekeeper version: 3.10.0
  • Kubernetes version: (use kubectl version): 1.26.6
@papanito papanito added the bug Something isn't working label Jul 14, 2023
@ritazh
Copy link
Member

ritazh commented Jul 14, 2023

Can you try

‘metadata.labels.”pod-security.kubernetes.io/enforce"'

@papanito
Copy link
Author

Thanks @ritazh that did the trick, now it works

@ritazh
Copy link
Member

ritazh commented Jul 18, 2023

Glad it worked for you!

@djsly
Copy link

djsly commented Apr 23, 2024

just stumbled on this problem, I was looking for the format, it might be good to update the DOC with this example maybe ?

https://open-policy-agent.github.io/gatekeeper/website/docs/mutation/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants