diff --git a/pkg/addon/policyframework/manifests/managedclusterchart/templates/namespace.yaml b/pkg/addon/policyframework/manifests/managedclusterchart/templates/namespace.yaml index e06988f1..5241613c 100644 --- a/pkg/addon/policyframework/manifests/managedclusterchart/templates/namespace.yaml +++ b/pkg/addon/policyframework/manifests/managedclusterchart/templates/namespace.yaml @@ -5,4 +5,4 @@ apiVersion: v1 kind: Namespace metadata: name: "{{ .Values.clusterName }}" -{{- end }} +{{- end }} \ No newline at end of file diff --git a/pkg/addon/policyframework/manifests/managedclusterchart/templates/ocm_namespace.yaml b/pkg/addon/policyframework/manifests/managedclusterchart/templates/ocm_namespace.yaml new file mode 100644 index 00000000..ed84553b --- /dev/null +++ b/pkg/addon/policyframework/manifests/managedclusterchart/templates/ocm_namespace.yaml @@ -0,0 +1,8 @@ +# Copyright Contributors to the Open Cluster Management project + +{{- if ne .Values.installMode "Hosted" }} +apiVersion: v1 +kind: Namespace +metadata: + name: open-cluster-management-policies +{{- end }} \ No newline at end of file diff --git a/test/e2e/case1_framework_deployment_test.go b/test/e2e/case1_framework_deployment_test.go index d66716be..241995cb 100644 --- a/test/e2e/case1_framework_deployment_test.go +++ b/test/e2e/case1_framework_deployment_test.go @@ -27,6 +27,7 @@ const ( case1PodSelector string = "app=governance-policy-framework" case1MWName string = "addon-governance-policy-framework-deploy-0" case1MWPatch string = "../resources/manifestwork_add_patch.json" + ocmPolicyNs string = "open-cluster-management-policies" ) var _ = Describe("Test framework deployment", Ordered, func() { @@ -72,7 +73,7 @@ var _ = Describe("Test framework deployment", Ordered, func() { By(logPrefix + "removing the framework deployment when the ManagedClusterAddOn CR is removed") - Kubectl("delete", "-n", cluster.clusterName, "-f", case1ManagedClusterAddOnCR, "--timeout=90s") + Kubectl("delete", "-n", cluster.clusterName, "-f", case1ManagedClusterAddOnCR, "--timeout=180s") deploy = GetWithTimeout( cluster.clusterClient, gvrDeployment, case1DeploymentName, agentInstallNs, false, 180, ) @@ -83,6 +84,11 @@ var _ = Describe("Test framework deployment", Ordered, func() { } pods := ListWithTimeoutByNamespace(cluster.clusterClient, gvrPod, opts, agentInstallNs, 0, false, 180) Expect(pods).To(BeNil()) + + By("Should not have " + ocmPolicyNs + " in hosted mode") + GetWithTimeout( + cluster.clusterClient, gvrNamespace, ocmPolicyNs, "", false, 60, + ) } }) @@ -316,6 +322,12 @@ var _ = Describe("Test framework deployment", Ordered, func() { cluster.clusterClient, gvrDeployment, case1DeploymentName, addonNamespace, false, 30, ) Expect(deploy).To(BeNil()) + + By("Should have " + ocmPolicyNs + " in normal mode") + ns := GetWithTimeout( + cluster.clusterClient, gvrNamespace, ocmPolicyNs, "", true, 60, + ) + Expect(ns).ShouldNot(BeNil()) } })