diff --git a/docs/assets/scripts/developer/k3d-dev.sh b/docs/assets/scripts/developer/k3d-dev.sh index 56b81d995b2239898f5c74b7f3dfc9593aee9e55..c0a4d0dc894c4655dc321f4eed4258c613d5e5fd 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 0000000000000000000000000000000000000000..ad1c7493a30ac3d19e2fc257f6b71aa79364c57f --- /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 +