Documentation ¶
Index ¶
- Constants
- Variables
- func CheckEvictionSupport(clientset kubernetes.Interface) (schema.GroupVersion, error)
- func CheckIfValidLabel(labelKey string, labelValue string) error
- func DeletePod(pod v1.Pod, k8sClientSet *kubernetes.Clientset, ...) error
- func EvictPod(pod v1.Pod, k8sClientSet *kubernetes.Clientset, ...) error
- func OverrideK8sHttpClientWithTracer(restConfig *rest.Config) (*http.Client, error)
- func ServerResourceForGroupVersionKind(discoveryClient discovery.DiscoveryInterface, gvk schema.GroupVersionKind) (*metav1.APIResource, error)
- func UpdateNodeUnschedulableProperty(desiredUnschedulable bool, node *v1.Node, k8sClientSet *kubernetes.Clientset) (*v1.Node, error)
- type ApplyResourcesRequest
- type ApplyResourcesResponse
- type ClusterConfig
- type ClusterResourceListMap
- type EventsResponse
- type GetAllApiResourcesResponse
- type JsonPatchType
- type K8sApiResource
- type K8sRequestBean
- type K8sUtil
- func (impl K8sUtil) BuildK8sObjectListTableData(manifest *unstructured.UnstructuredList, namespaced bool, ...) (*ClusterResourceListMap, error)
- func (impl K8sUtil) CreateConfigMap(namespace string, cm *v1.ConfigMap, client *v12.CoreV1Client) (*v1.ConfigMap, error)
- func (impl K8sUtil) CreateJob(namespace string, name string, clusterConfig *ClusterConfig, job *batchV1.Job) error
- func (impl K8sUtil) CreateK8sClientSet(restConfig *rest.Config) (*kubernetes.Clientset, error)
- func (impl K8sUtil) CreateNsIfNotExists(namespace string, clusterConfig *ClusterConfig) (err error)
- func (impl *K8sUtil) CreateResources(ctx context.Context, restConfig *rest.Config, manifest string, ...) (*ManifestResponse, error)
- func (impl K8sUtil) CreateSecret(namespace string, data map[string][]byte, secretName string, ...) (*v1.Secret, error)
- func (impl K8sUtil) CreateSecretData(namespace string, secret *v1.Secret, v1Client *v12.CoreV1Client) (*v1.Secret, error)
- func (impl *K8sUtil) DecodeGroupKindversion(data string) (*schema.GroupVersionKind, error)
- func (impl K8sUtil) DeleteAndCreateJob(content []byte, namespace string, clusterConfig *ClusterConfig) error
- func (impl K8sUtil) DeleteJob(namespace string, name string, clusterConfig *ClusterConfig) error
- func (impl K8sUtil) DeletePodByLabel(namespace string, labels string, clusterConfig *ClusterConfig) error
- func (impl *K8sUtil) DeleteResource(ctx context.Context, restConfig *rest.Config, gvk schema.GroupVersionKind, ...) (*ManifestResponse, error)
- func (impl K8sUtil) DeleteSecret(namespace string, name string, client *v12.CoreV1Client) error
- func (impl K8sUtil) DiscoveryClientGetLiveZCall(cluster *ClusterConfig) ([]byte, error)
- func (impl K8sUtil) ExtractK8sServerMajorAndMinorVersion(k8sServerVersion *version.Info) (int, int, error)
- func (impl K8sUtil) FetchConnectionStatusForCluster(k8sClientSet *kubernetes.Clientset) error
- func (impl K8sUtil) GetApiResources(restConfig *rest.Config, includeOnlyVerb string) ([]*K8sApiResource, error)
- func (impl K8sUtil) GetClientByToken(serverUrl string, token map[string]string) (*v12.CoreV1Client, error)
- func (impl K8sUtil) GetClientForInCluster() (*v12.CoreV1Client, error)
- func (impl K8sUtil) GetConfigMap(namespace string, name string, client *v12.CoreV1Client) (*v1.ConfigMap, error)
- func (impl K8sUtil) GetCoreV1Client(clusterConfig *ClusterConfig) (*v12.CoreV1Client, error)
- func (impl K8sUtil) GetCoreV1ClientByRestConfig(restConfig *rest.Config) (*v12.CoreV1Client, error)
- func (impl K8sUtil) GetCoreV1ClientInCluster() (*v12.CoreV1Client, error)
- func (impl K8sUtil) GetK8sConfigAndClients(clusterConfig *ClusterConfig) (*rest.Config, *http.Client, *kubernetes.Clientset, error)
- func (impl K8sUtil) GetK8sConfigAndClientsByRestConfig(restConfig *rest.Config) (*http.Client, *kubernetes.Clientset, error)
- func (impl K8sUtil) GetK8sDiscoveryClient(clusterConfig *ClusterConfig) (*discovery.DiscoveryClient, error)
- func (impl K8sUtil) GetK8sDiscoveryClientInCluster() (*discovery.DiscoveryClient, error)
- func (impl K8sUtil) GetK8sInClusterConfigAndClients() (*rest.Config, *http.Client, *kubernetes.Clientset, error)
- func (impl K8sUtil) GetK8sInClusterConfigAndDynamicClients() (*rest.Config, *http.Client, dynamic.Interface, error)
- func (impl K8sUtil) GetK8sInClusterRestConfig() (*rest.Config, error)
- func (impl K8sUtil) GetK8sServerVersion(clientSet *kubernetes.Clientset) (*version.Info, error)
- func (impl K8sUtil) GetKubeVersion() (*version.Info, error)
- func (impl K8sUtil) GetLiveZCall(path string, k8sClientSet *kubernetes.Clientset) ([]byte, error)
- func (impl K8sUtil) GetLogsForAPod(kubeClient *kubernetes.Clientset, namespace string, podName string, ...) *restclient.Request
- func (impl K8sUtil) GetMetricsClientSet(restConfig *rest.Config, k8sHttpClient *http.Client) (*metrics.Clientset, error)
- func (impl K8sUtil) GetNmByName(ctx context.Context, metricsClientSet *metrics.Clientset, name string) (*v1beta1.NodeMetrics, error)
- func (impl K8sUtil) GetNmList(ctx context.Context, metricsClientSet *metrics.Clientset) (*v1beta1.NodeMetricsList, error)
- func (impl K8sUtil) GetNodeByName(ctx context.Context, k8sClientSet *kubernetes.Clientset, name string) (*v1.Node, error)
- func (impl K8sUtil) GetNodesList(ctx context.Context, k8sClientSet *kubernetes.Clientset) (*v1.NodeList, error)
- func (impl K8sUtil) GetPodByName(namespace string, name string, client *v12.CoreV1Client) (*v1.Pod, error)
- func (impl K8sUtil) GetPodListByLabel(namespace, label string, clientSet *kubernetes.Clientset) ([]v1.Pod, error)
- func (impl K8sUtil) GetPodLogs(ctx context.Context, restConfig *rest.Config, name string, namespace string, ...) (io.ReadCloser, error)
- func (impl K8sUtil) GetPodsListForNamespace(ctx context.Context, k8sClientSet *kubernetes.Clientset, namespace string) (*v1.PodList, error)
- func (impl *K8sUtil) GetResource(ctx context.Context, namespace string, name string, ...) (*ManifestResponse, error)
- func (impl K8sUtil) GetResourceIf(restConfig *rest.Config, groupVersionKind schema.GroupVersionKind) (resourceIf dynamic.NamespaceableResourceInterface, namespaced bool, err error)
- func (impl K8sUtil) GetResourceIfWithAcceptHeader(restConfig *rest.Config, groupVersionKind schema.GroupVersionKind) (resourceIf dynamic.NamespaceableResourceInterface, namespaced bool, err error)
- func (impl K8sUtil) GetResourceInfoByLabelSelector(ctx context.Context, namespace string, labelSelector string) (*v1.Pod, error)
- func (impl K8sUtil) GetResourceList(ctx context.Context, restConfig *rest.Config, gvk schema.GroupVersionKind, ...) (*ResourceListResponse, bool, error)
- func (impl K8sUtil) GetRestConfigByCluster(clusterConfig *ClusterConfig) (*restclient.Config, error)
- func (impl K8sUtil) GetSecret(namespace string, name string, client *v12.CoreV1Client) (*v1.Secret, error)
- func (impl K8sUtil) GetServerVersionFromDiscoveryClient(k8sClientSet *kubernetes.Clientset) (*version.Info, error)
- func (impl K8sUtil) ListEvents(restConfig *rest.Config, namespace string, ...) (*v1.EventList, error)
- func (impl K8sUtil) ListNamespaces(client *v12.CoreV1Client) (*v1.NamespaceList, error)
- func (impl K8sUtil) PatchConfigMap(namespace string, clusterConfig *ClusterConfig, name string, ...) (*v1.ConfigMap, error)
- func (impl K8sUtil) PatchConfigMapJsonType(namespace string, clusterConfig *ClusterConfig, name string, data interface{}, ...) (*v1.ConfigMap, error)
- func (impl K8sUtil) PatchResourceRequest(ctx context.Context, restConfig *rest.Config, pt types.PatchType, ...) (*ManifestResponse, error)
- func (impl K8sUtil) UpdateConfigMap(namespace string, cm *v1.ConfigMap, client *v12.CoreV1Client) (*v1.ConfigMap, error)
- func (impl *K8sUtil) UpdateResource(ctx context.Context, restConfig *rest.Config, gvk schema.GroupVersionKind, ...) (*ManifestResponse, error)
- func (impl K8sUtil) UpdateSecret(namespace string, secret *v1.Secret, client *v12.CoreV1Client) (*v1.Secret, error)
- func (impl K8sUtil) ValidateResource(resourceObj map[string]interface{}, gvk schema.GroupVersionKind, ...) bool
- type ManifestResponse
- type PodLogsRequest
- type ResourceIdentifier
- type ResourceListResponse
Constants ¶
View Source
const ( DefaultClusterUrl = "https://kubernetes.default.svc" BearerToken = "bearer_token" CertificateAuthorityData = "cert_auth_data" CertData = "cert_data" TlsKey = "tls_key" LiveZ = "/livez" )
View Source
const ( // EvictionKind represents the kind of evictions object EvictionKind = "Eviction" // EvictionSubresource represents the kind of evictions object as pod's subresource EvictionSubresource = "pods/eviction" )
View Source
const AppsGroup = "apps"
View Source
const BatchGroup = "batch"
View Source
const K8sClusterResourceApiVersionKey = "apiVersion"
View Source
const K8sClusterResourceCellKey = "cells"
View Source
const K8sClusterResourceColumnDefinitionKey = "columnDefinitions"
View Source
const K8sClusterResourceCreationTimestampKey = "creationTimestamp"
View Source
const K8sClusterResourceCronJobKind = "CronJob"
View Source
const K8sClusterResourceKindKey = "kind"
View Source
const K8sClusterResourceMetadataKey = "metadata"
View Source
const K8sClusterResourceMetadataNameKey = "name"
View Source
const K8sClusterResourceNameKey = "name"
View Source
const K8sClusterResourceNamespaceKey = "namespace"
View Source
const K8sClusterResourceObjectKey = "object"
View Source
const K8sClusterResourceOwnerReferenceKey = "ownerReferences"
View Source
const K8sClusterResourcePriorityKey = "priority"
View Source
const K8sClusterResourceReplicationControllerKind = "ReplicationController"
View Source
const K8sClusterResourceRolloutGroup = "argoproj.io"
View Source
const K8sClusterResourceRolloutKind = "Rollout"
View Source
const K8sClusterResourceRowsKey = "rows"
View Source
const RestartingNotSupported = "restarting not supported"
View Source
const Running = "Running"
View Source
const V1VERSION = "v1"
Variables ¶
View Source
var KindVsChildrenGvk = map[string][]schema.GroupVersionKind{ kube.DeploymentKind: append(make([]schema.GroupVersionKind, 0), schema.GroupVersionKind{Group: AppsGroup, Version: V1VERSION, Kind: kube.ReplicaSetKind}, schema.GroupVersionKind{Version: V1VERSION, Kind: kube.PodKind}), K8sClusterResourceRolloutKind: append(make([]schema.GroupVersionKind, 0), schema.GroupVersionKind{Group: AppsGroup, Version: V1VERSION, Kind: kube.ReplicaSetKind}, schema.GroupVersionKind{Version: V1VERSION, Kind: kube.PodKind}), K8sClusterResourceCronJobKind: append(make([]schema.GroupVersionKind, 0), schema.GroupVersionKind{Group: BatchGroup, Version: V1VERSION, Kind: kube.JobKind}, schema.GroupVersionKind{Version: V1VERSION, Kind: kube.PodKind}), kube.JobKind: append(make([]schema.GroupVersionKind, 0), schema.GroupVersionKind{Version: V1VERSION, Kind: kube.PodKind}), kube.ReplicaSetKind: append(make([]schema.GroupVersionKind, 0), schema.GroupVersionKind{Version: V1VERSION, Kind: kube.PodKind}), kube.DaemonSetKind: append(make([]schema.GroupVersionKind, 0), schema.GroupVersionKind{Version: V1VERSION, Kind: kube.PodKind}), kube.StatefulSetKind: append(make([]schema.GroupVersionKind, 0), schema.GroupVersionKind{Version: V1VERSION, Kind: kube.PodKind}), K8sClusterResourceReplicationControllerKind: append(make([]schema.GroupVersionKind, 0), schema.GroupVersionKind{Version: V1VERSION, Kind: kube.PodKind}), }
Functions ¶
func CheckEvictionSupport ¶ added in v0.6.10
func CheckEvictionSupport(clientset kubernetes.Interface) (schema.GroupVersion, error)
CheckEvictionSupport uses Discovery API to find out if the server support eviction subresource If support, it will return its groupVersion; Otherwise, it will return an empty GroupVersion
func CheckIfValidLabel ¶ added in v0.6.21
func DeletePod ¶ added in v0.6.10
func DeletePod(pod v1.Pod, k8sClientSet *kubernetes.Clientset, deleteOptions metav1.DeleteOptions) error
DeletePod will delete the given pod, or return an error if it couldn't
func EvictPod ¶ added in v0.6.10
func EvictPod(pod v1.Pod, k8sClientSet *kubernetes.Clientset, evictionGroupVersion schema.GroupVersion, deleteOptions metav1.DeleteOptions) error
EvictPod will evict the given pod, or return an error if it couldn't
func OverrideK8sHttpClientWithTracer ¶ added in v0.6.21
func ServerResourceForGroupVersionKind ¶ added in v0.6.21
func ServerResourceForGroupVersionKind(discoveryClient discovery.DiscoveryInterface, gvk schema.GroupVersionKind) (*metav1.APIResource, error)
func UpdateNodeUnschedulableProperty ¶ added in v0.6.21
Types ¶
type ApplyResourcesRequest ¶ added in v0.6.21
type ApplyResourcesResponse ¶ added in v0.6.21
type ClusterConfig ¶ added in v0.6.21
type ClusterResourceListMap ¶ added in v0.6.21
type EventsResponse ¶ added in v0.6.21
type GetAllApiResourcesResponse ¶ added in v0.6.21
type GetAllApiResourcesResponse struct { ApiResources []*K8sApiResource `json:"apiResources"` AllowedAll bool `json:"allowedAll"` }
type JsonPatchType ¶ added in v0.6.21
type K8sApiResource ¶ added in v0.6.21
type K8sApiResource struct { Gvk schema.GroupVersionKind `json:"gvk"` Namespaced bool `json:"namespaced"` }
type K8sRequestBean ¶ added in v0.6.21
type K8sRequestBean struct { ResourceIdentifier ResourceIdentifier `json:"resourceIdentifier"` Patch string `json:"patch,omitempty"` PodLogsRequest PodLogsRequest `json:"podLogsRequest,omitempty"` ForceDelete bool `json:"-"` }
type K8sUtil ¶ added in v0.6.21
type K8sUtil struct {
// contains filtered or unexported fields
}
func NewK8sUtil ¶ added in v0.6.21
func NewK8sUtil(logger *zap.SugaredLogger, runTimeConfig *client.RuntimeConfig) *K8sUtil
func (K8sUtil) BuildK8sObjectListTableData ¶ added in v0.6.21
func (impl K8sUtil) BuildK8sObjectListTableData(manifest *unstructured.UnstructuredList, namespaced bool, gvk schema.GroupVersionKind, validateResourceAccess func(namespace string, group string, kind string, resourceName string) bool) (*ClusterResourceListMap, error)
func (K8sUtil) CreateConfigMap ¶ added in v0.6.21
func (K8sUtil) CreateK8sClientSet ¶ added in v0.6.21
func (K8sUtil) CreateNsIfNotExists ¶ added in v0.6.21
func (impl K8sUtil) CreateNsIfNotExists(namespace string, clusterConfig *ClusterConfig) (err error)
func (*K8sUtil) CreateResources ¶ added in v0.6.21
func (K8sUtil) CreateSecret ¶ added in v0.6.21
func (K8sUtil) CreateSecretData ¶ added in v0.6.21
func (*K8sUtil) DecodeGroupKindversion ¶ added in v0.6.21
func (impl *K8sUtil) DecodeGroupKindversion(data string) (*schema.GroupVersionKind, error)
func (K8sUtil) DeleteAndCreateJob ¶ added in v0.6.21
func (impl K8sUtil) DeleteAndCreateJob(content []byte, namespace string, clusterConfig *ClusterConfig) error
DeleteAndCreateJob Deletes and recreates if job exists else creates the job
func (K8sUtil) DeleteJob ¶ added in v0.6.21
func (impl K8sUtil) DeleteJob(namespace string, name string, clusterConfig *ClusterConfig) error
func (K8sUtil) DeletePodByLabel ¶ added in v0.6.21
func (impl K8sUtil) DeletePodByLabel(namespace string, labels string, clusterConfig *ClusterConfig) error
func (*K8sUtil) DeleteResource ¶ added in v0.6.21
func (K8sUtil) DeleteSecret ¶ added in v0.6.21
func (K8sUtil) DiscoveryClientGetLiveZCall ¶ added in v0.6.21
func (impl K8sUtil) DiscoveryClientGetLiveZCall(cluster *ClusterConfig) ([]byte, error)
func (K8sUtil) ExtractK8sServerMajorAndMinorVersion ¶ added in v0.6.21
func (K8sUtil) FetchConnectionStatusForCluster ¶ added in v0.6.21
func (impl K8sUtil) FetchConnectionStatusForCluster(k8sClientSet *kubernetes.Clientset) error
func (K8sUtil) GetApiResources ¶ added in v0.6.21
func (impl K8sUtil) GetApiResources(restConfig *rest.Config, includeOnlyVerb string) ([]*K8sApiResource, error)
if verb is supplied empty, that means - return all
func (K8sUtil) GetClientByToken ¶ added in v0.6.21
func (K8sUtil) GetClientForInCluster ¶ added in v0.6.21
func (impl K8sUtil) GetClientForInCluster() (*v12.CoreV1Client, error)
func (K8sUtil) GetConfigMap ¶ added in v0.6.21
func (K8sUtil) GetCoreV1Client ¶ added in v0.6.21
func (impl K8sUtil) GetCoreV1Client(clusterConfig *ClusterConfig) (*v12.CoreV1Client, error)
func (K8sUtil) GetCoreV1ClientByRestConfig ¶ added in v0.6.21
func (K8sUtil) GetCoreV1ClientInCluster ¶ added in v0.6.21
func (impl K8sUtil) GetCoreV1ClientInCluster() (*v12.CoreV1Client, error)
func (K8sUtil) GetK8sConfigAndClients ¶ added in v0.6.21
func (impl K8sUtil) GetK8sConfigAndClients(clusterConfig *ClusterConfig) (*rest.Config, *http.Client, *kubernetes.Clientset, error)
func (K8sUtil) GetK8sConfigAndClientsByRestConfig ¶ added in v0.6.21
func (K8sUtil) GetK8sDiscoveryClient ¶ added in v0.6.21
func (impl K8sUtil) GetK8sDiscoveryClient(clusterConfig *ClusterConfig) (*discovery.DiscoveryClient, error)
func (K8sUtil) GetK8sDiscoveryClientInCluster ¶ added in v0.6.21
func (impl K8sUtil) GetK8sDiscoveryClientInCluster() (*discovery.DiscoveryClient, error)
func (K8sUtil) GetK8sInClusterConfigAndClients ¶ added in v0.6.21
func (K8sUtil) GetK8sInClusterConfigAndDynamicClients ¶ added in v0.6.21
func (K8sUtil) GetK8sInClusterRestConfig ¶ added in v0.6.21
func (K8sUtil) GetK8sServerVersion ¶ added in v0.6.21
func (K8sUtil) GetKubeVersion ¶ added in v0.6.21
func (K8sUtil) GetLiveZCall ¶ added in v0.6.21
func (K8sUtil) GetLogsForAPod ¶ added in v0.6.21
func (impl K8sUtil) GetLogsForAPod(kubeClient *kubernetes.Clientset, namespace string, podName string, container string, follow bool) *restclient.Request
func (K8sUtil) GetMetricsClientSet ¶ added in v0.6.21
func (K8sUtil) GetNmByName ¶ added in v0.6.21
func (K8sUtil) GetNodeByName ¶ added in v0.6.21
func (K8sUtil) GetNodesList ¶ added in v0.6.21
func (K8sUtil) GetPodByName ¶ added in v0.6.21
func (K8sUtil) GetPodListByLabel ¶ added in v0.6.21
func (K8sUtil) GetPodLogs ¶ added in v0.6.21
func (K8sUtil) GetPodsListForNamespace ¶ added in v0.6.21
func (*K8sUtil) GetResource ¶ added in v0.6.21
func (K8sUtil) GetResourceIf ¶ added in v0.6.21
func (impl K8sUtil) GetResourceIf(restConfig *rest.Config, groupVersionKind schema.GroupVersionKind) (resourceIf dynamic.NamespaceableResourceInterface, namespaced bool, err error)
func (K8sUtil) GetResourceIfWithAcceptHeader ¶ added in v0.6.21
func (impl K8sUtil) GetResourceIfWithAcceptHeader(restConfig *rest.Config, groupVersionKind schema.GroupVersionKind) (resourceIf dynamic.NamespaceableResourceInterface, namespaced bool, err error)
func (K8sUtil) GetResourceInfoByLabelSelector ¶ added in v0.6.21
func (K8sUtil) GetResourceList ¶ added in v0.6.21
func (K8sUtil) GetRestConfigByCluster ¶ added in v0.6.21
func (impl K8sUtil) GetRestConfigByCluster(clusterConfig *ClusterConfig) (*restclient.Config, error)
func (K8sUtil) GetServerVersionFromDiscoveryClient ¶ added in v0.6.21
func (K8sUtil) ListEvents ¶ added in v0.6.21
func (K8sUtil) ListNamespaces ¶ added in v0.6.21
func (impl K8sUtil) ListNamespaces(client *v12.CoreV1Client) (*v1.NamespaceList, error)
func (K8sUtil) PatchConfigMap ¶ added in v0.6.21
func (K8sUtil) PatchConfigMapJsonType ¶ added in v0.6.21
func (K8sUtil) PatchResourceRequest ¶ added in v0.6.21
func (K8sUtil) UpdateConfigMap ¶ added in v0.6.21
func (*K8sUtil) UpdateResource ¶ added in v0.6.21
func (K8sUtil) UpdateSecret ¶ added in v0.6.21
type ManifestResponse ¶ added in v0.6.21
type ManifestResponse struct {
Manifest unstructured.Unstructured `json:"manifest,omitempty"`
}
type PodLogsRequest ¶ added in v0.6.21
type ResourceIdentifier ¶ added in v0.6.21
type ResourceIdentifier struct { Name string `json:"name"` //pod name for logs request Namespace string `json:"namespace"` GroupVersionKind schema.GroupVersionKind `json:"groupVersionKind"` }
type ResourceListResponse ¶ added in v0.6.21
type ResourceListResponse struct {
Resources unstructured.UnstructuredList `json:"resources,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.