Skip to content

Commit 9eaf448

Browse files
authored
feat(cli): add --proxy-cert flag for proxy SSL inspection support (#511)
Signed-off-by: Dorin Geman <[email protected]>
2 parents fbfb705 + e712f68 commit 9eaf448

14 files changed

+91
-5
lines changed

cmd/cli/commands/install-runner.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ func ensureStandaloneRunnerAvailable(ctx context.Context, printer standalone.Sta
138138
port = standalone.DefaultControllerPortCloud
139139
environment = "cloud"
140140
}
141-
if err := standalone.CreateControllerContainer(ctx, dockerClient, port, host, environment, false, gpu, "", modelStorageVolume, printer, engineKind, debug, false); err != nil {
141+
if err := standalone.CreateControllerContainer(ctx, dockerClient, port, host, environment, false, gpu, "", modelStorageVolume, printer, engineKind, debug, false, ""); err != nil {
142142
return nil, fmt.Errorf("unable to initialize standalone model runner container: %w", err)
143143
}
144144

@@ -172,6 +172,7 @@ type runnerOptions struct {
172172
doNotTrack bool
173173
pullImage bool
174174
pruneContainers bool
175+
proxyCert string
175176
}
176177

177178
// runInstallOrStart is shared logic for install-runner and start-runner commands
@@ -285,7 +286,7 @@ func runInstallOrStart(cmd *cobra.Command, opts runnerOptions, debug bool) error
285286
return fmt.Errorf("unable to initialize standalone model storage: %w", err)
286287
}
287288
// Create the model runner container.
288-
if err := standalone.CreateControllerContainer(cmd.Context(), dockerClient, port, opts.host, environment, opts.doNotTrack, gpu, opts.backend, modelStorageVolume, asPrinter(cmd), engineKind, debug, vllmOnWSL); err != nil {
289+
if err := standalone.CreateControllerContainer(cmd.Context(), dockerClient, port, opts.host, environment, opts.doNotTrack, gpu, opts.backend, modelStorageVolume, asPrinter(cmd), engineKind, debug, vllmOnWSL, opts.proxyCert); err != nil {
289290
return fmt.Errorf("unable to initialize standalone model runner container: %w", err)
290291
}
291292

@@ -300,6 +301,7 @@ func newInstallRunner() *cobra.Command {
300301
var backend string
301302
var doNotTrack bool
302303
var debug bool
304+
var proxyCert string
303305
c := &cobra.Command{
304306
Use: "install-runner",
305307
Short: "Install Docker Model Runner (Docker Engine only)",
@@ -312,6 +314,7 @@ func newInstallRunner() *cobra.Command {
312314
doNotTrack: doNotTrack,
313315
pullImage: true,
314316
pruneContainers: false,
317+
proxyCert: proxyCert,
315318
}, debug)
316319
},
317320
ValidArgsFunction: completion.NoComplete,
@@ -323,6 +326,7 @@ func newInstallRunner() *cobra.Command {
323326
Backend: &backend,
324327
DoNotTrack: &doNotTrack,
325328
Debug: &debug,
329+
ProxyCert: &proxyCert,
326330
})
327331
return c
328332
}

cmd/cli/commands/reinstall-runner.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ func newReinstallRunner() *cobra.Command {
1212
var backend string
1313
var doNotTrack bool
1414
var debug bool
15+
var proxyCert string
1516
c := &cobra.Command{
1617
Use: "reinstall-runner",
1718
Short: "Reinstall Docker Model Runner (Docker Engine only)",
@@ -24,6 +25,7 @@ func newReinstallRunner() *cobra.Command {
2425
doNotTrack: doNotTrack,
2526
pullImage: true,
2627
pruneContainers: true,
28+
proxyCert: proxyCert,
2729
}, debug)
2830
},
2931
ValidArgsFunction: completion.NoComplete,
@@ -35,6 +37,7 @@ func newReinstallRunner() *cobra.Command {
3537
Backend: &backend,
3638
DoNotTrack: &doNotTrack,
3739
Debug: &debug,
40+
ProxyCert: &proxyCert,
3841
})
3942
return c
4043
}

cmd/cli/commands/restart-runner.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ func newRestartRunner() *cobra.Command {
1111
var gpuMode string
1212
var doNotTrack bool
1313
var debug bool
14+
var proxyCert string
1415
c := &cobra.Command{
1516
Use: "restart-runner",
1617
Short: "Restart Docker Model Runner (Docker Engine only)",
@@ -30,6 +31,7 @@ func newRestartRunner() *cobra.Command {
3031
gpuMode: gpuMode,
3132
doNotTrack: doNotTrack,
3233
pullImage: false,
34+
proxyCert: proxyCert,
3335
}, debug)
3436
},
3537
ValidArgsFunction: completion.NoComplete,
@@ -40,6 +42,7 @@ func newRestartRunner() *cobra.Command {
4042
GpuMode: &gpuMode,
4143
DoNotTrack: &doNotTrack,
4244
Debug: &debug,
45+
ProxyCert: &proxyCert,
4346
})
4447
return c
4548
}

cmd/cli/commands/start-runner.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ func newStartRunner() *cobra.Command {
1111
var backend string
1212
var doNotTrack bool
1313
var debug bool
14+
var proxyCert string
1415
c := &cobra.Command{
1516
Use: "start-runner",
1617
Short: "Start Docker Model Runner (Docker Engine only)",
@@ -21,6 +22,7 @@ func newStartRunner() *cobra.Command {
2122
backend: backend,
2223
doNotTrack: doNotTrack,
2324
pullImage: false,
25+
proxyCert: proxyCert,
2426
}, debug)
2527
},
2628
ValidArgsFunction: completion.NoComplete,
@@ -31,6 +33,7 @@ func newStartRunner() *cobra.Command {
3133
Backend: &backend,
3234
DoNotTrack: &doNotTrack,
3335
Debug: &debug,
36+
ProxyCert: &proxyCert,
3437
})
3538
return c
3639
}

cmd/cli/commands/utils.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,14 +182,15 @@ func requireMinArgs(n int, cmdName string, usageArgs string) cobra.PositionalArg
182182
}
183183
}
184184

185-
// runnerOptions holds common runner configuration options
185+
// runnerFlagOptions holds common runner configuration options
186186
type runnerFlagOptions struct {
187187
Port *uint16
188188
Host *string
189189
GpuMode *string
190190
Backend *string
191191
DoNotTrack *bool
192192
Debug *bool
193+
ProxyCert *string
193194
}
194195

195196
// addRunnerFlags adds common runner flags to a command
@@ -213,4 +214,7 @@ func addRunnerFlags(cmd *cobra.Command, opts runnerFlagOptions) {
213214
if opts.Debug != nil {
214215
cmd.Flags().BoolVar(opts.Debug, "debug", false, "Enable debug logging")
215216
}
217+
if opts.ProxyCert != nil {
218+
cmd.Flags().StringVar(opts.ProxyCert, "proxy-cert", "", "Path to a CA certificate file for proxy SSL inspection")
219+
}
216220
}

cmd/cli/docs/reference/docker_model_install-runner.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,15 @@ options:
6666
experimentalcli: false
6767
kubernetes: false
6868
swarm: false
69+
- option: proxy-cert
70+
value_type: string
71+
description: Path to a CA certificate file for proxy SSL inspection
72+
deprecated: false
73+
hidden: false
74+
experimental: false
75+
experimentalcli: false
76+
kubernetes: false
77+
swarm: false
6978
deprecated: false
7079
hidden: false
7180
experimental: false

cmd/cli/docs/reference/docker_model_reinstall-runner.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,15 @@ options:
6666
experimentalcli: false
6767
kubernetes: false
6868
swarm: false
69+
- option: proxy-cert
70+
value_type: string
71+
description: Path to a CA certificate file for proxy SSL inspection
72+
deprecated: false
73+
hidden: false
74+
experimental: false
75+
experimentalcli: false
76+
kubernetes: false
77+
swarm: false
6978
deprecated: false
7079
hidden: false
7180
experimental: false

cmd/cli/docs/reference/docker_model_restart-runner.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,15 @@ options:
5959
experimentalcli: false
6060
kubernetes: false
6161
swarm: false
62+
- option: proxy-cert
63+
value_type: string
64+
description: Path to a CA certificate file for proxy SSL inspection
65+
deprecated: false
66+
hidden: false
67+
experimental: false
68+
experimentalcli: false
69+
kubernetes: false
70+
swarm: false
6271
deprecated: false
6372
hidden: false
6473
experimental: false

cmd/cli/docs/reference/docker_model_start-runner.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,15 @@ options:
5858
experimentalcli: false
5959
kubernetes: false
6060
swarm: false
61+
- option: proxy-cert
62+
value_type: string
63+
description: Path to a CA certificate file for proxy SSL inspection
64+
deprecated: false
65+
hidden: false
66+
experimental: false
67+
experimentalcli: false
68+
kubernetes: false
69+
swarm: false
6170
deprecated: false
6271
hidden: false
6372
experimental: false

cmd/cli/docs/reference/model_install-runner.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Install Docker Model Runner (Docker Engine only)
1313
| `--gpu` | `string` | `auto` | Specify GPU support (none\|auto\|cuda\|rocm\|musa\|cann) |
1414
| `--host` | `string` | `127.0.0.1` | Host address to bind Docker Model Runner |
1515
| `--port` | `uint16` | `0` | Docker container port for Docker Model Runner (default: 12434 for Docker Engine, 12435 for Cloud mode) |
16+
| `--proxy-cert` | `string` | | Path to a CA certificate file for proxy SSL inspection |
1617

1718

1819
<!---MARKER_GEN_END-->

0 commit comments

Comments
 (0)