Skip to content

Commit

Permalink
Remove Flavor Filtering
Browse files Browse the repository at this point in the history
We filter based on vcpu/ram/swap as required by kubeadm, but this is a
domain specific thing, rather than generic, so remove this and delegate
handling to the kubernetes service.

Implements #67
  • Loading branch information
spjmurray committed Nov 1, 2024
1 parent 204e54a commit 054dbfc
Showing 1 changed file with 0 additions and 12 deletions.
12 changes: 0 additions & 12 deletions pkg/providers/openstack/compute.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,22 +169,10 @@ func (c *ComputeClient) Flavors(ctx context.Context) ([]flavors.Flavor, error) {

result = slices.DeleteFunc(result, func(flavor flavors.Flavor) bool {
// We are admin, so see all the things, throw out private flavors.
// TODO: we _could_ allow if our project is in the allowed IDs.
if !flavor.IsPublic {
return true
}

// Kubeadm requires 2 VCPU, 2 "GB" of RAM (I'll pretend it's GiB) and no swap:
// https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/
if flavor.VCPUs < 2 || flavor.RAM < 2048 || flavor.Swap != 0 {
return true
}

// Don't remove the flavor if it's implicitly selected by a lack of configuration.
if c.options == nil || c.options.Flavors == nil || c.options.Flavors.Selector == nil {
return false
}

if len(c.options.Flavors.Selector.IDs) > 0 {
if !slices.Contains(c.options.Flavors.Selector.IDs, flavor.ID) {
return true
Expand Down

0 comments on commit 054dbfc

Please sign in to comment.