feat: Bump microcluster to v3#9
Conversation
Microcluster Schema Changes DetectedPlease ensure that the changes are intentional and have been reviewed by the appropriate team members. Adding a migration:You should not change the Microcluster migration files in interim Kubernetes releases to ensure a smooth Do not under any circumstances remove any migrations and never change the order of migrations in the microcluster schema files. |
There was a problem hiding this comment.
Pull request overview
This PR upgrades the project from Microcluster v2 to v3, which introduces several breaking API changes. The upgrade addresses package reorganization, internal API restrictions, and response handling consolidation.
Changes:
- Updated all import paths from
microcluster/v2tomicrocluster/v3and reorganized package imports (e.g.,rest/types→microcluster/types,lxd/response→microcluster/rest/response) - Replaced database cluster operations (
cluster.Stmt,cluster.RegisterStmt) with newdbpackage equivalents (db.Stmt,db.RegisterStmt) - Migrated from
s.Leader()client tosnap.K8sdClient("")for cluster operations, and updated method names (e.g.,DeleteClusterMember→RemoveClusterMember) - Updated State API method calls to function calls (e.g.,
s.FileSystem().StateDir→s.FileSystem().StateDir()) - Created new
utils.Path()helper function to replace the removeds.Address().Path()method - Added microcluster client methods to the mock implementation and k8sd client interface
Reviewed changes
Copilot reviewed 66 out of 67 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/utils/url.go | New utility function for URL path construction |
| pkg/utils/node/node.go | Updated to accept snap parameter and use new k8sd client |
| pkg/utils/microcluster/state.go | Updated microcluster import path |
| pkg/utils/http.go | Migrated from lxd response to microcluster response |
| pkg/snap/mock/provider.go | Updated microcluster import path |
| pkg/k8sd/features/* | Updated microcluster import paths |
| pkg/k8sd/database/* | Migrated from cluster package to db package for database operations |
| pkg/k8sd/controllers/feature.go | Updated microcluster import path |
| pkg/k8sd/app/* | Updated hooks to use new APIs, removed deprecated config fields, updated certificate methods |
| pkg/k8sd/api/* | Updated all response types and client access patterns |
| pkg/client/k8sd/* | Updated client implementation and added cluster member operations |
| cmd/k8sd/* | Updated filesystem API calls and deprecated flag descriptions |
| go.mod/go.sum | Updated dependency to microcluster v3 with temporary replace directive |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
5a801d2 to
eb5503d
Compare
69d80ab to
f46eb6c
Compare
Signed-off-by: Homayoon (Hue) Alimohammadi <homayoon.alimohammadi@canonical.com>
f46eb6c to
149fd61
Compare
Signed-off-by: Homayoon (Hue) Alimohammadi <homayoon.alimohammadi@canonical.com>
Signed-off-by: Homayoon (Hue) Alimohammadi <homayoon.alimohammadi@canonical.com>
|
e2e tests on the k8s-snap repo: canonical/k8s-snap#2347 |
| retries++ | ||
| } else { | ||
| // NOTE(Hue): We can not check for `cluster.Pending` with the `Role` type since it's internal to Microcluster | ||
| notPending = member.Role != "PENDING" |
There was a problem hiding this comment.
Can we ask Julian to expose this type for us? Checking for the string equivalent doesn't seem ideal.
There was a problem hiding this comment.
Great point! I've raised this PR: canonical/microcluster#650
Signed-off-by: Homayoon (Hue) Alimohammadi <homayoon.alimohammadi@canonical.com>
|
I've decided to bump to |
bschimke95
left a comment
There was a problem hiding this comment.
LGTM, please create a follow up card "bump to 3.0.3" to address Louise comment. IMHO we don't need to wait on this to merge this PR. It has been long enough.
|
The e2e tests are passing. Let's gooo! |
* feat: Bump microcluster to v3 * chore: use mctypes alias for microcluster/types import --------- Signed-off-by: Homayoon (Hue) Alimohammadi <homayoon.alimohammadi@canonical.com>
Overview
This PR bumps Microcluster to v3. There were a couple of breaking changes between v2 and v3:
clusterpackage is now internal to Microcluster. Functions likecluster.DeleteClusterMember,cluster.GetClusterMemberetc. are now not accessible externally. The Microclusterappinstance offers these functionalities in v3 by creating a local client and calling into the internal API./microcluster/types)lxd/response, instead it's baked into Microcluster. However, some functionalities were missing and a PR is currently open to add the missing functionalities: feat: Add response and log functionalities microcluster#603