Skip to content

Commit 61b62e7

Browse files
committed
Wrap up 4630 tasks, remove synthetic permissions and preflight admissions feature gates and residuals.
Signed-off-by: Daniel Franz <dfranz@redhat.com>
1 parent 7f4dd2c commit 61b62e7

21 files changed

Lines changed: 20 additions & 557 deletions

.claude/TODO-OCPSTRAT-3040.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ Anyone: Stream 6 (docs) ← after 4
3535

3636
### Stream 2 — Authentication + Action + Labels (Engineer B, no blockers)
3737

38-
- [ ] Remove `TokenGetter` (`authentication/tokengetter.go`) — **OPRUN-4630**
39-
- [ ] Remove `TokenInjectingRoundTripper` (`authentication/tripper.go`) — **OPRUN-4630**
40-
- [ ] Remove `authentication/synthetic.go` + tests — **OPRUN-4632**
41-
- [ ] Remove `ServiceAccountRestConfigMapper` from `action/restconfig.go`**OPRUN-4630**
42-
- [ ] Remove `SyntheticUserRestConfigMapper` from `action/restconfig.go` + tests — **OPRUN-4632**
38+
- [X] Remove `TokenGetter` (`authentication/tokengetter.go`) — **OPRUN-4630**
39+
- [X] Remove `TokenInjectingRoundTripper` (`authentication/tripper.go`) — **OPRUN-4630**
40+
- [X] Remove `authentication/synthetic.go` + tests — **OPRUN-4632**
41+
- [X] Remove `ServiceAccountRestConfigMapper` from `action/restconfig.go`**OPRUN-4630**
42+
- [X] Remove `SyntheticUserRestConfigMapper` from `action/restconfig.go` + tests — **OPRUN-4632**
4343
- [X] Remove SA annotations (`ServiceAccountNameKey`, `ServiceAccountNamespaceKey`) from `labels/labels.go`**OPRUN-4630** `7f5a6843`
4444

4545
### Stream 3 — Authorization + Build tooling (Engineer C, no blockers)
@@ -57,7 +57,7 @@ Anyone: Stream 6 (docs) ← after 4
5757
- [X] Remove pre-auth checks from Helm applier — **OPRUN-4631** N/A (PreAuthorizer removed in `9791b717`)
5858
- [X] Remove pre-auth checks from Boxcutter applier — **OPRUN-4631** N/A (PreAuthorizer removed in `9791b717`)
5959
- [X] Remove `PreflightPermissions` feature gate from `features.go`**OPRUN-4631** `e1b7d2f1`
60-
- [ ] Remove `SyntheticPermissions` feature gate from `features.go`**OPRUN-4632**
60+
- [X] Remove `SyntheticPermissions` feature gate from `features.go`**OPRUN-4632**
6161
- [X] Clean up RBAC watches if only needed for pre-auth — **OPRUN-4631** N/A (RBAC watches serve Boxcutter phase ordering)
6262
- [X] Rewire `main.go`: remove all SA/synthetic/preflight wiring, always use controller's own SA — **OPRUN-4630** `7f5a6843`
6363
- [ ] Update all unit + e2e tests — **OPRUN-4630, OPRUN-4631, OPRUN-4632**

cmd/operator-controller/main.go

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ import (
6060
ocv1 "github.com/operator-framework/operator-controller/api/v1"
6161
"github.com/operator-framework/operator-controller/internal/operator-controller/action"
6262
"github.com/operator-framework/operator-controller/internal/operator-controller/applier"
63-
"github.com/operator-framework/operator-controller/internal/operator-controller/authentication"
6463
"github.com/operator-framework/operator-controller/internal/operator-controller/catalogmetadata/cache"
6564
catalogclient "github.com/operator-framework/operator-controller/internal/operator-controller/catalogmetadata/client"
6665
"github.com/operator-framework/operator-controller/internal/operator-controller/contentmanager"
@@ -656,20 +655,13 @@ func (c *boxcutterReconcilerConfigurator) Configure(ceReconciler *controllers.Cl
656655
return fmt.Errorf("unable to add tracking cache to manager: %v", err)
657656
}
658657

659-
cerCoreClient, err := corev1client.NewForConfig(c.mgr.GetConfig())
660-
if err != nil {
661-
return fmt.Errorf("unable to create client for ClusterObjectSet controller: %w", err)
662-
}
663-
cerTokenGetter := authentication.NewTokenGetter(cerCoreClient, authentication.WithExpirationDuration(1*time.Hour))
664-
665658
revisionEngineFactory, err := controllers.NewDefaultRevisionEngineFactory(
666659
c.mgr.GetScheme(),
667660
trackingCache,
668661
discoveryClient,
669662
c.mgr.GetRESTMapper(),
670663
fieldOwnerPrefix,
671664
c.mgr.GetConfig(),
672-
cerTokenGetter,
673665
)
674666
if err != nil {
675667
return fmt.Errorf("unable to create revision engine factory: %w", err)
@@ -695,11 +687,7 @@ func (c *helmReconcilerConfigurator) Configure(ceReconciler *controllers.Cluster
695687
if err != nil {
696688
return fmt.Errorf("unable to create core client: %w", err)
697689
}
698-
tokenGetter := authentication.NewTokenGetter(coreClient, authentication.WithExpirationDuration(1*time.Hour))
699-
clientRestConfigMapper := action.ServiceAccountRestConfigMapper(tokenGetter)
700-
if features.OperatorControllerFeatureGate.Enabled(features.SyntheticPermissions) {
701-
clientRestConfigMapper = action.SyntheticUserRestConfigMapper(clientRestConfigMapper)
702-
}
690+
clientRestConfigMapper := action.ClusterAdminRestConfigMapper(c.mgr.GetConfig())
703691

704692
cfgGetter, err := helmclient.NewActionConfigGetter(c.mgr.GetConfig(), c.mgr.GetRESTMapper(),
705693
helmclient.StorageDriverMapper(action.ChunkedStorageDriverMapper(coreClient, c.mgr.GetAPIReader(), cfg.systemNamespace)),

hack/demo/resources/synthetic-user-perms/argocd-clusterextension.yaml

Lines changed: 0 additions & 13 deletions
This file was deleted.

hack/demo/resources/synthetic-user-perms/cegroup-admin-binding.yaml

Lines changed: 0 additions & 11 deletions
This file was deleted.

hack/demo/synthetic-user-cluster-admin-demo-script.sh

Lines changed: 0 additions & 30 deletions
This file was deleted.

helm/experimental.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,9 @@ options:
1515
- BundleReleaseSupport
1616
- DeploymentConfig
1717
- HelmChartSupport
18-
- PreflightPermissions
1918
- SingleOwnNamespaceInstallSupport
2019
- WebhookProviderCertManager
2120
disabled:
22-
- SyntheticPermissions
2321
- WebhookProviderOpenshiftServiceCA
2422
# List of enabled experimental features for catalogd
2523
# Use with {{- if has "FeatureGate" .Values.options.catalogd.features.enabled }}

helm/olmv1/values.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ options:
1818
- BundleReleaseSupport
1919
- DeploymentConfig
2020
- HelmChartSupport
21-
- PreflightPermissions
2221
- SingleOwnNamespaceInstallSupport
23-
- SyntheticPermissions
2422
- WebhookProviderOpenshiftServiceCA
2523
podDisruptionBudget:
2624
enabled: true

helm/tilt.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ options:
1515
features:
1616
enabled:
1717
- SingleOwnNamespaceInstallSupport
18-
- PreflightPermissions
1918
- HelmChartSupport
2019
disabled:
2120
- WebhookProviderOpenshiftServiceCA

internal/operator-controller/action/restconfig.go

Lines changed: 4 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -2,64 +2,15 @@ package action
22

33
import (
44
"context"
5-
"fmt"
6-
"net/http"
75

8-
"k8s.io/apimachinery/pkg/types"
96
"k8s.io/client-go/rest"
10-
"k8s.io/client-go/transport"
117
"sigs.k8s.io/controller-runtime/pkg/client"
12-
13-
ocv1 "github.com/operator-framework/operator-controller/api/v1"
14-
"github.com/operator-framework/operator-controller/internal/operator-controller/authentication"
158
)
169

17-
// SyntheticUserRestConfigMapper returns an AuthConfigMapper that that impersonates synthetic users and groups for Object o.
18-
// o is expected to be a ClusterExtension. If the service account defined in o is different from 'olm.synthetic-user', the
19-
// defaultAuthMapper will be used
20-
func SyntheticUserRestConfigMapper(defaultAuthMapper func(ctx context.Context, o client.Object, c *rest.Config) (*rest.Config, error)) func(ctx context.Context, o client.Object, c *rest.Config) (*rest.Config, error) {
21-
return func(ctx context.Context, o client.Object, c *rest.Config) (*rest.Config, error) {
22-
cExt, err := validate(o, c)
23-
if err != nil {
24-
return nil, err
25-
}
26-
cc := rest.CopyConfig(c)
27-
cc.Wrap(func(rt http.RoundTripper) http.RoundTripper {
28-
return transport.NewImpersonatingRoundTripper(authentication.SyntheticImpersonationConfig(*cExt), rt)
29-
})
30-
return cc, nil
31-
}
32-
}
33-
34-
// ServiceAccountRestConfigMapper returns an AuthConfigMapper scoped to the service account defined in o, which is expected to
35-
// be a ClusterExtension
36-
func ServiceAccountRestConfigMapper(tokenGetter *authentication.TokenGetter) func(ctx context.Context, o client.Object, c *rest.Config) (*rest.Config, error) {
10+
// ClusterAdminRestConfigMapper returns a config with cluster-admin permissions
11+
func ClusterAdminRestConfigMapper(adminConfig *rest.Config) func(ctx context.Context, o client.Object, c *rest.Config) (*rest.Config,
12+
error) {
3713
return func(ctx context.Context, o client.Object, c *rest.Config) (*rest.Config, error) {
38-
saConfig := rest.AnonymousClientConfig(c)
39-
saConfig.Wrap(func(rt http.RoundTripper) http.RoundTripper {
40-
return &authentication.TokenInjectingRoundTripper{
41-
Tripper: rt,
42-
TokenGetter: tokenGetter,
43-
Key: types.NamespacedName{
44-
Name: "operator-controller-controller-manager",
45-
Namespace: "olmv1-system",
46-
},
47-
}
48-
})
49-
return saConfig, nil
50-
}
51-
}
52-
53-
func validate(o client.Object, c *rest.Config) (*ocv1.ClusterExtension, error) {
54-
if c == nil {
55-
return nil, fmt.Errorf("rest config is nil")
56-
}
57-
if o == nil {
58-
return nil, fmt.Errorf("object is nil")
59-
}
60-
cExt, ok := o.(*ocv1.ClusterExtension)
61-
if !ok {
62-
return nil, fmt.Errorf("object is not a ClusterExtension")
14+
return rest.CopyConfig(adminConfig), nil
6315
}
64-
return cExt, nil
6516
}

internal/operator-controller/action/restconfig_test.go

Lines changed: 0 additions & 50 deletions
This file was deleted.

0 commit comments

Comments
 (0)