sig-storage-lib-external-provisioner icon indicating copy to clipboard operation
sig-storage-lib-external-provisioner copied to clipboard

test annDynamicallyProvisioned by ctrl.knownProvisioner

Open ayanamist opened this issue 3 years ago • 11 comments

I see

https://github.com/kubernetes-sigs/sig-storage-lib-external-provisioner/blob/a35bec6eb688ef7a0e31b340ed77bdb84010ace7/controller/controller.go#L1452

set annDynamicallyProvisioned from StorageClass.Provisioner, and test it using knownProvisioner with comments https://github.com/kubernetes-sigs/sig-storage-lib-external-provisioner/blob/a35bec6eb688ef7a0e31b340ed77bdb84010ace7/controller/controller.go#L1372-L1378

But in updatePersistentVolume and shouldDelete just use plain ann != ctrl.provisionerName to make comparison

https://github.com/kubernetes-sigs/sig-storage-lib-external-provisioner/blob/a35bec6eb688ef7a0e31b340ed77bdb84010ace7/controller/controller.go#L1233

https://github.com/kubernetes-sigs/sig-storage-lib-external-provisioner/blob/a35bec6eb688ef7a0e31b340ed77bdb84010ace7/controller/controller.go#L1288

Should these places also use knownProvisioner method?

ayanamist avatar May 10 '22 04:05 ayanamist

CLA Signed

The committers listed above are authorized under a signed CLA.

  • :white_check_mark: login: ayanamist / name: ayanamist (ee677a33821e5a068fef90d99a575474c960d13d)

Welcome @ayanamist!

It looks like this is your first PR to kubernetes-sigs/sig-storage-lib-external-provisioner 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/sig-storage-lib-external-provisioner has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. :smiley:

k8s-ci-robot avatar May 10 '22 04:05 k8s-ci-robot

Hi @ayanamist. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

k8s-ci-robot avatar May 10 '22 04:05 k8s-ci-robot

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: ayanamist To complete the pull request process, please assign wongma7 after the PR has been reviewed. You can assign the PR to them by writing /assign @wongma7 in a comment when ready.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

k8s-ci-robot avatar May 10 '22 04:05 k8s-ci-robot

/ok-to-test

you are right. we have a test for the shouldProvision case but not the shouldDelete.

https://github.com/kubernetes-sigs/sig-storage-lib-external-provisioner/blob/a35bec6eb688ef7a0e31b340ed77bdb84010ace7/controller/controller_test.go#L934-L941

please add an analogous shouldDelete test case to validate this fix , somewhere here https://github.com/kubernetes-sigs/sig-storage-lib-external-provisioner/blob/a35bec6eb688ef7a0e31b340ed77bdb84010ace7/controller/controller_test.go#L1065

wongma7 avatar May 31 '22 19:05 wongma7

in practice this hasn't caused any actual issues for CSI migration use-cases because then the second part of the if statement evaluates false.. https://github.com/kubernetes/kubernetes/blob/df1a3ddc9811969ad464b98ec5ec8972e907f778/pkg/controller/volume/persistentvolume/pv_controller_base.go#L473

for non CSI migration use-cases the second part evaluates true so then there might be issues if for some reason additionalProvisionerNames is set. This is very unlikely though because additionalProvisionerNames was added specifically for CSI migration use-cases, i don't know why anybody would set it otherwise

table for my own comprehension...

- CSI migration non-CSI migration use-case
additionalProvisionerNames set to e.g. kubernetes.io/aws-ebs shoulddelete works as intended since migratedTo == ctrl.provisionerName e.g. ebs.csi.aws.com shoulddelete does not work as intended, this PR fixes it
additionalProvisionerNames empty N/A, unsupported scenario shoulddelete works as intended since provisionedBy == ctrl.provisionerName

wongma7 avatar May 31 '22 19:05 wongma7

We have a very large cluster with handreds thousands pods and PV claims, so we use one single csi-controller with sidecars (external-provisioner and external-attacher) to serve multiple StorageClass so that it will use less CPU+Mem resources than multiple csi-controllers, so we reuse additionalProvisionerNames and it works with this PR merged. Will you take this scene into consideration and merge this one if tests are added? BTW test above is failed for gofmt failed at files not modified by me and can't be reproduced in my machine.

ayanamist avatar Jun 02 '22 06:06 ayanamist

ack, makes sense.

I'll fix the gofmt thing in a separate PR

wongma7 avatar Jun 02 '22 19:06 wongma7

@wongma7 Tests are now added and passed. BTW, pull-sig-storage-lib-external-provisioner-unit is a duplicate of pull-sig-storage-lib-external-provisioner-build, because make already includes make test

ayanamist avatar Jun 07 '22 03:06 ayanamist

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Sep 05 '22 03:09 k8s-triage-robot

/remove-lifecycle stale

ayanamist avatar Sep 05 '22 04:09 ayanamist

@ayanamist: PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

k8s-ci-robot avatar Nov 30 '22 01:11 k8s-ci-robot

It seems this issue is resolved by commit ee0d78c4 already.

ayanamist avatar Nov 30 '22 04:11 ayanamist