Skip to content

Commit 6047bec

Browse files
authored
feat: Add GenericClusterConfig and add docs on usage with own CC (#606)
**What problem does this PR solve?**: GenericClusterConfig provides for extension of any CC - very useful! Added docs on how to add CAREN your own ClusterClass as well so users can go further than just using our example ClusterClasses. **Which issue(s) this PR fixes**: Fixes # **How Has This Been Tested?**: <!-- Please describe the tests that you ran to verify your changes. Provide output from the tests and any manual steps needed to replicate the tests. --> **Special notes for your reviewer**: <!-- Use this to provide any additional information to the reviewers. This may include: - Best way to review the PR. - Where the author wants the most review attention on. - etc. -->
1 parent 103f1c2 commit 6047bec

File tree

12 files changed

+595
-9
lines changed

12 files changed

+595
-9
lines changed

api/v1alpha1/clusterconfig_types.go

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ var (
3232
awsClusterConfigCRDDefinition []byte
3333
//go:embed crds/caren.nutanix.com_nutanixclusterconfigs.yaml
3434
nutanixClusterConfigCRDDefinition []byte
35+
//go:embed crds/caren.nutanix.com_genericclusterconfigs.yaml
36+
genericClusterConfigCRDDefinition []byte
3537

3638
dockerClusterConfigVariableSchema = variables.MustSchemaFromCRDYAML(
3739
dockerClusterConfigCRDDefinition,
@@ -42,6 +44,9 @@ var (
4244
nutanixClusterConfigVariableSchema = variables.MustSchemaFromCRDYAML(
4345
nutanixClusterConfigCRDDefinition,
4446
)
47+
genericClusterConfigVariableSchema = variables.MustSchemaFromCRDYAML(
48+
genericClusterConfigCRDDefinition,
49+
)
4550
)
4651

4752
// +kubebuilder:object:root=true
@@ -103,7 +108,7 @@ type DockerClusterConfigSpec struct {
103108
ControlPlane *DockerNodeConfigSpec `json:"controlPlane,omitempty"`
104109

105110
// Extra Subject Alternative Names for the API Server signing cert.
106-
// For the Nutanix provider, the following default SANs will always be added:
111+
// For the Docker provider, the following default SANs will always be added:
107112
// - localhost
108113
// - 127.0.0.1
109114
// - 0.0.0.0
@@ -150,6 +155,27 @@ type NutanixClusterConfigSpec struct {
150155
ExtraAPIServerCertSANs []string `json:"extraAPIServerCertSANs,omitempty"`
151156
}
152157

158+
// +kubebuilder:object:root=true
159+
160+
// GenericClusterConfig is the Schema for the genericclusterconfigs API.
161+
type GenericClusterConfig struct {
162+
metav1.TypeMeta `json:",inline"`
163+
metav1.ObjectMeta `json:"metadata,omitempty"`
164+
165+
// +optional
166+
Spec GenericClusterConfigSpec `json:"spec,omitempty"`
167+
168+
// Extra Subject Alternative Names for the API Server signing cert.
169+
// +kubebuilder:validation:UniqueItems=true
170+
// +kubebuilder:validation:items:Pattern=`^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$`
171+
// +optional
172+
ExtraAPIServerCertSANs []string `json:"extraAPIServerCertSANs,omitempty"`
173+
}
174+
175+
func (s GenericClusterConfig) VariableSchema() clusterv1.VariableSchema { //nolint:gocritic,lll // Passed by value for no potential side-effect.
176+
return genericClusterConfigVariableSchema
177+
}
178+
153179
// GenericClusterConfigSpec defines the desired state of GenericClusterConfig.
154180
type GenericClusterConfigSpec struct {
155181
// Sets the Kubernetes image repository used for the KubeadmControlPlane.

api/v1alpha1/crds/caren.nutanix.com_dockerclusterconfigs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ spec:
258258
extraAPIServerCertSANs:
259259
description: |-
260260
Extra Subject Alternative Names for the API Server signing cert.
261-
For the Nutanix provider, the following default SANs will always be added:
261+
For the Docker provider, the following default SANs will always be added:
262262
- localhost
263263
- 127.0.0.1
264264
- 0.0.0.0

0 commit comments

Comments
 (0)