Skip to content

Commit

Permalink
✨(build) add support for BCs + ISs objects
Browse files Browse the repository at this point in the history
Until now, BuildConfiguration and ImageStream objects were not required.
Now that we need to add APM and customize images on a per-client basis,
using the aforementionned objects seems the more relevant solution.
  • Loading branch information
jmaupetit committed Sep 3, 2018
1 parent c52ed36 commit 6a339dd
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 2 deletions.
3 changes: 3 additions & 0 deletions group_vars/all/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ job_stamp: null
# docs/developer_guide/secrets.md
secret_id: "1.0.0"

# OpenShift's internal docker registry server
internal_docker_registry: "docker-registry.default.svc:5000"

# TODO: move the following settings to the redirect app
# Ports
aliases_port: 8999
Expand Down
6 changes: 6 additions & 0 deletions group_vars/env_type/development.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Variables specific to development environments
domain_name: "{{ lookup('env', 'OPENSHIFT_DOMAIN') }}.nip.io"

# OpenShift's internal docker registry server
#
# FIXME: use docker registry server IP address instead of the service name (i.e.
# docker-registry.default.svc) to prevent oc cluster DNS issues
internal_docker_registry: "172.30.1.1:5000"

# Use development images in the development environment
edxapp_image_tag: "hawthorn.1-1.0.0-dev"
richie_image_tag: "0.1.0-alpha.3-alpine-dev"
Expand Down
2 changes: 2 additions & 0 deletions init_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
- create_app_volumes
- create_app_endpoints
- create_static_services_routes
- create_app_image_streams
tags:
- volume
- endpoint
- route
- stream
14 changes: 14 additions & 0 deletions tasks/create_app_image_streams.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
# Create volumes for an app

- name: Print app name
debug: msg="App name {{ app.name }}"
tags: stream

- name: Make sure image streams exist
openshift_raw:
definition: "{{ lookup('template', item) | from_yaml }}"
state: present
with_items: "{{ streams }}"
when: streams is defined
tags: stream
21 changes: 20 additions & 1 deletion tasks/get_objects_for_app.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
---
# Get objects for an application

- name: Set templates list for this app
Expand All @@ -8,17 +7,29 @@

- name: Set OpenShift objects to manage
set_fact:
builds: "{{ templates | map('regex_search', '.*/bc.*\\.yml\\.j2$') | select('string') | list }}"
deployments: "{{ templates | map('regex_search', '.*/dc.*\\.yml\\.j2$') | select('string') | list }}"
services: "{{ templates | map('regex_search', '.*/svc\\.yml\\.j2$') | select('string') | list }}"
streams: "{{ templates | map('regex_search', '.*/is.*\\.yml\\.j2$') | select('string') | list }}"
jobs: "{{ templates | map('regex_search', '.*/job_.*\\.yml\\.j2$') | select('string') | list }}"
routes: "{{ templates | map('regex_search', '.*/route.*\\.yml\\.j2$') | select('string') | list }}"
tags:
- deploy
- build
- deployment
- service
- stream
- job
- route

- name: Display OpenShift's builds for this app
debug:
msg: "{{ builds | to_nice_yaml}}"
when: builds
tags:
- deploy
- build

- name: Display OpenShift's deployments for this app
debug:
msg: "{{ deployments | to_nice_yaml}}"
Expand All @@ -35,6 +46,14 @@
- deploy
- service

- name: Display OpenShift's image streams for this app
debug:
msg: "{{ streams | to_nice_yaml }}"
when: streams
tags:
- deploy
- stream

- name: Display OpenShift's jobs for this app
debug:
msg: "{{ jobs | to_nice_yaml }}"
Expand Down
3 changes: 2 additions & 1 deletion tasks/manage_app.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
---
# Task set to manage apps
#
# Args:
Expand All @@ -12,10 +11,12 @@
definition: "{{ lookup('template', item) | from_yaml }}"
state: "{{ deployment_state | default('present') }}"
with_items:
- "{{ builds }}"
- "{{ deployments }}"
- "{{ services }}"
tags:
- deploy
- build
- deployment
- service

Expand Down

0 comments on commit 6a339dd

Please sign in to comment.