Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the gather functions to collect data from the system namespaces only #468

Merged
merged 2 commits into from
Jul 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/gatherers/clusterconfig/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var (
// logTailLinesLong sets the maximum number of lines to fetch from long pod logs
logTailLinesLong = int64(400)

defaultNamespaces = []string{"default", "kube-system", "kube-public"}
defaultNamespaces = []string{"default", "kube-system", "kube-public", "openshift"}
datahubGroupVersionResource = schema.GroupVersionResource{
Group: "installers.datahub.sap.com", Version: "v1alpha1", Resource: "datahubs",
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/gatherers/clusterconfig/container_images.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func gatherContainerImages(ctx context.Context, coreClient corev1client.CoreV1In

for podIndex, pod := range pods.Items { //nolint:gocritic
podPtr := &pods.Items[podIndex]
if strings.HasPrefix(pod.Namespace, "openshift") && check.HasContainerInCrashloop(podPtr) {
if strings.HasPrefix(pod.Namespace, "openshift-") && check.HasContainerInCrashloop(podPtr) {
records = append(records, record.Record{
Name: fmt.Sprintf("config/pod/%s/%s", pod.Namespace, pod.Name),
Item: record.JSONMarshaller{Object: podPtr},
Expand Down
4 changes: 2 additions & 2 deletions pkg/gatherers/clusterconfig/install_plans.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ func gatherInstallPlans(ctx context.Context,
if err != nil {
return nil, []error{err}
}
// collect from all openshift* namespaces
// collect from openshift and all openshift-* namespaces
for i := range config.Items {
if !strings.HasPrefix(config.Items[i].Name, "openshift") {
if config.Items[i].Name != "openshift" && !strings.HasPrefix(config.Items[i].Name, "openshift-") {
continue
}
resInterface := dynamicClient.Resource(opResource).Namespace(config.Items[i].Name)
Expand Down
4 changes: 2 additions & 2 deletions pkg/gatherers/clusterconfig/service_accounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ func gatherServiceAccounts(ctx context.Context, coreClient corev1client.CoreV1In
var serviceAccounts []corev1.ServiceAccount
var records []record.Record
namespaces := defaultNamespaces
// collect from all openshift* namespaces + kubernetes defaults
// collect from all openshift-* namespaces + kubernetes defaults
for i := range config.Items {
if strings.HasPrefix(config.Items[i].Name, "openshift") {
if strings.HasPrefix(config.Items[i].Name, "openshift-") {
namespaces = append(namespaces, config.Items[i].Name)
}
}
Expand Down