Skip to content

fix(edas): add retry and k8s API fallback for service selector resolu…#6782

Open
luobily wants to merge 1 commit into
erda-project:masterfrom
luobily:fix-edas-svc
Open

fix(edas): add retry and k8s API fallback for service selector resolu…#6782
luobily wants to merge 1 commit into
erda-project:masterfrom
luobily:fix-edas-svc

Conversation

@luobily

@luobily luobily commented May 19, 2026

Copy link
Copy Markdown
Member

What this PR does / why we need it:

Which issue(s) this PR fixes:

Specified Reviewers:

/assign

ChangeLog

Language Changelog
🇺🇸 English fix(edas): add retry and k8s API fallback for service selector resolution
🇨🇳 中文 修复 edas k8s svc selector 出错的问题,增加重试

Need cherry-pick to release versions?

@erda-bot

Copy link
Copy Markdown
Member

No assignee specified!

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 294b11962b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tools/cli/create-apps.go Outdated
var cfg Config
configFile := filepath.Join(configDir, "config")
data, _ := os.ReadFile(configFile)
json.Unmarshal(data, &cfg)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Decode the CLI config as YAML

The standard CLI config is not JSON: command.GetGlobalConfig decodes it with yaml.NewDecoder and SetGlobalConfig writes it with yaml.Marshal in tools/cli/command/erda.go. With a normal ~/.erda.d/config such as host: ..., this json.Unmarshal leaves cfg.Host empty without returning a checked error, so the following metadata request is built with an empty scheme/host and resp.Body is dereferenced after a failed client.Get. This makes the new batch-create helper fail for normal CLI users; decode the config as YAML or reuse the existing config loader.

Useful? React with 👍 / 👎.

Comment thread tools/cli/create-apps.go Outdated

type SessionInfo struct {
Token string `json:"token"`
SessionID string `json:"sessionId"`

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Match the stored session cookie field

Existing CLI sessions store the cookie under json:"sessionid" via status.StatusInfo in tools/cli/status/status.go, but this new struct looks for sessionId. In deployments or accounts that rely on the OPENAPISESSION cookie rather than a token, unmarshalling leaves SessionID empty and both the project lookup and application creation requests are sent unauthenticated even though the user has logged in. Reuse status.StatusInfo or change the tag to match the stored field.

Useful? React with 👍 / 👎.

@codecov

codecov Bot commented May 19, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 30 lines in your changes missing coverage. Please review.
✅ Project coverage is 15.82%. Comparing base (d31c282) to head (409a5c1).

Files with missing lines Patch % Lines
...r/scheduler/executor/plugins/edas/edas_app_flow.go 0.00% 22 Missing ⚠️
...r/plugins/edas/wrapclient/kubernetes/deployment.go 0.00% 8 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #6782      +/-   ##
==========================================
- Coverage   15.82%   15.82%   -0.01%     
==========================================
  Files        3998     3998              
  Lines      328174   328199      +25     
==========================================
- Hits        51939    51938       -1     
- Misses     270338   270366      +28     
+ Partials     5897     5895       -2     
Flag Coverage Δ
by-github-actions 15.82% <0.00%> (-0.01%) ⬇️

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

Files with missing lines Coverage Δ
...tor/plugins/edas/wrapclient/kubernetes/provider.go 0.00% <ø> (ø)
...r/plugins/edas/wrapclient/kubernetes/deployment.go 0.00% <0.00%> (ø)
...r/scheduler/executor/plugins/edas/edas_app_flow.go 13.62% <0.00%> (-0.59%) ⬇️

... and 3 files with indirect coverage changes

🚀 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.

@luobily luobily force-pushed the fix-edas-svc branch 5 times, most recently from 4d943c5 to e2bc644 Compare May 21, 2026 05:36
…tion

When creating/updating EDAS services, the deployment query via EDAS API
can intermittently fail or timeout, causing the service selector to fall
back to labels that don't exist on pods. This adds:
- EDAS API retry (3 attempts with 5s interval)
- k8s API fallback (list+contains match) when EDAS API is exhausted
- nil check for orderList to prevent panic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

2 participants