Skip to content
This repository was archived by the owner on Jul 30, 2021. It is now read-only.

Commit ca299d1

Browse files
authored
Merge pull request #363 from aaronlevy/ca-fix
hack: copy ca.crt to host as part of vagrant provisioning
2 parents c43235c + 774da2f commit ca299d1

File tree

6 files changed

+25
-18
lines changed

6 files changed

+25
-18
lines changed

hack/multi-node/Vagrantfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ end
2020

2121
CONTROLLER_USER_DATA_PATH = File.expand_path("./cluster/user-data-controller")
2222
WORKER_USER_DATA_PATH = File.expand_path("./cluster/user-data-worker")
23+
KUBECONFIG_PATH = File.expand_path("cluster/auth/kubeconfig")
24+
CA_CERT_PATH = File.expand_path("cluster/tls/ca.crt")
2325

2426
def etcdIP(num)
2527
return "172.17.4.#{num+50}"
@@ -131,6 +133,12 @@ Vagrant.configure("2") do |config|
131133

132134
controller.vm.provision :file, source: CONTROLLER_USER_DATA_PATH, destination: "/tmp/vagrantfile-user-data"
133135
controller.vm.provision :shell, inline: "mv /tmp/vagrantfile-user-data /var/lib/coreos-vagrant/", privileged: true
136+
137+
controller.vm.provision :file, :source => KUBECONFIG_PATH, :destination => "/tmp/kubeconfig"
138+
controller.vm.provision :shell, :inline => "mv /tmp/kubeconfig /etc/kubernetes/kubeconfig", :privileged => true
139+
140+
controller.vm.provision :file, :source => CA_CERT_PATH, :destination => "/tmp/ca.crt"
141+
controller.vm.provision :shell, :inline => "mv /tmp/ca.crt /etc/kubernetes/ca.crt", :privileged => true
134142
end
135143
end
136144

@@ -153,6 +161,12 @@ Vagrant.configure("2") do |config|
153161

154162
worker.vm.provision :file, source: WORKER_USER_DATA_PATH, destination: "/tmp/vagrantfile-user-data"
155163
worker.vm.provision :shell, inline: "mv /tmp/vagrantfile-user-data /var/lib/coreos-vagrant/", privileged: true
164+
165+
worker.vm.provision :file, :source => KUBECONFIG_PATH, :destination => "/tmp/kubeconfig"
166+
worker.vm.provision :shell, :inline => "mv /tmp/kubeconfig /etc/kubernetes/kubeconfig", :privileged => true
167+
168+
worker.vm.provision :file, :source => CA_CERT_PATH, :destination => "/tmp/ca.crt"
169+
worker.vm.provision :shell, :inline => "mv /tmp/ca.crt /etc/kubernetes/ca.crt", :privileged => true
156170
end
157171
end
158172
end

hack/multi-node/bootkube-up

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,8 @@ fi
2222
# Render assets
2323
if [ ! -d "cluster" ]; then
2424
../../_output/bin/${local_os}/bootkube render --asset-dir=cluster --api-servers=https://172.17.4.101:443 ${etcd_render_flags}
25-
# Add rendered kubeconfig to the node user-data
26-
cat user-data.sample > cluster/user-data && sed 's/^/ /' cluster/auth/kubeconfig >> cluster/user-data
27-
cp cluster/user-data{,-worker}
28-
cp cluster/user-data{,-controller}
25+
cp user-data.sample cluster/user-data-worker
26+
cp user-data.sample cluster/user-data-controller
2927
sed -i.bak -e '/--node-labels=master=true/d' cluster/user-data-worker
3028
fi
3129

hack/multi-node/user-data.sample

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,3 @@ coreos:
4141

4242
[Install]
4343
WantedBy=multi-user.target
44-
45-
write_files:
46-
- path: "/etc/kubernetes/kubeconfig"
47-
permissions: "0644"
48-
owner: core
49-
content: |

hack/single-node/Vagrantfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ Vagrant.require_version ">= 1.6.0"
1212

1313
NODE_IP = "172.17.4.100"
1414
USER_DATA_PATH = File.expand_path("cluster/user-data")
15+
KUBECONFIG_PATH = File.expand_path("cluster/auth/kubeconfig")
16+
CA_CERT_PATH = File.expand_path("cluster/tls/ca.crt")
1517

1618
Vagrant.configure("2") do |config|
1719
# always use Vagrant's insecure key
@@ -51,4 +53,10 @@ Vagrant.configure("2") do |config|
5153

5254
config.vm.provision :file, :source => USER_DATA_PATH, :destination => "/tmp/vagrantfile-user-data"
5355
config.vm.provision :shell, :inline => "mv /tmp/vagrantfile-user-data /var/lib/coreos-vagrant/", :privileged => true
56+
57+
config.vm.provision :file, :source => KUBECONFIG_PATH, :destination => "/tmp/kubeconfig"
58+
config.vm.provision :shell, :inline => "mv /tmp/kubeconfig /etc/kubernetes/kubeconfig", :privileged => true
59+
60+
config.vm.provision :file, :source => CA_CERT_PATH, :destination => "/tmp/ca.crt"
61+
config.vm.provision :shell, :inline => "mv /tmp/ca.crt /etc/kubernetes/ca.crt", :privileged => true
5462
end

hack/single-node/bootkube-up

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ fi
1212
# Render assets
1313
if [ ! -d "cluster" ]; then
1414
../../_output/bin/${local_os}/bootkube render --asset-dir=cluster --api-servers=https://172.17.4.100:443
15-
# Add rendered kubeconfig to the node user-data
16-
cat user-data.sample > cluster/user-data && sed 's/^/ /' cluster/auth/kubeconfig >> cluster/user-data
15+
cp user-data.sample cluster/user-data
1716
fi
1817

1918
# Start the VM

hack/single-node/user-data.sample

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,3 @@ coreos:
4949

5050
[Install]
5151
WantedBy=multi-user.target
52-
53-
write_files:
54-
- path: "/etc/kubernetes/kubeconfig"
55-
permissions: "0644"
56-
owner: core
57-
content: |

0 commit comments

Comments
 (0)