From b5d81b8e5d97b501abce7d98adc59685676f2725 Mon Sep 17 00:00:00 2001 From: Hao Liu <44379968+TheRealHaoLiu@users.noreply.github.com> Date: Mon, 11 Mar 2024 15:01:00 -0400 Subject: [PATCH] Fix awx_kube_devel (#1759) * Fix awx_kube_devel * Sanitize version name for kube_dev When in development mode, awx version may look like 23.9.1.dev18+gee9eac15dc.d20240311 k8s job to the migration can only have a name with alphanumeric, and '.', '-' so we can just drop off the + Signed-off-by: Seth Foster --------- Signed-off-by: Seth Foster Co-authored-by: Seth Foster --- roles/installer/tasks/migrate_schema.yml | 4 ++-- roles/installer/templates/deployments/task.yaml.j2 | 4 ++++ roles/installer/templates/jobs/migration.yaml.j2 | 11 ++++++++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/roles/installer/tasks/migrate_schema.yml b/roles/installer/tasks/migrate_schema.yml index ef41e182..77ffc6fc 100644 --- a/roles/installer/tasks/migrate_schema.yml +++ b/roles/installer/tasks/migrate_schema.yml @@ -22,9 +22,9 @@ changed_when: false register: version_check - - name: Update instance version + - name: Sanitize instance version set_fact: - version: "{{ version_check.stdout | trim }}" + version: "{{ version_check.stdout.split('+')[0] | trim }}" # It is possible to do a wait on this task to create the job and wait # until it completes. Unfortunately, if the job doesn't wait finish within diff --git a/roles/installer/templates/deployments/task.yaml.j2 b/roles/installer/templates/deployments/task.yaml.j2 index a8f1dda7..29da6f51 100644 --- a/roles/installer/templates/deployments/task.yaml.j2 +++ b/roles/installer/templates/deployments/task.yaml.j2 @@ -95,6 +95,10 @@ spec: mountPath: "/etc/tower/settings.py" subPath: settings.py readOnly: true +{% if development_mode | bool %} + - name: awx-devel + mountPath: "/awx_devel" +{% endif %} - name: init-receptor image: '{{ _init_container_image }}' imagePullPolicy: '{{ image_pull_policy }}' diff --git a/roles/installer/templates/jobs/migration.yaml.j2 b/roles/installer/templates/jobs/migration.yaml.j2 index e306784c..98b9f7cb 100644 --- a/roles/installer/templates/jobs/migration.yaml.j2 +++ b/roles/installer/templates/jobs/migration.yaml.j2 @@ -13,7 +13,7 @@ spec: - name: "migration-job" image: '{{ _image }}' command: - - /usr/bin/awx-manage + - awx-manage - migrate - --noinput volumeMounts: @@ -29,6 +29,10 @@ spec: mountPath: "/etc/tower/settings.py" subPath: settings.py readOnly: true +{% if development_mode | bool %} + - name: awx-devel + mountPath: "/awx_devel" +{% endif %} volumes: - name: "{{ ansible_operator_meta.name }}-application-credentials" secret: @@ -52,6 +56,11 @@ spec: items: - key: settings path: settings.py +{% if development_mode | bool %} + - name: awx-devel + hostPath: + path: /awx_devel +{% endif %} dnsPolicy: ClusterFirst restartPolicy: Never terminationGracePeriodSeconds: 30