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

Fix the get logs from Pod set #2135

Merged
merged 1 commit into from
Sep 20, 2024
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
8 changes: 0 additions & 8 deletions e2e/fixtures/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -528,14 +528,6 @@ func (factory *Factory) UploadFile(
dst)
}

// GetLogsFromPod returns the logs for the provided Pod and container
func (factory *Factory) GetLogsFromPod(pod *corev1.Pod, container string) string {
logs, err := kubeHelper.GetLogsFromPod(context.Background(), factory.GetControllerRuntimeClient(), factory.getConfig(), pod, container, pointer.Int64(pod.CreationTimestamp.Unix()))
gomega.Expect(err).NotTo(gomega.HaveOccurred())

return logs
}

// GetLogsForPod will fetch the logs for the specified Pod and container since the provided seconds.
func (factory *Factory) GetLogsForPod(pod *corev1.Pod, container string, since *int64) string {
logs, err := kubeHelper.GetLogsFromPod(context.Background(), factory.GetControllerRuntimeClient(), factory.getConfig(), pod, container, since)
Expand Down
6 changes: 0 additions & 6 deletions e2e/fixtures/fdb_operator_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,6 @@ rules:
- update
- patch
- delete
- apiGroups:
- ""
resources:
- pods/exec
verbs:
- create
- apiGroups:
- apps.foundationdb.org
resources:
Expand Down
4 changes: 4 additions & 0 deletions e2e/test_operator/operator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ var _ = BeforeSuite(func() {
factory.GetClusterOptions()...,
)

// Make sure that the test suite is able to fetch logs from Pods.
operatorPod := factory.RandomPickOnePod(factory.GetOperatorPods(fdbCluster.Namespace()).Items)
Expect(factory.GetLogsForPod(&operatorPod, "manager", nil)).NotTo(BeEmpty())

//Load some data async into the cluster. We will only block as long as the Job is created.
factory.CreateDataLoaderIfAbsent(fdbCluster)

Expand Down
2 changes: 1 addition & 1 deletion internal/kubernetes/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ func GetLogsFromPod(
return "", err
}

req := restClient.Post().
req := restClient.Get().
Resource("pods").
Namespace(pod.Namespace).
Name(pod.Name).
Expand Down
Loading