diff --git a/pkg/apis/troubleshoot/v1beta1/collector_shared.go b/pkg/apis/troubleshoot/v1beta1/collector_shared.go index 0588d61b1..98410a23d 100644 --- a/pkg/apis/troubleshoot/v1beta1/collector_shared.go +++ b/pkg/apis/troubleshoot/v1beta1/collector_shared.go @@ -24,12 +24,12 @@ type LogLimits struct { } type Logs struct { - CollectorMeta `json:",inline" yaml:",inline"` - Name string `json:"name,omitempty" yaml:"name,omitempty"` - Selector []string `json:"selector" yaml:"selector"` - Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"` - Containers []string `json:"containers,omitempty" yaml:"containers,omitempty"` - Limits *LogLimits `json:"limits,omitempty" yaml:"omitempty"` + CollectorMeta `json:",inline" yaml:",inline"` + Name string `json:"name,omitempty" yaml:"name,omitempty"` + Selector []string `json:"selector" yaml:"selector"` + Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"` + ContainerNames []string `json:"containerNames,omitempty" yaml:"containerNames,omitempty"` + Limits *LogLimits `json:"limits,omitempty" yaml:"omitempty"` } type Run struct { diff --git a/pkg/apis/troubleshoot/v1beta1/zz_generated.deepcopy.go b/pkg/apis/troubleshoot/v1beta1/zz_generated.deepcopy.go index 1ac4a6708..618926aa5 100644 --- a/pkg/apis/troubleshoot/v1beta1/zz_generated.deepcopy.go +++ b/pkg/apis/troubleshoot/v1beta1/zz_generated.deepcopy.go @@ -893,8 +893,8 @@ func (in *Logs) DeepCopyInto(out *Logs) { *out = make([]string, len(*in)) copy(*out, *in) } - if in.Containers != nil { - in, out := &in.Containers, &out.Containers + if in.ContainerNames != nil { + in, out := &in.ContainerNames, &out.ContainerNames *out = make([]string, len(*in)) copy(*out, *in) } diff --git a/pkg/collect/logs.go b/pkg/collect/logs.go index 787729906..2810eea5a 100644 --- a/pkg/collect/logs.go +++ b/pkg/collect/logs.go @@ -36,7 +36,7 @@ func Logs(ctx *Context, logsCollector *troubleshootv1beta1.Logs) ([]byte, error) if len(pods) > 0 { for _, pod := range pods { - if len(logsCollector.Containers) == 0 { + if len(logsCollector.ContainerNames) == 0 { podLogs, err := getPodLogs(client, pod, logsCollector.Name, "", logsCollector.Limits, false) if err != nil { key := fmt.Sprintf("%s/%s-errors.json", logsCollector.Name, pod.Name) @@ -50,7 +50,7 @@ func Logs(ctx *Context, logsCollector *troubleshootv1beta1.Logs) ([]byte, error) logsOutput[k] = v } } else { - for _, container := range logsCollector.Containers { + for _, container := range logsCollector.ContainerNames { containerLogs, err := getPodLogs(client, pod, logsCollector.Name, container, logsCollector.Limits, false) if err != nil { key := fmt.Sprintf("%s/%s/%s-errors.json", logsCollector.Name, pod.Name, container)