Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions cmd/operator-controller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ func run() error {
// create applier
var ctrlBuilderOpts []controllers.ControllerBuilderOption
var extApplier controllers.Applier

certProvider := getCertificateProvider()
if features.OperatorControllerFeatureGate.Enabled(features.BoxcutterRuntime) {
// TODO: add support for preflight checks
// TODO: better scheme handling - which types do we want to support?
Expand All @@ -454,14 +454,14 @@ func run() error {
RevisionGenerator: &applier.SimpleRevisionGenerator{
Scheme: mgr.GetScheme(),
BundleRenderer: &applier.RegistryV1BundleRenderer{
BundleRenderer: registryv1.Renderer,
BundleRenderer: registryv1.Renderer,
CertificateProvider: certProvider,
},
},
}
ctrlBuilderOpts = append(ctrlBuilderOpts, controllers.WithOwns(&ocv1.ClusterExtensionRevision{}))
} else {
// now initialize the helmApplier, assigning the potentially nil preAuth
certProvider := getCertificateProvider()
extApplier = &applier.Helm{
ActionClientGetter: acg,
Preflights: preflights,
Expand Down
1 change: 1 addition & 0 deletions config/components/base/experimental/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ components:
- ../../features/preflight-permissions
- ../../features/apiv1-metas-handler
- ../../features/helm-chart
- ../../features/boxcutter-runtime
# This one is downstream only, so we shant use it
# - ../../features/webhook-provider-openshift-serviceca
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: operator-controller-boxcutter-cluster-admin
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: operator-controller-controller-manager
namespace: olmv1-system
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
---
apiVersion: kustomize.config.k8s.io/v1alpha1
kind: Component
resources:
- cluster_role_binding.yaml
patches:
- target:
kind: Deployment
Expand Down
10 changes: 8 additions & 2 deletions internal/operator-controller/applier/boxcutter.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,17 +223,23 @@ type BundleRenderer interface {
}

type RegistryV1BundleRenderer struct {
BundleRenderer render.BundleRenderer
BundleRenderer render.BundleRenderer
CertificateProvider render.CertificateProvider
}

func (r *RegistryV1BundleRenderer) Render(bundleFS fs.FS, ext *ocv1.ClusterExtension) ([]client.Object, error) {
reg, err := source.FromFS(bundleFS).GetBundle()
if err != nil {
return nil, err
}

if len(reg.CSV.Spec.WebhookDefinitions) > 0 && r.CertificateProvider == nil {
return nil, fmt.Errorf("unsupported bundle: webhookDefinitions are not supported")
Copy link
Owner

Choose a reason for hiding this comment

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

This looks more like an internal panic() that can only happen when you forget to setup the CertificateProvider with dependency injection. At least I find this error message to be confusing.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No, this message is raised to users if they try to install an operator that OLM doesn't yet support.

We have similar messages for bundles the don't support AllNamespaces mode or bundles that define OLM dependencies.

The standard manifest does not enable a webhook feature gate, so in that case, we explicitly are not setting up a CertificateProvider.

Copy link
Owner

Choose a reason for hiding this comment

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

Ah, gotya.

}

watchNamespace, err := GetWatchNamespace(ext)
if err != nil {
return nil, err
}
return r.BundleRenderer.Render(reg, ext.Spec.Namespace, render.WithTargetNamespaces(watchNamespace))
return r.BundleRenderer.Render(reg, ext.Spec.Namespace, render.WithTargetNamespaces(watchNamespace), render.WithCertificateProvider(r.CertificateProvider))
}
16 changes: 16 additions & 0 deletions manifests/experimental-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1699,6 +1699,21 @@ subjects:
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
annotations:
olm.operatorframework.io/feature-set: experimental
name: operator-controller-boxcutter-cluster-admin
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: operator-controller-controller-manager
namespace: olmv1-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
annotations:
olm.operatorframework.io/feature-set: experimental
Expand Down Expand Up @@ -1968,6 +1983,7 @@ spec:
- --feature-gates=SingleOwnNamespaceInstallSupport=true
- --feature-gates=PreflightPermissions=true
- --feature-gates=HelmChartSupport=true
- --feature-gates=BoxcutterRuntime=true
- --catalogd-cas-dir=/var/certs
- --pull-cas-dir=/var/certs
- --tls-cert=/var/certs/tls.cert
Expand Down
16 changes: 16 additions & 0 deletions manifests/experimental.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1699,6 +1699,21 @@ subjects:
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
annotations:
olm.operatorframework.io/feature-set: experimental
name: operator-controller-boxcutter-cluster-admin
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: operator-controller-controller-manager
namespace: olmv1-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
annotations:
olm.operatorframework.io/feature-set: experimental
Expand Down Expand Up @@ -1934,6 +1949,7 @@ spec:
- --feature-gates=SingleOwnNamespaceInstallSupport=true
- --feature-gates=PreflightPermissions=true
- --feature-gates=HelmChartSupport=true
- --feature-gates=BoxcutterRuntime=true
- --catalogd-cas-dir=/var/certs
- --pull-cas-dir=/var/certs
- --tls-cert=/var/certs/tls.cert
Expand Down
Loading