kubeutils

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2024 License: MPL-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClientSet

func NewClientSet(kubeconfig string, timeout int) (clientset *kubernetes.Clientset, err error)

Types

type ClusterRole

type ClusterRole struct {
	InstanceInterface typedv1.RbacV1Interface
	Item              *rbacv1.ClusterRole
}

定义结构体

func NewClusterRole

func NewClusterRole(kubeconfig string, item *rbacv1.ClusterRole) *ClusterRole

New函数可以用于配置一些默认值

func (*ClusterRole) Create

func (c *ClusterRole) Create(namespace string) error

创建资源

func (*ClusterRole) Delete

func (c *ClusterRole) Delete(namespace, name string, gracePeriodSeconds *int64) error

删除资源

func (*ClusterRole) DeleteList

func (c *ClusterRole) DeleteList(namespace, string, nameList []string, gracePeriodSeconds *int64) error

删除多个

func (*ClusterRole) Get

func (c *ClusterRole) Get(namespace, name string) (item interface{}, err error)

获取资源配置

func (*ClusterRole) List

func (c *ClusterRole) List(namespace, labelSelector, fieldSelector string) (items interface{}, err error)

获取资源列表

func (*ClusterRole) Update

func (c *ClusterRole) Update(namespace string) error

更新资源

type ClusterRoleBinding

type ClusterRoleBinding struct {
	InstanceInterface typedv1.RbacV1Interface
	Item              *rbacv1.ClusterRoleBinding
}

定义结构体

func NewClusterRoleBinding

func NewClusterRoleBinding(kubeconfig string, item *rbacv1.ClusterRoleBinding) *ClusterRoleBinding

New函数可以用于配置一些默认值

func (*ClusterRoleBinding) Create

func (c *ClusterRoleBinding) Create(namespace string) error

创建资源

func (*ClusterRoleBinding) Delete

func (c *ClusterRoleBinding) Delete(namespace, name string, gracePeriodSeconds *int64) error

删除资源

func (*ClusterRoleBinding) DeleteList

func (c *ClusterRoleBinding) DeleteList(namespace string, nameList []string, gracePeriodSeconds *int64) error

删除多个

func (*ClusterRoleBinding) Get

func (c *ClusterRoleBinding) Get(namespace, name string) (item interface{}, err error)

获取资源配置

func (*ClusterRoleBinding) List

func (c *ClusterRoleBinding) List(namespace, labelSelector, fieldSelector string) (items interface{}, err error)

获取资源列表

func (*ClusterRoleBinding) Update

func (c *ClusterRoleBinding) Update(namespace string) error

更新资源

type ConfigMap

type ConfigMap struct {
	InstanceInterface typedv1.CoreV1Interface
	Item              *corev1.ConfigMap
}

定义结构体

func NewConfigMap

func NewConfigMap(kubeconfig string, item *corev1.ConfigMap) *ConfigMap

New函数可以用于配置一些默认值

func (*ConfigMap) Create

func (c *ConfigMap) Create(namespace string) error

创建资源

func (*ConfigMap) Delete

func (c *ConfigMap) Delete(namespace, name string, gracePeriodSeconds *int64) error

删除资源

func (*ConfigMap) DeleteList

func (c *ConfigMap) DeleteList(namespace string, nameList []string, gracePeriodSeconds *int64) error

删除多个

func (*ConfigMap) Get

func (c *ConfigMap) Get(namespace, name string) (item interface{}, err error)

获取资源配置

func (*ConfigMap) List

func (c *ConfigMap) List(namespace, labelSelector, fieldSelector string) (items interface{}, err error)

获取资源列表

func (*ConfigMap) Update

func (c *ConfigMap) Update(namespace string) error

更新资源

type CronJob

type CronJob struct {
	InstanceInterface typedv1.BatchV1Interface
	Item              *batchv1.CronJob
}

定义结构体

func NewCronJob

func NewCronJob(kubeconfig string, item *batchv1.CronJob) *CronJob

New函数可以用于配置一些默认值

func (*CronJob) Create

func (c *CronJob) Create(namespace string) error

创建资源

func (*CronJob) Delete

func (c *CronJob) Delete(namespace, name string, gracePeriodSeconds *int64) error

删除资源

func (*CronJob) DeleteList

func (c *CronJob) DeleteList(namespace string, nameList []string, gracePeriodSeconds *int64) error

删除多个

func (*CronJob) Get

func (c *CronJob) Get(namespace, name string) (item interface{}, err error)

获取资源配置

func (*CronJob) List

func (c *CronJob) List(namespace, labelSelector, fieldSelector string) (items interface{}, err error)

获取资源列表

func (*CronJob) Update

func (c *CronJob) Update(namespace string) error

更新资源

type DaemonSet

type DaemonSet struct {
	InstanceInterface typedv1.AppsV1Interface
	Item              *appsv1.DaemonSet
}

定义结构体

func NewDaemonSet

func NewDaemonSet(kubeconfig string, item *appsv1.DaemonSet) *DaemonSet

New函数可以用于配置一些默认值

func (*DaemonSet) Create

func (c *DaemonSet) Create(namespace string) error

创建资源

func (*DaemonSet) Delete

func (c *DaemonSet) Delete(namespace, name string, gracePeriodSeconds *int64) error

删除资源

func (*DaemonSet) DeleteList

func (c *DaemonSet) DeleteList(namespace string, nameList []string, gracePeriodSeconds *int64) error

删除多个

func (*DaemonSet) Get

func (c *DaemonSet) Get(namespace, name string) (item interface{}, err error)

获取资源配置

func (*DaemonSet) List

func (c *DaemonSet) List(namespace, labelSelector, fieldSelector string) (items interface{}, err error)

获取资源列表

func (*DaemonSet) Update

func (c *DaemonSet) Update(namespace string) error

更新资源

type Deployment

type Deployment struct {
	InstanceInterface typedv1.AppsV1Interface
	Item              *appsv1.Deployment
}

定义结构体

func NewDeployment

func NewDeployment(kubeconfig string, item *appsv1.Deployment) *Deployment

New函数可以用于配置一些默认值

func (*Deployment) Create

func (c *Deployment) Create(namespace string) error

创建资源

func (*Deployment) Delete

func (c *Deployment) Delete(namespace, name string, gracePeriodSeconds *int64) error

删除资源

func (*Deployment) DeleteList

func (c *Deployment) DeleteList(namespace string, nameList []string, gracePeriodSeconds *int64) error

删除多个

func (*Deployment) Get

func (c *Deployment) Get(namespace, name string) (item interface{}, err error)

获取资源配置

func (*Deployment) List

func (c *Deployment) List(namespace, labelSelector, fieldSelector string) (items interface{}, err error)

获取资源列表

func (*Deployment) Update

func (c *Deployment) Update(namespace string) error

更新资源

type Ingress

type Ingress struct {
	InstanceInterface typedv1.NetworkingV1Interface
	Item              *networkingv1.Ingress
}

定义结构体

func NewIngress

func NewIngress(kubeconfig string, item *networkingv1.Ingress) *Ingress

New函数可以用于配置一些默认值

func (*Ingress) Create

func (c *Ingress) Create(namespace string) error

创建资源

func (*Ingress) Delete

func (c *Ingress) Delete(namespace, name string, gracePeriodSeconds *int64) error

删除资源

func (*Ingress) DeleteList

func (c *Ingress) DeleteList(namespace string, nameList []string, gracePeriodSeconds *int64) error

删除多个

func (*Ingress) Get

func (c *Ingress) Get(namespace, name string) (item interface{}, err error)

获取资源配置

func (*Ingress) List

func (c *Ingress) List(namespace, labelSelector, fieldSelector string) (items interface{}, err error)

获取资源列表

func (*Ingress) Update

func (c *Ingress) Update(namespace string) error

更新资源

type IngressClass

type IngressClass struct {
	InstanceInterface typedv1.NetworkingV1Interface
	Item              *networkingv1.IngressClass
}

定义结构体

func NewIngressClass

func NewIngressClass(kubeconfig string, item *networkingv1.IngressClass) *IngressClass

New函数可以用于配置一些默认值

func (*IngressClass) Create

func (c *IngressClass) Create(namespace string) error

创建资源

func (*IngressClass) Delete

func (c *IngressClass) Delete(namespace, name string, gracePeriodSeconds *int64) error

删除资源

func (*IngressClass) DeleteList

func (c *IngressClass) DeleteList(namespace string, nameList []string, gracePeriodSeconds *int64) error

删除多个

func (*IngressClass) Get

func (c *IngressClass) Get(namespace, name string) (item interface{}, err error)

获取资源配置

func (*IngressClass) List

func (c *IngressClass) List(namespace, labelSelector, fieldSelector string) (items interface{}, err error)

获取资源列表

func (*IngressClass) Update

func (c *IngressClass) Update(namespace string) error

更新资源

type KubeUtilser

type KubeUtilser interface {
	// namespace, item
	Create(string) error
	// namespace, name, gracePeriodSeconds
	Delete(string, string, *int64) error
	// namespace, nameList, gracePeriodSeconds
	DeleteList(string, []string, *int64) error
	// namespace, item
	Update(string) error
	// namespace, labelSelector, fieldSelector
	List(string, string, string) (interface{}, error)
	// namespace name
	Get(string, string) (interface{}, error)
}

定义kubeutils的接口

type Namespace

type Namespace struct {
	InstanceInterface typedv1.CoreV1Interface
	Item              *corev1.Namespace
}

定义结构体

func NewNamespace

func NewNamespace(kubeconfig string, item *corev1.Namespace) *Namespace

New函数可以用于配置一些默认值

func (*Namespace) Create

func (c *Namespace) Create(namespace string) error

创建资源

func (*Namespace) Delete

func (c *Namespace) Delete(namespace string, name string, gracePeriodSeconds *int64) error

删除资源

func (*Namespace) DeleteList

func (c *Namespace) DeleteList(namespace string, nameList []string, gracePeriodSeconds *int64) error

删除多个

func (*Namespace) Get

func (c *Namespace) Get(name string) (item interface{}, err error)

获取资源配置

func (*Namespace) List

func (c *Namespace) List(namespace, labelSelector, fieldSelector string) (items interface{}, err error)

获取资源列表

func (*Namespace) Update

func (c *Namespace) Update(namespace string) error

更新资源

type Node

type Node struct {
	InstanceInterface typedv1.CoreV1Interface
	Item              *corev1.Node
}

定义结构体

func NewNode

func NewNode(kubeconfig string, item *corev1.Node) *Node

New函数可以用于配置一些默认值

func (*Node) Create

func (c *Node) Create(namespace string) error

创建资源

func (*Node) Delete

func (c *Node) Delete(namespace string, name string, gracePeriodSeconds *int64) error

删除资源

func (*Node) DeleteList

func (c *Node) DeleteList(namespace string, nameList []string, gracePeriodSeconds *int64) error

删除多个

func (*Node) Get

func (c *Node) Get(namespace, name string) (item interface{}, err error)

获取资源配置

func (*Node) List

func (c *Node) List(namespace string, labelSelector, fieldSelector string) (items interface{}, err error)

获取资源列表

func (*Node) Update

func (c *Node) Update(namespace string) error

更新资源

type PersistentVolume

type PersistentVolume struct {
	InstanceInterface typedv1.CoreV1Interface
	Item              *corev1.PersistentVolume
}

定义结构体

func NewPersistentVolume

func NewPersistentVolume(kubeconfig string, item *corev1.PersistentVolume) *PersistentVolume

New函数可以用于配置一些默认值

func (*PersistentVolume) Create

func (c *PersistentVolume) Create(namespace string) error

创建资源

func (*PersistentVolume) Delete

func (c *PersistentVolume) Delete(namespace, name string, gracePeriodSeconds *int64) error

删除资源

func (*PersistentVolume) DeleteList

func (c *PersistentVolume) DeleteList(namespace string, nameList []string, gracePeriodSeconds *int64) error

删除多个

func (*PersistentVolume) Get

func (c *PersistentVolume) Get(namespace, name string) (item interface{}, err error)

获取资源配置

func (*PersistentVolume) List

func (c *PersistentVolume) List(namespace, labelSelector, fieldSelector string) (items interface{}, err error)

获取资源列表

func (*PersistentVolume) Update

func (c *PersistentVolume) Update(namespace string) error

更新资源

type PersistentVolumeClaim

type PersistentVolumeClaim struct {
	InstanceInterface typedv1.CoreV1Interface
	Item              *corev1.PersistentVolumeClaim
}

定义结构体

func NewPersistentVolumeClaim

func NewPersistentVolumeClaim(kubeconfig string, item *corev1.PersistentVolumeClaim) *PersistentVolumeClaim

New函数可以用于配置一些默认值

func (*PersistentVolumeClaim) Create

func (c *PersistentVolumeClaim) Create(namespace string) error

创建资源

func (*PersistentVolumeClaim) Delete

func (c *PersistentVolumeClaim) Delete(namespace, name string, gracePeriodSeconds *int64) error

删除资源

func (*PersistentVolumeClaim) DeleteList

func (c *PersistentVolumeClaim) DeleteList(namespace string, nameList []string, gracePeriodSeconds *int64) error

删除多个

func (*PersistentVolumeClaim) Get

func (c *PersistentVolumeClaim) Get(namespace, name string) (item interface{}, err error)

获取资源配置

func (*PersistentVolumeClaim) List

func (c *PersistentVolumeClaim) List(namespace, labelSelector, fieldSelector string) (items interface{}, err error)

获取资源列表

func (*PersistentVolumeClaim) Update

func (c *PersistentVolumeClaim) Update(namespace string) error

更新资源

type Pod

type Pod struct {
	InstanceInterface typedv1.CoreV1Interface
	Item              *corev1.Pod
}

定义结构体

func NewPod

func NewPod(kubeconfig string, item *corev1.Pod) *Pod

New函数可以用于配置一些默认值

func (*Pod) Create

func (c *Pod) Create(namespace string) error

创建资源

func (*Pod) Delete

func (c *Pod) Delete(namespace, name string, gracePeriodSeconds *int64) error

删除资源

func (*Pod) DeleteList

func (c *Pod) DeleteList(namespace string, nameList []string, gracePeriodSeconds *int64) error

删除多个

func (*Pod) Get

func (c *Pod) Get(namespace, name string) (item interface{}, err error)

获取资源配置

func (*Pod) List

func (c *Pod) List(namespace, labelSelector, fieldSelector string) (items interface{}, err error)

获取资源列表

func (*Pod) Update

func (c *Pod) Update(namespace string) error

更新资源

type ReplicaSet

type ReplicaSet struct {
	InstanceInterface typedv1.AppsV1Interface
	Item              *appsv1.ReplicaSet
}

定义结构体

func NewReplicaSet

func NewReplicaSet(kubeconfig string, item *appsv1.ReplicaSet) *ReplicaSet

New函数可以用于配置一些默认值

func (*ReplicaSet) Create

func (c *ReplicaSet) Create(namespace string) error

创建资源

func (*ReplicaSet) Delete

func (c *ReplicaSet) Delete(namespace, name string, gracePeriodSeconds *int64) error

删除资源

func (*ReplicaSet) DeleteList

func (c *ReplicaSet) DeleteList(namespace string, nameList []string, gracePeriodSeconds *int64) error

删除多个

func (*ReplicaSet) Get

func (c *ReplicaSet) Get(namespace, name string) (item interface{}, err error)

获取资源配置

func (*ReplicaSet) List

func (c *ReplicaSet) List(namespace, labelSelector, fieldSelector string) (items interface{}, err error)

获取资源列表

func (*ReplicaSet) Update

func (c *ReplicaSet) Update(namespace string) error

更新资源

type ResourceInstance

type ResourceInstance struct {
	Kubeconfig string
	// Namespace  string
	// Name       string
	// NameList   []string
	Clientset *kubernetes.Clientset
}

func (*ResourceInstance) Init

func (c *ResourceInstance) Init(kubeconfig string)

type Role

type Role struct {
	InstanceInterface typedv1.RbacV1Interface
	Item              *rbacv1.Role
}

定义结构体

func NewRole

func NewRole(kubeconfig string, item *rbacv1.Role) *Role

New函数可以用于配置一些默认值

func (*Role) Create

func (c *Role) Create(namespace string) error

创建资源

func (*Role) Delete

func (c *Role) Delete(namespace, name string, gracePeriodSeconds *int64) error

删除资源

func (*Role) DeleteList

func (c *Role) DeleteList(namespace string, nameList []string, gracePeriodSeconds *int64) error

删除多个

func (*Role) Get

func (c *Role) Get(namespace, name string) (item interface{}, err error)

获取资源配置

func (*Role) List

func (c *Role) List(namespace, labelSelector, fieldSelector string) (items interface{}, err error)

获取资源列表

func (*Role) Update

func (c *Role) Update(namespace string) error

更新资源

type RoleBinding

type RoleBinding struct {
	InstanceInterface typedv1.RbacV1Interface
	Item              *rbacv1.RoleBinding
}

定义结构体

func NewRoleBinding

func NewRoleBinding(kubeconfig string, item *rbacv1.RoleBinding) *RoleBinding

New函数可以用于配置一些默认值

func (*RoleBinding) Create

func (c *RoleBinding) Create(namespace string) error

创建资源

func (*RoleBinding) Delete

func (c *RoleBinding) Delete(namespace, name string, gracePeriodSeconds *int64) error

删除资源

func (*RoleBinding) DeleteList

func (c *RoleBinding) DeleteList(namespace string, nameList []string, gracePeriodSeconds *int64) error

删除多个

func (*RoleBinding) Get

func (c *RoleBinding) Get(namespace, name string) (item interface{}, err error)

获取资源配置

func (*RoleBinding) List

func (c *RoleBinding) List(namespace, labelSelector, fieldSelector string) (items interface{}, err error)

获取资源列表

func (*RoleBinding) Update

func (c *RoleBinding) Update(namespace string) error

更新资源

type Secret

type Secret struct {
	InstanceInterface typedv1.CoreV1Interface
	Item              *corev1.Secret
}

定义结构体

func NewSecret

func NewSecret(kubeconfig string, item *corev1.Secret) *Secret

New函数可以用于配置一些默认值

func (*Secret) Create

func (c *Secret) Create(namespace string) error

创建资源

func (*Secret) Delete

func (c *Secret) Delete(namespace, name string, gracePeriodSeconds *int64) error

删除资源

func (*Secret) DeleteList

func (c *Secret) DeleteList(namespace string, nameList []string, gracePeriodSeconds *int64) error

删除多个

func (*Secret) Get

func (c *Secret) Get(namespace, name string) (item interface{}, err error)

获取资源配置

func (*Secret) List

func (c *Secret) List(namespace, labelSelector, fieldSelector string) (items interface{}, err error)

获取资源列表

func (*Secret) Update

func (c *Secret) Update(namespace string) error

更新资源

type Service

type Service struct {
	InstanceInterface typedv1.CoreV1Interface
	Item              *corev1.Service
}

定义结构体

func NewService

func NewService(kubeconfig string, item *corev1.Service) *Service

New函数可以用于配置一些默认值

func (*Service) Create

func (c *Service) Create(namespace string) error

创建资源

func (*Service) Delete

func (c *Service) Delete(namespace, name string, gracePeriodSeconds *int64) error

删除资源

func (*Service) DeleteList

func (c *Service) DeleteList(namespace string, nameList []string, gracePeriodSeconds *int64) error

删除多个

func (*Service) Get

func (c *Service) Get(namespace, name string) (item interface{}, err error)

获取资源配置

func (*Service) List

func (c *Service) List(namespace, labelSelector, fieldSelector string) (items interface{}, err error)

获取资源列表

func (*Service) Update

func (c *Service) Update(namespace string) error

更新资源

type StatefulSet

type StatefulSet struct {
	InstanceInterface typedv1.AppsV1Interface
	Item              *appsv1.StatefulSet
}

定义结构体

func NewStatefulSet

func NewStatefulSet(kubeconfig string, item *appsv1.StatefulSet) *StatefulSet

New函数可以用于配置一些默认值

func (*StatefulSet) Create

func (c *StatefulSet) Create(namespace string) error

创建资源

func (*StatefulSet) Delete

func (c *StatefulSet) Delete(namespace, name string, gracePeriodSeconds *int64) error

删除资源

func (*StatefulSet) DeleteList

func (c *StatefulSet) DeleteList(namespace string, nameList []string, gracePeriodSeconds *int64) error

删除多个

func (*StatefulSet) Get

func (c *StatefulSet) Get(namespace, name string) (item interface{}, err error)

获取资源配置

func (*StatefulSet) List

func (c *StatefulSet) List(namespace, labelSelector, fieldSelector string) (items interface{}, err error)

获取资源列表

func (*StatefulSet) Update

func (c *StatefulSet) Update(namespace string) error

更新资源

type StorageClass

type StorageClass struct {
	InstanceInterface typedv1.StorageV1Interface
	Item              *storagev1.StorageClass
}

定义结构体

func NewStorageClass

func NewStorageClass(kubeconfig string, item *storagev1.StorageClass) *StorageClass

New函数可以用于配置一些默认值

func (*StorageClass) Create

func (c *StorageClass) Create(namespace string) error

创建资源

func (*StorageClass) Delete

func (c *StorageClass) Delete(namespace, name string, gracePeriodSeconds *int64) error

删除资源

func (*StorageClass) DeleteList

func (c *StorageClass) DeleteList(namespace string, nameList []string, gracePeriodSeconds *int64) error

删除多个

func (*StorageClass) Get

func (c *StorageClass) Get(namespace, name string) (item interface{}, err error)

获取资源配置

func (*StorageClass) List

func (c *StorageClass) List(namespace, labelSelector, fieldSelector string) (items interface{}, err error)

获取资源列表

func (*StorageClass) Update

func (c *StorageClass) Update(namespace string) error

更新资源

type Tools

type Tools struct {
	ClusterId     string
	DynamicClient *dynamic.DynamicClient
}

定义结构体

func NewTools

func NewTools(kubeconfig string) (tools *Tools, err error)

New函数可以用于配置一些默认值

func (*Tools) Apply

func (c *Tools) Apply(yamlContent string) (msg string, err error)

func (*Tools) Create

func (c *Tools) Create(yamlContent string) (msg string, err error)

创建资源

func (*Tools) Delete

func (c *Tools) Delete(yamlContent string) (msg string, err error)

func (*Tools) Update

func (c *Tools) Update(yamlContent string) (msg string, err error)

Jump to

Keyboard shortcuts

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