From 4e2547c5a3e52d003882ac8071da02b2eb8c9b32 Mon Sep 17 00:00:00 2001 From: Aswin Suryanarayanan Date: Fri, 8 Nov 2024 19:52:15 -0500 Subject: [PATCH] Add route agent healthcheck Signed-off-by: Aswin Suryanarayanan --- .idea/console.iml | 9 ++ .idea/inspectionProfiles/Project_Default.xml | 6 + .idea/modules.xml | 8 ++ .idea/vcs.xml | 6 + .idea/workspace.xml | 112 ++++++++++++++++++ .../ClusterSetSubmariner.tsx | 44 +++++-- 6 files changed, 176 insertions(+), 9 deletions(-) create mode 100644 .idea/console.iml create mode 100644 .idea/inspectionProfiles/Project_Default.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 100644 .idea/workspace.xml diff --git a/.idea/console.iml b/.idea/console.iml new file mode 100644 index 00000000000..5e764c4f0b9 --- /dev/null +++ b/.idea/console.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 00000000000..03d9549ea8e --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 00000000000..ef1bfd5d275 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 00000000000..35eb1ddfbbc --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 00000000000..9ea275c06fd --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + { + "associatedIndex": 1 +} + + + + { + "keyToString": { + "RunOnceActivity.OpenProjectViewOnStart": "true", + "RunOnceActivity.ShowReadmeOnStart": "true", + "RunOnceActivity.go.formatter.settings.were.checked": "true", + "RunOnceActivity.go.migrated.go.modules.settings": "true", + "RunOnceActivity.go.modules.automatic.dependencies.download": "true", + "RunOnceActivity.go.modules.go.list.on.any.changes.was.set": "true", + "WebServerToolWindowFactoryState": "false", + "git-widget-placeholder": "ra-healthcheck", + "go.import.settings.migrated": "true", + "go.sdk.automatically.set": "true", + "last_opened_file_path": "/Users/asuryana/Documents/GitHub/console", + "node.js.detected.package.eslint": "true", + "node.js.selected.package.eslint": "(autodetect)", + "nodejs.jest.jest_package": "/Users/asuryana/Documents/GitHub/console/frontend/node_modules/jest", + "nodejs_package_manager_path": "npm", + "ts.external.directory.path": "/Users/asuryana/Documents/GitHub/console/node_modules/typescript/lib" + } +} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + + + + file://$PROJECT_DIR$/frontend/src/routes/Infrastructure/Clusters/ClusterSets/ClusterSetDetails/ClusterSetDetails.test.tsx + 272 + + + + file://$PROJECT_DIR$/frontend/src/routes/Infrastructure/Clusters/ClusterSets/ClusterSetDetails/ClusterSetDetails.test.tsx + 313 + + + + + \ No newline at end of file diff --git a/frontend/src/routes/Infrastructure/Clusters/ClusterSets/ClusterSetDetails/ClusterSetSubmariner/ClusterSetSubmariner.tsx b/frontend/src/routes/Infrastructure/Clusters/ClusterSets/ClusterSetDetails/ClusterSetSubmariner/ClusterSetSubmariner.tsx index f6b8c6b99a9..2cdcc87d68e 100644 --- a/frontend/src/routes/Infrastructure/Clusters/ClusterSets/ClusterSetDetails/ClusterSetSubmariner/ClusterSetSubmariner.tsx +++ b/frontend/src/routes/Infrastructure/Clusters/ClusterSets/ClusterSetDetails/ClusterSetSubmariner/ClusterSetSubmariner.tsx @@ -60,6 +60,9 @@ const SubmarinerConnectionDegraded: SubmarinerConnectionDegradedType = 'Submarin type SubmarinerBrokerConfigAppliedType = 'SubmarinerBrokerConfigApplied' const SubmarinerBrokerConfigApplied: SubmarinerBrokerConfigAppliedType = 'SubmarinerBrokerConfigApplied' +type RouteAgentConnectionDegradedType = 'RouteAgentConnectionDegraded' +const RouteAgentConnectionDegraded: RouteAgentConnectionDegradedType = 'RouteAgentConnectionDegraded' + export enum SubmarinerStatus { 'progressing' = 'progressing', 'healthy' = 'healthy', @@ -70,19 +73,25 @@ export const submarinerHealthCheck = (mca: ManagedClusterAddOn) => { const connectionDegradedCondition = mca.status?.conditions?.find((c) => c.type === SubmarinerConnectionDegraded) const agentCondition = mca.status?.conditions?.find((c) => c.type === SubmarinerAgentDegraded) const nodeLabeledCondition = mca.status?.conditions?.find((c) => c.type === SubmarinerGatewayNodesLabeled) + const routeAgentConnectionDegradedCondition = mca.status?.conditions?.find( + (c) => c.type === RouteAgentConnectionDegraded + ) const isConnectionProgressing = connectionDegradedCondition?.status === undefined + const isRouteAgentProgressing = routeAgentConnectionDegradedCondition?.status === undefined const isAgentProgressing = agentCondition?.status === undefined const isNodeLabeledProgressing = nodeLabeledCondition?.status === undefined - if (isConnectionProgressing || isAgentProgressing || isNodeLabeledProgressing) { + if (isConnectionProgressing || isRouteAgentProgressing || isAgentProgressing || isNodeLabeledProgressing) { return SubmarinerStatus.progressing } else { const isHealthyConnection = connectionDegradedCondition?.status === 'False' + const isHealthyRouteAgent = routeAgentConnectionDegradedCondition?.status === 'False' const isHealthyAgent = agentCondition?.status === 'False' const isNodeLabeled = nodeLabeledCondition?.status === 'True' + const isConnectionHealthy = isHealthyConnection && isHealthyRouteAgent - if (isHealthyConnection && isHealthyAgent && isNodeLabeled) { + if (isHealthyAgent && isNodeLabeled && isConnectionHealthy) { return SubmarinerStatus.healthy } else { return SubmarinerStatus.degraded @@ -154,17 +163,34 @@ export function ClusterSetSubmarinerPageContent() { header: t('table.submariner.connection'), cell: (mca: ManagedClusterAddOn) => { const connectionDegradedCondition = mca.status?.conditions?.find((c) => c.type === SubmarinerConnectionDegraded) + const routeAgentConnectionDegradedCondition = mca.status?.conditions?.find( + (c) => c.type === RouteAgentConnectionDegraded + ) + let type: StatusType = StatusType.progress let status: string = t('status.submariner.progressing') let message: string | undefined = t('status.submariner.progressing.message') - if (connectionDegradedCondition) { - status = - connectionDegradedCondition?.status === 'True' - ? t('status.submariner.connection.degraded') - : t('status.submariner.connection.healthy') - type = connectionDegradedCondition?.status === 'True' ? StatusType.danger : StatusType.healthy - message = connectionDegradedCondition.message + + const isSubmarinerDegraded = connectionDegradedCondition?.status === 'True' + const isRouteAgentDegraded = routeAgentConnectionDegradedCondition?.status === 'True' + + if (isSubmarinerDegraded || isRouteAgentDegraded) { + status = t('status.submariner.connection.degraded') + type = StatusType.danger + if (isSubmarinerDegraded) { + message = connectionDegradedCondition?.message + } else { + message = routeAgentConnectionDegradedCondition?.message + } + } else if ( + connectionDegradedCondition?.status === 'False' && + routeAgentConnectionDegradedCondition?.status === 'False' + ) { + type = StatusType.healthy + status = t('status.submariner.connection.healthy') + message = connectionDegradedCondition?.message } + return }, },