Skip to content

Commit 8db0708

Browse files
committed
fixup! revert: Rollback generic cluster resource changes
1 parent b953a65 commit 8db0708

File tree

19 files changed

+126
-369
lines changed

19 files changed

+126
-369
lines changed

api/v1alpha1/clusterconfig_types.go

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ type AWSClusterConfigSpec struct {
7575
// +kubebuilder:validation:Optional
7676
AWS *AWSSpec `json:"aws,omitempty"`
7777

78-
GenericClusterConfigResource `json:",inline"`
78+
GenericClusterConfigSpec `json:",inline"`
7979

8080
// +kubebuilder:validation:Optional
8181
Addons *AWSAddons `json:"addons,omitempty"`
@@ -112,7 +112,7 @@ type DockerClusterConfigSpec struct {
112112
// +kubebuilder:validation:Optional
113113
Docker *DockerSpec `json:"docker,omitempty"`
114114

115-
GenericClusterConfigResource `json:",inline"`
115+
GenericClusterConfigSpec `json:",inline"`
116116

117117
// +kubebuilder:validation:Optional
118118
Addons *DockerAddons `json:"addons,omitempty"`
@@ -154,7 +154,7 @@ type NutanixClusterConfigSpec struct {
154154
// +kubebuilder:validation:Optional
155155
Nutanix *NutanixSpec `json:"nutanix,omitempty"`
156156

157-
GenericClusterConfigResource `json:",inline"`
157+
GenericClusterConfigSpec `json:",inline"`
158158

159159
// +kubebuilder:validation:Optional
160160
Addons *NutanixAddons `json:"addons,omitempty"`
@@ -200,13 +200,6 @@ func (s GenericClusterConfig) VariableSchema() clusterv1.VariableSchema { //noli
200200

201201
// GenericClusterConfigSpec defines the desired state of GenericClusterConfig.
202202
type GenericClusterConfigSpec struct {
203-
GenericClusterConfigResource `json:",inline"`
204-
205-
// +kubebuilder:validation:Optional
206-
Addons *GenericAddons `json:"addons,omitempty"`
207-
}
208-
209-
type GenericClusterConfigResource struct {
210203
// Sets the Kubernetes image repository used for the KubeadmControlPlane.
211204
// +kubebuilder:validation:Optional
212205
// +kubebuilder:validation:Pattern=`^((?:[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*|\[(?:[a-fA-F0-9:]+)\])(:[0-9]+)?/)?[a-z0-9]+((?:[._]|__|[-]+)[a-z0-9]+)*(/[a-z0-9]+((?:[._]|__|[-]+)[a-z0-9]+)*)*$`

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

Lines changed: 0 additions & 159 deletions
Original file line numberDiff line numberDiff line change
@@ -52,165 +52,6 @@ spec:
5252
spec:
5353
description: GenericClusterConfigSpec defines the desired state of GenericClusterConfig.
5454
properties:
55-
addons:
56-
properties:
57-
ccm:
58-
description: CCM tells us to enable or disable the cloud provider
59-
interface.
60-
properties:
61-
credentials:
62-
description: A reference to the Secret for credential information
63-
for the target Prism Central instance
64-
properties:
65-
secretRef:
66-
description: A reference to the Secret containing the
67-
credentials used by the CCM provider.
68-
properties:
69-
name:
70-
description: |-
71-
Name of the referent.
72-
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
73-
maxLength: 253
74-
minLength: 1
75-
type: string
76-
required:
77-
- name
78-
type: object
79-
required:
80-
- secretRef
81-
type: object
82-
strategy:
83-
default: HelmAddon
84-
description: Addon strategy used to deploy the CCM to the
85-
workload cluster.
86-
enum:
87-
- ClusterResourceSet
88-
- HelmAddon
89-
type: string
90-
type: object
91-
clusterAutoscaler:
92-
description: ClusterAutoscaler tells us to enable or disable the
93-
cluster-autoscaler addon.
94-
properties:
95-
strategy:
96-
default: HelmAddon
97-
description: |-
98-
Addon strategy used to deploy cluster-autoscaler to the management cluster
99-
targeting the workload cluster.
100-
enum:
101-
- ClusterResourceSet
102-
- HelmAddon
103-
type: string
104-
type: object
105-
cni:
106-
description: CNI required for providing CNI configuration.
107-
properties:
108-
provider:
109-
description: CNI provider to deploy.
110-
enum:
111-
- Calico
112-
- Cilium
113-
type: string
114-
strategy:
115-
default: HelmAddon
116-
description: Addon strategy used to deploy the CNI provider
117-
to the workload cluster.
118-
enum:
119-
- ClusterResourceSet
120-
- HelmAddon
121-
type: string
122-
values:
123-
description: Values contains the helm values for the CNI when
124-
HelmAddon is the strategy.
125-
properties:
126-
sourceRef:
127-
description: |-
128-
SourceRef is an object reference to Configmap/Secret inside the same namespace
129-
which contains inline YAML representing the values for the Helm chart.
130-
properties:
131-
kind:
132-
description: Kind is the type of resource being referenced,
133-
valid values are ('ConfigMap').
134-
enum:
135-
- ConfigMap
136-
type: string
137-
name:
138-
description: Name is the name of resource being referenced.
139-
maxLength: 253
140-
minLength: 1
141-
type: string
142-
required:
143-
- kind
144-
- name
145-
type: object
146-
type: object
147-
required:
148-
- provider
149-
type: object
150-
nfd:
151-
description: NFD tells us to enable or disable the node feature
152-
discovery addon.
153-
properties:
154-
strategy:
155-
default: HelmAddon
156-
description: Addon strategy used to deploy Node Feature Discovery
157-
(NFD) to the workload cluster.
158-
enum:
159-
- ClusterResourceSet
160-
- HelmAddon
161-
type: string
162-
type: object
163-
registry:
164-
properties:
165-
provider:
166-
default: CNCF Distribution
167-
description: The OCI registry provider to deploy.
168-
enum:
169-
- CNCF Distribution
170-
type: string
171-
required:
172-
- provider
173-
type: object
174-
serviceLoadBalancer:
175-
properties:
176-
configuration:
177-
description: Configuration for the chosen ServiceLoadBalancer
178-
provider.
179-
properties:
180-
addressRanges:
181-
description: |-
182-
AddressRanges is a list of IPv4 address ranges the
183-
provider uses to choose an address for a load balancer.
184-
items:
185-
description: AddressRange defines an IPv4 range.
186-
properties:
187-
end:
188-
format: ipv4
189-
type: string
190-
start:
191-
format: ipv4
192-
type: string
193-
required:
194-
- end
195-
- start
196-
type: object
197-
maxItems: 10
198-
minItems: 1
199-
type: array
200-
required:
201-
- addressRanges
202-
type: object
203-
provider:
204-
description: |-
205-
The LoadBalancer-type Service provider to deploy. Not required in infrastructures where
206-
the CCM acts as the provider.
207-
enum:
208-
- MetalLB
209-
type: string
210-
required:
211-
- provider
212-
type: object
213-
type: object
21455
dns:
21556
description: DNS defines the DNS configuration for the cluster.
21657
properties:

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 4 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/variables/aggregate_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ type ClusterConfigSpec struct {
2222

2323
EKS *carenv1.EKSSpec `json:"eks,omitempty"`
2424

25-
carenv1.GenericClusterConfigResource `json:",inline"`
25+
carenv1.GenericClusterConfigSpec `json:",inline"`
2626

2727
Addons *Addons `json:"addons,omitempty"`
2828

cmd/main.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,14 +121,14 @@ func main() {
121121
// It allows to specify configuration under a single variable.
122122
nutanixMetaHandlers := nutanix.New(globalOptions)
123123

124-
// genericMetaHandlers combines all generic patch and variable handlers under a single handler.
125-
// It allows to specify configuration under a single variable.
126-
genericMetaHandlers := generic.New()
127-
128124
// eksMetaHandlers combines all EKS patch and variable handlers under a single handler.
129125
// It allows to specify configuration under a single variable.
130126
eksMetaHandlers := eks.New(globalOptions)
131127

128+
// genericMetaHandlers combines all generic patch and variable handlers under a single handler.
129+
// It allows to specify configuration under a single variable.
130+
genericMetaHandlers := generic.New()
131+
132132
namespacesyncOptions := namespacesync.Options{}
133133
enforceClusterAutoscalerLimitsOptions := enforceclusterautoscalerlimits.Options{}
134134
failureDomainRolloutOptions := failuredomainrollout.Options{}
@@ -177,8 +177,8 @@ func main() {
177177
allHandlers = append(allHandlers, awsMetaHandlers.AllHandlers(mgr)...)
178178
allHandlers = append(allHandlers, dockerMetaHandlers.AllHandlers(mgr)...)
179179
allHandlers = append(allHandlers, nutanixMetaHandlers.AllHandlers(mgr)...)
180-
allHandlers = append(allHandlers, genericMetaHandlers.AllHandlers(mgr)...)
181180
allHandlers = append(allHandlers, eksMetaHandlers.AllHandlers(mgr)...)
181+
allHandlers = append(allHandlers, genericMetaHandlers.AllHandlers(mgr)...)
182182

183183
runtimeWebhookServer := server.NewServer(runtimeWebhookServerOpts, allHandlers...)
184184

pkg/handlers/eks/mutation/metapatch_handler.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func MetaPatchHandler(mgr manager.Manager) handlers.Named {
2626
patchHandlers = append(patchHandlers, metaMutators()...)
2727

2828
return mutation.NewMetaGeneratePatchesHandler(
29-
"eksClusterV1ConfigPatch",
29+
"eksClusterV4ConfigPatch",
3030
mgr.GetClient(),
3131
patchHandlers...,
3232
)
@@ -44,7 +44,7 @@ func MetaWorkerPatchHandler(mgr manager.Manager) handlers.Named {
4444
patchHandlers = append(patchHandlers, workerMetaMutators()...)
4545

4646
return mutation.NewMetaGeneratePatchesHandler(
47-
"eksWorkerV1ConfigPatch",
47+
"eksWorkerV4ConfigPatch",
4848
mgr.GetClient(),
4949
patchHandlers...,
5050
)

pkg/handlers/eks/mutation/region/inject_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ var _ = Describe("Generate EKS Region patches", func() {
3737
Vars: []runtimehooksv1.Variable{
3838
capitest.VariableWithValue(
3939
v1alpha1.ClusterConfigVariableName,
40-
"a-specific-region",
40+
"specific-region",
4141
v1alpha1.EKSVariableName,
4242
VariableName,
4343
),
@@ -46,7 +46,7 @@ var _ = Describe("Generate EKS Region patches", func() {
4646
ExpectedPatchMatchers: []capitest.JSONPatchMatcher{{
4747
Operation: "add",
4848
Path: "/spec/template/spec/region",
49-
ValueMatcher: gomega.Equal("a-specific-region"),
49+
ValueMatcher: gomega.Equal("specific-region"),
5050
}},
5151
},
5252
}

pkg/handlers/eks/mutation/region/variables_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ func TestVariableValidation(t *testing.T) {
2424
Name: "specified region",
2525
Vals: v1alpha1.EKSClusterConfigSpec{
2626
EKS: &v1alpha1.EKSSpec{
27-
Region: ptr.To(v1alpha1.Region("a-specified-region")),
27+
Region: ptr.To(v1alpha1.Region("specified-region")),
2828
},
2929
},
3030
},

0 commit comments

Comments
 (0)