@@ -21,9 +21,6 @@ package e2e
2121
2222import (
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" } {
0 commit comments