This role is using k8s_info module to validate OpenShift resources. The role can be used as pattern to validate Catalog items based on Openshift for now.
The work is still in progress. We would like to make test cases for non OCP CI.
The validations can be done for Gitops based installation of OCP resources or Ansible based installation.
The role will be moved to a collection sitting in one of our repositories and can be called during CI Provisioning, FTL or Ops CI/CD process.
-
Use the k8s_info ansible module to perform read operations on K8s objects.
-
Authenticate using either a config file, or password.
Parameters | Type | Default | Comments | ||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ocp_application_validation_file_path |
path |
'/tmp/validations/{{ guid[:5] | d('common') }}/testaments' |
to set directory path where validation task files will be created |
||||||||||||||||||||||||||||||||||||||||||||||||||
ocp_application_validation_remove_testaments |
bool |
true |
to remove validation directory path at the end of execution |
||||||||||||||||||||||||||||||||||||||||||||||||||
ocp_application_validation_result_path |
path |
'/tmp/validations/{{ guid[:5] | d('common') }}/' |
path where results.yml will be created and file will contain validation run pass and fail. |
||||||||||||||||||||||||||||||||||||||||||||||||||
ocp_application_validation_list |
list |
na |
List of parameters for validation |
||||||||||||||||||||||||||||||||||||||||||||||||||
cluster |
dict |
na |
dictionary of cluster parameters |
||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||
validations |
list |
na |
Contains nested dictionary of k8s object validation |
||||||||||||||||||||||||||||||||||||||||||||||||||
|
# Example-1
ocp_application_validation_list:
- cluster:
name: hub
host: https://api.hub.example.com:6443
username: username
password: password
validations:
- kind: StorageCluster
name: ocs-storagecluster
namespace: openshift-storage
retries: 120
delay: 10
conditions:
- _r_validate_universal.resources is defined
- _r_validate_universal.resources | length > 0
- _r_validate_universal.resources[0].status is defined
- _r_validate_universal.resources[0].status.phase is defined
- _r_validate_universal.resources[0].status.phase == "Ready"
- kind: NooBaa
api_version: noobaa.io/v1alpha1
name: noobaa
namespace: openshift-storage
# Example-2
ocp_application_validation_list:
- cluster:
name: local
validations:
- kind: Route
name: openshift-gitops-server
namespace: openshift-gitops
# Example-2
ocp_application_validation_list:
- cluster:
name: dev
host: https://api.dev.example.com:6443
username: username
password: password
validations:
- kind: Route
name: openshift-gitops-server
namespace: openshift-gitops
-
Mitesh Sharma ([email protected])
-
Tyrell Reddy ([email protected])
-
Prakhar Srivastava ([email protected])
-
Ritesh Shah ([email protected])