1
0
mirror of https://github.com/go-micro/go-micro.git synced 2024-12-12 08:23:58 +02:00
go-micro/util/kubernetes/client/options.go
ben-toogood d8110b70a3
Runtime custom docker img (#1168)
* Add DeploymentOptions to K8s Client

* WithBaseImage for  Runtime

* Revert Change

* Fix sequencing
2020-02-06 08:52:25 +00:00

53 lines
1.0 KiB
Go

package client
type DeploymentOptions struct {
BaseImage string
}
type LogOptions struct {
Params map[string]string
}
type WatchOptions struct {
Params map[string]string
}
type LogOption func(*LogOptions)
type WatchOption func(*WatchOptions)
type DeploymentOption func(*DeploymentOptions)
// LogParams provides additional params for logs
func LogParams(p map[string]string) LogOption {
return func(l *LogOptions) {
l.Params = p
}
}
// WatchParams used for watch params
func WatchParams(p map[string]string) WatchOption {
return func(w *WatchOptions) {
w.Params = p
}
}
// WithBaseImage sets the base image for the deployment
func WithBaseImage(img string) DeploymentOption {
return func(d *DeploymentOptions) {
d.BaseImage = img
}
}
// NewDeploymentOptions returns an initialized DeploymentOptions
func NewDeploymentOptions(opts []DeploymentOption) DeploymentOptions {
var options DeploymentOptions
for _, o := range opts {
o(&options)
}
if options.BaseImage == "" {
options.BaseImage = DefaultImage
}
return options
}