Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support configure dind parameter #941

Merged
merged 1 commit into from
Apr 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion build/worker/start.sh
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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