canonical / jhack

Chock-full of Juju hackery.
Apache License 2.0
51 stars 24 forks source link

imatrix view reports no established relation (in contradiction to juju status) #54

Closed taurus-forever closed 1 year ago

taurus-forever commented 1 year ago

Hi Pietro,

Additionally to imatrix improvements requested in https://github.com/PietroPasotti/jhack/issues/47, I want to report an issue with "imatrix view". See the full logs below, juju reports established relation pgbouncer-k8s:db <> finos-waltz-k8s:db but "imatrix view" said "pgsql N":

> juju status --relations
Model     Controller  Cloud/Region        Version  SLA          Timestamp
welcome2  charm-dev   microk8s/localhost  2.9.38   unsupported  12:20:23+01:00

App                        Version  Status  Scale  Charm                      Channel      Rev  Address         Exposed  Message
finos-waltz-k8s                     active      1  finos-waltz-k8s            edge          28  10.152.183.179  no       
pgbouncer-k8s                       active      2  pgbouncer-k8s              latest/edge   20  10.152.183.75   no       
postgresql-k8s                      active      2  postgresql-k8s             latest/edge   44  10.152.183.36   no       
tls-certificates-operator           active      1  tls-certificates-operator  latest/beta   22  10.152.183.254  no       

Unit                          Workload  Agent  Address      Ports  Message
finos-waltz-k8s/0*            active    idle   10.1.84.112         
pgbouncer-k8s/0*              active    idle   10.1.84.106         
pgbouncer-k8s/1               active    idle   10.1.84.105         
postgresql-k8s/0              active    idle   10.1.84.110         
postgresql-k8s/1*             active    idle   10.1.84.109         Primary
tls-certificates-operator/0*  active    idle   10.1.84.111         

Relation provider                       Requirer                            Interface                 Type     Message
pgbouncer-k8s:db                        finos-waltz-k8s:db                  pgsql                     regular  <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
pgbouncer-k8s:pgb-peers                 pgbouncer-k8s:pgb-peers             pgb_peers                 peer     
postgresql-k8s:database                 pgbouncer-k8s:backend-database      postgresql_client         regular  
postgresql-k8s:database-peers           postgresql-k8s:database-peers       postgresql_peers          peer     
postgresql-k8s:restart                  postgresql-k8s:restart              rolling_op                peer     
tls-certificates-operator:certificates  pgbouncer-k8s:certificates          tls-certificates          regular  
tls-certificates-operator:certificates  postgresql-k8s:certificates         tls-certificates          regular  
tls-certificates-operator:replicas      tls-certificates-operator:replicas  tls-certificates-replica  peer     

> jhack imatrix view
                                                                                              integration  v0.1                                                                                               
                                    ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━┓                                     
                                    ┃ providers\requirers       ┃ finos-waltz-k8s        ┃ pgbouncer-k8s           ┃ postgresql-k8s         ┃ tls-certificates-operator ┃                                     
                                    ┡━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━┩                                     
                                    │ finos-waltz-k8s           │ -n/a-                  │ ┏━━━━━━━━━━━━━━━━━━━━━┓ │ ┏━━━━━━━━━━━━━━━━━━━━┓ │ ┏━━━━━━━━━━━━━━━━━━━━━━━┓ │                                     
                                    │                           │                        │ ┃ - no interfaces -   ┃ │ ┃ - no interfaces -  ┃ │ ┃ - no interfaces -     ┃ │                                     
                                    │                           │                        │ └─────────────────────┘ │ └────────────────────┘ │ └───────────────────────┘ │                                     
                                    │ pgbouncer-k8s             │ ┏━━━━━━━━━━━━━━━━━━━━┓ │ -n/a-                   │ ┏━━━━━━━━━━━━━━━━━━━━┓ │ ┏━━━━━━━━━━━━━━━━━━━━━━━┓ │                                     
>>>>>>                              │                           │ ┃ pgsql N            ┃ │                         │ ┃ - no interfaces -  ┃ │ ┃ - no interfaces -     ┃ │                                     
                                    │                           │ └────────────────────┘ │                         │ └────────────────────┘ │ └───────────────────────┘ │                                     
                                    │ postgresql-k8s            │ ┏━━━━━━━━━━━━━━━━━━━━┓ │ ┏━━━━━━━━━━━━━━━━━━━━━┓ │ -n/a-                  │ ┏━━━━━━━━━━━━━━━━━━━━━━━┓ │                                     
                                    │                           │ ┃ pgsql N            ┃ │ ┃ postgresql_client Y ┃ │                        │ ┃ - no interfaces -     ┃ │                                     
                                    │                           │ └────────────────────┘ │ └─────────────────────┘ │                        │ └───────────────────────┘ │                                     
                                    │ tls-certificates-operator │ ┏━━━━━━━━━━━━━━━━━━━━┓ │ ┏━━━━━━━━━━━━━━━━━━━━━┓ │ ┏━━━━━━━━━━━━━━━━━━━━┓ │ -n/a-                     │                                     
                                    │                           │ ┃ - no interfaces -  ┃ │ ┃ tls-certificates Y  ┃ │ ┃ tls-certificates Y ┃ │                           │                                     
                                    │                           │ └────────────────────┘ │ └─────────────────────┘ │ └────────────────────┘ │                           │                                     
                                    └───────────────────────────┴────────────────────────┴─────────────────────────┴────────────────────────┴───────────────────────────┘                

The latest edge version 0.3.10 (revision 186) has the same issue:

> jhack imatrix view
                                                                                              integration  v0.1                                                                                               
                               ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━┓                                
                               ┃ providers\requirers       ┃ finos-waltz-k8s        ┃ pgbouncer-k8s                ┃ postgresql-k8s              ┃ tls-certificates-operator ┃                                
                               ┡━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━┩                                
                               │ finos-waltz-k8s           │ -n/a-                  │ ┌──────────────────────────┐ │ ┌─────────────────────────┐ │ ┌───────────────────────┐ │                                
                               │                           │                        │ │ - no interfaces -        │ │ │ - no interfaces -       │ │ │ - no interfaces -     │ │                                
                               │                           │                        │ └──────────────────────────┘ │ └─────────────────────────┘ │ └───────────────────────┘ │                                
                               │ pgbouncer-k8s             │ ┌────────────────────┐ │ -n/a-                        │ ┌─────────────────────────┐ │ ┌───────────────────────┐ │                                
 >>>>>                         │                           │ │ pgsql (1x) N       │ │                              │ │ - no interfaces -       │ │ │ - no interfaces -     │ │                                
                               │                           │ └────────────────────┘ │                              │ └─────────────────────────┘ │ └───────────────────────┘ │                                
                               │ postgresql-k8s            │ ┌────────────────────┐ │ ┌──────────────────────────┐ │ -n/a-                       │ ┌───────────────────────┐ │                                
                               │                           │ │ pgsql (1x) N       │ │ │ postgresql_client (1x) Y │ │                             │ │ - no interfaces -     │ │                                
                               │                           │ └────────────────────┘ │ └──────────────────────────┘ │                             │ └───────────────────────┘ │                                
                               │ tls-certificates-operator │ ┌────────────────────┐ │ ┌──────────────────────────┐ │ ┌─────────────────────────┐ │ -n/a-                     │                                
                               │                           │ │ - no interfaces -  │ │ │ tls-certificates (1x) Y  │ │ │ tls-certificates (1x) Y │ │                           │                                
                               │                           │ └────────────────────┘ │ └──────────────────────────┘ │ └─────────────────────────┘ │                           │                                
                               └───────────────────────────┴────────────────────────┴──────────────────────────────┴─────────────────────────────┴───────────────────────────┘                                

It could be related to multiply legacy interfaces in pgbouncer-k8s:

provides:
...
  # Legacy relations - these will be deprecated in a future release
  db:
    interface: pgsql
    optional: true
  db-admin:
    interface: pgsql
    optional: true

Juju 2.9.38 snap 2.9/stable (rev 21790), Microk8s 1.26.1/stable (rev 4595).

Tnx for the nice tool!

taurus-forever commented 1 year ago

Steps to reproduce:


> cat alex.yaml 
applications:
  finos-waltz-k8s:
    channel: latest/edge
    charm: finos-waltz-k8s
    constraints: arch=amd64
    scale: 1
  pgbouncer-k8s:
    channel: latest/edge
    charm: pgbouncer-k8s
    constraints: arch=amd64
    scale: 2
  postgresql-k8s:
    channel: latest/edge
    charm: postgresql-k8s
    constraints: arch=amd64
    scale: 2
    trust: true
  tls-certificates-operator:
    channel: latest/beta
    charm: tls-certificates-operator
    constraints: arch=amd64
    num_units: 1
    options:
      ca-common-name: postgresql_k8s_bundle_ca
      generate-self-signed-certificates: true
bundle: kubernetes
name: postgresql-k8s-bundle
relations:
- - pgbouncer-k8s:backend-database
  - postgresql-k8s:database
- - postgresql-k8s:certificates
  - tls-certificates-operator:certificates
- - pgbouncer-k8s:certificates
  - tls-certificates-operator:certificates
- - pgbouncer-k8s:db
  - finos-waltz-k8s:db
type: bundle

> juju deploy ./alex.yaml --trust
Located charm "finos-waltz-k8s" in charm-hub, channel latest/edge
Located charm "pgbouncer-k8s" in charm-hub, channel latest/edge
Located charm "postgresql-k8s" in charm-hub, channel latest/edge
Located charm "tls-certificates-operator" in charm-hub, channel latest/beta
Executing changes:
- upload charm finos-waltz-k8s from charm-hub from channel latest/edge with architecture=amd64
- deploy application finos-waltz-k8s from charm-hub with 1 unit with latest/edge
  added resource waltz-image
- upload charm pgbouncer-k8s from charm-hub from channel latest/edge with architecture=amd64
- deploy application pgbouncer-k8s from charm-hub with 2 units with latest/edge
  added resource pgbouncer-image
- upload charm postgresql-k8s from charm-hub from channel latest/edge with architecture=amd64
- deploy application postgresql-k8s from charm-hub with 2 units with latest/edge
  added resource postgresql-image
- upload charm tls-certificates-operator from charm-hub from channel latest/beta with architecture=amd64
- deploy application tls-certificates-operator from charm-hub with 1 unit with latest/beta
- add relation pgbouncer-k8s:backend-database - postgresql-k8s:database
- add relation postgresql-k8s:certificates - tls-certificates-operator:certificates
- add relation pgbouncer-k8s:certificates - tls-certificates-operator:certificates
- add relation pgbouncer-k8s:db - finos-waltz-k8s:db
Deploy of bundle completed.