Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨add kubekey k3s boostrap and control plane provider #7528

Merged
merged 2 commits into from
Nov 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 19 additions & 7 deletions cmd/clusterctl/client/config/providers_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,19 @@ const (

// Bootstrap providers.
const (
KubeadmBootstrapProviderName = "kubeadm"
TalosBootstrapProviderName = "talos"
MicroK8sBootstrapProviderName = "microk8s"
KubeadmBootstrapProviderName = "kubeadm"
TalosBootstrapProviderName = "talos"
MicroK8sBootstrapProviderName = "microk8s"
KubeKeyK3sBootstrapProviderName = "kubekey-k3s"
)

// ControlPlane providers.
const (
KubeadmControlPlaneProviderName = "kubeadm"
TalosControlPlaneProviderName = "talos"
MicroK8sControlPlaneProviderName = "microk8s"
NestedControlPlaneProviderName = "nested"
KubeadmControlPlaneProviderName = "kubeadm"
TalosControlPlaneProviderName = "talos"
MicroK8sControlPlaneProviderName = "microk8s"
NestedControlPlaneProviderName = "nested"
KubeKeyK3sControlPlaneProviderName = "kubekey-k3s"
)

// Other.
Expand Down Expand Up @@ -253,6 +255,11 @@ func (p *providersClient) defaults() []Provider {
url: "https://github.com/kubernetes-sigs/cluster-api/releases/latest/bootstrap-components.yaml",
providerType: clusterctlv1.BootstrapProviderType,
},
&provider{
name: KubeKeyK3sBootstrapProviderName,
url: "https://github.com/kubesphere/kubekey/releases/latest/bootstrap-components.yaml",
providerType: clusterctlv1.BootstrapProviderType,
},
&provider{
name: TalosBootstrapProviderName,
url: "https://github.com/siderolabs/cluster-api-bootstrap-provider-talos/releases/latest/bootstrap-components.yaml",
Expand All @@ -269,6 +276,11 @@ func (p *providersClient) defaults() []Provider {
url: "https://github.com/kubernetes-sigs/cluster-api/releases/latest/control-plane-components.yaml",
providerType: clusterctlv1.ControlPlaneProviderType,
},
&provider{
name: KubeKeyK3sControlPlaneProviderName,
url: "https://github.com/kubesphere/kubekey/releases/latest/control-plane-components.yaml",
providerType: clusterctlv1.ControlPlaneProviderType,
},
&provider{
name: TalosControlPlaneProviderName,
url: "https://github.com/siderolabs/cluster-api-control-plane-provider-talos/releases/latest/control-plane-components.yaml",
Expand Down
4 changes: 4 additions & 0 deletions cmd/clusterctl/client/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,11 @@ func Test_clusterctlClient_GetProvidersConfig(t *testing.T) {
wantProviders: []string{
config.ClusterAPIProviderName,
config.KubeadmBootstrapProviderName,
config.KubeKeyK3sBootstrapProviderName,
config.MicroK8sBootstrapProviderName,
config.TalosBootstrapProviderName,
config.KubeadmControlPlaneProviderName,
config.KubeKeyK3sControlPlaneProviderName,
config.MicroK8sControlPlaneProviderName,
config.NestedControlPlaneProviderName,
config.TalosControlPlaneProviderName,
Expand Down Expand Up @@ -100,9 +102,11 @@ func Test_clusterctlClient_GetProvidersConfig(t *testing.T) {
config.ClusterAPIProviderName,
customProviderConfig.Name(),
config.KubeadmBootstrapProviderName,
config.KubeKeyK3sBootstrapProviderName,
config.MicroK8sBootstrapProviderName,
config.TalosBootstrapProviderName,
config.KubeadmControlPlaneProviderName,
config.KubeKeyK3sControlPlaneProviderName,
config.MicroK8sControlPlaneProviderName,
config.NestedControlPlaneProviderName,
config.TalosControlPlaneProviderName,
Expand Down
10 changes: 10 additions & 0 deletions cmd/clusterctl/cmd/config_repositories_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,11 @@ var expectedOutputText = `NAME TYPE URL
cluster-api CoreProvider https://github.com/myorg/myforkofclusterapi/releases/latest/ core_components.yaml
another-provider BootstrapProvider ./ bootstrap-components.yaml
kubeadm BootstrapProvider https://github.com/kubernetes-sigs/cluster-api/releases/latest/ bootstrap-components.yaml
kubekey-k3s BootstrapProvider https://github.com/kubesphere/kubekey/releases/latest/ bootstrap-components.yaml
microk8s BootstrapProvider https://github.com/canonical/cluster-api-bootstrap-provider-microk8s/releases/latest/ bootstrap-components.yaml
talos BootstrapProvider https://github.com/siderolabs/cluster-api-bootstrap-provider-talos/releases/latest/ bootstrap-components.yaml
kubeadm ControlPlaneProvider https://github.com/kubernetes-sigs/cluster-api/releases/latest/ control-plane-components.yaml
kubekey-k3s ControlPlaneProvider https://github.com/kubesphere/kubekey/releases/latest/ control-plane-components.yaml
microk8s ControlPlaneProvider https://github.com/canonical/cluster-api-control-plane-provider-microk8s/releases/latest/ control-plane-components.yaml
nested ControlPlaneProvider https://github.com/kubernetes-sigs/cluster-api-provider-nested/releases/latest/ control-plane-components.yaml
talos ControlPlaneProvider https://github.com/siderolabs/cluster-api-control-plane-provider-talos/releases/latest/ control-plane-components.yaml
Expand Down Expand Up @@ -148,6 +150,10 @@ var expectedOutputYaml = `- File: core_components.yaml
Name: kubeadm
ProviderType: BootstrapProvider
URL: https://github.com/kubernetes-sigs/cluster-api/releases/latest/
- File: bootstrap-components.yaml
Name: kubekey-k3s
ProviderType: BootstrapProvider
URL: https://github.com/kubesphere/kubekey/releases/latest/
- File: bootstrap-components.yaml
Name: microk8s
ProviderType: BootstrapProvider
Expand All @@ -160,6 +166,10 @@ var expectedOutputYaml = `- File: core_components.yaml
Name: kubeadm
ProviderType: ControlPlaneProvider
URL: https://github.com/kubernetes-sigs/cluster-api/releases/latest/
- File: control-plane-components.yaml
Name: kubekey-k3s
ProviderType: ControlPlaneProvider
URL: https://github.com/kubesphere/kubekey/releases/latest/
- File: control-plane-components.yaml
Name: microk8s
ProviderType: ControlPlaneProvider
Expand Down
60 changes: 31 additions & 29 deletions docs/book/src/clusterctl/provider-contract.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,35 +236,37 @@ easier transition from `kubectl apply` to `clusterctl`.
As a reference you can consider the labels applied to the following
providers.

| Provider Name| Label |
|--------------|-------------------------------------------------------|
|CAPI | cluster.x-k8s.io/provider=cluster-api |
|CABPK | cluster.x-k8s.io/provider=bootstrap-kubeadm |
|CABPM | cluster.x-k8s.io/provider=bootstrap-microk8s |
|CACPK | cluster.x-k8s.io/provider=control-plane-kubeadm |
|CACPM | cluster.x-k8s.io/provider=control-plane-microk8s |
|CACPN | cluster.x-k8s.io/provider=control-plane-nested |
|CAPA | cluster.x-k8s.io/provider=infrastructure-aws |
|CAPB | cluster.x-k8s.io/provider=infrastructure-byoh |
|CAPC | cluster.x-k8s.io/provider=infrastructure-cloudstack |
|CAPD | cluster.x-k8s.io/provider=infrastructure-docker |
|CAPDO | cluster.x-k8s.io/provider=infrastructure-digitalocean |
|CAPG | cluster.x-k8s.io/provider=infrastructure-gcp |
|CAPH | cluster.x-k8s.io/provider=infrastructure-hetzner |
|CAPIBM | cluster.x-k8s.io/provider=infrastructure-ibmcloud |
|CAPKK | cluster.x-k8s.io/provider=infrastructure-kubekey |
|CAPK | cluster.x-k8s.io/provider=infrastructure-kubevirt |
|CAPM3 | cluster.x-k8s.io/provider=infrastructure-metal3 |
|CAPN | cluster.x-k8s.io/provider=infrastructure-nested |
|CAPO | cluster.x-k8s.io/provider=infrastructure-openstack |
|CAPOCI | cluster.x-k8s.io/provider=infrastructure-oci |
|CAPP | cluster.x-k8s.io/provider=infrastructure-packet |
|CAPV | cluster.x-k8s.io/provider=infrastructure-vsphere |
|CAPVC | cluster.x-k8s.io/provider=infrastructure-vcluster |
|CAPVCD | cluster.x-k8s.io/provider=infrastructure-vcd |
|CAPX | cluster.x-k8s.io/provider=infrastructure-nutanix |
|CAPZ | cluster.x-k8s.io/provider=infrastructure-azure |
|CAPOSC | cluster.x-k8s.io/provider=infrastructure-outscale |
| Provider Name | Label |
|---------------|-------------------------------------------------------|
| CAPI | cluster.x-k8s.io/provider=cluster-api |
| CABPK | cluster.x-k8s.io/provider=bootstrap-kubeadm |
| CABPM | cluster.x-k8s.io/provider=bootstrap-microk8s |
| CABPKK3S | cluster.x-k8s.io/provider=bootstrap-kubekey-k3s |
sbueringer marked this conversation as resolved.
Show resolved Hide resolved
| CACPK | cluster.x-k8s.io/provider=control-plane-kubeadm |
| CACPM | cluster.x-k8s.io/provider=control-plane-microk8s |
| CACPN | cluster.x-k8s.io/provider=control-plane-nested |
| CACPKK3S | cluster.x-k8s.io/provider=control-plane-kubekey-k3s |
| CAPA | cluster.x-k8s.io/provider=infrastructure-aws |
| CAPB | cluster.x-k8s.io/provider=infrastructure-byoh |
| CAPC | cluster.x-k8s.io/provider=infrastructure-cloudstack |
| CAPD | cluster.x-k8s.io/provider=infrastructure-docker |
| CAPDO | cluster.x-k8s.io/provider=infrastructure-digitalocean |
| CAPG | cluster.x-k8s.io/provider=infrastructure-gcp |
| CAPH | cluster.x-k8s.io/provider=infrastructure-hetzner |
| CAPIBM | cluster.x-k8s.io/provider=infrastructure-ibmcloud |
| CAPKK | cluster.x-k8s.io/provider=infrastructure-kubekey |
| CAPK | cluster.x-k8s.io/provider=infrastructure-kubevirt |
| CAPM3 | cluster.x-k8s.io/provider=infrastructure-metal3 |
| CAPN | cluster.x-k8s.io/provider=infrastructure-nested |
| CAPO | cluster.x-k8s.io/provider=infrastructure-openstack |
| CAPOCI | cluster.x-k8s.io/provider=infrastructure-oci |
| CAPP | cluster.x-k8s.io/provider=infrastructure-packet |
| CAPV | cluster.x-k8s.io/provider=infrastructure-vsphere |
| CAPVC | cluster.x-k8s.io/provider=infrastructure-vcluster |
| CAPVCD | cluster.x-k8s.io/provider=infrastructure-vcd |
| CAPX | cluster.x-k8s.io/provider=infrastructure-nutanix |
| CAPZ | cluster.x-k8s.io/provider=infrastructure-azure |
| CAPOSC | cluster.x-k8s.io/provider=infrastructure-outscale |
### Workload cluster templates

An infrastructure provider could publish a **cluster templates** file to be used by `clusterctl generate cluster`.
Expand Down
5 changes: 3 additions & 2 deletions docs/book/src/user/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -441,8 +441,6 @@ clusterctl init --infrastructure ibmcloud
clusterctl init --infrastructure kubekey
```

{{#/tab }}

{{#/tab }}
{{#tab Kubevirt}}

Expand Down Expand Up @@ -819,6 +817,8 @@ export INSTANCES=<your-linux-ip-address>
export CONTROL_PLANE_ENDPOINT_IP=<your-control-plane-virtual-ip>
```

Please visit the [KubeKey provider] for more information.

{{#/tab }}
{{#tab Kubevirt}}

Expand Down Expand Up @@ -1243,6 +1243,7 @@ See the [clusterctl] documentation for more detail about clusterctl supported ac
[management cluster]: ../reference/glossary.md#management-cluster
[Metal3 getting started guide]: https://github.com/metal3-io/cluster-api-provider-metal3/blob/master/docs/getting-started.md
[Metal3 provider]: https://github.com/metal3-io/cluster-api-provider-metal3/
[KubeKey provider]: https://github.com/kubesphere/kubekey
[Kubevirt provider]: https://github.com/kubernetes-sigs/cluster-api-provider-kubevirt/
[oci-provider]: https://oracle.github.io/cluster-api-provider-oci/#getting-started
[Equinix Metal getting started guide]: https://github.com/kubernetes-sigs/cluster-api-provider-packet#using
Expand Down