Skip to content

Commit

Permalink
support ingress class_name customization
Browse files Browse the repository at this point in the history
  • Loading branch information
jmazzitelli committed Nov 1, 2021
1 parent 6726500 commit 9123c02
Show file tree
Hide file tree
Showing 5 changed files with 109 additions and 15 deletions.
78 changes: 76 additions & 2 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,85 @@ Kiali Helm Charts are published at link:https://kiali.org/helm-charts/index.yaml

For Kiali installation documentation, please see:

* link:https://kiali.io/documentation/latest/quick-start/[Kiali Quick Start Guide]
* link:https://kiali.io/documentation/latest/installation-guide/[Kiali Installation Guide]
* link:https://kiali.io/docs/installation/quick-start/#install-via-helm[Kiali Quick Start Guide]
* link:https://kiali.io/docs/installation/installation-guide/install-with-helm/[Kiali Installation Guide]
== Chart Source

Kiali Operator helm chart source is found in the link:./kiali-operator[kiali-operator folder].
Kiali Server helm chart source is found in the link:./kiali-server[kiali-server folder].

== Developer Notes

=== Building

To build the helm charts, simply run `make clean build-helm-charts` which will generate the operator and server helm charts and stores their tarballs in the `_output/charts` directory.

=== Using the local Helm chart builds

==== Server

To generate the server templates, run:

```
helm template -n istio-system --set auth.strategy=anonymous --set deployment.image_version=latest kiali-server _output/charts/kiali-server-*-SNAPSHOT.tgz
```

To install the server, run:

```
helm install -n istio-system --set auth.strategy=anonymous --set deployment.image_version=latest kiali-server _output/charts/kiali-server-*-SNAPSHOT.tgz
```

To uninstall the server, run:

```
helm uninstall -n istio-system kiali-server
```

==== Operator

To generate the operator templates, run:

```
helm template -n kiali-operator --set allowAdHocKialiImage=true --set image.tag=latest --create-namespace kiali-operator _output/charts/kiali-operator-*-SNAPSHOT.tgz
```

To install the operator, run:

```
helm install -n kiali-operator --set allowAdHocKialiImage=true --set image.tag=latest --create-namespace kiali-operator _output/charts/kiali-operator-*-SNAPSHOT.tgz
```

To uninstall the operator, run:

```
helm uninstall -n kiali-operator kiali-operator
```

==== Overriding values

You can pass `--set` options to the above commands if you wish to override the default values. You can set nested dictionary values using dot notation: `--set deployment.logger.log_level=debug`. For a list of items, comma-separate the values and wrap the list in curly braces: `--set "deployment.accessible_namespaces={bookinfo,demo2}"`. You can set individual list items using square brackets: `--set deployment.accessible_namespaces[0]=bookinfo`.

If you locally built and pushed your Kiali server and Kiali operator images to your cluster, you can have the helm chart installations pull those images by the following settings:

|===
|Helm Chart|Cluster Type|Settings

|Server|Minikube|
`--set deployment.image_name=localhost:5000/kiali/kiali` +
`--set deployment.image_version=dev`
|Server|OpenShift|
`--set deployment.image_name=image-registry.openshift-image-registry.svc:5000/kiali/kiali` +
`--set deployment.image_version=dev`
|Operator|Minikube|
`--set image.repo=localhost:5000/kiali/kiali-operator` +
`--set image.tag=dev` +
`--set cr.spec.deployment.image_name=localhost:5000/kiali/kiali` +
`--set cr.spec.deployment.image_version=dev`
|Operator|OpenShift|
`--set image.repo=image-registry.openshift-image-registry.svc:5000/kiali/kiali-operator` +
`--set image.tag=dev` +
`--set cr.spec.deployment.image_name=image-registry.openshift-image-registry.svc:5000/kiali/kiali` +
`--set cr.spec.deployment.image_version=dev`
|===
15 changes: 15 additions & 0 deletions kiali-server/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,21 @@ Determine the default identity private key file. There is no default if on k8s;
{{- end }}
{{- end }}

{{/*
Determine the default deployment.ingress.enabled. Disable it on k8s; enable it on OpenShift.
*/}}
{{- define "kiali-server.deployment.ingress.enabled" -}}
{{- if hasKey .Values.deployment.ingress "enabled" }}
{{- .Values.deployment.ingress.enabled }}
{{- else }}
{{- if .Capabilities.APIVersions.Has "route.openshift.io/v1" }}
{{- true }}
{{- else }}
{{- false }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Determine the istio namespace - default is where Kiali is installed.
*/}}
Expand Down
13 changes: 8 additions & 5 deletions kiali-server/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- if not (.Capabilities.APIVersions.Has "route.openshift.io/v1") }}
{{- if .Values.deployment.ingress_enabled }}
{{- if eq "true" (include "kiali-server.deployment.ingress.enabled" .) }}
---
{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" }}
apiVersion: networking.k8s.io/v1
Expand All @@ -13,8 +13,8 @@ metadata:
labels:
{{- include "kiali-server.labels" . | nindent 4 }}
annotations:
{{- if hasKey .Values.deployment.override_ingress_yaml.metadata "annotations" }}
{{- toYaml .Values.deployment.override_ingress_yaml.metadata.annotations | nindent 4 }}
{{- if hasKey .Values.deployment.ingress.override_yaml.metadata "annotations" }}
{{- toYaml .Values.deployment.ingress.override_yaml.metadata.annotations | nindent 4 }}
{{- else }}
# For ingress-nginx versions older than 0.20.0 use secure-backends.
# (see: https://github.com/kubernetes/ingress-nginx/issues/3416#issuecomment-438247948)
Expand All @@ -28,9 +28,12 @@ metadata:
{{- end }}
{{- end }}
spec:
{{- if hasKey .Values.deployment.override_ingress_yaml "spec" }}
{{- toYaml .Values.deployment.override_ingress_yaml.spec | nindent 2 }}
{{- if hasKey .Values.deployment.ingress.override_yaml "spec" }}
{{- toYaml .Values.deployment.ingress.override_yaml.spec | nindent 2 }}
{{- else }}
{{- if .Values.deployment.ingress.class_name }}
ingressClassName: {{ .Values.deployment.ingress.class_name }}
{{- end }}
rules:
- http:
paths:
Expand Down
10 changes: 5 additions & 5 deletions kiali-server/templates/route.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- if .Capabilities.APIVersions.Has "route.openshift.io/v1" }}
{{- if .Values.deployment.ingress_enabled }}
{{- if .Values.deployment.ingress.enabled }}
# As of OpenShift 4.5, need to use --disable-openapi-validation when installing via Helm
---
apiVersion: route.openshift.io/v1
Expand All @@ -9,13 +9,13 @@ metadata:
namespace: {{ .Release.Namespace }}
labels:
{{- include "kiali-server.labels" . | nindent 4 }}
{{- if hasKey .Values.deployment.override_ingress_yaml.metadata "annotations" }}}
{{- if hasKey .Values.deployment.ingress.override_yaml.metadata "annotations" }}}
annotations:
{{- toYaml .Values.deployment.override_ingress_yaml.metadata.annotations | nindent 4 }}
{{- toYaml .Values.deployment.ingress.override_yaml.metadata.annotations | nindent 4 }}
{{- end }}
spec:
{{- if hasKey .Values.deployment.override_ingress_yaml "spec" }}
{{- toYaml .Values.deployment.override_ingress_yaml.spec | nindent 2 }}
{{- if hasKey .Values.deployment.ingress.override_yaml "spec" }}
{{- toYaml .Values.deployment.ingress.override_yaml.spec | nindent 2 }}
{{- else }}
tls:
termination: reencrypt
Expand Down
8 changes: 5 additions & 3 deletions kiali-server/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,18 @@ deployment:
image_pull_policy: "Always"
image_pull_secrets: []
image_version: ${HELM_IMAGE_TAG} # version like "v1.39" (see: https://quay.io/repository/kiali/kiali?tab=tags) or a digest hash
ingress_enabled: true
ingress:
class_name: "nginx"
#enabled:
override_yaml:
metadata: {}
instance_name: "kiali"
logger:
log_format: "text"
log_level: "info"
time_field_format: "2006-01-02T15:04:05Z07:00"
sampler_rate: "1"
node_selector: {}
override_ingress_yaml:
metadata: {}
pod_annotations: {}
pod_labels: {}
priority_class_name: ""
Expand Down

0 comments on commit 9123c02

Please sign in to comment.