This repository has been archived by the owner on Jun 13, 2024. It is now read-only.
Refactor: Ancillary K8s modules should not inherit from KubernetesRawModule #219
Closed
4 of 6 tasks
Labels
[Derived from feedback from @fabianvf]
Ancillary K8s modules such as k8s_service should not inherit from
KubernetesRawModule
. This is problematic in that the inheritance is too broad and includes a lot of implicitly inherited behavior This makes it unclear what is actually shared and sometimes carries through functions or parameters not applicable to the module being implemented.Examples of inheritance from the KubernetesRawModule:
Which are based on these classes:
These ancillary K8s modules should inherit from
AnsibleModule
directly rather KubernetesRawModule and use either bare methods in thecommon.py
or if the state is relevant belong in something like theK8sAnsibleMixin
(https://github.com/ansible-collections/community.kubernetes/blob/main/plugins/module_utils/common.py#L162), which should not implementAnsibleModule
functionality.Conversely, any broadly useful functions or shared code should be identified and moved out of specific modules and into `common.py.
Related to this, the argspec property should be not be included in
K8sAnsibleMixin
to avoid similar unintended inheritance with modules where arguments are not relevant.KubernetesRawModule
toK8sAnsibleMixin
orcommon.py
depending on usecommon.py
AnsibleModule
and apply relocated functions fromK8sAnsibleMixin
orcommon.py
as necessary.K8sAnsibleMixin
moving to specific argspecs in each moduleThe text was updated successfully, but these errors were encountered: