Skip to content

Commit fa3ebdc

Browse files
authored
Merge pull request #7528 from 24sama/main
✨add kubekey k3s boostrap and control plane provider
2 parents 566c3c4 + 1b32672 commit fa3ebdc

File tree

5 files changed

+67
-38
lines changed

5 files changed

+67
-38
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
@@ -242,35 +242,37 @@ easier transition from `kubectl apply` to `clusterctl`.
242242
As a reference you can consider the labels applied to the following
243243
providers.
244244

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

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

docs/book/src/user/quick-start.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,8 +441,6 @@ clusterctl init --infrastructure ibmcloud
441441
clusterctl init --infrastructure kubekey
442442
```
443443
444-
{{#/tab }}
445-
446444
{{#/tab }}
447445
{{#tab Kubevirt}}
448446
@@ -819,6 +817,8 @@ export INSTANCES=<your-linux-ip-address>
819817
export CONTROL_PLANE_ENDPOINT_IP=<your-control-plane-virtual-ip>
820818
```
821819
820+
Please visit the [KubeKey provider] for more information.
821+
822822
{{#/tab }}
823823
{{#tab Kubevirt}}
824824
@@ -1243,6 +1243,7 @@ See the [clusterctl] documentation for more detail about clusterctl supported ac
12431243
[management cluster]: ../reference/glossary.md#management-cluster
12441244
[Metal3 getting started guide]: https://github.com/metal3-io/cluster-api-provider-metal3/blob/master/docs/getting-started.md
12451245
[Metal3 provider]: https://github.com/metal3-io/cluster-api-provider-metal3/
1246+
[KubeKey provider]: https://github.com/kubesphere/kubekey
12461247
[Kubevirt provider]: https://github.com/kubernetes-sigs/cluster-api-provider-kubevirt/
12471248
[oci-provider]: https://oracle.github.io/cluster-api-provider-oci/#getting-started
12481249
[Equinix Metal getting started guide]: https://github.com/kubernetes-sigs/cluster-api-provider-packet#using

0 commit comments

Comments
 (0)