kube

package
v0.4.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var K8sResourcesChan = make(chan K8SResource)
View Source
var RegoRulesListChan = make(chan RegoRulesList)
View Source
var ResultChan = make(chan ValidateResult)

Functions

func GetK8SResources

func GetK8SResources(ctx context.Context, kubernetesClient *KubernetesClient)

GetK8SResources get kubernetes resources by GroupVersionResource, put the resources into the channel K8sResourcesChan, return error.

func GetK8SResourcesProvider

func GetK8SResourcesProvider(ctx context.Context, kubernetesClient *KubernetesClient) error

GetK8SResourcesProvider get kubeconfig by KubernetesAPI, get kubernetes resources by GetK8SResources.

func GetKubeConfig

func GetKubeConfig(kubeconfigPath string) (*rest.Config, error)

GetKubeConfig get the kubeconfig from path or by GetConfig

func GetObjectCounts added in v0.4.1

func GetObjectCounts(ctx context.Context, kubernetesClient *KubernetesClient, resource string, group string) (*unstructured.UnstructuredList, int, error)

GetObjectCounts get kubernetes resources by GroupVersion

Types

type Certificate

type Certificate struct {
	Name     string `yaml:"name" json:"name,omitempty"`
	Expires  string `yaml:"expires" json:"expires,omitempty"`
	Residual string `yaml:"residual" json:"residual,omitempty"`
}

type K8SResource

type K8SResource struct {
	ServerVersion    string
	CreationTime     time.Time
	APIServerAddress string
	Nodes            *unstructured.UnstructuredList
	NodesCount       int
	Namespaces       *unstructured.UnstructuredList
	NameSpacesCount  int
	NameSpacesList   []string
	Deployments      *unstructured.UnstructuredList
	DaemonSets       *unstructured.UnstructuredList
	StatefulSets     *unstructured.UnstructuredList
	Jobs             *unstructured.UnstructuredList
	CronJobs         *unstructured.UnstructuredList
	WorkloadsCount   int
	Roles            *unstructured.UnstructuredList
	ClusterRoles     *unstructured.UnstructuredList
	Events           *unstructured.UnstructuredList
}

type KubernetesClient

type KubernetesClient struct {
	KubeConfig    *rest.Config
	ClientSet     kubernetes.Interface
	DynamicClient dynamic.Interface
}

func (*KubernetesClient) K8SClients added in v0.4.0

func (k *KubernetesClient) K8SClients(kubeConfig *rest.Config) (*KubernetesClient, error)

K8SClients return kubeconfig clientset and dynamicClient.

type RegoRulesList

type RegoRulesList struct {
	RegoRules []string
}

type ResourceProvider

type ResourceProvider struct {
	ServerVersion   string
	CreationTime    time.Time
	AuditAddress    string
	Nodes           []corev1.Node
	Namespaces      []corev1.Namespace
	Pods            *corev1.PodList
	ConfigMap       []corev1.ConfigMap
	ProblemDetector []corev1.Event
	Workloads       []Workload
}

type ReturnMsg

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

type ValidateResult

type ValidateResult struct {
	Name      string
	Namespace string
	Type      string
	Level     string
	Message   string
	Reason    string
}

type Workload

type Workload struct {
	Kind       string
	Pod        corev1.Pod
	PodSpec    corev1.PodSpec
	ObjectMeta metav1.Object
}

Jump to

Keyboard shortcuts

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