From c37bf56b1e30ebc9bc94efca0ea12158d5648463 Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Mon, 13 Nov 2017 21:51:51 +0000 Subject: plugin/kubernetes: correctly set NODATA for ns (#1229) * plugin/kubernetes: Add GetNamespaceByName A bare or wildcard query for just the namespace should return NODATA, not NXDOMAIN, otherwise we deny the entirety of the names under the namespace. Add test to check for this in pod verified mode. * Review More comments and move namespace code to namespace.go --- plugin/kubernetes/handler_test.go | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'plugin/kubernetes/handler_test.go') diff --git a/plugin/kubernetes/handler_test.go b/plugin/kubernetes/handler_test.go index 5e9743b68..f9a600868 100644 --- a/plugin/kubernetes/handler_test.go +++ b/plugin/kubernetes/handler_test.go @@ -476,3 +476,14 @@ func (APIConnServeTest) GetNodeByName(name string) (*api.Node, error) { }, }, nil } + +func (APIConnServeTest) GetNamespaceByName(name string) (*api.Namespace, error) { + if name == "pod-nons" { // hanlder_pod_verified_test.go uses this for non-existent namespace. + return &api.Namespace{}, nil + } + return &api.Namespace{ + ObjectMeta: meta.ObjectMeta{ + Name: name, + }, + }, nil +} -- cgit v1.2.3