Skip to content

Commit

Permalink
Add resource requirements to initContainer, whitespace fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dalehamel committed Jan 28, 2019
1 parent ca4d3ee commit 45d9f2e
Showing 1 changed file with 21 additions and 11 deletions.
32 changes: 21 additions & 11 deletions pkg/tracejob/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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{
Expand Down

0 comments on commit 45d9f2e

Please sign in to comment.