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

OLMv1: permissions validation preflight check #1768

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

grokspawn
Copy link

No description provided.

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 19, 2025
Copy link
Contributor

openshift-ci bot commented Mar 19, 2025

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

Copy link
Contributor

openshift-ci bot commented Mar 19, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign spadgett for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

@grokspawn grokspawn force-pushed the permissions-preflight branch from ef70d79 to 1902247 Compare March 31, 2025 20:08
@grokspawn grokspawn force-pushed the permissions-preflight branch from 1902247 to f8fe50e Compare March 31, 2025 20:14
@grokspawn grokspawn marked this pull request as ready for review March 31, 2025 20:14
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 31, 2025
@grokspawn
Copy link
Author

/label tide/merge-method-squash

@openshift-ci openshift-ci bot added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Mar 31, 2025


### Non-Goals

Copy link
Member

Choose a reason for hiding this comment

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

I would also call out here that it is a non-goal to replace or supersede the cluster's authorization chain.

Copy link
Author

Choose a reason for hiding this comment

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

Introduce a preflight check that evaluates the permissions granted to the provided ServiceAccount against the permissions required by the ClusterExtension bundle. If any permissions are missing, the system will:
- Provide a detailed, user-friendly error message listing missing permissions.
- Prevent installation or upgrades from proceeding until the issue is resolved.
- The pre-flight check implemented as part of this work should include more than just surfacing the RBAC in the bundle. Generally, it should surface any permissions that are needed to stamp out all resources in the bundle on the cluster.
Copy link
Member

Choose a reason for hiding this comment

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

It should also surface permissions that OLM itself needs to manage the lifecycle of the bundle. For example:

  • list/watch for all bundle objects so that OLM can run informers and trigger reconciliation when they change
  • update for clusterextensions/finalizers for the parent clusterextension, so that OLM can include blockOwnerDeletion owner references

We don't need to list all of the examples out. Just point out that OLM itself might exert requirements on the rules that a service account needs.

Copy link
Author

Choose a reason for hiding this comment

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

### Non-Goals

- Only what is necessary to install the ClusterExtension based on what is provided in the bundle should be verified. OLM will only have knowledge of Kubernetes and applying Kubernetes resources so we won't be able to verify something like access to an external secret store as part of an extension's installation.
- Optionality of the preflight check.
Copy link
Member

Choose a reason for hiding this comment

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

I think this should be more of an open question for cluster auth-aligned reviewers. Is it reasonable to have a required check that cannot be disabled that assumes RBAC authorization for ClusterExtension service accounts?

Copy link
Author

Choose a reason for hiding this comment

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

Added an explicit note to ensure we have the convo
f3a38b2


The preflight check will extend the existing preflight interface in the operator controller. Key components:
1. Permission Analysis
- Use the ServiceAccount token to verify access against required permissions declared in the ClusterExtension’s bundle.
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we're actually planning to use the SA token in this case. Rather, we are building a local cache of all RBAC and doing a local best-effort evaluation.

Copy link
Author

Choose a reason for hiding this comment

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

Our approach can be broken down into two parts.

Part 1: Validating permissions required for installing the Cluster Extension:
- An initial fail-fast check that ensures the provided ServiceAccount has GET permissions required to perform the Helm dry-run. GET permissions are needed because the Helm dry-run API simulates the installation by rendering manifests and checking the Kubernetes API server for resource existence and state. Without these permissions, Helm cannot validate or resolve dependencies, leading to authorization errors or incomplete simulation.
Copy link
Member

Choose a reason for hiding this comment

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

I think this is out-of-date now. The latest plan is to do a client-only template rendering (which requires no cluster permissions at all), and then do the preauthorization checks based on the local-only-generated manifest.

Copy link
Author

Choose a reason for hiding this comment

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

Signed-off-by: Jordan Keister <[email protected]>
Copy link
Contributor

openshift-ci bot commented Apr 4, 2025

@grokspawn: all tests passed!

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants