openshift / vertical-pod-autoscaler-operator

An Operator for running the Vertical Pod Autoscaler on OpenShift
Apache License 2.0
27 stars 30 forks source link

Add explicit security contexts to remove all privs #121

Closed joelsmith closed 2 years ago

joelsmith commented 2 years ago

This should fix warnings showing up in CI and operator logs. For example:

Warning: would violate PodSecurity "restricted:latest": allowPrivilegeEscalation != false (containers "mutate-csv-and-generate-sqlite-db", "vpa-operator-registry" must set securityContext.allowPrivilegeEscalation=false), unrestricted capabilities (containers "mutate-csv-and-generate-sqlite-db", "vpa-operator-registry" must set securityContext.capabilities.drop=["ALL"]), runAsNonRoot != true (pod or containers "mutate-csv-and-generate-sqlite-db", "vpa-operator-registry" must set securityContext.runAsNonRoot=true), seccompProfile (pod or containers "mutate-csv-and-generate-sqlite-db", "vpa-operator-registry" must set securityContext.seccompProfile.type to "RuntimeDefault" or "Localhost")
openshift-ci[bot] commented 2 years ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: joelsmith

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: - ~~[OWNERS](https://github.com/openshift/vertical-pod-autoscaler-operator/blob/master/OWNERS)~~ [joelsmith] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
openshift-ci[bot] commented 2 years ago

@joelsmith: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-aws-olm 9736140764751e79d5138e083effa12d48e74560 link true /test e2e-aws-olm
ci/prow/e2e-aws-operator 9736140764751e79d5138e083effa12d48e74560 link true /test e2e-aws-operator

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
joelsmith commented 2 years ago

Test fails when VPA operator deployment can't start its pods:

      message: 'pods "vertical-pod-autoscaler-operator-6b586f464c-" is forbidden:
        unable to validate against any security context constraint: [provider "anyuid":
        Forbidden: not usable by user or serviceaccount, pod.metadata.annotations[container.seccomp.security.alpha.kubernetes.io/vertical-pod-autoscaler-operator]:
        Forbidden: seccomp may not be set, provider "nonroot": Forbidden: not usable
        by user or serviceaccount, provider "hostmount-anyuid": Forbidden: not usable
        by user or serviceaccount, provider "machine-api-termination-handler": Forbidden:
        not usable by user or serviceaccount, provider "hostnetwork": Forbidden: not
        usable by user or serviceaccount, provider "hostaccess": Forbidden: not usable
        by user or serviceaccount, provider "node-exporter": Forbidden: not usable
        by user or serviceaccount, provider "privileged": Forbidden: not usable by
        user or serviceaccount]'

The error message doesn't give any info on how it failed to validate against restricted which is the SCC I would expect it to use.

openshift-ci[bot] commented 2 years ago

@joelsmith: PR needs rebase.

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.
openshift-bot commented 2 years ago

Issues go stale after 90d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close. Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle stale

openshift-bot commented 2 years ago

Stale issues rot after 30d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle rotten. Rotten issues close after an additional 30d of inactivity. Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle rotten /remove-lifecycle stale

openshift-bot commented 2 years ago

Rotten issues close after 30d of inactivity.

Reopen the issue by commenting /reopen. Mark the issue as fresh by commenting /remove-lifecycle rotten. Exclude this issue from closing again by commenting /lifecycle frozen.

/close

openshift-ci[bot] commented 2 years ago

@openshift-bot: Closed this PR.

In response to [this](https://github.com/openshift/vertical-pod-autoscaler-operator/pull/121#issuecomment-1254348440): >Rotten issues close after 30d of inactivity. > >Reopen the issue by commenting `/reopen`. >Mark the issue as fresh by commenting `/remove-lifecycle rotten`. >Exclude this issue from closing again by commenting `/lifecycle frozen`. > >/close Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.