render

package
v0.24.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2020 License: Apache-2.0, Apache-2.0 Imports: 46 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Terminating represents a pod terminating status.
	Terminating = "Terminating"

	// Running represents a pod running status.
	Running = "Running"

	// Initialized represents a pod intialized status.
	Initialized = "Initialized"

	// Completed represents a pod completed status.
	Completed = "Completed"

	// ContainerCreating represents a pod container status.
	ContainerCreating = "ContainerCreating"

	// PodInitializing represents a pod initializing status.
	PodInitializing = "PodInitializing"

	// Pending represents a pod pending status.
	Pending = "Pending"

	// Blank represents no value.
	Blank = ""
)
View Source
const (
	// MissingValue indicates an unset value.
	MissingValue = "<none>"

	// NAValue indicates a value that does not pertain.
	NAValue = "n/a"

	// UnknownValue represents an unknown.
	UnknownValue = "<unknown>"

	// UnsetValue represent an unset value
	UnsetValue = ""

	// ZeroValue represents a zero value.
	ZeroValue = "0"
)
View Source
const (
	// NonResource represents a custom resource.
	NonResource = "*"
)

Variables

View Source
var (
	// ModColor row modified color.
	ModColor tcell.Color

	// AddColor row added color.
	AddColor tcell.Color

	// PendingColor row added color.
	PendingColor tcell.Color

	// ErrColor row err color.
	ErrColor tcell.Color

	// StdColor row default color.
	StdColor tcell.Color

	// HighlightColor row highlight color.
	HighlightColor tcell.Color

	// KillColor row deleted color.
	KillColor tcell.Color

	// CompletedColor row completed color.
	CompletedColor tcell.Color
)
View Source
var AgeDecorator = func(a string) string {
	return toAgeHuman(a)
}

AgeDecorator represents a timestamped as human column.

Functions

func AsPerc

func AsPerc(p string) string

AsPerc prints a number as percentage with parans.

func AsThousands added in v0.17.4

func AsThousands(n int64) string

AsThousands prints a number with thousand separator.

func DefaultColorer

func DefaultColorer(ns string, h Header, re RowEvent) tcell.Color

DefaultColorer set the default table row colors.

func Happy added in v0.16.0

func Happy(ns string, h Header, r Row) bool

Happy returns true if resource is happy, false otherwise

func IntToStr added in v0.17.4

func IntToStr(p int) string

IntToStr converts an int to a string.

func Less

func Less(asc, isNumber, isDuration bool, c1, c2 string) bool

Less return true if c1 < c2.

func Pad

func Pad(s string, width int) string

Pad a string up to the given length or truncates if greater than length.

func PrintPerc added in v0.17.4

func PrintPerc(p int) string

PrintPerc prints a number as percentage.

func ToContainerPorts added in v0.17.0

func ToContainerPorts(pp []v1.ContainerPort) string

ToContainerPorts returns container ports as a string.

func ToContainerState added in v0.17.0

func ToContainerState(s v1.ContainerState) string

ToContainerState returns container state as a string.

func ToPorts added in v0.17.0

func ToPorts(pp []v1.ServicePort) string

ToPorts returns service ports as a string.

func Truncate

func Truncate(str string, width int) string

Truncate a string to the given l and suffix ellipsis if needed.

func UrlFor

func UrlFor(host, path, port string) string

UrlFor computes fq url for a given benchmark configuration.

Types

type Alias

type Alias struct{}

Alias renders a aliases to screen.

func (Alias) ColorerFunc

func (Alias) ColorerFunc() ColorerFunc

ColorerFunc colors a resource row.

func (Alias) Header

func (Alias) Header(ns string) Header

Header returns a header row.

func (Alias) Render

func (Alias) Render(o interface{}, ns string, r *Row) error

Render renders a K8s resource to screen. BOZO!! Pass in a row with pre-alloc fields??

type AliasRes

type AliasRes struct {
	GVR     string
	Aliases []string
}

AliasRes represents an alias resource.

func (AliasRes) DeepCopyObject

func (a AliasRes) DeepCopyObject() runtime.Object

DeepCopyObject returns a container copy.

func (AliasRes) GetObjectKind

func (AliasRes) GetObjectKind() schema.ObjectKind

GetObjectKind returns a schema object.

type BenchCfg

type BenchCfg struct {
	C, N       int
	Host, Path string
}

BenchCfg represents a benchmark configuration.

type BenchInfo

type BenchInfo struct {
	File os.FileInfo
	Path string
}

BenchInfo represents benchmark run info.

func (BenchInfo) DeepCopyObject

func (b BenchInfo) DeepCopyObject() runtime.Object

DeepCopyObject returns a container copy.

func (BenchInfo) GetObjectKind

func (BenchInfo) GetObjectKind() schema.ObjectKind

GetObjectKind returns a schema object.

type Benchmark

type Benchmark struct{}

Benchmark renders a benchmarks to screen.

func (Benchmark) ColorerFunc

func (b Benchmark) ColorerFunc() ColorerFunc

ColorerFunc colors a resource row.

func (Benchmark) Header

func (Benchmark) Header(ns string) Header

Header returns a header row.

func (Benchmark) Render

func (b Benchmark) Render(o interface{}, ns string, r *Row) error

Render renders a K8s resource to screen.

type Builder added in v0.19.0

type Builder struct {
	Report Report `json:"popeye" yaml:"popeye"`
}

Builder represents a popeye report.

type ClusterRole

type ClusterRole struct{}

ClusterRole renders a K8s ClusterRole to screen.

func (ClusterRole) ColorerFunc

func (ClusterRole) ColorerFunc() ColorerFunc

ColorerFunc colors a resource row.

func (ClusterRole) Header

func (ClusterRole) Header(string) Header

Header returns a header rbw.

func (ClusterRole) Render

func (ClusterRole) Render(o interface{}, ns string, r *Row) error

Render renders a K8s resource to screen.

type ClusterRoleBinding

type ClusterRoleBinding struct{}

ClusterRoleBinding renders a K8s ClusterRoleBinding to screen.

func (ClusterRoleBinding) ColorerFunc

func (ClusterRoleBinding) ColorerFunc() ColorerFunc

ColorerFunc colors a resource row.

func (ClusterRoleBinding) Header

Header returns a header rbw.

func (ClusterRoleBinding) Render

func (ClusterRoleBinding) Render(o interface{}, ns string, r *Row) error

Render renders a K8s resource to screen.

type ColorerFunc

type ColorerFunc func(ns string, h Header, re RowEvent) tcell.Color

ColorerFunc represents a resource row colorer.

type Container

type Container struct{}

Container renders a K8s Container to screen.

func (Container) ColorerFunc

func (c Container) ColorerFunc() ColorerFunc

ColorerFunc colors a resource row.

func (Container) Header

func (Container) Header(ns string) Header

Header returns a header row.

func (Container) Render

func (c Container) Render(o interface{}, name string, r *Row) error

Render renders a K8s resource to screen.

type ContainerRes

type ContainerRes struct {
	Container *v1.Container
	Status    *v1.ContainerStatus
	MX        *mv1beta1.ContainerMetrics
	IsInit    bool
	Age       metav1.Time
}

ContainerRes represents a container and its metrics.

func (ContainerRes) DeepCopyObject

func (c ContainerRes) DeepCopyObject() runtime.Object

DeepCopyObject returns a container copy.

func (ContainerRes) GetObjectKind

func (c ContainerRes) GetObjectKind() schema.ObjectKind

GetObjectKind returns a schema object.

type ContainerWithMetrics

type ContainerWithMetrics interface {
	// Container returns the container
	Container() *v1.Container

	// ContainerStatus returns the current container status.
	ContainerStatus() *v1.ContainerStatus

	// Metrics returns the container metrics.
	Metrics() *mv1beta1.ContainerMetrics

	// Age returns the pod age.
	Age() metav1.Time

	// IsInit indicates a init container.
	IsInit() bool
}

ContainerWithMetrics represents a container and it's metrics.

type Context

type Context struct{}

Context renders a K8s ConfigMap to screen.

func (Context) ColorerFunc

func (Context) ColorerFunc() ColorerFunc

ColorerFunc colors a resource row.

func (Context) Header

func (Context) Header(ns string) Header

Header returns a header row.

func (Context) Render

func (c Context) Render(o interface{}, _ string, r *Row) error

Render renders a K8s resource to screen.

type ContextNamer

type ContextNamer interface {
	CurrentContextName() (string, error)
}

ContextNamer represents a named context.

type CronJob

type CronJob struct{}

CronJob renders a K8s CronJob to screen.

func (CronJob) ColorerFunc

func (CronJob) ColorerFunc() ColorerFunc

ColorerFunc colors a resource row.

func (CronJob) Header

func (CronJob) Header(ns string) Header

Header returns a header row.

func (CronJob) Render

func (c CronJob) Render(o interface{}, ns string, r *Row) error

Render renders a K8s resource to screen.

type CustomResourceDefinition

type CustomResourceDefinition struct{}

CustomResourceDefinition renders a K8s CustomResourceDefinition to screen.

func (CustomResourceDefinition) ColorerFunc

func (CustomResourceDefinition) ColorerFunc() ColorerFunc

ColorerFunc colors a resource row.

func (CustomResourceDefinition) Header

Header returns a header rbw.

func (CustomResourceDefinition) Render

func (CustomResourceDefinition) Render(o interface{}, ns string, r *Row) error

Render renders a K8s resource to screen.

type DaemonSet

type DaemonSet struct{}

DaemonSet renders a K8s DaemonSet to screen.

func (DaemonSet) ColorerFunc

func (d DaemonSet) ColorerFunc() ColorerFunc

ColorerFunc colors a resource row.

func (DaemonSet) Header

func (DaemonSet) Header(ns string) Header

Header returns a header row.

func (DaemonSet) Render

func (d DaemonSet) Render(o interface{}, ns string, r *Row) error

Render renders a K8s resource to screen.

type DecoratorFunc

type DecoratorFunc func(string) string

DecoratorFunc decorates a string.

type DeltaRow

type DeltaRow []string

DeltaRow represents a collection of row detlas between old and new row.

func NewDeltaRow

func NewDeltaRow(o, n Row, excludeLast bool) DeltaRow

NewDeltaRow computes the delta between 2 rows.

func (DeltaRow) Clone

func (d DeltaRow) Clone() DeltaRow

Clone returns a delta copy.

func (DeltaRow) Customize added in v0.17.0

func (d DeltaRow) Customize(cols []int, out DeltaRow)

Customize returns a subset of deltas.

func (DeltaRow) Diff added in v0.17.0

func (d DeltaRow) Diff(r DeltaRow, ageCol int) bool

Diff returns true if deltas differ or false otherwise.

func (DeltaRow) IsBlank

func (d DeltaRow) IsBlank() bool

IsBlank asserts a row has no values in it.

func (DeltaRow) Labelize added in v0.19.3

func (d DeltaRow) Labelize(cols []int, labelCol int) DeltaRow

Labelize returns a new deltaRow based on labels.

type Deployment

type Deployment struct{}

Deployment renders a K8s Deployment to screen.

func (Deployment) ColorerFunc

func (d Deployment) ColorerFunc() ColorerFunc

ColorerFunc colors a resource row.

func (Deployment) Header

func (Deployment) Header(ns string) Header

Header returns a header row.

func (Deployment) Render

func (d Deployment) Render(o interface{}, ns string, r *Row) error

Render renders a K8s resource to screen.

type Dir added in v0.21.0

type Dir struct{}

Dir renders a directory entry to screen.

func (Dir) ColorerFunc added in v0.21.0

func (Dir) ColorerFunc() ColorerFunc

ColorerFunc colors a resource row.

func (Dir) Header added in v0.21.0

func (Dir) Header(ns string) Header

Header returns a header row.

func (Dir) Render added in v0.21.0

func (Dir) Render(o interface{}, ns string, r *Row) error

Render renders a K8s resource to screen. BOZO!! Pass in a row with pre-alloc fields??

type DirRes added in v0.21.0

type DirRes struct {
	Info os.FileInfo
	Path string
}

DirRes represents an alias resource.

func (DirRes) DeepCopyObject added in v0.21.0

func (d DirRes) DeepCopyObject() runtime.Object

DeepCopyObject returns a container copy.

func (DirRes) GetObjectKind added in v0.21.0

func (DirRes) GetObjectKind() schema.ObjectKind

GetObjectKind returns a schema object.

type Endpoints

type Endpoints struct{}

Endpoints renders a K8s Endpoints to screen.

func (Endpoints) ColorerFunc

func (Endpoints) ColorerFunc() ColorerFunc

ColorerFunc colors a resource row.

func (Endpoints) Header

func (Endpoints) Header(ns string) Header

Header returns a header row.

func (Endpoints) Render

func (e Endpoints) Render(o interface{}, ns string, r *Row) error

Render renders a K8s resource to screen.

type Event

type Event struct{}

Event renders a K8s Event to screen.

func (Event) ColorerFunc

func (e Event) ColorerFunc() ColorerFunc

ColorerFunc colors a resource row.

func (Event) Header

func (Event) Header(ns string) Header

Header returns a header rbw.

func (Event) Render

func (e Event) Render(o interface{}, ns string, r *Row) error

Render renders a K8s resource to screen.

type Fields

type Fields []string

Fields represents a collection of row fields.

func (Fields) Clone

func (f Fields) Clone() Fields

Clone returns a copy of the fields.

func (Fields) Customize added in v0.17.0

func (f Fields) Customize(cols []int, out Fields)

Customize returns a subset of fields.

func (Fields) Diff added in v0.17.0

func (f Fields) Diff(ff Fields, ageCol int) bool

Diff returns true if fields differ or false otherwise.

type FileRes

type FileRes struct {
	File os.FileInfo
	Dir  string
}

FileRes represents a file resource.

func (FileRes) DeepCopyObject

func (c FileRes) DeepCopyObject() runtime.Object

DeepCopyObject returns a container copy.

func (FileRes) GetObjectKind

func (c FileRes) GetObjectKind() schema.ObjectKind

GetObjectKind returns a schema object.

type ForwardRes

type ForwardRes struct {
	Forwarder
	Config BenchCfg
}

ForwardRes represents a benchmark resource.

func (ForwardRes) DeepCopyObject

func (f ForwardRes) DeepCopyObject() runtime.Object

DeepCopyObject returns a container copy.

func (ForwardRes) GetObjectKind

func (f ForwardRes) GetObjectKind() schema.ObjectKind

GetObjectKind returns a schema object.

type Forwarder

type Forwarder interface {
	// Path returns a resource FQN.
	Path() string

	// Container returns a container name.
	Container() string

	// Ports returns container exposed ports.
	Ports() []string

	// Active returns forwarder current state.
	Active() bool

	// Age returns forwarder age.
	Age() string
}

Forwarder represents a port forwarder.

type Generic

type Generic struct {
	// contains filtered or unexported fields
}

Generic renders a generic resource to screen.

func (Generic) ColorerFunc

func (Generic) ColorerFunc() ColorerFunc

ColorerFunc colors a resource row.

func (Generic) Happy added in v0.16.0

func (Generic) Happy(ns string, r Row) bool

Happy returns true if resource is happy, false otherwise

func (*Generic) Header

func (g *Generic) Header(ns string) Header

Header returns a header row.

func (*Generic) Render

func (g *Generic) Render(o interface{}, ns string, r *Row) error

Render renders a K8s resource to screen.

func (*Generic) SetTable

func (g *Generic) SetTable(t *metav1beta1.Table)

SetTable sets the tabular resource.

type Header []HeaderColumn

Header represents a table header.

func (Header) Clone

func (h Header) Clone() Header

Clone duplicates a header.

func (Header) Columns added in v0.17.0

func (h Header) Columns(wide bool) []string

Columns return header as a collection of strings.

func (Header) Customize added in v0.17.0

func (h Header) Customize(cols []string, wide bool) Header

Customize builds a header from custom col definitions.

func (Header) Diff added in v0.17.0

func (h Header) Diff(header Header) bool

Diff returns true if the header changed.

func (Header) Dump added in v0.17.0

func (h Header) Dump()

Dump for debuging.

func (Header) HasAge added in v0.17.0

func (h Header) HasAge() bool

HasAge returns true if table has an age column.

func (Header) IndexOf added in v0.17.0

func (h Header) IndexOf(colName string, includeWide bool) int

IndexOf returns the col index or -1 if none.

func (Header) IsAgeCol added in v0.17.0

func (h Header) IsAgeCol(col int) bool

IsAgeCol checks if given column index is the age column.

func (Header) IsMetricsCol added in v0.23.2

func (h Header) IsMetricsCol(col int) bool

IsMetricsCol checks if given column index represents metrics.

func (Header) Labelize added in v0.19.3

func (h Header) Labelize(cols []int, labelCol int, rr RowEvents) Header

Labelize returns a new Header based on labels.

func (Header) MapIndices added in v0.17.0

func (h Header) MapIndices(cols []string, wide bool) []int

MapIndices returns a collection of mapped column indices based of the requested columns.

func (Header) ValidColIndex added in v0.17.0

func (h Header) ValidColIndex() int

ValidColIndex returns the valid col index or -1 if none.

type HeaderColumn added in v0.17.0

type HeaderColumn struct {
	Name      string
	Align     int
	Decorator DecoratorFunc
	Hide      bool
	Wide      bool
	MX        bool
	Time      bool
}

HeaderColumn represent a table header

func (HeaderColumn) Clone added in v0.17.0

func (h HeaderColumn) Clone() HeaderColumn

Clone copies a header.

type Helm added in v0.19.3

type Helm struct{}

Helm renders a helm chart to screen.

func (Helm) ColorerFunc added in v0.19.3

func (Helm) ColorerFunc() ColorerFunc

ColorerFunc colors a resource row.

func (Helm) Header added in v0.19.3

func (Helm) Header(_ string) Header

Header returns a header row.

func (Helm) Render added in v0.19.3

func (c Helm) Render(o interface{}, ns string, r *Row) error

Render renders a chart to screen.

type HelmRes added in v0.19.3

type HelmRes struct {
	Release *release.Release
}

HelmRes represents an helm chart resource.

func (HelmRes) DeepCopyObject added in v0.19.3

func (h HelmRes) DeepCopyObject() runtime.Object

DeepCopyObject returns a container copy.

func (HelmRes) GetObjectKind added in v0.19.3

func (HelmRes) GetObjectKind() schema.ObjectKind

GetObjectKind returns a schema object.

type HorizontalPodAutoscaler

type HorizontalPodAutoscaler struct{}

HorizontalPodAutoscaler renders a K8s HorizontalPodAutoscaler to screen.

func (HorizontalPodAutoscaler) ColorerFunc

func (HorizontalPodAutoscaler) ColorerFunc() ColorerFunc

ColorerFunc colors a resource row.

func (HorizontalPodAutoscaler) Header

Header returns a header row.

func (HorizontalPodAutoscaler) Render

func (h HorizontalPodAutoscaler) Render(o interface{}, ns string, r *Row) error

Render renders a K8s resource to screen.

type IdSorter

type IdSorter struct {
	Ids    []string
	Events RowEvents
}

IdSorter sorts row events by a given id.

func (IdSorter) Len

func (s IdSorter) Len() int

func (IdSorter) Less

func (s IdSorter) Less(i, j int) bool

func (IdSorter) Swap

func (s IdSorter) Swap(i, j int)

type Ingress

type Ingress struct{}

Ingress renders a K8s Ingress to screen.

func (Ingress) ColorerFunc

func (Ingress) ColorerFunc() ColorerFunc

ColorerFunc colors a resource row.

func (Ingress) Header

func (Ingress) Header(ns string) Header

Header returns a header row.

func (Ingress) Render

func (i Ingress) Render(o interface{}, ns string, r *Row) error

Render renders a K8s resource to screen.

type Issue added in v0.19.0

type Issue struct {
	Group   string       `yaml:"group" json:"group"`
	GVR     string       `yaml:"gvr" json:"gvr"`
	Level   config.Level `yaml:"level" json:"level"`
	Message string       `yaml:"message" json:"message"`
}

Issue represents a sanitization issue.

type Issues added in v0.19.0

type Issues []Issue

Issues represents a collection of issues.

func (Issues) CountSeverity added in v0.19.0

func (i Issues) CountSeverity(l config.Level) int

CountSeverity counts severity level instances

func (Issues) MaxSeverity added in v0.19.0

func (i Issues) MaxSeverity() config.Level

MaxSeverity gather the max severity in a collection of issues.

type Job

type Job struct{}

Job renders a K8s Job to screen.

func (Job) ColorerFunc

func (Job) ColorerFunc() ColorerFunc

ColorerFunc colors a resource row.

func (Job) Header

func (Job) Header(ns string) Header

Header returns a header row.

func (Job) Render

func (j Job) Render(o interface{}, ns string, r *Row) error

Render renders a K8s resource to screen.

type NamedContext

type NamedContext struct {
	Name    string
	Context *api.Context
	Config  ContextNamer
}

NamedContext represents a named cluster context.

func NewNamedContext

func NewNamedContext(c ContextNamer, n string, ctx *api.Context) *NamedContext

NewNamedContext returns a new named context.

func (*NamedContext) DeepCopyObject

func (c *NamedContext) DeepCopyObject() runtime.Object

DeepCopyObject returns a container copy.

func (*NamedContext) GetObjectKind

func (c *NamedContext) GetObjectKind() schema.ObjectKind

GetObjectKind returns a schema object.

func (*NamedContext) IsCurrentContext

func (c *NamedContext) IsCurrentContext(n string) bool

IsCurrentContext return the active context name.

type Namespace

type Namespace struct{}

Namespace renders a K8s Namespace to screen.

func (Namespace) ColorerFunc

func (n Namespace) ColorerFunc() ColorerFunc

ColorerFunc colors a resource row.

func (Namespace) Header

func (Namespace) Header(string) Header

Header returns a header rbw.

func (Namespace) Render

func (n Namespace) Render(o interface{}, _ string, r *Row) error

Render renders a K8s resource to screen.

type NetworkPolicy

type NetworkPolicy struct{}

NetworkPolicy renders a K8s NetworkPolicy to screen.

func (NetworkPolicy) ColorerFunc

func (NetworkPolicy) ColorerFunc() ColorerFunc

ColorerFunc colors a resource row.

func (NetworkPolicy) Header

func (NetworkPolicy) Header(ns string) Header

Header returns a header row.

func (NetworkPolicy) Render

func (n NetworkPolicy) Render(o interface{}, ns string, r *Row) error

Render renders a K8s resource to screen.

type Node

type Node struct{}

Node renders a K8s Node to screen.

func (Node) ColorerFunc

func (n Node) ColorerFunc() ColorerFunc

ColorerFunc colors a resource row.

func (Node) Header

func (Node) Header(_ string) Header

Header returns a header row.

func (Node) Render

func (n Node) Render(o interface{}, ns string, r *Row) error

Render renders a K8s resource to screen.

type NodeWithMetrics

type NodeWithMetrics struct {
	Raw      *unstructured.Unstructured
	MX       *mv1beta1.NodeMetrics
	PodCount int
}

NodeWithMetrics represents a node with its associated metrics.

func (*NodeWithMetrics) DeepCopyObject

func (n *NodeWithMetrics) DeepCopyObject() runtime.Object

DeepCopyObject returns a container copy.

func (*NodeWithMetrics) GetObjectKind

func (n *NodeWithMetrics) GetObjectKind() schema.ObjectKind

GetObjectKind returns a schema object.

type OpenFaas added in v0.15.0

type OpenFaas struct{}

OpenFaas renders an openfaas function to screen.

func (OpenFaas) ColorerFunc added in v0.15.0

func (o OpenFaas) ColorerFunc() ColorerFunc

ColorerFunc colors a resource row.

func (OpenFaas) Header added in v0.15.0

func (OpenFaas) Header(ns string) Header

Header returns a header row.

func (OpenFaas) Render added in v0.15.0

func (o OpenFaas) Render(i interface{}, ns string, r *Row) error

Render renders a chart to screen.

type OpenFaasRes added in v0.15.0

type OpenFaasRes struct {
	Function ofaas.FunctionStatus `json:"function"`
}

OpenFaasRes represents an openfaas function resource.

func (OpenFaasRes) DeepCopyObject added in v0.15.0

func (h OpenFaasRes) DeepCopyObject() runtime.Object

DeepCopyObject returns a container copy.

func (OpenFaasRes) GetObjectKind added in v0.15.0

func (OpenFaasRes) GetObjectKind() schema.ObjectKind

GetObjectKind returns a schema object.

type Outcome added in v0.19.0

type Outcome map[string]Issues

Outcome represents a classification of reports outcome.

type PersistentVolume

type PersistentVolume struct{}

PersistentVolume renders a K8s PersistentVolume to screen.

func (PersistentVolume) ColorerFunc

func (p PersistentVolume) ColorerFunc() ColorerFunc

ColorerFunc colors a resource row.

func (PersistentVolume) Header

func (PersistentVolume) Header(string) Header

Header returns a header rbw.

func (PersistentVolume) Render

func (p PersistentVolume) Render(o interface{}, ns string, r *Row) error

Render renders a K8s resource to screen.

type PersistentVolumeClaim

type PersistentVolumeClaim struct{}

PersistentVolumeClaim renders a K8s PersistentVolumeClaim to screen.

func (PersistentVolumeClaim) ColorerFunc

func (p PersistentVolumeClaim) ColorerFunc() ColorerFunc

ColorerFunc colors a resource row.

func (PersistentVolumeClaim) Header

func (PersistentVolumeClaim) Header(ns string) Header

Header returns a header rbw.

func (PersistentVolumeClaim) Render

func (p PersistentVolumeClaim) Render(o interface{}, ns string, r *Row) error

Render renders a K8s resource to screen.

type Pod

type Pod struct{}

Pod renders a K8s Pod to screen.

func (Pod) ColorerFunc

func (p Pod) ColorerFunc() ColorerFunc

ColorerFunc colors a resource row.

func (Pod) Header

func (Pod) Header(ns string) Header

Header returns a header row.

func (*Pod) Phase added in v0.13.3

func (p *Pod) Phase(po *v1.Pod) string

Phase reports the given pod phase.

func (Pod) Render

func (p Pod) Render(o interface{}, ns string, r *Row) error

Render renders a K8s resource to screen.

func (*Pod) Statuses added in v0.13.3

func (*Pod) Statuses(ss []v1.ContainerStatus) (cr, ct, rc int)

Statuses reports current pod container statuses.

type PodDisruptionBudget

type PodDisruptionBudget struct{}

PodDisruptionBudget renders a K8s PodDisruptionBudget to screen.

func (PodDisruptionBudget) ColorerFunc

func (p PodDisruptionBudget) ColorerFunc() ColorerFunc

ColorerFunc colors a resource row.

func (PodDisruptionBudget) Header

func (PodDisruptionBudget) Header(ns string) Header

Header returns a header row.

func (PodDisruptionBudget) Render

func (p PodDisruptionBudget) Render(o interface{}, ns string, r *Row) error

Render renders a K8s resource to screen.

type PodWithMetrics

type PodWithMetrics struct {
	Raw *unstructured.Unstructured
	MX  *mv1beta1.PodMetrics
}

PodWithMetrics represents a pod and its metrics.

func (*PodWithMetrics) DeepCopyObject

func (p *PodWithMetrics) DeepCopyObject() runtime.Object

DeepCopyObject returns a container copy.

func (*PodWithMetrics) GetObjectKind

func (p *PodWithMetrics) GetObjectKind() schema.ObjectKind

GetObjectKind returns a schema object.

type Policies

type Policies []PolicyRes

Policies represents a collection of RBAC policies.

func (Policies) Upsert

func (pp Policies) Upsert(p PolicyRes) Policies

Upsert adds a new policy.

type Policy

type Policy struct{}

Policy renders a rbac policy to screen.

func (Policy) ColorerFunc

func (Policy) ColorerFunc() ColorerFunc

ColorerFunc colors a resource row.

func (Policy) Header

func (Policy) Header(ns string) Header

Header returns a header row.

func (Policy) Render

func (Policy) Render(o interface{}, gvr string, r *Row) error

Render renders a K8s resource to screen.

type PolicyRes

type PolicyRes struct {
	Namespace, Binding string
	Resource, Group    string
	ResourceName       string
	NonResourceURL     string
	Verbs              []string
}

PolicyRes represents a rback policy rule.

func NewPolicyRes

func NewPolicyRes(ns, binding, res, grp string, vv []string) PolicyRes

NewPolicyRes returns a new policy.

func (PolicyRes) DeepCopyObject

func (p PolicyRes) DeepCopyObject() runtime.Object

DeepCopyObject returns a container copy.

func (PolicyRes) GetObjectKind

func (p PolicyRes) GetObjectKind() schema.ObjectKind

GetObjectKind returns a schema object.

type Popeye added in v0.19.0

type Popeye struct{}

Popeye renders a sanitizer to screen.

func (Popeye) ColorerFunc added in v0.19.0

func (Popeye) ColorerFunc() ColorerFunc

ColorerFunc colors a resource row.

func (Popeye) Header added in v0.19.0

func (Popeye) Header(ns string) Header

Header returns a header row.

func (Popeye) Render added in v0.19.0

func (Popeye) Render(o interface{}, ns string, r *Row) error

Render renders a K8s resource to screen.

type PortForward

type PortForward struct{}

PortForward renders a portforwards to screen.

func (PortForward) ColorerFunc

func (PortForward) ColorerFunc() ColorerFunc

ColorerFunc colors a resource row.

func (PortForward) Header

func (PortForward) Header(ns string) Header

Header returns a header row.

func (PortForward) Render

func (f PortForward) Render(o interface{}, gvr string, r *Row) error

Render renders a K8s resource to screen.

type Rbac

type Rbac struct{}

Rbac renders a rbac to screen.

func (Rbac) ColorerFunc

func (Rbac) ColorerFunc() ColorerFunc

ColorerFunc colors a resource row.

func (Rbac) Header

func (Rbac) Header(ns string) Header

Header returns a header row.

func (Rbac) Render

func (r Rbac) Render(o interface{}, ns string, ro *Row) error

Render renders a K8s resource to screen.

type Reference added in v0.20.0

type Reference struct{}

Reference renders a reference to screen.

func (Reference) ColorerFunc added in v0.20.0

func (Reference) ColorerFunc() ColorerFunc

ColorerFunc colors a resource row.

func (Reference) Header added in v0.20.0

func (Reference) Header(ns string) Header

Header returns a header row.

func (Reference) Render added in v0.20.0

func (Reference) Render(o interface{}, ns string, r *Row) error

Render renders a K8s resource to screen. BOZO!! Pass in a row with pre-alloc fields??

type ReferenceRes added in v0.20.0

type ReferenceRes struct {
	Namespace string
	Name      string
	GVR       string
}

ReferenceRes represents a reference resource.

func (ReferenceRes) DeepCopyObject added in v0.20.0

func (a ReferenceRes) DeepCopyObject() runtime.Object

DeepCopyObject returns a container copy.

func (ReferenceRes) GetObjectKind added in v0.20.0

func (ReferenceRes) GetObjectKind() schema.ObjectKind

GetObjectKind returns a schema object.

type ReplicaSet

type ReplicaSet struct{}

ReplicaSet renders a K8s ReplicaSet to screen.

func (ReplicaSet) ColorerFunc

func (r ReplicaSet) ColorerFunc() ColorerFunc

ColorerFunc colors a resource row.

func (ReplicaSet) Header

func (ReplicaSet) Header(ns string) Header

Header returns a header row.

func (ReplicaSet) Render

func (r ReplicaSet) Render(o interface{}, ns string, row *Row) error

Render renders a K8s resource to screen.

type Report added in v0.19.0

type Report struct {
	Score    int      `json:"score" yaml:"score"`
	Grade    string   `json:"grade" yaml:"grade"`
	Sections Sections `json:"sanitizers,omitempty" yaml:"sanitizers,omitempty"`
}

Report represents the output of a sanitization pass.

type ResEvent

type ResEvent int

ResEvent represents a resource event.

const (
	// EventUnchanged notifies listener resource has not changed.
	EventUnchanged ResEvent = 1 << iota

	// EventAdd notifies listener of a resource was added.
	EventAdd

	// EventUpdate notifies listener of a resource updated.
	EventUpdate

	// EventDelete  notifies listener of a resource was deleted.
	EventDelete

	// EventClear the stack was reset.
	EventClear
)

type Role

type Role struct{}

Role renders a K8s Role to screen.

func (Role) ColorerFunc

func (Role) ColorerFunc() ColorerFunc

ColorerFunc colors a resource row.

func (Role) Header

func (Role) Header(ns string) Header

Header returns a header row.

func (Role) Render

func (r Role) Render(o interface{}, ns string, row *Row) error

Render renders a K8s resource to screen.

type RoleBinding

type RoleBinding struct{}

RoleBinding renders a K8s RoleBinding to screen.

func (RoleBinding) ColorerFunc

func (RoleBinding) ColorerFunc() ColorerFunc

ColorerFunc colors a resource row.

func (RoleBinding) Header

func (RoleBinding) Header(ns string) Header

Header returns a header rbw.

func (RoleBinding) Render

func (r RoleBinding) Render(o interface{}, ns string, row *Row) error

Render renders a K8s resource to screen.

type Row

type Row struct {
	ID     string
	Fields Fields
}

Row represents a colllection of columns.

func NewRow

func NewRow(size int) Row

NewRow returns a new row with initialized fields.

func (Row) Clone

func (r Row) Clone() Row

Clone copies a row.

func (Row) Customize added in v0.17.0

func (r Row) Customize(cols []int) Row

Customize returns a row subset based on given col indices.

func (Row) Diff added in v0.17.0

func (r Row) Diff(ro Row, ageCol int) bool

Diff returns true if row differ or false otherwise.

func (Row) Labelize added in v0.19.3

func (r Row) Labelize(cols []int, labelCol int, labels []string) Row

Labelize returns a new row based on labels.

func (Row) Len added in v0.16.0

func (r Row) Len() int

Len returns the length of the row.

type RowEvent

type RowEvent struct {
	Kind   ResEvent
	Row    Row
	Deltas DeltaRow
}

RowEvent tracks resource instance events.

func NewRowEvent

func NewRowEvent(kind ResEvent, row Row) RowEvent

NewRowEvent returns a new row event.

func NewRowEventWithDeltas added in v0.19.3

func NewRowEventWithDeltas(row Row, delta DeltaRow) RowEvent

NewRowEventWithDeltas returns a new row event with deltas.

func (RowEvent) Clone

func (r RowEvent) Clone() RowEvent

Clone returns a rowevent deep copy.

func (RowEvent) Customize added in v0.17.0

func (r RowEvent) Customize(cols []int) RowEvent

Customize returns a new subset based on the given column indices.

func (RowEvent) Diff added in v0.13.5

func (r RowEvent) Diff(re RowEvent, ageCol int) bool

Diff returns true if the row changed.

func (RowEvent) ExtractHeaderLabels added in v0.19.3

func (r RowEvent) ExtractHeaderLabels(labelCol int) []string

ExtractHeaderLabels extract collection of fields into header.

func (RowEvent) Labelize added in v0.19.3

func (r RowEvent) Labelize(cols []int, labelCol int, labels []string) RowEvent

Labelize returns a new row event based on labels.

type RowEventSorter

type RowEventSorter struct {
	Events     RowEvents
	Index      int
	NS         string
	IsNumber   bool
	IsDuration bool
	Asc        bool
}

RowEventSorter sorts row events by a given colon.

func (RowEventSorter) Len

func (r RowEventSorter) Len() int

func (RowEventSorter) Less

func (r RowEventSorter) Less(i, j int) bool

func (RowEventSorter) Swap

func (r RowEventSorter) Swap(i, j int)

type RowEvents

type RowEvents []RowEvent

RowEvents a collection of row events.

func (RowEvents) Clear

func (r RowEvents) Clear() RowEvents

Clear delete all row events

func (RowEvents) Clone

func (r RowEvents) Clone() RowEvents

Clone returns a rowevents deep copy.

func (RowEvents) Customize added in v0.17.0

func (r RowEvents) Customize(cols []int) RowEvents

Customize returns custom row events based on columns layout.

func (RowEvents) Delete

func (r RowEvents) Delete(id string) RowEvents

Delete removes an element by id.

func (RowEvents) Diff added in v0.13.5

func (r RowEvents) Diff(re RowEvents, ageCol int) bool

Diff returns true if the event changed.

func (RowEvents) ExtractHeaderLabels added in v0.19.3

func (r RowEvents) ExtractHeaderLabels(labelCol int) []string

ExtractHeaderLabels extract header labels.

func (RowEvents) FindIndex

func (r RowEvents) FindIndex(id string) (int, bool)

FindIndex locates a row index by id. Returns false is not found.

func (RowEvents) Labelize added in v0.19.3

func (r RowEvents) Labelize(cols []int, labelCol int, labels []string) RowEvents

Labelize converts labels into a row event.

func (RowEvents) Sort

func (r RowEvents) Sort(ns string, sortCol int, ageCol, numCol, asc bool)

Sort rows based on column index and order.

func (RowEvents) Upsert

func (r RowEvents) Upsert(re RowEvent) RowEvents

Upsert add or update a row if it exists.

type RowSorter

type RowSorter struct {
	Rows                 Rows
	Index                int
	IsNumber, IsDuration bool
	Asc                  bool
}

RowSorter sorts rows.

func (RowSorter) Len

func (s RowSorter) Len() int

func (RowSorter) Less

func (s RowSorter) Less(i, j int) bool

func (RowSorter) Swap

func (s RowSorter) Swap(i, j int)

type Rows

type Rows []Row

Rows represents a collection of rows.

func (Rows) Delete

func (rr Rows) Delete(id string) Rows

Delete removes an element by id.

func (Rows) Find

func (rr Rows) Find(id string) (int, bool)

Find locates a row by id. Retturns false is not found.

func (Rows) Sort

func (rr Rows) Sort(col int, asc, isNum, isDur bool)

Sort rows based on column index and order.

func (Rows) Upsert

func (rr Rows) Upsert(r Row) Rows

Upsert adds a new item.

type RuleRes

type RuleRes struct {
	Resource, Group string
	ResourceName    string
	NonResourceURL  string
	Verbs           []string
}

RuleRes represents an rbac rule.

func NewRuleRes

func NewRuleRes(res, grp string, vv []string) RuleRes

NewRuleRes returns a new rule.

func (RuleRes) DeepCopyObject

func (r RuleRes) DeepCopyObject() runtime.Object

DeepCopyObject returns a container copy.

func (RuleRes) GetObjectKind

func (r RuleRes) GetObjectKind() schema.ObjectKind

GetObjectKind returns a schema object.

type Rules

type Rules []RuleRes

Rules represents a collection of rules.

func (Rules) Upsert

func (rr Rules) Upsert(r RuleRes) Rules

Upsert adds a new rule.

type ScreenDump

type ScreenDump struct{}

ScreenDump renders a screendumps to screen.

func (ScreenDump) ColorerFunc

func (ScreenDump) ColorerFunc() ColorerFunc

ColorerFunc colors a resource row.

func (ScreenDump) Header

func (ScreenDump) Header(ns string) Header

Header returns a header row.

func (ScreenDump) Render

func (b ScreenDump) Render(o interface{}, ns string, r *Row) error

Render renders a K8s resource to screen.

type Section added in v0.19.0

type Section struct {
	Title   string  `json:"sanitizer" yaml:"sanitizer"`
	GVR     string  `yaml:"gvr" json:"gvr"`
	Tally   *Tally  `json:"tally" yaml:"tally"`
	Outcome Outcome `json:"issues,omitempty" yaml:"issues,omitempty"`
}

Section represents a sanitizer pass

func (Section) DeepCopyObject added in v0.19.0

func (s Section) DeepCopyObject() runtime.Object

DeepCopyObject returns a container copy.

func (Section) GetObjectKind added in v0.19.0

func (Section) GetObjectKind() schema.ObjectKind

GetObjectKind returns a schema object.

func (Section) MaxSeverity added in v0.19.0

func (s Section) MaxSeverity() config.Level

MaxSeverity gather the max severity in a collection of issues.

type Sections added in v0.19.0

type Sections []Section

Sections represents a collection of sections.

func (Sections) Len added in v0.19.0

func (s Sections) Len() int

Len returns a section length.

func (Sections) Less added in v0.19.0

func (s Sections) Less(i, j int) bool

Less compares section scores.

func (Sections) Swap added in v0.19.0

func (s Sections) Swap(i, j int)

Swap swaps values.

type Service

type Service struct{}

Service renders a K8s Service to screen.

func (Service) ColorerFunc

func (Service) ColorerFunc() ColorerFunc

ColorerFunc colors a resource row.

func (Service) Header

func (Service) Header(ns string) Header

Header returns a header row.

func (Service) Render

func (s Service) Render(o interface{}, ns string, r *Row) error

Render renders a K8s resource to screen.

type ServiceAccount

type ServiceAccount struct{}

ServiceAccount renders a K8s ServiceAccount to screen.

func (ServiceAccount) ColorerFunc

func (ServiceAccount) ColorerFunc() ColorerFunc

ColorerFunc colors a resource row.

func (ServiceAccount) Header

func (ServiceAccount) Header(ns string) Header

Header returns a header row.

func (ServiceAccount) Render

func (s ServiceAccount) Render(o interface{}, ns string, r *Row) error

Render renders a K8s resource to screen.

type StatefulSet

type StatefulSet struct{}

StatefulSet renders a K8s StatefulSet to screen.

func (StatefulSet) ColorerFunc

func (s StatefulSet) ColorerFunc() ColorerFunc

ColorerFunc colors a resource row.

func (StatefulSet) Header

func (StatefulSet) Header(ns string) Header

Header returns a header row.

func (StatefulSet) Render

func (s StatefulSet) Render(o interface{}, ns string, r *Row) error

Render renders a K8s resource to screen.

type StorageClass

type StorageClass struct{}

StorageClass renders a K8s StorageClass to screen.

func (StorageClass) ColorerFunc

func (StorageClass) ColorerFunc() ColorerFunc

ColorerFunc colors a resource row.

func (StorageClass) Header

func (StorageClass) Header(ns string) Header

Header returns a header row.

func (StorageClass) Render

func (StorageClass) Render(o interface{}, ns string, r *Row) error

Render renders a K8s resource to screen.

type StringSet

type StringSet []string

StringSet represents a collection of unique strings.

func (StringSet) Add

func (ss StringSet) Add(item string) StringSet

Add adds a new item in the set.

func (StringSet) In

func (ss StringSet) In(item string) bool

In checks if a string is in the set.

type Subject

type Subject struct{}

Subject renders a rbac to screen.

func (Subject) ColorerFunc

func (Subject) ColorerFunc() ColorerFunc

ColorerFunc colors a resource row.

func (Subject) Happy added in v0.16.0

func (Subject) Happy(_ string, _ Row) bool

Happy returns true if resoure is happy, false otherwise

func (Subject) Header

func (Subject) Header(ns string) Header

Header returns a header row.

func (Subject) Render

func (s Subject) Render(o interface{}, ns string, r *Row) error

Render renders a K8s resource to screen.

type SubjectRes

type SubjectRes struct {
	Name, Kind, FirstLocation string
}

SubjectRes represents a subject rule.

func (SubjectRes) DeepCopyObject

func (s SubjectRes) DeepCopyObject() runtime.Object

DeepCopyObject returns a container copy.

func (SubjectRes) GetObjectKind

func (SubjectRes) GetObjectKind() schema.ObjectKind

GetObjectKind returns a schema object.

type Subjects

type Subjects []SubjectRes

Subjects represents a collection of RBAC policies.

func (Subjects) Upsert

func (ss Subjects) Upsert(s SubjectRes) Subjects

Upsert adds a new subject.

type TableData

type TableData struct {
	Header    Header
	RowEvents RowEvents
	Namespace string
}

TableData tracks a K8s resource for tabular display.

func NewTableData

func NewTableData() *TableData

NewTableData returns a new table.

func (*TableData) Clear

func (t *TableData) Clear()

Clear clears out the entire table.

func (*TableData) Clone

func (t *TableData) Clone() TableData

Clone returns a copy of the table

func (*TableData) Customize added in v0.17.0

func (t *TableData) Customize(cols []string, wide bool) TableData

Customize returns a new model with customized column layout.

func (*TableData) Delete

func (t *TableData) Delete(newKeys map[string]struct{})

Delete removes items in cache that are no longer valid.

func (*TableData) Diff

func (t *TableData) Diff(table TableData) bool

Diff checks if two tables are equal.

func (*TableData) IndexOfHeader added in v0.21.0

func (t *TableData) IndexOfHeader(h string) int

IndexOfHeader return the index of the header.

func (*TableData) Labelize added in v0.19.3

func (t *TableData) Labelize(labels []string) TableData

Labelize prints out specific label columns

func (*TableData) SetHeader added in v0.13.8

func (t *TableData) SetHeader(ns string, h Header)

SetHeader sets table header.

func (*TableData) Update

func (t *TableData) Update(rows Rows)

Update computes row deltas and update the table data.

type Tally added in v0.19.0

type Tally struct {
	OK, Info, Warning, Error int
	Count                    int
}

Tally tracks a section scores.

func (*Tally) Score added in v0.19.0

func (t *Tally) Score() int

Score returns the overall sections score in percent.

func (*Tally) Sum added in v0.19.0

func (t *Tally) Sum() int

Sum sums up tally counts.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL