'install' hook does not get executed on CAAS models
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Canonical Juju |
Fix Released
|
High
|
Heather Lanigan | ||
2.7 |
Fix Released
|
High
|
Heather Lanigan |
Bug Description
For IAAS charms 'install' hook runs before any other hook except storage hooks. For CAAS charms this is not the case.
Tested on 2.7.0 but I believe the same behavior is there for other versions.
There is a clear distinction for handling IAAS and CAAS models in the code - on CAAS models 'start' event runs first instead of 'install':
https:/
I found one vague reference to that here:
https:/
but not in the install event documentation https:/
Likewise, the "start" event is documented as the one that runs after the first config-changed but currently it doesn't (this documentation issue is probably due to the removal of config-changed execution on every agent restart). This is probably a good thing considering that a charm author needs an event that runs before config-changed.
juju debug-log --replay | grep -P 'test11.*?running op: run '
application-test11: 17:33:33 TRACE juju.worker.
application-test11: 17:33:33 TRACE juju.worker.
application-test11: 17:33:33 TRACE juju.worker.
application-test11: 17:33:35 TRACE juju.worker.
application-test11: 17:41:02 TRACE juju.worker.
It makes sense that any work done in the charm code that modifies the local pod environment will be lost if the operator pod gets restarted unless persisted to the operator-storage. There are two things that a charm author might want to do in the install hook though:
1) initialize any persistent charm state (a one-time operation for things like .unit-state.db);
1) install any additional dependencies persisted to the operator-storage (e.g. into a python virtual environment).
Based on that, it might be worth having the 'install' hook for k8s charms as well.
Changed in juju: | |
status: | New → Triaged |
importance: | Undecided → High |
milestone: | none → 2.8-beta1 |
Changed in juju: | |
assignee: | nobody → Heather Lanigan (hmlanigan) |
status: | Triaged → In Progress |
Changed in juju: | |
milestone: | 2.7.2 → 2.8-beta1 |
Changed in juju: | |
status: | Fix Committed → Fix Released |
FWIW, this is already a roadmap item for the current cycle