Skip to content

Commit 89d9539

Browse files
committed
Add first flavors for cluster templates.
1 parent 2f57b12 commit 89d9539

File tree

9 files changed

+1027
-7
lines changed

9 files changed

+1027
-7
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ _artifacts
1111
Dockerfile.cross
1212
.release
1313

14+
infrastructure-metal-stack
1415
infrastructure-components.yaml
1516
.capms-cluster-kubeconfig.yaml
1617

Makefile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,14 @@ release-manifests: $(KUSTOMIZE) build-installer ## Builds the manifests to publi
5252
$(KUSTOMIZE) build config/default > $(RELEASE_DIR)/infrastructure-components.yaml
5353
sed -i 's!image: $(IMG_NAME):latest!image: $(IMG_NAME):$(IMG_TAG)!' $(RELEASE_DIR)/infrastructure-components.yaml
5454
cp metadata.yaml $(RELEASE_DIR)/metadata.yaml
55-
cp config/clusterctl-templates/cluster-template.yaml $(RELEASE_DIR)/cluster-template.yaml
55+
cp config/clusterctl-templates/cluster-template*.yaml $(RELEASE_DIR)/
5656
cp config/clusterctl-templates/example_variables.rc $(RELEASE_DIR)/example_variables.rc
5757

58+
ifneq ($(CI),true)
59+
# for devel purposes with local overwrite in clusterctl.yaml
60+
mkdir -p infrastructure-metal-stack && cd infrastructure-metal-stack && [ ! -L "$(shell git describe --tags `git rev-list --tags --max-count=1`)" ] && ln -s ../.release $(shell git describe --tags `git rev-list --tags --max-count=1`) || echo "devel symlink already exists"
61+
endif
62+
5863
##@ Development
5964

6065
.PHONY: push-to-capi-lab
@@ -147,7 +152,7 @@ test-e2e: manifests generate fmt vet ginkgo
147152
FIREWALL_SIZE=$(E2E_FIREWALL_SIZE) \
148153
FIREWALL_NETWORKS=$(E2E_FIREWALL_NETWORKS) \
149154
ARTIFACTS=$(ARTIFACTS) \
150-
$(GINKGO) -vv -r --junit-report="junit.e2e_suite.xml" --output-dir="$(ARTIFACTS)" --label-filter="$(E2E_LABEL_FILTER)" -timeout 60m ./test/e2e/frmwrk
155+
$(GINKGO) -vv -r --junit-report="junit.e2e_suite.xml" --output-dir="$(ARTIFACTS)" --label-filter="$(E2E_LABEL_FILTER)" -timeout 60m ./test/e2e/frmwrk
151156

152157
.PHONY: lint
153158
lint: golangci-lint ## Run golangci-lint linter

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,3 +163,12 @@ When generating your cluster, set `POD_CIDR` to your desired value.
163163
```bash
164164
export POD_CIDR=["10.240.0.0/12"]
165165
```
166+
167+
## Flavors
168+
169+
You might choose from different cluster template [flavors](https://cluster-api.sigs.k8s.io/clusterctl/commands/generate-cluster.html?highlight=flavor#flavors) to generate your manifest with clusterctl. Here is a table describing the available flavors:
170+
171+
| Name | Description | K8s Compatibility |
172+
| ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------- |
173+
| calico | Installs [calico](https://docs.tigera.io/calico/latest/about/) CNI along with [metal-ccm](https://github.com/metal-stack/metal-ccm). Depends on `ClusterResourceSet` and the [Add-on Provider for Helm](https://github.com/kubernetes-sigs/cluster-api-addon-provider-helm/tree/main). | >= v1.33 |
174+
| before-v1.33 | Contains working cluster manifests for K8s versions < v1.33. | < v1.33 |
Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
1+
---
2+
apiVersion: cluster.x-k8s.io/v1beta1
3+
kind: Cluster
4+
metadata:
5+
name: ${CLUSTER_NAME}
6+
namespace: ${NAMESPACE}
7+
spec:
8+
clusterNetwork:
9+
pods:
10+
cidrBlocks: ${POD_CIDR:=["10.240.0.0/12"]}
11+
controlPlaneRef:
12+
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
13+
kind: KubeadmControlPlane
14+
name: ${CLUSTER_NAME}-controlplane
15+
namespace: ${NAMESPACE}
16+
infrastructureRef:
17+
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
18+
kind: MetalStackCluster
19+
name: ${CLUSTER_NAME}
20+
namespace: ${NAMESPACE}
21+
---
22+
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
23+
kind: MetalStackCluster
24+
metadata:
25+
name: ${CLUSTER_NAME}
26+
namespace: ${NAMESPACE}
27+
spec:
28+
projectID: ${METAL_PROJECT_ID}
29+
partition: ${METAL_PARTITION}
30+
nodeNetworkID: ${METAL_NODE_NETWORK_ID}
31+
controlPlaneIP: ${CONTROL_PLANE_IP}
32+
---
33+
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
34+
kind: MetalStackMachineTemplate
35+
metadata:
36+
name: ${CLUSTER_NAME}-controlplane
37+
namespace: ${NAMESPACE}
38+
spec:
39+
template:
40+
spec:
41+
size: ${CONTROL_PLANE_MACHINE_SIZE}
42+
image: ${CONTROL_PLANE_MACHINE_IMAGE}
43+
---
44+
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
45+
kind: MetalStackMachineTemplate
46+
metadata:
47+
name: ${CLUSTER_NAME}-worker
48+
spec:
49+
template:
50+
spec:
51+
size: ${WORKER_MACHINE_SIZE}
52+
image: ${WORKER_MACHINE_IMAGE}
53+
---
54+
kind: KubeadmControlPlane
55+
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
56+
metadata:
57+
name: ${CLUSTER_NAME}-controlplane
58+
spec:
59+
replicas: ${CONTROL_PLANE_MACHINE_COUNT}
60+
version: ${KUBERNETES_VERSION}
61+
machineTemplate:
62+
nodeDrainTimeout: 10m
63+
infrastructureRef:
64+
kind: MetalStackMachineTemplate
65+
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
66+
name: ${CLUSTER_NAME}-controlplane
67+
kubeadmConfigSpec:
68+
format: ignition
69+
clusterConfiguration:
70+
apiServer:
71+
extraArgs:
72+
cloud-provider: external
73+
controllerManager:
74+
extraArgs:
75+
cloud-provider: external
76+
initConfiguration:
77+
localAPIEndpoint:
78+
advertiseAddress: 127.0.0.1
79+
bindPort: 443
80+
nodeRegistration:
81+
kubeletExtraArgs:
82+
cloud-provider: external
83+
joinConfiguration:
84+
controlPlane:
85+
localAPIEndpoint:
86+
advertiseAddress: 127.0.0.1
87+
bindPort: 443
88+
nodeRegistration:
89+
kubeletExtraArgs:
90+
cloud-provider: external
91+
files:
92+
- path: /etc/kubernetes/manifests/kubevip.yaml
93+
owner: root:root
94+
permissions: "0644"
95+
content: |
96+
apiVersion: v1
97+
kind: Pod
98+
metadata:
99+
name: kube-vip
100+
namespace: kube-system
101+
spec:
102+
containers:
103+
- args:
104+
- manager
105+
env:
106+
- name: vip_arp
107+
value: "false"
108+
- name: port
109+
value: "443"
110+
- name: vip_interface
111+
value: lo
112+
- name: cp_enable
113+
value: "true"
114+
- name: cp_namespace
115+
value: kube-system
116+
- name: bgp_enable
117+
value: "true"
118+
- name: bgp_routerid
119+
value: 127.0.0.1
120+
- name: bgp_as
121+
value: "METAL_MACHINE_ASN"
122+
- name: bgp_peeraddress
123+
value: 127.0.0.1
124+
- name: bgp_peerpass
125+
- name: bgp_peeras
126+
value: "METAL_MACHINE_ASN"
127+
- name: address
128+
value: ${CONTROL_PLANE_IP}
129+
image: ghcr.io/kube-vip/kube-vip:v0.8.10
130+
imagePullPolicy: IfNotPresent
131+
name: kube-vip
132+
resources: {}
133+
securityContext:
134+
capabilities:
135+
add:
136+
- NET_ADMIN
137+
- NET_RAW
138+
drop:
139+
- ALL
140+
volumeMounts:
141+
- mountPath: /etc/kubernetes/admin.conf
142+
name: kubeconfig
143+
hostAliases:
144+
- hostnames:
145+
- kubernetes
146+
ip: 127.0.0.1
147+
hostNetwork: true
148+
volumes:
149+
- hostPath:
150+
path: /etc/kubernetes/admin.conf
151+
name: kubeconfig
152+
153+
---
154+
apiVersion: cluster.x-k8s.io/v1beta1
155+
kind: MachineDeployment
156+
metadata:
157+
name: ${CLUSTER_NAME}-md-0
158+
labels:
159+
cluster.x-k8s.io/cluster-name: ${CLUSTER_NAME}
160+
nodepool: nodepool-0
161+
spec:
162+
clusterName: ${CLUSTER_NAME}
163+
replicas: ${WORKER_MACHINE_COUNT}
164+
selector:
165+
matchLabels:
166+
cluster.x-k8s.io/cluster-name: ${CLUSTER_NAME}
167+
nodepool: nodepool-0
168+
template:
169+
metadata:
170+
labels:
171+
cluster.x-k8s.io/cluster-name: ${CLUSTER_NAME}
172+
nodepool: nodepool-0
173+
spec:
174+
nodeDrainTimeout: 120s
175+
clusterName: ${CLUSTER_NAME}
176+
version: "${KUBERNETES_VERSION}"
177+
bootstrap:
178+
configRef:
179+
name: ${CLUSTER_NAME}-md-0
180+
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
181+
kind: KubeadmConfigTemplate
182+
infrastructureRef:
183+
name: ${CLUSTER_NAME}-worker
184+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
185+
kind: MetalStackMachineTemplate
186+
---
187+
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
188+
kind: KubeadmConfigTemplate
189+
metadata:
190+
name: ${CLUSTER_NAME}-md-0
191+
spec:
192+
template:
193+
spec:
194+
format: ignition
195+
clusterConfiguration:
196+
apiServer:
197+
extraArgs:
198+
cloud-provider: external
199+
controllerManager:
200+
extraArgs:
201+
cloud-provider: external
202+
joinConfiguration:
203+
nodeRegistration:
204+
kubeletExtraArgs:
205+
cloud-provider: external

0 commit comments

Comments
 (0)