Skip to content

Commit

Permalink
Merge pull request kubevirt#579 from lukas-bednar/vmrs-conditions
Browse files Browse the repository at this point in the history
schema: update json tags to allow optional fields be empty
  • Loading branch information
rmohr authored Nov 23, 2017
2 parents 532343b + d5b6134 commit 1fa2c9d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 27 deletions.
19 changes: 1 addition & 18 deletions api/openapi-spec/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -1898,9 +1898,7 @@
"v1.CloudInitDataSourceNoCloud": {
"description": "http://cloudinit.readthedocs.io/en/latest/topics/datasources/nocloud.html",
"required": [
"userDataSecretRef",
"userDataBase64",
"metaDataBase64"
"userDataBase64"
],
"properties": {
"metaDataBase64": {
Expand Down Expand Up @@ -2010,9 +2008,7 @@
},
"v1.Disk": {
"required": [
"device",
"type",
"source",
"target"
],
"properties": {
Expand Down Expand Up @@ -3030,9 +3026,6 @@
}
},
"v1.VMReplicaSetStatus": {
"required": [
"conditions"
],
"properties": {
"conditions": {
"type": "array",
Expand Down Expand Up @@ -3082,10 +3075,6 @@
},
"v1.VMStatus": {
"description": "VMStatus represents information about the status of a VM. Status may trail the actual\nstate of a system.",
"required": [
"phase",
"graphics"
],
"properties": {
"conditions": {
"description": "Conditions are specific points in VM's pod runtime.",
Expand Down Expand Up @@ -3154,9 +3143,6 @@
},
"v1.VirtualMachine": {
"description": "VirtualMachine is *the* VM Definition. It represents a virtual machine in the runtime environment of kubernetes.",
"required": [
"status"
],
"properties": {
"apiVersion": {
"description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources",
Expand Down Expand Up @@ -3206,9 +3192,6 @@
},
"v1.VirtualMachineReplicaSet": {
"description": "VM is *the* VM Definition. It represents a virtual machine in the runtime environment of kubernetes.",
"required": [
"status"
],
"properties": {
"apiVersion": {
"description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources",
Expand Down
8 changes: 4 additions & 4 deletions pkg/api/v1/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ package v1
// http://cloudinit.readthedocs.io/en/latest/topics/datasources/nocloud.html
type CloudInitDataSourceNoCloud struct {
// Reference to a k8s secret that contains NoCloud userdata
UserDataSecretRef string `json:"userDataSecretRef"`
UserDataSecretRef string `json:"userDataSecretRef,omitempty"`
// The NoCloud cloud-init userdata as a base64 encoded string
UserDataBase64 string `json:"userDataBase64"`
// The NoCloud cloud-init metadata as a base64 encoded string
MetaDataBase64 string `json:"metaDataBase64"`
MetaDataBase64 string `json:"metaDataBase64,omitempty"`
}

// Only one of the fields in the CloudInitSpec can be set
Expand Down Expand Up @@ -73,10 +73,10 @@ type Devices struct {
// BEGIN Disk -----------------------------

type Disk struct {
Device string `json:"device"`
Device string `json:"device,omitempty"`
Snapshot string `json:"snapshot,omitempty"`
Type string `json:"type"`
Source DiskSource `json:"source"`
Source DiskSource `json:"source,omitempty"`
Target DiskTarget `json:"target"`
Serial string `json:"serial,omitempty"`
Driver *DiskDriver `json:"driver,omitempty"`
Expand Down
10 changes: 5 additions & 5 deletions pkg/api/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ type VirtualMachine struct {
// VM Spec contains the VM specification.
Spec VMSpec `json:"spec,omitempty" valid:"required"`
// Status is the high level overview of how the VM is doing. It contains information available to controllers and users.
Status VMStatus `json:"status"`
Status VMStatus `json:"status,omitempty"`
}

func (in *VirtualMachine) DeepCopyInto(out *VirtualMachine) {
Expand Down Expand Up @@ -198,9 +198,9 @@ type VMStatus struct {
// Conditions are specific points in VM's pod runtime.
Conditions []VMCondition `json:"conditions,omitempty"`
// Phase is the status of the VM in kubernetes world. It is not the VM status, but partially correlates to it.
Phase VMPhase `json:"phase"`
Phase VMPhase `json:"phase,omitempty"`
// Graphics represent the details of available graphical consoles.
Graphics []VMGraphics `json:"graphics"`
Graphics []VMGraphics `json:"graphics" optional:"true"`
}

type VMGraphics struct {
Expand Down Expand Up @@ -701,7 +701,7 @@ type VirtualMachineReplicaSet struct {
// VM Spec contains the VM specification.
Spec VMReplicaSetSpec `json:"spec,omitempty" valid:"required"`
// Status is the high level overview of how the VM is doing. It contains information available to controllers and users.
Status VMReplicaSetStatus `json:"status"`
Status VMReplicaSetStatus `json:"status,omitempty"`
}

// VMList is a list of VMs
Expand Down Expand Up @@ -739,7 +739,7 @@ type VMReplicaSetStatus struct {
// +optional
ReadyReplicas int32 `json:"readyReplicas,omitempty" protobuf:"varint,4,opt,name=readyReplicas"`

Conditions []VMReplicaSetCondition `json:"conditions"`
Conditions []VMReplicaSetCondition `json:"conditions" optional:"true"`
}

type VMReplicaSetCondition struct {
Expand Down

0 comments on commit 1fa2c9d

Please sign in to comment.