dc1eacee60
This patch follows the CoreOS guidance for kubernetes: https://coreos.com/kubernetes/docs/latest/getting-started.html CoreOS doesn't support multi-part mime user-data, so we cannot pack multiple scripts into one (which we did in Atomic). The major work of this patch is to wrap each cloud-init script with a systemd unit, which will be executed one-by-one at the first boot. Note that this patch only enable a basic CoreOS support. Advanced features (i.e. TLS, Cinder volume, HA, external load balancing) are not included. These features need to be ported from Atomic as a future work. Partially-Implements: blueprint coreos-k8s-bay Change-Id: Ib6fe76718ac9b198e0aae57618d3edd98792f15d
48 lines
1.2 KiB
YAML
48 lines
1.2 KiB
YAML
#cloud-config
|
|
write_files:
|
|
- path: /etc/systemd/system/create-kube-namespace.service
|
|
owner: "root:root"
|
|
permissions: "0644"
|
|
content: |
|
|
[Unit]
|
|
After=kubelet.service
|
|
Requires=kubelet.service
|
|
Description=Create kube-system namespace
|
|
|
|
[Service]
|
|
Type=oneshot
|
|
ExecStart=/etc/sysconfig/create-kube-namespace.sh
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
|
|
- path: /etc/sysconfig/create-kube-namespace.sh
|
|
owner: "root:root"
|
|
permissions: "0755"
|
|
content: |
|
|
#!/bin/sh
|
|
|
|
. /etc/sysconfig/heat-params
|
|
myip=$(ip addr show eth0 |
|
|
awk '$1 == "inet" {print $2}' | cut -f1 -d/)
|
|
|
|
until curl -sf "http://127.0.0.1:8080/healthz"
|
|
do
|
|
echo "Waiting for Kubernetes API..."
|
|
sleep 5
|
|
done
|
|
|
|
KUBE_SYSTEM_JSON=/srv/kubernetes/kube-system-namespace.json
|
|
mkdir -p $(dirname ${KUBE_SYSTEM_JSON})
|
|
cat > ${KUBE_SYSTEM_JSON} <<EOF
|
|
{
|
|
"apiVersion": "v1",
|
|
"kind": "Namespace",
|
|
"metadata": {
|
|
"name": "kube-system"
|
|
}
|
|
}
|
|
EOF
|
|
|
|
curl -XPOST -d@${KUBE_SYSTEM_JSON} "http://127.0.0.1:8080/api/v1/namespaces"
|