-
Notifications
You must be signed in to change notification settings - Fork 40
Feat: AIAC Event Broker + Keycloak SPI listener (phase 2, PR 2) #754
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
Changes from 49 commits
dd31fa4
9041072
ad90b0a
eb85ee3
371ac40
b565000
e4601e8
f17aee4
092853d
0905561
425a8b1
9266f60
bee62e6
20a71eb
37bd3d0
4efbe29
9401264
aa2411e
b85f514
f1c7366
58f225e
9d3a36e
1c8372e
199da88
c92cb89
432a884
087d19b
8013618
316c8f7
3b05cdb
2639f81
f1e6ae4
677d103
591b433
091c0bf
24e855e
e2d37eb
bc5fdcf
2233b70
113bcf9
ba30155
cf5bf7d
9f79b42
37223c8
b55011f
1c3e319
89374fe
010215f
21bd3f0
1611ca1
c9540a1
80a44c4
ac78321
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| --- | ||
| apiVersion: apps/v1 | ||
| kind: Deployment | ||
| metadata: | ||
| name: aiac-event-broker | ||
| namespace: aiac-system | ||
| spec: | ||
| replicas: 1 | ||
| selector: | ||
| matchLabels: | ||
| app: aiac-event-broker | ||
| template: | ||
| metadata: | ||
| labels: | ||
| app: aiac-event-broker | ||
| spec: | ||
| containers: | ||
| - name: nats | ||
| image: nats:2.14-alpine | ||
| imagePullPolicy: IfNotPresent | ||
| args: ["-js", "-sd", "/data/jetstream"] | ||
| ports: | ||
| - containerPort: 4222 | ||
| volumeMounts: | ||
| - name: jetstream-data | ||
| mountPath: /data/jetstream | ||
| volumes: | ||
| - name: jetstream-data | ||
| emptyDir: {} | ||
|
coderabbitai[bot] marked this conversation as resolved.
coderabbitai[bot] marked this conversation as resolved.
Comment on lines
+60
to
+71
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift Use persistent storage for JetStream data.
🤖 Prompt for AI Agents
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Deliberately deferred rather than fixed as suggested — see clawgenti's adjacent comment on this same line, which asked for the lighter fix (a comment documenting the tradeoff) instead of a PVC. Went with that: kept There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The finding remains valid while JetStream uses 🐇 ✏️ Learnings added
You are interacting with an AI system.
omerboehm marked this conversation as resolved.
|
||
|
|
||
| --- | ||
| apiVersion: v1 | ||
| kind: Service | ||
| metadata: | ||
| name: aiac-event-broker-service | ||
| namespace: aiac-system | ||
| spec: | ||
| selector: | ||
| app: aiac-event-broker | ||
| ports: | ||
| - name: nats | ||
| port: 4222 | ||
| targetPort: 4222 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| target/ | ||
| .idea/ | ||
| .vscode/ | ||
| .git/ | ||
| .gitignore | ||
| *.iml | ||
| README.md | ||
| Makefile |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| # Maven build output — regenerated by `mvn package`, never committed. | ||
| target/ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| # syntax=docker/dockerfile:1.7 | ||
|
|
||
| ARG KEYCLOAK_IMAGE=quay.io/keycloak/keycloak:26.6.3 | ||
|
|
||
| # Stage 1: build the SPI JAR (shaded — bundles jnats, since it isn't on Keycloak's classpath). | ||
| FROM maven:3.9-eclipse-temurin-17 AS jar-builder | ||
| WORKDIR /build | ||
| COPY pom.xml . | ||
| COPY src ./src | ||
| RUN --mount=type=cache,target=/root/.m2 mvn -B -DskipTests package | ||
|
|
||
| # Stage 2: drop the JAR into Keycloak and run `kc.sh build` so the augmented server is baked | ||
| # into the final image (no per-pod build at startup). | ||
| FROM ${KEYCLOAK_IMAGE} AS keycloak-builder | ||
| COPY --from=jar-builder /build/target/aiac-event-listener-*.jar /opt/keycloak/providers/ | ||
| RUN /opt/keycloak/bin/kc.sh build | ||
|
|
||
| # Stage 3: final runtime image — copy the augmented Keycloak from stage 2. | ||
| FROM ${KEYCLOAK_IMAGE} | ||
| COPY --from=keycloak-builder /opt/keycloak/ /opt/keycloak/ | ||
| ENTRYPOINT ["/opt/keycloak/bin/kc.sh"] | ||
| CMD ["start"] | ||
|
omerboehm marked this conversation as resolved.
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| SPI_VERSION := 0.1.0 | ||
| KEYCLOAK_VERSION := 26.6.3 | ||
|
|
||
| JAR := target/aiac-event-listener-$(SPI_VERSION).jar | ||
|
|
||
| REGISTRY ?= ghcr.io/rossoctl/cortex | ||
| IMAGE ?= aiac-keycloak-event-listener | ||
| IMAGE_TAG ?= $(SPI_VERSION)-kc$(KEYCLOAK_VERSION) | ||
| IMAGE_REF := $(REGISTRY)/$(IMAGE):$(IMAGE_TAG) | ||
|
|
||
| # Auto-detect if the 'docker' client is using a Podman backend. | ||
| IS_PODMAN_DETECT := $(shell docker info 2>/dev/null | grep -q "/var/lib/containers/storage" && echo "true") | ||
| ifeq ($(DOCKER_IS_PODMAN),) | ||
| DOCKER_IS_PODMAN := $(IS_PODMAN_DETECT) | ||
| endif | ||
|
|
||
| PLATFORMS ?= linux/amd64,linux/arm64 | ||
|
|
||
| HOST_ARCH := $(shell uname -m) | ||
| ifeq ($(HOST_ARCH),x86_64) | ||
| HOST_PLATFORM := linux/amd64 | ||
| else ifeq ($(HOST_ARCH),aarch64) | ||
| HOST_PLATFORM := linux/arm64 | ||
| else ifeq ($(HOST_ARCH),arm64) | ||
| HOST_PLATFORM := linux/arm64 | ||
| else | ||
| HOST_PLATFORM := linux/amd64 | ||
| endif | ||
|
|
||
| .PHONY: all package test clean image push install-info | ||
|
|
||
| all: package | ||
|
|
||
| package: $(JAR) | ||
|
|
||
| $(JAR): | ||
| mvn package | ||
|
|
||
| test: | ||
| mvn test | ||
|
|
||
| clean: | ||
| mvn clean | ||
|
|
||
| image: | ||
| @if [ "$(DOCKER_IS_PODMAN)" = "true" ]; then \ | ||
| echo "Info: Podman backend detected."; \ | ||
| fi | ||
| docker buildx build \ | ||
| --platform $(PLATFORMS) \ | ||
| --build-arg KEYCLOAK_IMAGE=quay.io/keycloak/keycloak:$(KEYCLOAK_VERSION) \ | ||
| -t $(IMAGE_REF) . | ||
| docker buildx build \ | ||
| --platform $(HOST_PLATFORM) \ | ||
| --build-arg KEYCLOAK_IMAGE=quay.io/keycloak/keycloak:$(KEYCLOAK_VERSION) \ | ||
| -t $(IMAGE_REF) --load . | ||
| @echo "Built $(IMAGE_REF) for $(PLATFORMS) (loaded $(HOST_PLATFORM) locally)" | ||
|
|
||
| push: | ||
| docker buildx build \ | ||
| --platform $(PLATFORMS) \ | ||
| --build-arg KEYCLOAK_IMAGE=quay.io/keycloak/keycloak:$(KEYCLOAK_VERSION) \ | ||
| -t $(IMAGE_REF) --push . | ||
| @echo "Pushed $(IMAGE_REF) for $(PLATFORMS)" | ||
|
|
||
| install-info: | ||
| @echo "JAR-only install:" | ||
| @echo " Copy $(JAR) into your Keycloak/RHBK providers directory, then run:" | ||
| @echo " kc.sh build" | ||
| @echo " and restart Keycloak." | ||
| @echo | ||
| @echo "Custom image install:" | ||
| @echo " make push # builds and pushes $(IMAGE_REF)" | ||
| @echo " Override the Keycloak image in your Helm values / Operator CR to: $(IMAGE_REF)" | ||
| @echo " (this repo does not manage that Helm chart — see README.md)" |
Uh oh!
There was an error while loading. Please reload this page.