Skip to content

Commit

Permalink
fix: Merge the k8s_generator_site role with k8s_snowdrop_site as they…
Browse files Browse the repository at this point in the history
… use the same certificate managed by letsencrypt and secrets
  • Loading branch information
cmoulliard committed Jan 9, 2020
1 parent b628503 commit 512617b
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 96 deletions.
1 change: 0 additions & 1 deletion ansible/playbook/post_installation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
- { role: 'k8s_service_broker', tags: 'k8s_service_broker'}
- { role: 'k8s_halkyon_site', tags: 'k8s_halkyon_site'}
- { role: 'k8s_snowdrop_site', tags: 'k8s_snowdrop_site'}
- { role: 'k8s_generator_site', tags: 'k8s_generator_site'}
- { role: 'k8s_issuer_certificate', tags: 'k8s_issuer_certificate'}
- { role: 'kind', tags: 'kind'}
- { role: 'ingress', tags: 'ingress'}
Expand Down
7 changes: 0 additions & 7 deletions ansible/playbook/roles/k8s_generator_site/defaults/main.yml

This file was deleted.

43 changes: 0 additions & 43 deletions ansible/playbook/roles/k8s_generator_site/tasks/install.yml

This file was deleted.

13 changes: 0 additions & 13 deletions ansible/playbook/roles/k8s_generator_site/tasks/main.yml

This file was deleted.

13 changes: 0 additions & 13 deletions ansible/playbook/roles/k8s_generator_site/tasks/remove.yml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,3 @@
- name: Deploy the Godaddy secrets, Issuers resources containing the API Token
shell: |
{{ client_tool }} {{ k8s_config }} apply -f {{ tempPath }}
- name: Copy the snowdrop.me or .dev secrets to the generator-site namespace
shell: |
{{ client_tool }} get secret {{ item }} -n snowdrop-site -o json | jq 'del(.items[].metadata.namespace)' | {{ client_tool }} apply --force -n generator-site -f -
with_items:
- www-snowdrop-dev-tls
- www-snowdrop-me-tls
6 changes: 5 additions & 1 deletion ansible/playbook/roles/k8s_snowdrop_site/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
remove: false
isOpenshift: false

snowdrop_namespace: "snowdrop-site"
snowdrop_namespace: snowdrop-site

generator_version: 0.3.14
generator_name: spring-boot-generator
generator_configmap_name: spring-boot-generator
26 changes: 26 additions & 0 deletions ansible/playbook/roles/k8s_snowdrop_site/tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,32 @@
command: "{{ client_tool }} {{ k8s_config }} create namespace {{ snowdrop_namespace }}"
ignore_errors: true

- name: Fetch Generator yml file using URL and version defined
get_url:
url: "https://raw.githubusercontent.com/snowdrop/generator/v{{ generator_version}}/conf/generator.yaml"
dest: /tmp/generator.yaml

- name: Fetch the Deployment yml file using the URL and version defined
get_url:
url: "https://raw.githubusercontent.com/snowdrop/generator/v{{ generator_version}}/config/k8s/01_deployment.yml"
force: yes
dest: /tmp/deployment.yml

- name: Change the image version to use the one specified
replace:
path: "/tmp/deployment.yml"
regexp: "latest"
replace: "{{ generator_version }}"

- name: Create the Generator configmap using the downloaded file
command: "{{ client_tool }} {{ k8s_config }} create configmap {{ generator_configmap_name }} --from-file /tmp/generator.yaml -n {{ generator_namespace }}"

- name: Deploy the Code Generator application
shell: |
{{ client_tool }} {{ k8s_config }} -n {{ snowdrop_namespace }} apply -f /tmp/deployment.yml
{{ client_tool }} {{ k8s_config }} -n {{ snowdrop_namespace }} apply -f https://raw.githubusercontent.com/snowdrop/generator/v{{ generator_version}}/config/k8s/02_service.yml
{{ client_tool }} {{ k8s_config }} -n {{ snowdrop_namespace }} apply -f https://raw.githubusercontent.com/snowdrop/generator/v{{ generator_version}}/config/k8s/03_ingress.yml
- name: Deploy Snowdrop site application
shell: |
{{ client_tool }} {{ k8s_config }} -n {{ snowdrop_namespace }} apply -f https://raw.githubusercontent.com/snowdrop/snowdrop-site-angular/master/deploy/k8s/02_deployment.yml
Expand Down
9 changes: 9 additions & 0 deletions ansible/playbook/roles/k8s_snowdrop_site/tasks/remove.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
- name: Remove the configmap Generator
command: "{{ client_tool }} {{ k8s_config }} delete configmap {{ generator_configmap_name }} -n {{ snowdrop_namespace }}"

- name: Remove the Code Generator application
shell: |
{{ client_tool }} {{ k8s_config }} -n {{ snowdrop_namespace }} delete deployment/{{ generator_name }}
{{ client_tool }} {{ k8s_config }} -n {{ snowdrop_namespace }} delete service/{{ generator_name }}
{{ client_tool }} {{ k8s_config }} -n {{ snowdrop_namespace }} delete ingress/{{ generator_name }}
- name: Remove SnowDrop web site k8s resources
shell: |
{{ client_tool }} {{ k8s_config }} -n {{ snowdrop_namespace }} delete -f https://raw.githubusercontent.com/snowdrop/snowdrop-site-angular/master/deploy/k8s/02_deployment.yml
Expand Down
11 changes: 0 additions & 11 deletions doc/post-installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -453,17 +453,6 @@ By default, the kubernetes cluster don't install [Web UI - Dashboard](https://ku

To remove the kubernetes resources of the Snowdrop web site, pass then the following variable `-e remove=true`

### Command : Install Code Generator on K8s

The Code Generator application can be installed using the following role and command on Kubernetes

```bash
ansible-playbook -i inventory/cloud_host playbook/post_installation.yml \
--tags k8s_generator_site
```
The version of the application can be changed using the parameter: `-e generator_version=0.3.10`
To remove the kubernetes resources of the Generator application, pass then the following variable `-e remove=true`

### Command : Issuer and certificate for the Cert Manager

The role `k8s_issuer_certificate` allows to install the `Issuer` and `Certificate` CRD resources which are used by the certificate manager operator
Expand Down

0 comments on commit 512617b

Please sign in to comment.