Pull Request已成功合入, 合并人@openeuler-ci-bot
(感谢 zhaoyifan28 的贡献)变更摘要
本 PR 重构 Template 元数据的存储语义:将 containerd Canonical Image Record 作为 Template 元数据的唯一 source of truth 与 GC root,移除 state.db(bbolt)中 Template 的 CRUD,同时调整 Create、Pull、Checkpoint 流程,使其在短生命周期 lease 释放前发布完整 Image Record,并利用 containerd 原生 GC 与内容标签管理 Boot Index descriptor closure。新增基于 containerd images.Store/content.Store 的 containerdtemplate.Store 实现 conchtemplate.Store,state.Store 接口仅保留 Sandbox 状态与 checkpoint head 的 CAS 更新。
主要改动
-
Template 元数据迁移至 containerd:新增
internal/adapters/containerd/template/store.go,以io.conch.template.*系列标签(schema、origin、parent、source-sandbox、source-ref、user.前缀)编码 Template 元数据到 Canonical Image Record,并删除internal/template/store.go中基于StateStore的PersistentStore/NewStore,Store接口的Create签名改为接收ocispec.Descriptortarget 参数。 -
bbolt 移除 Template CRUD,保留 checkpoint head CAS:
internal/daemon/state/bbolt.go删除templatesbucket 及CreateTemplate/GetTemplate/ListTemplates/DeleteTemplate/PublishCheckpoint,新增AdvanceCheckpointHead(sandboxID, expectedDigest, nextDigest)在单事务内校验并推进 checkpoint head;state.Store接口同步收敛为仅含该 CAS 方法。 -
调整 Checkpoint/Pull/Create 流程与 lease 生命周期:
internal/conchruntime/service.go中 Checkpoint 与 Pull 流程改用WithLease创建内容 lease,在 lease 释放前通过Templates.Create发布完整 Image Record;createTemplateFromSource同样在 publish lease 内创建记录,CAS 失败时通过cleanupTemplateRecord回滚。 -
删除仅解除 Canonical Image Record 并防并发误删:
Store.Delete校验record.Target.Digest与请求 digest 一致后调用images.DeleteTarget删除记录,RemoveTemplate简化为直接调用Templates.Delete,同时删除internal/image/bootindex_publish.go中旧的EnsureCanonicalBootIndexRecord/RemoveCanonicalBootIndexRecord。 -
请求取消后的临时记录限时清理:
internal/image/image.go新增RemoveFetchedImageRecord,使用context.WithoutCancel加 10 秒超时清理拉取产生的临时 image record;PublishBootIndexResult/PullBootIndexResult/PublishCheckpointBootIndexResult增加Target描述符(及SourceImageName)字段供下游创建记录。


🤖 AI 代码检视正在进行中,请稍候…


Welcome To openEuler Community
Hey @zhaoyifan28 , thanks for your contribution to the community.
Bot Usage Manual
I'm the Bot here serving you. You can find the instructions on how to interact with me at Here . That means you can comment below every pull request or issue to trigger Bot Commands. You can self-configure the PR merge rules for this repository. For more details, please refer to Here.
Contact Guide
If you have any questions, please contact the SIG: sig-CloudNative ,
and any of the maintainers: @duguhaotian, @gaodaweiky, @jimmieme, @lu-wei-army, @weibaohui, @wonleing, @yangzhao_kl, @zhaoyifan28, @zmr_2020 ,
and any of the committers: @Yekelu .


/lgtm
/approve


背景
Template 元数据当前同时保存在 state.db 和 containerd Canonical Image Record 中,存在双重 owner 及跨 Store 一致性问题。
改动
边界
验证