Skip to content

Commit 9a6c050

Browse files
committed
[WIP] Install web console server
1 parent d6ea0d5 commit 9a6c050

File tree

14 files changed

+293
-0
lines changed

14 files changed

+293
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
kind: AssetConfig
2+
apiVersion: v1
3+
extensionDevelopment: false
4+
extensionProperties: null
5+
extensionScripts: null
6+
extensionStylesheets: null
7+
extensions: null
8+
loggingPublicURL: ""
9+
logoutURL: ""
10+
masterPublicURL: https://127.0.0.1:8443
11+
metricsPublicURL: ""
12+
publicURL: https://127.0.0.1:8443/console/
13+
servingInfo:
14+
bindAddress: 0.0.0.0:8443
15+
bindNetwork: tcp4
16+
certFile: /var/serving-cert/tls.crt
17+
clientCA: ""
18+
keyFile: /var/serving-cert/tls.key
19+
maxRequestsInFlight: 0
20+
namedCertificates: null
21+
requestTimeoutSeconds: 0
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
apiVersion: template.openshift.io/v1
2+
kind: Template
3+
metadata:
4+
name: openshift-web-console
5+
annotations:
6+
openshift.io/display-name: OpenShift Web Console
7+
description: The server for the OpenShift web console.
8+
iconClass: icon-openshift
9+
tags: openshift,infra
10+
openshift.io/documentation-url: https://github.com/openshift/origin-web-console-server
11+
openshift.io/support-url: https://access.redhat.com
12+
openshift.io/provider-display-name: Red Hat, Inc.
13+
parameters:
14+
- name: IMAGE
15+
value: openshift/origin-web-console:latest
16+
- name: NAMESPACE
17+
value: openshift-web-console
18+
- name: LOGLEVEL
19+
value: "0"
20+
- name: API_SERVER_CONFIG
21+
- name: NODE_SELECTOR
22+
value: "{}"
23+
- name: REPLICA_COUNT
24+
value: "1"
25+
objects:
26+
27+
# to create the web console server
28+
- apiVersion: apps/v1beta1
29+
kind: Deployment
30+
metadata:
31+
namespace: ${NAMESPACE}
32+
name: webconsole
33+
labels:
34+
app: openshift-web-console
35+
webconsole: "true"
36+
spec:
37+
replicas: ${{REPLICA_COUNT}}
38+
strategy:
39+
type: Recreate
40+
template:
41+
metadata:
42+
name: webconsole
43+
labels:
44+
webconsole: "true"
45+
spec:
46+
serviceAccountName: webconsole
47+
containers:
48+
- name: c
49+
image: ${IMAGE}
50+
imagePullPolicy: IfNotPresent
51+
command:
52+
- "/usr/bin/origin-web-console"
53+
- "--audit-log-path=-"
54+
- "--config=/var/webconsole-config/webconsole-config.yaml"
55+
ports:
56+
- containerPort: 8443
57+
volumeMounts:
58+
- mountPath: /var/serving-cert
59+
name: serving-cert
60+
- mountPath: /var/webconsole-config
61+
name: webconsole-config
62+
readinessProbe:
63+
httpGet:
64+
path: /healthz
65+
port: 8443
66+
scheme: HTTPS
67+
nodeSelector: "${{NODE_SELECTOR}}"
68+
volumes:
69+
- name: serving-cert
70+
secret:
71+
defaultMode: 420
72+
secretName: webconsole-serving-cert
73+
- name: webconsole-config
74+
configMap:
75+
defaultMode: 420
76+
name: webconsole-config
77+
78+
# to create the config for the web console
79+
- apiVersion: v1
80+
kind: ConfigMap
81+
metadata:
82+
namespace: ${NAMESPACE}
83+
name: webconsole-config
84+
labels:
85+
app: openshift-web-console
86+
data:
87+
webconsole-config.yaml: ${API_SERVER_CONFIG}
88+
89+
# to be able to assign powers to the process
90+
- apiVersion: v1
91+
kind: ServiceAccount
92+
metadata:
93+
namespace: ${NAMESPACE}
94+
name: webconsole
95+
labels:
96+
app: openshift-web-console
97+
98+
# to be able to expose web console inside the cluster
99+
- apiVersion: v1
100+
kind: Service
101+
metadata:
102+
namespace: ${NAMESPACE}
103+
name: webconsole
104+
labels:
105+
app: openshift-web-console
106+
annotations:
107+
service.alpha.openshift.io/serving-cert-secret-name: webconsole-serving-cert
108+
spec:
109+
selector:
110+
webconsole: "true"
111+
ports:
112+
- name: https
113+
port: 443
114+
targetPort: 8443

playbooks/deploy_cluster.yml

+3
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222

2323
- import_playbook: openshift-hosted/private/config.yml
2424

25+
- import_playbook: openshift-web-console/private/config.yml
26+
when: openshift_web_console_install | default(true) | bool
27+
2528
- import_playbook: openshift-metrics/private/config.yml
2629
when: openshift_metrics_install_metrics | default(false) | bool
2730

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
- import_playbook: ../init/main.yml
3+
4+
- import_playbook: private/config.yml
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
- name: Web Console Install Checkpoint Start
3+
hosts: all
4+
gather_facts: false
5+
tasks:
6+
- name: Set Web Console install 'In Progress'
7+
run_once: true
8+
set_stats:
9+
data:
10+
installer_phase_web_console:
11+
status: "In Progress"
12+
start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
13+
14+
- name: Web Console
15+
hosts: oo_first_master
16+
roles:
17+
- openshift_web_console
18+
vars:
19+
first_master: "{{ groups.oo_first_master[0] }}"
20+
21+
- name: Web Console Install Checkpoint End
22+
hosts: all
23+
gather_facts: false
24+
tasks:
25+
- name: Set Web Console install 'Complete'
26+
run_once: true
27+
set_stats:
28+
data:
29+
installer_phase_web_console:
30+
status: "Complete"
31+
end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../roles/

roles/installer_checkpoint/callback_plugins/installer_checkpoint.py

+5
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ def v2_playbook_on_stats(self, stats):
3131
'installer_phase_node',
3232
'installer_phase_glusterfs',
3333
'installer_phase_hosted',
34+
'installer_phase_web_console',
3435
'installer_phase_metrics',
3536
'installer_phase_logging',
3637
'installer_phase_prometheus',
@@ -80,6 +81,10 @@ def v2_playbook_on_stats(self, stats):
8081
'title': 'Hosted Install',
8182
'playbook': 'playbooks/openshift-hosted/config.yml'
8283
},
84+
'installer_phase_web_console': {
85+
'title': 'Web Console Install',
86+
'playbook': 'playbooks/openshift-web-console/config.yml'
87+
},
8388
'installer_phase_metrics': {
8489
'title': 'Metrics Install',
8590
'playbook': 'playbooks/openshift-metrics/config.yml'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
openshift_web_console_install: true
3+
openshift_web_console_remove: false
4+
openshift_web_console_node_selector: {"region":"infra"}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
---
2+
# Fact setting
3+
- name: Set default image variables based on deployment type
4+
include_vars: "{{ item }}"
5+
with_first_found:
6+
- "{{ openshift_deployment_type | default(deployment_type) }}.yml"
7+
- "default_images.yml"
8+
9+
- name: set openshift_web_console facts
10+
set_fact:
11+
openshift_web_console_prefix: "{{ openshift_web_console_prefix | default(__openshift_web_console_prefix) }}"
12+
openshift_web_console_version: "{{ openshift_web_console_version | default(__openshift_web_console_version) }}"
13+
openshift_web_console_image_name: "{{ openshift_web_console_image_name | default(__openshift_web_console_image_name) }}"
14+
15+
- oc_project:
16+
name: openshift-web-console
17+
state: present
18+
19+
- command: mktemp -d /tmp/console-ansible-XXXXXX
20+
register: mktemp
21+
changed_when: False
22+
become: no
23+
24+
- copy:
25+
src: "{{ __console_files_location }}/{{ item }}"
26+
dest: "{{ mktemp.stdout }}/{{ item }}"
27+
with_items:
28+
- "{{ __console_template_file }}"
29+
- "{{ __console_config_file }}"
30+
31+
- yedit:
32+
src: "{{ mktemp.stdout }}/{{ __console_config_file }}"
33+
edits:
34+
- key: logoutURL
35+
value: "{{ openshift.master.logout_url | default('') }}"
36+
- key: publicURL
37+
# Must have a trailing slash
38+
value: "{{ openshift.master.public_console_url }}/"
39+
- key: masterPublicURL
40+
value: "{{ openshift.master.public_api_url }}"
41+
42+
- slurp:
43+
src: "{{ mktemp.stdout }}/{{ __console_config_file }}"
44+
register: config
45+
46+
- name: Apply template file
47+
shell: >
48+
{{ openshift.common.client_binary }} process -f "{{ mktemp.stdout }}/{{ __console_template_file }}"
49+
--param API_SERVER_CONFIG="{{ config['content'] | b64decode }}"
50+
--param IMAGE="{{ openshift_web_console_prefix }}{{ openshift_web_console_image_name }}:{{ openshift_web_console_version }}"
51+
| {{ openshift.common.client_binary }} apply -f -
52+
53+
- name: Verify that the web console is running
54+
command: >
55+
curl -k https://webconsole.openshift-web-console.svc/healthz
56+
args:
57+
# Disables the following warning:
58+
# Consider using get_url or uri module rather than running curl
59+
warn: no
60+
register: console_health
61+
until: console_health.stdout == 'ok'
62+
retries: 120
63+
delay: 1
64+
changed_when: false
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
# do any asserts here
3+
4+
- include_tasks: install.yml
5+
when: openshift_web_console_install | default(true) | bool
6+
7+
- include_tasks: remove.yml
8+
when: openshift_web_console_remove | default(false) | bool
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
- command: mktemp -d /tmp/console-ansible-XXXXXX
3+
register: mktemp
4+
changed_when: False
5+
become: no
6+
7+
- copy:
8+
src: "{{ __console_files_location }}/{{ item }}"
9+
dest: "{{ mktemp.stdout }}/{{ item }}"
10+
with_items:
11+
- "{{ __console_template_file }}"
12+
13+
- name: Delete web console objects
14+
shell: >
15+
{{ openshift.common.client_binary }} process -f "{{ mktemp.stdout }}/{{ __console_template_file }}" | {{ openshift.common.client_binary }} delete --ignore-not-found -f -
16+
17+
- oc_project:
18+
name: openshift-web-console
19+
state: absent
20+
21+
- file:
22+
state: absent
23+
name: "{{ mktemp.stdout }}"
24+
changed_when: False
25+
become: no
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
__openshift_web_console_prefix: "docker.io/openshift/"
3+
__openshift_web_console_version: "latest"
4+
__openshift_web_console_image_name: "origin-web-console"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
__console_files_location: "../../../files/origin-components/"
3+
4+
__console_template_file: "console-template.yaml"
5+
__console_config_file: "console-config.yaml"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
__openshift_web_console_prefix: "registry.access.redhat.com/openshift3/"
3+
__openshift_web_console_version: "v3.7"
4+
__openshift_web_console_image_name: "ose-web-console"

0 commit comments

Comments
 (0)