Skip to content

Commit 8fbed66

Browse files
authored
refactor: add new kube-proxy mode disable option (#1319)
**What problem does this PR solve?**: Moves the annotation based way of disabling kube-proxy to be driven by CAREN API instead. ``` apiVersion: cluster.x-k8s.io/v1beta1 kind: Cluster metadata: name: <NAME> spec: topology: variables: - name: clusterConfig value: kubeProxy: mode: disabled ``` **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 60c8c84 commit 8fbed66

22 files changed

+630
-643
lines changed

api/v1alpha1/clusterconfig_types.go

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ type AWSClusterConfigSpec struct {
8383
KubeadmClusterConfigSpec `json:",inline"`
8484
GenericClusterConfigSpec `json:",inline"`
8585

86+
// KubeProxy defines the configuration for kube-proxy.
87+
// +kubebuilder:validation:Optional
88+
KubeProxy *KubeProxy `json:"kubeProxy,omitempty"`
89+
8690
// +kubebuilder:validation:Optional
8791
Addons *AWSAddons `json:"addons,omitempty"`
8892

@@ -121,6 +125,10 @@ type DockerClusterConfigSpec struct {
121125
KubeadmClusterConfigSpec `json:",inline"`
122126
GenericClusterConfigSpec `json:",inline"`
123127

128+
// KubeProxy defines the configuration for kube-proxy.
129+
// +kubebuilder:validation:Optional
130+
KubeProxy *KubeProxy `json:"kubeProxy,omitempty"`
131+
124132
// +kubebuilder:validation:Optional
125133
Addons *DockerAddons `json:"addons,omitempty"`
126134

@@ -164,6 +172,10 @@ type NutanixClusterConfigSpec struct {
164172
KubeadmClusterConfigSpec `json:",inline"`
165173
GenericClusterConfigSpec `json:",inline"`
166174

175+
// KubeProxy defines the configuration for kube-proxy.
176+
// +kubebuilder:validation:Optional
177+
KubeProxy *KubeProxy `json:"kubeProxy,omitempty"`
178+
167179
// +kubebuilder:validation:Optional
168180
Addons *NutanixAddons `json:"addons,omitempty"`
169181

@@ -206,6 +218,10 @@ type EKSClusterConfigSpec struct {
206218

207219
GenericClusterConfigSpec `json:",inline"`
208220

221+
// KubeProxy defines the configuration for kube-proxy.
222+
// +kubebuilder:validation:Optional
223+
KubeProxy *KubeProxy `json:"kubeProxy,omitempty"`
224+
209225
// +kubebuilder:validation:Optional
210226
Addons *AWSAddons `json:"addons,omitempty"`
211227
}
@@ -243,10 +259,6 @@ type KubeadmClusterConfigSpec struct {
243259
// +kubebuilder:validation:Optional
244260
DNS *DNS `json:"dns,omitempty"`
245261

246-
// KubeProxy defines the configuration for kube-proxy.
247-
// +kubebuilder:validation:Optional
248-
KubeProxy *KubeProxy `json:"kubeProxy,omitempty"`
249-
250262
// MaxParallelImagePullsPerNode defines the maximum number of parallel image pulls performed by each kubelet.
251263
// If not set, the default value of 1 will be used.
252264
// If set to 0, the maximum number of parallel image pulls will be unlimited.
@@ -425,14 +437,20 @@ const (
425437
// KubeProxyModeNFTables indicates that kube-proxy should be installed in nftables
426438
// mode.
427439
KubeProxyModeNFTables KubeProxyMode = "nftables"
440+
// KubeProxyModeDisabled indicates that kube-proxy should be disabled.
441+
KubeProxyModeDisabled KubeProxyMode = "disabled"
428442
)
429443

444+
// KubeProxy defines the configuration for kube-proxy.
445+
// This struct is shared across all providers, but EKS only supports the disabled mode.
446+
// The CRD is updated manually to reflect this.
430447
type KubeProxy struct {
431448
// Mode specifies the mode for kube-proxy:
432449
// - iptables means that kube-proxy is installed in iptables mode.
433450
// - nftables means that kube-proxy is installed in nftables mode.
451+
// - disabled means that kube-proxy is disabled.
434452
// +kubebuilder:validation:Optional
435-
// +kubebuilder:validation:Enum=iptables;nftables
453+
// +kubebuilder:validation:Enum=iptables;nftables;disabled
436454
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="Value cannot be changed after cluster creation"
437455
Mode KubeProxyMode `json:"mode,omitempty"`
438456
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -716,9 +716,11 @@ spec:
716716
Mode specifies the mode for kube-proxy:
717717
- iptables means that kube-proxy is installed in iptables mode.
718718
- nftables means that kube-proxy is installed in nftables mode.
719+
- disabled means that kube-proxy is disabled.
719720
enum:
720721
- iptables
721722
- nftables
723+
- disabled
722724
type: string
723725
x-kubernetes-validations:
724726
- message: Value cannot be changed after cluster creation

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,9 +531,11 @@ spec:
531531
Mode specifies the mode for kube-proxy:
532532
- iptables means that kube-proxy is installed in iptables mode.
533533
- nftables means that kube-proxy is installed in nftables mode.
534+
- disabled means that kube-proxy is disabled.
534535
enum:
535536
- iptables
536537
- nftables
538+
- disabled
537539
type: string
538540
x-kubernetes-validations:
539541
- message: Value cannot be changed after cluster creation

0 commit comments

Comments
 (0)