diff --git a/sample-cnfs/k8s-multiple-processes/cnf-testsuite.yml b/sample-cnfs/k8s-multiple-processes/cnf-testsuite.yml index f1e4cb23b..a5025e86e 100644 --- a/sample-cnfs/k8s-multiple-processes/cnf-testsuite.yml +++ b/sample-cnfs/k8s-multiple-processes/cnf-testsuite.yml @@ -6,4 +6,5 @@ helm_repository: name: stable repo_url: https://cncf.gitlab.io/stable rolling_update_test_tag: 1.6.7 +helm_install_namespace: cnfspace allowlist_helm_chart_container_names: [node-cache, nginx, coredns, calico-node, kube-proxy, nginx-proxy] diff --git a/sample-cnfs/sample-multiple-processes/cnf-testsuite.yml b/sample-cnfs/sample-multiple-processes/cnf-testsuite.yml index 107f96e0f..e2a2df722 100644 --- a/sample-cnfs/sample-multiple-processes/cnf-testsuite.yml +++ b/sample-cnfs/sample-multiple-processes/cnf-testsuite.yml @@ -4,4 +4,5 @@ release_name: multi-proc helm_repository: name: repo_url: +helm_install_namespace: cnfspace allowlist_helm_chart_container_names: [node-cache, nginx, coredns, calico-node, kube-proxy, nginx-proxy] diff --git a/sample-cnfs/sample-prom-pod-discovery/cnf-testsuite.yml b/sample-cnfs/sample-prom-pod-discovery/cnf-testsuite.yml index e9b59cbfc..1092b4985 100644 --- a/sample-cnfs/sample-prom-pod-discovery/cnf-testsuite.yml +++ b/sample-cnfs/sample-prom-pod-discovery/cnf-testsuite.yml @@ -4,4 +4,5 @@ release_name: coredns helm_repository: name: stable repo_url: https://cncf.gitlab.io/stable +helm_install_namespace: cnfspace allowlist_helm_chart_container_names: [] diff --git a/sample-cnfs/sample_coredns/cnf-testsuite.yml b/sample-cnfs/sample_coredns/cnf-testsuite.yml index e9b59cbfc..1092b4985 100644 --- a/sample-cnfs/sample_coredns/cnf-testsuite.yml +++ b/sample-cnfs/sample_coredns/cnf-testsuite.yml @@ -4,4 +4,5 @@ release_name: coredns helm_repository: name: stable repo_url: https://cncf.gitlab.io/stable +helm_install_namespace: cnfspace allowlist_helm_chart_container_names: [] diff --git a/sample-cnfs/sample_coredns_default_namespace/chart b/sample-cnfs/sample_coredns_default_namespace/chart new file mode 120000 index 000000000..e8121a68a --- /dev/null +++ b/sample-cnfs/sample_coredns_default_namespace/chart @@ -0,0 +1 @@ +../sample_coredns/chart \ No newline at end of file diff --git a/sample-cnfs/sample_coredns_default_namespace/cnf-testsuite.yml b/sample-cnfs/sample_coredns_default_namespace/cnf-testsuite.yml new file mode 100644 index 000000000..ca8310c3f --- /dev/null +++ b/sample-cnfs/sample_coredns_default_namespace/cnf-testsuite.yml @@ -0,0 +1,8 @@ +--- +helm_directory: chart +release_name: coredns +helm_repository: + name: stable + repo_url: https://cncf.gitlab.io/stable +helm_install_namespace: default +allowlist_helm_chart_container_names: [] diff --git a/spec/workload/configuration_spec.cr b/spec/workload/configuration_spec.cr index 933be8258..3e9d4ad5c 100644 --- a/spec/workload/configuration_spec.cr +++ b/spec/workload/configuration_spec.cr @@ -353,13 +353,13 @@ describe CnfTestSuite do it "'default_namespace' should fail if a cnf creates resources in the default namespace", tags: ["default_namespace"] do begin - result = ShellCmd.run_testsuite("cnf_setup cnf-config=./sample-cnfs/sample_coredns") + result = ShellCmd.run_testsuite("cnf_setup cnf-config=./sample-cnfs/sample_coredns_default_namespace") result[:status].success?.should be_true result = ShellCmd.run_testsuite("default_namespace verbose") result[:status].success?.should be_true (/(FAILED).*(Resources are created in the default namespace)/ =~ result[:output]).should_not be_nil ensure - result = ShellCmd.run_testsuite("cnf_cleanup cnf-config=./sample-cnfs/sample_coredns") + result = ShellCmd.run_testsuite("cnf_cleanup cnf-config=./sample-cnfs/sample_coredns_default_namespace") KubectlClient::Utils.wait_for_terminations() end end diff --git a/src/tasks/workload/microservice.cr b/src/tasks/workload/microservice.cr index 64745c702..1b039df51 100644 --- a/src/tasks/workload/microservice.cr +++ b/src/tasks/workload/microservice.cr @@ -312,7 +312,7 @@ task "single_process_type" do |t, args| case kind when "deployment","statefulset","pod","replicaset", "daemonset" resource_yaml = KubectlClient::Get.resource(resource[:kind], resource[:name], resource[:namespace]) - pods = KubectlClient::Get.pods_by_resource(resource_yaml) + pods = KubectlClient::Get.pods_by_resource(resource_yaml, resource[:namespace]) containers = KubectlClient::Get.resource_containers(kind, resource[:name], resource[:namespace]) pods.map do |pod| pod_name = pod.dig("metadata", "name") diff --git a/src/tasks/workload/observability.cr b/src/tasks/workload/observability.cr index a63602a70..f12c1c395 100644 --- a/src/tasks/workload/observability.cr +++ b/src/tasks/workload/observability.cr @@ -96,7 +96,7 @@ task "prometheus_traffic" do |t, args| prom_cnf_match = CNFManager.workload_resource_test(args, config) do |resource_name, container, initialized| ip_match = false resource = KubectlClient::Get.resource(resource_name[:kind], resource_name[:name], resource_name[:namespace]) - pods = KubectlClient::Get.pods_by_resource(resource) + pods = KubectlClient::Get.pods_by_resource(resource, resource_name[:namespace]) pods.each do |pod| pod_ips = pod.dig("status", "podIPs") Log.info { "pod_ips: #{pod_ips}"}