-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature: dynamic inventory of resources created by a CR of an ansible operator #22
Comments
- filter pods using label selector infered from cwd - only create groups for pods - create subgroups for app.kubernetes.io labels - add hostvars from annotation - sanitize group names https://github.com/operator-framework/operator-sdk/issues/4887
Issues go stale after 90d of inactivity. Mark the issue as fresh by commenting If this issue is safe to close now please do so with /lifecycle stale |
Stale issues rot after 30d of inactivity. Mark the issue as fresh by commenting If this issue is safe to close now please do so with /lifecycle rotten |
/lifecycle frozen |
@jobcespedes: The label(s) In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Feature Request
Dynamic inventory of resources created by a CR of an ansible operator
Describe the problem you need a feature to resolve.
Operating or running ansible tasks over pods generated by a CR of an ansible operator is kind of cumbersome. One could use kubectl connection plugin and add them dynamically during each reconciliation loop using variables. The existing dynamic k8s inventory plugin could be a better fit. However, adding it to an ansible operator requires some steps. In addition, when done, it shows all the pods and services the operator has access and groups them in a way, in my opinion, not intuitive for the operator scope. They could not be filter, for instance.
Describe the solution you'd like.
The operator sdk to already include a dynamic inventory plugin that groups and adds only the pods, and optionally other kind of resources, of the CR the reconciliation loop is running. I would like to run some complementary ansible tasks over some of those pods. How it groups them should be intuitive in order to reference hosts, or groups more probably, in playbooks inside the operator. For instance: the name of a default group of all pods of a CR could be used as:
hosts: {{ ansible_operator_meta.namespace }}__{{ ansible_operator_meta.namespace }}__pods
. In addition, it would be helpful to define custom group formats using labels and add extra ansible variables using annotations. The following example shows: a posible pod definition for it to be considered as part of a CR inventory, to define a custom group membership and extra ansible variables:The custom CR could be:
However, it could complement k8s where some functionality is lacking or to add some logic to an operator.
/language ansible
The text was updated successfully, but these errors were encountered: