From e465056943e4f0def5111b9ea2fac79c329e136e Mon Sep 17 00:00:00 2001 From: Ryan Richard Date: Tue, 15 Mar 2022 15:09:39 -0700 Subject: [PATCH] Use both kubeadm.k8s.io/v1beta2 and v1beta3 to allow old versions of K8s You can use an older version of K8s on your development workstation by temporarily editing kind-up.sh to add the `--image` flag. By defining both v1beta2 and v1beta3 you should continue to be able to use old versions of K8s in this way with Kind v0.12.0. --- hack/kind-up.sh | 3 ++- hack/lib/kind-config/single-node.yaml | 14 +++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/hack/kind-up.sh b/hack/kind-up.sh index 64fdacc6..c60eb4c7 100755 --- a/hack/kind-up.sh +++ b/hack/kind-up.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# Copyright 2020 the Pinniped contributors. All Rights Reserved. +# Copyright 2020-2022 the Pinniped contributors. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 set -euo pipefail @@ -9,4 +9,5 @@ ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )" cd "${ROOT}" # To choose a specific version of kube, add this option to the command below: `--image kindest/node:v1.18.8`. +# To debug the kind config, add this option to the command below: `-v 10` kind create cluster --config "hack/lib/kind-config/single-node.yaml" --name pinniped diff --git a/hack/lib/kind-config/single-node.yaml b/hack/lib/kind-config/single-node.yaml index 2b56ffa3..ac90bfcb 100644 --- a/hack/lib/kind-config/single-node.yaml +++ b/hack/lib/kind-config/single-node.yaml @@ -24,9 +24,14 @@ nodes: containerPort: 31235 hostPort: 12346 listenAddress: 127.0.0.1 +# Kind v0.12.0 ignores kubeadm.k8s.io/v1beta2 for Kube v1.23+ but uses it for older versions of Kube. +# Previous versions of Kind would use kubeadm.k8s.io/v1beta2 for all versions of Kube including 1.23. +# To try to maximize compatibility with various versions of Kind and Kube, define this +# ClusterConfiguration twice and hope that Kind will use the one that it likes for the given version +# of Kube, and ignore the one that it doesn't like. This seems to work, at least for Kind v0.12.0. kubeadmConfigPatches: - | - apiVersion: kubeadm.k8s.io/v1beta3 + apiVersion: kubeadm.k8s.io/v1beta2 kind: ClusterConfiguration apiServer: extraArgs: @@ -39,3 +44,10 @@ kubeadmConfigPatches: # are exercised. For whatever reason, leaving this as false (i.e. use kube-proxy) appears to # hide some network misconfigurations when used internally by the API server aggregation layer. enable-aggregator-routing: "true" +- | + apiVersion: kubeadm.k8s.io/v1beta3 + kind: ClusterConfiguration + apiServer: + extraArgs: + # See comment above. + enable-aggregator-routing: "true"