INFRA-4076 | Add zoneaffinity support to OCI (#740)

This commit is contained in:
Ashvin S
2024-12-24 15:16:11 +05:30
committed by GitHub
parent bcd9a73a5e
commit b53091f1f3
3 changed files with 45 additions and 6 deletions

View File

@@ -19,7 +19,11 @@ import { Environment } from '../../constants/Environment';
import { InfoOutlined } from '@material-ui/icons';
import WarningDialog from '../../components/common/WarningDialog';
import { Manifest } from '@src/types/Manifest';
import { ALL_AWS_MUMBAI_AZ, ciliumEnabledCluster } from '@src/coreform/deployment/constants';
import {
ALL_AWS_MUMBAI_AZ,
ALL_OCI_MUMBAI_FD,
ciliumEnabledCluster,
} from '@src/coreform/deployment/constants';
import { CiliumServiceEntry } from '@src/types/Deployment';
import { useSelector } from 'react-redux';
import { RootState } from '@src/store';
@@ -266,6 +270,22 @@ const AdvancedDeploymentConfigurationCard = (
}
}, [isSpotNodeEnabled, gpu.value]);
useEffect(() => {
if (values.cluster.startsWith('apm1')) {
setFieldValue('deployment.zoneAffinity', ALL_OCI_MUMBAI_FD);
} else {
setFieldValue('deployment.zoneAffinity', ALL_AWS_MUMBAI_AZ);
}
}, [values.cluster]);
const getClusterZone = (cluster: string): string[] => {
if (cluster.startsWith('apm1')) {
return ALL_OCI_MUMBAI_FD;
} else {
return ALL_AWS_MUMBAI_AZ;
}
};
return (
<>
<CardLayout heading={'Advanced Deployment Configuration'}>
@@ -275,7 +295,7 @@ const AdvancedDeploymentConfigurationCard = (
label={'Availability Zones'}
className={'multi-select-margin-top'}
>
{toMenuItems(ALL_AWS_MUMBAI_AZ)}
{toMenuItems(getClusterZone(values.cluster))}
</FormikMultiSelect>
{spotNodeEnabledEnvironments.has(props.environment) ? (
<FormControlLabel

View File

@@ -102,4 +102,8 @@ export const ciliumEnabledCluster = new Set([
export const AP_SOUTH_1A = 'ap-south-1a';
export const AP_SOUTH_1B = 'ap-south-1b';
export const AP_SOUTH_1C = 'ap-south-1c';
export const FAULT_DOMAIN_1 = 'FAULT-DOMAIN-1';
export const FAULT_DOMAIN_2 = 'FAULT-DOMAIN-2';
export const FAULT_DOMAIN_3 = 'FAULT-DOMAIN-3';
export const ALL_AWS_MUMBAI_AZ = [AP_SOUTH_1A, AP_SOUTH_1B, AP_SOUTH_1C];
export const ALL_OCI_MUMBAI_FD = [FAULT_DOMAIN_1, FAULT_DOMAIN_2, FAULT_DOMAIN_3];

View File

@@ -4,10 +4,10 @@ import {
} from '../coreform/deployment/DeploymentBasicTab';
import * as yup from './yupArrayExtensions';
import {
environmentsNeedingAllMetadataFields,
disasterRecovery,
environmentsNeedingAllMetadataFields,
} from '../components/manifest/MetadataForm';
import { CommonApiGateway, Loadbalancer, RateLimitRules } from '../types/Types';
import { Loadbalancer, RateLimitRules } from '../types/Types';
import { EfsVolume, FsxMount } from '../types/Deployment';
import { elasticCacheValidationSchema } from './elasticCacheValidationSchema';
import { awsAccessValidationSchema } from '@src/models/awsAccessValidationSchema';
@@ -17,7 +17,11 @@ import { s3BucketsValidationSchema } from './s3BucketsValidationSchema';
import { flinkValidationSchema } from '@src/models/FlinkValidationSchema';
import { databaseValidationSchema } from '@src/models/DatabaseValidationSchema';
import { parseValue } from '@src/helper/ChangeRequest';
import { clusterZoneMapping } from '@src/coreform/deployment/constants';
import {
ALL_AWS_MUMBAI_AZ,
ALL_OCI_MUMBAI_FD,
clusterZoneMapping,
} from '@src/coreform/deployment/constants';
const pattern = {
url: yup
@@ -806,7 +810,18 @@ const deploymentValidationSchema = yup.object({
efs: efsValidationSchema.default(undefined),
fsx: fsxValidationSchema.default(undefined),
perfUtility: perfValidationSchema.default(undefined),
zoneAffinity: yup.array().of(yup.string().required('is Required')).min(1),
zoneAffinity: yup
.array()
.of(yup.string().required('is Required'))
.min(1)
.test('correct_zone', 'Invalid Zone selected', (value, context) => {
if (value === undefined) {
return true;
}
const cluster = context?.options?.context?.value?.cluster;
const zone: string[] = cluster.startsWith('apm1') ? ALL_OCI_MUMBAI_FD : ALL_AWS_MUMBAI_AZ;
return value.every(element => zone.includes(element));
}),
});
const docdbValidationScheme = yup.object({