Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing postgres upgrade conditional #1741

Merged
merged 3 commits into from
Mar 1, 2024

Conversation

aknochow
Copy link
Member

@aknochow aknochow commented Mar 1, 2024

SUMMARY

This fixes the bug introduced by #1486

ISSUE TYPE
  • Bug, Docs Fix or other nominal change
ADDITIONAL INFORMATION

Tested upgrade locally successfully (awx-postgres-13-0 was replaced with awx-postgres-15-0). Confirmed data migrated to new pvc.

Before:

 $ kubectl get all -n awx
NAME                                                   READY   STATUS      RESTARTS   AGE
pod/automation-job-1-mstbh                             0/1     Completed   0          60s
pod/awx-operator-controller-manager-7f44c57b4d-lpghj   2/2     Running     0          8m5s
pod/awx-postgres-13-0                                  1/1     Running     0          7m2s
pod/awx-task-6bbf6bb5d6-jv29h                          4/4     Running     0          6m34s
pod/awx-web-6fbdc6df6d-8vpbp                           3/3     Running     0          6m26s

NAME                                                      TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)    AGE
service/awx-operator-controller-manager-metrics-service   ClusterIP   10.103.144.126   <none>        8443/TCP   8m5s
service/awx-postgres-13                                   ClusterIP   None             <none>        5432/TCP   7m1s
service/awx-service                                       ClusterIP   10.105.155.35    <none>        80/TCP     6m37s

NAME                                              READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/awx-operator-controller-manager   1/1     1            1           8m5s
deployment.apps/awx-task                          1/1     1            1           6m34s
deployment.apps/awx-web                           1/1     1            1           6m26s

NAME                                                         DESIRED   CURRENT   READY   AGE
replicaset.apps/awx-operator-controller-manager-7f44c57b4d   1         1         1       8m5s
replicaset.apps/awx-task-6bbf6bb5d6                          1         1         1       6m34s
replicaset.apps/awx-web-6fbdc6df6d                           1         1         1       6m26s

NAME                               READY   AGE
statefulset.apps/awx-postgres-13   1/1     7m2s

After:

 $ kubectl get all -n awx
NAME                                                   READY   STATUS      RESTARTS   AGE
pod/automation-job-3-2j2kp                             0/1     Completed   0          19s
pod/awx-operator-controller-manager-797dbfff78-xw4qr   2/2     Running     0          5m22s
pod/awx-postgres-15-0                                  1/1     Running     0          4m24s
pod/awx-task-95df76d6c-pblqf                           4/4     Running     0          3m49s
pod/awx-web-69d94f8c4f-fl2sj                           3/3     Running     0          3m40s

NAME                                                      TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)    AGE
service/awx-operator-controller-manager-metrics-service   ClusterIP   10.103.144.126   <none>        8443/TCP   18m
service/awx-postgres-15                                   ClusterIP   None             <none>        5432/TCP   4m19s
service/awx-service                                       ClusterIP   10.105.155.35    <none>        80/TCP     17m

NAME                                              READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/awx-operator-controller-manager   1/1     1            1           18m
deployment.apps/awx-task                          1/1     1            1           17m
deployment.apps/awx-web                           1/1     1            1           16m

NAME                                                         DESIRED   CURRENT   READY   AGE
replicaset.apps/awx-operator-controller-manager-797dbfff78   1         1         1       5m22s
replicaset.apps/awx-operator-controller-manager-7f44c57b4d   0         0         0       18m
replicaset.apps/awx-task-6bbf6bb5d6                          0         0         0       17m
replicaset.apps/awx-task-95df76d6c                           1         1         1       3m49s
replicaset.apps/awx-web-69d94f8c4f                           1         1         1       3m40s
replicaset.apps/awx-web-6fbdc6df6d                           0         0         0       16m

NAME                               READY   AGE
statefulset.apps/awx-postgres-15   1/1     4m24s

The PVC is also migrated/updated:

Before:

 $ kubectl get pvc -n awx
NAME                            STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS   AGE
postgres-13-awx-postgres-13-0   Bound    pvc-59237498-94c2-425b-a00e-a5d315b27360   8Gi        RWO            standard       7m

After:

 $ kubectl get pvc -n awx
NAME                            STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS   AGE
postgres-15-awx-postgres-15-0   Bound    pvc-25501b6f-0299-43e4-9136-1afd1981e455   8Gi        RWO            standard       2m37s

Job history confirms migration success: (Job 1 is pre-upgrade and Job 2 is post-upgrade):
image

@TheRealHaoLiu TheRealHaoLiu changed the title fixing postgres upgrade conditional Fixing postgres upgrade conditional Mar 1, 2024
@aknochow aknochow force-pushed the fix-pg-conditionals branch 2 times, most recently from 309ec51 to 82bd6d7 Compare March 1, 2024 17:46
Copy link
Contributor

@dsavineau dsavineau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in addition to this I would add a int filter on the < operator condition to be sure that whatever the _previous_upgraded_pg_version variable type is then we convert it for the condition

-    - (_previous_upgraded_pg_version | default(false)) | ternary(_previous_upgraded_pg_version < supported_pg_version, true)
+    - (_previous_upgraded_pg_version | default(false)) | ternary(_previous_upgraded_pg_version | int < supported_pg_version, true)

https://github.com/ansible/awx-operator/blob/devel/roles/installer/tasks/database_configuration.yml#L182

@aknochow aknochow force-pushed the fix-pg-conditionals branch from 82bd6d7 to fedffa4 Compare March 1, 2024 19:02
@aknochow
Copy link
Member Author

aknochow commented Mar 1, 2024

@dsavineau Change made.

@TheRealHaoLiu TheRealHaoLiu merged commit d0827ba into ansible:devel Mar 1, 2024
6 checks passed
@aknochow aknochow deleted the fix-pg-conditionals branch March 2, 2024 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants