# Copyright 2020 Canonical Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
#     Unless required by applicable law or agreed to in writing, software
#     distributed under the License is distributed on an "AS IS" BASIS,
#     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#     See the License for the specific language governing permissions and
#     limitations under the License.
description: A high-available OSM cluster.
bundle: kubernetes
applications:
  zookeeper-k8s:
    charm: "cs:~charmed-osm/zookeeper-k8s"
    channel: "stable"
    scale: 3
    series: kubernetes
    storage:
      database: 100M
    options:
      # client-port: 2181
      server-port: 2888
      leader-election-port: 3888
      zookeeper-units: 3
    annotations:
      gui-x: 0
      gui-y: 550
  mariadb-k8s:
    charm: "cs:~charmed-osm/mariadb-k8s"
    channel: "stable"
    scale: 3
    series: kubernetes
    storage:
      database: 300M
    options:
      password: manopw
      root_password: osm4u
      user: mano
      database: database
      mysql_port: "3306"
      query-cache-type: "OFF"
      query-cache-size: 0
      ha-mode: true
    annotations:
      gui-x: -250
      gui-y: -200
  kafka-k8s:
    charm: "cs:~charmed-osm/kafka-k8s"
    channel: "stable"
    scale: 3
    series: kubernetes
    storage:
      database: 200M
    options:
      advertised-hostname: "kafka-k8s"
      advertised-port: 9092
      kafka-units: 3
      zookeeper-units: 3
      zookeeper-service-name: zookeeper-k8s-endpoints
    annotations:
      gui-x: 0
      gui-y: 300
  mongodb-k8s:
    charm: "cs:~charmed-osm/mongodb-k8s"
    channel: "stable"
    scale: 3
    series: kubernetes
    storage:
      database: 300M
    options:
      advertised-port: 27017
      replica-set: rs0
      namespace: osm
      service-name: mongodb-k8s-endpoints
      cluster-domain: cluster.local
      enable-sidecar: true
    annotations:
      gui-x: 0
      gui-y: 50
  nbi-k8s:
    charm: "%(prefix)s/nbi-k8s%(suffix)s"
    scale: 3
    series: kubernetes
    storage:
      packages: 100M
    options:
      log_level: "INFO"
      DATABASE_COMMONKEY: osm
      auth-backend: keystone
    annotations:
      gui-x: 0
      gui-y: -200
  ro-k8s:
    charm: "%(prefix)s/ro-k8s%(suffix)s"
    scale: 3
    series: kubernetes
    storage:
      log: 50M
    options:
      vim_database: "mano_vim_db"
      ro_database: "mano_db"
      OPENMANO_TENANT: "osm"
    annotations:
      gui-x: -250
      gui-y: 300
  ng-ui:
    charm: "%(prefix)s/ng-ui%(suffix)s"
    scale: 3
    series: kubernetes
    options:
      port: 80
      https_port: 443
      server_name: localhost
      client_max_body_size: 15M
    annotations:
      gui-x: 500
      gui-y: 100
  lcm-k8s:
    charm: "%(prefix)s/lcm-k8s%(suffix)s"
    scale: 3
    series: kubernetes
    storage:
      packages: 100M
    options:
      vca_host: vca
      vca_port: 17070
      vca_user: admin
      vca_password: secret
      vca_pubkey: pubkey
      vca_cacert: cacert
      use_external_vca: true
      DATABASE_COMMONKEY: osm
    annotations:
      gui-x: -250
      gui-y: 50
  mon-k8s:
    charm: "%(prefix)s/mon-k8s%(suffix)s"
    scale: 1
    series: kubernetes
    storage:
      database: 100M
    options:
      OSMMON_OPENSTACK_DEFAULT_GRANULARITY: 300
      OSMMON_GLOBAL_REQUEST_TIMEOUT: 10
      OSMMON_GLOBAL_LOGLEVEL: INFO
      OSMMON_DATABASE_COMMONKEY: osm
      OSMMON_COLLECTOR_INTERVAL: 30
      OSMMON_EVALUATOR_INTERVAL: 30
      vca_host: vca
      vca_user: admin
      vca_password: secret
      vca_cacert: cacert
      use_external_vca: true
    annotations:
      gui-x: 250
      gui-y: 50
  pol-k8s:
    charm: "%(prefix)s/pol-k8s%(suffix)s"
    scale: 3
    series: kubernetes
    storage:
      database: 100M
    options:
      log_level: INFO
    annotations:
      gui-x: -250
      gui-y: 550
  pla:
    charm: "%(prefix)s/pla%(suffix)s"
    scale: 3
    series: kubernetes
    annotations:
      gui-x: 500
      gui-y: -200
  prometheus-k8s:
    charm: "cs:~charmed-osm/prometheus-k8s"
    channel: "stable"
    scale: 1
    series: kubernetes
    storage:
      database: 100M
    options:
      advertised-port: 9090
      web-subpath: /
      default-target: "mon-k8s:8000"
    annotations:
      gui-x: 250
      gui-y: 300
  grafana-k8s:
    charm: "cs:~charmed-osm/grafana-k8s"
    channel: "stable"
    scale: 3
    series: kubernetes
    annotations:
      gui-x: 250
      gui-y: 550
  keystone:
    charm: '%(prefix)s/keystone%(suffix)s'
    channel: '%(channel)s'
    scale: 1
    series: kubernetes
    annotations:
      gui-x: -250
      gui-y: 550

relations:
  - - "kafka-k8s:zookeeper"
    - "zookeeper-k8s:zookeeper"
  - - "ro-k8s:mysql"
    - "mariadb-k8s:mysql"
  - - "nbi-k8s:mongo"
    - "mongodb-k8s:mongo"
  - - "nbi-k8s:kafka"
    - "kafka-k8s:kafka"
  - - "lcm-k8s:kafka"
    - "kafka-k8s:kafka"
  - - "lcm-k8s:mongo"
    - "mongodb-k8s:mongo"
  - - "mon-k8s:kafka"
    - "kafka-k8s:kafka"
  - - "mon-k8s:mongo"
    - "mongodb-k8s:mongo"
  - - "pol-k8s:kafka"
    - "kafka-k8s:kafka"
  - - "pol-k8s:mongo"
    - "mongodb-k8s:mongo"
  - - "lcm-k8s:ro"
    - "ro-k8s:ro"
  - - "prometheus-k8s:prometheus"
    - "mon-k8s:prometheus"
  - - "grafana-k8s:prometheus"
    - "prometheus-k8s:prometheus"
  - - "prometheus-k8s:prometheus"
    - "nbi-k8s:prometheus"
  - - "pla:kafka"
    - "kafka-k8s:kafka"
  - - "pla:mongo"
    - "mongodb-k8s:mongo"
  - - 'ng-ui:nbi'
    - 'nbi-k8s:nbi'
  - - 'keystone:db'
    - 'mariadb-k8s:mysql'
  - - 'keystone:keystone'
    - 'nbi-k8s:keystone'
  - - "ro-k8s:mongo"
    - "mongodb-k8s:mongo"
  - - "ro-k8s:kafka"
    - "kafka-k8s:kafka"
