diff options
Diffstat (limited to 'astroshop-helm/shipping/templates')
| -rw-r--r-- | astroshop-helm/shipping/templates/_helpers.tpl | 62 | ||||
| -rw-r--r-- | astroshop-helm/shipping/templates/deployment.yaml | 66 | ||||
| -rw-r--r-- | astroshop-helm/shipping/templates/service.yaml | 16 |
3 files changed, 144 insertions, 0 deletions
diff --git a/astroshop-helm/shipping/templates/_helpers.tpl b/astroshop-helm/shipping/templates/_helpers.tpl new file mode 100644 index 0000000..f08b18d --- /dev/null +++ b/astroshop-helm/shipping/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "shipping.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "shipping.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "shipping.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "shipping.labels" -}} +helm.sh/chart: {{ include "shipping.chart" . }} +{{ include "shipping.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "shipping.selectorLabels" -}} +app.kubernetes.io/name: {{ include "shipping.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "shipping.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "shipping.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/astroshop-helm/shipping/templates/deployment.yaml b/astroshop-helm/shipping/templates/deployment.yaml new file mode 100644 index 0000000..b042e99 --- /dev/null +++ b/astroshop-helm/shipping/templates/deployment.yaml @@ -0,0 +1,66 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + namespace: {{ .Values.namespace }} + name: {{ include "shipping.fullname" . }} + labels: + app.kubernetes.io/component: shippingservice + app.kubernetes.io/part-of: opentelemetry-demo + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "shipping.fullname" . }} + {{- include "shipping.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.opentelemetryDemoShippingservice.replicas }} + revisionHistoryLimit: {{ .Values.opentelemetryDemoShippingservice.revisionHistoryLimit + }} + selector: + matchLabels: + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "shipping.fullname" . }} + {{- include "shipping.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + app.kubernetes.io/component: shippingservice + app.kubernetes.io/instance: opentelemetry-demo + app.kubernetes.io/name: {{ .Values.namespace }}-{{ include "shipping.fullname" . }} + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "shipping.fullname" . }} + {{- include "shipping.selectorLabels" . | nindent 8 }} + spec: + containers: + - env: + - name: OTEL_SERVICE_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.labels['app.kubernetes.io/component'] + - name: OTEL_COLLECTOR_NAME + value: {{ quote .Values.opentelemetryDemoShippingservice.shippingservice.env.otelCollectorName + }} + - name: OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE + value: {{ quote .Values.opentelemetryDemoShippingservice.shippingservice.env.otelExporterOtlpMetricsTemporalityPreference + }} + - name: SHIPPING_PORT + value: {{ quote .Values.opentelemetryDemoShippingservice.shippingservice.env.shippingServicePort + }} + - name: QUOTE_ADDR + value: {{ quote .Values.opentelemetryDemoShippingservice.shippingservice.env.quoteServiceAddr + }} + - name: OTEL_EXPORTER_OTLP_ENDPOINT + value: {{ quote .Values.opentelemetryDemoShippingservice.shippingservice.env.otelExporterOtlpEndpoint + }} + - name: OTEL_RESOURCE_ATTRIBUTES + value: {{ quote .Values.opentelemetryDemoShippingservice.shippingservice.env.otelResourceAttributes + }} + - name: KUBERNETES_CLUSTER_DOMAIN + value: {{ quote .Values.kubernetesClusterDomain }} + image: '{{ .Values.opentelemetryDemoShippingservice.shippingservice.image.repository + }}:{{ .Values.opentelemetryDemoShippingservice.shippingservice.image.tag | default + .Chart.AppVersion }}' + imagePullPolicy: {{ .Values.opentelemetryDemoShippingservice.shippingservice.imagePullPolicy + }} + name: shippingservice + ports: + - containerPort: 8080 + name: service + resources: {{- toYaml .Values.opentelemetryDemoShippingservice.shippingservice.resources + | nindent 10 }} + serviceAccountName: {{ .Values.serviceAccount.name }} diff --git a/astroshop-helm/shipping/templates/service.yaml b/astroshop-helm/shipping/templates/service.yaml new file mode 100644 index 0000000..fb3edbb --- /dev/null +++ b/astroshop-helm/shipping/templates/service.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Values.namespace }}-{{ include "shipping.fullname" . }} + labels: + app.kubernetes.io/component: shippingservice + app.kubernetes.io/part-of: opentelemetry-demo + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "shipping.fullname" . }} + {{- include "shipping.labels" . | nindent 4 }} +spec: + type: {{ .Values.opentelemetryDemoShippingservice.type }} + selector: + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "shipping.fullname" . }} + {{- include "shipping.selectorLabels" . | nindent 4 }} + ports: + {{- .Values.opentelemetryDemoShippingservice.ports | toYaml | nindent 2 }} |
