Documentation
¶
Index ¶
- Variables
- func HasNameCollision(name string) bool
- func MarshalYAML(obj *unstructured.Unstructured) (render.Content, error)
- func Register(p ResourcePlugin)
- func RegisterIfAbsent(p ResourcePlugin) bool
- func RenderStatus(phase string) string
- func Reset()
- func StyledFg(text string, c color.Color) string
- type Column
- type DefaultSorter
- type DrillDowner
- type GoToer
- type Refreshable
- type ResourcePlugin
- func All() []ResourcePlugin
- func AllByName(name string) []ResourcePlugin
- func ByGVR(gvr schema.GroupVersionResource) (ResourcePlugin, bool)
- func ByKind(apiVersion, kind string) (ResourcePlugin, bool)
- func ByName(name string) (ResourcePlugin, bool)
- func ByQualifiedName(qualified string) (ResourcePlugin, bool)
- type SelfPopulating
- type SortPreference
- type Sortable
- type Uncoverable
Constants ¶
This section is empty.
Variables ¶
var ( FgRunning = theme.StatusRunning FgSucceeded = theme.StatusSucceeded FgPending = theme.StatusPending FgFailed = theme.StatusFailed )
Status foreground colors shared by all plugins.
Functions ¶
func HasNameCollision ¶ added in v0.3.0
HasNameCollision reports whether more than one plugin has been registered with the given name (i.e. same plural name but different API groups).
func MarshalYAML ¶
func MarshalYAML(obj *unstructured.Unstructured) (render.Content, error)
MarshalYAML serialises an Unstructured object to YAML, stripping noisy fields like metadata.managedFields to match kubectl's default behaviour.
func RegisterIfAbsent ¶
func RegisterIfAbsent(p ResourcePlugin) bool
RegisterIfAbsent adds a plugin only if its GVR is not already registered. When the GVR is new but another plugin with the same name exists, the plugin is added to byNameAll, byGVR, and ordered (so it appears in All()) but NOT set as the primary byName entry. Returns true only when the plugin becomes the primary entry for its name.
func RenderStatus ¶
RenderStatus returns the phase string with foreground color that is compatible with the table selection highlight.
Types ¶
type DefaultSorter ¶
type DefaultSorter interface {
DefaultSort() SortPreference
}
DefaultSorter is an optional interface plugins may implement to override the default sort column. If not implemented, NAME ascending is used.
type DrillDowner ¶
type DrillDowner interface {
DrillDown(obj *unstructured.Unstructured) (ResourcePlugin, []*unstructured.Unstructured)
}
DrillDowner is an optional interface for plugins that show child resources on Enter.
type GoToer ¶
type GoToer interface {
GoTo(obj *unstructured.Unstructured) (resourceName string, namespace string, ok bool)
}
GoToer is an optional interface for plugins that navigate to a different resource view on Enter.
type Refreshable ¶
type Refreshable interface {
Refresh(namespace string)
}
Refreshable is an optional interface for SelfPopulating plugins that need to re-fetch data when the namespace changes.
type ResourcePlugin ¶
type ResourcePlugin interface {
Name() string
ShortName() string
GVR() schema.GroupVersionResource
IsClusterScoped() bool
Columns() []Column
Row(obj *unstructured.Unstructured) []string
YAML(obj *unstructured.Unstructured) (render.Content, error)
Describe(ctx context.Context, obj *unstructured.Unstructured) (render.Content, error)
}
ResourcePlugin is the contract every resource type must satisfy.
func AllByName ¶ added in v0.3.0
func AllByName(name string) []ResourcePlugin
AllByName returns all plugins registered under a given name, across all API groups. Returns a copy of the internal slice.
func ByGVR ¶
func ByGVR(gvr schema.GroupVersionResource) (ResourcePlugin, bool)
ByGVR looks up a plugin by its GroupVersionResource.
func ByKind ¶
func ByKind(apiVersion, kind string) (ResourcePlugin, bool)
ByKind looks up a plugin by Kubernetes apiVersion and kind, using the discovery index to resolve the GVR first.
func ByQualifiedName ¶ added in v0.3.0
func ByQualifiedName(qualified string) (ResourcePlugin, bool)
ByQualifiedName looks up a plugin by a qualified name in the format "name.group/version" (e.g. "certificates.cert-manager.io/v1"). If the input does not contain a "/" it is not a qualified name and the lookup falls through to ByName for backward compatibility.
type SelfPopulating ¶
type SelfPopulating interface {
Objects() []*unstructured.Unstructured
}
SelfPopulating is an optional interface for plugins that manage their own object list instead of using the k8s.Store informer system. Used by synthetic views like api-resources that don't watch real K8s resources.
type SortPreference ¶
SortPreference specifies a plugin's preferred default sort.
type Sortable ¶
type Sortable interface {
SortValue(obj *unstructured.Unstructured, column string) string
}
Sortable is an optional interface plugins may implement to provide sort keys for their columns. If a plugin does not implement Sortable, ResourceList falls back to built-in defaults for NAME and AGE columns.
The column parameter is always the upper-cased Column.Title (e.g. "STATUS"). Return "" from SortValue to fall back to built-in handling for that column.
type Uncoverable ¶
type Uncoverable interface {
DescribeUncovered(ctx context.Context, obj *unstructured.Unstructured) (render.Content, error)
}
Uncoverable is an optional interface plugins may implement to provide a describe view with resolved/uncovered environment variable values. The app layer probes for this interface via type assertion.