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

sync subnet to vpc while switching between custom VPC and default VPC #3218

Merged
merged 5 commits into from
Oct 17, 2023

Conversation

qiutingjun
Copy link
Contributor

@qiutingjun qiutingjun commented Sep 14, 2023

What type of this PR

  • Bug fixes

Which issue(s) this PR fixes:

Fixes #(issue-number)

WHAT

🤖 Generated by Copilot at 8432a48

Refactor and improve subnet and VPC controller logic. Use constants for annotation keys and handle subnet VPC changes and annotations in subnet.go. Follow Go naming and style conventions in subnet.go and vpc.go.

🤖 Generated by Copilot at 8432a48

Sing, O Muse, of the cunning code that changed the subnet's fate,
How util.VpcLastName and util.VpcLastPolicies were born,
To mark the shifting VPCs and their rules with annotations great,
As ./pkg/controller/subnet.go was refactored and reborn.

HOW

🤖 Generated by Copilot at 8432a48

  • Declare multiple variables using short variable declaration blocks for brevity and consistency (link, link, link, link, link, link, link, link)
  • Remove redundant declaration of usingIPs variable in pkg/controller/subnet.go (link)
  • Add blank lines before assigning values from function calls or status fields for readability and consistency in pkg/controller/subnet.go (link, link, link)
  • Rename variables and functions to use uppercase for acronyms for consistency with Go naming convention in pkg/controller/subnet.go (link, link, link, link, link, link, link, link, link, link, link, link, link, link)
  • Add logic to set and check util.VpcLastName annotation on subnet objects to record and validate the previous VPC name of the subnet in pkg/controller/subnet.go (link, link, link)
  • Remove extra blank line before logging the enqueue update subnet message in pkg/controller/subnet.go (link)
  • Replace hard-coded annotation key "ovn.kubernetes.io/last_policies" with constant util.VpcLastPolicies for readability and maintainability in pkg/controller/vpc.go (link, link)
  • Add constants util.VpcLastName and util.VpcLastPolicies to the package util in pkg/util/const.go (link)

@qiutingjun qiutingjun force-pushed the develop branch 2 times, most recently from 49e8eeb to 984b0a5 Compare September 15, 2023 04:23
@oilbeater
Copy link
Collaborator

The e2e fails

@qiutingjun
Copy link
Contributor Author

The e2e fails

it's ok now.
It's strange that I ran an e2e test locally before and did not fail.

@oilbeater oilbeater added the bug Something isn't working label Oct 17, 2023
@oilbeater oilbeater merged commit e6086d2 into kubeovn:master Oct 17, 2023
57 of 58 checks passed
bobz965 pushed a commit that referenced this pull request Oct 18, 2023
…#3218)

* sync subnet to vpc while subnet's vpc modified

Signed-off-by: 夜微澜 <[email protected]>

* update check conditions of vpc names

Signed-off-by: 夜微澜 <[email protected]>

---------

Signed-off-by: 夜微澜 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants