Skip to content

Commit

Permalink
disable update checker in EC installations (#4723)
Browse files Browse the repository at this point in the history
* disable update checker in EC installations

* only show update schedule link if not embedded cluster
  • Loading branch information
laverya committed Jul 4, 2024
1 parent a95df26 commit 90b51b1
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 48 deletions.
5 changes: 3 additions & 2 deletions pkg/updatechecker/updatechecker.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
11 changes: 9 additions & 2 deletions web/src/Root.tsx
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -722,7 +722,14 @@ const Root = () => {
/>
}
>
<Route path=":slug" element={<Dashboard />} />
<Route
path=":slug"
element={
<Dashboard
adminConsoleMetadata={state.adminConsoleMetadata}
/>
}
/>
<Route
path=":slug/tree/:sequence?"
element={<DownstreamTree />}
Expand Down
36 changes: 21 additions & 15 deletions web/src/components/apps/AppVersionHistory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ type ReleaseWithError = {

type Props = {
outletContext: {
isEmbeddedCluster: boolean;
adminConsoleMetadata: {
isAirgap: boolean;
isKurl: boolean;
Expand Down Expand Up @@ -1834,21 +1835,26 @@ class AppVersionHistory extends Component<Props, State> {
</span>
</div>
)}
<span
className="flex-auto flex alignItems--center link u-fontSize--small"
onClick={this.toggleAutomaticUpdatesModal}
>
<Icon
icon="schedule-sync"
size={16}
className="clickable u-marginRight--5"
color={""}
style={{}}
disableFill={false}
removeInlineStyle={false}
/>
Configure automatic updates
</span>
{!this.props.outletContext
.isEmbeddedCluster && (
<span
className="flex-auto flex alignItems--center link u-fontSize--small"
onClick={
this.toggleAutomaticUpdatesModal
}
>
<Icon
icon="schedule-sync"
size={16}
className="clickable u-marginRight--5"
color={""}
style={{}}
disableFill={false}
removeInlineStyle={false}
/>
Configure automatic updates
</span>
)}
</div>
)}
</div>
Expand Down
25 changes: 15 additions & 10 deletions web/src/features/Dashboard/components/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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: {
Expand Down Expand Up @@ -105,7 +109,7 @@ type State = {
lastUpdatedDate: Date;
};

const Dashboard = () => {
const Dashboard = (props: Props) => {
const [state, setState] = useReducer(
(currentState: State, newState: Partial<State>) => ({
...currentState,
Expand Down Expand Up @@ -696,6 +700,7 @@ const Dashboard = () => {
viewAirgapUploadError={() => toggleViewAirgapUploadError()}
showAutomaticUpdatesModal={showAutomaticUpdatesModal}
noUpdatesAvalable={state.noUpdatesAvalable}
adminConsoleMetadata={props.adminConsoleMetadata}
/>
</div>

Expand Down
39 changes: 20 additions & 19 deletions web/src/features/Dashboard/components/DashboardVersionCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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;
Expand Down Expand Up @@ -1505,19 +1504,21 @@ const DashboardVersionCard = (props: Props) => {
</span>
</div>
)}
<div className="flex alignItems--center u-marginRight--20 link">
<Icon
icon="schedule-sync"
size={18}
className=" clickable u-marginRight--5"
/>
<span
className="u-fontSize--small u-lineHeight--default"
onClick={props.showAutomaticUpdatesModal}
>
Configure automatic updates
</span>
</div>
{!props.adminConsoleMetadata?.isEmbeddedCluster && (
<div className="flex alignItems--center u-marginRight--20 link">
<Icon
icon="schedule-sync"
size={18}
className=" clickable u-marginRight--5"
/>
<span
className="u-fontSize--small u-lineHeight--default"
onClick={props.showAutomaticUpdatesModal}
>
Configure automatic updates
</span>
</div>
)}
</div>
)}
</div>
Expand Down

0 comments on commit 90b51b1

Please sign in to comment.