diff --git a/api/v1alpha1/generated.pb.go b/api/v1alpha1/generated.pb.go index 41d7a23f..cf7e75c1 100644 --- a/api/v1alpha1/generated.pb.go +++ b/api/v1alpha1/generated.pb.go @@ -22,12 +22,16 @@ import ( fmt "fmt" io "io" + + proto "github.com/gogo/protobuf/proto" + github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys" + k8s_io_api_core_v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/resource" + math "math" math_bits "math/bits" reflect "reflect" strings "strings" - - proto "github.com/gogo/protobuf/proto" ) // Reference imports to suppress errors if they are not otherwise used. @@ -389,6 +393,7 @@ func init() { proto.RegisterType((*TaskList)(nil), "teainspace.com.ame.pkg.apis.ame.v1alpha1.TaskList") proto.RegisterType((*TaskSecret)(nil), "teainspace.com.ame.pkg.apis.ame.v1alpha1.TaskSecret") proto.RegisterType((*TaskSpec)(nil), "teainspace.com.ame.pkg.apis.ame.v1alpha1.TaskSpec") + proto.RegisterMapType((k8s_io_api_core_v1.ResourceList)(nil), "teainspace.com.ame.pkg.apis.ame.v1alpha1.TaskSpec.ResourcesEntry") proto.RegisterType((*TaskStatus)(nil), "teainspace.com.ame.pkg.apis.ame.v1alpha1.TaskStatus") } @@ -397,62 +402,69 @@ func init() { } var fileDescriptor_82a756a2a92d3306 = []byte{ - // 875 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x56, 0x4f, 0x6f, 0xe3, 0x44, - 0x14, 0x8f, 0xf3, 0x6f, 0xd3, 0x49, 0x1b, 0x60, 0xb4, 0xac, 0xac, 0x1e, 0xdc, 0xca, 0x48, 0xa8, - 0x07, 0x70, 0xb6, 0xd1, 0x0a, 0x22, 0x81, 0x2a, 0x11, 0x54, 0xad, 0x56, 0xfc, 0x8b, 0xc6, 0xab, - 0x1e, 0xd0, 0xc2, 0x32, 0x75, 0x5e, 0x1d, 0x93, 0xf8,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1a, - 0xe5, 0x49, 0x5f, 0x7a, 0x5b, 0xd2, 0x26, 0x0a, 0xd6, 0x3c, 0x51, 0x32, 0x92, 0x2f, 0x0d, 0x3f, - 0x44, 0xad, 0x68, 0x4a, 0x59, 0xae, 0xa3, 0xfd, 0x5c, 0x79, 0x63, 0xb1, 0xf8, 0xcf, 0xd5, 0xc1, - 0x8e, 0x88, 0x95, 0x06, 0xc9, 0x02, 0x47, 0xd6, 0xe5, 0xb5, 0x51, 0x7b, 0x71, 0x6d, 0xd4, 0x5e, - 0x5e, 0x1b, 0xb5, 0x1f, 0x96, 0x86, 0x76, 0xb9, 0x34, 0xb4, 0x17, 0x4b, 0x43, 0x7b, 0xb9, 0x34, - 0xb4, 0x3f, 0x97, 0x86, 0xf6, 0xe3, 0x5f, 0x46, 0xed, 0xeb, 0x4e, 0xbe, 0xab, 0x7f, 0x03, 0x00, - 0x00, 0xff, 0xff, 0xa6, 0xa1, 0xee, 0x43, 0x76, 0x0a, 0x00, 0x00, + // 982 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x56, 0xcf, 0x6f, 0x23, 0xb5, + 0x17, 0xcf, 0xe4, 0x57, 0x13, 0xa7, 0xed, 0x77, 0xbf, 0xd6, 0xb2, 0x1a, 0xf5, 0x30, 0xa9, 0x06, + 0x09, 0xf5, 0x00, 0x9e, 0x6d, 0xb4, 0x82, 0x08, 0x50, 0xa5, 0x0d, 0x54, 0xab, 0x15, 0xbf, 0x8a, + 0x67, 0x55, 0x24, 0xb4, 0xb0, 0xb8, 0x13, 0x77, 0x32, 0x24, 0xf3, 0x43, 0x63, 0xcf, 0x48, 0xb9, + 0x21, 0xfe, 0x02, 0x2e, 0xdc, 0x38, 0x22, 0xfe, 0x06, 0x84, 0xc4, 0x15, 0xf5, 0xb8, 0xdc, 0xf6, + 0x54, 0x68, 0xf8, 0x2f, 0xf6, 0x84, 0xec, 0xf1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, 0x3c, 0xc8, 0xfd, 0xf5, 0xbb, 0x02, 0xc2, 0x39, 0xc6, 0x61, 0xc0, 0xe3, 0xf9, 0xe8, + 0xb3, 0xfc, 0xc6, 0x8b, 0xf9, 0xe7, 0xe7, 0xfd, 0xfe, 0xf2, 0x7b, 0x67, 0x39, 0x61, 0x2c, 0xfe, + 0xa5, 0x45, 0x9c, 0x28, 0x9b, 0x6f, 0xff, 0xb8, 0xd6, 0x45, 0x8a, 0x79, 0xb9, 0xd9, 0x9d, 0x99, + 0xf8, 0x04, 0x94, 0xb3, 0xc2, 0x5b, 0xa0, 0x21, 0x04, 0x2e, 0x75, 0x8a, 0xc5, 0x10, 0xbe, 0x5f, + 0x6e, 0x05, 0xff, 0x52, 0xd5, 0x28, 0x87, 0x46, 0x9f, 0x26, 0x24, 0xe0, 0x1e, 0x9f, 0xab, 0x5e, + 0xf1, 0x76, 0x7d, 0xa8, 0x99, 0x07, 0xaa, 0xde, 0x64, 0x4b, 0x82, 0x77, 0x41, 0x2b, 0x9a, 0x10, + 0x96, 0x17, 0xdc, 0x4e, 0x5e, 0xa2, 0x47, 0x62, 0xf2, 0xf9, 0x79, 0xbf, 0x2b, 0x7c, 0xa5, 0x81, + 0x33, 0xc7, 0x11, 0x3a, 0xbb, 0x30, 0x6a, 0x4f, 0x2f, 0x8c, 0xda, 0xb3, 0x0b, 0xa3, 0xf6, 0xcd, + 0xc2, 0xd0, 0xce, 0x16, 0x86, 0xf6, 0x74, 0x61, 0x68, 0xcf, 0x16, 0x86, 0xf6, 0xe7, 0xc2, 0xd0, + 0xbe, 0xfb, 0xcb, 0xa8, 0x7d, 0xde, 0xc9, 0x99, 0xfd, 0x3b, 0x00, 0x00, 0xff, 0xff, 0xc2, 0xc4, + 0xa7, 0xf8, 0xd5, 0x0b, 0x00, 0x00, } func (m *PipelineStep) Marshal() (dAtA []byte, err error) { @@ -901,6 +913,35 @@ func (m *TaskSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.Resources) > 0 { + keysForResources := make([]string, 0, len(m.Resources)) + for k := range m.Resources { + keysForResources = append(keysForResources, string(k)) + } + github_com_gogo_protobuf_sortkeys.Strings(keysForResources) + for iNdEx := len(keysForResources) - 1; iNdEx >= 0; iNdEx-- { + v := m.Resources[k8s_io_api_core_v1.ResourceName(keysForResources[iNdEx])] + baseI := i + { + size, err := (&v).MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + i -= len(keysForResources[iNdEx]) + copy(dAtA[i:], keysForResources[iNdEx]) + i = encodeVarintGenerated(dAtA, i, uint64(len(keysForResources[iNdEx]))) + i-- + dAtA[i] = 0xa + i = encodeVarintGenerated(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0x3a + } + } { size, err := m.Source.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -1187,6 +1228,15 @@ func (m *TaskSpec) Size() (n int) { } l = m.Source.Size() n += 1 + l + sovGenerated(uint64(l)) + if len(m.Resources) > 0 { + for k, v := range m.Resources { + _ = k + _ = v + l = v.Size() + mapEntrySize := 1 + len(k) + sovGenerated(uint64(len(k))) + 1 + l + sovGenerated(uint64(l)) + n += mapEntrySize + 1 + sovGenerated(uint64(mapEntrySize)) + } + } return n } @@ -1359,6 +1409,16 @@ func (this *TaskSpec) String() string { repeatedStringForPipeline += strings.Replace(strings.Replace(f.String(), "PipelineStep", "PipelineStep", 1), `&`, ``, 1) + "," } repeatedStringForPipeline += "}" + keysForResources := make([]string, 0, len(this.Resources)) + for k := range this.Resources { + keysForResources = append(keysForResources, string(k)) + } + github_com_gogo_protobuf_sortkeys.Strings(keysForResources) + mapStringForResources := "k8s_io_api_core_v1.ResourceList{" + for _, k := range keysForResources { + mapStringForResources += fmt.Sprintf("%v: %v,", k, this.Resources[k8s_io_api_core_v1.ResourceName(k)]) + } + mapStringForResources += "}" s := strings.Join([]string{`&TaskSpec{`, `RunCommand:` + fmt.Sprintf("%v", this.RunCommand) + `,`, `ProjectId:` + fmt.Sprintf("%v", this.ProjectId) + `,`, @@ -1366,6 +1426,7 @@ func (this *TaskSpec) String() string { `Secrets:` + repeatedStringForSecrets + `,`, `Pipeline:` + repeatedStringForPipeline + `,`, `Source:` + strings.Replace(strings.Replace(this.Source.String(), "ProjectSource", "ProjectSource", 1), `&`, ``, 1) + `,`, + `Resources:` + mapStringForResources + `,`, `}`, }, "") return s @@ -2869,6 +2930,135 @@ func (m *TaskSpec) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Resources", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Resources == nil { + m.Resources = make(k8s_io_api_core_v1.ResourceList) + } + var mapkey k8s_io_api_core_v1.ResourceName + mapvalue := &resource.Quantity{} + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthGenerated + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return ErrInvalidLengthGenerated + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = k8s_io_api_core_v1.ResourceName(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var mapmsglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapmsglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if mapmsglen < 0 { + return ErrInvalidLengthGenerated + } + postmsgIndex := iNdEx + mapmsglen + if postmsgIndex < 0 { + return ErrInvalidLengthGenerated + } + if postmsgIndex > l { + return io.ErrUnexpectedEOF + } + mapvalue = &resource.Quantity{} + if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { + return err + } + iNdEx = postmsgIndex + } else { + iNdEx = entryPreIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.Resources[k8s_io_api_core_v1.ResourceName(mapkey)] = *mapvalue + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) diff --git a/api/v1alpha1/generated.proto b/api/v1alpha1/generated.proto index 6a3b03b7..9d7af1e7 100644 --- a/api/v1alpha1/generated.proto +++ b/api/v1alpha1/generated.proto @@ -20,6 +20,7 @@ syntax = "proto2"; package teainspace.com.ame.pkg.apis.ame.v1alpha1; +import "k8s.io/apimachinery/pkg/api/resource/generated.proto"; import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto"; // Package-wide variables from generator "generated". @@ -146,6 +147,9 @@ message TaskSpec { // source defines where AME will pull the project from. // This can either be AME's own object storage or a git repository. optional ProjectSource source = 6; + + // Resource define what resources this Task requires. + map resources = 7; } // TaskStatus defines the observed state of Task diff --git a/api/v1alpha1/task_types.go b/api/v1alpha1/task_types.go index 8464eea9..7ca93eea 100644 --- a/api/v1alpha1/task_types.go +++ b/api/v1alpha1/task_types.go @@ -57,6 +57,9 @@ type TaskSpec struct { // source defines where AME will pull the project from. // This can either be AME's own object storage or a git repository. Source ProjectSource `json:"source,omitempty"` + + // Resources define what resources this Task requires. + Resources v1.ResourceList `json:"resources,omitempty"` } // A ProjectSource describes where AME will fetch the project from. @@ -215,6 +218,7 @@ func NewTask(runCmd string, projectId string) *Task { Env: []TaskEnvVar{}, Secrets: []TaskSecret{}, Pipeline: []PipelineStep{}, + Resources: v1.ResourceList{}, }, } } diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index d52de866..1ce15fb4 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -22,6 +22,7 @@ limitations under the License. package v1alpha1 import ( + "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/runtime" ) @@ -265,6 +266,13 @@ func (in *TaskSpec) DeepCopyInto(out *TaskSpec) { } } out.Source = in.Source + if in.Resources != nil { + in, out := &in.Resources, &out.Resources + *out = make(v1.ResourceList, len(*in)) + for key, val := range *in { + (*out)[key] = val.DeepCopy() + } + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TaskSpec. diff --git a/cmd/ame/cli_test.go b/cmd/ame/cli_test.go index 17c52d06..369335a6 100644 --- a/cmd/ame/cli_test.go +++ b/cmd/ame/cli_test.go @@ -20,6 +20,7 @@ import ( "github.com/google/go-cmp/cmp" "golang.org/x/sync/errgroup" + corev1 "k8s.io/api/core/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/ActiveState/vt10x" @@ -763,8 +764,9 @@ func TestCreateTaskConfig(t *testing.T) { Value: "val1", }, }, - Secrets: []amev1alpha1.TaskSecret{}, - Pipeline: []amev1alpha1.PipelineStep{}, + Secrets: []amev1alpha1.TaskSecret{}, + Pipeline: []amev1alpha1.PipelineStep{}, + Resources: corev1.ResourceList{}, }, }, } diff --git a/config/crd/bases/ame.teainspace.com_reccurringtasks.yaml b/config/crd/bases/ame.teainspace.com_reccurringtasks.yaml index ecf5fd6c..93f27bf3 100644 --- a/config/crd/bases/ame.teainspace.com_reccurringtasks.yaml +++ b/config/crd/bases/ame.teainspace.com_reccurringtasks.yaml @@ -115,6 +115,15 @@ spec: description: A unique identifier for the project wich the Task will be running based on. type: string + resources: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: Resource define what resources this Task requires. + type: object runcommand: description: 'The command AME will use to execute the Task. The command must be runnable from a bash shell. TODO: define propper diff --git a/config/crd/bases/ame.teainspace.com_tasks.yaml b/config/crd/bases/ame.teainspace.com_tasks.yaml index 18359d7a..36650a99 100644 --- a/config/crd/bases/ame.teainspace.com_tasks.yaml +++ b/config/crd/bases/ame.teainspace.com_tasks.yaml @@ -109,6 +109,15 @@ spec: description: A unique identifier for the project wich the Task will be running based on. type: string + resources: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: Resource define what resources this Task requires. + type: object runcommand: description: 'The command AME will use to execute the Task. The command must be runnable from a bash shell. TODO: define propper requirements diff --git a/generated/clientset/versioned/clientset.go b/generated/clientset/versioned/clientset.go index 7f1654ce..34059a49 100644 --- a/generated/clientset/versioned/clientset.go +++ b/generated/clientset/versioned/clientset.go @@ -20,8 +20,8 @@ package versioned import ( "fmt" - amev1alpha1 "teainspace.com/ame/generated/clientset/versioned/typed/ame/v1alpha1" "net/http" + amev1alpha1 "teainspace.com/ame/generated/clientset/versioned/typed/ame/v1alpha1" discovery "k8s.io/client-go/discovery" rest "k8s.io/client-go/rest" diff --git a/generated/clientset/versioned/fake/register.go b/generated/clientset/versioned/fake/register.go index 98013586..f6af753f 100644 --- a/generated/clientset/versioned/fake/register.go +++ b/generated/clientset/versioned/fake/register.go @@ -19,12 +19,12 @@ limitations under the License. package fake import ( - amev1alpha1 "teainspace.com/ame/api/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" serializer "k8s.io/apimachinery/pkg/runtime/serializer" utilruntime "k8s.io/apimachinery/pkg/util/runtime" + amev1alpha1 "teainspace.com/ame/api/v1alpha1" ) var scheme = runtime.NewScheme() diff --git a/generated/clientset/versioned/scheme/register.go b/generated/clientset/versioned/scheme/register.go index 33ff61c1..393c4d51 100644 --- a/generated/clientset/versioned/scheme/register.go +++ b/generated/clientset/versioned/scheme/register.go @@ -19,12 +19,12 @@ limitations under the License. package scheme import ( - amev1alpha1 "teainspace.com/ame/api/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" serializer "k8s.io/apimachinery/pkg/runtime/serializer" utilruntime "k8s.io/apimachinery/pkg/util/runtime" + amev1alpha1 "teainspace.com/ame/api/v1alpha1" ) var Scheme = runtime.NewScheme() diff --git a/generated/clientset/versioned/typed/ame/v1alpha1/ame_client.go b/generated/clientset/versioned/typed/ame/v1alpha1/ame_client.go index 126ff54d..2a5f5a3f 100644 --- a/generated/clientset/versioned/typed/ame/v1alpha1/ame_client.go +++ b/generated/clientset/versioned/typed/ame/v1alpha1/ame_client.go @@ -19,11 +19,11 @@ limitations under the License. package v1alpha1 import ( - "teainspace.com/ame/generated/clientset/versioned/scheme" "net/http" + "teainspace.com/ame/generated/clientset/versioned/scheme" - v1alpha1 "teainspace.com/ame/api/v1alpha1" rest "k8s.io/client-go/rest" + v1alpha1 "teainspace.com/ame/api/v1alpha1" ) type AmeV1alpha1Interface interface { diff --git a/generated/clientset/versioned/typed/ame/v1alpha1/fake/fake_reccurringtask.go b/generated/clientset/versioned/typed/ame/v1alpha1/fake/fake_reccurringtask.go index 3ca77aac..205c3759 100644 --- a/generated/clientset/versioned/typed/ame/v1alpha1/fake/fake_reccurringtask.go +++ b/generated/clientset/versioned/typed/ame/v1alpha1/fake/fake_reccurringtask.go @@ -21,13 +21,13 @@ package fake import ( "context" - v1alpha1 "teainspace.com/ame/api/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" schema "k8s.io/apimachinery/pkg/runtime/schema" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" testing "k8s.io/client-go/testing" + v1alpha1 "teainspace.com/ame/api/v1alpha1" ) // FakeReccurringTasks implements ReccurringTaskInterface diff --git a/generated/clientset/versioned/typed/ame/v1alpha1/fake/fake_task.go b/generated/clientset/versioned/typed/ame/v1alpha1/fake/fake_task.go index 9db6db31..c4d67056 100644 --- a/generated/clientset/versioned/typed/ame/v1alpha1/fake/fake_task.go +++ b/generated/clientset/versioned/typed/ame/v1alpha1/fake/fake_task.go @@ -21,13 +21,13 @@ package fake import ( "context" - v1alpha1 "teainspace.com/ame/api/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" schema "k8s.io/apimachinery/pkg/runtime/schema" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" testing "k8s.io/client-go/testing" + v1alpha1 "teainspace.com/ame/api/v1alpha1" ) // FakeTasks implements TaskInterface diff --git a/generated/clientset/versioned/typed/ame/v1alpha1/reccurringtask.go b/generated/clientset/versioned/typed/ame/v1alpha1/reccurringtask.go index a4f3f92b..dabc6abe 100644 --- a/generated/clientset/versioned/typed/ame/v1alpha1/reccurringtask.go +++ b/generated/clientset/versioned/typed/ame/v1alpha1/reccurringtask.go @@ -23,11 +23,11 @@ import ( scheme "teainspace.com/ame/generated/clientset/versioned/scheme" "time" - v1alpha1 "teainspace.com/ame/api/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" rest "k8s.io/client-go/rest" + v1alpha1 "teainspace.com/ame/api/v1alpha1" ) // ReccurringTasksGetter has a method to return a ReccurringTaskInterface. diff --git a/generated/clientset/versioned/typed/ame/v1alpha1/task.go b/generated/clientset/versioned/typed/ame/v1alpha1/task.go index 88ee3254..8d573287 100644 --- a/generated/clientset/versioned/typed/ame/v1alpha1/task.go +++ b/generated/clientset/versioned/typed/ame/v1alpha1/task.go @@ -23,11 +23,11 @@ import ( scheme "teainspace.com/ame/generated/clientset/versioned/scheme" "time" - v1alpha1 "teainspace.com/ame/api/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" rest "k8s.io/client-go/rest" + v1alpha1 "teainspace.com/ame/api/v1alpha1" ) // TasksGetter has a method to return a TaskInterface. diff --git a/internal/clients/clients.go b/internal/clients/clients.go index b415212f..3cfb6322 100644 --- a/internal/clients/clients.go +++ b/internal/clients/clients.go @@ -10,6 +10,7 @@ import ( "teainspace.com/ame/internal/common" argo "github.com/argoproj/argo-workflows/v3/pkg/client/clientset/versioned/typed/workflow/v1alpha1" + corev1 "k8s.io/api/core/v1" ) // TODO: should we handle errors when creating clients instead of dying? @@ -52,3 +53,7 @@ func RecTasksClientFromConfig(cfg *rest.Config, ns string) v1alpha1.ReccurringTa func GenericTaskClientFromConfig(cfg *rest.Config, ns string) common.AmeGenClient[*amev1alpha1.Task] { return common.NewAmeGenClient[*amev1alpha1.Task](TasksClientFromConfig(cfg, ns)) } + +func GenericPodClientFromConfig(cfg *rest.Config, ns string) common.AmeGenClient[*corev1.Pod] { + return common.NewAmeGenClient[*corev1.Pod](PodClientFromConfig(cfg, ns)) +} diff --git a/internal/workflows/workflows.go b/internal/workflows/workflows.go index 2297907c..5182e631 100644 --- a/internal/workflows/workflows.go +++ b/internal/workflows/workflows.go @@ -5,6 +5,7 @@ package workflows import ( "context" + "encoding/json" "fmt" "time" @@ -32,7 +33,10 @@ func GenWorkflowSpec(task v1alpha1.Task) (argo.WorkflowSpec, error) { } setupWfTemplate := genWfSetupTemplate("setup", &task, taskVolName(&task)) - mainWfTemplate := genWfTemplate("main", &task, taskVolName(&task)) + mainWfTemplate, err := genWfTemplate("main", &task, taskVolName(&task)) + if err != nil { + return argo.WorkflowSpec{}, err + } wfSteps := []argo.ParallelSteps{ { @@ -83,7 +87,11 @@ func GenPipelineWf(t *v1alpha1.Task) (*argo.WorkflowSpec, error) { for _, s := range t.Spec.Pipeline { tSpec := v1alpha1.WfSpecFromPipelineStep(t, s) - wfTemplate := genWfTemplate(s.TaskName, v1alpha1.NewTaskFromSpec(tSpec, t.GetName()+s.TaskName), taskVolName(t)) + wfTemplate, err := genWfTemplate(s.TaskName, v1alpha1.NewTaskFromSpec(tSpec, t.GetName()+s.TaskName), taskVolName(t)) + if err != nil { + return nil, err + } + wfSteps = append(wfSteps, argo.ParallelSteps{ Steps: []argo.WorkflowStep{ { @@ -153,7 +161,12 @@ func taskVolName(t *v1alpha1.Task) string { return fmt.Sprintf("%s-volume", t.GetName()) } -func genWfTemplate(templateName string, t *v1alpha1.Task, volName string) argo.Template { +func genWfTemplate(templateName string, t *v1alpha1.Task, volName string) (argo.Template, error) { + podSpecPatch, err := podSpecPatch(t.Spec) + if err != nil { + return argo.Template{}, err + } + return argo.Template{ Name: templateName, @@ -204,9 +217,21 @@ func genWfTemplate(templateName string, t *v1alpha1.Task, volName string) argo.T }, }, - PodSpecPatch: `{"containers":[{"name":"main", "resources":{"limits":{ - "memory": "3Gi" }}}]}`, + PodSpecPatch: podSpecPatch, + }, nil +} + +func podSpecPatch(t v1alpha1.TaskSpec) (string, error) { + if len(t.Resources) == 0 { + return "", nil } + + requirements, err := json.Marshal(t.Resources) + if err != nil { + return "", err + } + + return fmt.Sprintf("{\"containers\":[{\"name\":\"main\", \"resources\":{\"limits\":%s}}]}", requirements), nil } // TaskEnvToContainerEnv constructs an array of EnvVar from t's environment diff --git a/server/grpc/task.pb.go b/server/grpc/task.pb.go index 63c7e7cf..74f4186b 100644 --- a/server/grpc/task.pb.go +++ b/server/grpc/task.pb.go @@ -4,7 +4,6 @@ package task import ( - v1alpha1 "teainspace.com/ame/api/v1alpha1" context "context" fmt "fmt" proto "github.com/golang/protobuf/proto" @@ -15,6 +14,7 @@ import ( v1 "k8s.io/apimachinery/pkg/apis/meta/v1" math "math" math_bits "math/bits" + v1alpha1 "teainspace.com/ame/api/v1alpha1" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/tests/main_test.go b/tests/main_test.go index 45403f51..89cb23c2 100644 --- a/tests/main_test.go +++ b/tests/main_test.go @@ -5,9 +5,14 @@ import ( "context" "log" "os" + "strings" "testing" "time" + "github.com/google/go-cmp/cmp" + v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/resource" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "teainspace.com/ame/api/v1alpha1" "teainspace.com/ame/internal/clients" "teainspace.com/ame/internal/common" @@ -19,6 +24,7 @@ var ( ctx context.Context testCfg testcfg.TestEnvConfig taskClient common.AmeGenClient[*v1alpha1.Task] + podClient common.AmeGenClient[*v1.Pod] ) func TestMain(m *testing.M) { @@ -30,7 +36,7 @@ func TestMain(m *testing.M) { } taskClient = clients.GenericTaskClientFromConfig(restCfg, testCfg.Namespace) - + podClient = clients.GenericPodClientFromConfig(restCfg, testCfg.Namespace) os.Exit(m.Run()) } @@ -66,3 +72,51 @@ func TestGitSourceExecution(t *testing.T) { } } } + +func TestCanGenerateWorkflowWithResources(t *testing.T) { + _, err := testenv.SetupCluster(ctx, testCfg) + if err != nil { + t.Fatal(err) + } + + task := v1alpha1.NewTask("test", "myproject") + task.Spec.Resources = v1.ResourceList{ + "memory": resource.MustParse("8"), + "cpu": resource.MustParse("4"), + "nvidia.com/gpu": resource.MustParse("1"), + } + + task, err = taskClient.Create(ctx, task) + if err != nil { + t.Fatal(err) + } + + ctx, cancel := context.WithTimeout(ctx, time.Second*120) + defer cancel() + + podChan, err := podClient.Watch(ctx, metav1.ListOptions{ + LabelSelector: "ame-task=" + task.GetName(), + }) + if err != nil { + t.Fatal(err) + } + + for p := range podChan { + // We are only interested in the pod for the main, as that is where the pod spec will be applied. + if strings.Contains(p.GetName(), "setup") { + continue + } + + for _, c := range p.Spec.Containers { + if c.Name == "main" { + diff := cmp.Diff(c.Resources.Limits, task.Spec.Resources) + if diff != "" { + t.Errorf("expected pod resource limits to match task resources but got diff:\n%s", diff) + } + return + } + } + } + + t.Fatal("could not find a valid container") +}