mirror of https://github.com/ansible/ansible.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
1.9 KiB
YAML
67 lines
1.9 KiB
YAML
6 years ago
|
# TODO: This is the only way I could get the kubeconfig, I don't know why. Running the lookup outside of debug seems to return an empty string
|
||
|
#- debug: msg={{ lookup('env', 'K8S_AUTH_KUBECONFIG') }}
|
||
|
# register: kubeconfig
|
||
|
|
||
|
# Kubernetes resources
|
||
|
|
||
|
- block:
|
||
|
- name: Create a namespace
|
||
|
k8s:
|
||
6 years ago
|
name: crd
|
||
6 years ago
|
kind: namespace
|
||
|
|
||
|
- name: install custom resource definitions
|
||
|
k8s:
|
||
|
definition: "{{ lookup('file', role_path + '/files/setup-crd.yml') }}"
|
||
|
|
||
|
- name: create custom resource definition
|
||
|
k8s:
|
||
|
definition: "{{ lookup('file', role_path + '/files/crd-resource.yml') }}"
|
||
6 years ago
|
namespace: crd
|
||
6 years ago
|
register: create_crd
|
||
|
|
||
|
- name: patch custom resource definition
|
||
|
k8s:
|
||
|
definition: "{{ lookup('file', role_path + '/files/crd-resource.yml') }}"
|
||
6 years ago
|
namespace: crd
|
||
6 years ago
|
register: recreate_crd
|
||
|
ignore_errors: yes
|
||
|
|
||
|
- name: assert that recreating crd is as expected
|
||
|
assert:
|
||
|
that:
|
||
|
- recreate_crd_default_merge_expectation
|
||
|
|
||
|
- block:
|
||
|
- name: recreate custom resource definition with merge_type
|
||
|
k8s:
|
||
|
definition: "{{ lookup('file', role_path + '/files/crd-resource.yml') }}"
|
||
|
merge_type: merge
|
||
6 years ago
|
namespace: crd
|
||
6 years ago
|
register: recreate_crd_with_merge
|
||
|
|
||
|
- name: recreate custom resource definition with merge_type list
|
||
|
k8s:
|
||
|
definition: "{{ lookup('file', role_path + '/files/crd-resource.yml') }}"
|
||
|
merge_type:
|
||
|
- strategic-merge
|
||
|
- merge
|
||
6 years ago
|
namespace: crd
|
||
6 years ago
|
register: recreate_crd_with_merge_list
|
||
|
when: recreate_crd is successful
|
||
|
|
||
|
|
||
|
- name: remove crd
|
||
|
k8s:
|
||
|
definition: "{{ lookup('file', role_path + '/files/crd-resource.yml') }}"
|
||
6 years ago
|
namespace: crd
|
||
6 years ago
|
state: absent
|
||
|
|
||
|
always:
|
||
6 years ago
|
- name: remove crd namespace
|
||
6 years ago
|
k8s:
|
||
6 years ago
|
kind: Namespace
|
||
|
name: crd
|
||
6 years ago
|
state: absent
|
||
|
ignore_errors: yes
|