Skip to content

Commit

Permalink
Use latest container image when version is empty (#1439)
Browse files Browse the repository at this point in the history
When using `velero install`, the image used should be a reasonable
default, even if buildinfo.Version is missing (such as when using `go
build` directly).

Signed-off-by: Nolan Brubaker <brubakern@vmware.com>
  • Loading branch information
nrb authored and KubeKween committed May 3, 2019
1 parent 26d86f5 commit 884e512
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions changelogs/unreleased/1439-nrb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Use `latest` image tag if no version information is provided at build time
2 changes: 1 addition & 1 deletion pkg/install/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
10 changes: 9 additions & 1 deletion pkg/install/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down

0 comments on commit 884e512

Please sign in to comment.