You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Can the config_path provider argument be sourced from $KUBECONFIG? The kubectl command uses KUBECONFIG by default so it makes sense to me that this provider would look in the same place. I think this could provide a smoother integration with other tools via consistent defaults.
My specific use-case is with Gitlab CI. Gitlab CI has a nice k8s cluster integration that automatically exports the KUBECONFG env var for each CI job. Because this provider looks for KUBE_CONFIG_PATH, I have to add some extra logic to re-export the kube config path. This sounds simple, but is made a bit more complex by what I'd consider a bug in Gitlab CI: adding
variables:
KUBE_CONFIG_PATH: $KUBECONFIG
to my .gitlab-ci.yml script actually exports the contents of the kube config file. The solution I've found is to add a script to the container running the job, to properly export KUBE_CONFIG_PATH before running Terraform.
To maintain backward compatibility, sourcing from KUBECONFIG would be in addition to sourcing from KUBE_CONFIG_PATH. KUBE_CONFIG_PATH could have priority to help prevent surprises.
I'm wondering if this has been looked at before. The choice of KUBE_CONFIG_PATH certainly feels intentional. If so, why was it decided not to use KUBECONFIG?
If this sounds reasonable, I can work on it and submit a PR.
Even worse - Kubernetes Provider works without specifying config_path (probably by falling back to $KUBECONFIG and then to $HOME/.kube/config). It would be great if the behavior of this provider would just match the behavior of Kubernetes Provider.
Would be great if somebody from the dev team take a look in this, the change introduced with v2.0.0 of provider remove KUBECONFIG in favor of KUBE_CONFIG_PATH and like the OP said, no backward compatibility is provided, increasing the complexity for the setup
Marking this issue as stale due to inactivity. If this issue receives no comments in the next 30 days it will automatically be closed. If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. This helps our maintainers find and focus on the active issues. Maintainers may also remove the stale label at their discretion. Thank you!
Description
Can the
config_path
provider argument be sourced from$KUBECONFIG
? Thekubectl
command usesKUBECONFIG
by default so it makes sense to me that this provider would look in the same place. I think this could provide a smoother integration with other tools via consistent defaults.My specific use-case is with Gitlab CI. Gitlab CI has a nice k8s cluster integration that automatically exports the
KUBECONFG
env var for each CI job. Because this provider looks forKUBE_CONFIG_PATH
, I have to add some extra logic to re-export the kube config path. This sounds simple, but is made a bit more complex by what I'd consider a bug in Gitlab CI: addingto my
.gitlab-ci.yml
script actually exports the contents of the kube config file. The solution I've found is to add a script to the container running the job, to properly exportKUBE_CONFIG_PATH
before running Terraform.To maintain backward compatibility, sourcing from
KUBECONFIG
would be in addition to sourcing fromKUBE_CONFIG_PATH
.KUBE_CONFIG_PATH
could have priority to help prevent surprises.I'm wondering if this has been looked at before. The choice of
KUBE_CONFIG_PATH
certainly feels intentional. If so, why was it decided not to useKUBECONFIG
?If this sounds reasonable, I can work on it and submit a PR.
References
Also posted at: hashicorp/terraform-provider-kubernetes#1175
Community Note
The text was updated successfully, but these errors were encountered: