charmed-kubernetes / pytest-operator

Apache License 2.0
7 stars 13 forks source link

`ops_test.model.deploy` ignores pinned revisions in a bundle #111

Closed natalian98 closed 1 year ago

natalian98 commented 1 year ago

When using ops_test.model.deploy to deploy a bundle, it seems to ignore pinned charm revisions.

Steps to reproduce

The following template named bundle.yaml.j2:

{%- set testing = testing is defined and testing.casefold() in ["1", "yes", "true"] %}
bundle: kubernetes
name: identity-platform
website: https://github.com/canonical/iam-bundle
issues: https://github.com/canonical/iam-bundle/issues
applications:
  hydra:
    charm: hydra
    channel: {{ channel|default('edge', true) }}
    scale: 1
    series: jammy
    trust: true
  kratos:
    charm: kratos
    channel: {{ channel|default('edge', true) }}
    scale: 1
    series: jammy
    trust: true
  kratos-external-idp-integrator:
    charm: kratos-external-idp-integrator
    channel: {{ channel|default('edge', true) }}
    scale: 1
    series: jammy
  identity-platform-login-ui-operator:
    charm: identity-platform-login-ui-operator
    channel: {{ channel|default('edge', true) }}
    scale: 1
    series: jammy
    trust: true
  postgresql-k8s:
    charm: postgresql-k8s
    channel: 14/stable
    series: jammy
    scale: 1
    trust: true
  tls-certificates-operator:
    charm: tls-certificates-operator
    channel: stable
    scale: 1
    {%- if testing %}
    options:
      ca-common-name: demo.ca.local
      generate-self-signed-certificates: true
    {%- endif %}
  traefik-admin:
    charm: traefik-k8s
    revision: 136
    channel: edge
    series: focal
    scale: 1
    trust: true
  traefik-public:
    charm: traefik-k8s
    revision: 136
    channel: edge
    series: focal
    scale: 1
    trust: true
relations:
  - [hydra:pg-database, postgresql-k8s:database]
  - [kratos:pg-database, postgresql-k8s:database]
  - [kratos:endpoint-info, hydra:endpoint-info]
  - [kratos-external-idp-integrator:kratos-external-idp, kratos:kratos-external-idp]
  - [hydra:admin-ingress, traefik-admin:ingress]
  - [hydra:public-ingress, traefik-public:ingress]
  - [kratos:admin-ingress, traefik-admin:ingress]
  - [kratos:public-ingress, traefik-public:ingress]
  - [identity-platform-login-ui-operator:ingress, traefik-public:ingress]
  - [identity-platform-login-ui-operator:endpoint-info, hydra:endpoint-info]
  - [identity-platform-login-ui-operator:ui-endpoint-info, hydra:ui-endpoint-info]
  - [identity-platform-login-ui-operator:ui-endpoint-info, kratos:ui-endpoint-info]
  - [identity-platform-login-ui-operator:kratos-endpoint-info, kratos:kratos-endpoint-info]
  - [traefik-admin:certificates, tls-certificates-operator:certificates]
  - [traefik-public:certificates, tls-certificates-operator:certificates]

is rendered correctly with ops_test.render_bundle (it includes the revision 136 in traefik-k8s), but when deployed in an integration test using ops_test.model.deploy, the most current revision 141 is deployed instead. Example CI

Workaround

Deploy the bundle with ops_test.run("juju", "deploy", rendered_bundle, "--trust")

addyess commented 1 year ago

@natalian98 thanks for raising this issue. ops_test.model is a Model object from python-libjuju

I believe there are numerous issues against deploying in python-juju regarding this

You might wish to open this issue there