Documentation ¶
Index ¶
- Constants
- func ApplyLimitRange(ctx context.Context, kubeClient *kubernetes.Clientset, namespace string, ...) error
- func ApplyResourceQuota(ctx context.Context, kubeClient *kubernetes.Clientset, namespace string, ...) error
- func BuildK8sContainers(containers []corev1.Container) []model.K8sPodContainer
- func BuildK8sContainersWithPointer(k8sContainers []model.K8sPodContainer) []*model.K8sPodContainer
- func BuildK8sNode(ctx context.Context, id int, node corev1.Node, ...) (*model.K8sNode, error)
- func BuildK8sPods(pods *corev1.PodList) []*model.K8sPod
- func EnsureNamespace(ctx context.Context, kubeClient *kubernetes.Clientset, namespace string) error
- func GetDaemonSetResources(ctx context.Context, kubeClient *kubernetes.Clientset, namespace string) ([]model.Resource, error)
- func GetDeploymentResources(ctx context.Context, kubeClient *kubernetes.Clientset, namespace string) ([]model.Resource, error)
- func GetDynamicClient(ctx context.Context, id int, clusterDao admin.ClusterDAO, ...) (*dynamic.DynamicClient, error)
- func GetInternalIP(node corev1.Node) string
- func GetKubeAndMetricsClient(id int, logger *zap.Logger, client client.K8sClient) (*kubernetes.Clientset, *metricsClient.Clientset, error)
- func GetKubeClient(clusterId int, client client.K8sClient, l *zap.Logger) (*kubernetes.Clientset, error)
- func GetNodeAge(node corev1.Node) string
- func GetNodeEvents(ctx context.Context, client *kubernetes.Clientset, nodeName string) ([]model.OneEvent, error)
- func GetNodeLabels(node corev1.Node) []string
- func GetNodeResource(ctx context.Context, metricsCli *metricsClient.Clientset, nodeName string, ...) ([]string, error)
- func GetNodeRoles(node corev1.Node) []string
- func GetNodeStatus(node corev1.Node) string
- func GetNodesByName(ctx context.Context, client *kubernetes.Clientset, nodeName string) (*corev1.NodeList, error)
- func GetPodResources(ctx context.Context, kubeClient *kubernetes.Clientset, namespace string) ([]model.Resource, error)
- func GetPodsByNodeName(ctx context.Context, client *kubernetes.Clientset, nodeName string) (*corev1.PodList, error)
- func GetReplicaSetResources(ctx context.Context, kubeClient *kubernetes.Clientset, namespace string) ([]model.Resource, error)
- func GetResourceName(kind string) string
- func GetResourceString(node corev1.Node, resourceName string) string
- func GetServiceResources(ctx context.Context, kubeClient *kubernetes.Clientset, namespace string) ([]model.Resource, error)
- func GetStatefulSetResources(ctx context.Context, kubeClient *kubernetes.Clientset, namespace string) ([]model.Resource, error)
- func GetTaintsMapFromTaints(taints []corev1.Taint) map[string]corev1.Taint
- func InitAadGetKubeClient(ctx context.Context, cluster *model.K8sCluster, logger *zap.Logger, ...) (*kubernetes.Clientset, error)
- func IsNodeSchedulable(node corev1.Node) bool
- func MergeTaints(existingTaints []corev1.Taint, newTaints []corev1.Taint) []corev1.Taint
- func RemoveTaints(existingTaints []corev1.Taint, taintsToDelete []corev1.Taint) []corev1.Taint
Constants ¶
const QuotaName = "compute-quota"
Variables ¶
This section is empty.
Functions ¶
func ApplyLimitRange ¶
func ApplyLimitRange(ctx context.Context, kubeClient *kubernetes.Clientset, namespace string, cluster *model.K8sCluster) error
ApplyLimitRange 应用 LimitRange 到指定命名空间
func ApplyResourceQuota ¶
func ApplyResourceQuota(ctx context.Context, kubeClient *kubernetes.Clientset, namespace string, cluster *model.K8sCluster) error
ApplyResourceQuota 应用 ResourceQuota 到指定命名空间
func BuildK8sContainers ¶
func BuildK8sContainers(containers []corev1.Container) []model.K8sPodContainer
BuildK8sContainers 构建 K8sContainer 列表
func BuildK8sContainersWithPointer ¶
func BuildK8sContainersWithPointer(k8sContainers []model.K8sPodContainer) []*model.K8sPodContainer
BuildK8sContainersWithPointer 转换普通切片为指针切片
func BuildK8sNode ¶
func BuildK8sPods ¶
BuildK8sPods BuildK8sNodes 构建 K8sNode 列表
func EnsureNamespace ¶
EnsureNamespace 确保指定的命名空间存在,如果不存在则创建
func GetDaemonSetResources ¶
func GetDaemonSetResources(ctx context.Context, kubeClient *kubernetes.Clientset, namespace string) ([]model.Resource, error)
GetDaemonSetResources 获取 DaemonSet 资源
func GetDeploymentResources ¶
func GetDeploymentResources(ctx context.Context, kubeClient *kubernetes.Clientset, namespace string) ([]model.Resource, error)
GetDeploymentResources 获取 Deployment 资源
func GetDynamicClient ¶
func GetDynamicClient(ctx context.Context, id int, clusterDao admin.ClusterDAO, client client.K8sClient) (*dynamic.DynamicClient, error)
func GetKubeAndMetricsClient ¶
func GetKubeAndMetricsClient(id int, logger *zap.Logger, client client.K8sClient) (*kubernetes.Clientset, *metricsClient.Clientset, error)
func GetKubeClient ¶
func GetKubeClient(clusterId int, client client.K8sClient, l *zap.Logger) (*kubernetes.Clientset, error)
GetKubeClient 获取 Kubernetes 客户端
func GetNodeEvents ¶
func GetNodeEvents(ctx context.Context, client *kubernetes.Clientset, nodeName string) ([]model.OneEvent, error)
GetNodeEvents 获取节点事件
func GetNodeResource ¶
func GetNodeResource(ctx context.Context, metricsCli *metricsClient.Clientset, nodeName string, pods *corev1.PodList, node *corev1.Node) ([]string, error)
GetNodeResource 获取节点资源信息
func GetNodesByName ¶
func GetNodesByName(ctx context.Context, client *kubernetes.Clientset, nodeName string) (*corev1.NodeList, error)
GetNodesByName 获取指定集群上的 Node 列表
func GetPodResources ¶
func GetPodResources(ctx context.Context, kubeClient *kubernetes.Clientset, namespace string) ([]model.Resource, error)
GetPodResources 获取 Pod 资源
func GetPodsByNodeName ¶
func GetPodsByNodeName(ctx context.Context, client *kubernetes.Clientset, nodeName string) (*corev1.PodList, error)
GetPodsByNodeName 获取指定节点上的 Pod 列表
func GetReplicaSetResources ¶
func GetReplicaSetResources(ctx context.Context, kubeClient *kubernetes.Clientset, namespace string) ([]model.Resource, error)
GetReplicaSetResources 获取 ReplicaSet 资源
func GetResourceString ¶
GetResourceString 获取节点资源信息
func GetServiceResources ¶
func GetServiceResources(ctx context.Context, kubeClient *kubernetes.Clientset, namespace string) ([]model.Resource, error)
GetServiceResources 获取 Service 资源
func GetStatefulSetResources ¶
func GetStatefulSetResources(ctx context.Context, kubeClient *kubernetes.Clientset, namespace string) ([]model.Resource, error)
GetStatefulSetResources 获取 StatefulSet 资源
func GetTaintsMapFromTaints ¶
GetTaintsMapFromTaints 将 taints 转换为键为 "Key:Value:Effect" 的 map
func InitAadGetKubeClient ¶
func MergeTaints ¶
MergeTaints 合并新的 taints,避免重复
Types ¶
This section is empty.