Skip to content

Set PSP generation disabled by default in deploy scripts#4813

Closed
Maddosaurus wants to merge 1 commit intomasterfrom
mm/fix-psp-settings
Closed

Set PSP generation disabled by default in deploy scripts#4813
Maddosaurus wants to merge 1 commit intomasterfrom
mm/fix-psp-settings

Conversation

@Maddosaurus
Copy link
Contributor

@Maddosaurus Maddosaurus commented Feb 10, 2023

Description

As PSPs are deprecated as of k8s 1.25, set POD_SECURITY_POLICIES to disabled by default to ensure successful deployments on any Kubernetes flavour, not only local k8s

Checklist

  • Investigated and inspected CI test results
  • Unit test and regression tests added
  • Evaluated and added CHANGELOG entry if required
  • Determined and documented upgrade steps
  • Documented user facing changes (create PR based on openshift/openshift-docs and merge into rhacs-docs)

Testing Performed

Observed deployment to succeed and ACS as well as Monitoring running as expected without setting an extra env var with deploy.sh on:

  • Local Colima 1.25
  • Local Colima 1.23
  • Infra OS 4.12 Cluster
  • Infra OS 4.11 Cluster

@msugakov
Copy link
Contributor

msugakov commented Feb 10, 2023

Regarding testing performed: does deployment still succeed on OCP <=4.11 and/or k8s <= 1.24?
I mean without overriding POD_SECURITY_POLICIES to true.

@ghost
Copy link

ghost commented Feb 10, 2023

Images are ready for the commit at 1f650c8.

To use with deploy scripts, first export MAIN_IMAGE_TAG=3.74.x-74-g1f650c83cb.

@Maddosaurus
Copy link
Contributor Author

I have also tested this on Colima running Kubernetes 1.23.16 as well as an OS 4.11 cluster.
In both cases, I did not set the env var explicitly, but made sure it is set to false in CLI output.
ACS deployed successfully including Monitoring, the Grafana dashboards populated and ACS was confirmed running as expected.

@Maddosaurus Maddosaurus requested a review from a team February 10, 2023 11:15
@Maddosaurus
Copy link
Contributor Author

Ignoring failing openshift-oldest tests as they seem to be broken right now.
Connor is investigating.

@openshift-ci
Copy link

openshift-ci bot commented Feb 10, 2023

@Maddosaurus: 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/openshift-oldest-qa-e2e-tests 1f650c8 link false /test openshift-oldest-qa-e2e-tests
ci/prow/openshift-newest-qa-e2e-tests 1f650c8 link false /test openshift-newest-qa-e2e-tests
ci/prow/openshift-penultimate-qa-e2e-tests 1f650c8 link false /test openshift-penultimate-qa-e2e-tests

Full PR test history. Your PR dashboard.

Details

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.

@gavin-stackrox
Copy link
Contributor

How does this work in relation to @johannes94 change:

setup_podsecuritypolicies_config() {

@Maddosaurus
Copy link
Contributor Author

@gavin-stackrox These changes are definitely related.
I am not familiar enough with our test setup to make final statements, but from what I understand, Johannes changes focus on the test setup, correct?
We would still run into problems when a human wants to use our deploy scripts for k8s or OpenShift.

IIUC, Johannes changes are needed to fix the CI tests, so we don't need to cherry pick this PR (4813) to fix them.
Do you agree?

@msugakov
Copy link
Contributor

@Maddosaurus
Johannes change tries to auto-sense PSP support, but does that in CI scripting. Your change hardcodes the choice (in a way that should not interfere with CI scripting) for local usage.
The problem is that we don't need that many ways of doing the same thing.

PSPs support can be autosensed in the deployment scripts which should apply to CI automatically, and then no need to hardcode the choice anywhere. How? One option is to simply check exit code from kubectl get podsecuritypolicy.policy > /dev/null 2>&1 command in deploy/common/k8sbased.sh.

Definitely don't check k8s version like if (( "$majorVersion" >= 1 && "$minorVersion" >= 25 )) - this won't work when k8s 2.0.0 sees the light.

@johannes94
Copy link
Contributor

johannes94 commented Feb 15, 2023

Definitely don't check k8s version like if (( "$majorVersion" >= 1 && "$minorVersion" >= 25 )) - this won't work when k8s 2.0.0 sees the light.

You're right this is a terrible mistake, we should fix it ASAP. The idea with testing the exit code doesn't sound very reliable to me, because the exit code if an api type is not found is 1 which could have a lot of different reasons.

Just for context, I did not want to set the default for POD_SECURITY_POLICIES to false because I was not sure if that would disable tests for older k8s version that we want to be executed. Also the place where the setup_podsecuritypolicies_config function is used was my best guess without ever looking at our CI scripts before. So if there is a better place to call it like deploy/common/k8sbased.sh feel free to move it.

@Maddosaurus Maddosaurus deleted the mm/fix-psp-settings branch July 10, 2024 08:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants