Skip to content

Commit d89adf8

Browse files
authored
Merge pull request #7156 from oscr/update-quickstart-kind-15
⚠️ Use Kubernetes 1.25 in Quick Start docs and CAPD.
2 parents 74eb151 + 5196df5 commit d89adf8

File tree

15 files changed

+125
-54
lines changed

15 files changed

+125
-54
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,6 @@ _releasenotes
8585
# Used during parts of the build process. Files _should_ get cleaned up automatically.
8686
# This is also a good location for any temporary manfiests used during development
8787
tmp
88+
89+
# asdf (not a typo! ;) used to manage multiple versions of tools
90+
.tool-versions

Tiltfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ def cluster_templates():
509509

510510
# Ensure we have default values for a small set of well-known variables
511511
substitutions["NAMESPACE"] = substitutions.get("NAMESPACE", "default")
512-
substitutions["KUBERNETES_VERSION"] = substitutions.get("KUBERNETES_VERSION", "v1.24.0")
512+
substitutions["KUBERNETES_VERSION"] = substitutions.get("KUBERNETES_VERSION", "v1.25.0")
513513
substitutions["CONTROL_PLANE_MACHINE_COUNT"] = substitutions.get("CONTROL_PLANE_MACHINE_COUNT", "1")
514514
substitutions["WORKER_MACHINE_COUNT"] = substitutions.get("WORKER_MACHINE_COUNT", "3")
515515

docs/book/src/developer/providers/v1.2-to-v1.3.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ maintainers of providers and consumers of our Go API.
1212
**Note**: Only the most relevant dependencies are listed, `k8s.io/` and `ginkgo`/`gomega` dependencies
1313
in Cluster API are kept in sync with the versions used by `sigs.k8s.io/controller-runtime`.
1414

15-
-
15+
- sigs.k8s.io/kind: v0.14.x => v0.15.x
1616

1717
## Changes by Kind
1818

docs/book/src/developer/tilt.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ workflow that offers easy deployments and rapid iterative builds.
88
## Prerequisites
99

1010
1. [Docker](https://docs.docker.com/install/): v19.03 or newer
11-
1. [kind](https://kind.sigs.k8s.io): v0.9 or newer
11+
1. [kind](https://kind.sigs.k8s.io): v0.15 or newer
1212
1. [Tilt](https://docs.tilt.dev/install.html): v0.22.2 or newer
1313
1. [kustomize](https://github.com/kubernetes-sigs/kustomize): provided via `make kustomize`
1414
1. [envsubst](https://github.com/drone/envsubst): provided via `make envsubst`
@@ -303,7 +303,7 @@ Custom values for variable substitutions can be set using `kustomize_substitutio
303303
```yaml
304304
kustomize_substitutions:
305305
NAMESPACE: default
306-
KUBERNETES_VERSION: v1.24.0
306+
KUBERNETES_VERSION: v1.25.0
307307
CONTROL_PLANE_MACHINE_COUNT: 1
308308
WORKER_MACHINE_COUNT: 3
309309
```

docs/book/src/user/quick-start.md

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ a target [management cluster] on the selected [infrastructure provider].
4545

4646
[kind] is not designed for production use.
4747

48-
**Minimum [kind] supported version**: v0.14.0
48+
**Minimum [kind] supported version**: v0.15.0
4949

5050
**Help with common issues can be found in the [Troubleshooting Guide](./troubleshooting.md).**
5151

@@ -948,7 +948,7 @@ The Docker provider is not designed for production use and is intended for devel
948948
949949
```bash
950950
clusterctl generate cluster capi-quickstart --flavor development \
951-
--kubernetes-version v1.24.0 \
951+
--kubernetes-version v1.25.0 \
952952
--control-plane-machine-count=3 \
953953
--worker-machine-count=3 \
954954
> capi-quickstart.yaml
@@ -960,7 +960,7 @@ clusterctl generate cluster capi-quickstart --flavor development \
960960
```bash
961961
export CLUSTER_NAME=kind
962962
export CLUSTER_NAMESPACE=vcluster
963-
export KUBERNETES_VERSION=1.23.4
963+
export KUBERNETES_VERSION=1.25.0
964964
export HELM_VALUES="service:\n type: NodePort"
965965
966966
kubectl create namespace ${CLUSTER_NAMESPACE}
@@ -975,7 +975,7 @@ clusterctl generate cluster ${CLUSTER_NAME} \
975975
976976
```bash
977977
clusterctl generate cluster capi-quickstart \
978-
--kubernetes-version v1.24.0 \
978+
--kubernetes-version v1.25.0 \
979979
--control-plane-machine-count=3 \
980980
--worker-machine-count=3 \
981981
> capi-quickstart.yaml
@@ -1034,8 +1034,8 @@ kubectl get kubeadmcontrolplane
10341034
You should see an output is similar to this:
10351035
10361036
```bash
1037-
NAME INITIALIZED API SERVER AVAILABLE VERSION REPLICAS READY UPDATED UNAVAILABLE
1038-
capi-quickstart-control-plane true v1.24.0 3 3 3
1037+
NAME CLUSTER INITIALIZED API SERVER AVAILABLE REPLICAS READY UPDATED UNAVAILABLE AGE VERSION
1038+
capi-quickstart-g2trk capi-quickstart true 3 3 3 4m7s v1.25.0
10391039
```
10401040
10411041
<aside class="note warning">
@@ -1091,7 +1091,7 @@ Calico not required for vcluster.
10911091
10921092
```bash
10931093
kubectl --kubeconfig=./capi-quickstart.kubeconfig \
1094-
apply -f https://docs.projectcalico.org/v3.21/manifests/calico.yaml
1094+
apply -f https://raw.githubusercontent.com/projectcalico/calico/v3.24.1/manifests/calico.yaml
10951095
```
10961096
10971097
After a short while, our nodes should be running and in `Ready` state,
@@ -1100,6 +1100,15 @@ let's check the status using `kubectl get nodes`:
11001100
```bash
11011101
kubectl --kubeconfig=./capi-quickstart.kubeconfig get nodes
11021102
```
1103+
```bash
1104+
NAME STATUS ROLES AGE VERSION
1105+
capi-quickstart-g2trk-9xrjv Ready control-plane 12m v1.25.0
1106+
capi-quickstart-g2trk-bmm9v Ready control-plane 11m v1.25.0
1107+
capi-quickstart-g2trk-hvs9q Ready control-plane 13m v1.25.0
1108+
capi-quickstart-md-0-55x6t-5649968bd7-8tq9v Ready <none> 12m v1.25.0
1109+
capi-quickstart-md-0-55x6t-5649968bd7-glnjd Ready <none> 12m v1.25.0
1110+
capi-quickstart-md-0-55x6t-5649968bd7-sfzp6 Ready <none> 12m v1.25.0
1111+
```
11031112
11041113
{{#/tab }}
11051114
{{#/tabs }}

hack/ensure-kind.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ set -o pipefail
2121
set -x
2222

2323
GOPATH_BIN="$(go env GOPATH)/bin/"
24-
MINIMUM_KIND_VERSION=v0.14.0
24+
MINIMUM_KIND_VERSION=v0.15.0
2525
goarch="$(go env GOARCH)"
2626
goos="$(go env GOOS)"
2727

test/e2e/config/docker.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -205,12 +205,12 @@ variables:
205205
# allowing the same e2e config file to be re-used in different Prow jobs e.g. each one with a K8s version permutation.
206206
# The following Kubernetes versions should be the latest versions with already published kindest/node images.
207207
# This avoids building node images in the default case which improves the test duration significantly.
208-
KUBERNETES_VERSION_MANAGEMENT: "v1.24.0"
209-
KUBERNETES_VERSION: "v1.24.0"
210-
KUBERNETES_VERSION_UPGRADE_FROM: "v1.23.6"
211-
KUBERNETES_VERSION_UPGRADE_TO: "v1.24.0"
212-
ETCD_VERSION_UPGRADE_TO: "3.5.3-0"
213-
COREDNS_VERSION_UPGRADE_TO: "v1.8.6"
208+
KUBERNETES_VERSION_MANAGEMENT: "v1.25.0"
209+
KUBERNETES_VERSION: "v1.25.0"
210+
KUBERNETES_VERSION_UPGRADE_FROM: "1.24.4"
211+
KUBERNETES_VERSION_UPGRADE_TO: "v1.25.0"
212+
ETCD_VERSION_UPGRADE_TO: "3.5.4-0"
213+
COREDNS_VERSION_UPGRADE_TO: "v1.9.3"
214214
DOCKER_SERVICE_DOMAIN: "cluster.local"
215215
IP_FAMILY: "IPv4"
216216
DOCKER_SERVICE_CIDRS: "10.128.0.0/12"
@@ -232,7 +232,7 @@ variables:
232232
# NOTE: We test the latest release with a previous contract.
233233
INIT_WITH_BINARY: "https://github.com/kubernetes-sigs/cluster-api/releases/download/v0.4.7/clusterctl-{OS}-{ARCH}"
234234
INIT_WITH_PROVIDERS_CONTRACT: "v1alpha4"
235-
INIT_WITH_KUBERNETES_VERSION: "v1.24.0"
235+
INIT_WITH_KUBERNETES_VERSION: "v1.25.0"
236236

237237
intervals:
238238
default/wait-controllers: ["3m", "10s"]

test/framework/bootstrap/kind_provider.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const (
3737
DefaultNodeImageRepository = "kindest/node"
3838

3939
// DefaultNodeImageVersion is the default Kubernetes version to be used for creating a kind cluster.
40-
DefaultNodeImageVersion = "v1.24.0"
40+
DefaultNodeImageVersion = "v1.25.0"
4141
)
4242

4343
// KindClusterOption is a NewKindClusterProvider option.

test/framework/deployment_helpers.go

Lines changed: 83 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import (
3232
. "github.com/onsi/gomega"
3333
appsv1 "k8s.io/api/apps/v1"
3434
corev1 "k8s.io/api/core/v1"
35+
policyv1 "k8s.io/api/policy/v1"
3536
"k8s.io/api/policy/v1beta1"
3637
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
3738
"k8s.io/apimachinery/pkg/util/intstr"
@@ -351,6 +352,7 @@ func DeployUnevictablePod(ctx context.Context, input DeployUnevictablePodInput)
351352
},
352353
}
353354
workloadClient := input.WorkloadClusterProxy.GetClientSet()
355+
354356
if input.ControlPlane != nil {
355357
var serverVersion *version.Info
356358
Eventually(func() error {
@@ -383,33 +385,72 @@ func DeployUnevictablePod(ctx context.Context, input DeployUnevictablePodInput)
383385
Deployment: workloadDeployment,
384386
})
385387

386-
budget := &v1beta1.PodDisruptionBudget{
387-
TypeMeta: metav1.TypeMeta{
388-
Kind: "PodDisruptionBudget",
389-
APIVersion: "policy/v1beta1",
390-
},
391-
ObjectMeta: metav1.ObjectMeta{
392-
Name: input.DeploymentName,
393-
Namespace: input.Namespace,
394-
},
395-
Spec: v1beta1.PodDisruptionBudgetSpec{
396-
Selector: &metav1.LabelSelector{
397-
MatchLabels: map[string]string{
398-
"app": "nonstop",
388+
// TODO(oscr): Remove when Kubernetes 1.20 support is dropped.
389+
serverVersion, err := workloadClient.ServerVersion()
390+
Expect(err).ToNot(HaveOccurred(), "Failed to get Kubernetes version for workload")
391+
392+
// If Kubernetes < 1.21.0 we need to use PDB from v1beta1
393+
if utilversion.MustParseGeneric(serverVersion.String()).LessThan(utilversion.MustParseGeneric("v1.21.0")) {
394+
budgetV1Beta1 := &v1beta1.PodDisruptionBudget{
395+
TypeMeta: metav1.TypeMeta{
396+
Kind: "PodDisruptionBudget",
397+
APIVersion: "policy/v1beta1",
398+
},
399+
ObjectMeta: metav1.ObjectMeta{
400+
Name: input.DeploymentName,
401+
Namespace: input.Namespace,
402+
},
403+
Spec: v1beta1.PodDisruptionBudgetSpec{
404+
Selector: &metav1.LabelSelector{
405+
MatchLabels: map[string]string{
406+
"app": "nonstop",
407+
},
408+
},
409+
MaxUnavailable: &intstr.IntOrString{
410+
Type: intstr.Int,
411+
IntVal: 1,
412+
StrVal: "1",
399413
},
400414
},
401-
MaxUnavailable: &intstr.IntOrString{
402-
Type: intstr.Int,
403-
IntVal: 1,
404-
StrVal: "1",
415+
}
416+
417+
AddPodDisruptionBudgetV1Beta1(ctx, AddPodDisruptionBudgetInputV1Beta1{
418+
Namespace: input.Namespace,
419+
ClientSet: workloadClient,
420+
Budget: budgetV1Beta1,
421+
})
422+
423+
// If Kubernetes >= 1.21.0 then we need to use PDB from v1
424+
} else {
425+
budget := &policyv1.PodDisruptionBudget{
426+
TypeMeta: metav1.TypeMeta{
427+
Kind: "PodDisruptionBudget",
428+
APIVersion: "policy/v1",
405429
},
406-
},
430+
ObjectMeta: metav1.ObjectMeta{
431+
Name: input.DeploymentName,
432+
Namespace: input.Namespace,
433+
},
434+
Spec: policyv1.PodDisruptionBudgetSpec{
435+
Selector: &metav1.LabelSelector{
436+
MatchLabels: map[string]string{
437+
"app": "nonstop",
438+
},
439+
},
440+
MaxUnavailable: &intstr.IntOrString{
441+
Type: intstr.Int,
442+
IntVal: 1,
443+
StrVal: "1",
444+
},
445+
},
446+
}
447+
448+
AddPodDisruptionBudget(ctx, AddPodDisruptionBudgetInput{
449+
Namespace: input.Namespace,
450+
ClientSet: workloadClient,
451+
Budget: budget,
452+
})
407453
}
408-
AddPodDisruptionBudget(ctx, AddPodDisruptionBudgetInput{
409-
Namespace: input.Namespace,
410-
ClientSet: workloadClient,
411-
Budget: budget,
412-
})
413454

414455
WaitForDeploymentsAvailable(ctx, WaitForDeploymentsAvailableInput{
415456
Getter: input.WorkloadClusterProxy.GetClient(),
@@ -435,11 +476,29 @@ func AddDeploymentToWorkloadCluster(ctx context.Context, input AddDeploymentToWo
435476

436477
type AddPodDisruptionBudgetInput struct {
437478
ClientSet *kubernetes.Clientset
438-
Budget *v1beta1.PodDisruptionBudget
479+
Budget *policyv1.PodDisruptionBudget
439480
Namespace string
440481
}
441482

442483
func AddPodDisruptionBudget(ctx context.Context, input AddPodDisruptionBudgetInput) {
484+
Eventually(func() error {
485+
budget, err := input.ClientSet.PolicyV1().PodDisruptionBudgets(input.Namespace).Create(ctx, input.Budget, metav1.CreateOptions{})
486+
if budget != nil && err == nil {
487+
return nil
488+
}
489+
return fmt.Errorf("podDisruptionBudget needs to be successfully deployed: %v", err)
490+
}, retryableOperationTimeout, retryableOperationInterval).Should(Succeed(), "podDisruptionBudget needs to be successfully deployed")
491+
}
492+
493+
// TODO(oscr): Delete below when Kubernetes 1.20 support is dropped.
494+
495+
type AddPodDisruptionBudgetInputV1Beta1 struct {
496+
ClientSet *kubernetes.Clientset
497+
Budget *v1beta1.PodDisruptionBudget
498+
Namespace string
499+
}
500+
501+
func AddPodDisruptionBudgetV1Beta1(ctx context.Context, input AddPodDisruptionBudgetInputV1Beta1) {
443502
Eventually(func() error {
444503
budget, err := input.ClientSet.PolicyV1beta1().PodDisruptionBudgets(input.Namespace).Create(ctx, input.Budget, metav1.CreateOptions{})
445504
if budget != nil && err == nil {

test/infrastructure/docker/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ ENV GOPROXY=$goproxy
3333
# Gets additional CAPD dependencies
3434
WORKDIR /tmp
3535

36-
RUN curl -LO https://dl.k8s.io/release/v1.24.0/bin/linux/${ARCH}/kubectl && \
36+
RUN curl -LO https://dl.k8s.io/release/v1.25.0/bin/linux/${ARCH}/kubectl && \
3737
chmod +x ./kubectl && \
3838
mv ./kubectl /usr/bin/kubectl
3939

0 commit comments

Comments
 (0)