Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var VersionList = []Version{ {"apps/v1", "Deployment", false}, {"extensions/v1beta1", "Deployment", true}, {"apps/v1beta2", "Deployment", true}, {"apps/v1beta1", "Deployment", true}, {"apps/v1beta1", "StatefulSet", true}, {"apps/v1beta2", "StatefulSet", true}, {"networking.k8s.io/v1", "NetworkPolicy", false}, {"extensions/v1beta1", "NetworkPolicy", true}, {"apps/v1beta2", "DaemonSet", true}, {"extensions/v1beta1", "DaemonSet", true}, {"policy/v1beta1", "PodSecurityPolicy", false}, {"extensions/v1beta1", "PodSecurityPolicy", true}, {"extensions/v1beta1", "ReplicaSet", true}, {"apps/v1beta1", "ReplicaSet", true}, {"apps/v1beta2", "ReplicaSet", true}, }
VersionList is a set of apiVersions and if they are deprecated or not. TODO: Find a better way to generate this. Currently using the list for 1.16 from here: https://kubernetes.io/blog/2019/07/18/api-deprecations-in-1-16/
Functions ¶
func DisplayOutput ¶
DisplayOutput prints the output based on desired variables
Example ¶
_ = DisplayOutput([]*Output{testOutput1, testOutput2}, "tabular", false)
Output: KIND VERSION DEPRECATED RESOURCE NAME Deployment extensions/v1beta1 true some name two
Example (BadFormat) ¶
_ = DisplayOutput([]*Output{testOutput1}, "foo", true)
Output: output format should be one of (json,yaml,tabular)
Example (Json) ¶
_ = DisplayOutput([]*Output{testOutput1}, "json", true)
Output: [{"file":"some name one","api":{"version":"apps/v1","kind":"Deployment"}}]
Example (NoOutput) ¶
_ = DisplayOutput([]*Output{testOutput1}, "tabular", false)
Output: APIVersions were found, but none were deprecated. Try --show-non-deprecated.
Example (ShowNonDeprecated) ¶
_ = DisplayOutput([]*Output{testOutput1}, "tabular", true)
Output: KIND VERSION DEPRECATED RESOURCE NAME Deployment apps/v1 false some name one
Example (Yaml) ¶
_ = DisplayOutput([]*Output{testOutput1}, "yaml", true)
Output: - file: some name one api: version: apps/v1 kind: Deployment
Example (ZeroLength) ¶
_ = DisplayOutput([]*Output{}, "tabular", false)
Output: There were no apiVersions found that match our records.
Types ¶
type Output ¶
type Output struct {
Name string `json:"file,omitempty" yaml:"file,omitempty"`
APIVersion *Version `json:"api,omitempty" yaml:"api,omitempty"`
}
Output is a thing that has an apiVersion in it
func IsVersioned ¶
IsVersioned returns a version if the file data sent can be unmarshaled into a stub and matches a known version in the VersionList
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"`
}
StubMeta will catch kube resource metadata
type Version ¶
type Version struct {
// Name is the name of the api version
Name string `json:"version,omitempty" yaml:"version,omitempty"`
// Kind is the kind of object associated with this version
Kind string `json:"kind,omitempty" yaml:"kind,omitempty"`
// Deprecated is a boolean that indicates if the apiVersion is deprecated
Deprecated bool `json:"deprecated,omitempty" yaml:"deprecated,omitempty"`
}
Version is an apiVersion and a flag for deprecation
Click to show internal directories.
Click to hide internal directories.