operator
operator copied to clipboard
K8s tutorial: Clarify how status is set if no relation data
In Integrate your charm with PostgreSQL, the definition of fetch_postgres_relation_data has a comment that says:
[...] If no data is retrieved, the unit is set to waiting status and the program exits with a zero status code.
This is confusing for several reasons:
- The method itself doesn't set the unit status. Instead, later in the doc we're adding a collect-status handler that sets waiting status.
- Even in the collect-status handler,
fetch_postgres_relation_dataisn't called. Instead, both places useself.database.fetch_relation_data. - "The program exists with a zero status" is technically true but not very helpful. We don't usually think of charms as programs that exit with particular status codes.
Discussion in Matrix: https://matrix.to/#/!LhFxJIPEcCacgdMghH:ubuntu.com/$yreC1AD_wDNvYYL18CyzXL6UPOp1yeCbVV28BpiIswc