type: charm
name: cinder-k8s
summary: OpenStack volume service
description: |
  Cinder is the OpenStack project that provides volume management for
  instances.
assumes:
  - k8s-api
  - juju >= 3.1
links:
  source:
    - https://opendev.org/openstack/charm-cinder-k8s
  issues:
    - https://bugs.launchpad.net/charm-cinder-k8s

base: ubuntu@24.04
platforms:
  amd64:

config:
  options:
    debug:
      default: false
      description: Enable debug logging.
      type: boolean
    region:
      default: RegionOne
      description: Name of the OpenStack region
      type: string

containers:
  cinder-api:
    resource: cinder-api-image
  cinder-scheduler:
    resource: cinder-scheduler-image

resources:
  cinder-api-image:
    type: oci-image
    description: OCI image for OpenStack Cinder API
    upstream-source: ghcr.io/canonical/cinder-consolidated:2024.1
  cinder-scheduler-image:
    type: oci-image
    description: OCI image for OpenStack Cinder Scheduler
    upstream-source: ghcr.io/canonical/cinder-consolidated:2024.1

requires:
  database:
    interface: mysql_client
    limit: 1
  ingress-internal:
    interface: ingress
    limit: 1
  ingress-public:
    interface: ingress
    optional: true
    limit: 1
  identity-service:
    interface: keystone
    limit: 1
  amqp:
    interface: rabbitmq
  storage-backend:
    interface: cinder-backend
  image-service:
    interface: glance
    optional: true
  receive-ca-cert:
    interface: certificate_transfer
    optional: true
  logging:
    interface: loki_push_api
    optional: true
  tracing:
    interface: tracing
    optional: true
    limit: 1

peers:
  peers:
    interface: cinder-peer

parts:
  update-certificates:
    plugin: nil
    override-build: |
      apt update
      apt install -y ca-certificates
      update-ca-certificates
  charm:
    after:
      - update-certificates
    build-packages:
      - git
      - libffi-dev
      - libssl-dev
      - rustc
      - cargo
      - pkg-config
    charm-binary-python-packages:
      - cryptography
      - jsonschema
      - pydantic
      - jinja2