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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache Deck assets differently #30776

Merged
merged 3 commits into from
Sep 26, 2023
Merged

Conversation

xrstf
Copy link
Contributor

@xrstf xrstf commented Sep 20, 2023

This PR changes the client-side caching of static Deck assets.

There was already #6395, which added the original client-side caching code. It's not super obvious from the code, but this method relied on the Last-Modified header and the browser sending an If-Not-Modified header on subsequent revalidations. This works just fine when you run Deck locally, but if you peek into the container image for Deck, you'll see

2023-09-20T18-53-38

I presume this is on purpose to achieve reproducible container images.

The Go HTTP serve will not send a Last-Modified header for files that have a 0 timestamp. Which is the case for all of them 馃榿 This unfortunately totally defeats the caching in a production setup.

Later #10626 introduced the deckVersion, but so far only used it to display it in the sidebar.

I now make use of this variable and add it as a cache busting header. This allows Deck to send strong caching headers, while after a Prow update clients would still be forced to fetch the new versions of all assets. This works independently of any file timestamps and I think is more robust in general.

Since #6395 was authored 6 years ago, I decided to also drop IE 6 support. At this point IE 6 is truly dead and MDN recommends not setting the Pragma header anymore. However I kept the HTTP/1.0-only proxy support, as I can imagine some complex Prow setups with legacy proxies in-between that are hard to upgrade.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Sep 20, 2023
@k8s-ci-robot
Copy link
Contributor

Hi @xrstf. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. area/prow Issues or PRs related to prow area/prow/deck Issues or PRs related to prow's deck component sig/testing Categorizes an issue or PR as relevant to SIG Testing. labels Sep 20, 2023
@xmudrii
Copy link
Member

xmudrii commented Sep 26, 2023

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Sep 26, 2023
@xmudrii
Copy link
Member

xmudrii commented Sep 26, 2023

/retest

1 similar comment
@xrstf
Copy link
Contributor Author

xrstf commented Sep 26, 2023

/retest

Copy link
Contributor

@michelle192837 michelle192837 left a comment

Choose a reason for hiding this comment

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

Looks good, thanks!

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 26, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: michelle192837, xrstf

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 26, 2023
@k8s-ci-robot k8s-ci-robot merged commit 7e338dd into kubernetes:master Sep 26, 2023
7 checks passed
@xrstf xrstf deleted the cache-deck-assets branch September 26, 2023 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/prow/deck Issues or PRs related to prow's deck component area/prow Issues or PRs related to prow cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants