Skip to content

Commit

Permalink
add new extensions configuration (kiali#787)
Browse files Browse the repository at this point in the history
* add new extensions configuration

* Apply suggestions from code review

Co-authored-by: Jay Shaughnessy <[email protected]>

---------

Co-authored-by: Jay Shaughnessy <[email protected]>
  • Loading branch information
jmazzitelli and jshaughn authored Sep 27, 2024
1 parent 6886b34 commit ea12b9d
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 0 deletions.
5 changes: 5 additions & 0 deletions crd-docs/cr/kiali.io_v1alpha1_kiali.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,11 @@ spec:
version_label: ""
view_only_mode: false

# default: extensions is an empty list
extensions:
- enabled: true
name: "skupper"

external_services:
custom_dashboards:
discovery_auto_threshold: 10
Expand Down
14 changes: 14 additions & 0 deletions crd-docs/crd/kiali.io_kialis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,20 @@ spec:
description: "When true, Kiali will be in 'view only' mode, allowing the user to view and retrieve management and monitoring data for the service mesh, but not allow the user to modify the service mesh."
type: boolean

extensions:
description: |
Defines third-party extensions whose metrics can be integrated into the Kiali traffic graph.
type: array
items:
type: object
properties:
enabled:
description: Determines if the Kiali traffic graph should incorporate the extension's metrics.
type: boolean
name:
description: The name that is used to identify the metric time series for the extension.
type: string

external_services:
description: |
These external service configuration settings define how to connect to the external services
Expand Down
20 changes: 20 additions & 0 deletions molecule/config-values-test/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@
- kiali_pod_spec.dnsPolicy == "ClusterFirst"
- kiali_pod_spec.dnsConfig is not defined

- name: Test the default extensions list is empty
assert:
that:
- kiali_configmap.extensions | length == 0

# This test will change some config settings to make sure things work like we expect.
# We will add additional tasks and asserts in the future to test other config changes.
# We load in the current kiali CR and then alter it with new config and deploy that new CR.
Expand Down Expand Up @@ -204,6 +209,14 @@
set_fact:
current_kiali_cr: "{{ current_kiali_cr | combine({'spec': {'deployment': {'dns': dns_settings}}}, recursive=True) }}"

- name: Add an extension
vars:
extensions:
- name: "skupper"
enabled: false
set_fact:
current_kiali_cr: "{{ current_kiali_cr | combine({'spec': {'extensions': extensions}}, recursive=True) }}"

- name: The new Kiali CR to be tested
debug:
msg: "{{ current_kiali_cr }}"
Expand Down Expand Up @@ -358,3 +371,10 @@
- kiali_pod_spec.dnsPolicy == "Default"
- kiali_pod_spec.dnsConfig.options[0].name == "ndots"
- kiali_pod_spec.dnsConfig.options[0].value == "1"

- name: Test the extensions settings
assert:
that:
- kiali_configmap.extensions | length == 1
- kiali_configmap.extensions[0].name == "skupper"
- kiali_configmap.extensions[0].enabled == False
2 changes: 2 additions & 0 deletions roles/default/kiali-deploy/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ kiali_defaults:
version_label: ""
view_only_mode: false

extensions: []

external_services:
custom_dashboards:
discovery_auto_threshold: 10
Expand Down
7 changes: 7 additions & 0 deletions roles/default/kiali-deploy/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ kiali_vars:
{{ kiali_defaults.deployment }}
{%- endif -%}
extensions: |
{%- if extensions is defined and extensions is iterable -%}
{{ extensions }}
{%- else -%}
{{ kiali_defaults.extensions }}
{%- endif -%}
external_services: |
{%- if external_services is defined and external_services is iterable -%}
{{ kiali_defaults.external_services | combine((external_services | stripnone), recursive=True) }}
Expand Down

0 comments on commit ea12b9d

Please sign in to comment.