resources

package
v0.0.0-...-7cc3570 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ResourceTypes represents the set of resource types.
	// Resouces are grouped by the same level of abstraction.
	ResourceTypes = []string{"hpa cronjob", "deploy job", "sts ds rs", "pod", "pvc", "svc", "ing"}
)

Functions

func NormalizeResource

func NormalizeResource(resource string) (string, error)

NormalizeResource resturns normalized name of the resource. It returns error if it fails to normalize the resource name. key of normalizedNames map is used as the normalized name.

Types

type Resources

type Resources struct {
	Namespace string

	Svcs      *corev1.ServiceList
	Pvcs      *corev1.PersistentVolumeClaimList
	Pods      *corev1.PodList
	Stss      *appsv1.StatefulSetList
	Dss       *appsv1.DaemonSetList
	Rss       *appsv1.ReplicaSetList
	Deploys   *appsv1.DeploymentList
	Jobs      *batchv1.JobList
	CronJobs  *batchv1.CronJobList
	Ingresses *netv1.IngressList
	Hpas      *autov1.HorizontalPodAutoscalerList
	// contains filtered or unexported fields
}

Resources represents the k8s resources

func NewResources

func NewResources(clientset kubernetes.Interface, namespace string) (*Resources, error)

NewResources resturns Resources for the namespace

func (*Resources) GetResourceNames

func (r *Resources) GetResourceNames(kind string) []string

GetResourceNames returns the resource names of the kind

func (*Resources) HasResource

func (r *Resources) HasResource(kind, name string) bool

HasResource check if Resources has k8s resource with the kind and the name

Jump to

Keyboard shortcuts

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