Skip to content

Commit

Permalink
Add feature for resource pool and tag selection. (#108)
Browse files Browse the repository at this point in the history
* Fix cluster template

* Update maas release v0.5.0

* add support for maas tag placement

---------

Co-authored-by: Deepak Sharma <deepak@spectrocloud.com>
  • Loading branch information
AmitSahastra and sadysnaat committed Nov 24, 2023
1 parent 148595c commit bb8204b
Show file tree
Hide file tree
Showing 10 changed files with 1,480 additions and 1 deletion.
1 change: 1 addition & 0 deletions api/v1alpha3/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions api/v1beta1/maasmachine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ type MaasMachineSpec struct {
// +kubebuilder:validation:Minimum=0
MinMemoryInMB *int `json:"minMemory"`

// Tags for placement
// +optional
Tags []string `json:"tags,omitempty"`

// Image will be the MaaS image id
// +kubebuilder:validation:MinLength=1
Image string `json:"image"`
Expand Down
5 changes: 5 additions & 0 deletions api/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,11 @@ spec:
systemID:
description: SystemID will be the MaaS machine ID
type: string
tags:
description: Tags for placement
items:
type: string
type: array
required:
- image
- minCPU
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,11 @@ spec:
systemID:
description: SystemID will be the MaaS machine ID
type: string
tags:
description: Tags for placement
items:
type: string
type: array
required:
- image
- minCPU
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require (
github.com/onsi/gomega v1.17.0
github.com/pkg/errors v0.9.1
github.com/prometheus/common v0.32.1
github.com/spectrocloud/maas-client-go v0.0.1-beta1.0.20230325022351-83e132faf065
github.com/spectrocloud/maas-client-go v0.0.1-beta1.0.20230830132549-2f7491722359
github.com/spf13/pflag v1.0.5
k8s.io/api v0.23.0
k8s.io/apiextensions-apiserver v0.23.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,8 @@ github.com/soheilhy/cmux v0.1.5/go.mod h1:T7TcVDs9LWfQgPlPsdngu6I6QIoyIFZDDC6sNE
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
github.com/spectrocloud/maas-client-go v0.0.1-beta1.0.20230325022351-83e132faf065 h1:9Hp6bTsg2Vpi4EYboy9/pLG3sRpDlePXEVDyvB9FljA=
github.com/spectrocloud/maas-client-go v0.0.1-beta1.0.20230325022351-83e132faf065/go.mod h1:ih7QvZPySD8fiIo56wO+W40w1ojiqNnpLP0Zb6nKvKk=
github.com/spectrocloud/maas-client-go v0.0.1-beta1.0.20230830132549-2f7491722359 h1:Rx+qfNFGE1Oh+cfNB+MW4JGod04jaaJemZ84yAn8HwQ=
github.com/spectrocloud/maas-client-go v0.0.1-beta1.0.20230830132549-2f7491722359/go.mod h1:ih7QvZPySD8fiIo56wO+W40w1ojiqNnpLP0Zb6nKvKk=
github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk=
github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I=
Expand Down
14 changes: 14 additions & 0 deletions pkg/maas/client/mock/clienset_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions pkg/maas/machine/machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ func (s *Service) DeployMachine(userDataB64 string) (_ *infrav1beta1.Machine, re
allocator.WithResourcePool(*mm.Spec.ResourcePool)
}

if len(mm.Spec.Tags) > 0 {
allocator.WithTags(mm.Spec.Tags)
}

m, err = allocator.Allocate(ctx)
if err != nil {
return nil, errors.Wrapf(err, "Unable to allocate machine")
Expand Down
Loading

0 comments on commit bb8204b

Please sign in to comment.