Rename CopyDockerImage to CopyImage

This commit is contained in:
John Gardiner Myers 2021-05-30 16:14:54 -07:00
parent 10cc4392c3
commit d70a11aaa6
4 changed files with 19 additions and 19 deletions

View File

@ -3,10 +3,10 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
go_library(
name = "go_default_library",
srcs = [
"copydockerimage.go",
"copydockerimage_fitask.go",
"copyfile.go",
"copyfile_fitask.go",
"copyimage.go",
"copyimage_fitask.go",
"docker_api.go",
"docker_cli.go",
],

View File

@ -23,23 +23,23 @@ import (
"k8s.io/kops/upup/pkg/fi"
)
// CopyDockerImage copies a docker image from a source registry, to a target registry,
// CopyImage copies a docker image from a source registry, to a target registry,
// typically used for highly secure clusters.
// +kops:fitask
type CopyDockerImage struct {
type CopyImage struct {
Name *string
SourceImage *string
TargetImage *string
Lifecycle *fi.Lifecycle
}
var _ fi.CompareWithID = &CopyDockerImage{}
var _ fi.CompareWithID = &CopyImage{}
func (e *CopyDockerImage) CompareWithID() *string {
func (e *CopyImage) CompareWithID() *string {
return e.Name
}
func (e *CopyDockerImage) Find(c *fi.Context) (*CopyDockerImage, error) {
func (e *CopyImage) Find(c *fi.Context) (*CopyImage, error) {
return nil, nil
// The problem here is that we can tag a local image with the remote tag, but there is no way to know
@ -80,7 +80,7 @@ func (e *CopyDockerImage) Find(c *fi.Context) (*CopyDockerImage, error) {
//}
//
//if sourceImage.ID == targetImage.ID {
// actual := &CopyDockerImage{}
// actual := &CopyImage{}
// actual.Name = e.Name
// actual.SourceImage = e.SourceImage
// actual.TargetImage = e.TargetImage
@ -95,11 +95,11 @@ func (e *CopyDockerImage) Find(c *fi.Context) (*CopyDockerImage, error) {
//return nil, nil
}
func (e *CopyDockerImage) Run(c *fi.Context) error {
func (e *CopyImage) Run(c *fi.Context) error {
return fi.DefaultDeltaRunMethod(e, c)
}
func (s *CopyDockerImage) CheckChanges(a, e, changes *CopyDockerImage) error {
func (s *CopyImage) CheckChanges(a, e, changes *CopyImage) error {
if fi.StringValue(e.Name) == "" {
return fi.RequiredField("Name")
}
@ -112,7 +112,7 @@ func (s *CopyDockerImage) CheckChanges(a, e, changes *CopyDockerImage) error {
return nil
}
func (_ *CopyDockerImage) Render(c *fi.Context, a, e, changes *CopyDockerImage) error {
func (_ *CopyImage) Render(c *fi.Context, a, e, changes *CopyImage) error {
api, err := newDockerAPI()
if err != nil {
return err

View File

@ -24,28 +24,28 @@ import (
"k8s.io/kops/upup/pkg/fi"
)
// CopyDockerImage
// CopyImage
var _ fi.HasLifecycle = &CopyDockerImage{}
var _ fi.HasLifecycle = &CopyImage{}
// GetLifecycle returns the Lifecycle of the object, implementing fi.HasLifecycle
func (o *CopyDockerImage) GetLifecycle() *fi.Lifecycle {
func (o *CopyImage) GetLifecycle() *fi.Lifecycle {
return o.Lifecycle
}
// SetLifecycle sets the Lifecycle of the object, implementing fi.SetLifecycle
func (o *CopyDockerImage) SetLifecycle(lifecycle fi.Lifecycle) {
func (o *CopyImage) SetLifecycle(lifecycle fi.Lifecycle) {
o.Lifecycle = &lifecycle
}
var _ fi.HasName = &CopyDockerImage{}
var _ fi.HasName = &CopyImage{}
// GetName returns the Name of the object, implementing fi.HasName
func (o *CopyDockerImage) GetName() *string {
func (o *CopyImage) GetName() *string {
return o.Name
}
// String is the stringer function for the task, producing readable output using fi.TaskAsString
func (o *CopyDockerImage) String() string {
func (o *CopyImage) String() string {
return fi.TaskAsString(o)
}

View File

@ -72,7 +72,7 @@ func (l *Loader) addAssetCopyTasks(assets []*assets.ImageAsset, lifecycle *fi.Li
Tasks: l.tasks,
}
copyImageTask := &assettasks.CopyDockerImage{
copyImageTask := &assettasks.CopyImage{
Name: fi.String(asset.DownloadLocation),
SourceImage: fi.String(asset.CanonicalLocation),
TargetImage: fi.String(asset.DownloadLocation),