Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions charts/opentelemetry-demo/postgresql-init/01-init.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
-- Copyright The OpenTelemetry Authors
-- SPDX-License-Identifier: Apache-2.0

CREATE USER otelu WITH PASSWORD 'otelp';


-- Create a table
CREATE TABLE "order" (
order_id TEXT PRIMARY KEY
);

CREATE TABLE shipping (
shipping_tracking_id TEXT PRIMARY KEY,
shipping_cost_currency_code TEXT NOT NULL,
shipping_cost_units BIGINT NOT NULL,
shipping_cost_nanos INT NOT NULL,
street_address TEXT,
city TEXT,
state TEXT,
country TEXT,
zip_code TEXT,
order_id TEXT NOT NULL,
FOREIGN KEY (order_id) REFERENCES "order"(order_id) ON DELETE CASCADE
);

CREATE TABLE orderitem (
item_cost_currency_code TEXT NOT NULL,
item_cost_units BIGINT NOT NULL,
item_cost_nanos INT NOT NULL,
product_id TEXT NOT NULL,
quantity INT NOT NULL,
order_id TEXT NOT NULL,
PRIMARY KEY (order_id, product_id),
FOREIGN KEY (order_id) REFERENCES "order"(order_id) ON DELETE CASCADE
);

GRANT SELECT, INSERT, UPDATE ON ALL TABLES IN SCHEMA public TO otelu;
11 changes: 11 additions & 0 deletions charts/opentelemetry-demo/templates/postgresql-init-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{- if .Values.components.postgresql.enabled -}}
apiVersion: v1
kind: ConfigMap
metadata:
name: postgresql-init
namespace: {{ .Release.Namespace }}
labels:
{{- include "otel-demo.labels" . | nindent 4 }}
data:
{{ (.Files.Glob "postgresql-init/*.sql").AsConfig | nindent 2 }}
{{- end -}}
3 changes: 3 additions & 0 deletions charts/opentelemetry-demo/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@
},
"valkey-cart": {
"$ref": "#/definitions/Component"
},
"postgresql": {
"$ref": "#/definitions/Component"
}
},
"title": "Components"
Expand Down
31 changes: 31 additions & 0 deletions charts/opentelemetry-demo/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@ components:
value: kafka:9092
- name: OTEL_EXPORTER_OTLP_ENDPOINT
value: http://$(OTEL_COLLECTOR_NAME):4318
- name: DB_CONNECTION_STRING
value: Host=postgresql;Username=otelu;Password=otelp;Database=otel
- name: OTEL_DOTNET_AUTO_TRACES_ENTITYFRAMEWORKCORE_INSTRUMENTATION_ENABLED
value: "false"
resources:
limits:
memory: 120Mi
Expand Down Expand Up @@ -681,6 +685,33 @@ components:
runAsGroup: 1000
runAsNonRoot: true

postgresql:
enabled: true
useDefault:
env: true
imageOverride:
repository: postgres
tag: "17.5"
replicas: 1
ports:
- name: postgresql
value: 5432
env:
- name: POSTGRES_USER
value: root
- name: POSTGRES_PASSWORD
value: otel
- name: POSTGRES_DB
value: otel
resources:
limits:
memory: 500Mi
mountedConfigMaps:
- name: init
mountPath: /docker-entrypoint-initdb.d/
existingConfigMap: postgresql-init


opentelemetry-collector:
enabled: true
image:
Expand Down
Loading