Documentation
¶
Index ¶
- Variables
- func IsBoundServiceAccount(subject rbacv1.Subject, username, namespace string) bool
- func NewGlobalHelper(opts ...Option) error
- type Auth
- type ClusterRoleBindingClient
- type ClusterRoleClient
- type ConfigMapClient
- type CustomResourceDefinitionClient
- type DeploymentClient
- type EventClient
- type Fetch
- type Helper
- func (h *Helper) ApplyCustomResourceDefinitions(crd apiextensionsv1.CustomResourceDefinition) (*apiextensionsv1.CustomResourceDefinition, error)
- func (h *Helper) ApplyDynamicResource(reader io.Reader) error
- func (h *Helper) CreateClusterRole(name string, rbacRules []rbacv1.PolicyRule) (*rbacv1.ClusterRole, error)
- func (h *Helper) CreateClusterRoleBinding(metaData metav1.ObjectMeta, roleRef rbacv1.RoleRef, subjects []rbacv1.Subject) (*rbacv1.ClusterRoleBinding, error)
- func (h *Helper) CreateConfigMap(configMap *corev1.ConfigMap) (*corev1.ConfigMap, error)
- func (h *Helper) CreateJob(job *batchv1.Job) (*batchv1.Job, error)
- func (h *Helper) CreateNamespace(metadata metav1.ObjectMeta) error
- func (h *Helper) CreateResourceQuota(name string, resourceQuota *corev1.ResourceQuota) (*corev1.ResourceQuota, error)
- func (h *Helper) CreateRoleBinding(metadata metav1.ObjectMeta, roleRef *rbacv1.RoleRef, subjects []rbacv1.Subject) (*rbacv1.RoleBinding, error)
- func (h *Helper) CreateSecret(secret *corev1.Secret) (*corev1.Secret, error)
- func (h *Helper) CreateServiceAccount(metadata metav1.ObjectMeta) (*corev1.ServiceAccount, error)
- func (h *Helper) CreateStorageClass(storageClass *storagev1.StorageClass) (*storagev1.StorageClass, error)
- func (h *Helper) CreateTokenSecret(secretName, serviceAccountName string) (*corev1.Secret, error)
- func (h *Helper) DeleteConfigMap(name string) error
- func (h *Helper) DeleteJob(name string) error
- func (h *Helper) DeleteNamespace(namespace string) error
- func (h *Helper) DeleteRoleBindings(username string, namespaces []string) error
- func (h *Helper) DeleteRoleBindingsIfTheServiceAccountIsIncluded(username, namespace string) error
- func (h *Helper) DeleteSecret(secretName string) error
- func (h *Helper) DeleteServiceAccount(name string) error
- func (h *Helper) DisableCurrentDefaultStorageClasses() error
- func (h *Helper) GenTokenSecretOpts(secretName, serviceAccountName string) *corev1.Secret
- func (h *Helper) GetClusterRole(name string) (*rbacv1.ClusterRole, error)
- func (h *Helper) GetDeployment(name string) (*appsv1.Deployment, error)
- func (h *Helper) GetJob(name string) (*batchv1.Job, error)
- func (h *Helper) GetNamespace(namespace string) (*corev1.Namespace, error)
- func (h *Helper) GetNode(name string) (*corev1.Node, error)
- func (h *Helper) GetNodeIP(nodeName string, addrType string) (string, error)
- func (h *Helper) GetRole(name string) (*rbacv1.Role, error)
- func (h *Helper) GetSecret(secretName string) (*corev1.Secret, error)
- func (h *Helper) GetServiceAccount(name string) (*corev1.ServiceAccount, error)
- func (h *Helper) GetStorageClass(name string) (*storagev1.StorageClass, error)
- func (h *Helper) GetSvc(name string) (*corev1.Service, error)
- func (h *Helper) GetSvcNodePortByTargetPort(svcName string, targetPort int) (int, error)
- func (h *Helper) GetTokenSecret(secretName string) (*corev1.Secret, error)
- func (h *Helper) IsNamespaceExist(namespace string) bool
- func (h *Helper) ListClusterRoleBinding(opt metav1.ListOptions) (*rbacv1.ClusterRoleBindingList, error)
- func (h *Helper) ListCustomResourceDefinition() (*apiextensionsv1.CustomResourceDefinitionList, error)
- func (h *Helper) ListEvent(opt metav1.ListOptions) (*corev1.EventList, error)
- func (h *Helper) ListJobs(opt metav1.ListOptions) (*batchv1.JobList, error)
- func (h *Helper) ListNamespace(opt metav1.ListOptions) (*corev1.NamespaceList, error)
- func (h *Helper) ListNodes() (*corev1.NodeList, error)
- func (h *Helper) ListPod(opt metav1.ListOptions) (*corev1.PodList, error)
- func (h *Helper) ListResourceQuota(opts metav1.ListOptions) (*corev1.ResourceQuotaList, error)
- func (h *Helper) ListRoleBindings(opt metav1.ListOptions) (*rbacv1.RoleBindingList, error)
- func (h *Helper) ListServiceAccount(opt metav1.ListOptions) (*corev1.ServiceAccountList, error)
- func (h *Helper) ListStorageClasses() (*storagev1.StorageClassList, error)
- func (h *Helper) PatchClusterRole(name string, dataToPatch []byte) error
- func (h *Helper) PatchNamespace(namespace string, patchData []byte) error
- func (h *Helper) PatchStorageClasses(storageClasses []storagev1.StorageClass, patchData []byte) error
- func (h *Helper) RunLeaseCron(ctx *context.Context)
- func (h *Helper) SetAuth() error
- func (h *Helper) SetClusterRoleBindingClient()
- func (h *Helper) SetClusterRoleClient()
- func (h *Helper) SetConfigMapClient(namespace string)
- func (h *Helper) SetCustomResourceDefinitionClient()
- func (h *Helper) SetDefaultStorageClass(name string) error
- func (h *Helper) SetDeploymentClient()
- func (h *Helper) SetEventClient()
- func (h *Helper) SetJobClient(namespace string)
- func (h *Helper) SetLeaseClient(id string, name string, namespace string)
- func (h *Helper) SetLeaseCron(schedule func())
- func (h *Helper) SetNamespaceClient()
- func (h *Helper) SetNodeClient()
- func (h *Helper) SetPodClient(namespace string)
- func (h *Helper) SetResourceQuotaClient(namespace string)
- func (h *Helper) SetRoleBindingClient(namespace string)
- func (h *Helper) SetRoleClient(namespace string)
- func (h *Helper) SetSVCClient()
- func (h *Helper) SetSecretClient(namespace string)
- func (h *Helper) SetServiceAccountClient(namespace string)
- func (h *Helper) SetStorageClassClient()
- func (h *Helper) UpdateNode(node *corev1.Node) (*corev1.Node, error)
- func (h *Helper) UpdateResourceQuota(name string, patchData []byte) error
- type JobClient
- type LeaseClient
- type NamespaceClient
- type NodeClient
- type Option
- type Options
- type PodClient
- type ResourceQuotaClient
- type RoleBindingClient
- type RoleClient
- type SecretClient
- type ServiceAccountClient
- type StorageClassClient
- type SvcClient
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrCpuQuotaExceeded = errors.New("cpu quota exceeded") ErrMemoryQuotaExceeded = errors.New("memory quota exceeded") ErrEphemeralStorageStorageQuotaExceeded = errors.New("ephemeral-storage quota exceeded") )
View Source
var ( InClusterAuth = "inCluster" OutOfClusterAuth = "outOfCluster" LeaseRun = leaderelection.RunOrDie )
Functions ¶
func IsBoundServiceAccount ¶
func NewGlobalHelper ¶
Types ¶
type ClusterRoleBindingClient ¶
type ClusterRoleBindingClient interface { List(context.Context, metav1.ListOptions) (*rbacv1.ClusterRoleBindingList, error) Create(ctx context.Context, clusterRoleBinding *rbacv1.ClusterRoleBinding, opts metav1.CreateOptions) (*rbacv1.ClusterRoleBinding, error) }
type ClusterRoleClient ¶
type ClusterRoleClient interface { Get(context.Context, string, metav1.GetOptions) (*rbacv1.ClusterRole, error) List(context.Context, metav1.ListOptions) (*rbacv1.ClusterRoleList, error) Patch(context.Context, string, types.PatchType, []byte, metav1.PatchOptions, ...string) (*rbacv1.ClusterRole, error) Apply(context.Context, *confRbacv1.ClusterRoleApplyConfiguration, metav1.ApplyOptions) (*rbacv1.ClusterRole, error) Create(ctx context.Context, clusterRole *rbacv1.ClusterRole, opts metav1.CreateOptions) (*rbacv1.ClusterRole, error) }
type ConfigMapClient ¶
type CustomResourceDefinitionClient ¶
type CustomResourceDefinitionClient interface { List(context.Context, metav1.ListOptions) (*apiextensionsv1.CustomResourceDefinitionList, error) Create(context.Context, *apiextensionsv1.CustomResourceDefinition, metav1.CreateOptions) (*apiextensionsv1.CustomResourceDefinition, error) }
type DeploymentClient ¶
type DeploymentClient interface {
Get(ctx context.Context, name string, opts metav1.GetOptions) (*appsv1.Deployment, error)
}
type EventClient ¶
type Helper ¶
type Helper struct { LeaseID string LeaseCallback leaderelection.LeaderCallbacks EventClient PodClient JobClient DeploymentClient NamespaceClient NodeClient SvcClient StorageClassClient ServiceAccountClient SecretClient RoleClient RoleBindingClient ClusterRoleClient ClusterRoleBindingClient LeaseClient ResourceQuotaClient ConfigMapClient CustomResourceDefinitionClient Options // contains filtered or unexported fields }
func GetGlobalHelper ¶
func GetGlobalHelper() *Helper
func (*Helper) ApplyCustomResourceDefinitions ¶
func (h *Helper) ApplyCustomResourceDefinitions(crd apiextensionsv1.CustomResourceDefinition) (*apiextensionsv1.CustomResourceDefinition, error)
func (*Helper) CreateClusterRole ¶
func (h *Helper) CreateClusterRole(name string, rbacRules []rbacv1.PolicyRule) (*rbacv1.ClusterRole, error)
func (*Helper) CreateClusterRoleBinding ¶
func (h *Helper) CreateClusterRoleBinding(metaData metav1.ObjectMeta, roleRef rbacv1.RoleRef, subjects []rbacv1.Subject) (*rbacv1.ClusterRoleBinding, error)
func (*Helper) CreateConfigMap ¶
func (*Helper) CreateNamespace ¶
func (h *Helper) CreateNamespace(metadata metav1.ObjectMeta) error
func (*Helper) CreateResourceQuota ¶
func (h *Helper) CreateResourceQuota(name string, resourceQuota *corev1.ResourceQuota) (*corev1.ResourceQuota, error)
func (*Helper) CreateRoleBinding ¶
func (h *Helper) CreateRoleBinding(metadata metav1.ObjectMeta, roleRef *rbacv1.RoleRef, subjects []rbacv1.Subject) (*rbacv1.RoleBinding, error)
func (*Helper) CreateSecret ¶
func (*Helper) CreateServiceAccount ¶
func (h *Helper) CreateServiceAccount(metadata metav1.ObjectMeta) (*corev1.ServiceAccount, error)
func (*Helper) CreateStorageClass ¶
func (h *Helper) CreateStorageClass(storageClass *storagev1.StorageClass) (*storagev1.StorageClass, error)
func (*Helper) CreateTokenSecret ¶
func (*Helper) DeleteConfigMap ¶
func (*Helper) DeleteNamespace ¶
func (*Helper) DeleteRoleBindings ¶
func (*Helper) DeleteRoleBindingsIfTheServiceAccountIsIncluded ¶
func (*Helper) DeleteSecret ¶
func (*Helper) DeleteServiceAccount ¶
func (*Helper) DisableCurrentDefaultStorageClasses ¶
func (*Helper) GenTokenSecretOpts ¶
func (*Helper) GetClusterRole ¶
func (h *Helper) GetClusterRole(name string) (*rbacv1.ClusterRole, error)
func (*Helper) GetDeployment ¶
func (h *Helper) GetDeployment(name string) (*appsv1.Deployment, error)
func (*Helper) GetNamespace ¶
func (*Helper) GetServiceAccount ¶
func (h *Helper) GetServiceAccount(name string) (*corev1.ServiceAccount, error)
func (*Helper) GetStorageClass ¶
func (h *Helper) GetStorageClass(name string) (*storagev1.StorageClass, error)
func (*Helper) GetSvcNodePortByTargetPort ¶
func (*Helper) GetTokenSecret ¶
func (*Helper) IsNamespaceExist ¶
func (*Helper) ListClusterRoleBinding ¶
func (h *Helper) ListClusterRoleBinding(opt metav1.ListOptions) (*rbacv1.ClusterRoleBindingList, error)
func (*Helper) ListCustomResourceDefinition ¶
func (h *Helper) ListCustomResourceDefinition() (*apiextensionsv1.CustomResourceDefinitionList, error)
func (*Helper) ListNamespace ¶
func (h *Helper) ListNamespace(opt metav1.ListOptions) (*corev1.NamespaceList, error)
func (*Helper) ListResourceQuota ¶
func (h *Helper) ListResourceQuota(opts metav1.ListOptions) (*corev1.ResourceQuotaList, error)
func (*Helper) ListRoleBindings ¶
func (h *Helper) ListRoleBindings(opt metav1.ListOptions) (*rbacv1.RoleBindingList, error)
func (*Helper) ListServiceAccount ¶
func (h *Helper) ListServiceAccount(opt metav1.ListOptions) (*corev1.ServiceAccountList, error)
func (*Helper) ListStorageClasses ¶
func (h *Helper) ListStorageClasses() (*storagev1.StorageClassList, error)
func (*Helper) PatchClusterRole ¶
func (*Helper) PatchNamespace ¶
func (*Helper) PatchStorageClasses ¶
func (h *Helper) PatchStorageClasses(storageClasses []storagev1.StorageClass, patchData []byte) error
func (*Helper) RunLeaseCron ¶
func (*Helper) SetClusterRoleBindingClient ¶
func (h *Helper) SetClusterRoleBindingClient()
func (*Helper) SetClusterRoleClient ¶
func (h *Helper) SetClusterRoleClient()
func (*Helper) SetConfigMapClient ¶
func (*Helper) SetCustomResourceDefinitionClient ¶
func (h *Helper) SetCustomResourceDefinitionClient()
func (*Helper) SetDefaultStorageClass ¶
func (*Helper) SetDeploymentClient ¶
func (h *Helper) SetDeploymentClient()
func (*Helper) SetEventClient ¶
func (h *Helper) SetEventClient()
func (*Helper) SetJobClient ¶
func (*Helper) SetLeaseClient ¶
func (*Helper) SetLeaseCron ¶
func (h *Helper) SetLeaseCron(schedule func())
func (*Helper) SetNamespaceClient ¶
func (h *Helper) SetNamespaceClient()
func (*Helper) SetNodeClient ¶
func (h *Helper) SetNodeClient()
func (*Helper) SetPodClient ¶
func (*Helper) SetResourceQuotaClient ¶
func (*Helper) SetRoleBindingClient ¶
func (*Helper) SetRoleClient ¶
func (*Helper) SetSVCClient ¶
func (h *Helper) SetSVCClient()
func (*Helper) SetSecretClient ¶
func (*Helper) SetServiceAccountClient ¶
func (*Helper) SetStorageClassClient ¶
func (h *Helper) SetStorageClassClient()
type JobClient ¶
type JobClient interface { Create(ctx context.Context, job *batchv1.Job, opts metav1.CreateOptions) (*batchv1.Job, error) Get(ctx context.Context, name string, opts metav1.GetOptions) (*batchv1.Job, error) List(ctx context.Context, opts metav1.ListOptions) (*batchv1.JobList, error) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error }
type LeaseClient ¶
type LeaseClient interface { Get(context.Context) (*resourcelock.LeaderElectionRecord, []byte, error) Create(context.Context, resourcelock.LeaderElectionRecord) error Update(context.Context, resourcelock.LeaderElectionRecord) error RecordEvent(string) Identity() string Describe() string }
type NamespaceClient ¶
type NamespaceClient interface { Get(context.Context, string, metav1.GetOptions) (*corev1.Namespace, error) Create(context.Context, *corev1.Namespace, metav1.CreateOptions) (*corev1.Namespace, error) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *corev1.Namespace, err error) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error List(ctx context.Context, opts metav1.ListOptions) (*corev1.NamespaceList, error) }
type NodeClient ¶
type ResourceQuotaClient ¶
type ResourceQuotaClient interface { List(ctx context.Context, opts metav1.ListOptions) (*corev1.ResourceQuotaList, error) Create(ctx context.Context, resourceQuota *corev1.ResourceQuota, opts metav1.CreateOptions) (*corev1.ResourceQuota, error) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *corev1.ResourceQuota, err error) }
type RoleBindingClient ¶
type RoleBindingClient interface { Apply(context.Context, *confRbacv1.RoleBindingApplyConfiguration, metav1.ApplyOptions) (*rbacv1.RoleBinding, error) List(ctx context.Context, opts metav1.ListOptions) (*rbacv1.RoleBindingList, error) Create(ctx context.Context, roleBinding *rbacv1.RoleBinding, opts metav1.CreateOptions) (*rbacv1.RoleBinding, error) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error }
type RoleClient ¶
type RoleClient interface { Apply(context.Context, *confRbacv1.RoleApplyConfiguration, metav1.ApplyOptions) (*rbacv1.Role, error) Get(ctx context.Context, name string, opts metav1.GetOptions) (*rbacv1.Role, error) }
type SecretClient ¶
type SecretClient interface { Get(context.Context, string, metav1.GetOptions) (*corev1.Secret, error) Create(ctx context.Context, secret *corev1.Secret, opts metav1.CreateOptions) (*corev1.Secret, error) Apply(context.Context, *confCorev1.SecretApplyConfiguration, metav1.ApplyOptions) (*corev1.Secret, error) Delete(context.Context, string, metav1.DeleteOptions) error }
type ServiceAccountClient ¶
type ServiceAccountClient interface { Apply(context.Context, *confCorev1.ServiceAccountApplyConfiguration, metav1.ApplyOptions) (*corev1.ServiceAccount, error) List(ctx context.Context, opts metav1.ListOptions) (*corev1.ServiceAccountList, error) Create(ctx context.Context, serviceAccount *corev1.ServiceAccount, opts metav1.CreateOptions) (*corev1.ServiceAccount, error) Get(ctx context.Context, name string, opts metav1.GetOptions) (*corev1.ServiceAccount, error) Delete(context.Context, string, metav1.DeleteOptions) error }
type StorageClassClient ¶
type StorageClassClient interface { List(context.Context, metav1.ListOptions) (*storagev1.StorageClassList, error) Get(context.Context, string, metav1.GetOptions) (*storagev1.StorageClass, error) Create(context.Context, *storagev1.StorageClass, metav1.CreateOptions) (*storagev1.StorageClass, error) Patch(context.Context, string, types.PatchType, []byte, metav1.PatchOptions, ...string) (*storagev1.StorageClass, error) }
Click to show internal directories.
Click to hide internal directories.