Skip to content

Commit cb2ccdd

Browse files
committed
Make sure the DeclarativeHealthcheckPath is valid
see comments for further details
1 parent 05a186b commit cb2ccdd

File tree

1 file changed

+25
-15
lines changed

1 file changed

+25
-15
lines changed

world/components.go

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -694,15 +694,15 @@ func (maker commonComponentMaker) RouteEmitterN(n int, fs ...func(config *routee
694694
BBSCACertFile: maker.bbsSSL.CACert,
695695
CommunicationTimeout: durationjson.Duration(30 * time.Second),
696696
ConsulDownModeNotificationInterval: durationjson.Duration(time.Minute),
697-
LockTTL: durationjson.Duration(locket.DefaultSessionTTL),
698-
NATSUsername: "nats",
699-
NATSPassword: "nats",
700-
RouteEmittingWorkers: 20,
701-
SyncInterval: durationjson.Duration(time.Minute),
702-
TCPRouteTTL: durationjson.Duration(2 * time.Minute),
703-
EnableTCPEmitter: false,
704-
EnableInternalEmitter: false,
705-
RegisterDirectInstanceRoutes: false,
697+
LockTTL: durationjson.Duration(locket.DefaultSessionTTL),
698+
NATSUsername: "nats",
699+
NATSPassword: "nats",
700+
RouteEmittingWorkers: 20,
701+
SyncInterval: durationjson.Duration(time.Minute),
702+
TCPRouteTTL: durationjson.Duration(2 * time.Minute),
703+
EnableTCPEmitter: false,
704+
EnableInternalEmitter: false,
705+
RegisterDirectInstanceRoutes: false,
706706
}
707707

708708
for _, f := range fs {
@@ -1327,6 +1327,14 @@ func (maker v1ComponentMaker) RepN(n int, modifyConfigFuncs ...func(*repconfig.R
13271327
cachePath := path.Join(tmpDir, "cache")
13281328
Expect(os.Mkdir(cachePath, 0777)).To(Succeed())
13291329

1330+
// garden 1.16.5 checks the source of the bind mount for mount options.
1331+
// Furthermore Rep in version 1.25.2 bind mounted the healthcheck binaries
1332+
// unconditionally without paying attention to
1333+
// EnableDeclarativeHealthcheck. We need to ensure that the source exist.
1334+
// see
1335+
// https://github.com/cloudfoundry/guardian/commit/1407257d989b483c64ea7d7cb6ea7d071fa75e84
1336+
healthcheckDummyDir := TempDir("healthcheck")
1337+
13301338
repConfig := repconfig.RepConfig{
13311339
AdvertiseDomain: "cell.service.cf.internal",
13321340
BBSClientSessionCacheSize: 0,
@@ -1361,6 +1369,7 @@ func (maker v1ComponentMaker) RepN(n int, modifyConfigFuncs ...func(*repconfig.R
13611369
ContainerReapInterval: durationjson.Duration(time.Minute),
13621370
ContainerInodeLimit: 200000,
13631371
EnableDeclarativeHealthcheck: false,
1372+
DeclarativeHealthcheckPath: healthcheckDummyDir,
13641373
MaxCacheSizeInBytes: 10 * 1024 * 1024 * 1024,
13651374
SkipCertVerify: false,
13661375
HealthyMonitoringInterval: durationjson.Duration(30 * time.Second),
@@ -1383,12 +1392,12 @@ func (maker v1ComponentMaker) RepN(n int, modifyConfigFuncs ...func(*repconfig.R
13831392
CSIPaths: []string{"/var/vcap/data/csiplugins"},
13841393
CSIMountRootDir: "/var/vcap/data/csimountroot",
13851394

1386-
EnableUnproxiedPortMappings: true,
1387-
GardenNetwork: "tcp",
1388-
GardenAddr: maker.addresses.GardenLinux,
1389-
ContainerMaxCpuShares: 1024,
1390-
CachePath: cachePath,
1391-
TempDir: tmpDir,
1395+
EnableUnproxiedPortMappings: true,
1396+
GardenNetwork: "tcp",
1397+
GardenAddr: maker.addresses.GardenLinux,
1398+
ContainerMaxCpuShares: 1024,
1399+
CachePath: cachePath,
1400+
TempDir: tmpDir,
13921401
GardenHealthcheckProcessPath: "/bin/sh",
13931402
GardenHealthcheckProcessArgs: []string{"-c", "echo", "foo"},
13941403
GardenHealthcheckProcessUser: "vcap",
@@ -1428,6 +1437,7 @@ func (maker v1ComponentMaker) RepN(n int, modifyConfigFuncs ...func(*repconfig.R
14281437
"-config", configFile.Name()),
14291438
Cleanup: func() {
14301439
os.RemoveAll(tmpDir)
1440+
os.RemoveAll(healthcheckDummyDir)
14311441
},
14321442
})
14331443
}

0 commit comments

Comments
 (0)