Skip to content

Commit

Permalink
Merge pull request #327 from Sergey1011010/collect-specific-adfs-error
Browse files Browse the repository at this point in the history
Bug 1922267: collect invalid resource name error from logs
  • Loading branch information
openshift-merge-robot committed Feb 2, 2021
2 parents d770855 + fc49d99 commit 3a83980
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 1 deletion.
13 changes: 12 additions & 1 deletion docs/gathered-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,18 @@ collects logs from openshift-apiserver-operator with following substrings:
The Kubernetes API https://github.com/kubernetes/client-go/blob/master/kubernetes/typed/core/v1/pod_expansion.go#L48
Response see https://docs.openshift.com/container-platform/4.6/rest_api/workloads_apis/pod-core-v1.html#apiv1namespacesnamespacepodsnamelog

Location in archive: config/pod/openshift-apiserver-operator/logs/{pod-name}/errors.log
Location in archive: config/pod/{namespace-name}/logs/{pod-name}/errors.log


## OpenshiftAuthenticationLogs

collects logs from pods in openshift-authentication namespace with following substring:
- "AuthenticationError: invalid resource name"

The Kubernetes API https://github.com/kubernetes/client-go/blob/master/kubernetes/typed/core/v1/pod_expansion.go#L48
Response see https://docs.openshift.com/container-platform/4.6/rest_api/workloads_apis/pod-core-v1.html#apiv1namespacesnamespacepodsnamelog

Location in archive: config/pod/openshift-authentication/logs/{pod-name}/errors.log


## OpenshiftSDNControllerLogs
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
E0201 16:15:39.833795 1 errorpage.go:26] AuthenticationError: invalid resource name "openid-keycloak:test/test": [may not contain '/']
1 change: 1 addition & 0 deletions pkg/gather/clusterconfig/0_gatherer.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ var gatherFunctions = map[string]gathering{
"openshift_apiserver_operator_logs": important(GatherOpenShiftAPIServerOperatorLogs),
"openshift_sdn_logs": important(GatherOpenshiftSDNLogs),
"openshift_sdn_controller_logs": important(GatherOpenshiftSDNControllerLogs),
"openshift_authentication_logs": important(GatherOpenshiftAuthenticationLogs),
"sap_config": failable(GatherSAPConfig),
"olm_operators": failable(GatherOLMOperators),
}
Expand Down
45 changes: 45 additions & 0 deletions pkg/gather/clusterconfig/openshift_authentication_logs.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package clusterconfig

import (
"k8s.io/client-go/kubernetes"
)

// GatherOpenshiftAuthenticationLogs collects logs from pods in openshift-authentication namespace with following substring:
// - "AuthenticationError: invalid resource name"
//
// The Kubernetes API https://github.com/kubernetes/client-go/blob/master/kubernetes/typed/core/v1/pod_expansion.go#L48
// Response see https://docs.openshift.com/container-platform/4.6/rest_api/workloads_apis/pod-core-v1.html#apiv1namespacesnamespacepodsnamelog
//
// Location in archive: config/pod/openshift-authentication/logs/{pod-name}/errors.log
func GatherOpenshiftAuthenticationLogs(g *Gatherer, c chan<- gatherResult) {
messagesToSearch := []string{
"AuthenticationError: invalid resource name",
}

gatherKubeClient, err := kubernetes.NewForConfig(g.gatherProtoKubeConfig)
if err != nil {
c <- gatherResult{nil, []error{err}}
return
}

coreClient := gatherKubeClient.CoreV1()

records, err := gatherLogsFromPodsInNamespace(
g.ctx,
coreClient,
"openshift-authentication",
messagesToSearch,
86400, // last day
1024*64, // maximum 64 kb of logs
"errors",
"",
false,
)
if err != nil {
c <- gatherResult{nil, []error{err}}
return
}

c <- gatherResult{records, nil}
return
}

0 comments on commit 3a83980

Please sign in to comment.