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
[2020-01-03 16:09:15,471] kopf.objects [ERROR ] [test/example-azure-postgresql-database] Handler 'on_create_handler' failed with an exception. Will retry.
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/kopf/reactor/handling.py", line 523, in _execute_handler
lifecycle=lifecycle, # just a default for the sub-handlers, not used directly.
File "/usr/local/lib/python3.7/site-packages/kopf/reactor/handling.py", line 612, in _call_handler
**kwargs,
File "/usr/local/lib/python3.7/site-packages/kopf/reactor/invocation.py", line 115, in invoke
result = await loop.run_in_executor(config.WorkersConfig.get_syn_executor(), real_fn)
File "/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "apg_op.py", line 62, in on_create_handler
create_secret(meta, spec, dbname, roles)
File "apg_op.py", line 28, in create_secret
kopf.adopt(data)
File "/usr/local/lib/python3.7/site-packages/kopf/toolkits/hierarchies.py", line 139, in adopt
append_owner_reference(objs, owner=real_owner)
File "/usr/local/lib/python3.7/site-packages/kopf/toolkits/hierarchies.py", line 28, in append_owner_reference
refs = obj.setdefault('metadata', {}).setdefault('ownerReferences', [])
AttributeError: 'V1Secret' object has no attribute 'setdefault'
Currently, only raw dicts are supported. The classes of other libraries are not yet supported. Though, it would be a good addition for this specific toolkit — hierarchy management — so that it can also accept kubernetes's and pykube-ng's classes for adopting/labelling/annotating/owning.
Commented by janvdvegt at 2020-01-27 17:29:02+00:00
I'm interested in picking this up, although I only started using kopf yesterday. Is my observation correct that the base kubernetes client is not used anywhere? I'm looking at that part of the code now and I would need some guidance on what would be a clean way to fit it in. Where would the conditions on whether it is a dictionary vs a kubernetes object go?
janvdvegt That is correct: Kubernetes API clients are not used in Kopf. Only aiohttp is used — for API communication (low-level).
However, Kopf has slightly extended behaviour if kubernetes and/or pykube-ng are installed — it will reuse their authentication methods. But it does not require them to be present (effectively limiting the authentication capabilities to simple tokens & username-passwords & ssl certs).
The hierarchy logic is fully located in kopf.toolkits.hierarchies — 3rd-party classes support should go there too.
Can you please briefly describe what is your intention — i.e. what are you going to change/implement to fix this issue (conceptually)?
PS: Please, be aware of #298 before you start implementing anything — it is a huge shuffle of classes & modules — the logic remains exactly the same though. It does not affect the hierarchies toolkit, luckily.
Commented by janvdvegt at 2020-01-28 08:32:29+00:00
On a base level it would be the methods in kopf.toolkits.hierarchies to also accept the kubernetes objects like V1Secret so that users can manipulate these objects as well with regards to ownership. This would mean the definition of a K8sObject would include these objects from kubernetes. It looks like all the logic can stay inside the hierarchies module.
The text was updated successfully, but these errors were encountered:
Long story short
When trying to adopt a V1Secret object, adoption fails with
AttributeError: 'V1Secret' object has no attribute 'setdefault'
Description
The code snippet to reproduce the issue
The exact command to reproduce the issue
The full output of the command that failed
Environment
Python packages installed
Thanks for reporting.
Currently, only raw dicts are supported. The classes of other libraries are not yet supported. Though, it would be a good addition for this specific toolkit — hierarchy management — so that it can also accept
kubernetes
's andpykube-ng
's classes for adopting/labelling/annotating/owning.I'm interested in picking this up, although I only started using kopf yesterday. Is my observation correct that the base kubernetes client is not used anywhere? I'm looking at that part of the code now and I would need some guidance on what would be a clean way to fit it in. Where would the conditions on whether it is a dictionary vs a kubernetes object go?
janvdvegt That is correct: Kubernetes API clients are not used in Kopf. Only
aiohttp
is used — for API communication (low-level).However, Kopf has slightly extended behaviour if
kubernetes
and/or pykube-ng are installed — it will reuse their authentication methods. But it does not require them to be present (effectively limiting the authentication capabilities to simple tokens & username-passwords & ssl certs).The hierarchy logic is fully located in
kopf.toolkits.hierarchies
— 3rd-party classes support should go there too.Can you please briefly describe what is your intention — i.e. what are you going to change/implement to fix this issue (conceptually)?
PS: Please, be aware of #298 before you start implementing anything — it is a huge shuffle of classes & modules — the logic remains exactly the same though. It does not affect the hierarchies toolkit, luckily.
On a base level it would be the methods in
kopf.toolkits.hierarchies
to also accept thekubernetes
objects likeV1Secret
so that users can manipulate these objects as well with regards to ownership. This would mean the definition of a K8sObject would include these objects fromkubernetes
. It looks like all the logic can stay inside thehierarchies
module.The text was updated successfully, but these errors were encountered: