Skip to content

Commit b724582

Browse files
committed
Kubernetes Operator for Nessie
1 parent 07f1359 commit b724582

File tree

193 files changed

+12701
-4
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

193 files changed

+12701
-4
lines changed

Diff for: .github/workflows/ci.yml

+60-4
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,15 @@ jobs:
8080
-x :nessie-quarkus:compileAll \
8181
-x :nessie-server-admin-tool:compileAll \
8282
-x :nessie-events-quarkus:compileAll \
83+
-x :nessie-operator:compileAll \
8384
--scan
8485
8586
- name: Gradle / Compile Quarkus
8687
run: |
8788
# 2 Retries - to mitigate https://github.com/gradle/gradle/issues/25751
88-
./gradlew :nessie-quarkus:compileAll :nessie-server-admin-tool:compileAll :nessie-events-quarkus:compileAll --scan || \
89-
./gradlew :nessie-quarkus:compileAll :nessie-server-admin-tool:compileAll :nessie-events-quarkus:compileAll --scan || \
90-
./gradlew :nessie-quarkus:compileAll :nessie-server-admin-tool:compileAll :nessie-events-quarkus:compileAll --scan
89+
./gradlew :nessie-quarkus:compileAll :nessie-server-admin-tool:compileAll :nessie-events-quarkus:compileAll :nessie-operator:compileAll --scan || \
90+
./gradlew :nessie-quarkus:compileAll :nessie-server-admin-tool:compileAll :nessie-events-quarkus:compileAll :nessie-operator:compileAll --scan || \
91+
./gradlew :nessie-quarkus:compileAll :nessie-server-admin-tool:compileAll :nessie-events-quarkus:compileAll :nessie-operator:compileAll --scan
9192
9293
- name: Gradle / Code checks
9394
run: ./gradlew codeChecks --scan
@@ -124,7 +125,7 @@ jobs:
124125
uses: ./.github/actions/ci-incr-build-cache-prepare
125126

126127
- name: Gradle / test
127-
run: ./gradlew test :nessie-client:check -x :nessie-client:intTest -x :nessie-quarkus:test -x :nessie-server-admin-tool:test -x :nessie-events-quarkus:test --scan
128+
run: ./gradlew test :nessie-client:check -x :nessie-client:intTest -x :nessie-quarkus:test -x :nessie-server-admin-tool:test -x :nessie-events-quarkus:test -x :nessie-operator:test --scan
128129

129130
- name: Capture Test Reports
130131
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4
@@ -170,6 +171,13 @@ jobs:
170171
./gradlew :nessie-events-quarkus:test --scan || \
171172
./gradlew :nessie-events-quarkus:test --scan
172173
174+
- name: Gradle / Test Quarkus Operator
175+
run: |
176+
# 2 Retries - to mitigate https://github.com/gradle/gradle/issues/25751
177+
./gradlew :nessie-operator:test --scan || \
178+
./gradlew :nessie-operator:test --scan || \
179+
./gradlew :nessie-operator:test --scan
180+
173181
- name: Dump quarkus.log
174182
if: ${{ failure() }}
175183
run: |
@@ -230,6 +238,7 @@ jobs:
230238
-x :nessie-quarkus:intTest \
231239
-x :nessie-server-admin-tool:intTest \
232240
-x :nessie-events-quarkus:intTest \
241+
-x :nessie-operator:intTest \
233242
$(cat ../persist-prjs.txt) \
234243
$(cat ../storage-prjs.txt) \
235244
$(cat ../spark-prjs.txt) \
@@ -477,6 +486,52 @@ jobs:
477486
with:
478487
job-name: 'int-test-quarkus-events'
479488

489+
int-test-quarkus-operator:
490+
name: CI intTest Quarkus Operator
491+
runs-on: ubuntu-22.04
492+
steps:
493+
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
494+
- name: Setup runner
495+
uses: ./.github/actions/setup-runner
496+
- name: Setup Java, Gradle
497+
uses: ./.github/actions/dev-tool-java
498+
499+
- name: Prepare Gradle build cache
500+
uses: ./.github/actions/ci-incr-build-cache-prepare
501+
502+
- name: Gradle / intTest Operator
503+
uses: gradle/actions/setup-gradle@v3
504+
with:
505+
arguments: |
506+
:nessie-operator:intTest
507+
--scan
508+
509+
- name: Dump quarkus.log
510+
if: ${{ failure() }}
511+
run: |
512+
find . -path "**/build/quarkus.log" | while read ql ; do
513+
echo "::group::Quarkus build log $ql"
514+
cat $ql
515+
echo "::endgroup::"
516+
done
517+
518+
- name: Capture Test Reports
519+
uses: actions/upload-artifact@v4
520+
if: ${{ failure() }}
521+
with:
522+
name: ci-inttest-operator-reports
523+
path: |
524+
**/build/quarkus.log
525+
**/build/reports/*
526+
**/build/test-results/*
527+
retention-days: 7
528+
529+
- name: Save partial Gradle build cache
530+
uses: ./.github/actions/ci-incr-build-cache-save
531+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
532+
with:
533+
job-name: 'int-test-quarkus-operator'
534+
480535
determine-jobs:
481536
name: CI Determine jobs
482537
runs-on: ubuntu-22.04
@@ -996,6 +1051,7 @@ jobs:
9961051
- int-test-quarkus-server
9971052
- int-test-quarkus-tool
9981053
- int-test-quarkus-events
1054+
- int-test-quarkus-operator
9991055
steps:
10001056
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
10011057
- name: Setup runner

Diff for: NOTICE

+29
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,35 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
220220
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
221221

222222

223+
---
224+
dk.brics.automaton:automaton
225+
226+
Copyright (c) 2001-2022 Anders Moeller
227+
All rights reserved.
228+
229+
Redistribution and use in source and binary forms, with or without
230+
modification, are permitted provided that the following conditions
231+
are met:
232+
1. Redistributions of source code must retain the above copyright
233+
notice, this list of conditions and the following disclaimer.
234+
2. Redistributions in binary form must reproduce the above copyright
235+
notice, this list of conditions and the following disclaimer in the
236+
documentation and/or other materials provided with the distribution.
237+
3. The name of the author may not be used to endorse or promote products
238+
derived from this software without specific prior written permission.
239+
240+
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
241+
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
242+
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
243+
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
244+
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
245+
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
246+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
247+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
248+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
249+
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
250+
251+
223252
---
224253
io.github.crac:org-crac
225254

Diff for: bom/build.gradle.kts

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ dependencies {
5050
api(project(":nessie-minio-testcontainer"))
5151
api(project(":nessie-nessie-testcontainer"))
5252
api(project(":nessie-network-tools"))
53+
api(project(":nessie-operator"))
5354
api(project(":nessie-quarkus-auth"))
5455
api(project(":nessie-quarkus-common"))
5556
api(project(":nessie-server-admin-tool"))

Diff for: gradle/libs.versions.toml

+2
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ quarkus-bom = { module = "io.quarkus.platform:quarkus-bom", version.ref = "quark
132132
quarkus-cassandra-bom = { module = "io.quarkus.platform:quarkus-cassandra-bom", version.ref = "quarkusPlatform" }
133133
quarkus-google-cloud-services-bom = { module = "io.quarkus.platform:quarkus-google-cloud-services-bom", version.ref = "quarkusPlatform" }
134134
quarkus-logging-sentry = { module = "io.quarkiverse.loggingsentry:quarkus-logging-sentry", version = "2.0.7" }
135+
quarkus-operator-sdk-bom = { module = "io.quarkus.platform:quarkus-operator-sdk-bom", version.ref = "quarkusPlatform" }
135136
rest-assured = { module = "io.rest-assured:rest-assured", version = "5.5.0" }
136137
rocksdb-jni = { module = "org.rocksdb:rocksdbjni", version = "9.4.0" }
137138
scala-library-v212 = { module = "org.scala-lang:scala-library", version = { strictly = "[2.12, 2.13[", prefer = "2.12.19" }}
@@ -148,6 +149,7 @@ spark-sql-v34-v212 = { module = "org.apache.spark:spark-sql_2_12", version = { s
148149
spark-sql-v34-v213 = { module = "org.apache.spark:spark-sql_2_13", version = { strictly = "[3.4, 3.5[", prefer = "3.4.3"}}
149150
spark-sql-v35-v212 = { module = "org.apache.spark:spark-sql_2_12", version = { strictly = "[3.5, 3.6[", prefer = "3.5.1"}}
150151
spark-sql-v35-v213 = { module = "org.apache.spark:spark-sql_2_13", version = { strictly = "[3.5, 3.6[", prefer = "3.5.1"}}
152+
sundr-builder-annotations = { module = "io.sundr:builder-annotations", version = "0.103.1" }
151153
testcontainers-bom = { module = "org.testcontainers:testcontainers-bom", version = "1.20.0" }
152154
testcontainers-keycloak = { module = "com.github.dasniko:testcontainers-keycloak", version = "3.4.0" }
153155
threeten-extra = { module = "org.threeten:threeten-extra", version = "1.8.0" }

Diff for: gradle/projects.main.properties

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ nessie-keycloak-testcontainer=testing/keycloak-container
3333
nessie-nessie-testcontainer=testing/nessie-container
3434
nessie-network-tools=tools/network
3535
nessie-object-storage-mock=testing/object-storage-mock
36+
nessie-operator=operator
3637
nessie-quarkus-auth=servers/quarkus-auth
3738
nessie-quarkus-common=servers/quarkus-common
3839
nessie-quarkus=servers/quarkus-server

Diff for: operator/Makefile

+114
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
2+
VERSION ?= $(shell cat ../version.txt | sed -e 's/.*-SNAPSHOT/latest/g')
3+
RELEASE_VERSION ?= $(shell cat ../version.txt | sed -e 's/-SNAPSHOT//g')
4+
5+
# CHANNELS define the bundle channels used in the bundle.
6+
# Add a new line here if you would like to change its default config. (E.g CHANNELS = "candidate,fast,stable")
7+
# To re-generate a bundle for other specific channels without changing the standard setup, you can:
8+
# - use the CHANNELS as arg of the bundle target (e.g make bundle CHANNELS=candidate,fast,stable)
9+
# - use environment variables to overwrite this value (e.g export CHANNELS="candidate,fast,stable")
10+
ifneq ($(origin CHANNELS), undefined)
11+
BUNDLE_CHANNELS := --channels=$(CHANNELS)
12+
endif
13+
14+
# DEFAULT_CHANNEL defines the default channel used in the bundle.
15+
# Add a new line here if you would like to change its default config. (E.g DEFAULT_CHANNEL = "stable")
16+
# To re-generate a bundle for any other default channel without changing the default setup, you can:
17+
# - use the DEFAULT_CHANNEL as arg of the bundle target (e.g make bundle DEFAULT_CHANNEL=stable)
18+
# - use environment variables to overwrite this value (e.g export DEFAULT_CHANNEL="stable")
19+
ifneq ($(origin DEFAULT_CHANNEL), undefined)
20+
BUNDLE_DEFAULT_CHANNEL := --default-channel=$(DEFAULT_CHANNEL)
21+
endif
22+
BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL)
23+
24+
# IMAGE_TAG_BASE defines the docker.io namespace and part of the image name for remote images.
25+
# This variable is used to construct full image tags for bundle and catalog images.
26+
IMAGE_TAG_BASE ?= ghcr.io/projectnessie/nessie-operator
27+
28+
# BUNDLE_IMG defines the image:tag used for the bundle.
29+
# You can use it as an arg. (E.g make bundle-build BUNDLE_IMG=<some-registry>/<project-name-bundle>:<tag>)
30+
BUNDLE_IMG ?= $(IMAGE_TAG_BASE)-bundle:$(VERSION)
31+
32+
# Image URL to use all building/pushing image targets
33+
IMG ?= $(IMAGE_TAG_BASE):$(VERSION)
34+
35+
PULL_POLICY ?= $(shell [ "$(VERSION)" = "latest" ] && echo "Always" || echo "IfNotPresent")
36+
PLATFORM ?= linux/$(shell arch)
37+
38+
all: docker-build
39+
40+
##@ General
41+
42+
# The help target prints out all targets with their descriptions organized
43+
# beneath their categories. The categories are represented by '##@' and the
44+
# target descriptions by '##'. The awk commands is responsible for reading the
45+
# entire set of makefiles included in this invocation, looking for lines of the
46+
# file as xyz: ## something, and then pretty-format the target and help. Then,
47+
# if there's a line with ##@ something, that gets pretty-printed as a category.
48+
# More info on the usage of ANSI control characters for terminal formatting:
49+
# https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters
50+
# More info on the awk command:
51+
# http://linuxcommand.org/lc3_adv_awk.php
52+
53+
help: ## Display this help.
54+
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
55+
56+
##@ Build
57+
58+
docker-build: ## Build docker image with the manager.
59+
../gradlew :nessie-operator:spotlessApply :nessie-operator:clean :nessie-operator:build -x check \
60+
-Dquarkus.container-image.build=true \
61+
-Dquarkus.container-image.image=${IMG} \
62+
-Dquarkus.jib.platforms=${PLATFORM} \
63+
-Dquarkus.kubernetes.prometheus.generate-service-monitor=false \
64+
-Dquarkus.kubernetes.image-pull-policy=${PULL_POLICY}
65+
66+
docker-push: ## Build and push docker image with the manager.
67+
../gradlew :nessie-operator:spotlessApply :nessie-operator:clean :nessie-operator:build -x check \
68+
-Dquarkus.container-image.build=true \
69+
-Dquarkus.container-image.push=true \
70+
-Dquarkus.container-image.image=${IMG} \
71+
-Dquarkus.jib.platforms=${PLATFORM} \
72+
-Dquarkus.kubernetes.prometheus.generate-service-monitor=false \
73+
-Dquarkus.kubernetes.image-pull-policy=${PULL_POLICY}
74+
75+
##@ Deployment
76+
77+
install: ## Install CRDs into the K8s cluster specified in ~/.kube/config.
78+
@$(foreach file, $(wildcard build/kubernetes/*-v1.yml), kubectl apply -f $(file);)
79+
80+
uninstall: ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config.
81+
@$(foreach file, $(wildcard build/kubernetes/*-v1.yml), kubectl delete -f $(file);)
82+
83+
deploy: ## Deploy controller to the K8s cluster specified in ~/.kube/config.
84+
kubectl apply -f build/kubernetes/kubernetes.yml
85+
86+
undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/config.
87+
kubectl delete -f build/kubernetes/kubernetes.yml
88+
89+
##@ Helm
90+
91+
helm-install: ## Install CRDs and the operator using Helm.
92+
helm install nessie-operator build/helm -n nessie-operator
93+
94+
helm-upgrade: ## Upgrade CRDs and the operator using Helm.
95+
helm upgrade nessie-operator build/helm -n nessie-operator
96+
97+
helm-uninstall: ## Uninstall CRDs and the operator using Helm.
98+
helm uninstall nessie-operator -n nessie-operator
99+
100+
##@ Bundle
101+
102+
.PHONY: bundle
103+
bundle: ## Generate bundle manifests and metadata, then validate generated files.
104+
cat build/kubernetes/* | operator-sdk generate bundle -q --overwrite --version $(RELEASE_VERSION) $(BUNDLE_METADATA_OPTS)
105+
operator-sdk bundle validate ./bundle
106+
# TODO use quarkus
107+
108+
.PHONY: bundle-build
109+
bundle-build: ## Build the bundle image.
110+
docker build -f build/bundle/nessie-operator/bundle.Dockerfile -t $(BUNDLE_IMG) build/bundle/nessie-operator
111+
112+
.PHONY: bundle-push
113+
bundle-push: ## Push the bundle image.
114+
docker push $(BUNDLE_IMG)

Diff for: operator/PROJECT

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Code generated by tool. DO NOT EDIT.
2+
# This file is used to track the info used to scaffold your project
3+
# and allow the plugins properly work.
4+
# More info: https://book.kubebuilder.io/reference/project-config.html
5+
domain: projectnessie.org
6+
layout:
7+
- quarkus.javaoperatorsdk.io/v1-alpha
8+
projectName: nessie-operator
9+
resources:
10+
- api:
11+
crdVersion: v1
12+
namespaced: true
13+
domain: projectnessie.org
14+
group: nessie
15+
kind: Nessie
16+
version: v1alpha1
17+
version: "3"

Diff for: operator/README.md

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Kubernetes Operator for Nessie
2+
3+
This module is a Kubernetes Operator for Nessie.
4+
5+
**WARNING: This is a work in progress and is not ready for production use.**
6+
7+
The operator is designed to manage the lifecycle of Nessie instances in a Kubernetes cluster.
8+
9+
This project was bootstrapped using [Operator SDK]:
10+
11+
```bash
12+
operator-sdk init --plugins=quarkus --domain=projectnessie.org --project-name=nessie-operator
13+
operator-sdk create api --plugins=quarkus --group nessie --version=v1alpha1 --kind=Nessie
14+
```
15+
16+
[Operator SDK]:https://sdk.operatorframework.io/docs/cli/operator-sdk/

0 commit comments

Comments
 (0)