Merge branch 'main' into fix/backup-name-validation

This commit is contained in:
R4mbo
2026-08-25 22:26:42 +05:30
committed by GitHub
168 changed files with 4336 additions and 741 deletions
+13 -2
View File
@@ -416,8 +416,19 @@ func ParseOrderedResources(orderMapStr string) (map[string]string, error) {
return nil, fmt.Errorf("invalid OrderedResources '%s'", entry)
}
kind := strings.TrimSpace(kv[0])
order := strings.TrimSpace(kv[1])
orderedResources[kind] = order
orderParts := strings.Split(kv[1], ",")
cleaned := make([]string, 0, len(orderParts))
for _, part := range orderParts {
name := strings.TrimSpace(part)
if name == "" {
continue
}
cleaned = append(cleaned, name)
}
if kind == "" || len(cleaned) == 0 {
return nil, fmt.Errorf("invalid OrderedResources '%s'", entry)
}
orderedResources[kind] = strings.Join(cleaned, ",")
}
return orderedResources, nil
}
+8
View File
@@ -234,6 +234,14 @@ func TestCreateOptions_OrderedResources(t *testing.T) {
"persistentvolumes": "pv1,pv2",
}
assert.Equal(t, expectedMixedResources, orderedResources)
// Spaces after commas in the resource list must be trimmed.
orderedResources, err = ParseOrderedResources("pods=ns1/p1, ns1/p2 ; persistentvolumeclaims= ns2/pvc1, ns2/pvc2")
require.NoError(t, err)
assert.Equal(t, map[string]string{
"pods": "ns1/p1,ns1/p2",
"persistentvolumeclaims": "ns2/pvc1,ns2/pvc2",
}, orderedResources)
}
func TestCreateCommand(t *testing.T) {
+1 -1
View File
@@ -111,7 +111,7 @@ func NewAddCommand(f client.Factory) *cobra.Command {
}
// add the plugin as an init container
plugin := *builder.ForPluginContainer(args[0], corev1api.PullPolicy(imagePullPolicyFlag.String())).Result()
plugin := *builder.ForPluginContainer(args[0], corev1api.PullPolicy(imagePullPolicyFlag.String()), veleroDeploy.Spec.Template.Spec.InitContainers).Result()
veleroDeploy.Spec.Template.Spec.InitContainers = append(veleroDeploy.Spec.Template.Spec.InitContainers, plugin)
-6
View File
@@ -57,13 +57,11 @@ var resToDelete = []kbclient.ObjectList{}
// uninstallOptions collects all the options for uninstalling Velero from a Kubernetes cluster.
type uninstallOptions struct {
wait bool // deprecated
force bool
}
// BindFlags adds command line values to the options struct.
func (o *uninstallOptions) BindFlags(flags *pflag.FlagSet) {
flags.BoolVar(&o.wait, "wait", o.wait, "Wait for Velero uninstall to be ready. Optional. Deprecated.")
flags.BoolVar(&o.force, "force", o.force, "Forces the Velero uninstall. Optional.")
}
@@ -81,10 +79,6 @@ Use '--force' to skip the prompt confirming if you want to uninstall Velero.
`,
Example: ` # velero uninstall --namespace staging`,
Run: func(c *cobra.Command, args []string) {
if o.wait {
fmt.Println("Warning: the \"--wait\" option is deprecated and will be removed in a future release. The uninstall command always waits for the uninstall to complete.")
}
// Confirm if not asked to force-skip confirmation
if !o.force {
fmt.Println("You are about to uninstall Velero.")