Skip to content

Commit b2ef823

Browse files
committed
DB secret for OpenFGA
1 parent 8fbe4e2 commit b2ef823

File tree

10 files changed

+1298
-50
lines changed

10 files changed

+1298
-50
lines changed

charts/openobserve-standalone/Chart.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ dependencies:
33
repository: https://charts.min.io
44
version: 5.3.0
55
digest: sha256:c539f29a4cbdeef50e73fccb320917baf7e08913288b2b2ba68f89f0eaf266de
6-
generated: "2025-04-27T06:49:29.099602-07:00"
6+
generated: "2025-04-29T17:16:27.935648-07:00"

charts/openobserve/Chart.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ dependencies:
99
repository: https://charts.min.io
1010
version: 5.3.0
1111
digest: sha256:12e13eef5ed1113d7d687def21c8ef2acdae7514500fac3737d968234bdbcc7d
12-
generated: "2025-04-27T06:49:25.318084-07:00"
12+
generated: "2025-04-29T17:16:23.750897-07:00"

charts/openobserve/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type: application
1515
# This is the chart version. This version number should be incremented each time you make changes
1616
# to the chart and its templates, including the app version.
1717
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18-
version: 0.14.60
18+
version: 0.14.61
1919

2020
# This is the version number of the application being deployed. This version number should be
2121
# incremented each time you make changes to the application. Versions are not expected to

charts/openobserve/basic_check.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
#!/bin/sh
22

33
helm -n o2 template . -f values.yaml > o2.yaml
4+
# helm -n o2 template . -f test_values_external_secret.yaml > o2.yaml

charts/openobserve/templates/openfga-deployment.yaml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,18 @@ spec:
2222
env:
2323
- name: OPENFGA_DATASTORE_ENGINE
2424
value: postgres
25+
{{- if .Values.postgres.enabled }}
2526
- name: OPENFGA_DATASTORE_URI
26-
{{- if .Values.postgres.enabled }}
2727
value: "postgres://openobserve:{{ .Values.postgres.spec.password }}@{{ include "openobserve.fullname" . }}-postgres-rw.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}:5432/app?sslmode=disable"
28-
{{- else if .Values.auth.ZO_META_POSTGRES_DSN }}
28+
{{- else if .Values.auth.ZO_META_POSTGRES_DSN }}
29+
- name: OPENFGA_DATASTORE_URI
2930
value: "{{ .Values.auth.ZO_META_POSTGRES_DSN }}"
30-
{{- else }}
31+
{{- else if .Values.config.ZO_META_POSTGRES_DSN }}
32+
- name: OPENFGA_DATASTORE_URI
3133
value: "{{ .Values.config.ZO_META_POSTGRES_DSN }}"
32-
{{- end }}
34+
{{- end }}
3335
envFrom:
34-
- secretRef: # postgres detail can be picked up from secret
36+
- secretRef: # postgres detail can be picked up from secret if not found anywhere else
3537
name: {{ if .Values.externalSecret.enabled }}{{ .Values.externalSecret.name }}{{ else }}{{ include "openobserve.fullname" . }}{{ end }}
3638
resources:
3739
limits:

charts/openobserve/test.sh

Lines changed: 112 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export TERM=xterm-256color
44
# Configuration
55
NAMESPACE="${1:-openobserve}" # Use first argument as namespace, default to 'openobserve' if not provided
66
RELEASE_NAME="${2:-o2}" # Use second argument as release name, default to 'o2' if not provided
7-
NAMESPACE="o2"
7+
NAMESPACE="o3"
88
RELEASE_NAME="o2"
99
# Function to check pod status
1010
check_pods() {
@@ -53,6 +53,19 @@ check_pods() {
5353
fi
5454
}
5555

56+
uninstall() {
57+
local namespace=$1
58+
local release_name=$2
59+
60+
echo "Uninstalling OpenObserve..."
61+
helm --namespace "$namespace" uninstall "$release_name"
62+
if [ $? -ne 0 ]; then
63+
echo "Failed to uninstall OpenObserve"
64+
return 1
65+
fi
66+
echo "OpenObserve uninstalled successfully"
67+
}
68+
5669
# Function to cleanup resources
5770
cleanup() {
5871
local namespace=$1
@@ -61,10 +74,6 @@ cleanup() {
6174

6275
echo -e "\nStarting cleanup..."
6376

64-
# Uninstall helm release
65-
echo "Uninstalling OpenObserve helm release: ${release_name}..."
66-
helm --namespace "$namespace" uninstall "$release_name"
67-
6877
# Delete namespace
6978
echo "Deleting namespace: ${namespace}"
7079
kubectl delete namespace "$namespace"
@@ -79,40 +88,111 @@ cleanup() {
7988
exit $exit_code
8089
}
8190

91+
setup() {
92+
93+
# Check if CloudNative PostgreSQL Operator is already installed
94+
if kubectl get deployment -n cnpg-system cloudnative-pg-controller-manager &> /dev/null; then
95+
echo "CloudNative PostgreSQL Operator is already installed."
96+
else
97+
# Install CloudNative PostgreSQL Operator (prerequisite)
98+
echo "Installing CloudNative PostgreSQL Operator..."
99+
kubectl apply -f https://raw.githubusercontent.com/cloudnative-pg/cloudnative-pg/release-1.22/releases/cnpg-1.22.1.yaml
100+
fi
101+
102+
# wait for the operator to get ready
103+
echo "Waiting for PostgreSQL Operator to be ready..."
104+
while true; do
105+
if kubectl get pods -n cnpg-system | grep -q "Running"; then
106+
echo "PostgreSQL Operator is ready!"
107+
break
108+
else
109+
echo "Waiting for PostgreSQL Operator to be ready..."
110+
sleep 5
111+
fi
112+
done
113+
114+
local namespace=$1
115+
local release_name=$2
116+
117+
# Check if the namespace already exists
118+
if kubectl get namespace "$namespace" > /dev/null 2>&1; then
119+
echo "Namespace '${namespace}' already exists. Skipping creation."
120+
else
121+
echo "Creating namespace '${namespace}'..."
122+
kubectl create namespace "$namespace"
123+
fi
124+
125+
# Check if OpenObserve is already installed
126+
if helm --namespace "$namespace" list | grep -q "$release_name"; then
127+
echo "OpenObserve is already installed. Skipping installation."
128+
return 0
129+
fi
130+
}
131+
132+
# Function to install OpenObserve and its dependencies
133+
test_basic() {
134+
local namespace=$1
135+
local release_name=$2
136+
137+
# Create namespace
138+
echo "Creating namespace: ${namespace}"
139+
kubectl create namespace "$namespace"
140+
141+
# Install OpenObserve helm chart
142+
echo "Installing OpenObserve helm chart (Release: ${release_name}) in namespace: ${namespace}"
143+
helm --namespace "$namespace" upgrade --install "$release_name" . -f values.yaml
144+
145+
return $?
146+
}
147+
148+
# Function to install OpenObserve external_secret
149+
test_with_external_secret() {
150+
local namespace=$1
151+
local release_name=$2
152+
153+
# Create namespace
154+
echo "Creating namespace: ${namespace}"
155+
kubectl create namespace "$namespace"
156+
157+
kubectl -n "$namespace" apply -f test_secret.yaml
158+
159+
# Install OpenObserve helm chart
160+
echo "Installing OpenObserve helm chart (Release: ${release_name}) in namespace: ${namespace}"
161+
helm --namespace "$namespace" upgrade --install "$release_name" . -f test_values_external_secret.yaml
162+
163+
return $?
164+
}
165+
82166
# Print configuration
83167
echo "Using configuration:"
84168
echo " Namespace: ${NAMESPACE}"
85169
echo " Release Name: ${RELEASE_NAME}"
86170
echo -e "-------------------\n"
87171

88-
# Start minikube
89-
echo "Starting minikube cluster..."
90-
# minikube start
91-
# if [ $? -ne 0 ]; then
92-
# echo "Failed to start minikube cluster"
93-
# exit 1
94-
# fi
95-
96-
# Install CloudNative PostgreSQL Operator (prerequisite)
97-
echo "Installing CloudNative PostgreSQL Operator..."
98-
kubectl apply -f https://raw.githubusercontent.com/cloudnative-pg/cloudnative-pg/release-1.22/releases/cnpg-1.22.1.yaml
172+
# Setup basic prerequisites
173+
setup "$namespace" "$release_name"
174+
if [ $? -ne 0 ]; then
175+
echo "Failed to setup prerequisites. Exiting."
176+
return 1
177+
fi
99178

100-
# wait for the operator to get ready by sleeping
101-
sleep 60
179+
# Test 1 - Install basic installation of OpenObserve and dependencies
180+
# test_basic "$NAMESPACE" "$RELEASE_NAME"
181+
# # Check pod status
182+
# check_pods "$NAMESPACE"
183+
# exit_status=$?
102184

103-
# Add OpenObserve helm repository
104-
# echo "Adding OpenObserve helm repository..."
105-
# helm repo add openobserve https://charts.openobserve.ai
106-
# helm repo update
185+
# if [ $exit_status -eq 0 ]; then
186+
# echo -e "\033[1;92m OpenObserve deployment completed successfully in namespace: ${NAMESPACE} \033[0m"
187+
# else
188+
# echo -e "\033[1;31m OpenObserve deployment encountered issues in namespace: ${NAMESPACE} . Please check the pod status above. \033[0m"
189+
# fi
107190

108-
# Create namespace
109-
echo "Creating namespace: ${NAMESPACE}"
110-
kubectl create namespace "$NAMESPACE"
191+
# uninstall "$namespace" "$release_name"
111192

112-
# Install OpenObserve helm chart
113-
echo "Installing OpenObserve helm chart (Release: ${RELEASE_NAME}) in namespace: ${NAMESPACE}"
114-
helm --namespace "$NAMESPACE" upgrade --install "$RELEASE_NAME" . -f values.yaml
115193

194+
# Test #2 - Install OpenObserve with external secret
195+
test_with_external_secret "$NAMESPACE" "$RELEASE_NAME"
116196
# Check pod status
117197
check_pods "$NAMESPACE"
118198
exit_status=$?
@@ -123,12 +203,14 @@ else
123203
echo -e "\033[1;31m OpenObserve deployment encountered issues in namespace: ${NAMESPACE} . Please check the pod status above. \033[0m"
124204
fi
125205

206+
# uninstall "$namespace" "$release_name"
207+
126208
# Setup trap for Ctrl+C
127-
trap 'cleanup "$NAMESPACE" "$RELEASE_NAME" $exit_status' INT
209+
# trap 'cleanup "$NAMESPACE" "$RELEASE_NAME" $exit_status' INT
128210

129211
# Pause to show results before cleanup
130212
# echo -e "\nTest completed. Press Enter to cleanup or Ctrl+C to keep the deployment..."
131213
# read -r
132214

133215
# Perform cleanup
134-
cleanup "$NAMESPACE" "$RELEASE_NAME" $exit_status
216+
# cleanup "$NAMESPACE" "$RELEASE_NAME" $exit_status

charts/openobserve/test_secret.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
apiVersion: v1
2+
kind: Secret
3+
metadata:
4+
name: super-secret
5+
type: Opaque
6+
stringData:
7+
ZO_ROOT_USER_EMAIL: "[email protected]"
8+
ZO_ROOT_USER_PASSWORD: "Complexpass#123"
9+
10+
# do not need to set this if enabled minio is being used. settings will be picked from minio section. Also IRSA is preferred if on EKS. Set the Service account section with the correct IAM role ARN. Refer https://zinc.dev/docs/guide/ha_deployment/#amazon-eks-s3
11+
ZO_S3_ACCESS_KEY: ""
12+
ZO_S3_SECRET_KEY: ""
13+
14+
AZURE_STORAGE_ACCOUNT_KEY: ""
15+
AZURE_STORAGE_ACCOUNT_NAME: ""
16+
ZO_META_POSTGRES_DSN: "postgres://openobserve:Batman123@o2-openobserve-postgres-rw:5432/app"
17+
OPENFGA_DATASTORE_URI: "postgres://openobserve:Batman123@o2-openobserve-postgres-rw:5432/app"
18+
ZO_META_POSTGRES_RO_DSN: ""
19+
ZO_TRACING_HEADER_KEY: "Authorization"
20+
ZO_TRACING_HEADER_VALUE: "Basic cm9vdEBleGFtcGxlLmNvbTpDb21wbGV4cGFzcyMxMjM="
21+
ZO_RUM_CLIENT_TOKEN: ""
22+
ZO_REPORT_USER_EMAIL: "" # Check details at https://github.com/openobserve/o2_report_server
23+
ZO_REPORT_USER_PASSWORD: ""
24+
ZO_SMTP_USER_NAME: "ABAAQQQQFFFFF" # Replace with your own SMTP username
25+
ZO_SMTP_PASSWORD: "+fjlahsguykevfkajvjk#jsbj43$bjkjbkk" # Replace with your own SMTP password

0 commit comments

Comments
 (0)