Skip to content

Commit 1c967ba

Browse files
Fixing unused flags
1 parent e7ba0e6 commit 1c967ba

1 file changed

Lines changed: 24 additions & 28 deletions

File tree

cmd/non-admin/restore/create.go

Lines changed: 24 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -72,28 +72,24 @@ func NewCreateCommand(f client.Factory, use string) *cobra.Command {
7272
}
7373

7474
type CreateOptions struct {
75-
Name string
76-
FromBackup string
77-
IncludeResources flag.StringArray
78-
ExcludeResources flag.StringArray
79-
IncludeClusterScopedResources flag.StringArray
80-
ExcludeClusterScopedResources flag.StringArray
81-
IncludeNamespaceScopedResources flag.StringArray
82-
ExcludeNamespaceScopedResources flag.StringArray
83-
NamespaceMapping flag.Map
84-
Labels flag.Map
85-
Annotations flag.Map
86-
Selector flag.LabelSelector
87-
OrSelector flag.OrLabelSelector
88-
IncludeClusterResources flag.OptionalBool
89-
Wait bool
90-
RestorePVs flag.OptionalBool
91-
PreserveNodePorts flag.OptionalBool
92-
ItemOperationTimeout time.Duration
93-
ExistingResourcePolicy string
94-
UploaderConfig flag.Map
95-
client kbclient.WithWatch
96-
currentNamespace string
75+
Name string
76+
FromBackup string
77+
IncludeResources flag.StringArray
78+
ExcludeResources flag.StringArray
79+
NamespaceMapping flag.Map
80+
Labels flag.Map
81+
Annotations flag.Map
82+
Selector flag.LabelSelector
83+
OrSelector flag.OrLabelSelector
84+
IncludeClusterResources flag.OptionalBool
85+
Wait bool
86+
RestorePVs flag.OptionalBool
87+
PreserveNodePorts flag.OptionalBool
88+
ItemOperationTimeout time.Duration
89+
ExistingResourcePolicy string
90+
UploaderConfig flag.Map
91+
client kbclient.WithWatch
92+
currentNamespace string
9793
}
9894

9995
func NewCreateOptions() *CreateOptions {
@@ -111,12 +107,8 @@ func NewCreateOptions() *CreateOptions {
111107

112108
func (o *CreateOptions) BindFlags(flags *pflag.FlagSet) {
113109
flags.StringVar(&o.FromBackup, "from-backup", o.FromBackup, "Backup to restore from (required).")
114-
flags.Var(&o.IncludeResources, "include-resources", "Resources to include in the restore, formatted as resource.group, such as storageclasses.storage.k8s.io (use '*' for all resources). Cannot work with include-cluster-scoped-resources, exclude-cluster-scoped-resources, include-namespace-scoped-resources and exclude-namespace-scoped-resources.")
115-
flags.Var(&o.ExcludeResources, "exclude-resources", "Resources to exclude from the restore, formatted as resource.group, such as storageclasses.storage.k8s.io. Cannot work with include-cluster-scoped-resources, exclude-cluster-scoped-resources, include-namespace-scoped-resources and exclude-namespace-scoped-resources.")
116-
flags.Var(&o.IncludeClusterScopedResources, "include-cluster-scoped-resources", "Cluster-scoped resources to include in the restore, formatted as resource.group, such as storageclasses.storage.k8s.io(use '*' for all resources). Cannot work with include-resources, exclude-resources and include-cluster-resources.")
117-
flags.Var(&o.ExcludeClusterScopedResources, "exclude-cluster-scoped-resources", "Cluster-scoped resources to exclude from the restore, formatted as resource.group, such as storageclasses.storage.k8s.io(use '*' for all resources). Cannot work with include-resources, exclude-resources and include-cluster-resources.")
118-
flags.Var(&o.IncludeNamespaceScopedResources, "include-namespace-scoped-resources", "Namespaced resources to include in the restore, formatted as resource.group, such as deployments.apps(use '*' for all resources). Cannot work with include-resources, exclude-resources and include-cluster-resources.")
119-
flags.Var(&o.ExcludeNamespaceScopedResources, "exclude-namespace-scoped-resources", "Namespaced resources to exclude from the restore, formatted as resource.group, such as deployments.apps(use '*' for all resources). Cannot work with include-resources, exclude-resources and include-cluster-resources.")
110+
flags.Var(&o.IncludeResources, "include-resources", "Resources to include in the restore, formatted as resource.group, such as storageclasses.storage.k8s.io (use '*' for all resources).")
111+
flags.Var(&o.ExcludeResources, "exclude-resources", "Resources to exclude from the restore, formatted as resource.group, such as storageclasses.storage.k8s.io.")
120112
flags.Var(&o.Labels, "labels", "Labels to apply to the restore.")
121113
flags.Var(&o.Annotations, "annotations", "Annotations to apply to the restore.")
122114
// Note: namespace-mappings are restricted for non-admin users and therefore not exposed
@@ -215,6 +207,10 @@ func (o *CreateOptions) buildRestore() *nacv1alpha1.NonAdminRestore {
215207
restoreSpec.ExcludedResources = o.ExcludeResources
216208
}
217209

210+
// Note: The namespace-scoped and cluster-scoped resource filters are only available
211+
// in backup operations, not restore operations in Velero RestoreSpec.
212+
// For restores, use IncludedResources/ExcludedResources with specific resource types.
213+
218214
// Note: Namespace mappings are restricted for non-admin users and therefore not processed
219215

220216
// Add selectors

0 commit comments

Comments
 (0)