Skip to content

Commit

Permalink
Fix the get logs from Pod set (#2135)
Browse files Browse the repository at this point in the history
  • Loading branch information
johscheuer committed Sep 20, 2024
1 parent 44e50aa commit 53eff6d
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 15 deletions.
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

0 comments on commit 53eff6d

Please sign in to comment.