Skip to content
Open
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ hack/tools/bin
test/e2e/data/infrastructure-docker/**/cluster-template*.yaml
!test/e2e/data/infrastructure-docker/**/clusterclass-quick-start-runtimesdk.yaml
!test/e2e/data/infrastructure-docker/**/clusterclass-quick-start-runtimesdk-v1beta1.yaml
!test/e2e/data/infrastructure-docker/**/clusterclass-quick-start-runtimesdk-generateplan.yaml
!test/e2e/data/infrastructure-docker/**/cluster-template-in-memory.yaml
!test/e2e/data/infrastructure-docker/**/clusterclass-in-memory.yaml
test/e2e/data/infrastructure-docker/**/clusterclass-*.yaml
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,7 @@ generate-e2e-templates-main: $(KUSTOMIZE)
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/main/cluster-template-machine-pool --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/main/cluster-template-machine-pool.yaml
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/main/cluster-template-upgrades --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/main/cluster-template-upgrades.yaml
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/main/cluster-template-upgrades-runtimesdk --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/main/cluster-template-upgrades-runtimesdk.yaml
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/main/cluster-template-upgrades-runtimesdk-generateplan --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/main/cluster-template-upgrades-runtimesdk-generateplan.yaml
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/main/cluster-template-kcp-pre-drain --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/main/cluster-template-kcp-pre-drain.yaml
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/main/cluster-template-kcp-scale-in --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/main/cluster-template-kcp-scale-in.yaml
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/main/cluster-template-ipv6 --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/main/cluster-template-ipv6.yaml
Expand Down
36 changes: 36 additions & 0 deletions test/e2e/cluster_upgrade_runtimesdk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,42 @@ var _ = Describe("When performing chained upgrades for workload cluster using Cl
})
})

var _ = Describe("When performing chained upgrades for workload cluster using ClusterClass with generateUpgradePlanExtension in a different NS with RuntimeSDK [ClusterClass]", Label("ClusterClass"), func() {
ClusterUpgradeWithRuntimeSDKSpec(ctx, func() ClusterUpgradeWithRuntimeSDKSpecInput {
return ClusterUpgradeWithRuntimeSDKSpecInput{
E2EConfig: e2eConfig,
ClusterctlConfigPath: clusterctlConfigPath,
BootstrapClusterProxy: bootstrapClusterProxy,
ArtifactFolder: artifactFolder,
SkipCleanup: skipCleanup,
InfrastructureProvider: ptr.To("docker"),
PostUpgrade: func(proxy framework.ClusterProxy, namespace, clusterName string) {
// This check ensures that the resourceVersions are stable, i.e. it verifies there are no
// continuous reconciles when everything should be stable.
framework.ValidateResourceVersionStable(ctx, proxy, namespace, clusterctlcluster.FilterClusterObjectsWithNameFilter(clusterName))
},
// "upgrades-runtimesdk-generateplan" uses the ClusterClass with generateUpgradePlanExtension field set.
Flavor: ptr.To("upgrades-runtimesdk-generateplan"),
DeployClusterClassInSeparateNamespace: true,
// Setting Kubernetes version from
KubernetesVersionFrom: e2eConfig.MustGetVariable(KubernetesVersionChainedUpgradeFrom),
// use Kubernetes versions from the kind mapper
// Note: Ensure KUBERNETES_VERSION_UPGRADE_TO is always part of the list, this is required for cases where
// KUBERNETES_VERSION_UPGRADE_TO is not in the kind mapper, e.g. in the `e2e-latestk8s` prowjob.
// Note: KUBERNETES_VERSION_UPGRADE_TO has to be set either to one version in kind.GetKubernetesVersions() or
// to a version greater than the last in the list by at most one minor version.
KubernetesVersions: appendIfNecessary(kind.GetKubernetesVersions(), e2eConfig.MustGetVariable(KubernetesVersionUpgradeTo)),
// The runtime extension gets deployed to the test-extension-system namespace and is exposed
// by the test-extension-webhook-service.
// The below values are used when creating the cluster-wide ExtensionConfig to refer
// the actual service.
ExtensionServiceNamespace: "test-extension-system",
ExtensionServiceName: "test-extension-webhook-service",
ExtensionConfigName: "k8s-chained-upgrade-with-runtimesdk-generateplan-cross-ns",
}
})
})

func appendIfNecessary(versions []string, v string) []string {
for _, version := range versions {
if version == v {
Expand Down
2 changes: 2 additions & 0 deletions test/e2e/config/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@ providers:
- sourcePath: "../data/infrastructure-docker/main/cluster-template-kcp-pre-drain.yaml"
- sourcePath: "../data/infrastructure-docker/main/cluster-template-upgrades.yaml"
- sourcePath: "../data/infrastructure-docker/main/cluster-template-upgrades-runtimesdk.yaml"
- sourcePath: "../data/infrastructure-docker/main/cluster-template-upgrades-runtimesdk-generateplan.yaml"
- sourcePath: "../data/infrastructure-docker/main/cluster-template-kcp-scale-in.yaml"
- sourcePath: "../data/infrastructure-docker/main/cluster-template-ipv6.yaml"
- sourcePath: "../data/infrastructure-docker/main/cluster-template-topology-dualstack-ipv6-primary.yaml"
Expand All @@ -353,6 +354,7 @@ providers:
- sourcePath: "../data/infrastructure-docker/main/clusterclass-quick-start.yaml"
- sourcePath: "../data/infrastructure-docker/main/clusterclass-quick-start-kcp-only.yaml"
- sourcePath: "../data/infrastructure-docker/main/clusterclass-quick-start-runtimesdk.yaml"
- sourcePath: "../data/infrastructure-docker/main/clusterclass-quick-start-runtimesdk-generateplan.yaml"
- sourcePath: "../data/infrastructure-docker/main/clusterclass-quick-start-runtimesdk-v1beta1.yaml"
- sourcePath: "../data/infrastructure-docker/main/clusterclass-in-memory.yaml"
- sourcePath: "../data/shared/main/metadata.yaml"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
apiVersion: cluster.x-k8s.io/v1beta2
kind: Cluster
metadata:
name: '${CLUSTER_NAME}'
namespace: default
labels:
cni: "${CLUSTER_NAME}-crs-0"
spec:
clusterNetwork:
services:
cidrBlocks: ['${DOCKER_SERVICE_CIDRS}']
pods:
cidrBlocks: ['${DOCKER_POD_CIDRS}']
serviceDomain: '${DOCKER_SERVICE_DOMAIN}'
topology:
classRef:
name: "quick-start-runtimesdk-generateplan"
namespace: '${CLUSTER_CLASS_NAMESPACE:-${NAMESPACE}}'
version: "${KUBERNETES_VERSION}"
controlPlane:
deletion:
nodeDeletionTimeoutSeconds: 30
replicas: ${CONTROL_PLANE_MACHINE_COUNT}
workers:
machineDeployments:
- class: "default-worker"
name: "md-0"
deletion:
nodeDeletionTimeoutSeconds: 30
nodeVolumeDetachTimeoutSeconds: 300
minReadySeconds: 5
replicas: ${WORKER_MACHINE_COUNT}
failureDomain: fd4
machinePools:
- class: "default-worker"
name: "mp-0"
deletion:
nodeDeletionTimeoutSeconds: 30
nodeVolumeDetachTimeoutSeconds: 300
minReadySeconds: 5
replicas: ${WORKER_MACHINE_COUNT}
failureDomains:
- fd4
variables:
- name: kubeadmControlPlaneMaxSurge
value: "1"
- name: imageRepository
value: "kindest"
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
resources:
- ../bases/crs.yaml
- cluster-runtimesdk-generateplan.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
apiVersion: cluster.x-k8s.io/v1beta2
kind: ClusterClass
metadata:
name: quick-start-runtimesdk-generateplan
spec:
controlPlane:
templateRef:
apiVersion: controlplane.cluster.x-k8s.io/v1beta2
kind: KubeadmControlPlaneTemplate
name: quick-start-control-plane
machineInfrastructure:
templateRef:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
kind: DockerMachineTemplate
name: quick-start-control-plane
naming:
template: "{{ .cluster.name }}-cp-{{ .random }}"
infrastructure:
templateRef:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
kind: DockerClusterTemplate
name: quick-start-cluster
naming:
template: "{{ .cluster.name }}-infra-{{ .random }}"
workers:
machineDeployments:
- class: default-worker
naming:
template: "{{ .cluster.name }}-md-{{ .machineDeployment.topologyName }}-{{ .random }}"
bootstrap:
templateRef:
apiVersion: bootstrap.cluster.x-k8s.io/v1beta2
kind: KubeadmConfigTemplate
name: quick-start-default-worker-bootstraptemplate
infrastructure:
templateRef:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
kind: DockerMachineTemplate
name: quick-start-default-worker-machinetemplate
machinePools:
- class: default-worker
naming:
template: "{{ .cluster.name }}-mp-{{ .machinePool.topologyName }}-{{ .random }}"
bootstrap:
templateRef:
apiVersion: bootstrap.cluster.x-k8s.io/v1beta2
kind: KubeadmConfigTemplate
name: quick-start-default-worker-bootstraptemplate
infrastructure:
templateRef:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
kind: DockerMachinePoolTemplate
name: quick-start-default-worker-machinepooltemplate
patches:
- name: test-patch
external:
generatePatchesExtension: generate-patches.${EXTENSION_CONFIG_NAME:-k8s-upgrade-with-runtimesdk}
validateTopologyExtension: validate-topology.${EXTENSION_CONFIG_NAME:-k8s-upgrade-with-runtimesdk}
discoverVariablesExtension: discover-variables.${EXTENSION_CONFIG_NAME:-k8s-upgrade-with-runtimesdk}
upgrade:
external:
generateUpgradePlanExtension: generate-upgrade-plan.${EXTENSION_CONFIG_NAME:-k8s-upgrade-with-runtimesdk}
Comment on lines +60 to +62
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sivchari if I got this right, this is the only difference between the test introduced by this PR and the existing runtime SDK test.

If this is correct, considering that this test takes long, I would be ok if we move this change to clusterclass-quick-start-runtimesdk and have only one test (I'm also considering that we have good test coverage for the different ways of computing upgrade plan, and that the runtime extension internally uses the same func we use when only kubernetes versions are set).

wdyt?
@sbueringer opinions?

Copy link
Member

@sbueringer sbueringer Nov 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. Let's just add this to the clusterclass-quick-start-runtimesdk ClusterClass and revert the rest of the changes on this PR

@sivchari Sorry we didn't think about this when writing up the tasks

---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
kind: DockerClusterTemplate
metadata:
name: quick-start-cluster
spec:
template:
spec:
failureDomains:
- name: fd1
controlPlane: true
- name: fd2
controlPlane: true
- name: fd3
controlPlane: true
- name: fd4
controlPlane: false
- name: fd5
controlPlane: false
- name: fd6
controlPlane: false
- name: fd7
controlPlane: false
- name: fd8
controlPlane: false
---
kind: KubeadmControlPlaneTemplate
apiVersion: controlplane.cluster.x-k8s.io/v1beta2
metadata:
name: quick-start-control-plane
spec:
template:
spec:
machineTemplate:
spec:
deletion:
nodeDrainTimeoutSeconds: 1
kubeadmConfigSpec:
clusterConfiguration:
apiServer:
# host.docker.internal is required by kubetest when running on MacOS because of the way ports are proxied.
certSANs: [localhost, 127.0.0.1, 0.0.0.0, host.docker.internal]
encryptionAlgorithm: "RSA-4096"
---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
kind: DockerMachineTemplate
metadata:
name: quick-start-control-plane
spec:
template:
spec:
extraMounts:
- containerPath: "/var/run/docker.sock"
hostPath: "/var/run/docker.sock"
preLoadImages: ${DOCKER_PRELOAD_IMAGES:-[]}
---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
kind: DockerMachineTemplate
metadata:
name: quick-start-default-worker-machinetemplate
spec:
template:
spec:
extraMounts:
- containerPath: "/var/run/docker.sock"
hostPath: "/var/run/docker.sock"
preLoadImages: ${DOCKER_PRELOAD_IMAGES:-[]}
---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
kind: DockerMachinePoolTemplate
metadata:
name: quick-start-default-worker-machinepooltemplate
spec:
template:
spec:
template:
extraMounts:
- containerPath: "/var/run/docker.sock"
hostPath: "/var/run/docker.sock"
preLoadImages: ${DOCKER_PRELOAD_IMAGES:-[]}
---
apiVersion: bootstrap.cluster.x-k8s.io/v1beta2
kind: KubeadmConfigTemplate
metadata:
name: quick-start-default-worker-bootstraptemplate