-
Notifications
You must be signed in to change notification settings - Fork 288
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
Validate Memory Usage for given resource pool for Vsphere provider #6680
Validate Memory Usage for given resource pool for Vsphere provider #6680
Conversation
Skipping CI for Draft Pull Request. |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #6680 +/- ##
==========================================
+ Coverage 75.61% 75.65% +0.03%
==========================================
Files 474 474
Lines 38268 38403 +135
==========================================
+ Hits 28937 29054 +117
- Misses 7724 7736 +12
- Partials 1607 1613 +6
☔ View full report in Codecov by Sentry. |
c2be09f
to
b2026b4
Compare
ed317ee
to
2bbb953
Compare
2bbb953
to
3f8bfd0
Compare
/retest eks-anywhere-presubmit |
@rahulbabu95: The
Use
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/retest-required |
3f8bfd0
to
2d7bbff
Compare
…lity for vsphere machine configs for create/upgrade as a preflight check Signed-off-by: Rahul Ganesh <[email protected]>
Signed-off-by: Rahul Ganesh <[email protected]>
2d7bbff
to
01e748d
Compare
pkg/providers/vsphere/vsphere.go
Outdated
needMemoryMiB int | ||
} | ||
|
||
func (p *vsphereProvider) getPrevMachineConfigMemoryUsage(ctx context.Context, mc *v1alpha1.VSphereMachineConfig, cluster *types.Cluster, count int) (memoryMiB int, err error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
count
is quite an ambiguous parameter here, what is this a count of?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
renaming it to machineConifgCount
pkg/providers/vsphere/vsphere.go
Outdated
return poolInfo[MemoryAvailable], needMemoryMiB, nil | ||
} | ||
|
||
func (p *vsphereProvider) calculateResourcePoolMemoryUsage(ctx context.Context, dc string, mc *v1alpha1.VSphereMachineConfig, cluster *types.Cluster, mu map[string]*memoryUsage, prevCount, newCount int) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The keys for mu
are really unclear. You can either create a dedicated data structure and give it an appropriate description or clearly document the param on this method. Same for counts.
Mind expanding dc
as well given its of type string
, its not clear what that means.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will expand the parameter names
pkg/providers/vsphere/vsphere.go
Outdated
memoryUsage := make(map[string]*memoryUsage) | ||
datacenter := clusterSpec.VSphereDatacenter.Spec.Datacenter | ||
cpMachineConfig := clusterSpec.controlPlaneMachineConfig() | ||
controlPlaneAvailableMiB, controlPlaneNeedMiB, err := p.getMachineConfigMemoryRequirements(ctx, datacenter, cpMachineConfig, clusterSpec.Cluster.Spec.ControlPlaneConfiguration.Count) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A method called getMachineConfigMemoryRequirements
that returns 'available memory' is a little confusing. This may just be a naming thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i have added an comment and changed the naming a bit
… helper function in validation to simplify the algorithm Signed-off-by: Rahul Ganesh <[email protected]>
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: chrisdoherty4 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Issue #, if available:
Description of changes:
Add a preflight validation that checks for requested memory is available in the resource pool for the respective machine configs before proceeding with the create or upgrade operation.
Testing (if applicable):
Documentation added/planned (if applicable):
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.