commands

package
v0.0.0-...-f7f3288 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 26, 2023 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const ManagedByStark = "app.kubernetes.io/managed-by=stark"

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildCmd

type BuildCmd struct {
	FileArgs
	ContextArgs

	Format OutputFormat `short:"f" help:"Output format (yaml,json)" default:"yaml"`
	Output string       `short:"o" help:"Write output to a file instead of stdout" type:"path"`
}

func (*BuildCmd) Run

func (cmd *BuildCmd) Run(args *kong.Context) error

type Cli

type Cli struct {
	Debug bool `short:"v" help:"Set log level to DEBUG for more information"`
	Trace bool `help:"Set log level to TRACE for even more information"`

	Build BuildCmd    `cmd:"" help:"Build a stark config and output YAML"`
	Fmt   FmtCmd      `cmd:"" aliases:"format" help:"Format a stark config"`
	Gen   GenerateCmd `cmd:"" aliases:"generate" help:"Generate files from stark configs"`
	Kube  KubeCmd     `cmd:"" aliases:"k" help:"Work with exported Stark bundles in Kubernetes"`

	Pkg PkgCmd `cmd:"" aliases:"p" help:"Work with packages and dependencies"`

	RawKubectl   KubectlCmd      `cmd:"" hidden:"" help:"Manage raw Kubernetes resources without Bundles"`
	ExternalDiff ExternalDiffCmd `cmd:"" hidden:""`
}

type ContextArgs

type ContextArgs struct {
	Version string            `help:"Version of the image to apply, set in ctx['version']"`
	Context map[string]string `help:"Generic values passed to Starlark evaluation in ctx"`
}

func (*ContextArgs) ToStarlark

func (c *ContextArgs) ToStarlark() *starlark.Dict

type ExternalDiffCmd

type ExternalDiffCmd struct {
	FromPath string `arg:""`
	ToPath   string `arg:""`

	IgnoreOrderChanges bool `default:"true"`
	Kubernetes         bool `default:"true"`

	Ignore []string `default:"metadata.managedFields.*"`

	Style string `default:"human"`
}

func (*ExternalDiffCmd) Run

func (cmd *ExternalDiffCmd) Run() error

type FileArgs

type FileArgs struct {
	Files []string `arg:"" help:"Path to stark config file" type:"existingfile"`
}

type FmtCmd

type FmtCmd struct {
	FileArgs

	InPlace bool `short:"i" help:"Overwrite file instead of printing"`
}

func (*FmtCmd) Run

func (cmd *FmtCmd) Run(args *kong.Context) error

type GenerateCmd

type GenerateCmd struct {
	FileArgs
	ContextArgs

	Out string `short:"o" help:"Override output base path, defaults to relative to input file"`
}

func (*GenerateCmd) Run

func (cmd *GenerateCmd) Run(args *kong.Context) error

type GeneratedFile

type GeneratedFile struct {
	Kind     string `yaml:"kind"`
	Filename string `yaml:"filename"`
	Data     string `yaml:"data"`
}

type KubeCfgArgs

type KubeCfgArgs struct {
	Kubectl    string `help:"Path to kubectl CLI"`
	Kubeconfig string `help:"Path to kubernetes config (default: ~/.kube/config)"`
	DiffCmd    string `help:"Command to use for external diff (default: pretty based on dyff)"`
}

func (*KubeCfgArgs) ToCfg

func (args *KubeCfgArgs) ToCfg() kube.KubeCfg

type KubeCmd

type KubeCmd struct {
	List   KubeListCmd   `cmd:"" aliases:"ls" help:"List resources in a Kubernetes bundle"`
	Diff   KubeDiffCmd   `cmd:"" help:"Diff resources in Kubernetes bundle with resources in cluster"`
	Deploy KubeDeployCmd `cmd:"" aliases:"d" help:"Deploy resources in a Kubernetes bundle to the target cluster"`
}

type KubeDeployCmd

type KubeDeployCmd struct {
	KubeCfgArgs
	FileArgs
	ContextArgs

	Watch          bool `short:"w" negatable:"" default:"false" help:"Watch code resources (Deployments) be applied"`
	DryRun         bool `help:"Run a dry-run instead of applying resources"`
	NonInteractive bool `short:"y" help:"Don't prompt, assume yes and deploy"`

	// TODO: use pruning as the default, after kubectl diff --prune is fixed
	Delete bool `help:"Prune old resources which no longer exist in the bundle while deploying"`
}

func (*KubeDeployCmd) Run

func (cmd *KubeDeployCmd) Run(args *kong.Context) error

type KubeDiffCmd

type KubeDiffCmd struct {
	KubeCfgArgs

	ContextArgs
	FileArgs
}

func (*KubeDiffCmd) Run

func (cmd *KubeDiffCmd) Run(args *kong.Context) error

type KubeListCmd

type KubeListCmd struct {
	ContextArgs
	FileArgs
}

func (*KubeListCmd) Run

func (cmd *KubeListCmd) Run(args *kong.Context) error

type KubectlApplyCmd

type KubectlApplyCmd struct {
	ContextArgs
	FileArgs
	DryRun bool `help:"Run a server dry-run instead of applying"`
}

func (*KubectlApplyCmd) Run

func (cmd *KubectlApplyCmd) Run(args *kong.Context) error

type KubectlCmd

type KubectlCmd struct {
	Apply KubectlApplyCmd `cmd:"" aliases:"a" help:"Apply raw resources with kubectl apply"`
	Diff  KubectlDiffCmd  `cmd:"" help:"Diff raw resources with kubectl diff"`
}

type KubectlDiffCmd

type KubectlDiffCmd struct {
	ContextArgs
	FileArgs
}

func (*KubectlDiffCmd) Run

func (cmd *KubectlDiffCmd) Run(args *kong.Context) error

type OutputFormat

type OutputFormat string
const (
	Json OutputFormat = "json"
	Yaml OutputFormat = "yaml"
)

type PkgClearCmd

type PkgClearCmd struct{}

func (*PkgClearCmd) Run

func (cmd *PkgClearCmd) Run() error

type PkgCmd

type PkgCmd struct {
	Init      PkgInitCmd      `cmd:"" aliases:"new,n" help:"Generate a starkcfg.star for the current package"`
	Push      PkgPushCmd      `cmd:"" help:"Push package to a remote repository"`
	FetchDeps PkgFetchDepsCmd `cmd:"" aliases:"fetch,fd" help:"Download all dependencies of this package"`
	Clear     PkgClearCmd     `cmd:"" help:"Delete downloaded dependencies of this package"`
}

type PkgFetchDepsCmd

type PkgFetchDepsCmd struct{}

func (*PkgFetchDepsCmd) Run

func (cmd *PkgFetchDepsCmd) Run() error

type PkgInitCmd

type PkgInitCmd struct {
	Package string `arg:"" help:"Name of the package to create"`
}

func (*PkgInitCmd) Run

func (cmd *PkgInitCmd) Run() error

type PkgPushCmd

type PkgPushCmd struct {
	Destination string `arg:"" help:"Remote reference to push to"`
}

func (*PkgPushCmd) Run

func (cmd *PkgPushCmd) Run() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL