transformers: add Opt variable as object data

This is so you can set Opts on instance creation of
kubernetes.Kubernetes and openshift.Openshift. This is useful
so that we can pass option information arround without having
to do it on the call stack every time.
This commit is contained in:
Dusty Mabe 2016-10-27 10:41:34 -04:00
parent c5e07f4926
commit 51dea8283a
No known key found for this signature in database
GPG Key ID: 3302DBD73952E671
2 changed files with 5 additions and 3 deletions

View File

@ -233,12 +233,12 @@ func Down(c *cli.Context) {
func getTransformer(opt kobject.ConvertOptions) transformer.Transformer {
var t transformer.Transformer
if opt.Provider == "kubernetes" {
// Create/Init new Kubernetes object
t = &kubernetes.Kubernetes{}
// Create/Init new Kubernetes object with CLI opts
t = &kubernetes.Kubernetes{Opt: opt}
} else {
// Create/Init new OpenShift object that is initialized with a newly
// created Kubernetes object. Openshift inherits from Kubernetes
t = &openshift.OpenShift{kubernetes.Kubernetes{}}
t = &openshift.OpenShift{kubernetes.Kubernetes{Opt: opt}}
}
return t
}

View File

@ -43,6 +43,8 @@ import (
)
type Kubernetes struct {
// the user provided options from the command line
Opt kobject.ConvertOptions
}
// timeout is how long we'll wait for the termination of kubernetes resource to be successful