Skip to content

Commit f489a57

Browse files
authored
Merge pull request #94 from equinix/kubeconfigfile-output
include kubeconfig filename in outputs, make content sensitive
2 parents ad8554c + b2fe6f1 commit f489a57

File tree

7 files changed

+28
-13
lines changed

7 files changed

+28
-13
lines changed

.github/workflows/integration.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ jobs:
1414
name: Integration Tests
1515
runs-on: ${{ matrix.os }}
1616
env:
17+
TF_VAR_secrets_encryption: false
18+
TF_VAR_metro: "sv"
19+
TF_VAR_ccm_enabled: true
20+
TF_VAR_loadbalancer_type: "kube-vip"
1721
TF_IN_AUTOMATION: 1
1822
TF_VERSION: ${{ matrix.tf }}
1923
TF_VAR_control_plane_node_count: 0

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@
44
*.tfvars
55
examples/inventory.yaml
66
examples/main.retry
7+
kubeconfig
8+
metal-key
9+
metal-key.pub
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
22
/usr/bin/ssh -i $ssh_private_key_path -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null root@$controller "while true; do if ! type kubeadm > /dev/null; then sleep 20; else break; fi; done"
3-
sleep 360
3+
sleep 520
44
/usr/bin/scp -i $ssh_private_key_path -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -q root@$controller:/etc/kubernetes/admin.conf $local_path/kubeconfig;
55

modules/controller_pool/controller-primary.tpl

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -108,17 +108,13 @@ EOF
108108
}
109109

110110
function kube_vip {
111-
kubectl apply -f https://kube-vip.io/manifests/rbac.yaml
112-
GATEWAY_IP=$(curl https://metadata.platformequinix.com/metadata | jq -r ".network.addresses[] | select(.public == false) | .gateway");
113-
ip route add 169.254.255.1 via $GATEWAY_IP
114-
ip route add 169.254.255.2 via $GATEWAY_IP
115-
alias kube-vip="docker run --network host --rm ghcr.io/kube-vip/kube-vip:v0.3.8"
116-
kube-vip manifest daemonset \
111+
kubectl --kubeconfig=/etc/kubernetes/admin.conf apply -f https://kube-vip.io/manifests/rbac.yaml
112+
docker run --network host --rm ghcr.io/kube-vip/kube-vip:v0.4.0 manifest daemonset \
117113
--interface lo \
118114
--services \
119115
--bgp \
120116
--annotations metal.equinix.com \
121-
--inCluster | kubectl apply -f -
117+
--inCluster | kubectl --kubeconfig=/etc/kubernetes/admin.conf apply -f -
122118
}
123119

124120
function ceph_pre_check {

modules/controller_pool/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ resource "null_resource" "kubeconfig" {
8383
}
8484

8585
data "local_file" "kubeconfig" {
86-
filename = "${path.root}/kubeconfig"
86+
filename = abspath("${path.root}/kubeconfig")
8787

8888
depends_on = [
8989
null_resource.kubeconfig

modules/controller_pool/outputs.tf

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ output "controller_addresses" {
99
# }
1010

1111
output "kubeconfig" {
12-
description = "Kubeconfig for the newly created cluster"
13-
value = data.local_file.kubeconfig
14-
}
12+
description = "Kubeconfig content for the newly created cluster"
13+
value = data.local_file.kubeconfig.content
14+
sensitive = true
15+
}
16+
17+
output "kubeconfig_filename" {
18+
description = "Kubeconfig file for the newly created cluster"
19+
value = data.local_file.kubeconfig.filename
20+
}

outputs.tf

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,10 @@ output "kubernetes_api_address" {
1010
output "kubernetes_kubeconfig" {
1111
description = "Kubeconfig for the newly created cluster"
1212
value = module.controllers.kubeconfig
13-
}
13+
sensitive = true
14+
}
15+
16+
output "kubernetes_kubeconfig_file" {
17+
description = "Kubecobnfig file for the newly created cluster"
18+
value = module.controllers.kubeconfig_filename
19+
}

0 commit comments

Comments
 (0)