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 IsDevtronApp(labels map[string]string) bool
- func IsNotFoundError(err error) bool
- func IsPod(gvk schema.GroupVersionKind) bool
- func IsService(gvk schema.GroupVersionKind) bool
- func OverrideK8sHttpClientWithTracer(restConfig *rest.Config) (*http.Client, error)
- func ResolveResourceReferences(un *unstructured.Unstructured) ([]metav1.OwnerReference, func(ResourceKey) bool)
- 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 CustomK8sHttpTransportConfig
- type EventsResponse
- type GetAllApiResourcesResponse
- type JsonPatchType
- type K8sApiResource
- type K8sRequestBean
- type K8sService
- type K8sServiceImpl
- func (impl *K8sServiceImpl) BuildK8sObjectListTableData(manifest *unstructured.UnstructuredList, namespaced bool, ...) (*ClusterResourceListMap, error)
- func (impl *K8sServiceImpl) CheckIfNsExists(namespace string, client *v12.CoreV1Client) (exists bool, err error)
- func (impl *K8sServiceImpl) CreateConfigMap(namespace string, cm *v1.ConfigMap, client *v12.CoreV1Client) (*v1.ConfigMap, error)
- func (impl *K8sServiceImpl) CreateJob(namespace string, name string, clusterConfig *ClusterConfig, job *batchV1.Job) error
- func (impl *K8sServiceImpl) CreateK8sClientSet(restConfig *rest.Config) (*kubernetes.Clientset, error)
- func (impl *K8sServiceImpl) CreateNs(namespace string, client *v12.CoreV1Client) (ns *v1.Namespace, err error)
- func (impl *K8sServiceImpl) CreateNsIfNotExists(namespace string, clusterConfig *ClusterConfig) (err error)
- func (impl *K8sServiceImpl) CreateOrUpdateSecretByName(client *v12.CoreV1Client, namespace, uniqueSecretName string, ...) error
- func (impl *K8sServiceImpl) CreateResources(ctx context.Context, restConfig *rest.Config, manifest string, ...) (*ManifestResponse, error)
- func (impl *K8sServiceImpl) CreateSecret(namespace string, data map[string][]byte, secretName string, ...) (*v1.Secret, error)
- func (impl *K8sServiceImpl) CreateSecretData(namespace string, secret *v1.Secret, v1Client *v12.CoreV1Client) (*v1.Secret, error)
- func (impl *K8sServiceImpl) DecodeGroupKindversion(data string) (*schema.GroupVersionKind, error)
- func (impl *K8sServiceImpl) DeleteAndCreateJob(content []byte, namespace string, clusterConfig *ClusterConfig) error
- func (impl *K8sServiceImpl) DeleteJob(namespace string, name string, clusterConfig *ClusterConfig) error
- func (impl *K8sServiceImpl) DeletePodByLabel(namespace string, labels string, clusterConfig *ClusterConfig) error
- func (impl *K8sServiceImpl) DeleteResource(ctx context.Context, restConfig *rest.Config, gvk schema.GroupVersionKind, ...) (*ManifestResponse, error)
- func (impl *K8sServiceImpl) DeleteSecret(namespace string, name string, client *v12.CoreV1Client) error
- func (impl *K8sServiceImpl) DiscoveryClientGetLiveZCall(cluster *ClusterConfig) ([]byte, error)
- func (impl *K8sServiceImpl) ExtractK8sServerMajorAndMinorVersion(k8sServerVersion *version.Info) (int, int, error)
- func (impl *K8sServiceImpl) FetchConnectionStatusForCluster(k8sClientSet *kubernetes.Clientset) error
- func (impl *K8sServiceImpl) GetApiResources(restConfig *rest.Config, includeOnlyVerb string) ([]*K8sApiResource, error)
- func (impl *K8sServiceImpl) GetClientByToken(serverUrl string, token map[string]string) (*v12.CoreV1Client, error)
- func (impl *K8sServiceImpl) GetClientForInCluster() (*v12.CoreV1Client, error)
- func (impl *K8sServiceImpl) GetConfigMap(namespace string, name string, client *v12.CoreV1Client) (*v1.ConfigMap, error)
- func (impl *K8sServiceImpl) GetConfigMapWithCtx(ctx context.Context, namespace string, name string, client *v12.CoreV1Client) (*v1.ConfigMap, error)
- func (impl *K8sServiceImpl) GetCoreV1Client(clusterConfig *ClusterConfig) (*v12.CoreV1Client, error)
- func (impl *K8sServiceImpl) GetCoreV1ClientByRestConfig(restConfig *rest.Config) (*v12.CoreV1Client, error)
- func (impl *K8sServiceImpl) GetCoreV1ClientInCluster() (*v12.CoreV1Client, error)
- func (impl *K8sServiceImpl) GetK8sConfigAndClients(clusterConfig *ClusterConfig) (*rest.Config, *http.Client, *kubernetes.Clientset, error)
- func (impl *K8sServiceImpl) GetK8sConfigAndClientsByRestConfig(restConfig *rest.Config) (*http.Client, *kubernetes.Clientset, error)
- func (impl *K8sServiceImpl) GetK8sDiscoveryClient(clusterConfig *ClusterConfig) (*discovery.DiscoveryClient, error)
- func (impl *K8sServiceImpl) GetK8sDiscoveryClientInCluster() (*discovery.DiscoveryClient, error)
- func (impl *K8sServiceImpl) GetK8sDynamicClient(restConfig *rest.Config, k8sHttpClient *http.Client) (dynamic.Interface, error)
- func (impl *K8sServiceImpl) GetK8sInClusterConfigAndClients() (*rest.Config, *http.Client, *kubernetes.Clientset, error)
- func (impl *K8sServiceImpl) GetK8sInClusterConfigAndDynamicClients() (*rest.Config, *http.Client, dynamic.Interface, error)
- func (impl *K8sServiceImpl) GetK8sInClusterRestConfig() (*rest.Config, error)
- func (impl *K8sServiceImpl) GetK8sServerVersion(clientSet *kubernetes.Clientset) (*version.Info, error)
- func (impl *K8sServiceImpl) GetKubeVersion() (*version.Info, error)
- func (impl *K8sServiceImpl) GetLiveZCall(path string, k8sClientSet *kubernetes.Clientset) ([]byte, error)
- func (impl *K8sServiceImpl) GetLogsForAPod(kubeClient *kubernetes.Clientset, namespace string, podName string, ...) *rest.Request
- func (impl *K8sServiceImpl) GetMetricsClientSet(restConfig *rest.Config, k8sHttpClient *http.Client) (*metrics.Clientset, error)
- func (impl *K8sServiceImpl) GetNmByName(ctx context.Context, metricsClientSet *metrics.Clientset, name string) (*v1beta1.NodeMetrics, error)
- func (impl *K8sServiceImpl) GetNmList(ctx context.Context, metricsClientSet *metrics.Clientset) (*v1beta1.NodeMetricsList, error)
- func (impl *K8sServiceImpl) GetNodeByName(ctx context.Context, k8sClientSet *kubernetes.Clientset, name string) (*v1.Node, error)
- func (impl *K8sServiceImpl) GetNodesList(ctx context.Context, k8sClientSet *kubernetes.Clientset) (*v1.NodeList, error)
- func (impl *K8sServiceImpl) GetPodByName(namespace string, name string, client *v12.CoreV1Client) (*v1.Pod, error)
- func (impl *K8sServiceImpl) GetPodListByLabel(namespace, label string, clientSet *kubernetes.Clientset) ([]v1.Pod, error)
- func (impl *K8sServiceImpl) GetPodLogs(ctx context.Context, restConfig *rest.Config, name string, namespace string, ...) (io.ReadCloser, error)
- func (impl *K8sServiceImpl) GetPodsListForNamespace(ctx context.Context, k8sClientSet *kubernetes.Clientset, namespace string) (*v1.PodList, error)
- func (impl *K8sServiceImpl) GetResource(ctx context.Context, namespace string, name string, ...) (*ManifestResponse, error)
- func (impl *K8sServiceImpl) GetResourceIf(restConfig *rest.Config, groupVersionKind schema.GroupVersionKind) (resourceIf dynamic.NamespaceableResourceInterface, namespaced bool, err error)
- func (impl *K8sServiceImpl) GetResourceIfWithAcceptHeader(restConfig *rest.Config, groupVersionKind schema.GroupVersionKind, ...) (resourceIf dynamic.NamespaceableResourceInterface, namespaced bool, err error)
- func (impl *K8sServiceImpl) GetResourceInfoByLabelSelector(ctx context.Context, namespace string, labelSelector string) (*v1.Pod, error)
- func (impl *K8sServiceImpl) GetResourceList(ctx context.Context, restConfig *rest.Config, gvk schema.GroupVersionKind, ...) (*ResourceListResponse, bool, error)
- func (impl *K8sServiceImpl) GetRestConfigByCluster(clusterConfig *ClusterConfig) (*rest.Config, error)
- func (impl *K8sServiceImpl) GetRestConfigByClusterWithoutCustomTransport(clusterConfig *ClusterConfig) (*rest.Config, error)
- func (impl *K8sServiceImpl) GetSecret(namespace string, name string, client *v12.CoreV1Client) (*v1.Secret, error)
- func (impl *K8sServiceImpl) GetSecretWithCtx(ctx context.Context, namespace string, name string, client *v12.CoreV1Client) (*v1.Secret, error)
- func (impl *K8sServiceImpl) GetServerGroups(k8sClientSet *kubernetes.Clientset) (*metav1.APIGroupList, error)
- func (impl *K8sServiceImpl) GetServerVersionFromDiscoveryClient(k8sClientSet *kubernetes.Clientset) (*version.Info, error)
- func (impl *K8sServiceImpl) ListEvents(restConfig *rest.Config, namespace string, ...) (*v1.EventList, error)
- func (impl *K8sServiceImpl) ListNamespaces(client *v12.CoreV1Client) (*v1.NamespaceList, error)
- func (impl *K8sServiceImpl) OverrideRestConfigWithCustomTransport(restConfig *rest.Config) (*rest.Config, error)
- func (impl *K8sServiceImpl) PatchConfigMap(namespace string, clusterConfig *ClusterConfig, name string, ...) (*v1.ConfigMap, error)
- func (impl *K8sServiceImpl) PatchConfigMapJsonType(namespace string, clusterConfig *ClusterConfig, name string, data interface{}, ...) (*v1.ConfigMap, error)
- func (impl *K8sServiceImpl) PatchResourceRequest(ctx context.Context, restConfig *rest.Config, pt types.PatchType, ...) (*ManifestResponse, error)
- func (impl *K8sServiceImpl) UpdateConfigMap(namespace string, cm *v1.ConfigMap, client *v12.CoreV1Client) (*v1.ConfigMap, error)
- func (impl *K8sServiceImpl) UpdateResource(ctx context.Context, restConfig *rest.Config, gvk schema.GroupVersionKind, ...) (*ManifestResponse, error)
- func (impl *K8sServiceImpl) UpdateSecret(namespace string, secret *v1.Secret, client *v12.CoreV1Client) (*v1.Secret, error)
- func (impl *K8sServiceImpl) ValidateForResource(namespace string, resourceRef interface{}, ...) bool
- func (impl *K8sServiceImpl) ValidateResource(resourceObj map[string]interface{}, gvk schema.GroupVersionKind, ...) bool
- type LocalDevMode
- type ManifestResponse
- type PodLogsRequest
- type ResourceIdentifier
- func (req *ResourceIdentifier) WithGroup(group string) *ResourceIdentifier
- func (req *ResourceIdentifier) WithKind(kind string) *ResourceIdentifier
- func (req *ResourceIdentifier) WithName(name string) *ResourceIdentifier
- func (req *ResourceIdentifier) WithNameSpace(namespace string) *ResourceIdentifier
- func (req *ResourceIdentifier) WithVersion(version string) *ResourceIdentifier
- type ResourceKey
- type ResourceListResponse
- type RuntimeConfig
Constants ¶
const ( DEFAULT_CLUSTER = "default_cluster" DEVTRON_SERVICE_NAME = "devtron-service" DefaultClusterUrl = "https://kubernetes.default.svc" BearerToken = "bearer_token" CertificateAuthorityData = "cert_auth_data" CertData = "cert_data" TlsKey = "tls_key" LiveZ = "/livez" Running = "Running" RestartingNotSupported = "restarting not supported" DEVTRON_APP_LABEL_KEY = "app" DEVTRON_APP_LABEL_VALUE1 = "devtron" DEVTRON_APP_LABEL_VALUE2 = "orchestrator" )
Variables ¶
var NotFoundError = errors.New("not found")
Functions ¶
func CheckEvictionSupport ¶
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 ¶
func DeletePod ¶
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 ¶
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 IsDevtronApp ¶
func IsNotFoundError ¶ added in v0.15.0
func IsPod ¶
func IsPod(gvk schema.GroupVersionKind) bool
func IsService ¶
func IsService(gvk schema.GroupVersionKind) bool
func ResolveResourceReferences ¶
func ResolveResourceReferences(un *unstructured.Unstructured) ([]metav1.OwnerReference, func(ResourceKey) bool)
func ServerResourceForGroupVersionKind ¶
func ServerResourceForGroupVersionKind(discoveryClient discovery.DiscoveryInterface, gvk schema.GroupVersionKind) (*metav1.APIResource, error)
Types ¶
type ApplyResourcesRequest ¶
type ApplyResourcesResponse ¶
type ClusterConfig ¶
type ClusterConfig struct { ClusterName string Host string BearerToken string InsecureSkipTLSVerify bool KeyData string CertData string CAData string ClusterId int ToConnectForClusterVerification bool RemoteConnectionConfig *bean.RemoteConnectionConfigBean }
func (*ClusterConfig) PopulateTlsConfigurationsInto ¶ added in v0.0.22
func (clusterConfig *ClusterConfig) PopulateTlsConfigurationsInto(restConfig *rest.Config)
type ClusterResourceListMap ¶
type CustomK8sHttpTransportConfig ¶ added in v0.0.21
type CustomK8sHttpTransportConfig struct { UseCustomTransport bool `env:"USE_CUSTOM_HTTP_TRANSPORT" envDefault:"false"` TimeOut int `env:"K8s_TCP_TIMEOUT" envDefault:"30"` KeepAlive int `env:"K8s_TCP_KEEPALIVE" envDefault:"30"` TLSHandshakeTimeout int `env:"K8s_TLS_HANDSHAKE_TIMEOUT" envDefault:"10"` MaxIdleConnsPerHost int `env:"K8s_CLIENT_MAX_IDLE_CONNS_PER_HOST" envDefault:"25"` IdleConnTimeout int `env:"K8s_TCP_IDLE_CONN_TIMEOUT" envDefault:"300"` }
func NewCustomK8sHttpTransportConfig ¶ added in v0.0.21
func NewCustomK8sHttpTransportConfig() *CustomK8sHttpTransportConfig
func (*CustomK8sHttpTransportConfig) OverrideConfigWithCustomTransport ¶ added in v0.0.21
func (impl *CustomK8sHttpTransportConfig) OverrideConfigWithCustomTransport(config *rest.Config) (*rest.Config, error)
OverrideConfigWithCustomTransport overrides the given rest config with custom transport if UseCustomTransport is enabled. if the config already has a defined transport, we don't override it.
type EventsResponse ¶
type GetAllApiResourcesResponse ¶
type GetAllApiResourcesResponse struct { ApiResources []*K8sApiResource `json:"apiResources"` AllowedAll bool `json:"allowedAll"` }
type JsonPatchType ¶
type K8sApiResource ¶
type K8sApiResource struct { Gvk schema.GroupVersionKind `json:"gvk"` Gvr schema.GroupVersionResource `json:"gvr"` Namespaced bool `json:"namespaced"` ShortNames []string `json:"shortNames"` }
type K8sRequestBean ¶
type K8sRequestBean struct { ResourceIdentifier ResourceIdentifier `json:"resourceIdentifier"` Patch string `json:"patch,omitempty"` PodLogsRequest PodLogsRequest `json:"podLogsRequest,omitempty"` ForceDelete bool `json:"forceDelete,omitempty"` }
func NewK8sRequestBean ¶ added in v0.0.24
func NewK8sRequestBean() *K8sRequestBean
func (*K8sRequestBean) WithResourceIdentifier ¶ added in v0.0.24
func (req *K8sRequestBean) WithResourceIdentifier(resourceIdentifier *ResourceIdentifier) *K8sRequestBean
type K8sService ¶ added in v0.0.10
type K8sService interface { GetLogsForAPod(kubeClient *kubernetes.Clientset, namespace string, podName string, container string, follow bool) *rest.Request GetMetricsClientSet(restConfig *rest.Config, k8sHttpClient *http.Client) (*metrics.Clientset, error) GetNmByName(ctx context.Context, metricsClientSet *metrics.Clientset, name string) (*v1beta1.NodeMetrics, error) GetNmList(ctx context.Context, metricsClientSet *metrics.Clientset) (*v1beta1.NodeMetricsList, error) GetPodsListForNamespace(ctx context.Context, k8sClientSet *kubernetes.Clientset, namespace string) (*v1.PodList, error) GetServerVersionFromDiscoveryClient(k8sClientSet *kubernetes.Clientset) (*version.Info, error) GetServerGroups(k8sClientSet *kubernetes.Clientset) (*metav1.APIGroupList, error) GetNodeByName(ctx context.Context, k8sClientSet *kubernetes.Clientset, name string) (*v1.Node, error) GetNodesList(ctx context.Context, k8sClientSet *kubernetes.Clientset) (*v1.NodeList, error) GetCoreV1ClientByRestConfig(restConfig *rest.Config) (*v12.CoreV1Client, error) GetCoreV1ClientInCluster() (*v12.CoreV1Client, error) GetKubeVersion() (*version.Info, error) ValidateResource(resourceObj map[string]interface{}, gvk schema.GroupVersionKind, validateCallback func(namespace string, group string, kind string, resourceName string) bool) bool BuildK8sObjectListTableData(manifest *unstructured.UnstructuredList, namespaced bool, gvk schema.GroupVersionKind, includeMetadata bool, validateResourceAccess func(namespace string, group string, kind string, resourceName string) bool) (*ClusterResourceListMap, error) ValidateForResource(namespace string, resourceRef interface{}, validateCallback func(namespace string, group string, kind string, resourceName string) bool) bool GetPodByName(namespace string, name string, client *v12.CoreV1Client) (*v1.Pod, error) GetK8sInClusterRestConfig() (*rest.Config, error) GetResourceInfoByLabelSelector(ctx context.Context, namespace string, labelSelector string) (*v1.Pod, error) GetClientByToken(serverUrl string, token map[string]string) (*v12.CoreV1Client, error) ListNamespaces(client *v12.CoreV1Client) (*v1.NamespaceList, error) DeleteAndCreateJob(content []byte, namespace string, clusterConfig *ClusterConfig) error DeletePodByLabel(namespace string, labels string, clusterConfig *ClusterConfig) error CreateJob(namespace string, name string, clusterConfig *ClusterConfig, job *batchV1.Job) error GetLiveZCall(path string, k8sClientSet *kubernetes.Clientset) ([]byte, error) DiscoveryClientGetLiveZCall(cluster *ClusterConfig) ([]byte, error) GetK8sConfigAndClientsByRestConfig(restConfig *rest.Config) (*http.Client, *kubernetes.Clientset, error) GetK8sConfigAndClients(clusterConfig *ClusterConfig) (*rest.Config, *http.Client, *kubernetes.Clientset, error) GetK8sInClusterConfigAndDynamicClients() (*rest.Config, *http.Client, dynamic.Interface, error) GetK8sInClusterConfigAndClients() (*rest.Config, *http.Client, *kubernetes.Clientset, error) DeleteJob(namespace string, name string, clusterConfig *ClusterConfig) error DeleteSecret(namespace string, name string, client *v12.CoreV1Client) error UpdateSecret(namespace string, secret *v1.Secret, client *v12.CoreV1Client) (*v1.Secret, error) CreateSecretData(namespace string, secret *v1.Secret, v1Client *v12.CoreV1Client) (*v1.Secret, error) CreateSecret(namespace string, data map[string][]byte, secretName string, secretType v1.SecretType, client *v12.CoreV1Client, labels map[string]string, stringData map[string]string) (*v1.Secret, error) GetSecret(namespace string, name string, client *v12.CoreV1Client) (*v1.Secret, error) GetSecretWithCtx(ctx context.Context, namespace string, name string, client *v12.CoreV1Client) (*v1.Secret, error) PatchConfigMapJsonType(namespace string, clusterConfig *ClusterConfig, name string, data interface{}, path string) (*v1.ConfigMap, error) PatchConfigMap(namespace string, clusterConfig *ClusterConfig, name string, data map[string]interface{}) (*v1.ConfigMap, error) UpdateConfigMap(namespace string, cm *v1.ConfigMap, client *v12.CoreV1Client) (*v1.ConfigMap, error) CreateConfigMap(namespace string, cm *v1.ConfigMap, client *v12.CoreV1Client) (*v1.ConfigMap, error) GetConfigMap(namespace string, name string, client *v12.CoreV1Client) (*v1.ConfigMap, error) GetConfigMapWithCtx(ctx context.Context, namespace string, name string, client *v12.CoreV1Client) (*v1.ConfigMap, error) CheckIfNsExists(namespace string, client *v12.CoreV1Client) (exists bool, err error) CreateNsIfNotExists(namespace string, clusterConfig *ClusterConfig) (err error) GetK8sDiscoveryClientInCluster() (*discovery.DiscoveryClient, error) GetK8sDiscoveryClient(clusterConfig *ClusterConfig) (*discovery.DiscoveryClient, error) GetClientForInCluster() (*v12.CoreV1Client, error) GetCoreV1Client(clusterConfig *ClusterConfig) (*v12.CoreV1Client, error) GetRestConfigByCluster(clusterConfig *ClusterConfig) (*rest.Config, error) GetResource(ctx context.Context, namespace string, name string, gvk schema.GroupVersionKind, restConfig *rest.Config) (*ManifestResponse, error) UpdateResource(ctx context.Context, restConfig *rest.Config, gvk schema.GroupVersionKind, namespace string, k8sRequestPatch string) (*ManifestResponse, error) DeleteResource(ctx context.Context, restConfig *rest.Config, gvk schema.GroupVersionKind, namespace string, name string, forceDelete bool) (*ManifestResponse, error) GetPodListByLabel(namespace, label string, clientSet *kubernetes.Clientset) ([]v1.Pod, error) ExtractK8sServerMajorAndMinorVersion(k8sServerVersion *version.Info) (int, int, error) GetK8sServerVersion(clientSet *kubernetes.Clientset) (*version.Info, error) DecodeGroupKindversion(data string) (*schema.GroupVersionKind, error) GetApiResources(restConfig *rest.Config, includeOnlyVerb string) ([]*K8sApiResource, error) CreateResources(ctx context.Context, restConfig *rest.Config, manifest string, gvk schema.GroupVersionKind, namespace string) (*ManifestResponse, error) PatchResourceRequest(ctx context.Context, restConfig *rest.Config, pt types.PatchType, manifest string, name string, namespace string, gvk schema.GroupVersionKind) (*ManifestResponse, error) GetResourceList(ctx context.Context, restConfig *rest.Config, gvk schema.GroupVersionKind, namespace string, asTable bool, listOptions *metav1.ListOptions) (*ResourceListResponse, bool, error) GetResourceIfWithAcceptHeader(restConfig *rest.Config, groupVersionKind schema.GroupVersionKind, asTable bool) (resourceIf dynamic.NamespaceableResourceInterface, namespaced bool, err error) GetPodLogs(ctx context.Context, restConfig *rest.Config, name string, namespace string, sinceTime *metav1.Time, tailLines int, sinceSeconds int, follow bool, containerName string, isPrevContainerLogsEnabled bool) (io.ReadCloser, error) ListEvents(restConfig *rest.Config, namespace string, groupVersionKind schema.GroupVersionKind, ctx context.Context, name string) (*v1.EventList, error) GetResourceIf(restConfig *rest.Config, groupVersionKind schema.GroupVersionKind) (resourceIf dynamic.NamespaceableResourceInterface, namespaced bool, err error) FetchConnectionStatusForCluster(k8sClientSet *kubernetes.Clientset) error CreateK8sClientSet(restConfig *rest.Config) (*kubernetes.Clientset, error) CreateOrUpdateSecretByName(client *v12.CoreV1Client, namespace, uniqueSecretName string, secretLabel map[string]string, secretData map[string]string) error //below functions are exposed for K8sUtilExtended GetRestConfigByClusterWithoutCustomTransport(clusterConfig *ClusterConfig) (*rest.Config, error) OverrideRestConfigWithCustomTransport(restConfig *rest.Config) (*rest.Config, error) CreateNs(namespace string, client *v12.CoreV1Client) (ns *v1.Namespace, err error) }
type K8sServiceImpl ¶ added in v0.0.10
type K8sServiceImpl struct {
// contains filtered or unexported fields
}
func NewK8sUtil ¶
func NewK8sUtil(logger *zap.SugaredLogger, runTimeConfig *RuntimeConfig) *K8sServiceImpl
func (*K8sServiceImpl) BuildK8sObjectListTableData ¶ added in v0.0.10
func (impl *K8sServiceImpl) BuildK8sObjectListTableData(manifest *unstructured.UnstructuredList, namespaced bool, gvk schema.GroupVersionKind, includeMetadata bool, validateResourceAccess func(namespace string, group string, kind string, resourceName string) bool) (*ClusterResourceListMap, error)
func (*K8sServiceImpl) CheckIfNsExists ¶ added in v0.0.10
func (impl *K8sServiceImpl) CheckIfNsExists(namespace string, client *v12.CoreV1Client) (exists bool, err error)
func (*K8sServiceImpl) CreateConfigMap ¶ added in v0.0.10
func (impl *K8sServiceImpl) CreateConfigMap(namespace string, cm *v1.ConfigMap, client *v12.CoreV1Client) (*v1.ConfigMap, error)
func (*K8sServiceImpl) CreateJob ¶ added in v0.0.10
func (impl *K8sServiceImpl) CreateJob(namespace string, name string, clusterConfig *ClusterConfig, job *batchV1.Job) error
func (*K8sServiceImpl) CreateK8sClientSet ¶ added in v0.0.10
func (impl *K8sServiceImpl) CreateK8sClientSet(restConfig *rest.Config) (*kubernetes.Clientset, error)
func (*K8sServiceImpl) CreateNs ¶ added in v0.16.0
func (impl *K8sServiceImpl) CreateNs(namespace string, client *v12.CoreV1Client) (ns *v1.Namespace, err error)
func (*K8sServiceImpl) CreateNsIfNotExists ¶ added in v0.0.10
func (impl *K8sServiceImpl) CreateNsIfNotExists(namespace string, clusterConfig *ClusterConfig) (err error)
func (*K8sServiceImpl) CreateOrUpdateSecretByName ¶ added in v0.16.0
func (impl *K8sServiceImpl) CreateOrUpdateSecretByName(client *v12.CoreV1Client, namespace, uniqueSecretName string, secretLabel map[string]string, secretData map[string]string) error
func (*K8sServiceImpl) CreateResources ¶ added in v0.0.10
func (impl *K8sServiceImpl) CreateResources(ctx context.Context, restConfig *rest.Config, manifest string, gvk schema.GroupVersionKind, namespace string) (*ManifestResponse, error)
func (*K8sServiceImpl) CreateSecret ¶ added in v0.0.10
func (*K8sServiceImpl) CreateSecretData ¶ added in v0.0.10
func (impl *K8sServiceImpl) CreateSecretData(namespace string, secret *v1.Secret, v1Client *v12.CoreV1Client) (*v1.Secret, error)
func (*K8sServiceImpl) DecodeGroupKindversion ¶ added in v0.0.10
func (impl *K8sServiceImpl) DecodeGroupKindversion(data string) (*schema.GroupVersionKind, error)
func (*K8sServiceImpl) DeleteAndCreateJob ¶ added in v0.0.10
func (impl *K8sServiceImpl) DeleteAndCreateJob(content []byte, namespace string, clusterConfig *ClusterConfig) error
DeleteAndCreateJob Deletes and recreates if job exists else creates the job
func (*K8sServiceImpl) DeleteJob ¶ added in v0.0.10
func (impl *K8sServiceImpl) DeleteJob(namespace string, name string, clusterConfig *ClusterConfig) error
func (*K8sServiceImpl) DeletePodByLabel ¶ added in v0.0.10
func (impl *K8sServiceImpl) DeletePodByLabel(namespace string, labels string, clusterConfig *ClusterConfig) error
func (*K8sServiceImpl) DeleteResource ¶ added in v0.0.10
func (impl *K8sServiceImpl) DeleteResource(ctx context.Context, restConfig *rest.Config, gvk schema.GroupVersionKind, namespace string, name string, forceDelete bool) (*ManifestResponse, error)
func (*K8sServiceImpl) DeleteSecret ¶ added in v0.0.10
func (impl *K8sServiceImpl) DeleteSecret(namespace string, name string, client *v12.CoreV1Client) error
func (*K8sServiceImpl) DiscoveryClientGetLiveZCall ¶ added in v0.0.10
func (impl *K8sServiceImpl) DiscoveryClientGetLiveZCall(cluster *ClusterConfig) ([]byte, error)
func (*K8sServiceImpl) ExtractK8sServerMajorAndMinorVersion ¶ added in v0.0.10
func (*K8sServiceImpl) FetchConnectionStatusForCluster ¶ added in v0.0.10
func (impl *K8sServiceImpl) FetchConnectionStatusForCluster(k8sClientSet *kubernetes.Clientset) error
func (*K8sServiceImpl) GetApiResources ¶ added in v0.0.10
func (impl *K8sServiceImpl) GetApiResources(restConfig *rest.Config, includeOnlyVerb string) ([]*K8sApiResource, error)
if verb is supplied empty, that means - return all
func (*K8sServiceImpl) GetClientByToken ¶ added in v0.0.10
func (impl *K8sServiceImpl) GetClientByToken(serverUrl string, token map[string]string) (*v12.CoreV1Client, error)
func (*K8sServiceImpl) GetClientForInCluster ¶ added in v0.0.10
func (impl *K8sServiceImpl) GetClientForInCluster() (*v12.CoreV1Client, error)
func (*K8sServiceImpl) GetConfigMap ¶ added in v0.0.10
func (impl *K8sServiceImpl) GetConfigMap(namespace string, name string, client *v12.CoreV1Client) (*v1.ConfigMap, error)
func (*K8sServiceImpl) GetConfigMapWithCtx ¶ added in v0.16.0
func (impl *K8sServiceImpl) GetConfigMapWithCtx(ctx context.Context, namespace string, name string, client *v12.CoreV1Client) (*v1.ConfigMap, error)
func (*K8sServiceImpl) GetCoreV1Client ¶ added in v0.0.10
func (impl *K8sServiceImpl) GetCoreV1Client(clusterConfig *ClusterConfig) (*v12.CoreV1Client, error)
func (*K8sServiceImpl) GetCoreV1ClientByRestConfig ¶ added in v0.0.10
func (impl *K8sServiceImpl) GetCoreV1ClientByRestConfig(restConfig *rest.Config) (*v12.CoreV1Client, error)
func (*K8sServiceImpl) GetCoreV1ClientInCluster ¶ added in v0.0.10
func (impl *K8sServiceImpl) GetCoreV1ClientInCluster() (*v12.CoreV1Client, error)
func (*K8sServiceImpl) GetK8sConfigAndClients ¶ added in v0.0.10
func (impl *K8sServiceImpl) GetK8sConfigAndClients(clusterConfig *ClusterConfig) (*rest.Config, *http.Client, *kubernetes.Clientset, error)
func (*K8sServiceImpl) GetK8sConfigAndClientsByRestConfig ¶ added in v0.0.10
func (impl *K8sServiceImpl) GetK8sConfigAndClientsByRestConfig(restConfig *rest.Config) (*http.Client, *kubernetes.Clientset, error)
func (*K8sServiceImpl) GetK8sDiscoveryClient ¶ added in v0.0.10
func (impl *K8sServiceImpl) GetK8sDiscoveryClient(clusterConfig *ClusterConfig) (*discovery.DiscoveryClient, error)
func (*K8sServiceImpl) GetK8sDiscoveryClientInCluster ¶ added in v0.0.10
func (impl *K8sServiceImpl) GetK8sDiscoveryClientInCluster() (*discovery.DiscoveryClient, error)
func (*K8sServiceImpl) GetK8sDynamicClient ¶ added in v0.0.10
func (*K8sServiceImpl) GetK8sInClusterConfigAndClients ¶ added in v0.0.10
func (impl *K8sServiceImpl) GetK8sInClusterConfigAndClients() (*rest.Config, *http.Client, *kubernetes.Clientset, error)
func (*K8sServiceImpl) GetK8sInClusterConfigAndDynamicClients ¶ added in v0.0.10
func (*K8sServiceImpl) GetK8sInClusterRestConfig ¶ added in v0.0.10
func (impl *K8sServiceImpl) GetK8sInClusterRestConfig() (*rest.Config, error)
func (*K8sServiceImpl) GetK8sServerVersion ¶ added in v0.0.10
func (impl *K8sServiceImpl) GetK8sServerVersion(clientSet *kubernetes.Clientset) (*version.Info, error)
func (*K8sServiceImpl) GetKubeVersion ¶ added in v0.0.10
func (impl *K8sServiceImpl) GetKubeVersion() (*version.Info, error)
func (*K8sServiceImpl) GetLiveZCall ¶ added in v0.0.10
func (impl *K8sServiceImpl) GetLiveZCall(path string, k8sClientSet *kubernetes.Clientset) ([]byte, error)
func (*K8sServiceImpl) GetLogsForAPod ¶ added in v0.0.10
func (impl *K8sServiceImpl) GetLogsForAPod(kubeClient *kubernetes.Clientset, namespace string, podName string, container string, follow bool) *rest.Request
func (*K8sServiceImpl) GetMetricsClientSet ¶ added in v0.0.10
func (*K8sServiceImpl) GetNmByName ¶ added in v0.0.10
func (impl *K8sServiceImpl) GetNmByName(ctx context.Context, metricsClientSet *metrics.Clientset, name string) (*v1beta1.NodeMetrics, error)
func (*K8sServiceImpl) GetNmList ¶ added in v0.0.10
func (impl *K8sServiceImpl) GetNmList(ctx context.Context, metricsClientSet *metrics.Clientset) (*v1beta1.NodeMetricsList, error)
func (*K8sServiceImpl) GetNodeByName ¶ added in v0.0.10
func (impl *K8sServiceImpl) GetNodeByName(ctx context.Context, k8sClientSet *kubernetes.Clientset, name string) (*v1.Node, error)
func (*K8sServiceImpl) GetNodesList ¶ added in v0.0.10
func (impl *K8sServiceImpl) GetNodesList(ctx context.Context, k8sClientSet *kubernetes.Clientset) (*v1.NodeList, error)
func (*K8sServiceImpl) GetPodByName ¶ added in v0.0.10
func (impl *K8sServiceImpl) GetPodByName(namespace string, name string, client *v12.CoreV1Client) (*v1.Pod, error)
func (*K8sServiceImpl) GetPodListByLabel ¶ added in v0.0.10
func (impl *K8sServiceImpl) GetPodListByLabel(namespace, label string, clientSet *kubernetes.Clientset) ([]v1.Pod, error)
func (*K8sServiceImpl) GetPodLogs ¶ added in v0.0.10
func (*K8sServiceImpl) GetPodsListForNamespace ¶ added in v0.0.10
func (impl *K8sServiceImpl) GetPodsListForNamespace(ctx context.Context, k8sClientSet *kubernetes.Clientset, namespace string) (*v1.PodList, error)
func (*K8sServiceImpl) GetResource ¶ added in v0.0.10
func (impl *K8sServiceImpl) GetResource(ctx context.Context, namespace string, name string, gvk schema.GroupVersionKind, restConfig *rest.Config) (*ManifestResponse, error)
func (*K8sServiceImpl) GetResourceIf ¶ added in v0.0.10
func (impl *K8sServiceImpl) GetResourceIf(restConfig *rest.Config, groupVersionKind schema.GroupVersionKind) (resourceIf dynamic.NamespaceableResourceInterface, namespaced bool, err error)
func (*K8sServiceImpl) GetResourceIfWithAcceptHeader ¶ added in v0.0.10
func (impl *K8sServiceImpl) GetResourceIfWithAcceptHeader(restConfig *rest.Config, groupVersionKind schema.GroupVersionKind, asTable bool) (resourceIf dynamic.NamespaceableResourceInterface, namespaced bool, err error)
func (*K8sServiceImpl) GetResourceInfoByLabelSelector ¶ added in v0.0.10
func (*K8sServiceImpl) GetResourceList ¶ added in v0.0.10
func (impl *K8sServiceImpl) GetResourceList(ctx context.Context, restConfig *rest.Config, gvk schema.GroupVersionKind, namespace string, asTable bool, listOptions *metav1.ListOptions) (*ResourceListResponse, bool, error)
func (*K8sServiceImpl) GetRestConfigByCluster ¶ added in v0.0.10
func (impl *K8sServiceImpl) GetRestConfigByCluster(clusterConfig *ClusterConfig) (*rest.Config, error)
func (*K8sServiceImpl) GetRestConfigByClusterWithoutCustomTransport ¶ added in v0.16.0
func (impl *K8sServiceImpl) GetRestConfigByClusterWithoutCustomTransport(clusterConfig *ClusterConfig) (*rest.Config, error)
func (*K8sServiceImpl) GetSecret ¶ added in v0.0.10
func (impl *K8sServiceImpl) GetSecret(namespace string, name string, client *v12.CoreV1Client) (*v1.Secret, error)
func (*K8sServiceImpl) GetSecretWithCtx ¶ added in v0.16.0
func (impl *K8sServiceImpl) GetSecretWithCtx(ctx context.Context, namespace string, name string, client *v12.CoreV1Client) (*v1.Secret, error)
func (*K8sServiceImpl) GetServerGroups ¶ added in v0.15.0
func (impl *K8sServiceImpl) GetServerGroups(k8sClientSet *kubernetes.Clientset) (*metav1.APIGroupList, error)
func (*K8sServiceImpl) GetServerVersionFromDiscoveryClient ¶ added in v0.0.10
func (impl *K8sServiceImpl) GetServerVersionFromDiscoveryClient(k8sClientSet *kubernetes.Clientset) (*version.Info, error)
func (*K8sServiceImpl) ListEvents ¶ added in v0.0.10
func (*K8sServiceImpl) ListNamespaces ¶ added in v0.0.10
func (impl *K8sServiceImpl) ListNamespaces(client *v12.CoreV1Client) (*v1.NamespaceList, error)
func (*K8sServiceImpl) OverrideRestConfigWithCustomTransport ¶ added in v0.16.0
func (*K8sServiceImpl) PatchConfigMap ¶ added in v0.0.10
func (impl *K8sServiceImpl) PatchConfigMap(namespace string, clusterConfig *ClusterConfig, name string, data map[string]interface{}) (*v1.ConfigMap, error)
func (*K8sServiceImpl) PatchConfigMapJsonType ¶ added in v0.0.10
func (impl *K8sServiceImpl) PatchConfigMapJsonType(namespace string, clusterConfig *ClusterConfig, name string, data interface{}, path string) (*v1.ConfigMap, error)
func (*K8sServiceImpl) PatchResourceRequest ¶ added in v0.0.10
func (impl *K8sServiceImpl) PatchResourceRequest(ctx context.Context, restConfig *rest.Config, pt types.PatchType, manifest string, name string, namespace string, gvk schema.GroupVersionKind) (*ManifestResponse, error)
func (*K8sServiceImpl) UpdateConfigMap ¶ added in v0.0.10
func (impl *K8sServiceImpl) UpdateConfigMap(namespace string, cm *v1.ConfigMap, client *v12.CoreV1Client) (*v1.ConfigMap, error)
func (*K8sServiceImpl) UpdateResource ¶ added in v0.0.10
func (impl *K8sServiceImpl) UpdateResource(ctx context.Context, restConfig *rest.Config, gvk schema.GroupVersionKind, namespace string, k8sRequestPatch string) (*ManifestResponse, error)
func (*K8sServiceImpl) UpdateSecret ¶ added in v0.0.10
func (impl *K8sServiceImpl) UpdateSecret(namespace string, secret *v1.Secret, client *v12.CoreV1Client) (*v1.Secret, error)
func (*K8sServiceImpl) ValidateForResource ¶ added in v0.0.18
func (*K8sServiceImpl) ValidateResource ¶ added in v0.0.10
func (impl *K8sServiceImpl) ValidateResource(resourceObj map[string]interface{}, gvk schema.GroupVersionKind, validateCallback func(namespace string, group string, kind string, resourceName string) bool) bool
type LocalDevMode ¶ added in v0.16.0
type LocalDevMode bool
type ManifestResponse ¶
type ManifestResponse struct { Manifest unstructured.Unstructured `json:"manifest,omitempty"` // EphemeralContainers are set for Pod kind manifest response only. // will only contain ephemeral containers which are in running state // +optional EphemeralContainers []*k8sObjectsUtil.EphemeralContainerData `json:"ephemeralContainers,omitempty"` }
func (*ManifestResponse) SetRunningEphemeralContainers ¶ added in v0.0.8
func (manifestResponse *ManifestResponse) SetRunningEphemeralContainers() error
SetRunningEphemeralContainers will extract out all the running ephemeral containers of the given pod manifest and sets in manifestResponse.EphemeralContainers if given manifest is not of pod kind
type PodLogsRequest ¶
type ResourceIdentifier ¶
type ResourceIdentifier struct { Name string `json:"name"` //pod name for logs request Namespace string `json:"namespace"` GroupVersionKind schema.GroupVersionKind `json:"groupVersionKind"` }
func NewResourceIdentifier ¶ added in v0.0.24
func NewResourceIdentifier() *ResourceIdentifier
func (*ResourceIdentifier) WithGroup ¶ added in v0.0.24
func (req *ResourceIdentifier) WithGroup(group string) *ResourceIdentifier
func (*ResourceIdentifier) WithKind ¶ added in v0.0.24
func (req *ResourceIdentifier) WithKind(kind string) *ResourceIdentifier
func (*ResourceIdentifier) WithName ¶ added in v0.0.24
func (req *ResourceIdentifier) WithName(name string) *ResourceIdentifier
func (*ResourceIdentifier) WithNameSpace ¶ added in v0.0.24
func (req *ResourceIdentifier) WithNameSpace(namespace string) *ResourceIdentifier
func (*ResourceIdentifier) WithVersion ¶ added in v0.0.24
func (req *ResourceIdentifier) WithVersion(version string) *ResourceIdentifier
type ResourceKey ¶
func GetResourceKey ¶
func GetResourceKey(obj *unstructured.Unstructured) ResourceKey
func NewResourceKey ¶
func NewResourceKey(group string, kind string, namespace string, name string) ResourceKey
func (ResourceKey) GroupKind ¶
func (k ResourceKey) GroupKind() schema.GroupKind
func (*ResourceKey) String ¶
func (k *ResourceKey) String() string
type ResourceListResponse ¶
type ResourceListResponse struct {
Resources unstructured.UnstructuredList `json:"resources,omitempty"`
}
type RuntimeConfig ¶ added in v0.16.0
type RuntimeConfig struct {
LocalDevMode LocalDevMode `env:"RUNTIME_CONFIG_LOCAL_DEV" envDefault:"false"`
}
func GetRuntimeConfig ¶ added in v0.16.0
func GetRuntimeConfig() (*RuntimeConfig, error)