sanitize

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2019 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToPerc

func ToPerc(v1, v2 int64) int64

ToPerc computes the percentage from one number over another.

Types

type Cluster added in v0.4.0

type Cluster struct {
	*issues.Collector
	ClusterLister
}

Cluster tracks cluster sanitization.

func NewCluster added in v0.4.0

func NewCluster(co *issues.Collector, lister ClusterLister) *Cluster

NewCluster returns a new Cluster sanitizer.

func (*Cluster) Sanitize added in v0.4.0

func (c *Cluster) Sanitize(ctx context.Context) error

Sanitize configmaps.

type ClusterLister added in v0.4.0

type ClusterLister interface {
	ListVersion() (string, string)
}

ClusterLister list available Clusters on a cluster.

type ClusterMetricsLister

type ClusterMetricsLister interface {
	ListClusterMetrics() v1.ResourceList
}

ClusterMetricsLister handles cluster metrics.

type ClusterRoleBindingLister

type ClusterRoleBindingLister interface {
	ListClusterRoleBindings() map[string]*rbacv1.ClusterRoleBinding
}

ClusterRoleBindingLister list all available ClusterRoleBindings.

type Collector

type Collector interface {
	Outcome() issues.Outcome
	AddSubCode(id issues.ID, p, s string, args ...interface{})
}

Collector collects sub issues.

type ConfigLister

type ConfigLister interface {
	CPUResourceLimits() config.Allocations
	MEMResourceLimits() config.Allocations
}

ConfigLister tracks configuration parameters.

type ConfigMap

type ConfigMap struct {
	*issues.Collector
	ConfigMapLister
}

ConfigMap tracks ConfigMap sanitization.

func NewConfigMap

func NewConfigMap(c *issues.Collector, lister ConfigMapLister) *ConfigMap

NewConfigMap returns a new ConfigMap sanitizer.

func (*ConfigMap) Sanitize

func (c *ConfigMap) Sanitize(context.Context) error

Sanitize a configmap.

type ConfigMapLister

type ConfigMapLister interface {
	PodRefs
	ListConfigMaps() map[string]*v1.ConfigMap
}

ConfigMapLister list available ConfigMaps on a cluster.

type ConsumptionMetrics

type ConsumptionMetrics struct {
	QOS                    v1.PodQOSClass
	CurrentCPU, CurrentMEM resource.Quantity
	RequestCPU, RequestMEM resource.Quantity
	LimitCPU, LimitMEM     resource.Quantity
	RequestedStorage       resource.Quantity
}

ConsumptionMetrics tracks managed pods resource utilization.

func (*ConsumptionMetrics) LimitCPURatio added in v0.3.10

func (d *ConsumptionMetrics) LimitCPURatio() float64

LimitCPURatio returns current cpu usage over requested percentage.

func (*ConsumptionMetrics) LimitMEMRatio added in v0.3.10

func (d *ConsumptionMetrics) LimitMEMRatio() float64

LimitMEMRatio returns current memory usage over requested percentage.

func (*ConsumptionMetrics) ReqAbsCPURatio added in v0.3.10

func (d *ConsumptionMetrics) ReqAbsCPURatio() float64

ReqAbsCPURatio returns abasolute cpu ratio.

func (*ConsumptionMetrics) ReqAbsMEMRatio added in v0.3.10

func (d *ConsumptionMetrics) ReqAbsMEMRatio() float64

ReqAbsMEMRatio returns absolute mem ratio.

func (*ConsumptionMetrics) ReqCPURatio

func (d *ConsumptionMetrics) ReqCPURatio() float64

ReqCPURatio returns current cpu usage over requested percentage.

func (*ConsumptionMetrics) ReqMEMRatio

func (d *ConsumptionMetrics) ReqMEMRatio() float64

ReqMEMRatio returns current memory usage over requested percentage.

type Container

type Container struct {
	LimitCollector
	// contains filtered or unexported fields
}

Container represents a Container linter.

func NewContainer

func NewContainer(fqn string, c LimitCollector) *Container

NewContainer returns a new container linter.

type DaemonLister added in v0.4.0

type DaemonLister interface {
	ListDaemonSets() map[string]*appsv1.DaemonSet
}

DaemonLister list DaemonSets.

type DaemonSet added in v0.4.0

type DaemonSet struct {
	*issues.Collector
	DaemonSetLister
}

DaemonSet tracks DaemonSet sanitization.

func NewDaemonSet added in v0.4.0

func NewDaemonSet(co *issues.Collector, lister DaemonSetLister) *DaemonSet

NewDaemonSet returns a new DaemonSet sanitizer.

func (*DaemonSet) Sanitize added in v0.4.0

func (d *DaemonSet) Sanitize(ctx context.Context) error

Sanitize configmaps.

type DaemonSetLister added in v0.4.0

DaemonSetLister list available DaemonSets on a cluster.

type DeployLister

type DeployLister interface {
	ListDeployments() map[string]*appsv1.Deployment
}

DeployLister list deployments.

type Deployment

type Deployment struct {
	*issues.Collector
	DeploymentLister
}

Deployment tracks Deployment sanitization.

func NewDeployment

func NewDeployment(co *issues.Collector, lister DeploymentLister) *Deployment

NewDeployment returns a new Deployment sanitizer.

func (*Deployment) Sanitize

func (d *Deployment) Sanitize(ctx context.Context) error

Sanitize configmaps.

type DeploymentLister

DeploymentLister list available Deployments on a cluster.

type EndPointLister

type EndPointLister interface {
	GetEndpoints(string) *v1.Endpoints
}

EndPointLister find all service endpoints.

type HorizontalPodAutoscaler

type HorizontalPodAutoscaler struct {
	*issues.Collector
	HpaLister
}

HorizontalPodAutoscaler represents a HorizontalPodAutoscaler linter.

func NewHorizontalPodAutoscaler

func NewHorizontalPodAutoscaler(co *issues.Collector, lister HpaLister) *HorizontalPodAutoscaler

NewHorizontalPodAutoscaler returns a new ServiceAccount linter.

func (*HorizontalPodAutoscaler) Sanitize

func (h *HorizontalPodAutoscaler) Sanitize(ctx context.Context) error

Sanitize an horizontalpodautoscaler.

type HpaLister

type HpaLister interface {
	DeployLister
	StatefulSetLister
	ClusterMetricsLister
	NodeMetricsLister
	ListHorizontalPodAutoscalers() map[string]*autoscalingv1.HorizontalPodAutoscaler
}

HpaLister list available hpas on a cluster.

type IngLister added in v0.4.0

type IngLister interface {
	ListIngresses() map[string]*nv1beta1.Ingress
}

IngLister list deployments.

type Ingress added in v0.4.0

type Ingress struct {
	*issues.Collector
	IngressLister
}

Ingress tracks Ingress sanitization.

func NewIngress added in v0.4.0

func NewIngress(co *issues.Collector, lister IngressLister) *Ingress

NewIngress returns a new Ingress sanitizer.

func (*Ingress) Sanitize added in v0.4.0

func (d *Ingress) Sanitize(ctx context.Context) error

Sanitize configmaps.

type IngressLister added in v0.4.0

type IngressLister interface {
	IngLister
}

IngressLister list available Ingresss on a cluster.

type LimitCollector

type LimitCollector interface {
	Collector
	PodLimiter
}

LimitCollector represents a collector with resource limits.

type Namespace

type Namespace struct {
	*issues.Collector
	NamespaceLister
}

Namespace represents a Namespace sanitizer.

func NewNamespace

func NewNamespace(co *issues.Collector, lister NamespaceLister) *Namespace

NewNamespace returns a new namespace linter.

func (*Namespace) Sanitize

func (n *Namespace) Sanitize(ctx context.Context) error

Sanitize a namespace

type NamespaceLister

type NamespaceLister interface {
	NamespaceRefs
	ListNamespaces() map[string]*v1.Namespace
}

NamespaceLister lists all namespaces.

type NamespaceRefs

type NamespaceRefs interface {
	ReferencedNamespaces(map[string]struct{})
}

NamespaceRefs tracks namespace references in the cluster.

type NamespaceSelectorLister added in v0.4.0

type NamespaceSelectorLister interface {
	ListNamespacesBySelector(sel *metav1.LabelSelector) map[string]*v1.Namespace
}

NamespaceSelectorLister list a collection of namespaces matching a selector.

type NetworkPolicy added in v0.4.0

type NetworkPolicy struct {
	*issues.Collector
	NetworkPolicyLister
}

NetworkPolicy tracks NetworkPolicy sanitization.

func NewNetworkPolicy added in v0.4.0

func NewNetworkPolicy(co *issues.Collector, lister NetworkPolicyLister) *NetworkPolicy

NewNetworkPolicy returns a new NetworkPolicy sanitizer.

func (*NetworkPolicy) Sanitize added in v0.4.0

func (n *NetworkPolicy) Sanitize(ctx context.Context) error

Sanitize configmaps.

type NetworkPolicyLister added in v0.4.0

type NetworkPolicyLister interface {
	PodSelectorLister
	NamespaceSelectorLister
	ListNetworkPolicies() map[string]*nv1.NetworkPolicy
}

NetworkPolicyLister list available NetworkPolicys on a cluster.

type Node

type Node struct {
	*issues.Collector
	NodeLister
}

Node represents a Node linter.

func NewNode

func NewNode(co *issues.Collector, lister NodeLister) *Node

NewNode returns a new Node linter.

func (*Node) Sanitize

func (n *Node) Sanitize(ctx context.Context) error

Sanitize a Node.

type NodeLimiter

type NodeLimiter interface {
	NodeCPULimit() float64
	NodeMEMLimit() float64
}

NodeLimiter tracks metrics limit range.

type NodeLister

type NodeLister interface {
	NodeMetricsLister
	PodLister
	NodeLimiter
	ListNodes() map[string]*v1.Node
}

NodeLister lists available nodes.

type NodeMetricsLister

type NodeMetricsLister interface {
	ListNodesMetrics() map[string]*mv1beta1.NodeMetrics
}

NodeMetricsLister handle

type PdbLister added in v0.3.10

type PdbLister interface {
	ListPodDisruptionBudgets() map[string]*pv1beta1.PodDisruptionBudget
	ForLabels(labels map[string]string) *pv1beta1.PodDisruptionBudget
}

PdbLister list pdb matching a given selector

type PersistentVolume

type PersistentVolume struct {
	*issues.Collector
	PersistentVolumeLister
}

PersistentVolume represents a PersistentVolume sanitizer.

func NewPersistentVolume

func NewPersistentVolume(co *issues.Collector, lister PersistentVolumeLister) *PersistentVolume

NewPersistentVolume returns a new PersistentVolume sanitizer.

func (*PersistentVolume) Sanitize

func (p *PersistentVolume) Sanitize(ctx context.Context) error

Sanitize a PersistentVolume.

type PersistentVolumeClaim

type PersistentVolumeClaim struct {
	*issues.Collector
	PersistentVolumeClaimLister
}

PersistentVolumeClaim represents a PersistentVolumeClaim sanitizer.

func NewPersistentVolumeClaim

func NewPersistentVolumeClaim(co *issues.Collector, lister PersistentVolumeClaimLister) *PersistentVolumeClaim

NewPersistentVolumeClaim returns a new PersistentVolumeClaim sanitizer.

func (*PersistentVolumeClaim) Sanitize

func (p *PersistentVolumeClaim) Sanitize(ctx context.Context) error

Sanitize a PersistentVolumeClaim.

type PersistentVolumeClaimLister

type PersistentVolumeClaimLister interface {
	ListPersistentVolumeClaims() map[string]*v1.PersistentVolumeClaim
	PodLister
}

PersistentVolumeClaimLister list available PersistentVolumeClaim on a cluster.

type PersistentVolumeLister

type PersistentVolumeLister interface {
	ListPersistentVolumes() map[string]*v1.PersistentVolume
}

PersistentVolumeLister list available PersistentVolume on a cluster.

type Pod

type Pod struct {
	*issues.Collector
	PodMXLister
}

Pod represents a Pod linter.

func NewPod

func NewPod(co *issues.Collector, lister PodMXLister) *Pod

NewPod returns a new pod linter.

func (*Pod) Sanitize

func (p *Pod) Sanitize(ctx context.Context) error

Sanitize a Pod.

type PodDisruptionBudget added in v0.3.10

type PodDisruptionBudget struct {
	*issues.Collector
	PodDisruptionBudgetLister
}

PodDisruptionBudget tracks PodDisruptionBudget sanitization.

func NewPodDisruptionBudget added in v0.3.10

func NewPodDisruptionBudget(c *issues.Collector, lister PodDisruptionBudgetLister) *PodDisruptionBudget

NewPodDisruptionBudget returns a new PodDisruptionBudget sanitizer.

func (*PodDisruptionBudget) Sanitize added in v0.3.10

Sanitize a configmap.

type PodDisruptionBudgetLister added in v0.3.10

type PodDisruptionBudgetLister interface {
	PodLister
	ListPodDisruptionBudgets() map[string]*pv1beta1.PodDisruptionBudget
}

PodDisruptionBudgetLister list available PodDisruptionBudgets on a cluster.

type PodGetter

type PodGetter interface {
	GetPod(map[string]string) *v1.Pod
}

PodGetter find a single pod matching service selector.

type PodLimiter

type PodLimiter interface {
	PodCPULimit() float64
	PodMEMLimit() float64
	RestartsLimit() int
}

PodLimiter tracks metrics limit range.

type PodLister

type PodLister interface {
	ListPods() map[string]*v1.Pod
	GetPod(sel map[string]string) *v1.Pod
}

PodLister lists available pods.

type PodMXLister

type PodMXLister interface {
	PodLimiter
	PodMetricsLister
	PodLister
	PdbLister
}

PodMXLister list available pods.

type PodMetric

type PodMetric interface {
	CurrentCPU() int64
	CurrentMEM() int64
	Empty() bool
}

PodMetric tracks node metrics available and current range.

type PodMetricsLister

type PodMetricsLister interface {
	ListPodsMetrics() map[string]*mv1beta1.PodMetrics
}

PodMetricsLister handles pods metrics.

type PodRefs

type PodRefs interface {
	PodRefs(cache.ObjReferences)
}

PodRefs tracks pods object references.

type PodSecurityPolicy added in v0.4.0

type PodSecurityPolicy struct {
	*issues.Collector
	PodSecurityPolicyLister
}

PodSecurityPolicy tracks PodSecurityPolicy sanitization.

func NewPodSecurityPolicy added in v0.4.0

func NewPodSecurityPolicy(co *issues.Collector, lister PodSecurityPolicyLister) *PodSecurityPolicy

NewPodSecurityPolicy returns a new PodSecurityPolicy sanitizer.

func (*PodSecurityPolicy) Sanitize added in v0.4.0

func (p *PodSecurityPolicy) Sanitize(ctx context.Context) error

Sanitize configmaps.

type PodSecurityPolicyLister added in v0.4.0

type PodSecurityPolicyLister interface {
	ListPodSecurityPolicies() map[string]*pv1beta1.PodSecurityPolicy
}

PodSecurityPolicyLister list available PodSecurityPolicys on a cluster.

type PodSelectorLister

type PodSelectorLister interface {
	ListPodsBySelector(sel *metav1.LabelSelector) map[string]*v1.Pod
}

PodSelectorLister list a collection of pod matching a selector.

type PodsMetricsLister

type PodsMetricsLister interface {
	ListPodsMetrics() map[string]*mv1beta1.PodMetrics
}

PodsMetricsLister handles pods metrics.

type PopeyeKey added in v0.3.13

type PopeyeKey string

PopeyeKey tracks context keys.

type ReplicaLister added in v0.4.0

type ReplicaLister interface {
	ListReplicaSets() map[string]*appsv1.ReplicaSet
}

ReplicaLister list replicaset.

type ReplicaSet added in v0.4.0

type ReplicaSet struct {
	*issues.Collector
	ReplicaSetLister
}

ReplicaSet tracks ReplicaSet sanitization.

func NewReplicaSet added in v0.4.0

func NewReplicaSet(co *issues.Collector, lister ReplicaSetLister) *ReplicaSet

NewReplicaSet returns a new ReplicaSet sanitizer.

func (*ReplicaSet) Sanitize added in v0.4.0

func (d *ReplicaSet) Sanitize(ctx context.Context) error

Sanitize configmaps.

type ReplicaSetLister added in v0.4.0

type ReplicaSetLister interface {
	ReplicaLister
}

ReplicaSetLister list available ReplicaSets on a cluster.

type RoleBindingLister

type RoleBindingLister interface {
	ListRoleBindings() map[string]*rbacv1.RoleBinding
}

RoleBindingLister list all available ClusterRoleBindings.

type SARefs

type SARefs interface {
	ServiceAccountRefs(cache.ObjReferences)
}

SARefs tracks ServiceAccount object references.

type Secret

type Secret struct {
	*issues.Collector
	SecretLister
}

Secret tracks Secret sanitization.

func NewSecret

func NewSecret(co *issues.Collector, lister SecretLister) *Secret

NewSecret returns a new Secret sanitizer.

func (*Secret) Sanitize

func (s *Secret) Sanitize(context.Context) error

Sanitize a secret.

type SecretLister

type SecretLister interface {
	PodRefs
	SARefs
	ListSecrets() map[string]*v1.Secret
}

SecretLister list available Secrets on a cluster.

type Service

type Service struct {
	*issues.Collector
	ServiceLister
}

Service represents a service linter.

func NewService

func NewService(co *issues.Collector, lister ServiceLister) *Service

NewService returns a new service linter.

func (*Service) Sanitize

func (s *Service) Sanitize(ctx context.Context) error

Sanitize services.

type ServiceAccount

type ServiceAccount struct {
	*issues.Collector

	ServiceAccountLister
}

ServiceAccount tracks ServiceAccount sanitizer.

func NewServiceAccount

func NewServiceAccount(co *issues.Collector, lister ServiceAccountLister) *ServiceAccount

NewServiceAccount returns a new ServiceAccount linter.

func (*ServiceAccount) Sanitize

func (s *ServiceAccount) Sanitize(ctx context.Context) error

Sanitize a serviceaccount.

type ServiceAccountLister

type ServiceAccountLister interface {
	PodLister
	ClusterRoleBindingLister
	RoleBindingLister
	SecretLister

	ListServiceAccounts() map[string]*v1.ServiceAccount
}

ServiceAccountLister list available ServiceAccounts on a cluster.

type ServiceLister

type ServiceLister interface {
	PodGetter
	EndPointLister
	ListServices() map[string]*v1.Service
}

ServiceLister list available Services on a cluster.

type StatefulSet

type StatefulSet struct {
	*issues.Collector
	StatefulSetLister
}

StatefulSet represents a StatefulSet sanitizer.

func NewStatefulSet

func NewStatefulSet(co *issues.Collector, lister StatefulSetLister) *StatefulSet

NewStatefulSet returns a new StatefulSet linter.

func (*StatefulSet) Sanitize

func (s *StatefulSet) Sanitize(ctx context.Context) error

Sanitize a StatefulSet.

type StatefulSetLister

type StatefulSetLister interface {
	PodLimiter
	ConfigLister
	PodSelectorLister
	PodsMetricsLister

	ListStatefulSets() map[string]*appsv1.StatefulSet
}

StatefulSetLister handles statefulsets.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳