Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pin agent version to 1.62.0 #2790

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .ci/prepare-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ if [[ -z $OPERATOR_VERSION ]]; then
exit 1
fi



JAEGER_VERSION=$(echo $JAEGER_VERSION | tr -d '"')


PREVIOUS_VERSION=$(grep operator= versions.txt | awk -F= '{print $2}')

# change the versions.txt, bump only operator version.
Expand All @@ -20,11 +23,11 @@ sed "s~replaces: jaeger-operator.v.*~replaces: jaeger-operator.v${PREVIOUS_VERSI
sed -i "s~all-in-one:.*~all-in-one:${JAEGER_VERSION}~gi" examples/all-in-one-with-options.yaml

# statefulset-manual-sidecar
sed -i "s~jaeger-agent:.*~jaeger-agent:${JAEGER_VERSION}~gi" examples/statefulset-manual-sidecar.yaml
sed -i "s~jaeger-agent:.*~jaeger-agent:${JAEGER_AGENT_VERSION}~gi" examples/statefulset-manual-sidecar.yaml

# operator-with-tracing
sed -i "s~jaeger-operator:.*~jaeger-operator:${OPERATOR_VERSION}~gi" examples/operator-with-tracing.yaml
sed -i "s~jaeger-agent:.*~jaeger-agent:${JAEGER_VERSION}~gi" examples/operator-with-tracing.yaml
sed -i "s~jaeger-agent:.*~jaeger-agent:${JAEGER_AGENT_VERSION}~gi" examples/operator-with-tracing.yaml

# tracegen
sed -i "s~jaeger-tracegen:.*~jaeger-tracegen:${JAEGER_VERSION}~gi" examples/tracegen.yaml
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ COPY pkg/ pkg/
COPY versions.txt versions.txt

ARG JAEGER_VERSION
ARG JAEGER_AGENT_VERSION
ARG VERSION_PKG
ARG VERSION
ARG VERSION_DATE
Expand All @@ -32,7 +33,7 @@ ARG VERSION_DATE
# see last part of https://docs.docker.com/buildx/working-with-buildx/#build-multi-platform-images
ARG TARGETARCH
# Build
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} GO111MODULE=on go build -ldflags="-X ${VERSION_PKG}.version=${VERSION} -X ${VERSION_PKG}.buildDate=${VERSION_DATE} -X ${VERSION_PKG}.defaultJaeger=${JAEGER_VERSION}" -a -o jaeger-operator main.go
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} GO111MODULE=on go build -ldflags="-X ${VERSION_PKG}.version=${VERSION} -X ${VERSION_PKG}.buildDate=${VERSION_DATE} -X ${VERSION_PKG}.defaultJaeger=${JAEGER_VERSION} -X ${VERSION_PKG}.defaultAgent=${JAEGER_AGENT_VERSION}" -a -o jaeger-operator main.go

FROM quay.io/centos/centos:stream9

Expand Down
8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ BUNDLE_IMG ?= ${IMG_PREFIX}/${OPERATOR_NAME}-bundle:$(addprefix v,${VERSION})
OUTPUT_BINARY ?= "$(BIN_DIR)/jaeger-operator"
VERSION_PKG ?= "github.com/jaegertracing/jaeger-operator/pkg/version"
export JAEGER_VERSION ?= "$(shell grep jaeger= versions.txt | awk -F= '{print $$2}')"
export JAEGER_AGENT_VERSION ?= "1.62.0"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A comment why 1.62.0 is used would be useful


# Kafka and Kafka Operator variables
STORAGE_NAMESPACE ?= "${shell kubectl get sa default -o jsonpath='{.metadata.namespace}' || oc project -q}"
KAFKA_NAMESPACE ?= "kafka"
Expand Down Expand Up @@ -81,7 +83,7 @@ else
GOBIN=$(shell go env GOBIN)
endif

LD_FLAGS ?= "-X $(VERSION_PKG).version=$(VERSION) -X $(VERSION_PKG).buildDate=$(VERSION_DATE) -X $(VERSION_PKG).defaultJaeger=$(JAEGER_VERSION)"
LD_FLAGS ?= "-X $(VERSION_PKG).version=$(VERSION) -X $(VERSION_PKG).buildDate=$(VERSION_DATE) -X $(VERSION_PKG).defaultJaeger=$(JAEGER_VERSION) -X $(VERSION_PKG).defaultAgent=$(JAEGER_AGENT_VERSION)"

# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
ENVTEST ?= $(LOCALBIN)/setup-envtest
Expand Down Expand Up @@ -152,11 +154,11 @@ build: format

.PHONY: docker
docker:
$(VECHO)[ ! -z "$(PIPELINE)" ] || docker build --build-arg=GOPROXY=${GOPROXY} --build-arg=VERSION=${VERSION} --build-arg=JAEGER_VERSION=${JAEGER_VERSION} --build-arg=TARGETARCH=$(GOARCH) --build-arg VERSION_DATE=${VERSION_DATE} --build-arg VERSION_PKG=${VERSION_PKG} -t "$(IMG)" . ${DOCKER_BUILD_OPTIONS}
$(VECHO)[ ! -z "$(PIPELINE)" ] || docker build --build-arg=GOPROXY=${GOPROXY} --build-arg=VERSION=${VERSION} --build-arg=JAEGER_VERSION=${JAEGER_VERSION} --build-arg=JAEGER_AGENT_VERSION=${JAEGER_AGENT_VERSION} --build-arg=TARGETARCH=$(GOARCH) --build-arg VERSION_DATE=${VERSION_DATE} --build-arg VERSION_PKG=${VERSION_PKG} -t "$(IMG)" . ${DOCKER_BUILD_OPTIONS}

.PHONY: dockerx
dockerx:
$(VECHO)[ ! -z "$(PIPELINE)" ] || docker buildx build --push --progress=plain --build-arg=VERSION=${VERSION} --build-arg=JAEGER_VERSION=${JAEGER_VERSION} --build-arg=GOPROXY=${GOPROXY} --build-arg VERSION_DATE=${VERSION_DATE} --build-arg VERSION_PKG=${VERSION_PKG} --platform=$(PLATFORMS) $(IMAGE_TAGS) .
$(VECHO)[ ! -z "$(PIPELINE)" ] || docker buildx build --push --progress=plain --build-arg=VERSION=${VERSION} --build-arg=JAEGER_VERSION=${JAEGER_VERSION} --build-arg=JAEGER_AGENT_VERSION=${JAEGER_AGENT_VERSION} --build-arg=GOPROXY=${GOPROXY} --build-arg VERSION_DATE=${VERSION_DATE} --build-arg VERSION_PKG=${VERSION_PKG} --platform=$(PLATFORMS) $(IMAGE_TAGS) .

.PHONY: push
push:
Expand Down
2 changes: 1 addition & 1 deletion pkg/deployment/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func (a *Agent) Get() *appsv1.DaemonSet {
Spec: corev1.PodSpec{
ImagePullSecrets: a.jaeger.Spec.Agent.ImagePullSecrets,
Containers: []corev1.Container{{
Image: util.ImageName(a.jaeger.Spec.Agent.Image, "jaeger-agent-image"),
Image: util.AgentImageName(a.jaeger.Spec.Agent.Image, "jaeger-agent-image"),
Name: "jaeger-agent-daemonset",
Args: args,
Env: proxy.ReadProxyVarsFromEnv(),
Expand Down
2 changes: 1 addition & 1 deletion pkg/deployment/agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func TestDefaultAgentImage(t *testing.T) {

d := NewAgent(jaeger).Get()
assert.Empty(t, jaeger.Spec.Agent.Image)
assert.Equal(t, "org/custom-agent-image:"+version.Get().Jaeger, d.Spec.Template.Spec.Containers[0].Image)
assert.Equal(t, "org/custom-agent-image:"+version.Get().Agent, d.Spec.Template.Spec.Containers[0].Image)
}

func TestGetDefaultAgentDeployment(t *testing.T) {
Expand Down
12 changes: 12 additions & 0 deletions pkg/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,18 @@
return image
}

func AgentImageName(image, param string) string {
if image == "" {
param := viper.GetString(param)
if strings.IndexByte(param, ':') == -1 {
image = fmt.Sprintf("%s:%s", param, version.Get().Agent)
} else {
image = param
}

Check warning on line 296 in pkg/util/util.go

View check run for this annotation

Codecov / codecov/patch

pkg/util/util.go#L289-L296

Added lines #L289 - L296 were not covered by tests
}
return image

Check warning on line 298 in pkg/util/util.go

View check run for this annotation

Codecov / codecov/patch

pkg/util/util.go#L298

Added line #L298 was not covered by tests
}

// RemoveEmptyVars removes empty variables from the input slice.
func RemoveEmptyVars(envVars []corev1.EnvVar) []corev1.EnvVar {
var notEmpty []corev1.EnvVar
Expand Down
14 changes: 14 additions & 0 deletions pkg/version/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@
version string
buildDate string
defaultJaeger string
defaultAgent string
)

// Version holds this Operator's version as well as the version of some of the components it uses
type Version struct {
Operator string `json:"jaeger-operator"`
BuildDate string `json:"build-date"`
Jaeger string `json:"jaeger-version"`
Agent string `json:"agent-version"`
Go string `json:"go-version"`
}

Expand All @@ -26,6 +28,7 @@
Operator: version,
BuildDate: buildDate,
Jaeger: DefaultJaeger(),
Agent: DefaultAgent(),

Check warning on line 31 in pkg/version/main.go

View check run for this annotation

Codecov / codecov/patch

pkg/version/main.go#L31

Added line #L31 was not covered by tests
Go: runtime.Version(),
}
}
Expand All @@ -51,6 +54,17 @@
return "0.0.0"
}

// DefaultAgent returns the default Jaeger to use when no versions are specified via CLI or configuration
func DefaultAgent() string {
if len(defaultAgent) > 0 {
// this should always be set, as it's specified during the build
return defaultAgent
}

Check warning on line 62 in pkg/version/main.go

View check run for this annotation

Codecov / codecov/patch

pkg/version/main.go#L58-L62

Added lines #L58 - L62 were not covered by tests

// fallback value, useful for tests
return "0.0.0"

Check warning on line 65 in pkg/version/main.go

View check run for this annotation

Codecov / codecov/patch

pkg/version/main.go#L65

Added line #L65 was not covered by tests
}

// DefaultJaegerMajorMinor returns the major.minor format of the default Jaeger version
func DefaultJaegerMajorMinor() string {
version := DefaultJaeger()
Expand Down
Loading