From a2de67ff99353f9e47d73164d7512f964fac938f Mon Sep 17 00:00:00 2001 From: cpanato Date: Tue, 14 Jun 2022 11:29:18 +0200 Subject: [PATCH 1/6] resolve --log-level deprecation and use --verbosity Signed-off-by: cpanato --- .github/workflows/test.yaml | 16 ++++++++++++++++ action.yml | 10 ++++++---- kind.sh | 22 +++++++++++----------- main.sh | 4 ++-- 4 files changed, 35 insertions(+), 17 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 94f096d..e241c7f 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -22,6 +22,22 @@ jobs: kubectl cluster-info kubectl get storageclass standard + test-with-custom-verbosity: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Create kind cluster with custom verbosity + uses: ./ + with: + verbosity: 10 + + - name: Test + run: | + kubectl cluster-info + kubectl get storageclass standard + test-with-custom-name: runs-on: ubuntu-latest steps: diff --git a/action.yml b/action.yml index 67f5f97..8086053 100644 --- a/action.yml +++ b/action.yml @@ -23,15 +23,17 @@ inputs: description: "The duration to wait for the control plane to become ready (default: 60s)" required: false default: "60s" - log_level: - description: "The log level for kind" + verbosity: + description: "The verbosity level for kind (default: 0)" + default: "0" required: false kubectl_version: - description: "The kubectl version to use (default: v1.21.10)" + description: "The kubectl version to use (default: v1.22.10)" required: false - default: "v1.21.10" + default: "v1.22.10" install_only: description: "Skips cluster creation, only install kind (default: false)" + required: false runs: using: "node12" main: "main.js" diff --git a/kind.sh b/kind.sh index 4fc5d2c..515038d 100755 --- a/kind.sh +++ b/kind.sh @@ -18,21 +18,21 @@ set -o errexit set -o nounset set -o pipefail -DEFAULT_KIND_VERSION=v0.12.0 +DEFAULT_KIND_VERSION=v0.14.0 DEFAULT_CLUSTER_NAME=chart-testing -DEFAULT_KUBECTL_VERSION=v1.21.10 +DEFAULT_KUBECTL_VERSION=v1.22.10 show_help() { cat << EOF Usage: $(basename "$0") - -h, --help Display help + --help Display help -v, --version The kind version to use (default: $DEFAULT_KIND_VERSION) -c, --config The path to the kind config file -i, --node-image The Docker image for the cluster nodes -n, --cluster-name The name of the cluster to create (default: chart-testing) -w, --wait The duration to wait for the control plane to become ready (default: 60s) - -l, --log-level The log level for kind [panic, fatal, error, warning, info, debug, trace] (default: warning) + -l, --verbosity info log verbosity, higher value produces more output -k, --kubectl-version The kubectl version to use (default: $DEFAULT_KUBECTL_VERSION) -o, --install-only Skips cluster creation, only install kind (default: false) @@ -45,7 +45,7 @@ main() { local node_image= local cluster_name="$DEFAULT_CLUSTER_NAME" local wait=60s - local log_level= + local verbosity= local kubectl_version="$DEFAULT_KUBECTL_VERSION" local install_only=false @@ -91,7 +91,7 @@ parse_command_line() { show_help exit ;; - -v|--version) + --version) if [[ -n "${2:-}" ]]; then version="$2" shift @@ -141,12 +141,12 @@ parse_command_line() { exit 1 fi ;; - -l|--log-level) + -v|--verbosity) if [[ -n "${2:-}" ]]; then - log_level="$2" + verbosity="$2" shift else - echo "ERROR: '--log-level' cannot be empty." >&2 + echo "ERROR: '--verbosity' cannot be empty." >&2 show_help exit 1 fi @@ -208,8 +208,8 @@ create_kind_cluster() { args+=("--config=$config") fi - if [[ -n "$log_level" ]]; then - args+=("--loglevel=$log_level") + if [[ -n "$verbosity" ]]; then + args+=("--verbosity=$verbosity") fi "$kind_dir/kind" "${args[@]}" diff --git a/main.sh b/main.sh index b41b9d2..6fa5185 100755 --- a/main.sh +++ b/main.sh @@ -43,8 +43,8 @@ main() { args+=(--wait "${INPUT_WAIT}") fi - if [[ -n "${INPUT_LOG_LEVEL:-}" ]]; then - args+=(--log-level "${INPUT_LOG_LEVEL}") + if [[ -n "${INPUT_VERBOSITY:-}" ]]; then + args+=(--verbosity "${INPUT_VERBOSITY}") fi if [[ -n "${INPUT_KUBECTL_VERSION:-}" ]]; then From e3fbdb8b9839c2546ca415b3177fe0e6b8fcb1fd Mon Sep 17 00:00:00 2001 From: cpanato Date: Tue, 14 Jun 2022 11:29:38 +0200 Subject: [PATCH 2/6] upgrade kind to v0.14.0 Signed-off-by: cpanato --- action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 8086053..2833514 100644 --- a/action.yml +++ b/action.yml @@ -6,9 +6,9 @@ branding: icon: box inputs: version: - description: "The kind version to use (default: v0.12.0)" + description: "The kind version to use (default: v0.14.0)" required: false - default: "v0.12.0" + default: "v0.14.0" config: description: "The path to the kind config file" required: false From 357f78c056416d515a58ac31ec42092f52572787 Mon Sep 17 00:00:00 2001 From: cpanato Date: Tue, 14 Jun 2022 11:31:29 +0200 Subject: [PATCH 3/6] update action checkout Signed-off-by: cpanato --- .github/workflows/test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index e241c7f..6c38c81 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -58,7 +58,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Only install kind without starting a cluster uses: ./ From 2a4ba5425495ffc321bfaa6ddb48db17d1c71dde Mon Sep 17 00:00:00 2001 From: cpanato Date: Tue, 14 Jun 2022 11:32:55 +0200 Subject: [PATCH 4/6] update readme Signed-off-by: cpanato --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 1d2a782..c342a8d 100644 --- a/README.md +++ b/README.md @@ -15,13 +15,13 @@ For more information, reference the GitHub Help Documentation for [Creating a wo For more information on inputs, see the [API Documentation](https://developer.github.com/v3/repos/releases/#input) -- `version`: The kind version to use (default: `v0.12.0`) +- `version`: The kind version to use (default: `v0.14.0`) - `config`: The path to the kind config file - `node_image`: The Docker image for the cluster nodes - `cluster_name`: The name of the cluster to create (default: `chart-testing`) - `wait`: The duration to wait for the control plane to become ready (default: `60s`) -- `log_level`: The log level for kind -- `kubectl_version`: The kubectl version to use (default: v1.21.10) +- `verbosity`: info log verbosity, higher value produces more output +- `kubectl_version`: The kubectl version to use (default: v1.22.10) - `install_only`: Skips cluster creation, only install kind (default: false) ### Example Workflow @@ -38,7 +38,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Create k8s Kind Cluster - uses: helm/kind-action@v1.2.0 + uses: helm/kind-action@v1.3.0 ``` 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. From fde3a7cc919f2a1b3976cf55801c655e8a2af42e Mon Sep 17 00:00:00 2001 From: cpanato Date: Tue, 14 Jun 2022 11:36:20 +0200 Subject: [PATCH 5/6] add extra test Signed-off-by: cpanato --- .github/workflows/test.yaml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 6c38c81..ba85545 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -69,7 +69,7 @@ jobs: run: | [[ $(kind get clusters | wc -l) -eq 0 ]] - test-with-custom-k8s-version: + test-with-custom-kubectl-version: runs-on: ubuntu-latest steps: - name: Checkout @@ -84,3 +84,19 @@ jobs: run: | kubectl cluster-info kubectl get nodes + + test-with-custom-node-image: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Create kind cluster with custom name + uses: ./ + with: + node_image: "kindest/node:v1.24.0" + + - name: Test + run: | + kubectl cluster-info + kubectl get nodes From 8cd6a7cf32ce69fb7f174bf3d5878e00b58fec31 Mon Sep 17 00:00:00 2001 From: cpanato Date: Tue, 14 Jun 2022 11:39:36 +0200 Subject: [PATCH 6/6] update to use node16 Signed-off-by: cpanato --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 2833514..3d44405 100644 --- a/action.yml +++ b/action.yml @@ -35,6 +35,6 @@ inputs: description: "Skips cluster creation, only install kind (default: false)" required: false runs: - using: "node12" + using: "node16" main: "main.js" post: "cleanup.js"