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

Comply with OCP/OKD 4.11 and 4.12 Pod Security Standards #2036

Merged
merged 1 commit into from Jul 25, 2022

Conversation

tiraboschi
Copy link
Member

Set something like:

spec:
 securityContext:
   # Do not use SeccompProfile if your project must work on
   # old k8s versions < 1.19 and Openshift < 4.11
   seccompProfile:
      type: RuntimeDefault
   runAsNonRoot: true
 containers:
   - name: my-container
     securityContext:
       allowPrivilegeEscalation: false
       capabilities:
         drop:
           - ALL

following OCP/OKD 4.12 best practices.
This change should be backported to release-1.7
to ensure a smooth upgrade process to the next version.

Signed-off-by: Simone Tiraboschi stirabos@redhat.com

Reviewer Checklist

Reviewers are supposed to review the PR for every aspect below one by one. To check an item means the PR is either "OK" or "Not Applicable" in terms of that item. All items are supposed to be checked before merging a PR.

  • PR Message
  • Commit Messages
  • How to test
  • Unit Tests
  • Functional Tests
  • User Documentation
  • Developer Documentation
  • Upgrade Scenario
  • Uninstallation Scenario
  • Backward Compatibility
  • Troubleshooting Friendly

Release note:

Comply with OCP/OKD 4.11 and 4.12 Pod Security Standards

@kubevirt-bot kubevirt-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. size/M labels Jul 20, 2022
@coveralls
Copy link
Collaborator

coveralls commented Jul 20, 2022

Pull Request Test Coverage Report for Build 2710977891

  • 2 of 2 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.02%) to 84.985%

Totals Coverage Status
Change from base Build 2686146258: 0.02%
Covered Lines: 4460
Relevant Lines: 5248

💛 - Coveralls

@hco-bot
Copy link
Collaborator

hco-bot commented Jul 20, 2022

okd-hco-e2e-image-index-gcp lane succeeded.
/override ci/prow/okd-hco-e2e-image-index-aws
okd-hco-e2e-upgrade-index-gcp lane succeeded.
/override ci/prow/okd-hco-e2e-upgrade-index-aws

@kubevirt-bot
Copy link
Contributor

@hco-bot: Overrode contexts on behalf of hco-bot: ci/prow/okd-hco-e2e-image-index-aws, ci/prow/okd-hco-e2e-upgrade-index-aws

In response to this:

okd-hco-e2e-image-index-gcp lane succeeded.
/override ci/prow/okd-hco-e2e-image-index-aws
okd-hco-e2e-upgrade-index-gcp lane succeeded.
/override ci/prow/okd-hco-e2e-upgrade-index-aws

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.

@hco-bot
Copy link
Collaborator

hco-bot commented Jul 20, 2022

hco-e2e-upgrade-prev-index-sno-azure lane succeeded.
/override ci/prow/hco-e2e-upgrade-prev-index-sno-aws

@kubevirt-bot
Copy link
Contributor

@hco-bot: Overrode contexts on behalf of hco-bot: ci/prow/hco-e2e-upgrade-prev-index-sno-aws

In response to this:

hco-e2e-upgrade-prev-index-sno-azure lane succeeded.
/override ci/prow/hco-e2e-upgrade-prev-index-sno-aws

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.

@tiraboschi
Copy link
Member Author

/retest

@hco-bot
Copy link
Collaborator

hco-bot commented Jul 20, 2022

hco-e2e-upgrade-index-sno-aws lane succeeded.
/override ci/prow/hco-e2e-upgrade-index-sno-azure

@kubevirt-bot
Copy link
Contributor

@hco-bot: Overrode contexts on behalf of hco-bot: ci/prow/hco-e2e-upgrade-index-sno-azure

In response to this:

hco-e2e-upgrade-index-sno-aws lane succeeded.
/override ci/prow/hco-e2e-upgrade-index-sno-azure

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.

Copy link
Collaborator

@orenc1 orenc1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have 2 comments:

  1. In the opening message you mentioned that also a seccompProfile should be added to the deployments spec:
   seccompProfile:
      type: RuntimeDefault

But I don't see it in the code changes.

  1. I think we should also update the kubevirt console plugin deployment with the new PSS, which is deployed by HCO and not in the CSV:

Set something like:
```
spec:
 securityContext:
   # Do not use SeccompProfile if your project must work on
   # old k8s versions < 1.19 and Openshift < 4.11
   seccompProfile:
      type: RuntimeDefault
   runAsNonRoot: true
 containers:
   - name: my-container
     securityContext:
       allowPrivilegeEscalation: false
       capabilities:
         drop:
           - ALL
```
following OCP/OKD 4.12 best practices.
This change should be backported to release-1.7
to ensure a smooth upgrade process to the next version.

Signed-off-by: Simone Tiraboschi <stirabos@redhat.com>
@tiraboschi
Copy link
Member Author

I have 2 comments:

done, thanks

@sonarcloud
Copy link

sonarcloud bot commented Jul 21, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@hco-bot
Copy link
Collaborator

hco-bot commented Jul 21, 2022

hco-e2e-upgrade-prev-index-aws lane succeeded.
/override ci/prow/hco-e2e-upgrade-prev-index-azure

@kubevirt-bot
Copy link
Contributor

@hco-bot: Overrode contexts on behalf of hco-bot: ci/prow/hco-e2e-upgrade-prev-index-azure

In response to this:

hco-e2e-upgrade-prev-index-aws lane succeeded.
/override ci/prow/hco-e2e-upgrade-prev-index-azure

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.

@tiraboschi
Copy link
Member Author

/retest

@hco-bot
Copy link
Collaborator

hco-bot commented Jul 21, 2022

hco-e2e-image-index-sno-aws lane succeeded.
/override ci/prow/hco-e2e-image-index-sno-azure

@kubevirt-bot
Copy link
Contributor

@hco-bot: Overrode contexts on behalf of hco-bot: ci/prow/hco-e2e-image-index-sno-azure

In response to this:

hco-e2e-image-index-sno-aws lane succeeded.
/override ci/prow/hco-e2e-image-index-sno-azure

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.

@tiraboschi
Copy link
Member Author

/retest

@tiraboschi
Copy link
Member Author

/retest

2 similar comments
@tiraboschi
Copy link
Member Author

/retest

@tiraboschi
Copy link
Member Author

/retest

@tiraboschi
Copy link
Member Author

   seccompProfile:
      type: RuntimeDefault

is not working on OCP/OKD < 4.11.
Waiting for openshift/release#30734 to properly consume OKD 4.11

@orenc1
Copy link
Collaborator

orenc1 commented Jul 24, 2022

/retest

@openshift-ci
Copy link

openshift-ci bot commented Jul 24, 2022

@tiraboschi: 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/hco-e2e-upgrade-prev-index-azure b1411ac link true /test hco-e2e-upgrade-prev-index-azure
ci/prow/hco-e2e-image-index-sno-azure b1411ac link false /test hco-e2e-image-index-sno-azure

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

@orenc1
Copy link
Collaborator

orenc1 commented Jul 24, 2022

@tiraboschi , looks like seccomp configuration on pods is not yet supported on OKD.
We're consuming OKD 4.10 - the latest release is 4.10.0-0.okd-2022-07-09-073606

        {
            "apiVersion": "v1",
            "count": 1,
            "eventTime": null,
            "firstTimestamp": "2022-07-24T09:56:09Z",
            "involvedObject": {
                "apiVersion": "apps/v1",
                "kind": "ReplicaSet",
                "name": "hco-operator-7f479f7b55",
                "namespace": "kubevirt-hyperconverged",
                "resourceVersion": "28140",
                "uid": "dafe5a10-dc54-467a-b39f-3f6a010f4bd3"
            },
            "kind": "Event",
            "lastTimestamp": "2022-07-24T09:56:09Z",
            "message": "Error creating: pods \"hco-operator-7f479f7b55-zrskt\" is forbidden: unable to validate against any security context constraint: [pod.metadata.annotations.seccomp.security.alpha.kubernetes.io/pod: Forbidden: seccomp may not be set pod.metadata.annotations.container.seccomp.security.alpha.kubernetes.io/hyperconverged-cluster-operator: Forbidden: seccomp may not be set provider \"anyuid\": Forbidden: not usable by user or serviceaccount 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]",
            "metadata": {
                "creationTimestamp": "2022-07-24T09:56:09Z",
                "name": "hco-operator-7f479f7b55.1704bb5cbbefba90",
                "namespace": "kubevirt-hyperconverged",
                "resourceVersion": "28146",
                "uid": "73566fde-adc5-4d89-b8e7-aae2433cb05e"
            },
            "reason": "FailedCreate",
            "reportingComponent": "",
            "reportingInstance": "",
            "source": {
                "component": "replicaset-controller"
            },
            "type": "Warning"
        },

Assuming we must set this up for OCP 4.12, maybe we can manually add the restriced-v2 SCC from OCP, for OKD clusters.

@orenc1
Copy link
Collaborator

orenc1 commented Jul 25, 2022

openshift/release#30734 is merged.
retesting with OKD 4.11
/retest

@tiraboschi
Copy link
Member Author

/cherry-pick release-1.7

@kubevirt-bot
Copy link
Contributor

@tiraboschi: once the present PR merges, I will cherry-pick it on top of release-1.7 in a new PR and assign it to you.

In response to this:

/cherry-pick release-1.7

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.

Copy link
Collaborator

@orenc1 orenc1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve

@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label Jul 25, 2022
@kubevirt-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: orenc1

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubevirt-bot kubevirt-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 25, 2022
@kubevirt-bot kubevirt-bot merged commit 0958078 into kubevirt:main Jul 25, 2022
@kubevirt-bot
Copy link
Contributor

@tiraboschi: #2036 failed to apply on top of branch "release-1.7":

Applying: Comply with OCP 4.11 and 4.12 Pod Security Standards
Using index info to reconstruct a base tree...
M	controllers/operands/kubevirtConsolePlugin.go
A	deploy/index-image/community-kubevirt-hyperconverged/1.8.0/manifests/kubevirt-hyperconverged-operator.v1.8.0.clusterserviceversion.yaml
A	deploy/olm-catalog/community-kubevirt-hyperconverged/1.8.0/manifests/kubevirt-hyperconverged-operator.v1.8.0.clusterserviceversion.yaml
M	deploy/operator.yaml
Falling back to patching base and 3-way merge...
Auto-merging deploy/operator.yaml
Auto-merging deploy/olm-catalog/community-kubevirt-hyperconverged/1.7.0/manifests/kubevirt-hyperconverged-operator.v1.7.0.clusterserviceversion.yaml
CONFLICT (content): Merge conflict in deploy/olm-catalog/community-kubevirt-hyperconverged/1.7.0/manifests/kubevirt-hyperconverged-operator.v1.7.0.clusterserviceversion.yaml
Auto-merging deploy/index-image/community-kubevirt-hyperconverged/1.7.0/manifests/kubevirt-hyperconverged-operator.v1.7.0.clusterserviceversion.yaml
Auto-merging controllers/operands/kubevirtConsolePlugin.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 Comply with OCP 4.11 and 4.12 Pod Security Standards
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

/cherry-pick release-1.7

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.

tiraboschi added a commit to tiraboschi/hyperconverged-cluster-operator that referenced this pull request Jul 26, 2022
Set something like:
```
spec:
 securityContext:
   # Do not use SeccompProfile if your project must work on
   # old k8s versions < 1.19 and Openshift < 4.11
   seccompProfile:
      type: RuntimeDefault
   runAsNonRoot: true
 containers:
   - name: my-container
     securityContext:
       allowPrivilegeEscalation: false
       capabilities:
         drop:
           - ALL
```
following OCP/OKD 4.12 best practices.

This is a manual cherry-pick of kubevirt#2036

Signed-off-by: Simone Tiraboschi <stirabos@redhat.com>
kubevirt-bot pushed a commit that referenced this pull request Jul 27, 2022
Set something like:
```
spec:
 securityContext:
   # Do not use SeccompProfile if your project must work on
   # old k8s versions < 1.19 and Openshift < 4.11
   seccompProfile:
      type: RuntimeDefault
   runAsNonRoot: true
 containers:
   - name: my-container
     securityContext:
       allowPrivilegeEscalation: false
       capabilities:
         drop:
           - ALL
```
following OCP/OKD 4.12 best practices.

This is a manual cherry-pick of #2036

Signed-off-by: Simone Tiraboschi <stirabos@redhat.com>
@tiraboschi tiraboschi deleted the pss_4.12 branch October 7, 2022 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants