Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
- **日期**:2026-05-18
- **范围**:仅讨论"上架"这一步(Artifact / ArtifactVersion 创建);OLM Subscription / InstallPlan / CSV 不在本次重构内
- **现状代码锚点**:
- `pkg/operator/operatorhub/artifact_versiong.go:15-89`(`InstallArtifactVersion` + `createArtifactVersion` 硬编码 unstructured)
- `pkg/operator/operatorhub/artifact_version.go:15-89`(`InstallArtifactVersion` + `createArtifactVersion` 硬编码 unstructured)
- `pkg/exec/exec.go:43-80`(已有的子进程执行机制,testCommand 走这条)
- `pkg/config/config.go:29-52`(`OperatorConfig`)

Expand Down Expand Up @@ -51,7 +51,7 @@

### 1. violet 接管范围:**只接管"创建 Artifact/ArtifactVersion"**

- 替换:`createArtifactVersion`(`artifact_versiong.go:51-90`)
- 替换:`createArtifactVersion`(`artifact_version.go:51-90`)
- 保留:`waitArtifactVersionPresent`、`waitPackageManifest`、`InstallSubscription`、InstallPlan 手动审批
- 原因:violet 物理上不管 OLM 资源;保留 Go 控制 OLM 流程 = 升级时序仍然由 upgrade CLI 把控

Expand Down Expand Up @@ -118,7 +118,7 @@ operatorConfig:
## 实施轮廓(不细化,留给 plan)

- 新建 `pkg/operator/operatorhub/violet.go`(拼 URL + 下载 + exec violet push)
- 替换 `artifact_versiong.go` 里 `createArtifactVersion` 的调用点
- 替换 `artifact_version.go` 里 `createArtifactVersion` 的调用点
- `pkg/config/config.go` 增字段 + 默认值
- 文档:更新 README 和 CLAUDE.md "新加 Operator 类型时" 段落(提及 violet 路径)

Expand Down
12 changes: 6 additions & 6 deletions docs/plans/2026-05-18-refactor-externalize-violet-binary-plan.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ origin:`docs/brainstorms/2026-05-18-violet-external-binary-brainstorm.md`。

## Problem Statement / Motivation

当前 `pkg/operator/operatorhub/artifact_versiong.go:51-90` 把 `Artifact`/`ArtifactVersion` 的 CRD 字段(apiVersion / labels / annotations / spec.present / spec.tag / OwnerReferences 等)**硬编码**在 Go 里。
当前 `pkg/operator/operatorhub/artifact_version.go:51-90` 把 `Artifact`/`ArtifactVersion` 的 CRD 字段(apiVersion / labels / annotations / spec.present / spec.tag / OwnerReferences 等)**硬编码**在 Go 里。

问题:
1. **schema 漂移风险** — Alauda CRD 演进时 upgrade CLI 必须跟着改、重发版
Expand All @@ -29,7 +29,7 @@ origin:`docs/brainstorms/2026-05-18-violet-external-binary-brainstorm.md`。

## Proposed Solution

**新 `InstallArtifactVersion` 流程**(替换 `pkg/operator/operatorhub/artifact_versiong.go:15-49`):
**新 `InstallArtifactVersion` 流程**(替换 `pkg/operator/operatorhub/artifact_version.go:15-49`):

```
1. resolve URL : 按 <prefix>/<name>/<channel>/<name>.latest.ALL.<bundleVersion>.tgz 拼
Expand Down Expand Up @@ -319,7 +319,7 @@ violet 自身打印的 `--password=xxx`(如有 debug 模式)会进 CLI 日
- `pkg/operator/operatorhub/violet.go`:
- 新增 `(o *Operator) installViaViolet(ctx, version Version) (*unstructured.Unstructured, error)`
- 实现 download HTTP GET → 临时目录 → sha256 校验(若 ExpectedSha256 非空)→ ensure clean AV(Get + Delete + Poll NotFound)→ exec violet(用 PR 1 的 EnvAllowlist)→ 复用 `waitArtifactVersionPresent` / `waitPackageManifest`
- `pkg/operator/operatorhub/artifact_versiong.go`:
- `pkg/operator/operatorhub/artifact_version.go`:
- `InstallArtifactVersion` 改走 `o.installViaViolet`
- **保留** `createArtifactVersion` 函数为 dead code(不删;便于 PR 2 出问题时本地 diff 对比)
- `README.md`:新增章节
Expand Down Expand Up @@ -356,7 +356,7 @@ violet 自身打印的 `--password=xxx`(如有 debug 模式)会进 CLI 日
**Branch**:`chore/remove-deprecated-create-av`(基于 PR 2 分支)

**改动范围**:
- `pkg/operator/operatorhub/artifact_versiong.go`:
- `pkg/operator/operatorhub/artifact_version.go`:
- 删除 `createArtifactVersion` 函数
- 删除仅它在用的 imports(`metav1` OwnerReference 等若不再需要)
- 检查 `artifactGVR` 是否还有引用 —— 仍要保留(`InstallArtifactVersion` 的 Get + `installViaViolet` 的 Delete 仍用)
Expand Down Expand Up @@ -401,10 +401,10 @@ PR 1 (基础设施) ─┬─→ PR 2 (切换 + dead code 保留) ─→ PR 3 (

### Internal references

- 现有 unstructured 创建逻辑:`pkg/operator/operatorhub/artifact_versiong.go:51-90`
- 现有 unstructured 创建逻辑:`pkg/operator/operatorhub/artifact_version.go:51-90`
- 子进程 exec:`pkg/exec/exec.go:43-80`(env 透传现状 line 48)
- 配置默认值入口:`pkg/config/config.go:91-112`
- knative logging 模式:`pkg/operator/operatorhub/subscription.go:23`、`pkg/operator/operatorhub/artifact_versiong.go:16`
- knative logging 模式:`pkg/operator/operatorhub/subscription.go:23`、`pkg/operator/operatorhub/artifact_version.go:16`
- factory:`pkg/operator/factory.go`
- Tekton Pipeline `devops/upgrade-test`(integration-test 集群):在线读取于 2026-05-18

Expand Down
73 changes: 0 additions & 73 deletions todos/001-pending-p2-http-download-no-timeout.md

This file was deleted.

78 changes: 0 additions & 78 deletions todos/004-pending-p2-package-manifest-substring-csv-match.md

This file was deleted.

84 changes: 0 additions & 84 deletions todos/005-pending-p2-wait-av-no-retry-on-transient-errors.md

This file was deleted.

Loading
Loading