@@ -9,6 +9,7 @@ set -euo pipefail
99# Default configuration
1010DEFAULT_CLUSTER_NAME=" byocni-cluster"
1111DEFAULT_SUB=" "
12+ DEFAULT_RESOURCE_GROUP=" "
1213DEFAULT_NETWORKING_MODE=" overlay"
1314DEFAULT_NO_KUBE_PROXY=" true"
1415DEFAULT_CNI_PLUGIN=" cilium"
@@ -39,6 +40,7 @@ Creates a BYO CNI cluster with the following steps:
3940OPTIONS:
4041 -c, --cluster CLUSTER_NAME Name of the AKS cluster (default: ${DEFAULT_CLUSTER_NAME} )
4142 -s, --subscription SUB_ID Azure subscription ID (required)
43+ -g, --resource-group GROUP Resource group name (default: same as cluster name)
4244 -z, --azcli AZCLI_COMMAND Azure CLI command (default: ${DEFAULT_AZCLI} )
4345 -k, --kubernetes-version VER Kubernetes version for the cluster (default: ${DEFAULT_KUBERNETES_VERSION} )
4446 -n, --networking-mode MODE Networking mode: overlay, swift, nodesubnet, dualstack-overlay, vnetscale-swift (default: ${DEFAULT_NETWORKING_MODE} )
@@ -80,6 +82,9 @@ EXAMPLES:
8082 # Custom cluster name and CNS version
8183 $0 --cluster my-cluster --subscription 9b8218f9-902a-4d20-a65c-e98acec5362f --cns-version v1.6.0
8284
85+ # Custom cluster name and resource group
86+ $0 --cluster my-cluster --resource-group my-rg --subscription 9b8218f9-902a-4d20-a65c-e98acec5362f
87+
8388 # Cluster with kube-proxy enabled
8489 $0 --subscription 9b8218f9-902a-4d20-a65c-e98acec5362f --with-kube-proxy
8590
@@ -319,7 +324,12 @@ create_cluster() {
319324 log " Kubernetes version ${KUBERNETES_VERSION} is >= 1.31, setting LTS=false"
320325 fi
321326
322- local make_cmd=" AZCLI=${AZCLI} CLUSTER=${CLUSTER_NAME} SUB=${SUBSCRIPTION} K8S_VER=${KUBERNETES_VERSION} LTS=${lts_setting} make ${make_target} "
327+ # Build make command with optional GROUP parameter
328+ local make_cmd=" AZCLI=${AZCLI} CLUSTER=${CLUSTER_NAME} SUB=${SUBSCRIPTION} K8S_VER=${KUBERNETES_VERSION} LTS=${lts_setting} "
329+ if [[ -n " ${RESOURCE_GROUP} " ]]; then
330+ make_cmd=" ${make_cmd} GROUP=${RESOURCE_GROUP} "
331+ fi
332+ make_cmd=" ${make_cmd} make ${make_target} "
323333
324334 log " Using make target: ${make_target} "
325335 execute " cd '${SCRIPT_DIR} ' && ${make_cmd} "
@@ -480,6 +490,7 @@ show_completion_message() {
480490# Parse command line arguments
481491CLUSTER_NAME=" ${DEFAULT_CLUSTER_NAME} "
482492SUBSCRIPTION=" ${DEFAULT_SUB} "
493+ RESOURCE_GROUP=" ${DEFAULT_RESOURCE_GROUP} "
483494NETWORKING_MODE=" ${DEFAULT_NETWORKING_MODE} "
484495NO_KUBE_PROXY=" ${DEFAULT_NO_KUBE_PROXY} "
485496CNI_PLUGIN=" ${DEFAULT_CNI_PLUGIN} "
@@ -504,6 +515,10 @@ while [[ $# -gt 0 ]]; do
504515 SUBSCRIPTION=" $2 "
505516 shift 2
506517 ;;
518+ -g|--resource-group)
519+ RESOURCE_GROUP=" $2 "
520+ shift 2
521+ ;;
507522 -z|--azcli)
508523 AZCLI=" $2 "
509524 shift 2
@@ -585,6 +600,7 @@ main() {
585600 log " Configuration:"
586601 log " Cluster Name: ${CLUSTER_NAME} "
587602 log " Subscription: ${SUBSCRIPTION} "
603+ log " Resource Group: ${RESOURCE_GROUP:- ${CLUSTER_NAME} } "
588604 log " Azure CLI: ${AZCLI} "
589605 log " Kubernetes Version: ${KUBERNETES_VERSION} "
590606 log " Networking Mode: ${NETWORKING_MODE} "
0 commit comments