Skip to content

Commit a95026c

Browse files
Doc: catalog bootstrap steps for helm deployment (#1243)
1 parent 4b4ab97 commit a95026c

File tree

3 files changed

+131
-21
lines changed

3 files changed

+131
-21
lines changed

helm/polaris/README.md

Lines changed: 62 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,35 +96,90 @@ eval $(minikube -p minikube docker-env)
9696

9797
The below instructions assume a local Kubernetes cluster is running and Helm is installed.
9898

99+
#### Common setup
100+
99101
Create and populate the target namespace:
100102

101103
```bash
102104
kubectl create namespace polaris
103105
kubectl apply --namespace polaris -f helm/polaris/ci/fixtures/
106+
107+
kubectl wait --namespace polaris --for=condition=ready pod --selector=app.kubernetes.io/name=postgres --timeout=120s
108+
```
109+
110+
The `helm/polaris/ci` contains a number of values files that can be used to install the chart with
111+
different configurations.
112+
113+
You can also run `ct` (chart-testing):
114+
115+
```bash
116+
ct lint --charts helm/polaris
117+
ct install --namespace polaris --debug --charts ./helm/polaris
104118
```
105119

106-
Finally, install the chart. From Polaris repo root:
120+
Below are two sample deployment models for installing the chart: one with a non-persistent backend and another with a persistent backend.
121+
122+
#### Non-persistent backend
123+
124+
Install the chart with a non-persistent backend. From Polaris repo root:
107125

108126
```bash
109127
helm upgrade --install --namespace polaris \
110128
--debug --values helm/polaris/ci/simple-values.yaml \
111129
polaris helm/polaris
112130
```
113131

114-
The `helm/polaris/ci` contains a number of values files that can be used to install the chart with
115-
different configurations.
132+
#### Persistent backend
116133

117-
You can also run `ct` (chart-testing):
134+
> [!WARNING]
135+
> 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.
136+
137+
Install the chart with a persistent backend. From Polaris repo root:
118138

119139
```bash
120-
ct lint --charts helm/polaris
121-
ct install --namespace polaris --debug --charts ./helm/polaris
140+
helm upgrade --install --namespace polaris \
141+
--debug --values helm/polaris/ci/persistence-values.yaml \
142+
polaris helm/polaris
143+
144+
kubectl wait --namespace polaris --for=condition=ready pod --selector=app.kubernetes.io/name=polaris --timeout=120s
145+
```
146+
147+
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:
148+
149+
```bash
150+
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
151+
```
152+
153+
The `persistence.xml` file references the Postgres hostname as postgres. Update it to localhost to enable local connections:
154+
155+
```bash
156+
sed -i .bak 's/postgres:/localhost:/g' persistence.xml
122157
```
123158

124-
### Uninstalling the chart
159+
To access Polaris and Postgres locally, set up port forwarding for both services:
160+
```bash
161+
kubectl port-forward -n polaris $(kubectl get pod -n polaris -l app.kubernetes.io/name=polaris -o jsonpath='{.items[0].metadata.name}') 8181:8181
162+
163+
kubectl port-forward -n polaris $(kubectl get pod -n polaris -l app.kubernetes.io/name=postgres -o jsonpath='{.items[0].metadata.name}') 5432:5432
164+
```
165+
166+
Run the catalog bootstrap using the Polaris admin tool. This step initializes the catalog with the required configuration:
167+
168+
```bash
169+
java -Dpolaris.persistence.eclipselink.configuration-file=./persistence.xml \
170+
-Dpolaris.persistence.eclipselink.persistence-unit=polaris \
171+
-jar quarkus/admin/build/polaris-quarkus-admin-*-runner.jar \
172+
bootstrap -c POLARIS,root,pass -r POLARIS
173+
```
174+
175+
### Uninstalling
125176

126177
```bash
127178
helm uninstall --namespace polaris polaris
179+
180+
kubectl delete --namespace polaris -f helm/polaris/ci/fixtures/
181+
182+
kubectl delete namespace polaris
128183
```
129184

130185
## Values

helm/polaris/README.md.gotmpl

Lines changed: 63 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,35 +97,90 @@ eval $(minikube -p minikube docker-env)
9797

9898
The below instructions assume a local Kubernetes cluster is running and Helm is installed.
9999

100+
#### Common setup
101+
100102
Create and populate the target namespace:
101103

102104
```bash
103105
kubectl create namespace polaris
104106
kubectl apply --namespace polaris -f helm/polaris/ci/fixtures/
107+
108+
kubectl wait --namespace polaris --for=condition=ready pod --selector=app.kubernetes.io/name=postgres --timeout=120s
109+
```
110+
111+
The `helm/polaris/ci` contains a number of values files that can be used to install the chart with
112+
different configurations.
113+
114+
You can also run `ct` (chart-testing):
115+
116+
```bash
117+
ct lint --charts helm/polaris
118+
ct install --namespace polaris --debug --charts ./helm/polaris
105119
```
106120

107-
Finally, install the chart. From Polaris repo root:
121+
Below are two sample deployment models for installing the chart: one with a non-persistent backend and another with a persistent backend.
122+
123+
#### Non-persistent backend
124+
125+
Install the chart with a non-persistent backend. From Polaris repo root:
108126

109127
```bash
110128
helm upgrade --install --namespace polaris \
111129
--debug --values helm/polaris/ci/simple-values.yaml \
112130
polaris helm/polaris
113131
```
114132

115-
The `helm/polaris/ci` contains a number of values files that can be used to install the chart with
116-
different configurations.
133+
#### Persistent backend
117134

118-
You can also run `ct` (chart-testing):
135+
> [!WARNING]
136+
> 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.
137+
138+
Install the chart with a persistent backend. From Polaris repo root:
119139

120140
```bash
121-
ct lint --charts helm/polaris
122-
ct install --namespace polaris --debug --charts ./helm/polaris
141+
helm upgrade --install --namespace polaris \
142+
--debug --values helm/polaris/ci/persistence-values.yaml \
143+
polaris helm/polaris
144+
145+
kubectl wait --namespace polaris --for=condition=ready pod --selector=app.kubernetes.io/name=polaris --timeout=120s
146+
```
147+
148+
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:
149+
150+
```bash
151+
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
152+
```
153+
154+
The `persistence.xml` file references the Postgres hostname as postgres. Update it to localhost to enable local connections:
155+
156+
```bash
157+
sed -i .bak 's/postgres:/localhost:/g' persistence.xml
123158
```
124159

125-
### Uninstalling the chart
160+
To access Polaris and Postgres locally, set up port forwarding for both services:
161+
```bash
162+
kubectl port-forward -n polaris $(kubectl get pod -n polaris -l app.kubernetes.io/name=polaris -o jsonpath='{.items[0].metadata.name}') 8181:8181
163+
164+
kubectl port-forward -n polaris $(kubectl get pod -n polaris -l app.kubernetes.io/name=postgres -o jsonpath='{.items[0].metadata.name}') 5432:5432
165+
```
166+
167+
Run the catalog bootstrap using the Polaris admin tool. This step initializes the catalog with the required configuration:
168+
169+
```bash
170+
java -Dpolaris.persistence.eclipselink.configuration-file=./persistence.xml \
171+
-Dpolaris.persistence.eclipselink.persistence-unit=polaris \
172+
-jar quarkus/admin/build/polaris-quarkus-admin-*-runner.jar \
173+
bootstrap -c POLARIS,root,pass -r POLARIS
174+
```
175+
176+
### Uninstalling
126177

127178
```bash
128179
helm uninstall --namespace polaris polaris
180+
181+
kubectl delete --namespace polaris -f helm/polaris/ci/fixtures/
182+
183+
kubectl delete namespace polaris
129184
```
130185

131-
{{ template "chart.valuesSection" . }}
186+
{{ template "chart.valuesSection" . }}

helm/polaris/ci/fixtures/postgres.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ spec:
2525
replicas: 1
2626
selector:
2727
matchLabels:
28-
app: postgres
28+
app.kubernetes.io/name: postgres
2929
template:
3030
metadata:
3131
labels:
32-
app: postgres
32+
app.kubernetes.io/name: postgres
3333
spec:
3434
containers:
3535
- name: postgres
@@ -65,8 +65,8 @@ metadata:
6565
name: postgres
6666
spec:
6767
selector:
68-
app: postgres
68+
app.kubernetes.io/name: postgres
6969
ports:
70-
- protocol: TCP
71-
port: 5432
72-
targetPort: 5432
70+
- protocol: TCP
71+
port: 5432
72+
targetPort: 5432

0 commit comments

Comments
 (0)