-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaction.yaml
84 lines (77 loc) · 2.68 KB
/
action.yaml
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
79
80
81
82
83
84
name: "Kind Cluster with internal container registry"
description: "Create a kind (Kubernetes IN Docker) cluster with an internal container registry"
author: "bakito"
inputs:
kind_version:
description: 'The version of kind to use'
required: false
# renovate: github-releases kubernetes-sigs/kind
default: 'v0.26.0'
kubectl_version:
description: 'The version of kubectl to use'
required: false
# renovate: custom.k8s kubectl
default: 'v1.31.0'
node_image:
description: 'The version of node image to use'
required: false
# renovate: docker
default: 'kindest/node:v1.32.1'
ingress_enabled:
description: 'enable ingress for the cluster'
required: false
default: false
ingress_version:
description: 'The ingress controller version (git tag)'
required: false
default: helm-chart-4.11.3
registry_image:
description: 'The registry docker image to be used'
required: false
# renovate: docker
default: 'registry:2'
outputs:
ingress_class_name:
description: 'The name of the ingress class'
value: 'nginx'
registry:
description: 'The address of the docker registry'
value: 'localhost:5001'
runs:
using: "composite"
steps:
- name: Install Helm
uses: azure/[email protected]
- name: Install jq
uses: dcarbone/[email protected]
- name: Install yq
uses: dcarbone/[email protected]
- name: Install Chainsaw
uses: kyverno/[email protected]
- name: Set up Registry Container
shell: bash
run: |
docker run -d --restart=always -p "127.0.0.1:5001:5000" --name kind-registry ${{ inputs.registry_image }}
- name: Create kind cluster
uses: helm/[email protected]
with:
version: ${{ inputs.kind_version }}
kubectl_version: ${{ inputs.kubectl_version }}
node_image: ${{ inputs.node_image }}
config: ${{ github.action_path }}/kind-config.yaml
- name: Set up Local Registry
shell: bash
run: |
# https://kind.sigs.k8s.io/docs/user/local-registry/
docker network connect kind kind-registry
kubectl apply -f ${{ github.action_path }}/configmap-registry.yaml
- name: Set up Ingress
if: ${{ inputs.ingress_enabled == 'true' }}
shell: bash
run: |
# https://kind.sigs.k8s.io/docs/user/ingress/
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/${{ inputs.ingress_version }}/deploy/static/provider/kind/deploy.yaml
kubectl wait --namespace ingress-nginx \
--for=condition=ready pod \
--selector=app.kubernetes.io/component=controller \
--timeout=90s