Content-Length: 243125 | pFad | http://github.com/nginxinc/nginx-supportpkg-for-k8s/commit/32e3da6d6f8a6324ea5ebf3ff01e1389d3973947

F1 Merge pull request #67 from nginxinc/areste-bugs · nginxinc/nginx-supportpkg-for-k8s@32e3da6 · GitHub
Skip to content

Commit

Permalink
Merge pull request #67 from nginxinc/areste-bugs
Browse files Browse the repository at this point in the history
Fix hardcoded container name for nic jobs
  • Loading branch information
mrajagopal authored Oct 15, 2024
2 parents 5da9768 + 8b5b731 commit 32e3da6
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions pkg/jobs/nic_job_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"bytes"
"context"
"encoding/json"
"fmt"
"github.com/nginxinc/nginx-k8s-supportpkg/pkg/crds"
"github.com/nginxinc/nginx-k8s-supportpkg/pkg/data_collector"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand All @@ -45,12 +46,16 @@ func NICJobList() []Job {
} else {
for _, pod := range pods.Items {
if strings.Contains(pod.Name, "ingress") {
res, err := dc.PodExecutor(namespace, pod.Name, "nginx-ingress", command, ctx)
if err != nil {
jobResult.Error = err
dc.Logger.Printf("\tCommand execution %s failed for pod %s in namespace %s: %v\n", command, pod.Name, namespace, err)
} else {
jobResult.Files[filepath.Join(dc.BaseDir, "exec", namespace, pod.Name+"__nginx-ingress-version.txt")] = res
for _, container := range pod.Spec.Containers {

res, err := dc.PodExecutor(namespace, pod.Name, container.Name, command, ctx)
if err != nil {
jobResult.Error = err
dc.Logger.Printf("\tCommand execution %s failed for pod %s in namespace %s: %v\n", command, pod.Name, namespace, err)
} else {
fileName := fmt.Sprintf("%s__%s__nginx-ingress-version.txt", pod.Name, container.Name)
jobResult.Files[filepath.Join(dc.BaseDir, "exec", namespace, fileName)] = res
}
}
}
}
Expand All @@ -72,12 +77,15 @@ func NICJobList() []Job {
} else {
for _, pod := range pods.Items {
if strings.Contains(pod.Name, "ingress") {
res, err := dc.PodExecutor(namespace, pod.Name, "nginx-ingress", command, ctx)
if err != nil {
jobResult.Error = err
dc.Logger.Printf("\tCommand execution %s failed for pod %s in namespace %s: %v\n", command, pod.Name, namespace, err)
} else {
jobResult.Files[filepath.Join(dc.BaseDir, "exec", namespace, pod.Name+"__nginx-t.txt")] = res
for _, container := range pod.Spec.Containers {
res, err := dc.PodExecutor(namespace, pod.Name, container.Name, command, ctx)
if err != nil {
jobResult.Error = err
dc.Logger.Printf("\tCommand execution %s failed for pod %s in namespace %s: %v\n", command, pod.Name, namespace, err)
} else {
fileName := fmt.Sprintf("%s__%s__nginx-t.txt", pod.Name, container.Name)
jobResult.Files[filepath.Join(dc.BaseDir, "exec", namespace, fileName)] = res
}
}
}
}
Expand Down

0 comments on commit 32e3da6

Please sign in to comment.








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/nginxinc/nginx-supportpkg-for-k8s/commit/32e3da6d6f8a6324ea5ebf3ff01e1389d3973947

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy