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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add upgradePolicy api #9

Merged
merged 1 commit into from
Apr 18, 2024
Merged

add upgradePolicy api #9

merged 1 commit into from
Apr 18, 2024

Conversation

cumirror
Copy link
Collaborator

@cumirror cumirror commented Mar 12, 2024

What type of PR is this?
kind feature

What this PR does / why we need it:
对于app管理的组件,如果是daemonset类型,提供daemonset组件分批次更新能力。

Special notes for your reviewer:

  • application对象的扩展:
    1、app对象的spec中,添加upgradepolicy字段,用于选择升级策略
    2、app对象的status中,扩展phase,添加UpgradingDaemonset、UpgradingDaemonsetFailed
  • application.tkestack.io中的对象扩展
    1、新增全局的upgradepolicy对象:描述升级策略
    2、新增namespace级别的upgradejob对象,用于具体的ds升级处理
  • application-controller的更新:
    1、app-controller中,添加对于upgradepolicy字段的处理,如果配置了升级策略则会创建upgradejob对象并进入到UpgradingDaemonset阶段;UpgradingDaemonset、UpgradingDaemonsetFailed中等待upgradejob升级完成
    2、新增upgradejob-controller,用于处理upgradejob,控制目标集群中daemonset的升级。处理结束后会更新app对象的注解,触发app再进入UpgradingDaemonset进行处理

整体方案如下:
image

@cumirror cumirror changed the title add upgradePolicy type [WIP]add upgradePolicy type Mar 12, 2024
@cumirror cumirror changed the title [WIP]add upgradePolicy type add upgradePolicy api Mar 19, 2024
@cumirror cumirror requested a review from GaoXiaodong April 9, 2024 07:46
@@ -114,6 +116,11 @@ func CreateControllerContext(cfg *config.Config, rootClientBuilder controller.Cl
return ControllerContext{}, err
}

region := os.Getenv("REGION")
if region == "" {
return ControllerContext{}, fmt.Errorf("Please set env REGION")
Copy link
Owner

Choose a reason for hiding this comment

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

这里会导致不通用的吧

@@ -161,7 +161,10 @@ func (c *Controller) needsUpdate(old *applicationv1.App, new *applicationv1.App)
new.Status.Phase == applicationv1.AppPhaseInstallFailed ||
new.Status.Phase == applicationv1.AppPhaseUpgradFailed ||
new.Status.Phase == applicationv1.AppPhaseSucceeded ||
new.Status.Phase == applicationv1.AppPhaseTerminating {
new.Status.Phase == applicationv1.AppPhaseTerminating ||
// ds升级,通过添加注解触发再次进入app处理状态
Copy link
Owner

Choose a reason for hiding this comment

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

上次讨论没有注解了的,现在还有吗?

}

// List selects resources in the storage which match to the selector. 'options' can be nil.
func (r *REST) List(ctx context.Context, options *metainternal.ListOptions) (runtime.Object, error) {
Copy link
Owner

Choose a reason for hiding this comment

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

如果这里资源是租户隔离的,还需要重写watch,不然走watch会越权

@GaoXiaodong GaoXiaodong merged commit 2b1a9f1 into GaoXiaodong:feature/tke-app-upgrade Apr 18, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants