mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Merge pull request #7224 from errordeveloper/master
coreos/azure: Weave version bump, various other enhancements
This commit is contained in:
commit
c1d1e1d45c
@ -60,7 +60,7 @@ kube-02 environment=production Ready
|
||||
Let's follow the Guestbook example now:
|
||||
```
|
||||
cd guestbook-example
|
||||
kubectl create -f redis-master.json
|
||||
kubectl create -f redis-master-controller.json
|
||||
kubectl create -f redis-master-service.json
|
||||
kubectl create -f redis-slave-controller.json
|
||||
kubectl create -f redis-slave-service.json
|
||||
|
@ -32,13 +32,12 @@ coreos:
|
||||
Description=etcd 2
|
||||
Documentation=https://github.com/coreos/etcd/
|
||||
[Service]
|
||||
Environment=ETCD_NAME=%host%
|
||||
Environment=ETCD_NAME=%H
|
||||
Environment=ETCD_INITIAL_CLUSTER_TOKEN=etcd-cluster
|
||||
Environment=ETCD_INITIAL_ADVERTISE_PEER_URLS=http://%host%:2380
|
||||
Environment=ETCD_LISTEN_PEER_URLS=http://%host%:2380
|
||||
Environment=ETCD_INITIAL_ADVERTISE_PEER_URLS=http://%H:2380
|
||||
Environment=ETCD_LISTEN_PEER_URLS=http://%H:2380
|
||||
Environment=ETCD_LISTEN_CLIENT_URLS=http://0.0.0.0:2379,http://0.0.0.0:4001
|
||||
Environment=ETCD_ADVERTISE_CLIENT_URLS=http://%host%:2379,http://%host%:4001
|
||||
Environment=ETCD_INITIAL_CLUSTER=%cluster%
|
||||
Environment=ETCD_ADVERTISE_CLIENT_URLS=http://%H:2379,http://%H:4001
|
||||
Environment=ETCD_INITIAL_CLUSTER_STATE=new
|
||||
ExecStart=/opt/bin/etcd2
|
||||
Restart=always
|
||||
|
@ -10,12 +10,18 @@ write_files:
|
||||
#!/bin/sh -xe
|
||||
minion_id="${1}"
|
||||
master_url="${2}"
|
||||
env_label="${3}"
|
||||
until healthcheck=$(curl --fail --silent "${master_url}/healthz")
|
||||
do sleep 2
|
||||
done
|
||||
test -n "${healthcheck}"
|
||||
test "${healthcheck}" = "ok"
|
||||
printf '{ "id": "%s", "kind": "Minion", "apiVersion": "v1beta1", "labels": { "environment": "production" } }' "${minion_id}" \
|
||||
printf '{
|
||||
"id": "%s",
|
||||
"kind": "Minion",
|
||||
"apiVersion": "v1beta1",
|
||||
"labels": { "environment": "%s" }
|
||||
}' "${minion_id}" "${env_label}" \
|
||||
| /opt/bin/kubectl create -s "${master_url}" -f -
|
||||
|
||||
- path: /etc/kubernetes/manifests/fluentd.manifest
|
||||
@ -50,6 +56,14 @@ coreos:
|
||||
group: stable
|
||||
reboot-strategy: off
|
||||
units:
|
||||
- name: systemd-networkd-wait-online.service
|
||||
drop-ins:
|
||||
- name: 50-check-github-is-reachable.conf
|
||||
content: |
|
||||
[Service]
|
||||
ExecStart=/bin/sh -x -c \
|
||||
'until curl --silent --fail https://status.github.com/api/status.json | grep -q \"good\"; do sleep 2; done'
|
||||
|
||||
- name: docker.service
|
||||
drop-ins:
|
||||
- name: 50-weave-kubernetes.conf
|
||||
@ -120,7 +134,7 @@ coreos:
|
||||
Before=weave-helper.service
|
||||
Before=docker.service
|
||||
Description=Install Weave
|
||||
Documentation=http://zettio.github.io/weave/
|
||||
Documentation=http://weaveworks.github.io/weave/
|
||||
Requires=network-online.target
|
||||
[Service]
|
||||
Type=oneshot
|
||||
@ -129,7 +143,7 @@ coreos:
|
||||
ExecStartPre=/usr/bin/curl \
|
||||
--silent \
|
||||
--location \
|
||||
https://github.com/weaveworks/weave/releases/download/v0.9.0/weave \
|
||||
https://github.com/weaveworks/weave/releases/download/latest_release/weave \
|
||||
--output /opt/bin/weave
|
||||
ExecStartPre=/usr/bin/curl \
|
||||
--silent \
|
||||
@ -150,7 +164,7 @@ coreos:
|
||||
After=install-weave.service
|
||||
After=docker.service
|
||||
Description=Weave Network Router
|
||||
Documentation=http://zettio.github.io/weave/
|
||||
Documentation=http://weaveworks.github.io/weave/
|
||||
Requires=docker.service
|
||||
Requires=install-weave.service
|
||||
[Service]
|
||||
@ -165,13 +179,13 @@ coreos:
|
||||
After=install-weave.service
|
||||
After=docker.service
|
||||
Description=Weave Network Router
|
||||
Documentation=http://zettio.github.io/weave/
|
||||
Documentation=http://weaveworks.github.io/weave/
|
||||
Requires=docker.service
|
||||
Requires=install-weave.service
|
||||
[Service]
|
||||
TimeoutStartSec=0
|
||||
EnvironmentFile=/etc/weave.%H.env
|
||||
ExecStartPre=/usr/bin/docker pull zettio/weave:latest
|
||||
ExecStartPre=/usr/bin/docker pull zettio/weavetools:latest
|
||||
ExecStartPre=/opt/bin/weave setup
|
||||
ExecStartPre=/opt/bin/weave launch $WEAVE_PEERS
|
||||
ExecStart=/usr/bin/docker attach weave
|
||||
Restart=on-failure
|
||||
@ -194,7 +208,7 @@ coreos:
|
||||
[Service]
|
||||
Type=oneshot
|
||||
EnvironmentFile=/etc/weave.%H.env
|
||||
ExecStart=/opt/bin/weave create-bridge
|
||||
ExecStart=/opt/bin/weave --local create-bridge
|
||||
ExecStart=/usr/bin/ip addr add dev weave $BRIDGE_ADDRESS_CIDR
|
||||
ExecStart=/usr/bin/ip route add $BREAKOUT_ROUTE dev weave scope link
|
||||
ExecStart=/usr/bin/ip route add 224.0.0.0/4 dev weave
|
||||
@ -222,6 +236,7 @@ coreos:
|
||||
ExecStartPost=/bin/ln -s /opt/kubernetes/server/bin/kubectl /opt/bin/
|
||||
ExecStartPost=/bin/mv /tmp/kubernetes/examples/guestbook /home/core/guestbook-example
|
||||
ExecStartPost=/bin/rm -rf /tmp/kubernetes
|
||||
ExecStartPost=/bin/sed 's/\("createExternalLoadBalancer":\) true/\1 false/' -i /home/core/guestbook-example/frontend-service.json
|
||||
RemainAfterExit=yes
|
||||
Type=oneshot
|
||||
[Install]
|
||||
@ -244,7 +259,7 @@ coreos:
|
||||
ExecStart=/opt/kubernetes/server/bin/kube-apiserver \
|
||||
--address=0.0.0.0 \
|
||||
--port=8080 \
|
||||
--etcd_servers=http://etcd-00:4001,http://etcd-01:4001,http://etcd-02:4001 \
|
||||
$ETCD_SERVERS \
|
||||
--portal_net=10.1.0.0/16 \
|
||||
--cloud_provider=vagrant \
|
||||
--logtostderr=true --v=3
|
||||
@ -345,6 +360,8 @@ coreos:
|
||||
content: |
|
||||
[Unit]
|
||||
After=download-kubernetes.service
|
||||
Before=proxy.service
|
||||
Before=kubelet.service
|
||||
ConditionFileIsExecutable=/opt/kubernetes/server/bin/kubectl
|
||||
ConditionFileIsExecutable=/opt/bin/register_minion.sh
|
||||
Description=Kubernetes Create Minion
|
||||
@ -352,7 +369,7 @@ coreos:
|
||||
Wants=download-kubernetes.service
|
||||
ConditionHost=!kube-00
|
||||
[Service]
|
||||
ExecStart=/opt/bin/register_minion.sh %H http://kube-00:8080
|
||||
ExecStart=/opt/bin/register_minion.sh %H http://kube-00:8080 production
|
||||
Type=oneshot
|
||||
[Install]
|
||||
WantedBy=kubernetes-minion.target
|
||||
|
@ -5,28 +5,51 @@ var util = require('../util.js');
|
||||
var cloud_config = require('../cloud_config.js');
|
||||
|
||||
|
||||
etcd_initial_cluster_conf_self = function (conf) {
|
||||
var port = '2380';
|
||||
|
||||
var data = {
|
||||
nodes: _(conf.nodes.etcd).times(function (n) {
|
||||
var host = util.hostname(n, 'etcd');
|
||||
return [host, [host, port].join(':')].join('=http://');
|
||||
}),
|
||||
};
|
||||
|
||||
return {
|
||||
'name': 'etcd2.service',
|
||||
'drop-ins': [{
|
||||
'name': '50-etcd-initial-cluster.conf',
|
||||
'content': _.template("[Service]\nEnvironment=ETCD_INITIAL_CLUSTER=<%= nodes.join(',') %>\n")(data),
|
||||
}],
|
||||
};
|
||||
};
|
||||
|
||||
etcd_initial_cluster_conf_kube = function (conf) {
|
||||
var port = '4001';
|
||||
|
||||
var data = {
|
||||
nodes: _(conf.nodes.etcd).times(function (n) {
|
||||
var host = util.hostname(n, 'etcd');
|
||||
return 'http://' + [host, port].join(':');
|
||||
}),
|
||||
};
|
||||
|
||||
return {
|
||||
'name': 'apiserver.service',
|
||||
'drop-ins': [{
|
||||
'name': '50-etcd-initial-cluster.conf',
|
||||
'content': _.template("[Service]\nEnvironment=ETCD_SERVERS=--etcd_servers=<%= nodes.join(',') %>\n")(data),
|
||||
}],
|
||||
};
|
||||
};
|
||||
|
||||
exports.create_etcd_cloud_config = function (node_count, conf) {
|
||||
var input_file = './cloud_config_templates/kubernetes-cluster-etcd-node-template.yml';
|
||||
var output_file = util.join_output_file_path('kubernetes-cluster-etcd-nodes', 'generated.yml');
|
||||
|
||||
var peers = [ ];
|
||||
for (var i = 0; i < node_count; i++) {
|
||||
peers.push(util.hostname(i, 'etcd') + '=http://' + util.hostname(i, 'etcd') + ':2380');
|
||||
}
|
||||
var cluster = peers.join(',');
|
||||
|
||||
return _(node_count).times(function (n) {
|
||||
var output_file = util.join_output_file_path('kubernetes-cluster-etcd-node-' + n, 'generated.yml');
|
||||
|
||||
return cloud_config.process_template(input_file, output_file, function(data) {
|
||||
for (var i = 0; i < data.coreos.units.length; i++) {
|
||||
var unit = data.coreos.units[i];
|
||||
if (unit.name === 'etcd2.service') {
|
||||
unit.content = _.replaceAll(_.replaceAll(unit.content, '%host%', util.hostname(n, 'etcd')), '%cluster%', cluster);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return data;
|
||||
});
|
||||
return cloud_config.process_template(input_file, output_file, function(data) {
|
||||
data.coreos.units.push(etcd_initial_cluster_conf_self(conf));
|
||||
return data;
|
||||
});
|
||||
};
|
||||
|
||||
@ -44,8 +67,10 @@ exports.create_node_cloud_config = function (node_count, conf) {
|
||||
bridge_address_cidr: util.ipv4([10, 2, n, 1], 24),
|
||||
});
|
||||
};
|
||||
|
||||
return cloud_config.process_template(input_file, output_file, function(data) {
|
||||
data.write_files = data.write_files.concat(_(node_count).times(make_node_config));
|
||||
data.coreos.units.push(etcd_initial_cluster_conf_kube(conf));
|
||||
return data;
|
||||
});
|
||||
};
|
||||
|
@ -9,7 +9,7 @@
|
||||
"author": "Ilya Dmitrichenko <errordeveloper@gmail.com>",
|
||||
"license": "Apache 2.0",
|
||||
"dependencies": {
|
||||
"azure-cli": "^0.8.16",
|
||||
"azure-cli": "^0.8.17",
|
||||
"colors": "^1.0.3",
|
||||
"js-yaml": "^3.2.5",
|
||||
"openssl-wrapper": "^0.2.1",
|
||||
|
Loading…
Reference in New Issue
Block a user