-
Notifications
You must be signed in to change notification settings - Fork 40k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed json tags for volumes #8788
Conversation
/cc @bgrant0607 @thockin |
@@ -204,7 +204,7 @@ type VolumeSource struct { | |||
// Glusterfs represents a Glusterfs mount on the host that shares a pod's lifetime | |||
Glusterfs *GlusterfsVolumeSource `json:"glusterfs"` | |||
// PersistentVolumeClaimVolumeSource represents a reference to a PersistentVolumeClaim in the same namespace | |||
PersistentVolumeClaimVolumeSource *PersistentVolumeClaimVolumeSource `json:"persistentVolumeClaim,omitempty"` | |||
PersistentVolumeClaimVolumeSource *PersistentVolumeClaimVolumeSource `json:"persistentVolumeClaim"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
omitempty implies optional. Really we shouldn't have any json tags in this file, but so long as we do, we might as well make the tags correct and consistent. All volume sources should have omitempty here, or just remove the json tags entirely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll add omitempty to each. I believe Tim tried removing all the json tags and failed.
Fyi @rootfs
|
@@ -252,7 +252,7 @@ type PersistentVolumeSource struct { | |||
// NFS represents an NFS mount on the host | |||
NFS *NFSVolumeSource `json:"nfs,omitempty" description:"NFS volume resource provisioned by an admin"` | |||
// RBD represents a Rados Block Device mount on the host that shares a pod's lifetime | |||
RBD *RBDVolumeSource `json:"rbd" description:"rados block volume that will be mounted on the host machine"` | |||
RBD *RBDVolumeSource `json:"rbd,omitempty" description:"rados block volume that will be mounted on the host machine"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about v1beta1 and v1beta2? We should keep them up to date until we remove them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed they were one way while v1beta3 was another. I thought maybe it was purposeful. I believe they used to be there.
I'll add 'omitempty' to the other versions, too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nm, i see these were all added by Nikhil but only to v1 and v1beta3. They are all the same now.
Thanks, @markturansky. |
@bgrant0607 I added 'omitempty' to internal types and v1beta1/2, per your request. Also, I removed 'omitempty' from PersistentVolumeClaimVolumeSource.ClaimName. Validation already requires the name, so omitempty makes no sense. cc @nikhiljindal this continues #8338 |
LGTM |
Thanks. LGTM. |
needs rebase |
23973a3
to
d338a7e
Compare
Rebased and added 'omitempty' to the couple new volumes that were added to PV. Waiting on green. |
@thockin Travis returned green. |
Several "omitempty" tags missing.
Resolves #8755.