From 11d38070c1df39032221ce9c9ec7420938d8be81 Mon Sep 17 00:00:00 2001 From: Rishab Rajesh Agarwal Date: Thu, 7 Dec 2023 23:54:30 -0500 Subject: [PATCH] feat: add Istio Service Mesh Gateway & Virtual Service --- templates/deployment.yaml | 3 +-- templates/istio_gateway.yaml | 15 +++++++++++++ templates/istio_virtual_service.yaml | 33 ++++++++++++++++++++++++++++ values.yaml | 9 ++++++-- 4 files changed, 56 insertions(+), 4 deletions(-) create mode 100644 templates/istio_gateway.yaml create mode 100644 templates/istio_virtual_service.yaml diff --git a/templates/deployment.yaml b/templates/deployment.yaml index a81e3d1..8bb002d 100644 --- a/templates/deployment.yaml +++ b/templates/deployment.yaml @@ -37,9 +37,8 @@ spec: - name: {{ .Chart.Name }} image: "{{ .Values.image.repository }}/{{ .Values.image.name }}:{{ .Values.image.tag }}" imagePullPolicy: {{ .Values.image.pullPolicy }} - # cpu: "1000m"x resources: - requests: + requests: memory: {{ .Values.resources.requests.memory}} cpu: {{ .Values.resources.requests.cpu}} limits: diff --git a/templates/istio_gateway.yaml b/templates/istio_gateway.yaml new file mode 100644 index 0000000..6c08f7b --- /dev/null +++ b/templates/istio_gateway.yaml @@ -0,0 +1,15 @@ +apiVersion: networking.istio.io/v1alpha3 +kind: Gateway +metadata: + name: {{ .Release.Name }}-gateway + namespace: {{ .Values.istio.namespace }} +spec: + selector: + istio: ingress + servers: + - port: + number: {{ .Values.istio.gateway.port }} # the Gateway port to be exposed + name: http + protocol: HTTP + hosts: + - "*" # accepting requests from all the hosts \ No newline at end of file diff --git a/templates/istio_virtual_service.yaml b/templates/istio_virtual_service.yaml new file mode 100644 index 0000000..4965615 --- /dev/null +++ b/templates/istio_virtual_service.yaml @@ -0,0 +1,33 @@ +apiVersion: networking.istio.io/v1alpha3 +kind: VirtualService +metadata: + name: {{ .Release.Name }}-vs + namespace: {{ .Values.istio.namespace }} +spec: + hosts: + - "*" + gateways: + - {{ .Release.Name }}-gateway + http: + - match: + - port: {{ .Values.istio.gateway.port }} # to match the gateway port basically to bind this to gateway + route: + - destination: + host: {{ .Release.Name }}-service.{{ .Values.namespace }}.svc.cluster.local # to match the service where we need to send the req (here we need to pass the Fully qualified domain name because our service is in different ns as from VS AND GATEWAY) + port: + number: {{.Values.service.port}} # the service port of the webapp + # - route: + # - destination: + # host: infra-helm-release-kafka-broker-0.infra-helm-release-kafka-broker-headless.deps.svc.cluster.local + # port: + # number: 9094 + # - route: + # - destination: + # host: infra-helm-release-kafka-broker-0.infra-helm-release-kafka-broker-headless.deps.svc.cluster.local + # port: + # number: 9094 + # - route: + # - destination: + # host: infra-helm-release-kafka-broker-0.infra-helm-release-kafka-broker-headless.deps.svc.cluster.local + # port: + # number: 9094 \ No newline at end of file diff --git a/values.yaml b/values.yaml index f24d567..dcdf785 100644 --- a/values.yaml +++ b/values.yaml @@ -22,6 +22,11 @@ imagePullSecrets: namespace: webapp +istio: + gateway: + port: 80 + namespace: istio-system + hpa: metrics: averageUtilization: 20 @@ -114,5 +119,5 @@ resources: memory: "512Mi" cpu: "0.6" requests: - memory: "128Mi" - cpu: "0.2" + memory: "512Mi" + cpu: "0.6"