Skip to content

Commit

Permalink
add support for maas tag placement (#90)
Browse files Browse the repository at this point in the history
  • Loading branch information
sadysnaat authored Sep 6, 2023
1 parent 18af959 commit d9b3dc5
Show file tree
Hide file tree
Showing 12 changed files with 83 additions and 5 deletions.
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: 2 additions & 2 deletions api/v1alpha4/groupversion_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ limitations under the License.
*/

// Package v1alpha4 contains API Schema definitions for the infrastructure v1alpha4 API group
//+kubebuilder:object:generate=true
//+groupName=infrastructure.cluster.x-k8s.io
// +kubebuilder:object:generate=true
// +groupName=infrastructure.cluster.x-k8s.io
package v1alpha4

import (
Expand Down
4 changes: 2 additions & 2 deletions api/v1beta1/groupversion_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ limitations under the License.
*/

// Package v1beta1 contains API Schema definitions for the infrastructure v1beta1 API group
//+kubebuilder:object:generate=true
//+groupName=infrastructure.cluster.x-k8s.io
// +kubebuilder:object:generate=true
// +groupName=infrastructure.cluster.x-k8s.io
package v1beta1

import (
Expand Down
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 @@ -9,7 +9,7 @@ require (
github.com/onsi/ginkgo v1.16.5
github.com/onsi/gomega v1.17.0
github.com/pkg/errors v0.9.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 @@ -449,6 +449,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
42 changes: 42 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 @@ -76,6 +76,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
10 changes: 10 additions & 0 deletions spectro/generated/core-global.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -830,6 +830,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 Expand Up @@ -1172,6 +1177,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

0 comments on commit d9b3dc5

Please sign in to comment.