You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
And there are many more settings (migrated from the existing config classes), and all the new settings will be added to this structure (e.g. a state persistence storage from #331).
importkopf# NOT YET! SOON. See #331. @kopf.on.startup()defconfigure(config: kopf.OperatorConfig, **_):
config.persistence.storage=kopf.AnnotationsStateStorage(prefix='my-opr.example.com')
# OR:config.persistence.storage=kopf.StatusStateStorage(name='my-opr')
Backward-compatibility
The legacy way via module-level config-classes is supported — they are used as the defaults for the settings. BUT: runtime changes of the config-classes are ignored, only the runtime changes of the settings are obeyed.
A special case with the executor of synchronous handlers is supported, and calls to set_synchronous_tasks_threadpool_limit() are forwarded to the settings executor — until config-classes are removed with the next major release (1.0).
Beside exposing settings to the users officially, this change also adds a dependency injection mechanics which can be used in the tests instead of mocks — thus making the tests cleaner.
What do these changes do?
Introduce settings: an official and documented way of configuring of all the little aspects of the framework behaviour on a per-operator basis.
Description
Previously, module-level hacks were used to modify global variables grouped into classes-as-namespaces (beside being undocumented):
No more!
Settings are now a part of the framework, and should be defined in the startup handlers:
And there are many more settings (migrated from the existing config classes), and all the new settings will be added to this structure (e.g. a state persistence storage from #331).
Backward-compatibility
The legacy way via module-level config-classes is supported — they are used as the defaults for the settings. BUT: runtime changes of the config-classes are ignored, only the runtime changes of the settings are obeyed.
A special case with the executor of synchronous handlers is supported, and calls to
set_synchronous_tasks_threadpool_limit()
are forwarded to the settings executor — until config-classes are removed with the next major release (1.0).Beside exposing settings to the users officially, this change also adds a dependency injection mechanics which can be used in the tests instead of mocks — thus making the tests cleaner.
Issues/PRs
Type of changes
Checklist
CONTRIBUTORS.txt
haikoschol Thank you. I've implemented these recommendation with few little additions in #337.
The text was updated successfully, but these errors were encountered: