Skip to content

Commit

Permalink
Merge pull request #1 from lkingland/main
Browse files Browse the repository at this point in the history
Config Flag Fix and Version Bump
  • Loading branch information
nicolaferraro authored Feb 12, 2021
2 parents 591987d + 19ee54f commit e7d0dcb
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 27 deletions.
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,17 @@ 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.9.0`)
- `version`: The KinD version to use (default: `v0.10.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: `kind`)
- `wait`: The duration to wait for the control plane to become ready (default: `60s`)
- `log_level`: The log level for KinD
- `registry`: Configures an insecure registry on `kind-registry:5000` to be used with KinD (default: `true`)
- `knative_serving`: The version of Knative Serving to install on the Kind cluster (not installed by default - example: `v0.19.0`)
- `knative_kourier`: The version of Knative Net Kourier to install on the Kind cluster (not installed by default - example: `v0.19.0`)
- `knative_eventing`: The version of Knative Eventing to install on the Kind cluster (not installed by default - example: `v0.19.0`)
- `kubectl_version`: The kubectl version to use (default: `v1.20.0`)
- `knative_serving`: The version of Knative Serving to install on the Kind cluster (not installed by default - example: `v0.20.0`)
- `knative_kourier`: The version of Knative Net Kourier to install on the Kind cluster (not installed by default - example: `v0.20.0`)
- `knative_eventing`: The version of Knative Eventing to install on the Kind cluster (not installed by default - example: `v0.20.0`)

### Example Workflow

Expand Down Expand Up @@ -66,9 +67,9 @@ jobs:
- name: Kubernetes KinD Cluster
uses: container-tools/kind-action@v1
with:
knative_serving: v0.19.0
knative_kourier: v0.19.0
knative_eventing: v0.19.0
knative_serving: v0.20.0
knative_kourier: v0.20.0
knative_eventing: v0.20.0
```

This will install Knative Serving, Eventing and a Kourier Ingress on your Kind cluster. To make Knative run on Kind, resource request and limits are removed from the original Knative descriptors.
Expand Down
10 changes: 6 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ branding:
icon: cloud
inputs:
version:
description: "The KinD version to use (default: v0.9.0)"
description: "The KinD version to use (default: v0.10.0)"
config:
description: "The path to the KinD config file"
node_image:
Expand All @@ -19,12 +19,14 @@ inputs:
description: "The log level for KinD"
registry:
description: "Configures an insecure registry on kind-registry:5000 to be used with KinD (default: true)"
kubectl_version:
description: "The version of kubectl to use (default: v1.20.0)"
knative_serving:
description: "The version of Knative Serving to install on the Kind cluster (not installed by default - example: v0.19.0)"
description: "The version of Knative Serving to install on the Kind cluster (not installed by default - example: v0.20.0)"
knative_kourier:
description: "The version of Knative Net Kourier to install on the Kind cluster (not installed by default - example: v0.19.0)"
description: "The version of Knative Net Kourier to install on the Kind cluster (not installed by default - example: v0.20.0)"
knative_eventing:
description: "The version of Knative Eventing to install on the Kind cluster (not installed by default - example: v0.19.0)"
description: "The version of Knative Eventing to install on the Kind cluster (not installed by default - example: v0.20.0)"
runs:
using: "node12"
main: "main.js"
Expand Down
18 changes: 15 additions & 3 deletions kind.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,17 @@ set -o errexit
set -o nounset
set -o pipefail

DEFAULT_KIND_VERSION=v0.9.0
DEFAULT_KIND_VERSION=v0.10.0
DEFAULT_CLUSTER_NAME=kind
KUBECTL_VERSION=v1.18.6
DEFAULT_KUBECTL_VERSION=v1.20.0

show_help() {
cat << EOF
Usage: $(basename "$0") <options>
-h, --help Display help
-v, --version The kind version to use (default: $DEFAULT_KIND_VERSION)"
-k, --kubectl-version The kubectl version to use (default: $DEFAULT_KUBECTL_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: $DEFAULT_CLUSTER_NAME)"
Expand All @@ -37,6 +38,7 @@ EOF

main() {
local version="$DEFAULT_KIND_VERSION"
local kubectl_version="$DEFAULT_KUBECTL_VERSION"
local config=
local node_image=
local cluster_name="$DEFAULT_CLUSTER_NAME"
Expand Down Expand Up @@ -68,6 +70,16 @@ parse_command_line() {
exit 1
fi
;;
-k|--kubectl-version)
if [[ -n "${2:-}" ]]; then
kubectl_version="$2"
shift
else
echo "ERROR: '-k|--kubectl-version' cannot be empty." >&2
show_help
exit 1
fi
;;
-c|--config)
if [[ -n "${2:-}" ]]; then
config="$2"
Expand Down Expand Up @@ -136,7 +148,7 @@ install_kind() {

install_kubectl() {
echo 'Installing kubectl...'
curl -sSLO "https://storage.googleapis.com/kubernetes-release/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl"
curl -sSLO "https://storage.googleapis.com/kubernetes-release/release/$kubectl_version/bin/linux/amd64/kubectl"
chmod +x kubectl
sudo mv kubectl /usr/local/bin/kubectl
}
Expand Down
31 changes: 18 additions & 13 deletions main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,42 +19,47 @@ set -o pipefail
SCRIPT_DIR=$(dirname -- "$(readlink -f "${BASH_SOURCE[0]}" || realpath "${BASH_SOURCE[0]}")")

main() {
args=()
args_kind=()
args_knative=()

if [[ -n "${INPUT_VERSION:-}" ]]; then
args+=(--version "${INPUT_VERSION}")
args_kind+=(--version "${INPUT_VERSION}")
fi

if [[ -n "${INPUT_CONFIG:-}" ]]; then
args+=(--config "${INPUT_CONFIG}")
args_kind+=(--config "${INPUT_CONFIG}")
fi

if [[ -n "${INPUT_NODE_IMAGE:-}" ]]; then
args+=(--node-image "${INPUT_NODE_IMAGE}")
args_kind+=(--node-image "${INPUT_NODE_IMAGE}")
fi

if [[ -n "${INPUT_CLUSTER_NAME:-}" ]]; then
args+=(--cluster-name "${INPUT_CLUSTER_NAME}")
args_kind+=(--cluster-name "${INPUT_CLUSTER_NAME}")
fi

if [[ -n "${INPUT_WAIT:-}" ]]; then
args+=(--wait "${INPUT_WAIT}")
args_kind+=(--wait "${INPUT_WAIT}")
fi

if [[ -n "${INPUT_LOG_LEVEL:-}" ]]; then
args+=(--log-level "${INPUT_LOG_LEVEL}")
args_kind+=(--log-level "${INPUT_LOG_LEVEL}")
fi

if [[ -n "${INPUT_KUBECTL_VERSION:-}" ]]; then
args_kind+=(--kubectl-version "${INPUT_KUBECTL_VERSION}")
fi

if [[ -n "${INPUT_KNATIVE_SERVING:-}" ]]; then
args+=(--knative-serving "${INPUT_KNATIVE_SERVING}")
args_knative+=(--knative-serving "${INPUT_KNATIVE_SERVING}")
fi

if [[ -n "${INPUT_KNATIVE_KOURIER:-}" ]]; then
args+=(--knative-kourier "${INPUT_KNATIVE_KOURIER}")
args_knative+=(--knative-kourier "${INPUT_KNATIVE_KOURIER}")
fi

if [[ -n "${INPUT_KNATIVE_EVENTING:-}" ]]; then
args+=(--knative-eventing "${INPUT_KNATIVE_EVENTING}")
args_knative+=(--knative-eventing "${INPUT_KNATIVE_EVENTING}")
fi

if [[ -z "${INPUT_REGISTRY:-}" ]] || [[ "${INPUT_REGISTRY,,}" = "true" ]]; then
Expand All @@ -63,17 +68,17 @@ main() {
if [[ -n "${INPUT_CONFIG:-}" ]]; then
echo 'WARNING: when using the "config" option, you need to manually configure the registry in the provided configuration'
else
args+=(--config "/etc/kind-registry/config.yaml")
args_kind+=(--config "/etc/kind-registry/config.yaml")
fi
fi

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

if [[ -z "${INPUT_REGISTRY:-}" ]] || [[ "${INPUT_REGISTRY,,}" = "true" ]]; then
"$SCRIPT_DIR/registry.sh" "--document" "true" "${args[@]}"
fi

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

main

0 comments on commit e7d0dcb

Please sign in to comment.