GetProvisioner returns the storage provisioner that should be used for the current workspace
(workspace *common.DevWorkspaceWithConfig)
| 47 | |
| 48 | // GetProvisioner returns the storage provisioner that should be used for the current workspace |
| 49 | func GetProvisioner(workspace *common.DevWorkspaceWithConfig) (Provisioner, error) { |
| 50 | storageClass := workspace.Spec.Template.Attributes.GetString(constants.DevWorkspaceStorageTypeAttribute, nil) |
| 51 | if storageClass == "" { |
| 52 | return &CommonStorageProvisioner{}, nil |
| 53 | } |
| 54 | switch storageClass { |
| 55 | case constants.CommonStorageClassType: |
| 56 | return &CommonStorageProvisioner{}, nil |
| 57 | case constants.PerWorkspaceStorageClassType: |
| 58 | return &PerWorkspaceStorageProvisioner{}, nil |
| 59 | case constants.AsyncStorageClassType: |
| 60 | return &AsyncStorageProvisioner{}, nil |
| 61 | case constants.EphemeralStorageClassType: |
| 62 | return &EphemeralStorageProvisioner{}, nil |
| 63 | case constants.PerUserStorageClassType: |
| 64 | return &CommonStorageProvisioner{}, nil |
| 65 | default: |
| 66 | return nil, UnsupportedStorageStrategy |
| 67 | } |
| 68 | } |