Merge ~mthaddon/charm-k8s-ingress/+git/charm-k8s-ingress:action into charm-k8s-ingress:master

Proposed by Tom Haddon
Status: Merged
Approved by: Jon Seager
Approved revision: e516149af42b4d59ae1510cb28c1cbcb4c63e2e1
Merged at revision: 5493aacc89a1a9b6609b3ebeb6b7bc185ee1cc62
Proposed branch: ~mthaddon/charm-k8s-ingress/+git/charm-k8s-ingress:action
Merge into: charm-k8s-ingress:master
Diff against target: 33 lines (+10/-0)
2 files modified
actions.yaml (+2/-0)
src/charm.py (+8/-0)
Reviewer Review Type Date Requested Status
ingress-charmers Pending
Review via email: mp+402511@code.launchpad.net

Commit message

Add an action to retrieve debug info about configured ingresses on the charm's namespace

To post a comment you must log in.
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

This merge proposal is being monitored by mergebot. Change the status to Approved to merge.

Revision history for this message
Tom Haddon (mthaddon) wrote :
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

Change successfully merged at revision 5493aacc89a1a9b6609b3ebeb6b7bc185ee1cc62

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/actions.yaml b/actions.yaml
2new file mode 100644
3index 0000000..24003f1
4--- /dev/null
5+++ b/actions.yaml
6@@ -0,0 +1,2 @@
7+describe-ingresses:
8+ description: Describe ingresses configured in this charm's namespace. Intended for debugging purposes.
9diff --git a/src/charm.py b/src/charm.py
10index 72cb7d2..2e7cef9 100755
11--- a/src/charm.py
12+++ b/src/charm.py
13@@ -52,12 +52,20 @@ class NginxIngressCharm(CharmBase):
14 def __init__(self, *args):
15 super().__init__(*args)
16 self.framework.observe(self.on.config_changed, self._on_config_changed)
17+ self.framework.observe(self.on.describe_ingresses_action, self._describe_ingresses_action)
18
19 # 'ingress' relation handling.
20 self.ingress = IngressProvides(self)
21 # When the 'ingress' is ready to configure, do so.
22 self.framework.observe(self.on.ingress_available, self._on_config_changed)
23
24+ def _describe_ingresses_action(self, event):
25+ """Handle the 'describe-ingresses' action."""
26+ self.k8s_auth()
27+ api = _networking_v1_beta1_api()
28+ ingresses = api.list_namespaced_ingress(namespace=self._namespace)
29+ event.set_results({"ingresses": ingresses})
30+
31 def _get_config_or_relation_data(self, field, fallback):
32 """Helper method to get data from config or the ingress relation."""
33 config_data = self.config[field]

Subscribers

People subscribed via source and target branches

to all changes: