mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-07-26 01:53:09 +00:00
Trim plugin image entries during install
Signed-off-by: AmirHossein HajiMohammadi <a.hajimohammadi@rahkar.team>
This commit is contained in:
@@ -139,7 +139,10 @@ func WithPodVolumeOperationTimeout(val time.Duration) podTemplateOption {
|
||||
|
||||
func WithPlugins(plugins []string) podTemplateOption {
|
||||
return func(c *podTemplateConfig) {
|
||||
c.plugins = plugins
|
||||
c.plugins = make([]string, 0, len(plugins))
|
||||
for _, plugin := range plugins {
|
||||
c.plugins = append(c.plugins, strings.TrimSpace(plugin))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -60,6 +60,15 @@ func TestDeployment(t *testing.T) {
|
||||
assert.Len(t, deploy.Spec.Template.Spec.Containers[0].Args, 2)
|
||||
assert.Equal(t, "--features=EnableCSI,foo,bar,baz", deploy.Spec.Template.Spec.Containers[0].Args[1])
|
||||
|
||||
deploy = Deployment("velero", WithPlugins([]string{
|
||||
"harbor-repo.vmware.com/harbor-ci/velero/velero-plugin-for-aws:v1.2.0",
|
||||
" \n vsphereveleroplugin/velero-plugin-for-vsphere:v1.1.1 ",
|
||||
}))
|
||||
assert.Len(t, deploy.Spec.Template.Spec.InitContainers, 2)
|
||||
assert.Equal(t, "harbor-repo.vmware.com/harbor-ci/velero/velero-plugin-for-aws:v1.2.0", deploy.Spec.Template.Spec.InitContainers[0].Image)
|
||||
assert.Equal(t, "vsphereveleroplugin/velero-plugin-for-vsphere:v1.1.1", deploy.Spec.Template.Spec.InitContainers[1].Image)
|
||||
assert.Equal(t, "vsphereveleroplugin-velero-plugin-for-vsphere", deploy.Spec.Template.Spec.InitContainers[1].Name)
|
||||
|
||||
deploy = Deployment("velero", WithUploaderType("kopia"))
|
||||
assert.Len(t, deploy.Spec.Template.Spec.Containers[0].Args, 2)
|
||||
assert.Equal(t, "--uploader-type=kopia", deploy.Spec.Template.Spec.Containers[0].Args[1])
|
||||
|
||||
Reference in New Issue
Block a user