Documentation ¶
Index ¶
- Constants
- Variables
- func JsonnetVM(opt ...JsonnetVMOpt) (*jsonnet.VM, error)
- func ReadObjects(vm *jsonnet.VM, paths []string, opts ...utils.ReadOption) ([]*unstructured.Unstructured, error)
- type DeleteCmd
- type DiffCmd
- type EvalCmd
- type HttpdCmd
- type JsonnetVMOpt
- func WithAlpha(enable bool) JsonnetVMOpt
- func WithImportPath(importPath ...string) JsonnetVMOpt
- func WithImportURLs(importURLs ...string) JsonnetVMOpt
- func WithResolver(typ ResolverType, failureMode ResolverFailureAction) JsonnetVMOpt
- func WithVar(v vars.Var) JsonnetVMOpt
- func WithWorkingDir(dir string) JsonnetVMOpt
- type K8sMetadata
- type K8sResource
- type PackCmd
- type ResolverFailureAction
- type ResolverType
- type ShowCmd
- type TracebackCmd
- type UpdateCmd
- type ValidateCmd
Constants ¶
const ( ProvenanceFileAnnotation = "kubecfg.github.com/provenance-file" ProvenancePathAnnotation = "kubecfg.github.com/provenance-path" )
const ( // AnnotationOrigObject annotation records the resource as it // was most recently specified by kubecfg (serialised to // JSON). This is used as input to the strategic-merge-patch // 3-way merge when performing updates. AnnotationOrigObject = "kubecfg.ksonnet.io/last-applied-configuration" // AnnotationGcTag annotation that triggers // garbage collection. Objects with value equal to // command-line flag that are *not* in config will be deleted. // // NB: this is in phase1 of a migration to use a label instead. // At this stage, both label+migration are written, but the // annotation (only) is still used to trigger GC. [gctag-migration] AnnotationGcTag = LabelGcTag // LabelGcTag label that triggers garbage collection. Objects // with value equal to command-line flag that are *not* in // config will be deleted. // // NB: this is in phase1 of a migration from an annotation. // At this stage, both label+migration are written, but the // annotation (only) is still used to trigger GC. [gctag-migration] LabelGcTag = "kubecfg.ksonnet.io/garbage-collect-tag" // AnnotationGcStrategy controls gc logic. Current values: // `auto` (default if absent) - do garbage collection // `ignore` - never garbage collect this object AnnotationGcStrategy = "kubecfg.ksonnet.io/garbage-collect-strategy" // GcStrategyAuto is the default automatic gc logic GcStrategyAuto = "auto" // GcStrategyIgnore means this object should be ignored by garbage collection GcStrategyIgnore = "ignore" )
const ( // DefaultFileNameFormat is a Go template expression used to generate the filenames when // running the `show --export-dir` command. DefaultFileNameFormat = `{{.apiVersion}}.{{.kind}}-{{default "default" .metadata.namespace}}.{{.metadata.name}}` )
Variables ¶
var DiffKeyValue = regexp.MustCompile(`"([-._a-zA-Z0-9]+)":\s"([[:alnum:]=+]+)",?`)
var DiffLineStart = regexp.MustCompile("(^|\n)(.)")
Matches all the line starts on a diff text, which is where we put diff markers and indent
var ErrDiffFound = fmt.Errorf("Differences found.")
Functions ¶
func JsonnetVM ¶ added in v0.29.1
func JsonnetVM(opt ...JsonnetVMOpt) (*jsonnet.VM, error)
JsonnetVM constructs a new jsonnet.VM, according to command line flags
func ReadObjects ¶ added in v0.29.1
func ReadObjects(vm *jsonnet.VM, paths []string, opts ...utils.ReadOption) ([]*unstructured.Unstructured, error)
ReadObjects evaluates all jsonnet files in paths and return all the k8s objects found in it. Unlike utils.Read this checks for duplicates and flattens the v1 Lists.
Types ¶
type DeleteCmd ¶ added in v0.6.0
type DeleteCmd struct { Client dynamic.Interface Mapper meta.RESTMapper Discovery discovery.DiscoveryInterface DefaultNamespace string GracePeriod int64 }
DeleteCmd represents the delete subcommand
func (DeleteCmd) Run ¶ added in v0.6.0
func (c DeleteCmd) Run(ctx context.Context, apiObjects []*unstructured.Unstructured) error
type DiffCmd ¶ added in v0.6.0
type DiffCmd struct { Client dynamic.Interface Mapper meta.RESTMapper DefaultNamespace string OmitSecrets bool DiffStrategy string }
DiffCmd represents the diff subcommand
func (DiffCmd) Run ¶ added in v0.6.0
func (c DiffCmd) Run(ctx context.Context, apiObjects []*unstructured.Unstructured, out io.Writer) error
type HttpdCmd ¶ added in v0.29.0
type HttpdCmd struct {
ListenAddr string
}
HttpdCmd represents the eval subcommand
type JsonnetVMOpt ¶ added in v0.29.1
type JsonnetVMOpt func(*jsonnetVMOpts)
func WithAlpha ¶ added in v0.29.1
func WithAlpha(enable bool) JsonnetVMOpt
func WithImportPath ¶ added in v0.29.1
func WithImportPath(importPath ...string) JsonnetVMOpt
func WithImportURLs ¶ added in v0.29.1
func WithImportURLs(importURLs ...string) JsonnetVMOpt
func WithResolver ¶ added in v0.29.1
func WithResolver(typ ResolverType, failureMode ResolverFailureAction) JsonnetVMOpt
func WithVar ¶ added in v0.29.1
func WithVar(v vars.Var) JsonnetVMOpt
func WithWorkingDir ¶ added in v0.29.1
func WithWorkingDir(dir string) JsonnetVMOpt
type K8sMetadata ¶ added in v0.30.0
type K8sResource ¶ added in v0.30.0
type K8sResource struct {
Metadata K8sMetadata `json:"metadata"`
}
type PackCmd ¶ added in v0.29.0
type PackCmd struct { OutputFile string InsecureRegistry bool // use HTTP if true DocsTarFile string }
PackCmd represents the eval subcommand
type ResolverFailureAction ¶ added in v0.29.1
type ResolverFailureAction int
const ( IgnoreResolverError ResolverFailureAction = iota WarnResolverError ReportResolverError )
type ResolverType ¶ added in v0.29.1
type ResolverType int
const ( NoopResolver ResolverType = iota RegistryResolver )
type ShowCmd ¶ added in v0.6.0
type ShowCmd struct { // OutputFormat is either "yaml" or "json". OutputFormat string // ExportDir is an optional name of a directory. If not set, the show command // will output all the resource concatenated to stdout. Otherwise, it will // create one file per resource, using the fileNameTemplate Go template to derive // the filename from the resource. ExportDir string // contains filtered or unexported fields }
ShowCmd represents the show subcommand
func NewShowCmd ¶ added in v0.23.0
NewShowCmd builds a ShowCmd initialized with its parameters. FileNameFormat will be parsed as a Go template and any template format error will be returned here.
func (ShowCmd) Run ¶ added in v0.6.0
func (c ShowCmd) Run(apiObjects []*unstructured.Unstructured, out io.Writer) error
type TracebackCmd ¶ added in v0.30.0
type TracebackCmd struct {
ShowAll bool
}
TracebackCmd represents the traceback subcommand
type UpdateCmd ¶
type UpdateCmd struct { Client dynamic.Interface Mapper meta.RESTMapper Discovery discovery.DiscoveryInterface DefaultNamespace string Create bool GcTag string GcTagsFromInput bool GcNamespace string SkipGc bool DryRun bool }
UpdateCmd represents the update subcommand
func (UpdateCmd) Run ¶
func (c UpdateCmd) Run(ctx context.Context, apiObjects []*unstructured.Unstructured) error
Run executes the update command
type ValidateCmd ¶ added in v0.6.0
type ValidateCmd struct { Mapper meta.RESTMapper Discovery discovery.DiscoveryInterface IgnoreUnknown bool }
ValidateCmd represents the validate subcommand
func (ValidateCmd) Run ¶ added in v0.6.0
func (c ValidateCmd) Run(apiObjects []*unstructured.Unstructured, out io.Writer) error