From d08cf6ff1575077dee99962540d77ce91c62387d Mon Sep 17 00:00:00 2001 From: Carlos Tadeu Panato Junior Date: Tue, 14 Jun 2022 12:08:25 +0200 Subject: [PATCH] resolve --log-level deprecation and replace to --verbosity (#64) * resolve --log-level deprecation and use --verbosity Signed-off-by: cpanato * upgrade kind to v0.14.0 Signed-off-by: cpanato * update action checkout Signed-off-by: cpanato * update readme Signed-off-by: cpanato * add extra test Signed-off-by: cpanato * update to use node16 Signed-off-by: cpanato --- .github/workflows/test.yaml | 36 ++++++++++++++++++++++++++++++++++-- README.md | 8 ++++---- action.yml | 16 +++++++++------- kind.sh | 22 +++++++++++----------- main.sh | 4 ++-- 5 files changed, 60 insertions(+), 26 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 94f096d..ba85545 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: @@ -42,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: ./ @@ -53,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 @@ -68,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 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. diff --git a/action.yml b/action.yml index 67f5f97..3d44405 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 @@ -23,16 +23,18 @@ 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" + using: "node16" main: "main.js" post: "cleanup.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