Skip to content

Commit 12cd150

Browse files
belgaied2fabriziopandinichrischdi
authored
🌱 Add Infrastructure provider Harvester (#11477)
* Added Infrastructure Provider Harvester Signed-off-by: Mohamed Belgaied Hassine <belgaied2@hotmail.com> * Adding org to provider name Signed-off-by: Mohamed Belgaied Hassine <belgaied2@hotmail.com> * Update cmd/clusterctl/client/config/providers_client.go Co-authored-by: Fabrizio Pandini <fabrizio.pandini@gmail.com> * Update docs/book/src/user/quick-start.md Co-authored-by: Christian Schlotter <chrischdi@users.noreply.github.com> * fix some linting with a comment Signed-off-by: Mohamed Belgaied Hassine <belgaied2@hotmail.com> --------- Signed-off-by: Mohamed Belgaied Hassine <belgaied2@hotmail.com> Co-authored-by: Fabrizio Pandini <fabrizio.pandini@gmail.com> Co-authored-by: Christian Schlotter <chrischdi@users.noreply.github.com>
1 parent fce7a86 commit 12cd150

File tree

4 files changed

+72
-9
lines changed

4 files changed

+72
-9
lines changed

cmd/clusterctl/client/config/providers_client.go

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,15 @@ const (
3737

3838
// Infra providers.
3939
const (
40-
AWSProviderName = "aws"
41-
AzureProviderName = "azure"
42-
BYOHProviderName = "byoh"
43-
CloudStackProviderName = "cloudstack"
44-
DockerProviderName = "docker"
45-
DOProviderName = "digitalocean"
46-
GCPProviderName = "gcp"
40+
AWSProviderName = "aws"
41+
AzureProviderName = "azure"
42+
BYOHProviderName = "byoh"
43+
CloudStackProviderName = "cloudstack"
44+
DockerProviderName = "docker"
45+
DOProviderName = "digitalocean"
46+
GCPProviderName = "gcp"
47+
// Note: harvester is currently on rancher-sandbox, but the plan is to move it on the harvester GitHub org (also owned by Rancher).
48+
HarvesterProviderName = "harvester-harvester"
4749
HetznerProviderName = "hetzner"
4850
HivelocityProviderName = "hivelocity-hivelocity"
4951
OutscaleProviderName = "outscale"
@@ -257,6 +259,11 @@ func (p *providersClient) defaults() []Provider {
257259
url: "https://github.com/vmware-tanzu/cluster-api-provider-bringyourownhost/releases/latest/infrastructure-components.yaml",
258260
providerType: clusterctlv1.InfrastructureProviderType,
259261
},
262+
&provider{
263+
name: HarvesterProviderName,
264+
url: "https://github.com/rancher-sandbox/cluster-api-provider-harvester/releases/latest/infrastructure-components.yaml",
265+
providerType: clusterctlv1.InfrastructureProviderType,
266+
},
260267
&provider{
261268
name: HetznerProviderName,
262269
url: "https://github.com/syself/cluster-api-provider-hetzner/releases/latest/infrastructure-components.yaml",

cmd/clusterctl/client/config_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ func Test_clusterctlClient_GetProvidersConfig(t *testing.T) {
8383
config.DOProviderName,
8484
config.DockerProviderName,
8585
config.GCPProviderName,
86+
config.HarvesterProviderName,
8687
config.HetznerProviderName,
8788
config.HivelocityProviderName,
8889
config.IBMCloudProviderName,
@@ -150,6 +151,7 @@ func Test_clusterctlClient_GetProvidersConfig(t *testing.T) {
150151
config.DOProviderName,
151152
config.DockerProviderName,
152153
config.GCPProviderName,
154+
config.HarvesterProviderName,
153155
config.HetznerProviderName,
154156
config.HivelocityProviderName,
155157
config.IBMCloudProviderName,

cmd/clusterctl/cmd/config_repositories_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ coxedge InfrastructureProvider https://github.com/coxedge/cl
130130
digitalocean InfrastructureProvider https://github.com/kubernetes-sigs/cluster-api-provider-digitalocean/releases/latest/ infrastructure-components.yaml
131131
docker InfrastructureProvider https://github.com/kubernetes-sigs/cluster-api/releases/latest/ infrastructure-components-development.yaml
132132
gcp InfrastructureProvider https://github.com/kubernetes-sigs/cluster-api-provider-gcp/releases/latest/ infrastructure-components.yaml
133+
harvester-harvester InfrastructureProvider https://github.com/rancher-sandbox/cluster-api-provider-harvester/releases/latest/ infrastructure-components.yaml
133134
hetzner InfrastructureProvider https://github.com/syself/cluster-api-provider-hetzner/releases/latest/ infrastructure-components.yaml
134135
hivelocity-hivelocity InfrastructureProvider https://github.com/hivelocity/cluster-api-provider-hivelocity/releases/latest/ infrastructure-components.yaml
135136
ibmcloud InfrastructureProvider https://github.com/kubernetes-sigs/cluster-api-provider-ibmcloud/releases/latest/ infrastructure-components.yaml
@@ -274,6 +275,10 @@ var expectedOutputYaml = `- File: core_components.yaml
274275
Name: gcp
275276
ProviderType: InfrastructureProvider
276277
URL: https://github.com/kubernetes-sigs/cluster-api-provider-gcp/releases/latest/
278+
- File: infrastructure-components.yaml
279+
Name: harvester-harvester
280+
ProviderType: InfrastructureProvider
281+
URL: https://github.com/rancher-sandbox/cluster-api-provider-harvester/releases/latest/
277282
- File: infrastructure-components.yaml
278283
Name: hetzner
279284
ProviderType: InfrastructureProvider

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

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ Additional documentation about experimental features can be found in [Experiment
281281
Depending on the infrastructure provider you are planning to use, some additional prerequisites should be satisfied
282282
before getting started with Cluster API. See below for the expected settings for common providers.
283283
284-
{{#tabs name:"tab-installation-infrastructure" tabs:"Akamai (Linode),AWS,Azure,CloudStack,DigitalOcean,Docker,Equinix Metal,GCP,Hetzner,Hivelocity,IBM Cloud,IONOS Cloud,K0smotron,KubeKey,KubeVirt,Metal3,Nutanix,OCI,OpenStack,Outscale,Proxmox,VCD,vcluster,Virtink,vSphere,Vultr"}}
284+
{{#tabs name:"tab-installation-infrastructure" tabs:"Akamai (Linode),AWS,Azure,CloudStack,DigitalOcean,Docker,Equinix Metal,GCP,Harvester,Hetzner,Hivelocity,IBM Cloud,IONOS Cloud,K0smotron,KubeKey,KubeVirt,Metal3,Nutanix,OCI,OpenStack,Outscale,Proxmox,VCD,vcluster,Virtink,vSphere,Vultr"}}
285285
{{#tab Akamai (Linode)}}
286286
287287
```bash
@@ -574,6 +574,14 @@ export GCP_B64ENCODED_CREDENTIALS=$( cat /path/to/gcp-credentials.json | base64
574574
clusterctl init --infrastructure gcp
575575
```
576576
577+
{{#/tab }}
578+
{{#tab Harvester}}
579+
580+
```bash
581+
clusterctl init --infrastructure harvester-harvester
582+
```
583+
584+
For more information, please visit the [Harvester project][Harvester provider].
577585
{{#/tab }}
578586
{{#tab Hetzner}}
579587
@@ -871,7 +879,7 @@ before configuring a cluster with Cluster API. Instructions are provided for com
871879
Otherwise, you can look at the `clusterctl generate cluster` [command][clusterctl generate cluster] documentation for details about how to
872880
discover the list of variables required by a cluster templates.
873881
874-
{{#tabs name:"tab-configuration-infrastructure" tabs:"Akamai (Linode),AWS,Azure,CloudStack,DigitalOcean,Docker,Equinix Metal,GCP,IBM Cloud,IONOS Cloud,K0smotron,KubeKey,KubeVirt,Metal3,Nutanix,OpenStack,Outscale,Proxmox,Tinkerbell,VCD,vcluster,Virtink,vSphere,Vultr"}}
882+
{{#tabs name:"tab-configuration-infrastructure" tabs:"Akamai (Linode),AWS,Azure,CloudStack,DigitalOcean,Docker,Equinix Metal,GCP,Harvester,IBM Cloud,IONOS Cloud,K0smotron,KubeKey,KubeVirt,Metal3,Nutanix,OpenStack,Outscale,Proxmox,Tinkerbell,VCD,vcluster,Virtink,vSphere,Vultr"}}
875883
{{#tab Akamai (Linode)}}
876884
877885
```bash
@@ -1050,6 +1058,46 @@ export CLUSTER_NAME="<CLUSTER_NAME>"
10501058
10511059
See the [GCP provider] for more information.
10521060
1061+
{{#/tab }}
1062+
{{#tab Harvester}}
1063+
1064+
1065+
```bash
1066+
# Cloud Provider credentials, which are a Kubeconfig generated using this process: https://docs.harvesterhci.io/v1.3/rancher/cloud-provider/#deploying-to-the-rke2-custom-cluster-experimental
1067+
# Since v0.1.5, this can be left "", because the controller can update it automatically
1068+
export CLOUD_CONFIG_KUBECONFIG_B64=""
1069+
# Name of the CAPI Cluster
1070+
export CLUSTER_NAME="<CLUSTER_NAME>"
1071+
# Number of Control Plane machines
1072+
export CONTROL_PLANE_MACHINE_COUNT=3
1073+
# URL to access the Harvester Cluster, this will be overriden by the controller
1074+
export HARVESTER_ENDPOINT=""
1075+
# Base64-Encoded Kubeconfig to access Harvester, which can be downloaded from Harvester's UI or from a Harvester Manager Node.
1076+
export HARVESTER_KUBECONFIG_B64="<HARVESTER_KUBECONFIG_ENCODED_IN_BASE64>"
1077+
# Namespace for all resources in the Management Cluster
1078+
export NAMESPACE="test"
1079+
# Pod CIDR for the Workload Cluster, it should have the format: 192.168.0.0/16
1080+
export POD_CIDR="10.42.0.0/16"
1081+
# Service CIDR for the Workload Cluster, it should have the format : 192.168.0.0/16 and be different from POD_CIDR
1082+
export SERVICE_CIDR="10.43.0.0/16"
1083+
# Reference to SSH Keypair in Harvester. It should follow the format <NAMESPACE>/<NAME>
1084+
export SSH_KEYPAIR="default/ssk-key-pair"
1085+
# Namespace in Harvester where the VMs will be created.
1086+
export TARGET_HARVESTER_NAMESPACE="default"
1087+
# Disk Size to be used by the VMs
1088+
export VM_DISK_SIZE="50Gi"
1089+
# Reference to OS Image in Harvester which will be used for creating VMs, It must follow the format <NAMESPACE>/<NAME>
1090+
export VM_IMAGE_NAME="default/jammy-server"
1091+
# Reference to VM Network in Harvester. It must follow the format <NAMESPACE>/<NAME>
1092+
export VM_NETWORK="default/untagged"
1093+
# Linux Username for the VMs
1094+
export VM_SSH_USER="ubuntu"
1095+
# Number of Worker nodes in the target Workload cluster
1096+
export WORKER_MACHINE_COUNT=2
1097+
```
1098+
1099+
See the [Harvester provider] for more information.
1100+
10531101
{{#/tab }}
10541102
{{#tab IBM Cloud}}
10551103
@@ -1817,6 +1865,7 @@ kind delete cluster
18171865
[Docker]: https://www.docker.com/
18181866
[GCP provider]: https://cluster-api-gcp.sigs.k8s.io/
18191867
[Helm]: https://helm.sh/docs/intro/install/
1868+
[Harvester provider]: https://github.com/rancher-sandbox/cluster-api-provider-harvester
18201869
[Hetzner provider]: https://github.com/syself/cluster-api-provider-hetzner
18211870
[Hivelocity provider]: https://github.com/hivelocity/cluster-api-provider-hivelocity
18221871
[IBM Cloud provider]: https://github.com/kubernetes-sigs/cluster-api-provider-ibmcloud

0 commit comments

Comments
 (0)