mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-14 02:43:36 +00:00
rebase: update kubernetes to 1.26.1
update kubernetes and its dependencies to v1.26.1 Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
committed by
mergify[bot]
parent
e9e33fb851
commit
9c8de9471e
58
e2e/pod.go
58
e2e/pod.go
@ -30,7 +30,7 @@ import (
|
||||
"k8s.io/client-go/kubernetes"
|
||||
"k8s.io/kubernetes/pkg/client/conditions"
|
||||
"k8s.io/kubernetes/test/e2e/framework"
|
||||
e2elog "k8s.io/kubernetes/test/e2e/framework/log"
|
||||
e2epod "k8s.io/kubernetes/test/e2e/framework/pod"
|
||||
)
|
||||
|
||||
const errRWOPConflict = "node has pod using PersistentVolumeClaim with the same name and ReadWriteOncePod access mode."
|
||||
@ -40,17 +40,17 @@ const errRWOPConflict = "node has pod using PersistentVolumeClaim with the same
|
||||
func getDaemonSetLabelSelector(f *framework.Framework, ns, daemonSetName string) (string, error) {
|
||||
ds, err := f.ClientSet.AppsV1().DaemonSets(ns).Get(context.TODO(), daemonSetName, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
e2elog.Logf("Error getting daemonsets with name %s in namespace %s", daemonSetName, ns)
|
||||
framework.Logf("Error getting daemonsets with name %s in namespace %s", daemonSetName, ns)
|
||||
|
||||
return "", err
|
||||
}
|
||||
s, err := metav1.LabelSelectorAsSelector(ds.Spec.Selector)
|
||||
if err != nil {
|
||||
e2elog.Logf("Error parsing %s daemonset selector in namespace %s", daemonSetName, ns)
|
||||
framework.Logf("Error parsing %s daemonset selector in namespace %s", daemonSetName, ns)
|
||||
|
||||
return "", err
|
||||
}
|
||||
e2elog.Logf("LabelSelector for %s daemonsets in namespace %s: %s", daemonSetName, ns, s.String())
|
||||
framework.Logf("LabelSelector for %s daemonsets in namespace %s: %s", daemonSetName, ns, s.String())
|
||||
|
||||
return s.String(), nil
|
||||
}
|
||||
@ -58,12 +58,12 @@ func getDaemonSetLabelSelector(f *framework.Framework, ns, daemonSetName string)
|
||||
func waitForDaemonSets(name, ns string, c kubernetes.Interface, t int) error {
|
||||
timeout := time.Duration(t) * time.Minute
|
||||
start := time.Now()
|
||||
e2elog.Logf("Waiting up to %v for all daemonsets in namespace '%s' to start", timeout, ns)
|
||||
framework.Logf("Waiting up to %v for all daemonsets in namespace '%s' to start", timeout, ns)
|
||||
|
||||
return wait.PollImmediate(poll, timeout, func() (bool, error) {
|
||||
ds, err := c.AppsV1().DaemonSets(ns).Get(context.TODO(), name, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
e2elog.Logf("Error getting daemonsets in namespace: '%s': %v", ns, err)
|
||||
framework.Logf("Error getting daemonsets in namespace: '%s': %v", ns, err)
|
||||
if strings.Contains(err.Error(), "not found") {
|
||||
return false, nil
|
||||
}
|
||||
@ -75,7 +75,7 @@ func waitForDaemonSets(name, ns string, c kubernetes.Interface, t int) error {
|
||||
}
|
||||
dNum := ds.Status.DesiredNumberScheduled
|
||||
ready := ds.Status.NumberReady
|
||||
e2elog.Logf(
|
||||
framework.Logf(
|
||||
"%d / %d pods ready in namespace '%s' in daemonset '%s' (%d seconds elapsed)",
|
||||
ready,
|
||||
dNum,
|
||||
@ -98,7 +98,7 @@ func findPodAndContainerName(f *framework.Framework, ns, cn string, opt *metav1.
|
||||
listErr error
|
||||
)
|
||||
err := wait.PollImmediate(poll, timeout, func() (bool, error) {
|
||||
podList, listErr = f.PodClientNS(ns).List(context.TODO(), *opt)
|
||||
podList, listErr = e2epod.PodClientNS(f, ns).List(context.TODO(), *opt)
|
||||
if listErr != nil {
|
||||
if isRetryableAPIError(listErr) {
|
||||
return false, nil
|
||||
@ -137,14 +137,14 @@ func getCommandInPodOpts(
|
||||
f *framework.Framework,
|
||||
c, ns, cn string,
|
||||
opt *metav1.ListOptions,
|
||||
) (framework.ExecOptions, error) {
|
||||
) (e2epod.ExecOptions, error) {
|
||||
cmd := []string{"/bin/sh", "-c", c}
|
||||
pName, cName, err := findPodAndContainerName(f, ns, cn, opt)
|
||||
if err != nil {
|
||||
return framework.ExecOptions{}, err
|
||||
return e2epod.ExecOptions{}, err
|
||||
}
|
||||
|
||||
return framework.ExecOptions{
|
||||
return e2epod.ExecOptions{
|
||||
Command: cmd,
|
||||
PodName: pName,
|
||||
Namespace: ns,
|
||||
@ -188,7 +188,7 @@ func execCommandInDaemonsetPod(
|
||||
}
|
||||
|
||||
cmd := []string{"/bin/sh", "-c", c}
|
||||
podOpt := framework.ExecOptions{
|
||||
podOpt := e2epod.ExecOptions{
|
||||
Command: cmd,
|
||||
Namespace: ns,
|
||||
PodName: podName,
|
||||
@ -204,7 +204,7 @@ func execCommandInDaemonsetPod(
|
||||
|
||||
// listPods returns slice of pods matching given ListOptions and namespace.
|
||||
func listPods(f *framework.Framework, ns string, opt *metav1.ListOptions) ([]v1.Pod, error) {
|
||||
podList, err := f.PodClientNS(ns).List(context.TODO(), *opt)
|
||||
podList, err := e2epod.PodClientNS(f, ns).List(context.TODO(), *opt)
|
||||
if len(podList.Items) == 0 {
|
||||
return podList.Items, fmt.Errorf("podlist for label '%s' in namespace %s is empty", opt.LabelSelector, ns)
|
||||
}
|
||||
@ -212,18 +212,18 @@ func listPods(f *framework.Framework, ns string, opt *metav1.ListOptions) ([]v1.
|
||||
return podList.Items, err
|
||||
}
|
||||
|
||||
func execWithRetry(f *framework.Framework, opts *framework.ExecOptions) (string, string, error) {
|
||||
func execWithRetry(f *framework.Framework, opts *e2epod.ExecOptions) (string, string, error) {
|
||||
timeout := time.Duration(deployTimeout) * time.Minute
|
||||
var stdOut, stdErr string
|
||||
err := wait.PollImmediate(poll, timeout, func() (bool, error) {
|
||||
var execErr error
|
||||
stdOut, stdErr, execErr = f.ExecWithOptions(*opts)
|
||||
stdOut, stdErr, execErr = e2epod.ExecWithOptions(f, *opts)
|
||||
if execErr != nil {
|
||||
if isRetryableAPIError(execErr) {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
e2elog.Logf("failed to execute command: %v", execErr)
|
||||
framework.Logf("failed to execute command: %v", execErr)
|
||||
|
||||
return false, fmt.Errorf("failed to execute command: %w", execErr)
|
||||
}
|
||||
@ -242,7 +242,7 @@ func execCommandInPod(f *framework.Framework, c, ns string, opt *metav1.ListOpti
|
||||
|
||||
stdOut, stdErr, err := execWithRetry(f, &podOpt)
|
||||
if stdErr != "" {
|
||||
e2elog.Logf("stdErr occurred: %v", stdErr)
|
||||
framework.Logf("stdErr occurred: %v", stdErr)
|
||||
}
|
||||
|
||||
return stdOut, stdErr, err
|
||||
@ -258,7 +258,7 @@ func execCommandInContainer(
|
||||
|
||||
stdOut, stdErr, err := execWithRetry(f, &podOpt)
|
||||
if stdErr != "" {
|
||||
e2elog.Logf("stdErr occurred: %v", stdErr)
|
||||
framework.Logf("stdErr occurred: %v", stdErr)
|
||||
}
|
||||
|
||||
return stdOut, stdErr, err
|
||||
@ -268,7 +268,7 @@ func execCommandInContainerByPodName(
|
||||
f *framework.Framework, shellCmd, namespace, podName, containerName string,
|
||||
) (string, string, error) {
|
||||
cmd := []string{"/bin/sh", "-c", shellCmd}
|
||||
execOpts := framework.ExecOptions{
|
||||
execOpts := e2epod.ExecOptions{
|
||||
Command: cmd,
|
||||
PodName: podName,
|
||||
Namespace: namespace,
|
||||
@ -281,7 +281,7 @@ func execCommandInContainerByPodName(
|
||||
|
||||
stdOut, stdErr, err := execWithRetry(f, &execOpts)
|
||||
if stdErr != "" {
|
||||
e2elog.Logf("stdErr occurred: %v", stdErr)
|
||||
framework.Logf("stdErr occurred: %v", stdErr)
|
||||
}
|
||||
|
||||
return stdOut, stdErr, err
|
||||
@ -298,7 +298,7 @@ func execCommandInToolBoxPod(f *framework.Framework, c, ns string) (string, stri
|
||||
|
||||
stdOut, stdErr, err := execWithRetry(f, &podOpt)
|
||||
if stdErr != "" {
|
||||
e2elog.Logf("stdErr occurred: %v", stdErr)
|
||||
framework.Logf("stdErr occurred: %v", stdErr)
|
||||
}
|
||||
|
||||
return stdOut, stdErr, err
|
||||
@ -312,7 +312,7 @@ func execCommandInPodAndAllowFail(f *framework.Framework, c, ns string, opt *met
|
||||
|
||||
stdOut, stdErr, err := execWithRetry(f, &podOpt)
|
||||
if err != nil {
|
||||
e2elog.Logf("command %s failed: %v", c, err)
|
||||
framework.Logf("command %s failed: %v", c, err)
|
||||
}
|
||||
|
||||
return stdOut, stdErr
|
||||
@ -351,7 +351,7 @@ func createAppErr(c kubernetes.Interface, app *v1.Pod, timeout int, errString st
|
||||
func waitForPodInRunningState(name, ns string, c kubernetes.Interface, t int, expectedError string) error {
|
||||
timeout := time.Duration(t) * time.Minute
|
||||
start := time.Now()
|
||||
e2elog.Logf("Waiting up to %v to be in Running state", name)
|
||||
framework.Logf("Waiting up to %v to be in Running state", name)
|
||||
|
||||
return wait.PollImmediate(poll, timeout, func() (bool, error) {
|
||||
pod, err := c.CoreV1().Pods(ns).Get(context.TODO(), name, metav1.GetOptions{})
|
||||
@ -376,13 +376,13 @@ func waitForPodInRunningState(name, ns string, c kubernetes.Interface, t int, ex
|
||||
return false, err
|
||||
}
|
||||
if strings.Contains(events.String(), expectedError) {
|
||||
e2elog.Logf("Expected Error %q found successfully", expectedError)
|
||||
framework.Logf("Expected Error %q found successfully", expectedError)
|
||||
|
||||
return true, err
|
||||
}
|
||||
}
|
||||
case v1.PodUnknown:
|
||||
e2elog.Logf(
|
||||
framework.Logf(
|
||||
"%s app is in %s phase expected to be in Running state (%d seconds elapsed)",
|
||||
name,
|
||||
pod.Status.Phase,
|
||||
@ -400,7 +400,7 @@ func deletePod(name, ns string, c kubernetes.Interface, t int) error {
|
||||
return fmt.Errorf("failed to delete app: %w", err)
|
||||
}
|
||||
start := time.Now()
|
||||
e2elog.Logf("Waiting for pod %v to be deleted", name)
|
||||
framework.Logf("Waiting for pod %v to be deleted", name)
|
||||
|
||||
return wait.PollImmediate(poll, timeout, func() (bool, error) {
|
||||
_, err := c.CoreV1().Pods(ns).Get(context.TODO(), name, metav1.GetOptions{})
|
||||
@ -411,7 +411,7 @@ func deletePod(name, ns string, c kubernetes.Interface, t int) error {
|
||||
if apierrs.IsNotFound(err) {
|
||||
return true, nil
|
||||
}
|
||||
e2elog.Logf("%s app to be deleted (%d seconds elapsed)", name, int(time.Since(start).Seconds()))
|
||||
framework.Logf("%s app to be deleted (%d seconds elapsed)", name, int(time.Since(start).Seconds()))
|
||||
|
||||
return false, fmt.Errorf("failed to get app: %w", err)
|
||||
}
|
||||
@ -431,7 +431,7 @@ func deletePodWithLabel(label, ns string, skipNotFound bool) error {
|
||||
label,
|
||||
fmt.Sprintf("--ignore-not-found=%t", skipNotFound))
|
||||
if err != nil {
|
||||
e2elog.Logf("failed to delete pod %v", err)
|
||||
framework.Logf("failed to delete pod %v", err)
|
||||
}
|
||||
|
||||
return err
|
||||
@ -449,7 +449,7 @@ func calculateSHA512sum(f *framework.Framework, app *v1.Pod, filePath string, op
|
||||
}
|
||||
// extract checksum from sha512sum output.
|
||||
checkSum := strings.Split(sha512sumOut, "")[0]
|
||||
e2elog.Logf("Calculated checksum %s", checkSum)
|
||||
framework.Logf("Calculated checksum %s", checkSum)
|
||||
|
||||
return checkSum, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user