Some checks failed
Continuous Integration - Pull Request / code-tests (pull_request) Has been cancelled
Continuous Integration - Pull Request / deployment-tests (local-code) (pull_request) Has been cancelled
helm-chart-ci / helm-chart-ci (pull_request) Has been cancelled
kubevious-manifests-ci / kubevious-manifests-ci (pull_request) Has been cancelled
kustomize-build-ci / kustomize-build-ci (pull_request) Has been cancelled
terraform-validate-ci / terraform-validate-ci (pull_request) Has been cancelled
Clean up deployment / cleanup-namespace (pull_request) Has been cancelled
Continuous Integration - Main/Release / code-tests (push) Has been cancelled
Continuous Integration - Main/Release / deployment-tests (local-code) (push) Has been cancelled
helm-chart-ci / helm-chart-ci (push) Has been cancelled
kubevious-manifests-ci / kubevious-manifests-ci (push) Has been cancelled
kustomize-build-ci / kustomize-build-ci (push) Has been cancelled
terraform-validate-ci / terraform-validate-ci (push) Has been cancelled
195 lines
5.3 KiB
YAML
195 lines
5.3 KiB
YAML
# Copyright 2024 Google LLC
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# https://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
{{- if .Values.currencyService.create }}
|
|
{{- if .Values.serviceAccounts.create }}
|
|
apiVersion: v1
|
|
kind: ServiceAccount
|
|
metadata:
|
|
name: {{ .Values.currencyService.name }}
|
|
namespace: {{.Release.Namespace}}
|
|
{{- if not .Values.serviceAccounts.annotationsOnlyForCartservice }}
|
|
{{- with .Values.serviceAccounts.annotations }}
|
|
annotations:
|
|
{{- toYaml . | nindent 4 }}
|
|
{{- end }}
|
|
{{- end }}
|
|
---
|
|
{{- end }}
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: {{ .Values.currencyService.name }}
|
|
namespace: {{ .Release.Namespace }}
|
|
labels:
|
|
app: {{ .Values.currencyService.name }}
|
|
spec:
|
|
selector:
|
|
matchLabels:
|
|
app: {{ .Values.currencyService.name }}
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: {{ .Values.currencyService.name }}
|
|
spec:
|
|
{{- if .Values.serviceAccounts.create }}
|
|
serviceAccountName: {{ .Values.currencyService.name }}
|
|
{{- else }}
|
|
serviceAccountName: default
|
|
{{- end }}
|
|
terminationGracePeriodSeconds: 5
|
|
{{- if .Values.securityContext.enable }}
|
|
securityContext:
|
|
fsGroup: 1000
|
|
runAsGroup: 1000
|
|
runAsNonRoot: true
|
|
runAsUser: 1000
|
|
{{- if .Values.seccompProfile.enable }}
|
|
seccompProfile:
|
|
type: {{ .Values.seccompProfile.type }}
|
|
{{- end }}
|
|
{{- end }}
|
|
containers:
|
|
- name: server
|
|
securityContext:
|
|
allowPrivilegeEscalation: false
|
|
capabilities:
|
|
drop:
|
|
- ALL
|
|
privileged: false
|
|
readOnlyRootFilesystem: true
|
|
image: {{ .Values.images.repository }}/{{ .Values.currencyService.name }}:{{ .Values.images.tag | default .Chart.AppVersion }}
|
|
ports:
|
|
- name: grpc
|
|
containerPort: 7000
|
|
env:
|
|
- name: PORT
|
|
value: "7000"
|
|
{{- if .Values.opentelemetryCollector.create }}
|
|
- name: COLLECTOR_SERVICE_ADDR
|
|
value: "{{ .Values.opentelemetryCollector.name }}:4317"
|
|
- name: OTEL_SERVICE_NAME
|
|
value: "{{ .Values.currencyService.name }}"
|
|
{{- end }}
|
|
{{- if .Values.googleCloudOperations.tracing }}
|
|
- name: ENABLE_TRACING
|
|
value: "1"
|
|
{{- end }}
|
|
{{- if not .Values.googleCloudOperations.profiler }}
|
|
- name: DISABLE_PROFILER
|
|
value: "1"
|
|
{{- end }}
|
|
readinessProbe:
|
|
grpc:
|
|
port: 7000
|
|
livenessProbe:
|
|
grpc:
|
|
port: 7000
|
|
resources:
|
|
{{- toYaml .Values.currencyService.resources | nindent 10 }}
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: {{ .Values.currencyService.name }}
|
|
namespace: {{ .Release.Namespace }}
|
|
labels:
|
|
app: {{ .Values.currencyService.name }}
|
|
spec:
|
|
type: ClusterIP
|
|
selector:
|
|
app: {{ .Values.currencyService.name }}
|
|
ports:
|
|
- name: grpc
|
|
port: 7000
|
|
targetPort: 7000
|
|
{{- if .Values.networkPolicies.create }}
|
|
---
|
|
apiVersion: networking.k8s.io/v1
|
|
kind: NetworkPolicy
|
|
metadata:
|
|
name: {{ .Values.currencyService.name }}
|
|
namespace: {{ .Release.Namespace }}
|
|
spec:
|
|
podSelector:
|
|
matchLabels:
|
|
app: {{ .Values.currencyService.name }}
|
|
policyTypes:
|
|
- Ingress
|
|
- Egress
|
|
ingress:
|
|
- from:
|
|
- podSelector:
|
|
matchLabels:
|
|
app: {{ .Values.frontend.name }}
|
|
- podSelector:
|
|
matchLabels:
|
|
app: {{ .Values.checkoutService.name }}
|
|
ports:
|
|
- port: 7000
|
|
protocol: TCP
|
|
egress:
|
|
- {}
|
|
{{- end }}
|
|
{{- if .Values.sidecars.create }}
|
|
---
|
|
apiVersion: networking.istio.io/v1beta1
|
|
kind: Sidecar
|
|
metadata:
|
|
name: {{ .Values.currencyService.name }}
|
|
namespace: {{ .Release.Namespace }}
|
|
spec:
|
|
workloadSelector:
|
|
labels:
|
|
app: {{ .Values.currencyService.name }}
|
|
egress:
|
|
- hosts:
|
|
- istio-system/*
|
|
{{- if .Values.opentelemetryCollector.create }}
|
|
- ./{{ .Values.opentelemetryCollector.name }}.{{ .Release.Namespace }}.svc.cluster.local
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- if .Values.authorizationPolicies.create }}
|
|
---
|
|
apiVersion: security.istio.io/v1beta1
|
|
kind: AuthorizationPolicy
|
|
metadata:
|
|
name: {{ .Values.currencyService.name }}
|
|
namespace: {{ .Release.Namespace }}
|
|
spec:
|
|
selector:
|
|
matchLabels:
|
|
app: {{ .Values.currencyService.name }}
|
|
rules:
|
|
- from:
|
|
- source:
|
|
principals:
|
|
{{- if .Values.serviceAccounts.create }}
|
|
- cluster.local/ns/{{ .Release.Namespace }}/sa/{{ .Values.frontend.name }}
|
|
- cluster.local/ns/{{ .Release.Namespace }}/sa/{{ .Values.checkoutService.name }}
|
|
{{- else }}
|
|
- cluster.local/ns/{{ .Release.Namespace }}/sa/default
|
|
{{- end }}
|
|
to:
|
|
- operation:
|
|
paths:
|
|
- /hipstershop.CurrencyService/Convert
|
|
- /hipstershop.CurrencyService/GetSupportedCurrencies
|
|
methods:
|
|
- POST
|
|
ports:
|
|
- "7000"
|
|
{{- end }}
|
|
{{- end }}
|