diff --git a/pkg/providers/cloudstack/controlplane_test.go b/pkg/providers/cloudstack/controlplane_test.go index 78d2bdfa111fc..13c9b629bb70f 100644 --- a/pkg/providers/cloudstack/controlplane_test.go +++ b/pkg/providers/cloudstack/controlplane_test.go @@ -607,7 +607,7 @@ func cloudstackMachineTemplate(name string) *cloudstackv1.CloudStackMachineTempl Template: cloudstackv1.CloudStackMachineTemplateResource{ Spec: cloudstackv1.CloudStackMachineSpec{ Template: cloudstackv1.CloudStackResourceIdentifier{ - Name: "centos7-k8s-118", + Name: "kubernetes_1_21", }, Offering: cloudstackv1.CloudStackResourceIdentifier{ Name: "m4-large", diff --git a/pkg/providers/cloudstack/testdata/cluster_main.yaml b/pkg/providers/cloudstack/testdata/cluster_main.yaml index 9c908a09a31d5..90f6b308d37f1 100644 --- a/pkg/providers/cloudstack/testdata/cluster_main.yaml +++ b/pkg/providers/cloudstack/testdata/cluster_main.yaml @@ -65,7 +65,7 @@ spec: sshAuthorizedKeys: # The key below was manually generated and not used in any production systems - "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC1BK73XhIzjX+meUr7pIYh6RHbvI3tmHeQIXY5lv7aztN1UoX+bhPo3dwo2sfSQn5kuxgQdnxIZ/CTzy0p0GkEYVv3gwspCeurjmu0XmrdmaSGcGxCEWT/65NtvYrQtUE5ELxJ+N/aeZNlK2B7IWANnw/82913asXH4VksV1NYNduP0o1/G4XcwLLSyVFB078q/oEnmvdNIoS61j4/o36HVtENJgYr0idcBvwJdvcGxGnPaqOhx477t+kfJAa5n5dSA5wilIaoXH5i1Tf/HsTCM52L+iNCARvQzJYZhzbWI1MDQwzILtIBEQCJsl2XSqIupleY8CxqQ6jCXt2mhae+wPc3YmbO5rFvr2/EvC57kh3yDs1Nsuj8KOvD78KeeujbR8n8pScm3WDp62HFQ8lEKNdeRNj6kB8WnuaJvPnyZfvzOhwG65/9w13IBl7B1sWxbFnq2rMpm5uHVK7mAmjL0Tt8zoDhcE1YJEnp9xte3/pvmKPkST5Q/9ZtR9P5sI+02jY0fvPkPyC03j2gsPixG7rpOCwpOdbny4dcj0TDeeXJX8er+oVfJuLYz0pNWJcT2raDdFfcqvYA0B0IyNYlj5nWX4RuEcyT3qocLReWPnZojetvAG/H8XwOh7fEVGqHAKOVSnPXCSQJPl6s0H12jPJBDJMTydtYPEszl4/CeQ== testemail@test.com" template: - name: "centos7-k8s-118" + name: "kubernetes_1_21" diskOffering: name: "Small" mountPath: "/data-small" @@ -90,7 +90,7 @@ spec: sshAuthorizedKeys: # The key below was manually generated and not used in any production systems - "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC1BK73XhIzjX+meUr7pIYh6RHbvI3tmHeQIXY5lv7aztN1UoX+bhPo3dwo2sfSQn5kuxgQdnxIZ/CTzy0p0GkEYVv3gwspCeurjmu0XmrdmaSGcGxCEWT/65NtvYrQtUE5ELxJ+N/aeZNlK2B7IWANnw/82913asXH4VksV1NYNduP0o1/G4XcwLLSyVFB078q/oEnmvdNIoS61j4/o36HVtENJgYr0idcBvwJdvcGxGnPaqOhx477t+kfJAa5n5dSA5wilIaoXH5i1Tf/HsTCM52L+iNCARvQzJYZhzbWI1MDQwzILtIBEQCJsl2XSqIupleY8CxqQ6jCXt2mhae+wPc3YmbO5rFvr2/EvC57kh3yDs1Nsuj8KOvD78KeeujbR8n8pScm3WDp62HFQ8lEKNdeRNj6kB8WnuaJvPnyZfvzOhwG65/9w13IBl7B1sWxbFnq2rMpm5uHVK7mAmjL0Tt8zoDhcE1YJEnp9xte3/pvmKPkST5Q/9ZtR9P5sI+02jY0fvPkPyC03j2gsPixG7rpOCwpOdbny4dcj0TDeeXJX8er+oVfJuLYz0pNWJcT2raDdFfcqvYA0B0IyNYlj5nWX4RuEcyT3qocLReWPnZojetvAG/H8XwOh7fEVGqHAKOVSnPXCSQJPl6s0H12jPJBDJMTydtYPEszl4/CeQ== testemail@test.com" template: - name: "centos7-k8s-118" + name: "kubernetes_1_21" diskOffering: name: "Small" mountPath: "/data-small" @@ -118,7 +118,7 @@ spec: sshAuthorizedKeys: # The key below was manually generated and not used in any production systems - "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC1BK73XhIzjX+meUr7pIYh6RHbvI3tmHeQIXY5lv7aztN1UoX+bhPo3dwo2sfSQn5kuxgQdnxIZ/CTzy0p0GkEYVv3gwspCeurjmu0XmrdmaSGcGxCEWT/65NtvYrQtUE5ELxJ+N/aeZNlK2B7IWANnw/82913asXH4VksV1NYNduP0o1/G4XcwLLSyVFB078q/oEnmvdNIoS61j4/o36HVtENJgYr0idcBvwJdvcGxGnPaqOhx477t+kfJAa5n5dSA5wilIaoXH5i1Tf/HsTCM52L+iNCARvQzJYZhzbWI1MDQwzILtIBEQCJsl2XSqIupleY8CxqQ6jCXt2mhae+wPc3YmbO5rFvr2/EvC57kh3yDs1Nsuj8KOvD78KeeujbR8n8pScm3WDp62HFQ8lEKNdeRNj6kB8WnuaJvPnyZfvzOhwG65/9w13IBl7B1sWxbFnq2rMpm5uHVK7mAmjL0Tt8zoDhcE1YJEnp9xte3/pvmKPkST5Q/9ZtR9P5sI+02jY0fvPkPyC03j2gsPixG7rpOCwpOdbny4dcj0TDeeXJX8er+oVfJuLYz0pNWJcT2raDdFfcqvYA0B0IyNYlj5nWX4RuEcyT3qocLReWPnZojetvAG/H8XwOh7fEVGqHAKOVSnPXCSQJPl6s0H12jPJBDJMTydtYPEszl4/CeQ== testemail@test.com" template: - name: "centos7-k8s-118" + name: "kubernetes_1_21" diskOffering: name: "Small" mountPath: "/data-small" diff --git a/pkg/providers/cloudstack/testdata/cluster_main_with_cp_node_labels.yaml b/pkg/providers/cloudstack/testdata/cluster_main_with_cp_node_labels.yaml index aa9d214b73ab5..9b10683fbc9cd 100644 --- a/pkg/providers/cloudstack/testdata/cluster_main_with_cp_node_labels.yaml +++ b/pkg/providers/cloudstack/testdata/cluster_main_with_cp_node_labels.yaml @@ -64,7 +64,7 @@ spec: sshAuthorizedKeys: # The key below was manually generated and not used in any production systems - "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC1BK73XhIzjX+meUr7pIYh6RHbvI3tmHeQIXY5lv7aztN1UoX+bhPo3dwo2sfSQn5kuxgQdnxIZ/CTzy0p0GkEYVv3gwspCeurjmu0XmrdmaSGcGxCEWT/65NtvYrQtUE5ELxJ+N/aeZNlK2B7IWANnw/82913asXH4VksV1NYNduP0o1/G4XcwLLSyVFB078q/oEnmvdNIoS61j4/o36HVtENJgYr0idcBvwJdvcGxGnPaqOhx477t+kfJAa5n5dSA5wilIaoXH5i1Tf/HsTCM52L+iNCARvQzJYZhzbWI1MDQwzILtIBEQCJsl2XSqIupleY8CxqQ6jCXt2mhae+wPc3YmbO5rFvr2/EvC57kh3yDs1Nsuj8KOvD78KeeujbR8n8pScm3WDp62HFQ8lEKNdeRNj6kB8WnuaJvPnyZfvzOhwG65/9w13IBl7B1sWxbFnq2rMpm5uHVK7mAmjL0Tt8zoDhcE1YJEnp9xte3/pvmKPkST5Q/9ZtR9P5sI+02jY0fvPkPyC03j2gsPixG7rpOCwpOdbny4dcj0TDeeXJX8er+oVfJuLYz0pNWJcT2raDdFfcqvYA0B0IyNYlj5nWX4RuEcyT3qocLReWPnZojetvAG/H8XwOh7fEVGqHAKOVSnPXCSQJPl6s0H12jPJBDJMTydtYPEszl4/CeQ== testemail@test.com" template: - name: "centos7-k8s-118" + name: "kubernetes_1_21" diskOffering: name: "Small" mountPath: "/data-small" @@ -87,7 +87,7 @@ spec: sshAuthorizedKeys: # The key below was manually generated and not used in any production systems - "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC1BK73XhIzjX+meUr7pIYh6RHbvI3tmHeQIXY5lv7aztN1UoX+bhPo3dwo2sfSQn5kuxgQdnxIZ/CTzy0p0GkEYVv3gwspCeurjmu0XmrdmaSGcGxCEWT/65NtvYrQtUE5ELxJ+N/aeZNlK2B7IWANnw/82913asXH4VksV1NYNduP0o1/G4XcwLLSyVFB078q/oEnmvdNIoS61j4/o36HVtENJgYr0idcBvwJdvcGxGnPaqOhx477t+kfJAa5n5dSA5wilIaoXH5i1Tf/HsTCM52L+iNCARvQzJYZhzbWI1MDQwzILtIBEQCJsl2XSqIupleY8CxqQ6jCXt2mhae+wPc3YmbO5rFvr2/EvC57kh3yDs1Nsuj8KOvD78KeeujbR8n8pScm3WDp62HFQ8lEKNdeRNj6kB8WnuaJvPnyZfvzOhwG65/9w13IBl7B1sWxbFnq2rMpm5uHVK7mAmjL0Tt8zoDhcE1YJEnp9xte3/pvmKPkST5Q/9ZtR9P5sI+02jY0fvPkPyC03j2gsPixG7rpOCwpOdbny4dcj0TDeeXJX8er+oVfJuLYz0pNWJcT2raDdFfcqvYA0B0IyNYlj5nWX4RuEcyT3qocLReWPnZojetvAG/H8XwOh7fEVGqHAKOVSnPXCSQJPl6s0H12jPJBDJMTydtYPEszl4/CeQ== testemail@test.com" template: - name: "centos7-k8s-118" + name: "kubernetes_1_21" diskOffering: name: "Small" mountPath: "/data-small" @@ -115,7 +115,7 @@ spec: sshAuthorizedKeys: # The key below was manually generated and not used in any production systems - "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC1BK73XhIzjX+meUr7pIYh6RHbvI3tmHeQIXY5lv7aztN1UoX+bhPo3dwo2sfSQn5kuxgQdnxIZ/CTzy0p0GkEYVv3gwspCeurjmu0XmrdmaSGcGxCEWT/65NtvYrQtUE5ELxJ+N/aeZNlK2B7IWANnw/82913asXH4VksV1NYNduP0o1/G4XcwLLSyVFB078q/oEnmvdNIoS61j4/o36HVtENJgYr0idcBvwJdvcGxGnPaqOhx477t+kfJAa5n5dSA5wilIaoXH5i1Tf/HsTCM52L+iNCARvQzJYZhzbWI1MDQwzILtIBEQCJsl2XSqIupleY8CxqQ6jCXt2mhae+wPc3YmbO5rFvr2/EvC57kh3yDs1Nsuj8KOvD78KeeujbR8n8pScm3WDp62HFQ8lEKNdeRNj6kB8WnuaJvPnyZfvzOhwG65/9w13IBl7B1sWxbFnq2rMpm5uHVK7mAmjL0Tt8zoDhcE1YJEnp9xte3/pvmKPkST5Q/9ZtR9P5sI+02jY0fvPkPyC03j2gsPixG7rpOCwpOdbny4dcj0TDeeXJX8er+oVfJuLYz0pNWJcT2raDdFfcqvYA0B0IyNYlj5nWX4RuEcyT3qocLReWPnZojetvAG/H8XwOh7fEVGqHAKOVSnPXCSQJPl6s0H12jPJBDJMTydtYPEszl4/CeQ== testemail@test.com" template: - name: "centos7-k8s-118" + name: "kubernetes_1_21" diskOffering: name: "Small" mountPath: "/data-small" diff --git a/pkg/providers/cloudstack/testdata/cluster_main_with_node_labels.yaml b/pkg/providers/cloudstack/testdata/cluster_main_with_node_labels.yaml index 44e0acb298dc8..e4b04a2b6edb4 100644 --- a/pkg/providers/cloudstack/testdata/cluster_main_with_node_labels.yaml +++ b/pkg/providers/cloudstack/testdata/cluster_main_with_node_labels.yaml @@ -64,7 +64,7 @@ spec: sshAuthorizedKeys: # The key below was manually generated and not used in any production systems - "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC1BK73XhIzjX+meUr7pIYh6RHbvI3tmHeQIXY5lv7aztN1UoX+bhPo3dwo2sfSQn5kuxgQdnxIZ/CTzy0p0GkEYVv3gwspCeurjmu0XmrdmaSGcGxCEWT/65NtvYrQtUE5ELxJ+N/aeZNlK2B7IWANnw/82913asXH4VksV1NYNduP0o1/G4XcwLLSyVFB078q/oEnmvdNIoS61j4/o36HVtENJgYr0idcBvwJdvcGxGnPaqOhx477t+kfJAa5n5dSA5wilIaoXH5i1Tf/HsTCM52L+iNCARvQzJYZhzbWI1MDQwzILtIBEQCJsl2XSqIupleY8CxqQ6jCXt2mhae+wPc3YmbO5rFvr2/EvC57kh3yDs1Nsuj8KOvD78KeeujbR8n8pScm3WDp62HFQ8lEKNdeRNj6kB8WnuaJvPnyZfvzOhwG65/9w13IBl7B1sWxbFnq2rMpm5uHVK7mAmjL0Tt8zoDhcE1YJEnp9xte3/pvmKPkST5Q/9ZtR9P5sI+02jY0fvPkPyC03j2gsPixG7rpOCwpOdbny4dcj0TDeeXJX8er+oVfJuLYz0pNWJcT2raDdFfcqvYA0B0IyNYlj5nWX4RuEcyT3qocLReWPnZojetvAG/H8XwOh7fEVGqHAKOVSnPXCSQJPl6s0H12jPJBDJMTydtYPEszl4/CeQ== testemail@test.com" template: - name: "centos7-k8s-118" + name: "kubernetes_1_21" diskOffering: name: "Small" mountPath: "/data-small" @@ -89,7 +89,7 @@ spec: sshAuthorizedKeys: # The key below was manually generated and not used in any production systems - "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC1BK73XhIzjX+meUr7pIYh6RHbvI3tmHeQIXY5lv7aztN1UoX+bhPo3dwo2sfSQn5kuxgQdnxIZ/CTzy0p0GkEYVv3gwspCeurjmu0XmrdmaSGcGxCEWT/65NtvYrQtUE5ELxJ+N/aeZNlK2B7IWANnw/82913asXH4VksV1NYNduP0o1/G4XcwLLSyVFB078q/oEnmvdNIoS61j4/o36HVtENJgYr0idcBvwJdvcGxGnPaqOhx477t+kfJAa5n5dSA5wilIaoXH5i1Tf/HsTCM52L+iNCARvQzJYZhzbWI1MDQwzILtIBEQCJsl2XSqIupleY8CxqQ6jCXt2mhae+wPc3YmbO5rFvr2/EvC57kh3yDs1Nsuj8KOvD78KeeujbR8n8pScm3WDp62HFQ8lEKNdeRNj6kB8WnuaJvPnyZfvzOhwG65/9w13IBl7B1sWxbFnq2rMpm5uHVK7mAmjL0Tt8zoDhcE1YJEnp9xte3/pvmKPkST5Q/9ZtR9P5sI+02jY0fvPkPyC03j2gsPixG7rpOCwpOdbny4dcj0TDeeXJX8er+oVfJuLYz0pNWJcT2raDdFfcqvYA0B0IyNYlj5nWX4RuEcyT3qocLReWPnZojetvAG/H8XwOh7fEVGqHAKOVSnPXCSQJPl6s0H12jPJBDJMTydtYPEszl4/CeQ== testemail@test.com" template: - name: "centos7-k8s-118" + name: "kubernetes_1_21" diskOffering: name: "Small" mountPath: "/data-small" @@ -114,7 +114,7 @@ spec: sshAuthorizedKeys: # The key below was manually generated and not used in any production systems - "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC1BK73XhIzjX+meUr7pIYh6RHbvI3tmHeQIXY5lv7aztN1UoX+bhPo3dwo2sfSQn5kuxgQdnxIZ/CTzy0p0GkEYVv3gwspCeurjmu0XmrdmaSGcGxCEWT/65NtvYrQtUE5ELxJ+N/aeZNlK2B7IWANnw/82913asXH4VksV1NYNduP0o1/G4XcwLLSyVFB078q/oEnmvdNIoS61j4/o36HVtENJgYr0idcBvwJdvcGxGnPaqOhx477t+kfJAa5n5dSA5wilIaoXH5i1Tf/HsTCM52L+iNCARvQzJYZhzbWI1MDQwzILtIBEQCJsl2XSqIupleY8CxqQ6jCXt2mhae+wPc3YmbO5rFvr2/EvC57kh3yDs1Nsuj8KOvD78KeeujbR8n8pScm3WDp62HFQ8lEKNdeRNj6kB8WnuaJvPnyZfvzOhwG65/9w13IBl7B1sWxbFnq2rMpm5uHVK7mAmjL0Tt8zoDhcE1YJEnp9xte3/pvmKPkST5Q/9ZtR9P5sI+02jY0fvPkPyC03j2gsPixG7rpOCwpOdbny4dcj0TDeeXJX8er+oVfJuLYz0pNWJcT2raDdFfcqvYA0B0IyNYlj5nWX4RuEcyT3qocLReWPnZojetvAG/H8XwOh7fEVGqHAKOVSnPXCSQJPl6s0H12jPJBDJMTydtYPEszl4/CeQ== testemail@test.com" template: - name: "centos7-k8s-118" + name: "kubernetes_1_21" diskOffering: name: "Small" mountPath: "/data-small" diff --git a/pkg/providers/cloudstack/testdata/expected_results_main_autoscaling_md.yaml b/pkg/providers/cloudstack/testdata/expected_results_main_autoscaling_md.yaml index 2dcf5cc5f7018..a4c30a6cd0469 100644 --- a/pkg/providers/cloudstack/testdata/expected_results_main_autoscaling_md.yaml +++ b/pkg/providers/cloudstack/testdata/expected_results_main_autoscaling_md.yaml @@ -124,7 +124,7 @@ spec: name: m4-large sshKey: "" template: - name: centos7-k8s-118 + name: kubernetes_1_21 --- diff --git a/pkg/providers/cloudstack/testdata/expected_results_main_cp.yaml b/pkg/providers/cloudstack/testdata/expected_results_main_cp.yaml index 4966a3b79541a..86f3338ebd378 100644 --- a/pkg/providers/cloudstack/testdata/expected_results_main_cp.yaml +++ b/pkg/providers/cloudstack/testdata/expected_results_main_cp.yaml @@ -453,7 +453,7 @@ spec: name: m4-large sshKey: "" template: - name: centos7-k8s-118 + name: kubernetes_1_21 --- apiVersion: infrastructure.cluster.x-k8s.io/v1beta3 @@ -484,6 +484,6 @@ spec: name: m4-large sshKey: "" template: - name: centos7-k8s-118 + name: kubernetes_1_21 --- diff --git a/pkg/providers/cloudstack/testdata/expected_results_main_md.yaml b/pkg/providers/cloudstack/testdata/expected_results_main_md.yaml index ee8e536461a80..2dd502dc8dad9 100644 --- a/pkg/providers/cloudstack/testdata/expected_results_main_md.yaml +++ b/pkg/providers/cloudstack/testdata/expected_results_main_md.yaml @@ -121,7 +121,7 @@ spec: name: m4-large sshKey: "" template: - name: centos7-k8s-118 + name: kubernetes_1_21 --- diff --git a/pkg/providers/cloudstack/testdata/expected_results_main_no_machinetemplate_update_cp.yaml b/pkg/providers/cloudstack/testdata/expected_results_main_no_machinetemplate_update_cp.yaml index c41c84c4d9c5e..a785f4077ce95 100644 --- a/pkg/providers/cloudstack/testdata/expected_results_main_no_machinetemplate_update_cp.yaml +++ b/pkg/providers/cloudstack/testdata/expected_results_main_no_machinetemplate_update_cp.yaml @@ -453,7 +453,7 @@ spec: name: m4-large sshKey: "" template: - name: centos7-k8s-118 + name: kubernetes_1_21 --- apiVersion: infrastructure.cluster.x-k8s.io/v1beta3 @@ -484,6 +484,6 @@ spec: name: m4-large sshKey: "" template: - name: centos7-k8s-118 + name: kubernetes_1_21 --- diff --git a/pkg/providers/cloudstack/testdata/expected_results_main_no_machinetemplate_update_md.yaml b/pkg/providers/cloudstack/testdata/expected_results_main_no_machinetemplate_update_md.yaml index 28016d6d5d05a..bc0ddda31c117 100644 --- a/pkg/providers/cloudstack/testdata/expected_results_main_no_machinetemplate_update_md.yaml +++ b/pkg/providers/cloudstack/testdata/expected_results_main_no_machinetemplate_update_md.yaml @@ -121,7 +121,7 @@ spec: name: m4-large sshKey: "" template: - name: centos7-k8s-118 + name: kubernetes_1_21 --- diff --git a/pkg/providers/cloudstack/testdata/expected_results_main_node_labels_cp.yaml b/pkg/providers/cloudstack/testdata/expected_results_main_node_labels_cp.yaml index 94eab6372fee8..2686ccbd064a5 100644 --- a/pkg/providers/cloudstack/testdata/expected_results_main_node_labels_cp.yaml +++ b/pkg/providers/cloudstack/testdata/expected_results_main_node_labels_cp.yaml @@ -439,7 +439,7 @@ spec: name: m4-large sshKey: "" template: - name: centos7-k8s-118 + name: kubernetes_1_21 --- apiVersion: infrastructure.cluster.x-k8s.io/v1beta3 @@ -469,6 +469,6 @@ spec: name: m4-large sshKey: "" template: - name: centos7-k8s-118 + name: kubernetes_1_21 --- diff --git a/pkg/providers/cloudstack/testdata/expected_results_main_node_labels_md.yaml b/pkg/providers/cloudstack/testdata/expected_results_main_node_labels_md.yaml index e15084a54bdc1..62855c097298e 100644 --- a/pkg/providers/cloudstack/testdata/expected_results_main_node_labels_md.yaml +++ b/pkg/providers/cloudstack/testdata/expected_results_main_node_labels_md.yaml @@ -107,7 +107,7 @@ spec: name: m4-large sshKey: "" template: - name: centos7-k8s-118 + name: kubernetes_1_21 --- diff --git a/pkg/providers/cloudstack/testdata/expected_results_resourceids_cp.yaml b/pkg/providers/cloudstack/testdata/expected_results_resourceids_cp.yaml index 36b73fdd41e2a..f1e7feb7ffa48 100644 --- a/pkg/providers/cloudstack/testdata/expected_results_resourceids_cp.yaml +++ b/pkg/providers/cloudstack/testdata/expected_results_resourceids_cp.yaml @@ -453,7 +453,7 @@ spec: name: m4-large sshKey: "" template: - name: centos7-k8s-118 + name: kubernetes_1_21 --- apiVersion: infrastructure.cluster.x-k8s.io/v1beta3 @@ -484,6 +484,6 @@ spec: name: m4-large sshKey: "" template: - name: centos7-k8s-118 + name: kubernetes_1_21 --- diff --git a/pkg/providers/cloudstack/validator.go b/pkg/providers/cloudstack/validator.go index 04f5c26cedf03..bbf4d6bcfd3e9 100644 --- a/pkg/providers/cloudstack/validator.go +++ b/pkg/providers/cloudstack/validator.go @@ -4,6 +4,7 @@ import ( "context" "errors" "fmt" + "strings" corev1 "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" @@ -117,11 +118,21 @@ func (v *Validator) ValidateClusterMachineConfigs(ctx context.Context, clusterSp return fmt.Errorf("cannot find CloudStackMachineConfig %v for control plane", clusterSpec.Cluster.Spec.ControlPlaneConfiguration.MachineGroupRef.Name) } + // validate template field name contains cluster kubernetes version for the control plane machine. + if err := v.validateTemplateMatchesKubernetesVersion(ctx, controlPlaneMachineConfig.Spec.Template.Name, string(clusterSpec.Cluster.Spec.KubernetesVersion)); err != nil { + return fmt.Errorf("machine config %s validation failed: %v", controlPlaneMachineConfig.Name, err) + } + if clusterSpec.Cluster.Spec.ExternalEtcdConfiguration != nil { etcdMachineConfig := etcdMachineConfig(clusterSpec) if etcdMachineConfig == nil { return fmt.Errorf("cannot find CloudStackMachineConfig %v for etcd machines", clusterSpec.Cluster.Spec.ExternalEtcdConfiguration.MachineGroupRef.Name) } + + // validate template field name contains cluster kubernetes version for the external etcd machine. + if err := v.validateTemplateMatchesKubernetesVersion(ctx, etcdMachineConfig.Spec.Template.Name, string(clusterSpec.Cluster.Spec.KubernetesVersion)); err != nil { + return fmt.Errorf("machine config %s validation failed: %v", etcdMachineConfig.Name, err) + } } for _, workerNodeGroupConfiguration := range clusterSpec.Cluster.Spec.WorkerNodeGroupConfigurations { @@ -129,6 +140,16 @@ func (v *Validator) ValidateClusterMachineConfigs(ctx context.Context, clusterSp if !ok { return fmt.Errorf("cannot find CloudStackMachineConfig %v for worker nodes", workerNodeGroupConfiguration.MachineGroupRef.Name) } + + version := string(clusterSpec.Cluster.Spec.KubernetesVersion) + // validate template field of worker group spec with the kubernetes version of each workerNodeGroup - in case of modular upgrade. + if workerNodeGroupConfiguration.KubernetesVersion != nil { + version = string(*workerNodeGroupConfiguration.KubernetesVersion) + } + templateName := clusterSpec.CloudStackMachineConfigs[workerNodeGroupConfiguration.MachineGroupRef.Name].Spec.Template.Name + if err := v.validateTemplateMatchesKubernetesVersion(ctx, templateName, version); err != nil { + return fmt.Errorf("machine config %s validation failed: %v", workerNodeGroupConfiguration.Name, err) + } } for _, machineConfig := range clusterSpec.CloudStackMachineConfigs { @@ -190,6 +211,22 @@ func (v *Validator) validateMachineConfig(ctx context.Context, datacenterConfig return nil } +func (v *Validator) validateTemplateMatchesKubernetesVersion(ctx context.Context, templateName string, kubernetesVersionName string) error { + // Replace 1.23, 1-23, 1_23 to 123 in the template name string. + templateReplacer := strings.NewReplacer("-", "", ".", "", "_", "") + template := templateReplacer.Replace(templateName) + // Replace 1-23 to 123 in the kubernetesversion string. + replacer := strings.NewReplacer(".", "") + kubernetesVersion := replacer.Replace(string(kubernetesVersionName)) + // This will return an error if the template name does not contain specified kubernetes version. + // For ex if the kubernetes version is 1.23, + // the template name should include 1.23 or 1-23, 1_23 or 123 i.e. kubernetes-1-23-eks in the string. + if !strings.Contains(template, kubernetesVersion) { + return fmt.Errorf("missing kube version from the machine config template name: template=%s, version=%s", templateName, string(kubernetesVersionName)) + } + return nil +} + // ValidateSecretsUnchanged checks the secret to see if it has not been changed. func (v *Validator) ValidateSecretsUnchanged(ctx context.Context, cluster *types.Cluster, execConfig *decoder.CloudStackExecConfig, client ProviderKubectlClient) error { for _, profile := range execConfig.Profiles { diff --git a/pkg/providers/cloudstack/validator_test.go b/pkg/providers/cloudstack/validator_test.go index ea077b9028443..a8561ff0f8b90 100644 --- a/pkg/providers/cloudstack/validator_test.go +++ b/pkg/providers/cloudstack/validator_test.go @@ -37,7 +37,7 @@ func (n *DummyNetClient) DialTimeout(network, address string, timeout time.Durat } var testTemplate = v1alpha1.CloudStackResourceIdentifier{ - Name: "centos7-k8s-118", + Name: "kubernetes_1_21", } var testOffering = v1alpha1.CloudStackResourceIdentifier{ @@ -397,6 +397,121 @@ func TestValidateSecretsUnchangedFailureSecretNotFound(t *testing.T) { assert.Nil(t, err) } +func TestValidateClusterMachineConfigsCPError(t *testing.T) { + ctx := context.Background() + cmk := mocks.NewMockProviderCmkClient(gomock.NewController(t)) + clusterSpec := test.NewFullClusterSpec(t, path.Join(testDataDir, testClusterConfigMainFilename)) + clusterSpec.CloudStackMachineConfigs["test-cp"].Spec.Template.Name = "kubernetes_1_22" + + validator := NewValidator(cmk, &DummyNetClient{}, true) + + err := validator.ValidateClusterMachineConfigs(ctx, clusterSpec) + if err == nil { + t.Fatalf("validation should not pass: %v", err) + } +} + +func TestValidateClusterMachineConfigsEtcdError(t *testing.T) { + ctx := context.Background() + cmk := mocks.NewMockProviderCmkClient(gomock.NewController(t)) + clusterSpec := test.NewFullClusterSpec(t, path.Join(testDataDir, testClusterConfigMainFilename)) + clusterSpec.CloudStackMachineConfigs["test-etcd"].Spec.Template.Name = "kubernetes_1_22" + + validator := NewValidator(cmk, &DummyNetClient{}, true) + + err := validator.ValidateClusterMachineConfigs(ctx, clusterSpec) + if err == nil { + t.Fatalf("validation should not pass: %v", err) + } +} + +func TestValidateClusterMachineConfigsError(t *testing.T) { + ctx := context.Background() + cmk := mocks.NewMockProviderCmkClient(gomock.NewController(t)) + clusterSpec := test.NewFullClusterSpec(t, path.Join(testDataDir, testClusterConfigMainFilename)) + clusterSpec.Cluster.Spec.KubernetesVersion = "1.22" + + validator := NewValidator(cmk, &DummyNetClient{}, true) + + err := validator.ValidateClusterMachineConfigs(ctx, clusterSpec) + if err == nil { + t.Fatalf("validation should not pass: %v", err) + } +} + +func TestValidateClusterMachineConfigsModularUpgradeError(t *testing.T) { + ctx := context.Background() + cmk := mocks.NewMockProviderCmkClient(gomock.NewController(t)) + clusterSpec := test.NewFullClusterSpec(t, path.Join(testDataDir, testClusterConfigMainFilename)) + kube122 := v1alpha1.KubernetesVersion("1.22") + clusterSpec.Cluster.Spec.WorkerNodeGroupConfigurations[0].KubernetesVersion = &kube122 + + validator := NewValidator(cmk, &DummyNetClient{}, true) + + err := validator.ValidateClusterMachineConfigs(ctx, clusterSpec) + if err == nil { + t.Fatalf("validation should not pass: %v", err) + } +} + +func TestValidateClusterMachineConfigsSuccess(t *testing.T) { + ctx := context.Background() + cmk := mocks.NewMockProviderCmkClient(gomock.NewController(t)) + clusterSpec := test.NewFullClusterSpec(t, path.Join(testDataDir, testClusterConfigMainFilename)) + + clusterSpec.Cluster.Spec.KubernetesVersion = "1.22" + clusterSpec.CloudStackMachineConfigs["test-cp"].Spec.Template.Name = "kubernetes_1_22" + clusterSpec.CloudStackMachineConfigs["test-etcd"].Spec.Template.Name = "kubernetes_1_22" + clusterSpec.CloudStackMachineConfigs["test"].Spec.Template.Name = "kubernetes_1_22" + + datacenterConfig, err := v1alpha1.GetCloudStackDatacenterConfig(path.Join(testDataDir, testClusterConfigMainFilename)) + if err != nil { + t.Fatalf("unable to get datacenter config from file") + } + + validator := NewValidator(cmk, &DummyNetClient{}, true) + + cmk.EXPECT().ValidateZoneAndGetId(ctx, gomock.Any(), gomock.Any()).Times(3).Return("4e3b338d-87a6-4189-b931-a1747edeea82", nil) + cmk.EXPECT().ValidateTemplatePresent(ctx, gomock.Any(), gomock.Any(), gomock.Any(), datacenterConfig.Spec.AvailabilityZones[0].Account, v1alpha1.CloudStackResourceIdentifier{Name: "kubernetes_1_22"}).Times(3) + cmk.EXPECT().ValidateServiceOfferingPresent(ctx, gomock.Any(), gomock.Any(), testOffering).Times(3) + cmk.EXPECT().ValidateDiskOfferingPresent(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Times(3) + cmk.EXPECT().ValidateAffinityGroupsPresent(ctx, gomock.Any(), gomock.Any(), datacenterConfig.Spec.AvailabilityZones[0].Account, gomock.Any()).Times(3) + + err = validator.ValidateClusterMachineConfigs(ctx, clusterSpec) + if err != nil { + t.Fatalf("validation should pass: %v", err) + } +} + +func TestValidateClusterMachineConfigsModularUpgradeSuccess(t *testing.T) { + ctx := context.Background() + cmk := mocks.NewMockProviderCmkClient(gomock.NewController(t)) + clusterSpec := test.NewFullClusterSpec(t, path.Join(testDataDir, testClusterConfigMainFilename)) + + kube122 := v1alpha1.KubernetesVersion("1.22") + clusterSpec.Cluster.Spec.WorkerNodeGroupConfigurations[0].KubernetesVersion = &kube122 + clusterSpec.CloudStackMachineConfigs["test"].Spec.Template.Name = "kubernetes_1_22" + + datacenterConfig, err := v1alpha1.GetCloudStackDatacenterConfig(path.Join(testDataDir, testClusterConfigMainFilename)) + if err != nil { + t.Fatalf("unable to get datacenter config from file") + } + + validator := NewValidator(cmk, &DummyNetClient{}, true) + + cmk.EXPECT().ValidateZoneAndGetId(ctx, gomock.Any(), gomock.Any()).Times(3).Return("4e3b338d-87a6-4189-b931-a1747edeea82", nil) + cmk.EXPECT().ValidateTemplatePresent(ctx, gomock.Any(), gomock.Any(), gomock.Any(), datacenterConfig.Spec.AvailabilityZones[0].Account, v1alpha1.CloudStackResourceIdentifier{Name: "kubernetes_1_22"}) + cmk.EXPECT().ValidateTemplatePresent(ctx, gomock.Any(), gomock.Any(), gomock.Any(), datacenterConfig.Spec.AvailabilityZones[0].Account, testTemplate).Times(2) + cmk.EXPECT().ValidateServiceOfferingPresent(ctx, gomock.Any(), gomock.Any(), testOffering).Times(3) + cmk.EXPECT().ValidateDiskOfferingPresent(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Times(3) + cmk.EXPECT().ValidateAffinityGroupsPresent(ctx, gomock.Any(), gomock.Any(), datacenterConfig.Spec.AvailabilityZones[0].Account, gomock.Any()).Times(3) + + err = validator.ValidateClusterMachineConfigs(ctx, clusterSpec) + if err != nil { + t.Fatalf("validation should pass: %v", err) + } +} + var testProfiles = []decoder.CloudStackProfileConfig{ { Name: "global",