MonkeyCanCode commented on code in PR #1243:
URL: https://github.com/apache/polaris/pull/1243#discussion_r2011308049
##########
helm/polaris/README.md:
##########
@@ -96,35 +96,90 @@ eval $(minikube -p minikube docker-env)
The below instructions assume a local Kubernetes cluster is running and Helm
is installed.
+#### Common setup
+
Create and populate the target namespace:
```bash
kubectl create namespace polaris
kubectl apply --namespace polaris -f helm/polaris/ci/fixtures/
+
+kubectl wait --namespace polaris --for=condition=ready pod
--selector=app.kubernetes.io/name=postgres --timeout=120s
+```
+
+The `helm/polaris/ci` contains a number of values files that can be used to
install the chart with
+different configurations.
+
+You can also run `ct` (chart-testing):
+
+```bash
+ct lint --charts helm/polaris
+ct install --namespace polaris --debug --charts ./helm/polaris
```
-Finally, install the chart. From Polaris repo root:
+Below are two sample deployment models for installing the chart: one with a
non-persistent backend and another with a persistent backend.
+
+#### Non-persistent backend
+
+Install the chart with a non-persistent backend. From Polaris repo root:
```bash
helm upgrade --install --namespace polaris \
--debug --values helm/polaris/ci/simple-values.yaml \
polaris helm/polaris
```
-The `helm/polaris/ci` contains a number of values files that can be used to
install the chart with
-different configurations.
+#### Persistent backend
-You can also run `ct` (chart-testing):
+> [!WARNING]
+> 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.
+
+Install the chart with a persistent backend. From Polaris repo root:
```bash
-ct lint --charts helm/polaris
-ct install --namespace polaris --debug --charts ./helm/polaris
+helm upgrade --install --namespace polaris \
+ --debug --values helm/polaris/ci/persistence-values.yaml \
+ polaris helm/polaris
+
+kubectl wait --namespace polaris --for=condition=ready pod
--selector=app.kubernetes.io/name=polaris --timeout=120s
+```
+
+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:
+
+```bash
+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
+```
+
+The `persistence.xml` file references the Postgres hostname as postgres.
Update it to localhost to enable local connections:
+
+```bash
+sed -i .bak 's/postgres:/localhost:/g' persistence.xml
```
-### Uninstalling the chart
+To access Polaris and Postgres locally, set up port forwarding for both
services:
+```bash
+kubectl port-forward -n polaris $(kubectl get pod -n polaris -l
app.kubernetes.io/name=polaris -o jsonpath='{.items[0].metadata.name}')
8181:8181
+
+kubectl port-forward -n polaris $(kubectl get pod -n polaris -l
app.kubernetes.io/name=postgres -o jsonpath='{.items[0].metadata.name}')
5432:5432
+```
Review Comment:
By default, nothing is exposed to the host computer from k8s. To expose
service from k8s to local, there are couple options for it such as node port,
ingress, API gateway, as well as simple port forwarding. Our current helm chart
does support ingress (via proper config as well as ensure the ingress
controller is installed...ingress controller installation is not part of
Polaris helm deployment). If this is preferred as a way to avoid port
forwarding, I can draft a PR for this as well.
This also means when end-users are using proper postgres setup, this won't
be an issue at all as port forwarding will no longer be needed and not need to
manually change hostname from postgres to localhost as now the config will
contains a resolvable FQDN that is routable both within the K8S as well as
users' computers.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]