Skip to content

Commit 0f7a2df

Browse files
[MISC] Disable juju 3.6 tests (#809)
* Update data-platform-workflows to v24 * Bump libs * Disable 3.6 tests * Latest dpw --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
1 parent 6c51da3 commit 0f7a2df

File tree

9 files changed

+45
-175
lines changed

9 files changed

+45
-175
lines changed

.github/workflows/ci.yaml

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ on:
2323
jobs:
2424
lint:
2525
name: Lint
26-
uses: canonical/data-platform-workflows/.github/workflows/lint.yaml@v23.1.1
26+
uses: canonical/data-platform-workflows/.github/workflows/lint.yaml@v24.0.5
2727

2828
unit-test:
2929
name: Unit test charm
@@ -45,7 +45,7 @@ jobs:
4545

4646
build:
4747
name: Build charm
48-
uses: canonical/data-platform-workflows/.github/workflows/build_charm.yaml@v23.1.1
48+
uses: canonical/data-platform-workflows/.github/workflows/build_charm.yaml@v24.0.5
4949
with:
5050
cache: true
5151

@@ -59,32 +59,25 @@ jobs:
5959
allure_on_amd64: false
6060
- agent: 3.4.6 # renovate: juju-agent-pin-minor
6161
allure_on_amd64: true
62-
- snap_channel: 3.6/stable
63-
allure_on_amd64: false
6462
architecture:
6563
- amd64
6664
include:
6765
- juju:
6866
agent: 3.4.6 # renovate: juju-agent-pin-minor
6967
allure_on_amd64: true
7068
architecture: arm64
71-
- juju:
72-
snap_channel: 3.6/stable
73-
allure_on_amd64: false
74-
architecture: arm64
75-
name: Integration | ${{ matrix.juju.agent || matrix.juju.snap_channel }} | ${{ matrix.architecture }}
69+
name: Integration | ${{ matrix.juju.agent }} | ${{ matrix.architecture }}
7670
needs:
7771
- lint
7872
- unit-test
7973
- build
80-
uses: canonical/data-platform-workflows/.github/workflows/integration_test_charm.yaml@v23.1.1
74+
uses: canonical/data-platform-workflows/.github/workflows/integration_test_charm.yaml@v24.0.5
8175
with:
8276
artifact-prefix: ${{ needs.build.outputs.artifact-prefix }}
8377
architecture: ${{ matrix.architecture }}
8478
cloud: microk8s
8579
microk8s-snap-channel: 1.32-strict/stable # renovate: latest microk8s
8680
juju-agent-version: ${{ matrix.juju.agent }}
87-
juju-snap-channel: ${{ matrix.juju.snap_channel }}
8881
libjuju-version-constraint: ${{ matrix.juju.libjuju }}
8982
_beta_allure_report: ${{ matrix.juju.allure_on_amd64 && matrix.architecture == 'amd64' }}
9083
secrets:

.github/workflows/release.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@ jobs:
4242

4343
build:
4444
name: Build charm
45-
uses: canonical/data-platform-workflows/.github/workflows/build_charm.yaml@v23.1.1
45+
uses: canonical/data-platform-workflows/.github/workflows/build_charm.yaml@v24.0.5
4646

4747
release:
4848
name: Release charm
4949
needs:
5050
- ci-tests
5151
- build
52-
uses: canonical/data-platform-workflows/.github/workflows/release_charm.yaml@v23.1.1
52+
uses: canonical/data-platform-workflows/.github/workflows/release_charm.yaml@v24.0.5
5353
with:
5454
channel: 14/edge
5555
artifact-prefix: ${{ needs.build.outputs.artifact-prefix }}

.github/workflows/sync_docs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
jobs:
1111
sync-docs:
1212
name: Sync docs from Discourse
13-
uses: canonical/data-platform-workflows/.github/workflows/sync_docs.yaml@v23.1.1
13+
uses: canonical/data-platform-workflows/.github/workflows/sync_docs.yaml@v24.0.5
1414
with:
1515
reviewers: a-velasco
1616
permissions:

charmcraft.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ parts:
2020
2121
# Convert subset of poetry.lock to requirements.txt
2222
curl -sSL https://install.python-poetry.org | python3 -
23+
/root/.local/bin/poetry self add poetry-plugin-export
2324
/root/.local/bin/poetry export --only main,charm-libs --output requirements.txt
2425
2526
craftctl default

lib/charms/observability_libs/v1/kubernetes_service_patch.py

Lines changed: 13 additions & 141 deletions
Original file line numberDiff line numberDiff line change
@@ -1,146 +1,13 @@
11
# Copyright 2021 Canonical Ltd.
22
# See LICENSE file for licensing details.
33

4-
"""# KubernetesServicePatch Library.
5-
6-
This library is designed to enable developers to more simply patch the Kubernetes Service created
7-
by Juju during the deployment of a sidecar charm. When sidecar charms are deployed, Juju creates a
8-
service named after the application in the namespace (named after the Juju model). This service by
9-
default contains a "placeholder" port, which is 65535/TCP.
10-
11-
When modifying the default set of resources managed by Juju, one must consider the lifecycle of the
12-
charm. In this case, any modifications to the default service (created during deployment), will be
13-
overwritten during a charm upgrade.
14-
15-
When initialised, this library binds a handler to the parent charm's `install` and `upgrade_charm`
16-
events which applies the patch to the cluster. This should ensure that the service ports are
17-
correct throughout the charm's life.
18-
19-
The constructor simply takes a reference to the parent charm, and a list of
20-
[`lightkube`](https://github.com/gtsystem/lightkube) ServicePorts that each define a port for the
21-
service. For information regarding the `lightkube` `ServicePort` model, please visit the
22-
`lightkube` [docs](https://gtsystem.github.io/lightkube-models/1.23/models/core_v1/#serviceport).
23-
24-
Optionally, a name of the service (in case service name needs to be patched as well), labels,
25-
selectors, and annotations can be provided as keyword arguments.
26-
27-
## Getting Started
28-
29-
To get started using the library, you just need to fetch the library using `charmcraft`. **Note
30-
that you also need to add `lightkube` and `lightkube-models` to your charm's `requirements.txt`.**
31-
32-
```shell
33-
cd some-charm
34-
charmcraft fetch-lib charms.observability_libs.v1.kubernetes_service_patch
35-
cat << EOF >> requirements.txt
36-
lightkube
37-
lightkube-models
38-
EOF
39-
```
40-
41-
Then, to initialise the library:
42-
43-
For `ClusterIP` services:
44-
45-
```python
46-
# ...
47-
from charms.observability_libs.v1.kubernetes_service_patch import KubernetesServicePatch
48-
from lightkube.models.core_v1 import ServicePort
49-
50-
class SomeCharm(CharmBase):
51-
def __init__(self, *args):
52-
# ...
53-
port = ServicePort(443, name=f"{self.app.name}")
54-
self.service_patcher = KubernetesServicePatch(self, [port])
55-
# ...
56-
```
57-
58-
For `LoadBalancer`/`NodePort` services:
59-
60-
```python
61-
# ...
62-
from charms.observability_libs.v1.kubernetes_service_patch import KubernetesServicePatch
63-
from lightkube.models.core_v1 import ServicePort
64-
65-
class SomeCharm(CharmBase):
66-
def __init__(self, *args):
67-
# ...
68-
port = ServicePort(443, name=f"{self.app.name}", targetPort=443, nodePort=30666)
69-
self.service_patcher = KubernetesServicePatch(
70-
self, [port], "LoadBalancer"
71-
)
72-
# ...
73-
```
74-
75-
Port protocols can also be specified. Valid protocols are `"TCP"`, `"UDP"`, and `"SCTP"`
76-
77-
```python
78-
# ...
79-
from charms.observability_libs.v1.kubernetes_service_patch import KubernetesServicePatch
80-
from lightkube.models.core_v1 import ServicePort
81-
82-
class SomeCharm(CharmBase):
83-
def __init__(self, *args):
84-
# ...
85-
tcp = ServicePort(443, name=f"{self.app.name}-tcp", protocol="TCP")
86-
udp = ServicePort(443, name=f"{self.app.name}-udp", protocol="UDP")
87-
sctp = ServicePort(443, name=f"{self.app.name}-sctp", protocol="SCTP")
88-
self.service_patcher = KubernetesServicePatch(self, [tcp, udp, sctp])
89-
# ...
90-
```
91-
92-
Bound with custom events by providing `refresh_event` argument:
93-
For example, you would like to have a configurable port in your charm and want to apply
94-
service patch every time charm config is changed.
95-
96-
```python
97-
from charms.observability_libs.v1.kubernetes_service_patch import KubernetesServicePatch
98-
from lightkube.models.core_v1 import ServicePort
99-
100-
class SomeCharm(CharmBase):
101-
def __init__(self, *args):
102-
# ...
103-
port = ServicePort(int(self.config["charm-config-port"]), name=f"{self.app.name}")
104-
self.service_patcher = KubernetesServicePatch(
105-
self,
106-
[port],
107-
refresh_event=self.on.config_changed
108-
)
109-
# ...
110-
```
111-
112-
Creating a new k8s lb service instead of patching the one created by juju
113-
Service name is optional. If not provided, it defaults to {app_name}-lb.
114-
If provided and equal to app_name, it also defaults to {app_name}-lb to prevent conflicts with the Juju default service.
115-
```python
116-
from charms.observability_libs.v1.kubernetes_service_patch import KubernetesServicePatch
117-
from lightkube.models.core_v1 import ServicePort
118-
119-
class SomeCharm(CharmBase):
120-
def __init__(self, *args):
121-
# ...
122-
port = ServicePort(int(self.config["charm-config-port"]), name=f"{self.app.name}")
123-
self.service_patcher = KubernetesServicePatch(
124-
self,
125-
[port],
126-
service_type="LoadBalancer",
127-
service_name="application-lb"
128-
)
129-
# ...
130-
```
131-
132-
Additionally, you may wish to use mocks in your charm's unit testing to ensure that the library
133-
does not try to make any API calls, or open any files during testing that are unlikely to be
134-
present, and could break your tests. The easiest way to do this is during your test `setUp`:
135-
136-
```python
137-
# ...
138-
139-
@patch("charm.KubernetesServicePatch", lambda x, y: None)
140-
def setUp(self, *unused):
141-
self.harness = Harness(SomeCharm)
142-
# ...
143-
```
4+
"""# [DEPRECATED!] KubernetesServicePatch Library.
5+
6+
The `kubernetes_service_patch` library is DEPRECATED and will be removed in October 2025.
7+
8+
For patching the Kubernetes service created by Juju during the deployment of a charm,
9+
`ops.Unit.set_ports` functionality should be used instead.
10+
14411
"""
14512

14613
import logging
@@ -167,7 +34,7 @@ def setUp(self, *unused):
16734

16835
# Increment this PATCH version before using `charmcraft publish-lib` or reset
16936
# to 0 if you are raising the major API version
170-
LIBPATCH = 12
37+
LIBPATCH = 13
17138

17239
ServiceType = Literal["ClusterIP", "LoadBalancer"]
17340

@@ -205,6 +72,11 @@ def __init__(
20572
will be observed to re-apply the patch (e.g. on port change).
20673
The `install` and `upgrade-charm` events would be observed regardless.
20774
"""
75+
logger.warning(
76+
"The ``kubernetes_service_patch v1`` library is DEPRECATED and will be removed "
77+
"in October 2025. For patching the Kubernetes service created by Juju during "
78+
"the deployment of a charm, ``ops.Unit.set_ports`` functionality should be used instead."
79+
)
20880
super().__init__(charm, "kubernetes-service-patch")
20981
self.charm = charm
21082
self.service_name = service_name or self._app

lib/charms/tempo_coordinator_k8s/v0/tracing.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def __init__(self, *args):
110110

111111
# Increment this PATCH version before using `charmcraft publish-lib` or reset
112112
# to 0 if you are raising the major API version
113-
LIBPATCH = 3
113+
LIBPATCH = 4
114114

115115
PYDEPS = ["pydantic"]
116116

@@ -891,13 +891,15 @@ def _get_endpoint(
891891
filter(lambda i: i.protocol.name == protocol, app_data.receivers)
892892
)
893893
if not receivers:
894-
logger.error(f"no receiver found with protocol={protocol!r}")
894+
# it can happen if the charm requests tracing protocols, but the relay (such as grafana-agent) isn't yet
895+
# connected to the tracing backend. In this case, it's not an error the charm author can do anything about
896+
logger.warning(f"no receiver found with protocol={protocol!r}.")
895897
return
896898
if len(receivers) > 1:
897-
logger.error(
899+
# if we have more than 1 receiver that matches, it shouldn't matter which receiver we'll be using.
900+
logger.warning(
898901
f"too many receivers with protocol={protocol!r}; using first one. Found: {receivers}"
899902
)
900-
return
901903

902904
receiver = receivers[0]
903905
return receiver.url

lib/charms/tls_certificates_interface/v2/tls_certificates.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ def _on_all_certificates_invalidated(self, event: AllCertificatesInvalidatedEven
307307

308308
# Increment this PATCH version before using `charmcraft publish-lib` or reset
309309
# to 0 if you are raising the major API version
310-
LIBPATCH = 28
310+
LIBPATCH = 29
311311

312312
PYDEPS = ["cryptography", "jsonschema"]
313313

@@ -459,7 +459,7 @@ def restore(self, snapshot: dict):
459459
class CertificateExpiringEvent(EventBase):
460460
"""Charm Event triggered when a TLS certificate is almost expired."""
461461

462-
def __init__(self, handle, certificate: str, expiry: str):
462+
def __init__(self, handle: Handle, certificate: str, expiry: str):
463463
"""CertificateExpiringEvent.
464464
465465
Args:

poetry.lock

Lines changed: 12 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,11 @@ optional = true
6464
[tool.poetry.group.integration.dependencies]
6565
lightkube = "^0.15.5"
6666
pytest = "^8.3.3"
67-
pytest-github-secrets = {git = "https://github.com/canonical/data-platform-workflows", tag = "v23.1.1", subdirectory = "python/pytest_plugins/github_secrets"}
67+
pytest-github-secrets = {git = "https://github.com/canonical/data-platform-workflows", tag = "v24.0.5", subdirectory = "python/pytest_plugins/github_secrets"}
6868
pytest-operator = "^0.38.0"
69-
pytest-operator-cache = {git = "https://github.com/canonical/data-platform-workflows", tag = "v23.1.1", subdirectory = "python/pytest_plugins/pytest_operator_cache"}
70-
pytest-operator-groups = {git = "https://github.com/canonical/data-platform-workflows", tag = "v23.1.1", subdirectory = "python/pytest_plugins/pytest_operator_groups"}
71-
allure-pytest-collection-report = {git = "https://github.com/canonical/data-platform-workflows", tag = "v23.1.1", subdirectory = "python/pytest_plugins/allure_pytest_collection_report"}
69+
pytest-operator-cache = {git = "https://github.com/canonical/data-platform-workflows", tag = "v24.0.5", subdirectory = "python/pytest_plugins/pytest_operator_cache"}
70+
pytest-operator-groups = {git = "https://github.com/canonical/data-platform-workflows", tag = "v24.0.5", subdirectory = "python/pytest_plugins/pytest_operator_groups"}
71+
allure-pytest-collection-report = {git = "https://github.com/canonical/data-platform-workflows", tag = "v24.0.5", subdirectory = "python/pytest_plugins/allure_pytest_collection_report"}
7272
# renovate caret doesn't work: https://github.com/renovatebot/renovate/issues/26940
7373
juju = "<=3.5.2.1"
7474
psycopg2-binary = "^2.9.10"

0 commit comments

Comments
 (0)