noop_expandable_plugin.go 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. Copyright 2018 The Kubernetes Authors.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. package volume
  14. import (
  15. "k8s.io/api/core/v1"
  16. "k8s.io/apimachinery/pkg/api/resource"
  17. "k8s.io/apimachinery/pkg/types"
  18. )
  19. type noopExpandableVolumePluginInstance struct {
  20. spec *Spec
  21. }
  22. var _ ExpandableVolumePlugin = &noopExpandableVolumePluginInstance{}
  23. func (n *noopExpandableVolumePluginInstance) ExpandVolumeDevice(spec *Spec, newSize resource.Quantity, oldSize resource.Quantity) (resource.Quantity, error) {
  24. return newSize, nil
  25. }
  26. func (n *noopExpandableVolumePluginInstance) Init(host VolumeHost) error {
  27. return nil
  28. }
  29. func (n *noopExpandableVolumePluginInstance) GetPluginName() string {
  30. return n.spec.KubeletExpandablePluginName()
  31. }
  32. func (n *noopExpandableVolumePluginInstance) GetVolumeName(spec *Spec) (string, error) {
  33. return n.spec.Name(), nil
  34. }
  35. func (n *noopExpandableVolumePluginInstance) CanSupport(spec *Spec) bool {
  36. return true
  37. }
  38. func (n *noopExpandableVolumePluginInstance) IsMigratedToCSI() bool {
  39. return false
  40. }
  41. func (n *noopExpandableVolumePluginInstance) RequiresRemount() bool {
  42. return false
  43. }
  44. func (n *noopExpandableVolumePluginInstance) NewMounter(spec *Spec, podRef *v1.Pod, opts VolumeOptions) (Mounter, error) {
  45. return nil, nil
  46. }
  47. func (n *noopExpandableVolumePluginInstance) NewUnmounter(name string, podUID types.UID) (Unmounter, error) {
  48. return nil, nil
  49. }
  50. func (n *noopExpandableVolumePluginInstance) ConstructVolumeSpec(volumeName, mountPath string) (*Spec, error) {
  51. return n.spec, nil
  52. }
  53. func (n *noopExpandableVolumePluginInstance) SupportsMountOption() bool {
  54. return true
  55. }
  56. func (n *noopExpandableVolumePluginInstance) SupportsBulkVolumeVerification() bool {
  57. return false
  58. }
  59. func (n *noopExpandableVolumePluginInstance) RequiresFSResize() bool {
  60. return true
  61. }