Skip to content

Commit

Permalink
feat: add container name
Browse files Browse the repository at this point in the history
  • Loading branch information
CasLubbers committed Nov 15, 2024
1 parent 97752aa commit 57a810a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
18 changes: 12 additions & 6 deletions src/cmd/apply-as-apps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,16 +136,22 @@ const writeApplicationManifest = async (release: HelmRelease, otomiVersion: stri
d.info(`Argocd-application-controller has been OOMKilled`)
const config = values as unknown as Record<string, any>
const controllerResources = config.controller?.resources
d.info(`config: ${JSON.stringify(config, null, 2)}`)
d.info(`config: ${controllerResources}`)
d.info(`config: ${JSON.stringify(controllerResources, null, 2)}`)

if (controllerResources) {
const cpuRequest = controllerResources.request?.cpu
const memoryRequest = controllerResources.request?.memory
const cpuLimit = controllerResources.limit?.cpu
const memoryLimit = controllerResources.limit?.request
d.info(`resources: ${cpuRequest} ${memoryRequest} ${cpuLimit} ${memoryLimit}`)
await patchStatefulSetResources(
'argocd-application-controller',
'application-controller',
'argocd',
controllerResources.request?.cpu,
controllerResources.request?.memory,
controllerResources.limit?.cpu,
controllerResources.limit?.request,
cpuRequest,
memoryRequest,
cpuLimit,
memoryLimit,
appV1Api,
)
}
Expand Down
3 changes: 2 additions & 1 deletion src/common/k8s.ts
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ export async function hasStsOOMKilledPods(

export async function patchStatefulSetResources(
statefulSetName: string,
containerName: string,
namespace: string,
cpuRequest: string,
memoryRequest: string,
Expand All @@ -359,7 +360,7 @@ export async function patchStatefulSetResources(
spec: {
containers: [
{
name: statefulSetName, // Adjust if the container name differs from StatefulSet name
name: containerName, // Adjust if the container name differs from StatefulSet name
resources: {
requests: {
cpu: cpuRequest,
Expand Down

0 comments on commit 57a810a

Please sign in to comment.