From 0da5f1ccca36a5bc39f5bee2cdf3a39f48eef63c Mon Sep 17 00:00:00 2001 From: Nikhita Raghunath Date: Mon, 25 Jun 2018 16:40:43 +0530 Subject: [PATCH] Add omitempty tag to optional API fields Signed-off-by: Nikhita Raghunath --- pkg/apis/ark/v1/backup.go | 4 ++-- pkg/apis/ark/v1/restore.go | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/apis/ark/v1/backup.go b/pkg/apis/ark/v1/backup.go index b871d6d77..cf340a93d 100644 --- a/pkg/apis/ark/v1/backup.go +++ b/pkg/apis/ark/v1/backup.go @@ -44,7 +44,7 @@ type BackupSpec struct { // SnapshotVolumes specifies whether to take cloud snapshots // of any PV's referenced in the set of objects included // in the Backup. - SnapshotVolumes *bool `json:"snapshotVolumes"` + SnapshotVolumes *bool `json:"snapshotVolumes,omitempty"` // TTL is a time.Duration-parseable string describing how long // the Backup should be retained for. @@ -80,7 +80,7 @@ type BackupResourceHookSpec struct { // ExcludedResources specifies the resources to which this hook spec does not apply. ExcludedResources []string `json:"excludedResources"` // LabelSelector, if specified, filters the resources to which this hook spec applies. - LabelSelector *metav1.LabelSelector `json:"labelSelector"` + LabelSelector *metav1.LabelSelector `json:"labelSelector,omitempty"` // Hooks is a list of BackupResourceHooks to execute. DEPRECATED. Replaced by PreHooks. Hooks []BackupResourceHook `json:"hooks"` // PreHooks is a list of BackupResourceHooks to execute prior to storing the item in the backup. diff --git a/pkg/apis/ark/v1/restore.go b/pkg/apis/ark/v1/restore.go index fa8611b97..7128f519c 100644 --- a/pkg/apis/ark/v1/restore.go +++ b/pkg/apis/ark/v1/restore.go @@ -49,16 +49,16 @@ type RestoreSpec struct { // LabelSelector is a metav1.LabelSelector to filter with // when restoring individual objects from the backup. If empty // or nil, all objects are included. Optional. - LabelSelector *metav1.LabelSelector `json:"labelSelector"` + LabelSelector *metav1.LabelSelector `json:"labelSelector,omitempty"` // RestorePVs specifies whether to restore all included // PVs from snapshot (via the cloudprovider). - RestorePVs *bool `json:"restorePVs"` + RestorePVs *bool `json:"restorePVs,omitempty"` // IncludeClusterResources specifies whether cluster-scoped resources // should be included for consideration in the restore. If null, defaults // to true. - IncludeClusterResources *bool `json:"includeClusterResources"` + IncludeClusterResources *bool `json:"includeClusterResources,omitempty"` } // RestorePhase is a string representation of the lifecycle phase