Skip to content

Commit

Permalink
fix(k8s): handle List resources in manifests properly
Browse files Browse the repository at this point in the history
  • Loading branch information
edvald authored and thsig committed Jun 20, 2019
1 parent 4b0e1b9 commit 487637f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions garden-service/src/plugins/kubernetes/status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
V1StatefulSetSpec,
V1DeploymentStatus,
} from "@kubernetes/client-node"
import { some, zip, isArray, isPlainObject, pickBy, mapValues } from "lodash"
import { some, zip, isArray, isPlainObject, pickBy, mapValues, flatten } from "lodash"
import { KubernetesProvider, KubernetesPluginContext } from "./config"
import { isSubset } from "../../util/is-subset"
import { LogEntry } from "../../logger/log-entry"
Expand Down Expand Up @@ -422,8 +422,10 @@ export async function compareDeployedObjects(
ctx: KubernetesPluginContext, api: KubeApi, namespace: string, resources: KubernetesResource[], log: LogEntry,
skipDiff: boolean,
): Promise<ComparisonResult> {
// Unroll any `List` resource types
resources = flatten(resources.map((r: any) => r.apiVersion === "v1" && r.kind === "List" ? r.items : [r]))

// First check if any resources are missing from the cluster.
// Check if any resources are missing from the cluster.
const maybeDeployedObjects = await Bluebird.map(resources, obj => getDeployedObject(ctx, ctx.provider, obj, log))
const deployedObjects = <KubernetesResource[]>maybeDeployedObjects.filter(o => o !== null)

Expand Down

0 comments on commit 487637f

Please sign in to comment.