-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #327 from Sergey1011010/collect-specific-adfs-error
Bug 1922267: collect invalid resource name error from logs
- Loading branch information
Showing
4 changed files
with
59 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...mple/config/pod/openshift-authentication/logs/oauth-openshift-6c98668d5b-ftt5n/errors.log
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 '/'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |