Skip to content

Commit

Permalink
Helm chart redesign for Quarkus-based runtimes
Browse files Browse the repository at this point in the history
  • Loading branch information
adutra committed Feb 1, 2025
1 parent d6de506 commit 8e290f4
Show file tree
Hide file tree
Showing 32 changed files with 3,443 additions and 841 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/helm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ jobs:
if: steps.list-changed.outputs.changed == 'true'
run: |
helm plugin install https://github.com/helm-unittest/helm-unittest.git || true
helm unittest helm/polaris
helm unittest helm/polaris 2> >(grep -v 'found symbolic link' >&2)
- name: Run chart-testing (lint)
if: steps.list-changed.outputs.changed == 'true'
Expand All @@ -99,9 +99,9 @@ jobs:
if: steps.list-changed.outputs.changed == 'true'
run: |
eval $(minikube -p minikube docker-env)
./gradlew :polaris-quarkus-server:assemble \
./gradlew :polaris-quarkus-server:assemble :polaris-quarkus-admin:assemble \
-Dquarkus.container-image.build=true \
-PeclipseLinkDeps=com.h2database:h2:2.3.232
-PeclipseLinkDeps=org.postgresql:postgresql:42.7.4
minikube image ls
- name: Install fixtures
Expand Down
203 changes: 184 additions & 19 deletions helm/polaris/README.md

Large diffs are not rendered by default.

76 changes: 69 additions & 7 deletions helm/polaris/README.md.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
Expand Down Expand Up @@ -49,23 +49,85 @@

### Optional

When using a custom `persistence.xml`, a Kubernetes Secret must be created for `.persistenceConfigSecret`. Below is a sample command:
When using a custom `persistence.xml`, a Kubernetes Secret must be created for it. Below is a sample command:
```bash
kubectl create secret generic polaris-secret -n polaris --from-file=persistence.xml
```

### From local directory (for development purposes)
### Running the unit tests

Helm unit tests do not require a Kubernetes cluster. To run the unit tests from the Polaris repo
root:

```bash
helm unittest helm/polaris 2> >(grep -v 'found symbolic link' >&2)
```

Note: the `grep` command is used to filter out the annoying warning messages about symbolic links;
see https://github.com/helm/helm/issues/7019.

### Running locally with a Kind cluster

The below instructions assume Kind and Helm are installed.

Simply run the `run.sh` script from the Polaris repo root, making sure to specify the
`--eclipse-link-deps` option:

```bash
./run.sh --eclipse-link-deps=org.postgresql:postgresql:42.7.4
```

This script will create a Kind cluster, deploy a local Docker registry, build the Polaris Docker
images with support for Postgres and load them into the Kind cluster. (It will also create an
example Deployment and Service with in-memory storage.)

### Running locally with a Minikube cluster

The below instructions assume a Minikube cluster is already running and Helm is installed.

If necessary, build and load the Docker images with support for Postgres into Minikube:

```bash
eval $(minikube -p minikube docker-env)

./gradlew :polaris-quarkus-server:assemble :polaris-quarkus-admin:assemble \
-Dquarkus.container-image.build=true \
-PeclipseLinkDeps=org.postgresql:postgresql:42.7.4
```

### Installing the chart locally

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

Create and populate the target namespace:

```bash
kubectl create namespace polaris
kubectl apply --namespace polaris -f helm/polaris/ci/fixtures/
```

Finally, install the chart. 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.

From Polaris repo root:
You can also run `ct` (chart-testing):

```bash
$ helm install polaris helm/polaris --namespace polaris --create-namespace
ct lint --charts helm/polaris
ct install --namespace polaris --debug --charts ./helm/polaris
```

### Uninstalling the chart

```bash
$ helm uninstall --namespace polaris polaris
helm uninstall --namespace polaris polaris
```

{{ template "chart.valuesSection" . }}
47 changes: 47 additions & 0 deletions helm/polaris/ci/extra-service-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#

image:
pullPolicy: Never

service:
type: ClusterIP
sessionAffinity: ClientIP
internalTrafficPolicy: Cluster
externalTrafficPolicy: Cluster
ports:
- name: polaris-http
port: 18181
targetPort: 8181
protocol: TCP
- name: polaris-http2
port: 28181
targetPort: 8181
protocol: TCP

extraServices:
- nameSuffix: "ext"
type: ClusterIP
sessionAffinity: None
internalTrafficPolicy: Local
externalTrafficPolicy: Local
ports:
- name: polaris-http2
port: 38181
targetPort: 8181
7 changes: 4 additions & 3 deletions helm/polaris/ci/fixtures/persistence.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@ stringData:
<class>org.apache.polaris.jpa.models.ModelSequenceId</class>
<shared-cache-mode>NONE</shared-cache-mode>
<properties>
<property name="jakarta.persistence.jdbc.url" value="jdbc:h2:mem:polaris-{realm}"/>
<property name="jakarta.persistence.jdbc.user" value="sa"/>
<property name="jakarta.persistence.jdbc.password" value=""/>
<property name="jakarta.persistence.jdbc.url"
value="jdbc:postgresql://postgres:5432/{realm}"/>
<property name="jakarta.persistence.jdbc.user" value="postgres"/>
<property name="jakarta.persistence.jdbc.password" value="postgres"/>
<property name="jakarta.persistence.schema-generation.database.action" value="create"/>
<property name="eclipselink.logging.level.sql" value="FINE"/>
<property name="eclipselink.logging.parameters" value="true"/>
Expand Down
72 changes: 72 additions & 0 deletions helm/polaris/ci/fixtures/postgres.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#

apiVersion: apps/v1
kind: Deployment
metadata:
name: postgres
spec:
replicas: 1
selector:
matchLabels:
app: postgres
template:
metadata:
labels:
app: postgres
spec:
containers:
- name: postgres
image: postgres:17.2
ports:
- containerPort: 5432
resources:
limits:
memory: "128Mi"
env:
- name: POSTGRES_USER
value: "postgres"
- name: POSTGRES_PASSWORD
value: "postgres"
- name: POSTGRES_DB
value: "POLARIS"
- name: POSTGRES_INITDB_ARGS
value: "--encoding UTF8 --data-checksums"
readinessProbe:
exec:
command:
- pg_isready
- -U
- postgres
initialDelaySeconds: 5
periodSeconds: 5
timeoutSeconds: 2
failureThreshold: 15
---
apiVersion: v1
kind: Service
metadata:
name: postgres
spec:
selector:
app: postgres
ports:
- protocol: TCP
port: 5432
targetPort: 5432
27 changes: 27 additions & 0 deletions helm/polaris/ci/fixtures/storage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#

apiVersion: v1
kind: Secret
metadata:
name: polaris-storage
type: Opaque
stringData:
access-key: "my-key"
secret-key: "my-secret"
59 changes: 59 additions & 0 deletions helm/polaris/ci/fixtures/token-broker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#

apiVersion: v1
kind: Secret
metadata:
name: polaris-token-broker
type: Opaque
stringData:
private.pem: |-
-----BEGIN PRIVATE KEY-----
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDiae5jQnQ+Dt8Optpa4fLNuUfI
37Sy29JPfn22CkGNo54SJi8NtR38Q958Bx9B+30IZPm3KtZGPC38Tm78/C508h7/Bd0jO7S3/UuQ
rYlg9H8gC59j14fE5cKEiKCvHrNK35Act9LrfhwEoGBs7G+90KD3SBIWzoc4vS8AB/ey09kRN3+M
dQ/DuRrafRgEx8ecq0x4KPggrmvworVVm1ya+H2JNKUQ+uQugmwxeRDE1GuJrgNnn4+ajueEnGdc
ohgz067AgZExzoyRlujJXBuL6JRtOSbEYVpNV1laVdA8UJ2b5I1PiNnVvx1m4gFi/Cela479EO6t
+AC+a1ez+MxTAgMBAAECggEAA1QiXJQ4CEeIsPrz/90NiEe+je34Bp8jtuZ5q6j38MCkjMjB7VYp
1DEdPr6OD5bGbk6puy8mik7NMEXo7NA6UJ7UpNQtvZxdmkzfhQeAGwxNKCfzlnCvPs5P70ng7uIp
KaMix8FOGQc4GztOX5uUQvqjuy70kSBFLajeXYZAdoEOu+E3QDaCUqiJlK3cRAJhg39Br+XfOHDp
cBdhlbxqQKZHWqDR010XUNoQpMHXWTu/e779Xze9uAvmYw98YGtCW8JB5A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7fDqbaWuHyzblHyN+0stvS
T359tgpBjaOeEiYvDbUd/EPefAcfQft9CGT5tyrWRjwt/E5u/PwudPIe/wXdIzu0t/1LkK2JYPR/
IAufY9eHxOXChIigrx6zSt+QHLfS634cBKBgbOxvvdCg90gSFs6HOL0vAAf3stPZETd/jHUPw7ka
2n0YBMfHnKtMeCj4IK5r8KK1VZtcmvh9iTSlEPrkLoJsMXkQxNRria4DZ5+Pmo7nhJxnXKIYM9Ou
wIGRMc6MkZboyVwbi+iUbTkmxGFaTVdZWlXQPFCdm+SNT4jZ1b8dZuIBYvwnpWuO/RDurfgAvmtX
s/jMUwIDAQAB
-----END PUBLIC KEY-----
31 changes: 25 additions & 6 deletions helm/polaris/ci/persistence-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,29 @@
image:
pullPolicy: Never

persistenceConfigSecret: polaris-persistence
authentication:
tokenBroker:
secret:
name: polaris-token-broker

polarisServerConfig:
metaStoreManager:
type: eclipse-link
persistence-unit: polaris
conf-file: /eclipselink-config/conf.jar!/persistence.xml
logging:
file:
enabled: true
json: true
storage:
size: 50Mi

persistence:
type: eclipse-link
eclipseLink:
secret:
name: polaris-persistence

bootstrap:
enabled: true
realms:
- POLARIS
credentials:
- POLARIS,root,secret
image:
pullPolicy: Never
10 changes: 10 additions & 0 deletions helm/polaris/ci/simple-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,13 @@

image:
pullPolicy: Never

storage:
secret:
name: polaris-storage
awsAccessKeyId: access-key
awsSecretAccessKey: secret-key

extraEnv:
- name: POLARIS_BOOTSTRAP_CREDENTIALS
value: root,root,secret
Loading

0 comments on commit 8e290f4

Please sign in to comment.