Skip to content

Commit

Permalink
Add base image option to provisioner
Browse files Browse the repository at this point in the history
  • Loading branch information
James Oliver authored and yasker committed Aug 2, 2018
1 parent 47cb5c7 commit 06a81b9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions controller/provisioner.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ func (p *Provisioner) Provision(opts pvController.VolumeOptions) (*v1.Persistent
if err != nil {
return nil, err
}
baseImage := ""
if _, ok := opts.Parameters[types.OptionBaseImage]; ok {
baseImage = opts.Parameters[types.OptionBaseImage]
}
frontend := types.VolumeFrontend(opts.Parameters[types.OptionFrontend])
if frontend == "" {
frontend = types.VolumeFrontendBlockDev
Expand All @@ -74,6 +78,7 @@ func (p *Provisioner) Provision(opts pvController.VolumeOptions) (*v1.Persistent
FromBackup: opts.Parameters[types.OptionFromBackup],
NumberOfReplicas: int64(numberOfReplicas),
StaleReplicaTimeout: int64(staleReplicaTimeout),
BaseImage: baseImage,
}
v, err := p.apiClient.Volume.Create(volReq)
if err != nil {
Expand All @@ -100,6 +105,7 @@ func (p *Provisioner) Provision(opts pvController.VolumeOptions) (*v1.Persistent
types.OptionFromBackup: v.FromBackup,
types.OptionNumberOfReplicas: strconv.FormatInt(v.NumberOfReplicas, 10),
types.OptionStaleReplicaTimeout: strconv.FormatInt(v.StaleReplicaTimeout, 10),
types.OptionBaseImage: v.BaseImage,
},
},
},
Expand Down
1 change: 1 addition & 0 deletions types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const (
OptionFromBackup = "fromBackup"
OptionNumberOfReplicas = "numberOfReplicas"
OptionStaleReplicaTimeout = "staleReplicaTimeout"
OptionBaseImage = "baseImage"
OptionFrontend = "frontend"

DefaultNumberOfReplicas = "3"
Expand Down

0 comments on commit 06a81b9

Please sign in to comment.