Skip to content

Commit d08cf6f

Browse files
authored
resolve --log-level deprecation and replace to --verbosity (#64)
* resolve --log-level deprecation and use --verbosity Signed-off-by: cpanato <ctadeu@gmail.com> * upgrade kind to v0.14.0 Signed-off-by: cpanato <ctadeu@gmail.com> * update action checkout Signed-off-by: cpanato <ctadeu@gmail.com> * update readme Signed-off-by: cpanato <ctadeu@gmail.com> * add extra test Signed-off-by: cpanato <ctadeu@gmail.com> * update to use node16 Signed-off-by: cpanato <ctadeu@gmail.com>
1 parent deab45f commit d08cf6f

File tree

5 files changed

+60
-26
lines changed

5 files changed

+60
-26
lines changed

.github/workflows/test.yaml

+34-2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,22 @@ jobs:
2222
kubectl cluster-info
2323
kubectl get storageclass standard
2424
25+
test-with-custom-verbosity:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v3
30+
31+
- name: Create kind cluster with custom verbosity
32+
uses: ./
33+
with:
34+
verbosity: 10
35+
36+
- name: Test
37+
run: |
38+
kubectl cluster-info
39+
kubectl get storageclass standard
40+
2541
test-with-custom-name:
2642
runs-on: ubuntu-latest
2743
steps:
@@ -42,7 +58,7 @@ jobs:
4258
runs-on: ubuntu-latest
4359
steps:
4460
- name: Checkout
45-
uses: actions/checkout@v2
61+
uses: actions/checkout@v3
4662

4763
- name: Only install kind without starting a cluster
4864
uses: ./
@@ -53,7 +69,7 @@ jobs:
5369
run: |
5470
[[ $(kind get clusters | wc -l) -eq 0 ]]
5571
56-
test-with-custom-k8s-version:
72+
test-with-custom-kubectl-version:
5773
runs-on: ubuntu-latest
5874
steps:
5975
- name: Checkout
@@ -68,3 +84,19 @@ jobs:
6884
run: |
6985
kubectl cluster-info
7086
kubectl get nodes
87+
88+
test-with-custom-node-image:
89+
runs-on: ubuntu-latest
90+
steps:
91+
- name: Checkout
92+
uses: actions/checkout@v3
93+
94+
- name: Create kind cluster with custom name
95+
uses: ./
96+
with:
97+
node_image: "kindest/node:v1.24.0"
98+
99+
- name: Test
100+
run: |
101+
kubectl cluster-info
102+
kubectl get nodes

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ For more information, reference the GitHub Help Documentation for [Creating a wo
1515

1616
For more information on inputs, see the [API Documentation](https://developer.github.com/v3/repos/releases/#input)
1717

18-
- `version`: The kind version to use (default: `v0.12.0`)
18+
- `version`: The kind version to use (default: `v0.14.0`)
1919
- `config`: The path to the kind config file
2020
- `node_image`: The Docker image for the cluster nodes
2121
- `cluster_name`: The name of the cluster to create (default: `chart-testing`)
2222
- `wait`: The duration to wait for the control plane to become ready (default: `60s`)
23-
- `log_level`: The log level for kind
24-
- `kubectl_version`: The kubectl version to use (default: v1.21.10)
23+
- `verbosity`: info log verbosity, higher value produces more output
24+
- `kubectl_version`: The kubectl version to use (default: v1.22.10)
2525
- `install_only`: Skips cluster creation, only install kind (default: false)
2626

2727
### Example Workflow
@@ -38,7 +38,7 @@ jobs:
3838
runs-on: ubuntu-latest
3939
steps:
4040
- name: Create k8s Kind Cluster
41-
uses: helm/kind-action@v1.2.0
41+
uses: helm/kind-action@v1.3.0
4242
```
4343
4444
This uses [@helm/kind-action](https://www.github.com/helm/kind-action) GitHub Action to spin up a [kind](https://kind.sigs.k8s.io/) Kubernetes cluster on every Pull Request.

action.yml

+9-7
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ branding:
66
icon: box
77
inputs:
88
version:
9-
description: "The kind version to use (default: v0.12.0)"
9+
description: "The kind version to use (default: v0.14.0)"
1010
required: false
11-
default: "v0.12.0"
11+
default: "v0.14.0"
1212
config:
1313
description: "The path to the kind config file"
1414
required: false
@@ -23,16 +23,18 @@ inputs:
2323
description: "The duration to wait for the control plane to become ready (default: 60s)"
2424
required: false
2525
default: "60s"
26-
log_level:
27-
description: "The log level for kind"
26+
verbosity:
27+
description: "The verbosity level for kind (default: 0)"
28+
default: "0"
2829
required: false
2930
kubectl_version:
30-
description: "The kubectl version to use (default: v1.21.10)"
31+
description: "The kubectl version to use (default: v1.22.10)"
3132
required: false
32-
default: "v1.21.10"
33+
default: "v1.22.10"
3334
install_only:
3435
description: "Skips cluster creation, only install kind (default: false)"
36+
required: false
3537
runs:
36-
using: "node12"
38+
using: "node16"
3739
main: "main.js"
3840
post: "cleanup.js"

kind.sh

+11-11
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,21 @@ set -o errexit
1818
set -o nounset
1919
set -o pipefail
2020

21-
DEFAULT_KIND_VERSION=v0.12.0
21+
DEFAULT_KIND_VERSION=v0.14.0
2222
DEFAULT_CLUSTER_NAME=chart-testing
23-
DEFAULT_KUBECTL_VERSION=v1.21.10
23+
DEFAULT_KUBECTL_VERSION=v1.22.10
2424

2525
show_help() {
2626
cat << EOF
2727
Usage: $(basename "$0") <options>
2828
29-
-h, --help Display help
29+
--help Display help
3030
-v, --version The kind version to use (default: $DEFAULT_KIND_VERSION)
3131
-c, --config The path to the kind config file
3232
-i, --node-image The Docker image for the cluster nodes
3333
-n, --cluster-name The name of the cluster to create (default: chart-testing)
3434
-w, --wait The duration to wait for the control plane to become ready (default: 60s)
35-
-l, --log-level The log level for kind [panic, fatal, error, warning, info, debug, trace] (default: warning)
35+
-l, --verbosity info log verbosity, higher value produces more output
3636
-k, --kubectl-version The kubectl version to use (default: $DEFAULT_KUBECTL_VERSION)
3737
-o, --install-only Skips cluster creation, only install kind (default: false)
3838
@@ -45,7 +45,7 @@ main() {
4545
local node_image=
4646
local cluster_name="$DEFAULT_CLUSTER_NAME"
4747
local wait=60s
48-
local log_level=
48+
local verbosity=
4949
local kubectl_version="$DEFAULT_KUBECTL_VERSION"
5050
local install_only=false
5151

@@ -91,7 +91,7 @@ parse_command_line() {
9191
show_help
9292
exit
9393
;;
94-
-v|--version)
94+
--version)
9595
if [[ -n "${2:-}" ]]; then
9696
version="$2"
9797
shift
@@ -141,12 +141,12 @@ parse_command_line() {
141141
exit 1
142142
fi
143143
;;
144-
-l|--log-level)
144+
-v|--verbosity)
145145
if [[ -n "${2:-}" ]]; then
146-
log_level="$2"
146+
verbosity="$2"
147147
shift
148148
else
149-
echo "ERROR: '--log-level' cannot be empty." >&2
149+
echo "ERROR: '--verbosity' cannot be empty." >&2
150150
show_help
151151
exit 1
152152
fi
@@ -208,8 +208,8 @@ create_kind_cluster() {
208208
args+=("--config=$config")
209209
fi
210210

211-
if [[ -n "$log_level" ]]; then
212-
args+=("--loglevel=$log_level")
211+
if [[ -n "$verbosity" ]]; then
212+
args+=("--verbosity=$verbosity")
213213
fi
214214

215215
"$kind_dir/kind" "${args[@]}"

main.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ main() {
4343
args+=(--wait "${INPUT_WAIT}")
4444
fi
4545

46-
if [[ -n "${INPUT_LOG_LEVEL:-}" ]]; then
47-
args+=(--log-level "${INPUT_LOG_LEVEL}")
46+
if [[ -n "${INPUT_VERBOSITY:-}" ]]; then
47+
args+=(--verbosity "${INPUT_VERBOSITY}")
4848
fi
4949

5050
if [[ -n "${INPUT_KUBECTL_VERSION:-}" ]]; then

0 commit comments

Comments
 (0)