Skip to content

Commit b333e25

Browse files
Copilotcamrynl
andcommitted
Add kubernetes version config option to BYO CNI cluster script
Co-authored-by: camrynl <[email protected]>
1 parent c925023 commit b333e25

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

hack/aks/README-byocni.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ Preview the commands that would be executed without actually running them:
5353
| `--cluster` | Name of the AKS cluster | `byocni-cluster` |
5454
| `--subscription` | Azure subscription ID | *Required* |
5555
| `--azcli` | Azure CLI command | `az` |
56+
| `--kubernetes-version` | Kubernetes version for the cluster | `1.29` |
5657
| `--networking-mode` | Networking mode (overlay, swift, nodesubnet, dualstack-overlay, vnetscale-swift) | `overlay` |
5758
| `--no-kube-proxy` | Create cluster without kube-proxy | `true` |
5859
| `--with-kube-proxy` | Create cluster with kube-proxy | Overrides --no-kube-proxy |
@@ -133,14 +134,23 @@ The script supports the following Cilium versions based on available manifests (
133134
--cilium-version-tag v1.17.0
134135
```
135136

136-
### Example 6: Only cluster and CNS, no CNI plugin
137+
### Example 6: Cluster with specific Kubernetes version
138+
```bash
139+
./create-byocni-cluster.sh \
140+
--subscription 9b8218f9-902a-4d20-a65c-e98acec5362f \
141+
--kubernetes-version 1.30 \
142+
--networking-mode overlay \
143+
--cni-plugin cilium
144+
```
145+
146+
### Example 7: Only cluster and CNS, no CNI plugin
137147
```bash
138148
./create-byocni-cluster.sh \
139149
--subscription 9b8218f9-902a-4d20-a65c-e98acec5362f \
140150
--cni-plugin none
141151
```
142152

143-
### Example 7: Using different image registry
153+
### Example 8: Using different image registry
144154
```bash
145155
./create-byocni-cluster.sh \
146156
--subscription 9b8218f9-902a-4d20-a65c-e98acec5362f \

hack/aks/create-byocni-cluster.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ DEFAULT_CILIUM_VERSION_TAG=""
2020
DEFAULT_IPV6_HP_BPF_VERSION=""
2121
DEFAULT_CNS_IMAGE_REPO="MCR"
2222
DEFAULT_AZCLI="az"
23+
DEFAULT_KUBERNETES_VERSION="1.29"
2324

2425
# Script configuration
2526
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
@@ -39,6 +40,7 @@ OPTIONS:
3940
-c, --cluster CLUSTER_NAME Name of the AKS cluster (default: ${DEFAULT_CLUSTER_NAME})
4041
-s, --subscription SUB_ID Azure subscription ID (required)
4142
-z, --azcli AZCLI_COMMAND Azure CLI command (default: ${DEFAULT_AZCLI})
43+
-k, --kubernetes-version VER Kubernetes version for the cluster (default: ${DEFAULT_KUBERNETES_VERSION})
4244
-n, --networking-mode MODE Networking mode: overlay, swift, nodesubnet, dualstack-overlay, vnetscale-swift (default: ${DEFAULT_NETWORKING_MODE})
4345
--no-kube-proxy Create cluster without kube-proxy (default: ${DEFAULT_NO_KUBE_PROXY})
4446
--with-kube-proxy Create cluster with kube-proxy (overrides --no-kube-proxy)
@@ -300,7 +302,7 @@ create_cluster() {
300302
;;
301303
esac
302304

303-
local make_cmd="AZCLI=${AZCLI} CLUSTER=${CLUSTER_NAME} SUB=${SUBSCRIPTION} make ${make_target}"
305+
local make_cmd="AZCLI=${AZCLI} CLUSTER=${CLUSTER_NAME} SUB=${SUBSCRIPTION} K8S_VER=${KUBERNETES_VERSION} make ${make_target}"
304306

305307
log "Using make target: ${make_target}"
306308
execute "cd '${SCRIPT_DIR}' && ${make_cmd}"
@@ -472,6 +474,7 @@ CILIUM_VERSION_TAG="${DEFAULT_CILIUM_VERSION_TAG}"
472474
IPV6_HP_BPF_VERSION="${DEFAULT_IPV6_HP_BPF_VERSION}"
473475
CNS_IMAGE_REPO="${DEFAULT_CNS_IMAGE_REPO}"
474476
AZCLI="${DEFAULT_AZCLI}"
477+
KUBERNETES_VERSION="${DEFAULT_KUBERNETES_VERSION}"
475478
DRY_RUN="false"
476479

477480
while [[ $# -gt 0 ]]; do
@@ -488,6 +491,10 @@ while [[ $# -gt 0 ]]; do
488491
AZCLI="$2"
489492
shift 2
490493
;;
494+
-k|--kubernetes-version)
495+
KUBERNETES_VERSION="$2"
496+
shift 2
497+
;;
491498
-n|--networking-mode)
492499
NETWORKING_MODE="$2"
493500
shift 2
@@ -562,6 +569,7 @@ main() {
562569
log " Cluster Name: ${CLUSTER_NAME}"
563570
log " Subscription: ${SUBSCRIPTION}"
564571
log " Azure CLI: ${AZCLI}"
572+
log " Kubernetes Version: ${KUBERNETES_VERSION}"
565573
log " Networking Mode: ${NETWORKING_MODE}"
566574
log " No Kube-proxy: ${NO_KUBE_PROXY}"
567575
log " CNI Plugin: ${CNI_PLUGIN}"

0 commit comments

Comments
 (0)