-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨(playbook) introduce static services
Add support for static services, with fixed name, in addition to the services deployed with a deployment stamp in their name. It allows applications inside the cluster to use the services exposed by other applications, with a consistent fqdn. BREAKING CHANGE : blue/green related tasks are now updating static services instead of routes
- Loading branch information
Showing
38 changed files
with
515 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
# Upgrade | ||
|
||
All instructions to upgrade this project from one release to the next will be | ||
documented in this file. Upgrades must be run sequentially, meaning you should | ||
not skip minor/major releases while upgrading (fix releases can be skipped). | ||
|
||
The format is inspired from [Keep a | ||
Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to | ||
[Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
||
|
||
## Unreleased | ||
|
||
### Static services | ||
|
||
This version introduces `Static services` and it is a breaking change in the | ||
blue/green deployment process. The `switch` playbook is patching static services | ||
instead of routes. And the `deployment_stamp` of the deployed stacks is no | ||
longer stored in routes, but in static services instead. | ||
|
||
In order to migrate to this new system, you have to apply the following upgrade | ||
process. This will not cause any downtime, but it implies a redeployment of your | ||
applications. | ||
|
||
#### Upgrade Procedure | ||
|
||
This procedure must be applied for every arnold application deployed. | ||
|
||
The `current` stack of your application (before applying this procedure) will be | ||
referenced as `BEFORE-UPGRADE-VERSION`. | ||
|
||
|
||
##### 1. Upgrade your arnold version | ||
|
||
##### 2. Execute the `create_services` ansible playbook : | ||
|
||
``` | ||
bin/ansible-playbook create_services.yml -e "apps_filter=your-application" | ||
``` | ||
It will create the static services required by your application. Each variant of these static services (`previous`, `current`, `next`) willtarget nothing after this step. | ||
|
||
##### 3. Execute the `deploy` ansible playbook : | ||
|
||
``` | ||
bin/deploy -e "apps_filter=your-application" | ||
``` | ||
|
||
It will deploy your application and the `next` static services will target this | ||
stack. | ||
|
||
This step does not affect routes. So your `BEFORE-UPGRADE-VERSION` stays | ||
unchanged and available via the `current` route. On the other hand, the `next` | ||
stack you just deployed will not be reachable by any route. | ||
|
||
##### 4. Execute the `switch` ansible playbook : | ||
|
||
``` | ||
bin/switch -e "apps_filter=your-application" | ||
``` | ||
|
||
The switch will be done at a the static services level. So, the stack you just | ||
deployed will be considered as the `current` by static services and by the | ||
ansible playbooks. | ||
|
||
But again, this step does not affect routes. So your `BEFORE-UPGRADE-VERSION` | ||
stack stays unchanged and available via the `current` route. | ||
|
||
##### 5. Execute the `create_routes` playbook : | ||
|
||
``` | ||
bin/ansible-playbook create_routes.yml -e "apps_filter=your-application" | ||
``` | ||
|
||
This will patch the routes to target the corresponding static services. After | ||
this step, your `BEFORE-UPGRADE-VERSION` will be unavailable and will be | ||
replaced by the `current` stack you just deployed. | ||
|
||
|
||
##### 6. Check and clean | ||
|
||
Check that everything is OK and execute the `clean` playbook to remove | ||
unreferenced stacks : | ||
|
||
``` | ||
bin/clean -e "apps_filter=your-application" | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
labels: | ||
app: edxapp | ||
service: nginx | ||
deployment_stamp: "{{ deployment_stamp }}" | ||
service_prefix: "{{ prefix }}" | ||
type: static-service | ||
removable: "no" | ||
name: "edxapp-nginx-{{ prefix }}" | ||
namespace: "{{ project_name }}" | ||
spec: | ||
ports: | ||
- name: "{{ edxapp_nginx_cms_port }}-tcp" | ||
port: {{ edxapp_nginx_cms_port }} | ||
protocol: TCP | ||
targetPort: {{ edxapp_nginx_cms_port }} | ||
- name: "{{ edxapp_nginx_lms_port }}-tcp" | ||
port: {{ edxapp_nginx_lms_port }} | ||
protocol: TCP | ||
targetPort: {{ edxapp_nginx_lms_port }} | ||
- name: "{{ edxapp_nginx_healthcheck_port }}-tcp" | ||
port: {{ edxapp_nginx_healthcheck_port }} | ||
protocol: TCP | ||
targetPort: {{ edxapp_nginx_healthcheck_port }} | ||
selector: | ||
app: edxapp | ||
deploymentconfig: "edxapp-nginx-{{ deployment_stamp | default('undefined', true) }}" | ||
type: ClusterIP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
labels: | ||
app: edxec | ||
service: nginx | ||
deployment_stamp: "{{ deployment_stamp }}" | ||
service_prefix: "{{ prefix }}" | ||
type: static-service | ||
removable: "no" | ||
name: "edxec-nginx-{{ prefix }}" | ||
namespace: "{{ project_name }}" | ||
spec: | ||
ports: | ||
- name: {{ edxec_nginx_port }}-tcp | ||
port: {{ edxec_nginx_port }} | ||
protocol: TCP | ||
targetPort: {{ edxec_nginx_port }} | ||
- name: "{{ edxec_nginx_healthcheck_port }}-tcp" | ||
port: {{ edxec_nginx_healthcheck_port }} | ||
protocol: TCP | ||
targetPort: {{ edxec_nginx_healthcheck_port }} | ||
selector: | ||
app: edxec | ||
deploymentconfig: "edxec-nginx-{{ deployment_stamp | default('undefined', true) }}" | ||
type: ClusterIP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
labels: | ||
app: forum | ||
service: forum | ||
deployment_stamp: "{{ deployment_stamp }}" | ||
service_prefix: "{{ prefix }}" | ||
type: static-service | ||
removable: "no" | ||
name: "forum-app-{{ prefix }}" | ||
namespace: "{{ project_name }}" | ||
spec: | ||
ports: | ||
- name: "{{ forum_port }}-tcp" | ||
port: {{ forum_port }} | ||
protocol: TCP | ||
targetPort: {{ forum_port }} | ||
selector: | ||
app: forum | ||
deploymentconfig: "forum-app-{{ deployment_stamp | default('undefined', true) }}" | ||
type: ClusterIP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
labels: | ||
app: hello | ||
deployment_stamp: "{{ deployment_stamp }}" | ||
service_prefix: "{{ prefix }}" | ||
type: static-service | ||
removable: "no" | ||
name: "hello-app-{{ prefix }}" | ||
namespace: "{{ project_name }}" | ||
spec: | ||
ports: | ||
- name: {{ hello_app_port }}-tcp | ||
port: {{ hello_app_port }} | ||
protocol: TCP | ||
targetPort: {{ hello_app_port }} | ||
type: ClusterIP | ||
selector: | ||
deploymentconfig: "hello-app-{{ deployment_stamp | default('undefined', true) }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
apps/learninglocker/templates/services/nginx/static-svc.yml.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
labels: | ||
app: learninglocker | ||
service: nginx | ||
deployment_stamp: "{{ deployment_stamp }}" | ||
service_prefix: "{{ prefix }}" | ||
type: static-service | ||
removable: "no" | ||
name: "learninglocker-nginx-{{ prefix }}" | ||
namespace: "{{ project_name }}" | ||
spec: | ||
ports: | ||
- name: "{{ learninglocker_nginx_port }}-tcp" | ||
port: {{ learninglocker_nginx_port }} | ||
protocol: TCP | ||
targetPort: {{ learninglocker_nginx_port }} | ||
- name: "{{ learninglocker_nginx_healthcheck_port }}-tcp" | ||
port: {{ learninglocker_nginx_healthcheck_port }} | ||
protocol: TCP | ||
targetPort: {{ learninglocker_nginx_healthcheck_port }} | ||
selector: | ||
app: learninglocker | ||
deploymentconfig: "learninglocker-nginx-{{ deployment_stamp | default('undefined', true) }}" | ||
type: ClusterIP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
labels: | ||
app: marsha | ||
service: nginx | ||
deployment_stamp: "{{ deployment_stamp }}" | ||
service_prefix: "{{ prefix }}" | ||
type: static-service | ||
removable: "no" | ||
name: "marsha-nginx-{{ prefix }}" | ||
namespace: "{{ project_name }}" | ||
spec: | ||
ports: | ||
- name: {{ marsha_nginx_port }}-tcp | ||
port: {{ marsha_nginx_port }} | ||
protocol: TCP | ||
targetPort: {{ marsha_nginx_port }} | ||
- name: "{{ marsha_nginx_healthcheck_port }}-tcp" | ||
port: {{ marsha_nginx_healthcheck_port }} | ||
protocol: TCP | ||
targetPort: {{ marsha_nginx_healthcheck_port }} | ||
selector: | ||
app: marsha | ||
deploymentconfig: "marsha-nginx-{{ deployment_stamp | default('undefined', true) }}" | ||
type: ClusterIP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
labels: | ||
app: richie | ||
service: nginx | ||
service_prefix: "{{ prefix }}" | ||
deployment_stamp: "{{ deployment_stamp }}" | ||
type: static-service | ||
removable: "no" | ||
name: "richie-nginx-{{ prefix }}" | ||
namespace: "{{ project_name }}" | ||
spec: | ||
ports: | ||
- name: {{ richie_nginx_port }}-tcp | ||
port: {{ richie_nginx_port }} | ||
protocol: TCP | ||
targetPort: {{ richie_nginx_port }} | ||
- name: "{{ richie_nginx_healthcheck_port }}-tcp" | ||
port: {{ richie_nginx_healthcheck_port }} | ||
protocol: TCP | ||
targetPort: {{ richie_nginx_healthcheck_port }} | ||
type: ClusterIP | ||
selector: | ||
app: richie | ||
deploymentconfig: "richie-nginx-{{ deployment_stamp | default('undefined', true) }}" |
Oops, something went wrong.