cli-utils/docs/dy
Phillip Wittrock 38e1577c1f Add support for dynamic commands published by CRDs 2019-07-31 14:57:01 -07:00
..
sample Add support for dynamic commands published by CRDs 2019-07-31 14:57:01 -07:00
README.md Add support for dynamic commands published by CRDs 2019-07-31 14:57:01 -07:00

README.md

Dynamic Commands

Dynamic Commands are server-side defined Commands published to the client as CRD annotations containing ResourceCommandList objects.

Sample

List the Commands from the cli

No Dynamic Commands will be present.

cli-experimental -h

Create the CRD that publishes Commands

Create a CRD that publishes Dynamic Commands.

kubectl apply -f .sample/cli_v1alpha1_clitestresource.yaml

List the Commands from the cli

New cli-experimental create deployment Command will now appear in help

cli-experimental -h
cli-experimental create -h
cli-experimental deployment -h

Run the Command in dry-run

Run the command, but print the Resources rather than creating them.

cli-experimental create deployment --image ubuntu --name foo --dry-run

Run the Command

Run the command to create the Resources.

cli-experimental create deployment --image ubuntu --name foo

Publishing a Command

Define the ResourceCommandList in a yaml file

See the dynamic.v1alpha1 API for documentation.

Add the ResourceCommandList to a CRD

Build the dy command

go build ./util/dy
dy add-commands path/to/commands.yaml path/to/crd.yaml

Apply the CRD

kubectl apply -f path/to/crd.yaml

Run the new Command

cli-experimental your command -h