Kubernetes Agent should honour the namespace if set in config
Summary
When using CI/CD Tunnel with Kubernetes agent the namespace is not set on the context even if defined in the agent config.yaml
Steps to reproduce
When using the following the CICD job to display the context
deploy:
image:
name: bitnami/kubectl:latest
entrypoint: [""]
script:
- kubectl config get-contexts
the output is
CURRENT NAME CLUSTER AUTHINFO NAMESPACE
path-to-my-config-repo:agent2 gitlab agent:72
The namespace was set in the agent config using the default-namespace
property
What is the current bug behavior?
No namespace is defined in the context so I need to either
- pass in
-n/--namespace
- add namespace to my yaml
But as I set the default-namespace
I assumed it would have been set
ci_access:
# This agent is accessible from CI jobs in these projects
projects:
- id: group1/group1-1/project1
default_namespace: namespace-to-use-as-default
# This agent is accessible from CI jobs in projects in these groups
groups:
- id: group2/group2-1
default_namespace: namespace-to-use-as-default
What is the expected correct behavior?
Namespace being set in the context
For example
kubectl config get-contexts
CURRENT NAME CLUSTER AUTHINFO NAMESPACE
path-to-my-config-repo:agent2 gitlab agent:72 my-namespace
Implementation details
Populate the context in the automatically injected KUBECONFIG
with a default namespace
Edited by Hordur Freyr Yngvason