Skip to content

Commit

Permalink
feat: support configure dind parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
zhujian7 committed Apr 28, 2019
1 parent 315acbf commit 08ccf0f
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
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:" $DinDParameter
dockerd-entrypoint.sh dockerd $DinDParameter > /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=172.17.0.0/16",
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
2 changes: 2 additions & 0 deletions release/cyclone-server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ _config:
value: smtp_server
- name: SMTP_USERNAME
value: smtp_username
- name: DIND_PARAMETER
value: --bip=172.17.0.0/16
- name: RECORD_ROTATION_THRESHOLD
value: '50'
- name: NOTIFICATION_URL
Expand Down

0 comments on commit 08ccf0f

Please sign in to comment.