Skip to content

Commit 802d8bb

Browse files
authored
Merge pull request #1 from duplocloud/aos-chart
Initial commit for aos chart
2 parents a9e7a1b + 9713998 commit 802d8bb

File tree

9 files changed

+469
-0
lines changed

9 files changed

+469
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Release Charts
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
release:
10+
permissions:
11+
contents: write
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v3
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Configure Git
20+
run: |
21+
git config user.name "$srikar"
22+
git config user.email "[email protected]"
23+
24+
- name: Run chart-releaser
25+
uses: helm/[email protected]
26+
env:
27+
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

charts/aos/Chart.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
apiVersion: v2
2+
name: aos
3+
description: Custom Helm chart for OpenTelemetry stack resources
4+
type: application
5+
version: 0.1.0
6+
appVersion: "1.0.0"

charts/aos/templates/cronjobs.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{{- if .Values.observabilityCollector.enabled }}
2+
apiVersion: batch/v1
3+
kind: CronJob
4+
metadata:
5+
name: otel-observability-collector
6+
namespace: {{ .Values.global.tenantName }}
7+
spec:
8+
schedule: {{ .Values.observabilityCollector.schedule | quote }}
9+
concurrencyPolicy: Forbid
10+
failedJobsHistoryLimit: 3
11+
successfulJobsHistoryLimit: 3
12+
jobTemplate:
13+
spec:
14+
template:
15+
spec:
16+
containers:
17+
- name: duplo-observability
18+
image: "{{ .Values.observabilityCollector.image }}:{{ .Values.observabilityCollector.imageTag }}"
19+
env:
20+
- name: PROMETHEUS_URL
21+
value: "http://duplo-metrics-nginx:80/prometheus"
22+
- name: LOKI_URL
23+
value: "https://logs.prod-apps.duplocloud.net"
24+
- name: CLUSTER
25+
value: {{ .Values.global.tenantInfraName | quote }}
26+
- name: NAMESPACE
27+
value: {{ .Values.global.tenantName | quote }}
28+
- name: CUSTOMER
29+
value: {{ .Values.global.customerName | quote }}
30+
- name: ENVIRONMENT
31+
value: {{ .Values.global.environment | quote }}
32+
- name: DUPLO_URL
33+
value: {{ .Values.global.duploAuthUrl | quote }}
34+
- name: GPG_PASSPHRASE
35+
valueFrom:
36+
secretKeyRef:
37+
name: gpg-passphrase
38+
key: gpg_passphrase
39+
- name: JOB_VERSION
40+
value: {{ .Values.observabilityCollector.jobVersion | quote }}
41+
restartPolicy: OnFailure
42+
{{- end }}
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
{{- if .Values.grafanaUI.enabled }}
2+
apiVersion: apps/v1
3+
kind: Deployment
4+
metadata:
5+
name: grafana-ui
6+
namespace: {{ .Values.global.tenantName }}
7+
spec:
8+
replicas: {{ .Values.grafanaUI.replicas }}
9+
selector:
10+
matchLabels:
11+
app: grafana-ui
12+
template:
13+
metadata:
14+
labels:
15+
app: grafana-ui
16+
annotations:
17+
k8s_grafana_com_scrape: "true"
18+
k8s_grafana_com_job: "grafana-metrics"
19+
k8s_grafana_com_metrics_path: "/metrics"
20+
k8s_grafana_com_metrics_portNumber: "3000"
21+
spec:
22+
containers:
23+
- name: grafana-ui
24+
image: "{{ .Values.grafanaUI.image }}:{{ .Values.grafanaUI.imageTag }}"
25+
ports:
26+
- containerPort: 3000
27+
env:
28+
- name: GF_INSTALL_PLUGINS
29+
value: {{ .Values.grafanaUI.plugins | quote }}
30+
- name: GF_SERVER_ROOT_URL
31+
value: "https://grafana-proxy-{{ .Values.global.tenantName }}.{{ .Values.global.dnsSuffix }}/"
32+
- name: GF_SECURITY_ADMIN_USER
33+
valueFrom:
34+
secretKeyRef:
35+
name: grafanaui
36+
key: username
37+
- name: GF_SECURITY_ADMIN_PASSWORD
38+
valueFrom:
39+
secretKeyRef:
40+
name: grafanaui
41+
key: password
42+
resources:
43+
{{- toYaml .Values.grafanaUI.resources | nindent 12 }}
44+
volumeMounts:
45+
- name: data
46+
mountPath: /var/lib/grafana
47+
volumes:
48+
- name: data
49+
persistentVolumeClaim:
50+
claimName: grafana-ui-data
51+
---
52+
{{- end }}
53+
{{- if .Values.duploAutomation.enabled }}
54+
apiVersion: apps/v1
55+
kind: Deployment
56+
metadata:
57+
name: duplo-automation
58+
namespace: {{ .Values.global.tenantName }}
59+
spec:
60+
replicas: {{ .Values.duploAutomation.replicas }}
61+
selector:
62+
matchLabels:
63+
app: duplo-automation
64+
template:
65+
metadata:
66+
labels:
67+
app: duplo-automation
68+
spec:
69+
containers:
70+
- name: duplo-automation
71+
image: "{{ .Values.duploAutomation.image }}:{{ .Values.duploAutomation.imageTag }}"
72+
ports:
73+
- containerPort: 5000
74+
env:
75+
- name: GRR_GRAFANA_URL
76+
value: "http://grafana-ui:3000"
77+
- name: GRR_GRAFANA_TOKEN
78+
valueFrom:
79+
secretKeyRef:
80+
name: grafanaui
81+
key: password
82+
- name: GRR_GRAFANA_USER
83+
valueFrom:
84+
secretKeyRef:
85+
name: grafanaui
86+
key: username
87+
- name: GRR_MIMIR_ADDRESS
88+
value: "http://duplo-metrics-ruler:8080"
89+
- name: GRR_MIMIR_TENANT_ID
90+
value: "anonymous"
91+
- name: GRR_TARGETS
92+
value: "Datasource,DashboardFolder,LibraryElement,Dashboard,AlertRuleGroup,AlertNotificationPolicy,AlertContactPoint,PrometheusRuleGroup"
93+
- name: GRR_OUTPUT_FORMAT
94+
value: "yaml"
95+
- name: GRR_ONLY_SPEC
96+
value: "false"
97+
- name: GRIZZLY_HTTP_TIMEOUT
98+
value: "60"
99+
volumeMounts:
100+
- name: data
101+
mountPath: /app/data
102+
volumes:
103+
- name: data
104+
persistentVolumeClaim:
105+
claimName: duplo-automation-data
106+
---
107+
{{- end }}
108+
{{- if .Values.grafanaProxy.enabled }}
109+
apiVersion: apps/v1
110+
kind: Deployment
111+
metadata:
112+
name: grafana-proxy
113+
namespace: {{ .Values.global.tenantName }}
114+
spec:
115+
replicas: {{ .Values.grafanaProxy.replicas }}
116+
selector:
117+
matchLabels:
118+
app: grafana-proxy
119+
template:
120+
metadata:
121+
labels:
122+
app: grafana-proxy
123+
spec:
124+
containers:
125+
- name: grafana-proxy
126+
image: "{{ .Values.grafanaProxy.image }}:{{ .Values.grafanaProxy.imageTag }}"
127+
ports:
128+
- containerPort: 80
129+
env:
130+
- name: DUPLO_AUTH_URL
131+
value: {{ .Values.global.duploAuthUrl | quote }}
132+
- name: BACKEND_URL
133+
value: "http://grafana-ui:3000"
134+
- name: CUSTOM_HEADER_ADD
135+
value: "proxy_set_header X-WEBAUTH-USER duplocloud;"
136+
resources:
137+
{{- toYaml .Values.grafanaProxy.resources | nindent 12 }}
138+
{{- end }}

charts/aos/templates/jobs.yaml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
{{- if .Values.integrationJob.enabled }}
2+
apiVersion: batch/v1
3+
kind: Job
4+
metadata:
5+
name: integration-duplo
6+
namespace: {{ .Values.global.tenantName }}
7+
spec:
8+
backoffLimit: 0
9+
template:
10+
spec:
11+
containers:
12+
- name: init-duplo
13+
image: "{{ .Values.integrationJob.image }}:{{ .Values.integrationJob.imageTag }}"
14+
command:
15+
- /bin/sh
16+
- -c
17+
- |
18+
echo "Waiting for $DUPLO_AUTOMATION_DEPLOYMENT_NAME to be ready..."
19+
until curl --silent --fail --output /dev/null $DUPLO_AUTOMATION_ENDPOINT; do
20+
echo "Waiting for $DUPLO_AUTOMATION_ENDPOINT to be ready..."
21+
sleep 10
22+
done
23+
echo "Waiting for $GRAFANA_UI to be ready..."
24+
until curl --silent --fail --output /dev/null $GRAFANA_UI; do
25+
echo "Waiting for $GRAFANA_UI to be ready..."
26+
sleep 10
27+
done
28+
echo "Waiting for $MIMIR_RULER to be ready..."
29+
until curl --silent --fail --output /dev/null $MIMIR_RULER; do
30+
echo "Waiting for $MIMIR_RULER to be ready..."
31+
sleep 10
32+
done
33+
echo "Waiting for $MIMIR_ALERTMANAGER to be ready..."
34+
until curl --silent --fail --output /dev/null $MIMIR_ALERTMANAGER; do
35+
echo "Waiting for $MIMIR_ALERTMANAGER to be ready..."
36+
sleep 10
37+
done
38+
echo "installing mimirtool"
39+
ARCH=$(uname -m)
40+
PLATFORM=$( [[ "$ARCH" == "x86_64" ]] && echo "linux-amd64" || ([[ "$ARCH" == "aarch64" ]] && echo "linux-arm64" || echo "linux-armv7"))
41+
curl -fLo mimirtool "https://github.com/grafana/mimir/releases/latest/download/mimirtool-${PLATFORM}"
42+
chmod +x mimirtool
43+
apk add --no-cache git
44+
git clone --depth=1 https://github.com/duplocloud/opentelemetry-release.git
45+
sed -i 's/<<SlackChannelName>>/duplo-otel-alerting/g' opentelemetry-release/integrations/integration-duplo/duplo-default-config.yaml
46+
sed -i "s/<<region>>/$REGION/g" opentelemetry-release/integrations/integration-duplo/datasource-duplo-aws.yaml
47+
sed -i 's|<<SlackWebhook>>|https://hooks.slack.com/services/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|g' opentelemetry-release/integrations/integration-duplo/duplo-default-config.yaml
48+
sed -i 's|<<GrafanaURL>>|grafana-proxy-{{ .Values.global.tenantName }}.{{ .Values.global.dnsSuffix }}|g' opentelemetry-release/integrations/integration-duplo/duplo_templates.tpl
49+
sed -i "s|<<DuploPortalName>>|$DUPLO_PORTAL_NAME|g" opentelemetry-release/integrations/integration-duplo/duplo_templates.tpl
50+
cp opentelemetry-release/integrations/integration-duplo/datasource-duplo-aws.yaml opentelemetry-release/integrations/integration-duplo/provisioning/datasource-duplo-aws.yaml
51+
./mimirtool alertmanager load opentelemetry-release/integrations/integration-duplo/duplo-default-config.yaml opentelemetry-release/integrations/integration-duplo/duplo_templates.tpl
52+
echo "Triggering Duplo automation integration..."
53+
INTEGRATIONS="apm linuxnode kubernetes slo aws-cloudwatch mimir loki tempo"
54+
for i in $INTEGRATIONS; do
55+
echo "Enabling $i"
56+
curl --fail --silent --show-error --location "$DUPLO_AUTOMATION_ENDPOINT/enable-integration" \
57+
--header 'Content-Type:application/json' \
58+
--data-raw "{\"integration_name\":\"$i\",\"context_name\":\"duplo-otel\"}" || { echo "❌ Failed to enable $i"; exit 1; }
59+
done
60+
echo "Enabling duplo"
61+
curl --fail --silent --show-error --location "$DUPLO_AUTOMATION_ENDPOINT/enable-integration" \
62+
--header 'Content-Type:application/json' \
63+
--data '{"integration_name":"duplo","context_name":"duplo-otel"}' || { echo "❌ Failed to enable duplo"; exit 1; }
64+
echo "✅ Duplo default provisioning completed successfully."
65+
env:
66+
- name: DUPLO_AUTOMATION_DEPLOYMENT_NAME
67+
value: "duplo-automation"
68+
- name: DUPLO_AUTOMATION_ENDPOINT
69+
value: "http://duplo-automation:5000"
70+
- name: GRAFANA_UI
71+
value: "http://grafana-ui:3000"
72+
- name: MIMIR_RULER
73+
value: "http://duplo-metrics-ruler:8080"
74+
- name: MIMIR_ADDRESS
75+
value: "http://duplo-metrics-nginx"
76+
- name: MIMIR_ALERTMANAGER
77+
value: "http://duplo-metrics-alertmanager:8080"
78+
- name: DUPLO_PORTAL_NAME
79+
value: "{{ .Values.global.customerName }}-{{ .Values.global.environment }}"
80+
- name: MIMIR_TENANT_ID
81+
value: "anonymous"
82+
- name: REGION
83+
value: {{ .Values.global.awsRegion | quote }}
84+
serviceAccountName: {{ .Values.global.tenantName }}-edit-user
85+
restartPolicy: Never
86+
{{- end }}

charts/aos/templates/pvc.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{{- if .Values.grafanaUI.enabled }}
2+
apiVersion: v1
3+
kind: PersistentVolumeClaim
4+
metadata:
5+
name: grafana-ui-data
6+
namespace: {{ .Values.global.tenantName }}
7+
spec:
8+
accessModes:
9+
- ReadWriteOnce
10+
resources:
11+
requests:
12+
storage: {{ .Values.grafanaUI.volume.size }}
13+
---
14+
{{- end }}
15+
{{- if .Values.duploAutomation.enabled }}
16+
apiVersion: v1
17+
kind: PersistentVolumeClaim
18+
metadata:
19+
name: duplo-automation-data
20+
namespace: {{ .Values.global.tenantName }}
21+
spec:
22+
accessModes:
23+
- ReadWriteOnce
24+
resources:
25+
requests:
26+
storage: {{ .Values.duploAutomation.volume.size }}
27+
{{- end }}

charts/aos/templates/secrets.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{{- if .Values.secrets.grafanaUI }}
2+
apiVersion: v1
3+
kind: Secret
4+
metadata:
5+
name: grafanaui
6+
namespace: {{ .Values.global.tenantName }}
7+
type: kubernetes.io/basic-auth
8+
data:
9+
username: {{ .Values.secrets.grafanaUI.username | b64enc }}
10+
password: {{ .Values.secrets.grafanaUI.password | b64enc }}
11+
---
12+
{{- end }}
13+
{{- if .Values.secrets.gpgPassphrase }}
14+
apiVersion: v1
15+
kind: Secret
16+
metadata:
17+
name: gpg-passphrase
18+
namespace: {{ .Values.global.tenantName }}
19+
type: Opaque
20+
data:
21+
gpg_passphrase: {{ .Values.secrets.gpgPassphrase | b64enc }}
22+
{{- end }}

0 commit comments

Comments
 (0)