Skip to content

Commit

Permalink
Merge pull request #76 from replicatedhq/divolgin/containerz
Browse files Browse the repository at this point in the history
Change containers to containerNames to not break kustomize
  • Loading branch information
divolgin authored Oct 31, 2019
2 parents 218b9c0 + 13fb6ab commit b19ac90
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions pkg/apis/troubleshoot/v1beta1/collector_shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions pkg/apis/troubleshoot/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pkg/collect/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit b19ac90

Please sign in to comment.