Skip to content

Commit

Permalink
✨(edxapp) add ImageStream and BuildConfig
Browse files Browse the repository at this point in the history
We now use custom image build for edxapp using ImageStream and
BuildConfig objects.
  • Loading branch information
jmaupetit committed Sep 4, 2018
1 parent 38d07de commit 103408f
Show file tree
Hide file tree
Showing 10 changed files with 110 additions and 6 deletions.
4 changes: 3 additions & 1 deletion apps/edxapp/templates/cms/_dc_base.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ spec:
value: {{ service_variant }}
- name: DJANGO_SETTINGS_MODULE
value: {{ service_variant }}.envs.fun.docker_run
image: "{{ edxapp_image_name }}:{{ edxapp_image_tag }}"
# We point to a local registry image build for this "live" image (see
# ImageStream and BuildConfig templates)
image: "{{ internal_docker_registry }}/{{ project_name }}/edxapp-{{ service_variant }}:{{ edxapp_image_tag }}-live"
imagePullPolicy: IfNotPresent
volumeMounts:
- mountPath: /config
Expand Down
38 changes: 38 additions & 0 deletions apps/edxapp/templates/cms/bc.yml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
apiVersion: "v1"
kind: "BuildConfig"
metadata:
# FIXME
#
# As mentionned in the official documentation [1]:
#
# Configuration change triggers currently only work when creating a new
# BuildConfig. In a future release, configuration change triggers will also
# be able to launch a build whenever a BuildConfig is updated.
#
# Hence, we must force BuildConfig to always get created with a unique name.
# This is a temporary solution that needs to be improved as soon as OKD
# triggers a new build upon BC object update.
#
# References:
#
# 1. https://docs.okd.io/latest/dev_guide/builds/triggering_builds.html#config-change-triggers
name: "edxapp-cms-{{ deployment_stamp }}"
namespace: "{{ project_name }}"
labels:
app: "edxapp"
service: "cms"
version: "{{ edxapp_image_tag }}"
deployment_stamp: "{{ deployment_stamp }}"
spec:
strategy:
type: Docker
source:
dockerfile: |-
FROM {{ edxapp_image_name }}:{{ edxapp_image_tag }}
# Add new statements here
triggers:
- type: "ConfigChange"
output:
to:
kind: "ImageStreamTag"
name: "edxapp-cms:{{ edxapp_image_tag }}-live"
8 changes: 8 additions & 0 deletions apps/edxapp/templates/cms/is.yml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: "v1"
kind: "ImageStream"
metadata:
name: "edxapp-cms"
namespace: "{{ project_name }}"
labels:
app: "edxapp"
service: "cms"
4 changes: 3 additions & 1 deletion apps/edxapp/templates/cms/job_01_collectstatic.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ spec:
spec:
containers:
- name: edxapp-cms-collectstatic-{{ job_stamp }}
image: "{{ edxapp_image_name }}:{{ edxapp_image_tag }}"
# We point to a local registry image build for this "live" image (see
# ImageStream and BuildConfig templates)
image: "{{ internal_docker_registry }}/{{ project_name }}/edxapp-cms:{{ edxapp_image_tag }}-live"
env:
- name: DJANGO_SETTINGS_MODULE
value: cms.envs.fun.docker_run
Expand Down
4 changes: 3 additions & 1 deletion apps/edxapp/templates/cms/job_04_db_migrate.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ spec:
spec:
containers:
- name: edxapp-cms-dbmigrate-{{ job_stamp }}
image: "{{ edxapp_image_name }}:{{ edxapp_image_tag }}"
# We point to a local registry image build for this "live" image (see
# ImageStream and BuildConfig templates)
image: "{{ internal_docker_registry }}/{{ project_name }}/edxapp-cms:{{ edxapp_image_tag }}-live"
env:
- name: DJANGO_SETTINGS_MODULE
value: cms.envs.fun.docker_run
Expand Down
4 changes: 3 additions & 1 deletion apps/edxapp/templates/cms/job_05_load_fixtures.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ spec:
spec:
containers:
- name: edxapp-cms-load-fixtures-{{ job_stamp }}
image: "{{ edxapp_image_name }}:{{ edxapp_image_tag }}"
# We point to a local registry image build for this "live" image (see
# ImageStream and BuildConfig templates)
image: "{{ internal_docker_registry }}/{{ project_name }}/edxapp-cms:{{ edxapp_image_tag }}-live"
env:
- name: DJANGO_SETTINGS_MODULE
value: cms.envs.fun.docker_run
Expand Down
38 changes: 38 additions & 0 deletions apps/edxapp/templates/lms/bc.yml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
apiVersion: "v1"
kind: "BuildConfig"
metadata:
# FIXME
#
# As mentionned in the official documentation [1]:
#
# Configuration change triggers currently only work when creating a new
# BuildConfig. In a future release, configuration change triggers will also
# be able to launch a build whenever a BuildConfig is updated.
#
# Hence, we must force BuildConfig to always get created with a unique name.
# This is a temporary solution that needs to be improved as soon as OKD
# triggers a new build upon BC object update.
#
# References:
#
# 1. https://docs.okd.io/latest/dev_guide/builds/triggering_builds.html#config-change-triggers
name: "edxapp-lms-{{ deployment_stamp }}"
namespace: "{{ project_name }}"
labels:
app: "edxapp"
service: "lms"
version: "{{ edxapp_image_tag }}"
deployment_stamp: "{{ deployment_stamp }}"
spec:
strategy:
type: Docker
source:
dockerfile: |-
FROM {{ edxapp_image_name }}:{{ edxapp_image_tag }}
# Add new statements here
triggers:
- type: "ConfigChange"
output:
to:
kind: "ImageStreamTag"
name: "edxapp-lms:{{ edxapp_image_tag }}-live"
8 changes: 8 additions & 0 deletions apps/edxapp/templates/lms/is.yml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: "v1"
kind: "ImageStream"
metadata:
name: "edxapp-lms"
namespace: "{{ project_name }}"
labels:
app: "edxapp"
service: "lms"
4 changes: 3 additions & 1 deletion apps/edxapp/templates/lms/job_02_collectstatic.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ spec:
spec:
containers:
- name: edxapp-lms-collectstatic-{{ job_stamp }}
image: "{{ edxapp_image_name }}:{{ edxapp_image_tag }}"
# We point to a local registry image build for this "live" image (see
# ImageStream and BuildConfig templates)
image: "{{ internal_docker_registry }}/{{ project_name }}/edxapp-lms:{{ edxapp_image_tag }}-live"
env:
- name: DJANGO_SETTINGS_MODULE
value: lms.envs.fun.docker_run
Expand Down
4 changes: 3 additions & 1 deletion apps/edxapp/templates/lms/job_03_db_migrate.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ spec:
spec:
containers:
- name: edxapp-lms-dbmigrate-{{ job_stamp }}
image: "{{ edxapp_image_name }}:{{ edxapp_image_tag }}"
# We point to a local registry image build for this "live" image (see
# ImageStream and BuildConfig templates)
image: "{{ internal_docker_registry }}/{{ project_name }}/edxapp-lms:{{ edxapp_image_tag }}-live"
env:
- name: DJANGO_SETTINGS_MODULE
value: lms.envs.fun.docker_run
Expand Down

0 comments on commit 103408f

Please sign in to comment.