Skip to content

Commit

Permalink
Feature: allow replacing image when in sync mode (#6236)
Browse files Browse the repository at this point in the history
* feat: allow replacing image when in sync mode

* docs: re-generate docs

---------

Co-authored-by: Vladimir Vagaytsev <vladimir.vagaitsev@gmail.com>
  • Loading branch information
to266 and vvagaytsev authored Jul 3, 2024
1 parent 8632f7f commit 444e63c
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
6 changes: 6 additions & 0 deletions core/src/plugins/kubernetes/sync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ export interface KubernetesDeployOverrideSpec {
target?: KubernetesTargetResourceSpec
command?: string[]
args?: string[]
image?: string
}

export interface KubernetesDeploySyncSpec {
Expand All @@ -176,6 +177,7 @@ const syncModeOverrideSpec = () =>
),
command: joi.array().items(joi.string()).description("Override the command/entrypoint in the matched container."),
args: joi.array().items(joi.string()).description("Override the args in the matched container."),
image: joi.string().description("Override the image of the matched container."),
})

export const kubernetesDeploySyncSchema = () =>
Expand Down Expand Up @@ -331,6 +333,7 @@ export async function configureSyncMode({
Override configuration:
${(override.command?.length ?? 0) > 0 ? `Command: ${override.command?.join(" ")}` : ""}
${(override.args?.length ?? 0) > 0 ? `Args: ${override.args?.join(" ")}` : ""}
${override.image?.length ?? 0 ? `Image: ${override.image}` : ""}
`,
})
}
Expand Down Expand Up @@ -406,6 +409,9 @@ export async function configureSyncMode({
if (override.args) {
targetContainer.args = override.args
}
if (override.image) {
targetContainer.image = override.image
}

updatedTargets[key] = resolved
}
Expand Down
10 changes: 10 additions & 0 deletions docs/reference/action-types/Deploy/helm.md
Original file line number Diff line number Diff line change
Expand Up @@ -880,6 +880,16 @@ Override the args in the matched container.
| --------------- | -------- |
| `array[string]` | No |

### `spec.sync.overrides[].image`

[spec](#spec) > [sync](#specsync) > [overrides](#specsyncoverrides) > image

Override the image of the matched container.

| Type | Required |
| -------- | -------- |
| `string` | No |

### `spec.localMode`

[spec](#spec) > localMode
Expand Down
10 changes: 10 additions & 0 deletions docs/reference/action-types/Deploy/kubernetes.md
Original file line number Diff line number Diff line change
Expand Up @@ -934,6 +934,16 @@ Override the args in the matched container.
| --------------- | -------- |
| `array[string]` | No |

### `spec.sync.overrides[].image`

[spec](#spec) > [sync](#specsync) > [overrides](#specsyncoverrides) > image

Override the image of the matched container.

| Type | Required |
| -------- | -------- |
| `string` | No |

### `spec.localMode`

[spec](#spec) > localMode
Expand Down

0 comments on commit 444e63c

Please sign in to comment.