Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running etcd 2.0.5 in a pod on master #4442

Merged
merged 1 commit into from
Mar 28, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions cluster/saltbase/salt/etcd/default

This file was deleted.

4 changes: 0 additions & 4 deletions cluster/saltbase/salt/etcd/etcd.conf

This file was deleted.

54 changes: 54 additions & 0 deletions cluster/saltbase/salt/etcd/etcd.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{% set ipv4_addr = salt['grains.get']('fqdn_ip4')[0] -%}

{
"apiVersion": "v1beta3",
"kind": "Pod",
"metadata": {"name":"etcd-server"},
"spec":{
"hostNetwork": true,
"containers":[
{
"name": "etcd-container",
"image": "kubernetes/etcd:2.0.5.1",
"command": [
"/usr/local/bin/etcd",
"--addr",
"{{ipv4_addr}}:4001",
"--bind-addr",
"0.0.0.0:4001",
"--data-dir",
"/var/etcd/data",
"--initial-advertise-peer-urls",
"http://kubernetes-master:2380",
"--name",
"kubernetes-master",
"--initial-cluster",
"kubernetes-master=http://kubernetes-master:2380",
">> /var/log/etcd.log"
],
"ports":[
{ "name": "serverport",
"containerPort": 2380,
"hostPort": 2380},{
"name": "clientport",
"containerPort": 4001,
"hostPort": 4001}
],
"volumeMounts": [
{ "name": "varetcd",
"mountPath": "/var/etcd",
"readOnly": false},
{ "name": "logetcd",
"mountPath": "/var/log/etcd.log",
"readOnly": false}
]
} ],
"volumes":[
{ "name": "varetcd",
"hostPath": {
"path": "/mnt/master-pd/var/etcd"}
},
{ "name": "logetcd",
"hostPath": {
"path": "/var/log/etcd.log"}}]
}}
13 changes: 0 additions & 13 deletions cluster/saltbase/salt/etcd/etcd.service

This file was deleted.

151 changes: 30 additions & 121 deletions cluster/saltbase/salt/etcd/init.sls
Original file line number Diff line number Diff line change
@@ -1,140 +1,49 @@
# We are caching the etcd tar file in GCS for reliability and speed. To
# update this to a new version, do the following:
# 2. Download tar file:
# curl -LO https://github.com/coreos/etcd/releases/download/<ver>/etcd-<ver>-linux-amd64.tar.gz
# 3. Upload to GCS (the cache control makes :
# gsutil cp <tar> gs://kubernetes-release/etcd/<tar>
# 4. Make it world readable:
# gsutil -m acl ch -R -g all:R gs://kubernetes-release/etcd/
# 5. Get a hash of the tar:
# shasum <tar>
# 6. Update this file with new tar version and new hash
delete_etc_etcd_dir:
file.absent:
- name: /etc/etcd

{% set etcd_version="v2.0.5" %}
{% set etcd_tar_url="https://storage.googleapis.com/kubernetes-release/etcd/etcd-%s-linux-amd64.tar.gz"
| format(etcd_version) %}
{% set etcd_tar_hash="sha1=34b185efa954327d6cdfe6be5b1eb5fcfb7c478c" %}
delete_etcd_conf:
file.absent:
- name: /etc/etcd/etcd.conf

etcd-tar:
archive:
- extracted
- user: root
- name: /usr/local/src
- source: {{ etcd_tar_url }}
- source_hash: {{ etcd_tar_hash }}
- archive_format: tar
- if_missing: /usr/local/src/etcd-{{ etcd_version }}-linux-amd64
{% if grains['saltversioninfo'] <= (2014, 7, 0, 0) %}
- tar_options: xz
{% endif %}
touch /var/log/etcd.log:
cmd.run:
- creates: /var/log/etcd.log

/var/etcd:
file.directory:
- name: /usr/local/src/etcd-{{ etcd_version }}-linux-amd64
- user: root
- group: root
- watch:
- archive: etcd-tar
- dir_mode: 700
- recurse:
- user
- group
- mode

etcd-symlink:
file.symlink:
- name: /usr/local/bin/etcd
- target: /usr/local/src/etcd-{{ etcd_version }}-linux-amd64/etcd
- force: true
- watch:
- archive: etcd-tar

etcdctl-symlink:
file.symlink:
- name: /usr/local/bin/etcdctl
- target: /usr/local/src/etcd-{{ etcd_version }}-linux-amd64/etcdctl
- force: true
- watch:
- archive: etcd-tar

etcd:
group.present:
- system: True
user.present:
- system: True
- gid_from_name: True
- shell: /sbin/nologin
- home: /var/etcd

/etc/etcd:
file.directory:
- user: root
- group: root
- dir_mode: 755

/etc/etcd/etcd.conf:
file.managed:
- source: salt://etcd/etcd.conf
- user: root
- group: root
- mode: 644

/var/etcd:
file.directory:
- user: etcd
- group: etcd
- dir_mode: 700
- require:
- user: etcd
- group: etcd
delete_etcd_default:
file.absent:
- name: /etc/default/etcd

/var/etcd/data:
file.directory:
- user: etcd
- group: etcd
- dir_mode: 700
- require:
- user: etcd
- group: etcd
delete_etcd_service_file:
file.absent:
- name: /usr/lib/systemd/system/etcd.service

{% if grains['os_family'] == 'RedHat' %}
delete_etcd_initd:
file.absent:
- name: /etc/init.d/etcd

/etc/default/etcd:
/etc/kubernetes/manifests/etcd.manifest:
file.managed:
- source: salt://etcd/default
- source: salt://etcd/etcd.manifest
- template: jinja
- user: root
- group: root
- mode: 644
- makedirs: true
- dir_mode: 755

/usr/lib/systemd/system/etcd.service:
file.managed:
- source: salt://etcd/etcd.service
- user: root
- group: root

{% else %}

/etc/init.d/etcd:
file.managed:
- source: salt://etcd/initd
- user: root
- group: root
- mode: 755

{% endif %}

etcd-service:
service.running:
#stop legacy etcd_service
stop_etcd-service:
service.dead:
- name: etcd
- enable: True
- watch:
- file: /etc/etcd/etcd.conf
{% if grains['os_family'] == 'RedHat' %}
- file: /usr/lib/systemd/system/etcd.service
- file: /etc/default/etcd
{% endif %}
- file: etcd-tar
- file: etcd-symlink
- require:
- file: /var/etcd
- file: /var/etcd/data
- user: etcd
- group: etcd

- enable: None
120 changes: 0 additions & 120 deletions cluster/saltbase/salt/etcd/initd

This file was deleted.

9 changes: 0 additions & 9 deletions cluster/saltbase/salt/monit/etcd

This file was deleted.

10 changes: 0 additions & 10 deletions cluster/saltbase/salt/monit/init.sls
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,6 @@ monit:
pkg:
- installed

{% if "kubernetes-master" in grains.get('roles', []) %}
/etc/monit/conf.d/etcd:
file:
- managed
- source: salt://monit/etcd
- user: root
- group: root
- mode: 644
{% endif %}

/etc/monit/conf.d/docker:
file:
- managed
Expand Down