generated from onedr0p/cluster-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.envrc
29 lines (23 loc) · 1.02 KB
/
.envrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#shellcheck disable=SC2148,SC2155
# Necessary because kubectx and kubens do not support multiple file paths in
# the KUBECONFIG variable.
# https://github.com/ahmetb/kubectx/issues/211
use_kubeconfig() {
kubernetes_dir="$(expand_path ./kubernetes)"
merged_kubeconfig="${kubernetes_dir}/kubeconfig"
touch "${merged_kubeconfig}"
while read -r kubeconfig; do
KUBECONFIG="${merged_kubeconfig}:${kubeconfig}" kubectl config view --flatten > "${merged_kubeconfig}.merged"
mv "${merged_kubeconfig}.merged" "${merged_kubeconfig}"
done < <(find "${kubernetes_dir}" -mindepth 2 -maxdepth 2 -name kubeconfig)
export KUBECONFIG="${merged_kubeconfig}"
}
use kubeconfig
export SOPS_AGE_KEY_FILE="$(expand_path ./age.key)"
# ansible
PATH_add "$(expand_path ./.venv/bin)"
export VIRTUAL_ENV="$(expand_path ./.venv)"
export ANSIBLE_COLLECTIONS_PATH=$(expand_path ./.venv/galaxy)
export ANSIBLE_NOCOWS=1
export ANSIBLE_ROLES_PATH=$(expand_path ./.venv/galaxy/ansible_roles)
export ANSIBLE_VARS_ENABLED="host_group_vars,community.sops.sops"