kube

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var K8sResourcesChan = make(chan K8SResource)
View Source
var KubeConfig *rest.Config
View Source
var RegoRulesListChan = make(chan RegoRulesList)
View Source
var ResultChan = make(chan ValidateResult)
View Source
var ValidateResultsChan = make(chan ValidateResults)

Functions

func ClientSet

func ClientSet(path string) *kubernetes.Clientset

ClientSet return clientset

func DynamicClient

func DynamicClient(path string) dynamic.Interface

DynamicClient return dynamicClient

func GetK8SResources

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

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

func GetK8SResourcesProvider

func GetK8SResourcesProvider(ctx context.Context, kubeconfig string)

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

func GetKubeConfig

func GetKubeConfig(kubeconfigPath string) *rest.Config

GetKubeConfig get the kubeconfig from path or by GetConfig

Types

type K8SResource

type K8SResource struct {
	ServerVersion string
	CreationTime  time.Time
	AuditAddress  string
	Nodes         []unstructured.Unstructured
	Namespaces    []unstructured.Unstructured
	Deployments   []unstructured.Unstructured
	DaemonSets    []unstructured.Unstructured
	StatefulSets  []unstructured.Unstructured
	Jobs          []unstructured.Unstructured
	CronJobs      []unstructured.Unstructured
	Roles         []unstructured.Unstructured
	ClusterRoles  []unstructured.Unstructured
	Events        []unstructured.Unstructured
}

type KubernetesClient

type KubernetesClient struct {
	ClientSet     kubernetes.Interface
	DynamicClient dynamic.Interface
	// contains filtered or unexported fields
}

func KubernetesAPI

func KubernetesAPI(kubeconfigPath string) *KubernetesClient

KubernetesAPI 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 ResultReceiver

type ResultReceiver struct {
	Name      string   `json:"name"`
	Namespace string   `json:"namespace"`
	Type      string   `json:"kind"`
	Message   []string `json:"message"`
	Reason    string   `json:"reason"`
}

type ReturnMsg

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

type ValidateResult

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

type ValidateResults

type ValidateResults struct {
	ValidateResults []ResultReceiver
}

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