Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
f776686
chore: bump library patch version to 16.3.17
marceloneppel Oct 11, 2026
2470936
fix(k8s): pass field_manager in the reparent stop apply
marceloneppel Oct 12, 2026
f0f8af2
merge k8s-5 into k8s-6-bump to refresh the base
marceloneppel Oct 12, 2026
0b33df9
merge k8s-5 into k8s-6-bump to refresh the base
marceloneppel Oct 13, 2026
d54d220
Merge branch 'k8s-5' into k8s-6-bump
marceloneppel Oct 13, 2026
6a01e58
Merge branch 'k8s-5' into k8s-6-bump
marceloneppel Oct 13, 2026
5840530
Merge commit '9d7ff3f1a' into k8s-6-bump
marceloneppel Oct 13, 2026
57ec60f
Merge branch 'k8s-5' into k8s-6-bump
marceloneppel Oct 13, 2026
7cd947e
Merge branch 'k8s-5' into k8s-6-bump
marceloneppel Oct 13, 2026
3df2ee0
Merge branch 'k8s-5' into k8s-6-bump to refresh the base
marceloneppel Oct 13, 2026
0b0503a
Merge branch 'k8s-5' into k8s-6-bump to refresh the base
marceloneppel Oct 13, 2026
99d3e4d
Merge branch 'k8s-5' into k8s-6-bump to refresh the base
marceloneppel Oct 13, 2026
f5add53
fix(charms): expose is_cluster_initialised on the abstract charm
marceloneppel Oct 14, 2026
49859bf
Merge branch 'vm-5' into k8s-1 to refresh the base
marceloneppel Oct 14, 2026
b82d03f
Merge branch 'k8s-1' into k8s-2 to refresh the base
marceloneppel Oct 14, 2026
d666ea4
Merge branch 'k8s-2' into k8s-3 to refresh the base
marceloneppel Oct 14, 2026
8fdcb6d
Merge branch 'k8s-3' into k8s-4 to refresh the base
marceloneppel Oct 14, 2026
1118a04
Merge branch 'k8s-4' into k8s-4b to refresh the base
marceloneppel Oct 14, 2026
54e5780
Merge branch 'k8s-4b' into k8s-5 to refresh the base
marceloneppel Oct 14, 2026
c687c9c
Merge branch 'k8s-5' into k8s-6-bump to refresh the base
marceloneppel Oct 14, 2026
1c60532
Merge branch 'k8s-5' into k8s-6-bump to refresh the base
marceloneppel Oct 14, 2026
7ac4833
Merge branch 'k8s-5' into k8s-6-bump to refresh the base
marceloneppel Oct 14, 2026
b17e5c5
Merge k8s-5 (raft alias fix) into k8s-6-bump
marceloneppel Oct 14, 2026
3600e90
Merge k8s-5 (stuck-raft emit fix) into k8s-6-bump
marceloneppel Oct 14, 2026
c1ab769
Merge branch 'fix20261014-k8s-4' into fix20261014-k8s-4b
marceloneppel Oct 14, 2026
1909a10
Merge branch 'fix20261014-k8s-4b' into fix20261014-k8s-5
marceloneppel Oct 14, 2026
b13e7c8
Merge branch 'fix20261014-k8s-5' into fix20261014-k8s-6-bump
marceloneppel Oct 14, 2026
0ef03c9
Merge branch 'fix20261014-k8s-5' into fix20261014-k8s-6-bump
marceloneppel Oct 14, 2026
14f8653
fix: satisfy ty after the ctor/lock refactor (COS attr annotation, Se…
marceloneppel Oct 14, 2026
09d5fb1
Merge branch 'fix20261014-k8s-5' into fix20261014-k8s-6-bump
marceloneppel Oct 14, 2026
4d463af
Merge branch 'fix20261014-k8s-5' into fix20261014-k8s-6-bump
marceloneppel Oct 14, 2026
462a6da
Merge branch 'fix20261014-vm-2' into fix20261014-k8s-6-bump
marceloneppel Oct 15, 2026
4f26123
Merge branch 'fix20261014-k8s-5' into fix20261014-k8s-6-bump
marceloneppel Oct 15, 2026
11669db
Merge branch 'fix20261014-k8s-5' into fix20261014-k8s-6-bump
marceloneppel Oct 15, 2026
73e0fdd
Merge branch 'fix20261014-k8s-5' into fix20261014-k8s-6-bump
marceloneppel Oct 15, 2026
fe95365
Merge branch 'fix20261014-k8s-5' into fix20261014-k8s-6-bump
marceloneppel Oct 15, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions single_kernel_postgresql/charms/k8s_charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import sys
from functools import cached_property
from pathlib import Path
from typing import TYPE_CHECKING, cast
from typing import TYPE_CHECKING, Any, cast

import psycopg2
from lightkube import Client
Expand Down Expand Up @@ -62,6 +62,9 @@
class PostgreSQLK8sCharm(AbstractPostgreSQLCharm):
"""PostgreSQL K8s Charm."""

# COS requirers are constructed charm-side and assigned by the consuming charm.
metrics_endpoint: Any = None

# Built by build_k8s_manager() while the abstract __init__ wires the
# async-replication subsystem; never None on the K8s substrate.
k8s_manager: K8sManager
Expand Down Expand Up @@ -284,9 +287,7 @@ def _restart_metrics_service(self) -> None:
Layer(
LayerDict({
"services": {
K8S_METRICS_SERVER_SERVICE_NAME: cast(
"ServiceDict", self._generate_metrics_service()
)
K8S_METRICS_SERVER_SERVICE_NAME: self._generate_metrics_service()
}
})
),
Expand Down Expand Up @@ -341,7 +342,7 @@ def _generate_metrics_jobs(self, enable_tls: bool) -> list[dict]:
},
]

def _generate_metrics_service(self) -> dict:
def _generate_metrics_service(self) -> "ServiceDict":
"""Generate the metrics exporter service definition (port)."""
workload = cast("K8sWorkload", self.workload)
monitoring_password = self.state.get_secret(APP_SCOPE, MONITORING_PASSWORD_KEY)
Expand Down
1 change: 1 addition & 0 deletions single_kernel_postgresql/managers/k8s.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ def reparent_services_on_stop(self) -> None:
name=resource.metadata.name,
namespace=resource.metadata.namespace,
force=True,
field_manager=app_name,
)
except ApiError:
logger.exception(
Expand Down
2 changes: 1 addition & 1 deletion single_kernel_postgresql/workload/k8s.py
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,7 @@ def generate_ldap_service(

def generate_metrics_service(
self, monitoring_password: str | None, postgresql_service: str
) -> dict:
) -> ServiceDict:
"""Generate the metrics exporter service definition (port)."""
return {
"override": "replace",
Expand Down
3 changes: 3 additions & 0 deletions tests/unit/test_k8s_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ def test_reparent_services_on_stop(harness, k8s_manager):
# The same Patroni-created resource is listed twice (Service + Endpoints) and
# reparented on each sighting — faithful to the charm's double-listing flow.
assert client.apply.call_count == 4
# The charm builds its stop-flow Client with field_manager=self.model.app.name:
# lightkube's APPLY patch requires one (bare Client() + apply() raises ValueError).
assert all(call.kwargs.get("field_manager") == app for call in client.apply.call_args_list)


def test_cleanup_old_cluster_resources_deletes_suffixes(harness, k8s_manager):
Expand Down
Loading