-
Notifications
You must be signed in to change notification settings - Fork 72
WIP 🌱 Add RBAC escalation test for installer ServiceAccount permissions #2441
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
Closed
camilamacedo86
wants to merge
3
commits into
operator-framework:main
from
camilamacedo86:big-hidden-sa-fix
Closed
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| Feature: RBAC Permissions for Extension Installation | ||
|
|
||
| Background: | ||
| Given OLM is available | ||
| And ClusterCatalog "test" serves bundles | ||
| And ServiceAccount "olm-sa" with needed permissions is available in ${TEST_NAMESPACE} | ||
|
|
||
| # This test verifies that the ClusterExtension installer ServiceAccount has the necessary | ||
| # RBAC permissions to install operators with different permission requirements. | ||
| # | ||
| # The rbac-escalation-operator requires permissions beyond what test-operator needs, | ||
| # testing that the installer SA can create ClusterRoleBindings for roles with | ||
| # permissions the SA itself doesn't directly possess (via bind/escalate verbs). | ||
| # | ||
| # See: docs/concepts/permission-model.md for OLMv1 permission requirements | ||
| Scenario: Install operator with different RBAC requirements | ||
| When ClusterExtension is applied | ||
| """ | ||
| apiVersion: olm.operatorframework.io/v1 | ||
| kind: ClusterExtension | ||
| metadata: | ||
| name: rbac-escalation-test | ||
| spec: | ||
| namespace: ${TEST_NAMESPACE} | ||
| serviceAccount: | ||
| name: olm-sa | ||
| source: | ||
| sourceType: Catalog | ||
| catalog: | ||
| packageName: rbac-escalation-operator | ||
| selector: | ||
| matchLabels: | ||
| "olm.operatorframework.io/metadata.name": test-catalog | ||
| """ | ||
| Then ClusterExtension is available | ||
| And bundle "rbac-escalation-operator.1.0.0" is installed in version "1.0.0" | ||
|
|
||
84 changes: 84 additions & 0 deletions
84
...-escalation-operator/v1.0.0/manifests/rbac-escalation-operator.clusterserviceversion.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| apiVersion: operators.coreos.com/v1alpha1 | ||
| kind: ClusterServiceVersion | ||
| metadata: | ||
| name: rbac-escalation-operator.v1.0.0 | ||
| namespace: placeholder | ||
| spec: | ||
| apiservicedefinitions: {} | ||
| customresourcedefinitions: | ||
| owned: [] | ||
| description: Test operator for validating RBAC escalation handling with diverse permission requirements | ||
| displayName: RBAC Escalation Test Operator | ||
| install: | ||
| spec: | ||
| deployments: | ||
| - name: rbac-escalation-operator | ||
| spec: | ||
| replicas: 1 | ||
| selector: | ||
| matchLabels: | ||
| app: rbac-escalation | ||
| template: | ||
| metadata: | ||
| labels: | ||
| app: rbac-escalation | ||
| spec: | ||
| terminationGracePeriodSeconds: 0 | ||
| containers: | ||
| - name: manager | ||
| image: busybox:1.37 | ||
| command: ["/bin/sh", "-c", "sleep 3600"] | ||
| serviceAccountName: rbac-escalation-sa | ||
| # These permissions differ from test-operator's requirements to validate | ||
| # that the installer SA can handle operators with diverse RBAC needs | ||
| clusterPermissions: | ||
| - rules: | ||
| # Requires storage.k8s.io permissions to test RBAC escalation handling | ||
| - apiGroups: | ||
| - storage.k8s.io | ||
| resources: | ||
| - storageclasses | ||
| verbs: | ||
| - create | ||
| - update | ||
| - delete | ||
| - list | ||
| - watch | ||
| - get | ||
| # Requires scheduling.k8s.io permissions to test diverse RBAC scenarios | ||
| - apiGroups: | ||
| - scheduling.k8s.io | ||
| resources: | ||
| - priorityclasses | ||
| verbs: | ||
| - create | ||
| - update | ||
| - delete | ||
| - list | ||
| - watch | ||
| - get | ||
| serviceAccountName: rbac-escalation-sa | ||
| strategy: deployment | ||
| installModes: | ||
| - supported: false | ||
| type: OwnNamespace | ||
| - supported: false | ||
| type: SingleNamespace | ||
| - supported: false | ||
| type: MultiNamespace | ||
| - supported: true | ||
| type: AllNamespaces | ||
| keywords: | ||
| - rbac-testing | ||
| - escalation | ||
| links: | ||
| - name: RBAC Escalation Operator | ||
| url: https://github.com/operator-framework/operator-controller | ||
| maintainers: | ||
| - email: dev@operatorframework.io | ||
| name: OLM Team | ||
| maturity: alpha | ||
| provider: | ||
| name: Operator Framework | ||
| url: https://operatorframework.io | ||
| version: 1.0.0 |
7 changes: 7 additions & 0 deletions
7
testdata/images/bundles/rbac-escalation-operator/v1.0.0/metadata/annotations.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| annotations: | ||
| operators.operatorframework.io.bundle.channel.default.v1: stable | ||
| operators.operatorframework.io.bundle.channels.v1: stable | ||
| operators.operatorframework.io.bundle.manifests.v1: manifests/ | ||
| operators.operatorframework.io.bundle.mediatype.v1: registry+v1 | ||
| operators.operatorframework.io.bundle.metadata.v1: metadata/ | ||
| operators.operatorframework.io.bundle.package.v1: rbac-escalation-operator |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.