canonical / canonical/serialized-data-interface
Recommended instantiation with ActiveStatus leads to issues
- Dominant language
- Python
- Stars
- 0
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Description
We recommend using this library like this:
```python
class Operator(CharmBase):
def __init__(self, *args):
super().__init__(*args)
try:
self.interfaces = get_interfaces(self)
except NoVersionsListed as err:
self.model.unit.status = WaitingStatus(str(err))
return
except NoCompatibleVersions as err:
self.model.unit.status = BlockedStatus(str(err))
return
else:
self.model.unit.status = ActiveStatus()
```
That leads to an issue where `ActiveStatus` can overwrite a `BlockedStatus`. This can be reproduced with:
juju deploy ch:istio-gateway istio-ingressgateway-operator --config=kind=ingress --trust
Which resolves to revision 6 as of this writing. It should be blocking on needing a relation to `istio-pilot`, but that status gets overwritten. `juju show-status-log` shows this:
```
$ juju show-status-log istio-ingressgateway-operator/0
Time Type Status Message
28 Oct 2021 11:26:22Z juju-unit executing running config-changed hook
28 Oct 2021 11:26:23Z workload active
28 Oct 2021 11:26:23Z workload blocked Waiting for istio-pilot relation
28 Oct 2021 11:26:23Z juju-unit executing running start hook
28 Oct 2021 11:26:24Z juju-unit idle
28 Oct 2021 13:55:32Z workload active
28 Oct 2021 13:56:15Z juju-unit executing running istio-pilot-relation-created hook
28 Oct 2021 13:56:16Z juju-unit idle
28 Oct 2021 13:56:51Z juju-unit executing running istio-pilot-relation-joined hook for istio-pilot/0
28 Oct 2021 13:56:51Z workload waiting List of istio-pilot versions not found for apps: istio-pilot
28 Oct 2021 13:56:52Z juju-unit executing running istio-pilot-relation-changed hook for istio-pilot/0
28 Oct 2021 13:56:52Z workload active
28 Oct 2021 13:56:52Z workload waiting Waiting for istio-pilot relation data
28 Oct 2021 13:56:52Z juju-unit executing running istio-pilot-relation-changed hook
28 Oct 2021 13:56:53Z workload active
28 Oct 2021 13:56:53Z workload waiting Waiting for istio-pilot relation data
28 Oct 2021 13:56:53Z juju-unit idle
28 Oct 2021 13:56:56Z juju-unit executing running istio-pilot-relation-changed hook
28 Oct 2021 14:01:59Z juju-unit idle
28 Oct 2021 14:20:48Z workload active
```
Deploying `istio-gateway` manually without the `else: self.model.unit.status = ActiveStatus()` clause worked initially, but broke after repeated relation joins and removals:
```
$ juju status
Model Controller Cloud/Region Version SLA Timestamp
istio-system uk8s microk8s/localhost 2.9.17 unsupported 12:10:54-05:00
App Version Status Scale Charm Store Channel Rev OS Address Message
istio-ingressgateway-operator waiting 1 istio-gateway local 0 kubernetes 10.152.183.164 installing agent
Unit Workload Agent Address Ports Message
istio-ingressgateway-operator/0* waiting idle 10.1.151.73 List of istio-pilot versions not found for apps: istio-pilot
```
```
$ juju show-status-log istio-ingressgateway-operator/0
Time Type Status Message
28 Oct 2021 09:52:07-05:00 juju-unit executing running istio-pilot-relation-joined hook for istio-pilot/1
28 Oct 2021 09:52:08-05:00 juju-unit executing running istio-pilot-relation-changed hook for istio-pilot/1
28 Oct 2021 09:52:08-05:00 workload waiting List of istio-pilot versions not found for apps: istio-pilot
28 Oct 2021 09:52:08-05:00 juju-unit idle
28 Oct 2021 09:52:09-05:00 juju-unit executing running istio-pilot-relation-changed hook
28 Oct 2021 09:52:09-05:00 juju-unit idle
28 Oct 2021 09:52:15-05:00 juju-unit executing running istio-pilot-relation-changed hook for istio-pilot/1
28 Oct 2021 09:52:15-05:00 workload waiting Waiting for istio-pilot relation data
28 Oct 2021 09:52:15-05:00 juju-unit idle
28 Oct 2021 09:52:22-05:00 juju-unit executing running istio-pilot-relation-changed hook
28 Oct 2021 09:52:22-05:00 workload active
28 Oct 2021 09:52:23-05:00 juju-unit idle
28 Oct 2021 09:52:29-05:00 juju-unit executing running istio-pilot-relation-departed hook for istio-pilot/1
28 Oct 2021 09:52:29-05:00 juju-unit executing running istio-pilot-relation-broken hook
28 Oct 2021 09:52:30-05:00 juju-unit idle
28 Oct 2021 09:54:04-05:00 juju-unit executing running istio-pilot-relation-created hook
28 Oct 2021 09:54:05-05:00 juju-unit idle
28 Oct 2021 09:58:10-05:00 juju-unit executing running istio-pilot-relation-broken hook
28 Oct 2021 09:58:10-05:00 workload waiting List of istio-pilot versions not found for apps: istio-pilot
28 Oct 2021 09:58:11-05:00 juju-unit idle
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.