Skip to content

Commit 1080795

Browse files
committed
feat: add flux in deployment types
1 parent a85f262 commit 1080795

File tree

12 files changed

+121
-118
lines changed

12 files changed

+121
-118
lines changed

.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,4 @@ LOGIN_PAGE_IMAGE=
7272
FEATURE_MANAGE_TRAFFIC_ENABLE=false
7373
FEATURE_REDFISH_NODE_ENABLE=false
7474
FEATURE_INFRA_PROVISION_INFO_BLOCK_HIDE=false
75+
FEATURE_FLUX_DEPLOYMENTS_ENABLE=false

config.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,6 @@
5050
| FEATURE_USER_DEFINED_GITOPS_REPO_ENABLE | false | If enabled user can pass the manual gitops repo |
5151
| SENTRY_RELEASE_VERSION | | Sentry release Version |
5252
| LOGIN_PAGE_IMAGE | | Login page image url |
53+
| FEATURE_FLUX_DEPLOYMENTS_ENABLE | false | Enables flux cd deployment type for devtron apps and devtron charts |
5354

5455
# DASHBOARD CONFIG SECRET

src/components/app/details/appDetails/AppDetails.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ const Details: React.FC<DetailsType> = ({
241241
useState<DeploymentStatusDetailsBreakdownDataType>({
242242
...(isVirtualEnvRef.current && processVirtualEnvironmentDeploymentData
243243
? processVirtualEnvironmentDeploymentData()
244-
: processDeploymentStatusDetailsData()),
244+
: processDeploymentStatusDetailsData(appDetails?.deploymentAppType)),
245245
deploymentStatus: DEFAULT_STATUS,
246246
})
247247
const isConfigDriftEnabled: boolean = window._env_.FEATURE_CONFIG_DRIFT_ENABLE && !!ConfigDriftModal
@@ -266,7 +266,7 @@ const Details: React.FC<DetailsType> = ({
266266
const processedDeploymentStatusDetailsData =
267267
isVirtualEnvRef.current && processVirtualEnvironmentDeploymentData
268268
? processVirtualEnvironmentDeploymentData(deploymentStatusDetailRes)
269-
: processDeploymentStatusDetailsData(deploymentStatusDetailRes)
269+
: processDeploymentStatusDetailsData(appDetails?.deploymentAppType, deploymentStatusDetailRes)
270270

271271
clearDeploymentStatusTimer()
272272

@@ -412,7 +412,10 @@ const Details: React.FC<DetailsType> = ({
412412
const processedDeploymentStatusData =
413413
isVirtualEnvRef.current && processVirtualEnvironmentDeploymentData
414414
? processVirtualEnvironmentDeploymentData(deploymentStatusDetailRes.result)
415-
: processDeploymentStatusDetailsData(deploymentStatusDetailRes.result)
415+
: processDeploymentStatusDetailsData(
416+
appDetails?.deploymentAppType,
417+
deploymentStatusDetailRes.result,
418+
)
416419

417420
setDeploymentStatusDetailsBreakdownData(processedDeploymentStatusData)
418421
} else {

src/components/app/details/appDetails/SourceInfo.tsx

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ import {
3838
} from '@devtron-labs/devtron-fe-common-lib'
3939
import { ReactComponent as ICCamera } from '@Icons/ic-camera.svg'
4040
import { APP_COMPOSE_STAGE, getAppComposeURL, URLS } from '../../../../config'
41-
import { DeploymentAppTypeNameMapping } from '../../../../config/constantMessaging'
4241
import { Nodes, SourceInfoType } from '../../types'
4342
import DeploymentStatusCard from './DeploymentStatusCard'
4443
import { importComponentFromFELibrary } from '../../../common/helpers/Helpers'
@@ -201,18 +200,9 @@ export const SourceInfo = ({
201200
<div className="flex left w-100">
202201
<AppEnvSelector {...(isAppView ? { isAppView, environments } : { isAppView: false, applications })} />
203202
{appDetails?.deploymentAppType && (
204-
<Tooltip
205-
placement="top"
206-
alwaysShowTippyOnHover={!appDetails.isVirtualEnvironment}
207-
content={`Deployed using ${
208-
isArgoCdApp ? DeploymentAppTypeNameMapping.GitOps : DeploymentAppTypeNameMapping.Helm
209-
}`}
210-
>
211-
<div className={`flex ${!appDetails.isVirtualEnvironment ? 'ml-16' : ''}`}>
212-
{/* TODO: verify what appType needs to be passed */}
213-
<DeploymentTypeIcon deploymentAppType={appDetails.deploymentAppType} appType={null} />
214-
</div>
215-
</Tooltip>
203+
<div className={`flex ${!appDetails.isVirtualEnvironment ? 'ml-16' : ''}`}>
204+
<DeploymentTypeIcon deploymentAppType={appDetails.deploymentAppType} />
205+
</div>
216206
)}
217207
{appDetails?.resourceTree &&
218208
!isIsolatedEnv &&

src/components/cdPipeline/BuildCD.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,8 @@ export default function BuildCD({
612612
isGitOpsRepoNotConfigured={isGitOpsRepoNotConfigured}
613613
gitOpsRepoConfigInfoBar={gitOpsRepoConfigInfoBar}
614614
areGitopsCredentialsConfigured={!isGitOpsInstalledButNotConfigured}
615+
// Want to show this when gitops module is installed, does not matter if it is configured or not
616+
showGitOpsOption={!noGitOpsModuleInstalledAndConfigured || isGitOpsInstalledButNotConfigured}
615617
/>
616618
</div>
617619
)
@@ -802,8 +804,6 @@ export default function BuildCD({
802804
{!window._env_.HIDE_GITOPS_OR_HELM_OPTION &&
803805
!isVirtualEnvironment &&
804806
formData.allowedDeploymentTypes.length > 0 &&
805-
// Want to show this when gitops module is installed, does not matter if it is configured or not
806-
(!noGitOpsModuleInstalledAndConfigured || isGitOpsInstalledButNotConfigured) &&
807807
renderDeploymentAppType()}
808808

809809
{isAdvanced ? renderAdvancedDeploymentStrategy() : renderBasicDeploymentStrategy()}

src/components/common/DeploymentTypeIcon/DeploymentTypeIcon.tsx

Lines changed: 46 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -14,43 +14,59 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { AppType, DeploymentAppTypes } from '@devtron-labs/devtron-fe-common-lib'
17+
import { DeploymentAppTypes, Tooltip } from '@devtron-labs/devtron-fe-common-lib'
1818

19-
import { ReactComponent as ArgoCD } from '../../../assets/icons/argo-cd-app.svg'
20-
import { ReactComponent as Helm } from '../../../assets/icons/helm-app.svg'
21-
import { ReactComponent as FluxCD } from '../../../assets/icons/ic-fluxcd.svg'
19+
import { ReactComponent as ArgoCD } from '@Icons/argo-cd-app.svg'
20+
import { ReactComponent as Helm } from '@Icons/helm-app.svg'
21+
import { ReactComponent as FluxCD } from '@Icons/ic-fluxcd.svg'
2222
import { importComponentFromFELibrary } from '../helpers/Helpers'
2323

24+
export const DEPLOYMENT_TYPE_TO_TEXT_MAP = {
25+
[DeploymentAppTypes.GITOPS]: 'GitOps',
26+
[DeploymentAppTypes.FLUX]: 'FluxCD',
27+
[DeploymentAppTypes.HELM]: 'Helm',
28+
}
29+
30+
interface DeploymentTypeIconProps {
31+
deploymentAppType: DeploymentAppTypes
32+
iconSize?: 24 | 32
33+
}
34+
2435
const VirtualEnvHelpTippy = importComponentFromFELibrary('VirtualEnvHelpTippy')
2536

26-
function DeploymentTypeIcon({
27-
deploymentAppType,
28-
appType,
29-
}: {
30-
deploymentAppType: string
31-
appType: string
32-
}): JSX.Element {
33-
const renderDeploymentTypeIcon = () => {
34-
if (
35-
(deploymentAppType === DeploymentAppTypes.MANIFEST_DOWNLOAD ||
36-
deploymentAppType === DeploymentAppTypes.MANIFEST_PUSH) &&
37-
VirtualEnvHelpTippy
38-
) {
39-
return <VirtualEnvHelpTippy isVirtualIcon />
40-
}
41-
if (deploymentAppType === DeploymentAppTypes.GITOPS || appType === AppType.EXTERNAL_ARGO_APP) {
42-
return <ArgoCD data-testid="argo-cd-app-logo" className="icon-dim-32" />
43-
}
44-
if (appType === AppType.EXTERNAL_FLUX_APP) {
45-
return <FluxCD data-testid="flux-cd-app-logo" className="icon-dim-32" />
46-
}
47-
if (deploymentAppType === DeploymentAppTypes.HELM) {
48-
return <Helm data-testid="helm-app-logo" className="icon-dim-32" />
49-
}
50-
return null
37+
const getDeploymentTypeIcon = ({ deploymentAppType, iconSize = 32 }: DeploymentTypeIconProps) => {
38+
const className = `icon-dim-${iconSize}`
39+
switch (deploymentAppType) {
40+
case DeploymentAppTypes.GITOPS:
41+
return <ArgoCD data-testid="argo-cd-app-logo" className={className} />
42+
case DeploymentAppTypes.FLUX:
43+
return <FluxCD data-testid="flux-cd-app-logo" className={className} />
44+
case DeploymentAppTypes.HELM:
45+
return <Helm data-testid="helm-app-logo" className={className} />
46+
default:
47+
return null
5148
}
49+
}
5250

53-
return renderDeploymentTypeIcon()
51+
const DeploymentTypeIcon = ({ deploymentAppType, iconSize }: DeploymentTypeIconProps): JSX.Element => {
52+
switch (deploymentAppType) {
53+
case DeploymentAppTypes.MANIFEST_DOWNLOAD:
54+
case DeploymentAppTypes.MANIFEST_PUSH:
55+
return VirtualEnvHelpTippy ? <VirtualEnvHelpTippy isVirtualIcon /> : null
56+
case DeploymentAppTypes.GITOPS:
57+
case DeploymentAppTypes.FLUX:
58+
case DeploymentAppTypes.HELM:
59+
return (
60+
<Tooltip
61+
alwaysShowTippyOnHover
62+
content={`Deployed Using ${DEPLOYMENT_TYPE_TO_TEXT_MAP[deploymentAppType]}`}
63+
>
64+
<div>{getDeploymentTypeIcon({ deploymentAppType, iconSize })}</div>
65+
</Tooltip>
66+
)
67+
default:
68+
return null
69+
}
5470
}
5571

5672
export default DeploymentTypeIcon

src/components/v2/appDetails/AppDetails.component.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ const AppDetailsComponent = ({
7878
useState<DeploymentStatusDetailsBreakdownDataType>({
7979
...(isVirtualEnv.current && processVirtualEnvironmentDeploymentData
8080
? processVirtualEnvironmentDeploymentData()
81-
: processDeploymentStatusDetailsData()),
81+
: processDeploymentStatusDetailsData(appDetails?.deploymentAppType)),
8282
deploymentStatus: DEFAULT_STATUS,
8383
})
8484

@@ -121,7 +121,8 @@ const AppDetailsComponent = ({
121121
const processedDeploymentStatusDetailsData =
122122
isVirtualEnv.current && processVirtualEnvironmentDeploymentData
123123
? processVirtualEnvironmentDeploymentData(deploymentStatusDetailRes)
124-
: processDeploymentStatusDetailsData(deploymentStatusDetailRes)
124+
: processDeploymentStatusDetailsData(appDetails?.deploymentAppType)
125+
125126
clearDeploymentStatusTimer()
126127
// If deployment status is in progress then fetch data in every 10 seconds
127128
if (processedDeploymentStatusDetailsData.deploymentStatus === DEPLOYMENT_STATUS.INPROGRESS) {

src/components/v2/appDetails/sourceInfo/EnvironmentSelector.component.tsx

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import {
2828
} from '@devtron-labs/devtron-fe-common-lib'
2929
import './sourceInfo.css'
3030
import { useParams, useHistory, useRouteMatch } from 'react-router-dom'
31-
import Tippy from '@tippyjs/react'
3231
import IndexStore from '../index.store'
3332
import { AppEnvironment } from './environment.type'
3433
import { useSharedState } from '../../utils/useSharedState'
@@ -43,7 +42,7 @@ import { deleteInstalledChart } from '../../../charts/charts.service'
4342
import { ReactComponent as Dots } from '@Icons/ic-more-vertical.svg'
4443
import { DELETE_ACTION, URLS, checkIfDevtronOperatorHelmRelease } from '../../../../config'
4544
import { ReactComponent as BinWithDots } from '../../../../assets/icons/ic-delete-dots.svg'
46-
import { DELETE_DEPLOYMENT_PIPELINE, DeploymentAppTypeNameMapping } from '../../../../config/constantMessaging'
45+
import { DELETE_DEPLOYMENT_PIPELINE } from '../../../../config/constantMessaging'
4746
import { getAppOtherEnvironmentMin } from '../../../../services/service'
4847
import DeploymentTypeIcon from '../../../common/DeploymentTypeIcon/DeploymentTypeIcon'
4948
import ClusterNotReachableDialog from '../../../common/ClusterNotReachableDialog/ClusterNotReachableDialog'
@@ -94,19 +93,6 @@ const EnvironmentSelectorComponent = ({
9493
}
9594
}, [params.appId])
9695

97-
const getDeployedUsing = () => {
98-
if (isGitops) {
99-
return DeploymentAppTypeNameMapping.GitOps
100-
}
101-
if (appDetails.appType === AppType.EXTERNAL_ARGO_APP) {
102-
return DeploymentAppTypeNameMapping.ArgoCD
103-
}
104-
if (appDetails.appType === AppType.EXTERNAL_FLUX_APP) {
105-
return DeploymentAppTypeNameMapping.FluxCD
106-
}
107-
return DeploymentAppTypeNameMapping.Helm
108-
}
109-
11096
useEffect(() => {
11197
if (!params.envId && appDetails.environmentId && !isExternalApp) {
11298
handleEnvironmentChange(appDetails.environmentId)
@@ -318,21 +304,12 @@ const EnvironmentSelectorComponent = ({
318304
)}
319305
</div>
320306
</div>
321-
{(appDetails?.deploymentAppType || appDetails?.appType) && (
322-
<Tippy
323-
className="default-tt"
324-
arrow={false}
325-
disabled={isVirtualEnvironment}
326-
placement="top"
327-
content={`Deployed using ${getDeployedUsing()}`}
328-
>
307+
{(appDetails?.deploymentAppType) && (
329308
<div className={`flex ${!isVirtualEnvironment ? 'ml-16' : ''}`}>
330309
<DeploymentTypeIcon
331310
deploymentAppType={appDetails.deploymentAppType}
332-
appType={appDetails.appType}
333311
/>
334312
</div>
335-
</Tippy>
336313
)}
337314
{appDetails?.deploymentAppDeleteRequest && (
338315
<>

0 commit comments

Comments
 (0)