resources

package
v3.0.4 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ExcludedLabels = map[string]string{"pod-template-generation": "",
	"app.kubernetes.io/name": "", "controller-revision-hash": "",
	"app.kubernetes.io/managed-by": "", "pod-template-hash": "",
	"statefulset.kubernetes.io/pod-name": "",
	"controler-uid":                      ""}

ExcludedLabels is a list of excluded label/selector from the dump

Functions

func GetResourceSetFromSlice

func GetResourceSetFromSlice(resourceSlice []string) (map[ResourceType]bool, error)

func ResourceToHeader

func ResourceToHeader(r ResourceType) string

Types

type APIResource

type APIResource struct {
	Name       string
	Shortnames []string
	Version    string
	Namespaced bool
	Kind       string
}

APIResource is the summary of a kubernetes pod

func (*APIResource) ToStrings

func (a *APIResource) ToStrings() []string

type APIResourceList

type APIResourceList struct {
	ApiResources []APIResource
	GroupVersion string
}

APIResource is the summary of a kubernetes pod

func (*APIResourceList) FromRuntime

func (r *APIResourceList) FromRuntime(obj interface{}, config CtorConfig)

FromRuntime builds object from the informer's result

func (*APIResourceList) GetFieldSelectors

func (r *APIResourceList) GetFieldSelectors() map[string]string

func (*APIResourceList) GetLabels

func (r *APIResourceList) GetLabels() map[string]string

func (*APIResourceList) GetNamespace

func (r *APIResourceList) GetNamespace() string

func (*APIResourceList) HasChanged

func (r *APIResourceList) HasChanged(k K8sResource) bool

func (*APIResourceList) ToStrings

func (r *APIResourceList) ToStrings() []string

ToString serializes the object to strings

type ConfigMap

type ConfigMap struct {
	ResourceMeta
}

ConfigMap is the summary of a kubernetes configMap

func (*ConfigMap) FromRuntime

func (c *ConfigMap) FromRuntime(obj interface{}, config CtorConfig)

FromRuntime builds object from the informer's result

func (*ConfigMap) HasChanged

func (c *ConfigMap) HasChanged(k K8sResource) bool

HasChanged returns true if the resource's dump needs to be updated

func (*ConfigMap) ToStrings

func (c *ConfigMap) ToStrings() []string

ToStrings serializes the object to strings

type CronJob

type CronJob struct {
	ResourceMeta
	Schedule     string
	LastSchedule string
	Containers   []string
}

CronJob is the summary of a kubernetes cronJob

func (*CronJob) FromRuntime

func (c *CronJob) FromRuntime(obj interface{}, config CtorConfig)

FromRuntime builds object from the informer's result

func (*CronJob) HasChanged

func (c *CronJob) HasChanged(k K8sResource) bool

HasChanged returns true if the resource's dump needs to be updated

func (*CronJob) ToStrings

func (c *CronJob) ToStrings() []string

ToString serializes the object to strings

type CtorConfig

type CtorConfig struct {
	IgnoredNodeRoles map[string]bool
}

CtorConfig is the configuration passed to all resource constructors

type DaemonSet

type DaemonSet struct {
	ResourceMeta
	Desired       string
	Current       string
	Ready         string
	Containers    []string
	LabelSelector []string
}

DaemonSet is the summary of a kubernetes daemonset

func (*DaemonSet) FromRuntime

func (d *DaemonSet) FromRuntime(obj interface{}, config CtorConfig)

FromRuntime builds object from the informer's result

func (*DaemonSet) HasChanged

func (d *DaemonSet) HasChanged(k K8sResource) bool

HasChanged returns true if the resource's dump needs to be updated

func (*DaemonSet) ToStrings

func (d *DaemonSet) ToStrings() []string

ToString serializes the object to strings

type Deployment

type Deployment struct {
	ResourceMeta
	DesiredReplicas   string
	AvailableReplicas string
	UpdatedReplicas   string
	CurrentReplicas   string
}

Deployment is the summary of a kubernetes deployment

func (*Deployment) FromRuntime

func (d *Deployment) FromRuntime(obj interface{}, config CtorConfig)

FromRuntime builds object from the informer's result

func (*Deployment) HasChanged

func (d *Deployment) HasChanged(k K8sResource) bool

HasChanged returns true if the resource's dump needs to be updated

func (*Deployment) ToStrings

func (d *Deployment) ToStrings() []string

ToString serializes the object to strings

type Endpoints

type Endpoints struct {
	ResourceMeta
	ReadyIps     []string
	ReadyPods    []string
	NotReadyIps  []string
	NotReadyPods []string
}

Endpoint is the summary of a kubernetes endpoints

func (*Endpoints) FromRuntime

func (e *Endpoints) FromRuntime(obj interface{}, config CtorConfig)

FromRuntime builds object from the informer's result

func (*Endpoints) HasChanged

func (e *Endpoints) HasChanged(k K8sResource) bool

HasChanged returns true if the resource's dump needs to be updated

func (*Endpoints) ToStrings

func (e *Endpoints) ToStrings() []string

ToString serializes the object to strings

type HorizontalPodAutoscaler

type HorizontalPodAutoscaler struct {
	ResourceMeta
	Reference       string
	Targets         string
	MinPods         string
	MaxPods         string
	CurrentReplicas string
}

HorizontalPodAutoscaler is the summary of a kubernetes horizontal pod autoscaler

func (*HorizontalPodAutoscaler) FromRuntime

func (h *HorizontalPodAutoscaler) FromRuntime(obj interface{}, config CtorConfig)

FromRuntime builds object from the informer's result

func (*HorizontalPodAutoscaler) HasChanged

func (h *HorizontalPodAutoscaler) HasChanged(k K8sResource) bool

HasChanged returns true if the resource'h dump needs to be updated

func (*HorizontalPodAutoscaler) ToStrings

func (h *HorizontalPodAutoscaler) ToStrings() []string

ToString serializes the object to strings

type Ingress

type Ingress struct {
	ResourceMeta
	Address []string
}

Ingress is the summary of a kubernetes ingress

func (*Ingress) FromRuntime

func (ingress *Ingress) FromRuntime(obj interface{}, config CtorConfig)

FromRuntime builds object from the informer's result

func (*Ingress) HasChanged

func (ingress *Ingress) HasChanged(k K8sResource) bool

HasChanged returns true if the resource's dump needs to be updated

func (*Ingress) ToStrings

func (ingress *Ingress) ToStrings() []string

ToString serializes the object to strings

type Job

type Job struct {
	ResourceMeta
	Completions string
	Containers  []string
}

Job is the summary of a kubernetes Job

func (*Job) FromRuntime

func (j *Job) FromRuntime(obj interface{}, config CtorConfig)

FromRuntime builds object from the informer's result

func (*Job) HasChanged

func (j *Job) HasChanged(k K8sResource) bool

HasChanged returns true if the resource's dump needs to be updated

func (*Job) ToStrings

func (j *Job) ToStrings() []string

ToString serializes the object to strings

type K8sResource

type K8sResource interface {
	GetNamespace() string
	GetLabels() map[string]string
	GetFieldSelectors() map[string]string

	HasChanged(k K8sResource) bool
	ToStrings() []string
	FromRuntime(obj interface{}, config CtorConfig)
}

K8sResource is the generic information of a k8s entity

func NewConfigMapFromRuntime

func NewConfigMapFromRuntime(obj interface{}, config CtorConfig) K8sResource

NewConfigMapFromRuntime builds a pod from informer result

func NewCronJobFromRuntime

func NewCronJobFromRuntime(obj interface{}, config CtorConfig) K8sResource

NewCronJobFromRuntime builds a cronJob from informer result

func NewDaemonSetFromRuntime

func NewDaemonSetFromRuntime(obj interface{}, config CtorConfig) K8sResource

NewDaemonSetFromRuntime builds a daemonset from informer result

func NewDeploymentFromRuntime

func NewDeploymentFromRuntime(obj interface{}, config CtorConfig) K8sResource

NewDeploymentFromRuntime builds a k8sresource from informer result

func NewEndpointsFromRuntime

func NewEndpointsFromRuntime(obj interface{}, config CtorConfig) K8sResource

NewEndpointsFromRuntime builds a k8s resource from informer result

func NewHorizontalPodAutoscalerFromRuntime

func NewHorizontalPodAutoscalerFromRuntime(obj interface{}, config CtorConfig) K8sResource

NewHorizontalPodAutoscalerFromRuntime builds a pod from informer result

func NewIngressFromRuntime

func NewIngressFromRuntime(obj interface{}, config CtorConfig) K8sResource

NewIngressFromRuntime builds a pod from informer result

func NewJobFromRuntime

func NewJobFromRuntime(obj interface{}, config CtorConfig) K8sResource

NewJobFromRuntime builds a Job from informer result

func NewNamespaceFromRuntime

func NewNamespaceFromRuntime(obj interface{}, config CtorConfig) K8sResource

NewNamespaceFromRuntime builds a pod from informer result

func NewNodeFromRuntime

func NewNodeFromRuntime(obj interface{}, config CtorConfig) K8sResource

NewNodeFromRuntime builds a k8sresoutce from informer result

func NewPersistentVolumeClaimFromRuntime

func NewPersistentVolumeClaimFromRuntime(obj interface{}, config CtorConfig) K8sResource

NewPersistentVolumeClaimFromRuntime builds a pod from informer result

func NewPersistentVolumeFromRuntime

func NewPersistentVolumeFromRuntime(obj interface{}, config CtorConfig) K8sResource

NewPersistentVolumeFromRuntime builds a pod from informer result

func NewPodFromRuntime

func NewPodFromRuntime(obj interface{}, config CtorConfig) K8sResource

NewPodFromRuntime builds a pod from informer result

func NewReplicaSetFromRuntime

func NewReplicaSetFromRuntime(obj interface{}, config CtorConfig) K8sResource

NewReplicaSetFromRuntime builds a k8sresource from informer result

func NewSecretFromRuntime

func NewSecretFromRuntime(obj interface{}, config CtorConfig) K8sResource

NewSecretFromRuntime builds a secret from informer result

func NewServiceAccountFromRuntime

func NewServiceAccountFromRuntime(obj interface{}, config CtorConfig) K8sResource

NewServiceAccountFromRuntime builds a pod from informer result

func NewServiceFromRuntime

func NewServiceFromRuntime(obj interface{}, config CtorConfig) K8sResource

NewServiceFromRuntime builds a pod from informer result

func NewStatefulSetFromRuntime

func NewStatefulSetFromRuntime(obj interface{}, config CtorConfig) K8sResource

NewStatefulSetFromRuntime builds a k8sresource from informer result

type Namespace

type Namespace struct {
	ResourceMeta
}

Namespace is the summary of a kubernetes configMap

func (*Namespace) FromRuntime

func (c *Namespace) FromRuntime(obj interface{}, config CtorConfig)

FromRuntime builds object from the informer's result

func (*Namespace) HasChanged

func (c *Namespace) HasChanged(k K8sResource) bool

HasChanged returns true if the resource's dump needs to be updated

func (*Namespace) ToStrings

func (c *Namespace) ToStrings() []string

ToString serializes the object to strings

type Node

type Node struct {
	ResourceMeta
	Roles        []string
	Status       string
	InstanceType string
	Zone         string
	InstanceID   string
	InternalIP   string
	Taints       []string
}

Node is the summary of a kubernetes node

func (*Node) FromRuntime

func (n *Node) FromRuntime(obj interface{}, config CtorConfig)

FromRuntime builds object from the informer's result

func (*Node) HasChanged

func (n *Node) HasChanged(k K8sResource) bool

HasChanged returns true if the resource's dump needs to be updated

func (*Node) ToStrings

func (n *Node) ToStrings() []string

ToString serializes the object to strings

type PersistentVolume

type PersistentVolume struct {
	ResourceMeta
	Status       string
	Claim        string
	Volume       string
	Zone         string
	Spec         string
	Affinities   []string
	StorageClass string
}

PersistentVolume is the summary of a kubernetes persistent volume

func (*PersistentVolume) FromRuntime

func (pv *PersistentVolume) FromRuntime(obj interface{}, config CtorConfig)

FromRuntime builds object from the informer's result

func (*PersistentVolume) HasChanged

func (pv *PersistentVolume) HasChanged(k K8sResource) bool

HasChanged returns true if the resource's dump needs to be updated

func (*PersistentVolume) ToStrings

func (pv *PersistentVolume) ToStrings() []string

ToString serializes the object to strings

type PersistentVolumeClaim

type PersistentVolumeClaim struct {
	ResourceMeta
	Status       string
	VolumeName   string
	Capacity     string
	StorageClass string
}

PersistentVolumeClaim is the summary of a kubernetes physical volume claim

func (*PersistentVolumeClaim) FromRuntime

func (pvc *PersistentVolumeClaim) FromRuntime(obj interface{}, config CtorConfig)

FromRuntime builds object from the informer's result

func (*PersistentVolumeClaim) HasChanged

func (pvc *PersistentVolumeClaim) HasChanged(k K8sResource) bool

HasChanged returns true if the resource's dump needs to be updated

func (*PersistentVolumeClaim) ToStrings

func (pvc *PersistentVolumeClaim) ToStrings() []string

ToString serializes the object to strings

type Pod

type Pod struct {
	ResourceMeta
	HostIP      string
	PodIP       string
	NodeName    string
	Tolerations []string
	Containers  []string
	Claims      []string
	Phase       string
	QosClass    string
	Resource    string
}

Pod is the summary of a kubernetes pod

func (*Pod) FromRuntime

func (p *Pod) FromRuntime(obj interface{}, config CtorConfig)

FromRuntime builds object from the informer's result

func (*Pod) GetFieldSelectors

func (p *Pod) GetFieldSelectors() map[string]string

func (*Pod) HasChanged

func (p *Pod) HasChanged(k K8sResource) bool

HasChanged returns true if the resource's dump needs to be updated

func (*Pod) ToStrings

func (p *Pod) ToStrings() []string

ToString serializes the object to strings

type ReplicaSet

type ReplicaSet struct {
	ResourceMeta
	Replicas          string
	ReadyReplicas     string
	AvailableReplicas string
	Selectors         []string
}

ReplicaSet is the summary of a kubernetes replicaSet

func (*ReplicaSet) FromRuntime

func (r *ReplicaSet) FromRuntime(obj interface{}, config CtorConfig)

FromRuntime builds object from the informer's result

func (*ReplicaSet) HasChanged

func (r *ReplicaSet) HasChanged(k K8sResource) bool

HasChanged returns true if the resource'r dump needs to be updated

func (*ReplicaSet) ToStrings

func (r *ReplicaSet) ToStrings() []string

ToString serializes the object to strings

type ResourceCtor

type ResourceCtor func(obj interface{}, config CtorConfig) K8sResource

func ResourceTypeToCtor

func ResourceTypeToCtor(resourceType ResourceType) ResourceCtor

type ResourceMeta

type ResourceMeta struct {
	Name         string
	Namespace    string // Namespace can be None
	Labels       map[string]string
	CreationTime time.Time
}

ResourceMeta is the generic information of a k8s entity

func (*ResourceMeta) FromDynamicMeta

func (r *ResourceMeta) FromDynamicMeta(u *unstructured.Unstructured, config CtorConfig)

FromDynamicMeta copies meta information to the object

func (*ResourceMeta) FromObjectMeta

func (r *ResourceMeta) FromObjectMeta(meta metav1.ObjectMeta, config CtorConfig)

FromObjectMeta copies meta information to the object

func (*ResourceMeta) GetFieldSelectors

func (r *ResourceMeta) GetFieldSelectors() map[string]string

func (*ResourceMeta) GetLabels

func (r *ResourceMeta) GetLabels() map[string]string

func (*ResourceMeta) GetNamespace

func (r *ResourceMeta) GetNamespace() string

type ResourceType

type ResourceType int64
const (
	ResourceTypeApiResource ResourceType = iota
	ResourceTypeConfigMap
	ResourceTypeCronJob
	ResourceTypeDaemonSet
	ResourceTypeDeployment
	ResourceTypeEndpoints
	ResourceTypeHorizontalPodAutoscaler
	ResourceTypeIngress
	ResourceTypeJob
	ResourceTypeNamespace
	ResourceTypeNode
	ResourceTypePod
	ResourceTypePersistentVolume
	ResourceTypePersistentVolumeClaim
	ResourceTypeReplicaSet
	ResourceTypeSecret
	ResourceTypeService
	ResourceTypeServiceAccount
	ResourceTypeStatefulSet
	ResourceTypeUnknown
)

func GetResourceType

func GetResourceType(cmdUse string, args []string) ResourceType

func ParseResourceType

func ParseResourceType(s string) ResourceType

func (ResourceType) IsNamespaced added in v3.0.3

func (r ResourceType) IsNamespaced() bool

func (ResourceType) String

func (r ResourceType) String() string

type Secret

type Secret struct {
	ResourceMeta
	SecretType string
	Data       string
}

Secret is the summary of a kubernetes secret

func (*Secret) FromRuntime

func (s *Secret) FromRuntime(obj interface{}, config CtorConfig)

FromRuntime builds object from the informer's result

func (*Secret) HasChanged

func (s *Secret) HasChanged(k K8sResource) bool

HasChanged returns true if the resource's dump needs to be updated

func (*Secret) ToStrings

func (s *Secret) ToStrings() []string

ToString serializes the object to strings

type Service

type Service struct {
	ResourceMeta
	ServiceType string
	ClusterIP   string
	Ports       []string
	Selectors   []string
}

Service is the summary of a kubernetes service

func (*Service) FromRuntime

func (s *Service) FromRuntime(obj interface{}, config CtorConfig)

FromRuntime builds object from the informer's result

func (*Service) HasChanged

func (s *Service) HasChanged(k K8sResource) bool

HasChanged returns true if the resource's dump needs to be updated

func (*Service) ToStrings

func (s *Service) ToStrings() []string

ToString serializes the object to strings

type ServiceAccount

type ServiceAccount struct {
	ResourceMeta
	NumberSecrets string
}

ServiceAccount is the summary of a kubernetes service account

func (*ServiceAccount) FromRuntime

func (s *ServiceAccount) FromRuntime(obj interface{}, config CtorConfig)

FromRuntime builds object from the informer's result

func (*ServiceAccount) HasChanged

func (s *ServiceAccount) HasChanged(k K8sResource) bool

HasChanged returns true if the resource's dump needs to be updated

func (*ServiceAccount) ToStrings

func (s *ServiceAccount) ToStrings() []string

ToString serializes the object to strings

type StatefulSet

type StatefulSet struct {
	ResourceMeta
	// contains filtered or unexported fields
}

StatefulSet is the summary of a kubernetes statefulset

func (*StatefulSet) FromRuntime

func (s *StatefulSet) FromRuntime(obj interface{}, config CtorConfig)

FromRuntime builds object from the informer's result

func (*StatefulSet) HasChanged

func (s *StatefulSet) HasChanged(k K8sResource) bool

HasChanged returns true if the resource's dump needs to be updated

func (*StatefulSet) ToStrings

func (s *StatefulSet) ToStrings() []string

ToString serializes the object to strings

type UnknownResourceError

type UnknownResourceError struct {
	ResourceStr string
}

func (UnknownResourceError) Error

func (u UnknownResourceError) Error() string

Jump to

Keyboard shortcuts

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