Skip to content

Commit

Permalink
✨ Allow pathfinder to be optional (#263)
Browse files Browse the repository at this point in the history
Add feature_pathfinder by default enabled but allow to disable
deployment, ds builds do not include pathfinder.

Signed-off-by: Franco Bladilo <fbladilo@redhat.com>
  • Loading branch information
fbladilo authored Sep 15, 2023
1 parent 530889a commit 4ba0537
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 52 deletions.
1 change: 1 addition & 0 deletions roles/tackle/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ app_version: "{{ lookup('env', 'VERSION') }}"
feature_auth_required: "{{ false if app_profile == 'konveyor' else true }}"
feature_auth_type: keycloak
feature_isolate_namespace: true
feature_pathfinder: true

# Environment
openshift_cluster: false
Expand Down
107 changes: 55 additions & 52 deletions roles/tackle/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -272,68 +272,71 @@
retries: 30
delay: 5

- name: "Setup PathFinder PostgreSQL PersistentVolume"
k8s:
state: present
definition: "{{ lookup('template', 'persistentvolumeclaim-pathfinder-postgresql.yml.j2') }}"
- when:
- feature_pathfinder|bool
block:
- name: "Setup PathFinder PostgreSQL PersistentVolume"
k8s:
state: present
definition: "{{ lookup('template', 'persistentvolumeclaim-pathfinder-postgresql.yml.j2') }}"

- name: "Check if PathFinder PostgreSQL Secret exists already so we don't update it"
k8s_info:
api_version: v1
kind: Secret
name: "{{ pathfinder_database_secret_name }}"
namespace: "{{ app_namespace }}"
register: pathfinder_database_secret_status
- name: "Check if PathFinder PostgreSQL Secret exists already so we don't update it"
k8s_info:
api_version: v1
kind: Secret
name: "{{ pathfinder_database_secret_name }}"
namespace: "{{ app_namespace }}"
register: pathfinder_database_secret_status

- when: (pathfinder_database_secret_status.resources | length) == 0
block:
- name: "Generate random values for PathFinder PostgreSQL username and password"
set_fact:
pathfinder_database_db_username: "user-{{ lookup('password', '/dev/null chars=ascii_lowercase,ascii_uppercase,digits length=4') }}"
pathfinder_database_db_password: "{{ lookup('password', '/dev/null chars=ascii_lowercase,ascii_uppercase,digits length=16') }}"
- when: (pathfinder_database_secret_status.resources | length) == 0
block:
- name: "Generate random values for PathFinder PostgreSQL username and password"
set_fact:
pathfinder_database_db_username: "user-{{ lookup('password', '/dev/null chars=ascii_lowercase,ascii_uppercase,digits length=4') }}"
pathfinder_database_db_password: "{{ lookup('password', '/dev/null chars=ascii_lowercase,ascii_uppercase,digits length=16') }}"

- name: "Encode PathFinder PostgreSQL username and password"
set_fact:
pathfinder_database_db_username_b64: "{{ pathfinder_database_db_username | b64encode }}"
pathfinder_database_db_password_b64: "{{ pathfinder_database_db_password | b64encode }}"
- name: "Encode PathFinder PostgreSQL username and password"
set_fact:
pathfinder_database_db_username_b64: "{{ pathfinder_database_db_username | b64encode }}"
pathfinder_database_db_password_b64: "{{ pathfinder_database_db_password | b64encode }}"

- name: "Setup PathFinder PostgreSQL Secret"
k8s:
state: present
definition: "{{ lookup('template', 'secret-pathfinder-postgresql.yml.j2') }}"

- name: "Setup PathFinder PostgreSQL Secret"
- name: "Setup PathFinder PostgreSQL Service"
k8s:
state: present
definition: "{{ lookup('template', 'secret-pathfinder-postgresql.yml.j2') }}"
definition: "{{ lookup('template', 'service-pathfinder-postgresql.yml.j2') }}"

- name: "Setup PathFinder PostgreSQL Service"
k8s:
state: present
definition: "{{ lookup('template', 'service-pathfinder-postgresql.yml.j2') }}"
- name: "Setup PathFinder PostgreSQL Deployment"
k8s:
state: present
definition: "{{ lookup('template', 'deployment-pathfinder-postgresql.yml.j2') }}"

- name: "Setup PathFinder PostgreSQL Deployment"
k8s:
state: present
definition: "{{ lookup('template', 'deployment-pathfinder-postgresql.yml.j2') }}"
- name: "Check status of PathFinder PostgreSQL"
kubernetes.core.k8s_info:
api_version: v1
kind: Pod
namespace: "{{ app_namespace }}"
label_selectors:
- app.kubernetes.io/name = {{ pathfinder_database_service_name }}
wait: true
wait_condition:
type: "Ready"
status: "True"
wait_timeout: 240

- name: "Check status of PathFinder PostgreSQL"
kubernetes.core.k8s_info:
api_version: v1
kind: Pod
namespace: "{{ app_namespace }}"
label_selectors:
- app.kubernetes.io/name = {{ pathfinder_database_service_name }}
wait: true
wait_condition:
type: "Ready"
status: "True"
wait_timeout: 240

- name: "Setup PathFinder Service"
k8s:
state: present
definition: "{{ lookup('template', 'service-pathfinder.yml.j2') }}"
- name: "Setup PathFinder Service"
k8s:
state: present
definition: "{{ lookup('template', 'service-pathfinder.yml.j2') }}"

- name: "Setup PathFinder Deployment"
k8s:
state: present
definition: "{{ lookup('template', 'deployment-pathfinder.yml.j2') }}"
- name: "Setup PathFinder Deployment"
k8s:
state: present
definition: "{{ lookup('template', 'deployment-pathfinder.yml.j2') }}"

- name: "Setup Hub API Database PersistentVolumeClaim"
k8s:
Expand Down

0 comments on commit 4ba0537

Please sign in to comment.