canonical / canonical/charmlibs

Make private key a cached property

Open
#463 1 comment 0 reactions 0 assignees View on GitHub
charmlibs-interfaces-tls-certificates team-tls
Dominant language
Python
Stars
5
Forks
28
Avg merge
1d 5h
Merged PRs (30d)
24

Description

The TLS library heavily uses the `private_key` property in the v4 version. This property calls get_secret every single time which is not very efficient as the secret value is not bound to change within the lifecycle of a hook. In scenarios with heavy deployments (for e.g. traefik integrated with 15 apps at once) in an environment without enough resources, juju controller is slow to respond. This makes the private_key property very slow (almost 9 seconds in one of the hooks where i did some profiling)

Making this property cached would really speed up the code.

Contributor guide

Open the contributing guide

Research direction

Start by locating the v4 TLS library's private_key property and inspecting how it calls get_secret. The change is complete when the secret is reused for the hook lifecycle instead of fetched repeatedly, with tests covering the cached-property behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
security
Issue type
Refactor
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.