Skip to content

Commit

Permalink
fix(kubernetes-module): fix regression
Browse files Browse the repository at this point in the history
This fixes a regression introduced when we added hot reloading support
for the `kubernetes-module` module type.

Also added an integ test case to guard against this regression in the
future.
  • Loading branch information
thsig committed Oct 22, 2020
1 parent 02bf43d commit f1c521f
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 2 deletions.
3 changes: 1 addition & 2 deletions core/src/plugins/kubernetes/kubernetes-module/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,7 @@ async function prepareManifestsForHotReload({
}
}

const hotReloadSpec = getHotReloadSpec(service)

const hotReloadSpec = hotReload ? getHotReloadSpec(service) : null
if (hotReload && hotReloadSpec) {
const resourceSpec = getServiceResourceSpec(module, undefined)
configureHotReload({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ manifests:
containers:
- name: busybox
image: busybox:1.31.1
args: [sleep, "100"]
ports:
- containerPort: 80
serviceResource:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ manifests:
containers:
- name: busybox
image: busybox:1.31.1
args: [sleep, "100"]
ports:
- containerPort: 80
env:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ describe("validateKubernetesModule", () => {
{
image: "busybox:1.31.1",
name: "busybox",
args: ["sleep", "100"],
ports: [
{
containerPort: 80,
Expand Down Expand Up @@ -180,6 +181,7 @@ describe("validateKubernetesModule", () => {
{
image: "busybox:1.31.1",
name: "busybox",
args: ["sleep", "100"],
ports: [
{
containerPort: 80,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,21 @@ describe("kubernetes-module handlers", () => {
})

describe("deployKubernetesService", () => {
it("should successfully deploy when serviceResource doesn't have a containerModule", async () => {
const graph = await garden.getConfigGraph(garden.log)
const service = graph.getService("module-simple")
const deployParams = {
ctx,
log: garden.log,
module: service.module,
service,
force: false,
hotReload: false,
runtimeContext: emptyRuntimeContext,
}
await deployKubernetesService(deployParams)
})

it("should toggle hot reload", async () => {
const graph = await garden.getConfigGraph(garden.log)
const service = graph.getService("with-source-module")
Expand Down

0 comments on commit f1c521f

Please sign in to comment.