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

rebase: update kubernetes dependencies to 1.26.1 #3638

Merged
merged 3 commits into from
Feb 3, 2023
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
564 changes: 282 additions & 282 deletions e2e/cephfs.go

Large diffs are not rendered by default.

43 changes: 21 additions & 22 deletions e2e/cephfs_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import (
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/client-go/kubernetes"
"k8s.io/kubernetes/test/e2e/framework"
e2elog "k8s.io/kubernetes/test/e2e/framework/log"
)

const (
Expand Down Expand Up @@ -106,7 +105,7 @@ func createCephfsStorageClass(
return wait.PollImmediate(poll, timeout, func() (bool, error) {
_, err = c.StorageV1().StorageClasses().Create(context.TODO(), &sc, metav1.CreateOptions{})
if err != nil {
e2elog.Logf("error creating StorageClass %q: %v", sc.Name, err)
framework.Logf("error creating StorageClass %q: %v", sc.Name, err)
if isRetryableAPIError(err) {
return false, nil
}
Expand Down Expand Up @@ -141,13 +140,13 @@ func createCephfsSecret(f *framework.Framework, secretName, userName, userKey st
func unmountCephFSVolume(f *framework.Framework, appName, pvcName string) error {
pod, err := f.ClientSet.CoreV1().Pods(f.UniqueName).Get(context.TODO(), appName, metav1.GetOptions{})
if err != nil {
e2elog.Logf("Error occurred getting pod %s in namespace %s", appName, f.UniqueName)
framework.Logf("Error occurred getting pod %s in namespace %s", appName, f.UniqueName)

return fmt.Errorf("failed to get pod: %w", err)
}
pvc, err := getPersistentVolumeClaim(f.ClientSet, f.UniqueName, pvcName)
if err != nil {
e2elog.Logf("Error occurred getting PVC %s in namespace %s", pvcName, f.UniqueName)
framework.Logf("Error occurred getting PVC %s in namespace %s", pvcName, f.UniqueName)

return fmt.Errorf("failed to get pvc: %w", err)
}
Expand All @@ -163,7 +162,7 @@ func unmountCephFSVolume(f *framework.Framework, appName, pvcName string) error
cephFSContainerName,
cephCSINamespace)
if stdErr != "" {
e2elog.Logf("StdErr occurred: %s", stdErr)
framework.Logf("StdErr occurred: %s", stdErr)
}

return err
Expand Down Expand Up @@ -339,7 +338,7 @@ func getSnapName(snapNamespace, snapName string) (string, error) {
snapIDRegex := regexp.MustCompile(`(\w+\-?){5}$`)
snapID := snapIDRegex.FindString(*sc.Status.SnapshotHandle)
snapshotName := fmt.Sprintf("csi-snap-%s", snapID)
e2elog.Logf("snapshotName= %s", snapshotName)
framework.Logf("snapshotName= %s", snapshotName)

return snapshotName, nil
}
Expand Down Expand Up @@ -464,7 +463,7 @@ func validateFscryptAndAppBinding(pvcPath, appPath string, kms kmsConfig, f *fra
if !destroyed {
return fmt.Errorf("passphrased was not destroyed: %s", msg)
} else if msg != "" {
e2elog.Logf("passphrase destroyed, but message returned: %s", msg)
framework.Logf("passphrase destroyed, but message returned: %s", msg)
}
}

Expand All @@ -479,17 +478,17 @@ func validateFscryptClone(
) {
pvc, err := loadPVC(pvcPath)
if err != nil {
e2elog.Failf("failed to load PVC: %v", err)
framework.Failf("failed to load PVC: %v", err)
}

pvc.Namespace = f.UniqueName
err = createPVCAndvalidatePV(f.ClientSet, pvc, deployTimeout)
if err != nil {
e2elog.Failf("failed to create PVC: %v", err)
framework.Failf("failed to create PVC: %v", err)
}
app, err := loadApp(appPath)
if err != nil {
e2elog.Failf("failed to load application: %v", err)
framework.Failf("failed to load application: %v", err)
}
label := make(map[string]string)
label[appKey] = appLabel
Expand All @@ -501,18 +500,18 @@ func validateFscryptClone(
}
wErr := writeDataInPod(app, &opt, f)
if wErr != nil {
e2elog.Failf("failed to write data from application %v", wErr)
framework.Failf("failed to write data from application %v", wErr)
}

pvcClone, err := loadPVC(pvcSmartClonePath)
if err != nil {
e2elog.Failf("failed to load PVC: %v", err)
framework.Failf("failed to load PVC: %v", err)
}
pvcClone.Spec.DataSource.Name = pvc.Name
pvcClone.Namespace = f.UniqueName
appClone, err := loadApp(appSmartClonePath)
if err != nil {
e2elog.Failf("failed to load application: %v", err)
framework.Failf("failed to load application: %v", err)
}
appClone.Namespace = f.UniqueName
appClone.Labels = map[string]string{
Expand All @@ -521,50 +520,50 @@ func validateFscryptClone(

err = createPVCAndApp(f.UniqueName, f, pvcClone, appClone, deployTimeout)
if err != nil {
e2elog.Failf("failed to create PVC or application (%s): %v", f.UniqueName, err)
framework.Failf("failed to create PVC or application (%s): %v", f.UniqueName, err)
}

_, csiVolumeHandle, err := getInfoFromPVC(pvcClone.Namespace, pvcClone.Name, f)
if err != nil {
e2elog.Failf("failed to get pvc info: %s", err)
framework.Failf("failed to get pvc info: %s", err)
}

if kms != noKMS && kms.canGetPassphrase() {
// check new passphrase created
stdOut, stdErr := kms.getPassphrase(f, csiVolumeHandle)
if stdOut != "" {
e2elog.Logf("successfully read the passphrase from vault: %s", stdOut)
framework.Logf("successfully read the passphrase from vault: %s", stdOut)
}
if stdErr != "" {
e2elog.Failf("failed to read passphrase from vault: %s", stdErr)
framework.Failf("failed to read passphrase from vault: %s", stdErr)
}
}

// delete parent pvc
err = deletePVCAndApp("", f, pvc, app)
if err != nil {
e2elog.Failf("failed to delete PVC or application: %v", err)
framework.Failf("failed to delete PVC or application: %v", err)
}

err = deletePVCAndApp(f.UniqueName, f, pvcClone, appClone)
if err != nil {
e2elog.Failf("failed to delete PVC or application (%s): %v", f.UniqueName, err)
framework.Failf("failed to delete PVC or application (%s): %v", f.UniqueName, err)
}

if kms != noKMS && kms.canGetPassphrase() {
// check passphrase deleted
stdOut, _ := kms.getPassphrase(f, csiVolumeHandle)
if stdOut != "" {
e2elog.Failf("passphrase found in vault while should be deleted: %s", stdOut)
framework.Failf("passphrase found in vault while should be deleted: %s", stdOut)
}
}

if kms != noKMS && kms.canVerifyKeyDestroyed() {
destroyed, msg := kms.verifyKeyDestroyed(f, csiVolumeHandle)
if !destroyed {
e2elog.Failf("passphrased was not destroyed: %s", msg)
framework.Failf("passphrased was not destroyed: %s", msg)
} else if msg != "" {
e2elog.Logf("passphrase destroyed, but message returned: %s", msg)
framework.Logf("passphrase destroyed, but message returned: %s", msg)
}
}
}
5 changes: 2 additions & 3 deletions e2e/clone.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/kubernetes/test/e2e/framework"
e2elog "k8s.io/kubernetes/test/e2e/framework/log"
)

func validateBiggerCloneFromPVC(f *framework.Framework,
Expand Down Expand Up @@ -60,14 +59,14 @@ func validateBiggerCloneFromPVC(f *framework.Framework,

pvcClone, err := loadPVC(pvcClonePath)
if err != nil {
e2elog.Failf("failed to load PVC: %v", err)
framework.Failf("failed to load PVC: %v", err)
}
pvcClone.Namespace = f.UniqueName
pvcClone.Spec.DataSource.Name = pvc.Name
pvcClone.Spec.Resources.Requests[v1.ResourceStorage] = resource.MustParse(newSize)
appClone, err := loadApp(appClonePath)
if err != nil {
e2elog.Failf("failed to load application: %v", err)
framework.Failf("failed to load application: %v", err)
}
appClone.Namespace = f.UniqueName
appClone.Labels = label
Expand Down
14 changes: 7 additions & 7 deletions e2e/deploy-vault.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
. "github.com/onsi/gomega" // nolint
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
e2elog "k8s.io/kubernetes/test/e2e/framework/log"
"k8s.io/kubernetes/test/e2e/framework"
)

var (
Expand Down Expand Up @@ -69,34 +69,34 @@ func deleteVault() {
func createORDeleteVault(action kubectlAction) {
data, err := replaceNamespaceInTemplate(vaultExamplePath + vaultServicePath)
if err != nil {
e2elog.Failf("failed to read content from %s %v", vaultExamplePath+vaultServicePath, err)
framework.Failf("failed to read content from %s %v", vaultExamplePath+vaultServicePath, err)
}

data = strings.ReplaceAll(data, "vault.default", "vault."+cephCSINamespace)

data = strings.ReplaceAll(data, "value: default", "value: "+cephCSINamespace)
err = retryKubectlInput(cephCSINamespace, action, data, deployTimeout)
if err != nil {
e2elog.Failf("failed to %s vault statefulset %v", action, err)
framework.Failf("failed to %s vault statefulset %v", action, err)
}

data, err = replaceNamespaceInTemplate(vaultExamplePath + vaultRBACPath)
if err != nil {
e2elog.Failf("failed to read content from %s %v", vaultExamplePath+vaultRBACPath, err)
framework.Failf("failed to read content from %s %v", vaultExamplePath+vaultRBACPath, err)
}
err = retryKubectlInput(cephCSINamespace, action, data, deployTimeout)
if err != nil {
e2elog.Failf("failed to %s vault statefulset %v", action, err)
framework.Failf("failed to %s vault statefulset %v", action, err)
}

data, err = replaceNamespaceInTemplate(vaultExamplePath + vaultConfigPath)
if err != nil {
e2elog.Failf("failed to read content from %s %v", vaultExamplePath+vaultConfigPath, err)
framework.Failf("failed to read content from %s %v", vaultExamplePath+vaultConfigPath, err)
}
data = strings.ReplaceAll(data, "default", cephCSINamespace)
err = retryKubectlInput(cephCSINamespace, action, data, deployTimeout)
if err != nil {
e2elog.Failf("failed to %s vault configmap %v", action, err)
framework.Failf("failed to %s vault configmap %v", action, err)
}
}

Expand Down
34 changes: 17 additions & 17 deletions e2e/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import (
"k8s.io/client-go/kubernetes"
deploymentutil "k8s.io/kubernetes/pkg/controller/deployment/util"
"k8s.io/kubernetes/test/e2e/framework"
e2elog "k8s.io/kubernetes/test/e2e/framework/log"
e2epod "k8s.io/kubernetes/test/e2e/framework/pod"
)

// execCommandInPodWithName run command in pod using podName.
Expand All @@ -44,7 +44,7 @@ func execCommandInPodWithName(
nameSpace string,
) (string, string, error) {
cmd := []string{"/bin/sh", "-c", cmdString}
podOpt := framework.ExecOptions{
podOpt := e2epod.ExecOptions{
Command: cmd,
PodName: podName,
Namespace: nameSpace,
Expand All @@ -55,7 +55,7 @@ func execCommandInPodWithName(
PreserveWhitespace: true,
}

return f.ExecWithOptions(podOpt)
return e2epod.ExecWithOptions(f, podOpt)
}

// loadAppDeployment loads the deployment app config and return deployment
Expand Down Expand Up @@ -92,7 +92,7 @@ func deleteDeploymentApp(clientSet kubernetes.Interface, name, ns string, deploy
return fmt.Errorf("failed to delete deployment: %w", err)
}
start := time.Now()
e2elog.Logf("Waiting for deployment %q to be deleted", name)
framework.Logf("Waiting for deployment %q to be deleted", name)

return wait.PollImmediate(poll, timeout, func() (bool, error) {
_, err := clientSet.AppsV1().Deployments(ns).Get(context.TODO(), name, metav1.GetOptions{})
Expand All @@ -103,7 +103,7 @@ func deleteDeploymentApp(clientSet kubernetes.Interface, name, ns string, deploy
if apierrs.IsNotFound(err) {
return true, nil
}
e2elog.Logf("%q deployment to be deleted (%d seconds elapsed)", name, int(time.Since(start).Seconds()))
framework.Logf("%q deployment to be deleted (%d seconds elapsed)", name, int(time.Since(start).Seconds()))

return false, fmt.Errorf("failed to get deployment: %w", err)
}
Expand All @@ -116,7 +116,7 @@ func deleteDeploymentApp(clientSet kubernetes.Interface, name, ns string, deploy
func waitForDeploymentInAvailableState(clientSet kubernetes.Interface, name, ns string, deployTimeout int) error {
timeout := time.Duration(deployTimeout) * time.Minute
start := time.Now()
e2elog.Logf("Waiting up to %q to be in Available state", name)
framework.Logf("Waiting up to %q to be in Available state", name)

return wait.PollImmediate(poll, timeout, func() (bool, error) {
d, err := clientSet.AppsV1().Deployments(ns).Get(context.TODO(), name, metav1.GetOptions{})
Expand All @@ -127,7 +127,7 @@ func waitForDeploymentInAvailableState(clientSet kubernetes.Interface, name, ns
if apierrs.IsNotFound(err) {
return false, nil
}
e2elog.Logf("%q deployment to be Available (%d seconds elapsed)", name, int(time.Since(start).Seconds()))
framework.Logf("%q deployment to be Available (%d seconds elapsed)", name, int(time.Since(start).Seconds()))

return false, err
}
Expand All @@ -154,7 +154,7 @@ func waitForDeploymentComplete(clientSet kubernetes.Interface, name, ns string,
if apierrs.IsNotFound(err) {
return false, nil
}
e2elog.Logf("deployment error: %v", err)
framework.Logf("deployment error: %v", err)

return false, err
}
Expand All @@ -166,7 +166,7 @@ func waitForDeploymentComplete(clientSet kubernetes.Interface, name, ns string,
if deployment.Status.Replicas == deployment.Status.ReadyReplicas {
return true, nil
}
e2elog.Logf(
framework.Logf(
"deployment status: expected replica count %d running replica count %d",
deployment.Status.Replicas,
deployment.Status.ReadyReplicas)
Expand Down Expand Up @@ -286,7 +286,7 @@ func (rnr *rookNFSResource) Do(action kubectlAction) error {
if err != nil {
// depending on the Ceph/Rook version, modules are
// enabled by default
e2elog.Logf("enabling module %q failed: %v", module, err)
framework.Logf("enabling module %q failed: %v", module, err)
}
}

Expand All @@ -295,7 +295,7 @@ func (rnr *rookNFSResource) Do(action kubectlAction) error {
cmd := fmt.Sprintf("ceph orch set backend %s", rnr.orchBackend)
_, _, err := execCommandInToolBoxPod(rnr.f, cmd, rookNamespace)
if err != nil {
e2elog.Logf("setting orch backend %q failed: %v", rnr.orchBackend, err)
framework.Logf("setting orch backend %q failed: %v", rnr.orchBackend, err)
}
}

Expand All @@ -318,14 +318,14 @@ func waitForDeploymentUpdateScale(
if isRetryableAPIError(upsErr) {
return false, nil
}
e2elog.Logf(
framework.Logf(
"Deployment UpdateScale %s/%s has not completed yet (%d seconds elapsed)",
ns, deploymentName, int(time.Since(start).Seconds()))

return false, fmt.Errorf("error update scale deployment %s/%s: %w", ns, deploymentName, upsErr)
}
if scaleResult.Spec.Replicas != scale.Spec.Replicas {
e2elog.Logf("scale result not matching for deployment %s/%s, desired scale %d, got %d",
framework.Logf("scale result not matching for deployment %s/%s, desired scale %d, got %d",
ns, deploymentName, scale.Spec.Replicas, scaleResult.Spec.Replicas)

return false, fmt.Errorf("error scale not matching in deployment %s/%s: %w", ns, deploymentName, upsErr)
Expand Down Expand Up @@ -354,7 +354,7 @@ func waitForDeploymentUpdate(
if isRetryableAPIError(upErr) {
return false, nil
}
e2elog.Logf(
framework.Logf(
"Deployment Update %s/%s has not completed yet (%d seconds elapsed)",
deployment.Namespace, deployment.Name, int(time.Since(start).Seconds()))

Expand Down Expand Up @@ -391,7 +391,7 @@ func waitForContainersArgsUpdate(
containers []string,
timeout int,
) error {
e2elog.Logf("waiting for deployment updates %s/%s", ns, deploymentName)
framework.Logf("waiting for deployment updates %s/%s", ns, deploymentName)

// wait for the deployment to be available
err := waitForDeploymentInAvailableState(c, deploymentName, ns, deployTimeout)
Expand Down Expand Up @@ -463,14 +463,14 @@ func waitForContainersArgsUpdate(
if isRetryableAPIError(getErr) {
return false, nil
}
e2elog.Logf(
framework.Logf(
"Deployment Get %s/%s has not completed yet (%d seconds elapsed)",
ns, deploymentName, int(time.Since(start).Seconds()))

return false, fmt.Errorf("error getting deployment %s/%s: %w", ns, deploymentName, getErr)
}
if deploy.Status.Replicas != count {
e2elog.Logf("Expected deployment %s/%s replicas %d, got %d", ns, deploymentName, count, deploy.Status.Replicas)
framework.Logf("Expected deployment %s/%s replicas %d, got %d", ns, deploymentName, count, deploy.Status.Replicas)

return false, fmt.Errorf("error expected deployment %s/%s replicas %d, got %d",
ns, deploymentName, count, deploy.Status.Replicas)
Expand Down
Loading