Created
February 14, 2019 16:34
-
-
Save cwilkers/9f41b5b588c8ad6e3fe8d964dcc14874 to your computer and use it in GitHub Desktop.
Return all custom types created by a CRD with a certain group name (*.federation.k8s.io)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: Backup federation control plane on master cluster | |
hosts: federation | |
tasks: | |
- name: Read CRDs | |
command: | |
argv: | |
- oc | |
- --context={{federation_context}} | |
- get | |
- customresourcedefinitions | |
- -o | |
- json | |
register: all_crds | |
- set_fact: | |
federated_types: "{{ federated_types | default ([]) + [ item ]}}" | |
vars: | |
query: "items[?contains(spec.group, 'federation.k8s.io')].metadata.name" | |
loop: "{{ all_crds.stdout | from_json | json_query(query) }}" | |
- debug: | |
var: federated_types |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment