Skip to content

Commit

Permalink
chore(kuma-cp) drop default sufix on the default traffic permission (#…
Browse files Browse the repository at this point in the history
…1155)

Signed-off-by: Jakub Dyszkiewicz <[email protected]>
  • Loading branch information
jakubdyszkiewicz authored Nov 16, 2020
1 parent d95cfaa commit 370daeb
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pkg/core/managers/apis/mesh/mesh_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ var _ = Describe("Mesh Manager", func() {
Expect(err).ToNot(HaveOccurred())

// and default TrafficPermission for the mesh exists
err = resStore.Get(context.Background(), &core_mesh.TrafficPermissionResource{}, store.GetByKey("allow-all-mesh-1.default", meshName))
err = resStore.Get(context.Background(), &core_mesh.TrafficPermissionResource{}, store.GetByKey("allow-all-mesh-1", meshName))
Expect(err).ToNot(HaveOccurred())
})

Expand Down
4 changes: 1 addition & 3 deletions pkg/defaults/mesh/traffic_permission.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,9 @@ var defaultTrafficPermission = mesh_proto.TrafficPermission{
},
}

// Default traffic permission needs to be stored with default suffix so on K8S it will be stored in the default namespace
// This will be dropped when TrafficPermission will be converted to Global Scope on K8S instead of Namespace Scope
// TrafficPermission needs to contain mesh name inside it. Otherwise if the name is the same (ex. "allow-all") creating new mesh would fail because there is already resource of name "allow-all" which is unique key on K8S
func defaultTrafficPermissionName(meshName string) string {
return fmt.Sprintf("allow-all-%s.default", meshName)
return fmt.Sprintf("allow-all-%s", meshName)
}

func createDefaultTrafficPermission(resManager manager.ResourceManager, meshName string) error {
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/kuma_deploy_hybrid_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ metadata:
return stdout, err
}, "10s", "1s").Should(ContainSubstring("HTTP/1.1 200 OK"))

err := global.GetKumactlOptions().KumactlDelete("traffic-permission", "allow-all-default.default") // remove builtin traffic permission
err := global.GetKumactlOptions().KumactlDelete("traffic-permission", "allow-all-default") // remove builtin traffic permission
Expect(err).ToNot(HaveOccurred())

err = YamlUniversal(trafficPermissionAllTo2Remote)(global)
Expand Down

0 comments on commit 370daeb

Please sign in to comment.