-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathaction.yml
78 lines (66 loc) · 2.66 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
name: "Set up KinD"
description: "Step to start and configure KinD cluster"
inputs:
node-hostname:
description: "Hostname of the main kind node"
required: false
default: kind
cluster-name:
description: "Name of the KinD cluster"
required: false
default: cluster
runs:
using: "composite"
steps:
- name: Init directories
shell: bash
run: |
TEMP_DIR="$(pwd)/tmp"
mkdir -p "${TEMP_DIR}"
echo "TEMP_DIR=${TEMP_DIR}" >> $GITHUB_ENV
mkdir -p "$(pwd)/bin"
echo "$(pwd)/bin" >> $GITHUB_PATH
- name: Container image registry
shell: bash
run: |
podman run -d -p 5000:5000 --name registry registry:2.8.1
export REGISTRY_ADDRESS=$(hostname -i):5000
echo "REGISTRY_ADDRESS=${REGISTRY_ADDRESS}" >> $GITHUB_ENV
echo "Container image registry started at ${REGISTRY_ADDRESS}"
KIND_CONFIG_FILE=${{ env.TEMP_DIR }}/kind.yaml
echo "KIND_CONFIG_FILE=${KIND_CONFIG_FILE}" >> $GITHUB_ENV
envsubst < ${GITHUB_ACTION_PATH}/resouces/kind.yaml > ${KIND_CONFIG_FILE}
sudo --preserve-env=REGISTRY_ADDRESS sh -c 'cat > /etc/containers/registries.conf.d/local.conf <<EOF
[[registry]]
prefix = "$REGISTRY_ADDRESS"
insecure = true
location = "$REGISTRY_ADDRESS"
EOF'
- name: Setup KinD cluster
uses: helm/[email protected]
with:
cluster_name: ${{ inputs.cluster-name }}
version: v0.17.0
config: ${{ env.KIND_CONFIG_FILE }}
- name: Print cluster info
shell: bash
run: |
echo "KinD cluster:"
kubectl cluster-info
kubectl describe nodes
- name: Install Ingress controller
shell: bash
run: |
VERSION=controller-v1.6.4
echo "Deploying Ingress controller into KinD cluster"
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 -
kubectl annotate ingressclass nginx "ingressclass.kubernetes.io/is-default-class=true"
kubectl -n ingress-nginx wait --timeout=300s --for=condition=Available deployments --all
- name: Add ${{ inputs.node-hostname }} host to machine hosts
shell: bash
run: echo "127.0.0.1 ${{ inputs.node-hostname }}" | sudo tee -a /etc/hosts
- name: Set env variables for tests to properly leverage KinD cluster
shell: bash
run: |
echo "CLUSTER_TYPE=KIND" >> $GITHUB_ENV
echo "CLUSTER_HOSTNAME=${{ inputs.node-hostname }}" >> $GITHUB_ENV