Skip to content

Commit b366947

Browse files
committed
be able to add containers to Kiali pod
fixes: kiali/kiali#5028
1 parent 747b9a9 commit b366947

File tree

10 files changed

+34
-0
lines changed

10 files changed

+34
-0
lines changed

crd-docs/cr/kiali.io_v1alpha1_kiali.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ spec:
5757

5858
deployment:
5959
accessible_namespaces: ["^((?!(istio-operator|kube-.*|openshift.*|ibm.*|kiali-operator)).)*$"]
60+
additional_pod_containers_yaml: {}
6061
# default: additional_service_yaml is empty
6162
additional_service_yaml:
6263
externalName: "kiali.example.com"

crd-docs/crd/kiali.io_kialis.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,10 @@ spec:
217217
type: array
218218
items:
219219
type: string
220+
additional_pod_containers_yaml:
221+
description: "Additional containers to add to the list of pod containers. Use this to add sidecar(s) to the Kiali pod. Use with care since sidecars may cause the Kiali container itself to operate incorrectly. It is up to the user who added the additional containers to ensure it works properly inside the Kiali pod; Kiali makes no guarantee additional containers will work. You can utilize container environment variables to pass data to the containers via mounted custom secrets (see spec.deployment.custom_secrets)."
222+
type: object
223+
x-kubernetes-preserve-unknown-fields: true
220224
additional_service_yaml:
221225
description: "Additional custom yaml to add to the service definition. This is used mainly to customize the service type. For example, if the `deployment.service_type` is set to 'LoadBalancer' and you want to set the loadBalancerIP, you can do so here with: `additional_service_yaml: { 'loadBalancerIP': '78.11.24.19' }`. Another example would be if the `deployment.service_type` is set to 'ExternalName' you will need to configure the name via: `additional_service_yaml: { 'externalName': 'my.kiali.example.com' }`. A final example would be if external IPs need to be set: `additional_service_yaml: { 'externalIPs': ['80.11.12.10'] }`"
222226
type: object

manifests/kiali-community/1.54.0/manifests/kiali.v1.54.0.clusterserviceversion.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,8 @@ spec:
227227
value: "false"
228228
- name: ALLOW_AD_HOC_KIALI_IMAGE
229229
value: "false"
230+
- name: ALLOW_AD_HOC_CONTAINERS
231+
value: "false"
230232
- name: PROFILE_TASKS_TASK_OUTPUT_LIMIT
231233
value: "100"
232234
- name: ANSIBLE_DEBUG_LOGS

manifests/kiali-ossm/manifests/kiali.clusterserviceversion.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,8 @@ spec:
264264
value: "false"
265265
- name: ALLOW_AD_HOC_KIALI_IMAGE
266266
value: "false"
267+
- name: ALLOW_AD_HOC_CONTAINERS
268+
value: "false"
267269
- name: PROFILE_TASKS_TASK_OUTPUT_LIMIT
268270
value: "100"
269271
- name: ANSIBLE_DEBUG_LOGS

manifests/kiali-upstream/1.54.0/manifests/kiali.v1.54.0.clusterserviceversion.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,8 @@ spec:
227227
value: "false"
228228
- name: ALLOW_AD_HOC_KIALI_IMAGE
229229
value: "false"
230+
- name: ALLOW_AD_HOC_CONTAINERS
231+
value: "false"
230232
- name: PROFILE_TASKS_TASK_OUTPUT_LIMIT
231233
value: "100"
232234
- name: ANSIBLE_DEBUG_LOGS

roles/default/kiali-deploy/defaults/main.yml

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ kiali_defaults:
5252

5353
deployment:
5454
accessible_namespaces: ["^((?!(istio-operator|kube-.*|openshift.*|ibm.*|kiali-operator)).)*$"]
55+
additional_pod_containers_yaml: {}
5556
#additional_service_yaml:
5657
affinity:
5758
node: {}

roles/default/kiali-deploy/tasks/main.yml

+7
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,13 @@
143143
# restrict to 40 chars, not 63, because instance_name is a prefix and we need to prepend additional chars for some resource names (like "-service-account")
144144
- kiali_vars.deployment.instance_name is not regex('^(?![0-9]+$)(?!-)[a-z0-9-]{,40}(?<!-)$')
145145

146+
- name: Only allow ad-hoc containers when appropriate
147+
fail:
148+
msg: "The operator is forbidden from installing additional containers into the Kiali pod."
149+
when:
150+
- kiali_vars.deployment.additional_pod_containers_yaml|length > 0
151+
- lookup('env', 'ALLOW_AD_HOC_CONTAINERS') | default('false', True) != "true"
152+
146153
- set_fact:
147154
status_environment: "{{ status_environment | default({}) | combine({item.0: item.1}) }}"
148155
loop: "{{ data[0] | zip(data[1]) | list }}"

roles/default/kiali-deploy/tasks/snake_camel_case.yaml

+9
Original file line numberDiff line numberDiff line change
@@ -167,3 +167,12 @@
167167
when:
168168
- kiali_vars.external_services.tracing.query_scope is defined
169169
- kiali_vars.external_services.tracing.query_scope | length > 0
170+
171+
- name: Replace snake_case with camelCase in deployment.additional_pod_containers_yaml
172+
set_fact:
173+
kiali_vars: |
174+
{% set a=kiali_vars['deployment'].pop('additional_pod_containers_yaml') %}
175+
{{ kiali_vars | combine({'deployment': {'additional_pod_containers_yaml': current_cr.spec.deployment.additional_pod_containers_yaml }}, recursive=True) }}
176+
when:
177+
- kiali_vars.deployment.additional_pod_containers_yaml is defined
178+
- kiali_vars.deployment.additional_pod_containers_yaml | length > 0

roles/default/kiali-deploy/templates/kubernetes/deployment.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@ spec:
120120
{{ kiali_vars.deployment.resources | to_nice_yaml(indent=0) | trim | indent(10) }}
121121
{% else %}
122122
resources: null
123+
{% endif %}
124+
{% if kiali_vars.deployment.additional_pod_containers_yaml|length > 0 %}
125+
{{ kiali_vars.deployment.additional_pod_containers_yaml | to_nice_yaml(indent=0) | trim | indent(6) }}
123126
{% endif %}
124127
volumes:
125128
- name: kiali-configuration

roles/default/kiali-deploy/templates/openshift/deployment.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@ spec:
124124
{{ kiali_vars.deployment.resources | to_nice_yaml(indent=0) | trim | indent(10) }}
125125
{% else %}
126126
resources: null
127+
{% endif %}
128+
{% if kiali_vars.deployment.additional_pod_containers_yaml|length > 0 %}
129+
{{ kiali_vars.deployment.additional_pod_containers_yaml | to_nice_yaml(indent=0) | trim | indent(6) }}
127130
{% endif %}
128131
volumes:
129132
- name: kiali-configuration

0 commit comments

Comments
 (0)