mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 03:11:40 +00:00
Merge pull request #88235 from tanjunchen/remove-TODO001
test/e2e/framework:remove TODO and make func private
This commit is contained in:
commit
e0a8ed62a6
@ -400,7 +400,6 @@ func createTLSSecret(kubeClient clientset.Interface, namespace, secretName strin
|
||||
}
|
||||
var s *v1.Secret
|
||||
if s, err = kubeClient.CoreV1().Secrets(namespace).Get(context.TODO(), secretName, metav1.GetOptions{}); err == nil {
|
||||
// TODO: Retry the update. We don't really expect anything to conflict though.
|
||||
framework.Logf("Updating secret %v in ns %v with hosts %v", secret.Name, namespace, host)
|
||||
s.Data = secret.Data
|
||||
_, err = kubeClient.CoreV1().Secrets(namespace).Update(context.TODO(), s, metav1.UpdateOptions{})
|
||||
|
@ -41,15 +41,6 @@ import (
|
||||
clientset "k8s.io/client-go/kubernetes"
|
||||
)
|
||||
|
||||
// LogsForPod starts reading the logs for a certain pod. If the pod has more than one
|
||||
// container, opts.Container must be set. Reading stops when the context is done.
|
||||
// The stream includes formatted error messages and ends with
|
||||
// rpc error: code = Unknown desc = Error: No such container: 41a...
|
||||
// when the pod gets deleted while streaming.
|
||||
func LogsForPod(ctx context.Context, cs clientset.Interface, ns, pod string, opts *v1.PodLogOptions) (io.ReadCloser, error) {
|
||||
return cs.CoreV1().Pods(ns).GetLogs(pod, opts).Stream(ctx)
|
||||
}
|
||||
|
||||
// LogOutput determines where output from CopyAllLogs goes.
|
||||
type LogOutput struct {
|
||||
// If not nil, errors will be logged here.
|
||||
@ -110,7 +101,7 @@ func CopyAllLogs(ctx context.Context, cs clientset.Interface, ns string, to LogO
|
||||
pod.Status.ContainerStatuses[i].State.Terminated == nil) {
|
||||
continue
|
||||
}
|
||||
readCloser, err := LogsForPod(ctx, cs, ns, pod.ObjectMeta.Name,
|
||||
readCloser, err := logsForPod(ctx, cs, ns, pod.ObjectMeta.Name,
|
||||
&v1.PodLogOptions{
|
||||
Container: c.Name,
|
||||
Follow: true,
|
||||
@ -210,6 +201,15 @@ func CopyAllLogs(ctx context.Context, cs clientset.Interface, ns string, to LogO
|
||||
return nil
|
||||
}
|
||||
|
||||
// logsForPod starts reading the logs for a certain pod. If the pod has more than one
|
||||
// container, opts.Container must be set. Reading stops when the context is done.
|
||||
// The stream includes formatted error messages and ends with
|
||||
// rpc error: code = Unknown desc = Error: No such container: 41a...
|
||||
// when the pod gets deleted while streaming.
|
||||
func logsForPod(ctx context.Context, cs clientset.Interface, ns, pod string, opts *v1.PodLogOptions) (io.ReadCloser, error) {
|
||||
return cs.CoreV1().Pods(ns).GetLogs(pod, opts).Stream(ctx)
|
||||
}
|
||||
|
||||
// WatchPods prints pod status events for a certain namespace or all namespaces
|
||||
// when namespace name is empty.
|
||||
func WatchPods(ctx context.Context, cs clientset.Interface, ns string, to io.Writer) error {
|
||||
|
Loading…
Reference in New Issue
Block a user