Skip to content

Commit

Permalink
add kubekey provider
Browse files Browse the repository at this point in the history
Signed-off-by: 24sama <jacksama@foxmail.com>
  • Loading branch information
24sama committed Nov 15, 2022
1 parent 0b6f4f1 commit 0756863
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 28 deletions.
6 changes: 6 additions & 0 deletions cmd/clusterctl/client/config/providers_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ const (
VSphereProviderName = "vsphere"
MAASProviderName = "maas"
KubevirtProviderName = "kubevirt"
KubeKeyProviderName = "kubekey"
VclusterProviderName = "vcluster"
VirtinkProviderName = "virtink"
)
Expand Down Expand Up @@ -223,6 +224,11 @@ func (p *providersClient) defaults() []Provider {
url: "https://github.com/nutanix-cloud-native/cluster-api-provider-nutanix/releases/latest/infrastructure-components.yaml",
providerType: clusterctlv1.InfrastructureProviderType,
},
&provider{
name: KubeKeyProviderName,
url: "https://github.com/kubesphere/kubekey/releases/latest/infrastructure-components.yaml",
providerType: clusterctlv1.InfrastructureProviderType,
},
&provider{
name: KubevirtProviderName,
url: "https://github.com/kubernetes-sigs/cluster-api-provider-kubevirt/releases/latest/infrastructure-components.yaml",
Expand Down
2 changes: 2 additions & 0 deletions cmd/clusterctl/client/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ func Test_clusterctlClient_GetProvidersConfig(t *testing.T) {
config.GCPProviderName,
config.HetznerProviderName,
config.IBMCloudProviderName,
config.KubeKeyProviderName,
config.KubevirtProviderName,
config.MAASProviderName,
config.Metal3ProviderName,
Expand Down Expand Up @@ -110,6 +111,7 @@ func Test_clusterctlClient_GetProvidersConfig(t *testing.T) {
config.GCPProviderName,
config.HetznerProviderName,
config.IBMCloudProviderName,
config.KubeKeyProviderName,
config.KubevirtProviderName,
config.MAASProviderName,
config.Metal3ProviderName,
Expand Down
5 changes: 5 additions & 0 deletions cmd/clusterctl/cmd/config_repositories_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ docker InfrastructureProvider https://github.com/kubernetes-sigs/
gcp InfrastructureProvider https://github.com/kubernetes-sigs/cluster-api-provider-gcp/releases/latest/ infrastructure-components.yaml
hetzner InfrastructureProvider https://github.com/syself/cluster-api-provider-hetzner/releases/latest/ infrastructure-components.yaml
ibmcloud InfrastructureProvider https://github.com/kubernetes-sigs/cluster-api-provider-ibmcloud/releases/latest/ infrastructure-components.yaml
kubekey InfrastructureProvider https://github.com/kubesphere/kubekey/releases/latest/ infrastructure-components.yaml
kubevirt InfrastructureProvider https://github.com/kubernetes-sigs/cluster-api-provider-kubevirt/releases/latest/ infrastructure-components.yaml
maas InfrastructureProvider https://github.com/spectrocloud/cluster-api-provider-maas/releases/latest/ infrastructure-components.yaml
metal3 InfrastructureProvider https://github.com/metal3-io/cluster-api-provider-metal3/releases/latest/ infrastructure-components.yaml
Expand Down Expand Up @@ -197,6 +198,10 @@ var expectedOutputYaml = `- File: core_components.yaml
Name: ibmcloud
ProviderType: InfrastructureProvider
URL: https://github.com/kubernetes-sigs/cluster-api-provider-ibmcloud/releases/latest/
- File: infrastructure-components.yaml
Name: kubekey
ProviderType: InfrastructureProvider
URL: https://github.com/kubesphere/kubekey/releases/latest/
- File: infrastructure-components.yaml
Name: kubevirt
ProviderType: InfrastructureProvider
Expand Down
53 changes: 27 additions & 26 deletions docs/book/src/clusterctl/provider-contract.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,32 +232,33 @@ 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 |
|CACPK | cluster.x-k8s.io/provider=control-plane-kubeadm |
|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 |
|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 |
|CACPK | cluster.x-k8s.io/provider=control-plane-kubeadm |
|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 |
### Workload cluster templates

An infrastructure provider could publish a **cluster templates** file to be used by `clusterctl generate cluster`.
Expand Down
3 changes: 3 additions & 0 deletions docs/book/src/reference/glossary.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ Cluster API Provider Nested
### CAPX
Cluster API Provider Nutanix

### CAPKK
Cluster API Provider KubeKey

### CAPK
Cluster API Provider Kubevirt

Expand Down
1 change: 1 addition & 0 deletions docs/book/src/reference/providers.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ updated info about which API version they are supporting.
- [Hetzner](https://github.com/syself/cluster-api-provider-hetzner)
- [Outscale](https://github.com/outscale-dev/cluster-api-provider-outscale)
- [IBM Cloud](https://github.com/kubernetes-sigs/cluster-api-provider-ibmcloud)
- [KubeKey](https://github.com/kubesphere/kubekey)
- [KubeVirt](https://github.com/kubernetes-sigs/cluster-api-provider-kubevirt)
- [MAAS](https://github.com/spectrocloud/cluster-api-provider-maas)
- [Metal3](https://github.com/metal3-io/cluster-api-provider-metal3)
Expand Down
27 changes: 25 additions & 2 deletions docs/book/src/user/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ Additional documentation about experimental features can be found in [Experiment
Depending on the infrastructure provider you are planning to use, some additional prerequisites should be satisfied
before getting started with Cluster API. See below for the expected settings for common providers.
{{#tabs name:"tab-installation-infrastructure" tabs:"AWS,Azure,CloudStack,DigitalOcean,Docker,Equinix Metal,GCP,Hetzner,IBM Cloud,Kubevirt,Metal3,Nutanix,OCI,OpenStack,Outscale,VCD,vcluster,Virtink,vSphere"}}
{{#tabs name:"tab-installation-infrastructure" tabs:"AWS,Azure,CloudStack,DigitalOcean,Docker,Equinix Metal,GCP,Hetzner,IBM Cloud,KubeKey,Kubevirt,Metal3,Nutanix,OCI,OpenStack,Outscale,VCD,vcluster,Virtink,vSphere"}}
{{#tab AWS}}
Download the latest binary of `clusterawsadm` from the [AWS provider releases].
Expand Down Expand Up @@ -437,6 +437,13 @@ export IBMCLOUD_API_KEY=<you_api_key>
clusterctl init --infrastructure ibmcloud
```
{{#/tab }}
{{#tab KubeKey}}
```bash
# Initialize the management cluster
clusterctl init --infrastructure kubekey
```
{{#/tab }}
{{#tab Kubevirt}}
Expand Down Expand Up @@ -597,7 +604,7 @@ before configuring a cluster with Cluster API. Instructions are provided for com
Otherwise, you can look at the `clusterctl generate cluster` [command][clusterctl generate cluster] documentation for details about how to
discover the list of variables required by a cluster templates.
{{#tabs name:"tab-configuration-infrastructure" tabs:"AWS,Azure,CloudStack,DigitalOcean,Docker,Equinix Metal,GCP,IBM Cloud,Kubevirt,Metal3,Nutanix,OpenStack,Outscale,VCD,vcluster,Virtink,vSphere"}}
{{#tabs name:"tab-configuration-infrastructure" tabs:"AWS,Azure,CloudStack,DigitalOcean,Docker,Equinix Metal,GCP,IBM Cloud,KubeKey,Kubevirt,Metal3,Nutanix,OpenStack,Outscale,VCD,vcluster,Virtink,vSphere"}}
{{#tab AWS}}
```bash
Expand Down Expand Up @@ -796,6 +803,22 @@ export IBMPOWERVS_NETWORK_NAME=<your-capi-network-name>
Please visit the [IBM Cloud provider] for more information.
{{#/tab }}
{{#tab KubeKey}}
```bash
# Required environment variables
# The KKZONE is used to specify where to download the binaries. (e.g. "", "cn")
export KKZONE=""
# The ssh name of the all instance Linux user. (e.g. root, ubuntu)
export USER_NAME=<your-linux-user>
# The ssh password of the all instance Linux user.
export PASSWORD=<your-linux-user-password>
# The ssh IP address of the all instance. (e.g. "[{address: 192.168.100.3}, {address: 192.168.100.4}]")
export INSTANCES=<your-linux-ip-address>
# The cluster control plane VIP. (e.g. "192.168.100.100")
export CONTROL_PLANE_ENDPOINT_IP=<your-control-plane-virtual-ip>
```
{{#/tab }}
{{#tab Kubevirt}}
Expand Down

0 comments on commit 0756863

Please sign in to comment.