Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use daemonset for machineid instead of docker mount #8

Merged
merged 1 commit into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions manifests/haproxy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: haproxy-config
namespace: metallb-system
data:
haproxy.cfg: |
global
Expand Down Expand Up @@ -69,7 +68,6 @@ apiVersion: apps/v1
kind: DaemonSet
metadata:
name: haproxy
namespace: metallb-system
spec:
selector:
matchLabels:
Expand Down
41 changes: 41 additions & 0 deletions manifests/machineid.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: ensure-machine-id
labels:
app: ensure-machine-id
spec:
selector:
matchLabels:
name: ensure-machine-id
template:
metadata:
labels:
name: ensure-machine-id
spec:
initContainers:
- name: generate-machine-id
image: cgr.dev/chainguard/wolfi-base:latest
command: ["/bin/sh", "-c"]
args:
- echo "B0D07F1F43F246409516ADBDCCC86FCE" > /mnt/host/etc/machine-id;
volumeMounts:
- name: machine-id
mountPath: /mnt/host/etc
readOnly: false
securityContext:
privileged: true
runAsUser: 0
containers:
- name: pause
image: k8s.gcr.io/pause:3.1
resources:
limits:
cpu: "0.1"
memory: "50Mi"
volumes:
- name: machine-id
hostPath:
path: /etc

hostPID: true
2 changes: 0 additions & 2 deletions manifests/metallb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ apiVersion: metallb.io/v1beta1
kind: IPAddressPool
metadata:
name: dev
namespace: metallb-system
spec:
addresses:
- "###ZARF_VAR_BASE_IP###.200-###ZARF_VAR_BASE_IP###.215"
Expand All @@ -11,4 +10,3 @@ apiVersion: metallb.io/v1beta1
kind: L2Advertisement
metadata:
name: empty
namespace: metallb-system
22 changes: 9 additions & 13 deletions zarf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ components:
actions:
onDeploy:
before:
- cmd: echo "B0D07F1F43F246409516ADBDCCC86FCE" > tmp-machine-id
description: "Create a machine-id file for the nodes"
- cmd: |
k3d cluster create \
-p "80:20080@server:*" \
Expand All @@ -47,27 +45,23 @@ components:
--k3s-arg "--disable=metrics-server@server:*" \
--k3s-arg "--disable=servicelb@server:*" \
--image ${ZARF_VAR_K3D_IMAGE} \
--volume $(pwd)/tmp-machine-id:/etc/machine-id@server:* \
${ZARF_VAR_CLUSTER_NAME}
description: "Create the cluster"
after:
- cmd: rm -f tmp-machine-id
onSuccess:
- cmd: |
echo "You can access this cluster over SSH (note http redirect will redirect to port 80 instead of 8080):"
echo "ssh -N -L 8080:localhost:80 -L 8443:localhost:443 -L 6550:localhost:6550"
echo
echo "To get the kubeconfig:"
echo "k3d kubeconfig get ${ZARF_VAR_CLUSTER_NAME}"
echo
echo "This cluster can be destroyed with:"
echo "k3d cluster delete ${ZARF_VAR_CLUSTER_NAME}"
description: "Print out information about how to access the cluster remotely"
onRemove:
before:
- cmd: k3d cluster delete ${ZARF_VAR_CLUSTER_NAME}
description: "Destroy the cluster"

- name: loadbalancer-stack
- name: uds-dev-stack
required: true
description: "Install MetalLB and HAProxy to provide a load balancer for the cluster"
description: "Install MetalLB, HAProxy, and Ensure MachineID to meet UDS developer needs without later config changes"
actions:
onDeploy:
before:
Expand All @@ -78,10 +72,12 @@ components:
charts:
- name: metallb
url: https://metallb.github.io/metallb
namespace: metallb-system
namespace: uds-dev-stack
version: 0.13.11
manifests:
- name: metallb-config
- name: uds-dev-stack
namespace: uds-dev-stack
files:
- "manifests/machineid.yaml"
- "manifests/metallb.yaml"
- "manifests/haproxy.yaml"