Skip to content

Commit

Permalink
feat: Split docker image config into name and tag
Browse files Browse the repository at this point in the history
This will allow us to override the tag during release without copyping
over the name and risk divergence.
  • Loading branch information
zqureshi authored and fntlnz committed Nov 4, 2020
1 parent d6d7dca commit f7314fa
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ IMAGE_BUILD_FLAGS ?= "--no-cache"

BPFTRACEVERSION ?= "v0.11.1"

LDFLAGS := -ldflags '-X github.com/iovisor/kubectl-trace/pkg/version.buildTime=$(shell date +%s) -X github.com/iovisor/kubectl-trace/pkg/version.gitCommit=${GIT_COMMIT} -X github.com/iovisor/kubectl-trace/pkg/cmd.ImageNameTag=${IMAGE_TRACERUNNER_COMMIT} -X github.com/iovisor/kubectl-trace/pkg/cmd.InitImageNameTag=${IMAGE_INITCONTAINER_COMMIT}'
LDFLAGS := -ldflags '-X github.com/iovisor/kubectl-trace/pkg/version.buildTime=$(shell date +%s) -X github.com/iovisor/kubectl-trace/pkg/version.gitCommit=${GIT_COMMIT} -X github.com/iovisor/kubectl-trace/pkg/cmd.ImageName=${IMAGE_NAME} -X github.com/iovisor/kubectl-trace/pkg/cmd.ImageTag=${GIT_COMMIT} -X github.com/iovisor/kubectl-trace/pkg/cmd.InitImageName=${IMAGE_NAME_INIT} -X github.com/iovisor/kubectl-trace/pkg/cmd.InitImageTag=${GIT_COMMIT}'
TESTPACKAGES := $(shell go list ./... | grep -v github.com/iovisor/kubectl-trace/integration)

kubectl_trace ?= _output/bin/kubectl-trace
Expand Down
2 changes: 1 addition & 1 deletion integration/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func (k *KubectlTraceSuite) SetUpSuite(c *check.C) {
defer os.RemoveAll(dir)
imageTarPath := filepath.Join(dir, "image.tar")

err = save(cmd.ImageNameTag, imageTarPath)
err = save(cmd.ImageName+":"+cmd.ImageTag, imageTarPath)
c.Assert(err, check.IsNil)

// Copy the bpftrace image to the nodes
Expand Down
16 changes: 10 additions & 6 deletions pkg/cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,14 @@ import (
)

var (
// ImageNameTag represents the default tracerunner image
ImageNameTag = "quay.io/iovisor/kubectl-trace-bpftrace:latest"
// InitImageNameTag represents the default init container image
InitImageNameTag = "quay.io/iovisor/kubectl-trace-init:latest"
// ImageName represents the default tracerunner image
ImageName = "quay.io/iovisor/kubectl-trace-bpftrace"
// ImageTag represents the tag to fetch for ImageName
ImageTag = "latest"
// InitImageName represents the default init container image
InitImageName = "quay.io/iovisor/kubectl-trace-init"
// InitImageTag represents the tag to fetch for InitImage
InitImageTag = "latest"
// DefaultDeadline is the maximum time a tracejob is allowed to run, in seconds
DefaultDeadline = 3600
// DefaultDeadlineGracePeriod is the maximum time to wait to print a map or histogram, in seconds
Expand Down Expand Up @@ -96,8 +100,8 @@ func NewRunOptions(streams genericclioptions.IOStreams) *RunOptions {
IOStreams: streams,

serviceAccount: "default",
imageName: ImageNameTag,
initImageName: InitImageNameTag,
imageName: ImageName + ":" + ImageTag,
initImageName: InitImageName + ":" + InitImageTag,
deadline: int64(DefaultDeadline),
deadlineGracePeriod: int64(DefaultDeadlineGracePeriod),
}
Expand Down

0 comments on commit f7314fa

Please sign in to comment.