Skip to content

Commit 6766d5c

Browse files
committed
add kubekey k3s boostrap and control plane provider
Signed-off-by: 24sama <[email protected]>
1 parent fb1b1df commit 6766d5c

File tree

4 files changed

+64
-36
lines changed

4 files changed

+64
-36
lines changed

cmd/clusterctl/client/config/providers_client.go

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,19 @@ const (
6565

6666
// Bootstrap providers.
6767
const (
68-
KubeadmBootstrapProviderName = "kubeadm"
69-
TalosBootstrapProviderName = "talos"
70-
MicroK8sBootstrapProviderName = "microk8s"
68+
KubeadmBootstrapProviderName = "kubeadm"
69+
TalosBootstrapProviderName = "talos"
70+
MicroK8sBootstrapProviderName = "microk8s"
71+
KubeKeyK3sBootstrapProviderName = "kubekey-k3s"
7172
)
7273

7374
// ControlPlane providers.
7475
const (
75-
KubeadmControlPlaneProviderName = "kubeadm"
76-
TalosControlPlaneProviderName = "talos"
77-
MicroK8sControlPlaneProviderName = "microk8s"
78-
NestedControlPlaneProviderName = "nested"
76+
KubeadmControlPlaneProviderName = "kubeadm"
77+
TalosControlPlaneProviderName = "talos"
78+
MicroK8sControlPlaneProviderName = "microk8s"
79+
NestedControlPlaneProviderName = "nested"
80+
KubeKeyK3sControlPlaneProviderName = "kubekey-k3s"
7981
)
8082

8183
// Other.
@@ -253,6 +255,11 @@ func (p *providersClient) defaults() []Provider {
253255
url: "https://github.com/kubernetes-sigs/cluster-api/releases/latest/bootstrap-components.yaml",
254256
providerType: clusterctlv1.BootstrapProviderType,
255257
},
258+
&provider{
259+
name: KubeKeyK3sBootstrapProviderName,
260+
url: "https://github.com/kubesphere/kubekey/releases/latest/bootstrap-components.yaml",
261+
providerType: clusterctlv1.BootstrapProviderType,
262+
},
256263
&provider{
257264
name: TalosBootstrapProviderName,
258265
url: "https://github.com/siderolabs/cluster-api-bootstrap-provider-talos/releases/latest/bootstrap-components.yaml",
@@ -269,6 +276,11 @@ func (p *providersClient) defaults() []Provider {
269276
url: "https://github.com/kubernetes-sigs/cluster-api/releases/latest/control-plane-components.yaml",
270277
providerType: clusterctlv1.ControlPlaneProviderType,
271278
},
279+
&provider{
280+
name: KubeKeyK3sControlPlaneProviderName,
281+
url: "https://github.com/kubesphere/kubekey/releases/latest/control-plane-components.yaml",
282+
providerType: clusterctlv1.ControlPlaneProviderType,
283+
},
272284
&provider{
273285
name: TalosControlPlaneProviderName,
274286
url: "https://github.com/siderolabs/cluster-api-control-plane-provider-talos/releases/latest/control-plane-components.yaml",

cmd/clusterctl/client/config_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,11 @@ func Test_clusterctlClient_GetProvidersConfig(t *testing.T) {
5757
wantProviders: []string{
5858
config.ClusterAPIProviderName,
5959
config.KubeadmBootstrapProviderName,
60+
config.KubeKeyK3sBootstrapProviderName,
6061
config.MicroK8sBootstrapProviderName,
6162
config.TalosBootstrapProviderName,
6263
config.KubeadmControlPlaneProviderName,
64+
config.KubeKeyK3sControlPlaneProviderName,
6365
config.MicroK8sControlPlaneProviderName,
6466
config.NestedControlPlaneProviderName,
6567
config.TalosControlPlaneProviderName,
@@ -100,9 +102,11 @@ func Test_clusterctlClient_GetProvidersConfig(t *testing.T) {
100102
config.ClusterAPIProviderName,
101103
customProviderConfig.Name(),
102104
config.KubeadmBootstrapProviderName,
105+
config.KubeKeyK3sBootstrapProviderName,
103106
config.MicroK8sBootstrapProviderName,
104107
config.TalosBootstrapProviderName,
105108
config.KubeadmControlPlaneProviderName,
109+
config.KubeKeyK3sControlPlaneProviderName,
106110
config.MicroK8sControlPlaneProviderName,
107111
config.NestedControlPlaneProviderName,
108112
config.TalosControlPlaneProviderName,

cmd/clusterctl/cmd/config_repositories_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,11 @@ var expectedOutputText = `NAME TYPE URL
103103
cluster-api CoreProvider https://github.com/myorg/myforkofclusterapi/releases/latest/ core_components.yaml
104104
another-provider BootstrapProvider ./ bootstrap-components.yaml
105105
kubeadm BootstrapProvider https://github.com/kubernetes-sigs/cluster-api/releases/latest/ bootstrap-components.yaml
106+
kubekey-k3s BootstrapProvider https://github.com/kubesphere/kubekey/releases/latest/ bootstrap-components.yaml
106107
microk8s BootstrapProvider https://github.com/canonical/cluster-api-bootstrap-provider-microk8s/releases/latest/ bootstrap-components.yaml
107108
talos BootstrapProvider https://github.com/siderolabs/cluster-api-bootstrap-provider-talos/releases/latest/ bootstrap-components.yaml
108109
kubeadm ControlPlaneProvider https://github.com/kubernetes-sigs/cluster-api/releases/latest/ control-plane-components.yaml
110+
kubekey-k3s ControlPlaneProvider https://github.com/kubesphere/kubekey/releases/latest/ control-plane-components.yaml
109111
microk8s ControlPlaneProvider https://github.com/canonical/cluster-api-control-plane-provider-microk8s/releases/latest/ control-plane-components.yaml
110112
nested ControlPlaneProvider https://github.com/kubernetes-sigs/cluster-api-provider-nested/releases/latest/ control-plane-components.yaml
111113
talos ControlPlaneProvider https://github.com/siderolabs/cluster-api-control-plane-provider-talos/releases/latest/ control-plane-components.yaml
@@ -148,6 +150,10 @@ var expectedOutputYaml = `- File: core_components.yaml
148150
Name: kubeadm
149151
ProviderType: BootstrapProvider
150152
URL: https://github.com/kubernetes-sigs/cluster-api/releases/latest/
153+
- File: bootstrap-components.yaml
154+
Name: kubekey-k3s
155+
ProviderType: BootstrapProvider
156+
URL: https://github.com/kubesphere/kubekey/releases/latest/
151157
- File: bootstrap-components.yaml
152158
Name: microk8s
153159
ProviderType: BootstrapProvider
@@ -160,6 +166,10 @@ var expectedOutputYaml = `- File: core_components.yaml
160166
Name: kubeadm
161167
ProviderType: ControlPlaneProvider
162168
URL: https://github.com/kubernetes-sigs/cluster-api/releases/latest/
169+
- File: control-plane-components.yaml
170+
Name: kubekey-k3s
171+
ProviderType: ControlPlaneProvider
172+
URL: https://github.com/kubesphere/kubekey/releases/latest/
163173
- File: control-plane-components.yaml
164174
Name: microk8s
165175
ProviderType: ControlPlaneProvider

docs/book/src/clusterctl/provider-contract.md

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -236,35 +236,37 @@ easier transition from `kubectl apply` to `clusterctl`.
236236
As a reference you can consider the labels applied to the following
237237
providers.
238238

239-
| Provider Name| Label |
240-
|--------------|-------------------------------------------------------|
241-
|CAPI | cluster.x-k8s.io/provider=cluster-api |
242-
|CABPK | cluster.x-k8s.io/provider=bootstrap-kubeadm |
243-
|CABPM | cluster.x-k8s.io/provider=bootstrap-microk8s |
244-
|CACPK | cluster.x-k8s.io/provider=control-plane-kubeadm |
245-
|CACPM | cluster.x-k8s.io/provider=control-plane-microk8s |
246-
|CACPN | cluster.x-k8s.io/provider=control-plane-nested |
247-
|CAPA | cluster.x-k8s.io/provider=infrastructure-aws |
248-
|CAPB | cluster.x-k8s.io/provider=infrastructure-byoh |
249-
|CAPC | cluster.x-k8s.io/provider=infrastructure-cloudstack |
250-
|CAPD | cluster.x-k8s.io/provider=infrastructure-docker |
251-
|CAPDO | cluster.x-k8s.io/provider=infrastructure-digitalocean |
252-
|CAPG | cluster.x-k8s.io/provider=infrastructure-gcp |
253-
|CAPH | cluster.x-k8s.io/provider=infrastructure-hetzner |
254-
|CAPIBM | cluster.x-k8s.io/provider=infrastructure-ibmcloud |
255-
|CAPKK | cluster.x-k8s.io/provider=infrastructure-kubekey |
256-
|CAPK | cluster.x-k8s.io/provider=infrastructure-kubevirt |
257-
|CAPM3 | cluster.x-k8s.io/provider=infrastructure-metal3 |
258-
|CAPN | cluster.x-k8s.io/provider=infrastructure-nested |
259-
|CAPO | cluster.x-k8s.io/provider=infrastructure-openstack |
260-
|CAPOCI | cluster.x-k8s.io/provider=infrastructure-oci |
261-
|CAPP | cluster.x-k8s.io/provider=infrastructure-packet |
262-
|CAPV | cluster.x-k8s.io/provider=infrastructure-vsphere |
263-
|CAPVC | cluster.x-k8s.io/provider=infrastructure-vcluster |
264-
|CAPVCD | cluster.x-k8s.io/provider=infrastructure-vcd |
265-
|CAPX | cluster.x-k8s.io/provider=infrastructure-nutanix |
266-
|CAPZ | cluster.x-k8s.io/provider=infrastructure-azure |
267-
|CAPOSC | cluster.x-k8s.io/provider=infrastructure-outscale |
239+
| Provider Name | Label |
240+
|---------------|-------------------------------------------------------|
241+
| CAPI | cluster.x-k8s.io/provider=cluster-api |
242+
| CABPK | cluster.x-k8s.io/provider=bootstrap-kubeadm |
243+
| CABPM | cluster.x-k8s.io/provider=bootstrap-microk8s |
244+
| CABPKK3S | cluster.x-k8s.io/provider=bootstrap-kubekey-k3s |
245+
| CACPK | cluster.x-k8s.io/provider=control-plane-kubeadm |
246+
| CACPM | cluster.x-k8s.io/provider=control-plane-microk8s |
247+
| CACPN | cluster.x-k8s.io/provider=control-plane-nested |
248+
| CACPKK3S | cluster.x-k8s.io/provider=control-plane-kubekey-k3s |
249+
| CAPA | cluster.x-k8s.io/provider=infrastructure-aws |
250+
| CAPB | cluster.x-k8s.io/provider=infrastructure-byoh |
251+
| CAPC | cluster.x-k8s.io/provider=infrastructure-cloudstack |
252+
| CAPD | cluster.x-k8s.io/provider=infrastructure-docker |
253+
| CAPDO | cluster.x-k8s.io/provider=infrastructure-digitalocean |
254+
| CAPG | cluster.x-k8s.io/provider=infrastructure-gcp |
255+
| CAPH | cluster.x-k8s.io/provider=infrastructure-hetzner |
256+
| CAPIBM | cluster.x-k8s.io/provider=infrastructure-ibmcloud |
257+
| CAPKK | cluster.x-k8s.io/provider=infrastructure-kubekey |
258+
| CAPK | cluster.x-k8s.io/provider=infrastructure-kubevirt |
259+
| CAPM3 | cluster.x-k8s.io/provider=infrastructure-metal3 |
260+
| CAPN | cluster.x-k8s.io/provider=infrastructure-nested |
261+
| CAPO | cluster.x-k8s.io/provider=infrastructure-openstack |
262+
| CAPOCI | cluster.x-k8s.io/provider=infrastructure-oci |
263+
| CAPP | cluster.x-k8s.io/provider=infrastructure-packet |
264+
| CAPV | cluster.x-k8s.io/provider=infrastructure-vsphere |
265+
| CAPVC | cluster.x-k8s.io/provider=infrastructure-vcluster |
266+
| CAPVCD | cluster.x-k8s.io/provider=infrastructure-vcd |
267+
| CAPX | cluster.x-k8s.io/provider=infrastructure-nutanix |
268+
| CAPZ | cluster.x-k8s.io/provider=infrastructure-azure |
269+
| CAPOSC | cluster.x-k8s.io/provider=infrastructure-outscale |
268270
### Workload cluster templates
269271

270272
An infrastructure provider could publish a **cluster templates** file to be used by `clusterctl generate cluster`.

0 commit comments

Comments
 (0)