Skip to content

Implement livestate for k8s multicluster plugin #5778

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

Merged
merged 3 commits into from
May 9, 2025

Conversation

ffjlabo
Copy link
Member

@ffjlabo ffjlabo commented Apr 24, 2025

What this PR does:

as title. This is a PoC.

PipeCD

Spec summary

  • Show each diff in one UI
  • Show each resource state with a tab

TODOs

  • decide synstate from multiple sync state
  • decide resource state from multiple resource state

Why we need it:

We want to support livestate feature for multi cluster plugin.

Which issue(s) this PR fixes:

Part of #5006

Does this PR introduce a user-facing change?:

  • How are users affected by this change:
  • Is this breaking change:
  • How to migrate (if breaking change):

Copy link

codecov bot commented Apr 24, 2025

Codecov Report

Attention: Patch coverage is 1.94175% with 101 lines in your changes missing coverage. Please review.

Project coverage is 27.19%. Comparing base (33670a8) to head (3423347).
Report is 8 commits behind head on master.

Files with missing lines Patch % Lines
...plugin/kubernetes_multicluster/livestate/plugin.go 1.96% 100 Missing ⚠️
...app/pipedv1/plugin/kubernetes_multicluster/main.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5778      +/-   ##
==========================================
+ Coverage   27.14%   27.19%   +0.05%     
==========================================
  Files         508      508              
  Lines       53803    53942     +139     
==========================================
+ Hits        14603    14671      +68     
- Misses      38084    38155      +71     
  Partials     1116     1116              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ffjlabo ffjlabo force-pushed the implement-livestate-for-k8s-multicluster-plugin branch from dc50f71 to 0981d3e Compare May 8, 2025 05:06
Signed-off-by: Yoshiki Fujikane <[email protected]>
@ffjlabo ffjlabo marked this pull request as ready for review May 8, 2025 09:14
Copy link
Member

@Warashi Warashi left a comment

Choose a reason for hiding this comment

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

Let's try

syncStates := make([]sdk.ApplicationSyncState, 0, len(targetConfigs))
for _, tc := range targetConfigs {
// Get the kubectl tool path.
kubectlPath, err := toolRegistry.Kubectl(ctx, cmp.Or(cfg.Spec.Input.KubectlVersion, tc.deployTarget.Config.KubectlVersion))
Copy link
Member

@Warashi Warashi May 9, 2025

Choose a reason for hiding this comment

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

[nits]
I think it's ok to fix this point in another PR.

This may be wrong. I think tc.deployTarget.Config.KubectlVersion has a higher priority.

Suggested change
kubectlPath, err := toolRegistry.Kubectl(ctx, cmp.Or(cfg.Spec.Input.KubectlVersion, tc.deployTarget.Config.KubectlVersion))
kubectlPath, err := toolRegistry.Kubectl(ctx, tc.deployTarget.Config.KubectlVersion, cmp.Or(cfg.Spec.Input.KubectlVersion))

Copy link
Member Author

Choose a reason for hiding this comment

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

@Warashi
It seems that cfg.Spec.Input.KubectlVersion has a higher priority in the old version.

// priority: applicationConfig.KubectlVersion > pipedConfig.KubectlVersion
https://github.com/pipe-cd/pipecd/blob/f53dd3cacc5dab5db3df48332b98f36b53158f17/pkg/app/piped/platformprovider/kubernetes/applier.go#L209C1-L217C2

It is the same as other deployment loginc for k8s plugin and k8s_multicluster.

Copy link
Member

Choose a reason for hiding this comment

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

@ffjlabo
Oops, thank you. I am confused with deployTargets and multiTargets.
ref;

kubectlVersions := []string{cfg.Spec.Input.KubectlVersion, deployTargetConfig.KubectlVersion}
// If multi-target is specified, use the kubectl version specified in it.
if multiTarget != nil {
kubectlVersions = append([]string{multiTarget.KubectlVersion}, kubectlVersions...)
}

Copy link
Member

@khanhtc1202 khanhtc1202 left a comment

Choose a reason for hiding this comment

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

👌

@ffjlabo ffjlabo merged commit eadee8b into master May 9, 2025
18 of 19 checks passed
@ffjlabo ffjlabo deleted the implement-livestate-for-k8s-multicluster-plugin branch May 9, 2025 05:03
@github-actions github-actions bot mentioned this pull request May 15, 2025
@github-actions github-actions bot mentioned this pull request May 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants