diff --git a/pkg/tracejob/job.go b/pkg/tracejob/job.go index d3d9a594..8368b125 100644 --- a/pkg/tracejob/job.go +++ b/pkg/tracejob/job.go @@ -11,9 +11,9 @@ import ( "github.com/iovisor/kubectl-trace/pkg/meta" batchv1 "k8s.io/api/batch/v1" apiv1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" - "k8s.io/apimachinery/pkg/api/resource" batchv1typed "k8s.io/client-go/kubernetes/typed/batch/v1" corev1typed "k8s.io/client-go/kubernetes/typed/core/v1" ) @@ -283,8 +283,18 @@ func (t *TraceJobClient) CreateJob(nj TraceJob) (*batchv1.Job, error) { }, InitContainers: []apiv1.Container{ apiv1.Container{ - Name: "kubectl-trace-init", - Image: version.InitImageNameTag(), + Name: "kubectl-trace-init", + Image: version.InitImageNameTag(), + Resources: apiv1.ResourceRequirements{ + Requests: apiv1.ResourceList{ + apiv1.ResourceCPU: resource.MustParse("100m"), + apiv1.ResourceMemory: resource.MustParse("100Mi"), + }, + Limits: apiv1.ResourceList{ + apiv1.ResourceCPU: resource.MustParse("1"), + apiv1.ResourceMemory: resource.MustParse("1G"), + }, + }, VolumeMounts: []apiv1.VolumeMount{ apiv1.VolumeMount{ Name: "lsb-release", @@ -320,14 +330,14 @@ func (t *TraceJobClient) CreateJob(nj TraceJob) (*batchv1.Job, error) { TTY: true, Stdin: true, Resources: apiv1.ResourceRequirements{ - Requests: apiv1.ResourceList{ - apiv1.ResourceCPU: resource.MustParse("100m"), - apiv1.ResourceMemory: resource.MustParse("100Mi"), - }, - Limits: apiv1.ResourceList{ - apiv1.ResourceCPU: resource.MustParse("1"), - apiv1.ResourceMemory: resource.MustParse("1G"), - }, + Requests: apiv1.ResourceList{ + apiv1.ResourceCPU: resource.MustParse("100m"), + apiv1.ResourceMemory: resource.MustParse("100Mi"), + }, + Limits: apiv1.ResourceList{ + apiv1.ResourceCPU: resource.MustParse("1"), + apiv1.ResourceMemory: resource.MustParse("1G"), + }, }, VolumeMounts: []apiv1.VolumeMount{ apiv1.VolumeMount{