Skip to content

Commit

Permalink
remove maistra related things from molecule tests (#716)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmazzitelli authored Nov 3, 2023
1 parent e3c0f58 commit 8ee6504
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 193 deletions.
56 changes: 0 additions & 56 deletions deploy/kiali/kiali_cr_dev_servicemesh.yaml

This file was deleted.

6 changes: 0 additions & 6 deletions molecule/asserts/configmap_asserts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,16 @@
assert:
that:
- kiali_configmap.external_services.prometheus.url == "http://prometheus.{{ istio.control_plane_namespace }}:9090"
when:
is_maistra == False

- name: Assert Kiali Configmap has the correct Grafana Url for Upstream Istio installs
assert:
that:
- kiali_configmap.external_services.grafana.in_cluster_url == "http://grafana.{{ istio.control_plane_namespace }}:3000"
when:
is_maistra == False

- name: Assert Kiali Configmap has correct Version Url for Upstream Istio installs
assert:
that:
- kiali_configmap.external_services.istio.url_service_version == "http://istiod.{{ istio.control_plane_namespace }}:15014/version"
when:
is_maistra == False

- name: Actual Kiali Accessible namespace list should be the same as the CR
assert:
Expand Down
18 changes: 0 additions & 18 deletions molecule/common/tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,6 @@
is_k8s: "{{ False if 'route.openshift.io' in api_groups else True }}"
is_minikube: "{{ True if lookup('env', 'MOLECULE_CLUSTER_TYPE') == 'minikube' else False }}"
is_kind: "{{ True if lookup('env', 'MOLECULE_CLUSTER_TYPE') == 'kind' else False }}"
- name: Determine the Istio implementation
set_fact:
is_maistra: "{{ True if 'maistra.io' in api_groups else False }}"

- name: Get SMCP if running in Maistra environment
k8s_info:
api_version: maistra.io/v2
kind: ServiceMeshControlPlane
namespace: "{{ istio.control_plane_namespace }}"
register: maistra_smcp
when:
- is_maistra == True

- name: There must one and only one SMCP already installed in the control plane
set_fact:
maistra_smcp: "{{ maistra_smcp.resources[0] }}"
when:
- is_maistra == True

- name: Get Kiali CR if present
set_fact:
Expand Down
9 changes: 0 additions & 9 deletions molecule/default/destroy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
is_k8s: "{{ False if 'route.openshift.io' in api_groups else True }}"
is_minikube: "{{ True if lookup('env', 'MOLECULE_CLUSTER_TYPE') == 'minikube' else False }}"
is_kind: "{{ True if lookup('env', 'MOLECULE_CLUSTER_TYPE') == 'kind' else False }}"
- name: Determine the Istio implementation
set_fact:
is_maistra: "{{ True if 'maistra.io' in api_groups else False }}"

- name: Determine if the operator installation is managed externally or not
set_fact:
Expand Down Expand Up @@ -51,12 +48,6 @@
retries: "{{ wait_retries }}"
delay: 5

- name: Delete any NetworkPolicy that was created
import_tasks: process-network-policy.yml
vars:
network_policy_state: "absent"
network_policy_namespace: "{{ kiali.install_namespace }}"

- name: Uninstall Operator via Helm
command:
argv:
Expand Down
74 changes: 0 additions & 74 deletions molecule/default/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,43 +14,11 @@
is_k8s: "{{ False if 'route.openshift.io' in api_groups else True }}"
is_minikube: "{{ True if lookup('env', 'MOLECULE_CLUSTER_TYPE') == 'minikube' else False }}"
is_kind: "{{ True if lookup('env', 'MOLECULE_CLUSTER_TYPE') == 'kind' else False }}"
- name: Determine the Istio implementation
set_fact:
is_maistra: "{{ True if 'maistra.io' in api_groups else False }}"

- name: Determine if the operator installation is managed externally or not
set_fact:
operator_installer: "{{ lookup('env', 'MOLECULE_OPERATOR_INSTALLER') | default('helm', True) }}" # can be 'helm' or 'skip'

- name: Get the SMCP name if on Maistra
k8s_info:
api_version: maistra.io/v2
kind: smcp
namespace: "{{ istio.control_plane_namespace }}"
register: smcp_raw
when:
- is_maistra == True

- set_fact:
smcp_name: "{{ smcp_raw.resources[0].metadata.name }}"
when:
- is_maistra == True

- name: See if we have Maistra htpasswd secret for accessing external services like Prometheus
k8s_info:
api_version: v1
kind: Secret
namespace: "{{ istio.control_plane_namespace }}"
name: htpasswd
register: maistra_secret_htpasswd_raw
when:
- is_maistra == True

- set_fact:
maistra_secret_password: "{{ maistra_secret_htpasswd_raw.resources[0].data.rawPassword | b64decode }}"
when:
- is_maistra == True

- name: Make sure the operator namespace exists
k8s:
state: present
Expand Down Expand Up @@ -124,12 +92,6 @@
kind: Namespace
name: "{{ cr_namespace }}"

- name: Create any NetworkPolicy needed to access the Kiali UI
import_tasks: process-network-policy.yml
vars:
network_policy_state: "present"
network_policy_namespace: "{{ kiali.install_namespace }}"

- name: Wait for the CRD to be established
k8s_info:
api_version: apiextensions.k8s.io/v1
Expand All @@ -143,42 +105,6 @@
set_fact:
kiali_cr_definition: "{{ lookup('template', cr_file_path) }}"

- name: Modify the Kiali CR definition with specific Maistra config for Prometheus, Tracing, Grafana and Istio
vars:
prometheus_config:
url: "https://prometheus.{{ istio.control_plane_namespace }}.svc:9090"
auth:
username: internal
type: basic
use_kiali_token: false
password: "{{ maistra_secret_password }}"
tracing_config:
in_cluster_url: "https://jaeger-query.{{ istio.control_plane_namespace }}.svc"
url: "https://jaeger-query.{{ istio.control_plane_namespace }}.svc"
use_grpc: false # today, OSSM 2.2 and under cannot use gRPC
auth:
username: internal
type: basic
use_kiali_token: false
password: "{{ maistra_secret_password }}"
grafana_config:
in_cluster_url: "https://grafana.{{ istio.control_plane_namespace }}.svc:3000"
url: "https://grafana.{{ istio.control_plane_namespace }}.svc"
auth:
username: internal
type: basic
use_kiali_token: false
password: "{{ maistra_secret_password }}"
istio_config:
config_map_name: "istio-{{ smcp_name }}"
istio_sidecar_injector_config_map_name: "istio-sidecar-injector-{{ smcp_name }}"
istiod_deployment_name: "istiod-{{ smcp_name }}"
url_service_version: "http://istiod-{{ smcp_name }}.{{ istio.control_plane_namespace }}:15014/version"
set_fact:
kiali_cr_definition: "{{ kiali_cr_definition | from_yaml | combine({'spec':{'external_services':{'prometheus': prometheus_config, 'tracing': tracing_config, 'grafana': grafana_config, 'istio': istio_config }}}, recursive=True) | to_yaml }}"
when:
- is_maistra == True

- name: Create Kiali CR
k8s:
namespace: "{{ cr_namespace }}"
Expand Down
19 changes: 0 additions & 19 deletions molecule/default/process-network-policy.yml

This file was deleted.

12 changes: 1 addition & 11 deletions molecule/metrics-test/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,39 +21,29 @@
test_start_time: "{{ ansible_date_time.iso8601 }}"

- set_fact:
# OSSM 2.2 uses Prometheus 2.23.0. Upstream Istio Prometheus addon uses something >2.31.0. The label is different for each.
prom_namespace_label: "{{ 'kubernetes_namespace' if is_maistra == True else 'namespace' }}"
prom_namespace_label: "namespace"

# Operator metrics are always enabled - make sure we have them
# NOTE: Service Mesh/Maistra does NOT collect these metrics, so do not test when running in Maistra env.

# an operator http-metric
- import_tasks: ../common/query-prometheus.yml
vars:
prometheus_request:
query: "workqueue_work_duration_seconds_count{app=\\\"kiali-operator\\\",{{ prom_namespace_label }}=\\\"{{ kiali.operator_namespace }}\\\"}"
time: "{{ test_start_time}}"
when:
- is_maistra != True
- assert:
that:
- prometheus_query_results.json.data.result | length > 0
when:
- is_maistra != True

# an operator build info metric
- import_tasks: ../common/query-prometheus.yml
vars:
prometheus_request:
query: "ansible_operator_build_info"
time: "{{ test_start_time}}"
when:
- is_maistra != True
- assert:
that:
- prometheus_query_results.json.data.result | length > 0
when:
- is_maistra != True

# The test is initialized with Kiali metrics turned off so there should not be any yet
- import_tasks: ../common/query-prometheus.yml
Expand Down

0 comments on commit 8ee6504

Please sign in to comment.