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

Cluster-wide operators support improvements #2479

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

greyerof
Copy link
Contributor

@greyerof greyerof commented Oct 1, 2024

This commit enables the discovery of cluster-wide operator pods (controllers), but also singleNamespace/multiNamespace installation methods where the targetNamespaces were set to be different than the installation namespace. The code will look for the controller pod in the installation namespace always. Operand pods can always be tested using normal namespace or label discovery methods, but a best-effort to find them in the configured namespaces will be implemented in a follow-up PR.

As a reminder:

  • installation namespace: namespace where both the subscription and the operator group where created. This is where the operator's controller (aka operator pod) is deployed by OLM.
  • targetNamespaces: namespaced where the controller will watch for CRs. The installation namespace can appear in this list but it's not mandatory.

Also, the test cases of the operator test suite related to controller pods have been moved to the access-control test suite, as those requirements also apply to any workload. For that reason, the discovered controller pods have also been added to the normal env.testPods so all the checks can be performed on them.

To distinguish between securityContext.runAsUser and securityContext.runAsNonRoot, the original test case access-control-security-context-non-root-user-check has been renamed to access-control-security-context-non-root-user-id-check

This commit enables the discovery of cluster-wide operator pods
(controllers), but also singleNamespace/multiNamespace installation
methods where the targetNamespaces were set to be different than the
installation namespace. The code will look for the controller pod in the
installation namespace always. Operand pods can always be tested using
normal namespace or label discovery methods, but a best-effort to find
them in the configured namespaces will be implemented in a follow-up PR.

As a reminder:
- installation namespace: namespace where both the subscription and the
  operator group where created. This is where the operator's controller
  (aka operator pod) is deployed by OLM.
- targetNamespaces: namespaced where the controller will watch for CRs.
  The installation namespace can appear in this list but it's not
  mandatory.

Also, the test cases of the operator test suite related to controller
pods have been moved to the access-control test suite, as those
requirements also apply to any workload. For that reason, the discovered
controller pods have also been added to the normal env.testPods so all
the checks can be performed on them.

To distinguish between securityContext.runAsUser and
securityContext.runAsNonRoot, the original test case
access-control-security-context-non-root-user-check has been renamed to
access-control-security-context-non-root-user-id-check
@dcibot
Copy link
Collaborator

dcibot commented Oct 1, 2024

@sebrandon1
Copy link
Member

If you make the changes in the QE repo, just temporarily change the ref: from main (in .github/workflows/qe-ocp-arm-416.yaml and .github/workflows/qe-ocp-pre-main.yaml) to whatever branch you have to make the 4.16 OCP tests pass.

If the operator pods were already discovered by either label or (more
likely) namepace discovery mode, we should not add them again, just flag
them.

Also, add the operator pods' containers to the containers under test
list.
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.

3 participants