-
Hello, I'm starting using Kopf and I get an error that I didn't understand: @kopf.on.create("camptocamp.com", "v1", "githubwebhooks")
async def _create(
meta: kopf._cogs.structs.bodies.Meta,
spec: kopf._cogs.structs.bodies.Spec,
logger: kopf._core.actions.execution.Logger,
**_,
) -> Dict[str, Any]:
...
return {'ghId': 348708588} Full operator code: https://github.com/camptocamp/operator-github-webhook/blob/kopf/docker/operator.py Full logs``` /usr/local/lib/python3.8/dist-packages/kopf/_core/reactor/running.py:176: FutureWarning: Absence of either namespaces or cluster-wide flag will become an error soon. For now, switching to the cluster-wide mode for backward compatibility. warnings.warn("Absence of either namespaces or cluster-wide flag will become an error soon." [2022-03-18 14:48:32,430] kopf.activities.star [INFO ] GitHub WebHook creator started [2022-03-18 14:48:32,431] kopf.activities.star [INFO ] Activity '_startup' succeeded. [2022-03-18 14:48:32,432] kopf._core.engines.a [INFO ] Initial authentication has been initiated. [2022-03-18 14:48:32,436] kopf.activities.auth [INFO ] Activity 'login_with_service_account' succeeded. [2022-03-18 14:48:32,438] kopf._core.engines.a [INFO ] Initial authentication has finished. [2022-03-18 14:48:37,478] kopf._core.reactor.o [WARNING ] Not enough permissions to watch for resources: changes (creation/deletion/updates) will not be noticed; the resources are only refreshed on operator restarts. [2022-03-18 14:48:37,689] kopf.objects [INFO ] [default/test1] Create, Name: test1, Namespace: default [2022-03-18 14:48:38,034] kopf.objects [INFO ] [default/test1] Webhook https://example.com/ on repository camptocamp/operator-github-webhook created [2022-03-18 14:48:38,035] kopf.objects [INFO ] [default/test1] Handler '_create' succeeded. [2022-03-18 14:48:38,035] kopf.objects [INFO ] [default/test1] Creation is processed: 1 succeeded; 0 failed. [2022-03-18 14:48:38,042] kopf.objects [WARNING ] [default/test1] Patching failed with inconsistencies: (('remove', ('status',), {'_create': {'ghId': 348708588}}, None),) [2022-03-18 14:48:38,563] kopf.objects [INFO ] [default/test2] Create, Name: test2, Namespace: default [2022-03-18 14:48:38,733] kopf.objects [INFO ] [default/test2] Handler '_create' succeeded. [2022-03-18 14:48:38,733] kopf.objects [INFO ] [default/test2] Creation is processed: 1 succeeded; 0 failed. [2022-03-18 14:48:38,740] kopf.objects [WARNING ] [default/test2] Patching failed with inconsistencies: (('remove', ('status',), {'_create': {'ghId': 348708588}}, None),) [2022-03-18 14:48:42,709] kopf.objects [INFO ] [default/test2] Delete, Name: test2, Namespace: default [2022-03-18 14:48:42,709] kopf.objects [INFO ] [default/test2] Handler '_delete' succeeded. [2022-03-18 14:48:42,710] kopf.objects [INFO ] [default/test2] Deletion is processed: 1 succeeded; 0 failed. [2022-03-18 14:48:47,094] kopf.objects [INFO ] [default/test1] Update, Name: test1, Namespace: default [2022-03-18 14:48:47,415] kopf.objects [INFO ] [default/test1] Webhook https://example.com/ on repository camptocamp/operator-github-webhook created [2022-03-18 14:48:47,416] kopf.objects [INFO ] [default/test1] Handler '_update' succeeded. [2022-03-18 14:48:47,416] kopf.objects [INFO ] [default/test1] Updating is processed: 1 succeeded; 0 failed. [2022-03-18 14:48:47,430] kopf.objects [WARNING ] [default/test1] Patching failed with inconsistencies: (('remove', ('status',), {'_update': {'ghId': 348708607}}, None),) ``` |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hello, I ran into the same error. From my understanding, Kopf is trying to patch the status field of your custom resource, but the patch is rejected by the Kubernetes API. When updating a custom resource, Kubernetes will prune all fields that are not declared in the CustomResourceDefinition. See the note here https://kopf.readthedocs.io/en/stable/walkthrough/updates/#updating-the-objects
|
Beta Was this translation helpful? Give feedback.
Hello, I ran into the same error. From my understanding, Kopf is trying to patch the status field of your custom resource, but the patch is rejected by the Kubernetes API.
When updating a custom resource, Kubernetes will prune all fields that are not declared in the CustomResourceDefinition.
See the note here https://kopf.readthedocs.io/en/stable/walkthrough/updates/#updating-the-objects