chore: enable use-any from revive

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
pull/8624/head
Matthieu MOREL 2025-01-17 07:51:57 +01:00
parent 5b1738abf8
commit cbba3bdde7
139 changed files with 798 additions and 799 deletions

View File

@ -282,7 +282,6 @@ linters-settings:
- name: unused-parameter - name: unused-parameter
disabled: true disabled: true
- name: use-any - name: use-any
disabled: true
- name: var-declaration - name: var-declaration
disabled: true disabled: true
- name: var-naming - name: var-naming

View File

@ -106,7 +106,7 @@ func (p *volumeSnapshotDeleteItemAction) Execute(
} }
func NewVolumeSnapshotDeleteItemAction(f client.Factory) plugincommon.HandlerInitializer { func NewVolumeSnapshotDeleteItemAction(f client.Factory) plugincommon.HandlerInitializer {
return func(logger logrus.FieldLogger) (interface{}, error) { return func(logger logrus.FieldLogger) (any, error) {
crClient, err := f.KubebuilderClient() crClient, err := f.KubebuilderClient()
if err != nil { if err != nil {
return nil, errors.WithStack(err) return nil, errors.WithStack(err)

View File

@ -112,7 +112,7 @@ func (p *volumeSnapshotContentDeleteItemAction) Execute(
func NewVolumeSnapshotContentDeleteItemAction( func NewVolumeSnapshotContentDeleteItemAction(
f client.Factory, f client.Factory,
) plugincommon.HandlerInitializer { ) plugincommon.HandlerInitializer {
return func(logger logrus.FieldLogger) (interface{}, error) { return func(logger logrus.FieldLogger) (any, error) {
crClient, err := f.KubebuilderClient() crClient, err := f.KubebuilderClient()
if err != nil { if err != nil {
return nil, err return nil, err

View File

@ -116,7 +116,7 @@ func (e *DefaultWaitExecHookHandler) HandleHooks(
// not yet been observed to be running. It relies on the Informer not to be called concurrently. // not yet been observed to be running. It relies on the Informer not to be called concurrently.
// When a container is observed running and its hooks are executed, the container is deleted // When a container is observed running and its hooks are executed, the container is deleted
// from the byContainer map. When the map is empty the watch is ended. // from the byContainer map. When the map is empty the watch is ended.
handler := func(newObj interface{}) { handler := func(newObj any) {
newPod, ok := newObj.(*v1.Pod) newPod, ok := newObj.(*v1.Pod)
if !ok { if !ok {
return return
@ -217,10 +217,10 @@ func (e *DefaultWaitExecHookHandler) HandleHooks(
_, podWatcher := cache.NewInformer(lw, pod, 0, cache.ResourceEventHandlerFuncs{ _, podWatcher := cache.NewInformer(lw, pod, 0, cache.ResourceEventHandlerFuncs{
AddFunc: handler, AddFunc: handler,
UpdateFunc: func(_, newObj interface{}) { UpdateFunc: func(_, newObj any) {
handler(newObj) handler(newObj)
}, },
DeleteFunc: func(obj interface{}) { DeleteFunc: func(obj any) {
err := fmt.Errorf("pod %s deleted before all hooks were executed", kube.NamespaceAndName(pod)) err := fmt.Errorf("pod %s deleted before all hooks were executed", kube.NamespaceAndName(pod))
log.Error(err) log.Error(err)
cancel() cancel()

View File

@ -429,69 +429,69 @@ func TestGetResourceModifiersFromConfig(t *testing.T) {
func TestResourceModifiers_ApplyResourceModifierRules(t *testing.T) { func TestResourceModifiers_ApplyResourceModifierRules(t *testing.T) {
pvcStandardSc := &unstructured.Unstructured{ pvcStandardSc := &unstructured.Unstructured{
Object: map[string]interface{}{ Object: map[string]any{
"apiVersion": "v1", "apiVersion": "v1",
"kind": "PersistentVolumeClaim", "kind": "PersistentVolumeClaim",
"metadata": map[string]interface{}{ "metadata": map[string]any{
"name": "test-pvc", "name": "test-pvc",
"namespace": "foo", "namespace": "foo",
}, },
"spec": map[string]interface{}{ "spec": map[string]any{
"storageClassName": "standard", "storageClassName": "standard",
}, },
}, },
} }
pvcPremiumSc := &unstructured.Unstructured{ pvcPremiumSc := &unstructured.Unstructured{
Object: map[string]interface{}{ Object: map[string]any{
"apiVersion": "v1", "apiVersion": "v1",
"kind": "PersistentVolumeClaim", "kind": "PersistentVolumeClaim",
"metadata": map[string]interface{}{ "metadata": map[string]any{
"name": "test-pvc", "name": "test-pvc",
"namespace": "foo", "namespace": "foo",
}, },
"spec": map[string]interface{}{ "spec": map[string]any{
"storageClassName": "premium", "storageClassName": "premium",
}, },
}, },
} }
pvcGoldSc := &unstructured.Unstructured{ pvcGoldSc := &unstructured.Unstructured{
Object: map[string]interface{}{ Object: map[string]any{
"apiVersion": "v1", "apiVersion": "v1",
"kind": "PersistentVolumeClaim", "kind": "PersistentVolumeClaim",
"metadata": map[string]interface{}{ "metadata": map[string]any{
"name": "test-pvc", "name": "test-pvc",
"namespace": "foo", "namespace": "foo",
}, },
"spec": map[string]interface{}{ "spec": map[string]any{
"storageClassName": "gold", "storageClassName": "gold",
}, },
}, },
} }
deployNginxOneReplica := &unstructured.Unstructured{ deployNginxOneReplica := &unstructured.Unstructured{
Object: map[string]interface{}{ Object: map[string]any{
"apiVersion": "apps/v1", "apiVersion": "apps/v1",
"kind": "Deployment", "kind": "Deployment",
"metadata": map[string]interface{}{ "metadata": map[string]any{
"name": "test-deployment", "name": "test-deployment",
"namespace": "foo", "namespace": "foo",
"labels": map[string]interface{}{ "labels": map[string]any{
"app": "nginx", "app": "nginx",
}, },
}, },
"spec": map[string]interface{}{ "spec": map[string]any{
"replicas": int64(1), "replicas": int64(1),
"template": map[string]interface{}{ "template": map[string]any{
"metadata": map[string]interface{}{ "metadata": map[string]any{
"labels": map[string]interface{}{ "labels": map[string]any{
"app": "nginx", "app": "nginx",
}, },
}, },
"spec": map[string]interface{}{ "spec": map[string]any{
"containers": []interface{}{ "containers": []any{
map[string]interface{}{ map[string]any{
"name": "nginx", "name": "nginx",
"image": "nginx:latest", "image": "nginx:latest",
}, },
@ -502,27 +502,27 @@ func TestResourceModifiers_ApplyResourceModifierRules(t *testing.T) {
}, },
} }
deployNginxTwoReplica := &unstructured.Unstructured{ deployNginxTwoReplica := &unstructured.Unstructured{
Object: map[string]interface{}{ Object: map[string]any{
"apiVersion": "apps/v1", "apiVersion": "apps/v1",
"kind": "Deployment", "kind": "Deployment",
"metadata": map[string]interface{}{ "metadata": map[string]any{
"name": "test-deployment", "name": "test-deployment",
"namespace": "foo", "namespace": "foo",
"labels": map[string]interface{}{ "labels": map[string]any{
"app": "nginx", "app": "nginx",
}, },
}, },
"spec": map[string]interface{}{ "spec": map[string]any{
"replicas": int64(2), "replicas": int64(2),
"template": map[string]interface{}{ "template": map[string]any{
"metadata": map[string]interface{}{ "metadata": map[string]any{
"labels": map[string]interface{}{ "labels": map[string]any{
"app": "nginx", "app": "nginx",
}, },
}, },
"spec": map[string]interface{}{ "spec": map[string]any{
"containers": []interface{}{ "containers": []any{
map[string]interface{}{ map[string]any{
"name": "nginx", "name": "nginx",
"image": "nginx:latest", "image": "nginx:latest",
}, },
@ -533,31 +533,31 @@ func TestResourceModifiers_ApplyResourceModifierRules(t *testing.T) {
}, },
} }
deployNginxMysql := &unstructured.Unstructured{ deployNginxMysql := &unstructured.Unstructured{
Object: map[string]interface{}{ Object: map[string]any{
"apiVersion": "apps/v1", "apiVersion": "apps/v1",
"kind": "Deployment", "kind": "Deployment",
"metadata": map[string]interface{}{ "metadata": map[string]any{
"name": "test-deployment", "name": "test-deployment",
"namespace": "foo", "namespace": "foo",
"labels": map[string]interface{}{ "labels": map[string]any{
"app": "nginx", "app": "nginx",
}, },
}, },
"spec": map[string]interface{}{ "spec": map[string]any{
"replicas": int64(1), "replicas": int64(1),
"template": map[string]interface{}{ "template": map[string]any{
"metadata": map[string]interface{}{ "metadata": map[string]any{
"labels": map[string]interface{}{ "labels": map[string]any{
"app": "nginx", "app": "nginx",
}, },
}, },
"spec": map[string]interface{}{ "spec": map[string]any{
"containers": []interface{}{ "containers": []any{
map[string]interface{}{ map[string]any{
"name": "nginx", "name": "nginx",
"image": "nginx:latest", "image": "nginx:latest",
}, },
map[string]interface{}{ map[string]any{
"name": "mysql", "name": "mysql",
"image": "mysql:latest", "image": "mysql:latest",
}, },
@ -568,19 +568,19 @@ func TestResourceModifiers_ApplyResourceModifierRules(t *testing.T) {
}, },
} }
cmTrue := &unstructured.Unstructured{ cmTrue := &unstructured.Unstructured{
Object: map[string]interface{}{ Object: map[string]any{
"apiVersion": "v1", "apiVersion": "v1",
"kind": "ConfigMap", "kind": "ConfigMap",
"data": map[string]interface{}{ "data": map[string]any{
"test": "true", "test": "true",
}, },
}, },
} }
cmFalse := &unstructured.Unstructured{ cmFalse := &unstructured.Unstructured{
Object: map[string]interface{}{ Object: map[string]any{
"apiVersion": "v1", "apiVersion": "v1",
"kind": "ConfigMap", "kind": "ConfigMap",
"data": map[string]interface{}{ "data": map[string]any{
"test": "false", "test": "false",
}, },
}, },

View File

@ -53,7 +53,7 @@ func (p *StrategicMergePatcher) Patch(u *unstructured.Unstructured, _ logrus.Fie
// strategicPatchObject applies a strategic merge patch of `patchBytes` to // strategicPatchObject applies a strategic merge patch of `patchBytes` to
// `originalObject` and stores the result in `objToUpdate`. // `originalObject` and stores the result in `objToUpdate`.
// It additionally returns the map[string]interface{} representation of the // It additionally returns the map[string]any representation of the
// `originalObject` and `patchBytes`. // `originalObject` and `patchBytes`.
// NOTE: Both `originalObject` and `objToUpdate` are supposed to be versioned. // NOTE: Both `originalObject` and `objToUpdate` are supposed to be versioned.
func strategicPatchObject( func strategicPatchObject(
@ -67,7 +67,7 @@ func strategicPatchObject(
return err return err
} }
patchMap := make(map[string]interface{}) patchMap := make(map[string]any)
var strictErrs []error var strictErrs []error
strictErrs, err = kubejson.UnmarshalStrict(patchBytes, &patchMap) strictErrs, err = kubejson.UnmarshalStrict(patchBytes, &patchMap)
if err != nil { if err != nil {
@ -84,8 +84,8 @@ func strategicPatchObject(
// <originalMap> and stores the result in <objToUpdate>. // <originalMap> and stores the result in <objToUpdate>.
// NOTE: <objToUpdate> must be a versioned object. // NOTE: <objToUpdate> must be a versioned object.
func applyPatchToObject( func applyPatchToObject(
originalMap map[string]interface{}, originalMap map[string]any,
patchMap map[string]interface{}, patchMap map[string]any,
objToUpdate runtime.Object, objToUpdate runtime.Object,
schemaReferenceObj runtime.Object, schemaReferenceObj runtime.Object,
strictErrs []error, strictErrs []error,

View File

@ -46,14 +46,14 @@ type Action struct {
// Type defined specific type of action, currently only support 'skip' // Type defined specific type of action, currently only support 'skip'
Type VolumeActionType `yaml:"type"` Type VolumeActionType `yaml:"type"`
// Parameters defined map of parameters when executing a specific action // Parameters defined map of parameters when executing a specific action
Parameters map[string]interface{} `yaml:"parameters,omitempty"` Parameters map[string]any `yaml:"parameters,omitempty"`
} }
// volumePolicy defined policy to conditions to match Volumes and related action to handle matched Volumes // volumePolicy defined policy to conditions to match Volumes and related action to handle matched Volumes
type VolumePolicy struct { type VolumePolicy struct {
// Conditions defined list of conditions to match Volumes // Conditions defined list of conditions to match Volumes
Conditions map[string]interface{} `yaml:"conditions"` Conditions map[string]any `yaml:"conditions"`
Action Action `yaml:"action"` Action Action `yaml:"action"`
} }
// resourcePolicies currently defined slice of volume policies to handle backup // resourcePolicies currently defined slice of volume policies to handle backup
@ -122,7 +122,7 @@ func (p *Policies) match(res *structuredVolume) *Action {
return nil return nil
} }
func (p *Policies) GetMatchAction(res interface{}) (*Action, error) { func (p *Policies) GetMatchAction(res any) (*Action, error) {
volume := &structuredVolume{} volume := &structuredVolume{}
switch obj := res.(type) { switch obj := res.(type) {
case *v1.PersistentVolume: case *v1.PersistentVolume:

View File

@ -138,20 +138,20 @@ func TestGetResourceMatchedAction(t *testing.T) {
VolumePolicies: []VolumePolicy{ VolumePolicies: []VolumePolicy{
{ {
Action: Action{Type: "skip"}, Action: Action{Type: "skip"},
Conditions: map[string]interface{}{ Conditions: map[string]any{
"capacity": "0,10Gi", "capacity": "0,10Gi",
"storageClass": []string{"gp2", "ebs-sc"}, "storageClass": []string{"gp2", "ebs-sc"},
"csi": interface{}( "csi": any(
map[string]interface{}{ map[string]any{
"driver": "aws.efs.csi.driver", "driver": "aws.efs.csi.driver",
}), }),
}, },
}, },
{ {
Action: Action{Type: "skip"}, Action: Action{Type: "skip"},
Conditions: map[string]interface{}{ Conditions: map[string]any{
"csi": interface{}( "csi": any(
map[string]interface{}{ map[string]any{
"driver": "files.csi.driver", "driver": "files.csi.driver",
"volumeAttributes": map[string]string{"protocol": "nfs"}, "volumeAttributes": map[string]string{"protocol": "nfs"},
}), }),
@ -159,21 +159,21 @@ func TestGetResourceMatchedAction(t *testing.T) {
}, },
{ {
Action: Action{Type: "snapshot"}, Action: Action{Type: "snapshot"},
Conditions: map[string]interface{}{ Conditions: map[string]any{
"capacity": "10,100Gi", "capacity": "10,100Gi",
"storageClass": []string{"gp2", "ebs-sc"}, "storageClass": []string{"gp2", "ebs-sc"},
"csi": interface{}( "csi": any(
map[string]interface{}{ map[string]any{
"driver": "aws.efs.csi.driver", "driver": "aws.efs.csi.driver",
}), }),
}, },
}, },
{ {
Action: Action{Type: "fs-backup"}, Action: Action{Type: "fs-backup"},
Conditions: map[string]interface{}{ Conditions: map[string]any{
"storageClass": []string{"gp2", "ebs-sc"}, "storageClass": []string{"gp2", "ebs-sc"},
"csi": interface{}( "csi": any(
map[string]interface{}{ map[string]any{
"driver": "aws.efs.csi.driver", "driver": "aws.efs.csi.driver",
}), }),
}, },
@ -281,9 +281,9 @@ func TestGetResourcePoliciesFromConfig(t *testing.T) {
Version: "v1", Version: "v1",
VolumePolicies: []VolumePolicy{ VolumePolicies: []VolumePolicy{
{ {
Conditions: map[string]interface{}{ Conditions: map[string]any{
"capacity": "0,10Gi", "capacity": "0,10Gi",
"csi": map[string]interface{}{ "csi": map[string]any{
"driver": "disks.csi.driver", "driver": "disks.csi.driver",
}, },
}, },
@ -292,8 +292,8 @@ func TestGetResourcePoliciesFromConfig(t *testing.T) {
}, },
}, },
{ {
Conditions: map[string]interface{}{ Conditions: map[string]any{
"csi": map[string]interface{}{ "csi": map[string]any{
"driver": "files.csi.driver", "driver": "files.csi.driver",
"volumeAttributes": map[string]string{"protocol": "nfs"}, "volumeAttributes": map[string]string{"protocol": "nfs"},
}, },

View File

@ -226,9 +226,9 @@ func (c *capacity) isInRange(y resource.Quantity) bool {
return false return false
} }
// unmarshalVolConditions parse map[string]interface{} into volumeConditions format // unmarshalVolConditions parse map[string]any into volumeConditions format
// and validate key fields of the map. // and validate key fields of the map.
func unmarshalVolConditions(con map[string]interface{}) (*volumeConditions, error) { func unmarshalVolConditions(con map[string]any) (*volumeConditions, error) {
volConditons := &volumeConditions{} volConditons := &volumeConditions{}
buffer := new(bytes.Buffer) buffer := new(bytes.Buffer)
err := yaml.NewEncoder(buffer).Encode(con) err := yaml.NewEncoder(buffer).Encode(con)

View File

@ -256,12 +256,12 @@ func TestCSIConditionMatch(t *testing.T) {
func TestUnmarshalVolumeConditions(t *testing.T) { func TestUnmarshalVolumeConditions(t *testing.T) {
testCases := []struct { testCases := []struct {
name string name string
input map[string]interface{} input map[string]any
expectedError string expectedError string
}{ }{
{ {
name: "Valid input", name: "Valid input",
input: map[string]interface{}{ input: map[string]any{
"capacity": "1Gi,10Gi", "capacity": "1Gi,10Gi",
"storageClass": []string{ "storageClass": []string{
"gp2", "gp2",
@ -275,28 +275,28 @@ func TestUnmarshalVolumeConditions(t *testing.T) {
}, },
{ {
name: "Invalid input: invalid capacity filed name", name: "Invalid input: invalid capacity filed name",
input: map[string]interface{}{ input: map[string]any{
"Capacity": "1Gi,10Gi", "Capacity": "1Gi,10Gi",
}, },
expectedError: "field Capacity not found", expectedError: "field Capacity not found",
}, },
{ {
name: "Invalid input: invalid storage class format", name: "Invalid input: invalid storage class format",
input: map[string]interface{}{ input: map[string]any{
"storageClass": "ebs-sc", "storageClass": "ebs-sc",
}, },
expectedError: "str `ebs-sc` into []string", expectedError: "str `ebs-sc` into []string",
}, },
{ {
name: "Invalid input: invalid csi format", name: "Invalid input: invalid csi format",
input: map[string]interface{}{ input: map[string]any{
"csi": "csi.driver", "csi": "csi.driver",
}, },
expectedError: "str `csi.driver` into resourcepolicies.csiVolumeSource", expectedError: "str `csi.driver` into resourcepolicies.csiVolumeSource",
}, },
{ {
name: "Invalid input: unknown field", name: "Invalid input: unknown field",
input: map[string]interface{}{ input: map[string]any{
"unknown": "foo", "unknown": "foo",
}, },
expectedError: "field unknown not found in type", expectedError: "field unknown not found in type",

View File

@ -78,7 +78,7 @@ func (c *csiCondition) validate() error {
} }
// decodeStruct restric validate the keys in decoded mappings to exist as fields in the struct being decoded into // decodeStruct restric validate the keys in decoded mappings to exist as fields in the struct being decoded into
func decodeStruct(r io.Reader, s interface{}) error { func decodeStruct(r io.Reader, s any) error {
dec := yaml.NewDecoder(r) dec := yaml.NewDecoder(r)
dec.KnownFields(true) dec.KnownFields(true)
return dec.Decode(s) return dec.Decode(s)

View File

@ -94,12 +94,12 @@ func TestValidate(t *testing.T) {
VolumePolicies: []VolumePolicy{ VolumePolicies: []VolumePolicy{
{ {
Action: Action{Type: "skip"}, Action: Action{Type: "skip"},
Conditions: map[string]interface{}{ Conditions: map[string]any{
"capacity": "0,10Gi", "capacity": "0,10Gi",
"unknown": "", "unknown": "",
"storageClass": []string{"gp2", "ebs-sc"}, "storageClass": []string{"gp2", "ebs-sc"},
"csi": interface{}( "csi": any(
map[string]interface{}{ map[string]any{
"driver": "aws.efs.csi.driver", "driver": "aws.efs.csi.driver",
}), }),
}, },
@ -115,11 +115,11 @@ func TestValidate(t *testing.T) {
VolumePolicies: []VolumePolicy{ VolumePolicies: []VolumePolicy{
{ {
Action: Action{Type: "skip"}, Action: Action{Type: "skip"},
Conditions: map[string]interface{}{ Conditions: map[string]any{
"capacity": "10Gi", "capacity": "10Gi",
"storageClass": []string{"gp2", "ebs-sc"}, "storageClass": []string{"gp2", "ebs-sc"},
"csi": interface{}( "csi": any(
map[string]interface{}{ map[string]any{
"driver": "aws.efs.csi.driver", "driver": "aws.efs.csi.driver",
}), }),
}, },
@ -135,11 +135,11 @@ func TestValidate(t *testing.T) {
VolumePolicies: []VolumePolicy{ VolumePolicies: []VolumePolicy{
{ {
Action: Action{Type: "skip"}, Action: Action{Type: "skip"},
Conditions: map[string]interface{}{ Conditions: map[string]any{
"capacity": "0,10Gi", "capacity": "0,10Gi",
"storageClass": "ebs-sc", "storageClass": "ebs-sc",
"csi": interface{}( "csi": any(
map[string]interface{}{ map[string]any{
"driver": "aws.efs.csi.driver", "driver": "aws.efs.csi.driver",
}), }),
}, },
@ -155,7 +155,7 @@ func TestValidate(t *testing.T) {
VolumePolicies: []VolumePolicy{ VolumePolicies: []VolumePolicy{
{ {
Action: Action{Type: "skip"}, Action: Action{Type: "skip"},
Conditions: map[string]interface{}{ Conditions: map[string]any{
"capacity": "0,10Gi", "capacity": "0,10Gi",
"storageClass": []string{"gp2", "ebs-sc"}, "storageClass": []string{"gp2", "ebs-sc"},
"csi": "aws.efs.csi.driver", "csi": "aws.efs.csi.driver",
@ -172,11 +172,11 @@ func TestValidate(t *testing.T) {
VolumePolicies: []VolumePolicy{ VolumePolicies: []VolumePolicy{
{ {
Action: Action{Type: "skip"}, Action: Action{Type: "skip"},
Conditions: map[string]interface{}{ Conditions: map[string]any{
"capacity": "0,10Gi", "capacity": "0,10Gi",
"storageClass": []string{"gp2", "ebs-sc"}, "storageClass": []string{"gp2", "ebs-sc"},
"csi": interface{}( "csi": any(
map[string]interface{}{ map[string]any{
"driver": []string{"aws.efs.csi.driver"}, "driver": []string{"aws.efs.csi.driver"},
}), }),
}, },
@ -192,11 +192,11 @@ func TestValidate(t *testing.T) {
VolumePolicies: []VolumePolicy{ VolumePolicies: []VolumePolicy{
{ {
Action: Action{Type: "skip"}, Action: Action{Type: "skip"},
Conditions: map[string]interface{}{ Conditions: map[string]any{
"capacity": "0,10Gi", "capacity": "0,10Gi",
"storageClass": []string{"gp2", "ebs-sc"}, "storageClass": []string{"gp2", "ebs-sc"},
"csi": interface{}( "csi": any(
map[string]interface{}{ map[string]any{
"driver": "aws.efs.csi.driver", "driver": "aws.efs.csi.driver",
"volumeAttributes": "test", "volumeAttributes": "test",
}), }),
@ -213,10 +213,10 @@ func TestValidate(t *testing.T) {
VolumePolicies: []VolumePolicy{ VolumePolicies: []VolumePolicy{
{ {
Action: Action{Type: "skip"}, Action: Action{Type: "skip"},
Conditions: map[string]interface{}{ Conditions: map[string]any{
"capacity": "0,10Gi", "capacity": "0,10Gi",
"csi": interface{}( "csi": any(
map[string]interface{}{ map[string]any{
"driver": "aws.efs.csi.driver", "driver": "aws.efs.csi.driver",
}), }),
}, },
@ -232,10 +232,10 @@ func TestValidate(t *testing.T) {
VolumePolicies: []VolumePolicy{ VolumePolicies: []VolumePolicy{
{ {
Action: Action{Type: "unsupported"}, Action: Action{Type: "unsupported"},
Conditions: map[string]interface{}{ Conditions: map[string]any{
"capacity": "0,10Gi", "capacity": "0,10Gi",
"csi": interface{}( "csi": any(
map[string]interface{}{ map[string]any{
"driver": "aws.efs.csi.driver", "driver": "aws.efs.csi.driver",
}), }),
}, },
@ -251,7 +251,7 @@ func TestValidate(t *testing.T) {
VolumePolicies: []VolumePolicy{ VolumePolicies: []VolumePolicy{
{ {
Action: Action{Type: "skip"}, Action: Action{Type: "skip"},
Conditions: map[string]interface{}{ Conditions: map[string]any{
"capacity": "0,10Gi", "capacity": "0,10Gi",
"storageClass": []string{"gp2", "ebs-sc"}, "storageClass": []string{"gp2", "ebs-sc"},
"nfs": "aws.efs.csi.driver", "nfs": "aws.efs.csi.driver",
@ -268,9 +268,9 @@ func TestValidate(t *testing.T) {
VolumePolicies: []VolumePolicy{ VolumePolicies: []VolumePolicy{
{ {
Action: Action{Type: "skip"}, Action: Action{Type: "skip"},
Conditions: map[string]interface{}{ Conditions: map[string]any{
"csi": interface{}( "csi": any(
map[string]interface{}{ map[string]any{
"driver": "aws.efs.csi.driver", "driver": "aws.efs.csi.driver",
}), }),
}, },
@ -286,9 +286,9 @@ func TestValidate(t *testing.T) {
VolumePolicies: []VolumePolicy{ VolumePolicies: []VolumePolicy{
{ {
Action: Action{Type: "skip"}, Action: Action{Type: "skip"},
Conditions: map[string]interface{}{ Conditions: map[string]any{
"csi": interface{}( "csi": any(
map[string]interface{}{ map[string]any{
"volumeAttributes": map[string]string{ "volumeAttributes": map[string]string{
"key1": "value1", "key1": "value1",
}, },
@ -306,9 +306,9 @@ func TestValidate(t *testing.T) {
VolumePolicies: []VolumePolicy{ VolumePolicies: []VolumePolicy{
{ {
Action: Action{Type: "skip"}, Action: Action{Type: "skip"},
Conditions: map[string]interface{}{ Conditions: map[string]any{
"csi": interface{}( "csi": any(
map[string]interface{}{ map[string]any{
"driver": "aws.efs.csi.driver", "driver": "aws.efs.csi.driver",
"volumeAttributes": map[string]string{ "volumeAttributes": map[string]string{
"key1": "value1", "key1": "value1",
@ -327,15 +327,15 @@ func TestValidate(t *testing.T) {
VolumePolicies: []VolumePolicy{ VolumePolicies: []VolumePolicy{
{ {
Action: Action{Type: "skip"}, Action: Action{Type: "skip"},
Conditions: map[string]interface{}{ Conditions: map[string]any{
"capacity": "0,10Gi", "capacity": "0,10Gi",
"storageClass": []string{"gp2", "ebs-sc"}, "storageClass": []string{"gp2", "ebs-sc"},
"csi": interface{}( "csi": any(
map[string]interface{}{ map[string]any{
"driver": "aws.efs.csi.driver", "driver": "aws.efs.csi.driver",
}), }),
"nfs": interface{}( "nfs": any(
map[string]interface{}{ map[string]any{
"server": "192.168.20.90", "server": "192.168.20.90",
"path": "/mnt/data/", "path": "/mnt/data/",
}), }),
@ -352,15 +352,15 @@ func TestValidate(t *testing.T) {
VolumePolicies: []VolumePolicy{ VolumePolicies: []VolumePolicy{
{ {
Action: Action{Type: "snapshot"}, Action: Action{Type: "snapshot"},
Conditions: map[string]interface{}{ Conditions: map[string]any{
"capacity": "0,10Gi", "capacity": "0,10Gi",
"storageClass": []string{"gp2", "ebs-sc"}, "storageClass": []string{"gp2", "ebs-sc"},
"csi": interface{}( "csi": any(
map[string]interface{}{ map[string]any{
"driver": "aws.efs.csi.driver", "driver": "aws.efs.csi.driver",
}), }),
"nfs": interface{}( "nfs": any(
map[string]interface{}{ map[string]any{
"server": "192.168.20.90", "server": "192.168.20.90",
"path": "/mnt/data/", "path": "/mnt/data/",
}), }),
@ -377,15 +377,15 @@ func TestValidate(t *testing.T) {
VolumePolicies: []VolumePolicy{ VolumePolicies: []VolumePolicy{
{ {
Action: Action{Type: "fs-backup"}, Action: Action{Type: "fs-backup"},
Conditions: map[string]interface{}{ Conditions: map[string]any{
"capacity": "0,10Gi", "capacity": "0,10Gi",
"storageClass": []string{"gp2", "ebs-sc"}, "storageClass": []string{"gp2", "ebs-sc"},
"csi": interface{}( "csi": any(
map[string]interface{}{ map[string]any{
"driver": "aws.efs.csi.driver", "driver": "aws.efs.csi.driver",
}), }),
"nfs": interface{}( "nfs": any(
map[string]interface{}{ map[string]any{
"server": "192.168.20.90", "server": "192.168.20.90",
"path": "/mnt/data/", "path": "/mnt/data/",
}), }),
@ -402,15 +402,15 @@ func TestValidate(t *testing.T) {
VolumePolicies: []VolumePolicy{ VolumePolicies: []VolumePolicy{
{ {
Action: Action{Type: Snapshot}, Action: Action{Type: Snapshot},
Conditions: map[string]interface{}{ Conditions: map[string]any{
"storageClass": []string{"gp2"}, "storageClass": []string{"gp2"},
}, },
}, },
{ {
Action: Action{Type: FSBackup}, Action: Action{Type: FSBackup},
Conditions: map[string]interface{}{ Conditions: map[string]any{
"nfs": interface{}( "nfs": any(
map[string]interface{}{ map[string]any{
"server": "192.168.20.90", "server": "192.168.20.90",
"path": "/mnt/data/", "path": "/mnt/data/",
}), }),

View File

@ -46,7 +46,7 @@ func (rp *MockRestartableProcess) ResetIfNeeded() error {
return args.Error(0) return args.Error(0)
} }
func (rp *MockRestartableProcess) GetByKindAndName(key process.KindAndName) (interface{}, error) { func (rp *MockRestartableProcess) GetByKindAndName(key process.KindAndName) (any, error) {
args := rp.Called(key) args := rp.Called(key)
return args.Get(0), args.Error(1) return args.Get(0), args.Error(1)
} }
@ -57,21 +57,21 @@ func (rp *MockRestartableProcess) Stop() {
type RestartableDelegateTest struct { type RestartableDelegateTest struct {
Function string Function string
Inputs []interface{} Inputs []any
ExpectedErrorOutputs []interface{} ExpectedErrorOutputs []any
ExpectedDelegateOutputs []interface{} ExpectedDelegateOutputs []any
} }
type Mockable interface { type Mockable interface {
Test(t mock.TestingT) Test(t mock.TestingT)
On(method string, args ...interface{}) *mock.Call On(method string, args ...any) *mock.Call
AssertExpectations(t mock.TestingT) bool AssertExpectations(t mock.TestingT) bool
} }
func RunRestartableDelegateTests( func RunRestartableDelegateTests(
t *testing.T, t *testing.T,
kind common.PluginKind, kind common.PluginKind,
newRestartable func(key process.KindAndName, p process.RestartableProcess) interface{}, newRestartable func(key process.KindAndName, p process.RestartableProcess) any,
newMock func() Mockable, newMock func() Mockable,
tests ...RestartableDelegateTest, tests ...RestartableDelegateTest,
) { ) {
@ -92,7 +92,7 @@ func RunRestartableDelegateTests(
method := reflect.ValueOf(r).MethodByName(tc.Function) method := reflect.ValueOf(r).MethodByName(tc.Function)
require.NotEmpty(t, method) require.NotEmpty(t, method)
// Convert the test case inputs ([]interface{}) to []reflect.Value // Convert the test case inputs ([]any) to []reflect.Value
var inputValues []reflect.Value var inputValues []reflect.Value
for i := range tc.Inputs { for i := range tc.Inputs {
inputValues = append(inputValues, reflect.ValueOf(tc.Inputs[i])) inputValues = append(inputValues, reflect.ValueOf(tc.Inputs[i]))
@ -102,7 +102,7 @@ func RunRestartableDelegateTests(
actual := method.Call(inputValues) actual := method.Call(inputValues)
// This Function asserts that the actual outputs match the expected outputs // This Function asserts that the actual outputs match the expected outputs
checkOutputs := func(expected []interface{}, actual []reflect.Value) { checkOutputs := func(expected []any, actual []reflect.Value) {
require.Equal(t, len(expected), len(actual)) require.Equal(t, len(expected), len(actual))
for i := range actual { for i := range actual {

View File

@ -143,7 +143,7 @@ func (v volumeHelperImpl) ShouldPerformFSBackup(volume corev1api.Volume, pod cor
} }
if v.volumePolicy != nil { if v.volumePolicy != nil {
var resource interface{} var resource any
resource = &volume resource = &volume
if volume.VolumeSource.PersistentVolumeClaim != nil { if volume.VolumeSource.PersistentVolumeClaim != nil {
pvc, err := kubeutil.GetPVCForPodVolume(&volume, &pod, v.client) pvc, err := kubeutil.GetPVCForPodVolume(&volume, &pod, v.client)

View File

@ -57,7 +57,7 @@ func TestVolumeHelperImpl_ShouldPerformSnapshot(t *testing.T) {
Version: "v1", Version: "v1",
VolumePolicies: []resourcepolicies.VolumePolicy{ VolumePolicies: []resourcepolicies.VolumePolicy{
{ {
Conditions: map[string]interface{}{ Conditions: map[string]any{
"storageClass": []string{"gp2-csi"}, "storageClass": []string{"gp2-csi"},
}, },
Action: resourcepolicies.Action{ Action: resourcepolicies.Action{
@ -78,7 +78,7 @@ func TestVolumeHelperImpl_ShouldPerformSnapshot(t *testing.T) {
Version: "v1", Version: "v1",
VolumePolicies: []resourcepolicies.VolumePolicy{ VolumePolicies: []resourcepolicies.VolumePolicy{
{ {
Conditions: map[string]interface{}{ Conditions: map[string]any{
"storageClass": []string{"gp2-csi"}, "storageClass": []string{"gp2-csi"},
}, },
Action: resourcepolicies.Action{ Action: resourcepolicies.Action{
@ -99,7 +99,7 @@ func TestVolumeHelperImpl_ShouldPerformSnapshot(t *testing.T) {
Version: "v1", Version: "v1",
VolumePolicies: []resourcepolicies.VolumePolicy{ VolumePolicies: []resourcepolicies.VolumePolicy{
{ {
Conditions: map[string]interface{}{ Conditions: map[string]any{
"storageClass": []string{"gp2-csi"}, "storageClass": []string{"gp2-csi"},
}, },
Action: resourcepolicies.Action{ Action: resourcepolicies.Action{
@ -121,7 +121,7 @@ func TestVolumeHelperImpl_ShouldPerformSnapshot(t *testing.T) {
Version: "v1", Version: "v1",
VolumePolicies: []resourcepolicies.VolumePolicy{ VolumePolicies: []resourcepolicies.VolumePolicy{
{ {
Conditions: map[string]interface{}{ Conditions: map[string]any{
"storageClass": []string{"gp2-csi"}, "storageClass": []string{"gp2-csi"},
}, },
Action: resourcepolicies.Action{ Action: resourcepolicies.Action{
@ -152,7 +152,7 @@ func TestVolumeHelperImpl_ShouldPerformSnapshot(t *testing.T) {
Version: "v1", Version: "v1",
VolumePolicies: []resourcepolicies.VolumePolicy{ VolumePolicies: []resourcepolicies.VolumePolicy{
{ {
Conditions: map[string]interface{}{ Conditions: map[string]any{
"storageClass": []string{"gp2-csi"}, "storageClass": []string{"gp2-csi"},
}, },
Action: resourcepolicies.Action{ Action: resourcepolicies.Action{
@ -186,7 +186,7 @@ func TestVolumeHelperImpl_ShouldPerformSnapshot(t *testing.T) {
Version: "v1", Version: "v1",
VolumePolicies: []resourcepolicies.VolumePolicy{ VolumePolicies: []resourcepolicies.VolumePolicy{
{ {
Conditions: map[string]interface{}{ Conditions: map[string]any{
"storageClass": []string{"gp2-csi"}, "storageClass": []string{"gp2-csi"},
}, },
Action: resourcepolicies.Action{ Action: resourcepolicies.Action{
@ -220,7 +220,7 @@ func TestVolumeHelperImpl_ShouldPerformSnapshot(t *testing.T) {
Version: "v1", Version: "v1",
VolumePolicies: []resourcepolicies.VolumePolicy{ VolumePolicies: []resourcepolicies.VolumePolicy{
{ {
Conditions: map[string]interface{}{ Conditions: map[string]any{
"storageClass": []string{"gp2-csi"}, "storageClass": []string{"gp2-csi"},
}, },
Action: resourcepolicies.Action{ Action: resourcepolicies.Action{
@ -253,7 +253,7 @@ func TestVolumeHelperImpl_ShouldPerformSnapshot(t *testing.T) {
Version: "v1", Version: "v1",
VolumePolicies: []resourcepolicies.VolumePolicy{ VolumePolicies: []resourcepolicies.VolumePolicy{
{ {
Conditions: map[string]interface{}{ Conditions: map[string]any{
"storageClass": []string{"gp2-csi"}, "storageClass": []string{"gp2-csi"},
}, },
Action: resourcepolicies.Action{ Action: resourcepolicies.Action{
@ -465,7 +465,7 @@ func TestVolumeHelperImpl_ShouldIncludeVolumeInBackup(t *testing.T) {
Version: "v1", Version: "v1",
VolumePolicies: []resourcepolicies.VolumePolicy{ VolumePolicies: []resourcepolicies.VolumePolicy{
{ {
Conditions: map[string]interface{}{ Conditions: map[string]any{
"storageClass": []string{"gp2-csi"}, "storageClass": []string{"gp2-csi"},
}, },
Action: resourcepolicies.Action{ Action: resourcepolicies.Action{
@ -540,7 +540,7 @@ func TestVolumeHelperImpl_ShouldPerformFSBackup(t *testing.T) {
Version: "v1", Version: "v1",
VolumePolicies: []resourcepolicies.VolumePolicy{ VolumePolicies: []resourcepolicies.VolumePolicy{
{ {
Conditions: map[string]interface{}{ Conditions: map[string]any{
"storageClass": []string{"gp2-csi"}, "storageClass": []string{"gp2-csi"},
}, },
Action: resourcepolicies.Action{ Action: resourcepolicies.Action{
@ -566,7 +566,7 @@ func TestVolumeHelperImpl_ShouldPerformFSBackup(t *testing.T) {
Version: "v1", Version: "v1",
VolumePolicies: []resourcepolicies.VolumePolicy{ VolumePolicies: []resourcepolicies.VolumePolicy{
{ {
Conditions: map[string]interface{}{ Conditions: map[string]any{
"volumeTypes": []string{"emptyDir"}, "volumeTypes": []string{"emptyDir"},
}, },
Action: resourcepolicies.Action{ Action: resourcepolicies.Action{
@ -600,7 +600,7 @@ func TestVolumeHelperImpl_ShouldPerformFSBackup(t *testing.T) {
Version: "v1", Version: "v1",
VolumePolicies: []resourcepolicies.VolumePolicy{ VolumePolicies: []resourcepolicies.VolumePolicy{
{ {
Conditions: map[string]interface{}{ Conditions: map[string]any{
"storageClass": []string{"gp2-csi"}, "storageClass": []string{"gp2-csi"},
}, },
Action: resourcepolicies.Action{ Action: resourcepolicies.Action{
@ -635,7 +635,7 @@ func TestVolumeHelperImpl_ShouldPerformFSBackup(t *testing.T) {
Version: "v1", Version: "v1",
VolumePolicies: []resourcepolicies.VolumePolicy{ VolumePolicies: []resourcepolicies.VolumePolicy{
{ {
Conditions: map[string]interface{}{ Conditions: map[string]any{
"storageClass": []string{"gp3-csi"}, "storageClass": []string{"gp3-csi"},
}, },
Action: resourcepolicies.Action{ Action: resourcepolicies.Action{

View File

@ -36,9 +36,9 @@ import (
func TestBackupPVAction(t *testing.T) { func TestBackupPVAction(t *testing.T) {
pvc := &unstructured.Unstructured{ pvc := &unstructured.Unstructured{
Object: map[string]interface{}{ Object: map[string]any{
"spec": map[string]interface{}{}, "spec": map[string]any{},
"status": map[string]interface{}{}, "status": map[string]any{},
}, },
} }
@ -54,7 +54,7 @@ func TestBackupPVAction(t *testing.T) {
// empty spec.volumeName should result in no error // empty spec.volumeName should result in no error
// and no additional items // and no additional items
pvc.Object["spec"].(map[string]interface{})["volumeName"] = "" pvc.Object["spec"].(map[string]any)["volumeName"] = ""
_, additional, err = a.Execute(pvc, backup) _, additional, err = a.Execute(pvc, backup)
assert.NoError(t, err) assert.NoError(t, err)
assert.Empty(t, additional) assert.Empty(t, additional)
@ -116,28 +116,28 @@ func TestBackupPVAction(t *testing.T) {
// non-empty spec.volumeName when status.phase is empty // non-empty spec.volumeName when status.phase is empty
// should result in no error and no additional items // should result in no error and no additional items
pvc.Object["spec"].(map[string]interface{})["volumeName"] = "myVolume" pvc.Object["spec"].(map[string]any)["volumeName"] = "myVolume"
_, additional, err = a.Execute(pvc, backup) _, additional, err = a.Execute(pvc, backup)
require.NoError(t, err) require.NoError(t, err)
require.Empty(t, additional) require.Empty(t, additional)
// non-empty spec.volumeName when status.phase is 'Pending' // non-empty spec.volumeName when status.phase is 'Pending'
// should result in no error and no additional items // should result in no error and no additional items
pvc.Object["status"].(map[string]interface{})["phase"] = corev1api.ClaimPending pvc.Object["status"].(map[string]any)["phase"] = corev1api.ClaimPending
_, additional, err = a.Execute(pvc, backup) _, additional, err = a.Execute(pvc, backup)
require.NoError(t, err) require.NoError(t, err)
require.Empty(t, additional) require.Empty(t, additional)
// non-empty spec.volumeName when status.phase is 'Lost' // non-empty spec.volumeName when status.phase is 'Lost'
// should result in no error and no additional items // should result in no error and no additional items
pvc.Object["status"].(map[string]interface{})["phase"] = corev1api.ClaimLost pvc.Object["status"].(map[string]any)["phase"] = corev1api.ClaimLost
_, additional, err = a.Execute(pvc, backup) _, additional, err = a.Execute(pvc, backup)
require.NoError(t, err) require.NoError(t, err)
require.Empty(t, additional) require.Empty(t, additional)
// non-empty spec.volumeName when status.phase is 'Bound' // non-empty spec.volumeName when status.phase is 'Bound'
// should result in no error and one additional item for the PV // should result in no error and one additional item for the PV
pvc.Object["status"].(map[string]interface{})["phase"] = corev1api.ClaimBound pvc.Object["status"].(map[string]any)["phase"] = corev1api.ClaimBound
_, additional, err = a.Execute(pvc, backup) _, additional, err = a.Execute(pvc, backup)
require.NoError(t, err) require.NoError(t, err)
require.Len(t, additional, 1) require.Len(t, additional, 1)
@ -145,7 +145,7 @@ func TestBackupPVAction(t *testing.T) {
// empty spec.volumeName when status.phase is 'Bound' should // empty spec.volumeName when status.phase is 'Bound' should
// result in no error and no additional items // result in no error and no additional items
pvc.Object["spec"].(map[string]interface{})["volumeName"] = "" pvc.Object["spec"].(map[string]any)["volumeName"] = ""
_, additional, err = a.Execute(pvc, backup) _, additional, err = a.Execute(pvc, backup)
assert.NoError(t, err) assert.NoError(t, err)
assert.Empty(t, additional) assert.Empty(t, additional)

View File

@ -552,7 +552,7 @@ func cancelDataUpload(
} }
func NewPvcBackupItemAction(f client.Factory) plugincommon.HandlerInitializer { func NewPvcBackupItemAction(f client.Factory) plugincommon.HandlerInitializer {
return func(logger logrus.FieldLogger) (interface{}, error) { return func(logger logrus.FieldLogger) (any, error) {
crClient, err := f.KubebuilderClient() crClient, err := f.KubebuilderClient()
if err != nil { if err != nil {
return nil, errors.WithStack(err) return nil, errors.WithStack(err)

View File

@ -372,7 +372,7 @@ func (p *volumeSnapshotBackupItemAction) Cancel(
func NewVolumeSnapshotBackupItemAction( func NewVolumeSnapshotBackupItemAction(
f client.Factory, f client.Factory,
) plugincommon.HandlerInitializer { ) plugincommon.HandlerInitializer {
return func(logger logrus.FieldLogger) (interface{}, error) { return func(logger logrus.FieldLogger) (any, error) {
crClient, err := f.KubebuilderClient() crClient, err := f.KubebuilderClient()
if err != nil { if err != nil {
return nil, errors.WithStack(err) return nil, errors.WithStack(err)

View File

@ -119,6 +119,6 @@ func (p *volumeSnapshotClassBackupItemAction) Cancel(
// NewVolumeSnapshotClassBackupItemAction returns a // NewVolumeSnapshotClassBackupItemAction returns a
// VolumeSnapshotClassBackupItemAction instance. // VolumeSnapshotClassBackupItemAction instance.
func NewVolumeSnapshotClassBackupItemAction(logger logrus.FieldLogger) (interface{}, error) { func NewVolumeSnapshotClassBackupItemAction(logger logrus.FieldLogger) (any, error) {
return &volumeSnapshotClassBackupItemAction{log: logger}, nil return &volumeSnapshotClassBackupItemAction{log: logger}, nil
} }

View File

@ -136,6 +136,6 @@ func (p *volumeSnapshotContentBackupItemAction) Cancel(
// VolumeSnapshotContentBackupItemAction instance. // VolumeSnapshotContentBackupItemAction instance.
func NewVolumeSnapshotContentBackupItemAction( func NewVolumeSnapshotContentBackupItemAction(
logger logrus.FieldLogger, logger logrus.FieldLogger,
) (interface{}, error) { ) (any, error) {
return &volumeSnapshotContentBackupItemAction{log: logger}, nil return &volumeSnapshotContentBackupItemAction{log: logger}, nil
} }

View File

@ -208,7 +208,7 @@ func TestRemapCRDVersionActionData(t *testing.T) {
// For ElasticSearch and Kibana, problems manifested when additionalPrinterColumns was moved from the top-level spec down to the // For ElasticSearch and Kibana, problems manifested when additionalPrinterColumns was moved from the top-level spec down to the
// versions slice. // versions slice.
if test.expectAdditionalColumns { if test.expectAdditionalColumns {
_, ok := item.UnstructuredContent()["spec"].(map[string]interface{})["additionalPrinterColumns"] _, ok := item.UnstructuredContent()["spec"].(map[string]any)["additionalPrinterColumns"]
assert.True(t, ok) assert.True(t, ok)
} }

View File

@ -446,7 +446,7 @@ func (kb *kubernetesBackupper) BackupWithResolvers(
var itemBlock *BackupItemBlock var itemBlock *BackupItemBlock
for i := range items { for i := range items {
log.WithFields(map[string]interface{}{ log.WithFields(map[string]any{
"progress": "", "progress": "",
"resource": items[i].groupResource.String(), "resource": items[i].groupResource.String(),
"namespace": items[i].namespace, "namespace": items[i].namespace,
@ -507,7 +507,7 @@ func (kb *kubernetesBackupper) BackupWithResolvers(
itemsBackedUp: backedUpItems, itemsBackedUp: backedUpItems,
} }
log.WithFields(map[string]interface{}{ log.WithFields(map[string]any{
"progress": "", "progress": "",
"resource": items[i].groupResource.String(), "resource": items[i].groupResource.String(),
"namespace": items[i].namespace, "namespace": items[i].namespace,
@ -973,7 +973,7 @@ func (kb *kubernetesBackupper) FinalizeBackup(
unstructuredDataUploads := make([]unstructured.Unstructured, 0) unstructuredDataUploads := make([]unstructured.Unstructured, 0)
for i, item := range items { for i, item := range items {
log.WithFields(map[string]interface{}{ log.WithFields(map[string]any{
"progress": "", "progress": "",
"resource": item.groupResource.String(), "resource": item.groupResource.String(),
"namespace": item.namespace, "namespace": item.namespace,
@ -1016,7 +1016,7 @@ func (kb *kubernetesBackupper) FinalizeBackup(
backedUpItems := backupRequest.BackedUpItems.Len() backedUpItems := backupRequest.BackedUpItems.Len()
totalItems := backedUpItems + (len(items) - (i + 1)) totalItems := backedUpItems + (len(items) - (i + 1))
log.WithFields(map[string]interface{}{ log.WithFields(map[string]any{
"progress": "", "progress": "",
"resource": item.groupResource.String(), "resource": item.groupResource.String(),
"namespace": item.namespace, "namespace": item.namespace,

View File

@ -1364,7 +1364,7 @@ func TestBackupItemActionsForSkippedPV(t *testing.T) {
VolumePolicies: []resourcepolicies.VolumePolicy{ VolumePolicies: []resourcepolicies.VolumePolicy{
{ {
Action: resourcepolicies.Action{Type: "snapshot"}, Action: resourcepolicies.Action{Type: "snapshot"},
Conditions: map[string]interface{}{ Conditions: map[string]any{
"storageClass": []string{"gp2"}, "storageClass": []string{"gp2"},
}, },
}, },
@ -1849,7 +1849,7 @@ func TestBackupActionModifications(t *testing.T) {
}, },
actions: []biav2.BackupItemAction{ actions: []biav2.BackupItemAction{
modifyingActionGetter(func(item *unstructured.Unstructured) { modifyingActionGetter(func(item *unstructured.Unstructured) {
item.Object["spec"].(map[string]interface{})["nodeName"] = "foo" item.Object["spec"].(map[string]any)["nodeName"] = "foo"
}), }),
}, },
want: map[string]unstructuredObject{ want: map[string]unstructuredObject{
@ -4282,7 +4282,7 @@ func defaultBackup() *builder.BackupBuilder {
return builder.ForBackup(velerov1.DefaultNamespace, "backup-1").DefaultVolumesToFsBackup(false) return builder.ForBackup(velerov1.DefaultNamespace, "backup-1").DefaultVolumesToFsBackup(false)
} }
func toUnstructuredOrFail(t *testing.T, obj interface{}) map[string]interface{} { func toUnstructuredOrFail(t *testing.T, obj any) map[string]any {
t.Helper() t.Helper()
res, err := runtime.DefaultUnstructuredConverter.ToUnstructured(obj) res, err := runtime.DefaultUnstructuredConverter.ToUnstructured(obj)
@ -4318,7 +4318,7 @@ func assertTarballContents(t *testing.T, backupFile io.Reader, items ...string)
} }
// unstructuredObject is a type alias to improve readability. // unstructuredObject is a type alias to improve readability.
type unstructuredObject map[string]interface{} type unstructuredObject map[string]any
// assertTarballFileContents verifies that the gzipped tarball stored in the provided // assertTarballFileContents verifies that the gzipped tarball stored in the provided
// backupFile contains the files specified as keys in 'want', and for each of those // backupFile contains the files specified as keys in 'want', and for each of those

View File

@ -159,7 +159,7 @@ func (ib *itemBackupper) backupItemInternal(logger logrus.FieldLogger, obj runti
namespace := metadata.GetNamespace() namespace := metadata.GetNamespace()
name := metadata.GetName() name := metadata.GetName()
log := logger.WithFields(map[string]interface{}{ log := logger.WithFields(map[string]any{
"name": name, "name": name,
"resource": groupResource.String(), "resource": groupResource.String(),
"namespace": namespace, "namespace": namespace,
@ -218,7 +218,7 @@ func (ib *itemBackupper) backupItemInternal(logger logrus.FieldLogger, obj runti
ib.podVolumeSnapshotTracker.Track(pod, volume.Name) ib.podVolumeSnapshotTracker.Track(pod, volume.Name)
if found, pvcName := ib.podVolumeSnapshotTracker.TakenForPodVolume(pod, volume.Name); found { if found, pvcName := ib.podVolumeSnapshotTracker.TakenForPodVolume(pod, volume.Name); found {
log.WithFields(map[string]interface{}{ log.WithFields(map[string]any{
"podVolume": volume, "podVolume": volume,
"pvcName": pvcName, "pvcName": pvcName,
}).Info("Pod volume uses a persistent volume claim which has already been backed up from another pod, skipping.") }).Info("Pod volume uses a persistent volume claim which has already been backed up from another pod, skipping.")

View File

@ -33,9 +33,9 @@ const (
ConfigKeyColorized = "colorized" ConfigKeyColorized = "colorized"
) )
// VeleroConfig is a map of strings to interface{} for deserializing Velero client config options. // VeleroConfig is a map of strings to any for deserializing Velero client config options.
// The alias is a way to attach type-asserting convenience methods. // The alias is a way to attach type-asserting convenience methods.
type VeleroConfig map[string]interface{} type VeleroConfig map[string]any
// LoadConfig loads the Velero client configuration file and returns it as a VeleroConfig. If the // LoadConfig loads the Velero client configuration file and returns it as a VeleroConfig. If the
// file does not exist, an empty map is returned. // file does not exist, an empty map is returned.

View File

@ -36,14 +36,14 @@ func TestFactory(t *testing.T) {
// Env variable should set the namespace if no config or argument are used // Env variable should set the namespace if no config or argument are used
os.Setenv("VELERO_NAMESPACE", "env-velero") os.Setenv("VELERO_NAMESPACE", "env-velero")
f := NewFactory("velero", make(map[string]interface{})) f := NewFactory("velero", make(map[string]any))
assert.Equal(t, "env-velero", f.Namespace()) assert.Equal(t, "env-velero", f.Namespace())
os.Unsetenv("VELERO_NAMESPACE") os.Unsetenv("VELERO_NAMESPACE")
// Argument should change the namespace // Argument should change the namespace
f = NewFactory("velero", make(map[string]interface{})) f = NewFactory("velero", make(map[string]any))
s := "flag-velero" s := "flag-velero"
flags := new(flag.FlagSet) flags := new(flag.FlagSet)
@ -55,7 +55,7 @@ func TestFactory(t *testing.T) {
// An argument overrides the env variable if both are set. // An argument overrides the env variable if both are set.
os.Setenv("VELERO_NAMESPACE", "env-velero") os.Setenv("VELERO_NAMESPACE", "env-velero")
f = NewFactory("velero", make(map[string]interface{})) f = NewFactory("velero", make(map[string]any))
flags = new(flag.FlagSet) flags = new(flag.FlagSet)
f.BindFlags(flags) f.BindFlags(flags)

View File

@ -257,7 +257,7 @@ func (o *CreateOptions) Run(c *cobra.Command, f client.Factory) error {
backupInformer := cache.NewSharedInformer(&lw, &velerov1api.Backup{}, time.Second) backupInformer := cache.NewSharedInformer(&lw, &velerov1api.Backup{}, time.Second)
_, _ = backupInformer.AddEventHandler( _, _ = backupInformer.AddEventHandler(
cache.FilteringResourceEventHandler{ cache.FilteringResourceEventHandler{
FilterFunc: func(obj interface{}) bool { FilterFunc: func(obj any) bool {
backup, ok := obj.(*velerov1api.Backup) backup, ok := obj.(*velerov1api.Backup)
if !ok { if !ok {
@ -266,14 +266,14 @@ func (o *CreateOptions) Run(c *cobra.Command, f client.Factory) error {
return backup.Name == o.Name return backup.Name == o.Name
}, },
Handler: cache.ResourceEventHandlerFuncs{ Handler: cache.ResourceEventHandlerFuncs{
UpdateFunc: func(_, obj interface{}) { UpdateFunc: func(_, obj any) {
backup, ok := obj.(*velerov1api.Backup) backup, ok := obj.(*velerov1api.Backup)
if !ok { if !ok {
return return
} }
updates <- backup updates <- backup
}, },
DeleteFunc: func(obj interface{}) { DeleteFunc: func(obj any) {
backup, ok := obj.(*velerov1api.Backup) backup, ok := obj.(*velerov1api.Backup)
if !ok { if !ok {
return return

View File

@ -56,7 +56,7 @@ func TestExitWithMessage(t *testing.T) {
name string name string
message string message string
succeed bool succeed bool
args []interface{} args []any
createErr error createErr error
writeFail bool writeFail bool
expectedExitCode int expectedExitCode int
@ -77,7 +77,7 @@ func TestExitWithMessage(t *testing.T) {
{ {
name: "not succeed", name: "not succeed",
message: "fake-message-1, arg-1 %s, arg-2 %v, arg-3 %v", message: "fake-message-1, arg-1 %s, arg-2 %v, arg-3 %v",
args: []interface{}{ args: []any{
"arg-1-1", "arg-1-1",
10, 10,
false, false,
@ -88,7 +88,7 @@ func TestExitWithMessage(t *testing.T) {
{ {
name: "not succeed", name: "not succeed",
message: "fake-message-2, arg-1 %s, arg-2 %v, arg-3 %v", message: "fake-message-2, arg-1 %s, arg-2 %v, arg-3 %v",
args: []interface{}{ args: []any{
"arg-1-2", "arg-1-2",
20, 20,
true, true,

View File

@ -369,7 +369,7 @@ func (o *CreateOptions) Run(c *cobra.Command, f client.Factory) error {
_, _ = restoreInformer.AddEventHandler( _, _ = restoreInformer.AddEventHandler(
cache.FilteringResourceEventHandler{ cache.FilteringResourceEventHandler{
FilterFunc: func(obj interface{}) bool { FilterFunc: func(obj any) bool {
restore, ok := obj.(*api.Restore) restore, ok := obj.(*api.Restore)
if !ok { if !ok {
return false return false
@ -377,14 +377,14 @@ func (o *CreateOptions) Run(c *cobra.Command, f client.Factory) error {
return restore.Name == o.RestoreName return restore.Name == o.RestoreName
}, },
Handler: cache.ResourceEventHandlerFuncs{ Handler: cache.ResourceEventHandlerFuncs{
UpdateFunc: func(_, obj interface{}) { UpdateFunc: func(_, obj any) {
restore, ok := obj.(*api.Restore) restore, ok := obj.(*api.Restore)
if !ok { if !ok {
return return
} }
updates <- restore updates <- restore
}, },
DeleteFunc: func(obj interface{}) { DeleteFunc: func(obj any) {
restore, ok := obj.(*api.Restore) restore, ok := obj.(*api.Restore)
if !ok { if !ok {
return return

View File

@ -34,7 +34,7 @@ func CheckError(err error) {
} }
// Exit prints msg (with optional args), plus a newline, to stderr and exits with code 1. // Exit prints msg (with optional args), plus a newline, to stderr and exits with code 1.
func Exit(msg string, args ...interface{}) { func Exit(msg string, args ...any) {
fmt.Fprintf(os.Stderr, msg+"\n", args...) fmt.Fprintf(os.Stderr, msg+"\n", args...)
os.Exit(1) os.Exit(1)
} }

View File

@ -209,16 +209,16 @@ func NewCommand(f client.Factory) *cobra.Command {
return c return c
} }
func newPVBackupItemAction(logger logrus.FieldLogger) (interface{}, error) { func newPVBackupItemAction(logger logrus.FieldLogger) (any, error) {
return bia.NewPVCAction(logger), nil return bia.NewPVCAction(logger), nil
} }
func newPodBackupItemAction(logger logrus.FieldLogger) (interface{}, error) { func newPodBackupItemAction(logger logrus.FieldLogger) (any, error) {
return bia.NewPodAction(logger), nil return bia.NewPodAction(logger), nil
} }
func newServiceAccountBackupItemAction(f client.Factory) plugincommon.HandlerInitializer { func newServiceAccountBackupItemAction(f client.Factory) plugincommon.HandlerInitializer {
return func(logger logrus.FieldLogger) (interface{}, error) { return func(logger logrus.FieldLogger) (any, error) {
// TODO(ncdc): consider a k8s style WantsKubernetesClientSet initialization approach // TODO(ncdc): consider a k8s style WantsKubernetesClientSet initialization approach
clientset, err := f.KubeClient() clientset, err := f.KubeClient()
if err != nil { if err != nil {
@ -248,7 +248,7 @@ func newServiceAccountBackupItemAction(f client.Factory) plugincommon.HandlerIni
} }
func newRemapCRDVersionAction(f client.Factory) plugincommon.HandlerInitializer { func newRemapCRDVersionAction(f client.Factory) plugincommon.HandlerInitializer {
return func(logger logrus.FieldLogger) (interface{}, error) { return func(logger logrus.FieldLogger) (any, error) {
config, err := f.ClientConfig() config, err := f.ClientConfig()
if err != nil { if err != nil {
return nil, err return nil, err
@ -272,20 +272,20 @@ func newRemapCRDVersionAction(f client.Factory) plugincommon.HandlerInitializer
} }
} }
func newJobRestoreItemAction(logger logrus.FieldLogger) (interface{}, error) { func newJobRestoreItemAction(logger logrus.FieldLogger) (any, error) {
return ria.NewJobAction(logger), nil return ria.NewJobAction(logger), nil
} }
func newPodRestoreItemAction(logger logrus.FieldLogger) (interface{}, error) { func newPodRestoreItemAction(logger logrus.FieldLogger) (any, error) {
return ria.NewPodAction(logger), nil return ria.NewPodAction(logger), nil
} }
func newInitRestoreHookPodAction(logger logrus.FieldLogger) (interface{}, error) { func newInitRestoreHookPodAction(logger logrus.FieldLogger) (any, error) {
return ria.NewInitRestoreHookPodAction(logger), nil return ria.NewInitRestoreHookPodAction(logger), nil
} }
func newPodVolumeRestoreItemAction(f client.Factory) plugincommon.HandlerInitializer { func newPodVolumeRestoreItemAction(f client.Factory) plugincommon.HandlerInitializer {
return func(logger logrus.FieldLogger) (interface{}, error) { return func(logger logrus.FieldLogger) (any, error) {
client, err := f.KubeClient() client, err := f.KubeClient()
if err != nil { if err != nil {
return nil, err return nil, err
@ -300,28 +300,28 @@ func newPodVolumeRestoreItemAction(f client.Factory) plugincommon.HandlerInitial
} }
} }
func newServiceRestoreItemAction(logger logrus.FieldLogger) (interface{}, error) { func newServiceRestoreItemAction(logger logrus.FieldLogger) (any, error) {
return ria.NewServiceAction(logger), nil return ria.NewServiceAction(logger), nil
} }
func newServiceAccountRestoreItemAction(logger logrus.FieldLogger) (interface{}, error) { func newServiceAccountRestoreItemAction(logger logrus.FieldLogger) (any, error) {
return ria.NewServiceAccountAction(logger), nil return ria.NewServiceAccountAction(logger), nil
} }
func newAddPVCFromPodRestoreItemAction(logger logrus.FieldLogger) (interface{}, error) { func newAddPVCFromPodRestoreItemAction(logger logrus.FieldLogger) (any, error) {
return ria.NewAddPVCFromPodAction(logger), nil return ria.NewAddPVCFromPodAction(logger), nil
} }
func newAddPVFromPVCRestoreItemAction(logger logrus.FieldLogger) (interface{}, error) { func newAddPVFromPVCRestoreItemAction(logger logrus.FieldLogger) (any, error) {
return ria.NewAddPVFromPVCAction(logger), nil return ria.NewAddPVFromPVCAction(logger), nil
} }
func newCRDV1PreserveUnknownFieldsItemAction(logger logrus.FieldLogger) (interface{}, error) { func newCRDV1PreserveUnknownFieldsItemAction(logger logrus.FieldLogger) (any, error) {
return ria.NewCRDV1PreserveUnknownFieldsAction(logger), nil return ria.NewCRDV1PreserveUnknownFieldsAction(logger), nil
} }
func newChangeStorageClassRestoreItemAction(f client.Factory) plugincommon.HandlerInitializer { func newChangeStorageClassRestoreItemAction(f client.Factory) plugincommon.HandlerInitializer {
return func(logger logrus.FieldLogger) (interface{}, error) { return func(logger logrus.FieldLogger) (any, error) {
client, err := f.KubeClient() client, err := f.KubeClient()
if err != nil { if err != nil {
return nil, err return nil, err
@ -336,7 +336,7 @@ func newChangeStorageClassRestoreItemAction(f client.Factory) plugincommon.Handl
} }
func newChangeImageNameRestoreItemAction(f client.Factory) plugincommon.HandlerInitializer { func newChangeImageNameRestoreItemAction(f client.Factory) plugincommon.HandlerInitializer {
return func(logger logrus.FieldLogger) (interface{}, error) { return func(logger logrus.FieldLogger) (any, error) {
client, err := f.KubeClient() client, err := f.KubeClient()
if err != nil { if err != nil {
return nil, err return nil, err
@ -348,16 +348,16 @@ func newChangeImageNameRestoreItemAction(f client.Factory) plugincommon.HandlerI
), nil ), nil
} }
} }
func newRoleBindingItemAction(logger logrus.FieldLogger) (interface{}, error) { func newRoleBindingItemAction(logger logrus.FieldLogger) (any, error) {
return ria.NewRoleBindingAction(logger), nil return ria.NewRoleBindingAction(logger), nil
} }
func newClusterRoleBindingItemAction(logger logrus.FieldLogger) (interface{}, error) { func newClusterRoleBindingItemAction(logger logrus.FieldLogger) (any, error) {
return ria.NewClusterRoleBindingAction(logger), nil return ria.NewClusterRoleBindingAction(logger), nil
} }
func newChangePVCNodeSelectorItemAction(f client.Factory) plugincommon.HandlerInitializer { func newChangePVCNodeSelectorItemAction(f client.Factory) plugincommon.HandlerInitializer {
return func(logger logrus.FieldLogger) (interface{}, error) { return func(logger logrus.FieldLogger) (any, error) {
client, err := f.KubeClient() client, err := f.KubeClient()
if err != nil { if err != nil {
return nil, err return nil, err
@ -371,16 +371,16 @@ func newChangePVCNodeSelectorItemAction(f client.Factory) plugincommon.HandlerIn
} }
} }
func newAPIServiceRestoreItemAction(logger logrus.FieldLogger) (interface{}, error) { func newAPIServiceRestoreItemAction(logger logrus.FieldLogger) (any, error) {
return ria.NewAPIServiceAction(logger), nil return ria.NewAPIServiceAction(logger), nil
} }
func newAdmissionWebhookConfigurationAction(logger logrus.FieldLogger) (interface{}, error) { func newAdmissionWebhookConfigurationAction(logger logrus.FieldLogger) (any, error) {
return ria.NewAdmissionWebhookConfigurationAction(logger), nil return ria.NewAdmissionWebhookConfigurationAction(logger), nil
} }
func newSecretRestoreItemAction(f client.Factory) plugincommon.HandlerInitializer { func newSecretRestoreItemAction(f client.Factory) plugincommon.HandlerInitializer {
return func(logger logrus.FieldLogger) (interface{}, error) { return func(logger logrus.FieldLogger) (any, error) {
client, err := f.KubebuilderClient() client, err := f.KubebuilderClient()
if err != nil { if err != nil {
return nil, err return nil, err
@ -390,7 +390,7 @@ func newSecretRestoreItemAction(f client.Factory) plugincommon.HandlerInitialize
} }
func newDataUploadRetrieveAction(f client.Factory) plugincommon.HandlerInitializer { func newDataUploadRetrieveAction(f client.Factory) plugincommon.HandlerInitializer {
return func(logger logrus.FieldLogger) (interface{}, error) { return func(logger logrus.FieldLogger) (any, error) {
client, err := f.KubebuilderClient() client, err := f.KubebuilderClient()
if err != nil { if err != nil {
return nil, err return nil, err
@ -401,7 +401,7 @@ func newDataUploadRetrieveAction(f client.Factory) plugincommon.HandlerInitializ
} }
func newDateUploadDeleteItemAction(f client.Factory) plugincommon.HandlerInitializer { func newDateUploadDeleteItemAction(f client.Factory) plugincommon.HandlerInitializer {
return func(logger logrus.FieldLogger) (interface{}, error) { return func(logger logrus.FieldLogger) (any, error) {
client, err := f.KubebuilderClient() client, err := f.KubebuilderClient()
if err != nil { if err != nil {
return nil, err return nil, err
@ -422,11 +422,11 @@ func newVolumeSnapshotBackupItemAction(f client.Factory) plugincommon.HandlerIni
return csibia.NewVolumeSnapshotBackupItemAction(f) return csibia.NewVolumeSnapshotBackupItemAction(f)
} }
func newVolumeSnapshotContentBackupItemAction(logger logrus.FieldLogger) (interface{}, error) { func newVolumeSnapshotContentBackupItemAction(logger logrus.FieldLogger) (any, error) {
return csibia.NewVolumeSnapshotContentBackupItemAction(logger) return csibia.NewVolumeSnapshotContentBackupItemAction(logger)
} }
func newVolumeSnapshotClassBackupItemAction(logger logrus.FieldLogger) (interface{}, error) { func newVolumeSnapshotClassBackupItemAction(logger logrus.FieldLogger) (any, error) {
return csibia.NewVolumeSnapshotClassBackupItemAction(logger) return csibia.NewVolumeSnapshotClassBackupItemAction(logger)
} }
@ -450,11 +450,11 @@ func newVolumeSnapshotRestoreItemAction(f client.Factory) plugincommon.HandlerIn
return csiria.NewVolumeSnapshotRestoreItemAction(f) return csiria.NewVolumeSnapshotRestoreItemAction(f)
} }
func newVolumeSnapshotContentRestoreItemAction(logger logrus.FieldLogger) (interface{}, error) { func newVolumeSnapshotContentRestoreItemAction(logger logrus.FieldLogger) (any, error) {
return csiria.NewVolumeSnapshotContentRestoreItemAction(logger) return csiria.NewVolumeSnapshotContentRestoreItemAction(logger)
} }
func newVolumeSnapshotClassRestoreItemAction(logger logrus.FieldLogger) (interface{}, error) { func newVolumeSnapshotClassRestoreItemAction(logger logrus.FieldLogger) (any, error) {
return csiria.NewVolumeSnapshotClassRestoreItemAction(logger) return csiria.NewVolumeSnapshotClassRestoreItemAction(logger)
} }
@ -464,12 +464,12 @@ func newPVCItemBlockAction(f client.Factory) plugincommon.HandlerInitializer {
return iba.NewPVCAction(f) return iba.NewPVCAction(f)
} }
func newPodItemBlockAction(logger logrus.FieldLogger) (interface{}, error) { func newPodItemBlockAction(logger logrus.FieldLogger) (any, error) {
return iba.NewPodAction(logger), nil return iba.NewPodAction(logger), nil
} }
func newServiceAccountItemBlockAction(f client.Factory) plugincommon.HandlerInitializer { func newServiceAccountItemBlockAction(f client.Factory) plugincommon.HandlerInitializer {
return func(logger logrus.FieldLogger) (interface{}, error) { return func(logger logrus.FieldLogger) (any, error) {
// TODO(ncdc): consider a k8s style WantsKubernetesClientSet initialization approach // TODO(ncdc): consider a k8s style WantsKubernetesClientSet initialization approach
clientset, err := f.KubeClient() clientset, err := f.KubeClient()
if err != nil { if err != nil {

View File

@ -74,11 +74,11 @@ func DescribeBackupInSF(
// DescribeBackupSpecInSF describes a backup spec in structured format. // DescribeBackupSpecInSF describes a backup spec in structured format.
func DescribeBackupSpecInSF(d *StructuredDescriber, spec velerov1api.BackupSpec) { func DescribeBackupSpecInSF(d *StructuredDescriber, spec velerov1api.BackupSpec) {
backupSpecInfo := make(map[string]interface{}) backupSpecInfo := make(map[string]any)
var s string var s string
// describe namespaces // describe namespaces
namespaceInfo := make(map[string]interface{}) namespaceInfo := make(map[string]any)
if len(spec.IncludedNamespaces) == 0 { if len(spec.IncludedNamespaces) == 0 {
s = "*" s = "*"
} else { } else {
@ -140,10 +140,10 @@ func DescribeBackupSpecInSF(d *StructuredDescriber, spec velerov1api.BackupSpec)
backupSpecInfo["CSISnapshotTimeout"] = spec.CSISnapshotTimeout.Duration.String() backupSpecInfo["CSISnapshotTimeout"] = spec.CSISnapshotTimeout.Duration.String()
// describe hooks // describe hooks
hooksInfo := make(map[string]interface{}) hooksInfo := make(map[string]any)
hooksResources := make(map[string]interface{}) hooksResources := make(map[string]any)
for _, backupResourceHookSpec := range spec.Hooks.Resources { for _, backupResourceHookSpec := range spec.Hooks.Resources {
ResourceDetails := make(map[string]interface{}) ResourceDetails := make(map[string]any)
var s string var s string
namespaceInfo := make(map[string]string) namespaceInfo := make(map[string]string)
if len(backupResourceHookSpec.IncludedNamespaces) == 0 { if len(backupResourceHookSpec.IncludedNamespaces) == 0 {
@ -181,10 +181,10 @@ func DescribeBackupSpecInSF(d *StructuredDescriber, spec velerov1api.BackupSpec)
} }
ResourceDetails["labelSelector"] = s ResourceDetails["labelSelector"] = s
preHooks := make([]map[string]interface{}, 0) preHooks := make([]map[string]any, 0)
for _, hook := range backupResourceHookSpec.PreHooks { for _, hook := range backupResourceHookSpec.PreHooks {
if hook.Exec != nil { if hook.Exec != nil {
preExecHook := make(map[string]interface{}) preExecHook := make(map[string]any)
preExecHook["container"] = hook.Exec.Container preExecHook["container"] = hook.Exec.Container
preExecHook["command"] = strings.Join(hook.Exec.Command, " ") preExecHook["command"] = strings.Join(hook.Exec.Command, " ")
preExecHook["onError:"] = hook.Exec.OnError preExecHook["onError:"] = hook.Exec.OnError
@ -194,10 +194,10 @@ func DescribeBackupSpecInSF(d *StructuredDescriber, spec velerov1api.BackupSpec)
} }
ResourceDetails["preExecHook"] = preHooks ResourceDetails["preExecHook"] = preHooks
postHooks := make([]map[string]interface{}, 0) postHooks := make([]map[string]any, 0)
for _, hook := range backupResourceHookSpec.PostHooks { for _, hook := range backupResourceHookSpec.PostHooks {
if hook.Exec != nil { if hook.Exec != nil {
postExecHook := make(map[string]interface{}) postExecHook := make(map[string]any)
postExecHook["container"] = hook.Exec.Container postExecHook["container"] = hook.Exec.Container
postExecHook["command"] = strings.Join(hook.Exec.Command, " ") postExecHook["command"] = strings.Join(hook.Exec.Command, " ")
postExecHook["onError:"] = hook.Exec.OnError postExecHook["onError:"] = hook.Exec.OnError
@ -225,7 +225,7 @@ func DescribeBackupSpecInSF(d *StructuredDescriber, spec velerov1api.BackupSpec)
func DescribeBackupStatusInSF(ctx context.Context, kbClient kbclient.Client, d *StructuredDescriber, backup *velerov1api.Backup, details bool, func DescribeBackupStatusInSF(ctx context.Context, kbClient kbclient.Client, d *StructuredDescriber, backup *velerov1api.Backup, details bool,
insecureSkipTLSVerify bool, caCertPath string, podVolumeBackups []velerov1api.PodVolumeBackup) { insecureSkipTLSVerify bool, caCertPath string, podVolumeBackups []velerov1api.PodVolumeBackup) {
status := backup.Status status := backup.Status
backupStatusInfo := make(map[string]interface{}) backupStatusInfo := make(map[string]any)
// Status.Version has been deprecated, use Status.FormatVersion // Status.Version has been deprecated, use Status.FormatVersion
backupStatusInfo["backupFormatVersion"] = status.FormatVersion backupStatusInfo["backupFormatVersion"] = status.FormatVersion
@ -271,7 +271,7 @@ func DescribeBackupStatusInSF(ctx context.Context, kbClient kbclient.Client, d *
} }
} }
func describeBackupResourceListInSF(ctx context.Context, kbClient kbclient.Client, backupStatusInfo map[string]interface{}, backup *velerov1api.Backup, insecureSkipTLSVerify bool, caCertPath string) { func describeBackupResourceListInSF(ctx context.Context, kbClient kbclient.Client, backupStatusInfo map[string]any, backup *velerov1api.Backup, insecureSkipTLSVerify bool, caCertPath string) {
// In consideration of decoding structured output conveniently, the two separate fields were created here(in func describeBackupResourceList, there is only one field describing either error message or resource list) // In consideration of decoding structured output conveniently, the two separate fields were created here(in func describeBackupResourceList, there is only one field describing either error message or resource list)
// the field of 'errorGettingResourceList' gives specific error message when it fails to get resources list // the field of 'errorGettingResourceList' gives specific error message when it fails to get resources list
// the field of 'resourceList' lists the rearranged resources // the field of 'resourceList' lists the rearranged resources
@ -299,8 +299,8 @@ func describeBackupResourceListInSF(ctx context.Context, kbClient kbclient.Clien
} }
func describeBackupVolumesInSF(ctx context.Context, kbClient kbclient.Client, backup *velerov1api.Backup, details bool, func describeBackupVolumesInSF(ctx context.Context, kbClient kbclient.Client, backup *velerov1api.Backup, details bool,
insecureSkipTLSVerify bool, caCertPath string, podVolumeBackupCRs []velerov1api.PodVolumeBackup, backupStatusInfo map[string]interface{}) { insecureSkipTLSVerify bool, caCertPath string, podVolumeBackupCRs []velerov1api.PodVolumeBackup, backupStatusInfo map[string]any) {
backupVolumes := make(map[string]interface{}) backupVolumes := make(map[string]any)
nativeSnapshots := []*volume.BackupVolumeInfo{} nativeSnapshots := []*volume.BackupVolumeInfo{}
csiSnapshots := []*volume.BackupVolumeInfo{} csiSnapshots := []*volume.BackupVolumeInfo{}
@ -351,20 +351,20 @@ func describeBackupVolumesInSF(ctx context.Context, kbClient kbclient.Client, ba
backupStatusInfo["backupVolumes"] = backupVolumes backupStatusInfo["backupVolumes"] = backupVolumes
} }
func describeNativeSnapshotsInSF(details bool, infos []*volume.BackupVolumeInfo, backupVolumes map[string]interface{}) { func describeNativeSnapshotsInSF(details bool, infos []*volume.BackupVolumeInfo, backupVolumes map[string]any) {
if len(infos) == 0 { if len(infos) == 0 {
backupVolumes["nativeSnapshots"] = "<none included>" backupVolumes["nativeSnapshots"] = "<none included>"
return return
} }
snapshotDetails := make(map[string]interface{}) snapshotDetails := make(map[string]any)
for _, info := range infos { for _, info := range infos {
describNativeSnapshotInSF(details, info, snapshotDetails) describNativeSnapshotInSF(details, info, snapshotDetails)
} }
backupVolumes["nativeSnapshots"] = snapshotDetails backupVolumes["nativeSnapshots"] = snapshotDetails
} }
func describNativeSnapshotInSF(details bool, info *volume.BackupVolumeInfo, snapshotDetails map[string]interface{}) { func describNativeSnapshotInSF(details bool, info *volume.BackupVolumeInfo, snapshotDetails map[string]any) {
if details { if details {
snapshotInfo := make(map[string]string) snapshotInfo := make(map[string]string)
snapshotInfo["snapshotID"] = info.NativeSnapshotInfo.SnapshotHandle snapshotInfo["snapshotID"] = info.NativeSnapshotInfo.SnapshotHandle
@ -379,7 +379,7 @@ func describNativeSnapshotInSF(details bool, info *volume.BackupVolumeInfo, snap
} }
} }
func describeCSISnapshotsInSF(details bool, infos []*volume.BackupVolumeInfo, backupVolumes map[string]interface{}, legacyInfoSource bool) { func describeCSISnapshotsInSF(details bool, infos []*volume.BackupVolumeInfo, backupVolumes map[string]any, legacyInfoSource bool) {
if len(infos) == 0 { if len(infos) == 0 {
if legacyInfoSource { if legacyInfoSource {
backupVolumes["csiSnapshots"] = "<none included or not detectable>" backupVolumes["csiSnapshots"] = "<none included or not detectable>"
@ -389,15 +389,15 @@ func describeCSISnapshotsInSF(details bool, infos []*volume.BackupVolumeInfo, ba
return return
} }
snapshotDetails := make(map[string]interface{}) snapshotDetails := make(map[string]any)
for _, info := range infos { for _, info := range infos {
describeCSISnapshotInSF(details, info, snapshotDetails) describeCSISnapshotInSF(details, info, snapshotDetails)
} }
backupVolumes["csiSnapshots"] = snapshotDetails backupVolumes["csiSnapshots"] = snapshotDetails
} }
func describeCSISnapshotInSF(details bool, info *volume.BackupVolumeInfo, snapshotDetails map[string]interface{}) { func describeCSISnapshotInSF(details bool, info *volume.BackupVolumeInfo, snapshotDetails map[string]any) {
snapshotDetail := make(map[string]interface{}) snapshotDetail := make(map[string]any)
describeLocalSnapshotInSF(details, info, snapshotDetail) describeLocalSnapshotInSF(details, info, snapshotDetail)
describeDataMovementInSF(details, info, snapshotDetail) describeDataMovementInSF(details, info, snapshotDetail)
@ -406,13 +406,13 @@ func describeCSISnapshotInSF(details bool, info *volume.BackupVolumeInfo, snapsh
} }
// describeLocalSnapshotInSF describes CSI volume snapshot contents in structured format. // describeLocalSnapshotInSF describes CSI volume snapshot contents in structured format.
func describeLocalSnapshotInSF(details bool, info *volume.BackupVolumeInfo, snapshotDetail map[string]interface{}) { func describeLocalSnapshotInSF(details bool, info *volume.BackupVolumeInfo, snapshotDetail map[string]any) {
if !info.PreserveLocalSnapshot { if !info.PreserveLocalSnapshot {
return return
} }
if details { if details {
localSnapshot := make(map[string]interface{}) localSnapshot := make(map[string]any)
if !info.SnapshotDataMoved { if !info.SnapshotDataMoved {
localSnapshot["operationID"] = info.CSISnapshotInfo.OperationID localSnapshot["operationID"] = info.CSISnapshotInfo.OperationID
@ -430,13 +430,13 @@ func describeLocalSnapshotInSF(details bool, info *volume.BackupVolumeInfo, snap
} }
} }
func describeDataMovementInSF(details bool, info *volume.BackupVolumeInfo, snapshotDetail map[string]interface{}) { func describeDataMovementInSF(details bool, info *volume.BackupVolumeInfo, snapshotDetail map[string]any) {
if !info.SnapshotDataMoved { if !info.SnapshotDataMoved {
return return
} }
if details { if details {
dataMovement := make(map[string]interface{}) dataMovement := make(map[string]any)
dataMovement["operationID"] = info.SnapshotDataMovementInfo.OperationID dataMovement["operationID"] = info.SnapshotDataMovementInfo.OperationID
dataMover := "velero" dataMover := "velero"
@ -456,14 +456,14 @@ func describeDataMovementInSF(details bool, info *volume.BackupVolumeInfo, snaps
// DescribeDeleteBackupRequestsInSF describes delete backup requests in structured format. // DescribeDeleteBackupRequestsInSF describes delete backup requests in structured format.
func DescribeDeleteBackupRequestsInSF(d *StructuredDescriber, requests []velerov1api.DeleteBackupRequest) { func DescribeDeleteBackupRequestsInSF(d *StructuredDescriber, requests []velerov1api.DeleteBackupRequest) {
deletionAttempts := make(map[string]interface{}) deletionAttempts := make(map[string]any)
if count := failedDeletionCount(requests); count > 0 { if count := failedDeletionCount(requests); count > 0 {
deletionAttempts["failed"] = count deletionAttempts["failed"] = count
} }
deletionRequests := make([]map[string]interface{}, 0) deletionRequests := make([]map[string]any, 0)
for _, req := range requests { for _, req := range requests {
deletionReq := make(map[string]interface{}) deletionReq := make(map[string]any)
deletionReq["creationTimestamp"] = req.CreationTimestamp.String() deletionReq["creationTimestamp"] = req.CreationTimestamp.String()
deletionReq["phase"] = req.Status.Phase deletionReq["phase"] = req.Status.Phase
@ -477,8 +477,8 @@ func DescribeDeleteBackupRequestsInSF(d *StructuredDescriber, requests []velerov
} }
// describePodVolumeBackupsInSF describes pod volume backups in structured format. // describePodVolumeBackupsInSF describes pod volume backups in structured format.
func describePodVolumeBackupsInSF(backups []velerov1api.PodVolumeBackup, details bool, backupVolumes map[string]interface{}) { func describePodVolumeBackupsInSF(backups []velerov1api.PodVolumeBackup, details bool, backupVolumes map[string]any) {
podVolumeBackupsInfo := make(map[string]interface{}) podVolumeBackupsInfo := make(map[string]any)
// Get the type of pod volume uploader. Since the uploader only comes from a single source, we can // Get the type of pod volume uploader. Since the uploader only comes from a single source, we can
// take the uploader type from the first element of the array. // take the uploader type from the first element of the array.
var uploaderType string var uploaderType string
@ -491,7 +491,7 @@ func describePodVolumeBackupsInSF(backups []velerov1api.PodVolumeBackup, details
// type display the type of pod volume backups // type display the type of pod volume backups
podVolumeBackupsInfo["uploderType"] = uploaderType podVolumeBackupsInfo["uploderType"] = uploaderType
podVolumeBackupsDetails := make(map[string]interface{}) podVolumeBackupsDetails := make(map[string]any)
// separate backups by phase (combining <none> and New into a single group) // separate backups by phase (combining <none> and New into a single group)
backupsByPhase := groupByPhase(backups) backupsByPhase := groupByPhase(backups)
@ -537,7 +537,7 @@ func DescribeBackupResultsInSF(ctx context.Context, kbClient kbclient.Client, d
var buf bytes.Buffer var buf bytes.Buffer
var resultMap map[string]results.Result var resultMap map[string]results.Result
errors, warnings := make(map[string]interface{}), make(map[string]interface{}) errors, warnings := make(map[string]any), make(map[string]any)
defer func() { defer func() {
d.Describe("errors", errors) d.Describe("errors", errors)
d.Describe("warnings", warnings) d.Describe("warnings", warnings)
@ -572,13 +572,13 @@ func DescribeBackupResultsInSF(ctx context.Context, kbClient kbclient.Client, d
// DescribeResourcePoliciesInSF describes resource policies in structured format. // DescribeResourcePoliciesInSF describes resource policies in structured format.
func DescribeResourcePoliciesInSF(d *StructuredDescriber, resPolicies *v1.TypedLocalObjectReference) { func DescribeResourcePoliciesInSF(d *StructuredDescriber, resPolicies *v1.TypedLocalObjectReference) {
policiesInfo := make(map[string]interface{}) policiesInfo := make(map[string]any)
policiesInfo["type"] = resPolicies.Kind policiesInfo["type"] = resPolicies.Kind
policiesInfo["name"] = resPolicies.Name policiesInfo["name"] = resPolicies.Name
d.Describe("resourcePolicies", policiesInfo) d.Describe("resourcePolicies", policiesInfo)
} }
func describeResultInSF(m map[string]interface{}, result results.Result) { func describeResultInSF(m map[string]any, result results.Result) {
m["velero"], m["cluster"], m["namespace"] = []string{}, []string{}, []string{} m["velero"], m["cluster"], m["namespace"] = []string{}, []string{}, []string{}
if len(result.Velero) > 0 { if len(result.Velero) > 0 {

View File

@ -33,7 +33,7 @@ import (
func TestDescribeBackupInSF(t *testing.T) { func TestDescribeBackupInSF(t *testing.T) {
sd := &StructuredDescriber{ sd := &StructuredDescriber{
output: make(map[string]interface{}), output: make(map[string]any),
format: "", format: "",
} }
backupBuilder1 := builder.ForBackup("test-ns", "test-backup") backupBuilder1 := builder.ForBackup("test-ns", "test-backup")
@ -75,9 +75,9 @@ func TestDescribeBackupInSF(t *testing.T) {
}, },
}) })
expect1 := map[string]interface{}{ expect1 := map[string]any{
"spec": map[string]interface{}{ "spec": map[string]any{
"namespaces": map[string]interface{}{ "namespaces": map[string]any{
"included": "inc-ns-1, inc-ns-2", "included": "inc-ns-1, inc-ns-2",
"excluded": "exc-ns-1, exc-ns-2", "excluded": "exc-ns-1, exc-ns-2",
}, },
@ -93,15 +93,15 @@ func TestDescribeBackupInSF(t *testing.T) {
"TTL": "72h0m0s", "TTL": "72h0m0s",
"CSISnapshotTimeout": "10m0s", "CSISnapshotTimeout": "10m0s",
"veleroSnapshotMoveData": "auto", "veleroSnapshotMoveData": "auto",
"hooks": map[string]interface{}{ "hooks": map[string]any{
"resources": map[string]interface{}{ "resources": map[string]any{
"hook-1": map[string]interface{}{ "hook-1": map[string]any{
"labelSelector": emptyDisplay, "labelSelector": emptyDisplay,
"namespaces": map[string]string{ "namespaces": map[string]string{
"included": "hook-inc-ns-1, hook-inc-ns-2", "included": "hook-inc-ns-1, hook-inc-ns-2",
"excluded": "hook-exc-ns-1, hook-exc-ns-2", "excluded": "hook-exc-ns-1, hook-exc-ns-2",
}, },
"preExecHook": []map[string]interface{}{ "preExecHook": []map[string]any{
{ {
"container": "hook-container-1", "container": "hook-container-1",
"command": "pre", "command": "pre",
@ -109,7 +109,7 @@ func TestDescribeBackupInSF(t *testing.T) {
"timeout": "0s", "timeout": "0s",
}, },
}, },
"postExecHook": []map[string]interface{}{ "postExecHook": []map[string]any{
{ {
"container": "hook-container-1", "container": "hook-container-1",
"command": "post", "command": "post",
@ -160,9 +160,9 @@ func TestDescribeBackupInSF(t *testing.T) {
}, },
}) })
expect2 := map[string]interface{}{ expect2 := map[string]any{
"spec": map[string]interface{}{ "spec": map[string]any{
"namespaces": map[string]interface{}{ "namespaces": map[string]any{
"included": "*", "included": "*",
"excluded": emptyDisplay, "excluded": emptyDisplay,
}, },
@ -178,15 +178,15 @@ func TestDescribeBackupInSF(t *testing.T) {
"TTL": "0s", "TTL": "0s",
"CSISnapshotTimeout": "0s", "CSISnapshotTimeout": "0s",
"veleroSnapshotMoveData": "auto", "veleroSnapshotMoveData": "auto",
"hooks": map[string]interface{}{ "hooks": map[string]any{
"resources": map[string]interface{}{ "resources": map[string]any{
"hook-1": map[string]interface{}{ "hook-1": map[string]any{
"labelSelector": emptyDisplay, "labelSelector": emptyDisplay,
"namespaces": map[string]string{ "namespaces": map[string]string{
"included": "*", "included": "*",
"excluded": emptyDisplay, "excluded": emptyDisplay,
}, },
"preExecHook": []map[string]interface{}{ "preExecHook": []map[string]any{
{ {
"container": "hook-container-1", "container": "hook-container-1",
"command": "pre", "command": "pre",
@ -194,7 +194,7 @@ func TestDescribeBackupInSF(t *testing.T) {
"timeout": "0s", "timeout": "0s",
}, },
}, },
"postExecHook": []map[string]interface{}{ "postExecHook": []map[string]any{
{ {
"container": "hook-container-1", "container": "hook-container-1",
"command": "post", "command": "post",
@ -244,21 +244,21 @@ func TestDescribePodVolumeBackupsInSF(t *testing.T) {
name string name string
inputPVBList []velerov1api.PodVolumeBackup inputPVBList []velerov1api.PodVolumeBackup
inputDetails bool inputDetails bool
expect map[string]interface{} expect map[string]any
}{ }{
{ {
name: "empty list", name: "empty list",
inputPVBList: []velerov1api.PodVolumeBackup{}, inputPVBList: []velerov1api.PodVolumeBackup{},
inputDetails: false, inputDetails: false,
expect: map[string]interface{}{"podVolumeBackups": "<none included>"}, expect: map[string]any{"podVolumeBackups": "<none included>"},
}, },
{ {
name: "2 completed pvbs", name: "2 completed pvbs",
inputPVBList: []velerov1api.PodVolumeBackup{*pvb1, *pvb2}, inputPVBList: []velerov1api.PodVolumeBackup{*pvb1, *pvb2},
inputDetails: true, inputDetails: true,
expect: map[string]interface{}{ expect: map[string]any{
"podVolumeBackups": map[string]interface{}{ "podVolumeBackups": map[string]any{
"podVolumeBackupsDetails": map[string]interface{}{ "podVolumeBackupsDetails": map[string]any{
"Completed": []map[string]string{ "Completed": []map[string]string{
{"pod-ns-1/pod-1": "vol-1"}, {"pod-ns-1/pod-1": "vol-1"},
{"pod-ns-1/pod-2": "vol-2"}, {"pod-ns-1/pod-2": "vol-2"},
@ -271,7 +271,7 @@ func TestDescribePodVolumeBackupsInSF(t *testing.T) {
} }
for _, tc := range testcases { for _, tc := range testcases {
t.Run(tc.name, func(tt *testing.T) { t.Run(tc.name, func(tt *testing.T) {
output := make(map[string]interface{}) output := make(map[string]any)
describePodVolumeBackupsInSF(tc.inputPVBList, tc.inputDetails, output) describePodVolumeBackupsInSF(tc.inputPVBList, tc.inputDetails, output)
assert.True(tt, reflect.DeepEqual(output, tc.expect)) assert.True(tt, reflect.DeepEqual(output, tc.expect))
}) })
@ -283,7 +283,7 @@ func TestDescribeNativeSnapshotsInSF(t *testing.T) {
name string name string
volumeInfo []*volume.BackupVolumeInfo volumeInfo []*volume.BackupVolumeInfo
inputDetails bool inputDetails bool
expect map[string]interface{} expect map[string]any
}{ }{
{ {
name: "no details", name: "no details",
@ -299,8 +299,8 @@ func TestDescribeNativeSnapshotsInSF(t *testing.T) {
}, },
}, },
}, },
expect: map[string]interface{}{ expect: map[string]any{
"nativeSnapshots": map[string]interface{}{ "nativeSnapshots": map[string]any{
"pv-1": "specify --details for more information", "pv-1": "specify --details for more information",
}, },
}, },
@ -321,8 +321,8 @@ func TestDescribeNativeSnapshotsInSF(t *testing.T) {
}, },
}, },
inputDetails: true, inputDetails: true,
expect: map[string]interface{}{ expect: map[string]any{
"nativeSnapshots": map[string]interface{}{ "nativeSnapshots": map[string]any{
"pv-1": map[string]string{ "pv-1": map[string]string{
"snapshotID": "snapshot-1", "snapshotID": "snapshot-1",
"type": "ebs", "type": "ebs",
@ -337,7 +337,7 @@ func TestDescribeNativeSnapshotsInSF(t *testing.T) {
for _, tc := range testcases { for _, tc := range testcases {
t.Run(tc.name, func(tt *testing.T) { t.Run(tc.name, func(tt *testing.T) {
output := make(map[string]interface{}) output := make(map[string]any)
describeNativeSnapshotsInSF(tc.inputDetails, tc.volumeInfo, output) describeNativeSnapshotsInSF(tc.inputDetails, tc.volumeInfo, output)
assert.True(tt, reflect.DeepEqual(output, tc.expect)) assert.True(tt, reflect.DeepEqual(output, tc.expect))
}) })
@ -349,13 +349,13 @@ func TestDescribeCSISnapshotsInSF(t *testing.T) {
name string name string
volumeInfo []*volume.BackupVolumeInfo volumeInfo []*volume.BackupVolumeInfo
inputDetails bool inputDetails bool
expect map[string]interface{} expect map[string]any
legacyInfoSource bool legacyInfoSource bool
}{ }{
{ {
name: "empty info, not legacy", name: "empty info, not legacy",
volumeInfo: []*volume.BackupVolumeInfo{}, volumeInfo: []*volume.BackupVolumeInfo{},
expect: map[string]interface{}{ expect: map[string]any{
"csiSnapshots": "<none included>", "csiSnapshots": "<none included>",
}, },
}, },
@ -363,7 +363,7 @@ func TestDescribeCSISnapshotsInSF(t *testing.T) {
name: "empty info, legacy", name: "empty info, legacy",
volumeInfo: []*volume.BackupVolumeInfo{}, volumeInfo: []*volume.BackupVolumeInfo{},
legacyInfoSource: true, legacyInfoSource: true,
expect: map[string]interface{}{ expect: map[string]any{
"csiSnapshots": "<none included or not detectable>", "csiSnapshots": "<none included or not detectable>",
}, },
}, },
@ -384,9 +384,9 @@ func TestDescribeCSISnapshotsInSF(t *testing.T) {
}, },
}, },
}, },
expect: map[string]interface{}{ expect: map[string]any{
"csiSnapshots": map[string]interface{}{ "csiSnapshots": map[string]any{
"pvc-ns-1/pvc-1": map[string]interface{}{ "pvc-ns-1/pvc-1": map[string]any{
"snapshot": "included, specify --details for more information", "snapshot": "included, specify --details for more information",
}, },
}, },
@ -411,10 +411,10 @@ func TestDescribeCSISnapshotsInSF(t *testing.T) {
}, },
}, },
inputDetails: true, inputDetails: true,
expect: map[string]interface{}{ expect: map[string]any{
"csiSnapshots": map[string]interface{}{ "csiSnapshots": map[string]any{
"pvc-ns-2/pvc-2": map[string]interface{}{ "pvc-ns-2/pvc-2": map[string]any{
"snapshot": map[string]interface{}{ "snapshot": map[string]any{
"operationID": "fake-operation-2", "operationID": "fake-operation-2",
"snapshotContentName": "vsc-2", "snapshotContentName": "vsc-2",
"storageSnapshotID": "snapshot-2", "storageSnapshotID": "snapshot-2",
@ -442,9 +442,9 @@ func TestDescribeCSISnapshotsInSF(t *testing.T) {
}, },
}, },
}, },
expect: map[string]interface{}{ expect: map[string]any{
"csiSnapshots": map[string]interface{}{ "csiSnapshots": map[string]any{
"pvc-ns-3/pvc-3": map[string]interface{}{ "pvc-ns-3/pvc-3": map[string]any{
"dataMovement": "included, specify --details for more information", "dataMovement": "included, specify --details for more information",
}, },
}, },
@ -468,10 +468,10 @@ func TestDescribeCSISnapshotsInSF(t *testing.T) {
}, },
}, },
inputDetails: true, inputDetails: true,
expect: map[string]interface{}{ expect: map[string]any{
"csiSnapshots": map[string]interface{}{ "csiSnapshots": map[string]any{
"pvc-ns-4/pvc-4": map[string]interface{}{ "pvc-ns-4/pvc-4": map[string]any{
"dataMovement": map[string]interface{}{ "dataMovement": map[string]any{
"operationID": "fake-operation-4", "operationID": "fake-operation-4",
"dataMover": "velero", "dataMover": "velero",
"uploaderType": "fake-uploader", "uploaderType": "fake-uploader",
@ -498,10 +498,10 @@ func TestDescribeCSISnapshotsInSF(t *testing.T) {
}, },
}, },
inputDetails: true, inputDetails: true,
expect: map[string]interface{}{ expect: map[string]any{
"csiSnapshots": map[string]interface{}{ "csiSnapshots": map[string]any{
"pvc-ns-4/pvc-4": map[string]interface{}{ "pvc-ns-4/pvc-4": map[string]any{
"dataMovement": map[string]interface{}{ "dataMovement": map[string]any{
"operationID": "fake-operation-4", "operationID": "fake-operation-4",
"dataMover": "velero", "dataMover": "velero",
"uploaderType": "fake-uploader", "uploaderType": "fake-uploader",
@ -515,7 +515,7 @@ func TestDescribeCSISnapshotsInSF(t *testing.T) {
for _, tc := range testcases { for _, tc := range testcases {
t.Run(tc.name, func(tt *testing.T) { t.Run(tc.name, func(tt *testing.T) {
output := make(map[string]interface{}) output := make(map[string]any)
describeCSISnapshotsInSF(tc.inputDetails, tc.volumeInfo, output, tc.legacyInfoSource) describeCSISnapshotsInSF(tc.inputDetails, tc.volumeInfo, output, tc.legacyInfoSource)
assert.True(tt, reflect.DeepEqual(output, tc.expect)) assert.True(tt, reflect.DeepEqual(output, tc.expect))
}) })
@ -527,14 +527,14 @@ func TestDescribeResourcePoliciesInSF(t *testing.T) {
Kind: "configmap", Kind: "configmap",
Name: "resource-policy-1", Name: "resource-policy-1",
} }
expect := map[string]interface{}{ expect := map[string]any{
"resourcePolicies": map[string]interface{}{ "resourcePolicies": map[string]any{
"type": "configmap", "type": "configmap",
"name": "resource-policy-1", "name": "resource-policy-1",
}, },
} }
sd := &StructuredDescriber{ sd := &StructuredDescriber{
output: make(map[string]interface{}), output: make(map[string]any),
format: "", format: "",
} }
DescribeResourcePoliciesInSF(sd, input) DescribeResourcePoliciesInSF(sd, input)
@ -549,8 +549,8 @@ func TestDescribeBackupResultInSF(t *testing.T) {
"ns-1": {"ns-1-msg-1", "ns-1-msg-2"}, "ns-1": {"ns-1-msg-1", "ns-1-msg-2"},
}, },
} }
got := map[string]interface{}{} got := map[string]any{}
expect := map[string]interface{}{ expect := map[string]any{
"velero": []string{"msg-1", "msg-2"}, "velero": []string{"msg-1", "msg-2"},
"cluster": []string{"cluster-1", "cluster-2"}, "cluster": []string{"cluster-1", "cluster-2"},
"namespace": map[string][]string{ "namespace": map[string][]string{
@ -579,24 +579,24 @@ func TestDescribeDeleteBackupRequestsInSF(t *testing.T) {
testcases := []struct { testcases := []struct {
name string name string
input []velerov1api.DeleteBackupRequest input []velerov1api.DeleteBackupRequest
expect map[string]interface{} expect map[string]any
}{ }{
{ {
name: "empty list", name: "empty list",
input: []velerov1api.DeleteBackupRequest{}, input: []velerov1api.DeleteBackupRequest{},
expect: map[string]interface{}{ expect: map[string]any{
"deletionAttempts": map[string]interface{}{ "deletionAttempts": map[string]any{
"deleteBackupRequests": []map[string]interface{}{}, "deleteBackupRequests": []map[string]any{},
}, },
}, },
}, },
{ {
name: "list with one failed and one in-progress request", name: "list with one failed and one in-progress request",
input: []velerov1api.DeleteBackupRequest{*dbr1, *dbr2}, input: []velerov1api.DeleteBackupRequest{*dbr1, *dbr2},
expect: map[string]interface{}{ expect: map[string]any{
"deletionAttempts": map[string]interface{}{ "deletionAttempts": map[string]any{
"failed": int(1), "failed": int(1),
"deleteBackupRequests": []map[string]interface{}{ "deleteBackupRequests": []map[string]any{
{ {
"creationTimestamp": t1.String(), "creationTimestamp": t1.String(),
"phase": velerov1api.DeleteBackupRequestPhaseProcessed, "phase": velerov1api.DeleteBackupRequestPhaseProcessed,
@ -616,7 +616,7 @@ func TestDescribeDeleteBackupRequestsInSF(t *testing.T) {
for _, tc := range testcases { for _, tc := range testcases {
t.Run(tc.name, func(tt *testing.T) { t.Run(tc.name, func(tt *testing.T) {
sd := &StructuredDescriber{ sd := &StructuredDescriber{
output: make(map[string]interface{}), output: make(map[string]any),
format: "", format: "",
} }
DescribeDeleteBackupRequestsInSF(sd, tc.input) DescribeDeleteBackupRequestsInSF(sd, tc.input)

View File

@ -47,12 +47,12 @@ func Describe(fn func(d *Describer)) string {
return d.buf.String() return d.buf.String()
} }
func (d *Describer) Printf(msg string, args ...interface{}) { func (d *Describer) Printf(msg string, args ...any) {
fmt.Fprint(d.out, d.Prefix) fmt.Fprint(d.out, d.Prefix)
fmt.Fprintf(d.out, msg, args...) fmt.Fprintf(d.out, msg, args...)
} }
func (d *Describer) Println(args ...interface{}) { func (d *Describer) Println(args ...any) {
fmt.Fprint(d.out, d.Prefix) fmt.Fprint(d.out, d.Prefix)
fmt.Fprintln(d.out, args...) fmt.Fprintln(d.out, args...)
} }
@ -122,14 +122,14 @@ func BoolPointerString(b *bool, falseString, trueString, nilString string) strin
} }
type StructuredDescriber struct { type StructuredDescriber struct {
output map[string]interface{} output map[string]any
format string format string
} }
// NewStructuredDescriber creates a StructuredDescriber. // NewStructuredDescriber creates a StructuredDescriber.
func NewStructuredDescriber(format string) *StructuredDescriber { func NewStructuredDescriber(format string) *StructuredDescriber {
return &StructuredDescriber{ return &StructuredDescriber{
output: make(map[string]interface{}), output: make(map[string]any),
format: format, format: format,
} }
} }
@ -144,13 +144,13 @@ func DescribeInSF(fn func(d *StructuredDescriber), format string) string {
} }
// Describe adds all types of argument to d.output. // Describe adds all types of argument to d.output.
func (d *StructuredDescriber) Describe(name string, arg interface{}) { func (d *StructuredDescriber) Describe(name string, arg any) {
d.output[name] = arg d.output[name] = arg
} }
// DescribeMetadata describes standard object metadata. // DescribeMetadata describes standard object metadata.
func (d *StructuredDescriber) DescribeMetadata(metadata metav1.ObjectMeta) { func (d *StructuredDescriber) DescribeMetadata(metadata metav1.ObjectMeta) {
metadataInfo := make(map[string]interface{}) metadataInfo := make(map[string]any)
metadataInfo["name"] = metadata.Name metadataInfo["name"] = metadata.Name
metadataInfo["namespace"] = metadata.Namespace metadataInfo["namespace"] = metadata.Namespace
metadataInfo["labels"] = metadata.Labels metadataInfo["labels"] = metadata.Labels

View File

@ -106,17 +106,17 @@ func TestDescriber_DescribeSlice(t *testing.T) {
func TestStructuredDescriber_JSONEncode(t *testing.T) { func TestStructuredDescriber_JSONEncode(t *testing.T) {
testcases := []struct { testcases := []struct {
name string name string
inputMap map[string]interface{} inputMap map[string]any
expect string expect string
}{ }{
{ {
name: "invalid json", name: "invalid json",
inputMap: map[string]interface{}{}, inputMap: map[string]any{},
expect: "{}\n", expect: "{}\n",
}, },
{ {
name: "valid json", name: "valid json",
inputMap: map[string]interface{}{"k1": "v1"}, inputMap: map[string]any{"k1": "v1"},
expect: `{ expect: `{
"k1": "v1" "k1": "v1"
} }
@ -148,8 +148,8 @@ func TestStructuredDescriber_DescribeMetadata(t *testing.T) {
"annotation-2": "v2", "annotation-2": "v2",
}, },
} }
expect := map[string]interface{}{ expect := map[string]any{
"metadata": map[string]interface{}{ "metadata": map[string]any{
"name": "test", "name": "test",
"namespace": "test-ns", "namespace": "test-ns",
"labels": map[string]string{ "labels": map[string]string{

View File

@ -548,7 +548,7 @@ func getBackupRepositoryConfig(ctx context.Context, ctrlClient client.Client, co
return nil, nil return nil, nil
} }
var unmarshalled map[string]interface{} var unmarshalled map[string]any
if err := json.Unmarshal([]byte(jsonData), &unmarshalled); err != nil { if err := json.Unmarshal([]byte(jsonData), &unmarshalled); err != nil {
return nil, errors.Wrapf(err, "error unmarshalling config data from %s for repo %s, repo type %s", configName, repoName, repoType) return nil, errors.Wrapf(err, "error unmarshalling config data from %s for repo %s, repo type %s", configName, repoName, repoType)
} }

View File

@ -46,7 +46,7 @@ import (
const testMaintenanceFrequency = 10 * time.Minute const testMaintenanceFrequency = 10 * time.Minute
func mockBackupRepoReconciler(t *testing.T, mockOn string, arg interface{}, ret ...interface{}) *BackupRepoReconciler { func mockBackupRepoReconciler(t *testing.T, mockOn string, arg any, ret ...any) *BackupRepoReconciler {
t.Helper() t.Helper()
mgr := &repomokes.Manager{} mgr := &repomokes.Manager{}
if mockOn != "" { if mockOn != "" {

View File

@ -796,7 +796,7 @@ func (r *DataUploadReconciler) closeDataPath(ctx context.Context, duName string)
r.dataPathMgr.RemoveAsyncBR(duName) r.dataPathMgr.RemoveAsyncBR(duName)
} }
func (r *DataUploadReconciler) setupExposeParam(du *velerov2alpha1api.DataUpload) (interface{}, error) { func (r *DataUploadReconciler) setupExposeParam(du *velerov2alpha1api.DataUpload) (any, error) {
log := r.logger.WithField("dataupload", du.Name) log := r.logger.WithField("dataupload", du.Name)
if du.Spec.SnapshotType == velerov2alpha1api.SnapshotTypeCSI { if du.Spec.SnapshotType == velerov2alpha1api.SnapshotTypeCSI {
@ -854,7 +854,7 @@ func (r *DataUploadReconciler) setupExposeParam(du *velerov2alpha1api.DataUpload
return nil, nil return nil, nil
} }
func (r *DataUploadReconciler) setupWaitExposePara(du *velerov2alpha1api.DataUpload) interface{} { func (r *DataUploadReconciler) setupWaitExposePara(du *velerov2alpha1api.DataUpload) any {
if du.Spec.SnapshotType == velerov2alpha1api.SnapshotTypeCSI { if du.Spec.SnapshotType == velerov2alpha1api.SnapshotTypeCSI {
return &exposer.CSISnapshotExposeWaitParam{ return &exposer.CSISnapshotExposeWaitParam{
NodeClient: r.client, NodeClient: r.client,

View File

@ -272,7 +272,7 @@ type fakeSnapshotExposer struct {
peekErr error peekErr error
} }
func (f *fakeSnapshotExposer) Expose(ctx context.Context, ownerObject corev1.ObjectReference, param interface{}) error { func (f *fakeSnapshotExposer) Expose(ctx context.Context, ownerObject corev1.ObjectReference, param any) error {
du := velerov2alpha1api.DataUpload{} du := velerov2alpha1api.DataUpload{}
err := f.kubeClient.Get(ctx, kbclient.ObjectKey{ err := f.kubeClient.Get(ctx, kbclient.ObjectKey{
Name: dataUploadName, Name: dataUploadName,
@ -289,7 +289,7 @@ func (f *fakeSnapshotExposer) Expose(ctx context.Context, ownerObject corev1.Obj
return nil return nil
} }
func (f *fakeSnapshotExposer) GetExposed(ctx context.Context, du corev1.ObjectReference, tm time.Duration, para interface{}) (*exposer.ExposeResult, error) { func (f *fakeSnapshotExposer) GetExposed(ctx context.Context, du corev1.ObjectReference, tm time.Duration, para any) (*exposer.ExposeResult, error) {
pod := &corev1.Pod{} pod := &corev1.Pod{}
err := f.kubeClient.Get(ctx, kbclient.ObjectKey{ err := f.kubeClient.Get(ctx, kbclient.ObjectKey{
Name: dataUploadName, Name: dataUploadName,
@ -326,11 +326,11 @@ type fakeDataUploadFSBR struct {
startErr error startErr error
} }
func (f *fakeDataUploadFSBR) Init(ctx context.Context, param interface{}) error { func (f *fakeDataUploadFSBR) Init(ctx context.Context, param any) error {
return f.initErr return f.initErr
} }
func (f *fakeDataUploadFSBR) StartBackup(source datapath.AccessPoint, uploaderConfigs map[string]string, param interface{}) error { func (f *fakeDataUploadFSBR) StartBackup(source datapath.AccessPoint, uploaderConfigs map[string]string, param any) error {
return f.startErr return f.startErr
} }
@ -1087,11 +1087,11 @@ func (dt *duResumeTestHelper) resumeCancellableDataPath(_ *DataUploadReconciler,
return dt.resumeErr return dt.resumeErr
} }
func (dt *duResumeTestHelper) Expose(context.Context, corev1.ObjectReference, interface{}) error { func (dt *duResumeTestHelper) Expose(context.Context, corev1.ObjectReference, any) error {
return nil return nil
} }
func (dt *duResumeTestHelper) GetExposed(context.Context, corev1.ObjectReference, time.Duration, interface{}) (*exposer.ExposeResult, error) { func (dt *duResumeTestHelper) GetExposed(context.Context, corev1.ObjectReference, time.Duration, any) (*exposer.ExposeResult, error) {
return dt.exposeResult, dt.getExposeErr return dt.exposeResult, dt.getExposeErr
} }

View File

@ -348,7 +348,7 @@ func (r *PodVolumeBackupReconciler) getParentSnapshot(ctx context.Context, log l
return "" return ""
} }
log.WithFields(map[string]interface{}{ log.WithFields(map[string]any{
"parentPodVolumeBackup": mostRecentPVB.Name, "parentPodVolumeBackup": mostRecentPVB.Name,
"parentSnapshotID": mostRecentPVB.Status.SnapshotID, "parentSnapshotID": mostRecentPVB.Status.SnapshotID,
}).Info("Found most recent completed PodVolumeBackup for PVC") }).Info("Found most recent completed PodVolumeBackup for PVC")

View File

@ -97,11 +97,11 @@ type fakeFSBR struct {
clock clock.WithTickerAndDelayedExecution clock clock.WithTickerAndDelayedExecution
} }
func (b *fakeFSBR) Init(ctx context.Context, param interface{}) error { func (b *fakeFSBR) Init(ctx context.Context, param any) error {
return nil return nil
} }
func (b *fakeFSBR) StartBackup(source datapath.AccessPoint, uploaderConfigs map[string]string, param interface{}) error { func (b *fakeFSBR) StartBackup(source datapath.AccessPoint, uploaderConfigs map[string]string, param any) error {
pvb := b.pvb pvb := b.pvb
original := b.pvb.DeepCopy() original := b.pvb.DeepCopy()

View File

@ -99,7 +99,7 @@ func (r *BackupMicroService) Init() error {
handler, err := r.duInformer.AddEventHandler( handler, err := r.duInformer.AddEventHandler(
cachetool.ResourceEventHandlerFuncs{ cachetool.ResourceEventHandlerFuncs{
UpdateFunc: func(oldObj interface{}, newObj interface{}) { UpdateFunc: func(oldObj any, newObj any) {
oldDu := oldObj.(*velerov2alpha1api.DataUpload) oldDu := oldObj.(*velerov2alpha1api.DataUpload)
newDu := newObj.(*velerov2alpha1api.DataUpload) newDu := newObj.(*velerov2alpha1api.DataUpload)

View File

@ -88,7 +88,7 @@ func (r *RestoreMicroService) Init() error {
handler, err := r.ddInformer.AddEventHandler( handler, err := r.ddInformer.AddEventHandler(
cachetool.ResourceEventHandlerFuncs{ cachetool.ResourceEventHandlerFuncs{
UpdateFunc: func(oldObj interface{}, newObj interface{}) { UpdateFunc: func(oldObj any, newObj any) {
oldDd := oldObj.(*velerov2alpha1api.DataDownload) oldDd := oldObj.(*velerov2alpha1api.DataDownload)
newDd := newObj.(*velerov2alpha1api.DataDownload) newDd := newObj.(*velerov2alpha1api.DataDownload)

View File

@ -85,7 +85,7 @@ func newFileSystemBR(jobName string, requestorType string, client client.Client,
return fs return fs
} }
func (fs *fileSystemBR) Init(ctx context.Context, param interface{}) error { func (fs *fileSystemBR) Init(ctx context.Context, param any) error {
initParam := param.(*FSBRInitParam) initParam := param.(*FSBRInitParam)
var err error var err error
@ -164,7 +164,7 @@ func (fs *fileSystemBR) close(ctx context.Context) {
} }
} }
func (fs *fileSystemBR) StartBackup(source AccessPoint, uploaderConfig map[string]string, param interface{}) error { func (fs *fileSystemBR) StartBackup(source AccessPoint, uploaderConfig map[string]string, param any) error {
if !fs.initialized { if !fs.initialized {
return errors.New("file system data path is not initialized") return errors.New("file system data path is not initialized")
} }

View File

@ -104,7 +104,7 @@ func newMicroServiceBRWatcher(client client.Client, kubeClient kubernetes.Interf
return ms return ms
} }
func (ms *microServiceBRWatcher) Init(ctx context.Context, param interface{}) error { func (ms *microServiceBRWatcher) Init(ctx context.Context, param any) error {
eventInformer, err := ms.mgr.GetCache().GetInformer(ctx, &v1.Event{}) eventInformer, err := ms.mgr.GetCache().GetInformer(ctx, &v1.Event{})
if err != nil { if err != nil {
return errors.Wrap(err, "error getting event informer") return errors.Wrap(err, "error getting event informer")
@ -117,7 +117,7 @@ func (ms *microServiceBRWatcher) Init(ctx context.Context, param interface{}) er
eventHandler, err := eventInformer.AddEventHandler( eventHandler, err := eventInformer.AddEventHandler(
cache.ResourceEventHandlerFuncs{ cache.ResourceEventHandlerFuncs{
AddFunc: func(obj interface{}) { AddFunc: func(obj any) {
evt := obj.(*v1.Event) evt := obj.(*v1.Event)
if evt.InvolvedObject.Namespace != ms.namespace || evt.InvolvedObject.Name != ms.associatedObject { if evt.InvolvedObject.Namespace != ms.namespace || evt.InvolvedObject.Name != ms.associatedObject {
return return
@ -125,7 +125,7 @@ func (ms *microServiceBRWatcher) Init(ctx context.Context, param interface{}) er
ms.eventCh <- evt ms.eventCh <- evt
}, },
UpdateFunc: func(_, obj interface{}) { UpdateFunc: func(_, obj any) {
evt := obj.(*v1.Event) evt := obj.(*v1.Event)
if evt.InvolvedObject.Namespace != ms.namespace || evt.InvolvedObject.Name != ms.associatedObject { if evt.InvolvedObject.Namespace != ms.namespace || evt.InvolvedObject.Name != ms.associatedObject {
return return
@ -141,7 +141,7 @@ func (ms *microServiceBRWatcher) Init(ctx context.Context, param interface{}) er
podHandler, err := podInformer.AddEventHandler( podHandler, err := podInformer.AddEventHandler(
cache.ResourceEventHandlerFuncs{ cache.ResourceEventHandlerFuncs{
UpdateFunc: func(_, obj interface{}) { UpdateFunc: func(_, obj any) {
pod := obj.(*v1.Pod) pod := obj.(*v1.Pod)
if pod.Namespace != ms.namespace || pod.Name != ms.thisPod { if pod.Namespace != ms.namespace || pod.Name != ms.thisPod {
return return
@ -213,7 +213,7 @@ func (ms *microServiceBRWatcher) close() {
} }
} }
func (ms *microServiceBRWatcher) StartBackup(source AccessPoint, uploaderConfig map[string]string, param interface{}) error { func (ms *microServiceBRWatcher) StartBackup(source AccessPoint, uploaderConfig map[string]string, param any) error {
ms.log.Infof("Start watching backup ms for source %v", source.ByPath) ms.log.Infof("Start watching backup ms for source %v", source.ByPath)
ms.startWatch() ms.startWatch()

View File

@ -59,10 +59,10 @@ type AccessPoint struct {
// AsyncBR is the interface for asynchronous data path methods // AsyncBR is the interface for asynchronous data path methods
type AsyncBR interface { type AsyncBR interface {
// Init initializes an asynchronous data path instance // Init initializes an asynchronous data path instance
Init(ctx context.Context, param interface{}) error Init(ctx context.Context, param any) error
// StartBackup starts an asynchronous data path instance for backup // StartBackup starts an asynchronous data path instance for backup
StartBackup(source AccessPoint, dataMoverConfig map[string]string, param interface{}) error StartBackup(source AccessPoint, dataMoverConfig map[string]string, param any) error
// StartRestore starts an asynchronous data path instance for restore // StartRestore starts an asynchronous data path instance for restore
StartRestore(snapshotID string, target AccessPoint, dataMoverConfig map[string]string) error StartRestore(snapshotID string, target AccessPoint, dataMoverConfig map[string]string) error

View File

@ -100,7 +100,7 @@ type csiSnapshotExposer struct {
log logrus.FieldLogger log logrus.FieldLogger
} }
func (e *csiSnapshotExposer) Expose(ctx context.Context, ownerObject corev1.ObjectReference, param interface{}) error { func (e *csiSnapshotExposer) Expose(ctx context.Context, ownerObject corev1.ObjectReference, param any) error {
csiExposeParam := param.(*CSISnapshotExposeParam) csiExposeParam := param.(*CSISnapshotExposeParam)
curLog := e.log.WithFields(logrus.Fields{ curLog := e.log.WithFields(logrus.Fields{
@ -232,7 +232,7 @@ func (e *csiSnapshotExposer) Expose(ctx context.Context, ownerObject corev1.Obje
return nil return nil
} }
func (e *csiSnapshotExposer) GetExposed(ctx context.Context, ownerObject corev1.ObjectReference, timeout time.Duration, param interface{}) (*ExposeResult, error) { func (e *csiSnapshotExposer) GetExposed(ctx context.Context, ownerObject corev1.ObjectReference, timeout time.Duration, param any) (*ExposeResult, error) {
exposeWaitParam := param.(*CSISnapshotExposeWaitParam) exposeWaitParam := param.(*CSISnapshotExposeWaitParam)
backupPodName := ownerObject.Name backupPodName := ownerObject.Name

View File

@ -26,11 +26,11 @@ import (
// SnapshotExposer is the interfaces for a snapshot exposer // SnapshotExposer is the interfaces for a snapshot exposer
type SnapshotExposer interface { type SnapshotExposer interface {
// Expose starts the process to expose a snapshot, the expose process may take long time // Expose starts the process to expose a snapshot, the expose process may take long time
Expose(context.Context, corev1.ObjectReference, interface{}) error Expose(context.Context, corev1.ObjectReference, any) error
// GetExposed polls the status of the expose. // GetExposed polls the status of the expose.
// If the expose is accessible by the current caller, it waits the expose ready and returns the expose result. // If the expose is accessible by the current caller, it waits the expose ready and returns the expose result.
// Otherwise, it returns nil as the expose result without an error. // Otherwise, it returns nil as the expose result without an error.
GetExposed(context.Context, corev1.ObjectReference, time.Duration, interface{}) (*ExposeResult, error) GetExposed(context.Context, corev1.ObjectReference, time.Duration, any) (*ExposeResult, error)
// PeekExposed tests the status of the expose. // PeekExposed tests the status of the expose.
// If the expose is incomplete but not recoverable, it returns an error. // If the expose is incomplete but not recoverable, it returns an error.

View File

@ -284,7 +284,7 @@ func createResource(r *unstructured.Unstructured, factory client.DynamicFactory,
id := fmt.Sprintf("%s/%s", r.GetKind(), r.GetName()) id := fmt.Sprintf("%s/%s", r.GetKind(), r.GetName())
// Helper to reduce boilerplate message about the same object // Helper to reduce boilerplate message about the same object
log := func(f string, a ...interface{}) { log := func(f string, a ...any) {
format := strings.Join([]string{id, ": ", f, "\n"}, "") format := strings.Join([]string{id, ": ", f, "\n"}, "")
fmt.Fprintf(w, format, a...) fmt.Fprintf(w, format, a...)
} }
@ -310,7 +310,7 @@ func CreateClient(r *unstructured.Unstructured, factory client.DynamicFactory, w
id := fmt.Sprintf("%s/%s", r.GetKind(), r.GetName()) id := fmt.Sprintf("%s/%s", r.GetKind(), r.GetName())
// Helper to reduce boilerplate message about the same object // Helper to reduce boilerplate message about the same object
log := func(f string, a ...interface{}) { log := func(f string, a ...any) {
format := strings.Join([]string{id, ": ", f, "\n"}, "") format := strings.Join([]string{id, ": ", f, "\n"}, "")
fmt.Fprintf(w, format, a...) fmt.Fprintf(w, format, a...)
} }

View File

@ -42,7 +42,7 @@ type PVCAction struct {
} }
func NewPVCAction(f client.Factory) plugincommon.HandlerInitializer { func NewPVCAction(f client.Factory) plugincommon.HandlerInitializer {
return func(logger logrus.FieldLogger) (interface{}, error) { return func(logger logrus.FieldLogger) (any, error) {
crClient, err := f.KubebuilderClient() crClient, err := f.KubebuilderClient()
if err != nil { if err != nil {
return nil, errors.WithStack(err) return nil, errors.WithStack(err)

View File

@ -187,7 +187,7 @@ func (b *objectBackupStoreGetter) Get(location *velerov1api.BackupStorageLocatio
return nil, err return nil, err
} }
log := logger.WithFields(logrus.Fields(map[string]interface{}{ log := logger.WithFields(logrus.Fields(map[string]any{
"bucket": bucket, "bucket": bucket,
"prefix": prefix, "prefix": prefix,
})) }))
@ -410,7 +410,7 @@ func tryGet(objectStore velero.ObjectStore, bucket, key string) (io.ReadCloser,
// decode extracts a .json.gz file reader into the object pointed to // decode extracts a .json.gz file reader into the object pointed to
// by 'into'. // by 'into'.
func decode(jsongzReader io.Reader, into interface{}) error { func decode(jsongzReader io.Reader, into any) error {
gzr, err := gzip.NewReader(jsongzReader) gzr, err := gzip.NewReader(jsongzReader)
if err != nil { if err != nil {
return errors.WithStack(err) return errors.WithStack(err)

View File

@ -36,7 +36,7 @@ import (
func TestRestartableGetBackupItemAction(t *testing.T) { func TestRestartableGetBackupItemAction(t *testing.T) {
tests := []struct { tests := []struct {
name string name string
plugin interface{} plugin any
getError error getError error
expectedError string expectedError string
}{ }{
@ -105,13 +105,13 @@ func TestRestartableBackupItemActionDelegatedFunctions(t *testing.T) {
b := new(v1.Backup) b := new(v1.Backup)
pv := &unstructured.Unstructured{ pv := &unstructured.Unstructured{
Object: map[string]interface{}{ Object: map[string]any{
"color": "blue", "color": "blue",
}, },
} }
pvToReturn := &unstructured.Unstructured{ pvToReturn := &unstructured.Unstructured{
Object: map[string]interface{}{ Object: map[string]any{
"color": "green", "color": "green",
}, },
} }
@ -125,7 +125,7 @@ func TestRestartableBackupItemActionDelegatedFunctions(t *testing.T) {
restartabletest.RunRestartableDelegateTests( restartabletest.RunRestartableDelegateTests(
t, t,
common.PluginKindBackupItemAction, common.PluginKindBackupItemAction,
func(key process.KindAndName, p process.RestartableProcess) interface{} { func(key process.KindAndName, p process.RestartableProcess) any {
return &RestartableBackupItemAction{ return &RestartableBackupItemAction{
Key: key, Key: key,
SharedPluginProcess: p, SharedPluginProcess: p,
@ -136,15 +136,15 @@ func TestRestartableBackupItemActionDelegatedFunctions(t *testing.T) {
}, },
restartabletest.RestartableDelegateTest{ restartabletest.RestartableDelegateTest{
Function: "AppliesTo", Function: "AppliesTo",
Inputs: []interface{}{}, Inputs: []any{},
ExpectedErrorOutputs: []interface{}{velero.ResourceSelector{}, errors.Errorf("reset error")}, ExpectedErrorOutputs: []any{velero.ResourceSelector{}, errors.Errorf("reset error")},
ExpectedDelegateOutputs: []interface{}{velero.ResourceSelector{IncludedNamespaces: []string{"a"}}, errors.Errorf("delegate error")}, ExpectedDelegateOutputs: []any{velero.ResourceSelector{IncludedNamespaces: []string{"a"}}, errors.Errorf("delegate error")},
}, },
restartabletest.RestartableDelegateTest{ restartabletest.RestartableDelegateTest{
Function: "Execute", Function: "Execute",
Inputs: []interface{}{pv, b}, Inputs: []any{pv, b},
ExpectedErrorOutputs: []interface{}{nil, ([]velero.ResourceIdentifier)(nil), errors.Errorf("reset error")}, ExpectedErrorOutputs: []any{nil, ([]velero.ResourceIdentifier)(nil), errors.Errorf("reset error")},
ExpectedDelegateOutputs: []interface{}{pvToReturn, additionalItems, errors.Errorf("delegate error")}, ExpectedDelegateOutputs: []any{pvToReturn, additionalItems, errors.Errorf("delegate error")},
}, },
) )
} }

View File

@ -36,7 +36,7 @@ import (
func TestRestartableGetBackupItemAction(t *testing.T) { func TestRestartableGetBackupItemAction(t *testing.T) {
tests := []struct { tests := []struct {
name string name string
plugin interface{} plugin any
getError error getError error
expectedError string expectedError string
}{ }{
@ -105,7 +105,7 @@ func TestRestartableBackupItemActionDelegatedFunctions(t *testing.T) {
b := new(v1.Backup) b := new(v1.Backup)
pv := &unstructured.Unstructured{ pv := &unstructured.Unstructured{
Object: map[string]interface{}{ Object: map[string]any{
"color": "blue", "color": "blue",
}, },
} }
@ -113,7 +113,7 @@ func TestRestartableBackupItemActionDelegatedFunctions(t *testing.T) {
oid := "operation1" oid := "operation1"
pvToReturn := &unstructured.Unstructured{ pvToReturn := &unstructured.Unstructured{
Object: map[string]interface{}{ Object: map[string]any{
"color": "green", "color": "green",
}, },
} }
@ -127,7 +127,7 @@ func TestRestartableBackupItemActionDelegatedFunctions(t *testing.T) {
restartabletest.RunRestartableDelegateTests( restartabletest.RunRestartableDelegateTests(
t, t,
common.PluginKindBackupItemAction, common.PluginKindBackupItemAction,
func(key process.KindAndName, p process.RestartableProcess) interface{} { func(key process.KindAndName, p process.RestartableProcess) any {
return &RestartableBackupItemAction{ return &RestartableBackupItemAction{
Key: key, Key: key,
SharedPluginProcess: p, SharedPluginProcess: p,
@ -138,27 +138,27 @@ func TestRestartableBackupItemActionDelegatedFunctions(t *testing.T) {
}, },
restartabletest.RestartableDelegateTest{ restartabletest.RestartableDelegateTest{
Function: "AppliesTo", Function: "AppliesTo",
Inputs: []interface{}{}, Inputs: []any{},
ExpectedErrorOutputs: []interface{}{velero.ResourceSelector{}, errors.Errorf("reset error")}, ExpectedErrorOutputs: []any{velero.ResourceSelector{}, errors.Errorf("reset error")},
ExpectedDelegateOutputs: []interface{}{velero.ResourceSelector{IncludedNamespaces: []string{"a"}}, errors.Errorf("delegate error")}, ExpectedDelegateOutputs: []any{velero.ResourceSelector{IncludedNamespaces: []string{"a"}}, errors.Errorf("delegate error")},
}, },
restartabletest.RestartableDelegateTest{ restartabletest.RestartableDelegateTest{
Function: "Execute", Function: "Execute",
Inputs: []interface{}{pv, b}, Inputs: []any{pv, b},
ExpectedErrorOutputs: []interface{}{nil, ([]velero.ResourceIdentifier)(nil), "", ([]velero.ResourceIdentifier)(nil), errors.Errorf("reset error")}, ExpectedErrorOutputs: []any{nil, ([]velero.ResourceIdentifier)(nil), "", ([]velero.ResourceIdentifier)(nil), errors.Errorf("reset error")},
ExpectedDelegateOutputs: []interface{}{pvToReturn, additionalItems, "", ([]velero.ResourceIdentifier)(nil), errors.Errorf("delegate error")}, ExpectedDelegateOutputs: []any{pvToReturn, additionalItems, "", ([]velero.ResourceIdentifier)(nil), errors.Errorf("delegate error")},
}, },
restartabletest.RestartableDelegateTest{ restartabletest.RestartableDelegateTest{
Function: "Progress", Function: "Progress",
Inputs: []interface{}{oid, b}, Inputs: []any{oid, b},
ExpectedErrorOutputs: []interface{}{velero.OperationProgress{}, errors.Errorf("reset error")}, ExpectedErrorOutputs: []any{velero.OperationProgress{}, errors.Errorf("reset error")},
ExpectedDelegateOutputs: []interface{}{velero.OperationProgress{}, errors.Errorf("delegate error")}, ExpectedDelegateOutputs: []any{velero.OperationProgress{}, errors.Errorf("delegate error")},
}, },
restartabletest.RestartableDelegateTest{ restartabletest.RestartableDelegateTest{
Function: "Cancel", Function: "Cancel",
Inputs: []interface{}{oid, b}, Inputs: []any{oid, b},
ExpectedErrorOutputs: []interface{}{errors.Errorf("reset error")}, ExpectedErrorOutputs: []any{errors.Errorf("reset error")},
ExpectedDelegateOutputs: []interface{}{errors.Errorf("delegate error")}, ExpectedDelegateOutputs: []any{errors.Errorf("delegate error")},
}, },
) )
} }

View File

@ -36,7 +36,7 @@ import (
func TestRestartableGetItemBlockAction(t *testing.T) { func TestRestartableGetItemBlockAction(t *testing.T) {
tests := []struct { tests := []struct {
name string name string
plugin interface{} plugin any
getError error getError error
expectedError string expectedError string
}{ }{
@ -105,7 +105,7 @@ func TestRestartableItemBlockActionDelegatedFunctions(t *testing.T) {
b := new(v1.Backup) b := new(v1.Backup)
pv := &unstructured.Unstructured{ pv := &unstructured.Unstructured{
Object: map[string]interface{}{ Object: map[string]any{
"color": "blue", "color": "blue",
}, },
} }
@ -119,7 +119,7 @@ func TestRestartableItemBlockActionDelegatedFunctions(t *testing.T) {
restartabletest.RunRestartableDelegateTests( restartabletest.RunRestartableDelegateTests(
t, t,
common.PluginKindItemBlockAction, common.PluginKindItemBlockAction,
func(key process.KindAndName, p process.RestartableProcess) interface{} { func(key process.KindAndName, p process.RestartableProcess) any {
return &RestartableItemBlockAction{ return &RestartableItemBlockAction{
Key: key, Key: key,
SharedPluginProcess: p, SharedPluginProcess: p,
@ -130,15 +130,15 @@ func TestRestartableItemBlockActionDelegatedFunctions(t *testing.T) {
}, },
restartabletest.RestartableDelegateTest{ restartabletest.RestartableDelegateTest{
Function: "AppliesTo", Function: "AppliesTo",
Inputs: []interface{}{}, Inputs: []any{},
ExpectedErrorOutputs: []interface{}{velero.ResourceSelector{}, errors.Errorf("reset error")}, ExpectedErrorOutputs: []any{velero.ResourceSelector{}, errors.Errorf("reset error")},
ExpectedDelegateOutputs: []interface{}{velero.ResourceSelector{IncludedNamespaces: []string{"a"}}, errors.Errorf("delegate error")}, ExpectedDelegateOutputs: []any{velero.ResourceSelector{IncludedNamespaces: []string{"a"}}, errors.Errorf("delegate error")},
}, },
restartabletest.RestartableDelegateTest{ restartabletest.RestartableDelegateTest{
Function: "GetRelatedItems", Function: "GetRelatedItems",
Inputs: []interface{}{pv, b}, Inputs: []any{pv, b},
ExpectedErrorOutputs: []interface{}{([]velero.ResourceIdentifier)(nil), errors.Errorf("reset error")}, ExpectedErrorOutputs: []any{([]velero.ResourceIdentifier)(nil), errors.Errorf("reset error")},
ExpectedDelegateOutputs: []interface{}{relatedItems, errors.Errorf("delegate error")}, ExpectedDelegateOutputs: []any{relatedItems, errors.Errorf("delegate error")},
}, },
) )
} }

View File

@ -159,10 +159,10 @@ func TestGetObjectStore(t *testing.T) {
getPluginTest(t, getPluginTest(t,
common.PluginKindObjectStore, common.PluginKindObjectStore,
"velero.io/aws", "velero.io/aws",
func(m Manager, name string) (interface{}, error) { func(m Manager, name string) (any, error) {
return m.GetObjectStore(name) return m.GetObjectStore(name)
}, },
func(name string, sharedPluginProcess process.RestartableProcess) interface{} { func(name string, sharedPluginProcess process.RestartableProcess) any {
return &restartableObjectStore{ return &restartableObjectStore{
key: process.KindAndName{Kind: common.PluginKindObjectStore, Name: name}, key: process.KindAndName{Kind: common.PluginKindObjectStore, Name: name},
sharedPluginProcess: sharedPluginProcess, sharedPluginProcess: sharedPluginProcess,
@ -176,10 +176,10 @@ func TestGetVolumeSnapshotter(t *testing.T) {
getPluginTest(t, getPluginTest(t,
common.PluginKindVolumeSnapshotter, common.PluginKindVolumeSnapshotter,
"velero.io/aws", "velero.io/aws",
func(m Manager, name string) (interface{}, error) { func(m Manager, name string) (any, error) {
return m.GetVolumeSnapshotter(name) return m.GetVolumeSnapshotter(name)
}, },
func(name string, sharedPluginProcess process.RestartableProcess) interface{} { func(name string, sharedPluginProcess process.RestartableProcess) any {
return &vsv1cli.RestartableVolumeSnapshotter{ return &vsv1cli.RestartableVolumeSnapshotter{
Key: process.KindAndName{Kind: common.PluginKindVolumeSnapshotter, Name: name}, Key: process.KindAndName{Kind: common.PluginKindVolumeSnapshotter, Name: name},
SharedPluginProcess: sharedPluginProcess, SharedPluginProcess: sharedPluginProcess,
@ -193,10 +193,10 @@ func TestGetBackupItemAction(t *testing.T) {
getPluginTest(t, getPluginTest(t,
common.PluginKindBackupItemAction, common.PluginKindBackupItemAction,
"velero.io/pod", "velero.io/pod",
func(m Manager, name string) (interface{}, error) { func(m Manager, name string) (any, error) {
return m.GetBackupItemAction(name) return m.GetBackupItemAction(name)
}, },
func(name string, sharedPluginProcess process.RestartableProcess) interface{} { func(name string, sharedPluginProcess process.RestartableProcess) any {
return &biav1cli.RestartableBackupItemAction{ return &biav1cli.RestartableBackupItemAction{
Key: process.KindAndName{Kind: common.PluginKindBackupItemAction, Name: name}, Key: process.KindAndName{Kind: common.PluginKindBackupItemAction, Name: name},
SharedPluginProcess: sharedPluginProcess, SharedPluginProcess: sharedPluginProcess,
@ -210,10 +210,10 @@ func TestGetBackupItemActionV2(t *testing.T) {
getPluginTest(t, getPluginTest(t,
common.PluginKindBackupItemActionV2, common.PluginKindBackupItemActionV2,
"velero.io/pod", "velero.io/pod",
func(m Manager, name string) (interface{}, error) { func(m Manager, name string) (any, error) {
return m.GetBackupItemActionV2(name) return m.GetBackupItemActionV2(name)
}, },
func(name string, sharedPluginProcess process.RestartableProcess) interface{} { func(name string, sharedPluginProcess process.RestartableProcess) any {
return &biav2cli.RestartableBackupItemAction{ return &biav2cli.RestartableBackupItemAction{
Key: process.KindAndName{Kind: common.PluginKindBackupItemActionV2, Name: name}, Key: process.KindAndName{Kind: common.PluginKindBackupItemActionV2, Name: name},
SharedPluginProcess: sharedPluginProcess, SharedPluginProcess: sharedPluginProcess,
@ -227,10 +227,10 @@ func TestGetRestoreItemAction(t *testing.T) {
getPluginTest(t, getPluginTest(t,
common.PluginKindRestoreItemAction, common.PluginKindRestoreItemAction,
"velero.io/pod", "velero.io/pod",
func(m Manager, name string) (interface{}, error) { func(m Manager, name string) (any, error) {
return m.GetRestoreItemAction(name) return m.GetRestoreItemAction(name)
}, },
func(name string, sharedPluginProcess process.RestartableProcess) interface{} { func(name string, sharedPluginProcess process.RestartableProcess) any {
return &riav1cli.RestartableRestoreItemAction{ return &riav1cli.RestartableRestoreItemAction{
Key: process.KindAndName{Kind: common.PluginKindRestoreItemAction, Name: name}, Key: process.KindAndName{Kind: common.PluginKindRestoreItemAction, Name: name},
SharedPluginProcess: sharedPluginProcess, SharedPluginProcess: sharedPluginProcess,
@ -244,10 +244,10 @@ func TestGetRestoreItemActionV2(t *testing.T) {
getPluginTest(t, getPluginTest(t,
common.PluginKindRestoreItemActionV2, common.PluginKindRestoreItemActionV2,
"velero.io/pod", "velero.io/pod",
func(m Manager, name string) (interface{}, error) { func(m Manager, name string) (any, error) {
return m.GetRestoreItemActionV2(name) return m.GetRestoreItemActionV2(name)
}, },
func(name string, sharedPluginProcess process.RestartableProcess) interface{} { func(name string, sharedPluginProcess process.RestartableProcess) any {
return &riav2cli.RestartableRestoreItemAction{ return &riav2cli.RestartableRestoreItemAction{
Key: process.KindAndName{Kind: common.PluginKindRestoreItemActionV2, Name: name}, Key: process.KindAndName{Kind: common.PluginKindRestoreItemActionV2, Name: name},
SharedPluginProcess: sharedPluginProcess, SharedPluginProcess: sharedPluginProcess,
@ -261,10 +261,10 @@ func TestGetItemBlockAction(t *testing.T) {
getPluginTest(t, getPluginTest(t,
common.PluginKindItemBlockAction, common.PluginKindItemBlockAction,
"velero.io/pod", "velero.io/pod",
func(m Manager, name string) (interface{}, error) { func(m Manager, name string) (any, error) {
return m.GetItemBlockAction(name) return m.GetItemBlockAction(name)
}, },
func(name string, sharedPluginProcess process.RestartableProcess) interface{} { func(name string, sharedPluginProcess process.RestartableProcess) any {
return &ibav1cli.RestartableItemBlockAction{ return &ibav1cli.RestartableItemBlockAction{
Key: process.KindAndName{Kind: common.PluginKindItemBlockAction, Name: name}, Key: process.KindAndName{Kind: common.PluginKindItemBlockAction, Name: name},
SharedPluginProcess: sharedPluginProcess, SharedPluginProcess: sharedPluginProcess,
@ -278,8 +278,8 @@ func getPluginTest(
t *testing.T, t *testing.T,
kind common.PluginKind, kind common.PluginKind,
name string, name string,
getPluginFunc func(m Manager, name string) (interface{}, error), getPluginFunc func(m Manager, name string) (any, error),
expectedResultFunc func(name string, sharedPluginProcess process.RestartableProcess) interface{}, expectedResultFunc func(name string, sharedPluginProcess process.RestartableProcess) any,
reinitializable bool, reinitializable bool,
) { ) {
t.Helper() t.Helper()
@ -373,7 +373,7 @@ func TestGetBackupItemActions(t *testing.T) {
} }
registry.On("List", pluginKind).Return(pluginIDs) registry.On("List", pluginKind).Return(pluginIDs)
var expectedActions []interface{} var expectedActions []any
for i := range pluginIDs { for i := range pluginIDs {
pluginID := pluginIDs[i] pluginID := pluginIDs[i]
pluginName := pluginID.Name pluginName := pluginID.Name
@ -408,7 +408,7 @@ func TestGetBackupItemActions(t *testing.T) {
assert.EqualError(t, err, "NewRestartableProcess") assert.EqualError(t, err, "NewRestartableProcess")
} else { } else {
require.NoError(t, err) require.NoError(t, err)
var actual []interface{} var actual []any
for i := range backupItemActions { for i := range backupItemActions {
actual = append(actual, backupItemActions[i]) actual = append(actual, backupItemActions[i])
} }
@ -465,7 +465,7 @@ func TestGetBackupItemActionsV2(t *testing.T) {
} }
registry.On("List", pluginKind).Return(pluginIDs) registry.On("List", pluginKind).Return(pluginIDs)
var expectedActions []interface{} var expectedActions []any
for i := range pluginIDs { for i := range pluginIDs {
pluginID := pluginIDs[i] pluginID := pluginIDs[i]
pluginName := pluginID.Name pluginName := pluginID.Name
@ -500,7 +500,7 @@ func TestGetBackupItemActionsV2(t *testing.T) {
assert.EqualError(t, err, "NewRestartableProcess") assert.EqualError(t, err, "NewRestartableProcess")
} else { } else {
require.NoError(t, err) require.NoError(t, err)
var actual []interface{} var actual []any
for i := range backupItemActions { for i := range backupItemActions {
actual = append(actual, backupItemActions[i]) actual = append(actual, backupItemActions[i])
} }
@ -557,7 +557,7 @@ func TestGetRestoreItemActions(t *testing.T) {
} }
registry.On("List", pluginKind).Return(pluginIDs) registry.On("List", pluginKind).Return(pluginIDs)
var expectedActions []interface{} var expectedActions []any
for i := range pluginIDs { for i := range pluginIDs {
pluginID := pluginIDs[i] pluginID := pluginIDs[i]
pluginName := pluginID.Name pluginName := pluginID.Name
@ -592,7 +592,7 @@ func TestGetRestoreItemActions(t *testing.T) {
assert.EqualError(t, err, "NewRestartableProcess") assert.EqualError(t, err, "NewRestartableProcess")
} else { } else {
require.NoError(t, err) require.NoError(t, err)
var actual []interface{} var actual []any
for i := range restoreItemActions { for i := range restoreItemActions {
actual = append(actual, restoreItemActions[i]) actual = append(actual, restoreItemActions[i])
} }
@ -649,7 +649,7 @@ func TestGetRestoreItemActionsV2(t *testing.T) {
} }
registry.On("List", pluginKind).Return(pluginIDs) registry.On("List", pluginKind).Return(pluginIDs)
var expectedActions []interface{} var expectedActions []any
for i := range pluginIDs { for i := range pluginIDs {
pluginID := pluginIDs[i] pluginID := pluginIDs[i]
pluginName := pluginID.Name pluginName := pluginID.Name
@ -684,7 +684,7 @@ func TestGetRestoreItemActionsV2(t *testing.T) {
assert.EqualError(t, err, "NewRestartableProcess") assert.EqualError(t, err, "NewRestartableProcess")
} else { } else {
require.NoError(t, err) require.NoError(t, err)
var actual []interface{} var actual []any
for i := range restoreItemActions { for i := range restoreItemActions {
actual = append(actual, restoreItemActions[i]) actual = append(actual, restoreItemActions[i])
} }
@ -698,10 +698,10 @@ func TestGetDeleteItemAction(t *testing.T) {
getPluginTest(t, getPluginTest(t,
common.PluginKindDeleteItemAction, common.PluginKindDeleteItemAction,
"velero.io/deleter", "velero.io/deleter",
func(m Manager, name string) (interface{}, error) { func(m Manager, name string) (any, error) {
return m.GetDeleteItemAction(name) return m.GetDeleteItemAction(name)
}, },
func(name string, sharedPluginProcess process.RestartableProcess) interface{} { func(name string, sharedPluginProcess process.RestartableProcess) any {
return &restartableDeleteItemAction{ return &restartableDeleteItemAction{
key: process.KindAndName{Kind: common.PluginKindDeleteItemAction, Name: name}, key: process.KindAndName{Kind: common.PluginKindDeleteItemAction, Name: name},
sharedPluginProcess: sharedPluginProcess, sharedPluginProcess: sharedPluginProcess,
@ -758,7 +758,7 @@ func TestGetDeleteItemActions(t *testing.T) {
} }
registry.On("List", pluginKind).Return(pluginIDs) registry.On("List", pluginKind).Return(pluginIDs)
var expectedActions []interface{} var expectedActions []any
for i := range pluginIDs { for i := range pluginIDs {
pluginID := pluginIDs[i] pluginID := pluginIDs[i]
pluginName := pluginID.Name pluginName := pluginID.Name
@ -793,7 +793,7 @@ func TestGetDeleteItemActions(t *testing.T) {
assert.EqualError(t, err, "NewRestartableProcess") assert.EqualError(t, err, "NewRestartableProcess")
} else { } else {
require.NoError(t, err) require.NoError(t, err)
var actual []interface{} var actual []any
for i := range deleteItemActions { for i := range deleteItemActions {
actual = append(actual, deleteItemActions[i]) actual = append(actual, deleteItemActions[i])
} }
@ -850,7 +850,7 @@ func TestGetItemBlockActions(t *testing.T) {
} }
registry.On("List", pluginKind).Return(pluginIDs) registry.On("List", pluginKind).Return(pluginIDs)
var expectedActions []interface{} var expectedActions []any
for i := range pluginIDs { for i := range pluginIDs {
pluginID := pluginIDs[i] pluginID := pluginIDs[i]
pluginName := pluginID.Name pluginName := pluginID.Name
@ -885,7 +885,7 @@ func TestGetItemBlockActions(t *testing.T) {
assert.EqualError(t, err, "NewRestartableProcess") assert.EqualError(t, err, "NewRestartableProcess")
} else { } else {
require.NoError(t, err) require.NoError(t, err)
var actual []interface{} var actual []any
for i := range itemBlockActions { for i := range itemBlockActions {
actual = append(actual, itemBlockActions[i]) actual = append(actual, itemBlockActions[i])
} }

View File

@ -37,8 +37,8 @@ type logrusAdapter struct {
// args are alternating key, value pairs, where the keys // args are alternating key, value pairs, where the keys
// are expected to be strings, and values can be any type. // are expected to be strings, and values can be any type.
func argsToFields(args ...interface{}) logrus.Fields { func argsToFields(args ...any) logrus.Fields {
fields := make(map[string]interface{}) fields := make(map[string]any)
for i := 0; i < len(args); i += 2 { for i := 0; i < len(args); i += 2 {
switch args[i] { switch args[i] {
@ -52,7 +52,7 @@ func argsToFields(args ...interface{}) logrus.Fields {
// to log at based on the hclog-compatible `@level` field which // to log at based on the hclog-compatible `@level` field which
// we're adding via HcLogLevelHook). // we're adding via HcLogLevelHook).
default: default:
var val interface{} var val any
if i+1 < len(args) { if i+1 < len(args) {
val = args[i+1] val = args[i+1]
} }
@ -66,27 +66,27 @@ func argsToFields(args ...interface{}) logrus.Fields {
// Trace emits a message and key/value pairs at the DEBUG level // Trace emits a message and key/value pairs at the DEBUG level
// (logrus doesn't have a TRACE level) // (logrus doesn't have a TRACE level)
func (l *logrusAdapter) Trace(msg string, args ...interface{}) { func (l *logrusAdapter) Trace(msg string, args ...any) {
l.Debug(msg, args...) l.Debug(msg, args...)
} }
// Debug emits a message and key/value pairs at the DEBUG level // Debug emits a message and key/value pairs at the DEBUG level
func (l *logrusAdapter) Debug(msg string, args ...interface{}) { func (l *logrusAdapter) Debug(msg string, args ...any) {
l.impl.WithFields(argsToFields(args...)).Debug(msg) l.impl.WithFields(argsToFields(args...)).Debug(msg)
} }
// Info emits a message and key/value pairs at the INFO level // Info emits a message and key/value pairs at the INFO level
func (l *logrusAdapter) Info(msg string, args ...interface{}) { func (l *logrusAdapter) Info(msg string, args ...any) {
l.impl.WithFields(argsToFields(args...)).Info(msg) l.impl.WithFields(argsToFields(args...)).Info(msg)
} }
// Warn emits a message and key/value pairs at the WARN level // Warn emits a message and key/value pairs at the WARN level
func (l *logrusAdapter) Warn(msg string, args ...interface{}) { func (l *logrusAdapter) Warn(msg string, args ...any) {
l.impl.WithFields(argsToFields(args...)).Warn(msg) l.impl.WithFields(argsToFields(args...)).Warn(msg)
} }
// Error emits a message and key/value pairs at the ERROR level // Error emits a message and key/value pairs at the ERROR level
func (l *logrusAdapter) Error(msg string, args ...interface{}) { func (l *logrusAdapter) Error(msg string, args ...any) {
l.impl.WithFields(argsToFields(args...)).Error(msg) l.impl.WithFields(argsToFields(args...)).Error(msg)
} }
@ -121,7 +121,7 @@ func (l *logrusAdapter) IsError() bool {
} }
// With creates a sublogger that will always have the given key/value pairs // With creates a sublogger that will always have the given key/value pairs
func (l *logrusAdapter) With(args ...interface{}) hclog.Logger { func (l *logrusAdapter) With(args ...any) hclog.Logger {
return &logrusAdapter{ return &logrusAdapter{
impl: l.impl.WithFields(argsToFields(args...)), impl: l.impl.WithFields(argsToFields(args...)),
level: l.level, level: l.level,
@ -164,7 +164,7 @@ func (l *logrusAdapter) SetLevel(_ hclog.Level) {
} }
// ImpliedArgs returns With key/value pairs // ImpliedArgs returns With key/value pairs
func (l *logrusAdapter) ImpliedArgs() []interface{} { func (l *logrusAdapter) ImpliedArgs() []any {
panic("not implemented") panic("not implemented")
} }
@ -172,7 +172,7 @@ func (l *logrusAdapter) ImpliedArgs() []interface{} {
// keys must be strings // keys must be strings
// vals can be any type, but display is implementation specific // vals can be any type, but display is implementation specific
// Emit a message and key/value pairs at a provided log level // Emit a message and key/value pairs at a provided log level
func (l *logrusAdapter) Log(level hclog.Level, msg string, args ...interface{}) { func (l *logrusAdapter) Log(level hclog.Level, msg string, args ...any) {
switch level { switch level {
case hclog.Trace: case hclog.Trace:
l.Trace(msg, args...) l.Trace(msg, args...)

View File

@ -26,34 +26,34 @@ import (
func TestArgsToFields(t *testing.T) { func TestArgsToFields(t *testing.T) {
tests := []struct { tests := []struct {
name string name string
args []interface{} args []any
expectedFields logrus.Fields expectedFields logrus.Fields
}{ }{
{ {
name: "empty args results in empty map of fields", name: "empty args results in empty map of fields",
args: []interface{}{}, args: []any{},
expectedFields: logrus.Fields(map[string]interface{}{}), expectedFields: logrus.Fields(map[string]any{}),
}, },
{ {
name: "matching string keys/values are correctly set as fields", name: "matching string keys/values are correctly set as fields",
args: []interface{}{"key-1", "value-1", "key-2", "value-2"}, args: []any{"key-1", "value-1", "key-2", "value-2"},
expectedFields: logrus.Fields(map[string]interface{}{ expectedFields: logrus.Fields(map[string]any{
"key-1": "value-1", "key-1": "value-1",
"key-2": "value-2", "key-2": "value-2",
}), }),
}, },
{ {
name: "time/timestamp/level entries are removed", name: "time/timestamp/level entries are removed",
args: []interface{}{"time", time.Now(), "key-1", "value-1", "timestamp", time.Now(), "key-2", "value-2", "level", "WARN"}, args: []any{"time", time.Now(), "key-1", "value-1", "timestamp", time.Now(), "key-2", "value-2", "level", "WARN"},
expectedFields: logrus.Fields(map[string]interface{}{ expectedFields: logrus.Fields(map[string]any{
"key-1": "value-1", "key-1": "value-1",
"key-2": "value-2", "key-2": "value-2",
}), }),
}, },
{ {
name: "odd number of args adds the last arg as a field with a nil value", name: "odd number of args adds the last arg as a field with a nil value",
args: []interface{}{"key-1", "value-1", "key-2", "value-2", "key-3"}, args: []any{"key-1", "value-1", "key-2", "value-2", "key-3"},
expectedFields: logrus.Fields(map[string]interface{}{ expectedFields: logrus.Fields(map[string]any{
"key-1": "value-1", "key-1": "value-1",
"key-2": "value-2", "key-2": "value-2",
"key-3": nil, "key-3": nil,

View File

@ -40,7 +40,7 @@ func (pf *processFactory) newProcess(command string, logger logrus.FieldLogger,
} }
type Process interface { type Process interface {
dispense(key KindAndName) (interface{}, error) dispense(key KindAndName) (any, error)
exited() bool exited() bool
kill() kill()
} }
@ -97,7 +97,7 @@ func removeFeaturesFlag(args []string) []string {
return commandArgs return commandArgs
} }
func (r *process) dispense(key KindAndName) (interface{}, error) { func (r *process) dispense(key KindAndName) (any, error) {
// This calls GRPCClient(clientConn) on the plugin instance registered for key.name. // This calls GRPCClient(clientConn) on the plugin instance registered for key.name.
dispensed, err := r.protocolClient.Dispense(key.Kind.String()) dispensed, err := r.protocolClient.Dispense(key.Kind.String())
if err != nil { if err != nil {

View File

@ -36,7 +36,7 @@ func (cp *mockClientProtocol) Close() error {
return args.Error(0) return args.Error(0)
} }
func (cp *mockClientProtocol) Dispense(name string) (interface{}, error) { func (cp *mockClientProtocol) Dispense(name string) (any, error) {
args := cp.Called(name) args := cp.Called(name)
return args.Get(0), args.Error(1) return args.Get(0), args.Error(1)
} }
@ -50,7 +50,7 @@ type mockClientDispenser struct {
mock.Mock mock.Mock
} }
func (cd *mockClientDispenser) ClientFor(name string) interface{} { func (cd *mockClientDispenser) ClientFor(name string) any {
args := cd.Called(name) args := cd.Called(name)
return args.Get(0) return args.Get(0)
} }
@ -93,7 +93,7 @@ func TestDispense(t *testing.T) {
clientDispenser := new(mockClientDispenser) clientDispenser := new(mockClientDispenser)
defer clientDispenser.AssertExpectations(t) defer clientDispenser.AssertExpectations(t)
var client interface{} var client any
key := KindAndName{} key := KindAndName{}
if tc.clientDispenser { if tc.clientDispenser {

View File

@ -42,7 +42,7 @@ type RestartableProcess interface {
AddReinitializer(key KindAndName, r Reinitializer) AddReinitializer(key KindAndName, r Reinitializer)
Reset() error Reset() error
ResetIfNeeded() error ResetIfNeeded() error
GetByKindAndName(key KindAndName) (interface{}, error) GetByKindAndName(key KindAndName) (any, error)
Stop() Stop()
} }
@ -57,7 +57,7 @@ type restartableProcess struct {
// lock guards all of the fields below // lock guards all of the fields below
lock sync.RWMutex lock sync.RWMutex
process Process process Process
plugins map[KindAndName]interface{} plugins map[KindAndName]any
reinitializers map[KindAndName]Reinitializer reinitializers map[KindAndName]Reinitializer
resetFailures int resetFailures int
} }
@ -65,7 +65,7 @@ type restartableProcess struct {
// reinitializer is capable of reinitializing a restartable plugin instance using the newly dispensed plugin. // reinitializer is capable of reinitializing a restartable plugin instance using the newly dispensed plugin.
type Reinitializer interface { type Reinitializer interface {
// reinitialize reinitializes a restartable plugin instance using the newly dispensed plugin. // reinitialize reinitializes a restartable plugin instance using the newly dispensed plugin.
Reinitialize(dispensed interface{}) error Reinitialize(dispensed any) error
} }
// newRestartableProcess creates a new restartableProcess for the given command and options. // newRestartableProcess creates a new restartableProcess for the given command and options.
@ -74,7 +74,7 @@ func newRestartableProcess(command string, logger logrus.FieldLogger, logLevel l
command: command, command: command,
logger: logger, logger: logger,
logLevel: logLevel, logLevel: logLevel,
plugins: make(map[KindAndName]interface{}), plugins: make(map[KindAndName]any),
reinitializers: make(map[KindAndName]Reinitializer), reinitializers: make(map[KindAndName]Reinitializer),
} }
@ -118,7 +118,7 @@ func (p *restartableProcess) resetLH() error {
// Redispense any previously dispensed plugins, reinitializing if necessary. // Redispense any previously dispensed plugins, reinitializing if necessary.
// Start by creating a new map to hold the newly dispensed plugins. // Start by creating a new map to hold the newly dispensed plugins.
newPlugins := make(map[KindAndName]interface{}) newPlugins := make(map[KindAndName]any)
for key := range p.plugins { for key := range p.plugins {
// Re-dispense // Re-dispense
dispensed, err := p.process.dispense(key) dispensed, err := p.process.dispense(key)
@ -160,7 +160,7 @@ func (p *restartableProcess) ResetIfNeeded() error {
} }
// GetByKindAndName acquires the lock and calls getByKindAndNameLH. // GetByKindAndName acquires the lock and calls getByKindAndNameLH.
func (p *restartableProcess) GetByKindAndName(key KindAndName) (interface{}, error) { func (p *restartableProcess) GetByKindAndName(key KindAndName) (any, error) {
p.lock.Lock() p.lock.Lock()
defer p.lock.Unlock() defer p.lock.Unlock()
@ -169,7 +169,7 @@ func (p *restartableProcess) GetByKindAndName(key KindAndName) (interface{}, err
// getByKindAndNameLH returns the dispensed plugin for key. If the plugin hasn't been dispensed before, it dispenses a // getByKindAndNameLH returns the dispensed plugin for key. If the plugin hasn't been dispensed before, it dispenses a
// new one. // new one.
func (p *restartableProcess) getByKindAndNameLH(key KindAndName) (interface{}, error) { func (p *restartableProcess) getByKindAndNameLH(key KindAndName) (any, error) {
dispensed, found := p.plugins[key] dispensed, found := p.plugins[key]
if found { if found {
return dispensed, nil return dispensed, nil

View File

@ -35,7 +35,7 @@ import (
func TestRestartableGetDeleteItemAction(t *testing.T) { func TestRestartableGetDeleteItemAction(t *testing.T) {
tests := []struct { tests := []struct {
name string name string
plugin interface{} plugin any
getError error getError error
expectedError string expectedError string
}{ }{
@ -103,7 +103,7 @@ func TestRestartableDeleteItemActionGetDelegate(t *testing.T) {
func TestRestartableDeleteItemActionDelegatedFunctions(t *testing.T) { func TestRestartableDeleteItemActionDelegatedFunctions(t *testing.T) {
pv := &unstructured.Unstructured{ pv := &unstructured.Unstructured{
Object: map[string]interface{}{ Object: map[string]any{
"color": "blue", "color": "blue",
}, },
} }
@ -118,7 +118,7 @@ func TestRestartableDeleteItemActionDelegatedFunctions(t *testing.T) {
restartabletest.RunRestartableDelegateTests( restartabletest.RunRestartableDelegateTests(
t, t,
common.PluginKindDeleteItemAction, common.PluginKindDeleteItemAction,
func(key process.KindAndName, p process.RestartableProcess) interface{} { func(key process.KindAndName, p process.RestartableProcess) any {
return &restartableDeleteItemAction{ return &restartableDeleteItemAction{
key: key, key: key,
sharedPluginProcess: p, sharedPluginProcess: p,
@ -130,15 +130,15 @@ func TestRestartableDeleteItemActionDelegatedFunctions(t *testing.T) {
}, },
restartabletest.RestartableDelegateTest{ restartabletest.RestartableDelegateTest{
Function: "AppliesTo", Function: "AppliesTo",
Inputs: []interface{}{}, Inputs: []any{},
ExpectedErrorOutputs: []interface{}{velero.ResourceSelector{}, errors.Errorf("reset error")}, ExpectedErrorOutputs: []any{velero.ResourceSelector{}, errors.Errorf("reset error")},
ExpectedDelegateOutputs: []interface{}{velero.ResourceSelector{IncludedNamespaces: []string{"a"}}, errors.Errorf("delegate error")}, ExpectedDelegateOutputs: []any{velero.ResourceSelector{IncludedNamespaces: []string{"a"}}, errors.Errorf("delegate error")},
}, },
restartabletest.RestartableDelegateTest{ restartabletest.RestartableDelegateTest{
Function: "Execute", Function: "Execute",
Inputs: []interface{}{input}, Inputs: []any{input},
ExpectedErrorOutputs: []interface{}{errors.Errorf("reset error")}, ExpectedErrorOutputs: []any{errors.Errorf("reset error")},
ExpectedDelegateOutputs: []interface{}{errors.Errorf("delegate error")}, ExpectedDelegateOutputs: []any{errors.Errorf("delegate error")},
}, },
) )
} }

View File

@ -54,7 +54,7 @@ func NewRestartableObjectStore(name string, sharedPluginProcess process.Restarta
} }
// reinitialize reinitializes a re-dispensed plugin using the initial data passed to Init(). // reinitialize reinitializes a re-dispensed plugin using the initial data passed to Init().
func (r *restartableObjectStore) Reinitialize(dispensed interface{}) error { func (r *restartableObjectStore) Reinitialize(dispensed any) error {
objectStore, ok := dispensed.(velero.ObjectStore) objectStore, ok := dispensed.(velero.ObjectStore)
if !ok { if !ok {
return errors.Errorf("plugin %T is not a ObjectStore", dispensed) return errors.Errorf("plugin %T is not a ObjectStore", dispensed)

View File

@ -35,7 +35,7 @@ import (
func TestRestartableGetObjectStore(t *testing.T) { func TestRestartableGetObjectStore(t *testing.T) {
tests := []struct { tests := []struct {
name string name string
plugin interface{} plugin any
getError error getError error
expectedError string expectedError string
}{ }{
@ -189,7 +189,7 @@ func TestRestartableObjectStoreDelegatedFunctions(t *testing.T) {
restartabletest.RunRestartableDelegateTests( restartabletest.RunRestartableDelegateTests(
t, t,
common.PluginKindObjectStore, common.PluginKindObjectStore,
func(key process.KindAndName, p process.RestartableProcess) interface{} { func(key process.KindAndName, p process.RestartableProcess) any {
return &restartableObjectStore{ return &restartableObjectStore{
key: key, key: key,
sharedPluginProcess: p, sharedPluginProcess: p,
@ -200,39 +200,39 @@ func TestRestartableObjectStoreDelegatedFunctions(t *testing.T) {
}, },
restartabletest.RestartableDelegateTest{ restartabletest.RestartableDelegateTest{
Function: "PutObject", Function: "PutObject",
Inputs: []interface{}{"bucket", "key", strings.NewReader("body")}, Inputs: []any{"bucket", "key", strings.NewReader("body")},
ExpectedErrorOutputs: []interface{}{errors.Errorf("reset error")}, ExpectedErrorOutputs: []any{errors.Errorf("reset error")},
ExpectedDelegateOutputs: []interface{}{errors.Errorf("delegate error")}, ExpectedDelegateOutputs: []any{errors.Errorf("delegate error")},
}, },
restartabletest.RestartableDelegateTest{ restartabletest.RestartableDelegateTest{
Function: "GetObject", Function: "GetObject",
Inputs: []interface{}{"bucket", "key"}, Inputs: []any{"bucket", "key"},
ExpectedErrorOutputs: []interface{}{nil, errors.Errorf("reset error")}, ExpectedErrorOutputs: []any{nil, errors.Errorf("reset error")},
ExpectedDelegateOutputs: []interface{}{io.NopCloser(strings.NewReader("object")), errors.Errorf("delegate error")}, ExpectedDelegateOutputs: []any{io.NopCloser(strings.NewReader("object")), errors.Errorf("delegate error")},
}, },
restartabletest.RestartableDelegateTest{ restartabletest.RestartableDelegateTest{
Function: "ListCommonPrefixes", Function: "ListCommonPrefixes",
Inputs: []interface{}{"bucket", "prefix", "delimiter"}, Inputs: []any{"bucket", "prefix", "delimiter"},
ExpectedErrorOutputs: []interface{}{([]string)(nil), errors.Errorf("reset error")}, ExpectedErrorOutputs: []any{([]string)(nil), errors.Errorf("reset error")},
ExpectedDelegateOutputs: []interface{}{[]string{"a", "b"}, errors.Errorf("delegate error")}, ExpectedDelegateOutputs: []any{[]string{"a", "b"}, errors.Errorf("delegate error")},
}, },
restartabletest.RestartableDelegateTest{ restartabletest.RestartableDelegateTest{
Function: "ListObjects", Function: "ListObjects",
Inputs: []interface{}{"bucket", "prefix"}, Inputs: []any{"bucket", "prefix"},
ExpectedErrorOutputs: []interface{}{([]string)(nil), errors.Errorf("reset error")}, ExpectedErrorOutputs: []any{([]string)(nil), errors.Errorf("reset error")},
ExpectedDelegateOutputs: []interface{}{[]string{"a", "b"}, errors.Errorf("delegate error")}, ExpectedDelegateOutputs: []any{[]string{"a", "b"}, errors.Errorf("delegate error")},
}, },
restartabletest.RestartableDelegateTest{ restartabletest.RestartableDelegateTest{
Function: "DeleteObject", Function: "DeleteObject",
Inputs: []interface{}{"bucket", "key"}, Inputs: []any{"bucket", "key"},
ExpectedErrorOutputs: []interface{}{errors.Errorf("reset error")}, ExpectedErrorOutputs: []any{errors.Errorf("reset error")},
ExpectedDelegateOutputs: []interface{}{errors.Errorf("delegate error")}, ExpectedDelegateOutputs: []any{errors.Errorf("delegate error")},
}, },
restartabletest.RestartableDelegateTest{ restartabletest.RestartableDelegateTest{
Function: "CreateSignedURL", Function: "CreateSignedURL",
Inputs: []interface{}{"bucket", "key", 30 * time.Minute}, Inputs: []any{"bucket", "key", 30 * time.Minute},
ExpectedErrorOutputs: []interface{}{"", errors.Errorf("reset error")}, ExpectedErrorOutputs: []any{"", errors.Errorf("reset error")},
ExpectedDelegateOutputs: []interface{}{"signedURL", errors.Errorf("delegate error")}, ExpectedDelegateOutputs: []any{"signedURL", errors.Errorf("delegate error")},
}, },
) )
} }

View File

@ -35,7 +35,7 @@ import (
func TestRestartableGetRestoreItemAction(t *testing.T) { func TestRestartableGetRestoreItemAction(t *testing.T) {
tests := []struct { tests := []struct {
name string name string
plugin interface{} plugin any
getError error getError error
expectedError string expectedError string
}{ }{
@ -102,7 +102,7 @@ func TestRestartableRestoreItemActionGetDelegate(t *testing.T) {
func TestRestartableRestoreItemActionDelegatedFunctions(t *testing.T) { func TestRestartableRestoreItemActionDelegatedFunctions(t *testing.T) {
pv := &unstructured.Unstructured{ pv := &unstructured.Unstructured{
Object: map[string]interface{}{ Object: map[string]any{
"color": "blue", "color": "blue",
}, },
} }
@ -115,7 +115,7 @@ func TestRestartableRestoreItemActionDelegatedFunctions(t *testing.T) {
output := &velero.RestoreItemActionExecuteOutput{ output := &velero.RestoreItemActionExecuteOutput{
UpdatedItem: &unstructured.Unstructured{ UpdatedItem: &unstructured.Unstructured{
Object: map[string]interface{}{ Object: map[string]any{
"color": "green", "color": "green",
}, },
}, },
@ -124,7 +124,7 @@ func TestRestartableRestoreItemActionDelegatedFunctions(t *testing.T) {
restartabletest.RunRestartableDelegateTests( restartabletest.RunRestartableDelegateTests(
t, t,
common.PluginKindRestoreItemAction, common.PluginKindRestoreItemAction,
func(key process.KindAndName, p process.RestartableProcess) interface{} { func(key process.KindAndName, p process.RestartableProcess) any {
return &RestartableRestoreItemAction{ return &RestartableRestoreItemAction{
Key: key, Key: key,
SharedPluginProcess: p, SharedPluginProcess: p,
@ -135,15 +135,15 @@ func TestRestartableRestoreItemActionDelegatedFunctions(t *testing.T) {
}, },
restartabletest.RestartableDelegateTest{ restartabletest.RestartableDelegateTest{
Function: "AppliesTo", Function: "AppliesTo",
Inputs: []interface{}{}, Inputs: []any{},
ExpectedErrorOutputs: []interface{}{velero.ResourceSelector{}, errors.Errorf("reset error")}, ExpectedErrorOutputs: []any{velero.ResourceSelector{}, errors.Errorf("reset error")},
ExpectedDelegateOutputs: []interface{}{velero.ResourceSelector{IncludedNamespaces: []string{"a"}}, errors.Errorf("delegate error")}, ExpectedDelegateOutputs: []any{velero.ResourceSelector{IncludedNamespaces: []string{"a"}}, errors.Errorf("delegate error")},
}, },
restartabletest.RestartableDelegateTest{ restartabletest.RestartableDelegateTest{
Function: "Execute", Function: "Execute",
Inputs: []interface{}{input}, Inputs: []any{input},
ExpectedErrorOutputs: []interface{}{nil, errors.Errorf("reset error")}, ExpectedErrorOutputs: []any{nil, errors.Errorf("reset error")},
ExpectedDelegateOutputs: []interface{}{output, errors.Errorf("delegate error")}, ExpectedDelegateOutputs: []any{output, errors.Errorf("delegate error")},
}, },
) )
} }

View File

@ -35,7 +35,7 @@ import (
func TestRestartableGetRestoreItemAction(t *testing.T) { func TestRestartableGetRestoreItemAction(t *testing.T) {
tests := []struct { tests := []struct {
name string name string
plugin interface{} plugin any
getError error getError error
expectedError string expectedError string
}{ }{
@ -102,7 +102,7 @@ func TestRestartableRestoreItemActionGetDelegate(t *testing.T) {
func TestRestartableRestoreItemActionDelegatedFunctions(t *testing.T) { func TestRestartableRestoreItemActionDelegatedFunctions(t *testing.T) {
pv := &unstructured.Unstructured{ pv := &unstructured.Unstructured{
Object: map[string]interface{}{ Object: map[string]any{
"color": "blue", "color": "blue",
}, },
} }
@ -115,7 +115,7 @@ func TestRestartableRestoreItemActionDelegatedFunctions(t *testing.T) {
output := &velero.RestoreItemActionExecuteOutput{ output := &velero.RestoreItemActionExecuteOutput{
UpdatedItem: &unstructured.Unstructured{ UpdatedItem: &unstructured.Unstructured{
Object: map[string]interface{}{ Object: map[string]any{
"color": "green", "color": "green",
}, },
}, },
@ -127,7 +127,7 @@ func TestRestartableRestoreItemActionDelegatedFunctions(t *testing.T) {
restartabletest.RunRestartableDelegateTests( restartabletest.RunRestartableDelegateTests(
t, t,
common.PluginKindRestoreItemActionV2, common.PluginKindRestoreItemActionV2,
func(key process.KindAndName, p process.RestartableProcess) interface{} { func(key process.KindAndName, p process.RestartableProcess) any {
return &RestartableRestoreItemAction{ return &RestartableRestoreItemAction{
Key: key, Key: key,
SharedPluginProcess: p, SharedPluginProcess: p,
@ -138,33 +138,33 @@ func TestRestartableRestoreItemActionDelegatedFunctions(t *testing.T) {
}, },
restartabletest.RestartableDelegateTest{ restartabletest.RestartableDelegateTest{
Function: "AppliesTo", Function: "AppliesTo",
Inputs: []interface{}{}, Inputs: []any{},
ExpectedErrorOutputs: []interface{}{velero.ResourceSelector{}, errors.Errorf("reset error")}, ExpectedErrorOutputs: []any{velero.ResourceSelector{}, errors.Errorf("reset error")},
ExpectedDelegateOutputs: []interface{}{velero.ResourceSelector{IncludedNamespaces: []string{"a"}}, errors.Errorf("delegate error")}, ExpectedDelegateOutputs: []any{velero.ResourceSelector{IncludedNamespaces: []string{"a"}}, errors.Errorf("delegate error")},
}, },
restartabletest.RestartableDelegateTest{ restartabletest.RestartableDelegateTest{
Function: "Execute", Function: "Execute",
Inputs: []interface{}{input}, Inputs: []any{input},
ExpectedErrorOutputs: []interface{}{nil, errors.Errorf("reset error")}, ExpectedErrorOutputs: []any{nil, errors.Errorf("reset error")},
ExpectedDelegateOutputs: []interface{}{output, errors.Errorf("delegate error")}, ExpectedDelegateOutputs: []any{output, errors.Errorf("delegate error")},
}, },
restartabletest.RestartableDelegateTest{ restartabletest.RestartableDelegateTest{
Function: "Progress", Function: "Progress",
Inputs: []interface{}{oid, r}, Inputs: []any{oid, r},
ExpectedErrorOutputs: []interface{}{velero.OperationProgress{}, errors.Errorf("reset error")}, ExpectedErrorOutputs: []any{velero.OperationProgress{}, errors.Errorf("reset error")},
ExpectedDelegateOutputs: []interface{}{velero.OperationProgress{}, errors.Errorf("delegate error")}, ExpectedDelegateOutputs: []any{velero.OperationProgress{}, errors.Errorf("delegate error")},
}, },
restartabletest.RestartableDelegateTest{ restartabletest.RestartableDelegateTest{
Function: "Cancel", Function: "Cancel",
Inputs: []interface{}{oid, r}, Inputs: []any{oid, r},
ExpectedErrorOutputs: []interface{}{errors.Errorf("reset error")}, ExpectedErrorOutputs: []any{errors.Errorf("reset error")},
ExpectedDelegateOutputs: []interface{}{errors.Errorf("delegate error")}, ExpectedDelegateOutputs: []any{errors.Errorf("delegate error")},
}, },
restartabletest.RestartableDelegateTest{ restartabletest.RestartableDelegateTest{
Function: "AreAdditionalItemsReady", Function: "AreAdditionalItemsReady",
Inputs: []interface{}{additionalItems, r}, Inputs: []any{additionalItems, r},
ExpectedErrorOutputs: []interface{}{false, errors.Errorf("reset error")}, ExpectedErrorOutputs: []any{false, errors.Errorf("reset error")},
ExpectedDelegateOutputs: []interface{}{true, errors.Errorf("delegate error")}, ExpectedDelegateOutputs: []any{true, errors.Errorf("delegate error")},
}, },
) )
} }

View File

@ -69,7 +69,7 @@ func NewRestartableVolumeSnapshotter(name string, sharedPluginProcess process.Re
} }
// reinitialize reinitializes a re-dispensed plugin using the initial data passed to Init(). // reinitialize reinitializes a re-dispensed plugin using the initial data passed to Init().
func (r *RestartableVolumeSnapshotter) Reinitialize(dispensed interface{}) error { func (r *RestartableVolumeSnapshotter) Reinitialize(dispensed any) error {
volumeSnapshotter, ok := dispensed.(vsv1.VolumeSnapshotter) volumeSnapshotter, ok := dispensed.(vsv1.VolumeSnapshotter)
if !ok { if !ok {
return errors.Errorf("plugin %T is not a VolumeSnapshotter", dispensed) return errors.Errorf("plugin %T is not a VolumeSnapshotter", dispensed)

View File

@ -34,7 +34,7 @@ import (
func TestRestartableGetVolumeSnapshotter(t *testing.T) { func TestRestartableGetVolumeSnapshotter(t *testing.T) {
tests := []struct { tests := []struct {
name string name string
plugin interface{} plugin any
getError error getError error
expectedError string expectedError string
}{ }{
@ -186,13 +186,13 @@ func TestRestartableVolumeSnapshotterInit(t *testing.T) {
func TestRestartableVolumeSnapshotterDelegatedFunctions(t *testing.T) { func TestRestartableVolumeSnapshotterDelegatedFunctions(t *testing.T) {
pv := &unstructured.Unstructured{ pv := &unstructured.Unstructured{
Object: map[string]interface{}{ Object: map[string]any{
"color": "blue", "color": "blue",
}, },
} }
pvToReturn := &unstructured.Unstructured{ pvToReturn := &unstructured.Unstructured{
Object: map[string]interface{}{ Object: map[string]any{
"color": "green", "color": "green",
}, },
} }
@ -200,7 +200,7 @@ func TestRestartableVolumeSnapshotterDelegatedFunctions(t *testing.T) {
restartabletest.RunRestartableDelegateTests( restartabletest.RunRestartableDelegateTests(
t, t,
common.PluginKindVolumeSnapshotter, common.PluginKindVolumeSnapshotter,
func(key process.KindAndName, p process.RestartableProcess) interface{} { func(key process.KindAndName, p process.RestartableProcess) any {
return &RestartableVolumeSnapshotter{ return &RestartableVolumeSnapshotter{
Key: key, Key: key,
SharedPluginProcess: p, SharedPluginProcess: p,
@ -211,39 +211,39 @@ func TestRestartableVolumeSnapshotterDelegatedFunctions(t *testing.T) {
}, },
restartabletest.RestartableDelegateTest{ restartabletest.RestartableDelegateTest{
Function: "CreateVolumeFromSnapshot", Function: "CreateVolumeFromSnapshot",
Inputs: []interface{}{"snapshotID", "volumeID", "volumeAZ", to.Ptr(int64(10000))}, Inputs: []any{"snapshotID", "volumeID", "volumeAZ", to.Ptr(int64(10000))},
ExpectedErrorOutputs: []interface{}{"", errors.Errorf("reset error")}, ExpectedErrorOutputs: []any{"", errors.Errorf("reset error")},
ExpectedDelegateOutputs: []interface{}{"volumeID", errors.Errorf("delegate error")}, ExpectedDelegateOutputs: []any{"volumeID", errors.Errorf("delegate error")},
}, },
restartabletest.RestartableDelegateTest{ restartabletest.RestartableDelegateTest{
Function: "GetVolumeID", Function: "GetVolumeID",
Inputs: []interface{}{pv}, Inputs: []any{pv},
ExpectedErrorOutputs: []interface{}{"", errors.Errorf("reset error")}, ExpectedErrorOutputs: []any{"", errors.Errorf("reset error")},
ExpectedDelegateOutputs: []interface{}{"volumeID", errors.Errorf("delegate error")}, ExpectedDelegateOutputs: []any{"volumeID", errors.Errorf("delegate error")},
}, },
restartabletest.RestartableDelegateTest{ restartabletest.RestartableDelegateTest{
Function: "SetVolumeID", Function: "SetVolumeID",
Inputs: []interface{}{pv, "volumeID"}, Inputs: []any{pv, "volumeID"},
ExpectedErrorOutputs: []interface{}{nil, errors.Errorf("reset error")}, ExpectedErrorOutputs: []any{nil, errors.Errorf("reset error")},
ExpectedDelegateOutputs: []interface{}{pvToReturn, errors.Errorf("delegate error")}, ExpectedDelegateOutputs: []any{pvToReturn, errors.Errorf("delegate error")},
}, },
restartabletest.RestartableDelegateTest{ restartabletest.RestartableDelegateTest{
Function: "GetVolumeInfo", Function: "GetVolumeInfo",
Inputs: []interface{}{"volumeID", "volumeAZ"}, Inputs: []any{"volumeID", "volumeAZ"},
ExpectedErrorOutputs: []interface{}{"", (*int64)(nil), errors.Errorf("reset error")}, ExpectedErrorOutputs: []any{"", (*int64)(nil), errors.Errorf("reset error")},
ExpectedDelegateOutputs: []interface{}{"volumeType", to.Ptr(int64(10000)), errors.Errorf("delegate error")}, ExpectedDelegateOutputs: []any{"volumeType", to.Ptr(int64(10000)), errors.Errorf("delegate error")},
}, },
restartabletest.RestartableDelegateTest{ restartabletest.RestartableDelegateTest{
Function: "CreateSnapshot", Function: "CreateSnapshot",
Inputs: []interface{}{"volumeID", "volumeAZ", map[string]string{"a": "b"}}, Inputs: []any{"volumeID", "volumeAZ", map[string]string{"a": "b"}},
ExpectedErrorOutputs: []interface{}{"", errors.Errorf("reset error")}, ExpectedErrorOutputs: []any{"", errors.Errorf("reset error")},
ExpectedDelegateOutputs: []interface{}{"snapshotID", errors.Errorf("delegate error")}, ExpectedDelegateOutputs: []any{"snapshotID", errors.Errorf("delegate error")},
}, },
restartabletest.RestartableDelegateTest{ restartabletest.RestartableDelegateTest{
Function: "DeleteSnapshot", Function: "DeleteSnapshot",
Inputs: []interface{}{"snapshotID"}, Inputs: []any{"snapshotID"},
ExpectedErrorOutputs: []interface{}{errors.Errorf("reset error")}, ExpectedErrorOutputs: []any{errors.Errorf("reset error")},
ExpectedDelegateOutputs: []interface{}{errors.Errorf("delegate error")}, ExpectedDelegateOutputs: []any{errors.Errorf("delegate error")},
}, },
) )
} }

View File

@ -34,7 +34,7 @@ type BackupItemActionPlugin struct {
} }
// GRPCClient returns a clientDispenser for BackupItemAction gRPC clients. // GRPCClient returns a clientDispenser for BackupItemAction gRPC clients.
func (p *BackupItemActionPlugin) GRPCClient(_ context.Context, _ *plugin.GRPCBroker, clientConn *grpc.ClientConn) (interface{}, error) { func (p *BackupItemActionPlugin) GRPCClient(_ context.Context, _ *plugin.GRPCBroker, clientConn *grpc.ClientConn) (any, error) {
return common.NewClientDispenser(p.ClientLogger, clientConn, newBackupItemActionGRPCClient), nil return common.NewClientDispenser(p.ClientLogger, clientConn, newBackupItemActionGRPCClient), nil
} }

View File

@ -46,7 +46,7 @@ type BackupItemActionGRPCClient struct {
grpcClient protobiav1.BackupItemActionClient grpcClient protobiav1.BackupItemActionClient
} }
func newBackupItemActionGRPCClient(base *common.ClientBase, clientConn *grpc.ClientConn) interface{} { func newBackupItemActionGRPCClient(base *common.ClientBase, clientConn *grpc.ClientConn) any {
return &BackupItemActionGRPCClient{ return &BackupItemActionGRPCClient{
ClientBase: base, ClientBase: base,
grpcClient: protobiav1.NewBackupItemActionClient(clientConn), grpcClient: protobiav1.NewBackupItemActionClient(clientConn),

View File

@ -156,7 +156,7 @@ func TestBackupItemActionGRPCServerExecute(t *testing.T) {
s := &BackupItemActionGRPCServer{mux: &common.ServerMux{ s := &BackupItemActionGRPCServer{mux: &common.ServerMux{
ServerLog: velerotest.NewLogger(), ServerLog: velerotest.NewLogger(),
Handlers: map[string]interface{}{ Handlers: map[string]any{
"xyz": itemAction, "xyz": itemAction,
}, },
}} }}

View File

@ -34,7 +34,7 @@ type BackupItemActionPlugin struct {
} }
// GRPCClient returns a clientDispenser for BackupItemAction gRPC clients. // GRPCClient returns a clientDispenser for BackupItemAction gRPC clients.
func (p *BackupItemActionPlugin) GRPCClient(_ context.Context, _ *plugin.GRPCBroker, clientConn *grpc.ClientConn) (interface{}, error) { func (p *BackupItemActionPlugin) GRPCClient(_ context.Context, _ *plugin.GRPCBroker, clientConn *grpc.ClientConn) (any, error) {
return common.NewClientDispenser(p.ClientLogger, clientConn, newBackupItemActionGRPCClient), nil return common.NewClientDispenser(p.ClientLogger, clientConn, newBackupItemActionGRPCClient), nil
} }

View File

@ -46,7 +46,7 @@ type BackupItemActionGRPCClient struct {
grpcClient protobiav2.BackupItemActionClient grpcClient protobiav2.BackupItemActionClient
} }
func newBackupItemActionGRPCClient(base *common.ClientBase, clientConn *grpc.ClientConn) interface{} { func newBackupItemActionGRPCClient(base *common.ClientBase, clientConn *grpc.ClientConn) any {
return &BackupItemActionGRPCClient{ return &BackupItemActionGRPCClient{
ClientBase: base, ClientBase: base,
grpcClient: protobiav2.NewBackupItemActionClient(clientConn), grpcClient: protobiav2.NewBackupItemActionClient(clientConn),

View File

@ -159,7 +159,7 @@ func TestBackupItemActionGRPCServerExecute(t *testing.T) {
s := &BackupItemActionGRPCServer{mux: &common.ServerMux{ s := &BackupItemActionGRPCServer{mux: &common.ServerMux{
ServerLog: velerotest.NewLogger(), ServerLog: velerotest.NewLogger(),
Handlers: map[string]interface{}{ Handlers: map[string]any{
"xyz": itemAction, "xyz": itemAction,
}, },
}} }}

View File

@ -28,7 +28,7 @@ type ClientBase struct {
} }
type ClientDispenser interface { type ClientDispenser interface {
ClientFor(name string) interface{} ClientFor(name string) any
} }
// clientDispenser supports the initialization and retrieval of multiple implementations for a single plugin kind, such as // clientDispenser supports the initialization and retrieval of multiple implementations for a single plugin kind, such as
@ -41,10 +41,10 @@ type clientDispenser struct {
// initFunc returns a client that implements a plugin interface, such as ObjectStore. // initFunc returns a client that implements a plugin interface, such as ObjectStore.
initFunc clientInitFunc initFunc clientInitFunc
// clients keeps track of all the initialized implementations. // clients keeps track of all the initialized implementations.
clients map[string]interface{} clients map[string]any
} }
type clientInitFunc func(base *ClientBase, clientConn *grpc.ClientConn) interface{} type clientInitFunc func(base *ClientBase, clientConn *grpc.ClientConn) any
// newClientDispenser creates a new clientDispenser. // newClientDispenser creates a new clientDispenser.
func NewClientDispenser(logger logrus.FieldLogger, clientConn *grpc.ClientConn, initFunc clientInitFunc) *clientDispenser { func NewClientDispenser(logger logrus.FieldLogger, clientConn *grpc.ClientConn, initFunc clientInitFunc) *clientDispenser {
@ -52,13 +52,13 @@ func NewClientDispenser(logger logrus.FieldLogger, clientConn *grpc.ClientConn,
clientConn: clientConn, clientConn: clientConn,
logger: logger, logger: logger,
initFunc: initFunc, initFunc: initFunc,
clients: make(map[string]interface{}), clients: make(map[string]any),
} }
} }
// ClientFor returns a gRPC client stub for the implementation of a plugin named name. If the client stub does not // ClientFor returns a gRPC client stub for the implementation of a plugin named name. If the client stub does not
// currently exist, clientFor creates it. // currently exist, clientFor creates it.
func (cd *clientDispenser) ClientFor(name string) interface{} { func (cd *clientDispenser) ClientFor(name string) any {
if client, found := cd.clients[name]; found { if client, found := cd.clients[name]; found {
return client return client
} }

View File

@ -36,7 +36,7 @@ func TestNewClientDispenser(t *testing.T) {
clientConn := new(grpc.ClientConn) clientConn := new(grpc.ClientConn)
c := 3 c := 3
initFunc := func(base *ClientBase, clientConn *grpc.ClientConn) interface{} { initFunc := func(base *ClientBase, clientConn *grpc.ClientConn) any {
return c return c
} }
@ -52,7 +52,7 @@ func TestClientFor(t *testing.T) {
c := new(fakeClient) c := new(fakeClient)
count := 0 count := 0
initFunc := func(base *ClientBase, clientConn *grpc.ClientConn) interface{} { initFunc := func(base *ClientBase, clientConn *grpc.ClientConn) any {
c.base = base c.base = base
c.clientConn = clientConn c.clientConn = clientConn
count++ count++

View File

@ -24,7 +24,7 @@ import (
) )
// HandlePanic is a panic handler for the server half of velero plugins. // HandlePanic is a panic handler for the server half of velero plugins.
func HandlePanic(p interface{}) error { func HandlePanic(p any) error {
if p == nil { if p == nil {
return nil return nil
} }

View File

@ -27,13 +27,13 @@ import (
// HandlerInitializer is a function that initializes and returns a new instance of one of Velero's plugin interfaces // HandlerInitializer is a function that initializes and returns a new instance of one of Velero's plugin interfaces
// (ObjectStore, VolumeSnapshotter, BackupItemAction, RestoreItemAction). // (ObjectStore, VolumeSnapshotter, BackupItemAction, RestoreItemAction).
type HandlerInitializer func(logger logrus.FieldLogger) (interface{}, error) type HandlerInitializer func(logger logrus.FieldLogger) (any, error)
// ServerMux manages multiple implementations of a single plugin kind, such as pod and pvc BackupItemActions. // ServerMux manages multiple implementations of a single plugin kind, such as pod and pvc BackupItemActions.
type ServerMux struct { type ServerMux struct {
kind PluginKind kind PluginKind
initializers map[string]HandlerInitializer initializers map[string]HandlerInitializer
Handlers map[string]interface{} Handlers map[string]any
ServerLog logrus.FieldLogger ServerLog logrus.FieldLogger
} }
@ -41,7 +41,7 @@ type ServerMux struct {
func NewServerMux(logger logrus.FieldLogger) *ServerMux { func NewServerMux(logger logrus.FieldLogger) *ServerMux {
return &ServerMux{ return &ServerMux{
initializers: make(map[string]HandlerInitializer), initializers: make(map[string]HandlerInitializer),
Handlers: make(map[string]interface{}), Handlers: make(map[string]any),
ServerLog: logger, ServerLog: logger,
} }
} }
@ -63,7 +63,7 @@ func (m *ServerMux) Names() []string {
// GetHandler returns the instance for a plugin with the given name. If an instance has already been initialized, // GetHandler returns the instance for a plugin with the given name. If an instance has already been initialized,
// that is returned. Otherwise, the instance is initialized by calling its initialization function. // that is returned. Otherwise, the instance is initialized by calling its initialization function.
func (m *ServerMux) GetHandler(name string) (interface{}, error) { func (m *ServerMux) GetHandler(name string) (any, error) {
if instance, found := m.Handlers[name]; found { if instance, found := m.Handlers[name]; found {
return instance, nil return instance, nil
} }

View File

@ -34,7 +34,7 @@ type DeleteItemActionPlugin struct {
} }
// GRPCClient returns a DeleteItemAction gRPC client. // GRPCClient returns a DeleteItemAction gRPC client.
func (p *DeleteItemActionPlugin) GRPCClient(_ context.Context, _ *plugin.GRPCBroker, clientConn *grpc.ClientConn) (interface{}, error) { func (p *DeleteItemActionPlugin) GRPCClient(_ context.Context, _ *plugin.GRPCBroker, clientConn *grpc.ClientConn) (any, error) {
return common.NewClientDispenser(p.ClientLogger, clientConn, newDeleteItemActionGRPCClient), nil return common.NewClientDispenser(p.ClientLogger, clientConn, newDeleteItemActionGRPCClient), nil
} }

View File

@ -44,7 +44,7 @@ type DeleteItemActionGRPCClient struct {
grpcClient proto.DeleteItemActionClient grpcClient proto.DeleteItemActionClient
} }
func newDeleteItemActionGRPCClient(base *common.ClientBase, clientConn *grpc.ClientConn) interface{} { func newDeleteItemActionGRPCClient(base *common.ClientBase, clientConn *grpc.ClientConn) any {
return &DeleteItemActionGRPCClient{ return &DeleteItemActionGRPCClient{
ClientBase: base, ClientBase: base,
grpcClient: proto.NewDeleteItemActionClient(clientConn), grpcClient: proto.NewDeleteItemActionClient(clientConn),

View File

@ -30,7 +30,7 @@ func ExampleNewServer_volumeSnapshotter() {
Serve() // serve the plugin Serve() // serve the plugin
} }
func newVolumeSnapshotter(logger logrus.FieldLogger) (interface{}, error) { func newVolumeSnapshotter(logger logrus.FieldLogger) (any, error) {
return &VolumeSnapshotter{FieldLogger: logger}, nil return &VolumeSnapshotter{FieldLogger: logger}, nil
} }
@ -97,7 +97,7 @@ func (b *VolumeSnapshotter) DeleteSnapshot(snapshotID string) error {
// Implement all methods for the DeleteItemAction interface // Implement all methods for the DeleteItemAction interface
func newDeleteItemAction(logger logrus.FieldLogger) (interface{}, error) { func newDeleteItemAction(logger logrus.FieldLogger) (any, error) {
return DeleteItemAction{FieldLogger: logger}, nil return DeleteItemAction{FieldLogger: logger}, nil
} }

View File

@ -34,7 +34,7 @@ type ItemBlockActionPlugin struct {
} }
// GRPCClient returns a clientDispenser for ItemBlockAction gRPC clients. // GRPCClient returns a clientDispenser for ItemBlockAction gRPC clients.
func (p *ItemBlockActionPlugin) GRPCClient(_ context.Context, _ *plugin.GRPCBroker, clientConn *grpc.ClientConn) (interface{}, error) { func (p *ItemBlockActionPlugin) GRPCClient(_ context.Context, _ *plugin.GRPCBroker, clientConn *grpc.ClientConn) (any, error) {
return common.NewClientDispenser(p.ClientLogger, clientConn, newItemBlockActionGRPCClient), nil return common.NewClientDispenser(p.ClientLogger, clientConn, newItemBlockActionGRPCClient), nil
} }

View File

@ -45,7 +45,7 @@ type ItemBlockActionGRPCClient struct {
grpcClient protoibav1.ItemBlockActionClient grpcClient protoibav1.ItemBlockActionClient
} }
func newItemBlockActionGRPCClient(base *common.ClientBase, clientConn *grpc.ClientConn) interface{} { func newItemBlockActionGRPCClient(base *common.ClientBase, clientConn *grpc.ClientConn) any {
return &ItemBlockActionGRPCClient{ return &ItemBlockActionGRPCClient{
ClientBase: base, ClientBase: base,
grpcClient: protoibav1.NewItemBlockActionClient(clientConn), grpcClient: protoibav1.NewItemBlockActionClient(clientConn),

View File

@ -132,7 +132,7 @@ func TestItemBlockActionGRPCServerGetRelatedItems(t *testing.T) {
s := &ItemBlockActionGRPCServer{mux: &common.ServerMux{ s := &ItemBlockActionGRPCServer{mux: &common.ServerMux{
ServerLog: velerotest.NewLogger(), ServerLog: velerotest.NewLogger(),
Handlers: map[string]interface{}{ Handlers: map[string]any{
"xyz": itemAction, "xyz": itemAction,
}, },
}} }}

View File

@ -34,7 +34,7 @@ type ObjectStorePlugin struct {
} }
// GRPCClient returns an ObjectStore gRPC client. // GRPCClient returns an ObjectStore gRPC client.
func (p *ObjectStorePlugin) GRPCClient(_ context.Context, _ *plugin.GRPCBroker, clientConn *grpc.ClientConn) (interface{}, error) { func (p *ObjectStorePlugin) GRPCClient(_ context.Context, _ *plugin.GRPCBroker, clientConn *grpc.ClientConn) (any, error) {
return common.NewClientDispenser(p.ClientLogger, clientConn, newObjectStoreGRPCClient), nil return common.NewClientDispenser(p.ClientLogger, clientConn, newObjectStoreGRPCClient), nil
} }

View File

@ -44,7 +44,7 @@ type ObjectStoreGRPCClient struct {
grpcClient proto.ObjectStoreClient grpcClient proto.ObjectStoreClient
} }
func newObjectStoreGRPCClient(base *common.ClientBase, clientConn *grpc.ClientConn) interface{} { func newObjectStoreGRPCClient(base *common.ClientBase, clientConn *grpc.ClientConn) any {
return &ObjectStoreGRPCClient{ return &ObjectStoreGRPCClient{
ClientBase: base, ClientBase: base,
grpcClient: proto.NewObjectStoreClient(clientConn), grpcClient: proto.NewObjectStoreClient(clientConn),

View File

@ -69,7 +69,7 @@ func NewPluginListerPlugin(impl PluginLister) *PluginListerPlugin {
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// GRPCClient returns a PluginLister gRPC client. // GRPCClient returns a PluginLister gRPC client.
func (p *PluginListerPlugin) GRPCClient(_ context.Context, _ *plugin.GRPCBroker, clientConn *grpc.ClientConn) (interface{}, error) { func (p *PluginListerPlugin) GRPCClient(_ context.Context, _ *plugin.GRPCBroker, clientConn *grpc.ClientConn) (any, error) {
return &PluginListerGRPCClient{grpcClient: proto.NewPluginListerClient(clientConn)}, nil return &PluginListerGRPCClient{grpcClient: proto.NewPluginListerClient(clientConn)}, nil
} }

View File

@ -24,7 +24,7 @@ import (
) )
func TestPluginImplementationsAreGRPCPlugins(t *testing.T) { func TestPluginImplementationsAreGRPCPlugins(t *testing.T) {
pluginImpls := []interface{}{ pluginImpls := []any{
new(VolumeSnapshotterPlugin), new(VolumeSnapshotterPlugin),
new(BackupItemActionPlugin), new(BackupItemActionPlugin),
new(ObjectStorePlugin), new(ObjectStorePlugin),

View File

@ -34,7 +34,7 @@ type RestoreItemActionPlugin struct {
} }
// GRPCClient returns a RestoreItemAction gRPC client. // GRPCClient returns a RestoreItemAction gRPC client.
func (p *RestoreItemActionPlugin) GRPCClient(_ context.Context, _ *plugin.GRPCBroker, clientConn *grpc.ClientConn) (interface{}, error) { func (p *RestoreItemActionPlugin) GRPCClient(_ context.Context, _ *plugin.GRPCBroker, clientConn *grpc.ClientConn) (any, error) {
return common.NewClientDispenser(p.ClientLogger, clientConn, newRestoreItemActionGRPCClient), nil return common.NewClientDispenser(p.ClientLogger, clientConn, newRestoreItemActionGRPCClient), nil
} }

View File

@ -47,7 +47,7 @@ type RestoreItemActionGRPCClient struct {
grpcClient proto.RestoreItemActionClient grpcClient proto.RestoreItemActionClient
} }
func newRestoreItemActionGRPCClient(base *common.ClientBase, clientConn *grpc.ClientConn) interface{} { func newRestoreItemActionGRPCClient(base *common.ClientBase, clientConn *grpc.ClientConn) any {
return &RestoreItemActionGRPCClient{ return &RestoreItemActionGRPCClient{
ClientBase: base, ClientBase: base,
grpcClient: proto.NewRestoreItemActionClient(clientConn), grpcClient: proto.NewRestoreItemActionClient(clientConn),

View File

@ -34,7 +34,7 @@ type RestoreItemActionPlugin struct {
} }
// GRPCClient returns a RestoreItemAction gRPC client. // GRPCClient returns a RestoreItemAction gRPC client.
func (p *RestoreItemActionPlugin) GRPCClient(_ context.Context, _ *plugin.GRPCBroker, clientConn *grpc.ClientConn) (interface{}, error) { func (p *RestoreItemActionPlugin) GRPCClient(_ context.Context, _ *plugin.GRPCBroker, clientConn *grpc.ClientConn) (any, error) {
return common.NewClientDispenser(p.ClientLogger, clientConn, newRestoreItemActionGRPCClient), nil return common.NewClientDispenser(p.ClientLogger, clientConn, newRestoreItemActionGRPCClient), nil
} }

View File

@ -48,7 +48,7 @@ type RestoreItemActionGRPCClient struct {
grpcClient protoriav2.RestoreItemActionClient grpcClient protoriav2.RestoreItemActionClient
} }
func newRestoreItemActionGRPCClient(base *common.ClientBase, clientConn *grpc.ClientConn) interface{} { func newRestoreItemActionGRPCClient(base *common.ClientBase, clientConn *grpc.ClientConn) any {
return &RestoreItemActionGRPCClient{ return &RestoreItemActionGRPCClient{
ClientBase: base, ClientBase: base,
grpcClient: protoriav2.NewRestoreItemActionClient(clientConn), grpcClient: protoriav2.NewRestoreItemActionClient(clientConn),

View File

@ -34,7 +34,7 @@ type VolumeSnapshotterPlugin struct {
} }
// GRPCClient returns a VolumeSnapshotter gRPC client. // GRPCClient returns a VolumeSnapshotter gRPC client.
func (p *VolumeSnapshotterPlugin) GRPCClient(_ context.Context, _ *plugin.GRPCBroker, clientConn *grpc.ClientConn) (interface{}, error) { func (p *VolumeSnapshotterPlugin) GRPCClient(_ context.Context, _ *plugin.GRPCBroker, clientConn *grpc.ClientConn) (any, error) {
return common.NewClientDispenser(p.ClientLogger, clientConn, newVolumeSnapshotterGRPCClient), nil return common.NewClientDispenser(p.ClientLogger, clientConn, newVolumeSnapshotterGRPCClient), nil
} }

View File

@ -43,7 +43,7 @@ type VolumeSnapshotterGRPCClient struct {
grpcClient proto.VolumeSnapshotterClient grpcClient proto.VolumeSnapshotterClient
} }
func newVolumeSnapshotterGRPCClient(base *common.ClientBase, clientConn *grpc.ClientConn) interface{} { func newVolumeSnapshotterGRPCClient(base *common.ClientBase, clientConn *grpc.ClientConn) any {
return &VolumeSnapshotterGRPCClient{ return &VolumeSnapshotterGRPCClient{
ClientBase: base, ClientBase: base,
grpcClient: proto.NewVolumeSnapshotterClient(clientConn), grpcClient: proto.NewVolumeSnapshotterClient(clientConn),

View File

@ -39,7 +39,7 @@ const defaultTimeout = 30 * time.Second
type PodCommandExecutor interface { type PodCommandExecutor interface {
// ExecutePodCommand executes a command in a container in a pod. If the command takes longer than // ExecutePodCommand executes a command in a container in a pod. If the command takes longer than
// the specified timeout, an error is returned. // the specified timeout, an error is returned.
ExecutePodCommand(log logrus.FieldLogger, item map[string]interface{}, namespace, name, hookName string, hook *api.ExecHook) error ExecutePodCommand(log logrus.FieldLogger, item map[string]any, namespace, name, hookName string, hook *api.ExecHook) error
} }
type poster interface { type poster interface {
@ -67,7 +67,7 @@ func NewPodCommandExecutor(restClientConfig *rest.Config, restClient poster) Pod
// command takes longer than the specified timeout, an error is returned (NOTE: it is not currently // command takes longer than the specified timeout, an error is returned (NOTE: it is not currently
// possible to ensure the command is terminated when the timeout occurs, so it may continue to run // possible to ensure the command is terminated when the timeout occurs, so it may continue to run
// in the background). // in the background).
func (e *defaultPodCommandExecutor) ExecutePodCommand(log logrus.FieldLogger, item map[string]interface{}, namespace, name, hookName string, hook *api.ExecHook) error { func (e *defaultPodCommandExecutor) ExecutePodCommand(log logrus.FieldLogger, item map[string]any, namespace, name, hookName string, hook *api.ExecHook) error {
if item == nil { if item == nil {
return errors.New("item is required") return errors.New("item is required")
} }

View File

@ -52,7 +52,7 @@ func TestNewPodCommandExecutor(t *testing.T) {
func TestExecutePodCommandMissingInputs(t *testing.T) { func TestExecutePodCommandMissingInputs(t *testing.T) {
tests := []struct { tests := []struct {
name string name string
item map[string]interface{} item map[string]any
podNamespace string podNamespace string
podName string podName string
hookName string hookName string
@ -63,22 +63,22 @@ func TestExecutePodCommandMissingInputs(t *testing.T) {
}, },
{ {
name: "missing pod namespace", name: "missing pod namespace",
item: map[string]interface{}{}, item: map[string]any{},
}, },
{ {
name: "missing pod name", name: "missing pod name",
item: map[string]interface{}{}, item: map[string]any{},
podNamespace: "ns", podNamespace: "ns",
}, },
{ {
name: "missing hookName", name: "missing hookName",
item: map[string]interface{}{}, item: map[string]any{},
podNamespace: "ns", podNamespace: "ns",
podName: "pod", podName: "pod",
}, },
{ {
name: "missing hook", name: "missing hook",
item: map[string]interface{}{}, item: map[string]any{},
podNamespace: "ns", podNamespace: "ns",
podName: "pod", podName: "pod",
hookName: "hook", hookName: "hook",

View File

@ -108,7 +108,7 @@ func (pbs *PVCBackupSummary) addSkipped(volumeName string, reason string) {
const indexNamePod = "POD" const indexNamePod = "POD"
func podIndexFunc(obj interface{}) ([]string, error) { func podIndexFunc(obj any) ([]string, error) {
pvb, ok := obj.(*velerov1api.PodVolumeBackup) pvb, ok := obj.(*velerov1api.PodVolumeBackup)
if !ok { if !ok {
return nil, errors.Errorf("expected PodVolumeBackup, but got %T", obj) return nil, errors.Errorf("expected PodVolumeBackup, but got %T", obj)
@ -144,7 +144,7 @@ func newBackupper(
b.handlerRegistration, _ = pvbInformer.AddEventHandler( b.handlerRegistration, _ = pvbInformer.AddEventHandler(
cache.ResourceEventHandlerFuncs{ cache.ResourceEventHandlerFuncs{
UpdateFunc: func(_, obj interface{}) { UpdateFunc: func(_, obj any) {
pvb, ok := obj.(*velerov1api.PodVolumeBackup) pvb, ok := obj.(*velerov1api.PodVolumeBackup)
if !ok { if !ok {
log.Errorf("expected PodVolumeBackup, but got %T", obj) log.Errorf("expected PodVolumeBackup, but got %T", obj)

View File

@ -92,7 +92,7 @@ func newRestorer(
_, _ = pvrInformer.AddEventHandler( _, _ = pvrInformer.AddEventHandler(
cache.ResourceEventHandlerFuncs{ cache.ResourceEventHandlerFuncs{
UpdateFunc: func(_, obj interface{}) { UpdateFunc: func(_, obj any) {
pvr := obj.(*velerov1api.PodVolumeRestore) pvr := obj.(*velerov1api.PodVolumeRestore)
if pvr.GetLabels()[velerov1api.RestoreUIDLabel] != string(restore.UID) { if pvr.GetLabels()[velerov1api.RestoreUIDLabel] != string(restore.UID) {
return return

View File

@ -376,7 +376,7 @@ func (urp *unifiedRepoProvider) DefaultMaintenanceFrequency(ctx context.Context,
return urp.repoService.DefaultMaintenanceFrequency() return urp.repoService.DefaultMaintenanceFrequency()
} }
func (urp *unifiedRepoProvider) GetPassword(param interface{}) (string, error) { func (urp *unifiedRepoProvider) GetPassword(param any) (string, error) {
_, ok := param.(RepoParam) _, ok := param.(RepoParam)
if !ok { if !ok {
return "", errors.Errorf("invalid parameter, expect %T, actual %T", RepoParam{}, param) return "", errors.Errorf("invalid parameter, expect %T, actual %T", RepoParam{}, param)
@ -390,7 +390,7 @@ func (urp *unifiedRepoProvider) GetPassword(param interface{}) (string, error) {
return repoPassword, nil return repoPassword, nil
} }
func (urp *unifiedRepoProvider) GetStoreType(param interface{}) (string, error) { func (urp *unifiedRepoProvider) GetStoreType(param any) (string, error) {
repoParam, ok := param.(RepoParam) repoParam, ok := param.(RepoParam)
if !ok { if !ok {
return "", errors.Errorf("invalid parameter, expect %T, actual %T", RepoParam{}, param) return "", errors.Errorf("invalid parameter, expect %T, actual %T", RepoParam{}, param)
@ -399,7 +399,7 @@ func (urp *unifiedRepoProvider) GetStoreType(param interface{}) (string, error)
return getStorageType(repoParam.BackupLocation), nil return getStorageType(repoParam.BackupLocation), nil
} }
func (urp *unifiedRepoProvider) GetStoreOptions(param interface{}) (map[string]string, error) { func (urp *unifiedRepoProvider) GetStoreOptions(param any) (map[string]string, error) {
repoParam, ok := param.(RepoParam) repoParam, ok := param.(RepoParam)
if !ok { if !ok {
return map[string]string{}, errors.Errorf("invalid parameter, expect %T, actual %T", RepoParam{}, param) return map[string]string{}, errors.Errorf("invalid parameter, expect %T, actual %T", RepoParam{}, param)

View File

@ -538,7 +538,7 @@ func TestGetStoreOptions(t *testing.T) {
testCases := []struct { testCases := []struct {
name string name string
funcTable localFuncTable funcTable localFuncTable
repoParam interface{} repoParam any
expected map[string]string expected map[string]string
expectedErr string expectedErr string
}{ }{
@ -798,9 +798,9 @@ func TestForget(t *testing.T) {
getter *credmock.SecretStore getter *credmock.SecretStore
repoService *reposervicenmocks.BackupRepoService repoService *reposervicenmocks.BackupRepoService
backupRepo *reposervicenmocks.BackupRepo backupRepo *reposervicenmocks.BackupRepo
retFuncOpen []interface{} retFuncOpen []any
retFuncDelete interface{} retFuncDelete any
retFuncFlush interface{} retFuncFlush any
credStoreReturn string credStoreReturn string
credStoreError error credStoreError error
expectedErr string expectedErr string
@ -822,7 +822,7 @@ func TestForget(t *testing.T) {
}, },
}, },
repoService: new(reposervicenmocks.BackupRepoService), repoService: new(reposervicenmocks.BackupRepoService),
retFuncOpen: []interface{}{ retFuncOpen: []any{
func(context.Context, udmrepo.RepoOptions) udmrepo.BackupRepo { func(context.Context, udmrepo.RepoOptions) udmrepo.BackupRepo {
return backupRepo return backupRepo
}, },
@ -847,7 +847,7 @@ func TestForget(t *testing.T) {
}, },
repoService: new(reposervicenmocks.BackupRepoService), repoService: new(reposervicenmocks.BackupRepoService),
backupRepo: new(reposervicenmocks.BackupRepo), backupRepo: new(reposervicenmocks.BackupRepo),
retFuncOpen: []interface{}{ retFuncOpen: []any{
func(context.Context, udmrepo.RepoOptions) udmrepo.BackupRepo { func(context.Context, udmrepo.RepoOptions) udmrepo.BackupRepo {
return backupRepo return backupRepo
}, },
@ -875,7 +875,7 @@ func TestForget(t *testing.T) {
}, },
repoService: new(reposervicenmocks.BackupRepoService), repoService: new(reposervicenmocks.BackupRepoService),
backupRepo: new(reposervicenmocks.BackupRepo), backupRepo: new(reposervicenmocks.BackupRepo),
retFuncOpen: []interface{}{ retFuncOpen: []any{
func(context.Context, udmrepo.RepoOptions) udmrepo.BackupRepo { func(context.Context, udmrepo.RepoOptions) udmrepo.BackupRepo {
return backupRepo return backupRepo
}, },
@ -947,9 +947,9 @@ func TestBatchForget(t *testing.T) {
getter *credmock.SecretStore getter *credmock.SecretStore
repoService *reposervicenmocks.BackupRepoService repoService *reposervicenmocks.BackupRepoService
backupRepo *reposervicenmocks.BackupRepo backupRepo *reposervicenmocks.BackupRepo
retFuncOpen []interface{} retFuncOpen []any
retFuncDelete interface{} retFuncDelete any
retFuncFlush interface{} retFuncFlush any
credStoreReturn string credStoreReturn string
credStoreError error credStoreError error
snapshots []string snapshots []string
@ -972,7 +972,7 @@ func TestBatchForget(t *testing.T) {
}, },
}, },
repoService: new(reposervicenmocks.BackupRepoService), repoService: new(reposervicenmocks.BackupRepoService),
retFuncOpen: []interface{}{ retFuncOpen: []any{
func(context.Context, udmrepo.RepoOptions) udmrepo.BackupRepo { func(context.Context, udmrepo.RepoOptions) udmrepo.BackupRepo {
return backupRepo return backupRepo
}, },
@ -997,7 +997,7 @@ func TestBatchForget(t *testing.T) {
}, },
repoService: new(reposervicenmocks.BackupRepoService), repoService: new(reposervicenmocks.BackupRepoService),
backupRepo: new(reposervicenmocks.BackupRepo), backupRepo: new(reposervicenmocks.BackupRepo),
retFuncOpen: []interface{}{ retFuncOpen: []any{
func(context.Context, udmrepo.RepoOptions) udmrepo.BackupRepo { func(context.Context, udmrepo.RepoOptions) udmrepo.BackupRepo {
return backupRepo return backupRepo
}, },
@ -1026,7 +1026,7 @@ func TestBatchForget(t *testing.T) {
}, },
repoService: new(reposervicenmocks.BackupRepoService), repoService: new(reposervicenmocks.BackupRepoService),
backupRepo: new(reposervicenmocks.BackupRepo), backupRepo: new(reposervicenmocks.BackupRepo),
retFuncOpen: []interface{}{ retFuncOpen: []any{
func(context.Context, udmrepo.RepoOptions) udmrepo.BackupRepo { func(context.Context, udmrepo.RepoOptions) udmrepo.BackupRepo {
return backupRepo return backupRepo
}, },
@ -1106,7 +1106,7 @@ func TestInitRepo(t *testing.T) {
funcTable localFuncTable funcTable localFuncTable
getter *credmock.SecretStore getter *credmock.SecretStore
repoService *reposervicenmocks.BackupRepoService repoService *reposervicenmocks.BackupRepoService
retFuncInit interface{} retFuncInit any
credStoreReturn string credStoreReturn string
credStoreError error credStoreError error
readOnlyBSL bool readOnlyBSL bool
@ -1206,7 +1206,7 @@ func TestConnectToRepo(t *testing.T) {
funcTable localFuncTable funcTable localFuncTable
getter *credmock.SecretStore getter *credmock.SecretStore
repoService *reposervicenmocks.BackupRepoService repoService *reposervicenmocks.BackupRepoService
retFuncInit interface{} retFuncInit any
credStoreReturn string credStoreReturn string
credStoreError error credStoreError error
expectedErr string expectedErr string
@ -1297,8 +1297,8 @@ func TestBoostRepoConnect(t *testing.T) {
getter *credmock.SecretStore getter *credmock.SecretStore
repoService *reposervicenmocks.BackupRepoService repoService *reposervicenmocks.BackupRepoService
backupRepo *reposervicenmocks.BackupRepo backupRepo *reposervicenmocks.BackupRepo
retFuncInit interface{} retFuncInit any
retFuncOpen []interface{} retFuncOpen []any
credStoreReturn string credStoreReturn string
credStoreError error credStoreError error
expectedErr string expectedErr string
@ -1320,7 +1320,7 @@ func TestBoostRepoConnect(t *testing.T) {
}, },
}, },
repoService: new(reposervicenmocks.BackupRepoService), repoService: new(reposervicenmocks.BackupRepoService),
retFuncOpen: []interface{}{ retFuncOpen: []any{
func(context.Context, udmrepo.RepoOptions) udmrepo.BackupRepo { func(context.Context, udmrepo.RepoOptions) udmrepo.BackupRepo {
return backupRepo return backupRepo
}, },
@ -1347,7 +1347,7 @@ func TestBoostRepoConnect(t *testing.T) {
}, },
}, },
repoService: new(reposervicenmocks.BackupRepoService), repoService: new(reposervicenmocks.BackupRepoService),
retFuncOpen: []interface{}{ retFuncOpen: []any{
func(context.Context, udmrepo.RepoOptions) udmrepo.BackupRepo { func(context.Context, udmrepo.RepoOptions) udmrepo.BackupRepo {
return backupRepo return backupRepo
}, },
@ -1374,7 +1374,7 @@ func TestBoostRepoConnect(t *testing.T) {
}, },
repoService: new(reposervicenmocks.BackupRepoService), repoService: new(reposervicenmocks.BackupRepoService),
backupRepo: new(reposervicenmocks.BackupRepo), backupRepo: new(reposervicenmocks.BackupRepo),
retFuncOpen: []interface{}{ retFuncOpen: []any{
func(context.Context, udmrepo.RepoOptions) udmrepo.BackupRepo { func(context.Context, udmrepo.RepoOptions) udmrepo.BackupRepo {
return backupRepo return backupRepo
}, },
@ -1438,7 +1438,7 @@ func TestPruneRepo(t *testing.T) {
funcTable localFuncTable funcTable localFuncTable
getter *credmock.SecretStore getter *credmock.SecretStore
repoService *reposervicenmocks.BackupRepoService repoService *reposervicenmocks.BackupRepoService
retFuncMaintain interface{} retFuncMaintain any
credStoreReturn string credStoreReturn string
credStoreError error credStoreError error
expectedErr string expectedErr string

View File

@ -33,7 +33,7 @@ type ManifestEntryMetadata struct {
} }
type RepoManifest struct { type RepoManifest struct {
Payload interface{} // The user data of manifest Payload any // The user data of manifest
Metadata *ManifestEntryMetadata // The metadata data of manifest Metadata *ManifestEntryMetadata // The metadata data of manifest
} }

Some files were not shown because too many files have changed in this diff Show More