Skip to content
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

Support the selector option in the k8s module when applying service definitions #43

Closed
geekifier opened this issue Feb 17, 2020 · 3 comments · Fixed by #158
Closed

Support the selector option in the k8s module when applying service definitions #43

geekifier opened this issue Feb 17, 2020 · 3 comments · Fixed by #158
Assignees
Labels

Comments

@geekifier
Copy link

SUMMARY

This is a copy of the following GH issue: ansible/ansible#67316.

The k8s module should support specifying selectors when applying resource definitions, similar to how kubectl supports it.

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

k8s module

ADDITIONAL INFORMATION

Some commonly used projects, such as Knative, require you to apply the Custom Resource Definitions (CRDs) to the K8s cluster, before you can deploy the rest of the service definition.

See: https://knative.dev/v0.11-docs/install/knative-with-any-k8s/#installing-knative.

Without the support for specifying selectors, this is not possible in Ansible without having to use a 3rd party binary (kubectl).

# example 
- name: Install Knative CRDs                                                                                                                                                                                      
  k8s:                                   
    state: present
    src: "{{ item.dest }}"
    context: "{{ k8s_cluster | mandatory }}" 
    # this does not work
   selector:
     - 'knative.dev/crd-install=true'    
    validate:
      fail_on_error: yes                                                                                                                                                                                   
  with_items:
    - "{{ knative_install_files.results }}"

# output

msg: 'Unsupported parameters for (k8s) module: selector Supported parameters include: api_key, api_version, append_hash, apply, ca_cert, client_cert, client_key, context, force, host, kind, kubeconfig, merge_type, name, namespace, password, proxy, resource_definition, src, state, username, validate, validate_certs, wait, wait_condition, wait_sleep, wait_timeout'

Sample kubectl command utilizing selectors:

kubectl apply --selector knative.dev/crd-install=true \
--filename https://github.com/knative/serving/releases/download/v0.11.0/serving.yaml \
--filename https://github.com/knative/eventing/releases/download/v0.11.0/release.yaml \
--filename https://github.com/knative/serving/releases/download/v0.11.0/monitoring.yaml
@gravesm gravesm transferred this issue from ansible-collections/community.kubernetes Apr 8, 2021
@abikouo abikouo added the jira label Jun 4, 2021
@abikouo abikouo self-assigned this Jun 29, 2021
@abikouo
Copy link
Contributor

abikouo commented Jun 29, 2021

@geekifier thanks for suggesting this feature, we are currently working on it and let you know once it is ready

@Akasurde
Copy link
Member

Akasurde commented Jul 7, 2021

@geekifier Could you please check if PR #158 works for you and let us know? Thanks.

@Akasurde
Copy link
Member

Akasurde commented Jul 7, 2021

resolved_by_pr #158

@Akasurde Akasurde added has_pr type/enhancement New feature or request labels Jul 7, 2021
ansible-zuul bot pushed a commit that referenced this issue Jul 29, 2021
k8s - add label_selectors options

SUMMARY
k8s now support label_selectors options same as k8s_info

Resolves #43

ISSUE TYPE


Feature Pull Request


COMPONENT NAME

k8s

Reviewed-by: Mike Graves <[email protected]>
Reviewed-by: None <None>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants