Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@ jobs:

- name: Create kind cluster
uses: ./
with:
install_local_path_provisioner: true

- name: Test
run: |
kubectl cluster-info
kubectl get storageclass local-path
kubectl get storageclass standard
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,12 @@ 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.6.1`)
- `version`: The kind version to use (default: `v0.7.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
- `install_local_path_provisioner`: If true, Rancher's local-path provisioner is installed which supports dynamic volume provisioning on multi-node clusters.
The newly created local-path StorageClass is made the default.

### Example Workflow

Expand All @@ -39,8 +37,6 @@ jobs:
steps:
- name: Create k8s Kind Cluster
uses: helm/kind-action@v1.0.0-alpha.3
with:
install_local_path_provisioner: true
```

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.
Expand Down
7 changes: 1 addition & 6 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ branding:
icon: box
inputs:
version:
description: "The kind version to use (default: v0.6.1)"
description: "The kind version to use (default: v0.7.0)"
config:
description: "The path to the kind config file"
node_image:
Expand All @@ -17,11 +17,6 @@ inputs:
description: "The duration to wait for the control plane to become ready (default: 60s)"
log_level:
description: "The log level for kind"
install_local_path_provisioner:
description: |
If true, Rancher's local-path provisioner is installed which supports
dynamic volume provisioning on multi-node clusters. The newly created
local-path StorageClass is made the default.
runs:
using: "node12"
main: "main.js"
28 changes: 2 additions & 26 deletions kind.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ set -o errexit
set -o nounset
set -o pipefail

DEFAULT_KIND_VERSION=v0.6.1
DEFAULT_KIND_VERSION=v0.7.0
DEFAULT_CLUSTER_NAME=chart-testing
KUBECTL_VERSION=v1.17.0

Expand All @@ -27,15 +27,12 @@ cat << EOF
Usage: $(basename "$0") <options>

-h, --help Display help
-v, --version The kind version to use (default: v0.6.1)"
-v, --version The kind version to use (default: v0.7.0)"
-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)
-p, --install-local-path-provisioner If true, Rancher's local-path provisioner is installed which supports
dynamic volume provisioning on multi-node clusters. The newly created
local-path StorageClass is made the default.

EOF
}
Expand All @@ -47,17 +44,13 @@ main() {
local cluster_name="$DEFAULT_CLUSTER_NAME"
local wait=60s
local log_level=
local install_local_path_provisioner=

parse_command_line "$@"

install_kind
install_kubectl
create_kind_cluster

if [[ -n "$install_local_path_provisioner" ]]; then
install_local_path_provisioner
fi
}

parse_command_line() {
Expand Down Expand Up @@ -127,9 +120,6 @@ parse_command_line() {
exit 1
fi
;;
-p|--install-local-path-provisioner)
install_local_path_provisioner=true
;;
*)
break
;;
Expand Down Expand Up @@ -172,18 +162,4 @@ create_kind_cluster() {
kind "${args[@]}"
}

install_local_path_provisioner() {
echo 'Installing local-path provisioner...'
kubectl apply -f https://raw.githubusercontent.com/rancher/local-path-provisioner/master/deploy/local-path-storage.yaml

echo 'Changing default StorageClass...'
kubectl patch storageclass standard --patch '{"metadata": {"annotations": {"storageclass.kubernetes.io/is-default-class": "false"}}}'
kubectl patch storageclass standard --patch '{"metadata": {"annotations": {"storageclass.beta.kubernetes.io/is-default-class": "false"}}}'
kubectl patch storageclass local-path --patch '{"metadata": {"annotations": {"storageclass.kubernetes.io/is-default-class": "true"}}}'
kubectl patch storageclass local-path --patch '{"metadata": {"annotations": {"storageclass.beta.kubernetes.io/is-default-class": "true"}}}'

echo 'Available StorageClasses:'
kubectl get storageclasses
}

main "$@"
4 changes: 0 additions & 4 deletions main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ main() {
args+=(--log-level "${INPUT_LOG_LEVEL}")
fi

if [[ -n "${INPUT_INSTALL_LOCAL_PATH_PROVISIONER:-}" ]]; then
args+=(--install-local-path-provisioner)
fi

"$SCRIPT_DIR/kind.sh" "${args[@]}"
}

Expand Down