Skip to content

Commit

Permalink
feat: support configure dind parameter (#941)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhujian7 authored and caicloud-bot committed Apr 30, 2019
1 parent 315acbf commit b108207
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
3 changes: 2 additions & 1 deletion build/worker/start.sh
@@ -1,5 +1,6 @@
#!/bin/sh
set -e
dockerd-entrypoint.sh dockerd > /dev/null &
echo "dind parameter is:" $DIND_PARAMETER
dockerd-entrypoint.sh dockerd $DIND_PARAMETER > /dev/null &
sleep 10
/cyclone-worker
13 changes: 13 additions & 0 deletions cmd/worker/options/options.go
Expand Up @@ -65,6 +65,9 @@ const (

// WorkerTimeout ...
WorkerTimeout = 2 * time.Hour

// DinDParameter represents the cyclone worker DinD starting parameter, e.g. --bip=192.168.1.5/24
DinDParameter = "DIND_PARAMETER"
)

// WorkerOptions ...
Expand Down Expand Up @@ -94,6 +97,9 @@ type WorkerOptions struct {
DockerHost string

Quota Quota

// DinDParameter represents the cyclone worker DinD starting parameter, e.g. --bip=192.168.1.5/24
DinDParameter string
}

// AddFlags adds flags to app.Flags
Expand Down Expand Up @@ -188,6 +194,13 @@ func (opts *WorkerOptions) AddFlags(app *cli.App) {
EnvVar: DockerHost,
Destination: &opts.DockerHost,
},
cli.StringFlag{
Name: "dind-parameter",
Value: "",
Usage: "the cyclone worker DinD starting parameter, e.g. --bip=192.168.1.5/24",
EnvVar: DinDParameter,
Destination: &opts.DinDParameter,
},
}
app.Flags = append(app.Flags, flags...)

Expand Down
4 changes: 4 additions & 0 deletions pkg/cloud/kubernetes/kubernetes.go
Expand Up @@ -333,6 +333,10 @@ func buildK8SEnv(id string, opts options.WorkerOptions) []apiv1.EnvVar {
Name: options.RequestMemory,
Value: opts.Quota[options.ResourceRequestsMemory].String(),
},
{
Name: options.DinDParameter,
Value: opts.DinDParameter,
},
}

return env
Expand Down

0 comments on commit b108207

Please sign in to comment.