From 7825da858081ba7687087e7473571ebc339a79ca Mon Sep 17 00:00:00 2001 From: Mohamed Belgaied Hassine Date: Tue, 26 Nov 2024 00:10:39 +0100 Subject: [PATCH 1/5] Added Infrastructure Provider Harvester Signed-off-by: Mohamed Belgaied Hassine --- .../client/config/providers_client.go | 6 +++ cmd/clusterctl/client/config_test.go | 2 + .../cmd/config_repositories_test.go | 5 ++ docs/book/src/user/quick-start.md | 52 ++++++++++++++++++- 4 files changed, 63 insertions(+), 2 deletions(-) diff --git a/cmd/clusterctl/client/config/providers_client.go b/cmd/clusterctl/client/config/providers_client.go index f3e9ed6ffb08..17140c3e9a42 100644 --- a/cmd/clusterctl/client/config/providers_client.go +++ b/cmd/clusterctl/client/config/providers_client.go @@ -44,6 +44,7 @@ const ( DockerProviderName = "docker" DOProviderName = "digitalocean" GCPProviderName = "gcp" + HarvesterProviderName = "harvester" HetznerProviderName = "hetzner" HivelocityProviderName = "hivelocity-hivelocity" OutscaleProviderName = "outscale" @@ -257,6 +258,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", diff --git a/cmd/clusterctl/client/config_test.go b/cmd/clusterctl/client/config_test.go index 6497a1c8443c..ab0f9140e10d 100644 --- a/cmd/clusterctl/client/config_test.go +++ b/cmd/clusterctl/client/config_test.go @@ -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, @@ -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, diff --git a/cmd/clusterctl/cmd/config_repositories_test.go b/cmd/clusterctl/cmd/config_repositories_test.go index 8b107980188c..a0a77b91e561 100644 --- a/cmd/clusterctl/cmd/config_repositories_test.go +++ b/cmd/clusterctl/cmd/config_repositories_test.go @@ -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 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 @@ -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 + ProviderType: InfrastructureProvider + URL: https://github.com/rancher-sandbox/cluster-api-provider-harvester/releases/latest/ - File: infrastructure-components.yaml Name: hetzner ProviderType: InfrastructureProvider diff --git a/docs/book/src/user/quick-start.md b/docs/book/src/user/quick-start.md index 5d7d4ea75cbd..f9eac7054835 100644 --- a/docs/book/src/user/quick-start.md +++ b/docs/book/src/user/quick-start.md @@ -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 @@ -575,6 +575,13 @@ clusterctl init --infrastructure gcp ``` {{#/tab }} +{{#tab Harvester}} + +```bash +clusterctl init --infrastructure harvester +``` + +Please visit the [Harvester project][Harvester provider]. {{#tab Hetzner}} Please visit the [Hetzner project][Hetzner provider]. @@ -871,7 +878,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 @@ -1050,6 +1057,46 @@ export 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="" +# 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="" +# 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 / +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 / +export VM_IMAGE_NAME="default/jammy-server" +# Reference to VM Network in Harvester. It must follow the format / +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}} @@ -1817,6 +1864,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 From 1c5b0f636ff591c5c6b9ebfc34e9e2e2aee72644 Mon Sep 17 00:00:00 2001 From: Mohamed Belgaied Hassine Date: Tue, 26 Nov 2024 12:36:40 +0100 Subject: [PATCH 2/5] Adding org to provider name Signed-off-by: Mohamed Belgaied Hassine --- cmd/clusterctl/client/config/providers_client.go | 2 +- cmd/clusterctl/cmd/config_repositories_test.go | 4 ++-- docs/book/src/user/quick-start.md | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cmd/clusterctl/client/config/providers_client.go b/cmd/clusterctl/client/config/providers_client.go index 17140c3e9a42..619921a261f8 100644 --- a/cmd/clusterctl/client/config/providers_client.go +++ b/cmd/clusterctl/client/config/providers_client.go @@ -44,7 +44,7 @@ const ( DockerProviderName = "docker" DOProviderName = "digitalocean" GCPProviderName = "gcp" - HarvesterProviderName = "harvester" + HarvesterProviderName = "harvester-harvester" HetznerProviderName = "hetzner" HivelocityProviderName = "hivelocity-hivelocity" OutscaleProviderName = "outscale" diff --git a/cmd/clusterctl/cmd/config_repositories_test.go b/cmd/clusterctl/cmd/config_repositories_test.go index a0a77b91e561..d489ced27788 100644 --- a/cmd/clusterctl/cmd/config_repositories_test.go +++ b/cmd/clusterctl/cmd/config_repositories_test.go @@ -130,7 +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 InfrastructureProvider https://github.com/rancher-sandbox/cluster-api-provider-harvester/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 @@ -276,7 +276,7 @@ var expectedOutputYaml = `- File: core_components.yaml ProviderType: InfrastructureProvider URL: https://github.com/kubernetes-sigs/cluster-api-provider-gcp/releases/latest/ - File: infrastructure-components.yaml - Name: harvester + Name: harvester-harvester ProviderType: InfrastructureProvider URL: https://github.com/rancher-sandbox/cluster-api-provider-harvester/releases/latest/ - File: infrastructure-components.yaml diff --git a/docs/book/src/user/quick-start.md b/docs/book/src/user/quick-start.md index f9eac7054835..7fedffeaf107 100644 --- a/docs/book/src/user/quick-start.md +++ b/docs/book/src/user/quick-start.md @@ -578,10 +578,10 @@ clusterctl init --infrastructure gcp {{#tab Harvester}} ```bash -clusterctl init --infrastructure harvester +clusterctl init --infrastructure harvester-harvester ``` -Please visit the [Harvester project][Harvester provider]. +For more information, please visit the [Harvester project][Harvester provider]. {{#tab Hetzner}} Please visit the [Hetzner project][Hetzner provider]. From 2f4b4146599317ce0c00c227aa159d31f581860c Mon Sep 17 00:00:00 2001 From: Mohamed Belgaied Hassine Date: Tue, 10 Dec 2024 21:54:54 +0100 Subject: [PATCH 3/5] Update cmd/clusterctl/client/config/providers_client.go Co-authored-by: Fabrizio Pandini --- cmd/clusterctl/client/config/providers_client.go | 1 + 1 file changed, 1 insertion(+) diff --git a/cmd/clusterctl/client/config/providers_client.go b/cmd/clusterctl/client/config/providers_client.go index 619921a261f8..2540eff53672 100644 --- a/cmd/clusterctl/client/config/providers_client.go +++ b/cmd/clusterctl/client/config/providers_client.go @@ -44,6 +44,7 @@ const ( 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" From f0cfdaa715e44426b719fb0d78a1d6066f662e66 Mon Sep 17 00:00:00 2001 From: Mohamed Belgaied Hassine Date: Fri, 13 Dec 2024 18:30:17 +0100 Subject: [PATCH 4/5] Update docs/book/src/user/quick-start.md Co-authored-by: Christian Schlotter --- docs/book/src/user/quick-start.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/book/src/user/quick-start.md b/docs/book/src/user/quick-start.md index 7fedffeaf107..9c021d31368d 100644 --- a/docs/book/src/user/quick-start.md +++ b/docs/book/src/user/quick-start.md @@ -582,6 +582,7 @@ clusterctl init --infrastructure harvester-harvester ``` For more information, please visit the [Harvester project][Harvester provider]. +{{#/tab }} {{#tab Hetzner}} Please visit the [Hetzner project][Hetzner provider]. From 610f4735d1f8e868822c2a6b52d128f659515f67 Mon Sep 17 00:00:00 2001 From: Mohamed Belgaied Hassine Date: Fri, 13 Dec 2024 21:49:52 +0100 Subject: [PATCH 5/5] fix some linting with a comment Signed-off-by: Mohamed Belgaied Hassine --- cmd/clusterctl/client/config/providers_client.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/cmd/clusterctl/client/config/providers_client.go b/cmd/clusterctl/client/config/providers_client.go index 2540eff53672..cbdcd383444d 100644 --- a/cmd/clusterctl/client/config/providers_client.go +++ b/cmd/clusterctl/client/config/providers_client.go @@ -37,14 +37,14 @@ const ( // Infra providers. const ( - 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) + 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"