Documentation
¶
Index ¶
Examples ¶
- Instance (PrintVersionsTabular)
- Instance (PrintVersionsTabular_noHeaders)
- Instance.DisplayOutput (Csv)
- Instance.DisplayOutput (Csv_customcolumns)
- Instance.DisplayOutput (Csv_noHeaders)
- Instance.DisplayOutput (Custom)
- Instance.DisplayOutput (Json)
- Instance.DisplayOutput (Markdown)
- Instance.DisplayOutput (Markdown_customcolumns)
- Instance.DisplayOutput (NoOutput)
- Instance.DisplayOutput (Normal)
- Instance.DisplayOutput (OnlyShowRemoved)
- Instance.DisplayOutput (Wide)
- Instance.DisplayOutput (Yaml)
- Instance.DisplayOutput (ZeroLength)
- Instance.PrintVersionList (Badformat)
- Instance.PrintVersionList (Json)
- Instance.PrintVersionList (Normal)
- Instance.PrintVersionList (Wide)
- Instance.PrintVersionList (Yaml)
Constants ¶
This section is empty.
Variables ¶
var PossibleColumnNames = []string{
"NAME",
"FILEPATH",
"NAMESPACE",
"KIND",
"VERSION",
"REPLACEMENT",
"DEPRECATED",
"DEPRECATED IN",
"REMOVED",
"REMOVED IN",
"COMPONENT",
"REPL AVAIL",
"REPL AVAIL IN",
}
PossibleColumnNames is the list of implmented columns
Functions ¶
func IsFileOrStdin ¶
func IsFileOrStdin(name string) bool
IsFileOrStdin detects if a file exists, or returns true if - is passed
func StringInSlice ¶
func StringInSlice(s string, slice []string) bool
StringInSlice returns true if the string is contained in the slice
Types ¶
type Instance ¶
type Instance struct {
Outputs []*Output `json:"items,omitempty" yaml:"items,omitempty"`
IgnoreDeprecations bool `json:"-" yaml:"-"`
IgnoreRemovals bool `json:"-" yaml:"-"`
IgnoreUnavailableReplacements bool `json:"-" yaml:"-"`
OnlyShowRemoved bool `json:"-" yaml:"-"`
NoHeaders bool `json:"-" yaml:"-"`
OutputFormat string `json:"-" yaml:"-"`
TargetVersions map[string]string `json:"target-versions,omitempty" yaml:"target-versions,omitempty"`
DeprecatedVersions []Version `json:"-" yaml:"-"`
CustomColumns []string `json:"-" yaml:"-"`
Components []string `json:"-" yaml:"-"`
}
Instance is an instance of the API. This holds configuration for a "run" of Pluto
Example (PrintVersionsTabular) ¶
Output:
KIND-------- NAME---------------- DEPRECATED IN-- REMOVED IN-- REPLACEMENT-- REPL AVAIL IN-- COMPONENT--
Deployment-- extensions/v1beta1-- v1.9.0--------- v1.16.0----- apps/v1------ v1.10.0-------- k8s--------
testkind---- testname------------ n/a------------ n/a--------- n/a---------- n/a------------ custom-----
Example (PrintVersionsTabular_noHeaders) ¶
Output:
Deployment-- extensions/v1beta1-- v1.9.0-- v1.16.0-- apps/v1-- v1.10.0-- k8s-----
testkind---- testname------------ n/a----- n/a------ n/a------ n/a------ custom--
func (*Instance) DisplayOutput ¶
func (instance *Instance) DisplayOutput() error
DisplayOutput prints the output based on desired variables
Example (Csv) ¶
Output:
NAME,NAMESPACE,KIND,VERSION,REPLACEMENT,DEPRECATED,DEPRECATED IN,REMOVED,REMOVED IN,REPL AVAIL,REPL AVAIL IN
some name one,pluto-namespace,Deployment,extensions/v1beta1,apps/v1,true,v1.9.0,true,v1.16.0,true,v1.10.0
some name two,<UNKNOWN>,Deployment,extensions/v1beta1,apps/v1,true,v1.9.0,true,v1.16.0,true,v1.10.0
Example (Csv_customcolumns) ¶
Output:
NAMESPACE,NAME,DEPRECATED IN,DEPRECATED,REPLACEMENT,VERSION,KIND,COMPONENT,FILEPATH
pluto-namespace,some name one,v1.9.0,true,apps/v1,extensions/v1beta1,Deployment,foo,path-to-file
<UNKNOWN>,some name two,v1.9.0,true,apps/v1,extensions/v1beta1,Deployment,foo,<UNKNOWN>
Example (Csv_noHeaders) ¶
Output:
some name one,pluto-namespace,Deployment,extensions/v1beta1,apps/v1,true,v1.9.0,true,v1.16.0,true,v1.10.0
some name two,<UNKNOWN>,Deployment,extensions/v1beta1,apps/v1,true,v1.9.0,true,v1.16.0,true,v1.10.0
Example (Custom) ¶
Output:
NAMESPACE-------- NAME----------- DEPRECATED IN-- DEPRECATED-- REPLACEMENT-- VERSION------------- KIND-------- COMPONENT-- FILEPATH------
pluto-namespace-- some name one-- v1.9.0--------- true-------- apps/v1------ extensions/v1beta1-- Deployment-- foo-------- path-to-file--
<UNKNOWN>-------- some name two-- v1.9.0--------- true-------- apps/v1------ extensions/v1beta1-- Deployment-- foo-------- <UNKNOWN>-----
Example (Json) ¶
Output:
{"items":[{"name":"some name one","filePath":"path-to-file","namespace":"pluto-namespace","api":{"version":"extensions/v1beta1","kind":"Deployment","deprecated-in":"v1.9.0","removed-in":"v1.16.0","replacement-api":"apps/v1","replacement-available-in":"v1.10.0","component":"foo"},"deprecated":true,"removed":true,"replacementAvailable":true},{"name":"some name two","api":{"version":"extensions/v1beta1","kind":"Deployment","deprecated-in":"v1.9.0","removed-in":"v1.16.0","replacement-api":"apps/v1","replacement-available-in":"v1.10.0","component":"foo"},"deprecated":true,"removed":true,"replacementAvailable":true}],"target-versions":{"foo":"v1.16.0"}}
Example (Markdown) ¶
Output:
| NAME | NAMESPACE | KIND | VERSION | REPLACEMENT | DEPRECATED | DEPRECATED IN | REMOVED | REMOVED IN | REPL AVAIL | REPL AVAIL IN |
|---------------|-----------------|------------|--------------------|-------------|------------|---------------|---------|------------|------------|---------------|
| some name one | pluto-namespace | Deployment | extensions/v1beta1 | apps/v1 | true | v1.9.0 | true | v1.16.0 | true | v1.10.0 |
| some name two | <UNKNOWN> | Deployment | extensions/v1beta1 | apps/v1 | true | v1.9.0 | true | v1.16.0 | true | v1.10.0 |
Example (Markdown_customcolumns) ¶
Output:
| NAMESPACE | NAME | DEPRECATED IN | DEPRECATED | REPLACEMENT | VERSION | KIND | COMPONENT | FILEPATH |
|-----------------|---------------|---------------|------------|-------------|--------------------|------------|-----------|--------------|
| pluto-namespace | some name one | v1.9.0 | true | apps/v1 | extensions/v1beta1 | Deployment | foo | path-to-file |
| <UNKNOWN> | some name two | v1.9.0 | true | apps/v1 | extensions/v1beta1 | Deployment | foo | <UNKNOWN> |
Example (NoOutput) ¶
Output: No output to display
Example (Normal) ¶
Output:
NAME-------------------- KIND-------- VERSION------------- REPLACEMENT-- REMOVED-- DEPRECATED-- REPL AVAIL--
some name one----------- Deployment-- extensions/v1beta1-- apps/v1------ true----- true-------- true--------
some name two----------- Deployment-- extensions/v1beta1-- apps/v1------ true----- true-------- true--------
deprecated not removed-- Deployment-- apps/v1------------- none--------- false---- true-------- false-------
Example (OnlyShowRemoved) ¶
Output:
NAME----------- KIND-------- VERSION------------- REPLACEMENT-- REMOVED-- DEPRECATED-- REPL AVAIL--
some name one-- Deployment-- extensions/v1beta1-- apps/v1------ true----- true-------- true--------
some name two-- Deployment-- extensions/v1beta1-- apps/v1------ true----- true-------- true--------
Example (Wide) ¶
Output:
NAME----------- NAMESPACE-------- KIND-------- VERSION------------- REPLACEMENT-- DEPRECATED-- DEPRECATED IN-- REMOVED-- REMOVED IN-- REPL AVAIL-- REPL AVAIL IN--
some name one-- pluto-namespace-- Deployment-- extensions/v1beta1-- apps/v1------ true-------- v1.9.0--------- true----- v1.16.0----- true-------- v1.10.0--------
some name two-- <UNKNOWN>-------- Deployment-- extensions/v1beta1-- apps/v1------ true-------- v1.9.0--------- true----- v1.16.0----- true-------- v1.10.0--------
Example (Yaml) ¶
Output:
items:
- name: some name one
filePath: path-to-file
namespace: pluto-namespace
api:
version: extensions/v1beta1
kind: Deployment
deprecated-in: v1.9.0
removed-in: v1.16.0
replacement-api: apps/v1
replacement-available-in: v1.10.0
component: foo
deprecated: true
removed: true
replacementAvailable: true
- name: some name two
api:
version: extensions/v1beta1
kind: Deployment
deprecated-in: v1.9.0
removed-in: v1.16.0
replacement-api: apps/v1
replacement-available-in: v1.10.0
component: foo
deprecated: true
removed: true
replacementAvailable: true
target-versions:
foo: v1.16.0
Example (ZeroLength) ¶
Output: There were no resources found with known deprecated apiVersions.
func (*Instance) FilterOutput ¶ added in v5.10.0
func (instance *Instance) FilterOutput()
FilterOutput filters the outputs that get printed first it fills out the Deprecated and Removed booleans then it returns the outputs that are either deprecated or removed and in the component list additionally, if instance.OnlyShowDeprecated is true, it will remove the apiVersions that are deprecated but not removed
func (*Instance) GetReturnCode ¶
func (instance *Instance) GetReturnCode() int
GetReturnCode checks for deprecated versions and returns a code. takes a boolean to ignore any errors. exit 2 - version deprecated exit 3 - version removed exit 4 - replacement is unavailable in target version
func (*Instance) IsVersioned ¶
func (instance *Instance) IsVersioned(data []byte) ([]*Output, error)
IsVersioned returns a version if the file data sent can be unmarshaled into a stub and matches a known version in the VersionList
func (*Instance) PrintVersionList ¶
func (instance *Instance) PrintVersionList(outputFormat string) error
PrintVersionList prints out the list of versions in a specific format
Example (Badformat) ¶
Output: The output format must one of (normal|wide|json|yaml)
Example (Json) ¶
Output:
{"deprecated-versions":[{"version":"extensions/v1beta1","kind":"Deployment","deprecated-in":"v1.9.0","removed-in":"v1.16.0","replacement-api":"apps/v1","replacement-available-in":"v1.10.0","component":"k8s"}]}
Example (Normal) ¶
Output:
KIND-------- NAME---------------- DEPRECATED IN-- REMOVED IN-- REPLACEMENT-- REPL AVAIL IN-- COMPONENT--
Deployment-- extensions/v1beta1-- v1.9.0--------- v1.16.0----- apps/v1------ v1.10.0-------- k8s--------
Example (Wide) ¶
Output:
KIND-------- NAME---------------- DEPRECATED IN-- REMOVED IN-- REPLACEMENT-- REPL AVAIL IN-- COMPONENT--
Deployment-- extensions/v1beta1-- v1.9.0--------- v1.16.0----- apps/v1------ v1.10.0-------- k8s--------
Example (Yaml) ¶
Output:
deprecated-versions:
- version: extensions/v1beta1
kind: Deployment
deprecated-in: v1.9.0
removed-in: v1.16.0
replacement-api: apps/v1
replacement-available-in: v1.10.0
component: k8s
type Output ¶
type Output struct {
// Name is the name of the object in question.
// This might be an object name, or a release
Name string `json:"name,omitempty" yaml:"name,omitempty"`
// FilePath is the full path of the file if the output came from a file
FilePath string `json:"filePath,omitempty" yaml:"filePath,omitempty"`
// Namespace is the namespace that the object is in
// The output may resolve this to UNKNOWN if there is no way of determining it
Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
// APIVersion is the version object corresponding to this output
APIVersion *Version `json:"api,omitempty" yaml:"api,omitempty"`
// Deprecated is a boolean indicating whether or not the version is deprecated
Deprecated bool `json:"deprecated" yaml:"deprecated"`
// Removed is a boolean indicating whether or not the version has been removed
Removed bool `json:"removed" yaml:"removed"`
// ReplacementAvailable is a boolean indicating whether or not the replacement is available
ReplacementAvailable bool `json:"replacementAvailable" yaml:"replacementAvailable"`
// CustomColumns is a list of column headers to be displayed with -ocustom or -omarkdown
CustomColumns []string `json:"-" yaml:"-"`
}
Output is a thing that has an apiVersion in it
type Stub ¶
type Stub struct {
Kind string `json:"kind" yaml:"kind"`
APIVersion string `json:"apiVersion" yaml:"apiVersion"`
Metadata StubMeta `json:"metadata" yaml:"metadata"`
Items []Stub `json:"items" yaml:"items"`
}
Stub is a stub of a Kubernetes manifest that has just the name and apiVersion
type StubMeta ¶
type StubMeta struct {
Name string `json:"name" yaml:"name"`
Namespace string `json:"namespace" yaml:"namespace"`
}
StubMeta will catch kube resource metadata
type Version ¶
type Version struct {
// Name is the name of the api version
Name string `json:"version" yaml:"version"`
// Kind is the kind of object associated with this version
Kind string `json:"kind" yaml:"kind"`
// DeprecatedIn is a string that indicates what version the api is deprecated in
// an empty string indicates that the version is not deprecated
DeprecatedIn string `json:"deprecated-in" yaml:"deprecated-in"`
// RemovedIn denotes the version that the api was actually removed in
// An empty string indicates that the version has not been removed yet
RemovedIn string `json:"removed-in" yaml:"removed-in"`
// ReplacementAPI is the apiVersion that replaces the deprecated one
ReplacementAPI string `json:"replacement-api" yaml:"replacement-api"`
// ReplacementAvailableIn is the version in which the replacement api is available
ReplacementAvailableIn string `json:"replacement-available-in" yaml:"replacement-available-in"`
// Component is the component associated with this version
Component string `json:"component" yaml:"component"`
}
Version is an apiVersion and a flag for deprecation
func CombineAdditionalVersions ¶
func CombineAdditionalVersions(additional []Version, defaults []Version) ([]Version, error)
CombineAdditionalVersions adds additional versions into the defaults. If the additional versions contain any that already exist in the defaults, return an error
func GetDefaultVersionList ¶
func GetDefaultVersionList(versionFileData []byte) ([]Version, map[string]string, error)
GetDefaultVersionList gets the default versions from the versions.yaml file
func UnMarshalVersions ¶
func UnMarshalVersions(data []byte) ([]Version, map[string]string, error)
UnMarshalVersions reads data from a versions file and returns the versions If included, it will also return the map of targetVersions
type VersionFile ¶
type VersionFile struct {
DeprecatedVersions []Version `json:"deprecated-versions" yaml:"deprecated-versions"`
TargetVersions map[string]string `json:"target-versions,omitempty" yaml:"target-versions,omitempty"`
}
VersionFile is a file with a list of deprecated versions