Repository navigation
refactor: move code to internal/ - #462
Merged
Merged
Conversation
thde
added this pull request to stack #459
September 17, 2026 11:06
…lication The application flags of both the create and the update command interpolate the same defaults and help texts, which create. ApplicationKongVars provided and update imported create for. The variables describe the application resource, not the create verb, so they move to internal/application as application.KongVars together with DefaultReplicas, the one create constant they reference. main and the tests of create and update call the new function. Part of #352.
The bucket flags of the create and the update command interpolate the same role list and flag syntax examples, which create.BucketKongVars provided and update imported create for. They describe the bucket resource, so they move to internal/bucket as bucket.KongVars. The update-only examples for the delete flags stay in update.BucketKongVars. create loses the bucketRoles variable and the stringSlice helper, which only the moved function used. Part of #352.
Both are kong value types: LabelSelector decodes a label query into a metav1.LabelSelector and LocalReference decodes a name into a meta.LocalReference. Neither carries any resource-specific logic, but they were declared in create next to the first command which used them, which forced the update verb to import create for its service connection and opensearch commands. They move to the new package internal/flag, which holds the kong value types more than one command declares. The LabelSelector test moves with the type and LocalReference gets one. Part of #352.
…l/serviceconnection KubernetesClusterOptions declares the --source-pod-selector and --source-namespace-selector flags which the service connection create and update commands both embed, and converts them to the API type. It was declared in create, which forced update to import the create verb. It moves to the new package internal/serviceconnection rather than to an internal/kubernetescluster package: the type is the flag form of networking.KubernetesClusterOptions, a field of the service connection's Source, and configures how a cluster acts as the source of a connection. It is not a property of the KubernetesCluster resource. The label_selector_* kong variables its help interpolates move along as serviceconnection.KongVars, so that the type works wherever it is embedded; create.ServiceConnectionKongVars keeps the allowed source and destination kinds, which only the create flags interpolate. main merges both. The new package gets a test which parses real arguments through kong. Part of #352.
The cloudvm, mysql and postgres commands of both create and update read SSH public keys from the same flags and files: SSHKeysFlags and DeprecatedKeysFlags declare the flags, ReadAuthorizedKeys and ParseAuthorizedKeys validate the keys in the authorized_keys format, AnyFile tells a passed file flag from a nil entry, and StorageKeysWithDeprecatedFile converts them to the storage API type. All of it was declared in create, which was the last reason for update to import the create verb. It moves unchanged to the new package internal/sshkey, deprecation warnings included. The verb-specific flag structs stay where they are: create keeps DatabaseSSHKeysFlags, update keeps OptionalSSHKeysFlags and its own DatabaseSSHKeysFlags, both now embedding or calling sshkey. The tests of the moved code move with it and the package gets tests of its own for ReadAuthorizedKeys, StorageKeysWithDeprecatedFile and the flag names the embedded structs register under a prefix. The command level tests stay in create and update. update no longer imports any verb package, so the last entry of allowedVerbImports is removed and the map is empty. Closes the last verb-to-verb import of #352.
thde
force-pushed
the
thde/352-05-update-create
branch
from
October 6, 2026 08:23
46c109b to
7422f13
Compare
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.
This MR moves shared code between
createandupdateinto their own internal packages.