Skip to content

redhat-gpte-devopsautomation/ocp_application_validation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

99 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ocp_application_validation

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.

Synopsis

  • Use the k8s_info ansible module to perform read operations on K8s objects.

  • Authenticate using either a config file, or password.

Requirements

  • ansible >= 2.9

  • kubernetese.core collection

Parameters

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

Parameters Type Comments

name

string

Cluster name

host

url

OpenShfit console api

username

string

OpenShfit cluster username

password

string

OpenShfit cluster password

onfail

string

Value=ignore, It ignores failed validation tasks and continues to validate other in the list. This applies to all of the validations defined under the cluster.

validations

list

na

Contains nested dictionary of k8s object validation

Parameters Type Comments

kind

string

k8s object kind

name

string

name of the object

namespace

string

namespace where object lives

api_version

string

api_version for the kind

operator

string

name of the operator without version to check

pipeline

string

Name of the pipeline used for pipelinerun kind

state

string

state of the pipeline to check

retries

string

retires for until loop

delay

string

delay for until loop

conditions

list

conditions to check

onfail

string

ignore

user

string

user name for route

password

string

password for route

force_basic_auth

bool

for route

status_code

integer

status code for uri

port

string

port like http/https for uri

Examples

# 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

Authors

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages