Skip to content

Commit 1094bc9

Browse files
joelanfordclaude
andcommitted
Make ServiceAccount optional in experimental channel
This commit updates the ClusterExtension API to make the serviceAccount field optional in the experimental channel while keeping it required in the standard channel. Changes to ClusterExtension API: - Added <opcon:standard:validation:Required> and <opcon:experimental:validation:Optional> tags to ServiceAccount field - Added channel-specific descriptions for serviceAccount behavior: - Standard: Service account is required - Experimental: If omitted, authenticates as synthetic user "olmv1:clusterextensions:<clusterExtensionName>" with group "olmv1:clusterextensions" - Added channel-specific descriptions for namespace field explaining the relationship with serviceAccount - Updated ServiceAccountReference documentation to remove namespace requirement text - Changed JSON tags to use omitzero for optional behavior Generated artifacts updated: - CRDs (standard and experimental channels) - API reference documentation - All manifest files 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent c08e679 commit 1094bc9

File tree

9 files changed

+82
-53
lines changed

9 files changed

+82
-53
lines changed

api/v1/clusterextension_types.go

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,19 @@ const (
4949
// ClusterExtensionSpec defines the desired state of ClusterExtension
5050
type ClusterExtensionSpec struct {
5151
// namespace is a reference to a Kubernetes namespace.
52-
// This is the namespace in which the provided ServiceAccount must exist.
53-
// It also designates the default namespace where namespace-scoped resources
52+
//
53+
// This designates the default namespace where namespace-scoped resources
5454
// for the extension are applied to the cluster.
5555
// Some extensions may contain namespace-scoped resources to be applied in other namespaces.
5656
// This namespace must exist.
5757
//
58+
// <opcon:standard:description>
59+
// This is also the namespace of the referenced service account.
60+
// </opcon:standard:description>
61+
// <opcon:experimental:description>
62+
// This is also the namespace of the referenced service account, if specified.
63+
// </opcon:experimental:description>
64+
//
5865
// namespace is required, immutable, and follows the DNS label standard
5966
// as defined in [RFC 1123]. It must contain only lowercase alphanumeric characters or hyphens (-),
6067
// start and end with an alphanumeric character, and be no longer than 63 characters
@@ -69,12 +76,24 @@ type ClusterExtensionSpec struct {
6976

7077
// serviceAccount is a reference to a ServiceAccount used to perform all interactions
7178
// with the cluster that are required to manage the extension.
79+
// <opcon:standard:description>
7280
// 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.
81+
//
7482
// serviceAccount is required.
83+
// </opcon:standard:description>
7584
//
76-
// +kubebuilder:validation:Required
77-
ServiceAccount ServiceAccountReference `json:"serviceAccount"`
85+
// <opcon:experimental:description>
86+
// If serviceAccount is specified, OLM will authenticate as that service account.
87+
// Otherwise, operator-controller will authenticate as:
88+
// - User: "olm:clusterextension:<clusterExtensionName>"
89+
// - Group: "olm:clusterextensions"
90+
//
91+
// The authenticated user must be configured with the necessary permissions to perform these interactions.
92+
// </opcon:experimental:description>
93+
//
94+
// <opcon:standard:validation:Required>
95+
// <opcon:experimental:validation:Optional>
96+
ServiceAccount ServiceAccountReference `json:"serviceAccount,omitzero"`
7897

7998
// source is a required field which selects the installation source of content
8099
// for this ClusterExtension. Selection is performed by setting the sourceType.
@@ -374,14 +393,12 @@ type CatalogFilter struct {
374393
UpgradeConstraintPolicy UpgradeConstraintPolicy `json:"upgradeConstraintPolicy,omitempty"`
375394
}
376395

377-
// ServiceAccountReference identifies the serviceAccount used fo install a ClusterExtension.
396+
// ServiceAccountReference identifies the serviceAccount name used to manage a ClusterExtension.
378397
type ServiceAccountReference struct {
379398
// name is a required, immutable reference to the name of the ServiceAccount
380399
// to be used for installation and management of the content for the package
381400
// specified in the packageName field.
382401
//
383-
// This ServiceAccount must exist in the installNamespace.
384-
//
385402
// name follows the DNS subdomain standard as defined in [RFC 1123].
386403
// It must contain only lowercase alphanumeric characters,
387404
// hyphens (-) or periods (.), start and end with an alphanumeric character,
@@ -404,7 +421,7 @@ type ServiceAccountReference struct {
404421
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="name is immutable"
405422
// +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"
406423
// +kubebuilder:validation:Required
407-
Name string `json:"name"`
424+
Name string `json:"name,omitempty"`
408425
}
409426

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

docs/api-reference/olmv1-api-reference.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -339,8 +339,8 @@ _Appears in:_
339339

340340
| Field | Description | Default | Validation |
341341
| --- | --- | --- | --- |
342-
| `namespace` _string_ | namespace is a reference to a Kubernetes namespace.<br />This is the namespace in which the provided ServiceAccount must exist.<br />It also designates the default namespace where namespace-scoped resources<br />for the extension are applied to the cluster.<br />Some extensions may contain namespace-scoped resources to be applied in other namespaces.<br />This namespace must exist.<br />namespace is required, immutable, and follows the DNS label standard<br />as defined in [RFC 1123]. It must contain only lowercase alphanumeric characters or hyphens (-),<br />start and end with an alphanumeric character, and be no longer than 63 characters<br />[RFC 1123]: https://tools.ietf.org/html/rfc1123 | | MaxLength: 63 <br />Required: \{\} <br /> |
343-
| `serviceAccount` _[ServiceAccountReference](#serviceaccountreference)_ | serviceAccount is a reference to a ServiceAccount used to perform all interactions<br />with the cluster that are required to manage the extension.<br />The ServiceAccount must be configured with the necessary permissions to perform these interactions.<br />The ServiceAccount must exist in the namespace referenced in the spec.<br />serviceAccount is required. | | Required: \{\} <br /> |
342+
| `namespace` _string_ | namespace is a reference to a Kubernetes namespace.<br />This designates the default namespace where namespace-scoped resources<br />for the extension are applied to the cluster.<br />Some extensions may contain namespace-scoped resources to be applied in other namespaces.<br />This namespace must exist.<br /><opcon:standard:description><br />This is also the namespace of the referenced service account.<br /></opcon:standard:description><br /><opcon:experimental:description><br />This is also the namespace of the referenced service account, if specified.<br /></opcon:experimental:description><br />namespace is required, immutable, and follows the DNS label standard<br />as defined in [RFC 1123]. It must contain only lowercase alphanumeric characters or hyphens (-),<br />start and end with an alphanumeric character, and be no longer than 63 characters<br />[RFC 1123]: https://tools.ietf.org/html/rfc1123 | | MaxLength: 63 <br />Required: \{\} <br /> |
343+
| `serviceAccount` _[ServiceAccountReference](#serviceaccountreference)_ | serviceAccount is a reference to a ServiceAccount used to perform all interactions<br />with the cluster that are required to manage the extension.<br /><opcon:standard:description><br />The ServiceAccount must be configured with the necessary permissions to perform these interactions.<br />serviceAccount is required.<br /></opcon:standard:description><br /><opcon:experimental:description><br />If serviceAccount is specified, OLM will authenticate as that service account.<br />Otherwise, operator-controller will authenticate as:<br /> - User: "olm:clusterextension:<clusterExtensionName>"<br /> - Group: "olm:clusterextensions"<br />The authenticated user must be configured with the necessary permissions to perform these interactions.<br /></opcon:experimental:description><br /><opcon:standard:validation:Required><br /><opcon:experimental:validation:Optional> | | |
344344
| `source` _[SourceConfig](#sourceconfig)_ | source is a required field which selects the installation source of content<br />for this ClusterExtension. Selection is performed by setting the sourceType.<br />Catalog is currently the only implemented sourceType, and setting the<br />sourcetype to "Catalog" requires the catalog field to also be defined.<br />Below is a minimal example of a source definition (in yaml):<br />source:<br /> sourceType: Catalog<br /> catalog:<br /> packageName: example-package | | Required: \{\} <br /> |
345345
| `install` _[ClusterExtensionInstallConfig](#clusterextensioninstallconfig)_ | install is an optional field used to configure the installation options<br />for the ClusterExtension such as the pre-flight check configuration. | | |
346346
| `config` _[ClusterExtensionConfig](#clusterextensionconfig)_ | config is an optional field used to specify bundle specific configuration<br />used to configure the bundle. Configuration is bundle specific and a bundle may provide<br />a configuration schema. When not specified, the default configuration of the resolved bundle will be used.<br />config is validated against a configuration schema provided by the resolved bundle. If the bundle does not provide<br />a configuration schema the final manifests will be derived on a best-effort basis. More information on how<br />to configure the bundle should be found in its end-user documentation.<br /><opcon:experimental> | | |
@@ -439,7 +439,7 @@ _Appears in:_
439439

440440

441441

442-
ServiceAccountReference identifies the serviceAccount used fo install a ClusterExtension.
442+
ServiceAccountReference identifies the serviceAccount name used to manage a ClusterExtension.
443443

444444

445445

@@ -448,7 +448,7 @@ _Appears in:_
448448

449449
| Field | Description | Default | Validation |
450450
| --- | --- | --- | --- |
451-
| `name` _string_ | name is a required, immutable reference to the name of the ServiceAccount<br />to be used for installation and management of the content for the package<br />specified in the packageName field.<br />This ServiceAccount must exist in the installNamespace.<br />name follows the DNS subdomain standard as defined in [RFC 1123].<br />It must contain only lowercase alphanumeric characters,<br />hyphens (-) or periods (.), start and end with an alphanumeric character,<br />and be no longer than 253 characters.<br />Some examples of valid values are:<br /> - some-serviceaccount<br /> - 123-serviceaccount<br /> - 1-serviceaccount-2<br /> - someserviceaccount<br /> - some.serviceaccount<br />Some examples of invalid values are:<br /> - -some-serviceaccount<br /> - some-serviceaccount-<br />[RFC 1123]: https://tools.ietf.org/html/rfc1123 | | MaxLength: 253 <br />Required: \{\} <br /> |
451+
| `name` _string_ | name is a required, immutable reference to the name of the ServiceAccount<br />to be used for installation and management of the content for the package<br />specified in the packageName field.<br />name follows the DNS subdomain standard as defined in [RFC 1123].<br />It must contain only lowercase alphanumeric characters,<br />hyphens (-) or periods (.), start and end with an alphanumeric character,<br />and be no longer than 253 characters.<br />Some examples of valid values are:<br /> - some-serviceaccount<br /> - 123-serviceaccount<br /> - 1-serviceaccount-2<br /> - someserviceaccount<br /> - some.serviceaccount<br />Some examples of invalid values are:<br /> - -some-serviceaccount<br /> - some-serviceaccount-<br />[RFC 1123]: https://tools.ietf.org/html/rfc1123 | | MaxLength: 253 <br />Required: \{\} <br /> |
452452

453453

454454
#### SourceConfig

helm/olmv1/base/operator-controller/crd/experimental/olm.operatorframework.io_clusterextensions.yaml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -151,12 +151,14 @@ spec:
151151
namespace:
152152
description: |-
153153
namespace is a reference to a Kubernetes namespace.
154-
This is the namespace in which the provided ServiceAccount must exist.
155-
It also designates the default namespace where namespace-scoped resources
154+
155+
This designates the default namespace where namespace-scoped resources
156156
for the extension are applied to the cluster.
157157
Some extensions may contain namespace-scoped resources to be applied in other namespaces.
158158
This namespace must exist.
159159
160+
This is also the namespace of the referenced service account, if specified.
161+
160162
namespace is required, immutable, and follows the DNS label standard
161163
as defined in [RFC 1123]. It must contain only lowercase alphanumeric characters or hyphens (-),
162164
start and end with an alphanumeric character, and be no longer than 63 characters
@@ -173,18 +175,20 @@ spec:
173175
description: |-
174176
serviceAccount is a reference to a ServiceAccount used to perform all interactions
175177
with the cluster that are required to manage the extension.
176-
The ServiceAccount must be configured with the necessary permissions to perform these interactions.
177-
The ServiceAccount must exist in the namespace referenced in the spec.
178-
serviceAccount is required.
178+
179+
If serviceAccount is specified, OLM will authenticate as that service account.
180+
Otherwise, operator-controller will authenticate as:
181+
- User: "olm:clusterextension:<clusterExtensionName>"
182+
- Group: "olm:clusterextensions"
183+
184+
The authenticated user must be configured with the necessary permissions to perform these interactions.
179185
properties:
180186
name:
181187
description: |-
182188
name is a required, immutable reference to the name of the ServiceAccount
183189
to be used for installation and management of the content for the package
184190
specified in the packageName field.
185191
186-
This ServiceAccount must exist in the installNamespace.
187-
188192
name follows the DNS subdomain standard as defined in [RFC 1123].
189193
It must contain only lowercase alphanumeric characters,
190194
hyphens (-) or periods (.), start and end with an alphanumeric character,
@@ -498,7 +502,6 @@ spec:
498502
has(self.catalog) : !has(self.catalog)'
499503
required:
500504
- namespace
501-
- serviceAccount
502505
- source
503506
type: object
504507
status:

helm/olmv1/base/operator-controller/crd/standard/olm.operatorframework.io_clusterextensions.yaml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,14 @@ spec:
112112
namespace:
113113
description: |-
114114
namespace is a reference to a Kubernetes namespace.
115-
This is the namespace in which the provided ServiceAccount must exist.
116-
It also designates the default namespace where namespace-scoped resources
115+
116+
This designates the default namespace where namespace-scoped resources
117117
for the extension are applied to the cluster.
118118
Some extensions may contain namespace-scoped resources to be applied in other namespaces.
119119
This namespace must exist.
120120
121+
This is also the namespace of the referenced service account.
122+
121123
namespace is required, immutable, and follows the DNS label standard
122124
as defined in [RFC 1123]. It must contain only lowercase alphanumeric characters or hyphens (-),
123125
start and end with an alphanumeric character, and be no longer than 63 characters
@@ -134,8 +136,9 @@ spec:
134136
description: |-
135137
serviceAccount is a reference to a ServiceAccount used to perform all interactions
136138
with the cluster that are required to manage the extension.
139+
137140
The ServiceAccount must be configured with the necessary permissions to perform these interactions.
138-
The ServiceAccount must exist in the namespace referenced in the spec.
141+
139142
serviceAccount is required.
140143
properties:
141144
name:
@@ -144,8 +147,6 @@ spec:
144147
to be used for installation and management of the content for the package
145148
specified in the packageName field.
146149
147-
This ServiceAccount must exist in the installNamespace.
148-
149150
name follows the DNS subdomain standard as defined in [RFC 1123].
150151
It must contain only lowercase alphanumeric characters,
151152
hyphens (-) or periods (.), start and end with an alphanumeric character,

internal/operator-controller/controllers/clusterextension_admission_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ func TestClusterExtensionAdmissionServiceAccount(t *testing.T) {
349349
{"dot-separated", "dotted.name", ""},
350350
{"longest valid service account name", strings.Repeat("x", 253), ""},
351351
{"too long service account name", strings.Repeat("x", 254), tooLongError},
352-
{"no service account name", "", regexMismatchError},
352+
{"no service account name", "", ""},
353353
{"spaces", "spaces spaces", regexMismatchError},
354354
{"capitalized", "Capitalized", regexMismatchError},
355355
{"camel case", "camelCase", regexMismatchError},

manifests/experimental-e2e.yaml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -939,12 +939,14 @@ spec:
939939
namespace:
940940
description: |-
941941
namespace is a reference to a Kubernetes namespace.
942-
This is the namespace in which the provided ServiceAccount must exist.
943-
It also designates the default namespace where namespace-scoped resources
942+
943+
This designates the default namespace where namespace-scoped resources
944944
for the extension are applied to the cluster.
945945
Some extensions may contain namespace-scoped resources to be applied in other namespaces.
946946
This namespace must exist.
947947
948+
This is also the namespace of the referenced service account, if specified.
949+
948950
namespace is required, immutable, and follows the DNS label standard
949951
as defined in [RFC 1123]. It must contain only lowercase alphanumeric characters or hyphens (-),
950952
start and end with an alphanumeric character, and be no longer than 63 characters
@@ -961,18 +963,20 @@ spec:
961963
description: |-
962964
serviceAccount is a reference to a ServiceAccount used to perform all interactions
963965
with the cluster that are required to manage the extension.
964-
The ServiceAccount must be configured with the necessary permissions to perform these interactions.
965-
The ServiceAccount must exist in the namespace referenced in the spec.
966-
serviceAccount is required.
966+
967+
If serviceAccount is specified, OLM will authenticate as that service account.
968+
Otherwise, operator-controller will authenticate as:
969+
- User: "olm:clusterextension:<clusterExtensionName>"
970+
- Group: "olm:clusterextensions"
971+
972+
The authenticated user must be configured with the necessary permissions to perform these interactions.
967973
properties:
968974
name:
969975
description: |-
970976
name is a required, immutable reference to the name of the ServiceAccount
971977
to be used for installation and management of the content for the package
972978
specified in the packageName field.
973979
974-
This ServiceAccount must exist in the installNamespace.
975-
976980
name follows the DNS subdomain standard as defined in [RFC 1123].
977981
It must contain only lowercase alphanumeric characters,
978982
hyphens (-) or periods (.), start and end with an alphanumeric character,
@@ -1286,7 +1290,6 @@ spec:
12861290
has(self.catalog) : !has(self.catalog)'
12871291
required:
12881292
- namespace
1289-
- serviceAccount
12901293
- source
12911294
type: object
12921295
status:

0 commit comments

Comments
 (0)