Closed webvictim closed 5 years ago
We should be able to set CPU/memory limits on jobs which can override the defaults set by a cluster.
I feel that something like this should work, but it doesn't currently:
Kube.Run(kube.Job{ Name: Sprintf("tele-release-%v-%s-%s", ID(), os, arch), Spec: _{ Template: _{ Spec: _{ Volumes: []_{ {Name: "creds", Secret: _{SecretName: "creds"}}, {Name: "gitkey", Secret: _{SecretName: "gitkey"}}, {Name: "aws-creds", Secret: _{SecretName: "aws-creds"}}, {Name: "scripts", ConfigMap: _{Name: "scripts"}}, {Name: "cache", EmptyDir: _{}}, {Name: "tmp", EmptyDir: _{}}, }, Containers: []_{ { Name: containerLabel, Image: forceImage, Command: Strings("force", "-d"), Env: []_{ {Name: "FORCE_ID", Value: ID()}, {Name: "FORCE_SCRIPT", Value: script}, {Name: "FORCE_SETUP", Value: containerSetupScript}, {Name: "GOOGLE_CREDENTIALS", Value: "/var/secrets/google/force-creds.json"}, {Name: "GIT_PRIVATE_KEY_FILE", Value: "/var/secrets/git/github.key"}, {Name: "GIT_KNOWN_HOSTS_FILE", Value: "/var/secrets/git/known_hosts"}, }, VolumeMounts: []_{ {Name: "tmp", MountPath: "/tmp"}, {Name: "cache", MountPath: "/root/.local"}, {Name: "creds", MountPath: "/var/secrets/google"}, {Name: "gitkey", MountPath: "/var/secrets/git"}, {Name: "scripts", MountPath: "/mnt/scripts"}, {Name: "aws-creds", MountPath: "/root/.aws"}, }, Resources: _{ Limits: _{ CPU: "1", }, }, SecurityContext: _{Privileged: true}, }, }, }, }, }, })
Error:
Original Error: *force.CodeError Failed calling function Include with args []interface {}{"release-lib.force"} reflect.Value.SetMapIndex: value of type string is not assignable to type v1.ResourceName
It works fine without the Resources: block.
Resources:
I tried various combinations of:
CPU: "1", CPU: "1000m", CPU: 1, CPU: 1000m, "CPU": "1", "CPU": 1 etc
Not sure whether I've got a problem with my structs or there's a bug. I can't figure out what sort of value it's expecting by reading the protobufs.
Implemented in #87
We should be able to set CPU/memory limits on jobs which can override the defaults set by a cluster.
I feel that something like this should work, but it doesn't currently:
Error:
Original Error: *force.CodeError Failed calling function Include with args []interface {}{"release-lib.force"} reflect.Value.SetMapIndex: value of type string is not assignable to type v1.ResourceName
It works fine without the
Resources:
block.I tried various combinations of:
Not sure whether I've got a problem with my structs or there's a bug. I can't figure out what sort of value it's expecting by reading the protobufs.