diff --git a/test/e2e/backups/deletion.go b/test/e2e/backups/deletion.go index e4bf69702d..3c6ca55ced 100644 --- a/test/e2e/backups/deletion.go +++ b/test/e2e/backups/deletion.go @@ -101,7 +101,7 @@ func runBackupDeletionTests(client TestClient, veleroCfg VeleroConfig, backupLoc registryCredentialFile := veleroCfg.RegistryCredentialFile veleroFeatures := veleroCfg.Features for _, ns := range workloadNamespaceList { - if err := CreateNamespace(oneHourTimeout, client, ns); err != nil { + if err := CreateNamespace(oneHourTimeout, client, ns, false); err != nil { return errors.Wrapf(err, "Failed to create namespace %s to install Kibishii workload", ns) } diff --git a/test/e2e/backups/sync_backups.go b/test/e2e/backups/sync_backups.go index 447fc735b9..3c131c4335 100644 --- a/test/e2e/backups/sync_backups.go +++ b/test/e2e/backups/sync_backups.go @@ -82,7 +82,7 @@ func BackupsSyncTest() { ctx, ctxCancel := context.WithTimeout(context.Background(), 30*time.Minute) defer ctxCancel() By(fmt.Sprintf("Prepare workload as target to backup by creating namespace %s namespace", test.testNS)) - Expect(CreateNamespace(ctx, *veleroCfg.ClientToInstallVelero, test.testNS)).To(Succeed(), + Expect(CreateNamespace(ctx, *veleroCfg.ClientToInstallVelero, test.testNS, false)).To(Succeed(), fmt.Sprintf("Failed to create %s namespace", test.testNS)) if CurrentSpecReport().Failed() && veleroCfg.FailFast { @@ -127,7 +127,7 @@ func BackupsSyncTest() { ctx, ctxCancel := context.WithTimeout(context.Background(), 30*time.Minute) defer ctxCancel() By(fmt.Sprintf("Prepare workload as target to backup by creating namespace in %s namespace", test.testNS), func() { - Expect(CreateNamespace(ctx, *veleroCfg.ClientToInstallVelero, test.testNS)).To(Succeed(), + Expect(CreateNamespace(ctx, *veleroCfg.ClientToInstallVelero, test.testNS, false)).To(Succeed(), fmt.Sprintf("Failed to create %s namespace", test.testNS)) }) diff --git a/test/e2e/backups/ttl.go b/test/e2e/backups/ttl.go index c2c2224e9d..da5c78b6af 100644 --- a/test/e2e/backups/ttl.go +++ b/test/e2e/backups/ttl.go @@ -95,7 +95,7 @@ func TTLTest() { ctx, ctxCancel := context.WithTimeout(context.Background(), 1*time.Hour) defer ctxCancel() By(fmt.Sprintf("Prepare workload as target to backup by creating namespace %s namespace", test.testNS), func() { - Expect(CreateNamespace(ctx, client, test.testNS)).To(Succeed(), + Expect(CreateNamespace(ctx, client, test.testNS, false)).To(Succeed(), fmt.Sprintf("Failed to create %s namespace", test.testNS)) }) diff --git a/test/e2e/basic/api-group/enable_api_group_versions.go b/test/e2e/basic/api-group/enable_api_group_versions.go index c0eb770626..4273189106 100644 --- a/test/e2e/basic/api-group/enable_api_group_versions.go +++ b/test/e2e/basic/api-group/enable_api_group_versions.go @@ -489,7 +489,7 @@ func installTestResources(ctx context.Context, client TestClient, group string, for version, cr := range tc.srcCRs { ns := fmt.Sprintf("rockband%ds-src-%s-%d", i, version, i) - if err := CreateNamespace(ctx, client, ns); err != nil { + if err := CreateNamespace(ctx, client, ns, false); err != nil { return "", "", errors.Wrapf(err, "create %s namespace", ns) } diff --git a/test/e2e/basic/namespace-mapping.go b/test/e2e/basic/namespace-mapping.go index a2ebc24c8b..e3e98b2e00 100644 --- a/test/e2e/basic/namespace-mapping.go +++ b/test/e2e/basic/namespace-mapping.go @@ -88,7 +88,7 @@ func (n *NamespaceMapping) CreateResources() error { for index, ns := range *n.NSIncluded { n.kibishiiData.Levels = len(*n.NSIncluded) + index By(fmt.Sprintf("Creating namespaces ...%s\n", ns), func() { - Expect(CreateNamespace(n.Ctx, n.Client, ns)).To(Succeed(), fmt.Sprintf("Failed to create namespace %s", ns)) + Expect(CreateNamespace(n.Ctx, n.Client, ns, false)).To(Succeed(), fmt.Sprintf("Failed to create namespace %s", ns)) }) By("Deploy sample workload of Kibishii", func() { Expect(KibishiiPrepareBeforeBackup(n.Ctx, n.Client, n.VeleroCfg.CloudProvider, diff --git a/test/e2e/basic/nodeport.go b/test/e2e/basic/nodeport.go index 7cee801a08..9a4ed6d5fe 100644 --- a/test/e2e/basic/nodeport.go +++ b/test/e2e/basic/nodeport.go @@ -64,7 +64,7 @@ func (n *NodePort) Init() error { func (n *NodePort) CreateResources() error { for _, ns := range *n.NSIncluded { By(fmt.Sprintf("Creating service %s in namespaces %s ......\n", n.serviceName, ns), func() { - Expect(CreateNamespace(n.Ctx, n.Client, ns)).To(Succeed(), fmt.Sprintf("Failed to create namespace %s", ns)) + Expect(CreateNamespace(n.Ctx, n.Client, ns, false)).To(Succeed(), fmt.Sprintf("Failed to create namespace %s", ns)) Expect(createServiceWithNodeport(n.Ctx, n.Client, ns, n.serviceName, n.labels, 0)).To(Succeed(), fmt.Sprintf("Failed to create service %s", n.serviceName)) service, err := GetService(n.Ctx, n.Client, ns, n.serviceName) Expect(err).To(Succeed()) @@ -88,7 +88,7 @@ func (n *NodePort) Destroy() error { }) By(fmt.Sprintf("Creating a new service which has the same nodeport as backed up service has in a new namespaces for nodeport collision ...%s\n", n.namespaceToCollision[i]), func() { - Expect(CreateNamespace(n.Ctx, n.Client, n.namespaceToCollision[i])).To(Succeed(), fmt.Sprintf("Failed to create namespace %s", n.namespaceToCollision[i])) + Expect(CreateNamespace(n.Ctx, n.Client, n.namespaceToCollision[i], false)).To(Succeed(), fmt.Sprintf("Failed to create namespace %s", n.namespaceToCollision[i])) Expect(createServiceWithNodeport(n.Ctx, n.Client, n.namespaceToCollision[i], n.serviceName, n.labels, n.nodePort)).To(Succeed(), fmt.Sprintf("Failed to create service %s", n.serviceName)) _, err := GetAllService(n.Ctx) Expect(err).To(Succeed(), "fail to get service") diff --git a/test/e2e/basic/pvc-selected-node-changing.go b/test/e2e/basic/pvc-selected-node-changing.go index e200929c11..f4f7a3427e 100644 --- a/test/e2e/basic/pvc-selected-node-changing.go +++ b/test/e2e/basic/pvc-selected-node-changing.go @@ -64,7 +64,7 @@ func (p *PVCSelectedNodeChanging) Init() error { func (p *PVCSelectedNodeChanging) CreateResources() error { By(fmt.Sprintf("Create namespace %s", p.namespace), func() { - Expect(CreateNamespace(p.Ctx, p.Client, p.namespace)).To(Succeed(), + Expect(CreateNamespace(p.Ctx, p.Client, p.namespace, false)).To(Succeed(), fmt.Sprintf("Failed to create namespace %s", p.namespace)) }) diff --git a/test/e2e/basic/resources-check/rbac.go b/test/e2e/basic/resources-check/rbac.go index b79c3615f4..ec00684888 100644 --- a/test/e2e/basic/resources-check/rbac.go +++ b/test/e2e/basic/resources-check/rbac.go @@ -81,7 +81,7 @@ func (r *RBACCase) CreateResources() error { for nsNum := 0; nsNum < r.NamespacesTotal; nsNum++ { createNSName := fmt.Sprintf("%s-%00000d", r.CaseBaseName, nsNum) fmt.Printf("Creating namespaces ...%s\n", createNSName) - if err := CreateNamespace(r.Ctx, r.Client, createNSName); err != nil { + if err := CreateNamespace(r.Ctx, r.Client, createNSName, false); err != nil { return errors.Wrapf(err, "Failed to create namespace %s", createNSName) } serviceAccountName := fmt.Sprintf("service-account-%s-%00000d", r.CaseBaseName, nsNum) diff --git a/test/e2e/basic/storage-class-changing.go b/test/e2e/basic/storage-class-changing.go index e2e5a02967..76e4e6cf76 100644 --- a/test/e2e/basic/storage-class-changing.go +++ b/test/e2e/basic/storage-class-changing.go @@ -73,7 +73,7 @@ func (s *StorageClasssChanging) CreateResources() error { } By(fmt.Sprintf("Create namespace %s", s.namespace), func() { - Expect(CreateNamespace(s.Ctx, s.Client, s.namespace)).To(Succeed(), + Expect(CreateNamespace(s.Ctx, s.Client, s.namespace, false)).To(Succeed(), fmt.Sprintf("Failed to create namespace %s", s.namespace)) }) diff --git a/test/e2e/bsl-mgmt/deletion.go b/test/e2e/bsl-mgmt/deletion.go index 51584d85ba..fd6a4f8f80 100644 --- a/test/e2e/bsl-mgmt/deletion.go +++ b/test/e2e/bsl-mgmt/deletion.go @@ -146,7 +146,7 @@ func BslDeletionTest(useVolumeSnapshots bool) { //label2 := "for!=1" label2 := "for=2" By("Create namespace for sample workload", func() { - Expect(CreateNamespace(oneHourTimeout, *veleroCfg.ClientToInstallVelero, bslDeletionTestNs)).To(Succeed()) + Expect(CreateNamespace(oneHourTimeout, *veleroCfg.ClientToInstallVelero, bslDeletionTestNs, false)).To(Succeed()) }) By("Deploy sample workload of Kibishii", func() { diff --git a/test/e2e/migration/migration.go b/test/e2e/migration/migration.go index 7eb57daaec..ba20985f11 100644 --- a/test/e2e/migration/migration.go +++ b/test/e2e/migration/migration.go @@ -181,6 +181,7 @@ func (m *migrationE2E) Backup() error { m.Ctx, *m.VeleroCfg.DefaultClient, m.CaseBaseName, + false, )).To(Succeed(), fmt.Sprintf("Failed to create namespace %s to install Kibishii workload", m.CaseBaseName)) diff --git a/test/e2e/parallelfilesdownload/parallel_files_download.go b/test/e2e/parallelfilesdownload/parallel_files_download.go index a678c6c80e..2197ccb855 100644 --- a/test/e2e/parallelfilesdownload/parallel_files_download.go +++ b/test/e2e/parallelfilesdownload/parallel_files_download.go @@ -90,7 +90,7 @@ func (p *ParallelFilesDownload) Init() error { func (p *ParallelFilesDownload) CreateResources() error { By(fmt.Sprintf("Create namespace %s", p.namespace), func() { - Expect(CreateNamespace(p.Ctx, p.Client, p.namespace)).To(Succeed(), + Expect(CreateNamespace(p.Ctx, p.Client, p.namespace, false)).To(Succeed(), fmt.Sprintf("Failed to create namespace %s", p.namespace)) }) diff --git a/test/e2e/parallelfilesupload/parallel_files_upload.go b/test/e2e/parallelfilesupload/parallel_files_upload.go index 5478e35186..7b99529fbf 100644 --- a/test/e2e/parallelfilesupload/parallel_files_upload.go +++ b/test/e2e/parallelfilesupload/parallel_files_upload.go @@ -81,7 +81,7 @@ func (p *ParallelFilesUpload) Init() error { func (p *ParallelFilesUpload) CreateResources() error { By(fmt.Sprintf("Create namespace %s", p.namespace), func() { - Expect(CreateNamespace(p.Ctx, p.Client, p.namespace)).To(Succeed(), + Expect(CreateNamespace(p.Ctx, p.Client, p.namespace, false)).To(Succeed(), fmt.Sprintf("Failed to create namespace %s", p.namespace)) }) diff --git a/test/e2e/privilegesmgmt/ssr.go b/test/e2e/privilegesmgmt/ssr.go index 9b0e99a0f8..11081f9eca 100644 --- a/test/e2e/privilegesmgmt/ssr.go +++ b/test/e2e/privilegesmgmt/ssr.go @@ -54,7 +54,7 @@ func SSRTest() { defer ctxCancel() defer DeleteNamespace(context.TODO(), *veleroCfg.ClientToInstallVelero, testNS, false) By(fmt.Sprintf("Create %s namespace", testNS)) - Expect(CreateNamespace(ctx, *veleroCfg.ClientToInstallVelero, testNS)).To(Succeed(), + Expect(CreateNamespace(ctx, *veleroCfg.ClientToInstallVelero, testNS, false)).To(Succeed(), fmt.Sprintf("Failed to create %s namespace", testNS)) By(fmt.Sprintf("Get version in %s namespace", testNS), func() { diff --git a/test/e2e/pv-backup/pv-backup-filter.go b/test/e2e/pv-backup/pv-backup-filter.go index b58cb8a55b..6f09445987 100644 --- a/test/e2e/pv-backup/pv-backup-filter.go +++ b/test/e2e/pv-backup/pv-backup-filter.go @@ -65,7 +65,7 @@ func (p *PVBackupFiltering) Init() error { func (p *PVBackupFiltering) CreateResources() error { for _, ns := range *p.NSIncluded { By(fmt.Sprintf("Create namespaces %s for workload\n", ns), func() { - Expect(CreateNamespace(p.Ctx, p.Client, ns)).To(Succeed(), fmt.Sprintf("Failed to create namespace %s", ns)) + Expect(CreateNamespace(p.Ctx, p.Client, ns, false)).To(Succeed(), fmt.Sprintf("Failed to create namespace %s", ns)) }) var pods []string By(fmt.Sprintf("Deploy a few pods with several PVs in namespace %s", ns), func() { diff --git a/test/e2e/resource-filtering/base.go b/test/e2e/resource-filtering/base.go index 8cfce438d5..457b26c61d 100644 --- a/test/e2e/resource-filtering/base.go +++ b/test/e2e/resource-filtering/base.go @@ -63,7 +63,7 @@ func (f *FilteringCase) CreateResources() error { for nsNum := 0; nsNum < f.NamespacesTotal; nsNum++ { namespace := fmt.Sprintf("%s-%00000d", f.CaseBaseName, nsNum) fmt.Printf("Creating resources in namespace ...%s\n", namespace) - if err := CreateNamespace(f.Ctx, f.Client, namespace); err != nil { + if err := CreateNamespace(f.Ctx, f.Client, namespace, false); err != nil { return errors.Wrapf(err, "Failed to create namespace %s", namespace) } //Create deployment diff --git a/test/e2e/resource-filtering/exclude_label.go b/test/e2e/resource-filtering/exclude_label.go index b90d63dd87..ad9c5fa0ee 100644 --- a/test/e2e/resource-filtering/exclude_label.go +++ b/test/e2e/resource-filtering/exclude_label.go @@ -83,7 +83,7 @@ func (e *ExcludeFromBackup) CreateResources() error { velerov1api.ExcludeFromBackupLabel: "false", } fmt.Printf("Creating resources in namespace ...%s\n", namespace) - if err := CreateNamespace(e.Ctx, e.Client, namespace); err != nil { + if err := CreateNamespace(e.Ctx, e.Client, namespace, false); err != nil { return errors.Wrapf(err, "Failed to create namespace %s", namespace) } //Create deployment: to be included diff --git a/test/e2e/resource-filtering/exclude_namespaces.go b/test/e2e/resource-filtering/exclude_namespaces.go index 1b8e5da550..f71b254aca 100644 --- a/test/e2e/resource-filtering/exclude_namespaces.go +++ b/test/e2e/resource-filtering/exclude_namespaces.go @@ -109,7 +109,7 @@ func (e *ExcludeNamespaces) CreateResources() error { for nsNum := 0; nsNum < e.NamespacesTotal; nsNum++ { createNSName := fmt.Sprintf("%s-%00000d", e.CaseBaseName, nsNum) fmt.Printf("Creating namespaces ...%s\n", createNSName) - if err := CreateNamespace(e.Ctx, e.Client, createNSName); err != nil { + if err := CreateNamespace(e.Ctx, e.Client, createNSName, false); err != nil { return errors.Wrapf(err, "Failed to create namespace %s", createNSName) } } diff --git a/test/e2e/resource-filtering/include_namespaces.go b/test/e2e/resource-filtering/include_namespaces.go index d511de2123..0092969bb5 100644 --- a/test/e2e/resource-filtering/include_namespaces.go +++ b/test/e2e/resource-filtering/include_namespaces.go @@ -104,7 +104,7 @@ func (i *IncludeNamespaces) CreateResources() error { for nsNum := 0; nsNum < i.NamespacesTotal; nsNum++ { createNSName := fmt.Sprintf("%s-%00000d", i.CaseBaseName, nsNum) fmt.Printf("Creating namespaces ...%s\n", createNSName) - if err := CreateNamespace(i.Ctx, i.Client, createNSName); err != nil { + if err := CreateNamespace(i.Ctx, i.Client, createNSName, false); err != nil { return errors.Wrapf(err, "Failed to create namespace %s", createNSName) } } diff --git a/test/e2e/resourcemodifiers/resource_modifiers.go b/test/e2e/resourcemodifiers/resource_modifiers.go index e3bd9ea11d..2ff0690454 100644 --- a/test/e2e/resourcemodifiers/resource_modifiers.go +++ b/test/e2e/resourcemodifiers/resource_modifiers.go @@ -106,7 +106,7 @@ func (r *ResourceModifiersCase) CreateResources() error { for nsNum := 0; nsNum < r.NamespacesTotal; nsNum++ { namespace := fmt.Sprintf("%s-%00000d", r.CaseBaseName, nsNum) By(fmt.Sprintf("Create namespaces %s for workload\n", namespace), func() { - Expect(CreateNamespace(r.Ctx, r.Client, namespace)).To(Succeed(), fmt.Sprintf("Failed to create namespace %s", namespace)) + Expect(CreateNamespace(r.Ctx, r.Client, namespace, false)).To(Succeed(), fmt.Sprintf("Failed to create namespace %s", namespace)) }) By(fmt.Sprintf("Creating deployment in namespaces ...%s\n", namespace), func() { diff --git a/test/e2e/resourcepolicies/resource_policies.go b/test/e2e/resourcepolicies/resource_policies.go index 94e238eda3..718ceb65e5 100644 --- a/test/e2e/resourcepolicies/resource_policies.go +++ b/test/e2e/resourcepolicies/resource_policies.go @@ -111,7 +111,7 @@ func (r *ResourcePoliciesCase) CreateResources() error { for nsNum := 0; nsNum < r.NamespacesTotal; nsNum++ { namespace := fmt.Sprintf("%s-%00000d", r.CaseBaseName, nsNum) By(fmt.Sprintf("Create namespaces %s for workload\n", namespace), func() { - Expect(CreateNamespace(r.Ctx, r.Client, namespace)).To(Succeed(), fmt.Sprintf("Failed to create namespace %s", namespace)) + Expect(CreateNamespace(r.Ctx, r.Client, namespace, false)).To(Succeed(), fmt.Sprintf("Failed to create namespace %s", namespace)) }) volName := fmt.Sprintf("vol-%s-%00000d", r.CaseBaseName, nsNum) diff --git a/test/e2e/schedule/in_progress.go b/test/e2e/schedule/in_progress.go index 3a148a8c1f..27b402c071 100644 --- a/test/e2e/schedule/in_progress.go +++ b/test/e2e/schedule/in_progress.go @@ -69,6 +69,7 @@ func (s *InProgressCase) CreateResources() error { s.Ctx, s.Client, s.namespace, + false, ), ).To(Succeed(), fmt.Sprintf("Failed to create namespace %s", s.namespace)) diff --git a/test/e2e/schedule/ordered_resources.go b/test/e2e/schedule/ordered_resources.go index 238a014c75..ba3c23d8b3 100644 --- a/test/e2e/schedule/ordered_resources.go +++ b/test/e2e/schedule/ordered_resources.go @@ -92,7 +92,7 @@ func (o *OrderedResources) CreateResources() error { "orderedresources": "true", } fmt.Printf("Creating resources in %s namespace ...\n", o.Namespace) - if err := k8sutil.CreateNamespace(o.Ctx, o.Client, o.Namespace); err != nil { + if err := k8sutil.CreateNamespace(o.Ctx, o.Client, o.Namespace, false); err != nil { return errors.Wrapf(err, "failed to create namespace %s", o.Namespace) } diff --git a/test/e2e/schedule/periodical.go b/test/e2e/schedule/periodical.go index 330356e998..145ed9bb62 100644 --- a/test/e2e/schedule/periodical.go +++ b/test/e2e/schedule/periodical.go @@ -53,6 +53,7 @@ func (n *PeriodicalCase) CreateResources() error { n.Ctx, n.Client, ns, + false, ), ).To( Succeed(), diff --git a/test/e2e/upgrade/upgrade.go b/test/e2e/upgrade/upgrade.go index 4757fbbe90..f43123261a 100644 --- a/test/e2e/upgrade/upgrade.go +++ b/test/e2e/upgrade/upgrade.go @@ -152,7 +152,7 @@ func BackupUpgradeRestoreTest(useVolumeSnapshots bool, veleroCLI2Version VeleroC tmpCfg.UpgradeFromVeleroVersion = veleroCLI2Version.VeleroVersion By("Create namespace for sample workload", func() { - Expect(CreateNamespace(oneHourTimeout, *veleroCfg.ClientToInstallVelero, upgradeNamespace)).To(Succeed(), + Expect(CreateNamespace(oneHourTimeout, *veleroCfg.ClientToInstallVelero, upgradeNamespace, false)).To(Succeed(), fmt.Sprintf("Failed to create namespace %s to install Kibishii workload", upgradeNamespace)) }) diff --git a/test/util/k8s/namespace.go b/test/util/k8s/namespace.go index b2a5cae0e6..c69c05a36b 100644 --- a/test/util/k8s/namespace.go +++ b/test/util/k8s/namespace.go @@ -35,13 +35,17 @@ import ( veleroexec "github.com/vmware-tanzu/velero/pkg/util/exec" ) -func CreateNamespace(ctx context.Context, client TestClient, namespace string) error { +func CreateNamespace(ctx context.Context, client TestClient, namespace string, addPsaLabels bool) error { ns := builder.ForNamespace(namespace).Result() - // Add label to avoid PSA check. - ns.Labels = map[string]string{ - "pod-security.kubernetes.io/enforce": "baseline", - "pod-security.kubernetes.io/enforce-version": "latest", + + if addPsaLabels { + // Add label to avoid PSA check. + ns.Labels = map[string]string{ + "pod-security.kubernetes.io/enforce": "baseline", + "pod-security.kubernetes.io/enforce-version": "latest", + } } + _, err := client.ClientGo.CoreV1().Namespaces().Create(context.TODO(), ns, metav1.CreateOptions{}) if apierrors.IsAlreadyExists(err) { return nil @@ -52,9 +56,6 @@ func CreateNamespace(ctx context.Context, client TestClient, namespace string) e func CreateNamespaceWithLabel(ctx context.Context, client TestClient, namespace string, label map[string]string) error { ns := builder.ForNamespace(namespace).Result() ns.Labels = label - // Add label to avoid PSA check. - ns.Labels["pod-security.kubernetes.io/enforce"] = "baseline" - ns.Labels["pod-security.kubernetes.io/enforce-version"] = "latest" _, err := client.ClientGo.CoreV1().Namespaces().Create(ctx, ns, metav1.CreateOptions{}) if apierrors.IsAlreadyExists(err) { return nil @@ -64,11 +65,6 @@ func CreateNamespaceWithLabel(ctx context.Context, client TestClient, namespace func CreateNamespaceWithAnnotation(ctx context.Context, client TestClient, namespace string, annotation map[string]string) error { ns := builder.ForNamespace(namespace).Result() - // Add label to avoid PSA check. - ns.Labels = map[string]string{ - "pod-security.kubernetes.io/enforce": "baseline", - "pod-security.kubernetes.io/enforce-version": "latest", - } ns.ObjectMeta.Annotations = annotation _, err := client.ClientGo.CoreV1().Namespaces().Create(context.TODO(), ns, metav1.CreateOptions{}) if apierrors.IsAlreadyExists(err) { diff --git a/test/util/kibishii/kibishii_utils.go b/test/util/kibishii/kibishii_utils.go index be503ff0b1..9f0b169593 100644 --- a/test/util/kibishii/kibishii_utils.go +++ b/test/util/kibishii/kibishii_utils.go @@ -90,7 +90,7 @@ func RunKibishiiTests( fmt.Println(errors.Wrapf(err, "failed to delete the namespace %q", kibishiiNamespace)) } } - if err := CreateNamespace(oneHourTimeout, client, kibishiiNamespace); err != nil { + if err := CreateNamespace(oneHourTimeout, client, kibishiiNamespace, false); err != nil { return errors.Wrapf(err, "Failed to create namespace %s to install Kibishii workload", kibishiiNamespace) } defer func() { @@ -282,12 +282,6 @@ func installKibishii(ctx context.Context, namespace string, cloudPlatform, veler return errors.Wrapf(err, "failed to install kibishii, stderr=%s", stderr) } - labelNamespaceCmd := exec.CommandContext(ctx, "kubectl", "label", "namespace", namespace, "pod-security.kubernetes.io/enforce=baseline", "pod-security.kubernetes.io/enforce-version=latest", "--overwrite=true") - _, stderr, err = veleroexec.RunCommand(labelNamespaceCmd) - fmt.Printf("Label namespace with PSA policy: %s\n", labelNamespaceCmd) - if err != nil { - return errors.Wrapf(err, "failed to label namespace with PSA policy, stderr=%s", stderr) - } if workerReplicas != DefaultKibishiiWorkerCounts { err = ScaleStatefulSet(ctx, namespace, "kibishii-deployment", workerReplicas) if err != nil { diff --git a/test/util/velero/install.go b/test/util/velero/install.go index 027ca43048..36e06c31ec 100644 --- a/test/util/velero/install.go +++ b/test/util/velero/install.go @@ -180,6 +180,7 @@ func generateVSpherePlugin(veleroCfg *test.VeleroConfig) error { context.Background(), *cli, veleroCfg.VeleroNamespace, + true, // need to add PSA labels to Velero namespace. ); err != nil { return errors.WithMessagef( err,