This commit is contained in:
devad 2023-11-24 16:50:49 +08:00
parent c57371a257
commit bb522cd661
1 changed files with 6 additions and 5 deletions

View File

@ -32,11 +32,10 @@ func (l *GetAppDetailLogic) GetAppDetail(in *kubernetes.AppDetailReq) (*kubernet
//查询指定集群下指定命名空间下和名字的deployment详情
for k, _ := range pkg.KClients {
//获取指定命名空间下的deployment
deployment, err := pkg.KClients[k].ClientSet.AppsV1().Deployments(in.Namespace).Get(context.Background(), in.Name, metav1.GetOptions{})
deployment, _ := pkg.KClients[k].ClientSet.AppsV1().Deployments(in.Namespace).Get(context.Background(), in.Name, metav1.GetOptions{})
//查询指定集群下指定命名空间下和名字的statefulset详情
statefulSets, err := pkg.KClients[k].ClientSet.AppsV1().StatefulSets(in.Namespace).Get(context.Background(), in.Name, metav1.GetOptions{})
fmt.Println("statefulSets的值 ", statefulSets, err)
statefulSets, _ := pkg.KClients[k].ClientSet.AppsV1().StatefulSets(in.Namespace).Get(context.Background(), in.Name, metav1.GetOptions{})
// 查询 Ingress 资源
// 创建一个 Ingress 客户端集线器
@ -45,10 +44,11 @@ func (l *GetAppDetailLogic) GetAppDetail(in *kubernetes.AppDetailReq) (*kubernet
// 定义要查询的标签选择器
labelSelector := fmt.Sprintf("cloud.sealos.io/app-deploy-manager=%s", in.Name)
// 执行查询操作,获取匹配标签的 Ingress 资源列表
ingresses, err := ingClient.List(context.TODO(), metav1.ListOptions{LabelSelector: labelSelector})
ingresses, _ := ingClient.List(context.TODO(), metav1.ListOptions{LabelSelector: labelSelector})
//查询 Service 资源
service, err := pkg.KClients[k].ClientSet.CoreV1().Services(in.Namespace).Get(context.Background(), in.Name, metav1.GetOptions{})
service, _ := pkg.KClients[k].ClientSet.CoreV1().Services(in.Namespace).Get(context.Background(), in.Name, metav1.GetOptions{})
//转换赋值
var (
kDeployment kubernetes.Deployment
@ -70,6 +70,7 @@ func (l *GetAppDetailLogic) GetAppDetail(in *kubernetes.AppDetailReq) (*kubernet
}
details = append(details, &appDetail)
}
logx.Infof("查询app详情成功")
return &kubernetes.AppDetailResp{
Code: "200",
Msg: "success",