Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build viable Docker images for Polaris using Quarkus #610

Merged
merged 1 commit into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 19 additions & 8 deletions .github/workflows/helm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ jobs:
with:
fetch-depth: 0

- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
eric-maynard marked this conversation as resolved.
Show resolved Hide resolved

- name: Set up Helm
uses: azure/[email protected]
with:
Expand Down Expand Up @@ -83,25 +89,30 @@ jobs:
if: steps.list-changed.outputs.changed == 'true'
uses: medyagh/[email protected]

- name: Docker build
- name: Print Docker info
if: steps.list-changed.outputs.changed == 'true'
run: |
docker -v
minikube docker-env

- name: Image build
if: steps.list-changed.outputs.changed == 'true'
run: |
eval $(minikube docker-env)
docker build -f ./Dockerfile \
--build-arg ECLIPSELINK=true \
--build-arg ECLIPSELINK_DEPS=com.h2database:h2:2.3.232 \
-t polaris:latest .
eval $(minikube -p minikube docker-env)
./gradlew :polaris-quarkus-server:assemble \
-Dquarkus.container-image.build=true \
-PeclipseLinkDeps=com.h2database:h2:2.3.232
minikube image ls

- name: Install fixtures
if: steps.list-changed.outputs.changed == 'true'
run: |
kubectl create namespace polaris-ns
kubectl apply --namespace polaris-ns $(find helm/polaris/ci/fixtures -name "*.yaml" -exec echo -n "-f {} " \;)
kubectl apply --namespace polaris-ns -f helm/polaris/ci/fixtures

- name: Run chart-testing (install)
if: steps.list-changed.outputs.changed == 'true'
run: |
ct install --target-branch ${{ github.event.repository.default_branch }} \
--namespace polaris-ns \
--helm-extra-set-args "--set=image.repository=polaris --set=image.tag=latest" \
--debug --charts ./helm/polaris
17 changes: 15 additions & 2 deletions .github/workflows/regtest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,23 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: fix permissions

- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'

- name: Fix permissions
run: mkdir -p regtests/output && chmod 777 regtests/output && chmod 777 regtests/t_*/ref/*

- name: Image build
run: |
./gradlew :polaris-quarkus-server:assemble -Dquarkus.container-image.build=true

- name: Regression Test
env:
AWS_ACCESS_KEY_ID: ${{secrets.AWS_ACCESS_KEY_ID}}
AWS_SECRET_ACCESS_KEY: ${{secrets.AWS_SECRET_ACCESS_KEY}}
run: docker compose up --build --exit-code-from regtest
run: |
docker compose -f regtests/docker-compose.yml up --build --exit-code-from regtest
67 changes: 0 additions & 67 deletions Dockerfile

This file was deleted.

4 changes: 0 additions & 4 deletions helm/polaris/ci/persistence-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,8 @@
#

image:
repository: polaris
tag: latest
pullPolicy: Never

bootstrapMetastoreManager: true

persistenceConfigSecret: polaris-persistence

polarisServerConfig:
Expand Down
2 changes: 0 additions & 2 deletions helm/polaris/ci/simple-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,4 @@
#

image:
repository: polaris
tag: latest
pullPolicy: Never
6 changes: 2 additions & 4 deletions helm/polaris/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,6 @@ spec:
{{- end }}
image: "{{ tpl .Values.image.repository . }}:{{ tpl .Values.image.tag . | default .Chart.Version }}"
imagePullPolicy: {{ tpl .Values.image.pullPolicy . }}
command: ["/app/bin/polaris-service"]
args: ["server", "/app/config/polaris-server.yml"]
{{- if .Values.extraEnv }}
env:
{{- tpl (toYaml .Values.extraEnv) . | nindent 12 }}
Expand All @@ -107,7 +105,7 @@ spec:
{{- end }}
livenessProbe:
httpGet:
path: /healthcheck
path: /q/health/live
port: "polaris-metrics"
scheme: HTTP
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
Expand All @@ -118,7 +116,7 @@ spec:
terminationGracePeriodSeconds: {{ .Values.livenessProbe.terminationGracePeriodSeconds }}
readinessProbe:
httpGet:
path: /healthcheck
path: /q/health/ready
port: "polaris-metrics"
scheme: HTTP
initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
Expand Down
2 changes: 1 addition & 1 deletion helm/polaris/templates/tests/test-connection.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ spec:
- name: wget
image: busybox
command: ['wget']
args: ['{{ include "polaris.fullname" . }}:{{ index .Values.service.ports "polaris-metrics" }}/healthcheck']
args: ['{{ include "polaris.fullname" . }}:{{ index .Values.service.ports "polaris-metrics" }}/q/health']
restartPolicy: Never
2 changes: 1 addition & 1 deletion helm/polaris/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ replicaCount: 1

image:
# -- The image repository to pull from.
repository: localhost:5001/polaris
repository: apache/polaris
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is different, right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Different, but I think apache/polaris is more correct :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly, localhost:5001 is definitely not a good choice. This is only useful if you have a local registry running, but images with that kind of registry are otherwise unusable.

Since @jbonofre created our DockerHub space: https://hub.docker.com/r/apache/polaris, the official polaris image name will be apache/polaris - which expands to docker.io/apache/polaris.

This is the name I'm using consistently in this PR. E.g. if you build the images as of today with ./gradlew assemble -Dquarkus.container-image.build=true you would get the following images loaded in your Docker environment:

  • apache/polaris:latest
  • apache/polaris:1.0.0-incubating-SNAPSHOT
  • apache/polaris-admin-tool:latest
  • apache/polaris-admin-tool:1.0.0-incubating-SNAPSHOT

# -- The image pull policy.
pullPolicy: IfNotPresent
# -- The image tag.
Expand Down
4 changes: 4 additions & 0 deletions quarkus/admin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ dependencies {
implementation(project(":polaris-quarkus-service"))
implementation(project(":polaris-quarkus-defaults"))

if (project.hasProperty("eclipseLinkDeps")) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we are not including any JDBC drivers anymore; we now need this hook.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a fair trade-off to me.

runtimeOnly(project(":polaris-eclipselink"))
}

implementation(enforcedPlatform(libs.quarkus.bom))
implementation("io.quarkus:quarkus-picocli")
implementation("io.quarkus:quarkus-container-image-docker")
Expand Down
4 changes: 4 additions & 0 deletions quarkus/server/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ dependencies {
implementation(project(":polaris-service-common"))
implementation(project(":polaris-quarkus-service"))

if (project.hasProperty("eclipseLinkDeps")) {
runtimeOnly(project(":polaris-eclipselink"))
}

// enforce the Quarkus _platform_ here, to get a consistent and validated set of dependencies
implementation(enforcedPlatform(libs.quarkus.bom))
implementation("io.quarkus:quarkus-container-image-docker")
Expand Down
26 changes: 15 additions & 11 deletions docker-compose.yml → regtests/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@

services:
polaris:
build:
context: .
image: apache/polaris:latest
ports:
- "8181:8181"
- "8181"
- "8182"
environment:
AWS_REGION: us-west-2
Expand All @@ -32,20 +31,25 @@ services:
AZURE_TENANT_ID: $AZURE_TENANT_ID
AZURE_CLIENT_ID: $AZURE_CLIENT_ID
AZURE_CLIENT_SECRET: $AZURE_CLIENT_SECRET
POLARIS_AUTHENTICATION_AUTHENTICATOR_TYPE: test
POLARIS_AUTHENTICATION_TOKEN_SERVICE_TYPE: test
QUARKUS_OTEL_SDK_DISABLED: "true"
polaris.persistence.type: in-memory
polaris.authentication.authenticator.type: test
polaris.authentication.token-service.type: test
polaris.authentication.token-broker.type: symmetric-key
polaris.authentication.token-broker.symmetric-key.secret: polaris
polaris.features.defaults."SUPPORTED_CATALOG_STORAGE_TYPES": '["FILE","S3","GCS","AZURE"]'
polaris.realm-context.realms: default-realm,realm1
quarkus.log.file.enable: false
quarkus.otel.sdk.disabled: "true"
volumes:
- ./regtests/credentials:/tmp/credentials/

- ./credentials:/tmp/credentials/
healthcheck:
test: ["CMD", "curl", "http://localhost:8182/q/health"]
interval: 10s
timeout: 10s
retries: 5
regtest:
build:
context: regtests
context: .
args:
POLARIS_HOST: polaris
depends_on:
Expand All @@ -69,5 +73,5 @@ services:
AWS_CROSS_REGION_BUCKET: $AWS_CROSS_REGION_BUCKET
AWS_ROLE_FOR_CROSS_REGION_BUCKET: $AWS_ROLE_FOR_CROSS_REGION_BUCKET
volumes:
- ./regtests/output:/tmp/polaris-regtests/
- ./regtests/credentials:/tmp/credentials/
- ./output:/tmp/polaris-regtests/
- ./credentials:/tmp/credentials/
Loading