From 21866380fb512b5d143f86ddec1879226472322d Mon Sep 17 00:00:00 2001 From: Pery Lemke <3199483+perylemke@users.noreply.github.com> Date: Wed, 24 Sep 2025 17:24:36 -0300 Subject: [PATCH 1/3] feat: create the examples of cluster api --- cluster-api/README.md | 44 ++++++++++++++ cluster-api/latitude-cluster/README.md | 52 ++++++++++++++++ cluster-api/latitude-cluster/lsh-cluster.yaml | 59 +++++++++++++++++++ cluster-api/latitude-machine/README.md | 54 +++++++++++++++++ cluster-api/latitude-machine/lsh-machine.yaml | 39 ++++++++++++ 5 files changed, 248 insertions(+) create mode 100644 cluster-api/README.md create mode 100644 cluster-api/latitude-cluster/README.md create mode 100644 cluster-api/latitude-cluster/lsh-cluster.yaml create mode 100644 cluster-api/latitude-machine/README.md create mode 100644 cluster-api/latitude-machine/lsh-machine.yaml diff --git a/cluster-api/README.md b/cluster-api/README.md new file mode 100644 index 0000000..9b1ebba --- /dev/null +++ b/cluster-api/README.md @@ -0,0 +1,44 @@ +# Cluster API - Latitude.sh + +## Prerequisites + +- [Kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/) installed +- [Cluster API provider for Latitude.sh](https://github.com/latitudesh/cluster-api-provider-latitudesh) installed + +## Getting Started + +1. Install the Cluster API provider for Latitude.sh: + +```bash +make install +``` + +2. Deploy the Cluster API provider for Latitude.sh: + +```bash +make deploy +``` + +3. Apply the `lsh-cluster.yaml` file: + +```bash +kubectl apply -f lsh-cluster.yaml +``` + +4. Wait for the cluster to be ready: + +```bash +kubectl get latitudecluster +``` + +5. Delete the cluster: + +```bash +kubectl delete latitudecluster +``` + +6. Delete all stale resources: + +```bash +kubectl delete -f lsh-cluster.yaml +``` \ No newline at end of file diff --git a/cluster-api/latitude-cluster/README.md b/cluster-api/latitude-cluster/README.md new file mode 100644 index 0000000..3ff19e2 --- /dev/null +++ b/cluster-api/latitude-cluster/README.md @@ -0,0 +1,52 @@ +# Latitude Cluster + +This example shows how to create a Kubernetes cluster on Latitude using the Cluster API provider for Latitude.sh. + +## Getting Started + +0. Change the `CLUSTER_NAME`, `PROJECT_ID`, `LOCATION`, `PLAN`, `OPERATING_SYSTEM`, and `SSH_KEY_ID` in the `lsh-cluster.yaml` file. +```bash +sed -i \ + -e 's//my-cluster/g' \ + -e 's//your-project-id/g' \ + -e 's//SAO2/g' \ + -e 's//c2-small-x86/g' \ + -e 's//your-ssh-key-id/g' \ + lsh-cluster.yaml +``` + +1. Apply the `lsh-cluster.yaml` file: + +```bash +kubectl apply -f lsh-cluster.yaml +``` + +2. Wait for the cluster to be ready: + +```bash +kubectl get latitudecluster +``` + +3. Get the description of the cluster: + +```bash +kubectl describe latitudecluster +``` + +4. Get the status of the cluster: + +```bash +kubectl get latitudecluster -o jsonpath='{.status.ready}' +``` + +5. Delete the cluster: + +```bash +kubectl delete latitudecluster +``` + +6. Delete all stale resources: + +```bash +kubectl delete -f lsh-cluster.yaml +``` \ No newline at end of file diff --git a/cluster-api/latitude-cluster/lsh-cluster.yaml b/cluster-api/latitude-cluster/lsh-cluster.yaml new file mode 100644 index 0000000..aab32c2 --- /dev/null +++ b/cluster-api/latitude-cluster/lsh-cluster.yaml @@ -0,0 +1,59 @@ +apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +kind: LatitudeCluster +metadata: + name: "" + namespace: default +spec: + location: "" + projectRef: + projectID: "" +--- +apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +kind: LatitudeMachineTemplate +metadata: + name: "" + namespace: default +spec: + template: + spec: + projectID: "" + site: "" + plan: "" + operatingSystem: "" + sshKeys: + - "" +--- +apiVersion: controlplane.cluster.x-k8s.io/v1beta1 +kind: KubeadmControlPlane +metadata: + name: "" + namespace: default +spec: + replicas: 1 + version: v1.30.0 + machineTemplate: + infrastructureRef: + apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 + kind: LatitudeMachineTemplate + name: "" + kubeadmConfigSpec: + clusterConfiguration: + controllerManager: {} + scheduler: {} + initConfiguration: {} + joinConfiguration: {} +--- +apiVersion: cluster.x-k8s.io/v1beta1 +kind: Cluster +metadata: + name: "" + namespace: default +spec: + infrastructureRef: + apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 + kind: LatitudeCluster + name: "" + controlPlaneRef: + apiVersion: controlplane.cluster.x-k8s.io/v1beta1 + kind: KubeadmControlPlane + name: "" diff --git a/cluster-api/latitude-machine/README.md b/cluster-api/latitude-machine/README.md new file mode 100644 index 0000000..e74d53e --- /dev/null +++ b/cluster-api/latitude-machine/README.md @@ -0,0 +1,54 @@ +# Latitude Machine + +This example shows how to create a machine on Latitude using the Cluster API provider for Latitude.sh. + +## Getting Started + +0. Change the `PROJECT_ID`, `LOCATION`, `PLAN`, `OPERATING_SYSTEM`, and `SSH_KEY_ID` in the `lsh-machine.yaml` file. +```bash +sed -i \ + -e 's//my-machine/g' \ + -e 's//your-project-id/g' \ + -e 's//SAO2/g' \ + -e 's//c2-small-x86/g' \ + -e 's//your-ssh-key-id/g' \ + -e 's//my-kubeadm-config/g' \ + -e 's//my-cluster/g' \ + lsh-machine.yaml +``` + +1. Apply the `lsh-machine.yaml` file: + +```bash +kubectl apply -f lsh-machine.yaml +``` + +2. Wait for the machine to be ready: + +```bash +kubectl get latitudemachine +``` + +3. Get the description of the machine: + +```bash +kubectl describe latitudemachine +``` + +4. Get the status of the machine: + +```bash +kubectl get latitudemachine -o jsonpath='{.status.ready}' +``` + +5. Delete the machine: + +```bash +kubectl delete latitudemachine +``` + +6. Delete all stale resources: + +```bash +kubectl delete -f lsh-machine.yaml +``` \ No newline at end of file diff --git a/cluster-api/latitude-machine/lsh-machine.yaml b/cluster-api/latitude-machine/lsh-machine.yaml new file mode 100644 index 0000000..d81940a --- /dev/null +++ b/cluster-api/latitude-machine/lsh-machine.yaml @@ -0,0 +1,39 @@ +apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 +kind: LatitudeMachine +metadata: + name: "" + namespace: default +spec: + projectID: "" + site: "" + plan: "" + operatingSystem: "ubuntu_24_04_x64_lts" + sshKeys: [""] +--- +apiVersion: bootstrap.cluster.x-k8s.io/v1beta2 +kind: KubeadmConfig +metadata: + name: "" + namespace: default +spec: + joinConfiguration: + nodeRegistration: + name: "{{ ds.meta_data.hostname }}" +--- +apiVersion: cluster.x-k8s.io/v1beta2 +kind: Machine +metadata: + name: "" + namespace: default +spec: + clusterName: "" + version: v1.30.0 + bootstrap: + configRef: + apiGroup: bootstrap.cluster.x-k8s.io + kind: KubeadmConfig + name: "" + infrastructureRef: + apiGroup: infrastructure.cluster.x-k8s.io + kind: LatitudeMachine + name: "" From 0a0f1dcea6ae21cd329045d0477de5dce4dfaa80 Mon Sep 17 00:00:00 2001 From: Pery Lemke <3199483+perylemke@users.noreply.github.com> Date: Wed, 24 Sep 2025 17:35:32 -0300 Subject: [PATCH 2/3] chore: include more infos on README --- cluster-api/README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cluster-api/README.md b/cluster-api/README.md index 9b1ebba..20203ae 100644 --- a/cluster-api/README.md +++ b/cluster-api/README.md @@ -1,5 +1,9 @@ # Cluster API - Latitude.sh +## Disclaimer + +This project is a work in progress and is not yet ready for production use. The project is currently in alpha and is not recommended for production use. + ## Prerequisites - [Kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/) installed From 3f48586ea045ef355e384471bb49ba8b70c05e3c Mon Sep 17 00:00:00 2001 From: Pery Lemke <3199483+perylemke@users.noreply.github.com> Date: Thu, 25 Sep 2025 09:57:00 -0300 Subject: [PATCH 3/3] chore: adjust typo and include docker and kind on README --- cluster-api/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cluster-api/README.md b/cluster-api/README.md index 20203ae..adfd12d 100644 --- a/cluster-api/README.md +++ b/cluster-api/README.md @@ -6,7 +6,9 @@ This project is a work in progress and is not yet ready for production use. The ## Prerequisites -- [Kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/) installed +- [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/) installed +- [docker](https://docs.docker.com/get-docker/) installed +- [kind](https://kind.sigs.k8s.io/docs/user/quick-start/#installation) installed - [Cluster API provider for Latitude.sh](https://github.com/latitudesh/cluster-api-provider-latitudesh) installed ## Getting Started