File tree Expand file tree Collapse file tree 3 files changed +20
-1
lines changed
flyteplugins/go/tasks/pluginmachinery/flytek8s Expand file tree Collapse file tree 3 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,10 @@ cmd/single/dist: export FLYTECONSOLE_VERSION ?= latest
18
18
cmd/single/dist :
19
19
script/get_flyteconsole_dist.sh
20
20
21
+ .PHONY : run
22
+ run : cmd/single/dist
23
+ POD_NAMESPACE=flyte go run -tags console cmd/main.go start --config ~ /.flyte/flyte-single-binary-local.yaml
24
+
21
25
.PHONY : compile
22
26
compile : cmd/single/dist
23
27
go build -tags console -v -o flyte -ldflags=$(LD_FLAGS ) ./cmd/
Original file line number Diff line number Diff line change 7
7
8
8
"github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/core"
9
9
pluginmachinery_core "github.com/flyteorg/flyte/flyteplugins/go/tasks/pluginmachinery/core"
10
+ "github.com/flyteorg/flyte/flyteplugins/go/tasks/pluginmachinery/flytek8s/config"
10
11
)
11
12
12
13
func ToK8sEnvVar (env []* core.KeyValuePair ) []v1.EnvVar {
@@ -20,6 +21,7 @@ func ToK8sEnvVar(env []*core.KeyValuePair) []v1.EnvVar {
20
21
// TODO we should modify the container resources to contain a map of enum values?
21
22
// Also we should probably create tolerations / taints, but we could do that as a post process
22
23
func ToK8sResourceList (resources []* core.Resources_ResourceEntry ) (v1.ResourceList , error ) {
24
+ gpuResourceName := config .GetK8sPluginConfig ().GpuResourceName
23
25
k8sResources := make (v1.ResourceList , len (resources ))
24
26
for _ , r := range resources {
25
27
rVal := r .GetValue ()
@@ -38,7 +40,7 @@ func ToK8sResourceList(resources []*core.Resources_ResourceEntry) (v1.ResourceLi
38
40
}
39
41
case core .Resources_GPU :
40
42
if ! v .IsZero () {
41
- k8sResources [ResourceNvidiaGPU ] = v
43
+ k8sResources [gpuResourceName ] = v
42
44
}
43
45
case core .Resources_EPHEMERAL_STORAGE :
44
46
if ! v .IsZero () {
Original file line number Diff line number Diff line change 9
9
10
10
"github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/core"
11
11
"github.com/flyteorg/flyte/flyteplugins/go/tasks/pluginmachinery/core/mocks"
12
+ "github.com/flyteorg/flyte/flyteplugins/go/tasks/pluginmachinery/flytek8s/config"
12
13
)
13
14
14
15
func TestToK8sEnvVar (t * testing.T ) {
@@ -44,6 +45,18 @@ func TestToK8sResourceList(t *testing.T) {
44
45
assert .Equal (t , resource .MustParse ("1024Mi" ), r [v1 .ResourceMemory ])
45
46
assert .Equal (t , resource .MustParse ("1024Mi" ), r [v1 .ResourceEphemeralStorage ])
46
47
}
48
+ {
49
+ gpuResourceName := v1 .ResourceName ("amd.com/gpu" )
50
+ cfg := config .GetK8sPluginConfig ()
51
+ cfg .GpuResourceName = gpuResourceName
52
+ assert .NoError (t , config .SetK8sPluginConfig (cfg ))
53
+ r , err := ToK8sResourceList ([]* core.Resources_ResourceEntry {
54
+ {Name : core .Resources_GPU , Value : "1" },
55
+ })
56
+ assert .NoError (t , err )
57
+ assert .NotEmpty (t , r )
58
+ assert .Equal (t , resource .MustParse ("1" ), r [gpuResourceName ])
59
+ }
47
60
{
48
61
r , err := ToK8sResourceList ([]* core.Resources_ResourceEntry {})
49
62
assert .NoError (t , err )
You can’t perform that action at this time.
0 commit comments