#!/usr/bin/env bash source .utils NAME="" VERSION="1.32.0@sha256:c48c62eac5da28cdadcf560d1d8616cfa6783b58f0d94cf63ad1bf49600cb027" NODES="2" FEATURE_GATES="MutatingAdmissionPolicy" RUNTIME_CONFIG="admissionregistration.k8s.io/v1alpha1" AUDIT_POLICY="" print_usage() { orange "kind-create-cluster - create a Kind cluster" echo " " underline "Usage:" echo "kind-create-cluster [cluster-name]" echo " " echo " " underline "Options:" echo "-h, --help show this help text" echo "-v, --version the version of kubernetes to use (default: ${VERSION})" echo "-n, --nodes the number of worker nodes (default: ${NODES})" echo "-f, --feature-gates a comma seperated list of feature-gates to enable (default: ${FEATURE_GATES})" echo "-r, --runtime-config a comma seperated list of API versions to enable (default: ${RUNTIME_CONFIG})" echo " --audit-policy a file containing the audit policy config" } while test $# -gt 0; do case "$1" in -n|--nodes) shift NODES=$1 shift ;; -v|--version) shift VERSION=$1 shift ;; -f|--feature-gates) shift FEATURE_GATES=$1 shift ;; -r|--runtime-config) shift RUNTIME_CONFIG=$1 shift ;; --audit-policy) shift AUDIT_POLICY=$1 shift ;; -h|--help) print_usage exit 0 ;; *) break ;; esac done # Positional args NAME=${1:-$(LC_ALL=C tr -dc a-z ${CONFIG_FILE} cat ${CONFIG_FILE} kind create cluster --config ${CONFIG_FILE} kind get kubeconfig --name ${NAME} > ~/.kube/clusters/kind.yaml