From 7352237fa9c040aafd80670387ccaa010153ec47 Mon Sep 17 00:00:00 2001 From: Hasindu Malala Achichige <45164356+hasindum@users.noreply.github.com> Date: Thu, 9 Jul 2020 16:01:17 +0530 Subject: [PATCH] chart: add Istio virtual service into loadtester chart (#647) Add Istio virtual service to loadtester chart --- charts/loadtester/README.md | 5 ++++ charts/loadtester/templates/istio-gw.yaml | 30 +++++++++++++++++++++++ charts/loadtester/templates/istio-vs.yaml | 17 +++++++++++++ charts/loadtester/values.yaml | 10 ++++++++ 4 files changed, 62 insertions(+) create mode 100644 charts/loadtester/templates/istio-gw.yaml create mode 100644 charts/loadtester/templates/istio-vs.yaml diff --git a/charts/loadtester/README.md b/charts/loadtester/README.md index 66201207..7c619e48 100644 --- a/charts/loadtester/README.md +++ b/charts/loadtester/README.md @@ -62,6 +62,11 @@ Parameter | Description | Default `logLevel` | Log level can be debug, info, warning, error or panic | `info` `appmesh.enabled` | Create AWS App Mesh v1beta2 virtual node | `false` `appmesh.backends` | AWS App Mesh virtual services | `none` +`istio.enabled` | Create Istio virtual service | `false` +`istio.host` | Loadtester hostname | `flagger-loadtester.flagger` +`istio.gateway.enabled` | Create Istio gateway in namespace | `false` +`istio.tls.enabled` | Enable TLS in gateway ( TLS secrets should be in namespace ) | `false` +`istio.tls.httpsRedirect` | Redirect traffic to TLS port | `false` Specify each parameter using the `--set key=value[,key=value]` argument to `helm upgrade`. For example, diff --git a/charts/loadtester/templates/istio-gw.yaml b/charts/loadtester/templates/istio-gw.yaml new file mode 100644 index 00000000..f6b05242 --- /dev/null +++ b/charts/loadtester/templates/istio-gw.yaml @@ -0,0 +1,30 @@ +{{- if and (.Values.istio.enabled) (.Values.istio.gateway.enabled) }} +apiVersion: networking.istio.io/v1alpha3 +kind: Gateway +metadata: + name: {{ include "loadtester.fullname" . }} +spec: + selector: + istio: ingressgateway + servers: + - port: + number: 80 + name: http-default + protocol: HTTP + hosts: + - {{ .Values.istio.host }} + {{- if .Values.istio.tls.enabled }} + - port: + number: 443 + name: https-default + protocol: HTTPS + tls: + httpsRedirect: {{ .Values.istio.tls.httpsRedirect }} + mode: SIMPLE + serverCertificate: "sds" + privateKey: "sds" + credentialName: {{ include "loadtester.fullname" . }} + hosts: + - {{ .Values.istio.host }} + {{- end }} +{{- end }} diff --git a/charts/loadtester/templates/istio-vs.yaml b/charts/loadtester/templates/istio-vs.yaml new file mode 100644 index 00000000..dd3115d2 --- /dev/null +++ b/charts/loadtester/templates/istio-vs.yaml @@ -0,0 +1,17 @@ +{{- if .Values.istio.enabled }} +apiVersion: networking.istio.io/v1alpha3 +kind: VirtualService +metadata: + name: {{ include "loadtester.fullname" . }} +spec: + gateways: + - {{ include "loadtester.fullname" . }} + hosts: + - {{ .Values.istio.host }} + http: + - route: + - destination: + host: {{ include "loadtester.fullname" . }} + port: + number: {{ .Values.service.port }} +{{- end }} diff --git a/charts/loadtester/values.yaml b/charts/loadtester/values.yaml index 9b30cc3d..d50dcd9e 100644 --- a/charts/loadtester/values.yaml +++ b/charts/loadtester/values.yaml @@ -59,3 +59,13 @@ appmesh: backends: - podinfo - podinfo-canary + +#Istio virtual service and gatway settings. TLS secrets should be in namespace before enbaled it. ( secret format loadtester.fullname ) +istio: + enabled: false + host: flagger-loadtester.flagger + gateway: + enabled: false + tls: + enabled: false + httpsRedirect: false