Removing postgres resources on OpenShift and Cloud Pak for Integration

When you remove API Connect by deleting its files, some of the postgres resources from Crunchy Data remain and must be deleted manually before you attempt to re-install API Connect.

About this task

Sometimes when you remove API Connect, some postgres resources remain and must be deleted manually.

To determine whether you need to delete any postgres resources, use the oc get command and specify vendor=crunchydata as shown in the following example.

$ oc get pods -n apic -l vendor=crunchydata
NAME                                                              READY   STATUS      RESTARTS   AGE
backrest-backup-production-mgmt-mymgmtsite123-postgres-k77xj      0/1     Completed   0          17h
production-mgmt-mymgmtsite123-postgres-backrest-shared-repk4kzc   1/1     Running     0          2d21h
production-mgmt-mymgmtsite123-postgres-full-sch-backup-9ktp5      0/1     Completed   0          164m

$ oc get deployments -n apic -l vendor=crunchydata
NAME                                                          READY   UP-TO-DATE   AVAILABLE   AGE
production-mgmt-mymgmtsite123-postgres-backrest-shared-repo   1/1     1            1           2d21h

$ oc get sa -n apic -l vendor=crunchydata
No resources found in apic namespace.

$ oc get jobs -n apic -l vendor=crunchydata
NAME                                                     COMPLETIONS   DURATION   AGE
backrest-backup-production-mgmt-mymgmtsite123-postgres   1/1           10s        17h
production-mgmt-mymgmtsite123-postgres-full-sch-backup   1/1           37s        164m
production-mgmt-mymgmtsite123-postgres-rmdata-cemg       1/1           20s        14m

$ oc get roles -n apic -l vendor=crunchydata
No resources found in apic namespace.

$ oc get rolebindings -n apic -l vendor=crunchydata
No resources found in apic namespace.

$ oc get secrets -n apic -l vendor=crunchydata
NAME                                                          TYPE     DATA   AGE
production-mgmt-7bc754c7-postgres-backrest-repo-config        Opaque   9      6d23h
production-mgmt-7bc754c7-postgres-postgres-secret             Opaque   2      6d23h
production-mgmt-7bc754c7-postgres-primaryuser-secret          Opaque   2      6d23h
production-mgmt-7bc754c7-postgres-testuser-secret             Opaque   2      6d23h
production-mgmt-8aac6b4e-postgres-backrest-repo-config        Opaque   9      6d22h
production-mgmt-8aac6b4e-postgres-postgres-secret             Opaque   2      6d22h
production-mgmt-8aac6b4e-postgres-primaryuser-secret          Opaque   2      6d22h
production-mgmt-8aac6b4e-postgres-testuser-secret             Opaque   2      6d22h
production-mgmt-mymgmtsite123-postgres-backrest-repo-config   Opaque   9      2d21h
production-mgmt-mymgmtsite123-postgres-postgres-secret        Opaque   2      2d21h
production-mgmt-mymgmtsite123-postgres-primaryuser-secret     Opaque   2      2d21h
production-mgmt-mymgmtsite123-postgres-testuser-secret        Opaque   2      2d21h

$ oc get cm -n apic -l vendor=crunchydata
NAME                                                  DATA   AGE
production-mgmt-mymgmtsite123-postgres-config         0      2d21h
production-mgmt-mymgmtsite123-postgres-leader         0      2d21h
production-mgmt-mymgmtsite123-postgres-pgbouncer-cm   2      2d21h
production-mgmt-mymgmtsite123-postgres-pgha-config    5      2d21h


For each type of postgres resource, check to see if any resources are available and if so, delete the resources:
  • pods:
    oc get pods -n <APIC_namespace> -l vendor=crunchydata
    oc delete pods -n <APIC_namespace> -l vendor=crunchydata
  • deployments:
    oc get deployments -n <APIC_namespace> -l vendor=crunchydata
    oc delete deployments -n <APIC_namespace> -l vendor=crunchydata
  • Jobs:
    oc get jobs -n <APIC_namespace> -l vendor=crunchydata
    oc delete jobs -n <APIC_namespace> -l vendor=crunchydata
  • roles:
    oc get roles -n <APIC_namespace> -l vendor=crunchydata
    oc delete roles -n <APIC_namespace> -l vendor=crunchydata
  • rolebindings:
    oc get rolebindings -n <APIC_namespace> -l vendor=crunchydata
    oc delete rolebindings -n <APIC_namespace> -l vendor=crunchydata
  • secrets:
    oc get secrets -n <APIC_namespace> -l vendor=crunchydata
    oc delete secrets -n <APIC_namespace> -l vendor=crunchydata
  • cm:
    oc get cm -n <APIC_namespace> -l vendor=crunchydata
    oc delete cm -n <APIC_namespace> -l vendor=crunchydata
  • pgtasks
    oc get -n <APIC_namespace> -l vendor=crunchydata
    oc delete -n <APIC_namespace>
  • pgreplica:
    oc get pgreplica -n <APIC_namespace> -l vendor=crunchydata
    oc delete pgreplica -n <APIC_namespace> -l vendor=crunchydata