From 61dac735bcfe76595697c28426c914e9c3519ac2 Mon Sep 17 00:00:00 2001 From: Joseph Callen Date: Tue, 20 Feb 2018 09:19:40 -0500 Subject: [PATCH] Adding Galera plan and testing --- Dockerfile-canary | 44 ++++++---- Dockerfile-latest | 44 ++++++---- Dockerfile-nightly | 44 ++++++---- apb.yml | 13 +++ playbooks/test.yml | 18 ++++ playbooks/test_tasks.yml | 37 ++++++++ playbooks/vars/dev.yml | 10 +++ playbooks/vars/ha.yml | 10 +++ playbooks/vars/prod.yml | 10 +++ .../defaults/main.yml | 28 +++++- .../rhscl-mariadb-apb-openshift/tasks/ha.yml | 73 ++++++++++++++++ .../tasks/main.yml | 34 ++++++-- .../tasks/test.yml | 73 ++++++++++++++++ .../templates/bc-galera.yaml.j2 | 35 ++++++++ .../templates/bc-ha.yaml.j2 | 25 ++++++ .../templates/imagestream.yaml.j2 | 23 +++++ .../templates/service.yaml.j2 | 18 ++++ .../templates/statefulset.yaml.j2 | 85 +++++++++++++++++++ 18 files changed, 564 insertions(+), 60 deletions(-) create mode 100644 playbooks/test.yml create mode 100644 playbooks/test_tasks.yml create mode 100644 playbooks/vars/dev.yml create mode 100644 playbooks/vars/ha.yml create mode 100644 playbooks/vars/prod.yml create mode 100644 roles/rhscl-mariadb-apb-openshift/tasks/ha.yml create mode 100644 roles/rhscl-mariadb-apb-openshift/tasks/test.yml create mode 100644 roles/rhscl-mariadb-apb-openshift/templates/bc-galera.yaml.j2 create mode 100644 roles/rhscl-mariadb-apb-openshift/templates/bc-ha.yaml.j2 create mode 100644 roles/rhscl-mariadb-apb-openshift/templates/imagestream.yaml.j2 create mode 100644 roles/rhscl-mariadb-apb-openshift/templates/service.yaml.j2 create mode 100644 roles/rhscl-mariadb-apb-openshift/templates/statefulset.yaml.j2 diff --git a/Dockerfile-canary b/Dockerfile-canary index bc0fea0..78a6f5b 100644 --- a/Dockerfile-canary +++ b/Dockerfile-canary @@ -18,24 +18,32 @@ b24KICAgIGRlZmF1bHQ6ICIxM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CiAg\ +ICAgIGNvc3Q6ICQwLjAwCiAgICBwYXJhbWV0ZXJzOiAqX3BhcmFtcwogICAgdXBkYXRlc190bzog\ +W10KICAtIG5hbWU6IHByb2QKICAgIGRlc2NyaXB0aW9uOiBUaGlzIHBsYW4gZGVwbG95cyBhIHNp\ +bmdsZSBNYXJpYURCIGluc3RhbmNlIHdpdGggMTAgR2lCIG9mIHBlcnNpc3RlbnQgc3RvcmFnZQog\ +ICAgZnJlZTogdHJ1ZQogICAgbWV0YWRhdGE6CiAgICAgIGRpc3BsYXlOYW1lOiBQcm9kdWN0aW9u\ +CiAgICAgIGNvc3Q6ICQwLjAwCiAgICBwYXJhbWV0ZXJzOiAqX3BhcmFtcwogICAgdXBkYXRlc190\ +bzoKICAgICAgLSBkZXYK" diff --git a/Dockerfile-latest b/Dockerfile-latest index a190644..1d46039 100644 --- a/Dockerfile-latest +++ b/Dockerfile-latest @@ -18,24 +18,32 @@ b24KICAgIGRlZmF1bHQ6ICIxMC4yIgogICAgZW51bTogWycxMC4yJyAsICcxMC4xJywgJzEwLjAn\ XQogICAgdHlwZTogZW51bQogICAgdGl0bGU6IE1hcmlhREIgVmVyc2lvbgogICAgcmVxdWlyZWQ6\ IHRydWUKICAgIHVwZGF0YWJsZTogdHJ1ZQoKdmVyc2lvbjogMS4wCm5hbWU6IG1hcmlhZGItYXBi\ CmRlc2NyaXB0aW9uOiBNYXJpYWRiIGFwYiBpbXBsZW1lbnRhdGlvbgpiaW5kYWJsZTogdHJ1ZQph\ -c3luYzogb3B0aW9uYWwKdGFnczoKICAtIGRhdGFiYXNlCiAgLSBtYXJpYWRiCm1ldGFkYXRhOgog\ -IGRvY3VtZW50YXRpb25Vcmw6ICJodHRwczovL21hcmlhZGIuY29tL2tiL2VuL21hcmlhZGIvZG9j\ -dW1lbnRhdGlvbi8iCiAgbG9uZ0Rlc2NyaXB0aW9uOiAiRGVwbG95cyBhIGJpbmRhYmxlIG1hcmlh\ -ZGIgaW5zdGFuY2UiCiA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jZSB3aXRoIGVwaGVtZXJhbCBzdG9yYWdlCiAgICBmcmVlOiB0cnVlCiAgICBkZWZh\ +dWx0OiB0cnVlCiAgICBtZXRhZGF0YToKICAgICAgZGlzcGxheU5hbWU6IERldmVsb3BtZW50CiAg\ +ICAgIGNvc3Q6ICQwLjAwCiAgICBwYXJhbWV0ZXJzOiAqX3BhcmFtcwogICAgdXBkYXRlc190bzoK\ +ICAgICAgLSBwcm9kCiAgLSBuYW1lOiBoYQogICAgZGVzY3JpcHRpb246IFRoaXMgcGxhbiBkZXBs\ +b3lzIGFuIHVuc3VwcG9ydGVkIHRocmVlLW5vZGUgQ2VudE9TIE1hcmlhREIgR2FsZXJhIGluc3Rh\ +bmNlIHdpdGggcGVyc2lzdGVudCBzdG9yYWdlCiAgICBmcmVlOiB0cnVlCiAgICBkZWZhdWx0OiBm\ +YWxzZQogICAgbWV0YWRhdGE6CiAgICAgIGRpc3BsYXlOYW1lOiBIaWdoLUF2YWlsYWJsaXR5CiAg\ +ICAgIGNvc3Q6ICQwLjAwCiAgICBwYXJhbWV0ZXJzOiAqX3BhcmFtcwogICAgdXBkYXRlc190bzog\ +W10KICAtIG5hbWU6IHByb2QKICAgIGRlc2NyaXB0aW9uOiBUaGlzIHBsYW4gZGVwbG95cyBhIHNp\ +bmdsZSBNYXJpYURCIGluc3RhbmNlIHdpdGggMTAgR2lCIG9mIHBlcnNpc3RlbnQgc3RvcmFnZQog\ +ICAgZnJlZTogdHJ1ZQogICAgbWV0YWRhdGE6CiAgICAgIGRpc3BsYXlOYW1lOiBQcm9kdWN0aW9u\ +CiAgICAgIGNvc3Q6ICQwLjAwCiAgICBwYXJhbWV0ZXJzOiAqX3BhcmFtcwogICAgdXBkYXRlc190\ +bzoKICAgICAgLSBkZXYK" diff --git a/Dockerfile-nightly b/Dockerfile-nightly index 319360e..3a4b2ad 100644 --- a/Dockerfile-nightly +++ b/Dockerfile-nightly @@ -18,24 +18,32 @@ b24KICAgIGRlZmF1bHQ6ICIxM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CiAg\ +ICAgIGNvc3Q6ICQwLjAwCiAgICBwYXJhbWV0ZXJzOiAqX3BhcmFtcwogICAgdXBkYXRlc190bzog\ +W10KICAtIG5hbWU6IHByb2QKICAgIGRlc2NyaXB0aW9uOiBUaGlzIHBsYW4gZGVwbG95cyBhIHNp\ +bmdsZSBNYXJpYURCIGluc3RhbmNlIHdpdGggMTAgR2lCIG9mIHBlcnNpc3RlbnQgc3RvcmFnZQog\ +ICAgZnJlZTogdHJ1ZQogICAgbWV0YWRhdGE6CiAgICAgIGRpc3BsYXlOYW1lOiBQcm9kdWN0aW9u\ +CiAgICAgIGNvc3Q6ICQwLjAwCiAgICBwYXJhbWV0ZXJzOiAqX3BhcmFtcwogICAgdXBkYXRlc190\ +bzoKICAgICAgLSBkZXYK" diff --git a/apb.yml b/apb.yml index e156697..f79ae5c 100644 --- a/apb.yml +++ b/apb.yml @@ -40,6 +40,7 @@ async: optional tags: - database - mariadb + - galera metadata: documentationUrl: "https://mariadb.com/kb/en/mariadb/documentation/" longDescription: "Deploys a bindable mariadb instance" @@ -47,6 +48,9 @@ metadata: - 'registry.access.redhat.com/rhscl/mariadb-100-rhel7' - 'registry.access.redhat.com/rhscl/mariadb-101-rhel7' - 'registry.access.redhat.com/rhscl/mariadb-102-rhel7' + - 'registry.centos.org/centos/mariadb-100-centos7' + - 'registry.centos.org/centos/mariadb-101-centos7' + - 'registry.centos.org/centos/mariadb-102-centos7' displayName: "MariaDB (APB)" console.openshift.io/iconClass: icon-mariadb providerDisplayName: "Red Hat, Inc." @@ -61,6 +65,15 @@ plans: parameters: *_params updates_to: - prod + - name: ha + description: This plan deploys an unsupported three-node CentOS MariaDB Galera instance with persistent storage + free: true + default: false + metadata: + displayName: High-Availablity + cost: $0.00 + parameters: *_params + updates_to: [] - name: prod description: This plan deploys a single MariaDB instance with 10 GiB of persistent storage free: true diff --git a/playbooks/test.yml b/playbooks/test.yml new file mode 100644 index 0000000..0b72c9f --- /dev/null +++ b/playbooks/test.yml @@ -0,0 +1,18 @@ +--- +- name: "[MARIADB_APB][TEST] Test MariaDB APB" + hosts: localhost + gather_facts: False + connection: local + roles: + - role: ansible.kubernetes-modules + install_python_requirements: no + - role: ansibleplaybookbundle.asb-modules + + tasks: + - include_tasks: test_tasks.yml + vars: + plan: "{{ outer_item }}" + with_items: + - ha + loop_control: + loop_var: outer_item diff --git a/playbooks/test_tasks.yml b/playbooks/test_tasks.yml new file mode 100644 index 0000000..ee4a5c7 --- /dev/null +++ b/playbooks/test_tasks.yml @@ -0,0 +1,37 @@ +--- +- name: "Include variables per apb plan" + include_vars: + file: "vars/{{ plan }}.yml" + +- debug: + msg: "{{ hostvars[inventory_hostname] }}" + +- name: "[TEST][{{ _apb_plan_id }}] Create new project" + openshift_v1_project: + name: '{{ namespace }}' + state: 'present' + +- name: "[TEST][{{ _apb_plan_id }}]" + include_role: + name: rhscl-mariadb-apb-openshift + vars: + action: 'provision' + state: 'present' + +- name: "[TEST][{{ _apb_plan_id }}]" + include_role: + name: rhscl-mariadb-apb-openshift + vars: + action: 'test' + +- name: "[TEST][{{ _apb_plan_id }}]" + include_role: + name: rhscl-mariadb-apb-openshift + vars: + action: 'deprovision' + state: 'absent' + +- name: "[TEST][{{ _apb_plan_id }}] Delete test project" + openshift_v1_project: + name: '{{ namespace }}' + state: 'absent' diff --git a/playbooks/vars/dev.yml b/playbooks/vars/dev.yml new file mode 100644 index 0000000..2be83c5 --- /dev/null +++ b/playbooks/vars/dev.yml @@ -0,0 +1,10 @@ +--- +_apb_plan_id: "dev" +service_name: "rhscl-mariadb" +namespace: "test-{{ _apb_plan_id }}-{{ service_name }}" +mariadb_database: "userdb" +mariadb_user: "user" +volume_size: "1Gi" +mariadb_version: "10.2" +mariadb_root_password: "password123" +mariadb_password: "password123" diff --git a/playbooks/vars/ha.yml b/playbooks/vars/ha.yml new file mode 100644 index 0000000..205a020 --- /dev/null +++ b/playbooks/vars/ha.yml @@ -0,0 +1,10 @@ +--- +_apb_plan_id: "ha" +service_name: "rhscl-mariadb" +namespace: "test-{{ _apb_plan_id }}-{{ service_name }}" +mariadb_database: "userdb" +mariadb_user: "user" +volume_size: "1Gi" +mariadb_version: "10.2" +mariadb_root_password: "password123" +mariadb_password: "password123" diff --git a/playbooks/vars/prod.yml b/playbooks/vars/prod.yml new file mode 100644 index 0000000..67b0a16 --- /dev/null +++ b/playbooks/vars/prod.yml @@ -0,0 +1,10 @@ +--- +_apb_plan_id: "prod" +service_name: "rhscl-mariadb" +namespace: "test-{{ _apb_plan_id }}-{{ service_name }}" +mariadb_database: "userdb" +mariadb_user: "user" +volume_size: "1Gi" +mariadb_version: "10.2" +mariadb_root_password: "password123" +mariadb_password: "password123" diff --git a/roles/rhscl-mariadb-apb-openshift/defaults/main.yml b/roles/rhscl-mariadb-apb-openshift/defaults/main.yml index a53ad23..937b5c6 100644 --- a/roles/rhscl-mariadb-apb-openshift/defaults/main.yml +++ b/roles/rhscl-mariadb-apb-openshift/defaults/main.yml @@ -1,9 +1,35 @@ --- + service_name: "{{ lookup('env','SERVICE_NAME') | default('rhscl-mariadb', true) }}" namespace: "{{ lookup('env','NAMESPACE') | default('rhscl-mariadb-apb', true) }}" mariadb_database: "{{ lookup('env','MARIADB_DATABASE') | default('', true) }}" mariadb_user: "{{ lookup('env','MARIADB_USER') | default('admin', true) }}" volume_size: "{{ lookup('env','VOLUME_SIZE') | default('10Gi', true) }}" mariadb_version: "{{ lookup('env','MARIADB_VERSION') | default('10.0', true) }}" -image: "registry.access.redhat.com/rhscl/mariadb-{{ mariadb_version | replace('.', '') }}-rhel7" +mariadb_version_nodots: "{{ mariadb_version | replace('.', '') }}" + + +# http://jinja.pocoo.org/docs/2.10/templates/#whitespace-control +# https://stackoverflow.com/a/21699210 +image: >- + {% if _apb_plan_id == "ha" -%} + registry.centos.org/centos/mariadb-{{ mariadb_version_nodots }}-centos7 + {%- else %} + registry.access.redhat.com/rhscl/mariadb-{{ mariadb_version_nodots }}-rhel7 + {%- endif %} state: present + +# Variables below are for the testing of the mariadb service. + +test_create_table: 'CREATE TABLE IF NOT EXISTS example_timestamp (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,data VARCHAR(100),cur_timestamp TIMESTAMP(6));' +test_insert: 'INSERT INTO example_timestamp (data) VALUES ("The time of creation is:");' +test_select: 'SELECT * FROM example_timestamp;' +test_galera: + - 'SHOW GLOBAL STATUS LIKE "wsrep_local_state_comment";' + - 'SHOW GLOBAL STATUS LIKE "wsrep_connected";' + - 'SHOW GLOBAL STATUS LIKE "wsrep_ready";' + +test_galera_expected_results: + wsrep_connected: "ON" + wsrep_ready: "ON" + wsrep_local_state_comment: "Synced" diff --git a/roles/rhscl-mariadb-apb-openshift/tasks/ha.yml b/roles/rhscl-mariadb-apb-openshift/tasks/ha.yml new file mode 100644 index 0000000..3671fd6 --- /dev/null +++ b/roles/rhscl-mariadb-apb-openshift/tasks/ha.yml @@ -0,0 +1,73 @@ +--- +# This module fails if the import ImageStream exists +- name: Image Streams + openshift_v1_image_stream: + name: "{{ item.name }}" + namespace: "{{ namespace }}" + state: "{{ state }}" + spec_tags: "{{ item.tags | default(omit) }}" + ignore_errors: True + with_items: + - name: "{{ service_name }}-{{ mariadb_version_nodots }}-{{ _apb_plan_id }}" + - name: "{{ service_name }}-{{ mariadb_version_nodots }}-galera" + - name: "{{ image.split('/')[-1] }}" + tags: + - from: + kind: DockerImage + name: "{{ image }}" + name: latest + +# This module does not correctly implement `spec_cluster_ip` when setting +# to 'None' still creates a clusterIP. +- name: Template Service + template: + src: service.yaml.j2 + dest: /tmp/service.yaml + register: svc + +- name: Apply Service + command: "oc apply -n {{ namespace }} -f {{ svc.dest | default(svc.path) }}" + +- name: Template BuildConfigs + template: + src: "{{ item }}.j2" + dest: "/tmp/{{ item }}" + register: bc + with_items: + - "bc-ha.yaml" + - "bc-galera.yaml" + +- name: Create BuildConfigs + openshift_v1_build_config: + name: "{{ (lookup('file', item.dest|default(item.path)) | from_yaml).metadata['name'] }}" + namespace: "{{ namespace }}" + state: "{{ state }}" + src: "{{ item.dest | default(item.path) }}" + with_items: "{{ bc.results }}" + +- name: Template StatefulSet + template: + src: statefulset.yaml.j2 + dest: /tmp/statefulset.yaml + register: sfs + +# This module fails if the statefulset exists and state is present +- name: Create StatefulSet + k8s_v1beta1_stateful_set: + name: "{{ service_name }}-{{ mariadb_version_nodots }}-{{ _apb_plan_id }}" + namespace: "{{ namespace }}" + src: "{{ sfs.dest | default(sfs.path) }}" + state: "{{ state }}" + ignore_errors: True + + +- name: Wait for rollout of StatefulSet + k8s_v1beta1_stateful_set: + name: "{{ service_name }}-{{ mariadb_version_nodots }}-{{ _apb_plan_id }}" + namespace: "{{ namespace }}" + register: rollout + until: rollout['stateful_set']['status']['ready_replicas'] == rollout['stateful_set']['status']['replicas'] + delay: 30 + retries: 20 + when: state == 'present' + diff --git a/roles/rhscl-mariadb-apb-openshift/tasks/main.yml b/roles/rhscl-mariadb-apb-openshift/tasks/main.yml index ec0aea7..639f6eb 100644 --- a/roles/rhscl-mariadb-apb-openshift/tasks/main.yml +++ b/roles/rhscl-mariadb-apb-openshift/tasks/main.yml @@ -1,4 +1,6 @@ --- + + - block: - name: Find pod we need to update shell: oc get pods -n {{ namespace }} -l app=rhscl-mariadb-apb -o custom-columns=name:.metadata.name --no-headers @@ -13,7 +15,9 @@ - name: Copy over db backup shell: oc cp -n {{ namespace }} {{ oldpod.stdout }}:/tmp/db.dump /tmp/db.dump - when: update is defined + when: + - update is defined + - _apb_plan_id != "ha" - name: set {{ service_name }} service state to {{ state }} k8s_v1_service: @@ -32,12 +36,24 @@ protocol: TCP target_port: 3306 register: mariadb_service + when: + - _apb_plan_id != "ha" + - action != "test" - include_tasks: dev.yml - when: _apb_plan_id == "dev" + when: + - _apb_plan_id == "dev" + - action != "test" - include_tasks: prod.yml - when: _apb_plan_id == "prod" + when: + - _apb_plan_id == "prod" + - action != "test" + +- include_tasks: ha.yml + when: + - _apb_plan_id == "ha" + - action != "test" - block: - name: Wait for mariadb to come up @@ -76,7 +92,13 @@ - "10.1" - "10.2" when: _apb_plan_id == "dev" or item != mariadb_version - when: update is defined + when: + - update is defined + - _apb_plan_id != "ha" + +- name: "[MARIADB_APB][MAIN] Test mariadb deployment" + include_tasks: test.yml + when: action == "test" - name: encode bind credentials asb_encode_binding: @@ -87,4 +109,6 @@ DB_USER: "{{ mariadb_user }}" DB_PASSWORD: "{{ mariadb_password }}" DB_NAME: "{{ mariadb_database }}" - when: state == "present" + when: + - state == "present" + - action != "test" diff --git a/roles/rhscl-mariadb-apb-openshift/tasks/test.yml b/roles/rhscl-mariadb-apb-openshift/tasks/test.yml new file mode 100644 index 0000000..bf1b9c4 --- /dev/null +++ b/roles/rhscl-mariadb-apb-openshift/tasks/test.yml @@ -0,0 +1,73 @@ +--- +- name: Get Pods + command: "oc -o json -n {{ namespace }} get pod -l app=rhscl-mariadb-apb" + register: pods + +- name: Get Service + command: "oc -o json -n {{ namespace }} get svc {{ service_name }}" + register: svc + +- set_fact: + svcobj: "{{ svc.stdout | from_json }}" + +- set_fact: + mysql_host: "{{ svcobj['spec']['clusterIP'] | default(service_name) }}" + +- set_fact: + podobj: "{{ pods.stdout | from_json }}" + +# Create table using service +- name: Create Database Tables + command: > + oc -n {{ namespace }} exec -i {{ podobj['items'][0]['metadata']['name'] }} -- + /opt/rh/rh-mariadb{{ mariadb_version_nodots }}/root/usr/bin/mysql + -h {{ service_name }} + -u {{ mariadb_user }} + -D {{ mariadb_database }} + -p'{{ mariadb_password }}' + -e '{{ test_create_table }}' + +# Create data using the pod name +- name: Create Data + command: > + oc -n {{ namespace }} exec -i {{ item['metadata']['name'] }} -- + /opt/rh/rh-mariadb{{ mariadb_version_nodots }}/root/usr/bin/mysql -h {{ item['metadata']['name'] }} + -u {{ mariadb_user }} + -D {{ mariadb_database }} + -p'{{ mariadb_password }}' + -e '{{ test_insert }}' + with_items: "{{ podobj['items'] }}" + +- name: Select Data + command: > + oc -n {{ namespace }} exec -i {{ item['metadata']['name'] }} -- + /opt/rh/rh-mariadb{{ mariadb_version_nodots }}/root/usr/bin/mysql -h {{ item['metadata']['name'] }} + -u {{ mariadb_user }} + -D {{ mariadb_database }} + -p'{{ mariadb_password }}' + -e '{{ test_select }}' + with_items: "{{ podobj['items'] }}" + +- name: Confirm Galera Operation + command: > + oc -n {{ namespace }} exec -i {{ item[0]['metadata']['name'] }} -- + /opt/rh/rh-mariadb{{ mariadb_version_nodots }}/root/usr/bin/mysql -h {{ item[0]['metadata']['name'] }} + -u root + -p'{{ mariadb_root_password }}' + -s + -N + -e '{{ item[1] }}' + with_nested: + - "{{ podobj['items'] }}" + - "{{ test_galera }}" + register: wsrep + when: _apb_plan_id == "ha" + +- name: Check Expected Results + fail: + msg: "Galera Error" + when: + - "item.stdout.split('\t')[1] != test_galera_expected_results[item.stdout.split('\t')[0]]" + - _apb_plan_id == "ha" + with_items: "{{ wsrep.results }}" + diff --git a/roles/rhscl-mariadb-apb-openshift/templates/bc-galera.yaml.j2 b/roles/rhscl-mariadb-apb-openshift/templates/bc-galera.yaml.j2 new file mode 100644 index 0000000..b16f274 --- /dev/null +++ b/roles/rhscl-mariadb-apb-openshift/templates/bc-galera.yaml.j2 @@ -0,0 +1,35 @@ +--- +apiVersion: v1 +kind: BuildConfig +metadata: + name: "{{ service_name }}-{{ mariadb_version }}-galera" +spec: + output: + to: + kind: ImageStreamTag + name: "{{ service_name }}-{{ mariadb_version_nodots }}-galera:latest" + source: + dockerfile: | + FROM {{ image }} + USER root + + # Leaving here to figure out if I want to template this... + # REPOLIST=rhel-7-server-rpms,rhel-7-server-optional-rpms,rhel-server-rhscl-7-rpms,rhel-7-server-extras-rpms + # yum -y install --disablerepo "*" --enablerepo ${REPOLIST} --setopt=tsflags=nodocs $INSTALL_PKGS && \ + RUN INSTALL_PKGS="rh-mariadb{{ mariadb_version_nodots }}-galera which MySQL-python" && \ + yum -y install --setopt=tsflags=nodocs $INSTALL_PKGS && \ + rpm -V $INSTALL_PKGS && \ + yum clean all + USER 27 + EXPOSE 4567 4568 4444 + type: Dockerfile + strategy: + dockerStrategy: + from: + kind: ImageStreamTag + name: "{{ image.split('/')[-1] }}:latest" + type: Docker + triggers: + - imageChange: {} + type: ImageChange + diff --git a/roles/rhscl-mariadb-apb-openshift/templates/bc-ha.yaml.j2 b/roles/rhscl-mariadb-apb-openshift/templates/bc-ha.yaml.j2 new file mode 100644 index 0000000..4eac81e --- /dev/null +++ b/roles/rhscl-mariadb-apb-openshift/templates/bc-ha.yaml.j2 @@ -0,0 +1,25 @@ +--- +apiVersion: v1 +kind: BuildConfig +metadata: + name: "{{ service_name }}-{{ mariadb_version }}-{{ _apb_plan_id }}" +spec: + output: + to: + kind: ImageStreamTag + name: "{{ service_name }}-{{ mariadb_version_nodots }}-{{ _apb_plan_id }}:latest" + source: + contextDir: image-configuration + git: + uri: https://github.com/jcpowermac/mariadb-ha-poc + ref: rhel + type: Git + strategy: + sourceStrategy: + from: + kind: ImageStreamTag + name: "{{ service_name }}-{{ mariadb_version_nodots }}-galera:latest" + type: Source + triggers: + - imageChange: {} + type: ImageChange diff --git a/roles/rhscl-mariadb-apb-openshift/templates/imagestream.yaml.j2 b/roles/rhscl-mariadb-apb-openshift/templates/imagestream.yaml.j2 new file mode 100644 index 0000000..01803c8 --- /dev/null +++ b/roles/rhscl-mariadb-apb-openshift/templates/imagestream.yaml.j2 @@ -0,0 +1,23 @@ +--- +apiVersion: v1 +kind: ImageStream +metadata: + name: "{{ service_name }}-{{ mariadb_version_nodots }}-{{ _apb_plan_id }}" + +--- +apiVersion: v1 +kind: ImageStream +metadata: + name: "{{ service_name }}-{{ mariadb_version_nodots }}-galera" + +--- +apiVersion: v1 +kind: ImageStream +metadata: + name: "{{ image.split('/')[-1] }}" +spec: + tags: + - from: + kind: DockerImage + name: "{{ image }}" + name: latest diff --git a/roles/rhscl-mariadb-apb-openshift/templates/service.yaml.j2 b/roles/rhscl-mariadb-apb-openshift/templates/service.yaml.j2 new file mode 100644 index 0000000..1e122da --- /dev/null +++ b/roles/rhscl-mariadb-apb-openshift/templates/service.yaml.j2 @@ -0,0 +1,18 @@ +--- +apiVersion: v1 +kind: Service +metadata: + annotations: + service.alpha.kubernetes.io/tolerate-unready-endpoints: "true" + name: "{{ service_name }}" + labels: + app: "{{ service_name }}-apb" +spec: + ports: + - port: 3306 + name: "{{ service_name }}" + clusterIP: None + selector: + app: "{{ service_name }}-apb" + service: "{{ service_name }}-{{ mariadb_version }}-{{ _apb_plan_id }}" + diff --git a/roles/rhscl-mariadb-apb-openshift/templates/statefulset.yaml.j2 b/roles/rhscl-mariadb-apb-openshift/templates/statefulset.yaml.j2 new file mode 100644 index 0000000..97142f7 --- /dev/null +++ b/roles/rhscl-mariadb-apb-openshift/templates/statefulset.yaml.j2 @@ -0,0 +1,85 @@ +--- +apiVersion: apps/v1beta1 +kind: StatefulSet +metadata: + name: "{{ service_name }}-{{ mariadb_version_nodots }}-{{ _apb_plan_id }}" + annotations: + image.openshift.io/triggers: | + [{ + "from": { + "kind": "ImageStreamTag", + "name": "{{ service_name }}-{{ mariadb_version_nodots }}-{{ _apb_plan_id }}:latest" + }, + "fieldPath": "spec.template.spec.containers[?(@.name==\"{{ service_name }}-{{ mariadb_version_nodots }}-{{ _apb_plan_id }}\")].image" + }] +spec: + serviceName: "{{ service_name }}" + replicas: "3" + template: + metadata: + labels: + app: rhscl-mariadb-apb + service: "{{ service_name }}-{{ mariadb_version }}-{{ _apb_plan_id }}" + annotations: + pod.alpha.kubernetes.io/initialized: "true" + spec: + containers: + - name: "{{ service_name }}-{{ mariadb_version_nodots }}-{{ _apb_plan_id }}" + image: " " + imagePullPolicy: Always + ports: + - containerPort: 3306 + name: mysql + - containerPort: 4444 + name: sst + - containerPort: 4567 + name: replication + - containerPort: 4568 + name: ist + livenessProbe: + tcpSocket: + port: 3306 + initialDelaySeconds: 120 + periodSeconds: 60 + timeoutSeconds: 1 + readinessProbe: + exec: + command: + - "/bin/sh" + - "-i" + - "-c" + - "MYSQL_PWD=\"$MYSQL_PASSWORD\" mysql -h 127.0.0.1 -u $MYSQL_USER -D $MYSQL_DATABASE -e 'SELECT 1'" + initialDelaySeconds: 15 + timeoutSeconds: 5 + env: + - name: POD_NAMESPACE + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.namespace + - name: MYSQL_ROOT_PASSWORD + value: '{{ mariadb_root_password }}' + - name: MYSQL_USER + value: '{{ mariadb_user }}' + - name: MYSQL_PASSWORD + value: '{{ mariadb_password }}' + - name: MYSQL_DATABASE + value: '{{ mariadb_database }}' + volumeMounts: + - name: mariadb-data + mountPath: /var/lib/mysql + - name: mariadb-config + mountPath: /etc/my.cnf.d + volumes: + - name: mariadb-config + emptyDir: {} + volumeClaimTemplates: + - metadata: + name: mariadb-data + annotations: + volume.alpha.kubernetes.io/storage-class: anything + spec: + accessModes: ["ReadWriteOnce"] + resources: + requests: + storage: {{ volume_size }}