Skip to content

Commit

Permalink
fix(k8s): respect pod selector in kubernetes-exec action type
Browse files Browse the repository at this point in the history
  • Loading branch information
vvagaytsev committed Nov 20, 2024
1 parent a370033 commit a80868b
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions core/src/plugins/kubernetes/kubernetes-type/kubernetes-exec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ import type { PluginContext } from "../../../plugin-context.js"
import type { RunActionDefinition, TestActionDefinition } from "../../../plugin/action-types.js"
import type { RunResult } from "../../../plugin/base.js"
import { dedent } from "../../../util/string.js"
import { KubeApi, KubernetesError } from "../api.js"
import { KubernetesError } from "../api.js"
import type { KubernetesPluginContext, KubernetesTargetResourceSpec } from "../config.js"
import { namespaceNameSchema, runPodResourceSchema } from "../config.js"
import { getActionNamespaceStatus } from "../namespace.js"
import { k8sGetRunResult } from "../run-results.js"
import type { SyncableResource } from "../types.js"
import { execInWorkload, readTargetResource } from "../util.js"
import { execInWorkload, getTargetResource } from "../util.js"
import type { KubernetesRunOutputs } from "./config.js"
import { kubernetesRunOutputsSchema } from "./config.js"

Expand All @@ -35,6 +35,7 @@ export interface KubernetesExecRunActionSpec {
command: string[]
namespace?: string
}

export type KubernetesExecRunActionConfig = RunActionConfig<"kubernetes-exec", KubernetesExecRunActionSpec>
export type KubernetesExecRunAction = RunAction<KubernetesExecRunActionConfig, KubernetesRunOutputs>

Expand Down Expand Up @@ -124,7 +125,6 @@ async function readAndExec({
const { resource, command } = action.getSpec()
const k8sCtx = <KubernetesPluginContext>ctx
const provider = k8sCtx.provider
const api = await KubeApi.factory(log, k8sCtx, provider)
const namespaceStatus = await getActionNamespaceStatus({
ctx: k8sCtx,
log,
Expand All @@ -137,9 +137,11 @@ async function readAndExec({
let target: SyncableResource

try {
target = await readTargetResource({
api,
namespace,
target = await getTargetResource({
ctx,
log,
provider,
action,
query: resource,
})
} catch (err) {
Expand Down

0 comments on commit a80868b

Please sign in to comment.