Skip to content

Commit

Permalink
Merge pull request #53 from canonical/IAM-961
Browse files Browse the repository at this point in the history
Migrate to charmcraft.yaml
  • Loading branch information
nsklikas authored Aug 5, 2024
2 parents 2eea978 + 9ee8459 commit f3a71ba
Show file tree
Hide file tree
Showing 10 changed files with 84 additions and 78 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ jobs:
with:
provider: microk8s
channel: 1.28-strict/stable
juju-channel: 3.2
bootstrap-options: '--agent-version=3.2.0'
juju-channel: 3.4
lxd-channel: 5.20/stable

- name: Run integration tests
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ juju integrate postgresql-k8s:database openfga-k8s
#### `openfga` interface

Current charm provides a library for the `openfga` integration interface. Your
application should define an interface in `metadata.yaml`:
application should define an interface in `charmcraft.yaml`:

```yaml
requires:
Expand Down
7 changes: 0 additions & 7 deletions actions.yaml

This file was deleted.

79 changes: 78 additions & 1 deletion charmcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,94 @@
# This file configures Charmcraft.
# See https://juju.is/docs/sdk/charmcraft-config for guidance.

name: openfga-k8s
type: charm
title: OpenFGA
summary: A high-performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar.
description: |
A high-performance and flexible authorization/permission engine
built for developers and inspired by Google Zanzibar.
OpenFGA is designed to make it easy for developers to model
their application permissions and add and integrate fine-grained
authorization into their applications.
It allows in-memory data storage for quick development, as well
as pluggable database modules. It currently supports PostgreSQL
and MySQL.
It offers an HTTP API and a gRPC API. It has SDKs for
Node.js/JavaScript, GoLang, Python and .NET. Look in our
Community section for third-party SDKs and tools.
links:
documentation: https://discourse.charmhub.io/t/openfga-k8s-docs-index/13826
website: https://github.com/canonical/openfga-operator
source: https://github.com/canonical/openfga-operator
issues: https://github.com/canonical/openfga-operator/issues

peers:
peer:
interface: openfga-peer

provides:
openfga:
interface: openfga
grafana-dashboard:
interface: grafana_dashboard
metrics-endpoint:
interface: prometheus_scrape

requires:
http-ingress:
interface: ingress
limit: 1
grpc-ingress:
interface: ingress
limit: 1
database:
interface: postgresql_client
limit: 1
log-proxy:
interface: loki_push_api
optional: true
limit: 1

containers:
openfga:
resource: oci-image

resources:
oci-image:
type: oci-image
description: OCI image for OpenFGA
upstream-source: ghcr.io/canonical/openfga:1.5.2

config:
options:
log-level:
description: |
Configures the log level of gunicorn.
Acceptable values are: "info", "debug", "warning", "error" and "critical"
default: "info"
type: string

actions:
schema-upgrade:
description: Upgrade the application database schema.

parts:
charm:
charm-python-packages:
charm-python-packages:
- setuptools
charm-binary-python-packages:
- requests >= 2.25.1
- jsonschema >= 3.2.0
- cryptography >= 3.4.8
- lightkube
- lightkube-models

bases:
- build-on:
- name: ubuntu
Expand Down
8 changes: 0 additions & 8 deletions config.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion integration-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pytest
juju
pytest-operator==0.31.1
pytest-operator==0.35.0
-r requirements.txt
54 changes: 0 additions & 54 deletions metadata.yaml

This file was deleted.

1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@ requests == 2.31.0
jsonschema==4.21.1
cryptography >= 3.4.8
lightkube===0.15.0
lightkube-models==1.29.0.6
pydantic<2.0
4 changes: 2 additions & 2 deletions tests/integration/test_charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

logger = logging.getLogger(__name__)

METADATA = yaml.safe_load(Path("./metadata.yaml").read_text())
METADATA = yaml.safe_load(Path("./charmcraft.yaml").read_text())
OPENFGA_APP = "openfga"
TRAEFIK_CHARM = "traefik-k8s"
TRAEFIK_GRPC_APP = "traefik-grpc"
Expand All @@ -40,7 +40,7 @@ async def test_build_and_deploy(ops_test: OpsTest, charm: str, test_charm: str)
charm, resources=resources, application_name=OPENFGA_APP, series="jammy", trust=True
),
ops_test.model.deploy(
"postgresql-k8s", application_name="postgresql", channel="edge", trust=True
"postgresql-k8s", application_name="postgresql", channel="14/stable", trust=True
),
ops_test.model.deploy(
test_charm,
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

logger = logging.getLogger(__name__)

METADATA = yaml.safe_load(Path("./metadata.yaml").read_text())
METADATA = yaml.safe_load(Path("./charmcraft.yaml").read_text())
APP_NAME = "openfga"


Expand Down

0 comments on commit f3a71ba

Please sign in to comment.