Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions src/server/lib/helm/helm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,7 @@ export async function helmOrgAppDeployStep(deploy: Deploy): Promise<Record<strin
);

// add toleration for static envs
customValues.push(
`${resourceType}.tolerations[0].key=static_env`,
`${resourceType}.tolerations[0].operator=Equal`,
`${resourceType}.tolerations[0].value=yes`,
`${resourceType}.tolerations[0].effect=NoSchedule`
);
customValues.push(...generateTolerationsCustomValues(`${resourceType}.tolerations`, staticEnvTolerations));
}
let version = constructImageVersion(deploy.dockerImage);
customValues.push(`${resourceType}.appImage=${deploy.dockerImage}`, `version=${version}`);
Expand Down
13 changes: 5 additions & 8 deletions src/server/lib/kubernetes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { APP_ENV, TMP_PATH } from 'shared/config';
import fs from 'fs';
import GlobalConfigService from 'server/services/globalConfig';
import { setupServiceAccountWithRBAC } from './kubernetes/rbac';
import { staticEnvTolerations } from './helm/constants';

const logger = rootLogger.child({
filename: 'lib/kubernetes.ts',
Expand Down Expand Up @@ -1140,14 +1141,7 @@ export function generateDeployManifests(
initContainers,
volumes,
...(build?.isStatic && {
tolerations: [
{
key: 'static_env',
operator: 'Equal',
value: 'yes',
effect: 'NoSchedule',
},
],
tolerations: staticEnvTolerations,
}),
enableServiceLinks: false,
},
Expand Down Expand Up @@ -1870,6 +1864,9 @@ function generateSingleDeploymentManifest({
affinity,
...(nodeSelector && { nodeSelector }),
containers,
...(build?.isStatic && {
tolerations: staticEnvTolerations,
}),
},
},
},
Expand Down
7 changes: 2 additions & 5 deletions src/server/lib/nativeHelm/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { ChartType, REPO_MAPPINGS, STATIC_ENV_JOB_TTL_SECONDS, HELM_JOB_TIMEOUT_
import { mergeKeyValueArrays, getResourceType } from 'shared/utils';
import { merge } from 'lodash';
import { renderTemplate, generateTolerationsCustomValues, generateNodeSelector } from 'server/lib/helm/utils';
import { staticEnvTolerations } from 'server/lib/helm/constants';
import {
createServiceAccountUsingExistingFunction,
setupDeployServiceAccountInNamespace,
Expand Down Expand Up @@ -730,10 +731,7 @@ export async function constructHelmCustomValues(deploy: Deploy, chartType: Chart
`${resourceType}.customNodeAffinity.requiredDuringSchedulingIgnoredDuringExecution.nodeSelectorTerms[0].matchExpressions[0].key=eks.amazonaws.com/capacityType`,
`${resourceType}.customNodeAffinity.requiredDuringSchedulingIgnoredDuringExecution.nodeSelectorTerms[0].matchExpressions[0].operator=In`,
`${resourceType}.customNodeAffinity.requiredDuringSchedulingIgnoredDuringExecution.nodeSelectorTerms[0].matchExpressions[0].values[0]=ON_DEMAND`,
`${resourceType}.tolerations[0].key=static_env`,
`${resourceType}.tolerations[0].operator=Equal`,
`${resourceType}.tolerations[0].value=yes`,
`${resourceType}.tolerations[0].effect=NoSchedule`
...generateTolerationsCustomValues(`${resourceType}.tolerations`, staticEnvTolerations)
);
}
} else if (chartType === ChartType.PUBLIC) {
Expand All @@ -758,7 +756,6 @@ export async function constructHelmCustomValues(deploy: Deploy, chartType: Chart
if (build?.isStatic) {
const { tolerations, nodeSelector } = configs[chartName] || {};
if (tolerations) {
const staticEnvTolerations = [{ key: 'static_env', operator: 'Equal', value: 'yes', effect: 'NoSchedule' }];
customValues = customValues.concat(generateTolerationsCustomValues(tolerations, staticEnvTolerations));
}
if (nodeSelector) {
Expand Down