From 0bbc4bba0fbbdbaf9109eb0ab361657ab03fb195 Mon Sep 17 00:00:00 2001 From: Nikos Date: Thu, 1 Aug 2024 12:40:15 +0300 Subject: [PATCH] refactor: migrate to charmcraft.yaml --- CONTRIBUTING.md | 2 +- charmcraft.yaml | 84 +++++++++++++++++++++++++++++++++++ config.yaml | 24 ---------- metadata.yaml | 57 ------------------------ tests/integration/conftest.py | 2 +- 5 files changed, 86 insertions(+), 83 deletions(-) delete mode 100644 config.yaml delete mode 100644 metadata.yaml diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 87a1a3c5..a0c22fe4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -65,7 +65,7 @@ juju add-model dev juju model-config logging-config="=INFO;unit=DEBUG" # Deploy the charm -juju deploy ./glauth-k8s_ubuntu-*-amd64.charm --resource oci-image=$(yq eval '.resources.oci-image.upstream-source' metadata.yaml) +juju deploy ./glauth-k8s_ubuntu-*-amd64.charm --resource oci-image=$(yq eval '.resources.oci-image.upstream-source' charmcraft.yaml) ``` ## Observability diff --git a/charmcraft.yaml b/charmcraft.yaml index 2fc7d3fe..f5240dcc 100644 --- a/charmcraft.yaml +++ b/charmcraft.yaml @@ -1,7 +1,90 @@ # This file configures Charmcraft. # See https://juju.is/docs/sdk/charmcraft-config for guidance. +name: glauth-k8s type: charm +description: | + Kubernetes Charmed Glauth Operator +summary: | + LDAP authentication provider + +links: + documentation: https://discourse.charmhub.io/t/13946 + source: https://github.com/canonical/glauth-k8s-operator + issues: https://github.com/canonical/glauth-k8s-operator/issues + +containers: + glauth: + resource: oci-image + +resources: + oci-image: + type: oci-image + description: GLAuth oci-image + upstream-source: ghcr.io/canonical/glauth:2.3.1 + +requires: + pg-database: + interface: postgresql_client + optional: false + limit: 1 + logging: + interface: loki_push_api + optional: true + certificates: + interface: tls-certificates + limit: 1 + optional: true + +provides: + metrics-endpoint: + description: | + Provides application metrics to COS Prometheus instance. + interface: prometheus_scrape + grafana-dashboard: + description: | + Forwards the built-in grafana dashboard(s) for monitoring GLAuth. + interface: grafana_dashboard + ldap: + description: | + Provides LDAP configuration data + interface: ldap + glauth-auxiliary: + description: | + Provides auxiliary data for glauth-utils charmed operator. + interface: glauth_auxiliary + send-ca-cert: + description: | + Transfer certificates to client charmed operators. + interface: certificate_transfer + +config: + options: + log_level: + description: | + Configures the log level. + + Acceptable values are: "info", "debug", "warning", "error" and "critical" + default: "info" + type: string + base_dn: + description: The base DN + default: "dc=glauth,dc=com" + type: string + hostname: + description: | + The hostname of the LDAP server. + + The hostname should NOT contain the LDAP scheme (e.g. ldap://) and port. + default: "ldap.glauth.com" + type: string + starttls_enabled: + description: | + Enable the StartTLS support or not. DO NOT TURN IT OFF IN PRODUCTION. + default: true + type: boolean + + bases: - build-on: - name: ubuntu @@ -9,6 +92,7 @@ bases: run-on: - name: ubuntu channel: "22.04" + parts: charm: charm-binary-python-packages: diff --git a/config.yaml b/config.yaml deleted file mode 100644 index 889463a3..00000000 --- a/config.yaml +++ /dev/null @@ -1,24 +0,0 @@ -options: - log_level: - description: | - Configures the log level. - - Acceptable values are: "info", "debug", "warning", "error" and "critical" - default: "info" - type: string - base_dn: - description: The base DN - default: "dc=glauth,dc=com" - type: string - hostname: - description: | - The hostname of the LDAP server. - - The hostname should NOT contain the LDAP scheme (e.g. ldap://) and port. - default: "ldap.glauth.com" - type: string - starttls_enabled: - description: | - Enable the StartTLS support or not. DO NOT TURN IT OFF IN PRODUCTION. - default: true - type: boolean diff --git a/metadata.yaml b/metadata.yaml deleted file mode 100644 index 49bfda35..00000000 --- a/metadata.yaml +++ /dev/null @@ -1,57 +0,0 @@ -# Copyright 2023 Canonical Ltd. -# See LICENSE file for licensing details. - -name: glauth-k8s - -description: | - Kubernetes Charmed Glauth Operator - -summary: | - LDAP authentication provider - -docs: https://discourse.charmhub.io/t/13946 - -containers: - glauth: - resource: oci-image - -resources: - oci-image: - type: oci-image - description: GLAuth oci-image - upstream-source: ghcr.io/canonical/glauth:2.3.1 - -requires: - pg-database: - interface: postgresql_client - optional: false - limit: 1 - logging: - interface: loki_push_api - optional: true - certificates: - interface: tls-certificates - limit: 1 - optional: true - -provides: - metrics-endpoint: - description: | - Provides application metrics to COS Prometheus instance. - interface: prometheus_scrape - grafana-dashboard: - description: | - Forwards the built-in grafana dashboard(s) for monitoring GLAuth. - interface: grafana_dashboard - ldap: - description: | - Provides LDAP configuration data - interface: ldap - glauth-auxiliary: - description: | - Provides auxiliary data for glauth-utils charmed operator. - interface: glauth_auxiliary - send-ca-cert: - description: | - Transfer certificates to client charmed operators. - interface: certificate_transfer diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py index 7e09d696..8b855b53 100644 --- a/tests/integration/conftest.py +++ b/tests/integration/conftest.py @@ -12,7 +12,7 @@ from cryptography.hazmat.backends import default_backend from pytest_operator.plugin import OpsTest -METADATA = yaml.safe_load(Path("./metadata.yaml").read_text()) +METADATA = yaml.safe_load(Path("./charmcraft.yaml").read_text()) CERTIFICATE_PROVIDER_APP = "self-signed-certificates" DB_APP = "postgresql-k8s" GLAUTH_APP = METADATA["name"]