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

Do not allow gatekeeper to self-manage #94

Merged
merged 1 commit into from Apr 23, 2019

Conversation

maxsmythe
Copy link
Contributor

Signed-off-by: Max Smythe smythe@google.com

Signed-off-by: Max Smythe <smythe@google.com>
@ritazh
Copy link
Member

ritazh commented Apr 22, 2019

Hi @maxsmythe With this PR, I was expecting the following test to succeed. Can you please verify if this is the expected behavior? Perhaps I missed something in the deployment.

Repro steps:

  1. Deploy all gatekeeper things
  2. Deploy k8suniquelabels_template.yaml, then deploy a constraint that checks for label gatekeeper on pod
apiVersion: constraints.gatekeeper.sh/v1alpha1
kind: K8sRequiredLabels
metadata:
  name: pod-must-have-gk
spec:
  match:
    kinds:
      - apiGroups: [""]
        kinds: ["Pod"]
  parameters:
    labels: ["gatekeeper"]
  1. Run kubectl -n gatekeeper-system edit statefulset gatekeeper-controller-manager to update replicas from 1 to 2.
  2. Result:
    Expected behavior:
    With no self-manage, there should be another gatekeeper pod created and running.
    Actual behavior:
    kubectl -n gatekeeper-system describe statefulset.apps/gatekeeper-controller-manager resulted in:
  Warning  FailedCreate      18s (x23 over 4m)  statefulset-controller  create Pod gatekeeper-controller-manager-1 in StatefulSet gatekeeper-controller-manager failed error: admission webhook "validation.gatekeeper.sh" denied the request: you must provide labels: {"gatekeeper"}

Without the constraint, there is no issue with updating the replicas to 2.

@maxsmythe
Copy link
Contributor Author

Seems to me WAI. The stateful set controller isn't running in the gatekeeper-system namespace, which means its service account isn't part of the excluded set of service accounts.

I think it's open to debate whether any objects in the gatekeeper-system namespace should be subject to constraints at all, but this change at least removes the friction around sync finalizers and out-of-compliance resources.

@maxsmythe maxsmythe merged commit 3c593d1 into open-policy-agent:master Apr 23, 2019
@maxsmythe maxsmythe deleted the no-self-management branch July 9, 2019 03:01
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.

None yet

2 participants