github.com/kubernetes-incubator/kube-aws@v0.16.4/pkg/api/image.go (about) 1 package api 2 3 import ( 4 "fmt" 5 ) 6 7 type Image struct { 8 Repo string `yaml:"repo,omitempty"` 9 RktPullDocker bool `yaml:"rktPullDocker,omitempty"` 10 Tag string `yaml:"tag,omitempty"` 11 } 12 13 func (i *Image) MergeIfEmpty(other Image) { 14 if i.Repo == "" || i.Tag == "" { 15 i.Repo = other.Repo 16 i.Tag = other.Tag 17 i.RktPullDocker = other.RktPullDocker 18 } 19 } 20 21 func (i *Image) Options() string { 22 if i.RktPullDocker { 23 return "--insecure-options=image " 24 } 25 return "" 26 } 27 28 func (i *Image) RktRepo() string { 29 if i.RktPullDocker { 30 return fmt.Sprintf("docker://%s:%s", i.Repo, i.Tag) 31 } 32 return fmt.Sprintf("%s:%s", i.Repo, i.Tag) 33 } 34 35 func (i *Image) RktRepoWithoutTag() string { 36 if i.RktPullDocker { 37 return fmt.Sprintf("docker://%s", i.Repo) 38 } 39 return i.Repo 40 } 41 42 func (i *Image) RepoWithTag() string { 43 return fmt.Sprintf("%s:%s", i.Repo, i.Tag) 44 }