diff options
Diffstat (limited to 'astroshop-helm')
119 files changed, 4724 insertions, 0 deletions
diff --git a/astroshop-helm/accounting/.helmignore b/astroshop-helm/accounting/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/astroshop-helm/accounting/.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/accounting/Chart.yaml b/astroshop-helm/accounting/Chart.yaml new file mode 100644 index 0000000..5551c3e --- /dev/null +++ b/astroshop-helm/accounting/Chart.yaml @@ -0,0 +1,22 @@ +apiVersion: v2 +name: accounting +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/accounting/templates/_helpers.tpl b/astroshop-helm/accounting/templates/_helpers.tpl new file mode 100644 index 0000000..7304c1e --- /dev/null +++ b/astroshop-helm/accounting/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "accounting.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 "accounting.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 "accounting.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "accounting.labels" -}} +helm.sh/chart: {{ include "accounting.chart" . }} +{{ include "accounting.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "accounting.selectorLabels" -}} +app.kubernetes.io/name: {{ include "accounting.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "accounting.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "accounting.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/astroshop-helm/accounting/templates/deployment.yaml b/astroshop-helm/accounting/templates/deployment.yaml new file mode 100644 index 0000000..37484e7 --- /dev/null +++ b/astroshop-helm/accounting/templates/deployment.yaml @@ -0,0 +1,74 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + namespace: {{ .Values.namespace }} + name: {{ include "accounting.fullname" . }} + labels: + app.kubernetes.io/component: accountingservice + app.kubernetes.io/part-of: opentelemetry-demo + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "accounting.fullname" . }} + {{- include "accounting.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.opentelemetryDemoAccountingservice.replicas }} + revisionHistoryLimit: {{ .Values.opentelemetryDemoAccountingservice.revisionHistoryLimit + }} + selector: + matchLabels: + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "accounting.fullname" . }} + {{- include "accounting.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + app.kubernetes.io/component: accountingservice + app.kubernetes.io/instance: opentelemetry-demo + app.kubernetes.io/name: {{ .Values.namespace }}-{{ include "accounting.fullname" . }} + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "accounting.fullname" . }} + {{- include "accounting.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.opentelemetryDemoAccountingservice.accountingservice.env.otelCollectorName + }} + - name: OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE + value: {{ quote .Values.opentelemetryDemoAccountingservice.accountingservice.env.otelExporterOtlpMetricsTemporalityPreference + }} + - name: KAFKA_ADDR + value: {{ quote .Values.opentelemetryDemoAccountingservice.accountingservice.env.kafkaServiceAddr + }} + - name: OTEL_EXPORTER_OTLP_ENDPOINT + value: {{ quote .Values.opentelemetryDemoAccountingservice.accountingservice.env.otelExporterOtlpEndpoint + }} + - name: OTEL_RESOURCE_ATTRIBUTES + value: {{ quote .Values.opentelemetryDemoAccountingservice.accountingservice.env.otelResourceAttributes + }} + - name: KUBERNETES_CLUSTER_DOMAIN + value: {{ quote .Values.kubernetesClusterDomain }} + image: '{{ .Values.opentelemetryDemoAccountingservice.accountingservice.image.repository + }}:{{ .Values.opentelemetryDemoAccountingservice.accountingservice.image.tag | + default .Chart.AppVersion }}' + imagePullPolicy: {{ .Values.opentelemetryDemoAccountingservice.accountingservice.imagePullPolicy + }} + name: accountingservice + resources: {{- toYaml .Values.opentelemetryDemoAccountingservice.accountingservice.resources + | nindent 10 }} + initContainers: + - command: + - sh + - -c + - until nc -z -v -w30 opentelemetry-demo-kafka 9092; do echo waiting for kafka; + sleep 2; done; + env: + - name: KUBERNETES_CLUSTER_DOMAIN + value: {{ quote .Values.kubernetesClusterDomain }} + image: '{{ .Values.opentelemetryDemoAccountingservice.waitForKafka.image.repository + }}:{{ .Values.opentelemetryDemoAccountingservice.waitForKafka.image.tag | default + .Chart.AppVersion }}' + name: wait-for-kafka + resources: {} + serviceAccountName: {{ .Values.serviceAccount.name }} diff --git a/astroshop-helm/accounting/values.yaml b/astroshop-helm/accounting/values.yaml new file mode 100644 index 0000000..1c55698 --- /dev/null +++ b/astroshop-helm/accounting/values.yaml @@ -0,0 +1,29 @@ +namespace: opentelemetry-demo +kubernetesClusterDomain: cluster.local + +serviceAccount: + name: opentelemetry-demo + version: ">=1.32.0-0" + partOf: opentelemetry-demo + +opentelemetryDemoAccountingservice: + accountingservice: + env: + kafkaServiceAddr: opentelemetry-demo-kafka:9092 + otelCollectorName: opentelemetry-demo-otelcol + otelExporterOtlpEndpoint: http://$(OTEL_COLLECTOR_NAME):4318 + otelExporterOtlpMetricsTemporalityPreference: cumulative + 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-accounting + imagePullPolicy: IfNotPresent + resources: + limits: + memory: 120Mi + replicas: 1 + revisionHistoryLimit: 10 + waitForKafka: + image: + repository: busybox + tag: latest 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 diff --git a/astroshop-helm/cart/.helmignore b/astroshop-helm/cart/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/astroshop-helm/cart/.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/cart/Chart.yaml b/astroshop-helm/cart/Chart.yaml new file mode 100644 index 0000000..e287f70 --- /dev/null +++ b/astroshop-helm/cart/Chart.yaml @@ -0,0 +1,22 @@ +apiVersion: v2 +name: cart +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/cart/templates/_helpers.tpl b/astroshop-helm/cart/templates/_helpers.tpl new file mode 100644 index 0000000..459ede7 --- /dev/null +++ b/astroshop-helm/cart/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "cart.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 "cart.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 "cart.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "cart.labels" -}} +helm.sh/chart: {{ include "cart.chart" . }} +{{ include "cart.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "cart.selectorLabels" -}} +app.kubernetes.io/name: {{ include "cart.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "cart.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "cart.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/astroshop-helm/cart/templates/deployment.yaml b/astroshop-helm/cart/templates/deployment.yaml new file mode 100644 index 0000000..f3f26e8 --- /dev/null +++ b/astroshop-helm/cart/templates/deployment.yaml @@ -0,0 +1,89 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + namespace: {{ .Values.namespace }} + name: {{ include "cart.fullname" . }} + labels: + app.kubernetes.io/component: cartservice + app.kubernetes.io/part-of: opentelemetry-demo + opentelemetry.io/name: opentelemetry-demo-cartservice + {{- include "cart.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.opentelemetryDemoCartservice.replicas }} + revisionHistoryLimit: {{ .Values.opentelemetryDemoCartservice.revisionHistoryLimit + }} + selector: + matchLabels: + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "cart.fullname" . }} + {{- include "cart.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + app.kubernetes.io/component: cartservice + app.kubernetes.io/instance: opentelemetry-demo + app.kubernetes.io/name: {{ .Values.namespace }}-{{ include "cart.fullname" . }} + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "cart.fullname" . }} + {{- include "cart.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.opentelemetryDemoCartservice.cartservice.env.otelCollectorName + }} + - name: OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE + value: {{ quote .Values.opentelemetryDemoCartservice.cartservice.env.otelExporterOtlpMetricsTemporalityPreference + }} + - name: CART_PORT + value: {{ quote .Values.opentelemetryDemoCartservice.cartservice.env.cartServicePort + }} + - name: ASPNETCORE_URLS + value: {{ quote .Values.opentelemetryDemoCartservice.cartservice.env.aspnetcoreUrls + }} + - name: VALKEY_ADDR + value: {{ quote .Values.opentelemetryDemoCartservice.cartservice.env.valkeyAddr + }} + - name: FLAGD_HOST + value: {{ quote .Values.opentelemetryDemoCartservice.cartservice.env.flagdHost + }} + - name: FLAGD_PORT + value: {{ quote .Values.opentelemetryDemoCartservice.cartservice.env.flagdPort + }} + - name: OTEL_EXPORTER_OTLP_ENDPOINT + value: {{ quote .Values.opentelemetryDemoCartservice.cartservice.env.otelExporterOtlpEndpoint + }} + - name: OTEL_RESOURCE_ATTRIBUTES + value: {{ quote .Values.opentelemetryDemoCartservice.cartservice.env.otelResourceAttributes + }} + - name: KUBERNETES_CLUSTER_DOMAIN + value: {{ quote .Values.kubernetesClusterDomain }} + image: '{{ .Values.opentelemetryDemoCartservice.cartservice.image.repository }}:{{ + .Values.opentelemetryDemoCartservice.cartservice.image.tag | default .Chart.AppVersion + }}' + imagePullPolicy: {{ .Values.opentelemetryDemoCartservice.cartservice.imagePullPolicy + }} + name: cartservice + ports: + - containerPort: 8080 + name: service + resources: {{- toYaml .Values.opentelemetryDemoCartservice.cartservice.resources + | nindent 10 }} + initContainers: + - command: + - sh + - -c + - until nc -z -v -w30 opentelemetry-demo-valkey 6379; do echo waiting for valkey; + sleep 2; done; + env: + - name: KUBERNETES_CLUSTER_DOMAIN + value: {{ quote .Values.kubernetesClusterDomain }} + image: '{{ .Values.opentelemetryDemoCartservice.waitForValkey.image.repository }}:{{ + .Values.opentelemetryDemoCartservice.waitForValkey.image.tag | default .Chart.AppVersion + }}' + name: wait-for-valkey + resources: {} + serviceAccountName: {{ .Values.serviceAccount.name }} diff --git a/astroshop-helm/cart/templates/service.yaml b/astroshop-helm/cart/templates/service.yaml new file mode 100644 index 0000000..15a7d66 --- /dev/null +++ b/astroshop-helm/cart/templates/service.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Values.namespace }}-{{ include "cart.fullname" . }} + labels: + app.kubernetes.io/component: cartservice + app.kubernetes.io/part-of: opentelemetry-demo + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "cart.fullname" . }} + {{- include "cart.labels" . | nindent 4 }} +spec: + type: {{ .Values.opentelemetryDemoCartservice.type }} + selector: + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "cart.fullname" . }} + {{- include "cart.selectorLabels" . | nindent 4 }} + ports: + {{- .Values.opentelemetryDemoCartservice.ports | toYaml | nindent 2 }} diff --git a/astroshop-helm/cart/values.yaml b/astroshop-helm/cart/values.yaml new file mode 100644 index 0000000..37aa643 --- /dev/null +++ b/astroshop-helm/cart/values.yaml @@ -0,0 +1,38 @@ +namespace: opentelemetry-demo +kubernetesClusterDomain: cluster.local + +serviceAccount: + name: opentelemetry-demo + version: ">=1.32.0-0" + partOf: opentelemetry-demo + +opentelemetryDemoCartservice: + cartservice: + env: + aspnetcoreUrls: http://*:$(CART_PORT) + cartServicePort: "8080" + flagdHost: opentelemetry-demo-flagd + flagdPort: "8013" + otelCollectorName: opentelemetry-demo-otelcol + otelExporterOtlpEndpoint: http://$(OTEL_COLLECTOR_NAME):4317 + otelExporterOtlpMetricsTemporalityPreference: cumulative + otelResourceAttributes: service.name=$(OTEL_SERVICE_NAME),service.namespace=opentelemetry-demo,service.version=2.1.3 + valkeyAddr: opentelemetry-demo-valkey:6379 + image: + repository: ghcr.io/open-telemetry/demo + tag: 2.1.3-cart + imagePullPolicy: IfNotPresent + resources: + limits: + memory: 160Mi + ports: + - name: tcp-service + port: 8080 + targetPort: 8080 + replicas: 1 + revisionHistoryLimit: 10 + type: ClusterIP + waitForValkey: + image: + repository: busybox + tag: latest diff --git a/astroshop-helm/checkout/.helmignore b/astroshop-helm/checkout/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/astroshop-helm/checkout/.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/checkout/Chart.yaml b/astroshop-helm/checkout/Chart.yaml new file mode 100644 index 0000000..12cab42 --- /dev/null +++ b/astroshop-helm/checkout/Chart.yaml @@ -0,0 +1,22 @@ +apiVersion: v2 +name: checkout +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/checkout/templates/_helpers.tpl b/astroshop-helm/checkout/templates/_helpers.tpl new file mode 100644 index 0000000..0efb2b1 --- /dev/null +++ b/astroshop-helm/checkout/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "checkout.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 "checkout.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 "checkout.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "checkout.labels" -}} +helm.sh/chart: {{ include "checkout.chart" . }} +{{ include "checkout.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "checkout.selectorLabels" -}} +app.kubernetes.io/name: {{ include "checkout.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "checkout.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "checkout.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/astroshop-helm/checkout/templates/deployment.yaml b/astroshop-helm/checkout/templates/deployment.yaml new file mode 100644 index 0000000..b950c50 --- /dev/null +++ b/astroshop-helm/checkout/templates/deployment.yaml @@ -0,0 +1,104 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + namespace: {{ .Values.namespace }} + name: {{ include "checkout.fullname" . }} + labels: + app.kubernetes.io/component: checkoutservice + app.kubernetes.io/part-of: opentelemetry-demo + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "checkout.fullname" . }} + {{- include "checkout.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.opentelemetryDemoCheckoutservice.replicas }} + revisionHistoryLimit: {{ .Values.opentelemetryDemoCheckoutservice.revisionHistoryLimit + }} + selector: + matchLabels: + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "checkout.fullname" . }} + {{- include "checkout.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + app.kubernetes.io/component: checkoutservice + app.kubernetes.io/instance: opentelemetry-demo + app.kubernetes.io/name: {{ .Values.namespace }}-{{ include "checkout.fullname" . }} + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "checkout.fullname" . }} + {{- include "checkout.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.opentelemetryDemoCheckoutservice.checkoutservice.env.otelCollectorName + }} + - name: OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE + value: {{ quote .Values.opentelemetryDemoCheckoutservice.checkoutservice.env.otelExporterOtlpMetricsTemporalityPreference + }} + - name: CHECKOUT_PORT + value: {{ quote .Values.opentelemetryDemoCheckoutservice.checkoutservice.env.checkoutServicePort + }} + - name: CART_ADDR + value: {{ quote .Values.opentelemetryDemoCheckoutservice.checkoutservice.env.cartServiceAddr + }} + - name: CURRENCY_ADDR + value: {{ quote .Values.opentelemetryDemoCheckoutservice.checkoutservice.env.currencyServiceAddr + }} + - name: EMAIL_ADDR + value: {{ quote .Values.opentelemetryDemoCheckoutservice.checkoutservice.env.emailServiceAddr + }} + - name: PAYMENT_ADDR + value: {{ quote .Values.opentelemetryDemoCheckoutservice.checkoutservice.env.paymentServiceAddr + }} + - name: PRODUCT_CATALOG_ADDR + value: {{ quote .Values.opentelemetryDemoCheckoutservice.checkoutservice.env.productCatalogServiceAddr + }} + - name: SHIPPING_ADDR + value: {{ quote .Values.opentelemetryDemoCheckoutservice.checkoutservice.env.shippingServiceAddr + }} + - name: KAFKA_ADDR + value: {{ quote .Values.opentelemetryDemoCheckoutservice.checkoutservice.env.kafkaServiceAddr + }} + - name: FLAGD_HOST + value: {{ quote .Values.opentelemetryDemoCheckoutservice.checkoutservice.env.flagdHost + }} + - name: FLAGD_PORT + value: {{ quote .Values.opentelemetryDemoCheckoutservice.checkoutservice.env.flagdPort + }} + - name: OTEL_EXPORTER_OTLP_ENDPOINT + value: {{ quote .Values.opentelemetryDemoCheckoutservice.checkoutservice.env.otelExporterOtlpEndpoint + }} + - name: OTEL_RESOURCE_ATTRIBUTES + value: {{ quote .Values.opentelemetryDemoCheckoutservice.checkoutservice.env.otelResourceAttributes + }} + - name: KUBERNETES_CLUSTER_DOMAIN + value: {{ quote .Values.kubernetesClusterDomain }} + image: '{{ .Values.opentelemetryDemoCheckoutservice.checkoutservice.image.repository + }}:{{ .Values.opentelemetryDemoCheckoutservice.checkoutservice.image.tag | default + .Chart.AppVersion }}' + imagePullPolicy: {{ .Values.opentelemetryDemoCheckoutservice.checkoutservice.imagePullPolicy + }} + name: checkoutservice + ports: + - containerPort: 8080 + name: service + resources: {{- toYaml .Values.opentelemetryDemoCheckoutservice.checkoutservice.resources + | nindent 10 }} + initContainers: + - command: + - sh + - -c + - until nc -z -v -w30 opentelemetry-demo-kafka 9092; do echo waiting for kafka; + sleep 2; done; + env: + - name: KUBERNETES_CLUSTER_DOMAIN + value: {{ quote .Values.kubernetesClusterDomain }} + image: '{{ .Values.opentelemetryDemoCheckoutservice.waitForKafka.image.repository + }}:{{ .Values.opentelemetryDemoCheckoutservice.waitForKafka.image.tag | default + .Chart.AppVersion }}' + name: wait-for-kafka + resources: {} + serviceAccountName: {{ .Values.serviceAccount.name }} diff --git a/astroshop-helm/checkout/templates/service.yaml b/astroshop-helm/checkout/templates/service.yaml new file mode 100644 index 0000000..3ad61a3 --- /dev/null +++ b/astroshop-helm/checkout/templates/service.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Values.namespace }}-{{ include "checkout.fullname" . }} + labels: + app.kubernetes.io/component: checkoutservice + app.kubernetes.io/part-of: opentelemetry-demo + opentelemetry.io/name: opentelemetry-demo-checkoutservice + {{- include "checkout.labels" . | nindent 4 }} +spec: + type: {{ .Values.opentelemetryDemoCheckoutservice.type }} + selector: + opentelemetry.io/name: opentelemetry-demo-checkoutservice + {{- include "checkout.selectorLabels" . | nindent 4 }} + ports: + {{- .Values.opentelemetryDemoCheckoutservice.ports | toYaml | nindent 2 }} diff --git a/astroshop-helm/checkout/values.yaml b/astroshop-helm/checkout/values.yaml new file mode 100644 index 0000000..ff916a4 --- /dev/null +++ b/astroshop-helm/checkout/values.yaml @@ -0,0 +1,45 @@ +namespace: opentelemetry-demo +kubernetesClusterDomain: cluster.local + +serviceAccount: + name: opentelemetry-demo + version: ">=1.32.0-0" + partOf: opentelemetry-demo + +opentelemetryDemoCheckoutservice: + checkoutservice: + env: + cartServiceAddr: opentelemetry-demo-cart:8080 + checkoutServicePort: "8080" + currencyServiceAddr: opentelemetry-demo-currency:8080 + emailServiceAddr: http://opentelemetry-demo-email:8080 + flagdHost: opentelemetry-demo-flagd + flagdPort: "8013" + kafkaServiceAddr: opentelemetry-demo-kafka:9092 + otelCollectorName: opentelemetry-demo-otelcol + otelExporterOtlpEndpoint: http://$(OTEL_COLLECTOR_NAME):4317 + otelExporterOtlpMetricsTemporalityPreference: cumulative + otelResourceAttributes: service.name=$(OTEL_SERVICE_NAME),service.namespace=opentelemetry-demo,service.version=2.1.3 + paymentServiceAddr: opentelemetry-demo-payment:8080 + productCatalogServiceAddr: opentelemetry-demo-productcatalog:8080 + shippingServiceAddr: opentelemetry-demo-shipping:8080 + image: + repository: ghcr.io/open-telemetry/demo + tag: 2.1.3-checkout + imagePullPolicy: IfNotPresent + resources: + limits: + memory: 100Mi + requests: + memory: 50Mi + ports: + - name: tcp-service + port: 8080 + targetPort: 8080 + replicas: 1 + revisionHistoryLimit: 10 + type: ClusterIP + waitForKafka: + image: + repository: busybox + tag: latest diff --git a/astroshop-helm/common/Chart.yaml b/astroshop-helm/common/Chart.yaml new file mode 100644 index 0000000..af7d45d --- /dev/null +++ b/astroshop-helm/common/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: opentelemetry-demo-common +description: Common resources for OpenTelemetry Demo services +type: application +version: 0.1.0 +appVersion: "2.1.3"
\ No newline at end of file diff --git a/astroshop-helm/common/templates/serviceAccount.yaml b/astroshop-helm/common/templates/serviceAccount.yaml new file mode 100644 index 0000000..75e8452 --- /dev/null +++ b/astroshop-helm/common/templates/serviceAccount.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ .Values.serviceAccount.name }} + namespace: {{ .Values.namespace }} + labels: + opentelemetry.io/name: {{ .Values.serviceAccount.labels.opentelemetryIoName }} + app.kubernetes.io/instance: {{ .Values.serviceAccount.labels.appKubernetesIoInstance }} + app.kubernetes.io/name: {{ .Values.serviceAccount.labels.appKubernetesIoName }} + app.kubernetes.io/version: {{ quote .Values.serviceAccount.labels.appKubernetesIoVersion }} + app.kubernetes.io/part-of: {{ .Values.serviceAccount.labels.appKubernetesIoPartOf }}
\ No newline at end of file diff --git a/astroshop-helm/common/values.yaml b/astroshop-helm/common/values.yaml new file mode 100644 index 0000000..1312f84 --- /dev/null +++ b/astroshop-helm/common/values.yaml @@ -0,0 +1,10 @@ +namespace: opentelemetry-demo + +serviceAccount: + name: opentelemetry-demo + labels: + opentelemetryIoName: opentelemetry-demo + appKubernetesIoInstance: opentelemetry-demo + appKubernetesIoName: opentelemetry-demo + appKubernetesIoVersion: "2.1.3" + appKubernetesIoPartOf: opentelemetry-demo
\ No newline at end of file diff --git a/astroshop-helm/currency/.helmignore b/astroshop-helm/currency/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/astroshop-helm/currency/.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/currency/Chart.yaml b/astroshop-helm/currency/Chart.yaml new file mode 100644 index 0000000..503686d --- /dev/null +++ b/astroshop-helm/currency/Chart.yaml @@ -0,0 +1,22 @@ +apiVersion: v2 +name: currency +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/currency/templates/_helpers.tpl b/astroshop-helm/currency/templates/_helpers.tpl new file mode 100644 index 0000000..0ac2377 --- /dev/null +++ b/astroshop-helm/currency/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "currency.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 "currency.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 "currency.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "currency.labels" -}} +helm.sh/chart: {{ include "currency.chart" . }} +{{ include "currency.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "currency.selectorLabels" -}} +app.kubernetes.io/name: {{ include "currency.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "currency.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "currency.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/astroshop-helm/currency/templates/deployment.yaml b/astroshop-helm/currency/templates/deployment.yaml new file mode 100644 index 0000000..6d950f1 --- /dev/null +++ b/astroshop-helm/currency/templates/deployment.yaml @@ -0,0 +1,66 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + namespace: {{ .Values.namespace }} + name: {{ include "currency.fullname" . }} + labels: + app.kubernetes.io/component: currencyservice + app.kubernetes.io/part-of: opentelemetry-demo + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "currency.fullname" . }} + {{- include "currency.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.opentelemetryDemoCurrencyservice.replicas }} + revisionHistoryLimit: {{ .Values.opentelemetryDemoCurrencyservice.revisionHistoryLimit + }} + selector: + matchLabels: + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "currency.fullname" . }} + {{- include "currency.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + app.kubernetes.io/component: currencyservice + app.kubernetes.io/instance: opentelemetry-demo + app.kubernetes.io/name: {{ .Values.namespace }}-{{ include "currency.fullname" . }} + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "currency.fullname" . }} + {{- include "currency.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.opentelemetryDemoCurrencyservice.currencyservice.env.otelCollectorName + }} + - name: OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE + value: {{ quote .Values.opentelemetryDemoCurrencyservice.currencyservice.env.otelExporterOtlpMetricsTemporalityPreference + }} + - name: CURRENCY_PORT + value: {{ quote .Values.opentelemetryDemoCurrencyservice.currencyservice.env.currencyServicePort + }} + - name: OTEL_EXPORTER_OTLP_ENDPOINT + value: {{ quote .Values.opentelemetryDemoCurrencyservice.currencyservice.env.otelExporterOtlpEndpoint + }} + - name: VERSION + value: {{ quote .Values.opentelemetryDemoCurrencyservice.currencyservice.env.version + }} + - name: OTEL_RESOURCE_ATTRIBUTES + value: {{ quote .Values.opentelemetryDemoCurrencyservice.currencyservice.env.otelResourceAttributes + }} + - name: KUBERNETES_CLUSTER_DOMAIN + value: {{ quote .Values.kubernetesClusterDomain }} + image: '{{ .Values.opentelemetryDemoCurrencyservice.currencyservice.image.repository + }}:{{ .Values.opentelemetryDemoCurrencyservice.currencyservice.image.tag | default + .Chart.AppVersion }}' + imagePullPolicy: {{ .Values.opentelemetryDemoCurrencyservice.currencyservice.imagePullPolicy + }} + name: currencyservice + ports: + - containerPort: 8080 + name: service + resources: {{- toYaml .Values.opentelemetryDemoCurrencyservice.currencyservice.resources + | nindent 10 }} + serviceAccountName: {{ .Values.serviceAccount.name }} diff --git a/astroshop-helm/currency/templates/service.yaml b/astroshop-helm/currency/templates/service.yaml new file mode 100644 index 0000000..51363a4 --- /dev/null +++ b/astroshop-helm/currency/templates/service.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Values.namespace }}-{{ include "currency.fullname" . }} + labels: + app.kubernetes.io/component: currencyservice + app.kubernetes.io/part-of: opentelemetry-demo + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "currency.fullname" . }} + {{- include "currency.labels" . | nindent 4 }} +spec: + type: {{ .Values.opentelemetryDemoCurrencyservice.type }} + selector: + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "currency.fullname" . }} + {{- include "currency.selectorLabels" . | nindent 4 }} + ports: + {{- .Values.opentelemetryDemoCurrencyservice.ports | toYaml | nindent 2 }} diff --git a/astroshop-helm/currency/values.yaml b/astroshop-helm/currency/values.yaml new file mode 100644 index 0000000..4e82b50 --- /dev/null +++ b/astroshop-helm/currency/values.yaml @@ -0,0 +1,31 @@ +namespace: opentelemetry-demo +kubernetesClusterDomain: cluster.local + +serviceAccount: + name: opentelemetry-demo + version: ">=1.32.0-0" + partOf: opentelemetry-demo + +opentelemetryDemoCurrencyservice: + currencyservice: + env: + currencyServicePort: "8080" + otelCollectorName: opentelemetry-demo-otelcol + otelExporterOtlpEndpoint: http://$(OTEL_COLLECTOR_NAME):4317 + otelExporterOtlpMetricsTemporalityPreference: cumulative + otelResourceAttributes: service.name=$(OTEL_SERVICE_NAME),service.namespace=opentelemetry-demo,service.version=2.1.3 + version: 2.1.3 + image: + repository: ghcr.io/open-telemetry/demo + tag: 2.1.3-currency + imagePullPolicy: IfNotPresent + resources: + limits: + memory: 20Mi + ports: + - name: tcp-service + port: 8080 + targetPort: 8080 + replicas: 1 + revisionHistoryLimit: 10 + type: ClusterIP diff --git a/astroshop-helm/email/.helmignore b/astroshop-helm/email/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/astroshop-helm/email/.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/email/Chart.yaml b/astroshop-helm/email/Chart.yaml new file mode 100644 index 0000000..0676c83 --- /dev/null +++ b/astroshop-helm/email/Chart.yaml @@ -0,0 +1,22 @@ +apiVersion: v2 +name: email +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/email/templates/_helpers.tpl b/astroshop-helm/email/templates/_helpers.tpl new file mode 100644 index 0000000..9742d31 --- /dev/null +++ b/astroshop-helm/email/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "email.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 "email.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 "email.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "email.labels" -}} +helm.sh/chart: {{ include "email.chart" . }} +{{ include "email.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "email.selectorLabels" -}} +app.kubernetes.io/name: {{ include "email.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "email.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "email.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/astroshop-helm/email/templates/deployment.yaml b/astroshop-helm/email/templates/deployment.yaml new file mode 100644 index 0000000..3bfcc8e --- /dev/null +++ b/astroshop-helm/email/templates/deployment.yaml @@ -0,0 +1,66 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + namespace: {{ .Values.namespace }} + name: {{ include "email.fullname" . }} + labels: + app.kubernetes.io/component: emailservice + app.kubernetes.io/part-of: opentelemetry-demo + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "email.fullname" . }} + {{- include "email.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.opentelemetryDemoEmailservice.replicas }} + revisionHistoryLimit: {{ .Values.opentelemetryDemoEmailservice.revisionHistoryLimit + }} + selector: + matchLabels: + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "email.fullname" . }} + {{- include "email.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + app.kubernetes.io/component: emailservice + app.kubernetes.io/instance: opentelemetry-demo + app.kubernetes.io/name: {{ .Values.namespace }}-{{ include "email.fullname" . }} + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "email.fullname" . }} + {{- include "email.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.opentelemetryDemoEmailservice.emailservice.env.otelCollectorName + }} + - name: OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE + value: {{ quote .Values.opentelemetryDemoEmailservice.emailservice.env.otelExporterOtlpMetricsTemporalityPreference + }} + - name: EMAIL_PORT + value: {{ quote .Values.opentelemetryDemoEmailservice.emailservice.env.emailServicePort + }} + - name: APP_ENV + value: {{ quote .Values.opentelemetryDemoEmailservice.emailservice.env.appEnv + }} + - name: OTEL_EXPORTER_OTLP_TRACES_ENDPOINT + value: {{ quote .Values.opentelemetryDemoEmailservice.emailservice.env.otelExporterOtlpTracesEndpoint + }} + - name: OTEL_RESOURCE_ATTRIBUTES + value: {{ quote .Values.opentelemetryDemoEmailservice.emailservice.env.otelResourceAttributes + }} + - name: KUBERNETES_CLUSTER_DOMAIN + value: {{ quote .Values.kubernetesClusterDomain }} + image: '{{ .Values.opentelemetryDemoEmailservice.emailservice.image.repository }}:{{ + .Values.opentelemetryDemoEmailservice.emailservice.image.tag | default .Chart.AppVersion + }}' + imagePullPolicy: {{ .Values.opentelemetryDemoEmailservice.emailservice.imagePullPolicy + }} + name: emailservice + ports: + - containerPort: 8080 + name: service + resources: {{- toYaml .Values.opentelemetryDemoEmailservice.emailservice.resources + | nindent 10 }} + serviceAccountName: {{ .Values.serviceAccount.name }} diff --git a/astroshop-helm/email/templates/service.yaml b/astroshop-helm/email/templates/service.yaml new file mode 100644 index 0000000..a32ae65 --- /dev/null +++ b/astroshop-helm/email/templates/service.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Values.namespace }}-{{ include "email.fullname" . }} + labels: + app.kubernetes.io/component: emailservice + app.kubernetes.io/part-of: opentelemetry-demo + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "email.fullname" . }} + {{- include "email.labels" . | nindent 4 }} +spec: + type: {{ .Values.opentelemetryDemoEmailservice.type }} + selector: + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "email.fullname" . }} + {{- include "email.selectorLabels" . | nindent 4 }} + ports: + {{- .Values.opentelemetryDemoEmailservice.ports | toYaml | nindent 2 }} diff --git a/astroshop-helm/email/values.yaml b/astroshop-helm/email/values.yaml new file mode 100644 index 0000000..5d2422e --- /dev/null +++ b/astroshop-helm/email/values.yaml @@ -0,0 +1,31 @@ +namespace: opentelemetry-demo +kubernetesClusterDomain: cluster.local + +serviceAccount: + name: opentelemetry-demo + version: ">=1.32.0-0" + partOf: opentelemetry-demo + +opentelemetryDemoEmailservice: + emailservice: + env: + appEnv: production + emailServicePort: "8080" + otelCollectorName: opentelemetry-demo-otelcol + otelExporterOtlpMetricsTemporalityPreference: cumulative + otelExporterOtlpTracesEndpoint: http://$(OTEL_COLLECTOR_NAME):4318/v1/traces + 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-email + imagePullPolicy: IfNotPresent + resources: + limits: + memory: 100Mi + ports: + - name: tcp-service + port: 8080 + targetPort: 8080 + replicas: 1 + revisionHistoryLimit: 10 + type: ClusterIP diff --git a/astroshop-helm/flagd/.helmignore b/astroshop-helm/flagd/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/astroshop-helm/flagd/.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/flagd/Chart.yaml b/astroshop-helm/flagd/Chart.yaml new file mode 100644 index 0000000..e95d6b0 --- /dev/null +++ b/astroshop-helm/flagd/Chart.yaml @@ -0,0 +1,22 @@ +apiVersion: v2 +name: flagd +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/flagd/templates/_helpers.tpl b/astroshop-helm/flagd/templates/_helpers.tpl new file mode 100644 index 0000000..b3d106d --- /dev/null +++ b/astroshop-helm/flagd/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "flagd.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 "flagd.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 "flagd.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "flagd.labels" -}} +helm.sh/chart: {{ include "flagd.chart" . }} +{{ include "flagd.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "flagd.selectorLabels" -}} +app.kubernetes.io/name: {{ include "flagd.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "flagd.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "flagd.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/astroshop-helm/flagd/templates/config.yaml b/astroshop-helm/flagd/templates/config.yaml new file mode 100644 index 0000000..9eab225 --- /dev/null +++ b/astroshop-helm/flagd/templates/config.yaml @@ -0,0 +1,10 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "flagd.fullname" . }}-config + labels: + app.kubernetes.io/part-of: opentelemetry-demo + opentelemetry.io/name: opentelemetry-demo + {{- include "flagd.labels" . | nindent 4 }} +data: + demo.flagd.json: {{ .Values.config.demoFlagdJson | toYaml | indent 1 }} diff --git a/astroshop-helm/flagd/templates/deployment.yaml b/astroshop-helm/flagd/templates/deployment.yaml new file mode 100644 index 0000000..13b9b5e --- /dev/null +++ b/astroshop-helm/flagd/templates/deployment.yaml @@ -0,0 +1,127 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + namespace: {{ .Values.namespace }} + name: {{ include "flagd.fullname" . }} + labels: + app.kubernetes.io/component: flagd + app.kubernetes.io/part-of: opentelemetry-demo + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "flagd.fullname" . }} + {{- include "flagd.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.opentelemetryDemoFlagd.replicas }} + revisionHistoryLimit: {{ .Values.opentelemetryDemoFlagd.revisionHistoryLimit }} + selector: + matchLabels: + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "flagd.fullname" . }} + {{- include "flagd.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + app.kubernetes.io/component: flagd + app.kubernetes.io/instance: opentelemetry-demo + app.kubernetes.io/name: {{ .Values.namespace }}-{{ include "flagd.fullname" . }} + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "flagd.fullname" . }} + {{- include "flagd.selectorLabels" . | nindent 8 }} + spec: + containers: + - command: + - /flagd-build + - start + - --uri + - file:./etc/flagd/demo.flagd.json + env: + - name: OTEL_SERVICE_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.labels['app.kubernetes.io/component'] + - name: OTEL_COLLECTOR_NAME + value: {{ quote .Values.opentelemetryDemoFlagd.flagd.env.otelCollectorName }} + - name: OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE + value: {{ quote .Values.opentelemetryDemoFlagd.flagd.env.otelExporterOtlpMetricsTemporalityPreference + }} + - name: FLAGD_METRICS_EXPORTER + value: {{ quote .Values.opentelemetryDemoFlagd.flagd.env.flagdMetricsExporter + }} + - name: FLAGD_OTEL_COLLECTOR_URI + value: {{ quote .Values.opentelemetryDemoFlagd.flagd.env.flagdOtelCollectorUri + }} + - name: OTEL_RESOURCE_ATTRIBUTES + value: {{ quote .Values.opentelemetryDemoFlagd.flagd.env.otelResourceAttributes + }} + - name: KUBERNETES_CLUSTER_DOMAIN + value: {{ quote .Values.kubernetesClusterDomain }} + image: {{ .Values.opentelemetryDemoFlagd.flagd.image.repository }}:{{ .Values.opentelemetryDemoFlagd.flagd.image.tag + | default .Chart.AppVersion }} + imagePullPolicy: {{ .Values.opentelemetryDemoFlagd.flagd.imagePullPolicy }} + name: flagd + ports: + - containerPort: 8013 + name: service + resources: {{- toYaml .Values.opentelemetryDemoFlagd.flagd.resources | nindent + 10 }} + volumeMounts: + - mountPath: /etc/flagd + name: config-rw + - env: + - name: OTEL_SERVICE_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.labels['app.kubernetes.io/component'] + - name: OTEL_COLLECTOR_NAME + value: {{ quote .Values.opentelemetryDemoFlagd.flagdui.env.otelCollectorName + }} + - name: OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE + value: {{ quote .Values.opentelemetryDemoFlagd.flagdui.env.otelExporterOtlpMetricsTemporalityPreference + }} + - name: FLAGD_METRICS_EXPORTER + value: {{ quote .Values.opentelemetryDemoFlagd.flagdui.env.flagdMetricsExporter + }} + - name: OTEL_EXPORTER_OTLP_ENDPOINT + value: {{ quote .Values.opentelemetryDemoFlagd.flagdui.env.otelExporterOtlpEndpoint + }} + - name: OTEL_RESOURCE_ATTRIBUTES + value: {{ quote .Values.opentelemetryDemoFlagd.flagdui.env.otelResourceAttributes + }} + - name: KUBERNETES_CLUSTER_DOMAIN + value: {{ quote .Values.kubernetesClusterDomain }} + - name: SECRET_KEY_BASE + value: {{ quote .Values.opentelemetryDemoFlagd.flagdui.env.secretKeyBase }} + image: {{ .Values.opentelemetryDemoFlagd.flagdui.image.repository }}:{{ .Values.opentelemetryDemoFlagd.flagdui.image.tag + | default .Chart.AppVersion }} + imagePullPolicy: {{ .Values.opentelemetryDemoFlagd.flagdui.imagePullPolicy }} + name: flagdui + ports: + - containerPort: 4000 + name: service + resources: {{- toYaml .Values.opentelemetryDemoFlagd.flagdui.resources | nindent + 10 }} + volumeMounts: + - mountPath: /app/data + name: config-rw + initContainers: + - command: + - sh + - -c + - cp /config-ro/demo.flagd.json /config-rw/demo.flagd.json && cat /config-rw/demo.flagd.json + env: + - name: KUBERNETES_CLUSTER_DOMAIN + value: {{ quote .Values.kubernetesClusterDomain }} + image: {{ .Values.opentelemetryDemoFlagd.initConfig.image.repository }}:{{ .Values.opentelemetryDemoFlagd.initConfig.image.tag + | default .Chart.AppVersion }} + name: init-config + resources: {} + volumeMounts: + - mountPath: /config-ro + name: config-ro + - mountPath: /config-rw + name: config-rw + serviceAccountName: {{ .Values.serviceAccount.name }} + volumes: + - emptyDir: {} + name: config-rw + - configMap: + name: {{ include "flagd.fullname" . }}-config + name: config-ro diff --git a/astroshop-helm/flagd/templates/service.yaml b/astroshop-helm/flagd/templates/service.yaml new file mode 100644 index 0000000..46eb89b --- /dev/null +++ b/astroshop-helm/flagd/templates/service.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Values.namespace }}-{{ include "flagd.fullname" . }} + labels: + app.kubernetes.io/component: flagd + app.kubernetes.io/part-of: opentelemetry-demo + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "flagd.fullname" . }} + {{- include "flagd.labels" . | nindent 4 }} +spec: + type: {{ .Values.opentelemetryDemoFlagd.type }} + selector: + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "flagd.fullname" . }} + {{- include "flagd.selectorLabels" . | nindent 4 }} + ports: + {{- .Values.opentelemetryDemoFlagd.ports | toYaml | nindent 2 }} diff --git a/astroshop-helm/flagd/values.yaml b/astroshop-helm/flagd/values.yaml new file mode 100644 index 0000000..bfdbc88 --- /dev/null +++ b/astroshop-helm/flagd/values.yaml @@ -0,0 +1,159 @@ +config: + demoFlagdJson: |- + { + "$schema": "https://flagd.dev/schema/v0/flags.json", + "flags": { + "productCatalogFailure": { + "description": "Fail product catalog service on a specific product", + "state": "ENABLED", + "variants": { + "on": true, + "off": false + }, + "defaultVariant": "off" + }, + "recommendationServiceCacheFailure": { + "description": "Fail recommendation service cache", + "state": "ENABLED", + "variants": { + "on": true, + "off": false + }, + "defaultVariant": "off" + }, + "adServiceManualGc": { + "description": "Triggers full manual garbage collections in the ad service", + "state": "ENABLED", + "variants": { + "on": true, + "off": false + }, + "defaultVariant": "off" + }, + "adServiceHighCpu": { + "description": "Triggers high cpu load in the ad service", + "state": "ENABLED", + "variants": { + "on": true, + "off": false + }, + "defaultVariant": "off" + }, + "adServiceFailure": { + "description": "Fail ad service", + "state": "ENABLED", + "variants": { + "on": true, + "off": false + }, + "defaultVariant": "off" + }, + "kafkaQueueProblems": { + "description": "Overloads Kafka queue while simultaneously introducing a consumer side delay leading to a lag spike", + "state": "ENABLED", + "variants": { + "on": 100, + "off": 0 + }, + "defaultVariant": "off" + }, + "cartServiceFailure": { + "description": "Fail cart service", + "state": "ENABLED", + "variants": { + "on": true, + "off": false + }, + "defaultVariant": "off" + }, + "paymentServiceFailure": { + "description": "Fail payment service charge requests", + "state": "ENABLED", + "variants": { + "on": true, + "off": false + }, + "defaultVariant": "off" + }, + "paymentServiceUnreachable": { + "description": "Payment service is unavailable", + "state": "ENABLED", + "variants": { + "on": true, + "off": false + }, + "defaultVariant": "off" + }, + "loadgeneratorFloodHomepage": { + "description": "Flood the frontend with a large amount of requests.", + "state": "ENABLED", + "variants": { + "on": 100, + "off": 0 + }, + "defaultVariant": "off" + }, + "imageSlowLoad": { + "description": "slow loading images in the frontend", + "state": "ENABLED", + "variants": { + "10sec": 10000, + "5sec": 5000, + "off": 0 + }, + "defaultVariant": "off" + } + } + } +namespace: opentelemetry-demo +kubernetesClusterDomain: cluster.local + +serviceAccount: + name: opentelemetry-demo + version: ">=1.32.0-0" + partOf: opentelemetry-demo + +opentelemetryDemoFlagd: + flagd: + env: + flagdMetricsExporter: otel + flagdOtelCollectorUri: $(OTEL_COLLECTOR_NAME):4317 + otelCollectorName: opentelemetry-demo-otelcol + otelExporterOtlpMetricsTemporalityPreference: cumulative + otelResourceAttributes: service.name=$(OTEL_SERVICE_NAME),service.namespace=opentelemetry-demo,service.version=2.1.3 + image: + repository: ghcr.io/open-feature/flagd + tag: v0.11.1 + imagePullPolicy: IfNotPresent + resources: + limits: + memory: 512Mi + flagdui: + env: + flagdMetricsExporter: otel + otelCollectorName: opentelemetry-demo-otelcol + otelExporterOtlpEndpoint: http://$(OTEL_COLLECTOR_NAME):4318 + otelExporterOtlpMetricsTemporalityPreference: cumulative + otelResourceAttributes: service.name=$(OTEL_SERVICE_NAME),service.namespace=opentelemetry-demo,service.version=2.1.3 + secretKeyBase: yYrECL4qbNwleYInGJYvVnSkwJuSQJ4ijPTx5tirGUXrbznFIBFVJdPl5t6O9ASw + image: + repository: ghcr.io/open-telemetry/demo + tag: 2.1.3-flagd-ui + imagePullPolicy: IfNotPresent + resources: + limits: + memory: 512Mi + initConfig: + image: + repository: busybox + tag: latest + ports: + - name: tcp-service + port: 8013 + targetPort: 8013 + - name: tcp-service-0 + port: 4000 + targetPort: 4000 + replicas: 1 + revisionHistoryLimit: 10 + type: ClusterIP diff --git a/astroshop-helm/fraud-detection/.helmignore b/astroshop-helm/fraud-detection/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/astroshop-helm/fraud-detection/.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/fraud-detection/Chart.yaml b/astroshop-helm/fraud-detection/Chart.yaml new file mode 100644 index 0000000..da1f476 --- /dev/null +++ b/astroshop-helm/fraud-detection/Chart.yaml @@ -0,0 +1,22 @@ +apiVersion: v2 +name: fraud-detection +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/fraud-detection/templates/_helpers.tpl b/astroshop-helm/fraud-detection/templates/_helpers.tpl new file mode 100644 index 0000000..767b8b3 --- /dev/null +++ b/astroshop-helm/fraud-detection/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "fraud-detection.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 "fraud-detection.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 "fraud-detection.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "fraud-detection.labels" -}} +helm.sh/chart: {{ include "fraud-detection.chart" . }} +{{ include "fraud-detection.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "fraud-detection.selectorLabels" -}} +app.kubernetes.io/name: {{ include "fraud-detection.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "fraud-detection.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "fraud-detection.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/astroshop-helm/fraud-detection/templates/deployment.yaml b/astroshop-helm/fraud-detection/templates/deployment.yaml new file mode 100644 index 0000000..8fdd86a --- /dev/null +++ b/astroshop-helm/fraud-detection/templates/deployment.yaml @@ -0,0 +1,62 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + namespace: {{ .Values.namespace }} + name: {{ include "fraud-detection.fullname" . }} + labels: + app.kubernetes.io/component: fraud-detectionservice + app.kubernetes.io/part-of: opentelemetry-demo + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "fraud-detection.fullname" . }} + {{- include "fraud-detection.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.opentelemetryDemoFrauddetectionservice.replicas }} + revisionHistoryLimit: {{ .Values.opentelemetryDemoFrauddetectionservice.revisionHistoryLimit }} + selector: + matchLabels: + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "fraud-detection.fullname" . }} + {{- include "fraud-detection.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + app.kubernetes.io/component: fraud-detectionservice + app.kubernetes.io/instance: opentelemetry-demo + app.kubernetes.io/name: {{ .Values.namespace }}-{{ include "fraud-detection.fullname" . }} + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "fraud-detection.fullname" . }} + {{- include "fraud-detection.selectorLabels" . | nindent 8 }} + spec: + containers: + - env: + - name: OTEL_SERVICE_NAME + value: {{ quote .Values.opentelemetryDemoFrauddetectionservice.fraudDetectionservice.env.otelServiceName }} + - name: OTEL_COLLECTOR_NAME + value: {{ quote .Values.opentelemetryDemoFrauddetectionservice.fraudDetectionservice.env.otelCollectorName }} + - name: OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE + value: {{ quote .Values.opentelemetryDemoFrauddetectionservice.fraudDetectionservice.env.otelExporterOtlpMetricsTemporalityPreference }} + - name: KAFKA_ADDR + value: {{ quote .Values.opentelemetryDemoFrauddetectionservice.fraudDetectionservice.env.kafkaServiceAddr }} + - name: FLAGD_HOST + value: {{ quote .Values.opentelemetryDemoFrauddetectionservice.fraudDetectionservice.env.flagdHost }} + - name: FLAGD_PORT + value: {{ quote .Values.opentelemetryDemoFrauddetectionservice.fraudDetectionservice.env.flagdPort }} + - name: OTEL_EXPORTER_OTLP_ENDPOINT + value: {{ quote .Values.opentelemetryDemoFrauddetectionservice.fraudDetectionservice.env.otelExporterOtlpEndpoint }} + - name: OTEL_RESOURCE_ATTRIBUTES + value: {{ quote .Values.opentelemetryDemoFrauddetectionservice.fraudDetectionservice.env.otelResourceAttributes }} + - name: KUBERNETES_CLUSTER_DOMAIN + value: {{ quote .Values.kubernetesClusterDomain }} + image: '{{ .Values.opentelemetryDemoFrauddetectionservice.fraudDetectionservice.image.repository }}:{{ .Values.opentelemetryDemoFrauddetectionservice.fraudDetectionservice.image.tag | default .Chart.AppVersion }}' + imagePullPolicy: {{ .Values.opentelemetryDemoFrauddetectionservice.fraudDetectionservice.imagePullPolicy }} + name: fraud-detectionservice + resources: {{- toYaml .Values.opentelemetryDemoFrauddetectionservice.fraudDetectionservice.resources | nindent 10 }} + initContainers: + - command: + - sh + - -c + - until nc -z -v -w30 opentelemetry-demo-kafka 9092; do echo waiting for kafka; sleep 2; done; + env: + - name: KUBERNETES_CLUSTER_DOMAIN + value: {{ quote .Values.kubernetesClusterDomain }} + image: '{{ .Values.opentelemetryDemoFrauddetectionservice.waitForKafka.image.repository }}:{{ .Values.opentelemetryDemoFrauddetectionservice.waitForKafka.image.tag | default .Chart.AppVersion }}' + name: wait-for-kafka + resources: {} + serviceAccountName: {{ .Values.serviceAccount.name }} diff --git a/astroshop-helm/fraud-detection/templates/serviceaccount.yaml b/astroshop-helm/fraud-detection/templates/serviceaccount.yaml new file mode 100644 index 0000000..d7ad9c0 --- /dev/null +++ b/astroshop-helm/fraud-detection/templates/serviceaccount.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ .Values.serviceAccount.name }} + namespace: {{ .Values.namespace }} + labels: + opentelemetry.io/name: {{ .Values.serviceAccount.name }} + app.kubernetes.io/instance: {{ .Values.serviceAccount.name }} + app.kubernetes.io/name: {{ .Values.serviceAccount.name }} + app.kubernetes.io/version: {{ quote .Values.serviceAccount.version }} + app.kubernetes.io/part-of: {{ .Values.serviceAccount.partOf }} + {{- include "fraud-detection.labels" . | nindent 4 }}
\ No newline at end of file diff --git a/astroshop-helm/fraud-detection/values.yaml b/astroshop-helm/fraud-detection/values.yaml new file mode 100644 index 0000000..c03d736 --- /dev/null +++ b/astroshop-helm/fraud-detection/values.yaml @@ -0,0 +1,31 @@ +namespace: opentelemetry-demo +kubernetesClusterDomain: cluster.local + +serviceAccount: + name: opentelemetry-demo + version: ">=1.32.0-0" + partOf: opentelemetry-demo +opentelemetryDemoFrauddetectionservice: + fraudDetectionservice: + env: + otelServiceName: fraud-detectionservice + flagdHost: opentelemetry-demo-flagd + flagdPort: "8013" + kafkaServiceAddr: opentelemetry-demo-kafka:9092 + otelCollectorName: opentelemetry-demo-otelcol + otelExporterOtlpEndpoint: http://$(OTEL_COLLECTOR_NAME):4318 + otelExporterOtlpMetricsTemporalityPreference: cumulative + 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-fraud-detection + imagePullPolicy: IfNotPresent + resources: + limits: + memory: 300Mi + replicas: 1 + revisionHistoryLimit: 10 + waitForKafka: + image: + repository: busybox + tag: latest diff --git a/astroshop-helm/frontend/.helmignore b/astroshop-helm/frontend/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/astroshop-helm/frontend/.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/frontend/Chart.yaml b/astroshop-helm/frontend/Chart.yaml new file mode 100644 index 0000000..40a1557 --- /dev/null +++ b/astroshop-helm/frontend/Chart.yaml @@ -0,0 +1,22 @@ +apiVersion: v2 +name: frontend +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/frontend/templates/_helpers.tpl b/astroshop-helm/frontend/templates/_helpers.tpl new file mode 100644 index 0000000..92c6c3b --- /dev/null +++ b/astroshop-helm/frontend/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "frontend.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 "frontend.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 "frontend.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "frontend.labels" -}} +helm.sh/chart: {{ include "frontend.chart" . }} +{{ include "frontend.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "frontend.selectorLabels" -}} +app.kubernetes.io/name: {{ include "frontend.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "frontend.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "frontend.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/astroshop-helm/frontend/templates/deployment.yaml b/astroshop-helm/frontend/templates/deployment.yaml new file mode 100644 index 0000000..6eb6e41 --- /dev/null +++ b/astroshop-helm/frontend/templates/deployment.yaml @@ -0,0 +1,80 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + namespace: {{ .Values.namespace }} + name: {{ include "frontend.fullname" . }} + labels: + app.kubernetes.io/component: frontend + app.kubernetes.io/part-of: opentelemetry-demo + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "frontend.fullname" . }} + {{- include "frontend.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.opentelemetryDemoFrontend.replicas }} + revisionHistoryLimit: {{ .Values.opentelemetryDemoFrontend.revisionHistoryLimit }} + selector: + matchLabels: + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "frontend.fullname" . }} + {{- include "frontend.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + app.kubernetes.io/component: frontend + app.kubernetes.io/instance: opentelemetry-demo + app.kubernetes.io/name: {{ .Values.namespace }}-{{ include "frontend.fullname" . }} + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "frontend.fullname" . }} + {{- include "frontend.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.opentelemetryDemoFrontend.frontend.env.otelCollectorName }} + - name: OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE + value: {{ quote .Values.opentelemetryDemoFrontend.frontend.env.otelExporterOtlpMetricsTemporalityPreference }} + - name: FRONTEND_PORT + value: {{ quote .Values.opentelemetryDemoFrontend.frontend.env.frontendPort }} + - name: FRONTEND_ADDR + value: {{ quote .Values.opentelemetryDemoFrontend.frontend.env.frontendAddr }} + - name: AD_ADDR + value: {{ quote .Values.opentelemetryDemoFrontend.frontend.env.adServiceAddr }} + - name: CART_ADDR + value: {{ quote .Values.opentelemetryDemoFrontend.frontend.env.cartServiceAddr }} + - name: CHECKOUT_ADDR + value: {{ quote .Values.opentelemetryDemoFrontend.frontend.env.checkoutServiceAddr }} + - name: CURRENCY_ADDR + value: {{ quote .Values.opentelemetryDemoFrontend.frontend.env.currencyServiceAddr }} + - name: PRODUCT_CATALOG_ADDR + value: {{ quote .Values.opentelemetryDemoFrontend.frontend.env.productCatalogServiceAddr }} + - name: RECOMMENDATION_ADDR + value: {{ quote .Values.opentelemetryDemoFrontend.frontend.env.recommendationServiceAddr }} + - name: SHIPPING_ADDR + value: {{ quote .Values.opentelemetryDemoFrontend.frontend.env.shippingServiceAddr }} + - name: FLAGD_HOST + value: {{ quote .Values.opentelemetryDemoFrontend.frontend.env.flagdHost }} + - name: FLAGD_PORT + value: {{ quote .Values.opentelemetryDemoFrontend.frontend.env.flagdPort }} + - name: OTEL_COLLECTOR_HOST + value: {{ quote .Values.opentelemetryDemoFrontend.frontend.env.otelCollectorHost }} + - name: OTEL_EXPORTER_OTLP_ENDPOINT + value: {{ quote .Values.opentelemetryDemoFrontend.frontend.env.otelExporterOtlpEndpoint }} + - name: WEB_OTEL_SERVICE_NAME + value: {{ quote .Values.opentelemetryDemoFrontend.frontend.env.webOtelServiceName }} + - name: PUBLIC_OTEL_EXPORTER_OTLP_TRACES_ENDPOINT + value: {{ quote .Values.opentelemetryDemoFrontend.frontend.env.publicOtelExporterOtlpTracesEndpoint }} + - name: OTEL_RESOURCE_ATTRIBUTES + value: {{ quote .Values.opentelemetryDemoFrontend.frontend.env.otelResourceAttributes }} + - name: KUBERNETES_CLUSTER_DOMAIN + value: {{ quote .Values.kubernetesClusterDomain }} + image: {{ .Values.opentelemetryDemoFrontend.frontend.image.repository }}:{{ .Values.opentelemetryDemoFrontend.frontend.image.tag | default .Chart.AppVersion }} + imagePullPolicy: {{ .Values.opentelemetryDemoFrontend.frontend.imagePullPolicy }} + name: frontend + ports: + - containerPort: 8080 + name: service + resources: {{- toYaml .Values.opentelemetryDemoFrontend.frontend.resources | nindent 10 }} + securityContext: {{- toYaml .Values.opentelemetryDemoFrontend.frontend.containerSecurityContext | nindent 10 }} + serviceAccountName: {{ .Values.serviceAccount.name }}
\ No newline at end of file diff --git a/astroshop-helm/frontend/templates/service.yaml b/astroshop-helm/frontend/templates/service.yaml new file mode 100644 index 0000000..1a7fdf9 --- /dev/null +++ b/astroshop-helm/frontend/templates/service.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Values.namespace }}-{{ include "frontend.fullname" . }} + labels: + app.kubernetes.io/component: frontend + app.kubernetes.io/part-of: opentelemetry-demo + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "frontend.fullname" . }} + {{- include "frontend.labels" . | nindent 4 }} +spec: + type: {{ .Values.opentelemetryDemoFrontend.type }} + selector: + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "frontend.fullname" . }} + {{- include "frontend.selectorLabels" . | nindent 4 }} + ports: + {{- .Values.opentelemetryDemoFrontend.ports | toYaml | nindent 2 }} diff --git a/astroshop-helm/frontend/values.yaml b/astroshop-helm/frontend/values.yaml new file mode 100644 index 0000000..92b4d61 --- /dev/null +++ b/astroshop-helm/frontend/values.yaml @@ -0,0 +1,47 @@ +namespace: opentelemetry-demo +kubernetesClusterDomain: cluster.local + +serviceAccount: + name: opentelemetry-demo + version: ">=1.32.0-0" + partOf: opentelemetry-demo + +opentelemetryDemoFrontend: + frontend: + containerSecurityContext: + runAsGroup: 1001 + runAsNonRoot: true + runAsUser: 1001 + env: + adServiceAddr: opentelemetry-demo-ad:8080 + cartServiceAddr: opentelemetry-demo-cart:8080 + checkoutServiceAddr: opentelemetry-demo-checkout:8080 + currencyServiceAddr: opentelemetry-demo-currency:8080 + flagdHost: opentelemetry-demo-flagd + flagdPort: "8013" + frontendAddr: :8080 + frontendPort: "8080" + otelCollectorHost: $(OTEL_COLLECTOR_NAME) + otelCollectorName: opentelemetry-demo-otelcol + otelExporterOtlpEndpoint: http://$(OTEL_COLLECTOR_NAME):4317 + otelExporterOtlpMetricsTemporalityPreference: cumulative + otelResourceAttributes: service.name=$(OTEL_SERVICE_NAME),service.namespace=opentelemetry-demo,service.version=2.1.3 + productCatalogServiceAddr: opentelemetry-demo-productcatalog:8080 + publicOtelExporterOtlpTracesEndpoint: http://localhost:8080/otlp-http/v1/traces + recommendationServiceAddr: opentelemetry-demo-recommendation:8080 + shippingServiceAddr: opentelemetry-demo-shipping:8080 + webOtelServiceName: frontend-web + image: + repository: ghcr.io/open-telemetry/demo + tag: 2.1.3-frontend + imagePullPolicy: IfNotPresent + resources: + limits: + memory: 250Mi + replicas: 1 + revisionHistoryLimit: 10 + ports: + - name: tcp-service + port: 8080 + targetPort: 3000 + type: ClusterIP diff --git a/astroshop-helm/frontendproxy/.helmignore b/astroshop-helm/frontendproxy/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/astroshop-helm/frontendproxy/.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/frontendproxy/Chart.yaml b/astroshop-helm/frontendproxy/Chart.yaml new file mode 100644 index 0000000..8ddb416 --- /dev/null +++ b/astroshop-helm/frontendproxy/Chart.yaml @@ -0,0 +1,22 @@ +apiVersion: v2 +name: frontendproxy +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/frontendproxy/templates/_helpers.tpl b/astroshop-helm/frontendproxy/templates/_helpers.tpl new file mode 100644 index 0000000..e8ebada --- /dev/null +++ b/astroshop-helm/frontendproxy/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "frontendproxy.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 "frontendproxy.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 "frontendproxy.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "frontendproxy.labels" -}} +helm.sh/chart: {{ include "frontendproxy.chart" . }} +{{ include "frontendproxy.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "frontendproxy.selectorLabels" -}} +app.kubernetes.io/name: {{ include "frontendproxy.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "frontendproxy.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "frontendproxy.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/astroshop-helm/frontendproxy/templates/configmap.yaml b/astroshop-helm/frontendproxy/templates/configmap.yaml new file mode 100644 index 0000000..081dc0a --- /dev/null +++ b/astroshop-helm/frontendproxy/templates/configmap.yaml @@ -0,0 +1,52 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "frontendproxy.fullname" . }}-config + namespace: {{ .Values.namespace }} + labels: + {{- include "frontendproxy.labels" . | nindent 4 }} +data: + envoy.yaml: | + static_resources: + listeners: + - address: + socket_address: + address: "0.0.0.0" + port_value: 8080 + filter_chains: + - filters: + - name: "envoy.filters.network.http_connection_manager" + typed_config: + "@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager + stat_prefix: "ingress_http" + route_config: + name: "local_route" + virtual_hosts: + - name: "frontend" + domains: ["*"] + routes: + - match: + prefix: "/" + route: + cluster: "frontend" + http_filters: + - name: "envoy.filters.http.router" + typed_config: + "@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router + clusters: + - name: "frontend" + type: STRICT_DNS + load_assignment: + cluster_name: "frontend" + endpoints: + - lb_endpoints: + - endpoint: + address: + socket_address: + address: "{{ .Values.opentelemetryDemoFrontendproxy.frontendproxy.env.frontendHost }}" + port_value: {{ .Values.opentelemetryDemoFrontendproxy.frontendproxy.env.frontendPort }} + admin: + address: + socket_address: + address: "0.0.0.0" + port_value: {{ .Values.opentelemetryDemoFrontendproxy.frontendproxy.env.envoyAdminPort }}
\ No newline at end of file diff --git a/astroshop-helm/frontendproxy/templates/deployment.yaml b/astroshop-helm/frontendproxy/templates/deployment.yaml new file mode 100644 index 0000000..a76013a --- /dev/null +++ b/astroshop-helm/frontendproxy/templates/deployment.yaml @@ -0,0 +1,97 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + namespace: {{ .Values.namespace }} + name: {{ include "frontendproxy.fullname" . }} + labels: + app.kubernetes.io/component: frontendproxy + app.kubernetes.io/part-of: opentelemetry-demo + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "frontendproxy.fullname" . }} + {{- include "frontendproxy.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.opentelemetryDemoFrontendproxy.replicas }} + revisionHistoryLimit: {{ .Values.opentelemetryDemoFrontendproxy.revisionHistoryLimit }} + selector: + matchLabels: + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "frontendproxy.fullname" . }} + {{- include "frontendproxy.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + app.kubernetes.io/component: frontendproxy + app.kubernetes.io/instance: opentelemetry-demo + app.kubernetes.io/name: {{ .Values.namespace }}-{{ include "frontendproxy.fullname" . }} + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "frontendproxy.fullname" . }} + {{- include "frontendproxy.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.opentelemetryDemoFrontendproxy.frontendproxy.env.otelCollectorName }} + - name: OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE + value: {{ quote .Values.opentelemetryDemoFrontendproxy.frontendproxy.env.otelExporterOtlpMetricsTemporalityPreference }} + - name: ENVOY_PORT + value: {{ quote .Values.opentelemetryDemoFrontendproxy.frontendproxy.env.envoyPort }} + - name: ENVOY_ADMIN_PORT + value: {{ quote .Values.opentelemetryDemoFrontendproxy.frontendproxy.env.envoyAdminPort }} + - name: FLAGD_HOST + value: {{ quote .Values.opentelemetryDemoFrontendproxy.frontendproxy.env.flagdHost }} + - name: FLAGD_PORT + value: {{ quote .Values.opentelemetryDemoFrontendproxy.frontendproxy.env.flagdPort }} + - name: FLAGD_UI_HOST + value: {{ quote .Values.opentelemetryDemoFrontendproxy.frontendproxy.env.flagdUiHost }} + - name: FLAGD_UI_PORT + value: {{ quote .Values.opentelemetryDemoFrontendproxy.frontendproxy.env.flagdUiPort }} + - name: FRONTEND_HOST + value: {{ quote .Values.opentelemetryDemoFrontendproxy.frontendproxy.env.frontendHost }} + - name: FRONTEND_PORT + value: {{ quote .Values.opentelemetryDemoFrontendproxy.frontendproxy.env.frontendPort }} + - name: GRAFANA_HOST + value: {{ quote .Values.opentelemetryDemoFrontendproxy.frontendproxy.env.grafanaServiceHost }} + - name: GRAFANA_PORT + value: {{ quote .Values.opentelemetryDemoFrontendproxy.frontendproxy.env.grafanaServicePort }} + - name: IMAGE_PROVIDER_HOST + value: {{ quote .Values.opentelemetryDemoFrontendproxy.frontendproxy.env.imageProviderHost }} + - name: IMAGE_PROVIDER_PORT + value: {{ quote .Values.opentelemetryDemoFrontendproxy.frontendproxy.env.imageProviderPort }} + - name: JAEGER_HOST + value: {{ quote .Values.opentelemetryDemoFrontendproxy.frontendproxy.env.jaegerServiceHost }} + - name: JAEGER_UI_PORT + value: {{ quote .Values.opentelemetryDemoFrontendproxy.frontendproxy.env.jaegerServicePort }} + - name: LOCUST_WEB_HOST + value: {{ quote .Values.opentelemetryDemoFrontendproxy.frontendproxy.env.locustWebHost }} + - name: LOCUST_WEB_PORT + value: {{ quote .Values.opentelemetryDemoFrontendproxy.frontendproxy.env.locustWebPort }} + - name: OTEL_COLLECTOR_HOST + value: {{ quote .Values.opentelemetryDemoFrontendproxy.frontendproxy.env.otelCollectorHost }} + - name: OTEL_COLLECTOR_PORT_GRPC + value: {{ quote .Values.opentelemetryDemoFrontendproxy.frontendproxy.env.otelCollectorPortGrpc }} + - name: OTEL_COLLECTOR_PORT_HTTP + value: {{ quote .Values.opentelemetryDemoFrontendproxy.frontendproxy.env.otelCollectorPortHttp }} + - name: OTEL_RESOURCE_ATTRIBUTES + value: {{ quote .Values.opentelemetryDemoFrontendproxy.frontendproxy.env.otelResourceAttributes }} + - name: KUBERNETES_CLUSTER_DOMAIN + value: {{ quote .Values.kubernetesClusterDomain }} + image: '{{ .Values.opentelemetryDemoFrontendproxy.frontendproxy.image.repository }}:{{ .Values.opentelemetryDemoFrontendproxy.frontendproxy.image.tag | default .Chart.AppVersion }}' + imagePullPolicy: {{ .Values.opentelemetryDemoFrontendproxy.frontendproxy.imagePullPolicy }} + name: frontendproxy + ports: + - containerPort: 8080 + name: service + resources: {{- toYaml .Values.opentelemetryDemoFrontendproxy.frontendproxy.resources | nindent 10 }} + securityContext: {{- toYaml .Values.opentelemetryDemoFrontendproxy.frontendproxy.containerSecurityContext | nindent 10 }} + command: ["/usr/local/bin/envoy"] + args: ["-c", "/etc/envoy/envoy.yaml", "--service-cluster", "frontendproxy"] + volumeMounts: + - name: envoy-config + mountPath: /etc/envoy + volumes: + - name: envoy-config + configMap: + name: {{ include "frontendproxy.fullname" . }}-config + serviceAccountName: {{ .Values.serviceAccount.name }}
\ No newline at end of file diff --git a/astroshop-helm/frontendproxy/templates/frontend-proxy.yaml b/astroshop-helm/frontendproxy/templates/frontend-proxy.yaml new file mode 100644 index 0000000..72ace3d --- /dev/null +++ b/astroshop-helm/frontendproxy/templates/frontend-proxy.yaml @@ -0,0 +1,24 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ .Values.namespace }}-{{ include "frontendproxy.fullname" . }} + labels: + app.kubernetes.io/component: frontendproxy + app.kubernetes.io/part-of: opentelemetry-demo + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "frontendproxy.fullname" . }} + annotations: + alb.ingress.kubernetes.io/scheme: internet-facing + alb.ingress.kubernetes.io/target-type: ip +spec: + ingressClassName: alb + rules: + - host: example.com + http: + paths: + - backend: + service: + name: '{{ include "frontendproxy.fullname" . }}' + port: + number: 8080 + path: / + pathType: Prefix diff --git a/astroshop-helm/frontendproxy/templates/service.yaml b/astroshop-helm/frontendproxy/templates/service.yaml new file mode 100644 index 0000000..84f1c4b --- /dev/null +++ b/astroshop-helm/frontendproxy/templates/service.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Values.namespace }}-{{ include "frontendproxy.fullname" . }} + labels: + app.kubernetes.io/component: frontendproxy + app.kubernetes.io/part-of: opentelemetry-demo + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "frontendproxy.fullname" . }} + {{- include "frontendproxy.labels" . | nindent 4 }} +spec: + type: {{ .Values.opentelemetryDemoFrontendproxy.type }} + selector: + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "frontendproxy.fullname" . }} + {{- include "frontendproxy.selectorLabels" . | nindent 4 }} + ports: + {{- .Values.opentelemetryDemoFrontendproxy.ports | toYaml | nindent 2 }} diff --git a/astroshop-helm/frontendproxy/values.yaml b/astroshop-helm/frontendproxy/values.yaml new file mode 100644 index 0000000..3bdc6c9 --- /dev/null +++ b/astroshop-helm/frontendproxy/values.yaml @@ -0,0 +1,51 @@ +namespace: opentelemetry-demo +kubernetesClusterDomain: cluster.local + +serviceAccount: + name: opentelemetry-demo + version: ">=1.32.0-0" + partOf: opentelemetry-demo + +opentelemetryDemoFrontendproxy: + frontendproxy: + containerSecurityContext: + runAsGroup: 101 + runAsNonRoot: true + runAsUser: 101 + env: + envoyPort: "8080" + envoyAdminPort: "10000" + flagdHost: opentelemetry-demo-flagd + flagdPort: "8013" + flagdUiHost: opentelemetry-demo-flagd + flagdUiPort: "4000" + frontendHost: opentelemetry-demo-frontend + frontendPort: "8080" + grafanaServiceHost: opentelemetry-demo-grafana + grafanaServicePort: "80" + imageProviderHost: opentelemetry-demo-imageprovider + imageProviderPort: "8081" + jaegerServiceHost: opentelemetry-demo-jaeger-query + jaegerServicePort: "16686" + locustWebHost: opentelemetry-demo-loadgenerator + locustWebPort: "8089" + otelCollectorHost: $(OTEL_COLLECTOR_NAME) + otelCollectorName: opentelemetry-demo-otelcol + otelCollectorPortGrpc: "4317" + otelCollectorPortHttp: "4318" + otelExporterOtlpMetricsTemporalityPreference: cumulative + 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-frontend-proxy + imagePullPolicy: IfNotPresent + resources: + limits: + memory: 50Mi + replicas: 1 + revisionHistoryLimit: 10 + ports: + - name: tcp-service + port: 8080 + targetPort: 8080 + type: LoadBalancer diff --git a/astroshop-helm/imageprovider/.helmignore b/astroshop-helm/imageprovider/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/astroshop-helm/imageprovider/.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/imageprovider/Chart.yaml b/astroshop-helm/imageprovider/Chart.yaml new file mode 100644 index 0000000..8c9ebc2 --- /dev/null +++ b/astroshop-helm/imageprovider/Chart.yaml @@ -0,0 +1,22 @@ +apiVersion: v2 +name: imageprovider +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/imageprovider/templates/_helpers.tpl b/astroshop-helm/imageprovider/templates/_helpers.tpl new file mode 100644 index 0000000..52b3da9 --- /dev/null +++ b/astroshop-helm/imageprovider/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "imageprovider.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 "imageprovider.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 "imageprovider.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "imageprovider.labels" -}} +helm.sh/chart: {{ include "imageprovider.chart" . }} +{{ include "imageprovider.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "imageprovider.selectorLabels" -}} +app.kubernetes.io/name: {{ include "imageprovider.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "imageprovider.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "imageprovider.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/astroshop-helm/imageprovider/templates/deployment.yaml b/astroshop-helm/imageprovider/templates/deployment.yaml new file mode 100644 index 0000000..cd26d73 --- /dev/null +++ b/astroshop-helm/imageprovider/templates/deployment.yaml @@ -0,0 +1,66 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + namespace: {{ .Values.namespace }} + name: {{ include "imageprovider.fullname" . }} + labels: + app.kubernetes.io/component: imageprovider + app.kubernetes.io/part-of: opentelemetry-demo + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "imageprovider.fullname" . }} + {{- include "imageprovider.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.opentelemetryDemoImageprovider.replicas }} + revisionHistoryLimit: {{ .Values.opentelemetryDemoImageprovider.revisionHistoryLimit + }} + selector: + matchLabels: + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "imageprovider.fullname" . }} + {{- include "imageprovider.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + app.kubernetes.io/component: imageprovider + app.kubernetes.io/instance: opentelemetry-demo + app.kubernetes.io/name: {{ .Values.namespace }}-{{ include "imageprovider.fullname" . }} + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "imageprovider.fullname" . }} + {{- include "imageprovider.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.opentelemetryDemoImageprovider.imageprovider.env.otelCollectorName + }} + - name: OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE + value: {{ quote .Values.opentelemetryDemoImageprovider.imageprovider.env.otelExporterOtlpMetricsTemporalityPreference + }} + - name: IMAGE_PROVIDER_PORT + value: {{ quote .Values.opentelemetryDemoImageprovider.imageprovider.env.imageProviderPort + }} + - name: OTEL_COLLECTOR_PORT_GRPC + value: {{ quote .Values.opentelemetryDemoImageprovider.imageprovider.env.otelCollectorPortGrpc + }} + - name: OTEL_COLLECTOR_HOST + value: {{ quote .Values.opentelemetryDemoImageprovider.imageprovider.env.otelCollectorHost + }} + - name: OTEL_RESOURCE_ATTRIBUTES + value: {{ quote .Values.opentelemetryDemoImageprovider.imageprovider.env.otelResourceAttributes + }} + - name: KUBERNETES_CLUSTER_DOMAIN + value: {{ quote .Values.kubernetesClusterDomain }} + image: '{{ .Values.opentelemetryDemoImageprovider.imageprovider.image.repository + }}:{{ .Values.opentelemetryDemoImageprovider.imageprovider.image.tag | default + .Chart.AppVersion }}' + imagePullPolicy: {{ .Values.opentelemetryDemoImageprovider.imageprovider.imagePullPolicy + }} + name: imageprovider + ports: + - containerPort: 8081 + name: service + resources: {{- toYaml .Values.opentelemetryDemoImageprovider.imageprovider.resources + | nindent 10 }} + serviceAccountName: {{ .Values.serviceAccount.name }} diff --git a/astroshop-helm/imageprovider/templates/service.yaml b/astroshop-helm/imageprovider/templates/service.yaml new file mode 100644 index 0000000..05448c6 --- /dev/null +++ b/astroshop-helm/imageprovider/templates/service.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Values.namespace }}-{{ include "imageprovider.fullname" . }} + labels: + app.kubernetes.io/component: imageprovider + app.kubernetes.io/part-of: opentelemetry-demo + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "imageprovider.fullname" . }} + {{- include "imageprovider.labels" . | nindent 4 }} +spec: + type: {{ .Values.opentelemetryDemoImageprovider.type }} + selector: + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "imageprovider.fullname" . }} + {{- include "imageprovider.selectorLabels" . | nindent 4 }} + ports: + {{- .Values.opentelemetryDemoImageprovider.ports | toYaml | nindent 2 }} diff --git a/astroshop-helm/imageprovider/values.yaml b/astroshop-helm/imageprovider/values.yaml new file mode 100644 index 0000000..207dcab --- /dev/null +++ b/astroshop-helm/imageprovider/values.yaml @@ -0,0 +1,31 @@ +namespace: opentelemetry-demo +kubernetesClusterDomain: cluster.local + +serviceAccount: + name: opentelemetry-demo + version: ">=1.32.0-0" + partOf: opentelemetry-demo + +opentelemetryDemoImageprovider: + imageprovider: + env: + imageProviderPort: "8081" + otelCollectorHost: $(OTEL_COLLECTOR_NAME) + otelCollectorName: opentelemetry-demo-otelcol + otelCollectorPortGrpc: "4317" + otelExporterOtlpMetricsTemporalityPreference: cumulative + 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-image-provider + imagePullPolicy: IfNotPresent + resources: + limits: + memory: 50Mi + ports: + - name: tcp-service + port: 8081 + targetPort: 8081 + replicas: 1 + revisionHistoryLimit: 10 + type: ClusterIP diff --git a/astroshop-helm/kafka/.helmignore b/astroshop-helm/kafka/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/astroshop-helm/kafka/.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/kafka/Chart.yaml b/astroshop-helm/kafka/Chart.yaml new file mode 100644 index 0000000..b943e05 --- /dev/null +++ b/astroshop-helm/kafka/Chart.yaml @@ -0,0 +1,22 @@ +apiVersion: v2 +name: kafka +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/kafka/templates/_helpers.tpl b/astroshop-helm/kafka/templates/_helpers.tpl new file mode 100644 index 0000000..fb7c47d --- /dev/null +++ b/astroshop-helm/kafka/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "kafka.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 "kafka.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 "kafka.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "kafka.labels" -}} +helm.sh/chart: {{ include "kafka.chart" . }} +{{ include "kafka.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "kafka.selectorLabels" -}} +app.kubernetes.io/name: {{ include "kafka.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "kafka.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "kafka.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/astroshop-helm/kafka/templates/deployment.yaml b/astroshop-helm/kafka/templates/deployment.yaml new file mode 100644 index 0000000..8275b42 --- /dev/null +++ b/astroshop-helm/kafka/templates/deployment.yaml @@ -0,0 +1,87 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + namespace: {{ .Values.namespace }} + name: {{ include "kafka.fullname" . }} + labels: + app.kubernetes.io/component: kafka + app.kubernetes.io/part-of: opentelemetry-demo + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "kafka.fullname" . }} + {{- include "kafka.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.opentelemetryDemoKafka.replicas }} + revisionHistoryLimit: {{ .Values.opentelemetryDemoKafka.revisionHistoryLimit }} + selector: + matchLabels: + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "kafka.fullname" . }} + {{- include "kafka.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + app.kubernetes.io/component: kafka + app.kubernetes.io/instance: opentelemetry-demo + app.kubernetes.io/name: {{ .Values.namespace }}-{{ include "kafka.fullname" . }} + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "kafka.fullname" . }} + {{- include "kafka.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.opentelemetryDemoKafka.kafka.env.otelCollectorName }} + - name: OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE + value: {{ quote .Values.opentelemetryDemoKafka.kafka.env.otelExporterOtlpMetricsTemporalityPreference }} + - name: KAFKA_ADVERTISED_LISTENERS + value: {{ quote .Values.opentelemetryDemoKafka.kafka.env.kafkaAdvertisedListeners }} + - name: OTEL_EXPORTER_OTLP_ENDPOINT + value: {{ quote .Values.opentelemetryDemoKafka.kafka.env.otelExporterOtlpEndpoint }} + - name: KAFKA_HEAP_OPTS + value: {{ quote .Values.opentelemetryDemoKafka.kafka.env.kafkaHeapOpts }} + - name: OTEL_RESOURCE_ATTRIBUTES + value: {{ quote .Values.opentelemetryDemoKafka.kafka.env.otelResourceAttributes }} + - name: KUBERNETES_CLUSTER_DOMAIN + value: {{ quote .Values.kubernetesClusterDomain }} + + # KRaft mode environment variables + - name: KAFKA_PROCESS_ROLES + value: {{ quote .Values.opentelemetryDemoKafka.kafka.env.processRoles }} + - name: KAFKA_NODE_ID + value: {{ quote .Values.opentelemetryDemoKafka.kafka.env.nodeId }} + - name: KAFKA_CONTROLLER_QUORUM_VOTERS + value: {{ quote .Values.opentelemetryDemoKafka.kafka.env.controllerQuorumVoters }} + - name: KAFKA_CONTROLLER_LISTENER_NAMES + value: {{ quote .Values.opentelemetryDemoKafka.kafka.env.controllerListenerNames }} + - name: KAFKA_LISTENER_SECURITY_PROTOCOL_MAP + value: {{ quote .Values.opentelemetryDemoKafka.kafka.env.listenerSecurityProtocolMap }} + - name: KAFKA_LISTENERS + value: {{ quote .Values.opentelemetryDemoKafka.kafka.env.listeners }} + - name: KAFKA_INTER_BROKER_LISTENER_NAME + value: {{ quote .Values.opentelemetryDemoKafka.kafka.env.interBrokerListenerName }} + - name: KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR + value: {{ quote .Values.opentelemetryDemoKafka.kafka.env.offsetsTopicReplicationFactor }} + - name: KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR + value: {{ quote .Values.opentelemetryDemoKafka.kafka.env.transactionStateLogReplicationFactor }} + - name: KAFKA_TRANSACTION_STATE_LOG_MIN_ISR + value: {{ quote .Values.opentelemetryDemoKafka.kafka.env.transactionStateLogMinIsr }} + - name: KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS + value: {{ quote .Values.opentelemetryDemoKafka.kafka.env.groupInitialRebalanceDelayMs }} + - name: KAFKA_LOG_DIRS + value: {{ quote .Values.opentelemetryDemoKafka.kafka.env.logDirs }} + - name: CLUSTER_ID + value: {{ quote .Values.opentelemetryDemoKafka.kafka.env.clusterId }} + + image: {{ .Values.opentelemetryDemoKafka.kafka.image.repository }}:{{ .Values.opentelemetryDemoKafka.kafka.image.tag | default .Chart.AppVersion }} + imagePullPolicy: {{ .Values.opentelemetryDemoKafka.kafka.imagePullPolicy }} + name: kafka + ports: + - containerPort: 9092 + name: plaintext + - containerPort: 9093 + name: controller + resources: {{- toYaml .Values.opentelemetryDemoKafka.kafka.resources | nindent 10 }} + securityContext: {{- toYaml .Values.opentelemetryDemoKafka.kafka.containerSecurityContext | nindent 10 }} + serviceAccountName: {{ .Values.serviceAccount.name }}
\ No newline at end of file diff --git a/astroshop-helm/kafka/templates/service.yaml b/astroshop-helm/kafka/templates/service.yaml new file mode 100644 index 0000000..c580713 --- /dev/null +++ b/astroshop-helm/kafka/templates/service.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Values.namespace }}-{{ include "kafka.fullname" . }} + labels: + app.kubernetes.io/component: kafka + app.kubernetes.io/part-of: opentelemetry-demo + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "kafka.fullname" . }} + {{- include "kafka.labels" . | nindent 4 }} +spec: + type: {{ .Values.opentelemetryDemoKafka.type }} + selector: + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "kafka.fullname" . }} + {{- include "kafka.selectorLabels" . | nindent 4 }} + ports: + {{- .Values.opentelemetryDemoKafka.ports | toYaml | nindent 2 }} diff --git a/astroshop-helm/kafka/values.yaml b/astroshop-helm/kafka/values.yaml new file mode 100644 index 0000000..58e98de --- /dev/null +++ b/astroshop-helm/kafka/values.yaml @@ -0,0 +1,53 @@ +namespace: opentelemetry-demo +kubernetesClusterDomain: cluster.local + +serviceAccount: + name: opentelemetry-demo + version: ">=1.32.0-0" + partOf: opentelemetry-demo + +opentelemetryDemoKafka: + kafka: + containerSecurityContext: + runAsGroup: 1000 + runAsNonRoot: true + runAsUser: 1000 + env: + kafkaAdvertisedListeners: PLAINTEXT://opentelemetry-demo-kafka:9092 + kafkaHeapOpts: -Xmx400M -Xms400M + otelCollectorName: opentelemetry-demo-otelcol + otelExporterOtlpEndpoint: http://$(OTEL_COLLECTOR_NAME):4318 + otelExporterOtlpMetricsTemporalityPreference: cumulative + otelResourceAttributes: service.name=$(OTEL_SERVICE_NAME),service.namespace=opentelemetry-demo,service.version=2.1.3 + + # KRaft mode configurations + processRoles: broker,controller + nodeId: 1 + controllerQuorumVoters: 1@opentelemetry-demo-kafka:9093 + controllerListenerNames: CONTROLLER + listenerSecurityProtocolMap: CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT + listeners: PLAINTEXT://:9092,CONTROLLER://:9093 + interBrokerListenerName: PLAINTEXT + offsetsTopicReplicationFactor: 1 + transactionStateLogReplicationFactor: 1 + transactionStateLogMinIsr: 1 + groupInitialRebalanceDelayMs: 0 + logDirs: /var/lib/kafka/data + clusterId: ckjPoprWQzOf0-FuNkGfFQ + image: + repository: ghcr.io/open-telemetry/demo + tag: 2.1.3-kafka + imagePullPolicy: IfNotPresent + resources: + limits: + memory: 600Mi + ports: + - name: plaintext + port: 9092 + targetPort: 9092 + - name: controller + port: 9093 + targetPort: 9093 + replicas: 1 + revisionHistoryLimit: 10 + type: ClusterIP diff --git a/astroshop-helm/loadgenerator/.helmignore b/astroshop-helm/loadgenerator/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/astroshop-helm/loadgenerator/.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/loadgenerator/Chart.yaml b/astroshop-helm/loadgenerator/Chart.yaml new file mode 100644 index 0000000..c5f6c82 --- /dev/null +++ b/astroshop-helm/loadgenerator/Chart.yaml @@ -0,0 +1,22 @@ +apiVersion: v2 +name: loadgenerator +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/loadgenerator/templates/_helpers.tpl b/astroshop-helm/loadgenerator/templates/_helpers.tpl new file mode 100644 index 0000000..e7da0df --- /dev/null +++ b/astroshop-helm/loadgenerator/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "loadgenerator.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 "loadgenerator.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 "loadgenerator.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "loadgenerator.labels" -}} +helm.sh/chart: {{ include "loadgenerator.chart" . }} +{{ include "loadgenerator.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "loadgenerator.selectorLabels" -}} +app.kubernetes.io/name: {{ include "loadgenerator.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "loadgenerator.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "loadgenerator.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/astroshop-helm/loadgenerator/templates/deployment.yaml b/astroshop-helm/loadgenerator/templates/deployment.yaml new file mode 100644 index 0000000..44726e1 --- /dev/null +++ b/astroshop-helm/loadgenerator/templates/deployment.yaml @@ -0,0 +1,90 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + namespace: {{ .Values.namespace }} + name: {{ include "loadgenerator.fullname" . }} + labels: + app.kubernetes.io/component: loadgenerator + app.kubernetes.io/part-of: opentelemetry-demo + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "loadgenerator.fullname" . }} + {{- include "loadgenerator.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.opentelemetryDemoLoadgenerator.replicas }} + revisionHistoryLimit: {{ .Values.opentelemetryDemoLoadgenerator.revisionHistoryLimit + }} + selector: + matchLabels: + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "loadgenerator.fullname" . }} + {{- include "loadgenerator.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + app.kubernetes.io/component: loadgenerator + app.kubernetes.io/instance: opentelemetry-demo + app.kubernetes.io/name: {{ .Values.namespace }}-{{ include "loadgenerator.fullname" . }} + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "loadgenerator.fullname" . }} + {{- include "loadgenerator.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.opentelemetryDemoLoadgenerator.loadgenerator.env.otelCollectorName + }} + - name: OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE + value: {{ quote .Values.opentelemetryDemoLoadgenerator.loadgenerator.env.otelExporterOtlpMetricsTemporalityPreference + }} + - name: LOCUST_WEB_PORT + value: {{ quote .Values.opentelemetryDemoLoadgenerator.loadgenerator.env.locustWebPort + }} + - name: LOCUST_USERS + value: {{ quote .Values.opentelemetryDemoLoadgenerator.loadgenerator.env.locustUsers + }} + - name: LOCUST_SPAWN_RATE + value: {{ quote .Values.opentelemetryDemoLoadgenerator.loadgenerator.env.locustSpawnRate + }} + - name: LOCUST_HOST + value: {{ quote .Values.opentelemetryDemoLoadgenerator.loadgenerator.env.locustHost + }} + - name: LOCUST_HEADLESS + value: {{ quote .Values.opentelemetryDemoLoadgenerator.loadgenerator.env.locustHeadless + }} + - name: LOCUST_AUTOSTART + value: {{ quote .Values.opentelemetryDemoLoadgenerator.loadgenerator.env.locustAutostart + }} + - name: LOCUST_BROWSER_TRAFFIC_ENABLED + value: {{ quote .Values.opentelemetryDemoLoadgenerator.loadgenerator.env.locustBrowserTrafficEnabled + }} + - name: PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION + value: {{ quote .Values.opentelemetryDemoLoadgenerator.loadgenerator.env.protocolBuffersPythonImplementation + }} + - name: FLAGD_HOST + value: {{ quote .Values.opentelemetryDemoLoadgenerator.loadgenerator.env.flagdHost + }} + - name: FLAGD_PORT + value: {{ quote .Values.opentelemetryDemoLoadgenerator.loadgenerator.env.flagdPort + }} + - name: OTEL_EXPORTER_OTLP_ENDPOINT + value: {{ quote .Values.opentelemetryDemoLoadgenerator.loadgenerator.env.otelExporterOtlpEndpoint + }} + - name: OTEL_RESOURCE_ATTRIBUTES + value: {{ quote .Values.opentelemetryDemoLoadgenerator.loadgenerator.env.otelResourceAttributes + }} + - name: KUBERNETES_CLUSTER_DOMAIN + value: {{ quote .Values.kubernetesClusterDomain }} + image: '{{ .Values.opentelemetryDemoLoadgenerator.loadgenerator.image.repository + }}:{{ .Values.opentelemetryDemoLoadgenerator.loadgenerator.image.tag | default + .Chart.AppVersion }}' + imagePullPolicy: {{ .Values.opentelemetryDemoLoadgenerator.loadgenerator.imagePullPolicy + }} + name: loadgenerator + ports: + - containerPort: 8089 + name: service + resources: {{- toYaml .Values.opentelemetryDemoLoadgenerator.loadgenerator.resources + | nindent 10 }} + serviceAccountName: {{ .Values.serviceAccount.name }} diff --git a/astroshop-helm/loadgenerator/templates/service.yaml b/astroshop-helm/loadgenerator/templates/service.yaml new file mode 100644 index 0000000..0258534 --- /dev/null +++ b/astroshop-helm/loadgenerator/templates/service.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Values.namespace }}-{{ include "loadgenerator.fullname" . }} + labels: + app.kubernetes.io/component: loadgenerator + app.kubernetes.io/part-of: opentelemetry-demo + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "loadgenerator.fullname" . }} + {{- include "loadgenerator.labels" . | nindent 4 }} +spec: + type: {{ .Values.opentelemetryDemoLoadgenerator.type }} + selector: + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "loadgenerator.fullname" . }} + {{- include "loadgenerator.selectorLabels" . | nindent 4 }} + ports: + {{- .Values.opentelemetryDemoLoadgenerator.ports | toYaml | nindent 2 }} diff --git a/astroshop-helm/loadgenerator/values.yaml b/astroshop-helm/loadgenerator/values.yaml new file mode 100644 index 0000000..c8549f1 --- /dev/null +++ b/astroshop-helm/loadgenerator/values.yaml @@ -0,0 +1,39 @@ +namespace: opentelemetry-demo +kubernetesClusterDomain: cluster.local + +serviceAccount: + name: opentelemetry-demo + version: ">=1.32.0-0" + partOf: opentelemetry-demo + +opentelemetryDemoLoadgenerator: + loadgenerator: + env: + flagdHost: opentelemetry-demo-flagd + flagdPort: "8013" + locustAutostart: "true" + locustBrowserTrafficEnabled: "true" + locustHeadless: "false" + locustHost: http://opentelemetry-demo-frontendproxy:8080 + locustSpawnRate: "1" + locustUsers: "10" + locustWebPort: "8089" + otelCollectorName: opentelemetry-demo-otelcol + otelExporterOtlpEndpoint: http://$(OTEL_COLLECTOR_NAME):4317 + otelExporterOtlpMetricsTemporalityPreference: cumulative + otelResourceAttributes: service.name=$(OTEL_SERVICE_NAME),service.namespace=opentelemetry-demo,service.version=2.1.3 + protocolBuffersPythonImplementation: python + image: + repository: ghcr.io/open-telemetry/demo + tag: 2.1.3-load-generator + imagePullPolicy: IfNotPresent + resources: + limits: + memory: 1500Mi + ports: + - name: tcp-service + port: 8089 + targetPort: 8089 + replicas: 1 + revisionHistoryLimit: 10 + type: ClusterIP diff --git a/astroshop-helm/payment/.helmignore b/astroshop-helm/payment/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/astroshop-helm/payment/.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/payment/Chart.yaml b/astroshop-helm/payment/Chart.yaml new file mode 100644 index 0000000..ea27b20 --- /dev/null +++ b/astroshop-helm/payment/Chart.yaml @@ -0,0 +1,22 @@ +apiVersion: v2 +name: payment +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/payment/templates/_helpers.tpl b/astroshop-helm/payment/templates/_helpers.tpl new file mode 100644 index 0000000..74b097c --- /dev/null +++ b/astroshop-helm/payment/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "payment.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 "payment.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 "payment.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "payment.labels" -}} +helm.sh/chart: {{ include "payment.chart" . }} +{{ include "payment.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "payment.selectorLabels" -}} +app.kubernetes.io/name: {{ include "payment.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "payment.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "payment.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/astroshop-helm/payment/templates/deployment.yaml b/astroshop-helm/payment/templates/deployment.yaml new file mode 100644 index 0000000..0389eae --- /dev/null +++ b/astroshop-helm/payment/templates/deployment.yaml @@ -0,0 +1,71 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + namespace: {{ .Values.namespace }} + name: {{ include "payment.fullname" . }} + labels: + app.kubernetes.io/component: paymentservice + app.kubernetes.io/part-of: opentelemetry-demo + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "payment.fullname" . }} + {{- include "payment.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.opentelemetryDemoPaymentservice.replicas }} + revisionHistoryLimit: {{ .Values.opentelemetryDemoPaymentservice.revisionHistoryLimit + }} + selector: + matchLabels: + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "payment.fullname" . }} + {{- include "payment.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + app.kubernetes.io/component: paymentservice + app.kubernetes.io/instance: opentelemetry-demo + app.kubernetes.io/name: {{ .Values.namespace }}-{{ include "payment.fullname" . }} + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "payment.fullname" . }} + {{- include "payment.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.opentelemetryDemoPaymentservice.paymentservice.env.otelCollectorName + }} + - name: OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE + value: {{ quote .Values.opentelemetryDemoPaymentservice.paymentservice.env.otelExporterOtlpMetricsTemporalityPreference + }} + - name: PAYMENT_PORT + value: {{ quote .Values.opentelemetryDemoPaymentservice.paymentservice.env.paymentServicePort + }} + - name: FLAGD_HOST + value: {{ quote .Values.opentelemetryDemoPaymentservice.paymentservice.env.flagdHost + }} + - name: FLAGD_PORT + value: {{ quote .Values.opentelemetryDemoPaymentservice.paymentservice.env.flagdPort + }} + - name: OTEL_EXPORTER_OTLP_ENDPOINT + value: {{ quote .Values.opentelemetryDemoPaymentservice.paymentservice.env.otelExporterOtlpEndpoint + }} + - name: OTEL_RESOURCE_ATTRIBUTES + value: {{ quote .Values.opentelemetryDemoPaymentservice.paymentservice.env.otelResourceAttributes + }} + - name: KUBERNETES_CLUSTER_DOMAIN + value: {{ quote .Values.kubernetesClusterDomain }} + image: '{{ .Values.opentelemetryDemoPaymentservice.paymentservice.image.repository + }}:{{ .Values.opentelemetryDemoPaymentservice.paymentservice.image.tag | default + .Chart.AppVersion }}' + imagePullPolicy: {{ .Values.opentelemetryDemoPaymentservice.paymentservice.imagePullPolicy + }} + name: paymentservice + ports: + - containerPort: 8080 + name: service + resources: {{- toYaml .Values.opentelemetryDemoPaymentservice.paymentservice.resources + | nindent 10 }} + securityContext: {{- toYaml .Values.opentelemetryDemoPaymentservice.paymentservice.containerSecurityContext + | nindent 10 }} + serviceAccountName: {{ .Values.serviceAccount.name }} diff --git a/astroshop-helm/payment/templates/service.yaml b/astroshop-helm/payment/templates/service.yaml new file mode 100644 index 0000000..021384c --- /dev/null +++ b/astroshop-helm/payment/templates/service.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Values.namespace }}-{{ include "payment.fullname" . }} + labels: + app.kubernetes.io/component: paymentservice + app.kubernetes.io/part-of: opentelemetry-demo + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "payment.fullname" . }} + {{- include "payment.labels" . | nindent 4 }} +spec: + type: {{ .Values.opentelemetryDemoPaymentservice.type }} + selector: + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "payment.fullname" . }} + {{- include "payment.selectorLabels" . | nindent 4 }} + ports: + {{- .Values.opentelemetryDemoPaymentservice.ports | toYaml | nindent 2 }} diff --git a/astroshop-helm/payment/values.yaml b/astroshop-helm/payment/values.yaml new file mode 100644 index 0000000..63add1c --- /dev/null +++ b/astroshop-helm/payment/values.yaml @@ -0,0 +1,36 @@ +namespace: opentelemetry-demo +kubernetesClusterDomain: cluster.local + +serviceAccount: + name: opentelemetry-demo + version: ">=1.32.0-0" + partOf: opentelemetry-demo + +opentelemetryDemoPaymentservice: + paymentservice: + containerSecurityContext: + runAsGroup: 1000 + runAsNonRoot: true + runAsUser: 1000 + env: + flagdHost: opentelemetry-demo-flagd + flagdPort: "8013" + otelCollectorName: opentelemetry-demo-otelcol + otelExporterOtlpEndpoint: http://$(OTEL_COLLECTOR_NAME):4317 + otelExporterOtlpMetricsTemporalityPreference: cumulative + otelResourceAttributes: service.name=$(OTEL_SERVICE_NAME),service.namespace=opentelemetry-demo,service.version=2.1.3 + paymentServicePort: "8080" + image: + repository: ghcr.io/open-telemetry/demo + tag: 2.1.3-payment + imagePullPolicy: IfNotPresent + resources: + limits: + memory: 120Mi + ports: + - name: tcp-service + port: 8080 + targetPort: 8080 + replicas: 1 + revisionHistoryLimit: 10 + type: ClusterIP diff --git a/astroshop-helm/productcatalog/.helmignore b/astroshop-helm/productcatalog/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/astroshop-helm/productcatalog/.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/productcatalog/Chart.yaml b/astroshop-helm/productcatalog/Chart.yaml new file mode 100644 index 0000000..52545b8 --- /dev/null +++ b/astroshop-helm/productcatalog/Chart.yaml @@ -0,0 +1,22 @@ +apiVersion: v2 +name: productcatalog +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/productcatalog/templates/_helpers.tpl b/astroshop-helm/productcatalog/templates/_helpers.tpl new file mode 100644 index 0000000..f68512d --- /dev/null +++ b/astroshop-helm/productcatalog/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "productcatalog.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 "productcatalog.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 "productcatalog.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "productcatalog.labels" -}} +helm.sh/chart: {{ include "productcatalog.chart" . }} +{{ include "productcatalog.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "productcatalog.selectorLabels" -}} +app.kubernetes.io/name: {{ include "productcatalog.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "productcatalog.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "productcatalog.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/astroshop-helm/productcatalog/templates/deployment.yaml b/astroshop-helm/productcatalog/templates/deployment.yaml new file mode 100644 index 0000000..70262be --- /dev/null +++ b/astroshop-helm/productcatalog/templates/deployment.yaml @@ -0,0 +1,69 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + namespace: {{ .Values.namespace }} + name: {{ include "productcatalog.fullname" . }} + labels: + app.kubernetes.io/component: productcatalogservice + app.kubernetes.io/part-of: opentelemetry-demo + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "productcatalog.fullname" . }} + {{- include "productcatalog.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.opentelemetryDemoProductcatalogservice.replicas }} + revisionHistoryLimit: {{ .Values.opentelemetryDemoProductcatalogservice.revisionHistoryLimit + }} + selector: + matchLabels: + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "productcatalog.fullname" . }} + {{- include "productcatalog.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + app.kubernetes.io/component: productcatalogservice + app.kubernetes.io/instance: opentelemetry-demo + app.kubernetes.io/name: {{ .Values.namespace }}-{{ include "productcatalog.fullname" . }} + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "productcatalog.fullname" . }} + {{- include "productcatalog.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.opentelemetryDemoProductcatalogservice.productcatalogservice.env.otelCollectorName + }} + - name: OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE + value: {{ quote .Values.opentelemetryDemoProductcatalogservice.productcatalogservice.env.otelExporterOtlpMetricsTemporalityPreference + }} + - name: PRODUCT_CATALOG_PORT + value: {{ quote .Values.opentelemetryDemoProductcatalogservice.productcatalogservice.env.productCatalogServicePort + }} + - name: FLAGD_HOST + value: {{ quote .Values.opentelemetryDemoProductcatalogservice.productcatalogservice.env.flagdHost + }} + - name: FLAGD_PORT + value: {{ quote .Values.opentelemetryDemoProductcatalogservice.productcatalogservice.env.flagdPort + }} + - name: OTEL_EXPORTER_OTLP_ENDPOINT + value: {{ quote .Values.opentelemetryDemoProductcatalogservice.productcatalogservice.env.otelExporterOtlpEndpoint + }} + - name: OTEL_RESOURCE_ATTRIBUTES + value: {{ quote .Values.opentelemetryDemoProductcatalogservice.productcatalogservice.env.otelResourceAttributes + }} + - name: KUBERNETES_CLUSTER_DOMAIN + value: {{ quote .Values.kubernetesClusterDomain }} + image: '{{ .Values.opentelemetryDemoProductcatalogservice.productcatalogservice.image.repository + }}:{{ .Values.opentelemetryDemoProductcatalogservice.productcatalogservice.image.tag + | default .Chart.AppVersion }}' + imagePullPolicy: {{ .Values.opentelemetryDemoProductcatalogservice.productcatalogservice.imagePullPolicy + }} + name: productcatalogservice + ports: + - containerPort: 8080 + name: service + resources: {{- toYaml .Values.opentelemetryDemoProductcatalogservice.productcatalogservice.resources + | nindent 10 }} + serviceAccountName: {{ .Values.serviceAccount.name }} diff --git a/astroshop-helm/productcatalog/templates/service.yaml b/astroshop-helm/productcatalog/templates/service.yaml new file mode 100644 index 0000000..29ef7cf --- /dev/null +++ b/astroshop-helm/productcatalog/templates/service.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Values.namespace }}-{{ include "productcatalog.fullname" . }} + labels: + app.kubernetes.io/component: productcatalogservice + app.kubernetes.io/part-of: opentelemetry-demo + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "productcatalog.fullname" . }} + {{- include "productcatalog.labels" . | nindent 4 }} +spec: + type: {{ .Values.opentelemetryDemoProductcatalogservice.type }} + selector: + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "productcatalog.fullname" . }} + {{- include "productcatalog.selectorLabels" . | nindent 4 }} + ports: + {{- .Values.opentelemetryDemoProductcatalogservice.ports | toYaml | nindent 2 }} diff --git a/astroshop-helm/productcatalog/values.yaml b/astroshop-helm/productcatalog/values.yaml new file mode 100644 index 0000000..8899179 --- /dev/null +++ b/astroshop-helm/productcatalog/values.yaml @@ -0,0 +1,32 @@ +namespace: opentelemetry-demo +kubernetesClusterDomain: cluster.local + +serviceAccount: + name: opentelemetry-demo + version: ">=1.32.0-0" + partOf: opentelemetry-demo + +opentelemetryDemoProductcatalogservice: + ports: + - name: tcp-service + port: 8080 + targetPort: 8080 + productcatalogservice: + env: + flagdHost: opentelemetry-demo-flagd + flagdPort: "8013" + otelCollectorName: opentelemetry-demo-otelcol + otelExporterOtlpEndpoint: http://$(OTEL_COLLECTOR_NAME):4317 + otelExporterOtlpMetricsTemporalityPreference: cumulative + otelResourceAttributes: service.name=$(OTEL_SERVICE_NAME),service.namespace=opentelemetry-demo,service.version=2.1.3 + productCatalogServicePort: "8080" + image: + repository: abhishekf5/product-catalog + tag: "13134113508" + imagePullPolicy: IfNotPresent + resources: + limits: + memory: 20Mi + replicas: 1 + revisionHistoryLimit: 10 + type: ClusterIP diff --git a/astroshop-helm/quote/.helmignore b/astroshop-helm/quote/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/astroshop-helm/quote/.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/quote/Chart.yaml b/astroshop-helm/quote/Chart.yaml new file mode 100644 index 0000000..01b98ef --- /dev/null +++ b/astroshop-helm/quote/Chart.yaml @@ -0,0 +1,22 @@ +apiVersion: v2 +name: quote +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/quote/templates/_helpers.tpl b/astroshop-helm/quote/templates/_helpers.tpl new file mode 100644 index 0000000..4a5a647 --- /dev/null +++ b/astroshop-helm/quote/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "quote.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 "quote.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 "quote.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "quote.labels" -}} +helm.sh/chart: {{ include "quote.chart" . }} +{{ include "quote.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "quote.selectorLabels" -}} +app.kubernetes.io/name: {{ include "quote.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "quote.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "quote.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/astroshop-helm/quote/templates/deployment.yaml b/astroshop-helm/quote/templates/deployment.yaml new file mode 100644 index 0000000..30959ec --- /dev/null +++ b/astroshop-helm/quote/templates/deployment.yaml @@ -0,0 +1,68 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + namespace: {{ .Values.namespace }} + name: {{ include "quote.fullname" . }} + labels: + app.kubernetes.io/component: quoteservice + app.kubernetes.io/part-of: opentelemetry-demo + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "quote.fullname" . }} + {{- include "quote.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.opentelemetryDemoQuoteservice.replicas }} + revisionHistoryLimit: {{ .Values.opentelemetryDemoQuoteservice.revisionHistoryLimit + }} + selector: + matchLabels: + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "quote.fullname" . }} + {{- include "quote.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + app.kubernetes.io/component: quoteservice + app.kubernetes.io/instance: opentelemetry-demo + app.kubernetes.io/name: {{ .Values.namespace }}-{{ include "quote.fullname" . }} + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "quote.fullname" . }} + {{- include "quote.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.opentelemetryDemoQuoteservice.quoteservice.env.otelCollectorName + }} + - name: OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE + value: {{ quote .Values.opentelemetryDemoQuoteservice.quoteservice.env.otelExporterOtlpMetricsTemporalityPreference + }} + - name: QUOTE_PORT + value: {{ quote .Values.opentelemetryDemoQuoteservice.quoteservice.env.quoteServicePort + }} + - name: OTEL_PHP_AUTOLOAD_ENABLED + value: {{ quote .Values.opentelemetryDemoQuoteservice.quoteservice.env.otelPhpAutoloadEnabled + }} + - name: OTEL_EXPORTER_OTLP_ENDPOINT + value: {{ quote .Values.opentelemetryDemoQuoteservice.quoteservice.env.otelExporterOtlpEndpoint + }} + - name: OTEL_RESOURCE_ATTRIBUTES + value: {{ quote .Values.opentelemetryDemoQuoteservice.quoteservice.env.otelResourceAttributes + }} + - name: KUBERNETES_CLUSTER_DOMAIN + value: {{ quote .Values.kubernetesClusterDomain }} + image: '{{ .Values.opentelemetryDemoQuoteservice.quoteservice.image.repository }}:{{ + .Values.opentelemetryDemoQuoteservice.quoteservice.image.tag | default .Chart.AppVersion + }}' + imagePullPolicy: {{ .Values.opentelemetryDemoQuoteservice.quoteservice.imagePullPolicy + }} + name: quoteservice + ports: + - containerPort: 8080 + name: service + resources: {{- toYaml .Values.opentelemetryDemoQuoteservice.quoteservice.resources + | nindent 10 }} + securityContext: {{- toYaml .Values.opentelemetryDemoQuoteservice.quoteservice.containerSecurityContext + | nindent 10 }} + serviceAccountName: {{ .Values.serviceAccount.name }} diff --git a/astroshop-helm/quote/templates/service.yaml b/astroshop-helm/quote/templates/service.yaml new file mode 100644 index 0000000..8ba12b4 --- /dev/null +++ b/astroshop-helm/quote/templates/service.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Values.namespace }}-{{ include "quote.fullname" . }} + labels: + app.kubernetes.io/component: quoteservice + app.kubernetes.io/part-of: opentelemetry-demo + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "quote.fullname" . }} + {{- include "quote.labels" . | nindent 4 }} +spec: + type: {{ .Values.opentelemetryDemoQuoteservice.type }} + selector: + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "quote.fullname" . }} + {{- include "quote.selectorLabels" . | nindent 4 }} + ports: + {{- .Values.opentelemetryDemoQuoteservice.ports | toYaml | nindent 2 }} diff --git a/astroshop-helm/quote/values.yaml b/astroshop-helm/quote/values.yaml new file mode 100644 index 0000000..19d0e6e --- /dev/null +++ b/astroshop-helm/quote/values.yaml @@ -0,0 +1,35 @@ +namespace: opentelemetry-demo +kubernetesClusterDomain: cluster.local + +serviceAccount: + name: opentelemetry-demo + version: ">=1.32.0-0" + partOf: opentelemetry-demo + +opentelemetryDemoQuoteservice: + ports: + - name: tcp-service + port: 8080 + targetPort: 8080 + quoteservice: + containerSecurityContext: + runAsGroup: 33 + runAsNonRoot: true + runAsUser: 33 + env: + otelCollectorName: opentelemetry-demo-otelcol + otelExporterOtlpEndpoint: http://$(OTEL_COLLECTOR_NAME):4318 + otelExporterOtlpMetricsTemporalityPreference: cumulative + otelPhpAutoloadEnabled: "true" + otelResourceAttributes: service.name=$(OTEL_SERVICE_NAME),service.namespace=opentelemetry-demo,service.version=2.1.3 + quoteServicePort: "8080" + image: + repository: ghcr.io/open-telemetry/demo + tag: 2.1.3-quote + imagePullPolicy: IfNotPresent + resources: + limits: + memory: 40Mi + replicas: 1 + revisionHistoryLimit: 10 + type: ClusterIP diff --git a/astroshop-helm/recommendation/.helmignore b/astroshop-helm/recommendation/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/astroshop-helm/recommendation/.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/recommendation/Chart.yaml b/astroshop-helm/recommendation/Chart.yaml new file mode 100644 index 0000000..eeee0d9 --- /dev/null +++ b/astroshop-helm/recommendation/Chart.yaml @@ -0,0 +1,22 @@ +apiVersion: v2 +name: recommendation +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/recommendation/templates/_helpers.tpl b/astroshop-helm/recommendation/templates/_helpers.tpl new file mode 100644 index 0000000..4945313 --- /dev/null +++ b/astroshop-helm/recommendation/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "recommendation.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 "recommendation.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 "recommendation.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "recommendation.labels" -}} +helm.sh/chart: {{ include "recommendation.chart" . }} +{{ include "recommendation.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "recommendation.selectorLabels" -}} +app.kubernetes.io/name: {{ include "recommendation.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "recommendation.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "recommendation.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/astroshop-helm/recommendation/templates/deployment.yaml b/astroshop-helm/recommendation/templates/deployment.yaml new file mode 100644 index 0000000..c222cea --- /dev/null +++ b/astroshop-helm/recommendation/templates/deployment.yaml @@ -0,0 +1,78 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + namespace: {{ .Values.namespace }} + name: {{ include "recommendation.fullname" . }} + labels: + app.kubernetes.io/component: recommendationservice + app.kubernetes.io/part-of: opentelemetry-demo + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "recommendation.fullname" . }} + {{- include "recommendation.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.opentelemetryDemoRecommendationservice.replicas }} + revisionHistoryLimit: {{ .Values.opentelemetryDemoRecommendationservice.revisionHistoryLimit + }} + selector: + matchLabels: + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "recommendation.fullname" . }} + {{- include "recommendation.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + app.kubernetes.io/component: recommendationservice + app.kubernetes.io/instance: opentelemetry-demo + app.kubernetes.io/name: {{ .Values.namespace }}-{{ include "recommendation.fullname" . }} + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "recommendation.fullname" . }} + {{- include "recommendation.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.opentelemetryDemoRecommendationservice.recommendationservice.env.otelCollectorName + }} + - name: OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE + value: {{ quote .Values.opentelemetryDemoRecommendationservice.recommendationservice.env.otelExporterOtlpMetricsTemporalityPreference + }} + - name: RECOMMENDATION_PORT + value: {{ quote .Values.opentelemetryDemoRecommendationservice.recommendationservice.env.recommendationServicePort + }} + - name: PRODUCT_CATALOG_ADDR + value: {{ quote .Values.opentelemetryDemoRecommendationservice.recommendationservice.env.productCatalogServiceAddr + }} + - name: OTEL_PYTHON_LOG_CORRELATION + value: {{ quote .Values.opentelemetryDemoRecommendationservice.recommendationservice.env.otelPythonLogCorrelation + }} + - name: PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION + value: {{ quote .Values.opentelemetryDemoRecommendationservice.recommendationservice.env.protocolBuffersPythonImplementation + }} + - name: FLAGD_HOST + value: {{ quote .Values.opentelemetryDemoRecommendationservice.recommendationservice.env.flagdHost + }} + - name: FLAGD_PORT + value: {{ quote .Values.opentelemetryDemoRecommendationservice.recommendationservice.env.flagdPort + }} + - name: OTEL_EXPORTER_OTLP_ENDPOINT + value: {{ quote .Values.opentelemetryDemoRecommendationservice.recommendationservice.env.otelExporterOtlpEndpoint + }} + - name: OTEL_RESOURCE_ATTRIBUTES + value: {{ quote .Values.opentelemetryDemoRecommendationservice.recommendationservice.env.otelResourceAttributes + }} + - name: KUBERNETES_CLUSTER_DOMAIN + value: {{ quote .Values.kubernetesClusterDomain }} + image: '{{ .Values.opentelemetryDemoRecommendationservice.recommendationservice.image.repository + }}:{{ .Values.opentelemetryDemoRecommendationservice.recommendationservice.image.tag + | default .Chart.AppVersion }}' + imagePullPolicy: {{ .Values.opentelemetryDemoRecommendationservice.recommendationservice.imagePullPolicy + }} + name: recommendationservice + ports: + - containerPort: 8080 + name: service + resources: {{- toYaml .Values.opentelemetryDemoRecommendationservice.recommendationservice.resources + | nindent 10 }} + serviceAccountName: {{ .Values.serviceAccount.name }} diff --git a/astroshop-helm/recommendation/templates/service.yaml b/astroshop-helm/recommendation/templates/service.yaml new file mode 100644 index 0000000..98f6a4e --- /dev/null +++ b/astroshop-helm/recommendation/templates/service.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Values.namespace }}-{{ include "recommendation.fullname" . }} + labels: + app.kubernetes.io/component: recommendationservice + app.kubernetes.io/part-of: opentelemetry-demo + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "recommendation.fullname" . }} + {{- include "recommendation.labels" . | nindent 4 }} +spec: + type: {{ .Values.opentelemetryDemoRecommendationservice.type }} + selector: + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "recommendation.fullname" . }} + {{- include "recommendation.selectorLabels" . | nindent 4 }} + ports: + {{- .Values.opentelemetryDemoRecommendationservice.ports | toYaml | nindent 2 }} diff --git a/astroshop-helm/recommendation/values.yaml b/astroshop-helm/recommendation/values.yaml new file mode 100644 index 0000000..247eb8f --- /dev/null +++ b/astroshop-helm/recommendation/values.yaml @@ -0,0 +1,35 @@ +namespace: opentelemetry-demo +kubernetesClusterDomain: cluster.local + +serviceAccount: + name: opentelemetry-demo + version: ">=1.32.0-0" + partOf: opentelemetry-demo + +opentelemetryDemoRecommendationservice: + ports: + - name: tcp-service + port: 8080 + targetPort: 8080 + recommendationservice: + env: + flagdHost: opentelemetry-demo-flagd + flagdPort: "8013" + otelCollectorName: opentelemetry-demo-otelcol + otelExporterOtlpEndpoint: http://$(OTEL_COLLECTOR_NAME):4317 + otelExporterOtlpMetricsTemporalityPreference: cumulative + otelPythonLogCorrelation: "true" + otelResourceAttributes: service.name=$(OTEL_SERVICE_NAME),service.namespace=opentelemetry-demo,service.version=2.1.3 + productCatalogServiceAddr: opentelemetry-demo-productcatalog:8080 + protocolBuffersPythonImplementation: python + recommendationServicePort: "8080" + image: + repository: ghcr.io/open-telemetry/demo + tag: 2.1.3-recommendation + imagePullPolicy: IfNotPresent + resources: + limits: + memory: 500Mi + replicas: 1 + revisionHistoryLimit: 10 + type: ClusterIP diff --git a/astroshop-helm/shipping/.helmignore b/astroshop-helm/shipping/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/astroshop-helm/shipping/.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/shipping/Chart.yaml b/astroshop-helm/shipping/Chart.yaml new file mode 100644 index 0000000..58c6a62 --- /dev/null +++ b/astroshop-helm/shipping/Chart.yaml @@ -0,0 +1,22 @@ +apiVersion: v2 +name: shipping +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/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 }} diff --git a/astroshop-helm/shipping/values.yaml b/astroshop-helm/shipping/values.yaml new file mode 100644 index 0000000..2881f89 --- /dev/null +++ b/astroshop-helm/shipping/values.yaml @@ -0,0 +1,31 @@ +namespace: opentelemetry-demo +kubernetesClusterDomain: cluster.local + +serviceAccount: + name: opentelemetry-demo + version: ">=1.32.0-0" + partOf: opentelemetry-demo + +opentelemetryDemoShippingservice: + ports: + - name: tcp-service + port: 8080 + targetPort: 8080 + replicas: 1 + revisionHistoryLimit: 10 + shippingservice: + env: + otelCollectorName: opentelemetry-demo-otelcol + otelExporterOtlpEndpoint: http://$(OTEL_COLLECTOR_NAME):4317 + otelExporterOtlpMetricsTemporalityPreference: cumulative + otelResourceAttributes: service.name=$(OTEL_SERVICE_NAME),service.namespace=opentelemetry-demo,service.version=2.1.3 + quoteServiceAddr: http://opentelemetry-demo-quote:8080 + shippingServicePort: "8080" + image: + repository: ghcr.io/open-telemetry/demo + tag: 2.1.3-shipping + imagePullPolicy: IfNotPresent + resources: + limits: + memory: 20Mi + type: ClusterIP diff --git a/astroshop-helm/valkey/.helmignore b/astroshop-helm/valkey/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/astroshop-helm/valkey/.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/valkey/Chart.yaml b/astroshop-helm/valkey/Chart.yaml new file mode 100644 index 0000000..e3ca3e2 --- /dev/null +++ b/astroshop-helm/valkey/Chart.yaml @@ -0,0 +1,22 @@ +apiVersion: v2 +name: valkey +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/valkey/templates/_helpers.tpl b/astroshop-helm/valkey/templates/_helpers.tpl new file mode 100644 index 0000000..359873a --- /dev/null +++ b/astroshop-helm/valkey/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "valkey.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 "valkey.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 "valkey.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "valkey.labels" -}} +helm.sh/chart: {{ include "valkey.chart" . }} +{{ include "valkey.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "valkey.selectorLabels" -}} +app.kubernetes.io/name: {{ include "valkey.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "valkey.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "valkey.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/astroshop-helm/valkey/templates/deployment.yaml b/astroshop-helm/valkey/templates/deployment.yaml new file mode 100644 index 0000000..155f84d --- /dev/null +++ b/astroshop-helm/valkey/templates/deployment.yaml @@ -0,0 +1,56 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + namespace: {{ .Values.namespace }} + name: {{ include "valkey.fullname" . }} + labels: + app.kubernetes.io/component: valkey + app.kubernetes.io/part-of: opentelemetry-demo + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "valkey.fullname" . }} + {{- include "valkey.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.opentelemetryDemoValkey.replicas }} + revisionHistoryLimit: {{ .Values.opentelemetryDemoValkey.revisionHistoryLimit }} + selector: + matchLabels: + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "valkey.fullname" . }} + {{- include "valkey.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + app.kubernetes.io/component: valkey + app.kubernetes.io/instance: opentelemetry-demo + app.kubernetes.io/name: {{ .Values.namespace }}-{{ include "valkey.fullname" . }} + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "valkey.fullname" . }} + {{- include "valkey.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.opentelemetryDemoValkey.valkey.env.otelCollectorName + }} + - name: OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE + value: {{ quote .Values.opentelemetryDemoValkey.valkey.env.otelExporterOtlpMetricsTemporalityPreference + }} + - name: OTEL_RESOURCE_ATTRIBUTES + value: {{ quote .Values.opentelemetryDemoValkey.valkey.env.otelResourceAttributes + }} + - name: KUBERNETES_CLUSTER_DOMAIN + value: {{ quote .Values.kubernetesClusterDomain }} + image: {{ .Values.opentelemetryDemoValkey.valkey.image.repository }}:{{ .Values.opentelemetryDemoValkey.valkey.image.tag + | default .Chart.AppVersion }} + imagePullPolicy: {{ .Values.opentelemetryDemoValkey.valkey.imagePullPolicy }} + name: valkey + ports: + - containerPort: 6379 + name: valkey + resources: {{- toYaml .Values.opentelemetryDemoValkey.valkey.resources | nindent + 10 }} + securityContext: {{- toYaml .Values.opentelemetryDemoValkey.valkey.containerSecurityContext + | nindent 10 }} + serviceAccountName: {{ .Values.serviceAccount.name }} diff --git a/astroshop-helm/valkey/templates/service.yaml b/astroshop-helm/valkey/templates/service.yaml new file mode 100644 index 0000000..f35bb65 --- /dev/null +++ b/astroshop-helm/valkey/templates/service.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Values.namespace }}-{{ include "valkey.fullname" . }} + labels: + app.kubernetes.io/component: valkey + app.kubernetes.io/part-of: opentelemetry-demo + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "valkey.fullname" . }} + {{- include "valkey.labels" . | nindent 4 }} +spec: + type: {{ .Values.opentelemetryDemoValkey.type }} + selector: + opentelemetry.io/name: {{ .Values.namespace }}-{{ include "valkey.fullname" . }} + {{- include "valkey.selectorLabels" . | nindent 4 }} + ports: + {{- .Values.opentelemetryDemoValkey.ports | toYaml | nindent 2 }} diff --git a/astroshop-helm/valkey/values.yaml b/astroshop-helm/valkey/values.yaml new file mode 100644 index 0000000..39cd97b --- /dev/null +++ b/astroshop-helm/valkey/values.yaml @@ -0,0 +1,32 @@ +namespace: opentelemetry-demo +kubernetesClusterDomain: cluster.local + +serviceAccount: + name: opentelemetry-demo + version: ">=1.32.0-0" + partOf: opentelemetry-demo + +opentelemetryDemoValkey: + ports: + - name: valkey + port: 6379 + targetPort: 6379 + replicas: 1 + revisionHistoryLimit: 10 + type: ClusterIP + valkey: + containerSecurityContext: + runAsGroup: 1000 + runAsNonRoot: true + runAsUser: 999 + env: + otelCollectorName: opentelemetry-demo-otelcol + otelExporterOtlpMetricsTemporalityPreference: cumulative + otelResourceAttributes: service.name=$(OTEL_SERVICE_NAME),service.namespace=opentelemetry-demo,service.version=2.1.3 + image: + repository: valkey/valkey + tag: 7.2-alpine + imagePullPolicy: IfNotPresent + resources: + limits: + memory: 20Mi |
