Skip to content

Commit

Permalink
Fix namespace for fleet in rancher bnm test
Browse files Browse the repository at this point in the history
  • Loading branch information
Mario Manno committed Nov 30, 2022
1 parent 5c7c47b commit a507d34
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
10 changes: 5 additions & 5 deletions e2e/assets/multi-cluster/bundle-namespace-mapping.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
apiVersion: v1
kind: Namespace
metadata:
name: {{.Namespace}}
name: {{.ProjectNamespace}}
---
kind: GitRepoRestriction
apiVersion: fleet.cattle.io/v1alpha1
metadata:
name: restriction
namespace: {{.Namespace}}
namespace: {{.ProjectNamespace}}

allowedTargetNamespaces:
- project1simpleapp
Expand All @@ -17,21 +17,21 @@ kind: BundleNamespaceMapping
apiVersion: fleet.cattle.io/v1alpha1
metadata:
name: mapping
namespace: {{.Namespace}}
namespace: {{.ProjectNamespace}}

bundleSelector:
matchLabels:
team: one

namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: fleet-local
kubernetes.io/metadata.name: {{.ClusterNamespace}}
---
kind: GitRepo
apiVersion: fleet.cattle.io/v1alpha1
metadata:
name: simpleapp
namespace: {{.Namespace}}
namespace: {{.ProjectNamespace}}
labels:
team: one

Expand Down
21 changes: 12 additions & 9 deletions e2e/multi-cluster/bundle_namespace_mapping_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,10 @@ var _ = Describe("Bundle Namespace Mapping", func() {
namespace = "project1"
asset = "multi-cluster/bundle-namespace-mapping.yaml"
data = struct {
Namespace string
TargetNamespace string
}{namespace, "targetNamespace: project1simpleapp"}
ProjectNamespace string
ClusterNamespace string
TargetNamespace string
}{namespace, env.Namespace, "targetNamespace: project1simpleapp"}
})

It("deploys to the mapped downstream cluster", func() {
Expand All @@ -73,9 +74,10 @@ var _ = Describe("Bundle Namespace Mapping", func() {
namespace = "project2"
asset = "multi-cluster/bundle-namespace-mapping.yaml"
data = struct {
Namespace string
TargetNamespace string
}{namespace, "targetNamespace: denythisnamespace"}
ProjectNamespace string
ClusterNamespace string
TargetNamespace string
}{namespace, env.Namespace, "targetNamespace: denythisnamespace"}
})

It("denies deployment to downstream cluster", func() {
Expand All @@ -93,9 +95,10 @@ var _ = Describe("Bundle Namespace Mapping", func() {
namespace = "project3"
asset = "multi-cluster/bundle-namespace-mapping.yaml"
data = struct {
Namespace string
TargetNamespace string
}{namespace, ""}
ProjectNamespace string
ClusterNamespace string
TargetNamespace string
}{namespace, env.Namespace, ""}
})

It("denies deployment to downstream cluster", func() {
Expand Down

0 comments on commit a507d34

Please sign in to comment.