Skip to content

Commit

Permalink
feat: add Istio Service Mesh Gateway & Virtual Service
Browse files Browse the repository at this point in the history
  • Loading branch information
rishabNeu committed Dec 8, 2023
1 parent e0eaa4e commit 11d3807
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 4 deletions.
3 changes: 1 addition & 2 deletions templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
15 changes: 15 additions & 0 deletions templates/istio_gateway.yaml
Original file line number Diff line number Diff line change
@@ -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
33 changes: 33 additions & 0 deletions templates/istio_virtual_service.yaml
Original file line number Diff line number Diff line change
@@ -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
9 changes: 7 additions & 2 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ imagePullSecrets:

namespace: webapp

istio:
gateway:
port: 80
namespace: istio-system

hpa:
metrics:
averageUtilization: 20
Expand Down Expand Up @@ -114,5 +119,5 @@ resources:
memory: "512Mi"
cpu: "0.6"
requests:
memory: "128Mi"
cpu: "0.2"
memory: "512Mi"
cpu: "0.6"

0 comments on commit 11d3807

Please sign in to comment.