Skip to content

Commit 644ed2e

Browse files
authored
feat: panic in sync pod cron and terminal not opening fix (#5603)
* panic in sync pod cron * better logging * added params in k8sCapacityDetails API * fix in logger.Errorw
1 parent d0bef6a commit 644ed2e

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

pkg/k8s/K8sCommonService.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ func (impl *K8sCommonServiceImpl) DeleteResource(ctx context.Context, request *R
148148
clusterId := request.ClusterId
149149
restConfig, err, _ := impl.GetRestConfigByClusterId(ctx, clusterId)
150150
if err != nil {
151-
impl.logger.Errorw("error in getting rest config by cluster Id", "err", err, "clusterId", request.AppIdentifier.ClusterId)
151+
impl.logger.Errorw("error in getting rest config by cluster Id", "err", err, "clusterId", clusterId)
152152
return nil, err
153153
}
154154
resourceIdentifier := request.K8sRequest.ResourceIdentifier

pkg/k8s/capacity/k8sCapacityService.go

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ func (impl *K8sCapacityServiceImpl) GetClusterCapacityDetailList(ctx context.Con
8888
} else {
8989
clusterCapacityDetail, err = impl.GetClusterCapacityDetail(ctx, cluster, true)
9090
if err != nil {
91-
impl.logger.Errorw("error in getting cluster capacity details by id", "err", err)
91+
impl.logger.Errorw("error in getting cluster capacity details by id", "clusterID", cluster.Id, "err", err)
9292
clusterCapacityDetail = &bean.ClusterCapacityDetail{
9393
ErrorInConnection: err.Error(),
9494
}
@@ -105,6 +105,7 @@ func (impl *K8sCapacityServiceImpl) GetClusterCapacityDetail(ctx context.Context
105105
//getting kubernetes clientSet by rest config
106106
restConfig, k8sHttpClient, k8sClientSet, err := impl.k8sCommonService.GetK8sConfigAndClients(ctx, cluster)
107107
if err != nil {
108+
impl.logger.Errorw("error in creating k8sHttpClient", "err", err)
108109
return nil, err
109110
}
110111
clusterDetail := &bean.ClusterCapacityDetail{}
@@ -118,17 +119,17 @@ func (impl *K8sCapacityServiceImpl) GetClusterCapacityDetail(ctx context.Context
118119
return nil, err
119120
}
120121
clusterCpuAllocatable, clusterMemoryAllocatable, nodeCount := impl.setBasicClusterDetails(nodeList, clusterDetail)
121-
if callForList {
122-
//assigning additional data for cluster listing api call
123-
clusterDetail.NodeCount = nodeCount
124-
//getting serverVersion
125-
serverVersion, err := impl.K8sUtil.GetServerVersionFromDiscoveryClient(k8sClientSet)
126-
if err != nil {
127-
impl.logger.Errorw("error in getting server version", "err", err, "clusterId", cluster.Id)
128-
return nil, err
129-
}
130-
clusterDetail.ServerVersion = serverVersion.GitVersion
131-
} else {
122+
//assigning additional data for cluster listing api call
123+
clusterDetail.NodeCount = nodeCount
124+
//getting serverVersion
125+
serverVersion, err := impl.K8sUtil.GetServerVersionFromDiscoveryClient(k8sClientSet)
126+
if err != nil {
127+
impl.logger.Errorw("error in getting server version", "clusterId", cluster.Id, "err", err)
128+
return nil, err
129+
}
130+
clusterDetail.ServerVersion = serverVersion.GitVersion
131+
if !callForList {
132+
clusterDetail.Name = cluster.ClusterName
132133
metricsClientSet, err := impl.K8sUtil.GetMetricsClientSet(restConfig, k8sHttpClient)
133134
if err != nil {
134135
impl.logger.Errorw("error in getting metrics client set", "err", err)

0 commit comments

Comments
 (0)