Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Makefile
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
29 changes: 21 additions & 8 deletions api/v1/clusterextension_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,34 @@ const (

// ClusterExtensionSpec defines the desired state of ClusterExtension
type ClusterExtensionSpec struct {
// 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.
// This namespace must exist.
// namespace selects the namespace that namespace-scoped resources for the extension
// are applied to.
//
// The namespace field is required, immutable, and follows the DNS label standard as defined in [RFC 1123].
// <opcon:standard:description>
// In the standard configuration, namespace is required and must reference an existing
// namespace on the cluster.

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.

Sorry didn't notice this on my first comment about the CRD changes: Let's leave the standard configuration CRD completely unchanged. When we re-gen the CRDs, I'd expect helm/olmv1/base/operator-controller/crd/standard/olm.operatorframework.io_clusterextensions.yaml to be unchanged.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

to let experimental users skip namespace, this PR loosened the validation rules on the namespace field, but those rules are shared, so the change showed up in both the standard and experimental CRDs. That's why standard changed.

// </opcon:standard:description>
// <opcon:experimental:description>
// 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.
// </opcon:experimental:description>
//
// 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:standard:validation:Required>
// <opcon:standard:validation:XValidation:rule="self != ''",message="namespace is required">
// <opcon:experimental:validation:XValidation:rule="oldSelf != '' || self == ''",message="namespace cannot be set after creation; mode is locked at creation time">
//
// +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
// +kubebuilder:validation:XValidation:rule="self == '' || self.matches(\"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$\")",message="namespace must be a valid DNS1123 label"
// +kubebuilder:validation:XValidation:rule="oldSelf == '' || self == oldSelf",message="namespace is immutable once set"
// +optional
Namespace string `json:"namespace"`
Comment thread
coderabbitai[bot] marked this conversation as resolved.

// serviceAccount is a deprecated field and is completely ignored.
Expand Down
23 changes: 18 additions & 5 deletions applyconfigurations/api/v1/clusterextensionspec.go

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

2 changes: 1 addition & 1 deletion applyconfigurations/api/v1/clusterextensionstatus.go

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
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