-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split install and cleanup tasks for ACM
This is a PoC for splitting out the install and cleanup tasks. This should be a backward-compatible change. If no role_mode is specified then the default mode is to just run the assessment as it was before. Signed-off-by: Brad P. Crochet <[email protected]>
- Loading branch information
Showing
4 changed files
with
63 additions
and
48 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
install_mode: '' |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
- name: Clean up operand | ||
kubernetes.core.k8s: | ||
state: absent | ||
api_version: operator.open-cluster-management.io/v1 | ||
kind: MultiClusterHub | ||
name: multiclusterhub | ||
namespace: "open-cluster-management" | ||
wait: true | ||
wait_sleep: 30 | ||
wait_timeout: 600 | ||
- name: Delete open-cluster-management namespace | ||
kubernetes.core.k8s: | ||
name: open-cluster-management | ||
api_version: v1 | ||
kind: Namespace | ||
state: absent |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--- | ||
- name: Install and report | ||
block: | ||
- name: Create open-cluster-management namespace | ||
kubernetes.core.k8s: | ||
name: open-cluster-management | ||
api_version: v1 | ||
kind: Namespace | ||
state: present | ||
- name: Create multiclusterhub CR in target_namespace and wait | ||
kubernetes.core.k8s: | ||
state: present | ||
namespace: "open-cluster-management" | ||
definition: | ||
apiVersion: operator.open-cluster-management.io/v1 | ||
kind: MultiClusterHub | ||
metadata: | ||
name: multiclusterhub | ||
spec: | ||
disableHubSelfManagement: true | ||
availabilityConfig: Basic | ||
wait: true | ||
wait_condition: | ||
reason: ComponentsAvailable | ||
status: 'True' | ||
type: Complete | ||
wait_sleep: 30 | ||
wait_timeout: 600 | ||
register: acm_result | ||
always: | ||
- name: Report result | ||
ansible.builtin.set_fact: | ||
assessment_result: "{{ 'pass' if (acm_result.result.status.phase is defined and acm_result.result.status.phase == 'Running') else 'fail' }}" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,12 @@ | ||
--- | ||
- name: Install and report | ||
block: | ||
- name: Create open-cluster-management namespace | ||
kubernetes.core.k8s: | ||
name: open-cluster-management | ||
api_version: v1 | ||
kind: Namespace | ||
state: present | ||
- name: Create multiclusterhub CR in target_namespace and wait | ||
kubernetes.core.k8s: | ||
state: present | ||
namespace: "open-cluster-management" | ||
definition: | ||
apiVersion: operator.open-cluster-management.io/v1 | ||
kind: MultiClusterHub | ||
metadata: | ||
name: multiclusterhub | ||
spec: | ||
disableHubSelfManagement: true | ||
availabilityConfig: Basic | ||
wait: true | ||
wait_condition: | ||
reason: ComponentsAvailable | ||
status: 'True' | ||
type: Complete | ||
wait_sleep: 30 | ||
wait_timeout: 600 | ||
register: acm_result | ||
always: | ||
- name: Report result | ||
ansible.builtin.set_fact: | ||
assessment_result: "{{ 'pass' if (acm_result.result.status.phase is defined and acm_result.result.status.phase == 'Running') else 'fail' }}" | ||
- name: Clean up operand | ||
kubernetes.core.k8s: | ||
state: absent | ||
api_version: operator.open-cluster-management.io/v1 | ||
kind: MultiClusterHub | ||
name: multiclusterhub | ||
namespace: "open-cluster-management" | ||
wait: true | ||
wait_sleep: 30 | ||
wait_timeout: 600 | ||
- name: Delete open-cluster-management namespace | ||
kubernetes.core.k8s: | ||
name: open-cluster-management | ||
api_version: v1 | ||
kind: Namespace | ||
state: absent | ||
- name: Install and assess operand | ||
ansible.builtin.include_tasks: install.yml | ||
when: role_mode == 'install' or role_mode == '' | ||
tags: | ||
- install | ||
|
||
- name: Cleanup operator | ||
Check failure on line 8 in roles/advanced_cluster_management/tasks/main.yml GitHub Actions / Ansible Lint on PRsyntax-check[specific]
|
||
ansible.builint.include_tasks: cleanup.yml | ||
when: role_mode == 'cleanup' or role_mode == '' | ||
tags: | ||
- cleanup |