Skip to content

Commit

Permalink
🌱 Add Infrastructure provider Harvester (#11477)
Browse files Browse the repository at this point in the history
* Added Infrastructure Provider Harvester

Signed-off-by: Mohamed Belgaied Hassine <[email protected]>

* Adding org to provider name

Signed-off-by: Mohamed Belgaied Hassine <[email protected]>

* Update cmd/clusterctl/client/config/providers_client.go

Co-authored-by: Fabrizio Pandini <[email protected]>

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

Co-authored-by: Christian Schlotter <[email protected]>

* fix some linting with a comment

Signed-off-by: Mohamed Belgaied Hassine <[email protected]>

---------

Signed-off-by: Mohamed Belgaied Hassine <[email protected]>
Co-authored-by: Fabrizio Pandini <[email protected]>
Co-authored-by: Christian Schlotter <[email protected]>
  • Loading branch information
3 people authored Jan 8, 2025
1 parent fce7a86 commit 12cd150
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 9 deletions.
21 changes: 14 additions & 7 deletions cmd/clusterctl/client/config/providers_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,15 @@ const (

// Infra providers.
const (
AWSProviderName = "aws"
AzureProviderName = "azure"
BYOHProviderName = "byoh"
CloudStackProviderName = "cloudstack"
DockerProviderName = "docker"
DOProviderName = "digitalocean"
GCPProviderName = "gcp"
AWSProviderName = "aws"
AzureProviderName = "azure"
BYOHProviderName = "byoh"
CloudStackProviderName = "cloudstack"
DockerProviderName = "docker"
DOProviderName = "digitalocean"
GCPProviderName = "gcp"
// Note: harvester is currently on rancher-sandbox, but the plan is to move it on the harvester GitHub org (also owned by Rancher).
HarvesterProviderName = "harvester-harvester"
HetznerProviderName = "hetzner"
HivelocityProviderName = "hivelocity-hivelocity"
OutscaleProviderName = "outscale"
Expand Down Expand Up @@ -257,6 +259,11 @@ func (p *providersClient) defaults() []Provider {
url: "https://github.com/vmware-tanzu/cluster-api-provider-bringyourownhost/releases/latest/infrastructure-components.yaml",
providerType: clusterctlv1.InfrastructureProviderType,
},
&provider{
name: HarvesterProviderName,
url: "https://github.com/rancher-sandbox/cluster-api-provider-harvester/releases/latest/infrastructure-components.yaml",
providerType: clusterctlv1.InfrastructureProviderType,
},
&provider{
name: HetznerProviderName,
url: "https://github.com/syself/cluster-api-provider-hetzner/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 @@ -83,6 +83,7 @@ func Test_clusterctlClient_GetProvidersConfig(t *testing.T) {
config.DOProviderName,
config.DockerProviderName,
config.GCPProviderName,
config.HarvesterProviderName,
config.HetznerProviderName,
config.HivelocityProviderName,
config.IBMCloudProviderName,
Expand Down Expand Up @@ -150,6 +151,7 @@ func Test_clusterctlClient_GetProvidersConfig(t *testing.T) {
config.DOProviderName,
config.DockerProviderName,
config.GCPProviderName,
config.HarvesterProviderName,
config.HetznerProviderName,
config.HivelocityProviderName,
config.IBMCloudProviderName,
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 @@ -130,6 +130,7 @@ coxedge InfrastructureProvider https://github.com/coxedge/cl
digitalocean InfrastructureProvider https://github.com/kubernetes-sigs/cluster-api-provider-digitalocean/releases/latest/ infrastructure-components.yaml
docker InfrastructureProvider https://github.com/kubernetes-sigs/cluster-api/releases/latest/ infrastructure-components-development.yaml
gcp InfrastructureProvider https://github.com/kubernetes-sigs/cluster-api-provider-gcp/releases/latest/ infrastructure-components.yaml
harvester-harvester InfrastructureProvider https://github.com/rancher-sandbox/cluster-api-provider-harvester/releases/latest/ infrastructure-components.yaml
hetzner InfrastructureProvider https://github.com/syself/cluster-api-provider-hetzner/releases/latest/ infrastructure-components.yaml
hivelocity-hivelocity InfrastructureProvider https://github.com/hivelocity/cluster-api-provider-hivelocity/releases/latest/ infrastructure-components.yaml
ibmcloud InfrastructureProvider https://github.com/kubernetes-sigs/cluster-api-provider-ibmcloud/releases/latest/ infrastructure-components.yaml
Expand Down Expand Up @@ -274,6 +275,10 @@ var expectedOutputYaml = `- File: core_components.yaml
Name: gcp
ProviderType: InfrastructureProvider
URL: https://github.com/kubernetes-sigs/cluster-api-provider-gcp/releases/latest/
- File: infrastructure-components.yaml
Name: harvester-harvester
ProviderType: InfrastructureProvider
URL: https://github.com/rancher-sandbox/cluster-api-provider-harvester/releases/latest/
- File: infrastructure-components.yaml
Name: hetzner
ProviderType: InfrastructureProvider
Expand Down
53 changes: 51 additions & 2 deletions docs/book/src/user/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,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:"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"}}
{{#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"}}
{{#tab Akamai (Linode)}}
```bash
Expand Down Expand Up @@ -574,6 +574,14 @@ export GCP_B64ENCODED_CREDENTIALS=$( cat /path/to/gcp-credentials.json | base64
clusterctl init --infrastructure gcp
```
{{#/tab }}
{{#tab Harvester}}
```bash
clusterctl init --infrastructure harvester-harvester
```
For more information, please visit the [Harvester project][Harvester provider].
{{#/tab }}
{{#tab Hetzner}}
Expand Down Expand Up @@ -871,7 +879,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:"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"}}
{{#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"}}
{{#tab Akamai (Linode)}}
```bash
Expand Down Expand Up @@ -1050,6 +1058,46 @@ export CLUSTER_NAME="<CLUSTER_NAME>"
See the [GCP provider] for more information.
{{#/tab }}
{{#tab Harvester}}
```bash
# 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
# Since v0.1.5, this can be left "", because the controller can update it automatically
export CLOUD_CONFIG_KUBECONFIG_B64=""
# Name of the CAPI Cluster
export CLUSTER_NAME="<CLUSTER_NAME>"
# Number of Control Plane machines
export CONTROL_PLANE_MACHINE_COUNT=3
# URL to access the Harvester Cluster, this will be overriden by the controller
export HARVESTER_ENDPOINT=""
# Base64-Encoded Kubeconfig to access Harvester, which can be downloaded from Harvester's UI or from a Harvester Manager Node.
export HARVESTER_KUBECONFIG_B64="<HARVESTER_KUBECONFIG_ENCODED_IN_BASE64>"
# Namespace for all resources in the Management Cluster
export NAMESPACE="test"
# Pod CIDR for the Workload Cluster, it should have the format: 192.168.0.0/16
export POD_CIDR="10.42.0.0/16"
# Service CIDR for the Workload Cluster, it should have the format : 192.168.0.0/16 and be different from POD_CIDR
export SERVICE_CIDR="10.43.0.0/16"
# Reference to SSH Keypair in Harvester. It should follow the format <NAMESPACE>/<NAME>
export SSH_KEYPAIR="default/ssk-key-pair"
# Namespace in Harvester where the VMs will be created.
export TARGET_HARVESTER_NAMESPACE="default"
# Disk Size to be used by the VMs
export VM_DISK_SIZE="50Gi"
# Reference to OS Image in Harvester which will be used for creating VMs, It must follow the format <NAMESPACE>/<NAME>
export VM_IMAGE_NAME="default/jammy-server"
# Reference to VM Network in Harvester. It must follow the format <NAMESPACE>/<NAME>
export VM_NETWORK="default/untagged"
# Linux Username for the VMs
export VM_SSH_USER="ubuntu"
# Number of Worker nodes in the target Workload cluster
export WORKER_MACHINE_COUNT=2
```
See the [Harvester provider] for more information.
{{#/tab }}
{{#tab IBM Cloud}}
Expand Down Expand Up @@ -1817,6 +1865,7 @@ kind delete cluster
[Docker]: https://www.docker.com/
[GCP provider]: https://cluster-api-gcp.sigs.k8s.io/
[Helm]: https://helm.sh/docs/intro/install/
[Harvester provider]: https://github.com/rancher-sandbox/cluster-api-provider-harvester
[Hetzner provider]: https://github.com/syself/cluster-api-provider-hetzner
[Hivelocity provider]: https://github.com/hivelocity/cluster-api-provider-hivelocity
[IBM Cloud provider]: https://github.com/kubernetes-sigs/cluster-api-provider-ibmcloud
Expand Down

0 comments on commit 12cd150

Please sign in to comment.