mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-09-19 14:34:17 +00:00
Add parameter "uploader-type" to velero server (#5212)
This commit adds the parameter "uploader-type" to velero server, add exposes the setting via "velero install" in CLI. fixes #5062 Signed-off-by: Daniel Jiang <jiangd@vmware.com> Signed-off-by: Daniel Jiang <jiangd@vmware.com>
This commit is contained in:
@@ -44,6 +44,7 @@ type podTemplateConfig struct {
|
||||
plugins []string
|
||||
features []string
|
||||
defaultVolumesToRestic bool
|
||||
uploaderType string
|
||||
}
|
||||
|
||||
func WithImage(image string) podTemplateOption {
|
||||
@@ -83,7 +84,6 @@ func WithEnvFromSecretKey(varName, secret, key string) podTemplateOption {
|
||||
func WithSecret(secretPresent bool) podTemplateOption {
|
||||
return func(c *podTemplateConfig) {
|
||||
c.withSecret = secretPresent
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,6 +123,12 @@ func WithFeatures(features []string) podTemplateOption {
|
||||
}
|
||||
}
|
||||
|
||||
func WithUploaderType(t string) podTemplateOption {
|
||||
return func(c *podTemplateConfig) {
|
||||
c.uploaderType = t
|
||||
}
|
||||
}
|
||||
|
||||
func WithDefaultVolumesToRestic() podTemplateOption {
|
||||
return func(c *podTemplateConfig) {
|
||||
c.defaultVolumesToRestic = true
|
||||
@@ -155,6 +161,10 @@ func Deployment(namespace string, opts ...podTemplateOption) *appsv1.Deployment
|
||||
args = append(args, "--default-volumes-to-restic=true")
|
||||
}
|
||||
|
||||
if len(c.uploaderType) > 0 {
|
||||
args = append(args, fmt.Sprintf("--uploader-type=%s", c.uploaderType))
|
||||
}
|
||||
|
||||
deployment := &appsv1.Deployment{
|
||||
ObjectMeta: objectMeta(namespace, "velero"),
|
||||
TypeMeta: metav1.TypeMeta{
|
||||
|
||||
@@ -57,4 +57,8 @@ func TestDeployment(t *testing.T) {
|
||||
deploy = Deployment("velero", WithFeatures([]string{"EnableCSI", "foo", "bar", "baz"}))
|
||||
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", 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])
|
||||
}
|
||||
|
||||
@@ -232,6 +232,7 @@ type VeleroOptions struct {
|
||||
CACertData []byte
|
||||
Features []string
|
||||
DefaultVolumesToRestic bool
|
||||
UploaderType string
|
||||
}
|
||||
|
||||
func AllCRDs() *unstructured.UnstructuredList {
|
||||
@@ -287,6 +288,7 @@ func AllResources(o *VeleroOptions) *unstructured.UnstructuredList {
|
||||
WithSecret(secretPresent),
|
||||
WithDefaultResticMaintenanceFrequency(o.DefaultResticMaintenanceFrequency),
|
||||
WithGarbageCollectionFrequency(o.GarbageCollectionFrequency),
|
||||
WithUploaderType(o.UploaderType),
|
||||
}
|
||||
|
||||
if len(o.Features) > 0 {
|
||||
|
||||
Reference in New Issue
Block a user