Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release-1.2] ⚠️ Use Kubernetes 1.25 in Quick Start docs and CAPD. #7174

Merged
merged 1 commit into from
Sep 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,10 @@ _releasenotes

# Helm
.helm

# Used during parts of the build process. Files _should_ get cleaned up automatically.
# This is also a good location for any temporary manfiests used during development
tmp

# asdf (not a typo! ;) used to manage multiple versions of tools
.tool-versions
21 changes: 15 additions & 6 deletions docs/book/src/user/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -948,7 +948,7 @@ The Docker provider is not designed for production use and is intended for devel

```bash
clusterctl generate cluster capi-quickstart --flavor development \
--kubernetes-version v1.24.0 \
--kubernetes-version v1.25.0 \
--control-plane-machine-count=3 \
--worker-machine-count=3 \
> capi-quickstart.yaml
Expand All @@ -960,7 +960,7 @@ clusterctl generate cluster capi-quickstart --flavor development \
```bash
export CLUSTER_NAME=kind
export CLUSTER_NAMESPACE=vcluster
export KUBERNETES_VERSION=1.23.4
export KUBERNETES_VERSION=1.25.0
export HELM_VALUES="service:\n type: NodePort"

kubectl create namespace ${CLUSTER_NAMESPACE}
Expand All @@ -975,7 +975,7 @@ clusterctl generate cluster ${CLUSTER_NAME} \

```bash
clusterctl generate cluster capi-quickstart \
--kubernetes-version v1.24.0 \
--kubernetes-version v1.25.0 \
--control-plane-machine-count=3 \
--worker-machine-count=3 \
> capi-quickstart.yaml
Expand Down Expand Up @@ -1034,8 +1034,8 @@ kubectl get kubeadmcontrolplane
You should see an output is similar to this:

```bash
NAME INITIALIZED API SERVER AVAILABLE VERSION REPLICAS READY UPDATED UNAVAILABLE
capi-quickstart-control-plane true v1.24.0 3 3 3
NAME CLUSTER INITIALIZED API SERVER AVAILABLE REPLICAS READY UPDATED UNAVAILABLE AGE VERSION
capi-quickstart-g2trk capi-quickstart true 3 3 3 4m7s v1.25.0
```

<aside class="note warning">
Expand Down Expand Up @@ -1091,7 +1091,7 @@ Calico not required for vcluster.

```bash
kubectl --kubeconfig=./capi-quickstart.kubeconfig \
apply -f https://docs.projectcalico.org/v3.21/manifests/calico.yaml
apply -f https://raw.githubusercontent.com/projectcalico/calico/v3.24.1/manifests/calico.yaml
```

After a short while, our nodes should be running and in `Ready` state,
Expand All @@ -1100,6 +1100,15 @@ let's check the status using `kubectl get nodes`:
```bash
kubectl --kubeconfig=./capi-quickstart.kubeconfig get nodes
```
```bash
NAME STATUS ROLES AGE VERSION
capi-quickstart-g2trk-9xrjv Ready control-plane 12m v1.25.0
capi-quickstart-g2trk-bmm9v Ready control-plane 11m v1.25.0
capi-quickstart-g2trk-hvs9q Ready control-plane 13m v1.25.0
capi-quickstart-md-0-55x6t-5649968bd7-8tq9v Ready <none> 12m v1.25.0
capi-quickstart-md-0-55x6t-5649968bd7-glnjd Ready <none> 12m v1.25.0
capi-quickstart-md-0-55x6t-5649968bd7-sfzp6 Ready <none> 12m v1.25.0
```

{{#/tab }}
{{#/tabs }}
Expand Down
14 changes: 7 additions & 7 deletions test/e2e/config/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -206,12 +206,12 @@ variables:
# allowing the same e2e config file to be re-used in different Prow jobs e.g. each one with a K8s version permutation.
# The following Kubernetes versions should be the latest versions with already published kindest/node images.
# This avoids building node images in the default case which improves the test duration significantly.
KUBERNETES_VERSION_MANAGEMENT: "v1.24.0"
KUBERNETES_VERSION: "v1.24.0"
KUBERNETES_VERSION_UPGRADE_FROM: "v1.23.6"
KUBERNETES_VERSION_UPGRADE_TO: "v1.24.0"
ETCD_VERSION_UPGRADE_TO: "3.5.3-0"
COREDNS_VERSION_UPGRADE_TO: "v1.8.6"
KUBERNETES_VERSION_MANAGEMENT: "v1.25.0"
KUBERNETES_VERSION: "v1.25.0"
KUBERNETES_VERSION_UPGRADE_FROM: "1.24.4"
KUBERNETES_VERSION_UPGRADE_TO: "v1.25.0"
ETCD_VERSION_UPGRADE_TO: "3.5.4-0"
COREDNS_VERSION_UPGRADE_TO: "v1.9.3"
DOCKER_SERVICE_DOMAIN: "cluster.local"
IP_FAMILY: "IPv4"
DOCKER_SERVICE_CIDRS: "10.128.0.0/12"
Expand All @@ -233,7 +233,7 @@ variables:
# NOTE: We test the latest release with a previous contract.
INIT_WITH_BINARY: "https://github.com/kubernetes-sigs/cluster-api/releases/download/v0.4.7/clusterctl-{OS}-{ARCH}"
INIT_WITH_PROVIDERS_CONTRACT: "v1alpha4"
INIT_WITH_KUBERNETES_VERSION: "v1.24.0"
INIT_WITH_KUBERNETES_VERSION: "v1.25.0"

intervals:
default/wait-controllers: ["3m", "10s"]
Expand Down
2 changes: 1 addition & 1 deletion test/framework/bootstrap/kind_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const (
DefaultNodeImageRepository = "kindest/node"

// DefaultNodeImageVersion is the default Kubernetes version to be used for creating a kind cluster.
DefaultNodeImageVersion = "v1.24.0"
DefaultNodeImageVersion = "v1.25.0"
)

// KindClusterOption is a NewKindClusterProvider option.
Expand Down
107 changes: 83 additions & 24 deletions test/framework/deployment_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (
. "github.com/onsi/gomega"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
policyv1 "k8s.io/api/policy/v1"
"k8s.io/api/policy/v1beta1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -365,6 +366,7 @@ func DeployUnevictablePod(ctx context.Context, input DeployUnevictablePodInput)
},
},
}

if input.ControlPlane != nil {
var serverVersion *version.Info
Eventually(func() error {
Expand Down Expand Up @@ -397,33 +399,72 @@ func DeployUnevictablePod(ctx context.Context, input DeployUnevictablePodInput)
Deployment: workloadDeployment,
})

budget := &v1beta1.PodDisruptionBudget{
TypeMeta: metav1.TypeMeta{
Kind: "PodDisruptionBudget",
APIVersion: "policy/v1beta1",
},
ObjectMeta: metav1.ObjectMeta{
Name: input.DeploymentName,
Namespace: input.Namespace,
},
Spec: v1beta1.PodDisruptionBudgetSpec{
Selector: &metav1.LabelSelector{
MatchLabels: map[string]string{
"app": "nonstop",
// TODO(oscr): Remove when Kubernetes 1.20 support is dropped.
serverVersion, err := workloadClient.ServerVersion()
Expect(err).ToNot(HaveOccurred(), "Failed to get Kubernetes version for workload")

// If Kubernetes < 1.21.0 we need to use PDB from v1beta1
if utilversion.MustParseGeneric(serverVersion.String()).LessThan(utilversion.MustParseGeneric("v1.21.0")) {
budgetV1Beta1 := &v1beta1.PodDisruptionBudget{
TypeMeta: metav1.TypeMeta{
Kind: "PodDisruptionBudget",
APIVersion: "policy/v1beta1",
},
ObjectMeta: metav1.ObjectMeta{
Name: input.DeploymentName,
Namespace: input.Namespace,
},
Spec: v1beta1.PodDisruptionBudgetSpec{
Selector: &metav1.LabelSelector{
MatchLabels: map[string]string{
"app": "nonstop",
},
},
MaxUnavailable: &intstr.IntOrString{
Type: intstr.Int,
IntVal: 1,
StrVal: "1",
},
},
MaxUnavailable: &intstr.IntOrString{
Type: intstr.Int,
IntVal: 1,
StrVal: "1",
}

AddPodDisruptionBudgetV1Beta1(ctx, AddPodDisruptionBudgetInputV1Beta1{
Namespace: input.Namespace,
ClientSet: workloadClient,
Budget: budgetV1Beta1,
})

// If Kubernetes >= 1.21.0 then we need to use PDB from v1
} else {
budget := &policyv1.PodDisruptionBudget{
TypeMeta: metav1.TypeMeta{
Kind: "PodDisruptionBudget",
APIVersion: "policy/v1",
},
},
ObjectMeta: metav1.ObjectMeta{
Name: input.DeploymentName,
Namespace: input.Namespace,
},
Spec: policyv1.PodDisruptionBudgetSpec{
Selector: &metav1.LabelSelector{
MatchLabels: map[string]string{
"app": "nonstop",
},
},
MaxUnavailable: &intstr.IntOrString{
Type: intstr.Int,
IntVal: 1,
StrVal: "1",
},
},
}

AddPodDisruptionBudget(ctx, AddPodDisruptionBudgetInput{
Namespace: input.Namespace,
ClientSet: workloadClient,
Budget: budget,
})
}
AddPodDisruptionBudget(ctx, AddPodDisruptionBudgetInput{
Namespace: input.Namespace,
ClientSet: workloadClient,
Budget: budget,
})

WaitForDeploymentsAvailable(ctx, WaitForDeploymentsAvailableInput{
Getter: input.WorkloadClusterProxy.GetClient(),
Expand All @@ -449,11 +490,29 @@ func AddDeploymentToWorkloadCluster(ctx context.Context, input AddDeploymentToWo

type AddPodDisruptionBudgetInput struct {
ClientSet *kubernetes.Clientset
Budget *v1beta1.PodDisruptionBudget
Budget *policyv1.PodDisruptionBudget
Namespace string
}

func AddPodDisruptionBudget(ctx context.Context, input AddPodDisruptionBudgetInput) {
Eventually(func() error {
budget, err := input.ClientSet.PolicyV1().PodDisruptionBudgets(input.Namespace).Create(ctx, input.Budget, metav1.CreateOptions{})
if budget != nil && err == nil {
return nil
}
return fmt.Errorf("podDisruptionBudget needs to be successfully deployed: %v", err)
}, retryableOperationTimeout, retryableOperationInterval).Should(Succeed(), "podDisruptionBudget needs to be successfully deployed")
}

// TODO(oscr): Delete below when Kubernetes 1.20 support is dropped.

type AddPodDisruptionBudgetInputV1Beta1 struct {
ClientSet *kubernetes.Clientset
Budget *v1beta1.PodDisruptionBudget
Namespace string
}

func AddPodDisruptionBudgetV1Beta1(ctx context.Context, input AddPodDisruptionBudgetInputV1Beta1) {
Eventually(func() error {
budget, err := input.ClientSet.PolicyV1beta1().PodDisruptionBudgets(input.Namespace).Create(ctx, input.Budget, metav1.CreateOptions{})
if budget != nil && err == nil {
Expand Down
2 changes: 1 addition & 1 deletion test/infrastructure/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ ENV GOPROXY=$goproxy
# Gets additional CAPD dependencies
WORKDIR /tmp

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

Expand Down
4 changes: 2 additions & 2 deletions test/infrastructure/docker/examples/machine-pool.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ metadata:
namespace: default
spec:
replicas: 1
version: v1.24.0
version: v1.25.0
machineTemplate:
infrastructureRef:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
Expand Down Expand Up @@ -80,7 +80,7 @@ spec:
replicas: 2
template:
spec:
version: v1.24.0
version: v1.25.0
clusterName: my-cluster
bootstrap:
configRef:
Expand Down
4 changes: 2 additions & 2 deletions test/infrastructure/docker/examples/simple-cluster-ipv6.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ metadata:
namespace: default
spec:
replicas: 1
version: v1.24.0
version: v1.25.0
machineTemplate:
infrastructureRef:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
Expand Down Expand Up @@ -90,7 +90,7 @@ spec:
cluster.x-k8s.io/cluster-name: my-cluster
template:
spec:
version: v1.24.0
version: v1.25.0
clusterName: my-cluster
bootstrap:
configRef:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ metadata:
name: controlplane-0
namespace: default
spec:
version: v1.24.0
version: v1.25.0
clusterName: my-cluster
bootstrap:
configRef:
Expand Down Expand Up @@ -80,7 +80,7 @@ spec:
cluster.x-k8s.io/cluster-name: my-cluster
template:
spec:
version: v1.24.0
version: v1.25.0
clusterName: my-cluster
bootstrap:
configRef:
Expand Down
4 changes: 2 additions & 2 deletions test/infrastructure/docker/examples/simple-cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ metadata:
namespace: default
spec:
replicas: 1
version: v1.24.0
version: v1.25.0
machineTemplate:
infrastructureRef:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
Expand Down Expand Up @@ -83,7 +83,7 @@ spec:
cluster.x-k8s.io/cluster-name: my-cluster
template:
spec:
version: v1.24.0
version: v1.25.0
clusterName: my-cluster
bootstrap:
configRef:
Expand Down
2 changes: 1 addition & 1 deletion test/infrastructure/docker/internal/docker/machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ import (

const (
defaultImageName = "kindest/node"
defaultImageTag = "v1.24.0"
defaultImageTag = "v1.25.0"
)

type nodeCreator interface {
Expand Down