Repository navigation
feat: first version of aisix-controller in Go - #2
Merged
Merged
Conversation
…of rejected resources
An APIKey or ProviderKey that pointed at the controller's own Secret read the generated file back as a credential, so every write changed the next one and the gateway rolled forever. The Secret is now kept out of credential sources and such references are rejected.
References were resolved through every ProviderKey's display_name before duplicates were rejected, so a Model pointing at the losing ProviderKey of a shared display_name was accepted and silently used the winner's credential. Such references are now rejected and name both ProviderKeys.
A rejected update fell back to the served entry found under its new display_name, so an edit that both renamed a resource and carried a rejected value dropped the working entry. The Secret now stores an index of which resource owns each entry, and fallbacks look up the resource. A new resource can no longer inherit a deleted resource's entry by sharing its display_name.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
This was referenced Nov 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
The first version of aisix-controller, in Go (controller-runtime). It reconciles
ProviderKey,ModelandAPIKeycustom resources (aisix.api7.ai/v1alpha1) into a standalone AISIX gateway's resources file.How it works
metadata.name.$is escaped, because the file interpolates${VAR}in every string.aisix validatefrom the same aisix release, bundled in the image and run with an empty environment.Accepted=Falsewith the gateway's message.aisix-resourcesSecret, and its hash is stamped on the gateway Deployment's pod template to roll the pods. The gateway reloads the file only at boot or on SIGHUP.Programmed=Trueonce every ready gateway pod reports the written file's SHA-256 asapplied.config_hashon/status/config.CRD schemas are generated (
cmd/crdgen) from the strict JSON Schemas of aisix v1.9.0, vendored underthird_party/aisix. Rules a structural schema cannot hold, such asoneOfbranches andif/then, are still enforced byaisix validate.Commits
Each commit builds and passes
go vetand the unit tests:Tests
make test: unit tests plus envtest suites (k8s 1.36.2) for reconcile, status conditions, the hash check and the manager wiring.make test-aisix: render, assemble and validate tests against the real aisix v1.9.0 binary, including a cross-field rule only the gateway enforces.make e2e: a kind cluster with the AISIX 1.9.0 Helm chart (2 replicas), the controller and a mock upstream. All 8 cases pass:$;make lintandmake crds-checkare clean.Limitations