Skip to content

Commit

Permalink
[#251] File probes override (#252)
Browse files Browse the repository at this point in the history
This reverts commit 2e9f603

Allows overriding file probes paths in case of container with read only file system.
  • Loading branch information
Jakub Bączek authored Sep 22, 2022
1 parent b49da2e commit c155793
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
6 changes: 5 additions & 1 deletion cmd/flags/file_probe.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ import (

// FileProbe stores flags related to the file probe.
type FileProbe struct {
Enabled bool
Enabled bool
LivenessPath string
ReadinessPath string
}

func (p *FileProbe) String() string {
Expand All @@ -30,4 +32,6 @@ func (p *FileProbe) String() string {

func (p *FileProbe) initFlags() {
flag.BoolVar(&p.Enabled, "file-probe-enabled", true, "If set to true writes files to be used as readiness/liveness probes")
flag.StringVar(&p.LivenessPath, "file-probe-liveness-path", "alive", "File to be used for liveness probe")
flag.StringVar(&p.ReadinessPath, "file-probe-readiness-path", "ready", "File to be used for readiness probe")
}
4 changes: 2 additions & 2 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func RunCmdRoot() {
// run runs the main logic and returns the number of warmup requests actually sent.
func run() int {
if opts.FileProbe.Enabled {
probe.WriteFile("alive")
probe.WriteFile(opts.FileProbe.LivenessPath)
}

var validationError bool
Expand Down Expand Up @@ -156,7 +156,7 @@ func postProcess(requestsSentCounter int) {
}

if opts.FileProbe.Enabled {
probe.WriteFile("ready")
probe.WriteFile(opts.FileProbe.ReadinessPath)
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions docs/about/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ The application receives a number of command-line flags including the requests t
| -http-requests | string | N/A | Http request to be sent. Request is in `<http-method>:<path>[:body]` format. E.g. `post:/ping:{"key": "value"}`. To send multiple requests, simply repeat this flag for each request. Use the notation `:file/xyz.json` if you want to use an external file for the request body. |
| -fail-readiness | bool | false | If set to true readiness will fail if the target did not became ready in time |
| -file-probe-enabled | bool | true | If set to true writes files that can be used as readiness/liveness probes. a file with the name `alive` is created when Mittens starts and a file named `ready` is created when the warmup completes |
| -file-probe-liveness-path | string | alive | File to be used for liveness probe |
| -file-probe-readiness-path | string | ready | File to be used for readiness probe |
| -request-delay-milliseconds | int | 500 | Delay in milliseconds between requests |
| -target-grpc-host | string | localhost | gRPC host to warm up |
| -target-grpc-port | int | 50051 | gRPC port for warm up requests |
Expand Down

0 comments on commit c155793

Please sign in to comment.