feat(config): port PostgreSQL parameter building + resource introspection (2/6)#182
Draft
marceloneppel wants to merge 1 commit into
Draft
Conversation
marceloneppel
force-pushed
the
skl-01-update-config-1-peer-accessors
branch
from
July 20, 2026 13:22
22d4f17 to
10eea18
Compare
marceloneppel
force-pushed
the
skl-01-update-config-2-params
branch
from
July 20, 2026 13:22
a7ee622 to
786d9bd
Compare
2 tasks
…tion Internalizes PostgreSQL parameter calculation (worker-process auto/cap rules, wal_compression, memory-limit conversion) into the library so ConfigManager owns the full config-build flow instead of stopping at a TODO. Resource discovery (cpu_cores, memory_bytes) moves onto the workload rather than a substrate-specific manager: get_available_memory already lives there, ConfigManager already holds self.workload, and K8sManager doesn't exist yet when ConfigManager is constructed in abstract_charm - so the workload is the only place both substrates can share a single no-branch call site. K8sWorkload gains required unit_name/namespace constructor args so its lightkube Pod/Node lookups can resolve "my own pod" without depending on a charm object reference, mirroring what the K8s charm does today via self.unit.name/self.model.name. lightkube becomes a real (not merely transitive) dependency via a new k8s pyproject extra, matching the version pins the K8s test charm already uses. Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
marceloneppel
force-pushed
the
skl-01-update-config-1-peer-accessors
branch
from
July 20, 2026 19:04
10eea18 to
ee47a46
Compare
marceloneppel
force-pushed
the
skl-01-update-config-2-params
branch
from
July 20, 2026 19:04
786d9bd to
ddf2305
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue
update_configbuilds PostgreSQL'sbootstrap.dcs.postgresql.parametersfrom the unit's CPU and memory, which both charms compute per substrate. This step ports the parameter builder and the substrate resource introspection it depends on.Solution
managers/config.py:_build_postgresql_parameterswith the_calculate_max_*helpers and_calculate_worker_process_config(cpu_cores).get_available_resources() -> tuple[int, int]— VM readsos.cpu_count()and available memory; K8s reads the node/pod via lightkube and raisesDeployedWithoutTrustErroron a 403ApiError.k8soptional extra (lightkube,lightkube-models) mirroring the existingvmextra, plus a regenerateduv.lock.DeployedWithoutTrustErroris raised here and caught at the charm/event layer in the charm-adoption PR (managers-raise convention). Second (code-only) PR in the update_config stack; theK8sWorkloadsignature gainsunit_name/namespace, so the one-line fixture update needed to keep the suite green rides with the code, and the new unit tests land in the stack's test PR (#188).Checklist