Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

fix(appliance): use version for image tags#63075

Merged
craigfurman merged 1 commit into
mainfrom
craig/rel-135-appliance-knows-what-images-to-pull-for-a-given-release
Jun 7, 2024
Merged

fix(appliance): use version for image tags#63075
craigfurman merged 1 commit into
mainfrom
craig/rel-135-appliance-knows-what-images-to-pull-for-a-given-release

Conversation

@craigfurman

Copy link
Copy Markdown
Contributor

Simultaneously fix a bug in the (still unreleased) appliance and change approach to container image metadata. The appliance used to maintain a map of versions to image-tags. The only version hardcoded for the still-in-development appliance was 5.3.9104, since that was the latest at the time development started. These versions were set to 5.3.2, which is incorrect. These versions were obtained from looking at the main branch of deploy-sourcegraph-helm, instead of the relevant release branch.

The change in approach is to stop including the optional sha256 digest of the image in the appliance-generated config. We considered several approaches in
https://linear.app/sourcegraph/issue/REL-22/spike-sketch-out-how-appliance-developers-will-handle-upgrades, please see that issue for more context.

It appears simpler to statelessly determine the image tag (as being equal to the release version string) rather than add moving parts such as calling the release registry, or building a 2-phase release system to bake image checksums into the appliance once they are known post-build. These options introduce complexity and greater possibility of errors than just asking for a version.

Closes
https://linear.app/sourcegraph/issue/REL-135/appliance-knows-what-images-to-pull-for-a-given-release.

Test plan

Golden tests included.

Changelog

  • Appliance uses requested version as image tag, instead of requiring sha256 digests.

@cla-bot cla-bot Bot added the cla-signed label Jun 4, 2024
@craigfurman craigfurman force-pushed the craig/rel-135-appliance-knows-what-images-to-pull-for-a-given-release branch from f26e3a8 to e1303ae Compare June 4, 2024 14:27
Comment thread internal/appliance/config/defaults.go Outdated

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Simple and stateless! This is the core of the proposal. Image metadata would need no developer input to enable upgrades.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is nice! I'm still a little worried, but I can't explain why so it's probably just FOC 😆
Either way if we encounter issues with this, it's an easy change 🚀

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oh! What causes the worry? 👀
Worth hearing it out before merge!

@craigfurman craigfurman Jun 5, 2024

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I should probably state what I see as the other side of the trade-off (the benefits of keeping digests), of course you're welcome to add to it 😁

Digests are another layer of validation and can be seen as a security feature. Hypothetically, if an attacker compromises a user's container registry accounts but has not gained access to their k8s API, digests prevent pulling a malicious image that has been falsely tagged as one of ours.

Subjectively, using them seems like a lot of overhead for a very hypothetical benefit. Security is not a single spectrum, it depends on our (and a user's) threat model. That's why I'm framing this as a bit hypothetical.

I vote that we just document this as a divergent behaviour of the appliance and see what early adopters think. As you note, this is a 2-way door and we can consider changing it if we get a lot of pushback. I opened an issue for this: https://linear.app/sourcegraph/issue/REL-138/document-divergences-from-helm-chart

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ah well as you wisely saying anyway, this is a 2-way door 😁

Let's merge it and rely on the issue I split to communicate the change clearly. We can always revisit it.

Comment thread internal/appliance/reconciler/testdata/golden-fixtures/cadvisor/default.yaml Outdated
Simultaneously fix a bug in the (still unreleased) appliance and change
approach to container image metadata. The appliance used to maintain a
map of versions to image-tags. The only version hardcoded for the
still-in-development appliance was 5.3.9104, since that was the latest
at the time development started. These versions were set to 5.3.2, which
is incorrect. These versions were obtained from looking at the main
branch of deploy-sourcegraph-helm, instead of the relevant release
branch.

The change in approach is to stop including the optional sha256 digest
of the image in the appliance-generated config. We considered several
approaches in
https://linear.app/sourcegraph/issue/REL-22/spike-sketch-out-how-appliance-developers-will-handle-upgrades,
please see that issue for more context.

It appears simpler to statelessly determine the image tag (as being
equal to the release version string) rather than add moving parts such
as calling the release registry, or building a 2-phase release system to
bake image checksums into the appliance once they are known post-build.
These options introduce complexity and greater possibility of errors
than just asking for a version.

Closes
https://linear.app/sourcegraph/issue/REL-135/appliance-knows-what-images-to-pull-for-a-given-release.
@craigfurman craigfurman force-pushed the craig/rel-135-appliance-knows-what-images-to-pull-for-a-given-release branch from e1303ae to e407ae4 Compare June 4, 2024 15:03
@craigfurman craigfurman requested a review from jdpleiness June 4, 2024 15:04
Comment thread internal/appliance/config/defaults.go Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is nice! I'm still a little worried, but I can't explain why so it's probably just FOC 😆
Either way if we encounter issues with this, it's an easy change 🚀

Comment thread internal/appliance/reconciler/testdata/golden-fixtures/cadvisor/default.yaml Outdated
@craigfurman craigfurman merged commit 8150eb1 into main Jun 7, 2024
@craigfurman craigfurman deleted the craig/rel-135-appliance-knows-what-images-to-pull-for-a-given-release branch June 7, 2024 09:08
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants