Skip to content

Commit ef44388

Browse files
committed
Merge branch '2028-feature-implement-opentelemetry-in-stackgres' into 'main'
Resolve "[Feature] Implement OpenTelemetry in StackGres" Closes #2028, #2887, #2891, #2889, and #2892 See merge request ongresinc/stackgres!1609
2 parents 33f03de + 657b11b commit ef44388

249 files changed

Lines changed: 5781 additions & 1082 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitlab-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
image: null
22

33
variables:
4-
SG_CI_IMAGE_NAME: "ci:1.26"
4+
SG_CI_IMAGE_NAME: "ci:1.29"
55
BUILDER_IMAGE_NAME: "builder:1.9"
66
SKIP_NATIVE: "false"
77
SKIP_E2E: "false"

.gitlab-ci/test.yml

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,7 @@ shell unit tests:
77
- stackgres-runner-v2
88
- linux-amd64
99
script:
10-
- |
11-
set +e
12-
TMP_PATH="/tmp/stackgres-$JOB_ID"
13-
cp -a . "$TMP_PATH"
14-
(
15-
cd "$TMP_PATH"
16-
sh stackgres-k8s/src/operator/src/test/shell/run-in-docker.sh
17-
)
18-
EXIT_CODE="$?"
19-
cp -a "$TMP_PATH"/stackgres-k8s/src/operator/target stackgres-k8s/src/operator/target
20-
rm -rf "$TMP_PATH"
21-
exit "$EXIT_CODE"
10+
- sh stackgres-k8s/src/operator/src/test/shell/run-in-docker.sh
2211
retry:
2312
max: 2
2413
when: [ unknown_failure, api_failure, stuck_or_timeout_failure, runner_system_failure, runner_unsupported,
Lines changed: 48 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,66 @@
11
---
2-
title: Change password
2+
title: Change Web Console's user credentials
33
weight: 1
44
url: /administration/adminui/change/password
55
description: Changing the UI password.
66
showToc: true
77
---
88

9-
### Changing the UI password
9+
### Changing the Web Console's user credentials
1010

11-
You can use the command below to change the password:
11+
You can use the commands below to change the username and the password of an existing Web Console user (requires [jq](https://jqlang.github.io/jq/) command):
1212

1313
```
14-
NEW_USER=admin
14+
USERNAME=admin
15+
NEW_USERNAME=root
1516
NEW_PASSWORD=password
16-
kubectl create secret generic -n stackgres stackgres-restapi-admin --dry-run=client -o json \
17-
--from-literal=k8sUsername="$NEW_USER" \
18-
--from-literal=password="$(echo -n "${NEW_USER}${NEW_PASSWORD}"| sha256sum | awk '{ print $1 }' )" > password.patch
1917
20-
kubectl patch secret -n stackgres stackgres-restapi-admin -p "$(cat password.patch)" && rm password.patch
21-
```
18+
# Patch the StackGres user Secret associated with the user
2219
23-
Remember to remove the generated password hint from the secret to avoid security flaws:
20+
kubectl get secret -A -l api.stackgres.io/auth=user \
21+
--template '{{ range .items }}{{ printf "%s %s %s\n" .metadata.namespace .metadata.name (.data.k8sUsername | base64decode) }}{{ end }}' \
22+
| grep " $USERNAME$" \
23+
| while read NAMESPACE SECRET_NAME USERNAME
24+
do
25+
kubectl patch secret -n "$NAMESPACE" "$SECRET_NAME" --type merge \
26+
-p "data: { password: \"$(echo -n "${NEW_USERNAME}${NEW_PASSWORD}"| sha256sum | cut -d ' ' -f 1 )\" }"
27+
done
2428
25-
```
26-
kubectl patch secret --namespace stackgres stackgres-restapi-admin --type json -p '[{"op":"remove","path":"/data/clearPassword"}]'
27-
```
29+
# Patch any existing ClusterRoleBinding associated with the user
2830
31+
kubectl get clusterrolebindings -o json \
32+
| jq -r --arg USERNAME "$USERNAME" --arg NEW_USERNAME "$NEW_USERNAME" \
33+
'.items[]
34+
| select(.subjects != null and (.subjects | any(.apiGroup == "rbac.authorization.k8s.io" and .kind == "User" and .name == $USERNAME)))
35+
| .metadata.name + " " + (
36+
.subjects
37+
| map(
38+
if .apiGroup == "rbac.authorization.k8s.io" and .kind == "User" and .name == $USERNAME
39+
then .name = $NEW_USERNAME else . end)
40+
| tojson
41+
)' \
42+
| while read CLUSTERROLEBINDING_NAME SUBJECTS
43+
do
44+
kubectl patch clusterrolebindings "$CLUSTERROLEBINDING_NAME" \
45+
--type merge -p "subjects: $SUBJECTS"
46+
done
2947
30-
To clean up the resources created by the demo just run:
48+
# Patch any existing RoleBinding associated with the user
3149
32-
```
33-
kubectl delete --ignore-not-found -f {{< download-url >}}/stackgres-operator-demo.yml
50+
kubectl get rolebindings -A -o json \
51+
| jq -r --arg USERNAME "$USERNAME" --arg NEW_USERNAME "$NEW_USERNAME" \
52+
'.items[]
53+
| select(.subjects != null and (.subjects | any(.apiGroup == "rbac.authorization.k8s.io" and .kind == "User" and .name == $USERNAME)))
54+
| .metadata.namespace + " " + .metadata.name + " " + (
55+
.subjects
56+
| map(
57+
if .apiGroup == "rbac.authorization.k8s.io" and .kind == "User" and .name == $USERNAME
58+
then .name = $NEW_USERNAME else . end)
59+
| tojson
60+
)' \
61+
| while read NAMESPACE ROLEBINDING_NAME SUBJECTS
62+
do
63+
kubectl patch rolebindings -n "$NAMESPACE" "$CLUSTERROLEBINDING_NAME" \
64+
--type merge -p "subjects: $SUBJECTS"
65+
done
3466
```

doc/content/en/06-crd-reference/15-sgstream/_index.template.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ The `SGStream` custom resource represents a stream of Change Data Capture (CDC)
2323
**Example:**
2424

2525
```yaml
26-
apiVersion: stackgres.io/v1
26+
apiVersion: stackgres.io/v1alpha1
2727
kind: SGStream
2828
metadata:
2929
name: cloudevent

stackgres-k8s/ci/build/Dockerfile-ci

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ FROM registry.access.redhat.com/ubi8-minimal:8.10-1018
126126
RUN microdnf install -y xz
127127
RUN mkdir -p ~/.docker/cli-plugins
128128
RUN echo '{"experimental":"enabled"}' > ~/.docker/config.json
129-
RUN wget -O /bin/kubectl "https://dl.k8s.io/release/v1.29.1/bin/linux/$(uname -m | grep -qxF aarch64 && echo arm64 || echo amd64)/kubectl"
129+
RUN wget -O /bin/kubectl "https://dl.k8s.io/release/v1.31.1/bin/linux/$(uname -m | grep -qxF aarch64 && echo arm64 || echo amd64)/kubectl"
130130
RUN chmod a+x /bin/kubectl
131131
RUN wget -O /bin/kind-0.15.0 "https://github.com/kubernetes-sigs/kind/releases/download/v0.15.0/kind-linux-$(uname -m | grep -qxF aarch64 && echo arm64 || echo amd64)"
132132
RUN chmod a+x /bin/kind-0.15.0
@@ -135,18 +135,23 @@ FROM registry.access.redhat.com/ubi8-minimal:8.10-1018
135135
RUN ln -s /bin/kind-0.20.0 /bin/kind
136136
RUN wget -O /bin/k3d "https://github.com/rancher/k3d/releases/download/v5.5.1/k3d-linux-$(uname -m | grep -qxF aarch64 && echo arm64 || echo amd64)"
137137
RUN chmod a+x /bin/k3d
138-
RUN wget "https://get.helm.sh/helm-v3.14.0-linux-$(uname -m | grep -qxF aarch64 && echo arm64 || echo amd64).tar.gz" -O -|tar xz --strip-components=1 -C /bin -f - "linux-$(uname -m | grep -qxF aarch64 && echo arm64 || echo amd64)/helm"
139-
RUN wget "https://github.com/derailed/k9s/releases/download/v0.31.7/k9s_Linux_$(uname -m | grep -qxF aarch64 && echo arm64 || echo amd64).tar.gz" -O -|tar xz -C /bin -f - k9s
138+
RUN wget "https://get.helm.sh/helm-v3.16.1-linux-$(uname -m | grep -qxF aarch64 && echo arm64 || echo amd64).tar.gz" -O -|tar xz --strip-components=1 -C /bin -f - "linux-$(uname -m | grep -qxF aarch64 && echo arm64 || echo amd64)/helm"
139+
RUN wget "https://github.com/derailed/k9s/releases/download/v0.32.5/k9s_Linux_$(uname -m | grep -qxF aarch64 && echo arm64 || echo amd64).tar.gz" -O -|tar xz -C /bin -f - k9s
140140
RUN pip3 install awscli
141-
RUN wget https://github.com/operator-framework/operator-sdk/releases/download/v1.32.0/operator-sdk_linux_$(uname -m | grep -qxF aarch64 && echo arm64 || echo amd64) -O /bin/operator-sdk
141+
RUN wget https://github.com/operator-framework/operator-sdk/releases/download/v1.37.0/operator-sdk_linux_$(uname -m | grep -qxF aarch64 && echo arm64 || echo amd64) -O /bin/operator-sdk
142142
RUN chmod a+x /bin/operator-sdk
143-
RUN wget https://github.com/operator-framework/operator-registry/releases/download/v1.36.0/linux-$(uname -m | grep -qxF aarch64 && echo arm64 || echo amd64)-opm -O /bin/opm
143+
RUN wget https://github.com/operator-framework/operator-registry/releases/download/v1.47.0/linux-$(uname -m | grep -qxF aarch64 && echo arm64 || echo amd64)-opm -O /bin/opm
144144
RUN chmod a+x /bin/opm
145145
RUN microdnf install -y findutils make procps diffutils
146146
RUN wget https://github.com/norwoodj/helm-docs/releases/download/v1.12.0/helm-docs_1.12.0_Linux_$(uname -m | grep -qxF aarch64 && echo arm64 || echo x86_64).tar.gz -O -|tar xz -C /bin -f - helm-docs
147147
RUN wget https://github.com/gohugoio/hugo/releases/download/v0.81.0/hugo_0.81.0_Linux-$(uname -m | grep -qxF aarch64 && echo ARM64 || echo 64bit).tar.gz -O -|tar xz -C /bin -f - hugo
148148
RUN wget https://github.com/fybrik/crdoc/releases/download/v0.6.3/crdoc_Linux_$(uname -m | grep -qxF aarch64 && echo arm64 || echo x86_64).tar.gz -O -|tar xz -C /bin -f - crdoc
149-
RUN wget -O - "https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/v5.3.0/kustomize_v5.3.0_$(uname -s | tr '[:upper:]' '[:lower:]')_$(uname -m | sed 's/x86_64/amd64/' | sed 's/aarch64/arm64/').tar.gz" | tar xzf - -C /bin
149+
RUN wget -O - "https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/v5.4.3/kustomize_v5.4.3_$(uname -s | tr '[:upper:]' '[:lower:]')_$(uname -m | sed 's/x86_64/amd64/' | sed 's/aarch64/arm64/').tar.gz" | tar xzf - -C /bin
150150
RUN wget -O /bin/kind-0.23.0 "https://github.com/kubernetes-sigs/kind/releases/download/v0.23.0/kind-linux-$(uname -m | grep -qxF aarch64 && echo arm64 || echo amd64)"
151151
RUN chmod a+x /bin/kind-0.23.0
152152
RUN ln -s -f /bin/kind-0.23.0 /bin/kind
153+
# Older operator-sdk versions than 1.36 removed support for plugin quarkus.javaoperatorsdk.io/v1-beta but the bundle is generated only by operator-sdk version 1.32
154+
# another reason to use java-operator-sdk :/
155+
RUN wget https://github.com/operator-framework/operator-sdk/releases/download/v1.32.0/operator-sdk_linux_$(uname -m | grep -qxF aarch64 && echo arm64 || echo amd64) -O /bin/operator-sdk-1.32
156+
RUN chmod a+x /bin/operator-sdk-1.32
157+

stackgres-k8s/ci/build/config.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
.images:
2-
ci_image: &ci_image registry.gitlab.com/ongresinc/stackgres/ci:1.26
2+
ci_image: &ci_image registry.gitlab.com/ongresinc/stackgres/ci:1.29
33
jdk_build_image: &jdk_build_image registry.gitlab.com/ongresinc/stackgres/builder:1.9
4-
jdk_runtime_image: &jdk_runtime_image registry.access.redhat.com/ubi9/openjdk-21:1.20-2.1721752936
5-
ubi8_micro_image: &ubi8_micro_image registry.access.redhat.com/ubi8-micro:8.10-9
6-
ubi9_minimal_image: &ubi9_minimal_image registry.access.redhat.com/ubi9-minimal:9.4-1194
7-
admin_ui_build_image: &admin_ui_build_image registry.access.redhat.com/ubi8/nodejs-20:1-50.1720405266
8-
admin_ui_nginx_image: &admin_ui_nginx_image registry.access.redhat.com/ubi8/nginx-124:1-16
9-
pglambda_nodejs_image: &pglambda_nodejs_image registry.access.redhat.com/ubi8/nodejs-18:1-114.1720405264
4+
jdk_runtime_image: &jdk_runtime_image registry.access.redhat.com/ubi9/openjdk-21:1.20-2.1726695192
5+
ubi8_micro_image: &ubi8_micro_image registry.access.redhat.com/ubi8-micro:8.10-13
6+
ubi9_minimal_image: &ubi9_minimal_image registry.access.redhat.com/ubi9-minimal:9.4-1227.1726694542
7+
admin_ui_build_image: &admin_ui_build_image registry.access.redhat.com/ubi8/nodejs-20:1-63
8+
admin_ui_nginx_image: &admin_ui_nginx_image registry.access.redhat.com/ubi8/nginx-124:1-29
9+
pglambda_nodejs_image: &pglambda_nodejs_image registry.access.redhat.com/ubi8/nodejs-18:1-127
1010
platforms:
1111
- linux/x86_64
1212
- linux/aarch64

stackgres-k8s/e2e/spec/abstract/prometheus-integration

Lines changed: 19 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ e2e_exclusive_lock() {
66

77
e2e_test() {
88
run_test "Check that exporter queries are wokring" check_exporter_queries
9-
run_test "Check that exporter pod monitor was created" check_exporter_pod_monitor
10-
run_test "Check that envoy pod monitor was created" check_envoy_pod_monitor
9+
run_test "Check that collector was created" check_collector
10+
run_test "Check that collector pod monitor was created" check_collector_pod_monitor
1111
run_test "Check that grafana is embedded" check_grafana_embedded
1212
run_test "Check that grafana secret is used" check_grafana_secret
1313
}
@@ -61,14 +61,26 @@ check_exporter_queries() {
6161
done
6262
}
6363

64-
check_exporter_pod_monitor() {
65-
local SERVICE_MONITOR="$CLUSTER_NAMESPACE-$CLUSTER_NAME-stackgres-postgres-exporter"
64+
check_collector() {
65+
local SERVICE_MONITOR="stackgres-collector"
6666

67-
if wait_until kubectl get podmonitors.monitoring.coreos.com -n "$(prometheus_namespace)" "$SERVICE_MONITOR"
67+
if wait_until kubectl get deployment -n "$OPERATOR_NAMESPACE" "$SERVICE_MONITOR"
6868
then
69-
echo "Exporter pod monitor was created"
69+
echo "Collector deployment was created"
7070
else
71-
echo "Exporter pod monitor wasn't created"
71+
echo "Collector deployment wasn't created"
72+
return 1
73+
fi
74+
}
75+
76+
check_collector_pod_monitor() {
77+
local SERVICE_MONITOR="stackgres-collector"
78+
79+
if wait_until kubectl get podmonitors.monitoring.coreos.com -n "$OPERATOR_NAMESPACE" "$SERVICE_MONITOR"
80+
then
81+
echo "Collector pod monitor was created"
82+
else
83+
echo "Collector pod monitor wasn't created"
7284
return 1
7385
fi
7486

@@ -93,27 +105,6 @@ check_exporter_pod_monitor() {
93105
fi
94106
}
95107

96-
check_envoy_pod_monitor() {
97-
local SERVICE_MONITOR="$CLUSTER_NAMESPACE-$CLUSTER_NAME-stackgres-envoy"
98-
99-
if wait_until kubectl get podmonitors.monitoring.coreos.com -n "$(prometheus_namespace)" "$SERVICE_MONITOR"
100-
then
101-
echo "Envoy pod monitor was created"
102-
else
103-
echo "Envoy pod monitor wasn't created"
104-
return 1
105-
fi
106-
107-
if wait_until kubectl exec -i -n "$CLUSTER_NAMESPACE" curl -- \
108-
curl -f -s "http://$(prometheus_service).$(prometheus_namespace):9090/api/v1/query?query=envoy_cluster_upstream_cx_rx_bytes_total"
109-
then
110-
echo "Envoy metrics was found on prometheus"
111-
else
112-
echo "Envoy metrics wasn't found on prometheus"
113-
return 1
114-
fi
115-
}
116-
117108
check_grafana_embedded() {
118109
if wait_until kubectl exec -i -n "$CLUSTER_NAMESPACE" curl -- curl -s -k "https://stackgres-restapi.$OPERATOR_NAMESPACE/grafana" -o /dev/null --fail
119110
then

stackgres-k8s/e2e/spec/aks/backup-with-aks-storage.values.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,3 @@ cluster:
2323
pods:
2424
persistentVolume:
2525
size: 128Mi
26-
configurations:
27-
sgBackupConfig: backupconf
28-
prometheusAutobind: false

stackgres-k8s/e2e/spec/backup.values.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,5 @@ cluster:
1313
retention: 2
1414
cronSchedule: '0 5 31 2 *'
1515
sgObjectStorage: objectstorage
16-
prometheusAutobind: false
1716
nonProductionOptions:
1817
disableClusterPodAntiAffinity: true

stackgres-k8s/e2e/spec/catchup-from-backup-storage.values.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,5 @@ cluster:
1414
retention: 2
1515
cronSchedule: '0 5 31 2 *'
1616
sgObjectStorage: backupconf
17-
prometheusAutobind: false
1817
nonProductionOptions:
1918
disableClusterPodAntiAffinity: true

0 commit comments

Comments
 (0)