GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat: libkubara and controller-gen for automated CRD generation by tuunit · Pull Request #628 · kubara-io/kubara

Conversation

@tuunit

@tuunit tuunit commented Sep 17, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Summary

This PR replaces Kubara's internal templating, directory walking, and manual configuration validation with libkubara and introduces controller-gen for handling clean and correct CRD generation.

What changed

  • Replaced custom template parsing and directory tree walking in render.go with libkubara/template and tree.
  • Replaced hand-written defaults and validation in defaults.go and store.go with controller-gen/kubebuilder comments and CEL rules on PlatformSetup.
  • Integarted libkubara/crdvalidate to validate configurations against the embedded CRD during creation and transitions.
  • Added migration logic to upgrade older configuration files to the new PlatformSetup schema.

Why the ratio of deletions to insertions is not larger

Looking at this PR or running git diff HEAD~7 --shortstat you might notice that the ratio of insertions and deletions is nearly 1-to-1 and you might think:

I would have expected a larger difference in the insertion to deletion ratio.

While this PR deletes LARGE chunks of internal code it also introduces a lot of new logic and features. First and foremost controller-gen for automated less error prone CRD management.

Additionally this PR contains a lot of changes that aren't go code changes which offset the "real" ratio even more:

  • Generated CRD yaml: The CRD manifest at src/internal/config/crd/kubara.io_platformsetups.yaml adds 244 lines of auto-generated yaml.
  • Controller-gen comments: Adding controller-gen requires a lot of +kubebuilder directives and doc comments in src/internal/config/types.go to define schemas, enums, defaults, and CEL rules.
  • CRD and migration code: We a new migration step in src/internal/config/migrate.go to handle older config formats.
  • New tests: We added new tests in src/internal/config/crd_test.go to cover schema validation and transitions.
  • Dependencies and tooling: Tooling changes added new lines between go.mod, go.sum, CI workflows, and Makefiles.

"Real" diff breakdown

Filter Insertions Deletions Net change
Raw diff +1030 -1167 -137
Without generated CRD YAML +776 -1167 -391
Go files only +690 -1090 -400
Go code only, without comments or blank lines +567 -924 -357
Replaced engine files and tests: render, store, defaults +201 -976 -775

Commands to verify the numbers

Diff without the generated CRD manifest:

git diff HEAD~8 --shortstat -- ':(exclude)*kubara.io_platformsetups.yaml'

Diff for Go files only:

git diff HEAD~8 --shortstat -- '*.go'

Count added Go code lines, without comments or blank lines:

git diff HEAD~8 -U0 -- '*.go' | grep -E '^\+([^+]|$)' | grep -v -E '^\+[[:space:]]*(//|/\*|\*|$)' | wc -l

Count deleted Go code lines, without comments or blank lines:

git diff HEAD~8 -U0 -- '*.go' | grep -E '^-([^-]|$)' | grep -v -E '^-[[:space:]]*(//|/\*|\*|$)' | wc -l

Diff on the exact files replaced by libkubara and controller-gen:

git diff HEAD~8 --shortstat -- \
  src/internal/render/render.go \
  src/internal/config/store.go \
  src/internal/config/store_test.go \
  src/internal/config/defaults.go \
  src/internal/config/defaults_test.go

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@tuunit
tuunit requested a review from a team September 17, 2026 10:06
tuunit
tuunit commented Sep 17, 2026
View reviewed changes
Comment thread src/internal/config/crd/kubara.io_platformsetups.yaml
@@ -0,0 +1,244 @@
---

@tuunit tuunit Sep 17, 2026

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

NOTE: this file is auto generated by make generate and the workflow tests that it is up-to-date

the actual source for this yaml definition is our config located in:
src/internal/config/types.go

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@tuunit
tuunit marked this pull request as draft September 17, 2026 14:11
@tuunit tuunit changed the title feat: libkubara feat: libkubara and controller-gen for automated CRD generation Sep 17, 2026
@tuunit
tuunit force-pushed the feat/libkubara branch from e0efc91 to 74bcb86 Compare September 17, 2026 14:20
@tuunit
tuunit marked this pull request as ready for review September 17, 2026 14:59
@tuunit
tuunit force-pushed the feat/libkubara branch from 74bcb86 to f247354 Compare October 5, 2026 06:45
@LSchu

LSchu commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

@tuunit still reviewing this, could you please rebase/solve the merge conflicts in the meantime?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@tuunit
tuunit force-pushed the feat/libkubara branch from c29c7eb to e69f487 Compare October 8, 2026 11:40
@LSchu

LSchu commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

with the new format all fields are sorted alphabetically instead of the custom fixed order we generated before.
This results in

    ssoOrg: none
    ssoTeam: none
    stage: demo
    type: hub

coming after the big services list, which makes it harder to see all relevant settings for a cluster at a glance.
Should we bundle all options except services, for example under .config?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@tuunit
tuunit force-pushed the feat/libkubara branch 3 times, most recently from c51c3d4 to 50e20e9 Compare November 5, 2026 12:38
@tuunit
tuunit added this pull request to stack #706 November 5, 2026 13:21
@tuunit
tuunit force-pushed the feat/libkubara branch from 50e20e9 to 8f77fb8 Compare November 5, 2026 13:23
tuunit and others added 4 commits November 10, 2026 16:25
@tuunit
feat: libkubara
34bda14
revert: unnecessary none pointer for the helm repository which would have caused empty field on file persistence

feat: introduction of controller-gen for reduce maintaince effort and deduplication of validation

feat(controller-gen): first autogenerated crd for the platform setup config

chore: remove deadcode

ci(libkubara): fix config patching for new CRD based syntax

fix: ensure defaulting for helmRepo.url

chore: upgrade libkubara for k8s compatability

Signed-off-by: Jan Larwig <[email protected]>
@tuunit
ci: add libkubara support while keeping backwards compatibility
2af6d2a
Signed-off-by: Jan Larwig <[email protected]>
@tuunit
fix: apiVersion and kubebuilder comments
886a8f0
Signed-off-by: Jan Larwig <[email protected]>
@tuunit
fix(local): increase grafana limits
6232332
Signed-off-by: Jan Larwig <[email protected]>
@tuunit
tuunit force-pushed the feat/libkubara branch from 0a89be6 to 6232332 Compare November 10, 2026 15:25
@tuunit
tuunit merged commit 6232332 into main Nov 10, 2026
5 of 8 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@tuunit
tuunit deleted the feat/libkubara branch November 10, 2026 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@tuunit @LSchu
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.