Refactor Data types of struct fields#2316
Merged
cb-github-robot merged 1 commit intocloud-barista:mainfrom Feb 13, 2026
Merged
Conversation
Signed-off-by: Seokho Son <shsongist@gmail.com>
Member
Author
|
/approve |
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request refactors data types of struct fields across the codebase, changing from string-based representations to appropriate numeric types (int, float64) for fields that represent numeric values. The PR addresses issue #991, which identified that fields like MaxResultNum, VmGroupSize, VcpuSize, MemorySize, DiskSize, and others were using string types when numeric types would be more appropriate.
Changes:
- Converted numeric fields from string to int/float64 types (SubGroupSize, SSHPort, RootDiskSize, node sizes, health checker settings, disk sizes, autoscaling thresholds, etc.)
- Updated Swagger/OpenAPI documentation to reflect the new types
- Modified configuration files (cloud_conf.yaml) to use numeric types
- Fixed IdList mutex to use pointer type (*sync.Mutex) to avoid copy-locks issue
- Enhanced image filtering logic to only mark available images as basic images
- Updated asset files (extraction patterns and cloud image data)
Reviewed changes
Copilot reviewed 26 out of 28 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/core/model/vnet.go | Changed VNetDetails fields to int (SubnetCount, HostsPerSubnet, UseFirstNZones) |
| src/core/model/spec.go | Changed SpecInfo.RootDiskSize from string to int |
| src/core/model/nlb.go | Changed NLB health checker fields (Interval, Timeout, Threshold) to int |
| src/core/model/mci.go | Changed SubGroupSize, SSHPort, RootDiskSize, NumVMsToAdd, AutoCondition fields (Operand, EvaluationPeriod), Limit, Weight to appropriate numeric types |
| src/core/model/k8scluster.go | Changed K8s node group size fields (DesiredNodeSize, MinNodeSize, MaxNodeSize) and RootDiskSize to int |
| src/core/model/datadisk.go | Changed DiskSize fields from string to int |
| src/core/model/config.go | Changed NLB settings and SubGroupSize to int in configuration model |
| src/core/model/common.go | Fixed IdList.mux from sync.Mutex to *sync.Mutex with lazy initialization |
| src/core/resource/vnet.go | Removed string-to-int conversions, now uses int fields directly |
| src/core/resource/spec.go | Added conversion from string to int for RootDiskSize when processing Spider responses |
| src/core/resource/k8scluster.go | Added int-to-string conversions when calling Spider API, string-to-int when receiving responses |
| src/core/resource/image.go | Only mark images as basic if ImageStatus is Available |
| src/core/resource/datadisk.go | Added conversions between int and string for Spider API interactions |
| src/core/infra/provisioning.go | Updated provisioning logic with proper int handling, fixed loop boundaries, added conversions for Spider API |
| src/core/infra/remoteCommand.go | Updated SSH port formatting to use int type |
| src/core/infra/recommendation.go | Improved error handling for numeric operand parsing |
| src/core/infra/orchestration.go | Removed unnecessary string conversions for evaluation period and operand |
| src/core/infra/monitoring.go | Added int-to-string conversion for SSH port |
| src/core/infra/manageInfo.go | Updated GetVmIp return type and SSHPort handling |
| src/core/infra/loadbalance.go | Added conversions for health checker settings and SubGroupSize validation |
| src/core/infra/utility.go | Updated SubGroupSize assignment to int |
| conf/cloud_conf.yaml | Changed NLB settings from quoted strings to numeric values |
| src/interface/rest/docs/swagger.yaml | Updated all API documentation to reflect new numeric types |
| src/interface/rest/docs/docs.go | Updated generated Swagger documentation |
| assets/extractionpatterns.yaml | Enhanced image filtering patterns (not directly related to type changes) |
| assets/cloudimage.csv | Updated Azure cloud image data (not directly related to type changes) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #991
This PR includes several breaking changes.
Apologies for that, but these changes should save you time in the long run.