Skip to content

Commit de91f86

Browse files
authored
Update the gather functions to collect data from the system namespaces only (#468)
* Update the gather functions to collect data from the system namespaces only * Fix the unit test error
1 parent 8ac04e4 commit de91f86

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

pkg/gatherers/clusterconfig/const.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ var (
1818
// logTailLinesLong sets the maximum number of lines to fetch from long pod logs
1919
logTailLinesLong = int64(400)
2020

21-
defaultNamespaces = []string{"default", "kube-system", "kube-public"}
21+
defaultNamespaces = []string{"default", "kube-system", "kube-public", "openshift"}
2222
datahubGroupVersionResource = schema.GroupVersionResource{
2323
Group: "installers.datahub.sap.com", Version: "v1alpha1", Resource: "datahubs",
2424
}

pkg/gatherers/clusterconfig/container_images.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ func gatherContainerImages(ctx context.Context, coreClient corev1client.CoreV1In
6767

6868
for podIndex, pod := range pods.Items { //nolint:gocritic
6969
podPtr := &pods.Items[podIndex]
70-
if strings.HasPrefix(pod.Namespace, "openshift") && check.HasContainerInCrashloop(podPtr) {
70+
if strings.HasPrefix(pod.Namespace, "openshift-") && check.HasContainerInCrashloop(podPtr) {
7171
records = append(records, record.Record{
7272
Name: fmt.Sprintf("config/pod/%s/%s", pod.Namespace, pod.Name),
7373
Item: record.JSONMarshaller{Object: podPtr},

pkg/gatherers/clusterconfig/install_plans.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ func gatherInstallPlans(ctx context.Context,
7878
if err != nil {
7979
return nil, []error{err}
8080
}
81-
// collect from all openshift* namespaces
81+
// collect from openshift and all openshift-* namespaces
8282
for i := range config.Items {
83-
if !strings.HasPrefix(config.Items[i].Name, "openshift") {
83+
if config.Items[i].Name != "openshift" && !strings.HasPrefix(config.Items[i].Name, "openshift-") {
8484
continue
8585
}
8686
resInterface := dynamicClient.Resource(opResource).Namespace(config.Items[i].Name)

pkg/gatherers/clusterconfig/service_accounts.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ func gatherServiceAccounts(ctx context.Context, coreClient corev1client.CoreV1In
5353
var serviceAccounts []corev1.ServiceAccount
5454
var records []record.Record
5555
namespaces := defaultNamespaces
56-
// collect from all openshift* namespaces + kubernetes defaults
56+
// collect from all openshift-* namespaces + kubernetes defaults
5757
for i := range config.Items {
58-
if strings.HasPrefix(config.Items[i].Name, "openshift") {
58+
if strings.HasPrefix(config.Items[i].Name, "openshift-") {
5959
namespaces = append(namespaces, config.Items[i].Name)
6060
}
6161
}

0 commit comments

Comments
 (0)