Repository navigation
[deckhouse-cli] Push with editions, docs, queue http draft - #500
Merged
Merged
Conversation
Signed-off-by: Pavel Okhlopkov <pavel.okhlopkov@flant.com>
Signed-off-by: Pavel Okhlopkov <pavel.okhlopkov@flant.com>
Signed-off-by: Pavel Okhlopkov <pavel.okhlopkov@flant.com>
Signed-off-by: Pavel Okhlopkov <pavel.okhlopkov@flant.com>
Signed-off-by: Pavel Okhlopkov <pavel.okhlopkov@flant.com>
Signed-off-by: Pavel Okhlopkov <pavel.okhlopkov@flant.com>
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.
Description
This PR bundles four changes:
d8 mirror pushto an edition repo puts the edition-independent installer and d8 CLI one level above the edition, where the Deckhouse registry keeps them.csebecomes a recognized edition.d8 system queue list|main --httpreads the queues through the API server (pods/portforward) instead of exec'ing curl in the Deckhouse pod.d8 system api(hidden) is a client for the runtime API of the Deckhouse controller (/api/v1, Module v2), with typed structures for every route.docs/are rewritten in one strict format, andinternal/system/README.mddocuments the new flag and command.1. Mirror push to an edition repo
When the push target ends with an edition (
ce,be,se,se-plus,ee,fe,cse),installer/anddeckhouse-cli/(the binary, its plugins and the plugins index) go to the root above it, and everything else stays under the target. This is the default, there is no flag. A path that is only an edition (registry.example.com/ee) is not split: it names a project calledee, the same rule the registry-packages-proxy applies.registry.example.com/deckhouse/eeregistry.example.com/deckhouse/ee/...(unchanged)installer/registry.example.com/deckhouse/installerdeckhouse-cli/,deckhouse-cli/plugins/<name>registry.example.com/deckhouse/deckhouse-cli,.../deckhouse-cli/plugins/<name>SplitTargetEditionandPushService.clientFor(internal/mirror/push.go). Push announces it withTarget is the EE edition repo: installer and deckhouse-cli are pushed outside it, to registry.example.com/deckhouse.pkg.CSEEditionjoinspkg.Edition, sod8 mirror pullfrom.../deckhouse/csealso reads the installer and d8 CLI from the root above it and reports the edition as CSE.--include-modulehelp now says that release-channel versions are added on top of a constraint range without being checked against it, so an upper bound does not apply to them. A new test case pins that behaviour.2.
d8 system queue list|main --http--http, d8 opens the leader pod'spods/portforward(WebSockets with an SPDY fallback, like kubectl) and sendsGET /queue/list.<format>to the controller's debug server on127.0.0.1:9652itself. Nothing runs in the container. Without the flag the exec path is unchanged.pods/proxycannot do this: the debug server listens on loopback only, and the kube-rbac-proxy that publishes it on:4204never receives the user's token, because the API server drops theAuthorizationheader before proxying.--watchkeeps one tunnel open and redials, looking up the leader again, after a failed refresh. Ctrl+C now also cancels a fetch in flight, on the exec path too.EOF.create pods/portforwardind8-systeminstead ofcreate pods/exec; with user-authz that is theportForwardingswitch.3.
d8 system api(hidden)One leaf per route of the controller's runtime API (
deckhouse-controller/internal/packages/api), which exists only withDECKHOUSE_ENABLE_MODULE_V2=true, hence the hidden command:healthz,readyz,endpoints,metrics/healthz,/readyz,/endpoints,/metricspprof <name> [--seconds] [--debug]/debug/pprof/<name>queues dump [--name],scheduler dump [--name],requirements dump/api/v1/{queues,scheduler,requirements}/dumppackages dump [--name],packages global dump,packages render <name>,packages snapshots <name>/api/v1/packages/...get <path>pods/proxysubresource of the leader pod to the controller's HTTP listener, which binds the pod IP on portself(4222); a port-forward dials localhost and cannot reach it. The transport sends the request throughrest.HTTPClientFor, becauserest.Requestdrops the body and status of the controller's plain-text error answers. An error of the API server itself, such as a refused permission, still comes back as a Kubernetes error.--podqueries a replica other than the leader.8010976436does not serve/api/v1/packagesover HTTP yet, so there thepackagescommands answer 404.-o yaml(the default) orjsonexactly as the controller encodes them.-o textgives summary tables for queues, the scheduler and packages.errors.Is(apiclient/errors.go). A non-2xx answer is aStatusErrorthat unwraps toErrNotFound(404),ErrBadRequest(400) orErrServerError(5xx). A dump that answersnullfor a name isErrUnknownPackage, and the global module before initialization isErrGlobalNotLoaded.ErrNotReady,ErrNoLeaderandErrNoSelfPortcover readiness and the pod lookup.internal/system/cmd/api/apiclient/types.gomirrors every answer at deckhouse main8010976436: queues, scheduler nodes and decisions, requirements, applications and modules with status, conditions, the nelm progress report, definitions, licensing and repository, the global module, and hook snapshots with informer counters. The client has one typed method per route.4. Docs
docs/mirror-bundle-layout.md,docs/mirror-pull-dry-run.md,docs/plugins.mdanddocs/self-update.mdshare one format now: scope and an "as of" date, RFC 2119 roles, a reference to the implementing code for every rule, troubleshooting, and a final "Known deviations" section that lists behaviour, verified by running d8, that breaks the contract (13, 9, 19 and 18 items). The deviations are documented, not fixed, in this PR.docs/mirror-bundle-layout.md§2.9 describes the edition split.internal/system/README.mddocuments--http, the new access path andd8 system api.Why do we need it, and what problem does it solve?
d8 mirror pullreads the installer anddeckhouse-clifrom the root above the edition repo, and the in-cluster registry-packages-proxy looks fordeckhouse-clithere too, but push wrote them under the edition (.../deckhouse/ee/installer). A later pull from such a mirror skipped them, and the cluster's proxy could not finddeckhouse-cliand its plugins.queue --http. The exec path needspods/execand curl in the image, prints an HTTP error body as if it were the dump (curl runs without--failand its stderr is dropped), and starts a new exec every second in--watch. The HTTP path needs neither, reports HTTP and kubelet errors, and reuses one connection.d8 system api. Module v2 gave the controller a new HTTP API (/api/v1), and d8 had no client for it. This command covers every route and fixes the wire format in typed structures that other commands, such asd8 status, can reuse.What is the expected result?
d8 s api queues dump -o textagainst the test fixtures:Checklist
queue --httpand theapitransports were checked by hand on a cluster, see Verified.)queue --httpand theapitransports; the edition push is covered by unit tests.)