Documentation
¶
Index ¶
- Constants
- Variables
- func CompareResolvedResources(a *ResolvedType, b *ResolvedType) *diff.JsonDiff
- func CompareResolvedResourcesHelper(a *ResolvedType, b *ResolvedType, pathContext []string, diffs *diff.JsonDiff)
- func CondensedResource(apiVersion string, resolvedType *ResolvedType, allowPath func([]string) bool) string
- func GetSpecsRootDirectory() string
- func IsPrefixOf[A comparable](xs []A, ys []A) bool
- func MakePathFromKubeVersion(version KubeVersion) string
- func MustDownloadSwaggerSpec(version KubeVersion) []byte
- func ParseRef(ref string) string
- func RunCompareResource(args *CompareResourceArgs)
- func RunExplain(args *ExplainArgs)
- func RunRootSchemaCommand()
- func RunShowResources(args *ShowResourcesArgs)
- func RunVersionCommand()
- func SetupCompareResourceCommand() *cobra.Command
- func SetupConfigCommand() *cobra.Command
- func SetupExplainCommand() *cobra.Command
- func SetupRootSchemaCommand() *cobra.Command
- func SetupShowResourcesCommand() *cobra.Command
- func SetupVersionCommand() *cobra.Command
- func ShowResources(groupBy ShowResourcesGroupBy, versions []string, ...) string
- func TableResource(resolvedType *ResolvedType, allowPath func([]string) bool) string
- type CompareResourceArgs
- type ExplainArgs
- type GVK
- type KubeSpec
- func (s *KubeSpec) MustGetDefinition(name string) *SpecType
- func (s *KubeSpec) ResolveStructure() map[string]map[string]*ResolvedType
- func (s *KubeSpec) Visit(visit func(path Path, resolved *ResolvedType, circular string)) (map[string]*ResolvedType, map[string]map[string]*ResolvedType)
- func (s *KubeSpec) VisitSpecType(resolvedTypes map[string]*ResolvedType, path Path, specType *SpecType, ...) *ResolvedType
- type KubeVersion
- type Path
- type PivotTable
- type ResolvedObject
- type ResolvedType
- type RootSchemaFlags
- type ShowResourcesArgs
- type ShowResourcesGroupBy
- type SpecPath
- type SpecType
Constants ¶
View Source
const (
DataDirEnvVar = "KUBECTL_SCHEMA_DATA_DIRECTORY"
)
Variables ¶
View Source
var ( GithubOpenapiURLTemplate = "https://raw.githubusercontent.com/kubernetes/kubernetes/v%s/api/openapi-spec/swagger.json" // LatestKubePatchVersionStrings records the latest known patch versions for each minor version // these version numbers come from https://github.com/kubernetes/kubernetes/tree/master/CHANGELOG LatestKubePatchVersionStrings = []string{ "1.5.8", "1.6.13", "1.7.16", "1.8.15", "1.9.11", "1.10.13", "1.11.10", "1.12.10", "1.13.12", "1.14.10", "1.15.12", "1.16.15", "1.17.17", "1.18.20", "1.19.16", "1.20.15", "1.21.14", "1.22.17", "1.23.17", "1.24.17", "1.25.16", "1.26.15", "1.27.15", "1.28.11", "1.29.6", "1.30.2", "1.31.0-alpha.3", } LatestKubePatchVersions = slice.Map(MustVersion, LatestKubePatchVersionStrings) )
View Source
var (
CompareKubeVersion = slice.ComparePairwise[string]()
)
Functions ¶
func CompareResolvedResources ¶
func CompareResolvedResources(a *ResolvedType, b *ResolvedType) *diff.JsonDiff
func CompareResolvedResourcesHelper ¶
func CompareResolvedResourcesHelper(a *ResolvedType, b *ResolvedType, pathContext []string, diffs *diff.JsonDiff)
func CondensedResource ¶
func CondensedResource(apiVersion string, resolvedType *ResolvedType, allowPath func([]string) bool) string
func GetSpecsRootDirectory ¶ added in v0.0.5
func GetSpecsRootDirectory() string
func IsPrefixOf ¶
func IsPrefixOf[A comparable](xs []A, ys []A) bool
func MakePathFromKubeVersion ¶
func MakePathFromKubeVersion(version KubeVersion) string
func MustDownloadSwaggerSpec ¶
func MustDownloadSwaggerSpec(version KubeVersion) []byte
func RunCompareResource ¶
func RunCompareResource(args *CompareResourceArgs)
func RunExplain ¶
func RunExplain(args *ExplainArgs)
func RunRootSchemaCommand ¶
func RunRootSchemaCommand()
func RunShowResources ¶
func RunShowResources(args *ShowResourcesArgs)
func RunVersionCommand ¶
func RunVersionCommand()
func SetupCompareResourceCommand ¶ added in v0.0.9
func SetupConfigCommand ¶ added in v0.1.1
func SetupExplainCommand ¶
func SetupRootSchemaCommand ¶
func SetupVersionCommand ¶
func ShowResources ¶
func TableResource ¶
func TableResource(resolvedType *ResolvedType, allowPath func([]string) bool) string
Types ¶
type CompareResourceArgs ¶
type ExplainArgs ¶
type GVK ¶
type GVK struct {
Group string `json:"group"`
Version string `json:"version"`
Kind string `json:"kind"`
}
func (*GVK) GroupVersion ¶
type KubeSpec ¶
type KubeSpec struct {
Definitions map[string]*SpecType `json:"definitions"`
Info struct {
Title string `json:"title"`
Version string `json:"version"`
} `json:"info"`
}
func MustReadSwaggerSpecFromGithub ¶
func MustReadSwaggerSpecFromGithub(version KubeVersion) *KubeSpec
func ReadSwaggerSpecFromGithub ¶
func ReadSwaggerSpecFromGithub(version KubeVersion) (*KubeSpec, error)
func (*KubeSpec) MustGetDefinition ¶
func (*KubeSpec) ResolveStructure ¶
func (s *KubeSpec) ResolveStructure() map[string]map[string]*ResolvedType
func (*KubeSpec) Visit ¶
func (s *KubeSpec) Visit(visit func(path Path, resolved *ResolvedType, circular string)) (map[string]*ResolvedType, map[string]map[string]*ResolvedType)
func (*KubeSpec) VisitSpecType ¶
func (s *KubeSpec) VisitSpecType(resolvedTypes map[string]*ResolvedType, path Path, specType *SpecType, visit func(path Path, resolved *ResolvedType, circular string)) *ResolvedType
type KubeVersion ¶
type KubeVersion []string
func MustVersion ¶
func MustVersion(v string) KubeVersion
func NewVersion ¶
func NewVersion(v string) (KubeVersion, error)
func (KubeVersion) Compare ¶
func (v KubeVersion) Compare(b KubeVersion) base.Ordering
func (KubeVersion) SwaggerSpecURL ¶
func (v KubeVersion) SwaggerSpecURL() string
func (KubeVersion) ToString ¶
func (v KubeVersion) ToString() string
type PivotTable ¶
type PivotTable struct {
FirstColumnHeader string
Rows map[string]map[string][]string
Columns []string
// contains filtered or unexported fields
}
func NewPivotTable ¶
func NewPivotTable(firstColumn string, restColumns []string) *PivotTable
func (*PivotTable) FormattedTable ¶
func (e *PivotTable) FormattedTable(formatRow func(rowKey string, values [][]string) []string) string
type ResolvedObject ¶
type ResolvedObject struct {
Properties map[string]*ResolvedType
AdditionalProperties *ResolvedType
}
type ResolvedType ¶
type ResolvedType struct {
Empty bool
Primitive string
Array *ResolvedType
Object *ResolvedObject
Circular string
}
type RootSchemaFlags ¶
type RootSchemaFlags struct {
Verbosity string
}
type ShowResourcesArgs ¶
type ShowResourcesArgs struct {
GroupBy string
KubeVersions []string
ApiVersions []string
Resources []string
Diff bool
}
func (*ShowResourcesArgs) GetGroupBy ¶
func (s *ShowResourcesArgs) GetGroupBy() ShowResourcesGroupBy
type ShowResourcesGroupBy ¶
type ShowResourcesGroupBy string
const ( ShowResourcesGroupByResource ShowResourcesGroupBy = "ShowResourcesGroupByResource" ShowResourcesGroupByApiVersion ShowResourcesGroupBy = "ShowResourcesGroupByApiVersion" )
func (ShowResourcesGroupBy) Header ¶
func (s ShowResourcesGroupBy) Header() string
type SpecType ¶
type SpecType struct {
AdditionalProperties *SpecType `json:"additionalProperties,omitempty"`
Description string `json:"description,omitempty"`
Format string `json:"format,omitempty"`
Items *SpecType `json:"items,omitempty"`
Properties map[string]*SpecType `json:"properties,omitempty"`
Ref string `json:"$ref,omitempty"`
Required []string `json:"required,omitempty"`
Type string `json:"type,omitempty"`
XKubernetesListMapKeys []string `json:"x-kubernetes-list-map-keys,omitempty"`
XKubernetesListType string `json:"x-kubernetes-list-type,omitempty"`
XKubernetesPatchMergeKey string `json:"x-kubernetes-patch-merge-key,omitempty"`
XKubernetesPatchStrategy string `json:"x-kubernetes-patch-strategy,omitempty"`
XKubernetesGroupVersionKind []*GVK `json:"x-kubernetes-group-version-kind,omitempty"`
XKubernetesUnions []map[string]interface{} `json:"x-kubernetes-unions,omitempty"`
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.