Skip to content

Commit 29345f6

Browse files
joelanfordclaude
andcommitted
⚠ Single-tenant simplification: remove deprecated features and simplify operator model
Implement the single-tenant simplification design to re-affirm OLM v1's cluster-admin-only operational model. Changes across work items: - 01-cluster-admin: Grant operator-controller cluster-admin ClusterRole (remove custom RBAC rules) - 02-deprecate-service-account: Mark spec.serviceAccount as deprecated and optional; remove from docs/examples/tooling - 03-remove-preflight-permissions: Remove PreflightPermissions feature gate and RBAC pre-authorization code - 04-remove-synthetic-permissions: Remove SyntheticPermissions feature gate and synthetic user/group authentication - 05-remove-single-own-namespace: Remove SingleOwnNamespaceInstallSupport feature gate, watchNamespace config, and own-namespace test fixtures - 07-simplify-contentmanager: Remove per-extension REST config and use shared manager client for content management - 09-documentation: Resolve merge conflicts, add cleanup tracking Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
5 parents 2e1eea6 + f9acbab + f0b21a8 + 7ec63ca + 2eeadef commit 29345f6

File tree

127 files changed

+830
-49732
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+830
-49732
lines changed

api/v1/clusterextension_types.go

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,14 @@ type ClusterExtensionSpec struct {
6666
// +required
6767
Namespace string `json:"namespace"`
6868

69-
// serviceAccount specifies a ServiceAccount used to perform all interactions with the cluster
70-
// that are required to manage the extension.
71-
// The ServiceAccount must be configured with the necessary permissions to perform these interactions.
72-
// The ServiceAccount must exist in the namespace referenced in the spec.
73-
// The serviceAccount field is required.
69+
// serviceAccount was previously used to specify a ServiceAccount for managing the extension.
70+
// This field is now deprecated and ignored. operator-controller uses its own ServiceAccount
71+
// for all Kubernetes API interactions.
7472
//
75-
// +required
76-
ServiceAccount ServiceAccountReference `json:"serviceAccount"`
73+
// Deprecated: This field is ignored. It will be removed in a future API version.
74+
//
75+
// +optional
76+
ServiceAccount ServiceAccountReference `json:"serviceAccount,omitzero"`
7777

7878
// source is required and selects the installation source of content for this ClusterExtension.
7979
// Set the sourceType field to perform the selection.
@@ -376,7 +376,10 @@ type CatalogFilter struct {
376376
UpgradeConstraintPolicy UpgradeConstraintPolicy `json:"upgradeConstraintPolicy,omitempty"`
377377
}
378378

379-
// ServiceAccountReference identifies the serviceAccount used fo install a ClusterExtension.
379+
// ServiceAccountReference identifies the serviceAccount used to install a ClusterExtension.
380+
//
381+
// Deprecated: This type is deprecated and will be removed in a future API version.
382+
// operator-controller now uses its own ServiceAccount for all operations.
380383
type ServiceAccountReference struct {
381384
// name is a required, immutable reference to the name of the ServiceAccount used for installation
382385
// and management of the content for the package specified in the packageName field.

api/v1/validation_test.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ func TestValidate(t *testing.T) {
2323
}
2424
defaultExtensionSpec := func(s *ClusterExtensionSpec) *ClusterExtensionSpec {
2525
s.Namespace = "ns"
26-
s.ServiceAccount = ServiceAccountReference{
27-
Name: "sa",
28-
}
2926
s.Source = SourceConfig{
3027
SourceType: SourceTypeCatalog,
3128
Catalog: &CatalogFilter{

cmd/operator-controller/main.go

Lines changed: 15 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ import (
5959
ocv1 "github.com/operator-framework/operator-controller/api/v1"
6060
"github.com/operator-framework/operator-controller/internal/operator-controller/action"
6161
"github.com/operator-framework/operator-controller/internal/operator-controller/applier"
62-
"github.com/operator-framework/operator-controller/internal/operator-controller/authentication"
6362
"github.com/operator-framework/operator-controller/internal/operator-controller/catalogmetadata/cache"
6463
catalogclient "github.com/operator-framework/operator-controller/internal/operator-controller/catalogmetadata/client"
6564
"github.com/operator-framework/operator-controller/internal/operator-controller/contentmanager"
@@ -474,10 +473,9 @@ func run() error {
474473

475474
certProvider := getCertificateProvider()
476475
regv1ManifestProvider := &applier.RegistryV1ManifestProvider{
477-
BundleRenderer: registryv1.Renderer,
478-
CertificateProvider: certProvider,
479-
IsWebhookSupportEnabled: certProvider != nil,
480-
IsSingleOwnNamespaceEnabled: features.OperatorControllerFeatureGate.Enabled(features.SingleOwnNamespaceInstallSupport),
476+
BundleRenderer: registryv1.Renderer,
477+
CertificateProvider: certProvider,
478+
IsWebhookSupportEnabled: certProvider != nil,
481479
}
482480
var cerCfg reconcilerConfigurator
483481
if features.OperatorControllerFeatureGate.Enabled(features.BoxcutterRuntime) {
@@ -619,9 +617,6 @@ func (c *boxcutterReconcilerConfigurator) Configure(ceReconciler *controllers.Cl
619617
}
620618
ceReconciler.ReconcileSteps = []controllers.ReconcileStepFunc{
621619
controllers.HandleFinalizers(c.finalizers),
622-
controllers.ValidateClusterExtension(
623-
controllers.ServiceAccountValidator(coreClient),
624-
),
625620
controllers.MigrateStorage(storageMigrator),
626621
controllers.RetrieveRevisionStates(revisionStatesGetter),
627622
controllers.ResolveBundle(c.resolver, c.mgr.GetClient()),
@@ -651,29 +646,19 @@ func (c *boxcutterReconcilerConfigurator) Configure(ceReconciler *controllers.Cl
651646
return fmt.Errorf("unable to add tracking cache to manager: %v", err)
652647
}
653648

654-
cerCoreClient, err := corev1client.NewForConfig(c.mgr.GetConfig())
655-
if err != nil {
656-
return fmt.Errorf("unable to create client for ClusterExtensionRevision controller: %w", err)
657-
}
658-
cerTokenGetter := authentication.NewTokenGetter(cerCoreClient, authentication.WithExpirationDuration(1*time.Hour))
659-
660-
revisionEngineFactory, err := controllers.NewDefaultRevisionEngineFactory(
649+
revisionEngine := controllers.NewRevisionEngine(
661650
c.mgr.GetScheme(),
662651
trackingCache,
663652
discoveryClient,
664653
c.mgr.GetRESTMapper(),
665654
fieldOwnerPrefix,
666-
c.mgr.GetConfig(),
667-
cerTokenGetter,
655+
c.mgr.GetClient(),
668656
)
669-
if err != nil {
670-
return fmt.Errorf("unable to create revision engine factory: %w", err)
671-
}
672657

673658
if err = (&controllers.ClusterExtensionRevisionReconciler{
674-
Client: c.mgr.GetClient(),
675-
RevisionEngineFactory: revisionEngineFactory,
676-
TrackingCache: trackingCache,
659+
Client: c.mgr.GetClient(),
660+
RevisionEngine: revisionEngine,
661+
TrackingCache: trackingCache,
677662
}).SetupWithManager(c.mgr); err != nil {
678663
return fmt.Errorf("unable to setup ClusterExtensionRevision controller: %w", err)
679664
}
@@ -685,19 +670,13 @@ func (c *helmReconcilerConfigurator) Configure(ceReconciler *controllers.Cluster
685670
if err != nil {
686671
return fmt.Errorf("unable to create core client: %w", err)
687672
}
688-
tokenGetter := authentication.NewTokenGetter(coreClient, authentication.WithExpirationDuration(1*time.Hour))
689-
clientRestConfigMapper := action.ServiceAccountRestConfigMapper(tokenGetter)
690-
if features.OperatorControllerFeatureGate.Enabled(features.SyntheticPermissions) {
691-
clientRestConfigMapper = action.SyntheticUserRestConfigMapper(clientRestConfigMapper)
692-
}
693673

694674
cfgGetter, err := helmclient.NewActionConfigGetter(c.mgr.GetConfig(), c.mgr.GetRESTMapper(),
695675
helmclient.StorageDriverMapper(action.ChunkedStorageDriverMapper(coreClient, c.mgr.GetAPIReader(), cfg.systemNamespace)),
696676
helmclient.ClientNamespaceMapper(func(obj client.Object) (string, error) {
697677
ext := obj.(*ocv1.ClusterExtension)
698678
return ext.Spec.Namespace, nil
699679
}),
700-
helmclient.ClientRestConfigMapper(clientRestConfigMapper),
701680
)
702681
if err != nil {
703682
return fmt.Errorf("unable to create helm action config getter: %w", err)
@@ -710,11 +689,14 @@ func (c *helmReconcilerConfigurator) Configure(ceReconciler *controllers.Cluster
710689
return fmt.Errorf("unable to create helm action client getter: %w", err)
711690
}
712691

713-
cm := contentmanager.NewManager(clientRestConfigMapper, c.mgr.GetConfig(), c.mgr.GetRESTMapper())
692+
cm, err := contentmanager.NewManager(c.mgr.GetConfig(), c.mgr.GetRESTMapper())
693+
if err != nil {
694+
setupLog.Error(err, "unable to create content manager")
695+
return err
696+
}
714697
err = c.finalizers.Register(controllers.ClusterExtensionCleanupContentManagerCacheFinalizer, finalizers.FinalizerFunc(func(ctx context.Context, obj client.Object) (crfinalizer.Result, error) {
715-
ext := obj.(*ocv1.ClusterExtension)
716-
err := cm.Delete(ext)
717-
return crfinalizer.Result{}, err
698+
cm.Delete(ctx, obj.GetName())
699+
return crfinalizer.Result{}, nil
718700
}))
719701
if err != nil {
720702
setupLog.Error(err, "unable to register content manager cleanup finalizer")
@@ -734,9 +716,6 @@ func (c *helmReconcilerConfigurator) Configure(ceReconciler *controllers.Cluster
734716
revisionStatesGetter := &controllers.HelmRevisionStatesGetter{ActionClientGetter: acg}
735717
ceReconciler.ReconcileSteps = []controllers.ReconcileStepFunc{
736718
controllers.HandleFinalizers(c.finalizers),
737-
controllers.ValidateClusterExtension(
738-
controllers.ServiceAccountValidator(coreClient),
739-
),
740719
controllers.RetrieveRevisionStates(revisionStatesGetter),
741720
controllers.ResolveBundle(c.resolver, c.mgr.GetClient()),
742721
controllers.UnpackBundle(c.imagePuller, c.imageCache),

0 commit comments

Comments
 (0)