Conversation
Mark the built-in default-policy as do-not-overwrite so that user modifications such as the upload display priority label are no longer reverted by the extension resource initializer on every startup. Fixes halo-dev#8259
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



What type of PR is this?
What this PR does / why we need it:
修复默认存储策略(
default-policy)的配置在 Halo 重启后丢失的问题。系统内置的"本地存储"策略会在每次启动时通过
ExtensionResourceInitializer从extensions/attachment-local-policy.yaml重新初始化。此前同文件中的default-policy-configConfigMap 已带有halo.run/do-not-overwrite: "true"标签(在 #8230 中引入),因此用户修改的存储配置数据(如存储位置)可以保留;
但
default-policy本身漏加了该标签,导致每次启动时初始化器都会用内置 YAML强制覆盖它,用户在该策略上保存的修改——例如"上传界面显示优先级"(保存在
metadata.labels["storage.halo.run/policy-priority-in-upload-ui"])以及自定义的显示名称——在重启后都会被还原为默认值(对应 Issue #8259)。
本 PR 为
default-policy补上与 ConfigMap 一致的halo.run/do-not-overwrite: "true"标签,使初始化器在启动时跳过对该策略的覆盖,从而保留用户的修改。
Which issue(s) this PR fixes:
Fixes #8259
Special notes for your reviewer:
AttachmentLocalPolicyResourceTest:断言default-policy及其 ConfigMap 均带有halo.run/do-not-overwrite标签(防止该保护标签将来被误删);ExtensionResourceInitializerTest:新增用例验证带 do-not-overwrite 标签的扩展在启动初始化时不会被 update / create 覆盖。
./gradlew spotlessCheck通过;run.halo.app.core.attachment.*与run.halo.app.infra.*包全量测试通过。CategoryFinderImplTest.listAsTreeTreatsInvalidParentsAsRoots存在一个预先存在的失败(根节点输出顺序为名称字典序,与测试期望的输入顺序不符),
已在未包含本次修改的基线上复现,与本次 PR 无关。
and reviewed locally)。
Does this PR introduce a user-facing change?