mirror of
https://gitlab.sarex.io/infra/terraform-contour-mirror.git
synced 2026-08-05 18:31:00 +03:00
++ fall back to in-cluster kubernetes auth when KUBECONFIG file doesn't exist
This commit is contained in:
parent
74f4e11b1d
commit
573e8d04f6
@ -58,8 +58,14 @@ variable "kube_context" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
provider "kubernetes" {
|
provider "kubernetes" {
|
||||||
config_path = var.kubeconfig_path != "" ? var.kubeconfig_path : null
|
# KUBECONFIG is set unconditionally at job level for the external-runner case
|
||||||
config_context = var.kube_context != "" ? var.kube_context : null
|
# (see .gitea/workflows/terraform.yml "Prepare kubeconfig"); on an in-cluster
|
||||||
|
# runner that file is never written (no KUBECONFIG_B64), so fileexists() must
|
||||||
|
# gate this - a non-empty path alone isn't enough, else the provider tries to
|
||||||
|
# read a file that was never created and falls over instead of using the pod
|
||||||
|
# ServiceAccount / in-cluster config.
|
||||||
|
config_path = var.kubeconfig_path != "" && fileexists(var.kubeconfig_path) ? var.kubeconfig_path : null
|
||||||
|
config_context = var.kubeconfig_path != "" && fileexists(var.kubeconfig_path) ? var.kube_context : null
|
||||||
}
|
}
|
||||||
|
|
||||||
# Vault: static VAULT_TOKEN if provided, else in-cluster k8s auth by the runner SA.
|
# Vault: static VAULT_TOKEN if provided, else in-cluster k8s auth by the runner SA.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user