diff --git a/changelogs/unreleased/1439-nrb b/changelogs/unreleased/1439-nrb new file mode 100644 index 0000000000..1b84c23f0b --- /dev/null +++ b/changelogs/unreleased/1439-nrb @@ -0,0 +1 @@ +Use `latest` image tag if no version information is provided at build time diff --git a/pkg/install/deployment.go b/pkg/install/deployment.go index e9accb8e92..436f80fb44 100644 --- a/pkg/install/deployment.go +++ b/pkg/install/deployment.go @@ -70,7 +70,7 @@ func WithRestoreOnly() podTemplateOption { func Deployment(namespace string, opts ...podTemplateOption) *appsv1beta1.Deployment { // TODO: Add support for server args c := &podTemplateConfig{ - image: "gcr.io/heptio-images/velero:latest", + image: DefaultImage, } for _, opt := range opts { diff --git a/pkg/install/resources.go b/pkg/install/resources.go index b06d4eaaa9..2ef1452187 100644 --- a/pkg/install/resources.go +++ b/pkg/install/resources.go @@ -28,8 +28,16 @@ import ( "github.com/heptio/velero/pkg/buildinfo" ) +// Use "latest" if the build process didn't supply a version +func imageVersion() string { + if buildinfo.Version == "" { + return "latest" + } + return buildinfo.Version +} + // DefaultImage is the default image to use for the Velero deployment and restic daemonset containers. -var DefaultImage = "gcr.io/heptio-images/velero:" + buildinfo.Version +var DefaultImage = "gcr.io/heptio-images/velero:" + imageVersion() func labels() map[string]string { return map[string]string{