k8sclient

package
v0.0.0-...-7aa05ff Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsWorkload

func IsWorkload(group, version, kind string) bool

Types

type IKubernetesClient

type IKubernetesClient interface {
	GetStreamedPodLogs(ctx context.Context, namespace, container, name string, logCount *int64, logChan chan<- string) error
	GetPodLogs(namespace, container, name string, numLogs *int64) ([]string, error)
	GetDeploymentLogs(namespace, container, deployment string, numLogs *int64) ([]string, error)
	GetStatefulSetsLogs(namespace, container, name string, numLogs *int64) ([]string, error)
	ListModules() ([]cyclopsv1alpha1.Module, error)
	CreateModule(module cyclopsv1alpha1.Module) error
	UpdateModule(module *cyclopsv1alpha1.Module) error
	UpdateModuleStatus(module *cyclopsv1alpha1.Module) (*cyclopsv1alpha1.Module, error)
	DeleteModule(name string) error
	GetModule(name string) (*cyclopsv1alpha1.Module, error)
	GetResourcesForModule(name string) ([]dto.Resource, error)
	GetWorkloadsForModule(name string) ([]dto.Resource, error)
	GetDeletedResources([]dto.Resource, string, string) ([]dto.Resource, error)
	GetModuleResourcesHealth(name string) (string, error)
	GVKtoAPIResourceName(gv schema.GroupVersion, kind string) (string, error)
	VersionInfo() (*version.Info, error)
	RestartDeployment(name, namespace string) error
	RestartStatefulSet(name, namespace string) error
	RestartDaemonSet(name, namespace string) error
	GetManifest(group, version, kind, name, namespace string, includeManagedFields bool) (string, error)
	Restart(group, version, kind, name, namespace string) error
	GetResource(group, version, kind, name, namespace string) (any, error)
	Delete(resource dto.Resource) error
	CreateDynamic(cyclopsv1alpha1.GroupVersionResource, *unstructured.Unstructured, string) error
	ApplyCRD(obj *unstructured.Unstructured) error
	ListNodes() ([]apiv1.Node, error)
	GetNode(name string) (*apiv1.Node, error)
	GetPodsForNode(nodeName string) ([]apiv1.Pod, error)
	ListNamespaces() ([]string, error)
	WatchResource(group, version, resource, name, namespace string) (watch.Interface, error)
	WatchKubernetesResources(gvrs []ResourceWatchSpec, stopCh chan struct{}) (chan *unstructured.Unstructured, error)
	ListTemplateAuthRules() ([]cyclopsv1alpha1.TemplateAuthRule, error)
	GetTemplateAuthRuleSecret(name, key string) (string, error)
	ListTemplateStore() ([]cyclopsv1alpha1.TemplateStore, error)
	CreateTemplateStore(ts *cyclopsv1alpha1.TemplateStore) error
	UpdateTemplateStore(ts *cyclopsv1alpha1.TemplateStore) error
	DeleteTemplateStore(name string) error
	GetResourcesForRelease(release string) ([]dto.Resource, error)
	GetWorkloadsForRelease(name string) ([]dto.Resource, error)
}

type KubernetesClient

type KubernetesClient struct {
	Dynamic dynamic.Interface
	// contains filtered or unexported fields
}

func New

func New(
	moduleNamespace string,
	helmReleaseNamespace string,
	moduleTargetNamespace string,
	logger logr.Logger,
) (*KubernetesClient, error)

func (*KubernetesClient) ApplyCRD

func (k *KubernetesClient) ApplyCRD(obj *unstructured.Unstructured) error

func (*KubernetesClient) CreateDynamic

func (k *KubernetesClient) CreateDynamic(
	resource v1alpha1.GroupVersionResource,
	obj *unstructured.Unstructured,
	targetNamespace string,
) error

func (*KubernetesClient) CreateModule

func (k *KubernetesClient) CreateModule(module cyclopsv1alpha1.Module) error

func (*KubernetesClient) CreateTemplateStore

func (k *KubernetesClient) CreateTemplateStore(ts *cyclopsv1alpha1.TemplateStore) error

func (*KubernetesClient) Delete

func (k *KubernetesClient) Delete(resource dto.Resource) error

func (*KubernetesClient) DeleteModule

func (k *KubernetesClient) DeleteModule(name string) error

func (*KubernetesClient) DeleteTemplateStore

func (k *KubernetesClient) DeleteTemplateStore(name string) error

func (*KubernetesClient) GVKtoAPIResourceName

func (k *KubernetesClient) GVKtoAPIResourceName(gv schema.GroupVersion, kind string) (string, error)

func (*KubernetesClient) GetDeletedResources

func (k *KubernetesClient) GetDeletedResources(
	resources []dto.Resource,
	manifest string,
	targetNamespace string,
) ([]dto.Resource, error)

func (*KubernetesClient) GetDeploymentLogs

func (k *KubernetesClient) GetDeploymentLogs(namespace, container, deployment string, numLogs *int64) ([]string, error)

func (*KubernetesClient) GetManifest

func (k *KubernetesClient) GetManifest(group, version, kind, name, namespace string, includeManagedFields bool) (string, error)

func (*KubernetesClient) GetModule

func (k *KubernetesClient) GetModule(name string) (*cyclopsv1alpha1.Module, error)

func (*KubernetesClient) GetModuleResourcesHealth

func (k *KubernetesClient) GetModuleResourcesHealth(name string) (string, error)

func (*KubernetesClient) GetNode

func (k *KubernetesClient) GetNode(name string) (*apiv1.Node, error)

func (*KubernetesClient) GetPodLogs

func (k *KubernetesClient) GetPodLogs(namespace, container, name string, numLogs *int64) ([]string, error)

func (*KubernetesClient) GetPodsForNode

func (k *KubernetesClient) GetPodsForNode(nodeName string) ([]apiv1.Pod, error)

func (*KubernetesClient) GetResource

func (k *KubernetesClient) GetResource(group, version, kind, name, namespace string) (any, error)

func (*KubernetesClient) GetResourcesForModule

func (k *KubernetesClient) GetResourcesForModule(name string) ([]dto.Resource, error)

func (*KubernetesClient) GetResourcesForRelease

func (k *KubernetesClient) GetResourcesForRelease(releaseName string) ([]dto.Resource, error)

func (*KubernetesClient) GetStatefulSetsLogs

func (k *KubernetesClient) GetStatefulSetsLogs(namespace, container, name string, numLogs *int64) ([]string, error)

func (*KubernetesClient) GetStreamedPodLogs

func (k *KubernetesClient) GetStreamedPodLogs(ctx context.Context, namespace, container, name string, logCount *int64, logChan chan<- string) error

func (*KubernetesClient) GetTemplateAuthRuleSecret

func (k *KubernetesClient) GetTemplateAuthRuleSecret(name, key string) (string, error)

func (*KubernetesClient) GetWorkloadsForModule

func (k *KubernetesClient) GetWorkloadsForModule(name string) ([]dto.Resource, error)

func (*KubernetesClient) GetWorkloadsForRelease

func (k *KubernetesClient) GetWorkloadsForRelease(releaseName string) ([]dto.Resource, error)

func (*KubernetesClient) ListModules

func (k *KubernetesClient) ListModules() ([]cyclopsv1alpha1.Module, error)

func (*KubernetesClient) ListNamespaces

func (k *KubernetesClient) ListNamespaces() ([]string, error)

func (*KubernetesClient) ListNodes

func (k *KubernetesClient) ListNodes() ([]apiv1.Node, error)

func (*KubernetesClient) ListTemplateAuthRules

func (k *KubernetesClient) ListTemplateAuthRules() ([]cyclopsv1alpha1.TemplateAuthRule, error)

func (*KubernetesClient) ListTemplateStore

func (k *KubernetesClient) ListTemplateStore() ([]cyclopsv1alpha1.TemplateStore, error)

func (*KubernetesClient) Restart

func (k *KubernetesClient) Restart(group, version, kind, name, namespace string) error

func (*KubernetesClient) RestartDaemonSet

func (k *KubernetesClient) RestartDaemonSet(name, namespace string) error

func (*KubernetesClient) RestartDeployment

func (k *KubernetesClient) RestartDeployment(name, namespace string) error

func (*KubernetesClient) RestartStatefulSet

func (k *KubernetesClient) RestartStatefulSet(name, namespace string) error

func (*KubernetesClient) UpdateModule

func (k *KubernetesClient) UpdateModule(module *cyclopsv1alpha1.Module) error

func (*KubernetesClient) UpdateModuleStatus

func (k *KubernetesClient) UpdateModuleStatus(module *cyclopsv1alpha1.Module) (*cyclopsv1alpha1.Module, error)

func (*KubernetesClient) UpdateTemplateStore

func (k *KubernetesClient) UpdateTemplateStore(ts *cyclopsv1alpha1.TemplateStore) error

func (*KubernetesClient) VersionInfo

func (k *KubernetesClient) VersionInfo() (*version.Info, error)

func (*KubernetesClient) WatchKubernetesResources

func (k *KubernetesClient) WatchKubernetesResources(gvrs []ResourceWatchSpec, stopCh chan struct{}) (chan *unstructured.Unstructured, error)

func (*KubernetesClient) WatchResource

func (k *KubernetesClient) WatchResource(group, version, resource, name, namespace string) (watch.Interface, error)

type ResourceWatchSpec

type ResourceWatchSpec struct {
	GVR       schema.GroupVersionResource
	Namespace string
	Name      string
}

Jump to

Keyboard shortcuts

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