Skip to content

Commit 694e8d7

Browse files
Merge pull request #365 from openshift-bot/synchronize-upstream
NO-ISSUE: Synchronize From Upstream Repositories
2 parents c2c847e + 9232e45 commit 694e8d7

File tree

18 files changed

+271
-17
lines changed

18 files changed

+271
-17
lines changed

commitchecker.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
expectedMergeBase: ac14a4e5344d35189b4ef5dae11937e55c5b9efd
1+
expectedMergeBase: d41ddd05f0c795296cf18c869a3541ede6b42ff7
22
upstreamBranch: main
33
upstreamOrg: operator-framework
44
upstreamRepo: operator-controller

config/overlays/featuregate/synthetic-user-permissions/kustomization.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# kustomization file for secure OLMv1
1+
# kustomization file for OLMv1 support for synthetic auth
22
# DO NOT ADD A NAMESPACE HERE
33
apiVersion: kustomize.config.k8s.io/v1beta1
44
kind: Kustomization
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# kustomization file for cert-manager backed OLMv1 support for installation of bundles with webhooks
2+
# DO NOT ADD A NAMESPACE HERE
3+
apiVersion: kustomize.config.k8s.io/v1beta1
4+
kind: Kustomization
5+
resources:
6+
- ../../../base/operator-controller
7+
- ../../../base/common
8+
components:
9+
- ../../../components/tls/operator-controller
10+
11+
patches:
12+
- target:
13+
kind: Deployment
14+
name: operator-controller-controller-manager
15+
path: patches/enable-featuregate.yaml
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# enable cert-manager backed webhook support feature gate
2+
- op: add
3+
path: /spec/template/spec/containers/0/args/-
4+
value: "--feature-gates=WebhookProviderCertManager=true"
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# kustomization file for openshift-serviceca backed OLMv1 support for installation of bundles with webhooks
2+
# DO NOT ADD A NAMESPACE HERE
3+
apiVersion: kustomize.config.k8s.io/v1beta1
4+
kind: Kustomization
5+
resources:
6+
- ../../../base/operator-controller
7+
- ../../../base/common
8+
components:
9+
- ../../../components/tls/operator-controller
10+
11+
patches:
12+
- target:
13+
kind: Deployment
14+
name: operator-controller-controller-manager
15+
path: patches/enable-featuregate.yaml
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# enable openshift-serviceca backed webhook support feature gate
2+
- op: add
3+
path: /spec/template/spec/containers/0/args/-
4+
value: "--feature-gates=WebhookProviderOpenshiftServiceCA=true"
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
## Installation of Bundles containing Webhooks
2+
3+
!!! note
4+
This feature is still in *alpha*. Either the `WebhookProviderCertManager`, or the `WebhookProviderOpenshiftServiceCA`, feature-gate
5+
must be enabled to make use of it. See the instructions below on how to enable the feature-gate.
6+
7+
OLMv1 currently does not support the installation of bundles containing webhooks. The webhook support feature enables this capability.
8+
Webhooks, or more concretely Admission Webhooks, are part of Kuberntes' [Dynamic Admission Control](https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/)
9+
feature. Webhooks run as services called by the kube-apiservice in due course of processing a resource related request. They can be used to validate resources, ensure reasonable default values,
10+
are set, or aid in the migration to new CustomResourceDefinition schema. The communication with the webhook service is secured by TLS. In OLMv1, the TLS certificate is managed by a
11+
certificate provider. Currently, two certificate providers are supported: CertManager and Openshift-ServiceCA. The certificate provider to use given by the feature-gate:
12+
13+
- `WebhookProviderCertManager` for [CertManager](https://cert-manager.io/)
14+
- `WebhookProviderOpenshiftServiceCA` for [Openshift-ServiceCA](https://github.com/openshift/service-ca-operator)
15+
16+
As CertManager is already installed with OLMv1, we suggest using `WebhookProviderCertManager`.
17+
18+
### Update OLM to enable Feature
19+
20+
```terminal title=Enable WebhookProviderCertManager feature
21+
kubectl kustomize config/overlays/featuregate/webhook-provider-certmanager | kubectl apply -f -
22+
```
23+
24+
Or,
25+
26+
```terminal title=Enable WebhookProviderOpenshiftServiceCA feature
27+
kubectl kustomize config/overlays/featuregate/webhook-provider-openshift-serviceca | kubectl apply -f -
28+
```
29+
30+
Then,
31+
32+
```terminal title=Wait for rollout to complete
33+
kubectl rollout status -n olmv1-system deployment/operator-controller-controller-manager
34+
```
35+
36+
### Notes on the generated certificate
37+
38+
#### CertManager
39+
40+
The generated certificate maintains a high-level of parity with the certificate generated by OLMv0:
41+
- Self-signed
42+
- Two validity period, rotating 24h before expiry
43+
- Valid for the webhook service's DNSNames:
44+
- <service-name>.<namespace>
45+
- <service-name>.<namespace>.svc
46+
- <service-name>.<namespace>.svc.cluster.local
47+
48+
#### Openshift-ServiceCA
49+
50+
Generation and rotation are completely governed by [Openshift-ServiceCA](https://github.com/openshift/service-ca-operator)
51+
52+
### How does it work?
53+
54+
There's no change in the installation flow. Just install a bundle containing webhooks as you would any other.
55+
56+
### Demo
57+
58+
!!! note
59+
As there is no difference in usage or experience between the CertManager and Openshift-ServiceCA variants, only
60+
the cert-manager variant is demoed.
61+
62+
[![asciicast](https://asciinema.org/a/GyjsB129GkUadeuxFhNuG4FcS.svg)](https://asciinema.org/a/GyjsB129GkUadeuxFhNuG4FcS)
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# How To Get Your Cluster Extension RBAC Right — Working with the Preflight Permissions Check
2+
3+
Cluster Extensions in Operator Lifecycle Manager (OLM) v1 are installed and managed via a **service account** that you (the cluster admin) provide. Unlike OLM v0, OLM v1 itself doesn’t have cluster-admin privileges to grant Operators the access they need – **you** must ensure the service account has all necessary Role-Based Access Control (RBAC) permissions. If the service account is missing permissions, the extension’s installation will fail or hang. To address this, the **operator-controller** now performs a **preflight permissions check** before installing an extension. This check identifies any missing RBAC permissions up front and surfaces them to you so that you can fix the issues.
4+
5+
## Understanding the Preflight Permissions Check
6+
7+
When you create a `ClusterExtension` Custom Resource (CR) to install an Operator extension, the operator-controller will do a dry-run of the installation and verify that the specified service account can perform all the actions required by that extension. This includes creating all the Kubernetes objects in the bundle (Deployments, Services, CRDs, etc.), as well as creating any RBAC roles or bindings that the extension’s bundle defines.
8+
9+
If any required permission is missing, the preflight check will **fail fast** *before* attempting the real installation. Instead of proceeding, the operator-controller records which permissions are missing. You’ll find this information in two places:
10+
11+
- **ClusterExtension Status Conditions:** The `ClusterExtension` CR will have a condition (such as **Progressing** or **Installing**) with a message describing the missing permissions. The condition’s reason may be set to “Retrying” (meaning the controller will periodically retry the install) and the message will start with “pre-authorization failed: …”.
12+
- **Operator-Controller Logs:** The same message is also logged by the operator-controller pod. If you have access to the operator-controller’s logs (in namespace `olm-controller` on OpenShift), you can see the detailed RBAC errors there as well.
13+
14+
### Interpreting the Preflight Check Output
15+
16+
The preflight check’s output enumerates the **RBAC rules** that the service account is missing. Each missing permission is listed in a structured format. For example, a message might say:
17+
18+
```
19+
service account requires the following permissions to manage cluster extension:
20+
Namespace:"" APIGroups:[] Resources:[services] Verbs:[list,watch]
21+
Namespace:"pipelines" APIGroups:[] Resources:[secrets] Verbs:[get]
22+
```
23+
24+
Let’s break down how to read this output:
25+
26+
- **`Namespace:""`** – An empty namespace in quotes means the permission is needed at the **cluster scope** (not limited to a single namespace). In the example above, `Namespace:""` for Services indicates the service account needs the ability to list/watch Services cluster-wide.
27+
- **`APIGroups:[]`** – An empty API group (`[]`) means the **core API group** (no group). For instance, core resources like Services, Secrets, ConfigMaps have `APIGroups:[]`. If the resource is part of a named API group (e.g. `apps`, `apiextensions.k8s.io`), that group would be listed here.
28+
- **`Resources:[...]`** – The resource type that’s missing permissions. e.g. `services`, `secrets`, `customresourcedefinitions`.
29+
- **`Verbs:[...]`** – The specific actions (verbs) that the service account is not allowed to do for that resource. Multiple verbs listed together means none of those verbs are permitted (and are all required).
30+
31+
A few special cases to note:
32+
33+
- **Privilege Escalation Cases:** If the extension’s bundle includes the creation of a Role or ClusterRole, the service account needs to have at least the permissions it is trying to grant. If not, the preflight check will report those verbs as missing to prevent privilege escalation.
34+
- **Missing Role References (Resolution Errors):** If an Operator’s bundle references an existing ClusterRole or Role that is not found, the preflight check will report an “authorization evaluation error” listing the missing role.
35+
36+
## Resolving Common RBAC Permission Errors
37+
38+
Once you understand what each missing permission is, the fix is usually straightforward: **grant the service account those permissions**. Here are common scenarios and how to address them:
39+
40+
- **Missing resource permissions (verbs):** Update or create a (Cluster)Role and RoleBinding/ClusterRoleBinding to grant the missing verbs on the resources in the specified namespaces or at cluster scope.
41+
- **Privilege escalation missing permissions:** Treat these missing verbs as required for the installer as well, granting the service account those rights so it can create the roles it needs.
42+
- **Missing roles/clusterroles:** Ensure any referenced roles exist by creating them or adjusting the extension’s expectations.
43+
44+
## Demo Scenario (OpenShift)
45+
46+
Below is an example demo you can run on OpenShift to see the preflight check in action:
47+
48+
1. **Create a minimal ServiceAccount and ClusterRole** that lacks key permissions (e.g., missing list/watch on Services and create on CRDs).
49+
2. **Apply a ClusterExtension** pointing to the Pipelines Operator package, specifying the above service account.
50+
3. **Describe the ClusterExtension** (`oc describe clusterextension pipelines-operator`) to see the preflight “pre-authorization failed” errors listing missing permissions.
51+
4. **Update the ClusterRole** to include the missing verbs.
52+
5. **Reapply the role** and observe the ClusterExtension status clear and the operator proceed with installation.
53+
54+
By following this guide and using the preflight output, you can iteratively grant exactly the permissions needed—no more, no less—ensuring your cluster extensions install reliably and securely.

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ require (
1010
github.com/containerd/containerd v1.7.27
1111
github.com/containers/image/v5 v5.35.0
1212
github.com/fsnotify/fsnotify v1.9.0
13-
github.com/go-logr/logr v1.4.2
13+
github.com/go-logr/logr v1.4.3
1414
github.com/google/go-cmp v0.7.0
1515
github.com/google/go-containerregistry v0.20.3
1616
github.com/gorilla/handlers v1.5.2

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,8 @@ github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2
170170
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
171171
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
172172
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
173-
github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
174-
github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
173+
github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI=
174+
github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
175175
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
176176
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
177177
github.com/go-logr/zapr v1.3.0 h1:XGdV8XW8zdwFiwOA2Dryh1gj2KRQyOOoNmBy4EplIcQ=

0 commit comments

Comments
 (0)