-
Notifications
You must be signed in to change notification settings - Fork 1.4k
🐛 Restore v1alpha3/v1alpha4 conversion to fix SSA issue & add e2e test coverage #10147
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
Merged
k8s-ci-robot
merged 14 commits into
kubernetes-sigs:main
from
sbueringer:pr-fix-apiversion-issue-with-fix
Feb 14, 2024
Merged
Changes from 1 commit
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
a5b57ce
Restore v1alpha4 types
sbueringer f8f75ad
Restore v1alpha3 types
sbueringer 8d9c7d4
Restore kubeadm v1beta1 types
sbueringer 524bf9f
Move core, KCP and CABPK types to internal
sbueringer 9b8e59f
Fix & ignore linter findings
sbueringer 8a416d9
Update Makefile to use internal paths
sbueringer f713dc4
Regenerate CRD YAMLs
sbueringer b010dbd
Regenerate deepcopy files
sbueringer eb01358
Regenerate conversion files and fix conversion
sbueringer d7b30cb
Implement import restrictions for CAPD v1alpha3
sbueringer abb86cd
Add e2e test to reproduce SSA apiVersion issue
sbueringer d94a842
Add e2e test to reproduce SSA apiVersion issue - add v1alpha3 test
sbueringer b7c8d8e
Fix build tags for generated conversion code
sbueringer c5508cf
Address review comments
sbueringer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,15 @@ providers: | |
- name: cluster-api | ||
type: CoreProvider | ||
versions: | ||
- name: "{go://sigs.k8s.io/[email protected]}" # latest published release in the v1alpha4 series; this is used for v1alpha4 --> v1beta1 clusterctl upgrades test only. | ||
value: "https://github.com/kubernetes-sigs/cluster-api/releases/download/{go://sigs.k8s.io/[email protected]}/core-components.yaml" | ||
type: "url" | ||
contract: v1alpha4 | ||
replacements: | ||
- old: --metrics-addr=127.0.0.1:8080 | ||
new: --metrics-addr=:8080 | ||
files: | ||
- sourcePath: "../data/shared/v0.4/metadata.yaml" | ||
- name: "{go://sigs.k8s.io/[email protected]}" # supported release in the v1beta1 series; this is used for v1beta1 --> main clusterctl upgrades test only. | ||
value: "https://github.com/kubernetes-sigs/cluster-api/releases/download/{go://sigs.k8s.io/[email protected]}/core-components.yaml" | ||
type: "url" | ||
|
@@ -73,6 +82,15 @@ providers: | |
- name: kubeadm | ||
type: BootstrapProvider | ||
versions: | ||
- name: "{go://sigs.k8s.io/[email protected]}" # latest published release in the v1alpha4 series; this is used for v1alpha4 --> v1beta1 clusterctl upgrades test only. | ||
value: "https://github.com/kubernetes-sigs/cluster-api/releases/download/{go://sigs.k8s.io/[email protected]}/bootstrap-components.yaml" | ||
type: "url" | ||
contract: v1alpha4 | ||
replacements: | ||
- old: --metrics-addr=127.0.0.1:8080 | ||
new: --metrics-addr=:8080 | ||
files: | ||
- sourcePath: "../data/shared/v0.4/metadata.yaml" | ||
- name: "{go://sigs.k8s.io/[email protected]}" # supported release in the v1beta1 series; this is used for v1beta1 --> main clusterctl upgrades test only. | ||
value: "https://github.com/kubernetes-sigs/cluster-api/releases/download/{go://sigs.k8s.io/[email protected]}/bootstrap-components.yaml" | ||
type: "url" | ||
|
@@ -111,6 +129,15 @@ providers: | |
- name: kubeadm | ||
type: ControlPlaneProvider | ||
versions: | ||
- name: "{go://sigs.k8s.io/[email protected]}" # latest published release in the v1alpha4 series; this is used for v1alpha4 --> v1beta1 clusterctl upgrades test only. | ||
value: "https://github.com/kubernetes-sigs/cluster-api/releases/download/{go://sigs.k8s.io/[email protected]}/control-plane-components.yaml" | ||
type: "url" | ||
contract: v1alpha4 | ||
replacements: | ||
- old: --metrics-addr=127.0.0.1:8080 | ||
new: --metrics-addr=:8080 | ||
files: | ||
- sourcePath: "../data/shared/v0.4/metadata.yaml" | ||
- name: "{go://sigs.k8s.io/[email protected]}" # supported release in the v1beta1 series; this is used for v1beta1 --> main clusterctl upgrades test only. | ||
value: "https://github.com/kubernetes-sigs/cluster-api/releases/download/{go://sigs.k8s.io/[email protected]}/control-plane-components.yaml" | ||
type: "url" | ||
|
@@ -149,6 +176,16 @@ providers: | |
- name: docker | ||
type: InfrastructureProvider | ||
versions: | ||
- name: "{go://sigs.k8s.io/[email protected]}" # latest published release in the v1alpha4 series; this is used for v1alpha4 --> v1beta1 clusterctl upgrades test only. | ||
value: "https://github.com/kubernetes-sigs/cluster-api/releases/download/{go://sigs.k8s.io/[email protected]}/infrastructure-components-development.yaml" | ||
type: "url" | ||
contract: v1alpha4 | ||
replacements: | ||
- old: --metrics-addr=127.0.0.1:8080 | ||
new: --metrics-addr=:8080 | ||
files: | ||
- sourcePath: "../data/shared/v0.4/metadata.yaml" | ||
- sourcePath: "../data/infrastructure-docker/v0.4/cluster-template.yaml" | ||
- name: "{go://sigs.k8s.io/[email protected]}" # supported release in the v1beta1 series; this is used for v1beta1 --> main clusterctl upgrades test only. | ||
value: "https://github.com/kubernetes-sigs/cluster-api/releases/download/{go://sigs.k8s.io/[email protected]}/infrastructure-components-development.yaml" | ||
type: "url" | ||
|
87 changes: 87 additions & 0 deletions
87
test/e2e/data/infrastructure-docker/v0.4/bases/cluster-with-kcp.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
--- | ||
# DockerCluster object referenced by the Cluster object | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4 | ||
kind: DockerCluster | ||
metadata: | ||
name: '${CLUSTER_NAME}' | ||
--- | ||
# Cluster object with | ||
# - Reference to the KubeadmControlPlane object | ||
# - the label cni=${CLUSTER_NAME}-crs-0, so the cluster can be selected by the ClusterResourceSet. | ||
apiVersion: cluster.x-k8s.io/v1alpha4 | ||
kind: Cluster | ||
metadata: | ||
name: '${CLUSTER_NAME}' | ||
labels: | ||
cni: "${CLUSTER_NAME}-crs-0" | ||
spec: | ||
clusterNetwork: | ||
services: | ||
cidrBlocks: ['${DOCKER_SERVICE_CIDRS}'] | ||
pods: | ||
cidrBlocks: ['${DOCKER_POD_CIDRS}'] | ||
serviceDomain: '${DOCKER_SERVICE_DOMAIN}' | ||
infrastructureRef: | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4 | ||
kind: DockerCluster | ||
name: '${CLUSTER_NAME}' | ||
controlPlaneRef: | ||
kind: KubeadmControlPlane | ||
apiVersion: controlplane.cluster.x-k8s.io/v1alpha4 | ||
name: "${CLUSTER_NAME}-control-plane" | ||
--- | ||
# DockerMachineTemplate object referenced by the KubeadmControlPlane object | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4 | ||
kind: DockerMachineTemplate | ||
metadata: | ||
name: "${CLUSTER_NAME}-control-plane" | ||
spec: | ||
template: | ||
spec: | ||
# NOTE: If the Kubernetes version is changed in `clusterctl_upgrade_test.go` the image and SHA must be updated here. | ||
customImage: "kindest/node:v1.23.17@sha256:f77f8cf0b30430ca4128cc7cfafece0c274a118cd0cdb251049664ace0dee4ff" | ||
extraMounts: | ||
- containerPath: "/var/run/docker.sock" | ||
hostPath: "/var/run/docker.sock" | ||
--- | ||
# KubeadmControlPlane referenced by the Cluster object with | ||
# - the label kcp-adoption.step2, because it should be created in the second step of the kcp-adoption test. | ||
kind: KubeadmControlPlane | ||
apiVersion: controlplane.cluster.x-k8s.io/v1alpha4 | ||
metadata: | ||
name: "${CLUSTER_NAME}-control-plane" | ||
labels: | ||
kcp-adoption.step2: "" | ||
spec: | ||
replicas: ${CONTROL_PLANE_MACHINE_COUNT} | ||
machineTemplate: | ||
infrastructureRef: | ||
kind: DockerMachineTemplate | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4 | ||
name: "${CLUSTER_NAME}-control-plane" | ||
kubeadmConfigSpec: | ||
clusterConfiguration: | ||
controllerManager: | ||
extraArgs: {enable-hostpath-provisioner: 'true'} | ||
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] | ||
initConfiguration: | ||
nodeRegistration: | ||
criSocket: unix:///var/run/containerd/containerd.sock | ||
kubeletExtraArgs: | ||
# We have to pin the cgroupDriver to cgroupfs for Kubernetes < v1.24 because kind does not support systemd for those versions, but kubeadm >= 1.21 defaults to systemd. | ||
# This cluster is used in tests where the Kubernetes version is < 1.24 | ||
cgroup-driver: cgroupfs | ||
eviction-hard: 'nodefs.available<0%,nodefs.inodesFree<0%,imagefs.available<0%' | ||
fail-swap-on: "false" | ||
joinConfiguration: | ||
nodeRegistration: | ||
criSocket: unix:///var/run/containerd/containerd.sock | ||
kubeletExtraArgs: | ||
# We have to pin the cgroupDriver to cgroupfs for Kubernetes < v1.24 because kind does not support systemd for those versions, but kubeadm >= 1.21 defaults to systemd. | ||
# This cluster is used in tests where the Kubernetes version is < 1.24 | ||
cgroup-driver: cgroupfs | ||
eviction-hard: 'nodefs.available<0%,nodefs.inodesFree<0%,imagefs.available<0%' | ||
fail-swap-on: "false" | ||
version: "${KUBERNETES_VERSION}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
# ConfigMap object referenced by the ClusterResourceSet object and with | ||
# the CNI resource defined in the test config file | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: "cni-${CLUSTER_NAME}-crs-0" | ||
data: ${CNI_RESOURCES} | ||
binaryData: | ||
--- | ||
# ClusterResourceSet object with | ||
# a selector that targets all the Cluster with label cni=${CLUSTER_NAME}-crs-0 | ||
apiVersion: addons.cluster.x-k8s.io/v1alpha4 | ||
kind: ClusterResourceSet | ||
metadata: | ||
name: "${CLUSTER_NAME}-crs-0" | ||
spec: | ||
strategy: ApplyOnce | ||
clusterSelector: | ||
matchLabels: | ||
cni: "${CLUSTER_NAME}-crs-0" | ||
resources: | ||
- name: "cni-${CLUSTER_NAME}-crs-0" | ||
kind: ConfigMap |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
--- | ||
# DockerMachineTemplate referenced by the MachineDeployment and with | ||
# - extraMounts for the docker sock, thus allowing self-hosting test | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4 | ||
kind: DockerMachineTemplate | ||
metadata: | ||
name: "${CLUSTER_NAME}-md-0" | ||
spec: | ||
template: | ||
spec: | ||
# NOTE: If the Kubernetes version is changed in `clusterctl_upgrade_test.go` the image and SHA must be updated here. | ||
customImage: "kindest/node:v1.23.17@sha256:f77f8cf0b30430ca4128cc7cfafece0c274a118cd0cdb251049664ace0dee4ff" | ||
extraMounts: | ||
- containerPath: "/var/run/docker.sock" | ||
hostPath: "/var/run/docker.sock" | ||
--- | ||
# KubeadmConfigTemplate referenced by the MachineDeployment | ||
apiVersion: bootstrap.cluster.x-k8s.io/v1alpha4 | ||
kind: KubeadmConfigTemplate | ||
metadata: | ||
name: "${CLUSTER_NAME}-md-0" | ||
spec: | ||
template: | ||
spec: | ||
joinConfiguration: | ||
nodeRegistration: | ||
criSocket: unix:///var/run/containerd/containerd.sock | ||
kubeletExtraArgs: | ||
# We have to pin the cgroupDriver to cgroupfs for Kubernetes < v1.24 because kind does not support systemd for those versions, but kubeadm >= 1.21 defaults to systemd. | ||
# This cluster is used in tests where the Kubernetes version is < 1.24 | ||
cgroup-driver: cgroupfs | ||
eviction-hard: 'nodefs.available<0%,nodefs.inodesFree<0%,imagefs.available<0%' | ||
fail-swap-on: "false" | ||
--- | ||
# MachineDeployment object | ||
apiVersion: cluster.x-k8s.io/v1alpha4 | ||
kind: MachineDeployment | ||
metadata: | ||
name: "${CLUSTER_NAME}-md-0" | ||
spec: | ||
clusterName: "${CLUSTER_NAME}" | ||
replicas: ${WORKER_MACHINE_COUNT} | ||
selector: | ||
matchLabels: | ||
template: | ||
spec: | ||
clusterName: "${CLUSTER_NAME}" | ||
version: "${KUBERNETES_VERSION}" | ||
bootstrap: | ||
configRef: | ||
name: "${CLUSTER_NAME}-md-0" | ||
apiVersion: bootstrap.cluster.x-k8s.io/v1alpha4 | ||
kind: KubeadmConfigTemplate | ||
infrastructureRef: | ||
name: "${CLUSTER_NAME}-md-0" | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4 | ||
kind: DockerMachineTemplate |
4 changes: 4 additions & 0 deletions
4
test/e2e/data/infrastructure-docker/v0.4/cluster-template/kustomization.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
bases: | ||
- ../bases/cluster-with-kcp.yaml | ||
- ../bases/md.yaml | ||
- ../bases/crs.yaml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apiVersion: clusterctl.cluster.x-k8s.io/v1alpha3 | ||
kind: Metadata | ||
releaseSeries: | ||
- major: 0 | ||
minor: 4 | ||
contract: v1alpha4 | ||
- major: 0 | ||
minor: 3 | ||
contract: v1alpha3 | ||
- major: 0 | ||
minor: 2 | ||
contract: v1alpha2 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.