Documentation
¶
Index ¶
- Constants
- Variables
- func ConvertUnstructuredSliceToMap(unstructuredSlice []unstructured.Unstructured) []map[string]interface{}
- func FilterOutOwneredResources(result []unstructured.Unstructured) []unstructured.Unstructured
- func GetClusterName() string
- func GetCurrentContext() *api.Context
- func GetDefaultNamespace() string
- func GetGroupVersionResource(resource string) (schema.GroupVersionResource, error)
- func GetK8sConfig() *restclient.Config
- func GetResourceListMock() ([]*metav1.APIResourceList, error)
- func GetResourceTriplets(group, version, resource string) []string
- func GroupVersionResourceToString(resource *schema.GroupVersionResource) string
- func InitializeMapResources(discoveryClient discovery.DiscoveryInterface)
- func InitializeMapResourcesMock()
- func IsAgentCompatibleAnnotation(annotations map[string]string) *bool
- func IsAgentCompatibleLabel(labels map[string]string) *bool
- func IsAttached(labels map[string]string) *bool
- func IsConnectedToCluster() bool
- func IsLabel(labels map[string]string, key string) *bool
- func IsNamespaceScope(resource *schema.GroupVersionResource) bool
- func IsStringInSlice(slice []string, val string) bool
- func JoinGroupVersion(group, version string) string
- func JoinResourceTriplets(group, version, resource string) string
- func LoadK8sConfig() error
- func ResourceGroupToSlice(group, version, resource string) []string
- func ResourceGroupToString(group, version, resource string) []string
- func SelectorToString(ls labels.Set) string
- func SetAgentCompatibleAnnotation(annotations map[string]string, val bool)
- func SetAgentCompatibleLabel(labels map[string]string, val bool)
- func SetLabel(labels map[string]string, key string, val bool)
- func StringInSlice(strSlice []string, str string) int
- func StringToResourceGroup(str string) (string, string, string)
- func V1AllClusterWithCompromisedRegistriesMock() *unstructured.UnstructuredList
- func V1KubeSystemNamespaceMock() *unstructured.UnstructuredList
- type IWorkload
- type KubernetesApi
- func (k8sAPI *KubernetesApi) CalculateWorkloadParentRecursive(workload IWorkload) (string, string, error)
- func (k8sAPI *KubernetesApi) CreateWorkload(workload IWorkload) (IWorkload, error)
- func (k8sAPI *KubernetesApi) DeleteWorkloadByWlid(wlid string) error
- func (k8sAPI *KubernetesApi) GetNamespace(ns string) (IWorkload, error)
- func (k8sAPI *KubernetesApi) GetWorkload(namespace, kind, name string) (IWorkload, error)
- func (k8sAPI *KubernetesApi) GetWorkloadByWlid(wlid string) (IWorkload, error)
- func (k8sAPI *KubernetesApi) ListAllWorkload() ([]IWorkload, error)
- func (k8sAPI *KubernetesApi) ListAttachedPods(namespace string) ([]corev1.Pod, error)
- func (k8sAPI *KubernetesApi) ListPods(namespace string, podLabels map[string]string) ([]corev1.Pod, error)
- func (k8sAPI *KubernetesApi) ListWorkloads(groupVersionResource *schema.GroupVersionResource, namespace string, ...) ([]IWorkload, error)
- func (k8sAPI *KubernetesApi) ListWorkloads2(namespace, kind string) ([]IWorkload, error)
- func (k8sAPI *KubernetesApi) ResourceInterface(resource *schema.GroupVersionResource, namespace string) dynamic.ResourceInterface
- func (k8sAPI *KubernetesApi) UpdateWorkload(workload IWorkload) (IWorkload, error)
Constants ¶
View Source
const ValueNotFound = -1
Variables ¶
View Source
var ConnectedToCluster = true
View Source
var K8SConfig *restclient.Config
K8SConfig pointer to k8s config
View Source
var ResourceClusterScope = []string{}
View Source
var ResourceGroupMapping = map[string]string{}
View Source
var RunningIncluster bool
RunningIncluster whether running in cluster
Functions ¶
func ConvertUnstructuredSliceToMap ¶
func ConvertUnstructuredSliceToMap(unstructuredSlice []unstructured.Unstructured) []map[string]interface{}
func FilterOutOwneredResources ¶
func FilterOutOwneredResources(result []unstructured.Unstructured) []unstructured.Unstructured
func GetClusterName ¶
func GetClusterName() string
func GetCurrentContext ¶
func GetDefaultNamespace ¶
func GetDefaultNamespace() string
func GetGroupVersionResource ¶
func GetGroupVersionResource(resource string) (schema.GroupVersionResource, error)
func GetK8sConfig ¶
func GetK8sConfig() *restclient.Config
GetK8sConfig get config. load if not loaded yet
func GetResourceListMock ¶ added in v0.0.28
func GetResourceListMock() ([]*metav1.APIResourceList, error)
func GetResourceTriplets ¶
func GroupVersionResourceToString ¶ added in v0.0.24
func GroupVersionResourceToString(resource *schema.GroupVersionResource) string
func InitializeMapResources ¶ added in v0.0.24
func InitializeMapResources(discoveryClient discovery.DiscoveryInterface)
func InitializeMapResourcesMock ¶ added in v0.0.24
func InitializeMapResourcesMock()
func IsAgentCompatibleLabel ¶
func IsAttached ¶
func IsConnectedToCluster ¶
func IsConnectedToCluster() bool
func IsNamespaceScope ¶
func IsNamespaceScope(resource *schema.GroupVersionResource) bool
func IsStringInSlice ¶
func JoinGroupVersion ¶ added in v0.0.24
func JoinResourceTriplets ¶
func LoadK8sConfig ¶
func LoadK8sConfig() error
LoadK8sConfig load config from local file or from cluster
func ResourceGroupToSlice ¶
func ResourceGroupToString ¶
DEPRECATED
func SelectorToString ¶
String returns all labels listed as a human readable string. Conveniently, exactly the format that ParseSelector takes.
func SetAgentCompatibleLabel ¶
func StringInSlice ¶
func V1AllClusterWithCompromisedRegistriesMock ¶
func V1AllClusterWithCompromisedRegistriesMock() *unstructured.UnstructuredList
func V1KubeSystemNamespaceMock ¶
func V1KubeSystemNamespaceMock() *unstructured.UnstructuredList
Types ¶
type IWorkload ¶
type IWorkload workloadinterface.IWorkload
type KubernetesApi ¶
type KubernetesApi struct {
KubernetesClient kubernetes.Interface
DynamicClient dynamic.Interface
DiscoveryClient discovery.DiscoveryInterface
Context context.Context
}
KubernetesApi -
func (*KubernetesApi) CalculateWorkloadParentRecursive ¶
func (k8sAPI *KubernetesApi) CalculateWorkloadParentRecursive(workload IWorkload) (string, string, error)
func (*KubernetesApi) CreateWorkload ¶
func (k8sAPI *KubernetesApi) CreateWorkload(workload IWorkload) (IWorkload, error)
func (*KubernetesApi) DeleteWorkloadByWlid ¶
func (k8sAPI *KubernetesApi) DeleteWorkloadByWlid(wlid string) error
func (*KubernetesApi) GetNamespace ¶
func (k8sAPI *KubernetesApi) GetNamespace(ns string) (IWorkload, error)
func (*KubernetesApi) GetWorkload ¶
func (k8sAPI *KubernetesApi) GetWorkload(namespace, kind, name string) (IWorkload, error)
func (*KubernetesApi) GetWorkloadByWlid ¶
func (k8sAPI *KubernetesApi) GetWorkloadByWlid(wlid string) (IWorkload, error)
func (*KubernetesApi) ListAllWorkload ¶
func (k8sAPI *KubernetesApi) ListAllWorkload() ([]IWorkload, error)
func (*KubernetesApi) ListAttachedPods ¶
func (k8sAPI *KubernetesApi) ListAttachedPods(namespace string) ([]corev1.Pod, error)
func (*KubernetesApi) ListWorkloads ¶
func (k8sAPI *KubernetesApi) ListWorkloads(groupVersionResource *schema.GroupVersionResource, namespace string, podLabels, fieldSelector map[string]string) ([]IWorkload, error)
func (*KubernetesApi) ListWorkloads2 ¶
func (k8sAPI *KubernetesApi) ListWorkloads2(namespace, kind string) ([]IWorkload, error)
func (*KubernetesApi) ResourceInterface ¶
func (k8sAPI *KubernetesApi) ResourceInterface(resource *schema.GroupVersionResource, namespace string) dynamic.ResourceInterface
func (*KubernetesApi) UpdateWorkload ¶
func (k8sAPI *KubernetesApi) UpdateWorkload(workload IWorkload) (IWorkload, error)
Click to show internal directories.
Click to hide internal directories.