Skip to content

Commit

Permalink
chore: Changes name to httprequest-lego-k8s (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
gruyaume committed Dec 6, 2023
1 parent 6746473 commit 942f923
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 27 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
if: ${{ github.event_name == 'push' }}
with:
name: tested-charm
path: .tox/**/httpreq-acme-operator_ubuntu-22.04-amd64.charm
path: .tox/**/httprequest-lego-k8s_ubuntu-22.04-amd64.charm
retention-days: 5
- name: Archive charmcraft logs
if: failure()
Expand Down Expand Up @@ -93,7 +93,7 @@ jobs:
with:
name: tested-charm
- name: Move charm in current directory
run: find ./ -name httpreq-acme-operator_ubuntu-22.04-amd64.charm -exec mv -t ./ {} \;
run: find ./ -name httprequest-lego-k8s_ubuntu-22.04-amd64.charm -exec mv -t ./ {} \;
- name: Select Charmhub channel
uses: canonical/charming-actions/[email protected]
id: channel
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# httpreq ACME Operator (K8s)
[![CharmHub Badge](https://charmhub.io/httpreq-acme-operator/badge.svg)](https://charmhub.io/httpreq-acme-operator)
# httpreq LEGO Operator (K8s)
[![CharmHub Badge](https://charmhub.io/httprequest-lego-k8s/badge.svg)](https://charmhub.io/httprequest-lego-k8s)

ACME operator implementing the provider side of the `tls-certificates`
LEGO operator implementing the provider side of the `tls-certificates`
interface to get signed certificates from the `Let's Encrypt` ACME server
using the HTTP Request plugin for DNS-01 challenge.

Expand All @@ -20,21 +20,21 @@ provided to as a configuration to this operator.
Create a YAML configuration file with the following fields:

```yaml
httpreq-acme-operator:
httprequest-lego-k8s:
email: <Account email address>
httpreq_endpoint: <HTTP/HTTPS URL>
```

Deploy `httpreq-acme-operator`:
Deploy `httprequest-lego-k8s`:

```bash
juju deploy httpreq-acme-operator --config <yaml config file>
juju deploy httprequest-lego-k8s --config <yaml config file>
```

Relate it to a `tls-certificates-requirer` charm:

```bash
juju relate httpreq-acme-operator:certificates <tls-certificates-requirer>
juju relate httprequest-lego-k8s:certificates <tls-certificates-requirer>
````

## Config
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
# Copyright 2023 Canonical Ltd.
# See LICENSE file for licensing details.

"""# acme_client Library.
"""# lego_client Library.
This library is designed to enable developers to easily create new charms for the ACME protocol.
This library contains all the logic necessary to get certificates from an ACME server.
## Getting Started
To get started using the library, you need to fetch the library using `charmcraft`.
```shell
charmcraft fetch-lib charms.acme_client_operator.v0.acme_client
charmcraft fetch-lib charms.lego_client_operator.v0.lego_client
```
You will also need to add the following library to the charm's `requirements.txt` file:
- jsonschema
- cryptography
Then, to use the library in an example charm, you can do the following:
```python
from charms.acme_client_operator.v0.acme_client import AcmeClient
from charms.lego_client_operator.v0.lego_client import AcmeClient
from ops.main import main
class ExampleAcmeCharm(AcmeClient):
def __init__(self, *args):
Expand Down Expand Up @@ -78,14 +78,15 @@ def _plugin_config(self):
from ops.pebble import ExecError

# The unique Charmhub library identifier, never change it
LIBID = "b3c9913b68dc42b89dfd0e77ac57236d"
LIBID = "d67f92a288e54ab68a6b6349e9b472c4"

# Increment this major API version when introducing breaking changes
LIBAPI = 0

# Increment this PATCH version before using `charmcraft publish-lib` or reset
# to 0 if you are raising the major API version
LIBPATCH = 3
LIBPATCH = 1


logger = logging.getLogger(__name__)

Expand Down
14 changes: 7 additions & 7 deletions metadata.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
# Copyright 2023 Canonical Ltd.
# See LICENSE file for licensing details.

name: httpreq-acme-operator
name: httprequest-lego-k8s

display-name: HTTP Request ACME Operator
display-name: HTTP Request LEGO (K8s)

description: |
ACME operator implementing the provider side of the `tls-certificates`
LEGO operator implementing the provider side of the `tls-certificates`
interface to get signed certificates from the `Let's Encrypt` ACME server
using the HTTP Request plugin for DNS-01 challenge.
summary: |
ACME operator implementing the provider side of the `tls-certificates`
LEGO operator implementing the provider side of the `tls-certificates`
interface to get signed certificates from the `Let's Encrypt` ACME server
using the HTTP Request plugin for DNS-01 challenge.
website: https://charmhub.io/httpreq-acme-operator
source: https://github.com/canonical/httpreq-acme-operator
issues: https://github.com/canonical/httpreq-acme-operator/issues
website: https://charmhub.io/httprequest-lego-k8s
source: https://github.com/canonical/httprequest-lego-k8s-operator
issues: https://github.com/canonical/httprequest-lego-k8s-operator/issues
docs: https://discourse.charmhub.io/t/http-request-acme-operator-docs-index/12513

provides:
Expand Down
8 changes: 4 additions & 4 deletions src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@
from typing import Dict
from urllib.parse import urlparse

from charms.acme_client_operator.v0.acme_client import AcmeClient # type: ignore[import]
from charms.lego_base_k8s.v0.lego_client import AcmeClient # type: ignore[import]
from ops.main import main
from ops.model import ActiveStatus, BlockedStatus

logger = logging.getLogger(__name__)


class HTTPReqAcmeOperatorCharm(AcmeClient):
class HTTPRequestLegoK8s(AcmeClient):
"""Main class that is instantiated every time an event occurs."""

def __init__(self, *args):
"""Uses the acme_client library to manage events."""
"""Uses the lego_client library to manage events."""
super().__init__(*args, plugin="httpreq")
self.framework.observe(self.on.config_changed, self._on_config_changed)

Expand Down Expand Up @@ -109,4 +109,4 @@ def _validate_httpreq_config(self) -> bool:


if __name__ == "__main__": # pragma: nocover
main(HTTPReqAcmeOperatorCharm)
main(HTTPRequestLegoK8s)
4 changes: 2 additions & 2 deletions tests/unit/test_charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
from ops.testing import Harness
from parameterized import parameterized # type: ignore[import]

from charm import HTTPReqAcmeOperatorCharm
from charm import HTTPRequestLegoK8s


class TestCharm(unittest.TestCase):
def setUp(self):
self.harness = Harness(HTTPReqAcmeOperatorCharm)
self.harness = Harness(HTTPRequestLegoK8s)
self.addCleanup(self.harness.cleanup)
self.harness.begin()

Expand Down

0 comments on commit 942f923

Please sign in to comment.