From c0e06fb8c4a9c4c03e11a66eedb5e6955f098dca Mon Sep 17 00:00:00 2001 From: Jonathan Braswell <jonathan@radiusmethod.com> Date: Thu, 26 Oct 2023 14:31:29 +0000 Subject: [PATCH] modify k3d-dev.sh to use ib metallb images --- docs/assets/scripts/developer/k3d-dev.sh | 25 ++++++++-- .../developer/metallb/kustomization.yaml | 47 +++++++++++++++++++ 2 files changed, 68 insertions(+), 4 deletions(-) create mode 100644 docs/assets/scripts/developer/metallb/kustomization.yaml diff --git a/docs/assets/scripts/developer/k3d-dev.sh b/docs/assets/scripts/developer/k3d-dev.sh index 56b81d995b..c0a4d0dc89 100755 --- a/docs/assets/scripts/developer/k3d-dev.sh +++ b/docs/assets/scripts/developer/k3d-dev.sh @@ -688,10 +688,27 @@ fi # Handle MetalLB cluster resource creation if [[ "${METAL_LB}" == true || "${ATTACH_SECONDARY_IP}" == true ]]; then echo "Installing MetalLB..." - run "kubectl create -f https://raw.githubusercontent.com/metallb/metallb/v0.13.9/config/manifests/metallb-native.yaml" - # Wait for controller to be live so that validating webhooks function when we apply the config - echo "Waiting for MetalLB controller..." - run "kubectl wait --for=condition=available --timeout 120s -n metallb-system deployment controller" + + until [[ ${REGISTRY_USERNAME} ]]; do + read -p "Please enter your Registry1 username: " REGISTRY_USERNAME + done + until [[ ${REGISTRY_PASSWORD} ]]; do + read -s -p "Please enter your Registry1 password: " REGISTRY_PASSWORD + done + run "kubectl create namespace metallb-system" + run "kubectl create secret docker-registry registry1 \ + --docker-server=registry1.dso.mil \ + --docker-username=${REGISTRY_USERNAME} \ + --docker-password=${REGISTRY_PASSWORD} \ + -n metallb-system" + + run "mkdir /tmp/metallb" + scp -i ~/.ssh/${KeyName}.pem -o StrictHostKeyChecking=no -o IdentitiesOnly=yes ${SCRIPT_DIR}/metallb/* ubuntu@${PublicIP}:/tmp/metallb + run "kubectl apply -k /tmp/metallb" + + # Wait for controller to be live so that validating webhooks function when we apply the config + echo "Waiting for MetalLB controller..." + run "kubectl wait --for=condition=available --timeout 120s -n metallb-system deployment controller" echo "MetalLB is installed." if [[ "$METAL_LB" == true ]]; then diff --git a/docs/assets/scripts/developer/metallb/kustomization.yaml b/docs/assets/scripts/developer/metallb/kustomization.yaml new file mode 100644 index 0000000000..ad1c7493a3 --- /dev/null +++ b/docs/assets/scripts/developer/metallb/kustomization.yaml @@ -0,0 +1,47 @@ +resources: + - https://raw.githubusercontent.com/metallb/metallb/v0.13.12/config/manifests/metallb-native.yaml + +images: + - name: quay.io/metallb/controller + newName: registry1.dso.mil/ironbank/opensource/metallb/controller + newTag: v0.13.12 + - name: quay.io/metallb/speaker + newName: registry1.dso.mil/ironbank/opensource/metallb/speaker + newTag: v0.13.12 + +patches: + - target: + kind: Deployment + name: controller + patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: controller + spec: + template: + spec: + imagePullSecrets: + - name: registry1 + securityContext: + fsGroup: 65532 + runAsNonRoot: true + runAsUser: 65532 + runAsGroup: 65532 + - target: + kind: DaemonSet + name: speaker + patch: |- + apiVersion: apps/v1 + kind: DaemonSet + metadata: + name: speaker + spec: + template: + spec: + imagePullSecrets: + - name: registry1 + securityContext: + fsGroup: 65532 + runAsUser: 0 + -- GitLab