Browse Source

Merge pull request #788 from Lakshmi-Patneedi/devel

AWX operator pod restarting multiple times fix
Sujit Jadhav 3 years ago
parent
commit
2d3e154f17

+ 24 - 12
control_plane/roles/webui_awx/tasks/install_awx.yml

@@ -1,4 +1,4 @@
-# Copyright 2021 Dell Inc. or its subsidiaries. All Rights Reserved.
+# Copyright 2022 Dell Inc. or its subsidiaries. All Rights Reserved.
 #
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
 # you may not use this file except in compliance with the License.
@@ -59,11 +59,28 @@
   command: "kubectl config set-context --current --namespace={{ awx_namespace }}"
   command: "kubectl config set-context --current --namespace={{ awx_namespace }}"
   changed_when: false
   changed_when: false
 
 
+- name: Installing jq package
+  package:
+    name: jq
+    state: present
+
 - name: Deploying awx-operator
 - name: Deploying awx-operator
   command: make deploy
   command: make deploy
   changed_when: false
   changed_when: false
   args:
   args:
     chdir: "{{ awx_operator_folder }}"
     chdir: "{{ awx_operator_folder }}"
+  environment:
+    NAMESPACE: "{{ awx_namespace }}"
+
+- name: Waiting for awx operator deployment {This might take 10-15 minutes}
+  block:
+    - name: Waiting for awx-operator deployment to be up and running
+      command: kubectl wait --for=condition=available deployment awx-operator-controller-manager -n {{ awx_namespace }} --timeout={{ awx_operator_time }}
+      changed_when: false 
+  rescue:
+    - name: Display failure message
+      debug:
+        msg: "{{ operator_deployment_failure }}"
 
 
 - name: Get K8s pods
 - name: Get K8s pods
   command: "kubectl get pods -n {{ awx_namespace }}"
   command: "kubectl get pods -n {{ awx_namespace }}"
@@ -103,15 +120,16 @@
   when: "'custom-awx-ee' not in docker_images.stdout"
   when: "'custom-awx-ee' not in docker_images.stdout"
   retries: "{{ min_retries }}"
   retries: "{{ min_retries }}"
 
 
-- name: Waiting for awx-operator deployment to be up and running
-  command: kubectl wait --for=condition=available deployment awx-operator-controller-manager -n {{ awx_namespace }} --timeout={{ awx_operator_time }}
-  changed_when: false
-
 - name: Deploy awx
 - name: Deploy awx
   command: "kubectl apply -f {{ awx_yml_file_path }}"
   command: "kubectl apply -f {{ awx_yml_file_path }}"
   changed_when: true
   changed_when: true
   when: not k8s_pods.stdout | regex_search('awx-([A-Za-z0-9]{10})-([A-Za-z0-9]{5})')
   when: not k8s_pods.stdout | regex_search('awx-([A-Za-z0-9]{10})-([A-Za-z0-9]{5})')
 
 
+- name: Wait for awx pods to get created
+  wait_for:
+    timeout: "{{ awx_wait_time }}"
+  when: not k8s_pods.stdout | regex_search('awx-([A-Za-z0-9]{10})-([A-Za-z0-9]{5})')
+
 - name: Install awxkit using pip3
 - name: Install awxkit using pip3
   pip:
   pip:
     name: awxkit
     name: awxkit
@@ -122,18 +140,12 @@
   changed_when: true
   changed_when: true
   register: installation_status
   register: installation_status
 
 
-- name: Wait for awx pods to get created
-  wait_for:
-    timeout: "{{ awx_wait_time }}"
-  when: not k8s_pods.stdout | regex_search('awx-([A-Za-z0-9]{10})-([A-Za-z0-9]{5})')
-
 - name: Fails if the pods go into ImagePullBackOff state
 - name: Fails if the pods go into ImagePullBackOff state
   block:
   block:
     - name: Waiting for awx deployment to be up and running
     - name: Waiting for awx deployment to be up and running
       command: kubectl wait --for=condition=available deployment awx -n {{ awx_namespace }} --timeout={{ awx_deployment_time }}
       command: kubectl wait --for=condition=available deployment awx -n {{ awx_namespace }} --timeout={{ awx_deployment_time }}
       changed_when: false
       changed_when: false
-
   rescue:
   rescue:
     - name: Display failure message
     - name: Display failure message
       debug:
       debug:
-        msg: "{{ deployment_failure_msg }}"
+        msg: "{{ deployment_failure_msg }}"

+ 2 - 1
control_plane/roles/webui_awx/vars/main.yml

@@ -36,6 +36,7 @@ readiness_probe_initial: "initialDelaySeconds: 5"
 readiness_probe_final: "initialDelaySeconds: 300"
 readiness_probe_final: "initialDelaySeconds: 300"
 awx_operator_time: 900s
 awx_operator_time: 900s
 awx_deployment_time: 1500s
 awx_deployment_time: 1500s
+operator_deployment_failure: "AWX Operator deployment failed due to awx operator pod is in crashloopbackoff state"
 
 
 # Usage: configure_settings.yml
 # Usage: configure_settings.yml
 awx_port: 8052
 awx_port: 8052
@@ -54,7 +55,7 @@ awx_ui_msg: "AWX Upgrading"
 return_status: 200
 return_status: 200
 max_retries: 20
 max_retries: 20
 max_delay: 15
 max_delay: 15
-awx_ui_wait_time: 30
+awx_ui_wait_time: 200
 
 
 # Usage: check_prerequisites.yml
 # Usage: check_prerequisites.yml
 min_retries: 2
 min_retries: 2