Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ func (r *HostedClusterReconciler) reconcileNetworkPolicies(ctx context.Context,
}

// ManagementKASNetworkPolicy restricts traffic for pods unless they have a known annotation.
if controlPlaneOperatorAppliesManagementKASNetworkPolicyLabel && hcluster.Spec.Platform.Type == hyperv1.AWSPlatform {
if controlPlaneOperatorAppliesManagementKASNetworkPolicyLabel &&
(hcluster.Spec.Platform.Type == hyperv1.AWSPlatform || hcluster.Spec.Platform.Type == hyperv1.AzurePlatform) {
policy = networkpolicy.ManagementKASNetworkPolicy(controlPlaneNamespaceName)
if _, err := createOrUpdate(ctx, r.Client, policy, func() error {
return reconcileManagementKASNetworkPolicy(policy, managementClusterNetwork, kubernetesEndpoint, r.ManagementClusterCapabilities.Has(capabilities.CapabilityDNS))
Expand Down
7 changes: 5 additions & 2 deletions test/e2e/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ var expectedKasManagementComponents = []string{
"cloud-controller-manager",
"olm-collect-profiles",
"aws-ebs-csi-driver-operator",
"azure-disk-csi-driver-operator",
"azure-file-csi-driver-operator",
"karpenter",
"karpenter-operator",
"featuregate-generator",
Expand Down Expand Up @@ -993,8 +995,8 @@ func EnsureAllRoutesUseHCPRouter(t *testing.T, ctx context.Context, hostClient c

func EnsureNetworkPolicies(t *testing.T, ctx context.Context, c crclient.Client, hostedCluster *hyperv1.HostedCluster) {
t.Run("EnsureNetworkPolicies", func(t *testing.T) {
if hostedCluster.Spec.Platform.Type != hyperv1.AWSPlatform {
t.Skipf("test only supported on AWS platform, saw %s", hostedCluster.Spec.Platform.Type)
if hostedCluster.Spec.Platform.Type != hyperv1.AWSPlatform && hostedCluster.Spec.Platform.Type != hyperv1.AzurePlatform {
t.Skipf("test only supported on AWS and Azure platforms, saw %s", hostedCluster.Spec.Platform.Type)
}

hcpNamespace := manifests.HostedControlPlaneNamespace(hostedCluster.Namespace, hostedCluster.Name)
Expand Down Expand Up @@ -1034,6 +1036,7 @@ func EnsureNetworkPolicies(t *testing.T, ctx context.Context, c crclient.Client,
g.Expect(err).To(HaveOccurred())

// Validate private router is not allowed to access management KAS.
// Note: Private router validation only applies to AWS - Azure doesn't have private router config
if hostedCluster.Spec.Platform.Type == hyperv1.AWSPlatform {
if hostedCluster.Spec.Platform.AWS.EndpointAccess != hyperv1.Private {
// TODO (alberto): Run also in private case. Today it results in a flake:
Expand Down