Skip to content

Commit d2378f4

Browse files
author
Per Goncalves da Silva
committed
Add experimental ClusterExtension .spec.config
Signed-off-by: Per Goncalves da Silva <[email protected]>
1 parent 3b5e6fb commit d2378f4

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

api/v1/clusterextension_types.go

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ limitations under the License.
1717
package v1
1818

1919
import (
20+
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
2021
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2122
)
2223

@@ -25,6 +26,8 @@ var ClusterExtensionKind = "ClusterExtension"
2526
type (
2627
UpgradeConstraintPolicy string
2728
CRDUpgradeSafetyEnforcement string
29+
30+
ClusterExtensionConfigType string
2831
)
2932

3033
const (
@@ -39,6 +42,8 @@ const (
3942
// Use with caution as this can lead to unknown and potentially
4043
// disastrous results such as data loss.
4144
UpgradeConstraintPolicySelfCertified UpgradeConstraintPolicy = "SelfCertified"
45+
46+
ClusterExtensionConfigTypeInline ClusterExtensionConfigType = "Inline"
4247
)
4348

4449
// ClusterExtensionSpec defines the desired state of ClusterExtension
@@ -92,6 +97,14 @@ type ClusterExtensionSpec struct {
9297
//
9398
// +optional
9499
Install *ClusterExtensionInstallConfig `json:"install,omitempty"`
100+
101+
// config contains configuration values applied during rendering of the
102+
// ClusterExtension's manifests. Values can be specified inline or sourced
103+
// from a referenced Secret.
104+
//
105+
// <opcon:experimental>
106+
// +optional
107+
Config *ClusterExtensionConfig `json:"config,omitempty"`
95108
}
96109

97110
const SourceTypeCatalog = "Catalog"
@@ -138,6 +151,29 @@ type ClusterExtensionInstallConfig struct {
138151
Preflight *PreflightConfig `json:"preflight,omitempty"`
139152
}
140153

154+
// ClusterExtensionConfig is a discriminated union which selects the source configuration values to be merged into
155+
// the ClusterExtension's rendered manifests.
156+
//
157+
// +union
158+
type ClusterExtensionConfig struct {
159+
// configType is a required reference to the type of configuration source.
160+
//
161+
// Allowed values are "Inline"
162+
//
163+
// When this field is set to "Inline", the cluster extension configuration is defined inline within the
164+
// ClusterExtension resource.
165+
//
166+
// +unionDiscriminator
167+
// +kubebuilder:validation:Enum:="Inline"
168+
// +kubebuilder:validation:Required
169+
ConfigType ClusterExtensionConfigType `json:"configType"`
170+
171+
// inline contains JSON or YAML values specified directly in the
172+
// ClusterExtension.
173+
// +optional
174+
Inline *apiextensionsv1.JSON `json:"inline,omitempty"`
175+
}
176+
141177
// CatalogFilter defines the attributes used to identify and filter content from a catalog.
142178
type CatalogFilter struct {
143179
// packageName is a reference to the name of the package to be installed

0 commit comments

Comments
 (0)