How to change annotationsDiffBaseStorage prefix and clean old one #1179
-
|
Hi, i'm trying to change domain of my prefix .. # from
NS_API_DEPRECATED="crui.foo.github.com"
# to
NS_API="crui.bar.github.com"i used to start the operator like this @kopf.on.startup(id="crui-startup")
async def configure(settings: kopf.OperatorSettings, **_):
settings.persistence.diffbase_storage = kopf.AnnotationsDiffBaseStorage(
prefix=K8S_API_NS,
key="last-handled-configuration",
)i added a deprecated function @kopf.on.resume(
"", "v1", "secret", labels=LABELS_MATCH_DEPRECATED, id="crui-deprecated"
)
async def on_deprecated_labels(body: kopf.Body, **_): # pragma: no cover
"""Handle deprecated label events"""
raise kopf.PermanentError(
f"deprecated labels detected on secret {body.metadata.name}, please update to use {K8S_API_NS} instead of {K8S_API_NS_DEPRECATED}"
)but i'm struggling to remove old any idea how to make this properly? thank you |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
|
i found the solution, digging in issue/PR and discussion with that work as expected |
Beta Was this translation helpful? Give feedback.
-
|
For the record and later readers, I would like to extend the answer. The transition of this kind is documented here: The solution is slightly more complex, and consists of 3 stages of arbitrary duration:
As long as there is a possibility of a rollback, you want the old labels/annotations to be present. The multi-source storages solve this exact problem: write to all configured places, read from the first successful one. Apply to both "progress storage" and "diffbase storage". For this particular reason (and this reason alone), Kopf itself still uses the |
Beta Was this translation helpful? Give feedback.
i found the solution, digging in issue/PR and discussion with that
#319 (comment)
work as expected