|
1 | 1 | # @engineerd/setup-kind |
2 | 2 |
|
3 | | -Setup [KinD (Kubernetes in Docker)](https://kind.sigs.k8s.io/) with a single GitHub Action! |
| 3 | +Setup [KinD (Kubernetes in Docker)](https://kind.sigs.k8s.io/) with a single |
| 4 | +GitHub Action! |
4 | 5 |
|
5 | | -> This action assumes a Linux environment, and will _not_ work on Windows or MacOS agents. |
| 6 | +> Because of a [deprecation in the GitHub Actions environment][gh-actions-path], |
| 7 | +> versions lower than v0.5.0 will no longer work properly. See [this |
| 8 | +> issue][path-issue] for more details. |
6 | 9 |
|
7 | | -``` |
| 10 | +> This action assumes a Linux environment, and will _not_ work on Windows or |
| 11 | +> MacOS agents. |
| 12 | +
|
| 13 | +```yaml |
8 | 14 | name: "Create cluster using KinD" |
9 | 15 | on: [pull_request, push] |
10 | 16 |
|
11 | 17 | jobs: |
12 | 18 | kind: |
13 | 19 | runs-on: ubuntu-latest |
14 | 20 | steps: |
15 | | - - uses: actions/checkout@master |
16 | | - - uses: engineerd/setup-kind@v0.4.0 |
17 | | - - name: Testing |
18 | | - run: | |
19 | | - kubectl cluster-info |
20 | | - kubectl get pods -n kube-system |
21 | | - echo "current-context:" $(kubectl config current-context) |
22 | | - echo "environment-kubeconfig:" ${KUBECONFIG} |
| 21 | + - uses: actions/checkout@master |
| 22 | + - uses: engineerd/setup-kind@v0.5.0 |
| 23 | + - name: Testing |
| 24 | + run: | |
| 25 | + kubectl cluster-info |
| 26 | + kubectl get pods -n kube-system |
| 27 | + echo "current-context:" $(kubectl config current-context) |
| 28 | + echo "environment-kubeconfig:" ${KUBECONFIG} |
23 | 29 | ``` |
24 | 30 |
|
25 | | -> Note: KUBECONFIG is automatically merged after cluster creation starting with version 0.6 of Kind. See [this document for a detailed migration guide][kind-kubeconfig] |
| 31 | +> Note: KUBECONFIG is automatically merged after cluster creation starting with |
| 32 | +> version 0.6 of Kind. See [this document for a detailed migration |
| 33 | +> guide][kind-kubeconfig] |
26 | 34 |
|
27 | 35 | > Note: GitHub Actions workers come pre-configured with `kubectl`. |
28 | 36 |
|
29 | | -The following arguments can be configured on the job using the `with` keyword (see example above). |
30 | | -Currently, possible inputs are all the flags for `kind cluster create`, with the additional version, which sets the Kind version to downloadm and `skipClusterCreation`, which when present, skips creating the cluster (the Kind tools is configured in the path). |
| 37 | +The following arguments can be configured on the job using the `with` keyword |
| 38 | +(see example above). Currently, possible inputs are all the flags for |
| 39 | +`kind cluster create`, with the additional version, which sets the Kind version |
| 40 | +to downloadm and `skipClusterCreation`, which when present, skips creating the |
| 41 | +cluster (the Kind tools is configured in the path). |
31 | 42 |
|
32 | 43 | Optional inputs: |
33 | 44 |
|
34 | 45 | - `version`: version of Kind to use (default `"v0.7.0"`) |
35 | | -- `config`: path (relative to the root of the repository) to a kind config file. If omitted, a default 1-node cluster will be created |
| 46 | +- `config`: path (relative to the root of the repository) to a kind config file. |
| 47 | + If omitted, a default 1-node cluster will be created |
36 | 48 | - `image`: node Docker image to use for booting the cluster. |
37 | 49 | - `name`: cluster context name (default `"kind-kind"`) |
38 | 50 | - `wait`: wait for control plane node to be ready (default `"300s"`) |
39 | | -- `skipClusterCreation`: if `"true"`, the action will not create a cluster, just acquire the tools |
| 51 | +- `skipClusterCreation`: if `"true"`, the action will not create a cluster, just |
| 52 | + acquire the tools |
40 | 53 |
|
41 | 54 | Example using optional inputs: |
42 | 55 |
|
43 | | -``` |
| 56 | +```yaml |
44 | 57 | name: "Create cluster using KinD" |
45 | 58 | on: [pull_request, push] |
46 | 59 |
|
47 | 60 | jobs: |
48 | 61 | kind: |
49 | 62 | runs-on: ubuntu-latest |
50 | 63 | steps: |
51 | | - - uses: actions/checkout@master |
52 | | - - uses: engineerd/setup-kind@v0.4.0 |
53 | | - with: |
| 64 | + - uses: actions/checkout@master |
| 65 | + - uses: engineerd/setup-kind@v0.5.0 |
| 66 | + with: |
54 | 67 | version: "v0.7.0" |
55 | | - - name: Testing |
56 | | - run: | |
57 | | - kubectl cluster-info |
58 | | - kubectl get pods -n kube-system |
59 | | - echo "current-context:" $(kubectl config current-context) |
60 | | - echo "environment-kubeconfig:" ${KUBECONFIG} |
| 68 | + - name: Testing |
| 69 | + run: | |
| 70 | + kubectl cluster-info |
| 71 | + kubectl get pods -n kube-system |
| 72 | + echo "current-context:" $(kubectl config current-context) |
| 73 | + echo "environment-kubeconfig:" ${KUBECONFIG} |
61 | 74 | ``` |
62 | 75 |
|
63 | 76 | [kind-kubeconfig]: https://github.com/kubernetes-sigs/kind/issues/1060 |
| 77 | +[gh-actions-path]: |
| 78 | + https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/ |
| 79 | +[path-issue]: https://github.com/engineerd/setup-kind/issues/28 |
0 commit comments