Repository: vmware-tanzu/tanzu-framework (language: go)

Issue:
CNI variable is not imported on vsphere template
**Bug description**
`get_vsphere_vars` is filtering the variables imported in the Cluster object, `cni` is not in the list and must be added to be rendered in the cluster object. This affects json in line patches and functions that rely on this variable.

**Affected product area (please put an X in all that apply)**

- ( ) APIs
- ( ) Addons
- ( ) CLI
- ( ) Docs
- ( ) IAM
- (x) Installation
- (x) Plugin
- ( ) Security
- ( ) Test and Release
- ( ) User Experience
- ( ) Developer Experience

**Expected behavior**
To have data.values.CNI imported in the variables list

**Steps to reproduce the bug**
Set a CNI: none and observe the Cluster object having cni: antrea as variable.

**Version** (include the SHA if the version is not obvious)
2.1

**Environment where the bug was observed (cloud, OS, etc)**

**Relevant Debug Output (Logs, manifests, etc)**



Discussion / hints:

Fix patch:
diff --git a/packages/tkg-clusterclass-vsphere/bundle/config/upstream/base.yaml b/packages/tkg-clusterclass-vsphere/bundle/config/upstream/base.yaml
index 0d9eff58fa..948b2722c7 100644
--- a/packages/tkg-clusterclass-vsphere/bundle/config/upstream/base.yaml
+++ b/packages/tkg-clusterclass-vsphere/bundle/config/upstream/base.yaml
@@ -1889,9 +1889,19 @@ spec:
           path: 'C:\k\prevent_windows_updates.ps1'
           content: |
             Set-Service -Name "wuauserv" -StartupType Disabled -Status Stopped
+      - op: add
+        path: /spec/template/spec/files/-
+        value:
+          content: |
+            # Disable firewall for SSH and OVS access
+            Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled False
+          path: C:\k\disable_firewall.ps1
       - op: add
         path: /spec/template/spec/postKubeadmCommands/-
         value: powershell c:/k/prevent_windows_updates.ps1 -ExecutionPolicy Bypass
+      - op: add
+        path: /spec/template/spec/postKubeadmCommands/-
+        value: powershell c:/k/disable_firewall.ps1
       - op: replace
         path: /spec/template/spec/users
         valueFrom:
@@ -1933,9 +1943,6 @@ spec:
                 return $SaToken
             }
 
-            # Disable firewall temporarily for SSH and other internal ports access
-            Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled False
-
             $TempFolder = 'C:\programdata\temp'
             $AntreaInTempFolder = "$TempFolder\antrea-windows-advanced.zip"
             $KubeproxyInTempFolder = "$TempFolder\kube-proxy.exe"
diff --git a/providers/infrastructure-vsphere/v1.5.1/cconly/base.yaml b/providers/infrastructure-vsphere/v1.5.1/cconly/base.yaml
index 0d9eff58fa..948b2722c7 100644
--- a/providers/infrastructure-vsphere/v1.5.1/cconly/base.yaml
+++ b/providers/infrastructure-vsphere/v1.5.1/cconly/base.yaml
@@ -1889,9 +1889,19 @@ spec:
           path: 'C:\k\prevent_windows_updates.ps1'
           content: |
             Set-Service -Name "wuauserv" -StartupType Disabled -Status Stopped
+      - op: add
+        path: /spec/template/spec/files/-
+        value:
+          content: |
+            # Disable firewall for SSH and OVS access
+            Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled False
+          path: C:\k\disable_firewall.ps1
       - op: add
         path: /spec/template/spec/postKubeadmCommands/-
         value: powershell c:/k/prevent_windows_updates.ps1 -ExecutionPolicy Bypass
+      - op: add
+        path: /spec/template/spec/postKubeadmCommands/-
+        value: powershell c:/k/disable_firewall.ps1
       - op: replace
         path: /spec/template/spec/users
         valueFrom:
@@ -1933,9 +1943,6 @@ spec:
                 return $SaToken
             }
 
-            # Disable firewall temporarily for SSH and other internal ports access
-            Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled False
-
             $TempFolder = 'C:\programdata\temp'
             $AntreaInTempFolder = "$TempFolder\antrea-windows-advanced.zip"
             $KubeproxyInTempFolder = "$TempFolder\kube-proxy.exe"
diff --git a/providers/infrastructure-vsphere/v1.5.1/yttcc/overlay.yaml b/providers/infrastructure-vsphere/v1.5.1/yttcc/overlay.yaml
index 12d4addf30..8266d6a722 100644
--- a/providers/infrastructure-vsphere/v1.5.1/yttcc/overlay.yaml
+++ b/providers/infrastructure-vsphere/v1.5.1/yttcc/overlay.yaml
@@ -137,7 +137,7 @@ spec:
     variables:
     #@ vars = get_vsphere_vars()
     #@ for configVariable in vars:
-    #@  if vars[configVariable] != None and configVariable in ["workerKubeletExtraArgs","controlPlaneKubeletExtraArgs","kubeControllerManagerExtraArgs","kubeSchedulerExtraArgs","apiServerExtraArgs","etcdExtraArgs", "apiServerPort", "controlPlane", "worker", "vcenter", "VSPHERE_WINDOWS_TEMPLATE", "apiServerEndpoint", "network", "imageRepository", "trust", "user", "auditLogging", "aviAPIServerHAProvider", "ntpServers", "TKR_DATA", "proxy", "kubeVipLoadBalancerProvider", "additionalFQDN", "controlPlaneCertificateRotation", "podSecurityStandard", "eventRateLimitConf"]:
+    #@  if vars[configVariable] != None and configVariable in ["workerKubeletExtraArgs","controlPlaneKubeletExtraArgs","kubeControllerManagerExtraArgs","kubeSchedulerExtraArgs","apiServerExtraArgs","etcdExtraArgs", "apiServerPort", "controlPlane", "worker", "vcenter", "VSPHERE_WINDOWS_TEMPLATE", "cni", "apiServerEndpoint", "network", "imageRepository", "trust", "user", "auditLogging", "aviAPIServerHAProvider", "ntpServers", "TKR_DATA", "proxy", "kubeVipLoadBalancerProvider", "additionalFQDN", "controlPlaneCertificateRotation", "podSecurityStandard", "eventRateLimitConf"]:
     - name: #@ configVariable
       value: #@ vars[configVariable]
     #@ end


Test patch: