Skip to content

Add CREATE DATABASE DDL with Deployer mechanism for K8s Database objects#214

Merged
ryannedolan merged 8 commits intomainfrom
rdolan/create-database
Apr 30, 2026
Merged

Add CREATE DATABASE DDL with Deployer mechanism for K8s Database objects#214
ryannedolan merged 8 commits intomainfrom
rdolan/create-database

Conversation

@ryannedolan
Copy link
Copy Markdown
Collaborator

Summary

  • Added create database ddl

Details

Introduces CREATE [OR REPLACE] DATABASE <name> [WITH (...)] syntax that deploys a Database CRD to Kubernetes via the Deployer pattern. Includes parser, executor, shared processCreateDatabase util, K8sDatabaseDeployer, and quidem test with !specify support.

Testing Done

> create database "mydb" WITH (url 'jdbc:mysql://localhost:3306/mydb', driver 'com.mysql.cj.jdbc.Driver', schema 'myschema', dialect 'MySQL');

produces:

apiVersion: hoptimator.linkedin.com/v1alpha1
kind: Database
metadata:
  name: mydb
spec:
  dialect: MySQL
  driver: com.mysql.cj.jdbc.Driver
  schema: myschema
  url: jdbc:mysql://localhost:3306/mydb

Introduces CREATE [OR REPLACE] DATABASE <name> [WITH (...)] syntax that
deploys a Database CRD to Kubernetes via the Deployer pattern. Includes
parser, executor, shared processCreateDatabase util, K8sDatabaseDeployer,
and quidem test with !specify support.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 28, 2026

Code Coverage

Overall Project 84.33% -0.23% 🟢
Files changed 72.4% 🟢

File Coverage
K8sDatabaseDeployer.java 100% 🟢
K8sDeployerProvider.java 100% 🟢
HoptimatorDdlExecutor.java 92.71% -3.26%
HoptimatorDdlUtils.java 85.34% -1.73% 🟢
DatabaseDeployable.java 78.95% -21.05% 🟢

ryannedolan and others added 4 commits April 27, 2026 22:33
SQL parser uppercases unquoted identifiers, so WITH (url '...') produces
key "URL". Use a case-insensitive TreeMap in K8sDatabaseDeployer and fix
expected config key casing in the CREATE JOB quidem test.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
SnakeYAML serializes Java enums by name (MYSQL) not value (MySQL).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ryannedolan ryannedolan enabled auto-merge (squash) April 30, 2026 17:33
Copy link
Copy Markdown
Collaborator

@jogrogan jogrogan left a comment

Choose a reason for hiding this comment

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

lgtm but please add unit tests for any non-generated parser code. There should be existing example for unit testing deployers and HoptimatorDdlUtils and whatnot

@ryannedolan
Copy link
Copy Markdown
Collaborator Author

@copilot can you add the unit tests referenced above

…sDeployerProvider

Agent-Logs-Url: https://github.com/linkedin/Hoptimator/sessions/b448a07f-580a-40c3-a885-a6b2a53fcf25

Co-authored-by: ryannedolan <1387539+ryannedolan@users.noreply.github.com>
auto-merge was automatically disabled April 30, 2026 20:22

Head branch was pushed to by a user without write access

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 30, 2026

lgtm but please add unit tests for any non-generated parser code. There should be existing example for unit testing deployers and HoptimatorDdlUtils and whatnot

Added unit tests in commit be4a9ba:

  • K8sDatabaseDeployerTest (11 tests) — covers toK8sObject() behaviors: URL required, case-insensitive option lookup (the d8e73a1 fix), all options populated (driver/schema/catalog/dialect), dialect enum validation, API interactions, YAML output format, and name canonicalization.
  • processCreateDatabase tests in HoptimatorDdlUtilsTest (5 tests) — covers compound name rejection, SPECIFY mode empty specs, viewPath content, no-options handling, and specifyFromSql routing.
  • K8sDeployerProviderTest (1 test) — verifies DatabaseDeployable routes to K8sDatabaseDeployer.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • checkstyle.org
    • Triggering command: /opt/hostedtoolcache/CodeQL/2.25.1/x64/codeql/tools/linux64/java/bin/java /opt/hostedtoolcache/CodeQL/2.25.1/x64/codeql/tools/linux64/java/bin/java -jar /opt/hostedtoolcache/CodeQL/2.25.1/x64/codeql/xml/tools/xml-extractor.jar --fileList=/tmp/codeql-scratch-c2bb8f7fb6eb8b71/dbs/java/working/files-to-index10062266869957039771.list --sourceArchiveDir=/tmp/codeql-scratch-c2bb8f7fb6eb8b71/dbs/java/src --outputDir=/tmp/codeql-scratch-c2bb8f7fb6eb8b71/dbs/java/trap/java (dns block)
  • linkedin.jfrog.io
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED -XX:MaxMetaspaceSize=384m -XX:&#43;HeapDumpOnOutOfMemoryError -Xms256m -Xmx512m -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@ryannedolan
Copy link
Copy Markdown
Collaborator Author

@copilot fix checkstyle errors:

Error: eckstyle] [ERROR] /home/runner/work/Hoptimator/Hoptimator/hoptimator-k8s/src/test/java/com/linkedin/hoptimator/k8s/K8sDatabaseDeployerTest.java:6:8: Unused import - com.linkedin.hoptimator.k8s.models.V1alpha1DatabaseSpec. [UnusedImports]

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 30, 2026

@copilot fix checkstyle errors:

...

Fixed in commit 7c43c74 — removed the unused V1alpha1DatabaseSpec import.

@ryannedolan ryannedolan enabled auto-merge (squash) April 30, 2026 21:35
@ryannedolan ryannedolan requested a review from jogrogan April 30, 2026 21:35
Copy link
Copy Markdown
Collaborator

@jogrogan jogrogan left a comment

Choose a reason for hiding this comment

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

LGTM

@ryannedolan ryannedolan merged commit 403f38e into main Apr 30, 2026
1 check passed
@ryannedolan ryannedolan deleted the rdolan/create-database branch April 30, 2026 21:48
jogrogan pushed a commit that referenced this pull request May 1, 2026
…cts (#214)

* Add CREATE DATABASE DDL with Deployer mechanism for K8s Database objects

Introduces CREATE [OR REPLACE] DATABASE <name> [WITH (...)] syntax that
deploys a Database CRD to Kubernetes via the Deployer pattern. Includes
parser, executor, shared processCreateDatabase util, K8sDatabaseDeployer,
and quidem test with !specify support.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Fix case-insensitive option lookup in deployers

SQL parser uppercases unquoted identifiers, so WITH (url '...') produces
key "URL". Use a case-insensitive TreeMap in K8sDatabaseDeployer and fix
expected config key casing in the CREATE JOB quidem test.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Fix expected dialect enum serialization in quidem test

SnakeYAML serializes Java enums by name (MYSQL) not value (MySQL).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Add unit tests for K8sDatabaseDeployer, processCreateDatabase, and K8sDeployerProvider

Agent-Logs-Url: https://github.com/linkedin/Hoptimator/sessions/b448a07f-580a-40c3-a885-a6b2a53fcf25

Co-authored-by: ryannedolan <1387539+ryannedolan@users.noreply.github.com>

* Address code review feedback: rename test methods and fix comment grammar

Agent-Logs-Url: https://github.com/linkedin/Hoptimator/sessions/b448a07f-580a-40c3-a885-a6b2a53fcf25

Co-authored-by: ryannedolan <1387539+ryannedolan@users.noreply.github.com>

* Remove unused V1alpha1DatabaseSpec import from K8sDatabaseDeployerTest

Agent-Logs-Url: https://github.com/linkedin/Hoptimator/sessions/975eee55-ade8-4ede-b3d8-70015a063e28

Co-authored-by: ryannedolan <1387539+ryannedolan@users.noreply.github.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: ryannedolan <1387539+ryannedolan@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants