Skip to content

Commit 1bbe788

Browse files
pedjakclaudedtfranzjoelanford
authored
✨ Deprecate ClusterExtension spec.serviceAccount (#2770)
* feat(api): deprecate spec.serviceAccount and adopt cluster-admin scope Mark spec.serviceAccount as deprecated in the ClusterExtension API. Remove PreAuthorizer integration, SA-scoped RBAC templates, and restconfig action. Simplify the controller to use cluster-admin scope directly. Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Daniel Franz <dfranz@redhat.com> * feat: add ValidatingAdmissionPolicy for serviceAccount deprecation warning Create VAP and VAPB resources that emit a warning when spec.serviceAccount is set on a ClusterExtension. Add integration test infrastructure for warning collection. Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Daniel Franz <dfranz@redhat.com> * test: clean up e2e tests for serviceAccount deprecation Remove SA-specific e2e test scenarios, SA RBAC templates, and the extension developer test suite. Simplify test steps to use cluster-admin scope. Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Daniel Franz <dfranz@redhat.com> * refactor: remove per-SA infrastructure and feature gates Delete authentication and authorization packages, feature gates, k8smaintainer tool, SA demo scripts, and documentation. Remove k8s.io/kubernetes dependency and unnecessary k8s staging replace directives. Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Daniel Franz <dfranz@redhat.com> * refactor: replace contentmanager with shared TrackingCache Delete the contentmanager package and replace it with boxcutter's shared TrackingCache. Simplify revision engine factory to use the base config directly. Remove SA label constants. Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Daniel Franz <dfranz@redhat.com> * docs: update documentation for cluster-admin scope Remove SA-related documentation, tutorials, and demo scripts. Clean up remaining ServiceAccount references from unit tests. Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Daniel Franz <dfranz@redhat.com> * Add documentation examples for using ValidatingAdmissionPolicy to protect OLMv1 API access. Signed-off-by: Daniel Franz <dfranz@redhat.com> Co-Authored-By: Predrag Knezevic <pknezevi@redhat.com> Co-Authored-By: Daniel Franz <dfranz@redhat.com> Co-Authored-By: Claude <noreply@anthropic.com> * docs: rewrite cluster-admin scope section in design decisions doc Also updates go.mod/go.sum to fix k8s.io/client-go version. --------- Signed-off-by: Daniel Franz <dfranz@redhat.com> Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Daniel Franz <dfranz@redhat.com> Co-authored-by: Joe Lanford <joe.lanford@gmail.com>
1 parent 4562584 commit 1bbe788

105 files changed

Lines changed: 1822 additions & 8166 deletions

File tree

Some content is hidden

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

Makefile

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,6 @@ lint-custom: custom-linter-build #EXHELP Call custom linter for the project
145145
lint-api-diff: $(GOLANGCI_LINT) #HELP Validate API changes using kube-api-linter with diff-aware analysis
146146
hack/api-lint-diff/run.sh
147147

148-
.PHONY: k8s-pin
149-
k8s-pin: #EXHELP Pin k8s staging modules based on k8s.io/kubernetes version (in go.mod or from K8S_IO_K8S_VERSION env var) and run go mod tidy.
150-
K8S_IO_K8S_VERSION='$(K8S_IO_K8S_VERSION)' go run hack/tools/k8smaintainer/main.go
151-
152148
.PHONY: tidy #HELP Run go mod tidy.
153149
tidy:
154150
go mod tidy
@@ -210,7 +206,7 @@ generate: $(CONTROLLER_GEN) generate-mocks #EXHELP Generate code containing Deep
210206
done
211207

212208
.PHONY: verify
213-
verify: k8s-pin kind-verify-versions fmt generate manifests update-tls-profiles crd-ref-docs update-registryv1-bundle-schema verify-bingo #HELP Verify all generated code is up-to-date. Runs k8s-pin instead of just tidy.
209+
verify: tidy kind-verify-versions fmt generate manifests update-tls-profiles crd-ref-docs update-registryv1-bundle-schema verify-bingo #HELP Verify all generated code is up-to-date.
214210
git diff --exit-code
215211

216212
.PHONY: verify-bingo

api/v1/clusterextension_types.go

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ const (
5050
// ClusterExtensionSpec defines the desired state of ClusterExtension
5151
type ClusterExtensionSpec struct {
5252
// namespace specifies a Kubernetes namespace.
53-
// This is the namespace where the provided ServiceAccount must exist.
54-
// It also designates the default namespace where namespace-scoped resources for the extension are applied to the cluster.
53+
// It designates the default namespace where namespace-scoped resources for the extension are applied to the cluster.
5554
// Some extensions may contain namespace-scoped resources to be applied in other namespaces.
5655
// This namespace must exist.
5756
//
@@ -67,14 +66,15 @@ type ClusterExtensionSpec struct {
6766
// +required
6867
Namespace string `json:"namespace"`
6968

70-
// serviceAccount specifies a ServiceAccount used to perform all interactions with the cluster
71-
// that are required to manage the extension.
72-
// The ServiceAccount must be configured with the necessary permissions to perform these interactions.
73-
// The ServiceAccount must exist in the namespace referenced in the spec.
74-
// The serviceAccount field is required.
69+
// serviceAccount is a deprecated field and is completely ignored.
70+
// OLMv1 is a single-tenant system where users with ClusterExtension write access are
71+
// effectively delegated cluster-admin trust. The operator-controller runs with
72+
// cluster-admin privileges and uses its own service account for all cluster interactions.
7573
//
76-
// +required
77-
ServiceAccount ServiceAccountReference `json:"serviceAccount"`
74+
// Deprecated: serviceAccount is no longer used and will be removed in a future release.
75+
//
76+
// +optional
77+
ServiceAccount ServiceAccountReference `json:"serviceAccount,omitzero"`
7878

7979
// source is required and selects the installation source of content for this ClusterExtension.
8080
// Set the sourceType field to perform the selection.
@@ -150,7 +150,6 @@ type SourceConfig struct {
150150
}
151151

152152
// ClusterExtensionInstallConfig is a union which selects the clusterExtension installation config.
153-
// ClusterExtensionInstallConfig requires the namespace and serviceAccount which should be used for the installation of packages.
154153
//
155154
// +kubebuilder:validation:XValidation:rule="has(self.preflight)",message="at least one of [preflight] are required when install is specified"
156155
// +union
@@ -378,12 +377,15 @@ type CatalogFilter struct {
378377
UpgradeConstraintPolicy UpgradeConstraintPolicy `json:"upgradeConstraintPolicy,omitempty"`
379378
}
380379

381-
// ServiceAccountReference identifies the serviceAccount used fo install a ClusterExtension.
380+
// ServiceAccountReference is a deprecated type and is completely ignored.
381+
//
382+
// Deprecated: ServiceAccountReference is no longer used and will be removed in a future release.
383+
//
384+
// +kubebuilder:validation:MinProperties=1
382385
type ServiceAccountReference struct {
383-
// name is a required, immutable reference to the name of the ServiceAccount used for installation
384-
// and management of the content for the package specified in the packageName field.
386+
// name is a deprecated field and is completely ignored.
385387
//
386-
// This ServiceAccount must exist in the installNamespace.
388+
// Deprecated: name is no longer used and will be removed in a future release.
387389
//
388390
// The name field follows the DNS subdomain standard as defined in [RFC 1123].
389391
// It must contain only lowercase alphanumeric characters, hyphens (-) or periods (.),
@@ -402,11 +404,12 @@ type ServiceAccountReference struct {
402404
//
403405
// [RFC 1123]: https://tools.ietf.org/html/rfc1123
404406
//
407+
// +kubebuilder:validation:MinLength:=1
405408
// +kubebuilder:validation:MaxLength:=253
406-
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="name is immutable"
409+
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="name is immutable once set but may be cleared"
407410
// +kubebuilder:validation:XValidation:rule="self.matches(\"^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$\")",message="name must be a valid DNS1123 subdomain. It must contain only lowercase alphanumeric characters, hyphens (-) or periods (.), start and end with an alphanumeric character, and be no longer than 253 characters"
408-
// +required
409-
Name string `json:"name"`
411+
// +optional
412+
Name string `json:"name,omitempty"`
410413
}
411414

412415
// PreflightConfig holds the configuration for the preflight checks. If used, at least one preflight check must be non-nil.

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{

applyconfigurations/api/v1/clusterextensioninstallconfig.go

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

applyconfigurations/api/v1/clusterextensionspec.go

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

applyconfigurations/api/v1/serviceaccountreference.go

Lines changed: 6 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)