From 746dc2738f14aadd4099997ada0c3930fc0f5ed5 Mon Sep 17 00:00:00 2001 From: "Christian M. Adams" Date: Wed, 24 Mar 2021 13:37:32 -0400 Subject: [PATCH] Name pg pod in a more unique way - this is to make it possible to run migration with multiple deployments in the same pod --- README.md | 2 ++ roles/installer/tasks/migrate_data.yml | 2 +- roles/installer/templates/tower_postgres.yaml.j2 | 10 +++++----- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index d6bf18fb..83fc864a 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,8 @@ metadata: name: awx ``` +> The metadata.name you provide, will be the name of the resulting AWX deployment. If you deploy more than one to the same namespace, be sure to use unique names. + Finally, use `kubectl` to create the awx instance in your cluster: ```bash diff --git a/roles/installer/tasks/migrate_data.yml b/roles/installer/tasks/migrate_data.yml index ae04e8ca..59b5c744 100644 --- a/roles/installer/tasks/migrate_data.yml +++ b/roles/installer/tasks/migrate_data.yml @@ -13,7 +13,7 @@ kind: Pod namespace: '{{ meta.namespace }}' label_selectors: - - "app={{ deployment_type }}-postgres" + - "app={{ meta.name }}-{{ deployment_type }}-postgres" register: postgres_pod until: "postgres_pod['resources'][0]['status']['phase'] == 'Running'" delay: 5 diff --git a/roles/installer/templates/tower_postgres.yaml.j2 b/roles/installer/templates/tower_postgres.yaml.j2 index 5cdd17e2..c2629861 100644 --- a/roles/installer/templates/tower_postgres.yaml.j2 +++ b/roles/installer/templates/tower_postgres.yaml.j2 @@ -6,11 +6,11 @@ metadata: name: '{{ meta.name }}-postgres' namespace: '{{ meta.namespace }}' labels: - app: '{{ deployment_type }}-postgres' + app: '{{ meta.name }}-{{ deployment_type }}-postgres' spec: selector: matchLabels: - app: '{{ deployment_type }}-postgres' + app: '{{ meta.name }}-{{ deployment_type }}-postgres' serviceName: '{{ meta.name }}' replicas: 1 updateStrategy: @@ -18,7 +18,7 @@ spec: template: metadata: labels: - app: '{{ deployment_type }}-postgres' + app: '{{ meta.name }}-{{ deployment_type }}-postgres' spec: containers: - image: '{{ tower_postgres_image }}' @@ -71,10 +71,10 @@ metadata: name: '{{ meta.name }}-postgres' namespace: '{{ meta.namespace }}' labels: - app: '{{ deployment_type }}-postgres' + app: '{{ meta.name }}-{{ deployment_type }}-postgres' spec: ports: - port: 5432 clusterIP: None selector: - app: '{{ deployment_type }}-postgres' + app: '{{ meta.name }}-{{ deployment_type }}-postgres'