Skip to content

Commit 145ad3e

Browse files
Fix helm doc (#2001)
* Fix helm doc * Remove persistent ref * Remove persistent ref * Fixes based on feedback * Fixes based on feedback * Fixes based on feedback * Fixes based on feedback
1 parent daf4476 commit 145ad3e

File tree

8 files changed

+213
-372
lines changed

8 files changed

+213
-372
lines changed

helm/polaris/README.md

Lines changed: 184 additions & 217 deletions
Large diffs are not rendered by default.

helm/polaris/README.md.gotmpl

Lines changed: 25 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -35,27 +35,12 @@
3535

3636
{{ template "chart.homepageLine" . }}
3737

38-
{{ template "chart.maintainersHeader" . }}
39-
40-
{{- range .Maintainers }}
41-
* [{{ .Name }}]({{ if .Url }}{{ .Url }}{{ else }}https://github.com/{{ .Name }}{{ end }})
42-
{{- end }}
43-
4438
{{ template "chart.sourcesSection" . }}
4539

4640
{{ template "chart.requirementsSection" . }}
4741

4842
## Installation
4943

50-
### Prerequisites
51-
52-
When using the (deprecated) EclipseLink-backed metastore, a custom `persistence.xml` is required,
53-
and a Kubernetes Secret must be created for it. Below is a sample command:
54-
55-
```bash
56-
kubectl create secret generic polaris-secret -n polaris --from-file=persistence.xml
57-
```
58-
5944
### Running locally with a Kind cluster
6045

6146
The below instructions assume Kind and Helm are installed.
@@ -66,27 +51,27 @@ Simply run the `run.sh` script from the Polaris repo root:
6651
./run.sh
6752
```
6853

69-
If using the EclipseLink-backed metastore, make sure to specify the `--eclipse-link-deps` option.
70-
7154
This script will create a Kind cluster, deploy a local Docker registry, build the Polaris Docker
7255
images with support for Postgres and load them into the Kind cluster. (It will also create an
7356
example Deployment and Service with in-memory storage.)
7457

7558
### Running locally with a Minikube cluster
7659

77-
The below instructions assume a Minikube cluster is already running and Helm is installed.
60+
The below instructions assume Minikube and Helm are installed.
7861

79-
If necessary, build and load the Docker images with support for Postgres into Minikube:
62+
Start the Minikube cluster, build and load image into the Minikube cluster:
8063

8164
```bash
82-
eval $(minikube -p minikube docker-env)
65+
minikube start
66+
eval $(minikube docker-env)
8367

8468
./gradlew \
85-
:polaris-server:assemble \
86-
:polaris-server:quarkusAppPartsBuild --rerun \
87-
:polaris-admin:assemble \
88-
:polaris-admin:quarkusAppPartsBuild --rerun \
89-
-Dquarkus.container-image.build=true
69+
:polaris-server:assemble \
70+
:polaris-server:quarkusAppPartsBuild --rerun \
71+
:polaris-admin:assemble \
72+
:polaris-admin:quarkusAppPartsBuild --rerun \
73+
-Dquarkus.container-image.tag=postgres-latest \
74+
-Dquarkus.container-image.build=true
9075
```
9176

9277
### Installing the chart locally
@@ -96,15 +81,15 @@ The below instructions assume a local Kubernetes cluster is running and Helm is
9681
#### Common setup
9782

9883
Create the target namespace:
99-
10084
```bash
10185
kubectl create namespace polaris
10286
```
10387

10488
Create all the required resources in the `polaris` namespace. This usually includes a Postgres
105-
database and a Kubernetes Secret for the `persistence.xml` file. The Polaris chart does not create
89+
database, Kubernetes secrets, and service accounts. The Polaris chart does not create
10690
these resources automatically, as they are not required for all Polaris deployments. The chart will
107-
fail if these resources are not created beforehand.
91+
fail if these resources are not created beforehand. You can find some examples in the
92+
`helm/polaris/ci/fixtures` directory, but beware that these are primarily intended for tests.
10893

10994
Below are two sample deployment models for installing the chart: one with a non-persistent backend and another with a persistent backend.
11095

@@ -116,19 +101,17 @@ Below are two sample deployment models for installing the chart: one with a non-
116101
#### Non-persistent backend
117102

118103
Install the chart with a non-persistent backend. From Polaris repo root:
119-
120104
```bash
121105
helm upgrade --install --namespace polaris \
122-
--debug --values helm/polaris/ci/simple-values.yaml \
123-
polaris helm/polaris
106+
--values helm/polaris/ci/simple-values.yaml \
107+
polaris helm/polaris
124108
```
125109

126110
Note: if you are running the tests on a Kind cluster started with the `run.sh` command explained
127111
above, then you need to run `helm upgrade` as follows:
128-
129112
```bash
130113
helm upgrade --install --namespace polaris \
131-
--debug --values helm/polaris/ci/simple-values.yaml \
114+
--values helm/polaris/ci/simple-values.yaml \
132115
--set=image.repository=localhost:5001/apache/polaris \
133116
polaris helm/polaris
134117
```
@@ -139,41 +122,28 @@ helm upgrade --install --namespace polaris \
139122
> The Postgres deployment set up in the fixtures directory is intended for testing purposes only and is not suitable for production use. For production deployments, use a managed Postgres service or a properly configured and secured Postgres instance.
140123

141124
Install the chart with a persistent backend. From Polaris repo root:
142-
143125
```bash
144126
helm upgrade --install --namespace polaris \
145-
--debug --values helm/polaris/ci/persistence-values.yaml \
127+
--values helm/polaris/ci/persistence-values.yaml \
146128
polaris helm/polaris
147-
148129
kubectl wait --namespace polaris --for=condition=ready pod --selector=app.kubernetes.io/name=polaris --timeout=120s
149130
```
150131

151-
After deploying the chart with a persistent backend, the `persistence.xml` file, originally loaded into the Kubernetes pod via a secret, can be accessed locally if needed. This file contains the persistence configuration required for the next steps. Use the following command to retrieve it:
152-
153-
```bash
154-
kubectl exec -it -n polaris $(kubectl get pod -n polaris -l app.kubernetes.io/name=polaris -o jsonpath='{.items[0].metadata.name}') -- cat /deployments/config/persistence.xml > persistence.xml
155-
```
156-
157-
The `persistence.xml` file references the Postgres hostname as postgres. Update it to localhost to enable local connections:
158-
159-
```bash
160-
sed -i .bak 's/postgres:/localhost:/g' persistence.xml
161-
```
162-
163-
To access Polaris and Postgres locally, set up port forwarding for both services:
132+
To access Polaris and Postgres locally, set up port forwarding for both services (This is needed for bootstrap processes):
164133
```bash
165134
kubectl port-forward -n polaris $(kubectl get pod -n polaris -l app.kubernetes.io/name=polaris -o jsonpath='{.items[0].metadata.name}') 8181:8181
166135

167136
kubectl port-forward -n polaris $(kubectl get pod -n polaris -l app.kubernetes.io/name=postgres -o jsonpath='{.items[0].metadata.name}') 5432:5432
168137
```
169138

170139
Run the catalog bootstrap using the Polaris admin tool. This step initializes the catalog with the required configuration:
171-
172140
```bash
173-
java -Dpolaris.persistence.eclipselink.configuration-file=./persistence.xml \
174-
-Dpolaris.persistence.eclipselink.persistence-unit=polaris \
175-
-jar runtime/admin/build/polaris-admin-*-runner.jar \
176-
bootstrap -c POLARIS,root,pass -r POLARIS
141+
container_envs=$(kubectl exec -it -n polaris $(kubectl get pod -n polaris -l app.kubernetes.io/name=polaris -o jsonpath='{.items[0].metadata.name}') -- env)
142+
export QUARKUS_DATASOURCE_USERNAME=$(echo "$container_envs" | grep quarkus.datasource.username | awk -F '=' '{print $2}' | tr -d '\n\r')
143+
export QUARKUS_DATASOURCE_PASSWORD=$(echo "$container_envs" | grep quarkus.datasource.password | awk -F '=' '{print $2}' | tr -d '\n\r')
144+
export QUARKUS_DATASOURCE_JDBC_URL=$(echo "$container_envs" | grep quarkus.datasource.jdbc.url | sed 's/postgres/localhost/2' | awk -F '=' '{print $2}' | tr -d '\n\r')
145+
146+
java -jar runtime/admin/build/quarkus-app/quarkus-run.jar bootstrap -c POLARIS,root,pass -r POLARIS
177147
```
178148

179149
### Uninstalling
@@ -198,15 +168,13 @@ The following tools are required to run the tests:
198168
* [Chart Testing](https://github.com/helm/chart-testing)
199169

200170
Quick installation instructions for these tools:
201-
202171
```bash
203172
helm plugin install https://github.com/helm-unittest/helm-unittest.git
204173
brew install chart-testing
205174
```
206175

207176
The integration tests also require some fixtures to be deployed. The `ci/fixtures` directory
208177
contains the required resources. To deploy them, run the following command:
209-
210178
```bash
211179
kubectl apply --namespace polaris -f helm/polaris/ci/fixtures/
212180
kubectl wait --namespace polaris --for=condition=ready pod --selector=app.kubernetes.io/name=postgres --timeout=120s
@@ -219,7 +187,6 @@ different configurations.
219187

220188
Helm unit tests do not require a Kubernetes cluster. To run the unit tests, execute Helm Unit from
221189
the Polaris repo root:
222-
223190
```bash
224191
helm unittest helm/polaris
225192
```
@@ -236,9 +203,8 @@ Integration tests require a Kubernetes cluster. See installation instructions ab
236203
a local cluster.
237204

238205
Integration tests are run with the Chart Testing tool:
239-
240206
```bash
241-
ct install --namespace polaris --debug --charts ./helm/polaris
207+
ct install --namespace polaris --charts ./helm/polaris
242208
```
243209

244210
Note: if you are running the tests on a Kind cluster started with the `run.sh` command explained

helm/polaris/templates/_helpers.tpl

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -191,13 +191,6 @@ Prints the config volume definition for deployments and jobs.
191191
path: symmetric.key
192192
{{- end }}
193193
{{- end }}
194-
{{- if and ( eq .Values.persistence.type "eclipse-link" ) .Values.persistence.eclipseLink.secret.name }}
195-
- secret:
196-
name: {{ tpl .Values.persistence.eclipseLink.secret.name . }}
197-
items:
198-
- key: {{ tpl .Values.persistence.eclipseLink.secret.key . }}
199-
path: persistence.xml
200-
{{- end }}
201194
{{- end -}}
202195

203196
{{/*

helm/polaris/templates/configmap.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,6 @@ data:
4949
5050
{{- /* Persistence */ -}}
5151
{{- $_ = set $map "polaris.persistence.type" .Values.persistence.type -}}
52-
{{- if and ( eq .Values.persistence.type "eclipse-link" ) .Values.persistence.eclipseLink.secret.name -}}
53-
{{- $_ = set $map "polaris.persistence.eclipselink.persistence-unit" .Values.persistence.eclipseLink.persistenceUnit -}}
54-
{{- $_ = set $map "polaris.persistence.eclipselink.configuration-file" (printf "%s/persistence.xml" .Values.image.configDir ) -}}
55-
{{- end -}}
5652
5753
{{- /* File IO */ -}}
5854
{{- $_ = set $map "polaris.file-io.type" .Values.fileIo.type -}}

helm/polaris/tests/configmap_test.yaml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,6 @@ tests:
102102
- matchRegex: { path: 'data["application.properties"]', pattern: "polaris.features.realm-overrides.\"realm1\".\"feature1\"=false" }
103103
- matchRegex: { path: 'data["application.properties"]', pattern: "polaris.features.realm-overrides.\"realm2\".\"feature2\"=43" }
104104

105-
- it: should configure persistence
106-
set:
107-
persistence: { type: "eclipse-link", eclipseLink: { persistenceUnit: "polaris", secret: { name: "polaris-persistence" } } }
108-
asserts:
109-
- matchRegex: { path: 'data["application.properties"]', pattern: "polaris.persistence.type=eclipse-link" }
110-
- matchRegex: { path: 'data["application.properties"]', pattern: "polaris.persistence.eclipselink.persistence-unit=polaris" }
111-
- matchRegex: { path: 'data["application.properties"]', pattern: "polaris.persistence.eclipselink.configuration-file=/deployments/config/persistence.xml" }
112-
113105
- it: should configure relational-jdbc persistence
114106
set:
115107
persistence: { type: "relational-jdbc", relationalJdbc: { secret: { name: "polaris-persistence" } } }

helm/polaris/tests/deployment_test.yaml

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -356,31 +356,6 @@ tests:
356356
mountPath: /deployments/config
357357
readOnly: true
358358

359-
- it: should evaluate template expressions in persistence secret name
360-
set:
361-
persistence:
362-
type: eclipse-link
363-
eclipseLink:
364-
secret:
365-
name: "{{ .Release.Name }}-persistence-secret"
366-
asserts:
367-
- contains:
368-
path: spec.template.spec.volumes
369-
content:
370-
name: config-volume
371-
projected:
372-
sources:
373-
- configMap:
374-
items:
375-
- key: application.properties
376-
path: application.properties
377-
name: polaris-release
378-
- secret:
379-
items:
380-
- key: persistence.xml
381-
path: persistence.xml
382-
name: polaris-release-persistence-secret
383-
384359
# spec.template.spec.containers[0].ports
385360
- it: should set container ports by default
386361
asserts:
@@ -987,39 +962,6 @@ tests:
987962
- key: private.key
988963
path: private.pem
989964

990-
- it: should configure config volume with persistence secret
991-
set:
992-
image.configDir: /config/dir
993-
persistence:
994-
type: eclipse-link
995-
eclipseLink:
996-
secret:
997-
name: polaris-persistence
998-
key: custom.xml
999-
asserts:
1000-
- contains:
1001-
path: spec.template.spec.containers[0].volumeMounts
1002-
content:
1003-
name: config-volume
1004-
mountPath: /config/dir
1005-
readOnly: true
1006-
- contains:
1007-
path: spec.template.spec.volumes
1008-
content:
1009-
name: config-volume
1010-
projected:
1011-
sources:
1012-
- configMap:
1013-
name: polaris-release
1014-
items:
1015-
- key: application.properties
1016-
path: application.properties
1017-
- secret:
1018-
name: polaris-persistence
1019-
items:
1020-
- key: custom.xml
1021-
path: persistence.xml
1022-
1023965
- it: should set relational-jdbc persistence environment variables
1024966
set:
1025967
persistence: { type: "relational-jdbc", relationalJdbc: { secret: { name: "polaris-persistence", username: "username", password: "password", jdbcUrl: "jdbcUrl" } } }

helm/polaris/values.yaml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -537,18 +537,6 @@ persistence:
537537
# -- The secret key holding the database JDBC connection URL
538538
jdbcUrl: jdbcUrl
539539

540-
# -- The configuration for the eclipse-link persistence manager.
541-
eclipseLink:
542-
# -- The secret name to pull persistence.xml from.
543-
secret:
544-
# -- The name of the secret to pull persistence.xml from.
545-
# If not provided, the default built-in persistence.xml will be used. This is probably not what you want.
546-
name: ~
547-
# -- The key in the secret to pull persistence.xml from.
548-
key: persistence.xml
549-
# -- The persistence unit name to use.
550-
persistenceUnit: polaris
551-
552540
# -- Polaris FileIO configuration.
553541
fileIo:
554542
# -- The type of file IO to use. Two built-in types are supported: default and wasb. The wasb one translates WASB paths to ABFS ones.

run.sh

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,13 @@
2424
# Function to display usage information
2525
usage() {
2626
echo "Usage: $0 [--eclipse-link-deps=<deps>] [-h|--help]"
27-
echo " --eclipse-link-deps=<deps> EclipseLink dependencies to use, e.g."
28-
echo " --eclipse-link-deps=com.h2database:h2:2.3.232"
2927
echo " -h, --help Display this help message"
3028
exit 1
3129
}
3230

3331
# Parse command-line arguments
3432
while [[ "$#" -gt 0 ]]; do
3533
case $1 in
36-
--eclipse-link-deps=*)
37-
ECLIPSE_LINK_DEPS="-PeclipseLinkDeps=${1#*=}"
38-
;;
3934
-h|--help)
4035
usage
4136
;;
@@ -53,9 +48,11 @@ sh ./kind-registry.sh
5348
# Build and deploy the server image
5449
echo "Building polaris image..."
5550
./gradlew \
56-
:polaris-server:build \
51+
:polaris-server:assemble \
5752
:polaris-server:quarkusAppPartsBuild --rerun \
58-
$ECLIPSE_LINK_DEPS \
53+
:polaris-admin:assemble \
54+
:polaris-admin:quarkusAppPartsBuild --rerun \
55+
-Dquarkus.container-image.tag=postgres-latest \
5956
-Dquarkus.container-image.build=true \
6057
-Dquarkus.container-image.registry=localhost:5001
6158

0 commit comments

Comments
 (0)