Skip to content
This repository was archived by the owner on Jun 10, 2024. It is now read-only.

Commit 57d05bb

Browse files
authored
Merge pull request #137 from cmgrote/main
#127 Initial chart for providing a sample high availability config
2 parents 9a41928 + e2421d0 commit 57d05bb

13 files changed

+512
-0
lines changed

cts/charts/ec-ha-crux/Chart.yaml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
# Copyright Contributors to the Egeria project.
3+
---
4+
name: ec-ha-crux
5+
description: ODPi Egeria high availability sample for the Crux connector
6+
apiVersion: v1
7+
version: 0.1
8+
icon: https://raw.githubusercontent.com/odpi/egeria/99016e77167fa30dcfade809b061358a92a59973/assets/img/egeria.png
9+
keywords:
10+
- odpi, egeria, open-metadata, connector, ha, juxt, crux
11+
sources:
12+
- https://github.com/odpi/egeria-connector-crux
13+
home: https://github.com/odpi/egeria-connector-crux
14+
maintainers:
15+
- name: Christopher Grote
16+
email: chris@thegrotes.net
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/bash
2+
3+
echo "Defining the common configuration via the bootstrap endpoint: ${CRUX_BOOTSTRAP_ENDPOINT}..."
4+
5+
curl -f -k -w "\n (%{http_code} - %{url_effective})\n" --silent -X POST ${CRUX_BOOTSTRAP_ENDPOINT}/open-metadata/admin-services/users/${EGERIA_USER}/servers/${CRUX_SERVER}/server-url-root?url=${CRUX_PUBLIC_ENDPOINT}
6+
curl -f -k -w "\n (%{http_code} - %{url_effective})\n" --silent -X POST ${CRUX_BOOTSTRAP_ENDPOINT}/open-metadata/admin-services/users/${EGERIA_USER}/servers/${CRUX_SERVER}/server-type?typeName=Crux
7+
curl -f -k -w "\n (%{http_code} - %{url_effective})\n" --silent -X POST ${CRUX_BOOTSTRAP_ENDPOINT}/open-metadata/admin-services/users/${EGERIA_USER}/servers/${CRUX_SERVER}/organization-name?name=ODPi
8+
curl -f -k -w "\n (%{http_code} - %{url_effective})\n" --silent -X POST --header "Content-Type: application/json" ${CRUX_BOOTSTRAP_ENDPOINT}/open-metadata/admin-services/users/${EGERIA_USER}/servers/${CRUX_SERVER}/event-bus?topicURLRoot=egeria --data '{"producer": {"bootstrap.servers": "'"${KAFKA_ENDPOINT}"'"}, "consumer": {"bootstrap.servers": "'"${KAFKA_ENDPOINT}"'"} }'
9+
curl -f -k -w "\n (%{http_code} - %{url_effective})\n" --silent -X POST --header "Content-Type: application/json" ${CRUX_BOOTSTRAP_ENDPOINT}/open-metadata/admin-services/users/${EGERIA_USER}/servers/${CRUX_SERVER}/local-repository/mode/plugin-repository/connection --data '{"class":"Connection","connectorType":{"class":"ConnectorType","connectorProviderClassName":"org.odpi.egeria.connectors.juxt.crux.repositoryconnector.CruxOMRSRepositoryConnectorProvider"},"configurationProperties":{"cruxConfig":{"crux/index-store":{"kv-store":{"crux/module":"crux.rocksdb/->kv-store","db-dir":"data/servers/crux/rdb-index"}},"kafka-config":{"crux/module":"crux.kafka/->kafka-config","bootstrap-servers":"'"${KAFKA_ENDPOINT}"'"},"crux/document-store":{"crux/module":"crux.kafka/->document-store","kafka-config":"kafka-config","doc-topic-opts":{"topic-name":"crux-doc-store"},"poll-wait-duration":"PT0.050S"},"crux/tx-log":{"crux/module":"crux.kafka/->tx-log","kafka-config":"kafka-config","tx-topic-opts":{"topic-name":"crux-tx-log"},"poll-wait-duration":"PT0.050S"},"egeria.crux.lucene/lucene-store":{"db-dir":"data/servers/crux/lucene"}}}}'
10+
curl -f -k -w "\n (%{http_code} - %{url_effective})\n" --silent -X POST ${CRUX_BOOTSTRAP_ENDPOINT}/open-metadata/admin-services/users/${EGERIA_USER}/servers/${CRUX_SERVER}/cohorts/${EGERIA_COHORT}
11+
12+
echo "Retrieving common configuration from bootstrap endpoint: ${CRUX_BOOTSTRAP_ENDPOINT}..."
13+
14+
curl -f -k -w "\n (%{http_code} - %{url_effective})\n" --silent -X GET ${CRUX_BOOTSTRAP_ENDPOINT}/open-metadata/admin-services/users/${EGERIA_USER}/servers/${CRUX_SERVER}/configuration -o /tmp/configresponse.json
15+
jq -c '.omagserverConfig' /tmp/configresponse.json > /tmp/serverconfig.json
16+
17+
echo "Deploying common configuration to all pods..."
18+
19+
for REPLICA in $(seq 0 ${NUM_REPLICAS}); do
20+
ENDPOINT="https://${CRUX_RELEASE_NAME}-crux-${REPLICA}.${INTERNAL_SVC_NAME}:9443"
21+
echo " ... deploying configuration to: ${ENDPOINT}"
22+
curl -f -k -w "\n (%{http_code} - %{url_effective})\n" --silent -X POST --header "Content-Type: application/json" ${ENDPOINT}/open-metadata/admin-services/users/${EGERIA_USER}/servers/${CRUX_SERVER}/configuration --data @/tmp/serverconfig.json
23+
done
24+
25+
echo "Starting the server within each pod..."
26+
27+
for REPLICA in $(seq 0 ${NUM_REPLICAS}); do
28+
ENDPOINT="https://${CRUX_RELEASE_NAME}-crux-${REPLICA}.${INTERNAL_SVC_NAME}:9443"
29+
echo " ... starting server within: ${ENDPOINT}"
30+
curl -f -k -w "\n (%{http_code} - %{url_effective})\n" --silent -X POST --max-time 900 ${ENDPOINT}/open-metadata/admin-services/users/${EGERIA_USER}/servers/${CRUX_SERVER}/instance
31+
done
32+
33+
echo ""
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
3+
echo "Performance Test Suite is complete -- retrieving all results..."
4+
5+
curl -f -k --silent --basic admin:admin -X GET --max-time 60 ${CRUX_BOOTSTRAP_ENDPOINT}/servers/pts/open-metadata/conformance-suite/users/${EGERIA_USER}/report/summary > /tmp/openmetadata_cts_summary.json
6+
TEST_CASES=$(curl -f -k --silent --basic admin:admin -X GET --max-time 60 ${CRUX_BOOTSTRAP_ENDPOINT}/servers/pts/open-metadata/conformance-suite/users/${EGERIA_USER}/report/test-cases | jq -r '.testCaseIds[]')
7+
PROFILES=$(curl -f -k --silent --basic admin:admin -X GET --max-time 60 ${CRUX_BOOTSTRAP_ENDPOINT}/servers/pts/open-metadata/conformance-suite/users/${EGERIA_USER}/report/profiles | jq -r '.profileNames[]')
8+
9+
mkdir -p /tmp/profile-details
10+
while read -r line; do
11+
urlencoded=$(echo ${line} | sed -e 's/ /%20/g')
12+
filename=$(echo ${line} | sed -e 's/ /_/g')
13+
echo "Retrieving profile details for: ${line}"
14+
curl -f -k --silent --basic admin:admin -X GET --max-time 60 ${CRUX_BOOTSTRAP_ENDPOINT}/servers/pts/open-metadata/conformance-suite/users/${EGERIA_USER}/report/profiles/${urlencoded} > /tmp/profile-details/${filename}.json
15+
done < <(echo "${PROFILES}")
16+
17+
mkdir -p /tmp/test-case-details
18+
while read -r line; do
19+
echo "Retrieving test case details for: ${line}"
20+
urlencoded=$(echo ${line} | sed -e 's/</%3C/g')
21+
urlencoded=$(echo ${urlencoded} | sed -e 's/>/%3E/g')
22+
filename=$(echo ${line} | sed -e 's/[<>]/_/g')
23+
curl -f -k --silent --basic admin:admin -X GET --max-time 60 ${CRUX_BOOTSTRAP_ENDPOINT}/servers/pts/open-metadata/conformance-suite/users/${EGERIA_USER}/report/test-cases/${urlencoded} > /tmp/test-case-details/${filename}.json
24+
done < <(echo "${TEST_CASES}")
25+
26+
echo "Consolidating all results into a single tarball archive..."
27+
28+
cd /tmp
29+
tar cvf pd.tar profile-details/*.json; gzip pd.tar
30+
tar cvf tcd.tar test-case-details/*.json; gzip tcd.tar
31+
tar cvf ${PTS_REPORT_NAME}.tar *.config cohort.* openmetadata_cts_summary.json pd.tar.gz tcd.tar.gz; gzip ${PTS_REPORT_NAME}.tar
32+
echo "Complete -- PTS results available to download from /tmp/${PTS_REPORT_NAME}.tar.gz"
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
echo "Recording environment details..."
4+
5+
curl -f -k -w "\n (%{http_code} - %{url_effective})\n" --silent -X GET ${CRUX_BOOTSTRAP_ENDPOINT}/open-metadata/admin-services/users/${EGERIA_USER}/servers/pts/configuration > /tmp/omag.server.pts.config
6+
curl -f -k -w "\n (%{http_code} - %{url_effective})\n" --silent -X GET ${CRUX_PUBLIC_ENDPOINT}/open-metadata/admin-services/users/${EGERIA_USER}/servers/${CRUX_SERVER}/configuration > /tmp/omag.server.${CRUX_SERVER}.config
7+
curl -f -k -w "\n (%{http_code} - %{url_effective})\n" --silent -X GET ${CRUX_BOOTSTRAP_ENDPOINT}/servers/pts/open-metadata/repository-services/users/${EGERIA_USER}/metadata-highway/local-registration > /tmp/cohort.${EGERIA_COHORT}.pts.local
8+
curl -f -k -w "\n (%{http_code} - %{url_effective})\n" --silent -X GET ${CRUX_BOOTSTRAP_ENDPOINT}/servers/pts/open-metadata/repository-services/users/${EGERIA_USER}/metadata-highway/cohorts/${EGERIA_COHORT}/remote-members > /tmp/cohort.${EGERIA_COHORT}.pts.remote
9+
curl -f -k -w "\n (%{http_code} - %{url_effective})\n" --silent -X GET ${CRUX_PUBLIC_ENDPOINT}/servers/${CRUX_SERVER}/open-metadata/repository-services/users/${EGERIA_USER}/metadata-highway/local-registration > /tmp/cohort.${EGERIA_COHORT}.${CRUX_SERVER}.local
10+
curl -f -k -w "\n (%{http_code} - %{url_effective})\n" --silent -X GET ${CRUX_PUBLIC_ENDPOINT}/servers/${CRUX_SERVER}/open-metadata/repository-services/users/${EGERIA_USER}/metadata-highway/cohorts/${EGERIA_COHORT}/remote-members > /tmp/cohort.${EGERIA_COHORT}.${CRUX_SERVER}.remote
11+
12+
echo ""

cts/charts/ec-ha-crux/bin/startPTS.sh

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
echo "Starting the Performance Test Suite..."
4+
5+
curl -f -k -w "\n (%{http_code} - %{url_effective})\n" --silent -X POST ${CRUX_BOOTSTRAP_ENDPOINT}/open-metadata/admin-services/users/${EGERIA_USER}/servers/pts/server-url-root?url=${CRUX_BOOTSTRAP_ENDPOINT}
6+
curl -f -k -w "\n (%{http_code} - %{url_effective})\n" --silent -X POST ${CRUX_BOOTSTRAP_ENDPOINT}/open-metadata/admin-services/users/${EGERIA_USER}/servers/pts/server-type?typeName=PerformanceTestSuite
7+
curl -f -k -w "\n (%{http_code} - %{url_effective})\n" --silent -X POST --header "Content-Type: application/json" ${CRUX_BOOTSTRAP_ENDPOINT}/open-metadata/admin-services/users/${EGERIA_USER}/servers/pts/event-bus?topicURLRoot=egeria --data '{"producer": {"bootstrap.servers": "'"${KAFKA_ENDPOINT}"'"}, "consumer": {"bootstrap.servers": "'"${KAFKA_ENDPOINT}"'"} }'
8+
curl -f -k -w "\n (%{http_code} - %{url_effective})\n" --silent -X POST ${CRUX_BOOTSTRAP_ENDPOINT}/open-metadata/admin-services/users/${EGERIA_USER}/servers/pts/cohorts/${EGERIA_COHORT}
9+
curl -f -k -w "\n (%{http_code} - %{url_effective})\n" --silent -X POST --header "Content-Type: application/json" ${CRUX_BOOTSTRAP_ENDPOINT}/open-metadata/admin-services/users/${EGERIA_USER}/servers/pts/conformance-suite-workbenches/repository-workbench/performance --data '{"class":"RepositoryPerformanceWorkbenchConfig","tutRepositoryServerName":"'"${CRUX_SERVER}"'","instancesPerType":10,"maxSearchResults":5,"waitBetweenScenarios":60}'
10+
curl -f -k -w "\n (%{http_code} - %{url_effective})\n" --silent -X POST ${CRUX_BOOTSTRAP_ENDPOINT}/open-metadata/admin-services/users/${EGERIA_USER}/servers/pts/instance
11+
12+
echo ""

cts/charts/ec-ha-crux/bin/waitLoop.sh

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
echo "Waiting 2 minutes for PTS to start..."
4+
sleep 120
5+
6+
until [ $(curl -f -k --silent --basic admin:admin -X GET ${CRUX_BOOTSTRAP_ENDPOINT}/servers/pts/open-metadata/conformance-suite/users/${EGERIA_USER}/status/workbenches/performance-workbench | jq '.workbenchStatus.workbenchComplete') == "true" ]; do
7+
echo " ... waiting another 20 seconds for PTS to complete"
8+
sleep 20
9+
done
10+
11+
echo ""
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
# Copyright Contributors to the Egeria project.
3+
---
4+
dependencies:
5+
- name: kafka
6+
version: 12.2.0
7+
repository: https://charts.bitnami.com/bitnami
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{{/* <!-- SPDX-License-Identifier: Apache-2.0 --> */}}
2+
{{/* Copyright Contributors to the Egeria project. */}}{{/* vim: set filetype=mustache: */}}
3+
{{/*
4+
Expand the name of the chart.
5+
*/}}
6+
{{- define "myapp.name" -}}
7+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
8+
{{- end -}}
9+
10+
{{/*
11+
Create chart name and version as used by the chart label.
12+
*/}}
13+
{{- define "myapp.chart" -}}
14+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
15+
{{- end -}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
# Copyright Contributors to the Egeria project.
3+
---
4+
apiVersion: v1
5+
kind: ConfigMap
6+
metadata:
7+
name: {{ .Release.Name }}-configmap
8+
labels:
9+
app.kubernetes.io/name: {{ include "myapp.name" . }}
10+
helm.sh/chart: {{ include "myapp.chart" . }}
11+
app.kubernetes.io/instance: {{ .Release.Name }}
12+
app.kubernetes.io/managed-by: {{ .Release.Service }}
13+
data:
14+
# General cluster configuration - for core egeria, kafka - these must be used
15+
EGERIA_USER: {{ .Values.egeria.user }}
16+
EGERIA_COHORT: {{ .Values.egeria.cohort }}
17+
EGERIA_SERVER: {{ .Values.egeria.server }}
18+
KAFKA_ENDPOINT: {{ .Release.Name }}-kafka:9092
19+
20+
# Used by Crux
21+
CRUX_RELEASE_NAME: {{ .Release.Name }}
22+
NUM_REPLICAS: "{{ .Values.crux.replicaCount }}"
23+
STRICT_SSL: "false"
24+
LOGGING_LEVEL_ROOT: {{ .Values.logging.level }}
25+
INTERNAL_SVC_NAME: {{ .Release.Name }}-crux-headless
26+
CRUX_PUBLIC_ENDPOINT: https://{{ .Release.Name }}-crux:9443
27+
CRUX_BOOTSTRAP_ENDPOINT: https://{{ .Release.Name }}-crux-0.{{ .Release.Name }}-crux-headless:9443
28+
CRUX_SERVER: {{ .Values.crux.proxyserver }}
29+
30+
# Used for downloads
31+
CONNECTOR_JAR: egeria-connector-crux-{{ .Values.crux.connectorversion }}-jar-with-dependencies.jar
32+
CONNECTOR_URL: {{ .Values.crux.connectorurl }}
33+
CRUX_ROCKS_JAR_URL: https://clojars.org/repo/juxt/crux-rocksdb/{{ .Values.crux.version }}/crux-rocksdb-{{ .Values.crux.version }}.jar
34+
ROCKS_JAR_URL: https://repo1.maven.org/maven2/org/rocksdb/rocksdbjni/{{ .Values.dependencyVersions.rocksdb }}/rocksdbjni-{{ .Values.dependencyVersions.rocksdb }}.jar
35+
JNR_JAR_URL: https://repo1.maven.org/maven2/com/github/jnr/jnr-ffi/{{ .Values.dependencyVersions.jnr }}/jnr-ffi-{{ .Values.dependencyVersions.jnr }}.jar
36+
KAFKA_JAR_URL: https://repo1.maven.org/maven2/org/apache/kafka/kafka-clients/{{ .Values.dependencyVersions.kafka }}/kafka-clients-{{ .Values.dependencyVersions.kafka }}.jar
37+
PTS_REPORT_NAME: {{ .Release.Name }}
+118
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
# Copyright Contributors to the Egeria project.
3+
---
4+
apiVersion: v1
5+
kind: Service
6+
metadata:
7+
name: {{ .Release.Name }}-crux-headless
8+
labels:
9+
app.kubernetes.io/component: egeria-connector-crux
10+
spec:
11+
type: ClusterIP
12+
clusterIP: None
13+
ports:
14+
- name: proxy
15+
port: 9443
16+
protocol: TCP
17+
targetPort: https
18+
selector:
19+
app.kubernetes.io/component: egeria-connector-crux
20+
...
21+
---
22+
apiVersion: v1
23+
kind: Service
24+
metadata:
25+
name: {{ .Release.Name }}-crux
26+
labels:
27+
app.kubernetes.io/component: egeria-connector-crux
28+
spec:
29+
type: ClusterIP
30+
ports:
31+
- name: proxy
32+
port: 9443
33+
protocol: TCP
34+
targetPort: https
35+
selector:
36+
app.kubernetes.io/component: egeria-connector-crux
37+
...
38+
---
39+
apiVersion: apps/v1
40+
kind: StatefulSet
41+
metadata:
42+
name: {{ .Release.Name }}-crux
43+
labels:
44+
app.kubernetes.io/component: egeria-connector-crux
45+
spec:
46+
replicas: {{ .Values.crux.replicaCount }}
47+
selector:
48+
matchLabels:
49+
app.kubernetes.io/component: egeria-connector-crux
50+
serviceName: {{ .Release.Name }}-crux-headless
51+
template:
52+
metadata:
53+
labels:
54+
app.kubernetes.io/component: egeria-connector-crux
55+
spec:
56+
terminationGracePeriodSeconds: 60
57+
volumes:
58+
- name: egeria-crux-connector-volume
59+
emptyDir: {}
60+
initContainers:
61+
- name: init-connector
62+
image: "{{ if (.Values.image.configure.registry | default .Values.imageDefaults.registry) }}{{ .Values.image.configure.registry | default .Values.imageDefaults.registry }}/{{ end }}\
63+
{{ if (.Values.image.configure.namespace | default .Values.imageDefaults.namespace) }}{{ .Values.image.configure.namespace | default .Values.imageDefaults.namespace }}/{{ end }}\
64+
{{ .Values.image.configure.name }}\
65+
:{{ .Values.image.configure.tag | default .Values.imageDefaults.tag }}"
66+
imagePullPolicy: {{ .Values.image.configure.pullPolicy | default .Values.imageDefaults.pullPolicy }}
67+
envFrom:
68+
- configMapRef:
69+
name: {{ .Release.Name }}-configmap
70+
command:
71+
- "/bin/bash"
72+
- "-c"
73+
- >
74+
cd /opt/egeria/connectors &&
75+
curl --location ${CONNECTOR_URL} --output ${CONNECTOR_JAR} &&
76+
wget ${CRUX_ROCKS_JAR_URL} &&
77+
wget ${ROCKS_JAR_URL} &&
78+
wget ${JNR_JAR_URL} &&
79+
wget ${KAFKA_JAR_URL}
80+
volumeMounts:
81+
- mountPath: /opt/egeria/connectors
82+
name: egeria-crux-connector-volume
83+
containers:
84+
- name: proxy
85+
image: "{{ if (.Values.image.egeria.registry | default .Values.imageDefaults.registry) }}{{ .Values.image.egeria.registry | default .Values.imageDefaults.registry }}/{{ end }}\
86+
{{ if (.Values.image.egeria.namespace | default .Values.imageDefaults.namespace) }}{{ .Values.image.egeria.namespace | default .Values.imageDefaults.namespace }}/{{ end }}\
87+
{{ .Values.image.egeria.name }}\
88+
:{{ .Values.image.egeria.tag | default .Values.imageDefaults.tag }}"
89+
imagePullPolicy: {{ .Values.image.egeria.pullPolicy | default .Values.imageDefaults.pullPolicy }}
90+
envFrom:
91+
- configMapRef:
92+
name: {{ .Release.Name }}-configmap
93+
env:
94+
- name: "LOADER_PATH"
95+
value: "/opt/egeria/connectors"
96+
- name: "MALLOC_ARENA_MAX"
97+
value: "2"
98+
ports:
99+
- name: https
100+
containerPort: 9443
101+
readinessProbe:
102+
tcpSocket:
103+
port: 9443
104+
initialDelaySeconds: 10
105+
periodSeconds: 10
106+
failureThreshold: 6
107+
resources:
108+
requests:
109+
memory: "4Gi"
110+
cpu: "1000m"
111+
limits:
112+
memory: "8Gi"
113+
cpu: "2000m"
114+
volumeMounts:
115+
- mountPath: /opt/egeria/connectors
116+
name: egeria-crux-connector-volume
117+
readOnly: true
118+
...

0 commit comments

Comments
 (0)