From 90b51b1301da6e45b420eb264ca981a60c1cddb6 Mon Sep 17 00:00:00 2001 From: Andrew Lavery Date: Wed, 3 Jul 2024 23:46:42 -0400 Subject: [PATCH] disable update checker in EC installations (#4723) * disable update checker in EC installations * only show update schedule link if not embedded cluster --- pkg/updatechecker/updatechecker.go | 5 ++- web/src/Root.tsx | 11 +++++- web/src/components/apps/AppVersionHistory.tsx | 36 ++++++++++------- .../Dashboard/components/Dashboard.tsx | 25 +++++++----- .../components/DashboardVersionCard.tsx | 39 ++++++++++--------- 5 files changed, 68 insertions(+), 48 deletions(-) diff --git a/pkg/updatechecker/updatechecker.go b/pkg/updatechecker/updatechecker.go index c24b5061da..21eba44679 100644 --- a/pkg/updatechecker/updatechecker.go +++ b/pkg/updatechecker/updatechecker.go @@ -61,13 +61,14 @@ func Start() error { // if enabled, and cron job was NOT found: add a new cron job to check app updates // if enabled, and a cron job was found, update the existing cron job with the latest cron spec // if disabled: stop the current running cron job (if exists) -// no-op for airgap applications +// no-op for airgap and embedded cluster applications func Configure(a *apptypes.App, updateCheckerSpec string) error { appId := a.GetID() appSlug := a.GetSlug() isAirgap := a.GetIsAirgap() + isEC := util.IsEmbeddedCluster() - if isAirgap { + if isAirgap || isEC { return nil } diff --git a/web/src/Root.tsx b/web/src/Root.tsx index ed44c727d2..8412cdab1a 100644 --- a/web/src/Root.tsx +++ b/web/src/Root.tsx @@ -1,4 +1,4 @@ -import { useReducer, useEffect, createContext } from "react"; +import { createContext, useEffect, useReducer } from "react"; import { createBrowserHistory } from "history"; import { Navigate, Route, Routes, useNavigate } from "react-router-dom"; import { Helmet } from "react-helmet"; @@ -722,7 +722,14 @@ const Root = () => { /> } > - } /> + + } + /> } diff --git a/web/src/components/apps/AppVersionHistory.tsx b/web/src/components/apps/AppVersionHistory.tsx index a7418bff5f..f252bf5293 100644 --- a/web/src/components/apps/AppVersionHistory.tsx +++ b/web/src/components/apps/AppVersionHistory.tsx @@ -54,6 +54,7 @@ type ReleaseWithError = { type Props = { outletContext: { + isEmbeddedCluster: boolean; adminConsoleMetadata: { isAirgap: boolean; isKurl: boolean; @@ -1834,21 +1835,26 @@ class AppVersionHistory extends Component { )} - - - Configure automatic updates - + {!this.props.outletContext + .isEmbeddedCluster && ( + + + Configure automatic updates + + )} )} diff --git a/web/src/features/Dashboard/components/Dashboard.tsx b/web/src/features/Dashboard/components/Dashboard.tsx index f079638b71..ce6c29eded 100644 --- a/web/src/features/Dashboard/components/Dashboard.tsx +++ b/web/src/features/Dashboard/components/Dashboard.tsx @@ -21,20 +21,14 @@ import { useNextAppVersionWithIntercept } from "../api/useNextAppVersion"; import "@src/scss/components/watches/Dashboard.scss"; import "@src/../node_modules/react-vis/dist/style"; import { Paragraph } from "@src/styles/common"; - -const COMMON_ERRORS = { - "HTTP 401": "Registry credentials are invalid", - "invalid username/password": "Registry credentials are invalid", - "no such host": "No such host", -}; - // Types import { App, AppLicense, - Downstream, - DashboardResponse, DashboardActionLink, + DashboardResponse, + Downstream, + Metadata, ResourceStates, Version, } from "@types"; @@ -46,6 +40,16 @@ import { useAppDownstream } from "../api/getAppDownstream"; import { useAirgapConfig } from "../api/getAirgapConfig"; import { Updates, useCheckForUpdates } from "../api/getUpdates"; +const COMMON_ERRORS = { + "HTTP 401": "Registry credentials are invalid", + "invalid username/password": "Registry credentials are invalid", + "no such host": "No such host", +}; + +type Props = { + adminConsoleMetadata: Metadata | null; +}; + type OutletContext = { app: App; cluster: { @@ -105,7 +109,7 @@ type State = { lastUpdatedDate: Date; }; -const Dashboard = () => { +const Dashboard = (props: Props) => { const [state, setState] = useReducer( (currentState: State, newState: Partial) => ({ ...currentState, @@ -696,6 +700,7 @@ const Dashboard = () => { viewAirgapUploadError={() => toggleViewAirgapUploadError()} showAutomaticUpdatesModal={showAutomaticUpdatesModal} noUpdatesAvalable={state.noUpdatesAvalable} + adminConsoleMetadata={props.adminConsoleMetadata} /> diff --git a/web/src/features/Dashboard/components/DashboardVersionCard.tsx b/web/src/features/Dashboard/components/DashboardVersionCard.tsx index 928966214d..5ae7d14fa3 100644 --- a/web/src/features/Dashboard/components/DashboardVersionCard.tsx +++ b/web/src/features/Dashboard/components/DashboardVersionCard.tsx @@ -13,15 +13,14 @@ import ShowLogsModal from "@src/components/modals/ShowLogsModal"; import DeployWarningModal from "@src/components/shared/modals/DeployWarningModal"; import SkipPreflightsModal from "@src/components/shared/modals/SkipPreflightsModal"; import classNames from "classnames"; -import { getReadableGitOpsProviderName } from "@src/utilities/utilities"; -import { useNextAppVersionWithIntercept } from "../api/useNextAppVersion"; -import { useSelectedApp } from "@features/App"; - import { - Utilities, getPreflightResultState, + getReadableGitOpsProviderName, secondsAgo, + Utilities, } from "@src/utilities/utilities"; +import { useNextAppVersionWithIntercept } from "../api/useNextAppVersion"; +import { useSelectedApp } from "@features/App"; import { Repeater } from "@src/utilities/repeater"; import "@src/scss/components/watches/DashboardCard.scss"; @@ -39,7 +38,7 @@ import { AirgapUploader } from "@src/utilities/airgapUploader"; import EditConfigIcon from "@components/shared/EditConfigIcon"; type Props = { - adminConsoleMetadata?: Metadata; + adminConsoleMetadata: Metadata | null; airgapUploader: AirgapUploader | null; airgapUploadError: string | null; checkingForUpdates: boolean; @@ -1505,19 +1504,21 @@ const DashboardVersionCard = (props: Props) => { )} -
- - - Configure automatic updates - -
+ {!props.adminConsoleMetadata?.isEmbeddedCluster && ( +
+ + + Configure automatic updates + +
+ )} )}