FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

⚠ make spec.namespace optional with managed namespace support and PSA support by nader-ziada · Pull Request #2825 · operator-framework/operator-controller · GitHub

4 changes: 4 additions & 0 deletions Makefile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,10 @@ crd-ref-docs: $(CRD_REF_DOCS) #EXHELP Generate the API Reference Documents.
$(CRD_REF_DOCS) --source-path=$(ROOT_DIR)/api/ \
--config=$(API_REFERENCE_DIR)/crd-ref-docs-gen-config.yaml \
--renderer=markdown --output-path=$(API_REFERENCE_DIR)/$(API_REFERENCE_FILENAME);
# crd-ref-docs renders doc-comment text verbatim, including internal <opcon:...> generator
# directives; strip them from the published reference (the per-channel contracts remain in prose).
sed -E 's#</?opcon:[^>]*>##g' $(API_REFERENCE_DIR)/$(API_REFERENCE_FILENAME) > $(API_REFERENCE_DIR)/$(API_REFERENCE_FILENAME).tmp
mv $(API_REFERENCE_DIR)/$(API_REFERENCE_FILENAME).tmp $(API_REFERENCE_DIR)/$(API_REFERENCE_FILENAME)

VENVDIR := $(abspath docs/.venv)

Expand Down
28 changes: 26 additions & 2 deletions api/v1/clusterextension_types.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const (

// ClusterExtensionSpec defines the desired state of ClusterExtension
type ClusterExtensionSpec struct {
// <opcon:standard:description>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

The API checker is complaining about this:

api/v1/clusterextension_types.go:52:2:kubeapilinter:commentstart: godoc for field ClusterExtensionSpec.Namespace should start with 'namespace ...'

But I think it's "ok" since the field has been moved back to experimental.

// namespace specifies a Kubernetes namespace.
// It designates the default namespace where namespace-scoped resources for the extension are applied to the cluster.
// Some extensions may contain namespace-scoped resources to be applied in other namespaces.
Expand All @@ -59,10 +60,31 @@ type ClusterExtensionSpec struct {
// and be no longer than 63 characters.
//
// [RFC 1123]: https://tools.ietf.org/html/rfc1123
// </opcon:standard:description>
// <opcon:experimental:description>
// namespace selects the namespace that namespace-scoped resources for the extension
// are applied to.
//
// namespace is optional. When set, it must reference an existing namespace on the cluster.
// When omitted, operator-controller resolves and creates a managed namespace from the
// bundle's metadata. Whether namespace is set or omitted is fixed at creation time and
// cannot be changed afterwards.
//
// The namespace field follows the DNS label standard as defined in [RFC 1123].
// It must contain only lowercase alphanumeric characters or hyphens (-), start and end with an alphanumeric character,
// and be no longer than 63 characters.
//
// [RFC 1123]: https://tools.ietf.org/html/rfc1123
// </opcon:experimental:description>
//
// <opcon:standard:validation:XValidation:rule="self == oldSelf",message="namespace is immutable">
// <opcon:standard:validation:XValidation:rule="self.matches("^[a-z0-9]([-a-z0-9]*[a-z0-9])?$")",message="namespace must be a valid DNS1123 label">
// <opcon:experimental:validation:XValidation:rule="self == '' || self.matches("^[a-z0-9]([-a-z0-9]*[a-z0-9])?$")",message="namespace must be a valid DNS1123 label">
// <opcon:experimental:validation:XValidation:rule="oldSelf == '' || self == oldSelf",message="namespace is immutable once set">
// <opcon:experimental:validation:XValidation:rule="oldSelf != '' || self == ''",message="namespace cannot be set after creation; mode is locked at creation time">
Comment thread
coderabbitai[bot] marked this conversation as resolved.
// <opcon:experimental:validation:Optional>
//
// +kubebuilder:validation:MaxLength:=63
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="namespace is immutable"
// +kubebuilder:validation:XValidation:rule="self.matches(\"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$\")",message="namespace must be a valid DNS1123 label"
// +required
Namespace string `json:"namespace"`

Expand Down Expand Up @@ -586,6 +608,8 @@ type ClusterExtension struct {
metav1.ObjectMeta `json:"metadata,omitempty"`

// spec is an optional field that defines the desired state of the ClusterExtension.
//
// <opcon:experimental:validation:XValidation:rule="has(oldSelf.namespace) == has(self.namespace)",message="namespace presence is immutable; it cannot be added or removed after creation">
// +optional
Spec ClusterExtensionSpec `json:"spec,omitempty"`

Expand Down
2 changes: 2 additions & 0 deletions applyconfigurations/api/v1/clusterextension.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions applyconfigurations/api/v1/clusterextensionspec.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions cmd/operator-controller/main.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -502,11 +502,12 @@ func run() error {

certProvider := getCertificateProvider()
regv1ManifestProvider := &applier.RegistryV1ManifestProvider{
BundleRenderer: registryv1.Renderer,
CertificateProvider: certProvider,
IsWebhookSupportEnabled: certProvider != nil,
IsSingleOwnNamespaceEnabled: features.OperatorControllerFeatureGate.Enabled(features.SingleOwnNamespaceInstallSupport),
IsDeploymentConfigEnabled: features.OperatorControllerFeatureGate.Enabled(features.DeploymentConfig),
BundleRenderer: registryv1.Renderer,
CertificateProvider: certProvider,
IsWebhookSupportEnabled: certProvider != nil,
IsSingleOwnNamespaceEnabled: features.OperatorControllerFeatureGate.Enabled(features.SingleOwnNamespaceInstallSupport),
IsDeploymentConfigEnabled: features.OperatorControllerFeatureGate.Enabled(features.DeploymentConfig),
IsNamespaceManagementEnabled: features.OperatorControllerFeatureGate.Enabled(features.BoxcutterRuntime),
}
var cerCfg reconcilerConfigurator
if features.OperatorControllerFeatureGate.Enabled(features.BoxcutterRuntime) {
Expand Down Expand Up @@ -659,6 +660,7 @@ func (c *boxcutterReconcilerConfigurator) Configure(ceReconciler *controllers.Cl
controllers.RetrieveRevisionStates(revisionStatesGetter),
controllers.ResolveBundle(c.resolver, c.mgr.GetClient()),
controllers.UnpackBundle(c.imagePuller, c.imageCache),
controllers.ValidateInstallNamespace(coreClient),
controllers.ApplyBundleWithBoxcutter(appl.Apply),
}

Expand Down
Loading
Loading

Back | FazBrowse Home | New Git URL