docs: clarify handling of postgres relation data in K8s tutorial#2256
docs: clarify handling of postgres relation data in K8s tutorial#2256dwilding merged 9 commits intocanonical:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR improves the PostgreSQL integration tutorial by reorganizing the documentation flow and simplifying docstrings. The changes make it easier to understand how to handle database relation data by presenting steps in a more logical sequence and reducing verbose explanations.
Key changes:
- Reorganized tutorial sections to present database authentication handling before Pebble layer updates
- Simplified overly verbose docstrings in
get_app_environment()andfetch_postgres_relation_data()methods - Replaced a diagram with clearer textual explanation of service behavior with/without database relations
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| docs/tutorial/from-zero-to-hero-write-your-first-kubernetes-charm/integrate-your-charm-with-postgresql.md | Reorganized tutorial flow to introduce database authentication methods before Pebble layer updates; replaced diagram with text explanation |
| examples/k8s-3-postgresql/src/charm.py | Simplified docstrings for get_app_environment() and fetch_postgres_relation_data() methods |
| examples/k8s-4-action/src/charm.py | Simplified docstrings for get_app_environment() and fetch_postgres_relation_data() methods |
| examples/k8s-5-observe/src/charm.py | Simplified docstrings for get_app_environment() and fetch_postgres_relation_data() methods |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
tonyandrewmeyer
left a comment
There was a problem hiding this comment.
Thanks for doing this! I agree the flow makes more sense now, and the renames are good.
I agree the simple text is clearer than the diagram being removed. I wonder if (later, in a different PR) some sort of diagrammatic summary at the end of the tutorial might be useful for people - often the event flow is challenging to understand and I think that's where a diagram can best help.
In Integrate your charm with PostgreSQL, the part from "Add relation event observers" to the end of "Share the authentication information with your application" needs improving:
I've reorganised the flow and improved the explanations of what's happening. That includes replacing the diagram by more focused text.
Previews of updated sections:
Other updates to the tutorial:
self._update_layer_and_restart()toself._replan_workload()- see commentself._on_database_created()toself._on_database_endpoint()- see commentself.fetch_postgres_relation_data()toself.fetch_database_relation_data()and removed other places where PostgreSQL is mentioned, to be more generic - see commentself.get_app_environment()- see comment