Skip to content

Commit 9c7786f

Browse files
authored
fix: force apply essential manifests on upgrade (#2682)
1 parent 1b69e41 commit 9c7786f

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

src/cmd/apply-teams.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const d = terminal(`cmd:${cmdName}:apply-teams`)
88

99
export const applyTeams = async (): Promise<boolean> => {
1010
d.info('Deploying team namespaces')
11-
const result = await deployEssential(['team=true'])
11+
const result = await deployEssential(['team=true'], true)
1212

1313
if (result) {
1414
d.info('Teams applied')

src/common/hf.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { getParsedArgs, HelmArguments } from './yargs'
1111
import { ProcessOutputTrimmed, Streams } from './zx-enhance'
1212
import { resolve } from 'path'
1313
import { existsSync, mkdirSync, writeFileSync } from 'fs'
14+
import { applyServerSide } from './k8s'
1415

1516
const replaceHFPaths = (output: string, envDir = env.ENV_DIR): string => output.replaceAll('../env', envDir)
1617
export const HF_DEFAULT_SYNC_ARGS = ['sync', '--concurrency=1', '--sync-args', '--disable-openapi-validation --qps=20']
@@ -191,7 +192,7 @@ export const hfTemplate = async (
191192
return template
192193
}
193194

194-
export const deployEssential = async (labelOpts: string[] | null = null) => {
195+
export const deployEssential = async (labelOpts: string[] | null = null, force: boolean = false) => {
195196
const d = terminal('common:hf:applyEssential')
196197
const dir = '/tmp/otomi/'
197198

@@ -215,7 +216,7 @@ export const deployEssential = async (labelOpts: string[] | null = null) => {
215216
}
216217
writeFileSync(templateFile, templateOutput)
217218

218-
await $`kubectl apply --server-side=true -f ${templateFile}`
219+
await applyServerSide(templateFile, force)
219220
}
220221

221222
return true

src/common/runtime-upgrade.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export async function runtimeUpgrade({ when }: RuntimeUpgradeArgs): Promise<void
2121
}
2222

2323
d.info('Deploying essential manifests')
24-
const essentialDeployResult = await deployEssential(['upgrade=true'])
24+
const essentialDeployResult = await deployEssential(['upgrade=true'], true)
2525
if (!essentialDeployResult) {
2626
throw new Error('Failed to update namespaces')
2727
}

0 commit comments

Comments
 (0)