Documentation
¶
Index ¶
Examples ¶
- Instance (PrintVersionsTabular)
- Instance.DisplayOutput (Custom)
- Instance.DisplayOutput (Json)
- 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",
}
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:"-"`
OnlyShowRemoved 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-- COMPONENT--
Deployment-- extensions/v1beta1-- v1.9.0--------- v1.16.0----- apps/v1------ k8s--------
testkind---- testname------------ n/a------------ n/a--------- n/a---------- custom-----
func (*Instance) DisplayOutput ¶
func (instance *Instance) DisplayOutput() error
DisplayOutput prints the output based on desired variables
Example (Custom) ¶
Output:
NAME----------- NAMESPACE-------- KIND-------- VERSION------------- REPLACEMENT-- DEPRECATED-- DEPRECATED IN-- COMPONENT-- FILEPATH------
some name one-- pluto-namespace-- Deployment-- extensions/v1beta1-- apps/v1------ true-------- v1.9.0--------- foo-------- path-to-file--
some name two-- <UNKNOWN>-------- Deployment-- extensions/v1beta1-- apps/v1------ true-------- v1.9.0--------- 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","component":"foo"},"deprecated":true,"removed":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","component":"foo"},"deprecated":true,"removed":true}],"target-versions":{"foo":"v1.16.0"}}
Example (NoOutput) ¶
Output: No output to display
Example (Normal) ¶
Output:
NAME-------------------- KIND-------- VERSION------------- REPLACEMENT-- REMOVED-- DEPRECATED--
some name one----------- Deployment-- extensions/v1beta1-- apps/v1------ true----- true--------
some name two----------- Deployment-- extensions/v1beta1-- apps/v1------ true----- true--------
deprecated not removed-- Deployment-- apps/v1------------- none--------- false---- true--------
Example (OnlyShowRemoved) ¶
Output:
NAME----------- KIND-------- VERSION------------- REPLACEMENT-- REMOVED-- DEPRECATED--
some name one-- Deployment-- extensions/v1beta1-- apps/v1------ true----- true--------
some name two-- Deployment-- extensions/v1beta1-- apps/v1------ true----- true--------
Example (Wide) ¶
Output:
NAME----------- NAMESPACE-------- KIND-------- VERSION------------- REPLACEMENT-- DEPRECATED-- DEPRECATED IN-- REMOVED-- REMOVED IN--
some name one-- pluto-namespace-- Deployment-- extensions/v1beta1-- apps/v1------ true-------- v1.9.0--------- true----- v1.16.0-----
some name two-- <UNKNOWN>-------- Deployment-- extensions/v1beta1-- apps/v1------ true-------- v1.9.0--------- true----- v1.16.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
component: foo
deprecated: true
removed: 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
component: foo
deprecated: true
removed: true
target-versions:
foo: v1.16.0
Example (ZeroLength) ¶
Output: There were no resources found with known deprecated apiVersions.
func (*Instance) FilterOutput ¶
func (instance *Instance) FilterOutput()
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
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|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","component":"k8s"}]}
Example (Normal) ¶
Output:
KIND-------- NAME---------------- DEPRECATED IN-- REMOVED IN-- REPLACEMENT-- COMPONENT--
Deployment-- extensions/v1beta1-- v1.9.0--------- v1.16.0----- apps/v1------ k8s--------
Example (Wide) ¶
Output:
KIND-------- NAME---------------- DEPRECATED IN-- REMOVED IN-- REPLACEMENT-- COMPONENT--
Deployment-- extensions/v1beta1-- v1.9.0--------- v1.16.0----- apps/v1------ 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
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"`
// CustomColumns is a list of column headers to be displayed when -ocustom
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"`
}
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"`
// 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() ([]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