Skip to content

Commit 2e7a707

Browse files
committed
Remove dead helm e2e code
1 parent b92b4b6 commit 2e7a707

File tree

4 files changed

+29
-200
lines changed

4 files changed

+29
-200
lines changed

test/e2e/cloud-provider-azure.go

Lines changed: 20 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ package e2e
2121

2222
import (
2323
"context"
24-
"fmt"
25-
"os"
26-
"strings"
2724

2825
. "github.com/onsi/ginkgo/v2"
2926
. "github.com/onsi/gomega"
@@ -44,40 +41,14 @@ const (
4441

4542
// EnsureCNIAndCloudProviderAzureHelmChart installs the official cloud-provider-azure helm chart
4643
// and a CNI and validates that expected pods exist and are Ready.
47-
func EnsureCNIAndCloudProviderAzureHelmChart(ctx context.Context, input clusterctl.ApplyCustomClusterTemplateAndWaitInput, installHelmChart bool, cidrBlocks []string, hasWindows bool) {
44+
func EnsureCNIAndCloudProviderAzureHelmChart(ctx context.Context, input clusterctl.ApplyCustomClusterTemplateAndWaitInput, hasWindows bool) {
4845
specName := "ensure-cloud-provider-azure"
4946
clusterProxy := input.ClusterProxy.GetWorkloadCluster(ctx, input.Namespace, input.ClusterName)
5047

51-
if installHelmChart {
52-
By("Installing cloud-provider-azure components via helm")
53-
options := &HelmOptions{
54-
Values: []string{
55-
fmt.Sprintf("infra.clusterName=%s", input.ClusterName),
56-
"cloudControllerManager.logVerbosity=4",
57-
},
58-
StringValues: []string{fmt.Sprintf("cloudControllerManager.clusterCIDR=%s", strings.Join(cidrBlocks, `\,`))},
59-
}
60-
// If testing a CI version of Kubernetes, use CCM and CNM images built from source.
61-
if useCIArtifacts || usePRArtifacts {
62-
options.Values = append(options.Values, fmt.Sprintf("cloudControllerManager.imageName=%s", os.Getenv("CCM_IMAGE_NAME")))
63-
options.Values = append(options.Values, fmt.Sprintf("cloudNodeManager.imageName=%s", os.Getenv("CNM_IMAGE_NAME")))
64-
options.Values = append(options.Values, fmt.Sprintf("cloudControllerManager.imageRepository=%s", os.Getenv("IMAGE_REGISTRY")))
65-
options.Values = append(options.Values, fmt.Sprintf("cloudNodeManager.imageRepository=%s", os.Getenv("IMAGE_REGISTRY")))
66-
options.StringValues = append(options.StringValues, fmt.Sprintf("cloudControllerManager.imageTag=%s", os.Getenv("IMAGE_TAG_CCM")))
67-
options.StringValues = append(options.StringValues, fmt.Sprintf("cloudNodeManager.imageTag=%s", os.Getenv("IMAGE_TAG_CNM")))
68-
}
69-
70-
if strings.Contains(input.ClusterName, "flatcar") {
71-
options.StringValues = append(options.StringValues, "cloudControllerManager.caCertDir=/usr/share/ca-certificates")
72-
}
73-
74-
InstallHelmChart(ctx, clusterProxy, defaultNamespace, cloudProviderAzureHelmRepoURL, cloudProviderAzureChartName, cloudProviderAzureHelmReleaseName, options, "")
75-
} else {
76-
By("Ensuring cloud-provider-azure is installed via CAAPH")
77-
}
48+
By("Ensuring cloud-provider-azure is installed via CAAPH")
7849

7950
// We do this before waiting for the pods to be ready because there is a co-dependency between CNI (nodes ready) and cloud-provider being initialized.
80-
EnsureCNI(ctx, input, installHelmChart, cidrBlocks, hasWindows)
51+
EnsureCNI(ctx, input, hasWindows)
8152

8253
By("Waiting for Ready cloud-controller-manager deployment pods")
8354
for _, d := range []string{"cloud-controller-manager"} {
@@ -87,40 +58,28 @@ func EnsureCNIAndCloudProviderAzureHelmChart(ctx context.Context, input clusterc
8758
}
8859

8960
// EnsureAzureDiskCSIDriverHelmChart installs the official azure-disk CSI driver helm chart
90-
func EnsureAzureDiskCSIDriverHelmChart(ctx context.Context, input clusterctl.ApplyCustomClusterTemplateAndWaitInput, installHelmChart bool, hasWindows bool) {
61+
func EnsureAzureDiskCSIDriverHelmChart(ctx context.Context, input clusterctl.ApplyCustomClusterTemplateAndWaitInput) {
9162
specName := "ensure-azuredisk-csi-drivers"
9263
clusterProxy := input.ClusterProxy.GetWorkloadCluster(ctx, input.Namespace, input.ClusterName)
9364
mgmtClient := input.ClusterProxy.GetClient()
9465

95-
if installHelmChart {
96-
By("Installing azure-disk CSI driver components via helm")
97-
options := &HelmOptions{
98-
Values: []string{"controller.replicas=1", "controller.runOnControlPlane=true"},
99-
}
100-
// TODO: make this always true once HostProcessContainers are on for all supported k8s versions.
101-
if hasWindows {
102-
options.Values = append(options.Values, "windows.useHostProcessContainers=true")
103-
}
104-
InstallHelmChart(ctx, clusterProxy, kubesystem, azureDiskCSIDriverHelmRepoURL, azureDiskCSIDriverChartName, azureDiskCSIDriverHelmReleaseName, options, "")
105-
} else {
106-
By("Ensuring azure-disk CSI driver is installed via CAAPH")
107-
cluster := &clusterv1.Cluster{}
108-
Eventually(func(g Gomega) {
109-
g.Expect(mgmtClient.Get(ctx, types.NamespacedName{
110-
Namespace: input.Namespace,
111-
Name: input.ClusterName,
112-
}, cluster)).To(Succeed())
113-
// Label the cluster so that CAAPH installs the azuredisk-csi helm chart via existing HelmChartProxy resource
114-
if cluster.Labels != nil {
115-
cluster.Labels[azureDiskCSIDriverCAAPHLabelName] = "true"
116-
} else {
117-
cluster.Labels = map[string]string{
118-
azureDiskCSIDriverCAAPHLabelName: "true",
119-
}
66+
By("Ensuring azure-disk CSI driver is installed via CAAPH")
67+
cluster := &clusterv1.Cluster{}
68+
Eventually(func(g Gomega) {
69+
g.Expect(mgmtClient.Get(ctx, types.NamespacedName{
70+
Namespace: input.Namespace,
71+
Name: input.ClusterName,
72+
}, cluster)).To(Succeed())
73+
// Label the cluster so that CAAPH installs the azuredisk-csi helm chart via existing HelmChartProxy resource
74+
if cluster.Labels != nil {
75+
cluster.Labels[azureDiskCSIDriverCAAPHLabelName] = "true"
76+
} else {
77+
cluster.Labels = map[string]string{
78+
azureDiskCSIDriverCAAPHLabelName: "true",
12079
}
121-
g.Expect(mgmtClient.Update(ctx, cluster)).To(Succeed())
122-
}, e2eConfig.GetIntervals(specName, "wait-deployment")...).Should(Succeed())
123-
}
80+
}
81+
g.Expect(mgmtClient.Update(ctx, cluster)).To(Succeed())
82+
}, e2eConfig.GetIntervals(specName, "wait-deployment")...).Should(Succeed())
12483

12584
By("Waiting for Ready csi-azuredisk-controller deployment pods")
12685
for _, d := range []string{"csi-azuredisk-controller"} {

test/e2e/cni.go

Lines changed: 4 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,10 @@ package e2e
2121

2222
import (
2323
"context"
24-
"fmt"
2524
"os"
26-
"path/filepath"
2725

2826
. "github.com/onsi/ginkgo/v2"
2927
. "github.com/onsi/gomega"
30-
k8snet "k8s.io/utils/net"
3128
"sigs.k8s.io/cluster-api/test/framework/clusterctl"
3229
)
3330

@@ -43,11 +40,11 @@ const (
4340
)
4441

4542
// EnsureCNI installs the CNI plugin depending on the input.CNIManifestPath
46-
func EnsureCNI(ctx context.Context, input clusterctl.ApplyCustomClusterTemplateAndWaitInput, installHelmChart bool, cidrBlocks []string, hasWindows bool) {
43+
func EnsureCNI(ctx context.Context, input clusterctl.ApplyCustomClusterTemplateAndWaitInput, hasWindows bool) {
4744
if input.CNIManifestPath != "" {
4845
InstallCNIManifest(ctx, input)
4946
} else {
50-
EnsureCalicoIsReady(ctx, input, installHelmChart, cidrBlocks, hasWindows)
47+
EnsureCalicoIsReady(ctx, input, hasWindows)
5148
}
5249
}
5350

@@ -63,17 +60,11 @@ func InstallCNIManifest(ctx context.Context, input clusterctl.ApplyCustomCluster
6360
}
6461

6562
// EnsureCalicoIsReady copies the kubeadm configmap to the calico-system namespace and waits for the calico pods to be ready.
66-
func EnsureCalicoIsReady(ctx context.Context, input clusterctl.ApplyCustomClusterTemplateAndWaitInput, installHelmChart bool, cidrBlocks []string, hasWindows bool) {
63+
func EnsureCalicoIsReady(ctx context.Context, input clusterctl.ApplyCustomClusterTemplateAndWaitInput, hasWindows bool) {
6764
specName := "ensure-calico"
6865

6966
clusterProxy := input.ClusterProxy.GetWorkloadCluster(ctx, input.Namespace, input.ClusterName)
70-
if installHelmChart {
71-
By("Installing Calico CNI via Helm Chart")
72-
values := getCalicoValues(cidrBlocks)
73-
InstallHelmChart(ctx, clusterProxy, calicoOperatorNamespace, calicoHelmChartRepoURL, calicoHelmChartName, calicoHelmReleaseName, values, os.Getenv(CalicoVersion))
74-
} else {
75-
By("Ensuring Calico CNI is installed via CAAPH")
76-
}
67+
By("Ensuring Calico CNI is installed via CAAPH")
7768

7869
By("Copying kubeadm config map to calico-system namespace")
7970
workloadClusterClient := clusterProxy.GetClient()
@@ -100,38 +91,3 @@ func EnsureCalicoIsReady(ctx context.Context, input clusterctl.ApplyCustomCluste
10091
WaitForDeploymentsAvailable(ctx, waitInput, e2eConfig.GetIntervals(specName, "wait-deployment")...)
10192
}
10293
}
103-
104-
func getCalicoValues(cidrBlocks []string) *HelmOptions {
105-
var ipv6CidrBlock, ipv4CidrBlock string
106-
var values *HelmOptions
107-
for _, cidr := range cidrBlocks {
108-
if k8snet.IsIPv6CIDRString(cidr) {
109-
ipv6CidrBlock = cidr
110-
} else {
111-
Expect(k8snet.IsIPv4CIDRString(cidr)).To(BeTrue(), "CIDR %s is not a valid IPv4 or IPv6 CIDR", cidr)
112-
ipv4CidrBlock = cidr
113-
}
114-
}
115-
addonsPath := e2eConfig.MustGetVariable(AddonsPath)
116-
switch {
117-
case ipv6CidrBlock != "" && ipv4CidrBlock != "":
118-
By("Configuring calico CNI helm chart for dual-stack configuration")
119-
values = &HelmOptions{
120-
StringValues: []string{fmt.Sprintf("installation.calicoNetwork.ipPools[0].cidr=%s", ipv4CidrBlock), fmt.Sprintf("installation.calicoNetwork.ipPools[1].cidr=%s", ipv6CidrBlock)},
121-
ValueFiles: []string{filepath.Join(addonsPath, "calico-dual-stack", "values.yaml")},
122-
}
123-
case ipv6CidrBlock != "":
124-
By("Configuring calico CNI helm chart for IPv6 configuration")
125-
values = &HelmOptions{
126-
StringValues: []string{fmt.Sprintf("installation.calicoNetwork.ipPools[0].cidr=%s", ipv6CidrBlock)},
127-
ValueFiles: []string{filepath.Join(addonsPath, "calico-ipv6", "values.yaml")},
128-
}
129-
default:
130-
By("Configuring calico CNI helm chart for IPv4 configuration")
131-
values = &HelmOptions{
132-
StringValues: []string{fmt.Sprintf("installation.calicoNetwork.ipPools[0].cidr=%s", ipv4CidrBlock)},
133-
ValueFiles: []string{filepath.Join(addonsPath, "calico", "values.yaml")},
134-
}
135-
}
136-
return values
137-
}

test/e2e/common.go

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -253,27 +253,19 @@ func createRestConfig(ctx context.Context, tmpdir, namespace, clusterName string
253253
return config
254254
}
255255

256-
// EnsureControlPlaneInitialized waits for the cluster KubeadmControlPlane object to be initialized
257-
// and then installs cloud-provider-azure components via Helm.
258-
// Fulfills the clusterctl.Waiter type so that it can be used as ApplyClusterTemplateAndWaitInput data
259-
// in the flow of a clusterctl.ApplyClusterTemplateAndWait E2E test scenario.
260-
func EnsureControlPlaneInitialized(ctx context.Context, input clusterctl.ApplyCustomClusterTemplateAndWaitInput, result *clusterctl.ApplyCustomClusterTemplateAndWaitResult) {
261-
ensureControlPlaneInitialized(ctx, input, result, true)
262-
}
263-
264256
// EnsureControlPlaneInitializedNoAddons waits for the cluster KubeadmControlPlane object to be initialized
265257
// and then installs cloud-provider-azure components via Helm.
266258
// Fulfills the clusterctl.Waiter type so that it can be used as ApplyClusterTemplateAndWaitInput data
267259
// in the flow of a clusterctl.ApplyClusterTemplateAndWait E2E test scenario.
268260
func EnsureControlPlaneInitializedNoAddons(ctx context.Context, input clusterctl.ApplyCustomClusterTemplateAndWaitInput, result *clusterctl.ApplyCustomClusterTemplateAndWaitResult) {
269-
ensureControlPlaneInitialized(ctx, input, result, false)
261+
ensureControlPlaneInitialized(ctx, input, result)
270262
}
271263

272264
// ensureControlPlaneInitialized waits for the cluster KubeadmControlPlane object to be initialized
273265
// and then installs cloud-provider-azure components via Helm.
274266
// Fulfills the clusterctl.Waiter type so that it can be used as ApplyClusterTemplateAndWaitInput data
275267
// in the flow of a clusterctl.ApplyClusterTemplateAndWait E2E test scenario.
276-
func ensureControlPlaneInitialized(ctx context.Context, input clusterctl.ApplyCustomClusterTemplateAndWaitInput, result *clusterctl.ApplyCustomClusterTemplateAndWaitResult, installHelmCharts bool) {
268+
func ensureControlPlaneInitialized(ctx context.Context, input clusterctl.ApplyCustomClusterTemplateAndWaitInput, result *clusterctl.ApplyCustomClusterTemplateAndWaitResult) {
277269
getter := input.ClusterProxy.GetClient()
278270
cluster := framework.GetClusterByName(ctx, framework.GetClusterByNameInput{
279271
Getter: getter,
@@ -303,12 +295,12 @@ func ensureControlPlaneInitialized(ctx context.Context, input clusterctl.ApplyCu
303295

304296
if kubeadmControlPlane.Spec.KubeadmConfigSpec.ClusterConfiguration.ControllerManager.ExtraArgs["cloud-provider"] != infrav1.AzureNetworkPluginName {
305297
// There is a co-dependency between cloud-provider and CNI so we install both together if cloud-provider is external.
306-
EnsureCNIAndCloudProviderAzureHelmChart(ctx, input, installHelmCharts, cluster.Spec.ClusterNetwork.Pods.CIDRBlocks, hasWindows)
298+
EnsureCNIAndCloudProviderAzureHelmChart(ctx, input, hasWindows)
307299
} else {
308-
EnsureCNI(ctx, input, installHelmCharts, cluster.Spec.ClusterNetwork.Pods.CIDRBlocks, hasWindows)
300+
EnsureCNI(ctx, input, hasWindows)
309301
}
310302
controlPlane := discoveryAndWaitForControlPlaneInitialized(ctx, input, result)
311-
EnsureAzureDiskCSIDriverHelmChart(ctx, input, installHelmCharts, hasWindows)
303+
EnsureAzureDiskCSIDriverHelmChart(ctx, input)
312304
result.ControlPlane = controlPlane
313305
}
314306

test/e2e/helm.go

Lines changed: 0 additions & 78 deletions
This file was deleted.

0 commit comments

Comments
 (0)