k8sclient

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2022 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LABEL_ENVIRONMENT         = "environment"
	LABEL_COMPONENT           = "component"
	LABEL_APP_IDPP2           = "app.idpp2"
	LABEL_PART_OF             = "part-of"
	LABEL_IDPP2_BUILDER       = "aiblab.co.kr/builder"
	LABEL_IDPP2_BUILDER_TAGET = "aiblab.co.kr/builder-target"
	LABEL_IDPP2_USERNAME      = "aiblab.co.kr/username"
	LABEL_JUPYTERUSERNAME     = "hub.jupyter.org/username"
	LABEL_NVIDIA_GPU          = "nvidia.com/gpu"
)
View Source
const (
	FIELD_MANAGER                  = "projectmanager"
	AIBLAB_ENVIRONMENT             = "idpp2"
	AIBLAB_BUILDER                 = "idpp2-builder"
	AIBLAB_BUILDER_TAGET_IPYKERNEL = "ipykernel"
	AIBLAB_BUILDER_TAGET_IRKERNEL  = "irkernel"
	AIBLAB_BUILDER_TAGET_TFSERVING = "tfserving"
)
View Source
const (
	TYPEMETA_KIND_NAMESPACE     = "Namespace"
	TYPEMETA_KIND_RESOURCEQUOTA = "ResourceQuota"
	TYPEMETA_KIND_POD           = "Pod"
	TYPEMETA_KIND_SERVICE       = "Service"
	TYPEMETA_KIND_DEPLOYMENT    = "Deployment"
	TYPEMETA_KIND_JOB           = "Job"
)
View Source
const (
	TYPEMETA_APIVERSION_V1              = "v1"
	TYPEMETA_APIVERSION_BATCH_V1        = "batch/v1"
	TYPEMETA_APIVERSION_METRICS_V1BETA1 = "metrics.k8s.io/v1beta1"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiSpecs

type ApiSpecs map[string]metav1.APIResource

func (ApiSpecs) GetResource

func (s ApiSpecs) GetResource(kind string) metav1.APIResource

type ClientImpl

type ClientImpl struct {
	// contains filtered or unexported fields
}

func NewK8sClient

func NewK8sClient(config *K8sClusterConfig) *ClientImpl

func (*ClientImpl) ApiSpecs

func (s *ClientImpl) ApiSpecs() ApiSpecs

func (*ClientImpl) ApplyNamespace

func (s *ClientImpl) ApplyNamespace(ctx context.Context, name string, labels K8sLabels) (*corev1.Namespace, error)

func (*ClientImpl) ApplyResourceQuota added in v0.0.3

func (s *ClientImpl) ApplyResourceQuota(ctx context.Context, namespace string, name string, spec corev1.ResourceList) (*corev1.ResourceQuota, error)

func (*ClientImpl) DeleteConfigMap

func (s *ClientImpl) DeleteConfigMap(ctx context.Context, namespace string, name string) error

func (*ClientImpl) DeleteConfigMaps

func (s *ClientImpl) DeleteConfigMaps(ctx context.Context, namespace string, selector string) error

func (*ClientImpl) DeleteCronJob

func (s *ClientImpl) DeleteCronJob(ctx context.Context, namespace string, name string) error

func (*ClientImpl) DeleteCronJobs

func (s *ClientImpl) DeleteCronJobs(ctx context.Context, namespace string, selector string) error

func (*ClientImpl) DeleteDaemonSet

func (s *ClientImpl) DeleteDaemonSet(ctx context.Context, namespace string, name string) error

func (*ClientImpl) DeleteDaemonSets

func (s *ClientImpl) DeleteDaemonSets(ctx context.Context, namespace string, selector string) error

func (*ClientImpl) DeleteDeployment

func (s *ClientImpl) DeleteDeployment(ctx context.Context, namespace string, name string) error

func (*ClientImpl) DeleteDeployments

func (s *ClientImpl) DeleteDeployments(ctx context.Context, namespace string, selector string) error

func (*ClientImpl) DeleteJob

func (s *ClientImpl) DeleteJob(ctx context.Context, namespace string, name string) error

func (*ClientImpl) DeleteJobs

func (s *ClientImpl) DeleteJobs(ctx context.Context, namespace string, selector string) error

func (*ClientImpl) DeleteLimitRange

func (s *ClientImpl) DeleteLimitRange(ctx context.Context, namespace string, name string) error

func (*ClientImpl) DeleteLimitRanges

func (s *ClientImpl) DeleteLimitRanges(ctx context.Context, namespace string, selector string) error

func (*ClientImpl) DeleteNamespace

func (s *ClientImpl) DeleteNamespace(ctx context.Context, name string) error

func (*ClientImpl) DeletePersistentVolumeClaim

func (s *ClientImpl) DeletePersistentVolumeClaim(ctx context.Context, namespace string, name string) error

func (*ClientImpl) DeletePersistentVolumeClaims

func (s *ClientImpl) DeletePersistentVolumeClaims(ctx context.Context, namespace string, selector string) error

func (*ClientImpl) DeletePod

func (s *ClientImpl) DeletePod(ctx context.Context, namespace string, name string) error

func (*ClientImpl) DeletePodTemplate

func (s *ClientImpl) DeletePodTemplate(ctx context.Context, namespace string, name string) error

func (*ClientImpl) DeletePodTemplates

func (s *ClientImpl) DeletePodTemplates(ctx context.Context, namespace string, selector string) error

func (*ClientImpl) DeletePods

func (s *ClientImpl) DeletePods(ctx context.Context, namespace string, selector string) error

func (*ClientImpl) DeleteReplicaSet

func (s *ClientImpl) DeleteReplicaSet(ctx context.Context, namespace string, name string) error

func (*ClientImpl) DeleteReplicaSets

func (s *ClientImpl) DeleteReplicaSets(ctx context.Context, namespace string, selector string) error

func (*ClientImpl) DeleteReplicationController

func (s *ClientImpl) DeleteReplicationController(ctx context.Context, namespace string, name string) error

func (*ClientImpl) DeleteReplicationControllers

func (s *ClientImpl) DeleteReplicationControllers(ctx context.Context, namespace string, selector string) error

func (*ClientImpl) DeleteResourceQuota

func (s *ClientImpl) DeleteResourceQuota(ctx context.Context, namespace string, name string) error

func (*ClientImpl) DeleteResourceQuotas

func (s *ClientImpl) DeleteResourceQuotas(ctx context.Context, namespace string, selector string) error

func (*ClientImpl) DeleteSecret

func (s *ClientImpl) DeleteSecret(ctx context.Context, namespace string, name string) error

func (*ClientImpl) DeleteSecrets

func (s *ClientImpl) DeleteSecrets(ctx context.Context, namespace string, selector string) error

func (*ClientImpl) DeleteService

func (s *ClientImpl) DeleteService(ctx context.Context, namespace string, name string) error

func (*ClientImpl) DeleteServiceAccount

func (s *ClientImpl) DeleteServiceAccount(ctx context.Context, namespace string, name string) error

func (*ClientImpl) DeleteServiceAccounts

func (s *ClientImpl) DeleteServiceAccounts(ctx context.Context, namespace string, selector string) error

func (*ClientImpl) DeleteStatefulSet

func (s *ClientImpl) DeleteStatefulSet(ctx context.Context, namespace string, name string) error

func (*ClientImpl) DeleteStatefulSets

func (s *ClientImpl) DeleteStatefulSets(ctx context.Context, namespace string, selector string) error

func (*ClientImpl) GetConfigMap

func (s *ClientImpl) GetConfigMap(ctx context.Context, namespace string, name string) (*corev1.ConfigMap, error)

func (*ClientImpl) GetCronJob

func (s *ClientImpl) GetCronJob(ctx context.Context, namespace string, name string) (*batchv1.CronJob, error)

func (*ClientImpl) GetDaemonSet

func (s *ClientImpl) GetDaemonSet(ctx context.Context, namespace string, name string) (*appsv1.DaemonSet, error)

func (*ClientImpl) GetDeployment

func (s *ClientImpl) GetDeployment(ctx context.Context, namespace string, name string) (*appsv1.Deployment, error)

func (*ClientImpl) GetEndpoints

func (s *ClientImpl) GetEndpoints(ctx context.Context, namspace string, name string) (*corev1.Endpoints, error)

func (*ClientImpl) GetEvent

func (s *ClientImpl) GetEvent(ctx context.Context, namspace string, name string) (*eventv1.Event, error)

func (*ClientImpl) GetJob

func (s *ClientImpl) GetJob(ctx context.Context, namespace string, name string) (*batchv1.Job, error)

func (*ClientImpl) GetLimitRange

func (s *ClientImpl) GetLimitRange(ctx context.Context, namspace string, name string) (*corev1.LimitRange, error)

func (*ClientImpl) GetNamespace

func (s *ClientImpl) GetNamespace(ctx context.Context, name string) (*corev1.Namespace, error)

func (*ClientImpl) GetNode

func (s *ClientImpl) GetNode(ctx context.Context, name string) (*corev1.Node, error)

func (*ClientImpl) GetPersistentVolume

func (s *ClientImpl) GetPersistentVolume(ctx context.Context, name string) (*corev1.PersistentVolume, error)

func (*ClientImpl) GetPersistentVolumeClaim

func (s *ClientImpl) GetPersistentVolumeClaim(ctx context.Context, namspace string, name string) (*corev1.PersistentVolumeClaim, error)

func (*ClientImpl) GetPod

func (s *ClientImpl) GetPod(ctx context.Context, namespace string, name string) (*corev1.Pod, error)

func (*ClientImpl) GetPodTemplate

func (s *ClientImpl) GetPodTemplate(ctx context.Context, namespace string, name string) (*corev1.PodTemplate, error)

func (*ClientImpl) GetReplicaSet

func (s *ClientImpl) GetReplicaSet(ctx context.Context, namespace string, name string) (*appsv1.ReplicaSet, error)

func (*ClientImpl) GetReplicationController

func (s *ClientImpl) GetReplicationController(ctx context.Context, namespace string, name string) (*corev1.ReplicationController, error)

func (*ClientImpl) GetResourceQuota

func (s *ClientImpl) GetResourceQuota(ctx context.Context, namespace string, name string) (*corev1.ResourceQuota, error)

func (*ClientImpl) GetSecret

func (s *ClientImpl) GetSecret(ctx context.Context, namespace string, name string) (*corev1.Secret, error)

func (*ClientImpl) GetService

func (s *ClientImpl) GetService(ctx context.Context, namespace string, name string) (*corev1.Service, error)

func (*ClientImpl) GetServiceAccount

func (s *ClientImpl) GetServiceAccount(ctx context.Context, namespace string, name string) (*corev1.ServiceAccount, error)

func (*ClientImpl) GetStatefulSet

func (s *ClientImpl) GetStatefulSet(ctx context.Context, namespace string, name string) (*appsv1.StatefulSet, error)

func (*ClientImpl) GetStorageClass

func (s *ClientImpl) GetStorageClass(ctx context.Context, namespace string, name string) (*storagev1.StorageClass, error)

func (*ClientImpl) ListConfigMap

func (s *ClientImpl) ListConfigMap(ctx context.Context, namespace string, selector string) (*corev1.ConfigMapList, error)

func (*ClientImpl) ListCronJob

func (s *ClientImpl) ListCronJob(ctx context.Context, namespace string, selector string) (*batchv1.CronJobList, error)

func (*ClientImpl) ListDaemonSet

func (s *ClientImpl) ListDaemonSet(ctx context.Context, namespace string, selector string) (*appsv1.DaemonSetList, error)

func (*ClientImpl) ListDeployment

func (s *ClientImpl) ListDeployment(ctx context.Context, namespace string, selector string) (*appsv1.DeploymentList, error)

func (*ClientImpl) ListEndpoints

func (s *ClientImpl) ListEndpoints(ctx context.Context, namespace string, selector string) (*corev1.EndpointsList, error)

func (*ClientImpl) ListEvent

func (s *ClientImpl) ListEvent(ctx context.Context, namespace string, selector string) (*eventv1.EventList, error)

func (*ClientImpl) ListJob

func (s *ClientImpl) ListJob(ctx context.Context, namespace string, selector string) (*batchv1.JobList, error)

func (*ClientImpl) ListLimitRange

func (s *ClientImpl) ListLimitRange(ctx context.Context, namespace string, selector string) (*corev1.LimitRangeList, error)

func (*ClientImpl) ListNamespace

func (s *ClientImpl) ListNamespace(ctx context.Context, selector string) (*corev1.NamespaceList, error)

func (*ClientImpl) ListNode

func (s *ClientImpl) ListNode(ctx context.Context, selector string) (*corev1.NodeList, error)

func (*ClientImpl) ListPersistentVolume

func (s *ClientImpl) ListPersistentVolume(ctx context.Context, selector string) (*corev1.PersistentVolumeList, error)

func (*ClientImpl) ListPersistentVolumeClaim

func (s *ClientImpl) ListPersistentVolumeClaim(ctx context.Context, namespace string, selector string) (*corev1.PersistentVolumeClaimList, error)

func (*ClientImpl) ListPod

func (s *ClientImpl) ListPod(ctx context.Context, namespace string, selector string) (*corev1.PodList, error)

func (*ClientImpl) ListPodTemplate

func (s *ClientImpl) ListPodTemplate(ctx context.Context, namespace string, selector string) (*corev1.PodTemplateList, error)

func (*ClientImpl) ListReplicaSet

func (s *ClientImpl) ListReplicaSet(ctx context.Context, namespace string, selector string) (*appsv1.ReplicaSetList, error)

func (*ClientImpl) ListReplicationController

func (s *ClientImpl) ListReplicationController(ctx context.Context, namespace string, selector string) (*corev1.ReplicationControllerList, error)

func (*ClientImpl) ListResourceQuota

func (s *ClientImpl) ListResourceQuota(ctx context.Context, namespace string, selector string) (*corev1.ResourceQuotaList, error)

func (*ClientImpl) ListSecret

func (s *ClientImpl) ListSecret(ctx context.Context, namespace string, selector string) (*corev1.SecretList, error)

func (*ClientImpl) ListService

func (s *ClientImpl) ListService(ctx context.Context, namespace string, selector string) (*corev1.ServiceList, error)

func (*ClientImpl) ListServiceAccount

func (s *ClientImpl) ListServiceAccount(ctx context.Context, namespace string, selector string) (*corev1.ServiceAccountList, error)

func (*ClientImpl) ListStatefulSet

func (s *ClientImpl) ListStatefulSet(ctx context.Context, namespace string, selector string) (*appsv1.StatefulSetList, error)

func (*ClientImpl) ObjectToJob

func (s *ClientImpl) ObjectToJob(object runtime.Object) *batchv1.Job

func (*ClientImpl) ObjectToNamespace

func (s *ClientImpl) ObjectToNamespace(object runtime.Object) *corev1.Namespace

func (*ClientImpl) ObjectToPod

func (s *ClientImpl) ObjectToPod(object runtime.Object) *corev1.Pod

func (*ClientImpl) ObjectToResourceQuota

func (s *ClientImpl) ObjectToResourceQuota(object runtime.Object) *corev1.ResourceQuota

func (*ClientImpl) RestartDaemonSet

func (s *ClientImpl) RestartDaemonSet(ctx context.Context, namespace string, name string) (*appsv1.DaemonSet, error)

func (*ClientImpl) RestartDeployment

func (s *ClientImpl) RestartDeployment(ctx context.Context, namespace string, name string) (*appsv1.Deployment, error)

func (*ClientImpl) RestartStatefulSet

func (s *ClientImpl) RestartStatefulSet(ctx context.Context, namespace string, name string) (*appsv1.StatefulSet, error)

func (*ClientImpl) WatchJobs

func (s *ClientImpl) WatchJobs(ctx context.Context, namespace string, selector string) (watch.Interface, error)

func (*ClientImpl) WatchNamespaces

func (s *ClientImpl) WatchNamespaces(ctx context.Context, selector string) (watch.Interface, error)

func (*ClientImpl) WatchPods

func (s *ClientImpl) WatchPods(ctx context.Context, namespace string, selector string) (watch.Interface, error)

func (ClientImpl) WatchResourceQuotas

func (s ClientImpl) WatchResourceQuotas(ctx context.Context, namespace string, selector string) (watch.Interface, error)

type DynamicImpl

type DynamicImpl struct {
	// contains filtered or unexported fields
}

func NewK8sDynamicClient

func NewK8sDynamicClient(config *K8sClusterConfig) *DynamicImpl

func (*DynamicImpl) Apply

type K8sClusterConfig

type K8sClusterConfig struct {
	// contains filtered or unexported fields
}

func NewClusterConfig

func NewClusterConfig() *K8sClusterConfig

type K8sLabels

type K8sLabels map[string]string

func (K8sLabels) Get

func (s K8sLabels) Get(key string) string

func (K8sLabels) Put

func (s K8sLabels) Put(key string, val string) K8sLabels

type LabelName

type LabelName string

type MetricsImpl added in v0.0.3

type MetricsImpl struct {
	// contains filtered or unexported fields
}

func NewK8sMetricClient

func NewK8sMetricClient(config *K8sClusterConfig) *MetricsImpl

func (*MetricsImpl) GetNode added in v0.0.3

func (*MetricsImpl) GetPod added in v0.0.3

func (s *MetricsImpl) GetPod(ctx context.Context, namespace string, name string) (*metricsV1beta1api.PodMetrics, error)

func (*MetricsImpl) ListNode added in v0.0.3

func (s *MetricsImpl) ListNode(ctx context.Context, selector string) (*metricsV1beta1api.NodeMetricsList, error)

func (*MetricsImpl) ListPod added in v0.0.3

func (s *MetricsImpl) ListPod(ctx context.Context, namespace string, selector string) (*metricsV1beta1api.PodMetricsList, error)

type ResourceSpecs

type ResourceSpecs map[string]interface{}

func (ResourceSpecs) GetApiVersion

func (s ResourceSpecs) GetApiVersion() string

func (ResourceSpecs) GetKind

func (s ResourceSpecs) GetKind() string

func (ResourceSpecs) GetName

func (s ResourceSpecs) GetName() string

func (ResourceSpecs) GroupVersionResource

func (s ResourceSpecs) GroupVersionResource(client *ClientImpl) schema.GroupVersionResource

Jump to

Keyboard shortcuts

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