Skip to content

Commit

Permalink
Merge pull request #19 from canonical/IAM-575
Browse files Browse the repository at this point in the history
feat: ldap & auxiliary interface integration and some improvements
  • Loading branch information
wood-push-melon authored Jan 17, 2024
2 parents 19441a5 + a3ba848 commit 20ca07e
Show file tree
Hide file tree
Showing 27 changed files with 1,063 additions and 310 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/release_libs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Release Charm Library

on:
push:
branches:
- main
paths:
- "lib/charms/glauth_k8s/**"

jobs:
release-libs:
name: Release charm library
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Release charm library
uses: canonical/charming-actions/release-libraries@main
with:
credentials: ${{ secrets.CHARMCRAFT_CREDENTIALS }}
github-token: ${{ secrets.GITHUB_TOKEN }}
26 changes: 26 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-added-large-files
- id: debug-statements
- id: detect-private-key
- id: end-of-file-fixer
- id: requirements-txt-fixer
- id: trailing-whitespace
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.13
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- repo: https://github.com/psf/black
rev: 23.12.1
hooks:
- id: black
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
hooks:
- id: mypy
args: ["--config-file", "pyproject.toml"]
additional_dependencies:
- types-PyYAML
1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @canonical/identity
23 changes: 12 additions & 11 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,22 @@ this operator.

## Developing

You can use the environments created by `tox` for development:
You can use the environments created by `tox` for development. It helps
install `pre-commit` and `mypy` type checker.

```shell
tox --notest -e unit
source .tox/unit/bin/activate
$ tox -e dev
$ source .tox/unit/bin/activate
```

## Testing

```shell
tox -e fmt # update your code according to linting rules
tox -e lint # code style
tox -e unit # unit tests
tox -e integration # integration tests
tox # runs 'fmt', 'lint', and 'unit' environments
$ tox -e fmt # update your code according to linting rules
$ tox -e lint # code style
$ tox -e unit # unit tests
$ tox -e integration # integration tests
$ tox # runs 'fmt', 'lint', and 'unit' environments
```

## Build the charm
Expand All @@ -58,13 +59,13 @@ $ charmcraft pack

```shell
# Create a juju model
juju add-model dev
$ juju add-model dev

# Enable DEBUG logging
juju model-config logging-config="<root>=INFO;unit=DEBUG"
$ juju model-config logging-config="<root>=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' metadata.yaml)
```

## Observability
Expand Down
48 changes: 44 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
![Ubuntu](https://img.shields.io/badge/Ubuntu-22.04-E95420?label=Ubuntu&logo=ubuntu&logoColor=white)
[![License](https://img.shields.io/github/license/canonical/glauth-k8s-operator?label=License)](https://github.com/canonical/glauth-k8s-operator/blob/main/LICENSE)

[![Continuous Integration Status](https://github.com/canonical/glauth-k8s-operator/actions/workflows/on_push.yaml/badge.svg?branch=main)](https://github.com/canonical/glauth-k8s-operator/actions?query=branch%3Amain)
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)

This repository holds the Juju Kubernetes charmed operator
for [GLAuth](https://github.com/glauth/glauth), an open-sourced LDAP server.

Expand All @@ -29,15 +32,52 @@ $ juju integrate glauth-k8s postgresql-k8s

## Integrations

TBD.
### `postgresql_client` Integration

The `glauth-k8s` charmed operator requires the integration with the
`postgres-k8s` charmed operator following the [`postgresql_client` interface
protocol](https://github.com/canonical/charm-relation-interfaces/tree/main/interfaces/postgresql_client/v0).

```shell
$ juju integrate glauth-k8s postgresql-k8s
```

### `ldap` Integration

The `glauth-k8s` charmed operator offers the `ldap` integration with any
LDAP client charmed operator following
the [`ldap` interface protocol](https://github.com/canonical/charm-relation-interfaces/tree/main/interfaces/ldap/v0).

```shell
$ juju integrate <ldap-client-charm>:ldap glauth-k8s:ldap
```

### `glauth_auxiliary` Integration

The `glauth-k8s` charmed operator provides the `glauth_auxiliary`
integration with
the [`glauth-utils` charmed operator](https://github.com/canonical/glauth-utils)
to deliver necessary auxiliary configurations.

```shell
$ juju integrate glauth-k8s glauth-utils
```

## Configurations

TBD.
The `glauth-k8s` charmed operator offers the following charm configuration
options.

## Actions
| Charm Config Option | Description | Example |
|:-------------------:|------------------------------------------------------------------|------------------------------------------------------|
| `base_dn` | The portion of the DIT in which to search for matching entries | `juju config <charm-app> base-dn="dc=glauth,dc=com"` |
| `hostname` | The hostname of the LDAP server in `glauth-k8s` charmed operator | `juju config <charm-app> hostname="ldap.glauth.com"` |

TBD.
> ⚠️ **NOTE**
>
> - The `hostname` should **NOT** contain the ldap scheme (e.g. `ldap://`) and
> port.
> - Please refer to the `config.yaml` for more details about the configurations.
## Contributing

Expand Down
11 changes: 9 additions & 2 deletions config.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
options:
log_level:
description: |
Configures the log level.
Configures the log level.
Acceptable values are: "info", "debug", "warning", "error" and "critical"
default: "info"
type: string
base_dn:
description: 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
2 changes: 1 addition & 1 deletion fmt-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
black
isort
ruff
6 changes: 2 additions & 4 deletions integration-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
protobuf~=3.20.1
pytest
-r requirements.txt
juju
pytest
pytest-operator
requests
-r requirements.txt
Loading

0 comments on commit 20ca07e

Please sign in to comment.