I think it makes sense to add the ability for enable-auto-restarts to be set at the unit level via an action. A new flag, internal to the charm, called unit-enable-auto-restarts could be used to manage this state. It would be set/unset via unit charm actions.
If unit-enable-auto-restarts is set to True or False then is overrides the charm config option enable-auto-restarts. If it is unset the behaviour reverts to whatever the charm config enable-auto-restarts is set too. If unit-enable-auto-restarts is set then this should be clear in the units workload status message.
In the scenario where an application has enable-auto-restarts charm config set to false and a single unit needs to be rebooted the operator can set unit-enable-auto-restarts=True for the unit that requires maintenance. The unit can then be rebooted and when the maintenance is complete unit-enable-auto-restarts=False.
The scenario where an application needs to be expanded but existing units need to be forbidden from performing service interrupting events is slightly more complicated.
- Set unit-enable-auto-restarts=False via action for existing units
- Set charm config option enable-auto-restarts=True.
- Expand application
- Either set unit-enable-auto-restarts=False for the new unit or...
- Set enable-auto-restarts=False and unset unit-enable-auto-restarts on all units.
I'm increasingly of the opinion that in the longer term the application level config option enable-auto-restarts would be removed in favour of the unit level setting.
I think it makes sense to add the ability for enable- auto-restarts to be set at the unit level via an action. A new flag, internal to the charm, called unit-enable- auto-restarts could be used to manage this state. It would be set/unset via unit charm actions.
If unit-enable- auto-restarts is set to True or False then is overrides the charm config option enable- auto-restarts. If it is unset the behaviour reverts to whatever the charm config enable- auto-restarts is set too. If unit-enable- auto-restarts is set then this should be clear in the units workload status message.
In the scenario where an application has enable- auto-restarts charm config set to false and a single unit needs to be rebooted the operator can set unit-enable- auto-restarts= True for the unit that requires maintenance. The unit can then be rebooted and when the maintenance is complete unit-enable- auto-restarts= False.
The scenario where an application needs to be expanded but existing units need to be forbidden from performing service interrupting events is slightly more complicated.
- Set unit-enable- auto-restarts= False via action for existing units auto-restarts= True. auto-restarts= False for the new unit or... auto-restarts= False and unset unit-enable- auto-restarts on all units.
- Set charm config option enable-
- Expand application
- Either set unit-enable-
- Set enable-
I'm increasingly of the opinion that in the longer term the application level config option enable- auto-restarts would be removed in favour of the unit level setting.