diff options
Diffstat (limited to 'astroshop-helm/ad')
| -rw-r--r-- | astroshop-helm/ad/.helmignore | 23 | ||||
| -rw-r--r-- | astroshop-helm/ad/Chart.yaml | 22 | ||||
| -rw-r--r-- | astroshop-helm/ad/templates/_helpers.tpl | 62 | ||||
| -rw-r--r-- | astroshop-helm/ad/templates/deployment.yaml | 59 | ||||
| -rw-r--r-- | astroshop-helm/ad/templates/service.yaml | 16 | ||||
| -rw-r--r-- | astroshop-helm/ad/values.yaml | 33 |
6 files changed, 215 insertions, 0 deletions
diff --git a/astroshop-helm/ad/.helmignore b/astroshop-helm/ad/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/astroshop-helm/ad/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/astroshop-helm/ad/Chart.yaml b/astroshop-helm/ad/Chart.yaml new file mode 100644 index 0000000..32f770f --- /dev/null +++ b/astroshop-helm/ad/Chart.yaml @@ -0,0 +1,22 @@ +apiVersion: v2 +name: ad +description: A Helm chart for Kubernetes +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "2.1.3" +namespace: opentelemetry-demo
\ No newline at end of file diff --git a/astroshop-helm/ad/templates/_helpers.tpl b/astroshop-helm/ad/templates/_helpers.tpl new file mode 100644 index 0000000..b6d6510 --- /dev/null +++ b/astroshop-helm/ad/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "ad.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 "ad.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 "ad.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "ad.labels" -}} +helm.sh/chart: {{ include "ad.chart" . }} +{{ include "ad.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "ad.selectorLabels" -}} +app.kubernetes.io/name: {{ include "ad.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "ad.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "ad.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/astroshop-helm/ad/templates/deployment.yaml b/astroshop-helm/ad/templates/deployment.yaml new file mode 100644 index 0000000..756b98f --- /dev/null +++ b/astroshop-helm/ad/templates/deployment.yaml @@ -0,0 +1,59 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + namespace: {{ .Values.namespace }} + name: {{ include "ad.fullname" . }} + labels: + app.kubernetes.io/component: adservice + app.kubernetes.io/part-of: opentelemetry-demo + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "ad.fullname" . }} # Changed this line + {{- include "ad.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.opentelemetryDemoAdservice.replicas }} + revisionHistoryLimit: {{ .Values.opentelemetryDemoAdservice.revisionHistoryLimit }} + selector: + matchLabels: + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "ad.fullname" . }} # Changed this line + {{- include "ad.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + app.kubernetes.io/component: adservice + app.kubernetes.io/instance: opentelemetry-demo + app.kubernetes.io/name: {{ .Values.namespace }}-{{ include "ad.fullname" . }} # Changed this line + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "ad.fullname" . }} # Changed this line + {{- include "ad.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.opentelemetryDemoAdservice.adservice.env.otelCollectorName }} + - name: OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE + value: {{ quote .Values.opentelemetryDemoAdservice.adservice.env.otelExporterOtlpMetricsTemporalityPreference }} + - name: AD_PORT + value: {{ quote .Values.opentelemetryDemoAdservice.adservice.env.adServicePort }} + - name: FLAGD_HOST + value: {{ quote .Values.opentelemetryDemoAdservice.adservice.env.flagdHost }} + - name: FLAGD_PORT + value: {{ quote .Values.opentelemetryDemoAdservice.adservice.env.flagdPort }} + - name: OTEL_EXPORTER_OTLP_ENDPOINT + value: {{ quote .Values.opentelemetryDemoAdservice.adservice.env.otelExporterOtlpEndpoint }} + - name: OTEL_LOGS_EXPORTER + value: {{ quote .Values.opentelemetryDemoAdservice.adservice.env.otelLogsExporter }} + - name: OTEL_RESOURCE_ATTRIBUTES + value: {{ quote .Values.opentelemetryDemoAdservice.adservice.env.otelResourceAttributes }} + - name: KUBERNETES_CLUSTER_DOMAIN + value: {{ quote .Values.kubernetesClusterDomain }} + image: {{ .Values.opentelemetryDemoAdservice.adservice.image.repository }}:{{ .Values.opentelemetryDemoAdservice.adservice.image.tag | default .Chart.AppVersion }} + imagePullPolicy: {{ .Values.opentelemetryDemoAdservice.adservice.imagePullPolicy }} + name: adservice + ports: + - containerPort: 8080 + name: service + resources: {{- toYaml .Values.opentelemetryDemoAdservice.adservice.resources | nindent 10 }} + serviceAccountName: {{ .Values.serviceAccount.name }} diff --git a/astroshop-helm/ad/templates/service.yaml b/astroshop-helm/ad/templates/service.yaml new file mode 100644 index 0000000..359ee81 --- /dev/null +++ b/astroshop-helm/ad/templates/service.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Values.namespace }}-{{ include "ad.fullname" . }} + labels: + app.kubernetes.io/component: adservice + app.kubernetes.io/part-of: opentelemetry-demo + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "ad.fullname" . }} + {{- include "ad.labels" . | nindent 4 }} +spec: + type: {{ .Values.opentelemetryDemoAdservice.type }} + selector: + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "ad.fullname" . }} + {{- include "ad.selectorLabels" . | nindent 4 }} + ports: + {{- .Values.opentelemetryDemoAdservice.ports | toYaml | nindent 2 }} diff --git a/astroshop-helm/ad/values.yaml b/astroshop-helm/ad/values.yaml new file mode 100644 index 0000000..dad628c --- /dev/null +++ b/astroshop-helm/ad/values.yaml @@ -0,0 +1,33 @@ +namespace: opentelemetry-demo +kubernetesClusterDomain: cluster.local + +serviceAccount: + name: opentelemetry-demo + version: ">=1.32.0-0" + partOf: opentelemetry-demo + +opentelemetryDemoAdservice: + adservice: + env: + adServicePort: "8080" + flagdHost: opentelemetry-demo-flagd + flagdPort: "8013" + otelCollectorName: opentelemetry-demo-otelcol + otelExporterOtlpEndpoint: http://$(OTEL_COLLECTOR_NAME):4318 + otelExporterOtlpMetricsTemporalityPreference: cumulative + otelLogsExporter: otlp + otelResourceAttributes: service.name=$(OTEL_SERVICE_NAME),service.namespace=opentelemetry-demo,service.version=2.1.3 + image: + repository: ghcr.io/open-telemetry/demo + tag: 2.1.3-ad + imagePullPolicy: IfNotPresent + resources: + limits: + memory: 300Mi + ports: + - name: tcp-service + port: 8080 + targetPort: 8080 + replicas: 1 + revisionHistoryLimit: 10 + type: ClusterIP |
