@@ -63,10 +63,113 @@ jobs:
6363 - name : Setup NVidia GPU environment for KinD
6464 uses : ./common/github-actions/nvidia-gpu-setup
6565
66- - name : Setup and start KinD cluster
67- uses : ./common/github-actions/kind
66+ - name : Init directories
67+ run : |
68+ TEMP_DIR="$(pwd)/tmp"
69+ mkdir -p "${TEMP_DIR}"
70+ echo "TEMP_DIR=${TEMP_DIR}" >> $GITHUB_ENV
71+
72+ mkdir -p "$(pwd)/bin"
73+ echo "$(pwd)/bin" >> $GITHUB_PATH
74+
75+ - name : Container image registry
76+ run : |
77+ podman run -d -p 5000:5000 --name registry registry:2.8.1
78+
79+ export NODE_IMAGE="kindest/node:v1.26.0@sha256:691e24bd2417609db7e589e1a479b902d2e209892a10ce375fab60a8407c7352"
80+
81+ export REGISTRY_ADDRESS=$(hostname -i):5000
82+ echo "REGISTRY_ADDRESS=${REGISTRY_ADDRESS}" >> $GITHUB_ENV
83+ echo "Container image registry started at ${REGISTRY_ADDRESS}"
84+
85+ KIND_CONFIG_FILE=${TEMP_DIR}/kind.yaml
86+
87+ # Create KIND config with 1 worker node
88+ cat > ${KIND_CONFIG_FILE} <<EOF
89+ kind : Cluster
90+ apiVersion : kind.x-k8s.io/v1alpha4
91+ containerdConfigPatches :
92+ - |-
93+ [plugins."io.containerd.grpc.v1.cri".registry.mirrors."${REGISTRY_ADDRESS}"]
94+ endpoint = ["http://${REGISTRY_ADDRESS}"]
95+ nodes :
96+ - role : control-plane
97+ image : ${NODE_IMAGE}
98+ kubeadmConfigPatches :
99+ - |
100+ kind: InitConfiguration
101+ nodeRegistration:
102+ kubeletExtraArgs:
103+ node-labels: "ingress-ready=true"
104+ extraPortMappings :
105+ - containerPort : 80
106+ hostPort : 80
107+ protocol : TCP
108+ - containerPort : 443
109+ hostPort : 443
110+ protocol : TCP
111+ - role : worker
112+ image : ${NODE_IMAGE}
113+ labels :
114+ worker-1 : true
115+ extraMounts :
116+ - hostPath : /dev/null
117+ containerPath : /var/run/nvidia-container-devices/all
118+ EOF
119+
120+ echo "KIND_CONFIG_FILE=${KIND_CONFIG_FILE}" >> $GITHUB_ENV
121+
122+ sudo --preserve-env=REGISTRY_ADDRESS sh -c 'cat > /etc/containers/registries.conf.d/local.conf <<EOF
123+ [[registry]]
124+ prefix = "$REGISTRY_ADDRESS"
125+ insecure = true
126+ location = "$REGISTRY_ADDRESS"
127+ EOF'
128+
129+ - name : Setup KinD cluster
130+ 68131 with :
69- worker-nodes : 1
132+ cluster_name : cluster
133+ version : v0.17.0
134+ config : ${{ env.KIND_CONFIG_FILE }}
135+
136+ - name : Print cluster info
137+ run : |
138+ echo "KinD cluster:"
139+ kubectl cluster-info
140+ kubectl describe nodes
141+
142+ - name : Install Ingress controller
143+ run : |
144+ VERSION=controller-v1.9.6
145+ echo "Deploying Ingress controller into KinD cluster"
146+ curl https://raw.githubusercontent.com/kubernetes/ingress-nginx/"${VERSION}"/deploy/static/provider/kind/deploy.yaml | sed "s/--publish-status-address=localhost/--report-node-internal-ip-address\\n - --status-update-interval=10/g" | kubectl apply -f -
147+ kubectl annotate ingressclass nginx "ingressclass.kubernetes.io/is-default-class=true"
148+ # Turn on SSL Passthrough
149+ kubectl patch deploy --type json --patch '[{"op":"add","path": "/spec/template/spec/containers/0/args/-","value":"--enable-ssl-passthrough"}]' ingress-nginx-controller -n ingress-nginx
150+
151+ kubectl -n ingress-nginx wait --timeout=300s --for=condition=Available deployments --all
152+
153+ - name : Setup Dnsmasq to resolve hostnames with domain name kind
154+ run : |
155+ # Based on https://sixfeetup.com/blog/local-development-with-wildcard-dns-on-linux
156+ sudo apt-get install -y dnsmasq
157+
158+ sudo sed -i -E "s/#DNS=/DNS=127.0.0.2/" /etc/systemd/resolved.conf
159+ sudo sed -i -E "s/#Domains=/Domains=~kind/" /etc/systemd/resolved.conf
160+ sudo systemctl restart systemd-resolved
161+
162+ sudo sed -i -E "s/#IGNORE_RESOLVCONF=yes/IGNORE_RESOLVCONF=yes/" /etc/default/dnsmasq
163+ sudo sed -i -E "s/#listen-address=/listen-address=127.0.0.2/" /etc/dnsmasq.conf
164+ sudo sed -i -E "s/#bind-interfaces/bind-interfaces/" /etc/dnsmasq.conf
165+ sudo sed -i -E "s|#(address=).*|\1/kind/127.0.0.1|" /etc/dnsmasq.conf
166+ sudo systemctl restart dnsmasq
167+ systemctl status dnsmasq
168+
169+ - name : Set env variables for tests to properly leverage KinD cluster
170+ run : |
171+ echo "CLUSTER_TYPE=KIND" >> $GITHUB_ENV
172+ echo "CLUSTER_HOSTNAME=kind" >> $GITHUB_ENV
70173
71174 - name : Install NVidia GPU operator for KinD
72175 uses : ./common/github-actions/nvidia-gpu-operator
0 commit comments