From 024734b8047e377bd956f7c6019f6373357d501f Mon Sep 17 00:00:00 2001 From: mac641 Date: Thu, 26 Feb 2026 10:15:43 +0100 Subject: [PATCH 01/11] feat: add kamaji flavor Co-authored-by: Matthias Hartmann --- Makefile | 2 ++ compose.yaml | 2 ++ deploy_control_plane.yaml | 4 +++ deploy_kamaji.yaml | 13 +++++++ .../group_vars/control-plane/kamaji.yaml | 9 +++++ roles/kamaji/defaults/main.yaml | 2 ++ roles/kamaji/tasks/main.yaml | 32 +++++++++++++++++ .../templates/tenant-control-plane.yaml.j2 | 35 +++++++++++++++++++ 8 files changed, 99 insertions(+) create mode 100644 deploy_kamaji.yaml create mode 100644 inventories/group_vars/control-plane/kamaji.yaml create mode 100644 roles/kamaji/defaults/main.yaml create mode 100644 roles/kamaji/tasks/main.yaml create mode 100644 roles/kamaji/templates/tenant-control-plane.yaml.j2 diff --git a/Makefile b/Makefile index 02a2729e..1eb04cc6 100644 --- a/Makefile +++ b/Makefile @@ -36,6 +36,8 @@ MINI_LAB_SONIC_IMAGE=r.metal-stack.io/vrnetlab/dell_sonic:$(MINI_LAB_DELL_SONIC_ else ifeq ($(MINI_LAB_FLAVOR),capms) LAB_TOPOLOGY=mini-lab.capms.yaml MINI_LAB_SONIC_IMAGE=r.metal-stack.io/vrnetlab/dell_sonic:$(MINI_LAB_DELL_SONIC_VERSION) +else ifeq ($(MINI_LAB_FLAVOR),kamaji) +KAMAJI_ENABLED=true else ifeq ($(MINI_LAB_FLAVOR),gardener) GARDENER_ENABLED=true # usually gardener restricts the maximum version for k8s: diff --git a/compose.yaml b/compose.yaml index 54a6b6f4..5509ff23 100644 --- a/compose.yaml +++ b/compose.yaml @@ -21,6 +21,8 @@ services: - DOCKER_HUB_USER=${DOCKER_HUB_USER} - DOCKER_HUB_TOKEN=${DOCKER_HUB_TOKEN} - GARDENER_ENABLED=${GARDENER_ENABLED:-} + - KAMAJI_ENABLED=${KAMAJI_ENABLED:-} + - MONITORING_ENABLED=${MONITORING_ENABLED:-} network_mode: host working_dir: /mini-lab entrypoint: diff --git a/deploy_control_plane.yaml b/deploy_control_plane.yaml index 84436081..c19bbc66 100644 --- a/deploy_control_plane.yaml +++ b/deploy_control_plane.yaml @@ -35,3 +35,7 @@ - name: deploy gardener import_playbook: deploy_gardener.yaml when: gardener_enabled + +- name: deploy kamaji + import_playbook: deploy_kamaji.yaml + when: kamaji_enabled diff --git a/deploy_kamaji.yaml b/deploy_kamaji.yaml new file mode 100644 index 00000000..7d1f0488 --- /dev/null +++ b/deploy_kamaji.yaml @@ -0,0 +1,13 @@ +--- +- name: deploy kamaji + hosts: control-plane + connection: local + gather_facts: false + + roles: + - name: ansible-common + tags: always + - name: kamaji + tags: kamaji + # vars: + # metal_control_plane_host_provider: metal diff --git a/inventories/group_vars/control-plane/kamaji.yaml b/inventories/group_vars/control-plane/kamaji.yaml new file mode 100644 index 00000000..82a7d09c --- /dev/null +++ b/inventories/group_vars/control-plane/kamaji.yaml @@ -0,0 +1,9 @@ +--- +kamaaji_enabled: "{{ lookup('env', 'KAMAAJI_ENABLED') | default('', false) }}" + +tenant_name: kamaji-tenant-control-plane +tenant_namespace: kamaji-tenant +tenant_version: v1.33.0 + +tenant_port: 6443 +tenant_proxy_port: 8132 diff --git a/roles/kamaji/defaults/main.yaml b/roles/kamaji/defaults/main.yaml new file mode 100644 index 00000000..e658e688 --- /dev/null +++ b/roles/kamaji/defaults/main.yaml @@ -0,0 +1,2 @@ +--- +kamaji_version: "6.0.4" diff --git a/roles/kamaji/tasks/main.yaml b/roles/kamaji/tasks/main.yaml new file mode 100644 index 00000000..d9fc534c --- /dev/null +++ b/roles/kamaji/tasks/main.yaml @@ -0,0 +1,32 @@ +--- +- name: Add bitnami repo + kubernetes.core.helm_repository: + name: jetstack + repo_url: https://charts.jetstack.io + +- name: Deploy cert manager + kubernetes.core.helm: + chart_ref: jetstack/cert-manager + release_name: kamaji-cert-manager + release_namespace: kamaji-cert-manager + create_namespace: true + wait: true + set_values: + - installCRDs: true + +- name: Deploy kamaji + kubernetes.core.helm: + chart_ref: clastix/kamaji + chart_version: 0.0.0+latest + release_name: kamaji + release_namespace: kamaji-system + create_namespace: true + wait: true + set_values: + - image.tag: latest +# +# - name: Deploy tenant control plane +# kubernetes.core.k8s: +# state: present +# template: "{{ lookup('template', 'tenant-control-plane.yaml.j2') | from_yaml }}" +# wait: true diff --git a/roles/kamaji/templates/tenant-control-plane.yaml.j2 b/roles/kamaji/templates/tenant-control-plane.yaml.j2 new file mode 100644 index 00000000..6488a12a --- /dev/null +++ b/roles/kamaji/templates/tenant-control-plane.yaml.j2 @@ -0,0 +1,35 @@ +--- +apiVersion: kamaji.clastix.io/v1alpha1 +kind: TenantControlPlane +metadata: + name: {{ tenant_name }} + labels: + tenant.clastix.io: {{ tenant_name }} +spec: + controlPlane: + deployment: + replicas: 2 + service: + serviceType: LoadBalancer + kubernetes: + version: {{ tenant_version }} + kubelet: + configurationJSONPatches: + - op: add + path: /featureGates + value: + KubeletCrashLoopBackOffMax: false + KubeletEnsureSecretPulledImages: false + - op: replace + path: /cgroupDriver + value: systemd + networkProfile: + port: {{ tenant_port }} + addons: + coreDNS: {} + kubeProxy: {} + konnectivity: + server: + port: {{ tenant_proxy_port }} + agent: + mode: DaemonSet From 60e96d724c39ac0f8658a5a7cb902db8e584ab0f Mon Sep 17 00:00:00 2001 From: mac641 Date: Thu, 26 Feb 2026 11:37:17 +0100 Subject: [PATCH 02/11] refactor(kamaji): move kamaji management control-plane creation to capi-lab Co-authored-by: Matthias Hartmann --- .../group_vars/control-plane/kamaji.yaml | 9 +---- roles/kamaji/defaults/main.yaml | 2 -- roles/kamaji/tasks/main.yaml | 6 ---- .../templates/tenant-control-plane.yaml.j2 | 35 ------------------- 4 files changed, 1 insertion(+), 51 deletions(-) delete mode 100644 roles/kamaji/defaults/main.yaml delete mode 100644 roles/kamaji/templates/tenant-control-plane.yaml.j2 diff --git a/inventories/group_vars/control-plane/kamaji.yaml b/inventories/group_vars/control-plane/kamaji.yaml index 82a7d09c..c4d8ea4e 100644 --- a/inventories/group_vars/control-plane/kamaji.yaml +++ b/inventories/group_vars/control-plane/kamaji.yaml @@ -1,9 +1,2 @@ --- -kamaaji_enabled: "{{ lookup('env', 'KAMAAJI_ENABLED') | default('', false) }}" - -tenant_name: kamaji-tenant-control-plane -tenant_namespace: kamaji-tenant -tenant_version: v1.33.0 - -tenant_port: 6443 -tenant_proxy_port: 8132 +kamaji_enabled: "{{ lookup('env', 'KAMAAJI_ENABLED') | default('', false) }}" diff --git a/roles/kamaji/defaults/main.yaml b/roles/kamaji/defaults/main.yaml deleted file mode 100644 index e658e688..00000000 --- a/roles/kamaji/defaults/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ ---- -kamaji_version: "6.0.4" diff --git a/roles/kamaji/tasks/main.yaml b/roles/kamaji/tasks/main.yaml index d9fc534c..f1d131ed 100644 --- a/roles/kamaji/tasks/main.yaml +++ b/roles/kamaji/tasks/main.yaml @@ -24,9 +24,3 @@ wait: true set_values: - image.tag: latest -# -# - name: Deploy tenant control plane -# kubernetes.core.k8s: -# state: present -# template: "{{ lookup('template', 'tenant-control-plane.yaml.j2') | from_yaml }}" -# wait: true diff --git a/roles/kamaji/templates/tenant-control-plane.yaml.j2 b/roles/kamaji/templates/tenant-control-plane.yaml.j2 deleted file mode 100644 index 6488a12a..00000000 --- a/roles/kamaji/templates/tenant-control-plane.yaml.j2 +++ /dev/null @@ -1,35 +0,0 @@ ---- -apiVersion: kamaji.clastix.io/v1alpha1 -kind: TenantControlPlane -metadata: - name: {{ tenant_name }} - labels: - tenant.clastix.io: {{ tenant_name }} -spec: - controlPlane: - deployment: - replicas: 2 - service: - serviceType: LoadBalancer - kubernetes: - version: {{ tenant_version }} - kubelet: - configurationJSONPatches: - - op: add - path: /featureGates - value: - KubeletCrashLoopBackOffMax: false - KubeletEnsureSecretPulledImages: false - - op: replace - path: /cgroupDriver - value: systemd - networkProfile: - port: {{ tenant_port }} - addons: - coreDNS: {} - kubeProxy: {} - konnectivity: - server: - port: {{ tenant_proxy_port }} - agent: - mode: DaemonSet From 9ef1ed1851a9ff9bfa45a20e6a2d883529ffe105 Mon Sep 17 00:00:00 2001 From: mac641 Date: Thu, 26 Feb 2026 13:02:55 +0100 Subject: [PATCH 03/11] fix(kamaji): typos --- Makefile | 1 + inventories/group_vars/control-plane/kamaji.yaml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 87e5943c..c7f4f094 100644 --- a/Makefile +++ b/Makefile @@ -38,6 +38,7 @@ else ifeq ($(MINI_LAB_FLAVOR),capms) LAB_TOPOLOGY=mini-lab.capms.yaml MINI_LAB_SONIC_IMAGE=r.metal-stack.io/vrnetlab/dell_sonic:$(MINI_LAB_DELL_SONIC_VERSION) else ifeq ($(MINI_LAB_FLAVOR),kamaji) +LAB_TOPOLOGY=mini-lab.sonic.yaml KAMAJI_ENABLED=true else ifeq ($(MINI_LAB_FLAVOR),gardener) GARDENER_ENABLED=true diff --git a/inventories/group_vars/control-plane/kamaji.yaml b/inventories/group_vars/control-plane/kamaji.yaml index c4d8ea4e..0e4c6f4d 100644 --- a/inventories/group_vars/control-plane/kamaji.yaml +++ b/inventories/group_vars/control-plane/kamaji.yaml @@ -1,2 +1,2 @@ --- -kamaji_enabled: "{{ lookup('env', 'KAMAAJI_ENABLED') | default('', false) }}" +kamaji_enabled: "{{ lookup('env', 'KAMAJI_ENABLED') | default('', false) }}" From 8af8772b0b83591081b8975fda7e45f23348c3f6 Mon Sep 17 00:00:00 2001 From: mac641 Date: Thu, 26 Feb 2026 13:14:42 +0100 Subject: [PATCH 04/11] fix(kamaji): fix helm chart values and typos --- roles/kamaji/tasks/main.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/roles/kamaji/tasks/main.yaml b/roles/kamaji/tasks/main.yaml index f1d131ed..b9aa1157 100644 --- a/roles/kamaji/tasks/main.yaml +++ b/roles/kamaji/tasks/main.yaml @@ -1,5 +1,5 @@ --- -- name: Add bitnami repo +- name: Add kamaji repo kubernetes.core.helm_repository: name: jetstack repo_url: https://charts.jetstack.io @@ -7,20 +7,20 @@ - name: Deploy cert manager kubernetes.core.helm: chart_ref: jetstack/cert-manager - release_name: kamaji-cert-manager + name: kamaji-cert-manager release_namespace: kamaji-cert-manager create_namespace: true wait: true set_values: - - installCRDs: true + - value: installCRDs=true - name: Deploy kamaji kubernetes.core.helm: chart_ref: clastix/kamaji chart_version: 0.0.0+latest - release_name: kamaji + name: kamaji release_namespace: kamaji-system create_namespace: true wait: true set_values: - - image.tag: latest + - value: image.tag=latest From 16b0370b7dd7814e7b83f84bb59c22011366ef29 Mon Sep 17 00:00:00 2001 From: mac641 Date: Thu, 26 Feb 2026 13:35:00 +0100 Subject: [PATCH 05/11] fix(kamaji): add missing clastix helm_repository --- roles/kamaji/tasks/main.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/roles/kamaji/tasks/main.yaml b/roles/kamaji/tasks/main.yaml index b9aa1157..edf6fda0 100644 --- a/roles/kamaji/tasks/main.yaml +++ b/roles/kamaji/tasks/main.yaml @@ -1,9 +1,14 @@ --- -- name: Add kamaji repo +- name: Add jetstack repo kubernetes.core.helm_repository: name: jetstack repo_url: https://charts.jetstack.io +- name: Add clastix repo + kubernetes.core.helm_repository: + name: clastix + repo_url: https://clastix.github.io/charts + - name: Deploy cert manager kubernetes.core.helm: chart_ref: jetstack/cert-manager From 1ac9fe3df9b24956966da9b85bccfbbb2e4a8a8a Mon Sep 17 00:00:00 2001 From: Matthias Hartmann Date: Thu, 26 Feb 2026 14:53:13 +0100 Subject: [PATCH 06/11] docs: add kamaji overview --- docs/overview-kamaji.drawio.svg | 751 ++++++++++++++++++++++++++++++++ 1 file changed, 751 insertions(+) create mode 100644 docs/overview-kamaji.drawio.svg diff --git a/docs/overview-kamaji.drawio.svg b/docs/overview-kamaji.drawio.svg new file mode 100644 index 00000000..f6e083c1 --- /dev/null +++ b/docs/overview-kamaji.drawio.svg @@ -0,0 +1,751 @@ + + + + + + + + + + + + + + + + + +
+
+
+ + linux-desktop + +
+
+
+
+ + linux-desktop + +
+
+
+ + + + + + + + + + + + + +
+
+
+ + + containerlab + + +
+
+
+
+ + containerlab + +
+
+
+ + + + + + + + + +
+
+
+ + + kind-cluster + + +
+
+
+
+ + kind-cluster + +
+
+
+ + + + + + + + + + +
+
+
+ metal-stack +
+
+
+
+ + metal-stack + +
+
+
+ + + + + + + + + + + + + + + + +
+
+
+ partition +
+
+
+
+ + partition + +
+
+
+ + + + + + + + + + +
+
+
+ + machine02/ + +
+ + firewall + +
+
+
+
+
+ + machine02/... + +
+
+
+ + + + + + + +
+
+
+ tenantnetwork +
+
+
+
+ + tenantnetwork + +
+
+
+ + + + + + + + + + + + + + +
+
+
+ leaf02 +
+
+
+
+ + leaf02 + +
+
+
+ + + + + + + +
+
+
+ metal-core +
+
+
+
+ + metal-core + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ masterdata-api +
+
+
+
+ + masterdata-api + +
+
+
+ + + + + + + auditing + + + + + + + + + + + + + +
+
+
+ metal-db +
+
+
+
+ + metal-db + +
+
+
+ + + + + + + + + + +
+
+
+ ipam-db +
+
+
+
+ + ipam-db + +
+
+
+ + + + + + + +
+
+
+ ipam +
+
+
+
+ + ipam + +
+
+
+ + + + + + + +
+
+
+ nsqd +
+
+
+
+ + nsqd + +
+
+
+ + + + + + + +
+
+
+ metal-api +
+
+
+
+ + metal-api + +
+
+
+ + + + + + + + + + + + + +
+
+
+ masterdata-db +
+
+
+
+ + masterdata-... + +
+
+
+ + + + + + + + +
+
+
+ capi-lab +
+
+
+
+ + capi-lab + +
+
+
+ + + + + + + +
+
+
+ docker network 172.17.0.1/16 +
+
+
+
+ + docker network 172.17.0.1/16 + +
+
+
+ + + + + + + +
+
+
+ Ingress-Controller (NGINX) +
+
+
+
+ + Ingress-Controller (... + +
+
+
+ + + + + + + + + + +
+
+
+ machine01 +
+
+
+
+ + machine01 + +
+
+
+ + + + + + + +
+
+
+ exit +
+
+
+
+ + exit + +
+
+
+ + + + + + + + + + + +
+
+
+ leaf01 +
+
+
+
+ + leaf01 + +
+
+
+ + + + + + + + + + +
+
+
+ metal-core +
+
+
+
+ + metal-core + +
+
+
+ + + + + + + + + + +
+
+
+ veth link +
+
+
+
+ + veth link + +
+
+
+ + + + + + + + + + +
+
+
+ Kamaji Management Cluster +
+
+
+
+ + Kamaji Management Cluster + +
+
+
+ + + + + + + + + + + + + +
+
+
+ tenant control plane A +
+
+
+
+ + tenant control plane A + +
+
+
+ + + + + + + + + + Multi-Tenant + + + Datastore + + + + + + + + + + + + + + + + + +
+
+
+ tenant control plane B +
+
+
+
+ + tenant control plane B + +
+
+
+ + + + + + + +
+
+
+ CAPMS (ClusterAPI Provider) +
+
+
+
+ + CAPMS (ClusterAPI Provider) + +
+
+
+ + + +
+ + + + + Text is not SVG - cannot display + + + +
\ No newline at end of file From 848583821419679e81fcf5a60b8744d117c3c8c0 Mon Sep 17 00:00:00 2001 From: mac641 Date: Fri, 27 Feb 2026 13:55:01 +0100 Subject: [PATCH 07/11] docs(kamaji): add reference to capi-lab --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 057191fd..bab8c337 100644 --- a/README.md +++ b/README.md @@ -190,11 +190,12 @@ make power-- ## Flavors -There are four flavors of the mini-lab environment: +There are five flavors of the mini-lab environment: - `sonic`: runs two Community SONiC switches - `dell_sonic`: runs two Enterprise SONiC switches with a [locally built vrnetlab image](https://github.com/srl-labs/vrnetlab/tree/master/dell/dell_sonic) - `capms`: runs the `dell_sonic` flavor but with four instead of two machines (this is used for [cluster-provider-metal-stack](https://github.com/metal-stack/cluster-api-provider-metal-stack) in order to have dedicated hosts for control plane / worker / firewall) +- `kamaji`: runs the `sonic` flavor. The working example is available at the [cluster-provider-metal-stack](https://github.com/metal-stack/cluster-api-provider-metal-stack)'s `capi-lab`. - `gardener`: runs the `sonic` flavor and installs the [Gardener](https://gardener.cloud) in the mini-lab In order to start specific flavor, you can define the flavor as follows: From bffc98533e9e2ecfb33f738f1302b09cd1b95e6a Mon Sep 17 00:00:00 2001 From: Matthias Hartmann Date: Mon, 9 Mar 2026 16:20:16 +0100 Subject: [PATCH 08/11] add own topology for kamaji and install metallb with ip address pool --- Makefile | 3 +- mini-lab.kamaji.yaml | 70 +++++++++++++++++++ roles/kamaji/tasks/main.yaml | 49 ++++++++++++- .../templates/metallb-kind-ip-pool.yaml | 15 ++++ 4 files changed, 134 insertions(+), 3 deletions(-) create mode 100644 mini-lab.kamaji.yaml create mode 100644 roles/kamaji/templates/metallb-kind-ip-pool.yaml diff --git a/Makefile b/Makefile index c7f4f094..8d10666d 100644 --- a/Makefile +++ b/Makefile @@ -38,7 +38,7 @@ else ifeq ($(MINI_LAB_FLAVOR),capms) LAB_TOPOLOGY=mini-lab.capms.yaml MINI_LAB_SONIC_IMAGE=r.metal-stack.io/vrnetlab/dell_sonic:$(MINI_LAB_DELL_SONIC_VERSION) else ifeq ($(MINI_LAB_FLAVOR),kamaji) -LAB_TOPOLOGY=mini-lab.sonic.yaml +LAB_TOPOLOGY=mini-lab.kamaji.yaml KAMAJI_ENABLED=true else ifeq ($(MINI_LAB_FLAVOR),gardener) GARDENER_ENABLED=true @@ -166,6 +166,7 @@ cleanup-partition: sudo --preserve-env $(CONTAINERLAB) destroy --topo mini-lab.dell_sonic.yaml sudo --preserve-env $(CONTAINERLAB) destroy --topo mini-lab.sonic.yaml sudo --preserve-env $(CONTAINERLAB) destroy --topo mini-lab.capms.yaml + sudo --preserve-env $(CONTAINERLAB) destroy --topo mini-lab.kamaji.yaml docker network rm --force mini_lab_ext .PHONY: _privatenet diff --git a/mini-lab.kamaji.yaml b/mini-lab.kamaji.yaml new file mode 100644 index 00000000..49b50ac9 --- /dev/null +++ b/mini-lab.kamaji.yaml @@ -0,0 +1,70 @@ +# flavor for mini-lab kamaji with cluster-api-provider-metal-stack +name: mini-lab +prefix: "" + +mgmt: + network: mini_lab_ext + +topology: + defaults: + kind: linux + nodes: + # make metal-control-plane accessible via mini_lab_ext + metal-control-plane-control-plane: + kind: ext-container + exec: + - ip route add 203.0.113.128/25 via 203.0.113.128 dev eth0 + exit: + image: quay.io/frrouting/frr:10.3.0 + network-mode: none + binds: + - files/exit/daemons:/etc/frr/daemons + - files/exit/frr.conf:/etc/frr/frr.conf + - files/exit/vtysh.conf:/etc/frr/vtysh.conf + - files/exit/network.sh:/root/network.sh + exec: + - sh /root/network.sh + external_service: + image: docker.io/library/nginx:alpine-slim + network-mode: none + binds: + - files/external_service/network.sh:/root/network.sh + exec: + - sh /root/network.sh + mini_lab_ext: + kind: bridge + leaf01: + group: leaves + image: ${MINI_LAB_SONIC_IMAGE} + binds: + - files/ssh/id_rsa.pub:/authorized_keys + env: + QEMU_MEMORY: 4096 + leaf02: + group: leaves + image: ${MINI_LAB_SONIC_IMAGE} + binds: + - files/ssh/id_rsa.pub:/authorized_keys + env: + QEMU_MEMORY: 4096 + machine01: + group: machines + image: ${MINI_LAB_VM_IMAGE} + env: + UUID: 00000000-0000-0000-0000-000000000001 + machine02: + group: machines + image: ${MINI_LAB_VM_IMAGE} + env: + UUID: 00000000-0000-0000-0000-000000000002 + links: + - endpoints: ["exit:mini_lab_ext", "mini_lab_ext:exit"] + mtu: 9000 + - endpoints: ["external_service:mini_lab_ext", "mini_lab_ext:external_service"] + mtu: 9000 + - endpoints: ["leaf01:Ethernet0", "machine01:lan0"] + - endpoints: ["leaf02:Ethernet0", "machine01:lan1"] + - endpoints: ["leaf01:Ethernet1", "machine02:lan0"] + - endpoints: ["leaf02:Ethernet1", "machine02:lan1"] + - endpoints: ["leaf01:Ethernet120", "exit:eth1"] + - endpoints: ["leaf02:Ethernet120", "exit:eth2"] diff --git a/roles/kamaji/tasks/main.yaml b/roles/kamaji/tasks/main.yaml index edf6fda0..02f242f5 100644 --- a/roles/kamaji/tasks/main.yaml +++ b/roles/kamaji/tasks/main.yaml @@ -4,6 +4,12 @@ name: jetstack repo_url: https://charts.jetstack.io +- name: Add metallb repo + kubernetes.core.helm_repository: + name: metallb + repo_url: https://metallb.github.io/metallb + + - name: Add clastix repo kubernetes.core.helm_repository: name: clastix @@ -12,13 +18,51 @@ - name: Deploy cert manager kubernetes.core.helm: chart_ref: jetstack/cert-manager - name: kamaji-cert-manager - release_namespace: kamaji-cert-manager + name: cert-manager + release_namespace: cert-manager create_namespace: true wait: true set_values: - value: installCRDs=true +# +# Claude Opus 4.6 was used to generate the following Ansible tasks based on the provided code snippets and context of +# the Getting Started guide for Kamaji with kind: https://kamaji.clastix.io/getting-started/kamaji-kind/ +# They are intended to install metallb with an address pool that matches the kind network. +- name: Deploy metallb + kubernetes.core.helm: + chart_ref: metallb/metallb + name: metallb + release_namespace: metallb-system + create_namespace: true + wait: true + +- name: Read cluster nodes + kubernetes.core.k8s_info: + api_version: v1 + kind: Node + register: cluster_nodes + +- name: Find node InternalIP + ansible.builtin.set_fact: + kind_node_ip: "{{ item.address }}" + loop: "{{ cluster_nodes.resources[0].status.addresses }}" + when: item.type == 'InternalIP' + +- name: Derive MetalLB network prefix + ansible.builtin.set_fact: + metallb_kind_net_prefix: "{{ kind_node_ip | regex_replace('^([0-9]+\\.[0-9]+)\\..*$', '\\1') }}" + +- name: Debug MetalLB network prefix + ansible.builtin.debug: + msg: "kind_node_ip={{ kind_node_ip }} metallb_kind_net_prefix={{ metallb_kind_net_prefix }}" + +- name: Apply MetalLB IP address pool + kubernetes.core.k8s: + state: present + template: metallb-kind-ip-pool.yaml +# + - name: Deploy kamaji kubernetes.core.helm: chart_ref: clastix/kamaji @@ -29,3 +73,4 @@ wait: true set_values: - value: image.tag=latest + - value: resources=null diff --git a/roles/kamaji/templates/metallb-kind-ip-pool.yaml b/roles/kamaji/templates/metallb-kind-ip-pool.yaml new file mode 100644 index 00000000..ad64657e --- /dev/null +++ b/roles/kamaji/templates/metallb-kind-ip-pool.yaml @@ -0,0 +1,15 @@ +--- +apiVersion: metallb.io/v1beta1 +kind: IPAddressPool +metadata: + name: kind-ip-pool + namespace: metallb-system +spec: + addresses: + - {{ metallb_kind_net_prefix }}.255.200-{{ metallb_kind_net_prefix }}.255.250 +--- +apiVersion: metallb.io/v1beta1 +kind: L2Advertisement +metadata: + name: empty + namespace: metallb-system \ No newline at end of file From fb9ac42ec31d4546d274a95712f4b1ed2e5c225e Mon Sep 17 00:00:00 2001 From: mac641 Date: Wed, 11 Mar 2026 17:34:19 +0100 Subject: [PATCH 09/11] fix(kamaji): add creation of kamaji tenant control plane kubernetes namespace --- roles/kamaji/tasks/main.yaml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/roles/kamaji/tasks/main.yaml b/roles/kamaji/tasks/main.yaml index 02f242f5..487f4953 100644 --- a/roles/kamaji/tasks/main.yaml +++ b/roles/kamaji/tasks/main.yaml @@ -9,7 +9,6 @@ name: metallb repo_url: https://metallb.github.io/metallb - - name: Add clastix repo kubernetes.core.helm_repository: name: clastix @@ -45,8 +44,8 @@ - name: Find node InternalIP ansible.builtin.set_fact: - kind_node_ip: "{{ item.address }}" - loop: "{{ cluster_nodes.resources[0].status.addresses }}" + kind_node_ip: '{{ item.address }}' + loop: '{{ cluster_nodes.resources[0].status.addresses }}' when: item.type == 'InternalIP' - name: Derive MetalLB network prefix @@ -55,7 +54,7 @@ - name: Debug MetalLB network prefix ansible.builtin.debug: - msg: "kind_node_ip={{ kind_node_ip }} metallb_kind_net_prefix={{ metallb_kind_net_prefix }}" + msg: 'kind_node_ip={{ kind_node_ip }} metallb_kind_net_prefix={{ metallb_kind_net_prefix }}' - name: Apply MetalLB IP address pool kubernetes.core.k8s: @@ -74,3 +73,10 @@ set_values: - value: image.tag=latest - value: resources=null + +- name: Create kamaji tenant cluster namespace + kubernetes.core.k8s: + name: kamaji-tenants + api_version: v1 + kind: Namespace + state: present From dfbd02b6ba1e87e62c48d198d0f8d6b09bf8c832 Mon Sep 17 00:00:00 2001 From: mac641 Date: Thu, 12 Mar 2026 14:02:31 +0100 Subject: [PATCH 10/11] docs: adjust flavor wording as suggested by @vknabel --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index bab8c337..bdbf2a4d 100644 --- a/README.md +++ b/README.md @@ -190,12 +190,12 @@ make power-- ## Flavors -There are five flavors of the mini-lab environment: +All available mini-lab flavors are listed below: - `sonic`: runs two Community SONiC switches - `dell_sonic`: runs two Enterprise SONiC switches with a [locally built vrnetlab image](https://github.com/srl-labs/vrnetlab/tree/master/dell/dell_sonic) - `capms`: runs the `dell_sonic` flavor but with four instead of two machines (this is used for [cluster-provider-metal-stack](https://github.com/metal-stack/cluster-api-provider-metal-stack) in order to have dedicated hosts for control plane / worker / firewall) -- `kamaji`: runs the `sonic` flavor. The working example is available at the [cluster-provider-metal-stack](https://github.com/metal-stack/cluster-api-provider-metal-stack)'s `capi-lab`. +- `kamaji`: runs a variation of the `sonic` flavor. The working example is available at the [cluster-provider-metal-stack](https://github.com/metal-stack/cluster-api-provider-metal-stack)'s `capi-lab`. - `gardener`: runs the `sonic` flavor and installs the [Gardener](https://gardener.cloud) in the mini-lab In order to start specific flavor, you can define the flavor as follows: From cc90545377626376f1d58b87eecc7612ef892b8a Mon Sep 17 00:00:00 2001 From: mac641 Date: Thu, 12 Mar 2026 15:26:54 +0100 Subject: [PATCH 11/11] refactor(kamaji): remove unused debug step in ansible role --- roles/kamaji/tasks/main.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/roles/kamaji/tasks/main.yaml b/roles/kamaji/tasks/main.yaml index 487f4953..568c3da5 100644 --- a/roles/kamaji/tasks/main.yaml +++ b/roles/kamaji/tasks/main.yaml @@ -52,10 +52,6 @@ ansible.builtin.set_fact: metallb_kind_net_prefix: "{{ kind_node_ip | regex_replace('^([0-9]+\\.[0-9]+)\\..*$', '\\1') }}" -- name: Debug MetalLB network prefix - ansible.builtin.debug: - msg: 'kind_node_ip={{ kind_node_ip }} metallb_kind_net_prefix={{ metallb_kind_net_prefix }}' - - name: Apply MetalLB IP address pool kubernetes.core.k8s: state: present