Skip to content
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

Merged
merged 4 commits into from
May 27, 2015
Merged

Conversation

markturansky
Copy link
Contributor

Several "omitempty" tags missing.

Resolves #8755.

@roberthbailey
Copy link
Contributor

/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"`
Copy link
Member

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.

Copy link
Contributor Author

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.

@pmorie
Copy link
Member

pmorie commented May 25, 2015

Fyi @rootfs
On Mon, May 25, 2015 at 12:07 PM Robert Bailey notifications@github.com
wrote:

/cc @bgrant0607 https://github.com/bgrant0607 @thockin
https://github.com/thockin


Reply to this email directly or view it on GitHub
#8788 (comment)
.

@@ -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"`
Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

@bgrant0607 bgrant0607 self-assigned this May 25, 2015
@bgrant0607
Copy link
Member

Thanks, @markturansky.

@markturansky
Copy link
Contributor Author

@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

@thockin thockin added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 25, 2015
@thockin
Copy link
Member

thockin commented May 25, 2015

LGTM

@bgrant0607
Copy link
Member

Thanks. LGTM.

@thockin
Copy link
Member

thockin commented May 27, 2015

needs rebase

@markturansky
Copy link
Contributor Author

Rebased and added 'omitempty' to the couple new volumes that were added to PV. Waiting on green.

@markturansky
Copy link
Contributor Author

@thockin Travis returned green.

thockin added a commit that referenced this pull request May 27, 2015
@thockin thockin merged commit 06ed1f8 into kubernetes:master May 27, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm "Looks good to me", indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pod spec.volumes.rbd included when empty
6 participants