diff --git a/DEVELOPING.adoc b/DEVELOPING.adoc index cf5c0dae..a59cf452 100644 --- a/DEVELOPING.adoc +++ b/DEVELOPING.adoc @@ -138,10 +138,10 @@ WARNING: This may not work if you have SELinux enabled. If you get permission er When making any kind of change, you should also make the necessary changes to the link:./molecule/[Molecule tests] to ensure they still pass. You can easily run the Molecule tests on your local box using Minikube by running the link:https://github.com/kiali/kiali/blob/master/hack/ci-minikube-molecule-tests.sh[ci-minikube-molecule-tests.sh] hack script. If you want to run just a few or one Molecule test rather than the whole suite, you can run something like this (omit `CLUSTER_TYPE` if running the test on OpenShift; you can omit `MINIKUBE_PROFILE` if your profile is the default of `minikube`). ``` -CLUSTER_TYPE=minikube MINIKUBE_PROFILE=ci MOLECULE_USE_DEV_IMAGES=true MOLECULE_SCENARIO="api-test" make clean build test cluster-push molecule-test +CLUSTER_TYPE=minikube MINIKUBE_PROFILE=ci MOLECULE_USE_DEV_IMAGES=true MOLECULE_SCENARIO="roles-test" make clean build test cluster-push molecule-test ``` -where `api-test` is the Molecule test(s) you want to run. The value of link:https://github.com/kiali/kiali/blob/v1.25.0/make/Makefile.molecule.mk#L5-L8[`MOLECULE_SCENARIO`] is a space-separated list of Molecule tests - the full list of Molecule tests are link:./molecule[found here]. There are other environment variables you can set (such as `MOLECULE_DEBUG` for turning on debug messages) - see the link:https://github.com/kiali/kiali/blob/master/make/Makefile.molecule.mk[make/Makefile.molecule.mk] file in the kiali/kiali repo. +where `roles-test` is the Molecule test(s) you want to run. The value of link:https://github.com/kiali/kiali/blob/v1.25.0/make/Makefile.molecule.mk#L5-L8[`MOLECULE_SCENARIO`] is a space-separated list of Molecule tests - the full list of Molecule tests are link:./molecule[found here]. There are other environment variables you can set (such as `MOLECULE_DEBUG` for turning on debug messages) - see the link:https://github.com/kiali/kiali/blob/master/make/Makefile.molecule.mk[make/Makefile.molecule.mk] file in the kiali/kiali repo. NOTE: If you have never run the Molecule tests before, the Molecule container image will be built for you automatically. If you need to rebuild the image for some reason, run `FORCE_MOLECULE_BUILD=true make molecule-build`. diff --git a/molecule/api-test/apps.test.yaml b/molecule/api-test/apps.test.yaml deleted file mode 100644 index 5735b9a0..00000000 --- a/molecule/api-test/apps.test.yaml +++ /dev/null @@ -1,28 +0,0 @@ -- name: "/namespaces/{namespace}/apps" - vars: - param_namespace: "{{ simple_mesh_namespace }}" - uri: - url: "{{ kiali_base_url }}/api/namespaces/{{ param_namespace }}/apps" - return_content: yes - validate_certs: false - register: api_results_raw - -- set_fact: - api_namespaces_apps_json: "{{ api_results_raw.json }}" - -- name: "Results: /namespaces/{namespace}/apps" - debug: - msg: "{{ api_namespaces_apps_json }}" - -- name: Assert that we were able to get the apps info - assert: - that: - - api_namespaces_apps_json is defined - - api_namespaces_apps_json.namespace.name == simple_mesh_namespace - - api_namespaces_apps_json.applications | length == 2 - - api_namespaces_apps_json | json_query('applications[?name==`simple-client`].istioSidecar') | join == "True" - - api_namespaces_apps_json | json_query('applications[?name==`simple-client`].labels.app') | join == "simple-client" - - api_namespaces_apps_json | json_query('applications[?name==`simple-client`].labels.version') | join == "v99" - - api_namespaces_apps_json | json_query('applications[?name==`simple-server`].istioSidecar') | join == "True" - - api_namespaces_apps_json | json_query('applications[?name==`simple-server`].labels.app') | join == "simple-server" - - api_namespaces_apps_json | json_query('applications[?name==`simple-server`].labels.version') | join == "v99" diff --git a/molecule/api-test/cleanup.yml b/molecule/api-test/cleanup.yml deleted file mode 100644 index f54fe309..00000000 --- a/molecule/api-test/cleanup.yml +++ /dev/null @@ -1,23 +0,0 @@ -- name: Cleanup - hosts: localhost - connection: local - collections: - - kubernetes.core - tasks: - - # Cleanup should only ever execute when a molecule test fails - # api-test has its own cleanup because we need to ensure the simple-mesh namespace is deleted - - - name: Get information about the cluster - set_fact: - api_groups: "{{ lookup('kubernetes.core.k8s', cluster_info='api_groups') }}" - - name: Determine the cluster type - set_fact: - is_openshift: "{{ True if 'route.openshift.io' in api_groups else False }}" - is_k8s: "{{ False if 'route.openshift.io' in api_groups else True }}" - - name: Determine the Istio implementation - set_fact: - is_maistra: "{{ True if 'maistra.io' in api_groups else False }}" - - - import_tasks: ../default/dump-logs.yml - - import_tasks: delete-simple-mesh.yml diff --git a/molecule/api-test/config.test.yaml b/molecule/api-test/config.test.yaml deleted file mode 100644 index 1814ad95..00000000 --- a/molecule/api-test/config.test.yaml +++ /dev/null @@ -1,32 +0,0 @@ -- name: "/config" - uri: - url: "{{ kiali_base_url }}/api/config" - return_content: yes - validate_certs: false - register: api_results_raw - -- set_fact: - api_config_json: "{{ api_results_raw.json }}" - -- name: "Results: /config" - debug: - msg: "{{ api_config_json }}" - -- name: Assert that we were able to get the config - assert: - that: - - api_config_json.healthConfig is defined - - api_config_json.istioAnnotations is defined - - api_config_json.istioAnnotations.istioInjectionAnnotation is defined - - api_config_json.istioConfigMap is defined - - api_config_json.istioIdentityDomain is defined - - api_config_json.istioLabels is defined - - api_config_json.istioLabels.appLabelName is defined - - api_config_json.istioLabels.injectionLabelName is defined - - api_config_json.istioLabels.versionLabelName is defined - - api_config_json.istioNamespace == istio.control_plane_namespace - - api_config_json.istioStatusEnabled is defined - - api_config_json.kialiFeatureFlags is defined - - api_config_json.kialiFeatureFlags.istioInjectionAction is defined - - api_config_json.prometheus is defined - - api_config_json.prometheus.globalScrapeInterval is defined diff --git a/molecule/api-test/converge.yml b/molecule/api-test/converge.yml deleted file mode 100644 index 909430cb..00000000 --- a/molecule/api-test/converge.yml +++ /dev/null @@ -1,40 +0,0 @@ -- name: Tests - hosts: localhost - connection: local - collections: - - kubernetes.core - vars: - custom_resource: "{{ lookup('template', cr_file_path) | from_yaml }}" - tasks: - - import_tasks: ../common/tasks.yml - - import_tasks: ../asserts/pod_asserts.yml - - import_tasks: ../common/wait_for_kiali_running.yml - - - name: Make sure the test set the strategy to anonymous so we don't need to log in - assert: - that: - - kiali_configmap.auth.strategy == "anonymous" - - # Start with empty Prometheus data - - import_tasks: ../common/purge-prometheus-data.yml - - - import_tasks: create-simple-mesh.yml - - - name: Find all API tests - vars: - # if you want to test a particular one, just change test_file_pattern to what you want to test - test_file_pattern: "*.test.yaml" - find: - paths: "{{ test_dir_path }}" - patterns: "{{ test_file_pattern }}" - register: all_api_tests_raw - - - name: Get a sorted list of all API test files - set_fact: - all_api_tests: "{{ all_api_tests_raw.files | sort(attribute='path') | map(attribute='path') | list }}" - - - name: Execute each test - include_tasks: "{{ item }}" - loop: "{{ all_api_tests }}" - - - import_tasks: delete-simple-mesh.yml diff --git a/molecule/api-test/create-simple-mesh.yml b/molecule/api-test/create-simple-mesh.yml deleted file mode 100644 index 759aa949..00000000 --- a/molecule/api-test/create-simple-mesh.yml +++ /dev/null @@ -1,233 +0,0 @@ -- name: Create simple-mesh namespace with Istio auto-injection enabled and custom dashboards - k8s: - state: present - definition: - apiVersion: "{{ 'project.openshift.io/v1' if is_openshift == True else 'v1' }}" - kind: "{{ 'Project' if is_openshift == True else 'Namespace' }}" - metadata: - name: "{{ simple_mesh_namespace }}" - labels: - istio-injection: enabled - annotations: - dashboards.kiali.io/templates: | - - name: custom_envoy1 - title: Custom_Envoy_1 - discoverOn: "envoy_server_uptime" - items: - - chart: - name: "Pods uptime" - spans: 3 - metricName: "envoy_server_uptime" - dataType: "raw" - - name: custom_envoy2 - title: Custom_Envoy_2 - discoverOn: "envoy_server_uptime" - items: - - chart: - name: "Allocated memory" - unit: "bytes" - spans: 3 - metricName: "envoy_server_memory_allocated" - dataType: "raw" - min: 0 - -- name: Create Maistra SMM to add simple-mesh to the mesh - k8s: - state: present - definition: - apiVersion: maistra.io/v1 - kind: ServiceMeshMember - metadata: - name: default - namespace: "{{ simple_mesh_namespace }}" - spec: - controlPlaneRef: - namespace: "{{ istio.control_plane_namespace }}" - name: "{{ maistra_smcp.metadata.name }}" - when: - - is_openshift == True - - is_maistra == True - -- name: Create NAD so CNI works, only if on OpenShift but not running Maistra - k8s: - state: present - definition: - apiVersion: k8s.cni.cncf.io/v1 - kind: NetworkAttachmentDefinition - metadata: - namespace: "{{ simple_mesh_namespace }}" - name: istio-cni - when: - - is_openshift == True - - is_maistra == False - -- name: Create simple-sa service account - k8s: - state: present - definition: - apiVersion: v1 - kind: ServiceAccount - metadata: - name: simple-sa - namespace: "{{ simple_mesh_namespace }}" - -- name: Create simple-scc so OpenShift deployments are successful - k8s: - state: present - definition: - apiVersion: security.openshift.io/v1 - kind: SecurityContextConstraints - metadata: - name: simple-scc - runAsUser: - type: RunAsAny - seLinuxContext: - type: RunAsAny - supplementalGroups: - type: RunAsAny - users: - - "system:serviceaccount:{{ simple_mesh_namespace }}:simple-sa" - when: - - is_openshift == True - -- name: Create simple-server deployment - k8s: - state: present - definition: - apiVersion: apps/v1 - kind: Deployment - metadata: - name: simple-server - namespace: "{{ simple_mesh_namespace }}" - labels: - app: simple-server - version: v99 - spec: - selector: - matchLabels: - app: simple-server - template: - metadata: - annotations: - sidecar.istio.io/inject: "true" - dashboards.kiali.io/templates: | - - name: custom_envoy1 - - name: custom_envoy3 - title: Custom_Envoy_3 - discoverOn: "envoy_server_uptime" - items: - - chart: - name: "Heap size" - unit: "bytes" - spans: 3 - metricName: "envoy_server_memory_heap_size" - dataType: "raw" - min: 0 - labels: - app: simple-server - version: v99 - spec: - serviceAccountName: simple-sa - containers: - - name: simple-server - image: quay.io/jmazzitelli/alpine:latest - command: - - "/bin/sh" - args: - - "-c" - - 'while true; do printf "HTTP/1.1 200 OK\n\n" | nc -l -p 8000 -s 0.0.0.0 -n -v ; done' - ports: - - containerPort: 8000 - -- name: Create simple-server service - k8s: - state: present - definition: - apiVersion: v1 - kind: Service - metadata: - name: simple-server-svc - namespace: "{{ simple_mesh_namespace }}" - labels: - app: simple-server - version: v99 - spec: - ports: - - name: http - protocol: TCP - port: 8000 - selector: - app: simple-server - version: v99 - -- name: Create simple-client deployment - k8s: - state: present - definition: - apiVersion: apps/v1 - kind: Deployment - metadata: - name: simple-client - namespace: "{{ simple_mesh_namespace }}" - labels: - app: simple-client - version: v99 - spec: - selector: - matchLabels: - app: simple-client - template: - metadata: - annotations: - sidecar.istio.io/inject: "true" - labels: - app: simple-client - version: v99 - spec: - serviceAccountName: simple-sa - containers: - - name: simple-client - image: quay.io/jmazzitelli/alpine:latest - command: - - "/bin/sh" - args: - - "-c" - - "watch -n 1 wget -q -O /dev/null http://simple-server-svc:8000" - -- name: Asserting that the Simple Server Pod exists and there is only one - k8s_info: - api_version: v1 - kind: Pod - namespace: "{{ simple_mesh_namespace }}" - label_selectors: - - app = simple-server - register: simple_server_pod - until: - - simple_server_pod is success - - simple_server_pod.resources | length == 1 - - simple_server_pod.resources[0].status is defined - - simple_server_pod.resources[0].status.phase is defined - - simple_server_pod.resources[0].status.phase == "Running" - retries: "{{ wait_retries }}" - delay: 5 - -- name: Asserting that the Simple Client Pod exists and there is only one - k8s_info: - api_version: v1 - kind: Pod - namespace: "{{ simple_mesh_namespace }}" - label_selectors: - - app = simple-client - register: simple_client_pod - until: - - simple_client_pod is success - - simple_client_pod.resources | length == 1 - - simple_client_pod.resources[0].status is defined - - simple_client_pod.resources[0].status.phase is defined - - simple_client_pod.resources[0].status.phase == "Running" - retries: "{{ wait_retries }}" - delay: 5 - -- name: Pause for a few seconds so we generate telemetry data - pause: - seconds: 45 diff --git a/molecule/api-test/dashboards.test.yaml b/molecule/api-test/dashboards.test.yaml deleted file mode 100644 index f99a4b9f..00000000 --- a/molecule/api-test/dashboards.test.yaml +++ /dev/null @@ -1,209 +0,0 @@ -# Get the custom dashboard definition - -- name: "/namespaces/{namespace}/customdashboard/kiali" - vars: - param_namespace: "{{ kiali.install_namespace }}" - param_dashboard: "kiali" - uri: - url: "{{ kiali_base_url }}/api/namespaces/{{ param_namespace }}/customdashboard/{{ param_dashboard }}" - return_content: yes - validate_certs: false - register: api_results_raw - -- set_fact: - api_customdashboard_json: "{{ api_results_raw.json }}" - -- name: "Results: /namespaces/{namespace}/customdashboard/kiali" - debug: - msg: "{{ api_customdashboard_json }}" - -- name: Assert that we were able to get the Kiali custom dashboard and its four charts - assert: - that: - - api_customdashboard_json is defined - - api_customdashboard_json.name == 'kiali' - - api_customdashboard_json.title == 'Kiali Internal Metrics' - - api_customdashboard_json.charts | length == 4 - - api_customdashboard_json | json_query('charts[?name==`API hit rate`].spans') | join == "6" - - api_customdashboard_json | json_query('charts[?name==`API processing duration`].spans') | join == "6" - - api_customdashboard_json | json_query('charts[?name==`API Failures`].spans') | join == "6" - - api_customdashboard_json | json_query('charts[?name==`Graph generation duration`].spans') | join == "6" - -# Get the app dashboard - -- name: "/namespaces/{namespace}/customdashboard/kiali?labelsFilter=app:kiali" - vars: - param_namespace: "{{ kiali.install_namespace }}" - param_dashboard: "kiali" - uri: - url: "{{ kiali_base_url }}/api/namespaces/{{ param_namespace }}/customdashboard/{{ param_dashboard }}?labelsFilter=app:kiali" - return_content: yes - validate_certs: false - register: api_results_raw - -- set_fact: - api_customdashboard_json: "{{ api_results_raw.json }}" - -- name: "Results: /namespaces/{namespace}/customdashboard/kiali?labelsFilter=app:kiali" - debug: - msg: "{{ api_customdashboard_json }}" - -- name: Assert that we were able to get the Kiali app dashboard - assert: - that: - - api_customdashboard_json is defined - - api_customdashboard_json.charts | length > 0 - - api_customdashboard_json | json_query('charts[?name==`API hit rate`].metrics') | length > 0 - - api_customdashboard_json | json_query('charts[?name==`API processing duration`].metrics') | length > 0 - -# Get the workload dashboard - -- name: "/namespaces/{namespace}/customdashboard/kiali?labelsFilter=app:kiali,version:{version}" - vars: - param_namespace: "{{ kiali.install_namespace }}" - param_dashboard: "kiali" - param_version: "{{ kiali.image_version if kiali.image_version != '' else kiali_configmap.deployment.image_version }}" - uri: - url: "{{ kiali_base_url }}/api/namespaces/{{ param_namespace }}/customdashboard/{{ param_dashboard }}?labelsFilter=app:kiali,version:{{ param_version }}" - return_content: yes - validate_certs: false - register: api_results_raw - -- set_fact: - api_customdashboard_json: "{{ api_results_raw.json }}" - -- name: "Results: /namespaces/{namespace}/customdashboard/kiali?labelsFilter=app:kiali,version:{version}" - debug: - msg: "{{ api_customdashboard_json }}" - -- name: Assert that we were able to get the Kiali workload dashboard - assert: - that: - - api_customdashboard_json is defined - - api_customdashboard_json.charts | length > 0 - - api_customdashboard_json | json_query('charts[?name==`API hit rate`].metrics') | length > 0 - - api_customdashboard_json | json_query('charts[?name==`API processing duration`].metrics') | length > 0 - -# Assert that we removed the "go" custom dashboard when we installed Kiali - -- name: "/namespaces/{namespace}/customdashboard/go (should not exist)" - vars: - param_namespace: "{{ kiali.install_namespace }}" - param_dashboard: "go" - uri: - url: "{{ kiali_base_url }}/api/namespaces/{{ param_namespace }}/customdashboard/{{ param_dashboard }}" - return_content: yes - validate_certs: false - status_code: 500 - register: api_results_raw - -- set_fact: - api_customdashboard_json: "{{ api_results_raw.json }}" - -- name: Assert that the built-in Go dashboard was removed - assert: - that: - - api_customdashboard_json is defined - - api_customdashboard_json.error == "Dashboard [go] does not exist or is disabled" - -# Below will test the dashboard override features. -# You can add dashboard yaml in a namespace annotation and in a workload (pod) annotation. -# The workload dashboards override the namespace dashboards which override the built-in dashboards. -# The queries below will all ask for the dashboards for the simple-server workload and the simple-mesh namespace - -# custom_envoy1 (workload) -- name: "/namespaces/{namespace}/customdashboard/custom_envoy1?labelsFilter=app:simple-server,version:v99&workloadType=Deployment&workload=simple-server (workload annotation should have removed this dashboard)" - vars: - param_namespace: "{{ simple_mesh_namespace }}" - param_dashboard: "custom_envoy1" - uri: - url: "{{ kiali_base_url }}/api/namespaces/{{ param_namespace }}/customdashboard/{{ param_dashboard }}?labelsFilter=app:simple-server,version:v99&workloadType=Deployment&workload=simple-server" - return_content: yes - validate_certs: false - status_code: 500 - register: api_results_raw - -- set_fact: - api_customdashboard_json: "{{ api_results_raw.json }}" - -- name: "Results: /namespaces/{namespace}/customdashboard/custom_envoy1?labelsFilter=app:simple-server,version:v99&workloadType=Deployment&workload=simple-server (workload annotation should have removed this dashboard)" - debug: - msg: "{{ api_customdashboard_json }}" - -- name: Assert that workload annotations overrode (and removed) the namespace dashboard - assert: - that: - - api_customdashboard_json is defined - - api_customdashboard_json.error == "Dashboard [custom_envoy1] does not exist or is disabled" - -# custom_envoy1 (namespace) -- name: "/namespaces/{namespace}/customdashboard/custom_envoy1 (namespace annotation defined this)" - vars: - param_namespace: "{{ simple_mesh_namespace }}" - param_dashboard: "custom_envoy1" - uri: - url: "{{ kiali_base_url }}/api/namespaces/{{ param_namespace }}/customdashboard/{{ param_dashboard }}" - return_content: yes - validate_certs: false - register: api_results_raw - -- set_fact: - api_customdashboard_json: "{{ api_results_raw.json }}" - -- name: "Results: /namespaces/{namespace}/customdashboard/custom_envoy1 (namespace annotation defined this)" - debug: - msg: "{{ api_customdashboard_json }}" - -- name: Assert that we were able to get the Kiali dashboard from the namespace annotation - assert: - that: - - api_customdashboard_json is defined - - api_customdashboard_json.title == "Custom_Envoy_1" - -# custom_envoy2 -- name: "/namespaces/{namespace}/customdashboard/custom_envoy2?labelsFilter=app:simple-server,version:v99&workloadType=Deployment&workload=simple-server" - vars: - param_namespace: "{{ simple_mesh_namespace }}" - param_dashboard: "custom_envoy2" - uri: - url: "{{ kiali_base_url }}/api/namespaces/{{ param_namespace }}/customdashboard/{{ param_dashboard }}?labelsFilter=app:simple-server,version:v99&workloadType=Deployment&workload=simple-server" - return_content: yes - validate_certs: false - register: api_results_raw - -- set_fact: - api_customdashboard_json: "{{ api_results_raw.json }}" - -- name: "Results: /namespaces/{namespace}/customdashboard/custom_envoy2?labelsFilter=app:simple-server,version:v99&workloadType=Deployment&workload=simple-server" - debug: - msg: "{{ api_customdashboard_json }}" - -- name: Assert that we were able to get the Kiali dashboard from the workload annotation - assert: - that: - - api_customdashboard_json is defined - - api_customdashboard_json.title == "Custom_Envoy_2" - -# custom_envoy3 -- name: "/namespaces/{namespace}/customdashboard/custom_envoy3?labelsFilter=app:simple-server,version:v99&workloadType=Deployment&workload=simple-server" - vars: - param_namespace: "{{ simple_mesh_namespace }}" - param_dashboard: "custom_envoy3" - uri: - url: "{{ kiali_base_url }}/api/namespaces/{{ param_namespace }}/customdashboard/{{ param_dashboard }}?labelsFilter=app:simple-server,version:v99&workloadType=Deployment&workload=simple-server" - return_content: yes - validate_certs: false - register: api_results_raw - -- set_fact: - api_customdashboard_json: "{{ api_results_raw.json }}" - -- name: "Results: /namespaces/{namespace}/customdashboard/custom_envoy3?labelsFilter=app:simple-server,version:v99&workloadType=Deployment&workload=simple-server" - debug: - msg: "{{ api_customdashboard_json }}" - -- name: Assert that we were able to get the Kiali dashboard from the workload annotation - assert: - that: - - api_customdashboard_json is defined - - api_customdashboard_json.title == "Custom_Envoy_3" diff --git a/molecule/api-test/delete-simple-mesh.yml b/molecule/api-test/delete-simple-mesh.yml deleted file mode 100644 index d2768e3d..00000000 --- a/molecule/api-test/delete-simple-mesh.yml +++ /dev/null @@ -1,16 +0,0 @@ -- name: Delete the simple-scc - k8s: - state: absent - api_version: security.openshift.io/v1 - kind: SecurityContextConstraints - name: simple-scc - when: - - is_openshift == True - -- name: Delete the simple mesh namespace and everything in it - k8s: - state: absent - api_version: "{{ 'project.openshift.io/v1' if is_openshift == True else 'v1' }}" - kind: "{{ 'Project' if is_openshift == True else 'Namespace' }}" - name: "{{ simple_mesh_namespace }}" - wait: yes diff --git a/molecule/api-test/graph.test.yaml b/molecule/api-test/graph.test.yaml deleted file mode 100644 index 2970a72a..00000000 --- a/molecule/api-test/graph.test.yaml +++ /dev/null @@ -1,154 +0,0 @@ -### WORKLOAD GRAPH ### - -- set_fact: - graph_test_url: "{{ kiali_base_url }}/api/namespaces/graph?namespaces={{ simple_mesh_namespace }}&graphType=workload&injectServiceNodes=false" - -- name: "/namespaces/graph - workload" - uri: - url: "{{ graph_test_url }}" - return_content: yes - validate_certs: false - register: api_results_raw - -- set_fact: - api_namespaces_graph_json: "{{ api_results_raw.json }}" - -- name: "Results: /namespaces/graph: {{ graph_test_url }}" - debug: - msg: "{{ api_namespaces_graph_json }}" - -# JMESPATH tester : https://jmespath.org/ -# Note that "|[0]" simply flattens a list to a string - -- name: Assert that we were able to get the graph info for the small 2-node mesh - assert: - that: - - api_namespaces_graph_json is defined - - api_namespaces_graph_json.duration is defined - - api_namespaces_graph_json.timestamp is defined - - api_namespaces_graph_json.graphType == "workload" - - api_namespaces_graph_json.elements.edges | length == 1 - - api_namespaces_graph_json.elements.nodes | length == 2 - - api_namespaces_graph_json | json_query('elements.nodes[] | [?data.app==`simple-client`].data.nodeType|[0]') == "workload" - - api_namespaces_graph_json | json_query('elements.nodes[] | [?data.app==`simple-client`].data.workload|[0]') == "simple-client" - - api_namespaces_graph_json | json_query('elements.nodes[] | [?data.app==`simple-server`].data.nodeType|[0]') == "workload" - - api_namespaces_graph_json | json_query('elements.nodes[] | [?data.app==`simple-server`].data.workload|[0]') == "simple-server" - - api_namespaces_graph_json | json_query('elements.nodes[] | [?data.app==`simple-server`].data.traffic[0].protocol|[0]') == "http" - - api_namespaces_graph_json | json_query('elements.nodes[] | [?data.app==`simple-server`].data.destServices[0].name|[0]') == "simple-server-svc" - - api_namespaces_graph_json | json_query('elements.edges[0].data.traffic.protocol') == "http" - - api_namespaces_graph_json | json_query('elements.edges[0].data.source') == api_namespaces_graph_json | json_query('elements.nodes[] | [?data.app==`simple-client`].data.id|[0]') - - api_namespaces_graph_json | json_query('elements.edges[0].data.target') == api_namespaces_graph_json | json_query('elements.nodes[] | [?data.app==`simple-server`].data.id|[0]') - -### APP GRAPH ### - -- set_fact: - graph_test_url: "{{ kiali_base_url }}/api/namespaces/graph?namespaces={{ simple_mesh_namespace }}&graphType=app&injectServiceNodes=false" - -- name: "/namespaces/graph - app" - uri: - url: "{{ graph_test_url }}" - return_content: yes - validate_certs: false - register: api_results_raw - -- set_fact: - api_namespaces_graph_json: "{{ api_results_raw.json }}" - -- name: "Results: /namespaces/graph: {{ graph_test_url }}" - debug: - msg: "{{ api_namespaces_graph_json }}" - -- name: Assert that we were able to get the graph info for the small 2-node mesh - assert: - that: - - api_namespaces_graph_json is defined - - api_namespaces_graph_json.duration is defined - - api_namespaces_graph_json.timestamp is defined - - api_namespaces_graph_json.graphType == "app" - - api_namespaces_graph_json.elements.edges | length == 1 - - api_namespaces_graph_json.elements.nodes | length == 2 - - api_namespaces_graph_json | json_query('elements.nodes[] | [?data.app==`simple-client`].data.nodeType|[0]') == "app" - - api_namespaces_graph_json | json_query('elements.nodes[] | [?data.app==`simple-client`].data.app|[0]') == "simple-client" - - api_namespaces_graph_json | json_query('elements.nodes[] | [?data.app==`simple-server`].data.nodeType|[0]') == "app" - - api_namespaces_graph_json | json_query('elements.nodes[] | [?data.app==`simple-server`].data.app|[0]') == "simple-server" - - api_namespaces_graph_json | json_query('elements.nodes[] | [?data.app==`simple-server`].data.traffic[0].protocol|[0]') == "http" - - api_namespaces_graph_json | json_query('elements.nodes[] | [?data.app==`simple-server`].data.destServices[0].name|[0]') == "simple-server-svc" - - api_namespaces_graph_json | json_query('elements.edges[0].data.traffic.protocol') == "http" - - api_namespaces_graph_json | json_query('elements.edges[0].data.source') == api_namespaces_graph_json | json_query('elements.nodes[] | [?data.app==`simple-client`].data.id|[0]') - - api_namespaces_graph_json | json_query('elements.edges[0].data.target') == api_namespaces_graph_json | json_query('elements.nodes[] | [?data.app==`simple-server`].data.id|[0]') - -### VERSIONED APP GRAPH ### - -- set_fact: - graph_test_url: "{{ kiali_base_url }}/api/namespaces/graph?namespaces={{ simple_mesh_namespace }}&graphType=versionedApp&injectServiceNodes=false" - -- name: "/namespaces/graph - versionedApp" - uri: - url: "{{ graph_test_url }}" - return_content: yes - validate_certs: false - register: api_results_raw - -- set_fact: - api_namespaces_graph_json: "{{ api_results_raw.json }}" - -- name: "Results: /namespaces/graph: {{ graph_test_url }}" - debug: - msg: "{{ api_namespaces_graph_json }}" - -- name: Assert that we were able to get the graph info for the small 2-node mesh - assert: - that: - - api_namespaces_graph_json is defined - - api_namespaces_graph_json.duration is defined - - api_namespaces_graph_json.timestamp is defined - - api_namespaces_graph_json.graphType == "versionedApp" - - api_namespaces_graph_json.elements.edges | length == 1 - - api_namespaces_graph_json.elements.nodes | length == 2 - - api_namespaces_graph_json | json_query('elements.nodes[] | [?data.app==`simple-client`].data.nodeType|[0]') == "app" - - api_namespaces_graph_json | json_query('elements.nodes[] | [?data.app==`simple-client`].data.app|[0]') == "simple-client" - - api_namespaces_graph_json | json_query('elements.nodes[] | [?data.app==`simple-server`].data.nodeType|[0]') == "app" - - api_namespaces_graph_json | json_query('elements.nodes[] | [?data.app==`simple-server`].data.app|[0]') == "simple-server" - - api_namespaces_graph_json | json_query('elements.nodes[] | [?data.app==`simple-server`].data.traffic[0].protocol|[0]') == "http" - - api_namespaces_graph_json | json_query('elements.nodes[] | [?data.app==`simple-server`].data.destServices[0].name|[0]') == "simple-server-svc" - - api_namespaces_graph_json | json_query('elements.edges[0].data.traffic.protocol') == "http" - - api_namespaces_graph_json | json_query('elements.edges[0].data.source') == api_namespaces_graph_json | json_query('elements.nodes[] | [?data.app==`simple-client`].data.id|[0]') - - api_namespaces_graph_json | json_query('elements.edges[0].data.target') == api_namespaces_graph_json | json_query('elements.nodes[] | [?data.app==`simple-server`].data.id|[0]') - -### SERVICE GRAPH ### - -- set_fact: - graph_test_url: "{{ kiali_base_url }}/api/namespaces/graph?namespaces={{ simple_mesh_namespace }}&graphType=service" - -- name: "/namespaces/graph - service" - uri: - url: "{{ graph_test_url }}" - return_content: yes - validate_certs: false - register: api_results_raw - -- set_fact: - api_namespaces_graph_json: "{{ api_results_raw.json }}" - -- name: "Results: /namespaces/graph: {{ graph_test_url }}" - debug: - msg: "{{ api_namespaces_graph_json }}" - -- name: Assert that we were able to get the graph info for the small 2-node mesh - assert: - that: - - api_namespaces_graph_json is defined - - api_namespaces_graph_json.duration is defined - - api_namespaces_graph_json.timestamp is defined - - api_namespaces_graph_json.graphType == "service" - - api_namespaces_graph_json.elements.edges | length == 1 - - api_namespaces_graph_json.elements.nodes | length == 2 - - api_namespaces_graph_json | json_query('elements.nodes[] | [?data.app==`simple-client`].data.nodeType|[0]') == "workload" - - api_namespaces_graph_json | json_query('elements.nodes[] | [?data.app==`simple-client`].data.workload|[0]') == "simple-client" - - api_namespaces_graph_json | json_query('elements.nodes[] | [?data.app==`simple-server`].data.nodeType|[0]') == "service" - - api_namespaces_graph_json | json_query('elements.nodes[] | [?data.app==`simple-server`].data.service|[0]') == "simple-server-svc" - - api_namespaces_graph_json | json_query('elements.nodes[] | [?data.app==`simple-server`].data.traffic[0].protocol|[0]') == "http" - - api_namespaces_graph_json | json_query('elements.nodes[] | [?data.app==`simple-server`].data.destServices[0].name|[0]') == "simple-server-svc" - - api_namespaces_graph_json | json_query('elements.edges[0].data.traffic.protocol') == "http" - - api_namespaces_graph_json | json_query('elements.edges[0].data.source') == api_namespaces_graph_json | json_query('elements.nodes[] | [?data.app==`simple-client`].data.id|[0]') - - api_namespaces_graph_json | json_query('elements.edges[0].data.target') == api_namespaces_graph_json | json_query('elements.nodes[] | [?data.app==`simple-server`].data.id|[0]') diff --git a/molecule/api-test/health.test.yaml b/molecule/api-test/health.test.yaml deleted file mode 100644 index 522185a7..00000000 --- a/molecule/api-test/health.test.yaml +++ /dev/null @@ -1,24 +0,0 @@ -- name: "/namespaces/{namespace}/health" - vars: - param_namespace: "{{ simple_mesh_namespace }}" - uri: - url: "{{ kiali_base_url }}/api/namespaces/{{ param_namespace }}/health" - return_content: yes - validate_certs: false - register: api_results_raw - -- set_fact: - api_namespaces_health_json: "{{ api_results_raw.json }}" - -- name: "Results: /namespaces/{namespace}/health" - debug: - msg: "{{ api_namespaces_health_json }}" - -- name: Assert that we were able to get the health info - assert: - that: - - api_namespaces_health_json is defined - - api_namespaces_health_json["simple-client"].requests is defined - - api_namespaces_health_json["simple-client"].workloadStatuses[0].name == "simple-client" - - api_namespaces_health_json["simple-server"].requests is defined - - api_namespaces_health_json["simple-server"].workloadStatuses[0].name == "simple-server" diff --git a/molecule/api-test/healthz.test.yaml b/molecule/api-test/healthz.test.yaml deleted file mode 100644 index 1bdb638a..00000000 --- a/molecule/api-test/healthz.test.yaml +++ /dev/null @@ -1,5 +0,0 @@ -- name: "/healthz" - uri: - url: "{{ kiali_base_url }}/healthz" - return_content: no - validate_certs: false diff --git a/molecule/api-test/istio-config.test.yaml b/molecule/api-test/istio-config.test.yaml deleted file mode 100644 index b50b8c42..00000000 --- a/molecule/api-test/istio-config.test.yaml +++ /dev/null @@ -1,22 +0,0 @@ -- name: "/namespaces/{namespace}/istio" - vars: - param_namespace: "{{ simple_mesh_namespace }}" - uri: - url: "{{ kiali_base_url }}/api/namespaces/{{ param_namespace }}/istio" - return_content: yes - validate_certs: false - register: api_results_raw - -- set_fact: - api_namespaces_istio_json: "{{ api_results_raw.json }}" - -- name: "Results: /namespaces/{namespace}/istio" - debug: - msg: "{{ api_namespaces_istio_json }}" - -- name: Assert that we were able to get the namespaces-istio info - assert: - that: - - api_namespaces_istio_json is defined - - api_namespaces_istio_json.gateways is defined - - api_namespaces_istio_json.virtualServices is defined diff --git a/molecule/api-test/istio-permissions.test.yaml b/molecule/api-test/istio-permissions.test.yaml deleted file mode 100644 index 72e92b4b..00000000 --- a/molecule/api-test/istio-permissions.test.yaml +++ /dev/null @@ -1,18 +0,0 @@ -- name: "/istio/permissions" - uri: - url: "{{ kiali_base_url }}/api/istio/permissions" - return_content: yes - validate_certs: false - register: api_results_raw - -- set_fact: - api_istio_permissions_json: "{{ api_results_raw.json }}" - -- name: "Results: /istio/permissions" - debug: - msg: "{{ api_istio_permissions_json }}" - -- name: Assert that we were able to get the Istio permissions info - assert: - that: - - api_istio_permissions_json is defined diff --git a/molecule/api-test/istio-status.test.yaml b/molecule/api-test/istio-status.test.yaml deleted file mode 100644 index 86fb7016..00000000 --- a/molecule/api-test/istio-status.test.yaml +++ /dev/null @@ -1,18 +0,0 @@ -- name: "/istio/status" - uri: - url: "{{ kiali_base_url }}/api/istio/status" - return_content: yes - validate_certs: false - register: api_results_raw - -- set_fact: - api_istio_status_json: "{{ api_results_raw.json }}" - -- name: "Results: /istio/status" - debug: - msg: "{{ api_istio_status_json }}" - -- name: Assert that we were able to get the istio-status info - assert: - that: - - api_istio_status_json is defined diff --git a/molecule/api-test/kiali-cr.yaml b/molecule/api-test/kiali-cr.yaml deleted file mode 100644 index 37ff3fd1..00000000 --- a/molecule/api-test/kiali-cr.yaml +++ /dev/null @@ -1,23 +0,0 @@ -apiVersion: kiali.io/v1alpha1 -kind: Kiali -metadata: - name: kiali -spec: - version: {{ kiali.spec_version }} - istio_namespace: {{ istio.control_plane_namespace }} - auth: - strategy: anonymous - # this will test that we can remove the "go" custom monitoring dashboard - custom_dashboards: - - name: go - deployment: - ingress: - enabled: true - logger: - log_level: debug - accessible_namespaces: {{ kiali.accessible_namespaces }} - image_name: "{{ kiali.image_name }}" - image_pull_policy: {{ kiali.image_pull_policy }} - image_version: "{{ kiali.image_version }}" - namespace: {{ kiali.install_namespace }} - service_type: {{ 'LoadBalancer' if is_kind else 'NodePort' }} diff --git a/molecule/api-test/metrics.test.yaml b/molecule/api-test/metrics.test.yaml deleted file mode 100644 index 2df021b5..00000000 --- a/molecule/api-test/metrics.test.yaml +++ /dev/null @@ -1,20 +0,0 @@ -- name: "/namespaces/{namespace}/metrics" - vars: - param_namespace: "{{ simple_mesh_namespace }}" - uri: - url: "{{ kiali_base_url }}/api/namespaces/{{ param_namespace }}/metrics" - return_content: yes - validate_certs: false - register: api_results_raw - -- set_fact: - api_namespaces_metrics_json: "{{ api_results_raw.json }}" - -- name: "Results: /namespaces/{namespace}/metrics" - debug: - msg: "{{ api_namespaces_metrics_json }}" - -- name: Assert that we were able to get the metrics info - assert: - that: - - api_namespaces_metrics_json is defined diff --git a/molecule/api-test/molecule.yml b/molecule/api-test/molecule.yml deleted file mode 100644 index 38f83b03..00000000 --- a/molecule/api-test/molecule.yml +++ /dev/null @@ -1,47 +0,0 @@ ---- -dependency: - name: galaxy -driver: - name: $DORP -platforms: -- name: default - groups: - - k8s -provisioner: - name: ansible - config_options: - defaults: - callback_enabled: junit - playbooks: - destroy: ../default/destroy.yml - prepare: ../default/prepare.yml - cleanup: ./cleanup.yml - inventory: - group_vars: - all: - test_dir_path: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') }}/molecule/api-test" - cr_file_path: "{{ test_dir_path }}/kiali-cr.yaml" - cr_namespace: "{{ 'kiali-operator' if (lookup('env', 'MOLECULE_OPERATOR_INSTALLER') | default('helm', True) == 'helm') else 'istio-system' }}" # if external operator, assume CR must go in control plane namespace - wait_retries: "{{ lookup('env', 'MOLECULE_WAIT_RETRIES') | default('360', True) }}" - simple_mesh_namespace: "simple-mesh" - istio: - control_plane_namespace: istio-system - kiali: - spec_version: "{{ lookup('env', 'MOLECULE_KIALI_CR_SPEC_VERSION') | default('default', True) }}" - install_namespace: istio-system - accessible_namespaces: ["**"] - operator_namespace: "{{ 'kiali-operator' if (lookup('env', 'MOLECULE_OPERATOR_INSTALLER') | default('helm', True) == 'helm') else ('openshift-operators' if (query('kubernetes.core.k8s', kind='Namespace', resource_name='openshift-operators') | length > 0) else 'operators') }}" # if external operator, assume operator is in OLM location - operator_image_name: "{{ 'image-registry.openshift-image-registry.svc:5000/kiali/kiali-operator' if lookup('env', 'MOLECULE_KIALI_OPERATOR_IMAGE_NAME') == 'dev' else (lookup('env', 'MOLECULE_KIALI_OPERATOR_IMAGE_NAME')|default('quay.io/kiali/kiali-operator', True)) }}" - operator_version: "{{ lookup('env', 'MOLECULE_KIALI_OPERATOR_IMAGE_VERSION')|default('latest', True) }}" - operator_watch_namespace: kiali-operator - operator_cluster_role_creator: "true" - image_name: "{{ 'image-registry.openshift-image-registry.svc:5000/kiali/kiali' if lookup('env', 'MOLECULE_KIALI_IMAGE_NAME') == 'dev' else ('quay.io/kiali/kiali' if ansible_env.MOLECULE_KIALI_IMAGE_NAME is not defined else lookup('env', 'MOLECULE_KIALI_IMAGE_NAME')) }}" - image_version: "{{ 'latest' if ansible_env.MOLECULE_KIALI_IMAGE_VERSION is not defined else lookup('env', 'MOLECULE_KIALI_IMAGE_VERSION') }}" - image_pull_policy: "{{ lookup('env', 'MOLECULE_KIALI_IMAGE_PULL_POLICY')|default('Always', True) }}" - operator_image_pull_policy: "{{ lookup('env', 'MOLECULE_KIALI_OPERATOR_IMAGE_PULL_POLICY')|default('Always', True) }}" -scenario: - name: api-test - test_sequence: - - prepare - - converge - - destroy diff --git a/molecule/api-test/namespaces.test.yaml b/molecule/api-test/namespaces.test.yaml deleted file mode 100644 index c36c8a1f..00000000 --- a/molecule/api-test/namespaces.test.yaml +++ /dev/null @@ -1,18 +0,0 @@ -- name: "/namespaces" - uri: - url: "{{ kiali_base_url }}/api/namespaces" - return_content: yes - validate_certs: false - register: api_results_raw - -- set_fact: - api_namespaces_json: "{{ api_results_raw.json }}" - -- name: "Results: /namespaces" - debug: - msg: "{{ api_namespaces_json }}" - -- name: Assert that we were able to get the list of namespaces - assert: - that: - - api_namespaces_json | length > 0 diff --git a/molecule/api-test/services.test.yaml b/molecule/api-test/services.test.yaml deleted file mode 100644 index c4f34f48..00000000 --- a/molecule/api-test/services.test.yaml +++ /dev/null @@ -1,25 +0,0 @@ -- name: "/namespaces/{namespace}/services" - vars: - param_namespace: "{{ simple_mesh_namespace }}" - uri: - url: "{{ kiali_base_url }}/api/namespaces/{{ param_namespace }}/services" - return_content: yes - validate_certs: false - register: api_results_raw - -- set_fact: - api_namespaces_services_json: "{{ api_results_raw.json }}" - -- name: "Results: /namespaces/{namespace}/services" - debug: - msg: "{{ api_namespaces_services_json }}" - -- name: Assert that we were able to get the services info - assert: - that: - - api_namespaces_services_json is defined - - api_namespaces_services_json.namespace.name == simple_mesh_namespace - - api_namespaces_services_json.services | length == 1 - - api_namespaces_services_json | json_query('services[?name==`simple-server-svc`].istioSidecar') | join == "True" - - api_namespaces_services_json | json_query('services[?name==`simple-server-svc`].labels.app') | join == "simple-server" - - api_namespaces_services_json | json_query('services[?name==`simple-server-svc`].labels.version') | join == "v99" diff --git a/molecule/api-test/status.test.yaml b/molecule/api-test/status.test.yaml deleted file mode 100644 index cbe64eae..00000000 --- a/molecule/api-test/status.test.yaml +++ /dev/null @@ -1,26 +0,0 @@ -- name: "/status" - uri: - url: "{{ kiali_base_url }}/api/status" - return_content: yes - validate_certs: false - register: api_results_raw - -- set_fact: - api_status_json: "{{ api_results_raw.json }}" - -- name: "Results: /status" - debug: - msg: "{{ api_status_json }}" - -- name: Assert that we were able to get the status info - assert: - that: - - api_status_json is defined - - api_status_json.externalServices is defined - - api_status_json.status is defined - - api_status_json.status['Kiali container version'] is defined - - api_status_json.status['Kiali commit hash'] is defined - - api_status_json.status['Kiali version'] is defined - - api_status_json.status['Kiali state'] == 'running' - - api_status_json.istioEnvironment is defined - - api_status_json.istioEnvironment.isMaistra == is_maistra diff --git a/molecule/api-test/tls.test.yaml b/molecule/api-test/tls.test.yaml deleted file mode 100644 index e8621961..00000000 --- a/molecule/api-test/tls.test.yaml +++ /dev/null @@ -1,21 +0,0 @@ -- name: "/namespaces/{namespace}/tls" - vars: - param_namespace: "{{ simple_mesh_namespace }}" - uri: - url: "{{ kiali_base_url }}/api/namespaces/{{ param_namespace }}/tls" - return_content: yes - validate_certs: false - register: api_results_raw - -- set_fact: - api_namespaces_tls_json: "{{ api_results_raw.json }}" - -- name: "Results: /namespaces/{namespace}/tls" - debug: - msg: "{{ api_namespaces_tls_json }}" - -- name: Assert that we were able to get the tls info - assert: - that: - - api_namespaces_tls_json is defined - - api_namespaces_tls_json.status is defined diff --git a/molecule/api-test/validations.test.yaml b/molecule/api-test/validations.test.yaml deleted file mode 100644 index 26db5256..00000000 --- a/molecule/api-test/validations.test.yaml +++ /dev/null @@ -1,23 +0,0 @@ -- name: "/namespaces/{namespace}/validations" - vars: - param_namespace: "{{ simple_mesh_namespace }}" - uri: - url: "{{ kiali_base_url }}/api/namespaces/{{ param_namespace }}/validations" - return_content: yes - validate_certs: false - register: api_results_raw - -- set_fact: - api_namespaces_validations_json: "{{ api_results_raw.json }}" - -- name: "Results: /namespaces/{namespace}/validations" - debug: - msg: "{{ api_namespaces_validations_json }}" - -- name: Assert that we were able to get the validations info - assert: - that: - - api_namespaces_validations_json is defined - - api_namespaces_validations_json.errors is defined - - api_namespaces_validations_json.warnings is defined - - api_namespaces_validations_json.objectCount is defined diff --git a/molecule/api-test/workloads.test.yaml b/molecule/api-test/workloads.test.yaml deleted file mode 100644 index 60f896cf..00000000 --- a/molecule/api-test/workloads.test.yaml +++ /dev/null @@ -1,28 +0,0 @@ -- name: "/namespaces/{namespace}/workloads" - vars: - param_namespace: "{{ simple_mesh_namespace }}" - uri: - url: "{{ kiali_base_url }}/api/namespaces/{{ param_namespace }}/workloads" - return_content: yes - validate_certs: false - register: api_results_raw - -- set_fact: - api_namespaces_workloads_json: "{{ api_results_raw.json }}" - -- name: "Results: /namespaces/{namespace}/workloads" - debug: - msg: "{{ api_namespaces_workloads_json }}" - -- name: Assert that we were able to get the workloads info - assert: - that: - - api_namespaces_workloads_json is defined - - api_namespaces_workloads_json.namespace.name == simple_mesh_namespace - - api_namespaces_workloads_json.workloads | length == 2 - - api_namespaces_workloads_json | json_query('workloads[?name==`simple-client`].istioSidecar') | join == "True" - - api_namespaces_workloads_json | json_query('workloads[?name==`simple-client`].labels.app') | join == "simple-client" - - api_namespaces_workloads_json | json_query('workloads[?name==`simple-client`].labels.version') | join == "v99" - - api_namespaces_workloads_json | json_query('workloads[?name==`simple-server`].istioSidecar') | join == "True" - - api_namespaces_workloads_json | json_query('workloads[?name==`simple-server`].labels.app') | join == "simple-server" - - api_namespaces_workloads_json | json_query('workloads[?name==`simple-server`].labels.version') | join == "v99"