kube

package
v1.0.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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 GetKubeConfigInCluster added in v0.5.0

func GetKubeConfigInCluster() (*rest.Config, error)

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
	Pods             *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
}

func GetK8SResources

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

GetK8SResources get kubernetes resources by GroupVersionResource, return K8SResource.

type KubernetesClient

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

func GetK8SClients added in v0.5.0

func GetK8SClients(kubeconfig string) (*KubernetesClient, error)

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