Skip to content

Commit 0c08ca0

Browse files
Hack hack hack
1 parent 90b4459 commit 0c08ca0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+493
-747
lines changed

playbooks/common/openshift-cluster/upgrades/docker/tasks/restart.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,19 @@
66
retries: 3
77
delay: 30
88

9+
- name: Restart static master services
10+
command: /usr/bin/master-restart "{{ item }}"
11+
with_items:
12+
- api
13+
- controllers
14+
- etcd
15+
failed_when: false
16+
when: openshift_is_containerized | bool
17+
918
- name: Restart containerized services
1019
service: name={{ item }} state=started
1120
with_items:
12-
- etcd_container
1321
- openvswitch
14-
- "{{ openshift_service_type }}-master-api"
15-
- "{{ openshift_service_type }}-master-controllers"
1622
- "{{ openshift_service_type }}-node"
1723
failed_when: false
1824
when: openshift_is_containerized | bool

playbooks/common/openshift-cluster/upgrades/docker/tasks/upgrade.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,19 @@
44
- name: Stop containerized services
55
service: name={{ item }} state=stopped
66
with_items:
7-
- "{{ openshift_service_type }}-master-api"
8-
- "{{ openshift_service_type }}-master-controllers"
97
- "{{ openshift_service_type }}-node"
10-
- etcd_container
118
- openvswitch
129
failed_when: false
1310
when: openshift_is_containerized | bool
1411

12+
- name: Restart static master services
13+
command: /usr/bin/master-restart "{{ item }}"
14+
with_items:
15+
- api
16+
- controllers
17+
- etcd
18+
failed_when: false
19+
1520
- name: Check Docker image count
1621
shell: "docker images -aq | wc -l"
1722
register: docker_image_count

playbooks/openshift-master/private/config.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,13 @@
178178
openshift_no_proxy_etcd_host_ips: "{{ hostvars | lib_utils_oo_select_keys(groups['oo_etcd_to_config'] | default([]))
179179
| lib_utils_oo_collect('openshift.common.ip') | default([]) | join(',')
180180
}}"
181+
pre_tasks:
182+
- name: Prepare the bootstrap node config on masters for self-hosting
183+
import_role:
184+
name: openshift_node_group
185+
tasks_from: bootstrap
186+
when: openshift_master_bootstrap_enabled | default(false) | bool
187+
181188
roles:
182189
- role: openshift_master_facts
183190
- role: openshift_clock

playbooks/openshift-master/private/scaleup.yml

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,14 @@
1616
yaml_key: 'kubernetesMasterConfig.masterCount'
1717
yaml_value: "{{ openshift.master.master_count }}"
1818
notify:
19-
- restart master api
20-
- restart master controllers
19+
- restart master
2120
handlers:
22-
- name: restart master api
23-
service: name={{ openshift_service_type }}-master-controllers state=restarted
21+
- name: restart master
22+
command: /usr/bin/master-restart "{{ item }}"
23+
with_items:
24+
- api
25+
- controllers
2426
notify: verify api server
25-
# We retry the controllers because the API may not be 100% initialized yet.
26-
- name: restart master controllers
27-
command: "systemctl restart {{ openshift_service_type }}-master-controllers"
28-
retries: 3
29-
delay: 5
30-
register: result
31-
until: result.rc == 0
3227
- name: verify api server
3328
command: >
3429
curl --silent --tlsv1.2

playbooks/openshift-master/private/tasks/wire_aggregator.yml

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -191,16 +191,11 @@
191191
#restart master serially here
192192
- when: yedit_output.changed or (yedit_asset_config_output is defined and yedit_asset_config_output.changed)
193193
block:
194-
- name: restart master api
195-
systemd: name={{ openshift_service_type }}-master-api state=restarted
196-
197-
# We retry the controllers because the API may not be 100% initialized yet.
198-
- name: restart master controllers
199-
command: "systemctl restart {{ openshift_service_type }}-master-controllers"
200-
retries: 3
201-
delay: 5
202-
register: result
203-
until: result.rc == 0
194+
- name: restart master
195+
command: /usr/bin/master-restart "{{ item }}"
196+
with_items:
197+
- api
198+
- controllers
204199

205200
- name: Verify API Server
206201
# Using curl here since the uri module requires python-httplib2 and

playbooks/openshift-node/private/restart.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,7 @@
2222
name: "{{ item }}"
2323
state: started
2424
with_items:
25-
- etcd_container
2625
- openvswitch
27-
- "{{ openshift_service_type }}-master-api"
28-
- "{{ openshift_service_type }}-master-controllers"
2926
- "{{ openshift_service_type }}-node"
3027
failed_when: false
3128
when: openshift_is_containerized | bool
File renamed without changes.

roles/etcd/tasks/main.yml

Lines changed: 4 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -9,104 +9,12 @@
99
- name: setup firewall
1010
import_tasks: firewall.yml
1111

12-
- name: Install etcd
13-
package: name=etcd{{ '-' + etcd_version if etcd_version is defined else '' }} state=present
14-
when: not etcd_is_containerized | bool
15-
register: result
16-
until: result is succeeded
17-
18-
- include_tasks: drop_etcdctl.yml
19-
when:
20-
- openshift_etcd_etcdctl_profile | default(true) | bool
21-
22-
- block:
23-
- name: Pull etcd container
24-
command: docker pull {{ etcd_image }}
25-
register: pull_result
26-
changed_when: "'Downloaded newer image' in pull_result.stdout"
27-
28-
- name: Install etcd container service file
29-
template:
30-
dest: "/etc/systemd/system/etcd_container.service"
31-
src: etcd.docker.service
32-
when:
33-
- etcd_is_containerized | bool
34-
- not l_is_etcd_system_container | bool
35-
36-
# Start secondary etcd instance for third party integrations
37-
# TODO: Determine an alternative to using thirdparty variable
38-
- block:
39-
- name: Create configuration directory
40-
file:
41-
path: "{{ etcd_conf_dir }}"
42-
state: directory
43-
mode: 0700
44-
45-
# TODO: retest with symlink to confirm it does or does not function
46-
- name: Copy service file for etcd instance
47-
copy:
48-
src: /usr/lib/systemd/system/etcd.service
49-
dest: "/etc/systemd/system/{{ etcd_service }}.service"
50-
remote_src: True
51-
52-
- name: Create third party etcd service.d directory exists
53-
file:
54-
path: "{{ etcd_systemd_dir }}"
55-
state: directory
56-
57-
- name: Configure third part etcd service unit file
58-
template:
59-
dest: "{{ etcd_systemd_dir }}/custom.conf"
60-
src: custom.conf.j2
61-
when: etcd_is_thirdparty
62-
6312
# TODO: this task may not be needed with Validate permissions
6413
- name: Ensure etcd datadir exists
6514
file:
6615
path: "{{ etcd_data_dir }}"
6716
state: directory
6817
mode: 0700
69-
when: etcd_is_containerized | bool
70-
71-
- name: Ensure etcd datadir ownership for thirdparty datadir
72-
file:
73-
path: "{{ etcd_data_dir }}"
74-
state: directory
75-
mode: 0700
76-
owner: etcd
77-
group: etcd
78-
recurse: True
79-
when: etcd_is_thirdparty | bool
80-
81-
# TODO: Determine if the below reload would work here, for now just reload
82-
- name:
83-
command: systemctl daemon-reload
84-
when: etcd_is_thirdparty | bool
85-
86-
- block:
87-
- name: Disable system etcd when containerized
88-
systemd:
89-
name: etcd
90-
state: stopped
91-
enabled: no
92-
masked: yes
93-
daemon_reload: yes
94-
when: not l_is_etcd_system_container | bool
95-
register: task_result
96-
failed_when:
97-
- task_result is failed
98-
- ('could not' not in task_result.msg|lower)
99-
100-
- name: Install etcd container service file
101-
template:
102-
dest: "/etc/systemd/system/etcd_container.service"
103-
src: etcd.docker.service
104-
when: not l_is_etcd_system_container | bool
105-
106-
- name: Install Etcd system container
107-
include_tasks: system_container.yml
108-
when: l_is_etcd_system_container | bool
109-
when: etcd_is_containerized | bool
11018

11119
- name: Validate permissions on the config dir
11220
file:
@@ -121,16 +29,9 @@
12129
src: etcd.conf.j2
12230
dest: "{{ etcd_conf_file }}"
12331
backup: true
124-
notify:
125-
- restart etcd
12632

12733
- name: Enable etcd
128-
systemd:
129-
name: "{{ etcd_service }}"
130-
state: started
131-
enabled: yes
132-
register: start_result
133-
134-
- name: Set fact etcd_service_status_changed
135-
set_fact:
136-
etcd_service_status_changed: "{{ start_result is changed }}"
34+
copy:
35+
src: "etcd.yaml"
36+
dest: "/etc/origin/node/pods/"
37+
mode: 0700

roles/openshift_logging/handlers/main.yml

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,12 @@
11
---
2-
- name: restart master api
3-
systemd: name={{ openshift_service_type }}-master-api state=restarted
2+
- name: restart master
3+
command: /usr/bin/master-restart "{{ item }}"
4+
with_items:
5+
- api
6+
- controllers
47
when: (not (master_api_service_status_changed | default(false) | bool))
58
notify: Verify API Server
69

7-
# We retry the controllers because the API may not be 100% initialized yet.
8-
- name: restart master controllers
9-
command: "systemctl restart {{ openshift_service_type }}-master-controllers"
10-
retries: 3
11-
delay: 5
12-
register: result
13-
until: result.rc == 0
14-
when: (not (master_controllers_service_status_changed | default(false) | bool))
15-
1610
- name: Verify API Server
1711
# Using curl here since the uri module requires python-httplib2 and
1812
# wait_for port doesn't provide health information.

files/control-plane/apiserver.yaml renamed to roles/openshift_master/files/apiserver.yaml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,16 @@ spec:
1111
hostNetwork: true
1212
containers:
1313
- name: api
14-
image: openshift/origin:v3.9.0-alpha.3
15-
command: ["/usr/bin/openshift", "start", "master", "api"]
14+
image: openshift/origin:v3.9.0-alpha.4
15+
command: ["/bin/bash", "-c"]
1616
args:
17-
- "--config=/etc/origin/master/master-config.yaml"
17+
- |
18+
#!/bin/bash
19+
set -euo pipefail
20+
if [[ -f /etc/origin/master/master.env ]]; then
21+
source /etc/origin/master/master.env
22+
fi
23+
exec openshift start master api --config=/etc/origin/master/master-config.yaml
1824
securityContext:
1925
privileged: true
2026
volumeMounts:

files/control-plane/controller.yaml renamed to roles/openshift_master/files/controller.yaml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,16 @@ spec:
1111
hostNetwork: true
1212
containers:
1313
- name: controllers
14-
image: openshift/origin:v3.9.0-alpha.3
15-
command: ["/usr/bin/openshift", "start", "master", "controllers"]
14+
image: openshift/origin:v3.9.0-alpha.4
15+
command: ["/bin/bash", "-c"]
1616
args:
17-
- "--config=/etc/origin/master/master-config.yaml"
18-
- "--listen=https://0.0.0.0:8444"
17+
- |
18+
#!/bin/bash
19+
set -euo pipefail
20+
if [[ -f /etc/origin/master/master.env ]]; then
21+
source /etc/origin/master/master.env
22+
fi
23+
exec openshift start master controllers --config=/etc/origin/master/master-config.yaml --listen=https://0.0.0.0:8444
1924
securityContext:
2025
privileged: true
2126
volumeMounts:
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
# Return the logs for a given static pod by component name and container name. Remaining arguments are passed to the
5+
# current container runtime.
6+
if [[ -z "${1-}" || -z "${2-}" ]]; then
7+
echo "A component name like 'api', 'etcd', or 'controllers' must be specified along with the container name within that component." 1>&2
8+
exit 1
9+
fi
10+
uid=$(docker ps -l -a --filter "label=openshift.io/component=${1}" --filter "label=io.kubernetes.container.name=POD" --format '{{ .Label "io.kubernetes.pod.uid" }}')
11+
if [[ -z "${uid}" ]]; then
12+
echo "Component ${1} is stopped or not running" 1>&2
13+
exit 0
14+
fi
15+
container=$(docker ps -l -a -q --filter "label=io.kubernetes.pod.uid=${uid}" --filter "label=io.kubernetes.container.name=${2}")
16+
exec docker logs "${@:3}" "${container}"
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
# Restart the named component by stopping its base container.
5+
if [[ -z "${1-}" ]]; then
6+
echo "A component name like 'api', 'etcd', or 'controllers' must be specified." 1>&2
7+
exit 1
8+
fi
9+
container=$(docker ps -l -q --filter "label=openshift.io/component=${1}" --filter "label=io.kubernetes.container.name=POD")
10+
if [[ -z "${container}" ]]; then
11+
echo "Component ${1} is already stopped" 1>&2
12+
exit 0
13+
fi
14+
exec docker stop "${container}" --time 30 >/dev/null

roles/openshift_master/handlers/main.yml

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,14 @@
11
---
2-
- name: restart master api
3-
systemd:
4-
name: "{{ openshift_service_type }}-master-api"
5-
state: restarted
2+
- name: restart master
3+
command: /usr/bin/master-restart "{{ item }}"
4+
with_items:
5+
- api
6+
- controllers
67
when:
78
- not (master_api_service_status_changed | default(false) | bool)
89
notify:
910
- Verify API Server
1011

11-
# We retry the controllers because the API may not be 100% initialized yet.
12-
- name: restart master controllers
13-
command: "systemctl restart {{ openshift_service_type }}-master-controllers"
14-
retries: 3
15-
delay: 5
16-
register: result
17-
until: result.rc == 0
18-
when:
19-
- not (master_controllers_service_status_changed | default(false) | bool)
20-
2112
- name: Verify API Server
2213
# Using curl here since the uri module requires python-httplib2 and
2314
# wait_for port doesn't provide health information.

roles/openshift_master/tasks/bootstrap_settings.yml

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)