kubernetesutils

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: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClusterRole

type ClusterRole struct {
	InstanceInterface typedv1.RbacV1Interface
}

定义结构体

func NewClusterRole

func NewClusterRole(kubeconfig string) *ClusterRole

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

func (*ClusterRole) Create

func (c *ClusterRole) Create(item *rbacv1.ClusterRole) error

创建资源

func (*ClusterRole) Delete

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

删除资源

func (*ClusterRole) DeleteList

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

删除多个

func (*ClusterRole) Get

func (c *ClusterRole) Get(name string) (item *rbacv1.ClusterRole, err error)

获取资源配置

func (*ClusterRole) List

func (c *ClusterRole) List(labelSelector, fieldSelector string) (items *rbacv1.ClusterRoleList, err error)

获取资源列表

func (*ClusterRole) Update

func (c *ClusterRole) Update(item *rbacv1.ClusterRole) error

更新资源

type ClusterRoleBinding

type ClusterRoleBinding struct {
	InstanceInterface typedv1.RbacV1Interface
}

定义结构体

func NewClusterRoleBinding

func NewClusterRoleBinding(kubeconfig string) *ClusterRoleBinding

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

func (*ClusterRoleBinding) Create

创建资源

func (*ClusterRoleBinding) Delete

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

删除资源

func (*ClusterRoleBinding) DeleteList

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

删除多个

func (*ClusterRoleBinding) Get

func (c *ClusterRoleBinding) Get(name string) (item *rbacv1.ClusterRoleBinding, err error)

获取资源配置

func (*ClusterRoleBinding) List

func (c *ClusterRoleBinding) List(labelSelector, fieldSelector string) (items *rbacv1.ClusterRoleBindingList, err error)

获取资源列表

func (*ClusterRoleBinding) Update

更新资源

type ConfigMap

type ConfigMap struct {
	InstanceInterface typedv1.CoreV1Interface
}

定义结构体

func NewConfigMap

func NewConfigMap(kubeconfig string) *ConfigMap

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

func (*ConfigMap) Create

func (c *ConfigMap) Create(namespace string, item *corev1.ConfigMap) 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 *corev1.ConfigMap, err error)

获取资源配置

func (*ConfigMap) List

func (c *ConfigMap) List(namespace, labelSelector, fieldSelector string) (items *corev1.ConfigMapList, err error)

获取资源列表

func (*ConfigMap) Update

func (c *ConfigMap) Update(namespace string, item *corev1.ConfigMap) error

更新资源

type CronJob

type CronJob struct {
	InstanceInterface typedv1.BatchV1Interface
}

定义结构体

func NewCronJob

func NewCronJob(kubeconfig string) *CronJob

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

func (*CronJob) Create

func (c *CronJob) Create(namespace string, item *batchv1.CronJob) 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 *batchv1.CronJob, err error)

获取资源配置

func (*CronJob) List

func (c *CronJob) List(namespace, labelSelector, fieldSelector string) (items *batchv1.CronJobList, err error)

获取资源列表

func (*CronJob) Update

func (c *CronJob) Update(namespace string, item *batchv1.CronJob) error

更新资源

type DaemonSet

type DaemonSet struct {
	InstanceInterface typedv1.AppsV1Interface
}

定义结构体

func NewDaemonSet

func NewDaemonSet(kubeconfig string) *DaemonSet

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

func (*DaemonSet) Create

func (c *DaemonSet) Create(namespace string, item *appsv1.DaemonSet) 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 *appsv1.DaemonSet, err error)

获取资源配置

func (*DaemonSet) List

func (c *DaemonSet) List(namespace, labelSelector, fieldSelector string) (items *appsv1.DaemonSetList, err error)

获取资源列表

func (*DaemonSet) Update

func (c *DaemonSet) Update(namespace string, item *appsv1.DaemonSet) error

更新资源

type Deployment

type Deployment struct {
	InstanceInterface typedv1.AppsV1Interface
}

定义结构体

func NewDeployment

func NewDeployment(kubeconfig string) *Deployment

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

func (*Deployment) Create

func (c *Deployment) Create(namespace string, item *appsv1.Deployment) 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 *appsv1.Deployment, err error)

获取资源配置

func (*Deployment) List

func (c *Deployment) List(namespace, labelSelector, fieldSelector string) (items *appsv1.DeploymentList, err error)

获取资源列表

func (*Deployment) Update

func (c *Deployment) Update(namespace string, item *appsv1.Deployment) error

更新资源

type Ingress

type Ingress struct {
	InstanceInterface typedv1.NetworkingV1Interface
}

定义结构体

func NewIngress

func NewIngress(kubeconfig string) *Ingress

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

func (*Ingress) Create

func (c *Ingress) Create(namespace string, item *networkingv1.Ingress) 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 *networkingv1.Ingress, err error)

获取资源配置

func (*Ingress) List

func (c *Ingress) List(namespace, labelSelector, fieldSelector string) (items *networkingv1.IngressList, err error)

获取资源列表

func (*Ingress) Update

func (c *Ingress) Update(namespace string, item *networkingv1.Ingress) error

更新资源

type IngressClass

type IngressClass struct {
	InstanceInterface typedv1.NetworkingV1Interface
}

定义结构体

func NewIngressClass

func NewIngressClass(kubeconfig string) *IngressClass

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

func (*IngressClass) Get

func (c *IngressClass) Get(name string) (item *networkingv1.IngressClass, err error)

获取资源配置

func (*IngressClass) List

func (c *IngressClass) List(labelSelector, fieldSelector string) (items *networkingv1.IngressClassList, err error)

获取资源列表

type KubeUtilser

type KubeUtilser interface {
	Create() error
	Delete(*int64) error
	DeleteList(*int64) error
	Update() error
	List(string, string) (interface{}, error)
	Get() (interface{}, error)
}

定义kubeutils的接口,先不用接口

type Namespace

type Namespace struct {
	InstanceInterface typedv1.CoreV1Interface
}

定义结构体

func NewNamespace

func NewNamespace(kubeconfig string) *Namespace

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

func (*Namespace) Create

func (c *Namespace) Create(item *corev1.Namespace) error

创建资源

func (*Namespace) Delete

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

删除资源

func (*Namespace) DeleteList

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

删除多个

func (*Namespace) Get

func (c *Namespace) Get(name string) (item *corev1.Namespace, err error)

获取资源配置

func (*Namespace) List

func (c *Namespace) List(labelSelector, fieldSelector string) (items *corev1.NamespaceList, err error)

获取资源列表

func (*Namespace) Update

func (c *Namespace) Update(item *corev1.Namespace) error

更新资源

type Node

type Node struct {
	InstanceInterface typedv1.CoreV1Interface
}

定义结构体

func NewNode

func NewNode(kubeconfig string) *Node

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

func (*Node) Create

func (c *Node) Create(item *corev1.Node) error

创建资源

func (*Node) Delete

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

删除资源

func (*Node) DeleteList

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

删除多个

func (*Node) Get

func (c *Node) Get(name string) (item *corev1.Node, err error)

获取资源配置

func (*Node) List

func (c *Node) List(labelSelector, fieldSelector string) (items *corev1.NodeList, err error)

获取资源列表

func (*Node) Update

func (c *Node) Update(item *corev1.Node) error

更新资源

type PersistentVolume

type PersistentVolume struct {
	InstanceInterface typedv1.CoreV1Interface
}

定义结构体

func NewPersistentVolume

func NewPersistentVolume(kubeconfig string) *PersistentVolume

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

func (*PersistentVolume) Create

func (c *PersistentVolume) Create(item *corev1.PersistentVolume) error

创建资源

func (*PersistentVolume) Delete

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

删除资源

func (*PersistentVolume) DeleteList

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

删除多个

func (*PersistentVolume) Get

func (c *PersistentVolume) Get(name string) (item *corev1.PersistentVolume, err error)

获取资源配置

func (*PersistentVolume) List

func (c *PersistentVolume) List(labelSelector, fieldSelector string) (items *corev1.PersistentVolumeList, err error)

获取资源列表

func (*PersistentVolume) Update

func (c *PersistentVolume) Update(item *corev1.PersistentVolume) error

更新资源

type PersistentVolumeClaim

type PersistentVolumeClaim struct {
	InstanceInterface typedv1.CoreV1Interface
}

定义结构体

func NewPersistentVolumeClaim

func NewPersistentVolumeClaim(kubeconfig string) *PersistentVolumeClaim

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

func (*PersistentVolumeClaim) Create

func (c *PersistentVolumeClaim) Create(namespace string, item *corev1.PersistentVolumeClaim) 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 *corev1.PersistentVolumeClaim, err error)

获取资源配置

func (*PersistentVolumeClaim) List

func (c *PersistentVolumeClaim) List(namespace, labelSelector, fieldSelector string) (items *corev1.PersistentVolumeClaimList, err error)

获取资源列表

func (*PersistentVolumeClaim) Update

func (c *PersistentVolumeClaim) Update(namespace string, item *corev1.PersistentVolumeClaim) error

更新资源

type Pod

type Pod struct {
	InstanceInterface typedv1.CoreV1Interface
}

定义结构体

func NewPod

func NewPod(kubeconfig string) *Pod

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

func (*Pod) Create

func (c *Pod) Create(namespace string, item *corev1.Pod) 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 *corev1.Pod, err error)

获取资源配置

func (*Pod) List

func (c *Pod) List(namespace, labelSelector, fieldSelector string) (items *corev1.PodList, err error)

获取资源列表

func (*Pod) Update

func (c *Pod) Update(namespace string, item *corev1.Pod) error

更新资源

type ReplicaSet

type ReplicaSet struct {
	InstanceInterface typedv1.AppsV1Interface
}

定义结构体

func NewReplicaSet

func NewReplicaSet(kubeconfig string) *ReplicaSet

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

func (*ReplicaSet) Create

func (c *ReplicaSet) Create(namespace string, item *appsv1.ReplicaSet) 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 *appsv1.ReplicaSet, err error)

获取资源配置

func (*ReplicaSet) List

func (c *ReplicaSet) List(namespace, labelSelector, fieldSelector string) (items *appsv1.ReplicaSetList, err error)

获取资源列表

func (*ReplicaSet) Update

func (c *ReplicaSet) Update(namespace string, item *appsv1.ReplicaSet) 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
}

定义结构体

func NewRole

func NewRole(kubeconfig string) *Role

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

func (*Role) Create

func (c *Role) Create(namespace string, item *rbacv1.Role) 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 *rbacv1.Role, err error)

获取资源配置

func (*Role) List

func (c *Role) List(namespace, labelSelector, fieldSelector string) (items *rbacv1.RoleList, err error)

获取资源列表

func (*Role) Update

func (c *Role) Update(namespace string, item *rbacv1.Role) error

更新资源

type RoleBinding

type RoleBinding struct {
	InstanceInterface typedv1.RbacV1Interface
}

定义结构体

func NewRoleBinding

func NewRoleBinding(kubeconfig string) *RoleBinding

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

func (*RoleBinding) Create

func (c *RoleBinding) Create(namespace string, item *rbacv1.RoleBinding) 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 *rbacv1.RoleBinding, err error)

获取资源配置

func (*RoleBinding) List

func (c *RoleBinding) List(namespace, labelSelector, fieldSelector string) (items *rbacv1.RoleBindingList, err error)

获取资源列表

func (*RoleBinding) Update

func (c *RoleBinding) Update(namespace string, item *rbacv1.RoleBinding) error

更新资源

type Secret

type Secret struct {
	InstanceInterface typedv1.CoreV1Interface
}

定义结构体

func NewSecret

func NewSecret(kubeconfig string) *Secret

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

func (*Secret) Create

func (c *Secret) Create(namespace string, item *corev1.Secret) 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 *corev1.Secret, err error)

获取资源配置

func (*Secret) List

func (c *Secret) List(namespace, labelSelector, fieldSelector string) (items *corev1.SecretList, err error)

获取资源列表

func (*Secret) Update

func (c *Secret) Update(namespace string, item *corev1.Secret) error

更新资源

type Service

type Service struct {
	InstanceInterface typedv1.CoreV1Interface
}

定义结构体

func NewService

func NewService(kubeconfig string) *Service

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

func (*Service) Create

func (c *Service) Create(namespace string, item *corev1.Service) 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 *corev1.Service, err error)

获取资源配置

func (*Service) List

func (c *Service) List(namespace, labelSelector, fieldSelector string) (items *corev1.ServiceList, err error)

获取资源列表

func (*Service) Update

func (c *Service) Update(namespace string, item *corev1.Service) error

更新资源

type StatefulSet

type StatefulSet struct {
	InstanceInterface typedv1.AppsV1Interface
}

定义结构体

func NewStatefulSet

func NewStatefulSet(kubeconfig string) *StatefulSet

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

func (*StatefulSet) Create

func (c *StatefulSet) Create(namespace string, item *appsv1.StatefulSet) 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 *appsv1.StatefulSet, err error)

获取资源配置

func (*StatefulSet) List

func (c *StatefulSet) List(namespace, labelSelector, fieldSelector string) (items *appsv1.StatefulSetList, err error)

获取资源列表

func (*StatefulSet) Update

func (c *StatefulSet) Update(namespace string, item *appsv1.StatefulSet) error

更新资源

type StorageClass

type StorageClass struct {
	InstanceInterface typedv1.StorageV1Interface
}

定义结构体

func NewStorageClass

func NewStorageClass(kubeconfig string) *StorageClass

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

func (*StorageClass) Create

func (c *StorageClass) Create(item *storagev1.StorageClass) error

创建资源

func (*StorageClass) Delete

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

删除资源

func (*StorageClass) DeleteList

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

删除多个

func (*StorageClass) Get

func (c *StorageClass) Get(name string) (item *storagev1.StorageClass, err error)

获取资源配置

func (*StorageClass) List

func (c *StorageClass) List(labelSelector, fieldSelector string) (items *storagev1.StorageClassList, err error)

获取资源列表

func (*StorageClass) Update

func (c *StorageClass) Update(item *storagev1.StorageClass) 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