From 6bac5ffaa2e491f4d730966d693f71d29dcaccae Mon Sep 17 00:00:00 2001 From: stefanprodan Date: Thu, 5 Sep 2019 01:08:26 +0300 Subject: [PATCH] Add gPRC port and service name to chart --- charts/podinfo/templates/deployment.yaml | 36 ++++++++++++++++++------ charts/podinfo/templates/service.yaml | 6 ++++ charts/podinfo/values.yaml | 6 ++-- 3 files changed, 38 insertions(+), 10 deletions(-) diff --git a/charts/podinfo/templates/deployment.yaml b/charts/podinfo/templates/deployment.yaml index 1d0189f..3de0833 100644 --- a/charts/podinfo/templates/deployment.yaml +++ b/charts/podinfo/templates/deployment.yaml @@ -8,7 +8,9 @@ metadata: release: {{ .Release.Name }} heritage: {{ .Release.Service }} spec: + {{- if and (not .Values.hpa.enabled) (gt .Values.replicaCount 1.0) }} replicas: {{ .Values.replicaCount }} + {{- end }} strategy: type: RollingUpdate rollingUpdate: @@ -23,10 +25,11 @@ spec: app: {{ template "podinfo.name" . }} release: {{ .Release.Name }} annotations: - prometheus.io/scrape: 'true' + prometheus.io/scrape: "true" + prometheus.io/port: "{{ .Values.service.httpPort }}" spec: terminationGracePeriodSeconds: 30 - {{- if .Values.serviceAccount.create }} + {{- if .Values.serviceAccount.enabled }} serviceAccountName: {{ template "podinfo.serviceAccountName" . }} {{- end }} containers: @@ -35,13 +38,20 @@ spec: imagePullPolicy: {{ .Values.image.pullPolicy }} command: - ./podinfo - - --port={{ .Values.service.containerPort }} + - --port={{ .Values.service.httpPort | default 9898 }} + {{- if .Values.service.metricsPort }} + - --port-metrics={{ .Values.service.metricsPort }} + {{- end }} + {{- if .Values.service.grpcPort }} + - --grpc-port={{ .Values.service.grpcPort }} + {{- end }} + {{- if .Values.service.grpcService }} + - --grpc-service-name={{ .Values.service.grpcService }} + {{- end }} - --level={{ .Values.logLevel }} - --random-delay={{ .Values.faults.delay }} - --random-error={{ .Values.faults.error }} env: - - name: PODINFO_UI_COLOR - value: {{ .Values.color }} {{- if .Values.message }} - name: PODINFO_UI_MESSAGE value: {{ .Values.message }} @@ -52,15 +62,25 @@ spec: {{- end }} ports: - name: http - containerPort: {{ .Values.service.containerPort }} + containerPort: {{ .Values.service.httpPort | default 9898 }} protocol: TCP + {{- if .Values.service.metricsPort }} + - name: http-metrics + containerPort: {{ .Values.service.metricsPort }} + protocol: TCP + {{- end }} + {{- if .Values.service.grpcPort }} + - name: grpc + containerPort: {{ .Values.service.grpcPort }} + protocol: TCP + {{- end }} livenessProbe: exec: command: - podcli - check - http - - localhost:{{ .Values.service.containerPort }}/healthz + - localhost:{{ .Values.service.httpPort | default 9898 }}/healthz initialDelaySeconds: 1 timeoutSeconds: 5 readinessProbe: @@ -69,7 +89,7 @@ spec: - podcli - check - http - - localhost:{{ .Values.service.containerPort }}/readyz + - localhost:{{ .Values.service.httpPort | default 9898 }}/readyz initialDelaySeconds: 1 timeoutSeconds: 5 volumeMounts: diff --git a/charts/podinfo/templates/service.yaml b/charts/podinfo/templates/service.yaml index f0b175f..9daa442 100644 --- a/charts/podinfo/templates/service.yaml +++ b/charts/podinfo/templates/service.yaml @@ -18,6 +18,12 @@ spec: {{- if (and (eq .Values.service.type "NodePort") (not (empty .Values.service.nodePort))) }} nodePort: {{ .Values.service.nodePort }} {{- end }} + {{- if .Values.service.grpcPort }} + - port: {{ .Values.service.grpcPort }} + targetPort: grpc + protocol: TCP + name: grpc + {{- end }} selector: app: {{ template "podinfo.name" . }} release: {{ .Release.Name }} diff --git a/charts/podinfo/values.yaml b/charts/podinfo/values.yaml index 9910b7c..c8f8dbe 100644 --- a/charts/podinfo/values.yaml +++ b/charts/podinfo/values.yaml @@ -2,7 +2,6 @@ replicaCount: 1 logLevel: info -color: blue backend: #http://backend-podinfo:9898/echo message: #UI greetings @@ -18,8 +17,11 @@ image: service: enabled: true type: ClusterIP + metricsPort: 9797 + httpPort: 9898 externalPort: 9898 - containerPort: 9898 + grpcPort: 9999 + grpcService: podinfo nodePort: 31198 # metrics-server add-on required