Skip to content

Conversation

@evanli18
Copy link
Contributor

@evanli18 evanli18 commented Mar 8, 2022

Add .status.observedGeneration to Configuration.

reference:

Signed-off-by: Evan Li evan.li97@outlook.com

@codecov
Copy link

codecov bot commented Mar 8, 2022

Codecov Report

Merging #269 (c9c55b8) into master (37972ac) will decrease coverage by 2.30%.
The diff coverage is 45.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #269      +/-   ##
==========================================
- Coverage   77.44%   75.14%   -2.31%     
==========================================
  Files          19       19              
  Lines        1215     1219       +4     
==========================================
- Hits          941      916      -25     
- Misses        202      240      +38     
+ Partials       72       63       -9     
Flag Coverage Δ
unit 75.14% <45.00%> (-2.31%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
controllers/configuration_controller.go 65.20% <45.00%> (-4.07%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 37972ac...c9c55b8. Read the comment docs.

@zzxwill
Copy link
Collaborator

zzxwill commented Mar 8, 2022

This feature is pretty cool, which I planned to implement tonight:)

@zzxwill
Copy link
Collaborator

zzxwill commented Mar 8, 2022

@lowkeyrd Please help review this feature.

return ctrl.Result{}, err
}

var tfExecutionJob = &batchv1.Job{}
Copy link
Collaborator

Choose a reason for hiding this comment

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

这一块不能删除,它解决的是这个场景:
Configuration 部署过程中,job 已经完成了,状态还是 ProvisioningAndChecking,这时候删除 Configuration,状态就无法到达 Avaialable,导致状态 block,无法部署成功也无法删除。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

这里需要判断一下是否是当前 spec 对应的 job ,如果新的 spec 进来会后会拿到上一次的 job

for k, v := range variableInSecret.Data {
if val, ok := meta.VariableSecretData[k]; !ok || !bytes.Equal(v, val) {
envChanged = true
meta.EnvChanged = true
Copy link
Collaborator

Choose a reason for hiding this comment

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

这个一旦设置为 true,就无法变成 false,所以不能设置为全局的属性。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

每次事件触发后进来都会初始化 meta。

Copy link
Collaborator

Choose a reason for hiding this comment

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

嗯嗯,我的意思就是一次 reconcile,你在这一行加了一个判断是更合理的。
https://github.com/oam-dev/terraform-controller/pull/269/files#diff-1aa78f86e236bbfbdd87a2dd01cfad0cda0964bdfc8ba4a7ba036fd11cbbabb5R267

@evanli18 evanli18 force-pushed the feat/status branch 2 times, most recently from 21a8da5 to 7269a1d Compare March 8, 2022 14:17
@evanli18 evanli18 requested a review from zzxwill March 8, 2022 14:19
}

// Check whether env changes
if err := meta.prepareTFVariables(configuration); err != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Great, I did move it to here in another pending PR.

break
}
}
} else if !kerrors.IsNotFound(err) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

What will happen if it's not IsNotFound error?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

system err or runtime err

Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

如果 not found 在这里返回,会无法继续进行;后面会在配置变更后删除 secrets object

return err
}

break
Copy link
Collaborator

Choose a reason for hiding this comment

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

Good catch!

Signed-off-by: Evan Li <evan.li97@outlook.com>
Copy link
Collaborator

@zzxwill zzxwill left a comment

Choose a reason for hiding this comment

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

Great job!

@zzxwill zzxwill merged commit 616070b into kubevela:master Mar 9, 2022
zzxwill added a commit to zzxwill/kubevela that referenced this pull request Mar 10, 2022
- Change json tag of spec.Region to `customRegion` in Configuration kubevela#3384
- Use .status.observedGeneration to make Terraform outputs is latest kubevela/terraform-controller#269

Signed-off-by: Zheng Xi Zhou <zzxwill@gmail.com>
zzxwill added a commit to zzxwill/kubevela that referenced this pull request Mar 11, 2022
- Change json tag of spec.Region to `customRegion` in Configuration kubevela#3384
- Use .status.observedGeneration to make Terraform outputs is latest kubevela/terraform-controller#269

Signed-off-by: Zheng Xi Zhou <zzxwill@gmail.com>
zzxwill added a commit to kubevela/kubevela that referenced this pull request Mar 11, 2022
* Upgrade API version for Terraform Controller

- Change json tag of spec.Region to `customRegion` in Configuration #3384
- Use .status.observedGeneration to make Terraform outputs is latest kubevela/terraform-controller#269

Signed-off-by: Zheng Xi Zhou <zzxwill@gmail.com>

* fix ci

Signed-off-by: Zheng Xi Zhou <zzxwill@gmail.com>
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