-
Notifications
You must be signed in to change notification settings - Fork 30
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
Update tempo to 2.5.0 #958
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #958 +/- ##
==========================================
- Coverage 74.37% 73.35% -1.02%
==========================================
Files 104 105 +1
Lines 6372 6486 +114
==========================================
+ Hits 4739 4758 +19
- Misses 1346 1438 +92
- Partials 287 290 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
The ownership of
I think we'll need an init container to adjust existing installations. |
Signed-off-by: Pavol Loffay <[email protected]>
Is this not something solved by the securityContext? |
good that we have the upgrade tests an instance created with 2.4.2 and upgraded to 2.5.0 throws
|
PR in the tempo helm chart grafana/helm-charts#3161 (comment) |
The issue does not seem to occur on OCP. The OCP seems to be setting this
Tested with kubectl apply -f - <<EOF
apiVersion: tempo.grafana.com/v1alpha1
kind: TempoStack
metadata:
name: simplest
spec:
managementState: Managed
images:
tempo: docker.io/grafana/tempo:2.4.1
storage:
secret:
name: minio-test
type: s3
storageSize: 1Gi
resources:
total:
limits:
memory: 2Gi
cpu: 2000m
template:
queryFrontend:
jaegerQuery:
enabled: true
EOF reported some data and then changed to
|
Signed-off-by: Pavol Loffay <[email protected]>
Signed-off-by: Pavol Loffay <[email protected]>
Signed-off-by: Pavol Loffay <[email protected]>
|
||
func upgrade0_11_0_pvcs(ctx context.Context, u Upgrade, tempo metav1.ObjectMeta, nodeSelector map[string]string, image string, pvcs *corev1.PersistentVolumeClaimList) error { | ||
// keep the jobs around for 1 day | ||
ttl := int32(60 * 60 * 24) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this TTL necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
otherwise the job would hang there forever
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small comment but other than that LGTM
// so the issue does not happen on OpenShift. | ||
func upgrade0_11_0(ctx context.Context, u Upgrade, tempo *v1alpha1.TempoStack) error { | ||
// do nothing on OpenShift | ||
if u.CtrlConfig.Gates.OpenShift.OpenShiftRoute { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
funny way of detect openshift :D
Signed-off-by: Pavol Loffay <[email protected]>
Signed-off-by: Pavol Loffay <[email protected]>
@@ -18,6 +18,7 @@ COPY . . | |||
|
|||
# Build | |||
ARG OPERATOR_VERSION | |||
ARG TEMPO_VERSION |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rubenvp8510 do you know how OPERATOR_VERSION
is passed in GHA when the image is published? We might need to update the workflow to include the tempo version
@@ -159,7 +159,7 @@ run: manifests generate ## Run a controller from your host. | |||
|
|||
.PHONY: docker-build | |||
docker-build: ## Build docker image with the manager. | |||
docker buildx build --load --platform linux/${ARCH} --build-arg OPERATOR_VERSION -t ${IMG} . | |||
docker buildx build --load --platform linux/${ARCH} --build-arg OPERATOR_VERSION --build-arg TEMPO_VERSION -t ${IMG} . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
afaics we don't need to pass OPERATOR_VERSION
or TEMPO_VERSION
here, because in the Dockerfile we run make build
, and the Makefile contains the versions (hardcoded).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That does not work for e.g.
IMG_PREFIX=docker.io/pavolloffay OPERATOR_VERSION=0.11.0 TEMPO_VERSION=2.5.0 make docker-build docker-push deploy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, yes, but this is only required for testing, right? Anyway, still useful 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering about race conditions, this is the timeline on upgrade:
- old tempo version runs
- operator restarts with new operator version
- operator reconciles all managed instances
3.1. at the start of reconcile loop, operator runs upgrades
3.2. upgrade procedure creates job tochown
PV contents (while old tempo pods are still running)
3.3. reconcile create the manifests, using the new tempo image in allDeployment
andStatefulSet
manifests
3.4. reconcile detects changes and applies the new manifests to the cluster, triggering a restart of the tempo pods (the upgrade job may or may not be completed at this time)
I guess this works in most cases, but not all (busy cluster, chown-job takes long time to schedule/execute, the ingester keeps writing during chmod, so we end up with some root-owned and some tempo-owned files in the PV, etc).
Ideally we stop running ingesters, perform chown
, wait until chown
is done, and then only start the new version.
I think adding an initContainer would solve the timing issues. init containers always start and finish before the main container, and afaics (correct me if I'm wrong) while the init container of the new statefulset runs, the old statefulset is already terminated (otherwise two pods access the same PV, I think this is prevented).
There is an issue with the init-container approach. The init-container will run only for ingesters (and PVs) that are scheduled to run. The ingesters might be scaled down (e.g. from 5 instances to 2) therefore there will be PVs that won't be upgraded. |
We'll have to keep the initContainer indefinitely, so when the ingesters are scaled down it doesn't matter if the PV is in an outdated state, but when they get scaled up again they will be upgraded. |
Signed-off-by: Pavol Loffay <[email protected]>
This is certainly doable but it will clutter non upgrade related packages. I would prefer to keep the upgrade code in an isolated standalone package. I have changed the upgrade procedure to scale ingesters down to zero before upgrading, then wait until a single job that mounts all volumes finishes. |
Signed-off-by: Pavol Loffay <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, nice job (pun intended)
|
||
return false, nil | ||
}) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could remove the job here, instead of leaving it there until the 24h TTL. but it's fine either way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left it there intentionally for awareness :)
The upstream tempo 2.5.0 docker images has a breaking change https://github.com/grafana/tempo/releases/tag/v2.5.0
The user changed from
root
totempo
(10001:10001
) which reads/var/tempo
.Notable changes:
chown -R /var/tempo
for every PV of the ingester.securityContext.fsGroup
so even a community image works well.Upgrade test