diff --git a/glide.lock b/glide.lock index 1f56d4bb7..dff13e30f 100644 --- a/glide.lock +++ b/glide.lock @@ -1,5 +1,5 @@ -hash: 563297636458e2f68f455063bbd7de89cb5455b842f91a84ae16c4d280bdee44 -updated: 2018-04-30T17:22:00.749333711+03:00 +hash: 0ece4ec8bf754e47c987bba0f7173f29a08aadc2b476a653e56bb57ebcdd80b5 +updated: 2018-07-04T19:17:18.386872596+03:00 imports: - name: github.com/onsi/ginkgo version: 11459a886d9cd66b319dac7ef1e917ee221372c9 @@ -36,18 +36,25 @@ imports: - matchers/support/goraph/util - types - name: kubevirt.io/kubevirt - version: 04747283df41770829b41cc669c9b2c71b175892 + version: b5b91243f540739eb5db61af89b2f1e5ba449dfa repo: https://github.com/kubevirt/kubevirt.git subpackages: - pkg/api/v1 - pkg/controller + - pkg/ephemeral-disk-utils - pkg/kubecli - pkg/log - pkg/precond + - pkg/registry-disk + - pkg/util/net/dns + - pkg/version + - pkg/virt-controller/services - pkg/virtctl - pkg/virtctl/console - - pkg/virtctl/offlinevm + - pkg/virtctl/expose - pkg/virtctl/templates + - pkg/virtctl/version + - pkg/virtctl/vm - pkg/virtctl/vnc - tests testImports: @@ -76,9 +83,9 @@ testImports: - name: github.com/go-openapi/jsonreference version: 3fb327e6747da3043567ee86abd02bb6376b6be2 - name: github.com/go-openapi/spec - version: bcff419492eeeb01f76e77d2ebc714dc97b607f5 + version: 16284f9da51d5a5b5dc67c8109a99b014c4b7f0a - name: github.com/go-openapi/swag - version: 811b1089cde9dad18d4d0c2d09fbdbf28dbd27a5 + version: 2b0bd4f193d011c203529df626a65d63cb8a79e8 - name: github.com/go-stack/stack version: 259ab82a6cad3992b4e21ff5cac294ccb06474bc - name: github.com/gogo/protobuf @@ -89,11 +96,11 @@ testImports: - name: github.com/golang/glog version: 44145f04b68cf362d9c4df2182967c2275eaefed - name: github.com/golang/mock - version: 87f106fccd7e3ced294a19e86bebd7846911690a + version: 22bbf0ddf08105dfa364d0a2fa619dfa71014af5 subpackages: - gomock - name: github.com/golang/protobuf - version: 1643683e1b54a9e88ad26d98f81400c8c9d9f4f9 + version: b4deda0973fb4c70b50d226b1af49f3da59f5265 subpackages: - proto - ptypes @@ -103,11 +110,11 @@ testImports: - name: github.com/google/btree version: 7d79101e329e5a3adf994758c578dab82b90c017 - name: github.com/google/goexpect - version: 756071476d4175eed2d146a607574a92063d1f58 + version: ab4b830a1d94b505ac5025eaa09ed950b329efa4 - name: github.com/google/gofuzz version: 44d81051d367757e1c7c6a5a86423ece9afcf63c - name: github.com/google/goterm - version: a4092ec6825782fa1703cbaaeaf24ef377d5c9c4 + version: 70e1c263818522aa1ecbdd34d7e143639d447ced subpackages: - term - name: github.com/googleapis/gnostic @@ -133,7 +140,7 @@ testImports: - name: github.com/inconshreveable/mousetrap version: 76626ae9c91c4f2a10f34cad8ce83ea42c93bb75 - name: github.com/json-iterator/go - version: 2ddf6d758266fcb080a4f9e054b9f292c85e6798 + version: f2b4162afba35581b6d4a50d3b8f34e33c144682 - name: github.com/juju/ratelimit version: 5b9ff866471762aa2ab2dced63c9fb6f53921342 - name: github.com/kr/logfmt @@ -157,7 +164,7 @@ testImports: - name: github.com/PuerkitoBio/urlesc version: 5bd2802263f21d8788851d5305584c82a5c75d7e - name: github.com/spf13/cobra - version: a1f051bc3eba734da4772d60e2d677f47cf93ef4 + version: ef82de70bb3f60c65fb8eebacbb2d122ef517385 subpackages: - cobra - name: github.com/spf13/pflag @@ -212,7 +219,7 @@ testImports: - unicode/norm - width - name: google.golang.org/grpc - version: fc37cf1364fafea48582b50bf6d4acf9880a980a + version: 40cd6b15e2880b88deb091b0fcb091694285fcb0 subpackages: - codes - name: gopkg.in/inf.v0 @@ -356,6 +363,6 @@ testImports: - util/integer - util/workqueue - name: k8s.io/kube-openapi - version: 3a0c53868c9444e4224c3dd5dc2caa9b5107ff7b + version: d83b052f768a50a309c692a9c271da3f3276ff88 subpackages: - pkg/common diff --git a/glide.yaml b/glide.yaml index 51918463e..79fa8c42f 100644 --- a/glide.yaml +++ b/glide.yaml @@ -5,5 +5,5 @@ import: - package: github.com/onsi/gomega version: dcabb60a477c2b6f456df65037cb6708210fbb02 - package: kubevirt.io/kubevirt - version: v0.6.0 + version: v0.7.0 repo: https://github.com/kubevirt/kubevirt.git diff --git a/hack/run-tests.sh b/hack/run-tests.sh index 84c3aa488..ee4ba5659 100755 --- a/hack/run-tests.sh +++ b/hack/run-tests.sh @@ -5,7 +5,7 @@ set -e source hack/common.sh prefix=kubevirt -tag=v0.6.0 +tag=v0.7.0 kubeconfig=~/.kube/config ${TESTS_OUT_DIR}/tests.test -kubeconfig=$kubeconfig -tag=$tag -prefix=$prefix -test.timeout 60m diff --git a/roles/kubevirt/README.md b/roles/kubevirt/README.md index 0a1139a74..6fa2d795e 100644 --- a/roles/kubevirt/README.md +++ b/roles/kubevirt/README.md @@ -15,7 +15,7 @@ Deploy KubeVirt resources onto a cluster. |registry_namespace | kubevirt | |Container image organization.| |registry_url | docker.io | |Container image registry.| | storage_role | storage-none | | Storage role to install with KubeVirt.| -| version |0.6.0||KubeVirt release version.| +| version |0.7.0||KubeVirt release version.| |default_vm_templates||| Default vm templates to deploy with KubeVirt.| |offline_template_dir| /opt/apb/kubevirt-templates || Offline VM template location specifed in the APB Dockerfile.| diff --git a/roles/kubevirt/defaults/main.yml b/roles/kubevirt/defaults/main.yml index 16fc0a11d..8d4a6331a 100644 --- a/roles/kubevirt/defaults/main.yml +++ b/roles/kubevirt/defaults/main.yml @@ -6,7 +6,7 @@ cluster: "openshift" apb_action: "provision" release_manifest_url: "https://github.com/kubevirt/kubevirt/releases/download" kubevirt_template_dir: "{{ role_path }}/templates" -version: 0.6.0 +version: 0.7.0 docker_tag: "v{{ version }}" offline_template_dir: "/opt/apb/kubevirt-templates" diff --git a/roles/kubevirt/templates/kubevirt.yaml.j2 b/roles/kubevirt/templates/kubevirt.yaml.j2 index 0b7fe5d47..2c4e1e9d0 100644 --- a/roles/kubevirt/templates/kubevirt.yaml.j2 +++ b/roles/kubevirt/templates/kubevirt.yaml.j2 @@ -5,21 +5,22 @@ metadata: name: kubevirt.io:admin labels: kubevirt.io: "" + rbac.authorization.k8s.io/aggregate-to-admin: "true" rules: - apiGroups: - subresources.kubevirt.io resources: - - virtualmachines/console - - virtualmachines/vnc + - virtualmachineinstances/console + - virtualmachineinstances/vnc verbs: - get - apiGroups: - kubevirt.io resources: + - virtualmachineinstances - virtualmachines - - offlinevirtualmachines - - virtualmachinepresets - - virtualmachinereplicasets + - virtualmachineinstancepresets + - virtualmachineinstancereplicasets verbs: - get - delete @@ -29,17 +30,6 @@ rules: - list - watch - deletecollection - - apiGroups: [""] - resources: - - configmaps - resourceNames: - - kubevirt-config - verbs: - - update - - get - - patch - - create - - delete --- apiVersion: rbac.authorization.k8s.io/v1beta1 kind: ClusterRole @@ -47,21 +37,22 @@ metadata: name: kubevirt.io:edit labels: kubevirt.io: "" + rbac.authorization.k8s.io/aggregate-to-edit: "true" rules: - apiGroups: - subresources.kubevirt.io resources: - - virtualmachines/console - - virtualmachines/vnc + - virtualmachineinstances/console + - virtualmachineinstances/vnc verbs: - get - apiGroups: - kubevirt.io resources: + - virtualmachineinstances - virtualmachines - - offlinevirtualmachines - - virtualmachinepresets - - virtualmachinereplicasets + - virtualmachineinstancepresets + - virtualmachineinstancereplicasets verbs: - get - delete @@ -77,14 +68,15 @@ metadata: name: kubevirt.io:view labels: kubevirt.io: "" + rbac.authorization.k8s.io/aggregate-to-view: "true" rules: - apiGroups: - kubevirt.io resources: + - virtualmachineinstances - virtualmachines - - offlinevirtualmachines - - virtualmachinepresets - - virtualmachinereplicasets + - virtualmachineinstancepresets + - virtualmachineinstancereplicasets verbs: - get - list @@ -205,7 +197,7 @@ rules: - apiGroups: - kubevirt.io resources: - - virtualmachines + - virtualmachineinstances verbs: - get - list @@ -241,10 +233,10 @@ rules: - apiGroups: - kubevirt.io resources: + - virtualmachineinstances + - virtualmachineinstancereplicasets + - virtualmachineinstancepresets - virtualmachines - - virtualmachinereplicasets - - virtualmachinepresets - - offlinevirtualmachines verbs: - get - list @@ -382,16 +374,25 @@ spec: replicas: 2 template: metadata: + annotations: + scheduler.alpha.kubernetes.io/critical-pod: "" + scheduler.alpha.kubernetes.io/tolerations: | + [ + { + "key": "CriticalAddonsOnly", + "operator": "Exists" + } + ] labels: kubevirt.io: virt-api spec: serviceAccountName: kubevirt-controller containers: - name: virt-api - image: {{ docker_prefix }}/virt-api:{{docker_tag}} + image: {{ docker_prefix }}/virt-api:{{ docker_tag }} imagePullPolicy: IfNotPresent command: - - "/virt-api" + - "virt-api" - "--port" - "8443" - "--subresources-only" @@ -419,18 +420,27 @@ spec: replicas: 2 template: metadata: + annotations: + scheduler.alpha.kubernetes.io/critical-pod: "" + scheduler.alpha.kubernetes.io/tolerations: | + [ + { + "key": "CriticalAddonsOnly", + "operator": "Exists" + } + ] labels: kubevirt.io: virt-controller spec: serviceAccountName: kubevirt-controller containers: - name: virt-controller - image: {{ docker_prefix }}/virt-controller:{{docker_tag}} + image: {{ docker_prefix }}/virt-controller:{{ docker_tag }} imagePullPolicy: IfNotPresent command: - - "/virt-controller" + - "virt-controller" - "--launcher-image" - - "{{ docker_prefix }}/virt-launcher:{{docker_tag}}" + - "{{ docker_prefix }}/virt-launcher:{{ docker_tag }}" - "--port" - "8182" ports: @@ -467,6 +477,15 @@ spec: template: metadata: name: virt-handler + annotations: + scheduler.alpha.kubernetes.io/critical-pod: "" + scheduler.alpha.kubernetes.io/tolerations: | + [ + { + "key": "CriticalAddonsOnly", + "operator": "Exists" + } + ] labels: kubevirt.io: virt-handler spec: @@ -477,10 +496,10 @@ spec: ports: - containerPort: 8185 hostPort: 8185 - image: {{ docker_prefix }}/virt-handler:{{docker_tag}} + image: {{ docker_prefix }}/virt-handler:{{ docker_tag }} imagePullPolicy: IfNotPresent command: - - "/virt-handler" + - "virt-handler" - "-v" - "3" - "--hostname-override" @@ -494,6 +513,8 @@ spec: mountPath: /var/run/kubevirt - name: virt-private-dir mountPath: /var/run/kubevirt-private + - name: device-plugin + mountPath: /var/lib/kubelet/device-plugins env: - name: NODE_NAME valueFrom: @@ -509,6 +530,9 @@ spec: - name: virt-private-dir hostPath: path: /var/run/kubevirt-private + - name: device-plugin + hostPath: + path: /var/lib/kubelet/device-plugins --- apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition @@ -516,313 +540,242 @@ metadata: creationTimestamp: null labels: kubevirt.io: "" - name: virtualmachines.kubevirt.io + name: virtualmachineinstances.kubevirt.io spec: group: kubevirt.io names: - kind: VirtualMachine - plural: virtualmachines + kind: VirtualMachineInstance + plural: virtualmachineinstances shortNames: - - vm - - vms - singular: virtualmachine + - vmi + - vmis + singular: virtualmachineinstance scope: Namespaced validation: openAPIV3Schema: - description: VirtualMachine is *the* VM Definition. It represents a virtual - machine in the runtime environment of kubernetes. 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' type: string kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds' type: string metadata: {} spec: - description: VirtualMachineSpec is a description of a VirtualMachine. properties: affinity: - description: Affinity groups all the affinity rules related to a VM properties: nodeAffinity: {} + podAffinity: {} + podAntiAffinity: {} domain: properties: clock: - description: Represents the clock and timers of a vm properties: timezone: - description: Timezone sets the guest clock to the specified - timezone. Zone name follows the TZ environment variable format - (e.g. 'America/New_York') type: string utc: - description: UTC sets the guest clock to UTC on each boot. properties: offsetSeconds: - description: OffsetSeconds specifies an offset in seconds, - relative to UTC. If set, guest changes to the clock will - be kept during reboots and not reset. format: int32 type: integer cpu: - description: CPU allow specifying the CPU topology properties: cores: - description: Cores specifies the number of cores inside the - vm. Must be a value greater or equal 1. format: int64 type: integer + model: + type: string devices: properties: disks: - description: Disks describes disks, cdroms, floppy and luns - which are connected to the vm items: properties: bootOrder: - description: BootOrder is an integer value > 0, used to - determine ordering of boot devices. Lower values take - precedence. Disks without a boot order are not tried - if a disk with a boot order exists. format: int32 type: integer cdrom: properties: bus: - description: 'Bus indicates the type of disk device - to emulate. supported values: virtio, sata, scsi, - ide' type: string readonly: - description: ReadOnly Defaults to true type: boolean tray: - description: Tray indicates if the tray of the device - is open or closed. Allowed values are "open" and - "closed" Defaults to closed type: string disk: properties: bus: - description: 'Bus indicates the type of disk device - to emulate. supported values: virtio, sata, scsi, - ide' type: string readonly: - description: ReadOnly Defaults to false type: boolean floppy: properties: readonly: - description: ReadOnly Defaults to false type: boolean tray: - description: Tray indicates if the tray of the device - is open or closed. Allowed values are "open" and - "closed" Defaults to closed type: string lun: properties: bus: - description: 'Bus indicates the type of disk device - to emulate. supported values: virtio, sata, scsi, - ide' type: string readonly: - description: ReadOnly Defaults to false type: boolean name: - description: Name is the device name + type: string + serial: type: string volumeName: - description: Name of the volume which is referenced Must - match the Name of a Volume. type: string required: - name - volumeName type: array + interfaces: + items: + properties: + bridge: {} + macAddress: + type: string + model: + type: string + name: + type: string + ports: + items: + properties: + name: + type: string + port: + format: int32 + type: integer + protocol: + type: string + required: + - port + type: array + slirp: {} + required: + - name + type: array watchdog: - description: Named watchdog device properties: i6300esb: - description: i6300esb watchdog device properties: action: - description: The action to take. Valid values are poweroff, - reset, shutdown. Defaults to reset type: string name: - description: Name of the watchdog type: string required: - name features: properties: acpi: - description: Represents if a feature is enabled or disabled properties: enabled: - description: Enabled determines if the feature should be - enabled or disabled on the guest Defaults to true type: boolean apic: properties: enabled: - description: Enabled determines if the feature should be - enabled or disabled on the guest Defaults to true type: boolean endOfInterrupt: - description: EndOfInterrupt enables the end of interrupt - notification in the guest Defaults to false type: boolean hyperv: - description: Hyperv specific features properties: relaxed: - description: Represents if a feature is enabled or disabled properties: enabled: - description: Enabled determines if the feature should - be enabled or disabled on the guest Defaults to true type: boolean reset: - description: Represents if a feature is enabled or disabled properties: enabled: - description: Enabled determines if the feature should - be enabled or disabled on the guest Defaults to true type: boolean runtime: - description: Represents if a feature is enabled or disabled properties: enabled: - description: Enabled determines if the feature should - be enabled or disabled on the guest Defaults to true type: boolean spinlocks: properties: enabled: - description: Enabled determines if the feature should - be enabled or disabled on the guest Defaults to true type: boolean spinlocks: - description: Retries indicates the number of retries - Must be a value greater or equal 4096 Defaults to - 4096 format: int64 type: integer synic: - description: Represents if a feature is enabled or disabled properties: enabled: - description: Enabled determines if the feature should - be enabled or disabled on the guest Defaults to true type: boolean synictimer: - description: Represents if a feature is enabled or disabled properties: enabled: - description: Enabled determines if the feature should - be enabled or disabled on the guest Defaults to true type: boolean vapic: - description: Represents if a feature is enabled or disabled properties: enabled: - description: Enabled determines if the feature should - be enabled or disabled on the guest Defaults to true type: boolean vendorid: properties: enabled: - description: Enabled determines if the feature should - be enabled or disabled on the guest Defaults to true type: boolean vendorid: - description: VendorID sets the hypervisor vendor id, - visible to the vm String up to twelve characters type: string vpindex: - description: Represents if a feature is enabled or disabled properties: enabled: - description: Enabled determines if the feature should - be enabled or disabled on the guest Defaults to true type: boolean firmware: properties: uuid: - description: UUID reported by the vm bios Defaults to a random - generated uid type: string machine: properties: type: - description: QEMU machine type is the actual chipset of the - VM. type: string required: - type + memory: + properties: + hugepages: + properties: + pageSize: + type: string resources: properties: limits: - description: Limits describes the maximum amount of compute - resources allowed. Valid resource keys are "memory" and "cpu". type: object requests: - description: Requests is a description of the initial vm resources. - Valid resource keys are "memory" and "cpu". type: object required: - devices hostname: - description: Specifies the hostname of the vm If not specified, the - hostname will be set to the name of the vm, if dhcp or cloud-init - is configured properly. type: string + networks: + items: + properties: + name: + type: string + pod: + properties: + vmNetworkCIDR: + type: string + required: + - name + type: array nodeSelector: - description: 'NodeSelector is a selector which must be true for the - vm to fit on a node. Selector which must match a node''s labels for - the vm to be scheduled on that node. More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/' type: object subdomain: - description: If specified, the fully qualified vm hostname will be "...svc.". If not specified, the vm will not - have a domainname at all. The DNS entry will resolve to the vm, no - matter if the vm itself can pick up a hostname. type: string terminationGracePeriodSeconds: - description: Grace period observed after signalling a VM to stop after - which the VM is force terminated. format: int64 type: integer volumes: - description: List of volumes that can be mounted by disks belonging - to the vm. items: - description: Volume represents a named volume in a vm. properties: cloudInitNoCloud: - description: 'Represents a cloud-init nocloud user data source - More info: http://cloudinit.readthedocs.io/en/latest/topics/datasources/nocloud.html' properties: secretRef: {} userData: - description: UserData contains NoCloud inline cloud-init userdata type: string userDataBase64: - description: UserDataBase64 contains NoCloud cloud-init userdata - as a base64 encoded string type: string emptyDisk: - description: EmptyDisk represents a temporary disk which shares - the vms lifecycle properties: capacity: {} required: @@ -831,21 +784,13 @@ spec: properties: persistentVolumeClaim: {} name: - description: 'Volume''s name. Must be a DNS_LABEL and unique within - the vm. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' type: string persistentVolumeClaim: {} registryDisk: - description: Represents a docker image with an embedded disk properties: image: - description: Image is the name of the image with the embedded - disk type: string imagePullSecret: - description: ImagePullSecret is the name of the Docker registry - secret required to pull the image. The secret must already - exist. type: string required: - image @@ -855,11 +800,8 @@ spec: required: - domain status: - description: VirtualMachineStatus represents information about the status - of a VM. Status may trail the actual state of a system. properties: conditions: - description: Conditions are specific points in VM's pod runtime. items: properties: lastProbeTime: {} @@ -877,24 +819,18 @@ spec: - status type: array interfaces: - description: Interfaces represent the details of available network interfaces. items: properties: ipAddress: - description: IP address of a Virtual Machine interface type: string mac: - description: Hardware address of a Virtual Machine interface type: string type: array nodeName: - description: NodeName is the name where the VM is currently running. type: string phase: - description: Phase is the status of the VM in kubernetes world. It is - not the VM status, but partially correlates to it. type: string - version: v1alpha1 + version: v1alpha2 status: acceptedNames: kind: "" @@ -908,41 +844,30 @@ metadata: creationTimestamp: null labels: kubevirt.io: "" - name: virtualmachinereplicasets.kubevirt.io + name: virtualmachineinstancereplicasets.kubevirt.io spec: group: kubevirt.io names: - kind: VirtualMachineReplicaSet - plural: virtualmachinereplicasets + kind: VirtualMachineInstanceReplicaSet + plural: virtualmachineinstancereplicasets shortNames: - - vmrs - - vmrss - singular: virtualmachinereplicaset + - vmirs + - vmirss + singular: virtualmachineinstancereplicaset scope: Namespaced validation: openAPIV3Schema: - description: VM is *the* VM Definition. It represents a virtual machine in the - runtime environment of kubernetes. 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' type: string kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds' type: string metadata: {} spec: properties: paused: - description: Indicates that the replica set is paused. type: boolean replicas: - description: Number of desired pods. This is a pointer to distinguish - between explicit zero and not specified. Defaults to 1. format: int32 type: integer selector: {} @@ -950,314 +875,222 @@ spec: properties: metadata: {} spec: - description: VirtualMachineSpec is a description of a VirtualMachine. properties: affinity: - description: Affinity groups all the affinity rules related - to a VM properties: nodeAffinity: {} + podAffinity: {} + podAntiAffinity: {} domain: properties: clock: - description: Represents the clock and timers of a vm properties: timezone: - description: Timezone sets the guest clock to the specified - timezone. Zone name follows the TZ environment variable - format (e.g. 'America/New_York') type: string utc: - description: UTC sets the guest clock to UTC on each - boot. properties: offsetSeconds: - description: OffsetSeconds specifies an offset in - seconds, relative to UTC. If set, guest changes - to the clock will be kept during reboots and not - reset. format: int32 type: integer cpu: - description: CPU allow specifying the CPU topology properties: cores: - description: Cores specifies the number of cores inside - the vm. Must be a value greater or equal 1. format: int64 type: integer + model: + type: string devices: properties: disks: - description: Disks describes disks, cdroms, floppy and - luns which are connected to the vm items: properties: bootOrder: - description: BootOrder is an integer value > 0, - used to determine ordering of boot devices. - Lower values take precedence. Disks without - a boot order are not tried if a disk with a - boot order exists. format: int32 type: integer cdrom: properties: bus: - description: 'Bus indicates the type of disk - device to emulate. supported values: virtio, - sata, scsi, ide' type: string readonly: - description: ReadOnly Defaults to true type: boolean tray: - description: Tray indicates if the tray of - the device is open or closed. Allowed values - are "open" and "closed" Defaults to closed type: string disk: properties: bus: - description: 'Bus indicates the type of disk - device to emulate. supported values: virtio, - sata, scsi, ide' type: string readonly: - description: ReadOnly Defaults to false type: boolean floppy: properties: readonly: - description: ReadOnly Defaults to false type: boolean tray: - description: Tray indicates if the tray of - the device is open or closed. Allowed values - are "open" and "closed" Defaults to closed type: string lun: properties: bus: - description: 'Bus indicates the type of disk - device to emulate. supported values: virtio, - sata, scsi, ide' type: string readonly: - description: ReadOnly Defaults to false type: boolean name: - description: Name is the device name + type: string + serial: type: string volumeName: - description: Name of the volume which is referenced - Must match the Name of a Volume. type: string required: - name - volumeName type: array + interfaces: + items: + properties: + bridge: {} + macAddress: + type: string + model: + type: string + name: + type: string + ports: + items: + properties: + name: + type: string + port: + format: int32 + type: integer + protocol: + type: string + required: + - port + type: array + slirp: {} + required: + - name + type: array watchdog: - description: Named watchdog device properties: i6300esb: - description: i6300esb watchdog device properties: action: - description: The action to take. Valid values - are poweroff, reset, shutdown. Defaults to - reset type: string name: - description: Name of the watchdog type: string required: - name features: properties: acpi: - description: Represents if a feature is enabled or disabled properties: enabled: - description: Enabled determines if the feature should - be enabled or disabled on the guest Defaults to - true type: boolean apic: properties: enabled: - description: Enabled determines if the feature should - be enabled or disabled on the guest Defaults to - true type: boolean endOfInterrupt: - description: EndOfInterrupt enables the end of interrupt - notification in the guest Defaults to false type: boolean hyperv: - description: Hyperv specific features properties: relaxed: - description: Represents if a feature is enabled - or disabled properties: enabled: - description: Enabled determines if the feature - should be enabled or disabled on the guest - Defaults to true type: boolean reset: - description: Represents if a feature is enabled - or disabled properties: enabled: - description: Enabled determines if the feature - should be enabled or disabled on the guest - Defaults to true type: boolean runtime: - description: Represents if a feature is enabled - or disabled properties: enabled: - description: Enabled determines if the feature - should be enabled or disabled on the guest - Defaults to true type: boolean spinlocks: properties: enabled: - description: Enabled determines if the feature - should be enabled or disabled on the guest - Defaults to true type: boolean spinlocks: - description: Retries indicates the number of - retries Must be a value greater or equal 4096 - Defaults to 4096 format: int64 type: integer synic: - description: Represents if a feature is enabled - or disabled properties: enabled: - description: Enabled determines if the feature - should be enabled or disabled on the guest - Defaults to true type: boolean synictimer: - description: Represents if a feature is enabled - or disabled properties: enabled: - description: Enabled determines if the feature - should be enabled or disabled on the guest - Defaults to true type: boolean vapic: - description: Represents if a feature is enabled - or disabled properties: enabled: - description: Enabled determines if the feature - should be enabled or disabled on the guest - Defaults to true type: boolean vendorid: properties: enabled: - description: Enabled determines if the feature - should be enabled or disabled on the guest - Defaults to true type: boolean vendorid: - description: VendorID sets the hypervisor vendor - id, visible to the vm String up to twelve - characters type: string vpindex: - description: Represents if a feature is enabled - or disabled properties: enabled: - description: Enabled determines if the feature - should be enabled or disabled on the guest - Defaults to true type: boolean firmware: properties: uuid: - description: UUID reported by the vm bios Defaults to - a random generated uid type: string machine: properties: type: - description: QEMU machine type is the actual chipset - of the VM. type: string required: - type + memory: + properties: + hugepages: + properties: + pageSize: + type: string resources: properties: limits: - description: Limits describes the maximum amount of - compute resources allowed. Valid resource keys are - "memory" and "cpu". type: object requests: - description: Requests is a description of the initial - vm resources. Valid resource keys are "memory" and - "cpu". type: object required: - devices hostname: - description: Specifies the hostname of the vm If not specified, - the hostname will be set to the name of the vm, if dhcp or - cloud-init is configured properly. type: string + networks: + items: + properties: + name: + type: string + pod: + properties: + vmNetworkCIDR: + type: string + required: + - name + type: array nodeSelector: - description: 'NodeSelector is a selector which must be true - for the vm to fit on a node. Selector which must match a node''s - labels for the vm to be scheduled on that node. More info: - https://kubernetes.io/docs/concepts/configuration/assign-pod-node/' type: object subdomain: - description: If specified, the fully qualified vm hostname will - be "...svc.". - If not specified, the vm will not have a domainname at all. - The DNS entry will resolve to the vm, no matter if the vm - itself can pick up a hostname. type: string terminationGracePeriodSeconds: - description: Grace period observed after signalling a VM to - stop after which the VM is force terminated. format: int64 type: integer volumes: - description: List of volumes that can be mounted by disks belonging - to the vm. items: - description: Volume represents a named volume in a vm. properties: cloudInitNoCloud: - description: 'Represents a cloud-init nocloud user data - source More info: http://cloudinit.readthedocs.io/en/latest/topics/datasources/nocloud.html' properties: secretRef: {} userData: - description: UserData contains NoCloud inline cloud-init - userdata type: string userDataBase64: - description: UserDataBase64 contains NoCloud cloud-init - userdata as a base64 encoded string type: string emptyDisk: - description: EmptyDisk represents a temporary disk which - shares the vms lifecycle properties: capacity: {} required: @@ -1266,22 +1099,13 @@ spec: properties: persistentVolumeClaim: {} name: - description: 'Volume''s name. Must be a DNS_LABEL and - unique within the vm. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' type: string persistentVolumeClaim: {} registryDisk: - description: Represents a docker image with an embedded - disk properties: image: - description: Image is the name of the image with the - embedded disk type: string imagePullSecret: - description: ImagePullSecret is the name of the Docker - registry secret required to pull the image. The - secret must already exist. type: string required: - image @@ -1313,15 +1137,12 @@ spec: - status type: array readyReplicas: - description: The number of ready replicas for this replica set. format: int32 type: integer replicas: - description: Total number of non-terminated pods targeted by this deployment - (their labels match the selector). format: int32 type: integer - version: v1alpha1 + version: v1alpha2 status: acceptedNames: kind: "" @@ -1335,29 +1156,23 @@ metadata: creationTimestamp: null labels: kubevirt.io: "" - name: virtualmachinepresets.kubevirt.io + name: virtualmachineinstancepresets.kubevirt.io spec: group: kubevirt.io names: - kind: VirtualMachinePreset - plural: virtualmachinepresets + kind: VirtualMachineInstancePreset + plural: virtualmachineinstancepresets shortNames: - - vmpreset - - vmpresets - singular: virtualmachinepreset + - vmipreset + - vmipresets + singular: virtualmachineinstancepreset scope: Namespaced validation: openAPIV3Schema: 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' type: string kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds' type: string metadata: {} spec: @@ -1365,238 +1180,183 @@ spec: domain: properties: clock: - description: Represents the clock and timers of a vm properties: timezone: - description: Timezone sets the guest clock to the specified - timezone. Zone name follows the TZ environment variable format - (e.g. 'America/New_York') type: string utc: - description: UTC sets the guest clock to UTC on each boot. properties: offsetSeconds: - description: OffsetSeconds specifies an offset in seconds, - relative to UTC. If set, guest changes to the clock will - be kept during reboots and not reset. format: int32 type: integer cpu: - description: CPU allow specifying the CPU topology properties: cores: - description: Cores specifies the number of cores inside the - vm. Must be a value greater or equal 1. format: int64 type: integer + model: + type: string devices: properties: disks: - description: Disks describes disks, cdroms, floppy and luns - which are connected to the vm items: properties: bootOrder: - description: BootOrder is an integer value > 0, used to - determine ordering of boot devices. Lower values take - precedence. Disks without a boot order are not tried - if a disk with a boot order exists. format: int32 type: integer cdrom: properties: bus: - description: 'Bus indicates the type of disk device - to emulate. supported values: virtio, sata, scsi, - ide' type: string readonly: - description: ReadOnly Defaults to true type: boolean tray: - description: Tray indicates if the tray of the device - is open or closed. Allowed values are "open" and - "closed" Defaults to closed type: string disk: properties: bus: - description: 'Bus indicates the type of disk device - to emulate. supported values: virtio, sata, scsi, - ide' type: string readonly: - description: ReadOnly Defaults to false type: boolean floppy: properties: readonly: - description: ReadOnly Defaults to false type: boolean tray: - description: Tray indicates if the tray of the device - is open or closed. Allowed values are "open" and - "closed" Defaults to closed type: string lun: properties: bus: - description: 'Bus indicates the type of disk device - to emulate. supported values: virtio, sata, scsi, - ide' type: string readonly: - description: ReadOnly Defaults to false type: boolean name: - description: Name is the device name + type: string + serial: type: string volumeName: - description: Name of the volume which is referenced Must - match the Name of a Volume. type: string required: - name - volumeName type: array + interfaces: + items: + properties: + bridge: {} + macAddress: + type: string + model: + type: string + name: + type: string + ports: + items: + properties: + name: + type: string + port: + format: int32 + type: integer + protocol: + type: string + required: + - port + type: array + slirp: {} + required: + - name + type: array watchdog: - description: Named watchdog device properties: i6300esb: - description: i6300esb watchdog device properties: action: - description: The action to take. Valid values are poweroff, - reset, shutdown. Defaults to reset type: string name: - description: Name of the watchdog type: string required: - name features: properties: acpi: - description: Represents if a feature is enabled or disabled properties: enabled: - description: Enabled determines if the feature should be - enabled or disabled on the guest Defaults to true type: boolean apic: properties: enabled: - description: Enabled determines if the feature should be - enabled or disabled on the guest Defaults to true type: boolean endOfInterrupt: - description: EndOfInterrupt enables the end of interrupt - notification in the guest Defaults to false type: boolean hyperv: - description: Hyperv specific features properties: relaxed: - description: Represents if a feature is enabled or disabled properties: enabled: - description: Enabled determines if the feature should - be enabled or disabled on the guest Defaults to true type: boolean reset: - description: Represents if a feature is enabled or disabled properties: enabled: - description: Enabled determines if the feature should - be enabled or disabled on the guest Defaults to true type: boolean runtime: - description: Represents if a feature is enabled or disabled properties: enabled: - description: Enabled determines if the feature should - be enabled or disabled on the guest Defaults to true type: boolean spinlocks: properties: enabled: - description: Enabled determines if the feature should - be enabled or disabled on the guest Defaults to true type: boolean spinlocks: - description: Retries indicates the number of retries - Must be a value greater or equal 4096 Defaults to - 4096 format: int64 type: integer synic: - description: Represents if a feature is enabled or disabled properties: enabled: - description: Enabled determines if the feature should - be enabled or disabled on the guest Defaults to true type: boolean synictimer: - description: Represents if a feature is enabled or disabled properties: enabled: - description: Enabled determines if the feature should - be enabled or disabled on the guest Defaults to true type: boolean vapic: - description: Represents if a feature is enabled or disabled properties: enabled: - description: Enabled determines if the feature should - be enabled or disabled on the guest Defaults to true type: boolean vendorid: properties: enabled: - description: Enabled determines if the feature should - be enabled or disabled on the guest Defaults to true type: boolean vendorid: - description: VendorID sets the hypervisor vendor id, - visible to the vm String up to twelve characters type: string vpindex: - description: Represents if a feature is enabled or disabled properties: enabled: - description: Enabled determines if the feature should - be enabled or disabled on the guest Defaults to true type: boolean firmware: properties: uuid: - description: UUID reported by the vm bios Defaults to a random - generated uid type: string machine: properties: type: - description: QEMU machine type is the actual chipset of the - VM. type: string required: - type + memory: + properties: + hugepages: + properties: + pageSize: + type: string resources: properties: limits: - description: Limits describes the maximum amount of compute - resources allowed. Valid resource keys are "memory" and "cpu". type: object requests: - description: Requests is a description of the initial vm resources. - Valid resource keys are "memory" and "cpu". type: object - required: - - devices selector: {} required: - selector - version: v1alpha1 + version: v1alpha2 status: acceptedNames: kind: "" @@ -1610,355 +1370,249 @@ metadata: creationTimestamp: null labels: kubevirt.io: "" - name: offlinevirtualmachines.kubevirt.io + name: virtualmachines.kubevirt.io spec: group: kubevirt.io names: - kind: OfflineVirtualMachine - plural: offlinevirtualmachines + kind: VirtualMachine + plural: virtualmachines shortNames: - - ovm - - ovms - singular: offlinevirtualmachine + - vm + - vms + singular: virtualmachine scope: Namespaced validation: openAPIV3Schema: - description: OfflineVirtualMachine handles the VirtualMachines that are not - running or are in a stopped state The OfflineVirtualMachine contains the template - to create the VirtualMachine. It also mirrors the running state of the created - VirtualMachine in its 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' type: string kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds' type: string metadata: {} spec: - description: OfflineVirtualMachineSpec describes how the proper OfflineVirtualMachine - should look like properties: running: - description: Running controls whether the associatied VirtualMachine - is created or not type: boolean template: properties: metadata: {} spec: - description: VirtualMachineSpec is a description of a VirtualMachine. properties: affinity: - description: Affinity groups all the affinity rules related - to a VM properties: nodeAffinity: {} + podAffinity: {} + podAntiAffinity: {} domain: properties: clock: - description: Represents the clock and timers of a vm properties: timezone: - description: Timezone sets the guest clock to the specified - timezone. Zone name follows the TZ environment variable - format (e.g. 'America/New_York') type: string utc: - description: UTC sets the guest clock to UTC on each - boot. properties: offsetSeconds: - description: OffsetSeconds specifies an offset in - seconds, relative to UTC. If set, guest changes - to the clock will be kept during reboots and not - reset. format: int32 type: integer cpu: - description: CPU allow specifying the CPU topology properties: cores: - description: Cores specifies the number of cores inside - the vm. Must be a value greater or equal 1. format: int64 type: integer + model: + type: string devices: properties: disks: - description: Disks describes disks, cdroms, floppy and - luns which are connected to the vm items: properties: bootOrder: - description: BootOrder is an integer value > 0, - used to determine ordering of boot devices. - Lower values take precedence. Disks without - a boot order are not tried if a disk with a - boot order exists. format: int32 type: integer cdrom: properties: bus: - description: 'Bus indicates the type of disk - device to emulate. supported values: virtio, - sata, scsi, ide' type: string readonly: - description: ReadOnly Defaults to true type: boolean tray: - description: Tray indicates if the tray of - the device is open or closed. Allowed values - are "open" and "closed" Defaults to closed type: string disk: properties: bus: - description: 'Bus indicates the type of disk - device to emulate. supported values: virtio, - sata, scsi, ide' type: string readonly: - description: ReadOnly Defaults to false type: boolean floppy: properties: readonly: - description: ReadOnly Defaults to false type: boolean tray: - description: Tray indicates if the tray of - the device is open or closed. Allowed values - are "open" and "closed" Defaults to closed type: string lun: properties: bus: - description: 'Bus indicates the type of disk - device to emulate. supported values: virtio, - sata, scsi, ide' type: string readonly: - description: ReadOnly Defaults to false type: boolean name: - description: Name is the device name + type: string + serial: type: string volumeName: - description: Name of the volume which is referenced - Must match the Name of a Volume. type: string required: - name - volumeName type: array + interfaces: + items: + properties: + bridge: {} + macAddress: + type: string + model: + type: string + name: + type: string + ports: + items: + properties: + name: + type: string + port: + format: int32 + type: integer + protocol: + type: string + required: + - port + type: array + slirp: {} + required: + - name + type: array watchdog: - description: Named watchdog device properties: i6300esb: - description: i6300esb watchdog device properties: action: - description: The action to take. Valid values - are poweroff, reset, shutdown. Defaults to - reset type: string name: - description: Name of the watchdog type: string required: - name features: properties: acpi: - description: Represents if a feature is enabled or disabled properties: enabled: - description: Enabled determines if the feature should - be enabled or disabled on the guest Defaults to - true type: boolean apic: properties: enabled: - description: Enabled determines if the feature should - be enabled or disabled on the guest Defaults to - true type: boolean endOfInterrupt: - description: EndOfInterrupt enables the end of interrupt - notification in the guest Defaults to false type: boolean hyperv: - description: Hyperv specific features properties: relaxed: - description: Represents if a feature is enabled - or disabled properties: enabled: - description: Enabled determines if the feature - should be enabled or disabled on the guest - Defaults to true type: boolean reset: - description: Represents if a feature is enabled - or disabled properties: enabled: - description: Enabled determines if the feature - should be enabled or disabled on the guest - Defaults to true type: boolean runtime: - description: Represents if a feature is enabled - or disabled properties: enabled: - description: Enabled determines if the feature - should be enabled or disabled on the guest - Defaults to true type: boolean spinlocks: properties: enabled: - description: Enabled determines if the feature - should be enabled or disabled on the guest - Defaults to true type: boolean spinlocks: - description: Retries indicates the number of - retries Must be a value greater or equal 4096 - Defaults to 4096 format: int64 type: integer synic: - description: Represents if a feature is enabled - or disabled properties: enabled: - description: Enabled determines if the feature - should be enabled or disabled on the guest - Defaults to true type: boolean synictimer: - description: Represents if a feature is enabled - or disabled properties: enabled: - description: Enabled determines if the feature - should be enabled or disabled on the guest - Defaults to true type: boolean vapic: - description: Represents if a feature is enabled - or disabled properties: enabled: - description: Enabled determines if the feature - should be enabled or disabled on the guest - Defaults to true type: boolean vendorid: properties: enabled: - description: Enabled determines if the feature - should be enabled or disabled on the guest - Defaults to true type: boolean vendorid: - description: VendorID sets the hypervisor vendor - id, visible to the vm String up to twelve - characters type: string vpindex: - description: Represents if a feature is enabled - or disabled properties: enabled: - description: Enabled determines if the feature - should be enabled or disabled on the guest - Defaults to true type: boolean firmware: properties: uuid: - description: UUID reported by the vm bios Defaults to - a random generated uid type: string machine: properties: type: - description: QEMU machine type is the actual chipset - of the VM. type: string required: - type + memory: + properties: + hugepages: + properties: + pageSize: + type: string resources: properties: limits: - description: Limits describes the maximum amount of - compute resources allowed. Valid resource keys are - "memory" and "cpu". type: object requests: - description: Requests is a description of the initial - vm resources. Valid resource keys are "memory" and - "cpu". type: object required: - devices hostname: - description: Specifies the hostname of the vm If not specified, - the hostname will be set to the name of the vm, if dhcp or - cloud-init is configured properly. type: string + networks: + items: + properties: + name: + type: string + pod: + properties: + vmNetworkCIDR: + type: string + required: + - name + type: array nodeSelector: - description: 'NodeSelector is a selector which must be true - for the vm to fit on a node. Selector which must match a node''s - labels for the vm to be scheduled on that node. More info: - https://kubernetes.io/docs/concepts/configuration/assign-pod-node/' type: object subdomain: - description: If specified, the fully qualified vm hostname will - be "...svc.". - If not specified, the vm will not have a domainname at all. - The DNS entry will resolve to the vm, no matter if the vm - itself can pick up a hostname. type: string terminationGracePeriodSeconds: - description: Grace period observed after signalling a VM to - stop after which the VM is force terminated. format: int64 type: integer volumes: - description: List of volumes that can be mounted by disks belonging - to the vm. items: - description: Volume represents a named volume in a vm. properties: cloudInitNoCloud: - description: 'Represents a cloud-init nocloud user data - source More info: http://cloudinit.readthedocs.io/en/latest/topics/datasources/nocloud.html' properties: secretRef: {} userData: - description: UserData contains NoCloud inline cloud-init - userdata type: string userDataBase64: - description: UserDataBase64 contains NoCloud cloud-init - userdata as a base64 encoded string type: string emptyDisk: - description: EmptyDisk represents a temporary disk which - shares the vms lifecycle properties: capacity: {} required: @@ -1967,22 +1621,13 @@ spec: properties: persistentVolumeClaim: {} name: - description: 'Volume''s name. Must be a DNS_LABEL and - unique within the vm. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' type: string persistentVolumeClaim: {} registryDisk: - description: Represents a docker image with an embedded - disk properties: image: - description: Image is the name of the image with the - embedded disk type: string imagePullSecret: - description: ImagePullSecret is the name of the Docker - registry secret required to pull the image. The - secret must already exist. type: string required: - image @@ -1995,15 +1640,9 @@ spec: - running - template status: - description: OfflineVirtualMachineStatus represents the status returned - by the controller to describe how the OfflineVirtualMachine is doing properties: conditions: - description: Hold the state information of the OfflineVirtualMachine - and its VirtualMachine items: - description: OfflineVirtualMachineCondition represents the state of - OfflineVirtualMachine properties: lastProbeTime: {} lastTransitionTime: {} @@ -2020,16 +1659,12 @@ spec: - status type: array created: - description: Created indicates if the virtual machine is created in - the cluster type: boolean ready: - description: Ready indicates if the virtual machine is running and ready type: boolean - version: v1alpha1 + version: v1alpha2 status: acceptedNames: kind: "" plural: "" conditions: null - diff --git a/tests/sanity_test.go b/tests/sanity_test.go index 7151cad3a..984e8c1fc 100644 --- a/tests/sanity_test.go +++ b/tests/sanity_test.go @@ -2,6 +2,7 @@ package tests_test import ( "flag" + . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -17,25 +18,24 @@ var _ = Describe("Sanity", func() { virtClient, err := kubecli.GetKubevirtClient() tests.PanicOnError(err) - var vm *v1.VirtualMachine + var vmi *v1.VirtualMachineInstance BeforeEach(func() { tests.BeforeTestCleanup() - vm = tests.NewRandomVMWithEphemeralDisk(tests.RegistryDiskFor(tests.RegistryDiskAlpine)) + vmi = tests.NewRandomVMIWithEphemeralDisk(tests.RegistryDiskFor(tests.RegistryDiskAlpine)) }) Describe("Creating a VM", func() { It("should success", func() { - err := virtClient.RestClient().Post().Resource(tests.VmResource).Namespace(tests.NamespaceTestDefault).Body(vm).Do().Error() + _, err := virtClient.VirtualMachineInstance(tests.NamespaceTestDefault).Create(vmi) Expect(err).To(BeNil()) }) - It("should start it", func(done Done) { - obj, err := virtClient.RestClient().Post().Resource(tests.VmResource).Namespace(tests.NamespaceTestDefault).Body(vm).Do().Get() + It("should start it", func() { + vmi, err := virtClient.VirtualMachineInstance(tests.NamespaceTestDefault).Create(vmi) Expect(err).To(BeNil()) - tests.WaitForSuccessfulVMStart(obj) - - close(done) - }, 45) + + tests.WaitForSuccessfulVMIStart(vmi) + }) }) }) diff --git a/tests/tests_suite_test.go b/tests/tests_suite_test.go index 11539e5ca..a49c86179 100644 --- a/tests/tests_suite_test.go +++ b/tests/tests_suite_test.go @@ -5,7 +5,7 @@ import ( . "github.com/onsi/gomega" "testing" - + "kubevirt.io/kubevirt/tests" ) diff --git a/vars/README.md b/vars/README.md index 79b1f7954..cfbbee10a 100644 --- a/vars/README.md +++ b/vars/README.md @@ -7,5 +7,5 @@ List of top level variables. | cluster| openshift|
  • openshift
  • kubernetes
|Cluster type to deploy KubeVirt on.| | namespace|kube-system | |Namespace to create resources.| | kubevirt_openshift_version | 3.7|
  • 3.7
  • 3.9
|OpenShift cluster version.| -| version |0.6.0|
  • 0.6.0
  • 0.5.0
  • 0.4.1
  • 0.4.0
  • 0.3.0
  • 0.2.0
  • 0.1.0
|KubeVirt release version.| +| version |0.7.0|
  • 0.7.0
  • 0.6.0
  • 0.5.0
  • 0.4.1
  • 0.4.0
  • 0.3.0
  • 0.2.0
  • 0.1.0
|KubeVirt release version.| | storage_role | storage-none |
  • storage-none
  • storage-demo
  • storage-glusterfs
| Storage role to install with KubeVirt.| diff --git a/vars/all.yml b/vars/all.yml index e24d3efc3..bc31cdf19 100644 --- a/vars/all.yml +++ b/vars/all.yml @@ -8,7 +8,7 @@ openshift_ansible_dir: "openshift-ansible/" openshift_playbook_path: "{{ openshift_ansible_dir }}/{{ 'playbooks/byo/config.yml' if kubevirt_openshift_version == '3.7' else 'playbooks/deploy_cluster.yml' }}" ### KubeVirt ### -version: 0.6.0 +version: 0.7.0 ### Components ### storage_role: "storage-none" diff --git a/vendor/github.com/go-openapi/spec/.golangci.yml b/vendor/github.com/go-openapi/spec/.golangci.yml new file mode 100644 index 000000000..4029779e1 --- /dev/null +++ b/vendor/github.com/go-openapi/spec/.golangci.yml @@ -0,0 +1,19 @@ +linters-settings: + govet: + check-shadowing: true + golint: + min-confidence: 0 + gocyclo: + min-complexity: 25 + maligned: + suggest-new: true + dupl: + threshold: 100 + goconst: + min-len: 2 + min-occurrences: 2 + +linters: + enable-all: true + disable: + - maligned diff --git a/vendor/github.com/go-openapi/spec/.travis.yml b/vendor/github.com/go-openapi/spec/.travis.yml index ea80ef2a7..390aa8619 100644 --- a/vendor/github.com/go-openapi/spec/.travis.yml +++ b/vendor/github.com/go-openapi/spec/.travis.yml @@ -1,6 +1,8 @@ language: go go: - 1.7 +- 1.8 +- 1.9 install: - go get -u github.com/stretchr/testify - go get -u github.com/go-openapi/swag diff --git a/vendor/github.com/go-openapi/spec/README.md b/vendor/github.com/go-openapi/spec/README.md index 1d1622082..6354742cb 100644 --- a/vendor/github.com/go-openapi/spec/README.md +++ b/vendor/github.com/go-openapi/spec/README.md @@ -1,5 +1,10 @@ # OAI object model [![Build Status](https://travis-ci.org/go-openapi/spec.svg?branch=master)](https://travis-ci.org/go-openapi/spec) [![codecov](https://codecov.io/gh/go-openapi/spec/branch/master/graph/badge.svg)](https://codecov.io/gh/go-openapi/spec) [![Slack Status](https://slackin.goswagger.io/badge.svg)](https://slackin.goswagger.io) -[![license](http://img.shields.io/badge/license-Apache%20v2-orange.svg)](https://raw.githubusercontent.com/go-openapi/spec/master/LICENSE) [![GoDoc](https://godoc.org/github.com/go-openapi/spec?status.svg)](http://godoc.org/github.com/go-openapi/spec) +[![license](http://img.shields.io/badge/license-Apache%20v2-orange.svg)](https://raw.githubusercontent.com/go-openapi/spec/master/LICENSE) +[![GoDoc](https://godoc.org/github.com/go-openapi/spec?status.svg)](http://godoc.org/github.com/go-openapi/spec) +[![GolangCI](https://golangci.com/badges/github.com/go-openapi/spec.svg)](https://golangci.com) +[![Go Report Card](https://goreportcard.com/badge/github.com/go-openapi/spec)](https://goreportcard.com/report/github.com/go-openapi/spec) -The object model for OpenAPI specification documents +The object model for OpenAPI specification documents. + +Currently supports Swagger 2.0. diff --git a/vendor/github.com/go-openapi/spec/bindata.go b/vendor/github.com/go-openapi/spec/bindata.go index 693917a07..1717ea105 100644 --- a/vendor/github.com/go-openapi/spec/bindata.go +++ b/vendor/github.com/go-openapi/spec/bindata.go @@ -162,7 +162,7 @@ func AssetNames() []string { // _bindata is a table, holding each asset generator, mapped to its name. var _bindata = map[string]func() (*asset, error){ "jsonschema-draft-04.json": jsonschemaDraft04JSON, - "v2/schema.json": v2SchemaJSON, + "v2/schema.json": v2SchemaJSON, } // AssetDir returns the file names below a certain @@ -204,6 +204,7 @@ type bintree struct { Func func() (*asset, error) Children map[string]*bintree } + var _bintree = &bintree{nil, map[string]*bintree{ "jsonschema-draft-04.json": &bintree{jsonschemaDraft04JSON, map[string]*bintree{}}, "v2": &bintree{nil, map[string]*bintree{ @@ -257,4 +258,3 @@ func _filePath(dir, name string) string { cannonicalName := strings.Replace(name, "\\", "/", -1) return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...) } - diff --git a/vendor/github.com/go-openapi/spec/expander.go b/vendor/github.com/go-openapi/spec/expander.go index ad1529db5..98629a75e 100644 --- a/vendor/github.com/go-openapi/spec/expander.go +++ b/vendor/github.com/go-openapi/spec/expander.go @@ -59,6 +59,7 @@ func init() { resCache = initResolutionCache() } +// initResolutionCache initializes the URI resolution cache func initResolutionCache() ResolutionCache { return &simpleCache{store: map[string]interface{}{ "http://swagger.io/v2/schema.json": MustLoadSwagger20Schema(), @@ -66,6 +67,7 @@ func initResolutionCache() ResolutionCache { }} } +// Get retrieves a cached URI func (s *simpleCache) Get(uri string) (interface{}, bool) { debugLog("getting %q from resolution cache", uri) s.lock.Lock() @@ -76,6 +78,7 @@ func (s *simpleCache) Get(uri string) (interface{}, bool) { return v, ok } +// Set caches a URI func (s *simpleCache) Set(uri string, data interface{}) { s.lock.Lock() s.store[uri] = data @@ -116,19 +119,19 @@ func ResolveRef(root interface{}, ref *Ref) (*Schema, error) { case map[string]interface{}: b, _ := json.Marshal(sch) newSch := new(Schema) - json.Unmarshal(b, newSch) + _ = json.Unmarshal(b, newSch) return newSch, nil default: return nil, fmt.Errorf("unknown type for the resolved reference") } } -// ResolveParameter resolves a paramter reference against a context root +// ResolveParameter resolves a parameter reference against a context root func ResolveParameter(root interface{}, ref Ref) (*Parameter, error) { return ResolveParameterWithBase(root, ref, nil) } -// ResolveParameterWithBase resolves a paramter reference against a context root and base path +// ResolveParameterWithBase resolves a parameter reference against a context root and base path func ResolveParameterWithBase(root interface{}, ref Ref, opts *ExpandOptions) (*Parameter, error) { resolver, err := defaultSchemaLoader(root, opts, nil) if err != nil { @@ -400,7 +403,7 @@ func (r *schemaLoader) resolveRef(ref *Ref, target interface{}, basePath string) // it is pointing somewhere in the root. root := r.root if (ref.IsRoot() || ref.HasFragmentOnly) && root == nil && basePath != "" { - if baseRef, err := NewRef(basePath); err == nil { + if baseRef, erb := NewRef(basePath); erb == nil { root, _, _, _ = r.load(baseRef.GetURL()) } } @@ -829,7 +832,8 @@ func expandPathItem(pathItem *PathItem, resolver *schemaLoader, basePath string) } pathItem.Ref = Ref{} - parentRefs = parentRefs[0:] + // Currently unused: + //parentRefs = parentRefs[0:] for idx := range pathItem.Parameters { if err := expandParameter(&(pathItem.Parameters[idx]), resolver, basePath); shouldStopOnError(err, resolver.options) { diff --git a/vendor/github.com/go-openapi/spec/header.go b/vendor/github.com/go-openapi/spec/header.go index 85c4d454c..82f77f770 100644 --- a/vendor/github.com/go-openapi/spec/header.go +++ b/vendor/github.com/go-openapi/spec/header.go @@ -22,6 +22,7 @@ import ( "github.com/go-openapi/swag" ) +// HeaderProps describes a response header type HeaderProps struct { Description string `json:"description,omitempty"` } @@ -153,7 +154,7 @@ func (h Header) MarshalJSON() ([]byte, error) { return swag.ConcatJSON(b1, b2, b3), nil } -// UnmarshalJSON marshal this from JSON +// UnmarshalJSON unmarshals this header from JSON func (h *Header) UnmarshalJSON(data []byte) error { if err := json.Unmarshal(data, &h.CommonValidations); err != nil { return err @@ -164,32 +165,29 @@ func (h *Header) UnmarshalJSON(data []byte) error { if err := json.Unmarshal(data, &h.VendorExtensible); err != nil { return err } - if err := json.Unmarshal(data, &h.HeaderProps); err != nil { - return err - } - return nil + return json.Unmarshal(data, &h.HeaderProps) } // JSONLookup look up a value by the json property name -func (p Header) JSONLookup(token string) (interface{}, error) { - if ex, ok := p.Extensions[token]; ok { +func (h Header) JSONLookup(token string) (interface{}, error) { + if ex, ok := h.Extensions[token]; ok { return &ex, nil } - r, _, err := jsonpointer.GetForToken(p.CommonValidations, token) + r, _, err := jsonpointer.GetForToken(h.CommonValidations, token) if err != nil && !strings.HasPrefix(err.Error(), "object has no field") { return nil, err } if r != nil { return r, nil } - r, _, err = jsonpointer.GetForToken(p.SimpleSchema, token) + r, _, err = jsonpointer.GetForToken(h.SimpleSchema, token) if err != nil && !strings.HasPrefix(err.Error(), "object has no field") { return nil, err } if r != nil { return r, nil } - r, _, err = jsonpointer.GetForToken(p.HeaderProps, token) + r, _, err = jsonpointer.GetForToken(h.HeaderProps, token) return r, err } diff --git a/vendor/github.com/go-openapi/spec/info.go b/vendor/github.com/go-openapi/spec/info.go index fb8b7c4ac..cfb37ec12 100644 --- a/vendor/github.com/go-openapi/spec/info.go +++ b/vendor/github.com/go-openapi/spec/info.go @@ -52,14 +52,14 @@ func (e Extensions) GetBool(key string) (bool, bool) { // GetStringSlice gets a string value from the extensions func (e Extensions) GetStringSlice(key string) ([]string, bool) { if v, ok := e[strings.ToLower(key)]; ok { - arr, ok := v.([]interface{}) - if !ok { + arr, isSlice := v.([]interface{}) + if !isSlice { return nil, false } var strs []string for _, iface := range arr { - str, ok := iface.(string) - if !ok { + str, isString := iface.(string) + if !isString { return nil, false } strs = append(strs, str) diff --git a/vendor/github.com/go-openapi/spec/items.go b/vendor/github.com/go-openapi/spec/items.go index 492423ef7..cf4298971 100644 --- a/vendor/github.com/go-openapi/spec/items.go +++ b/vendor/github.com/go-openapi/spec/items.go @@ -22,6 +22,7 @@ import ( "github.com/go-openapi/swag" ) +// SimpleSchema describe swagger simple schemas for parameters and headers type SimpleSchema struct { Type string `json:"type,omitempty"` Format string `json:"format,omitempty"` @@ -31,6 +32,7 @@ type SimpleSchema struct { Example interface{} `json:"example,omitempty"` } +// TypeName return the type (or format) of a simple schema func (s *SimpleSchema) TypeName() string { if s.Format != "" { return s.Format @@ -38,6 +40,7 @@ func (s *SimpleSchema) TypeName() string { return s.Type } +// ItemsTypeName yields the type of items in a simple schema array func (s *SimpleSchema) ItemsTypeName() string { if s.Items == nil { return "" @@ -45,6 +48,7 @@ func (s *SimpleSchema) ItemsTypeName() string { return s.Items.TypeName() } +// CommonValidations describe common JSON-schema validations type CommonValidations struct { Maximum *float64 `json:"maximum,omitempty"` ExclusiveMaximum bool `json:"exclusiveMaximum,omitempty"` @@ -212,18 +216,18 @@ func (i Items) MarshalJSON() ([]byte, error) { } // JSONLookup look up a value by the json property name -func (p Items) JSONLookup(token string) (interface{}, error) { +func (i Items) JSONLookup(token string) (interface{}, error) { if token == "$ref" { - return &p.Ref, nil + return &i.Ref, nil } - r, _, err := jsonpointer.GetForToken(p.CommonValidations, token) + r, _, err := jsonpointer.GetForToken(i.CommonValidations, token) if err != nil && !strings.HasPrefix(err.Error(), "object has no field") { return nil, err } if r != nil { return r, nil } - r, _, err = jsonpointer.GetForToken(p.SimpleSchema, token) + r, _, err = jsonpointer.GetForToken(i.SimpleSchema, token) return r, err } diff --git a/vendor/github.com/go-openapi/spec/operation.go b/vendor/github.com/go-openapi/spec/operation.go index e698f9e8a..32f7d8fe7 100644 --- a/vendor/github.com/go-openapi/spec/operation.go +++ b/vendor/github.com/go-openapi/spec/operation.go @@ -21,6 +21,7 @@ import ( "github.com/go-openapi/swag" ) +// OperationProps describes an operation type OperationProps struct { Description string `json:"description,omitempty"` Consumes []string `json:"consumes,omitempty"` @@ -38,9 +39,9 @@ type OperationProps struct { // MarshalJSON takes care of serializing operation properties to JSON // -// We use a custom marhaller here to handle a special cases related +// We use a custom marhaller here to handle a special cases related to // the Security field. We need to preserve zero length slice -// while omiting the field when the value is nil/unset. +// while omitting the field when the value is nil/unset. func (op OperationProps) MarshalJSON() ([]byte, error) { type Alias OperationProps if op.Security == nil { diff --git a/vendor/github.com/go-openapi/spec/parameter.go b/vendor/github.com/go-openapi/spec/parameter.go index 71aee1e80..cb1a88d25 100644 --- a/vendor/github.com/go-openapi/spec/parameter.go +++ b/vendor/github.com/go-openapi/spec/parameter.go @@ -64,6 +64,7 @@ func ParamRef(uri string) *Parameter { return p } +// ParamProps describes the specific attributes of an operation parameter type ParamProps struct { Description string `json:"description,omitempty"` Name string `json:"name,omitempty"` diff --git a/vendor/github.com/go-openapi/spec/path_item.go b/vendor/github.com/go-openapi/spec/path_item.go index 9ab3ec538..a8ae63ece 100644 --- a/vendor/github.com/go-openapi/spec/path_item.go +++ b/vendor/github.com/go-openapi/spec/path_item.go @@ -21,7 +21,7 @@ import ( "github.com/go-openapi/swag" ) -// pathItemProps the path item specific properties +// PathItemProps the path item specific properties type PathItemProps struct { Get *Operation `json:"get,omitempty"` Put *Operation `json:"put,omitempty"` diff --git a/vendor/github.com/go-openapi/spec/response.go b/vendor/github.com/go-openapi/spec/response.go index a32b039ea..586db0d78 100644 --- a/vendor/github.com/go-openapi/spec/response.go +++ b/vendor/github.com/go-openapi/spec/response.go @@ -39,15 +39,15 @@ type Response struct { } // JSONLookup look up a value by the json property name -func (p Response) JSONLookup(token string) (interface{}, error) { - if ex, ok := p.Extensions[token]; ok { +func (r Response) JSONLookup(token string) (interface{}, error) { + if ex, ok := r.Extensions[token]; ok { return &ex, nil } if token == "$ref" { - return &p.Ref, nil + return &r.Ref, nil } - r, _, err := jsonpointer.GetForToken(p.ResponseProps, token) - return r, err + ptr, _, err := jsonpointer.GetForToken(r.ResponseProps, token) + return ptr, err } // UnmarshalJSON hydrates this items instance with the data from JSON diff --git a/vendor/github.com/go-openapi/spec/responses.go b/vendor/github.com/go-openapi/spec/responses.go index 3ab06697f..4efb6f868 100644 --- a/vendor/github.com/go-openapi/spec/responses.go +++ b/vendor/github.com/go-openapi/spec/responses.go @@ -85,11 +85,15 @@ func (r Responses) MarshalJSON() ([]byte, error) { return concated, nil } +// ResponsesProps describes all responses for an operation. +// It tells what is the default response and maps all responses with a +// HTTP status code. type ResponsesProps struct { Default *Response StatusCodeResponses map[int]Response } +// MarshalJSON marshals responses as JSON func (r ResponsesProps) MarshalJSON() ([]byte, error) { toser := map[string]Response{} if r.Default != nil { @@ -101,6 +105,7 @@ func (r ResponsesProps) MarshalJSON() ([]byte, error) { return json.Marshal(toser) } +// UnmarshalJSON unmarshals responses from JSON func (r *ResponsesProps) UnmarshalJSON(data []byte) error { var res map[string]Response if err := json.Unmarshal(data, &res); err != nil { diff --git a/vendor/github.com/go-openapi/spec/schema.go b/vendor/github.com/go-openapi/spec/schema.go index 05c1a4aa0..b9481e29b 100644 --- a/vendor/github.com/go-openapi/spec/schema.go +++ b/vendor/github.com/go-openapi/spec/schema.go @@ -203,6 +203,7 @@ func (r *SchemaURL) fromMap(v map[string]interface{}) error { // return nil // } +// SchemaProps describes a JSON schema (draft 4) type SchemaProps struct { ID string `json:"id,omitempty"` Ref Ref `json:"-"` @@ -240,6 +241,7 @@ type SchemaProps struct { Definitions Definitions `json:"definitions,omitempty"` } +// SwaggerSchemaProps are additional properties supported by swagger schemas, but not JSON-schema (draft 4) type SwaggerSchemaProps struct { Discriminator string `json:"discriminator,omitempty"` ReadOnly bool `json:"readOnly,omitempty"` @@ -604,8 +606,8 @@ func (s *Schema) UnmarshalJSON(data []byte) error { return err } - sch.Ref.fromMap(d) - sch.Schema.fromMap(d) + _ = sch.Ref.fromMap(d) + _ = sch.Schema.fromMap(d) delete(d, "$ref") delete(d, "$schema") diff --git a/vendor/github.com/go-openapi/spec/security_scheme.go b/vendor/github.com/go-openapi/spec/security_scheme.go index 22d4f10af..9f1b454ea 100644 --- a/vendor/github.com/go-openapi/spec/security_scheme.go +++ b/vendor/github.com/go-openapi/spec/security_scheme.go @@ -78,6 +78,7 @@ func OAuth2AccessToken(authorizationURL, tokenURL string) *SecurityScheme { }} } +// SecuritySchemeProps describes a swagger security scheme in the securityDefinitions section type SecuritySchemeProps struct { Description string `json:"description,omitempty"` Type string `json:"type"` diff --git a/vendor/github.com/go-openapi/spec/swagger.go b/vendor/github.com/go-openapi/spec/swagger.go index 23780c78a..4586a21c8 100644 --- a/vendor/github.com/go-openapi/spec/swagger.go +++ b/vendor/github.com/go-openapi/spec/swagger.go @@ -67,6 +67,7 @@ func (s *Swagger) UnmarshalJSON(data []byte) error { return nil } +// SwaggerProps captures the top-level properties of an Api specification type SwaggerProps struct { ID string `json:"id,omitempty"` Consumes []string `json:"consumes,omitempty"` diff --git a/vendor/github.com/go-openapi/spec/tag.go b/vendor/github.com/go-openapi/spec/tag.go index 97f555840..25256c4be 100644 --- a/vendor/github.com/go-openapi/spec/tag.go +++ b/vendor/github.com/go-openapi/spec/tag.go @@ -21,6 +21,7 @@ import ( "github.com/go-openapi/swag" ) +// TagProps describe a tag entry in the top level tags section of a swagger spec type TagProps struct { Description string `json:"description,omitempty"` Name string `json:"name,omitempty"` diff --git a/vendor/github.com/go-openapi/swag/.golangci.yml b/vendor/github.com/go-openapi/swag/.golangci.yml new file mode 100644 index 000000000..4029779e1 --- /dev/null +++ b/vendor/github.com/go-openapi/swag/.golangci.yml @@ -0,0 +1,19 @@ +linters-settings: + govet: + check-shadowing: true + golint: + min-confidence: 0 + gocyclo: + min-complexity: 25 + maligned: + suggest-new: true + dupl: + threshold: 100 + goconst: + min-len: 2 + min-occurrences: 2 + +linters: + enable-all: true + disable: + - maligned diff --git a/vendor/github.com/go-openapi/swag/.travis.yml b/vendor/github.com/go-openapi/swag/.travis.yml index 24c69bdf3..c41437b7a 100644 --- a/vendor/github.com/go-openapi/swag/.travis.yml +++ b/vendor/github.com/go-openapi/swag/.travis.yml @@ -1,6 +1,8 @@ language: go go: - 1.8 +- 1.9.x +- 1.10.x install: - go get -u github.com/stretchr/testify - go get -u github.com/mailru/easyjson diff --git a/vendor/github.com/go-openapi/swag/README.md b/vendor/github.com/go-openapi/swag/README.md index 5d43728e8..90f5c9b7c 100644 --- a/vendor/github.com/go-openapi/swag/README.md +++ b/vendor/github.com/go-openapi/swag/README.md @@ -1,6 +1,9 @@ # Swag [![Build Status](https://travis-ci.org/go-openapi/swag.svg?branch=master)](https://travis-ci.org/go-openapi/swag) [![codecov](https://codecov.io/gh/go-openapi/swag/branch/master/graph/badge.svg)](https://codecov.io/gh/go-openapi/swag) [![Slack Status](https://slackin.goswagger.io/badge.svg)](https://slackin.goswagger.io) -[![license](http://img.shields.io/badge/license-Apache%20v2-orange.svg)](https://raw.githubusercontent.com/go-openapi/swag/master/LICENSE) [![GoDoc](https://godoc.org/github.com/go-openapi/swag?status.svg)](http://godoc.org/github.com/go-openapi/swag) +[![license](http://img.shields.io/badge/license-Apache%20v2-orange.svg)](https://raw.githubusercontent.com/go-openapi/swag/master/LICENSE) +[![GoDoc](https://godoc.org/github.com/go-openapi/swag?status.svg)](http://godoc.org/github.com/go-openapi/swag) +[![GolangCI](https://golangci.com/badges/github.com/go-openapi/swag.svg)](https://golangci.com) +[![Go Report Card](https://goreportcard.com/badge/github.com/go-openapi/swag)](https://goreportcard.com/report/github.com/go-openapi/swag) Contains a bunch of helper functions: @@ -9,4 +12,4 @@ Contains a bunch of helper functions: * fast json concatenation * search in path * load from file or http -* name manglin \ No newline at end of file +* name mangling diff --git a/vendor/github.com/go-openapi/swag/convert.go b/vendor/github.com/go-openapi/swag/convert.go index 2bf5ecbba..ba269122a 100644 --- a/vendor/github.com/go-openapi/swag/convert.go +++ b/vendor/github.com/go-openapi/swag/convert.go @@ -36,16 +36,16 @@ func IsFloat64AJSONInteger(f float64) bool { } var evaluatesAsTrue = map[string]struct{}{ - "true": struct{}{}, - "1": struct{}{}, - "yes": struct{}{}, - "ok": struct{}{}, - "y": struct{}{}, - "on": struct{}{}, - "selected": struct{}{}, - "checked": struct{}{}, - "t": struct{}{}, - "enabled": struct{}{}, + "true": {}, + "1": {}, + "yes": {}, + "ok": {}, + "y": {}, + "on": {}, + "selected": {}, + "checked": {}, + "t": {}, + "enabled": {}, } // ConvertBool turn a string into a boolean diff --git a/vendor/github.com/go-openapi/swag/json.go b/vendor/github.com/go-openapi/swag/json.go index 274331ef1..60e55ecd3 100644 --- a/vendor/github.com/go-openapi/swag/json.go +++ b/vendor/github.com/go-openapi/swag/json.go @@ -21,6 +21,7 @@ import ( "reflect" "strings" "sync" + "sync/atomic" "github.com/mailru/easyjson/jlexer" "github.com/mailru/easyjson/jwriter" @@ -34,9 +35,14 @@ var DefaultJSONNameProvider = NewNameProvider() const comma = byte(',') -var closers = map[byte]byte{ - '{': '}', - '[': ']', +var atomicClosers atomic.Value + +func init() { + atomicClosers.Store( + map[byte]byte{ + '{': '}', + '[': ']', + }) } type ejMarshaler interface { @@ -82,10 +88,7 @@ func DynamicJSONToStruct(data interface{}, target interface{}) error { if err != nil { return err } - if err := ReadJSON(b, target); err != nil { - return err - } - return nil + return ReadJSON(b, target) } // ConcatJSON concatenates multiple json objects efficiently @@ -110,6 +113,7 @@ func ConcatJSON(blobs ...[]byte) []byte { var opening, closing byte var idx, a int buf := bytes.NewBuffer(nil) + closers := atomicClosers.Load().(map[byte]byte) for i, b := range blobs[:last+1] { if b == nil || bytes.Equal(b, nullJSON) { diff --git a/vendor/github.com/go-openapi/swag/post_go19.go b/vendor/github.com/go-openapi/swag/post_go19.go new file mode 100644 index 000000000..567680c79 --- /dev/null +++ b/vendor/github.com/go-openapi/swag/post_go19.go @@ -0,0 +1,53 @@ +// +build go1.9 + +package swag + +import ( + "sort" + "sync" +) + +// indexOfInitialisms is a thread-safe implementation of the sorted index of initialisms. +// Since go1.9, this may be implemented with sync.Map. +type indexOfInitialisms struct { + sortMutex *sync.Mutex + index *sync.Map +} + +func newIndexOfInitialisms() *indexOfInitialisms { + return &indexOfInitialisms{ + sortMutex: new(sync.Mutex), + index: new(sync.Map), + } +} + +func (m *indexOfInitialisms) load(initial map[string]bool) *indexOfInitialisms { + m.sortMutex.Lock() + defer m.sortMutex.Unlock() + for k, v := range initial { + m.index.Store(k, v) + } + return m +} + +func (m *indexOfInitialisms) isInitialism(key string) bool { + _, ok := m.index.Load(key) + return ok +} + +func (m *indexOfInitialisms) add(key string) *indexOfInitialisms { + m.index.Store(key, true) + return m +} + +func (m *indexOfInitialisms) sorted() (result []string) { + m.sortMutex.Lock() + defer m.sortMutex.Unlock() + m.index.Range(func(key, value interface{}) bool { + k := key.(string) + result = append(result, k) + return true + }) + sort.Sort(sort.Reverse(byLength(result))) + return +} diff --git a/vendor/github.com/go-openapi/swag/pre_go19.go b/vendor/github.com/go-openapi/swag/pre_go19.go new file mode 100644 index 000000000..72c48ae75 --- /dev/null +++ b/vendor/github.com/go-openapi/swag/pre_go19.go @@ -0,0 +1,55 @@ +// +build !go1.9 + +package swag + +import ( + "sort" + "sync" +) + +// indexOfInitialisms is a thread-safe implementation of the sorted index of initialisms. +// Before go1.9, this may be implemented with a mutex on the map. +type indexOfInitialisms struct { + getMutex *sync.Mutex + index map[string]bool +} + +func newIndexOfInitialisms() *indexOfInitialisms { + return &indexOfInitialisms{ + getMutex: new(sync.Mutex), + index: make(map[string]bool, 50), + } +} + +func (m *indexOfInitialisms) load(initial map[string]bool) *indexOfInitialisms { + m.getMutex.Lock() + defer m.getMutex.Unlock() + for k, v := range initial { + m.index[k] = v + } + return m +} + +func (m *indexOfInitialisms) isInitialism(key string) bool { + m.getMutex.Lock() + defer m.getMutex.Unlock() + _, ok := m.index[key] + return ok +} + +func (m *indexOfInitialisms) add(key string) *indexOfInitialisms { + m.getMutex.Lock() + defer m.getMutex.Unlock() + m.index[key] = true + return m +} + +func (m *indexOfInitialisms) sorted() (result []string) { + m.getMutex.Lock() + defer m.getMutex.Unlock() + for k := range m.index { + result = append(result, k) + } + sort.Sort(sort.Reverse(byLength(result))) + return +} diff --git a/vendor/github.com/go-openapi/swag/util.go b/vendor/github.com/go-openapi/swag/util.go index 7e0f80a41..6eba19c5c 100644 --- a/vendor/github.com/go-openapi/swag/util.go +++ b/vendor/github.com/go-openapi/swag/util.go @@ -18,63 +18,74 @@ import ( "math" "reflect" "regexp" - "sort" "strings" "sync" "unicode" ) -// Taken from https://github.com/golang/lint/blob/3390df4df2787994aea98de825b964ac7944b817/lint.go#L732-L769 -var commonInitialisms = map[string]bool{ - "ACL": true, - "API": true, - "ASCII": true, - "CPU": true, - "CSS": true, - "DNS": true, - "EOF": true, - "GUID": true, - "HTML": true, - "HTTPS": true, - "HTTP": true, - "ID": true, - "IP": true, - "JSON": true, - "LHS": true, - "OAI": true, - "QPS": true, - "RAM": true, - "RHS": true, - "RPC": true, - "SLA": true, - "SMTP": true, - "SQL": true, - "SSH": true, - "TCP": true, - "TLS": true, - "TTL": true, - "UDP": true, - "UI": true, - "UID": true, - "UUID": true, - "URI": true, - "URL": true, - "UTF8": true, - "VM": true, - "XML": true, - "XMPP": true, - "XSRF": true, - "XSS": true, -} +// commonInitialisms are common acronyms that are kept as whole uppercased words. +var commonInitialisms *indexOfInitialisms + +// initialisms is a slice of sorted initialisms var initialisms []string var once sync.Once -func sortInitialisms() { - for k := range commonInitialisms { - initialisms = append(initialisms, k) +var isInitialism func(string) bool + +func init() { + // Taken from https://github.com/golang/lint/blob/3390df4df2787994aea98de825b964ac7944b817/lint.go#L732-L769 + var configuredInitialisms = map[string]bool{ + "ACL": true, + "API": true, + "ASCII": true, + "CPU": true, + "CSS": true, + "DNS": true, + "EOF": true, + "GUID": true, + "HTML": true, + "HTTPS": true, + "HTTP": true, + "ID": true, + "IP": true, + "JSON": true, + "LHS": true, + "OAI": true, + "QPS": true, + "RAM": true, + "RHS": true, + "RPC": true, + "SLA": true, + "SMTP": true, + "SQL": true, + "SSH": true, + "TCP": true, + "TLS": true, + "TTL": true, + "UDP": true, + "UI": true, + "UID": true, + "UUID": true, + "URI": true, + "URL": true, + "UTF8": true, + "VM": true, + "XML": true, + "XMPP": true, + "XSRF": true, + "XSS": true, } - sort.Sort(sort.Reverse(byLength(initialisms))) + + // a thread-safe index of initialisms + commonInitialisms = newIndexOfInitialisms().load(configuredInitialisms) + + // a test function + isInitialism = commonInitialisms.isInitialism +} + +func ensureSorted() { + initialisms = commonInitialisms.sorted() } // JoinByFormat joins a string array by a known format: @@ -169,7 +180,7 @@ func split(str string) (words []string) { str = rex1.ReplaceAllString(str, " $1") // check if consecutive single char things make up an initialism - once.Do(sortInitialisms) + once.Do(ensureSorted) for _, k := range initialisms { str = strings.Replace(str, rex1.ReplaceAllString(k, " $1"), " "+k, -1) } @@ -230,7 +241,7 @@ func ToCommandName(name string) string { func ToHumanNameLower(name string) string { var out []string for _, w := range split(name) { - if !commonInitialisms[upper(w)] { + if !isInitialism(upper(w)) { out = append(out, lower(w)) } else { out = append(out, w) @@ -244,7 +255,7 @@ func ToHumanNameTitle(name string) string { var out []string for _, w := range split(name) { uw := upper(w) - if !commonInitialisms[uw] { + if !isInitialism(uw) { out = append(out, upper(w[:1])+lower(w[1:])) } else { out = append(out, w) @@ -269,7 +280,7 @@ func ToJSONName(name string) string { // ToVarName camelcases a name which can be underscored or pascal cased func ToVarName(name string) string { res := ToGoName(name) - if _, ok := commonInitialisms[res]; ok { + if isInitialism(res) { return lower(res) } if len(res) <= 1 { @@ -284,7 +295,7 @@ func ToGoName(name string) string { for _, w := range split(name) { uw := upper(w) mod := int(math.Min(float64(len(uw)), 2)) - if !commonInitialisms[uw] && !commonInitialisms[uw[:len(uw)-mod]] { + if !isInitialism(uw) && !isInitialism(uw[:len(uw)-mod]) { uw = upper(w[:1]) + lower(w[1:]) } out = append(out, uw) @@ -350,8 +361,11 @@ func IsZero(data interface{}) bool { // AddInitialisms add additional initialisms func AddInitialisms(words ...string) { for _, word := range words { - commonInitialisms[upper(word)] = true + //commonInitialisms[upper(word)] = true + commonInitialisms.add(upper(word)) } + // sort again + initialisms = commonInitialisms.sorted() } // CommandLineOptionsGroup represents a group of user-defined command line options diff --git a/vendor/github.com/go-openapi/swag/yaml.go b/vendor/github.com/go-openapi/swag/yaml.go index e2eff7568..f458c81a8 100644 --- a/vendor/github.com/go-openapi/swag/yaml.go +++ b/vendor/github.com/go-openapi/swag/yaml.go @@ -56,14 +56,17 @@ func BytesToYAMLDoc(data []byte) (interface{}, error) { return document, nil } +// JSONMapSlice represent a JSON object, with the order of keys maintained type JSONMapSlice []JSONMapItem +// MarshalJSON renders a JSONMapSlice as JSON func (s JSONMapSlice) MarshalJSON() ([]byte, error) { w := &jwriter.Writer{Flags: jwriter.NilMapAsEmpty | jwriter.NilSliceAsEmpty} s.MarshalEasyJSON(w) return w.BuildBytes() } +// MarshalEasyJSON renders a JSONMapSlice as JSON, using easyJSON func (s JSONMapSlice) MarshalEasyJSON(w *jwriter.Writer) { w.RawByte('{') @@ -79,11 +82,14 @@ func (s JSONMapSlice) MarshalEasyJSON(w *jwriter.Writer) { w.RawByte('}') } +// UnmarshalJSON makes a JSONMapSlice from JSON func (s *JSONMapSlice) UnmarshalJSON(data []byte) error { l := jlexer.Lexer{Data: data} s.UnmarshalEasyJSON(&l) return l.Error() } + +// UnmarshalEasyJSON makes a JSONMapSlice from JSON, using easyJSON func (s *JSONMapSlice) UnmarshalEasyJSON(in *jlexer.Lexer) { if in.IsNull() { in.Skip() @@ -100,23 +106,34 @@ func (s *JSONMapSlice) UnmarshalEasyJSON(in *jlexer.Lexer) { *s = result } +// JSONMapItem represents the value of a key in a JSON object held by JSONMapSlice type JSONMapItem struct { Key string Value interface{} } +// MarshalJSON renders a JSONMapItem as JSON func (s JSONMapItem) MarshalJSON() ([]byte, error) { w := &jwriter.Writer{Flags: jwriter.NilMapAsEmpty | jwriter.NilSliceAsEmpty} s.MarshalEasyJSON(w) return w.BuildBytes() } +// MarshalEasyJSON renders a JSONMapItem as JSON, using easyJSON func (s JSONMapItem) MarshalEasyJSON(w *jwriter.Writer) { w.String(s.Key) w.RawByte(':') w.Raw(WriteJSON(s.Value)) } +// UnmarshalJSON makes a JSONMapItem from JSON +func (s *JSONMapItem) UnmarshalJSON(data []byte) error { + l := jlexer.Lexer{Data: data} + s.UnmarshalEasyJSON(&l) + return l.Error() +} + +// UnmarshalEasyJSON makes a JSONMapItem from JSON, using easyJSON func (s *JSONMapItem) UnmarshalEasyJSON(in *jlexer.Lexer) { key := in.UnsafeString() in.WantColon() @@ -125,11 +142,6 @@ func (s *JSONMapItem) UnmarshalEasyJSON(in *jlexer.Lexer) { s.Key = key s.Value = value } -func (s *JSONMapItem) UnmarshalJSON(data []byte) error { - l := jlexer.Lexer{Data: data} - s.UnmarshalEasyJSON(&l) - return l.Error() -} func transformData(input interface{}) (out interface{}, err error) { switch in := input.(type) { @@ -147,9 +159,9 @@ func transformData(input interface{}) (out interface{}, err error) { return nil, fmt.Errorf("types don't match expect map key string or int got: %T", mi.Key) } - v, err := transformData(mi.Value) - if err != nil { - return nil, err + v, ert := transformData(mi.Value) + if ert != nil { + return nil, ert } nmi.Value = v o[i] = nmi @@ -168,9 +180,9 @@ func transformData(input interface{}) (out interface{}, err error) { return nil, fmt.Errorf("types don't match expect map key string or int got: %T", ke) } - v, err := transformData(va) - if err != nil { - return nil, err + v, ert := transformData(va) + if ert != nil { + return nil, ert } nmi.Value = v o = append(o, nmi) @@ -202,7 +214,7 @@ func YAMLDoc(path string) (json.RawMessage, error) { return nil, err } - return json.RawMessage(data), nil + return data, nil } // YAMLData loads a yaml document from either http or a file diff --git a/vendor/github.com/golang/mock/mockgen/reflect.go b/vendor/github.com/golang/mock/mockgen/reflect.go index 915f1331a..b80f97ffc 100644 --- a/vendor/github.com/golang/mock/mockgen/reflect.go +++ b/vendor/github.com/golang/mock/mockgen/reflect.go @@ -49,22 +49,38 @@ func writeProgram(importPath string, symbols []string) ([]byte, error) { return program.Bytes(), nil } -// run the given command and parse the output as a model.Package. -func run(command string) (*model.Package, error) { +// run the given program and parse the output as a model.Package. +func run(program string) (*model.Package, error) { + f, err := ioutil.TempFile("", "") + filename := f.Name() + defer os.Remove(filename) + if err := f.Close(); err != nil { + return nil, err + } + // Run the program. - cmd := exec.Command(command) - var stdout bytes.Buffer - cmd.Stdout = &stdout + cmd := exec.Command(program, "-output", filename) + cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr if err := cmd.Run(); err != nil { return nil, err } + f, err = os.Open(filename) + if err != nil { + return nil, err + } + // Process output. var pkg model.Package - if err := gob.NewDecoder(&stdout).Decode(&pkg); err != nil { + if err := gob.NewDecoder(f).Decode(&pkg); err != nil { + return nil, err + } + + if err := f.Close(); err != nil { return nil, err } + return &pkg, nil } @@ -154,6 +170,7 @@ package main import ( "encoding/gob" + "flag" "fmt" "os" "path" @@ -164,7 +181,11 @@ import ( pkg_ {{printf "%q" .ImportPath}} ) +var output = flag.String("output", "", "The output file name, or empty to use stdout.") + func main() { + flag.Parse() + its := []struct{ sym string typ reflect.Type @@ -189,7 +210,23 @@ func main() { intf.Name = it.sym pkg.Interfaces = append(pkg.Interfaces, intf) } - if err := gob.NewEncoder(os.Stdout).Encode(pkg); err != nil { + + outfile := os.Stdout + if len(*output) != 0 { + var err error + outfile, err = os.Create(*output) + if err != nil { + fmt.Fprintf(os.Stderr, "failed to open output file %q", *output) + } + defer func() { + if err := outfile.Close(); err != nil { + fmt.Fprintf(os.Stderr, "failed to close output file %q", *output) + os.Exit(1) + } + }() + } + + if err := gob.NewEncoder(outfile).Encode(pkg); err != nil { fmt.Fprintf(os.Stderr, "gob encode: %v\n", err) os.Exit(1) } diff --git a/vendor/github.com/golang/protobuf/.gitignore b/vendor/github.com/golang/protobuf/.gitignore index 8f5b596b1..c7dd40587 100644 --- a/vendor/github.com/golang/protobuf/.gitignore +++ b/vendor/github.com/golang/protobuf/.gitignore @@ -12,5 +12,6 @@ core _obj _test _testmain.go -protoc-gen-go/testdata/multi/*.pb.go -_conformance/_conformance + +# Conformance test output and transient files. +conformance/failing_tests.txt diff --git a/vendor/github.com/golang/protobuf/.travis.yml b/vendor/github.com/golang/protobuf/.travis.yml index 93c67805b..455fa660c 100644 --- a/vendor/github.com/golang/protobuf/.travis.yml +++ b/vendor/github.com/golang/protobuf/.travis.yml @@ -2,17 +2,29 @@ sudo: false language: go go: - 1.6.x -- 1.7.x -- 1.8.x -- 1.9.x +- 1.10.x +- 1.x install: - go get -v -d -t github.com/golang/protobuf/... - - curl -L https://github.com/google/protobuf/releases/download/v3.3.0/protoc-3.3.0-linux-x86_64.zip -o /tmp/protoc.zip - - unzip /tmp/protoc.zip -d $HOME/protoc + - curl -L https://github.com/google/protobuf/releases/download/v3.5.1/protoc-3.5.1-linux-x86_64.zip -o /tmp/protoc.zip + - unzip /tmp/protoc.zip -d "$HOME"/protoc + - mkdir -p "$HOME"/src && ln -s "$HOME"/protoc "$HOME"/src/protobuf env: - PATH=$HOME/protoc/bin:$PATH script: - - make all test + - make all + - make regenerate + # TODO(tamird): When https://github.com/travis-ci/gimme/pull/130 is + # released, make this look for "1.x". + - if [[ "$TRAVIS_GO_VERSION" == 1.10* ]]; then + if [[ "$(git status --porcelain 2>&1)" != "" ]]; then + git status >&2; + git diff -a >&2; + exit 1; + fi; + echo "git status is clean."; + fi; + - make test diff --git a/vendor/github.com/golang/protobuf/Make.protobuf b/vendor/github.com/golang/protobuf/Make.protobuf deleted file mode 100644 index 15071de10..000000000 --- a/vendor/github.com/golang/protobuf/Make.protobuf +++ /dev/null @@ -1,40 +0,0 @@ -# Go support for Protocol Buffers - Google's data interchange format -# -# Copyright 2010 The Go Authors. All rights reserved. -# https://github.com/golang/protobuf -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -# Includable Makefile to add a rule for generating .pb.go files from .proto files -# (Google protocol buffer descriptions). -# Typical use if myproto.proto is a file in package mypackage in this directory: -# -# include $(GOROOT)/src/pkg/github.com/golang/protobuf/Make.protobuf - -%.pb.go: %.proto - protoc --go_out=. $< - diff --git a/vendor/github.com/golang/protobuf/Makefile b/vendor/github.com/golang/protobuf/Makefile index a1421d8b7..2bc2621aa 100644 --- a/vendor/github.com/golang/protobuf/Makefile +++ b/vendor/github.com/golang/protobuf/Makefile @@ -29,16 +29,14 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - all: install install: - go install ./proto ./jsonpb ./ptypes - go install ./protoc-gen-go + go install ./proto ./jsonpb ./ptypes ./protoc-gen-go test: - go test ./proto ./jsonpb ./ptypes - make -C protoc-gen-go/testdata test + go test ./... ./protoc-gen-go/testdata + make -C conformance test clean: go clean ./... @@ -47,9 +45,4 @@ nuke: go clean -i ./... regenerate: - make -C protoc-gen-go/descriptor regenerate - make -C protoc-gen-go/plugin regenerate - make -C protoc-gen-go/testdata regenerate - make -C proto/testdata regenerate - make -C jsonpb/jsonpb_test_proto regenerate - make -C _conformance regenerate + ./regenerate.sh diff --git a/vendor/github.com/golang/protobuf/README.md b/vendor/github.com/golang/protobuf/README.md index 9c4c815c0..01b29daf2 100644 --- a/vendor/github.com/golang/protobuf/README.md +++ b/vendor/github.com/golang/protobuf/README.md @@ -7,7 +7,7 @@ Google's data interchange format. Copyright 2010 The Go Authors. https://github.com/golang/protobuf -This package and the code it generates requires at least Go 1.4. +This package and the code it generates requires at least Go 1.6. This software implements Go bindings for protocol buffers. For information about protocol buffers themselves, see @@ -56,13 +56,49 @@ parameter set to the directory you want to output the Go code to. The generated files will be suffixed .pb.go. See the Test code below for an example using such a file. +## Packages and input paths ## + +The protocol buffer language has a concept of "packages" which does not +correspond well to the Go notion of packages. In generated Go code, +each source `.proto` file is associated with a single Go package. The +name and import path for this package is specified with the `go_package` +proto option: + + option go_package = "github.com/golang/protobuf/ptypes/any"; + +The protocol buffer compiler will attempt to derive a package name and +import path if a `go_package` option is not present, but it is +best to always specify one explicitly. + +There is a one-to-one relationship between source `.proto` files and +generated `.pb.go` files, but any number of `.pb.go` files may be +contained in the same Go package. + +The output name of a generated file is produced by replacing the +`.proto` suffix with `.pb.go` (e.g., `foo.proto` produces `foo.pb.go`). +However, the output directory is selected in one of two ways. Let +us say we have `inputs/x.proto` with a `go_package` option of +`github.com/golang/protobuf/p`. The corresponding output file may +be: + +- Relative to the import path: + + protoc --go_out=. inputs/x.proto + # writes ./github.com/golang/protobuf/p/x.pb.go + + (This can work well with `--go_out=$GOPATH`.) + +- Relative to the input file: + + protoc --go_out=paths=source_relative:. inputs/x.proto + # generate ./inputs/x.pb.go + +## Generated code ## The package comment for the proto library contains text describing the interface provided in Go for protocol buffers. Here is an edited version. -========== - The proto package converts data structures to and from the wire format of protocol buffers. It works in concert with the Go source code generated for .proto files by the protocol compiler. @@ -114,9 +150,9 @@ Consider file test.proto, containing ```proto syntax = "proto2"; package example; - + enum FOO { X = 17; }; - + message Test { required string label = 1; optional int32 type = 2 [default=77]; @@ -170,22 +206,25 @@ To create and play with a Test object from the example package, To pass extra parameters to the plugin, use a comma-separated parameter list separated from the output directory by a colon: - protoc --go_out=plugins=grpc,import_path=mypackage:. *.proto - -- `import_prefix=xxx` - a prefix that is added onto the beginning of - all imports. Useful for things like generating protos in a - subdirectory, or regenerating vendored protobufs in-place. -- `import_path=foo/bar` - used as the package if no input files - declare `go_package`. If it contains slashes, everything up to the - rightmost slash is ignored. +- `paths=(import | source_relative)` - specifies how the paths of + generated files are structured. See the "Packages and imports paths" + section above. The default is `import`. - `plugins=plugin1+plugin2` - specifies the list of sub-plugins to load. The only plugin in this repo is `grpc`. - `Mfoo/bar.proto=quux/shme` - declares that foo/bar.proto is associated with Go package quux/shme. This is subject to the import_prefix parameter. +The following parameters are deprecated and should not be used: + +- `import_prefix=xxx` - a prefix that is added onto the beginning of + all imports. +- `import_path=foo/bar` - used as the package if no input files + declare `go_package`. If it contains slashes, everything up to the + rightmost slash is ignored. + ## gRPC Support ## If a proto file specifies RPC services, protoc-gen-go can be instructed to diff --git a/vendor/github.com/golang/protobuf/_conformance/Makefile b/vendor/github.com/golang/protobuf/conformance/Makefile similarity index 76% rename from vendor/github.com/golang/protobuf/_conformance/Makefile rename to vendor/github.com/golang/protobuf/conformance/Makefile index 89800e2d9..b99e4ed6d 100644 --- a/vendor/github.com/golang/protobuf/_conformance/Makefile +++ b/vendor/github.com/golang/protobuf/conformance/Makefile @@ -29,5 +29,21 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -regenerate: - protoc --go_out=Mgoogle/protobuf/any.proto=github.com/golang/protobuf/ptypes/any,Mgoogle/protobuf/duration.proto=github.com/golang/protobuf/ptypes/duration,Mgoogle/protobuf/struct.proto=github.com/golang/protobuf/ptypes/struct,Mgoogle/protobuf/timestamp.proto=github.com/golang/protobuf/ptypes/timestamp,Mgoogle/protobuf/wrappers.proto=github.com/golang/protobuf/ptypes/wrappers,Mgoogle/protobuf/field_mask.proto=google.golang.org/genproto/protobuf:. conformance_proto/conformance.proto +PROTOBUF_ROOT=$(HOME)/src/protobuf + +all: + @echo To run the tests in this directory, acquire the main protobuf + @echo distribution from: + @echo + @echo ' https://github.com/google/protobuf' + @echo + @echo Build the test runner with: + @echo + @echo ' cd conformance && make conformance-test-runner' + @echo + @echo And run the tests in this directory with: + @echo + @echo ' make test PROTOBUF_ROOT=' + +test: + ./test.sh $(PROTOBUF_ROOT) diff --git a/vendor/github.com/golang/protobuf/_conformance/conformance.go b/vendor/github.com/golang/protobuf/conformance/conformance.go similarity index 94% rename from vendor/github.com/golang/protobuf/_conformance/conformance.go rename to vendor/github.com/golang/protobuf/conformance/conformance.go index c54212c80..3029312a1 100644 --- a/vendor/github.com/golang/protobuf/_conformance/conformance.go +++ b/vendor/github.com/golang/protobuf/conformance/conformance.go @@ -39,7 +39,7 @@ import ( "io" "os" - pb "github.com/golang/protobuf/_conformance/conformance_proto" + pb "github.com/golang/protobuf/conformance/internal/conformance_proto" "github.com/golang/protobuf/jsonpb" "github.com/golang/protobuf/proto" ) @@ -101,13 +101,6 @@ func handle(req *pb.ConformanceRequest) *pb.ConformanceResponse { err = proto.Unmarshal(p.ProtobufPayload, &msg) case *pb.ConformanceRequest_JsonPayload: err = jsonpb.UnmarshalString(p.JsonPayload, &msg) - if err != nil && err.Error() == "unmarshaling Any not supported yet" { - return &pb.ConformanceResponse{ - Result: &pb.ConformanceResponse_Skipped{ - Skipped: err.Error(), - }, - } - } default: return &pb.ConformanceResponse{ Result: &pb.ConformanceResponse_RuntimeError{ diff --git a/vendor/github.com/golang/protobuf/conformance/conformance.sh b/vendor/github.com/golang/protobuf/conformance/conformance.sh new file mode 100755 index 000000000..8532f5711 --- /dev/null +++ b/vendor/github.com/golang/protobuf/conformance/conformance.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +cd $(dirname $0) +exec go run conformance.go $* diff --git a/vendor/github.com/golang/protobuf/conformance/failure_list_go.txt b/vendor/github.com/golang/protobuf/conformance/failure_list_go.txt new file mode 100644 index 000000000..d37280896 --- /dev/null +++ b/vendor/github.com/golang/protobuf/conformance/failure_list_go.txt @@ -0,0 +1,61 @@ +# This is the list of conformance tests that are known ot fail right now. +# TODO: These should be fixed. + +DurationProtoInputTooLarge.JsonOutput +DurationProtoInputTooSmall.JsonOutput +FieldMaskNumbersDontRoundTrip.JsonOutput +FieldMaskPathsDontRoundTrip.JsonOutput +FieldMaskTooManyUnderscore.JsonOutput +JsonInput.AnyWithFieldMask.JsonOutput +JsonInput.AnyWithFieldMask.ProtobufOutput +JsonInput.DoubleFieldQuotedValue.JsonOutput +JsonInput.DoubleFieldQuotedValue.ProtobufOutput +JsonInput.DurationHas3FractionalDigits.Validator +JsonInput.DurationHas6FractionalDigits.Validator +JsonInput.DurationHas9FractionalDigits.Validator +JsonInput.DurationHasZeroFractionalDigit.Validator +JsonInput.DurationMaxValue.JsonOutput +JsonInput.DurationMaxValue.ProtobufOutput +JsonInput.DurationMinValue.JsonOutput +JsonInput.DurationMinValue.ProtobufOutput +JsonInput.EnumFieldUnknownValue.Validator +JsonInput.FieldMask.JsonOutput +JsonInput.FieldMask.ProtobufOutput +JsonInput.FieldNameInLowerCamelCase.Validator +JsonInput.FieldNameWithMixedCases.JsonOutput +JsonInput.FieldNameWithMixedCases.ProtobufOutput +JsonInput.FieldNameWithMixedCases.Validator +JsonInput.FieldNameWithNumbers.Validator +JsonInput.FloatFieldQuotedValue.JsonOutput +JsonInput.FloatFieldQuotedValue.ProtobufOutput +JsonInput.Int32FieldExponentialFormat.JsonOutput +JsonInput.Int32FieldExponentialFormat.ProtobufOutput +JsonInput.Int32FieldFloatTrailingZero.JsonOutput +JsonInput.Int32FieldFloatTrailingZero.ProtobufOutput +JsonInput.Int32FieldMaxFloatValue.JsonOutput +JsonInput.Int32FieldMaxFloatValue.ProtobufOutput +JsonInput.Int32FieldMinFloatValue.JsonOutput +JsonInput.Int32FieldMinFloatValue.ProtobufOutput +JsonInput.Int32FieldStringValue.JsonOutput +JsonInput.Int32FieldStringValue.ProtobufOutput +JsonInput.Int32FieldStringValueEscaped.JsonOutput +JsonInput.Int32FieldStringValueEscaped.ProtobufOutput +JsonInput.Int64FieldBeString.Validator +JsonInput.MapFieldValueIsNull +JsonInput.OneofFieldDuplicate +JsonInput.RepeatedFieldMessageElementIsNull +JsonInput.RepeatedFieldPrimitiveElementIsNull +JsonInput.StringFieldSurrogateInWrongOrder +JsonInput.StringFieldUnpairedHighSurrogate +JsonInput.StringFieldUnpairedLowSurrogate +JsonInput.TimestampHas3FractionalDigits.Validator +JsonInput.TimestampHas6FractionalDigits.Validator +JsonInput.TimestampHas9FractionalDigits.Validator +JsonInput.TimestampHasZeroFractionalDigit.Validator +JsonInput.TimestampJsonInputTooSmall +JsonInput.TimestampZeroNormalized.Validator +JsonInput.Uint32FieldMaxFloatValue.JsonOutput +JsonInput.Uint32FieldMaxFloatValue.ProtobufOutput +JsonInput.Uint64FieldBeString.Validator +TimestampProtoInputTooLarge.JsonOutput +TimestampProtoInputTooSmall.JsonOutput diff --git a/vendor/github.com/golang/protobuf/_conformance/conformance_proto/conformance.pb.go b/vendor/github.com/golang/protobuf/conformance/internal/conformance_proto/conformance.pb.go similarity index 55% rename from vendor/github.com/golang/protobuf/_conformance/conformance_proto/conformance.pb.go rename to vendor/github.com/golang/protobuf/conformance/internal/conformance_proto/conformance.pb.go index ec354eada..82d454120 100644 --- a/vendor/github.com/golang/protobuf/_conformance/conformance_proto/conformance.pb.go +++ b/vendor/github.com/golang/protobuf/conformance/internal/conformance_proto/conformance.pb.go @@ -1,29 +1,17 @@ // Code generated by protoc-gen-go. DO NOT EDIT. -// source: conformance_proto/conformance.proto +// source: conformance.proto -/* -Package conformance is a generated protocol buffer package. - -It is generated from these files: - conformance_proto/conformance.proto - -It has these top-level messages: - ConformanceRequest - ConformanceResponse - TestAllTypes - ForeignMessage -*/ package conformance import proto "github.com/golang/protobuf/proto" import fmt "fmt" import math "math" -import google_protobuf "github.com/golang/protobuf/ptypes/any" -import google_protobuf1 "github.com/golang/protobuf/ptypes/duration" -import google_protobuf2 "google.golang.org/genproto/protobuf" -import google_protobuf3 "github.com/golang/protobuf/ptypes/struct" -import google_protobuf4 "github.com/golang/protobuf/ptypes/timestamp" -import google_protobuf5 "github.com/golang/protobuf/ptypes/wrappers" +import any "github.com/golang/protobuf/ptypes/any" +import duration "github.com/golang/protobuf/ptypes/duration" +import _struct "github.com/golang/protobuf/ptypes/struct" +import timestamp "github.com/golang/protobuf/ptypes/timestamp" +import wrappers "github.com/golang/protobuf/ptypes/wrappers" +import field_mask "google.golang.org/genproto/protobuf/field_mask" // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -58,7 +46,9 @@ var WireFormat_value = map[string]int32{ func (x WireFormat) String() string { return proto.EnumName(WireFormat_name, int32(x)) } -func (WireFormat) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } +func (WireFormat) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_conformance_48ac832451f5d6c3, []int{0} +} type ForeignEnum int32 @@ -82,7 +72,9 @@ var ForeignEnum_value = map[string]int32{ func (x ForeignEnum) String() string { return proto.EnumName(ForeignEnum_name, int32(x)) } -func (ForeignEnum) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } +func (ForeignEnum) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_conformance_48ac832451f5d6c3, []int{1} +} type TestAllTypes_NestedEnum int32 @@ -109,7 +101,9 @@ var TestAllTypes_NestedEnum_value = map[string]int32{ func (x TestAllTypes_NestedEnum) String() string { return proto.EnumName(TestAllTypes_NestedEnum_name, int32(x)) } -func (TestAllTypes_NestedEnum) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{2, 0} } +func (TestAllTypes_NestedEnum) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_conformance_48ac832451f5d6c3, []int{2, 0} +} // Represents a single test case's input. The testee should: // @@ -126,12 +120,34 @@ type ConformanceRequest struct { Payload isConformanceRequest_Payload `protobuf_oneof:"payload"` // Which format should the testee serialize its message to? RequestedOutputFormat WireFormat `protobuf:"varint,3,opt,name=requested_output_format,json=requestedOutputFormat,enum=conformance.WireFormat" json:"requested_output_format,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *ConformanceRequest) Reset() { *m = ConformanceRequest{} } -func (m *ConformanceRequest) String() string { return proto.CompactTextString(m) } -func (*ConformanceRequest) ProtoMessage() {} -func (*ConformanceRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } +func (m *ConformanceRequest) Reset() { *m = ConformanceRequest{} } +func (m *ConformanceRequest) String() string { return proto.CompactTextString(m) } +func (*ConformanceRequest) ProtoMessage() {} +func (*ConformanceRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_conformance_48ac832451f5d6c3, []int{0} +} +func (m *ConformanceRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ConformanceRequest.Unmarshal(m, b) +} +func (m *ConformanceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ConformanceRequest.Marshal(b, m, deterministic) +} +func (dst *ConformanceRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ConformanceRequest.Merge(dst, src) +} +func (m *ConformanceRequest) XXX_Size() int { + return xxx_messageInfo_ConformanceRequest.Size(m) +} +func (m *ConformanceRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ConformanceRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ConformanceRequest proto.InternalMessageInfo type isConformanceRequest_Payload interface { isConformanceRequest_Payload() @@ -227,11 +243,11 @@ func _ConformanceRequest_OneofSizer(msg proto.Message) (n int) { // payload switch x := m.Payload.(type) { case *ConformanceRequest_ProtobufPayload: - n += proto.SizeVarint(1<<3 | proto.WireBytes) + n += 1 // tag and wire n += proto.SizeVarint(uint64(len(x.ProtobufPayload))) n += len(x.ProtobufPayload) case *ConformanceRequest_JsonPayload: - n += proto.SizeVarint(2<<3 | proto.WireBytes) + n += 1 // tag and wire n += proto.SizeVarint(uint64(len(x.JsonPayload))) n += len(x.JsonPayload) case nil: @@ -250,13 +266,35 @@ type ConformanceResponse struct { // *ConformanceResponse_ProtobufPayload // *ConformanceResponse_JsonPayload // *ConformanceResponse_Skipped - Result isConformanceResponse_Result `protobuf_oneof:"result"` + Result isConformanceResponse_Result `protobuf_oneof:"result"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ConformanceResponse) Reset() { *m = ConformanceResponse{} } +func (m *ConformanceResponse) String() string { return proto.CompactTextString(m) } +func (*ConformanceResponse) ProtoMessage() {} +func (*ConformanceResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_conformance_48ac832451f5d6c3, []int{1} +} +func (m *ConformanceResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ConformanceResponse.Unmarshal(m, b) +} +func (m *ConformanceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ConformanceResponse.Marshal(b, m, deterministic) +} +func (dst *ConformanceResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ConformanceResponse.Merge(dst, src) +} +func (m *ConformanceResponse) XXX_Size() int { + return xxx_messageInfo_ConformanceResponse.Size(m) +} +func (m *ConformanceResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ConformanceResponse.DiscardUnknown(m) } -func (m *ConformanceResponse) Reset() { *m = ConformanceResponse{} } -func (m *ConformanceResponse) String() string { return proto.CompactTextString(m) } -func (*ConformanceResponse) ProtoMessage() {} -func (*ConformanceResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } +var xxx_messageInfo_ConformanceResponse proto.InternalMessageInfo type isConformanceResponse_Result interface { isConformanceResponse_Result() @@ -433,27 +471,27 @@ func _ConformanceResponse_OneofSizer(msg proto.Message) (n int) { // result switch x := m.Result.(type) { case *ConformanceResponse_ParseError: - n += proto.SizeVarint(1<<3 | proto.WireBytes) + n += 1 // tag and wire n += proto.SizeVarint(uint64(len(x.ParseError))) n += len(x.ParseError) case *ConformanceResponse_SerializeError: - n += proto.SizeVarint(6<<3 | proto.WireBytes) + n += 1 // tag and wire n += proto.SizeVarint(uint64(len(x.SerializeError))) n += len(x.SerializeError) case *ConformanceResponse_RuntimeError: - n += proto.SizeVarint(2<<3 | proto.WireBytes) + n += 1 // tag and wire n += proto.SizeVarint(uint64(len(x.RuntimeError))) n += len(x.RuntimeError) case *ConformanceResponse_ProtobufPayload: - n += proto.SizeVarint(3<<3 | proto.WireBytes) + n += 1 // tag and wire n += proto.SizeVarint(uint64(len(x.ProtobufPayload))) n += len(x.ProtobufPayload) case *ConformanceResponse_JsonPayload: - n += proto.SizeVarint(4<<3 | proto.WireBytes) + n += 1 // tag and wire n += proto.SizeVarint(uint64(len(x.JsonPayload))) n += len(x.JsonPayload) case *ConformanceResponse_Skipped: - n += proto.SizeVarint(5<<3 | proto.WireBytes) + n += 1 // tag and wire n += proto.SizeVarint(uint64(len(x.Skipped))) n += len(x.Skipped) case nil: @@ -536,69 +574,79 @@ type TestAllTypes struct { // *TestAllTypes_OneofNestedMessage // *TestAllTypes_OneofString // *TestAllTypes_OneofBytes - // *TestAllTypes_OneofBool - // *TestAllTypes_OneofUint64 - // *TestAllTypes_OneofFloat - // *TestAllTypes_OneofDouble - // *TestAllTypes_OneofEnum OneofField isTestAllTypes_OneofField `protobuf_oneof:"oneof_field"` // Well-known types - OptionalBoolWrapper *google_protobuf5.BoolValue `protobuf:"bytes,201,opt,name=optional_bool_wrapper,json=optionalBoolWrapper" json:"optional_bool_wrapper,omitempty"` - OptionalInt32Wrapper *google_protobuf5.Int32Value `protobuf:"bytes,202,opt,name=optional_int32_wrapper,json=optionalInt32Wrapper" json:"optional_int32_wrapper,omitempty"` - OptionalInt64Wrapper *google_protobuf5.Int64Value `protobuf:"bytes,203,opt,name=optional_int64_wrapper,json=optionalInt64Wrapper" json:"optional_int64_wrapper,omitempty"` - OptionalUint32Wrapper *google_protobuf5.UInt32Value `protobuf:"bytes,204,opt,name=optional_uint32_wrapper,json=optionalUint32Wrapper" json:"optional_uint32_wrapper,omitempty"` - OptionalUint64Wrapper *google_protobuf5.UInt64Value `protobuf:"bytes,205,opt,name=optional_uint64_wrapper,json=optionalUint64Wrapper" json:"optional_uint64_wrapper,omitempty"` - OptionalFloatWrapper *google_protobuf5.FloatValue `protobuf:"bytes,206,opt,name=optional_float_wrapper,json=optionalFloatWrapper" json:"optional_float_wrapper,omitempty"` - OptionalDoubleWrapper *google_protobuf5.DoubleValue `protobuf:"bytes,207,opt,name=optional_double_wrapper,json=optionalDoubleWrapper" json:"optional_double_wrapper,omitempty"` - OptionalStringWrapper *google_protobuf5.StringValue `protobuf:"bytes,208,opt,name=optional_string_wrapper,json=optionalStringWrapper" json:"optional_string_wrapper,omitempty"` - OptionalBytesWrapper *google_protobuf5.BytesValue `protobuf:"bytes,209,opt,name=optional_bytes_wrapper,json=optionalBytesWrapper" json:"optional_bytes_wrapper,omitempty"` - RepeatedBoolWrapper []*google_protobuf5.BoolValue `protobuf:"bytes,211,rep,name=repeated_bool_wrapper,json=repeatedBoolWrapper" json:"repeated_bool_wrapper,omitempty"` - RepeatedInt32Wrapper []*google_protobuf5.Int32Value `protobuf:"bytes,212,rep,name=repeated_int32_wrapper,json=repeatedInt32Wrapper" json:"repeated_int32_wrapper,omitempty"` - RepeatedInt64Wrapper []*google_protobuf5.Int64Value `protobuf:"bytes,213,rep,name=repeated_int64_wrapper,json=repeatedInt64Wrapper" json:"repeated_int64_wrapper,omitempty"` - RepeatedUint32Wrapper []*google_protobuf5.UInt32Value `protobuf:"bytes,214,rep,name=repeated_uint32_wrapper,json=repeatedUint32Wrapper" json:"repeated_uint32_wrapper,omitempty"` - RepeatedUint64Wrapper []*google_protobuf5.UInt64Value `protobuf:"bytes,215,rep,name=repeated_uint64_wrapper,json=repeatedUint64Wrapper" json:"repeated_uint64_wrapper,omitempty"` - RepeatedFloatWrapper []*google_protobuf5.FloatValue `protobuf:"bytes,216,rep,name=repeated_float_wrapper,json=repeatedFloatWrapper" json:"repeated_float_wrapper,omitempty"` - RepeatedDoubleWrapper []*google_protobuf5.DoubleValue `protobuf:"bytes,217,rep,name=repeated_double_wrapper,json=repeatedDoubleWrapper" json:"repeated_double_wrapper,omitempty"` - RepeatedStringWrapper []*google_protobuf5.StringValue `protobuf:"bytes,218,rep,name=repeated_string_wrapper,json=repeatedStringWrapper" json:"repeated_string_wrapper,omitempty"` - RepeatedBytesWrapper []*google_protobuf5.BytesValue `protobuf:"bytes,219,rep,name=repeated_bytes_wrapper,json=repeatedBytesWrapper" json:"repeated_bytes_wrapper,omitempty"` - OptionalDuration *google_protobuf1.Duration `protobuf:"bytes,301,opt,name=optional_duration,json=optionalDuration" json:"optional_duration,omitempty"` - OptionalTimestamp *google_protobuf4.Timestamp `protobuf:"bytes,302,opt,name=optional_timestamp,json=optionalTimestamp" json:"optional_timestamp,omitempty"` - OptionalFieldMask *google_protobuf2.FieldMask `protobuf:"bytes,303,opt,name=optional_field_mask,json=optionalFieldMask" json:"optional_field_mask,omitempty"` - OptionalStruct *google_protobuf3.Struct `protobuf:"bytes,304,opt,name=optional_struct,json=optionalStruct" json:"optional_struct,omitempty"` - OptionalAny *google_protobuf.Any `protobuf:"bytes,305,opt,name=optional_any,json=optionalAny" json:"optional_any,omitempty"` - OptionalValue *google_protobuf3.Value `protobuf:"bytes,306,opt,name=optional_value,json=optionalValue" json:"optional_value,omitempty"` - RepeatedDuration []*google_protobuf1.Duration `protobuf:"bytes,311,rep,name=repeated_duration,json=repeatedDuration" json:"repeated_duration,omitempty"` - RepeatedTimestamp []*google_protobuf4.Timestamp `protobuf:"bytes,312,rep,name=repeated_timestamp,json=repeatedTimestamp" json:"repeated_timestamp,omitempty"` - RepeatedFieldmask []*google_protobuf2.FieldMask `protobuf:"bytes,313,rep,name=repeated_fieldmask,json=repeatedFieldmask" json:"repeated_fieldmask,omitempty"` - RepeatedStruct []*google_protobuf3.Struct `protobuf:"bytes,324,rep,name=repeated_struct,json=repeatedStruct" json:"repeated_struct,omitempty"` - RepeatedAny []*google_protobuf.Any `protobuf:"bytes,315,rep,name=repeated_any,json=repeatedAny" json:"repeated_any,omitempty"` - RepeatedValue []*google_protobuf3.Value `protobuf:"bytes,316,rep,name=repeated_value,json=repeatedValue" json:"repeated_value,omitempty"` + OptionalBoolWrapper *wrappers.BoolValue `protobuf:"bytes,201,opt,name=optional_bool_wrapper,json=optionalBoolWrapper" json:"optional_bool_wrapper,omitempty"` + OptionalInt32Wrapper *wrappers.Int32Value `protobuf:"bytes,202,opt,name=optional_int32_wrapper,json=optionalInt32Wrapper" json:"optional_int32_wrapper,omitempty"` + OptionalInt64Wrapper *wrappers.Int64Value `protobuf:"bytes,203,opt,name=optional_int64_wrapper,json=optionalInt64Wrapper" json:"optional_int64_wrapper,omitempty"` + OptionalUint32Wrapper *wrappers.UInt32Value `protobuf:"bytes,204,opt,name=optional_uint32_wrapper,json=optionalUint32Wrapper" json:"optional_uint32_wrapper,omitempty"` + OptionalUint64Wrapper *wrappers.UInt64Value `protobuf:"bytes,205,opt,name=optional_uint64_wrapper,json=optionalUint64Wrapper" json:"optional_uint64_wrapper,omitempty"` + OptionalFloatWrapper *wrappers.FloatValue `protobuf:"bytes,206,opt,name=optional_float_wrapper,json=optionalFloatWrapper" json:"optional_float_wrapper,omitempty"` + OptionalDoubleWrapper *wrappers.DoubleValue `protobuf:"bytes,207,opt,name=optional_double_wrapper,json=optionalDoubleWrapper" json:"optional_double_wrapper,omitempty"` + OptionalStringWrapper *wrappers.StringValue `protobuf:"bytes,208,opt,name=optional_string_wrapper,json=optionalStringWrapper" json:"optional_string_wrapper,omitempty"` + OptionalBytesWrapper *wrappers.BytesValue `protobuf:"bytes,209,opt,name=optional_bytes_wrapper,json=optionalBytesWrapper" json:"optional_bytes_wrapper,omitempty"` + RepeatedBoolWrapper []*wrappers.BoolValue `protobuf:"bytes,211,rep,name=repeated_bool_wrapper,json=repeatedBoolWrapper" json:"repeated_bool_wrapper,omitempty"` + RepeatedInt32Wrapper []*wrappers.Int32Value `protobuf:"bytes,212,rep,name=repeated_int32_wrapper,json=repeatedInt32Wrapper" json:"repeated_int32_wrapper,omitempty"` + RepeatedInt64Wrapper []*wrappers.Int64Value `protobuf:"bytes,213,rep,name=repeated_int64_wrapper,json=repeatedInt64Wrapper" json:"repeated_int64_wrapper,omitempty"` + RepeatedUint32Wrapper []*wrappers.UInt32Value `protobuf:"bytes,214,rep,name=repeated_uint32_wrapper,json=repeatedUint32Wrapper" json:"repeated_uint32_wrapper,omitempty"` + RepeatedUint64Wrapper []*wrappers.UInt64Value `protobuf:"bytes,215,rep,name=repeated_uint64_wrapper,json=repeatedUint64Wrapper" json:"repeated_uint64_wrapper,omitempty"` + RepeatedFloatWrapper []*wrappers.FloatValue `protobuf:"bytes,216,rep,name=repeated_float_wrapper,json=repeatedFloatWrapper" json:"repeated_float_wrapper,omitempty"` + RepeatedDoubleWrapper []*wrappers.DoubleValue `protobuf:"bytes,217,rep,name=repeated_double_wrapper,json=repeatedDoubleWrapper" json:"repeated_double_wrapper,omitempty"` + RepeatedStringWrapper []*wrappers.StringValue `protobuf:"bytes,218,rep,name=repeated_string_wrapper,json=repeatedStringWrapper" json:"repeated_string_wrapper,omitempty"` + RepeatedBytesWrapper []*wrappers.BytesValue `protobuf:"bytes,219,rep,name=repeated_bytes_wrapper,json=repeatedBytesWrapper" json:"repeated_bytes_wrapper,omitempty"` + OptionalDuration *duration.Duration `protobuf:"bytes,301,opt,name=optional_duration,json=optionalDuration" json:"optional_duration,omitempty"` + OptionalTimestamp *timestamp.Timestamp `protobuf:"bytes,302,opt,name=optional_timestamp,json=optionalTimestamp" json:"optional_timestamp,omitempty"` + OptionalFieldMask *field_mask.FieldMask `protobuf:"bytes,303,opt,name=optional_field_mask,json=optionalFieldMask" json:"optional_field_mask,omitempty"` + OptionalStruct *_struct.Struct `protobuf:"bytes,304,opt,name=optional_struct,json=optionalStruct" json:"optional_struct,omitempty"` + OptionalAny *any.Any `protobuf:"bytes,305,opt,name=optional_any,json=optionalAny" json:"optional_any,omitempty"` + OptionalValue *_struct.Value `protobuf:"bytes,306,opt,name=optional_value,json=optionalValue" json:"optional_value,omitempty"` + RepeatedDuration []*duration.Duration `protobuf:"bytes,311,rep,name=repeated_duration,json=repeatedDuration" json:"repeated_duration,omitempty"` + RepeatedTimestamp []*timestamp.Timestamp `protobuf:"bytes,312,rep,name=repeated_timestamp,json=repeatedTimestamp" json:"repeated_timestamp,omitempty"` + RepeatedFieldmask []*field_mask.FieldMask `protobuf:"bytes,313,rep,name=repeated_fieldmask,json=repeatedFieldmask" json:"repeated_fieldmask,omitempty"` + RepeatedStruct []*_struct.Struct `protobuf:"bytes,324,rep,name=repeated_struct,json=repeatedStruct" json:"repeated_struct,omitempty"` + RepeatedAny []*any.Any `protobuf:"bytes,315,rep,name=repeated_any,json=repeatedAny" json:"repeated_any,omitempty"` + RepeatedValue []*_struct.Value `protobuf:"bytes,316,rep,name=repeated_value,json=repeatedValue" json:"repeated_value,omitempty"` // Test field-name-to-JSON-name convention. - // (protobuf says names can be any valid C/C++ identifier.) - Fieldname1 int32 `protobuf:"varint,401,opt,name=fieldname1" json:"fieldname1,omitempty"` - FieldName2 int32 `protobuf:"varint,402,opt,name=field_name2,json=fieldName2" json:"field_name2,omitempty"` - XFieldName3 int32 `protobuf:"varint,403,opt,name=_field_name3,json=FieldName3" json:"_field_name3,omitempty"` - Field_Name4_ int32 `protobuf:"varint,404,opt,name=field__name4_,json=fieldName4" json:"field__name4_,omitempty"` - Field0Name5 int32 `protobuf:"varint,405,opt,name=field0name5" json:"field0name5,omitempty"` - Field_0Name6 int32 `protobuf:"varint,406,opt,name=field_0_name6,json=field0Name6" json:"field_0_name6,omitempty"` - FieldName7 int32 `protobuf:"varint,407,opt,name=fieldName7" json:"fieldName7,omitempty"` - FieldName8 int32 `protobuf:"varint,408,opt,name=FieldName8" json:"FieldName8,omitempty"` - Field_Name9 int32 `protobuf:"varint,409,opt,name=field_Name9,json=fieldName9" json:"field_Name9,omitempty"` - Field_Name10 int32 `protobuf:"varint,410,opt,name=Field_Name10,json=FieldName10" json:"Field_Name10,omitempty"` - FIELD_NAME11 int32 `protobuf:"varint,411,opt,name=FIELD_NAME11,json=FIELDNAME11" json:"FIELD_NAME11,omitempty"` - FIELDName12 int32 `protobuf:"varint,412,opt,name=FIELD_name12,json=FIELDName12" json:"FIELD_name12,omitempty"` - XFieldName13 int32 `protobuf:"varint,413,opt,name=__field_name13,json=FieldName13" json:"__field_name13,omitempty"` - X_FieldName14 int32 `protobuf:"varint,414,opt,name=__Field_name14,json=FieldName14" json:"__Field_name14,omitempty"` - Field_Name15 int32 `protobuf:"varint,415,opt,name=field__name15,json=fieldName15" json:"field__name15,omitempty"` - Field__Name16 int32 `protobuf:"varint,416,opt,name=field__Name16,json=fieldName16" json:"field__Name16,omitempty"` - FieldName17__ int32 `protobuf:"varint,417,opt,name=field_name17__,json=fieldName17" json:"field_name17__,omitempty"` - FieldName18__ int32 `protobuf:"varint,418,opt,name=Field_name18__,json=FieldName18" json:"Field_name18__,omitempty"` -} - -func (m *TestAllTypes) Reset() { *m = TestAllTypes{} } -func (m *TestAllTypes) String() string { return proto.CompactTextString(m) } -func (*TestAllTypes) ProtoMessage() {} -func (*TestAllTypes) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } + Fieldname1 int32 `protobuf:"varint,401,opt,name=fieldname1" json:"fieldname1,omitempty"` + FieldName2 int32 `protobuf:"varint,402,opt,name=field_name2,json=fieldName2" json:"field_name2,omitempty"` + XFieldName3 int32 `protobuf:"varint,403,opt,name=_field_name3,json=FieldName3" json:"_field_name3,omitempty"` + Field_Name4_ int32 `protobuf:"varint,404,opt,name=field__name4_,json=fieldName4" json:"field__name4_,omitempty"` + Field0Name5 int32 `protobuf:"varint,405,opt,name=field0name5" json:"field0name5,omitempty"` + Field_0Name6 int32 `protobuf:"varint,406,opt,name=field_0_name6,json=field0Name6" json:"field_0_name6,omitempty"` + FieldName7 int32 `protobuf:"varint,407,opt,name=fieldName7" json:"fieldName7,omitempty"` + FieldName8 int32 `protobuf:"varint,408,opt,name=FieldName8" json:"FieldName8,omitempty"` + Field_Name9 int32 `protobuf:"varint,409,opt,name=field_Name9,json=fieldName9" json:"field_Name9,omitempty"` + Field_Name10 int32 `protobuf:"varint,410,opt,name=Field_Name10,json=FieldName10" json:"Field_Name10,omitempty"` + FIELD_NAME11 int32 `protobuf:"varint,411,opt,name=FIELD_NAME11,json=FIELDNAME11" json:"FIELD_NAME11,omitempty"` + FIELDName12 int32 `protobuf:"varint,412,opt,name=FIELD_name12,json=FIELDName12" json:"FIELD_name12,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TestAllTypes) Reset() { *m = TestAllTypes{} } +func (m *TestAllTypes) String() string { return proto.CompactTextString(m) } +func (*TestAllTypes) ProtoMessage() {} +func (*TestAllTypes) Descriptor() ([]byte, []int) { + return fileDescriptor_conformance_48ac832451f5d6c3, []int{2} +} +func (m *TestAllTypes) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TestAllTypes.Unmarshal(m, b) +} +func (m *TestAllTypes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TestAllTypes.Marshal(b, m, deterministic) +} +func (dst *TestAllTypes) XXX_Merge(src proto.Message) { + xxx_messageInfo_TestAllTypes.Merge(dst, src) +} +func (m *TestAllTypes) XXX_Size() int { + return xxx_messageInfo_TestAllTypes.Size(m) +} +func (m *TestAllTypes) XXX_DiscardUnknown() { + xxx_messageInfo_TestAllTypes.DiscardUnknown(m) +} + +var xxx_messageInfo_TestAllTypes proto.InternalMessageInfo type isTestAllTypes_OneofField interface { isTestAllTypes_OneofField() @@ -616,31 +664,11 @@ type TestAllTypes_OneofString struct { type TestAllTypes_OneofBytes struct { OneofBytes []byte `protobuf:"bytes,114,opt,name=oneof_bytes,json=oneofBytes,proto3,oneof"` } -type TestAllTypes_OneofBool struct { - OneofBool bool `protobuf:"varint,115,opt,name=oneof_bool,json=oneofBool,oneof"` -} -type TestAllTypes_OneofUint64 struct { - OneofUint64 uint64 `protobuf:"varint,116,opt,name=oneof_uint64,json=oneofUint64,oneof"` -} -type TestAllTypes_OneofFloat struct { - OneofFloat float32 `protobuf:"fixed32,117,opt,name=oneof_float,json=oneofFloat,oneof"` -} -type TestAllTypes_OneofDouble struct { - OneofDouble float64 `protobuf:"fixed64,118,opt,name=oneof_double,json=oneofDouble,oneof"` -} -type TestAllTypes_OneofEnum struct { - OneofEnum TestAllTypes_NestedEnum `protobuf:"varint,119,opt,name=oneof_enum,json=oneofEnum,enum=conformance.TestAllTypes_NestedEnum,oneof"` -} func (*TestAllTypes_OneofUint32) isTestAllTypes_OneofField() {} func (*TestAllTypes_OneofNestedMessage) isTestAllTypes_OneofField() {} func (*TestAllTypes_OneofString) isTestAllTypes_OneofField() {} func (*TestAllTypes_OneofBytes) isTestAllTypes_OneofField() {} -func (*TestAllTypes_OneofBool) isTestAllTypes_OneofField() {} -func (*TestAllTypes_OneofUint64) isTestAllTypes_OneofField() {} -func (*TestAllTypes_OneofFloat) isTestAllTypes_OneofField() {} -func (*TestAllTypes_OneofDouble) isTestAllTypes_OneofField() {} -func (*TestAllTypes_OneofEnum) isTestAllTypes_OneofField() {} func (m *TestAllTypes) GetOneofField() isTestAllTypes_OneofField { if m != nil { @@ -1111,245 +1139,210 @@ func (m *TestAllTypes) GetOneofBytes() []byte { return nil } -func (m *TestAllTypes) GetOneofBool() bool { - if x, ok := m.GetOneofField().(*TestAllTypes_OneofBool); ok { - return x.OneofBool - } - return false -} - -func (m *TestAllTypes) GetOneofUint64() uint64 { - if x, ok := m.GetOneofField().(*TestAllTypes_OneofUint64); ok { - return x.OneofUint64 - } - return 0 -} - -func (m *TestAllTypes) GetOneofFloat() float32 { - if x, ok := m.GetOneofField().(*TestAllTypes_OneofFloat); ok { - return x.OneofFloat - } - return 0 -} - -func (m *TestAllTypes) GetOneofDouble() float64 { - if x, ok := m.GetOneofField().(*TestAllTypes_OneofDouble); ok { - return x.OneofDouble - } - return 0 -} - -func (m *TestAllTypes) GetOneofEnum() TestAllTypes_NestedEnum { - if x, ok := m.GetOneofField().(*TestAllTypes_OneofEnum); ok { - return x.OneofEnum - } - return TestAllTypes_FOO -} - -func (m *TestAllTypes) GetOptionalBoolWrapper() *google_protobuf5.BoolValue { +func (m *TestAllTypes) GetOptionalBoolWrapper() *wrappers.BoolValue { if m != nil { return m.OptionalBoolWrapper } return nil } -func (m *TestAllTypes) GetOptionalInt32Wrapper() *google_protobuf5.Int32Value { +func (m *TestAllTypes) GetOptionalInt32Wrapper() *wrappers.Int32Value { if m != nil { return m.OptionalInt32Wrapper } return nil } -func (m *TestAllTypes) GetOptionalInt64Wrapper() *google_protobuf5.Int64Value { +func (m *TestAllTypes) GetOptionalInt64Wrapper() *wrappers.Int64Value { if m != nil { return m.OptionalInt64Wrapper } return nil } -func (m *TestAllTypes) GetOptionalUint32Wrapper() *google_protobuf5.UInt32Value { +func (m *TestAllTypes) GetOptionalUint32Wrapper() *wrappers.UInt32Value { if m != nil { return m.OptionalUint32Wrapper } return nil } -func (m *TestAllTypes) GetOptionalUint64Wrapper() *google_protobuf5.UInt64Value { +func (m *TestAllTypes) GetOptionalUint64Wrapper() *wrappers.UInt64Value { if m != nil { return m.OptionalUint64Wrapper } return nil } -func (m *TestAllTypes) GetOptionalFloatWrapper() *google_protobuf5.FloatValue { +func (m *TestAllTypes) GetOptionalFloatWrapper() *wrappers.FloatValue { if m != nil { return m.OptionalFloatWrapper } return nil } -func (m *TestAllTypes) GetOptionalDoubleWrapper() *google_protobuf5.DoubleValue { +func (m *TestAllTypes) GetOptionalDoubleWrapper() *wrappers.DoubleValue { if m != nil { return m.OptionalDoubleWrapper } return nil } -func (m *TestAllTypes) GetOptionalStringWrapper() *google_protobuf5.StringValue { +func (m *TestAllTypes) GetOptionalStringWrapper() *wrappers.StringValue { if m != nil { return m.OptionalStringWrapper } return nil } -func (m *TestAllTypes) GetOptionalBytesWrapper() *google_protobuf5.BytesValue { +func (m *TestAllTypes) GetOptionalBytesWrapper() *wrappers.BytesValue { if m != nil { return m.OptionalBytesWrapper } return nil } -func (m *TestAllTypes) GetRepeatedBoolWrapper() []*google_protobuf5.BoolValue { +func (m *TestAllTypes) GetRepeatedBoolWrapper() []*wrappers.BoolValue { if m != nil { return m.RepeatedBoolWrapper } return nil } -func (m *TestAllTypes) GetRepeatedInt32Wrapper() []*google_protobuf5.Int32Value { +func (m *TestAllTypes) GetRepeatedInt32Wrapper() []*wrappers.Int32Value { if m != nil { return m.RepeatedInt32Wrapper } return nil } -func (m *TestAllTypes) GetRepeatedInt64Wrapper() []*google_protobuf5.Int64Value { +func (m *TestAllTypes) GetRepeatedInt64Wrapper() []*wrappers.Int64Value { if m != nil { return m.RepeatedInt64Wrapper } return nil } -func (m *TestAllTypes) GetRepeatedUint32Wrapper() []*google_protobuf5.UInt32Value { +func (m *TestAllTypes) GetRepeatedUint32Wrapper() []*wrappers.UInt32Value { if m != nil { return m.RepeatedUint32Wrapper } return nil } -func (m *TestAllTypes) GetRepeatedUint64Wrapper() []*google_protobuf5.UInt64Value { +func (m *TestAllTypes) GetRepeatedUint64Wrapper() []*wrappers.UInt64Value { if m != nil { return m.RepeatedUint64Wrapper } return nil } -func (m *TestAllTypes) GetRepeatedFloatWrapper() []*google_protobuf5.FloatValue { +func (m *TestAllTypes) GetRepeatedFloatWrapper() []*wrappers.FloatValue { if m != nil { return m.RepeatedFloatWrapper } return nil } -func (m *TestAllTypes) GetRepeatedDoubleWrapper() []*google_protobuf5.DoubleValue { +func (m *TestAllTypes) GetRepeatedDoubleWrapper() []*wrappers.DoubleValue { if m != nil { return m.RepeatedDoubleWrapper } return nil } -func (m *TestAllTypes) GetRepeatedStringWrapper() []*google_protobuf5.StringValue { +func (m *TestAllTypes) GetRepeatedStringWrapper() []*wrappers.StringValue { if m != nil { return m.RepeatedStringWrapper } return nil } -func (m *TestAllTypes) GetRepeatedBytesWrapper() []*google_protobuf5.BytesValue { +func (m *TestAllTypes) GetRepeatedBytesWrapper() []*wrappers.BytesValue { if m != nil { return m.RepeatedBytesWrapper } return nil } -func (m *TestAllTypes) GetOptionalDuration() *google_protobuf1.Duration { +func (m *TestAllTypes) GetOptionalDuration() *duration.Duration { if m != nil { return m.OptionalDuration } return nil } -func (m *TestAllTypes) GetOptionalTimestamp() *google_protobuf4.Timestamp { +func (m *TestAllTypes) GetOptionalTimestamp() *timestamp.Timestamp { if m != nil { return m.OptionalTimestamp } return nil } -func (m *TestAllTypes) GetOptionalFieldMask() *google_protobuf2.FieldMask { +func (m *TestAllTypes) GetOptionalFieldMask() *field_mask.FieldMask { if m != nil { return m.OptionalFieldMask } return nil } -func (m *TestAllTypes) GetOptionalStruct() *google_protobuf3.Struct { +func (m *TestAllTypes) GetOptionalStruct() *_struct.Struct { if m != nil { return m.OptionalStruct } return nil } -func (m *TestAllTypes) GetOptionalAny() *google_protobuf.Any { +func (m *TestAllTypes) GetOptionalAny() *any.Any { if m != nil { return m.OptionalAny } return nil } -func (m *TestAllTypes) GetOptionalValue() *google_protobuf3.Value { +func (m *TestAllTypes) GetOptionalValue() *_struct.Value { if m != nil { return m.OptionalValue } return nil } -func (m *TestAllTypes) GetRepeatedDuration() []*google_protobuf1.Duration { +func (m *TestAllTypes) GetRepeatedDuration() []*duration.Duration { if m != nil { return m.RepeatedDuration } return nil } -func (m *TestAllTypes) GetRepeatedTimestamp() []*google_protobuf4.Timestamp { +func (m *TestAllTypes) GetRepeatedTimestamp() []*timestamp.Timestamp { if m != nil { return m.RepeatedTimestamp } return nil } -func (m *TestAllTypes) GetRepeatedFieldmask() []*google_protobuf2.FieldMask { +func (m *TestAllTypes) GetRepeatedFieldmask() []*field_mask.FieldMask { if m != nil { return m.RepeatedFieldmask } return nil } -func (m *TestAllTypes) GetRepeatedStruct() []*google_protobuf3.Struct { +func (m *TestAllTypes) GetRepeatedStruct() []*_struct.Struct { if m != nil { return m.RepeatedStruct } return nil } -func (m *TestAllTypes) GetRepeatedAny() []*google_protobuf.Any { +func (m *TestAllTypes) GetRepeatedAny() []*any.Any { if m != nil { return m.RepeatedAny } return nil } -func (m *TestAllTypes) GetRepeatedValue() []*google_protobuf3.Value { +func (m *TestAllTypes) GetRepeatedValue() []*_struct.Value { if m != nil { return m.RepeatedValue } @@ -1440,48 +1433,6 @@ func (m *TestAllTypes) GetFIELDName12() int32 { return 0 } -func (m *TestAllTypes) GetXFieldName13() int32 { - if m != nil { - return m.XFieldName13 - } - return 0 -} - -func (m *TestAllTypes) GetX_FieldName14() int32 { - if m != nil { - return m.X_FieldName14 - } - return 0 -} - -func (m *TestAllTypes) GetField_Name15() int32 { - if m != nil { - return m.Field_Name15 - } - return 0 -} - -func (m *TestAllTypes) GetField__Name16() int32 { - if m != nil { - return m.Field__Name16 - } - return 0 -} - -func (m *TestAllTypes) GetFieldName17__() int32 { - if m != nil { - return m.FieldName17__ - } - return 0 -} - -func (m *TestAllTypes) GetFieldName18__() int32 { - if m != nil { - return m.FieldName18__ - } - return 0 -} - // XXX_OneofFuncs is for the internal use of the proto package. func (*TestAllTypes) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { return _TestAllTypes_OneofMarshaler, _TestAllTypes_OneofUnmarshaler, _TestAllTypes_OneofSizer, []interface{}{ @@ -1489,11 +1440,6 @@ func (*TestAllTypes) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) (*TestAllTypes_OneofNestedMessage)(nil), (*TestAllTypes_OneofString)(nil), (*TestAllTypes_OneofBytes)(nil), - (*TestAllTypes_OneofBool)(nil), - (*TestAllTypes_OneofUint64)(nil), - (*TestAllTypes_OneofFloat)(nil), - (*TestAllTypes_OneofDouble)(nil), - (*TestAllTypes_OneofEnum)(nil), } } @@ -1515,25 +1461,6 @@ func _TestAllTypes_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { case *TestAllTypes_OneofBytes: b.EncodeVarint(114<<3 | proto.WireBytes) b.EncodeRawBytes(x.OneofBytes) - case *TestAllTypes_OneofBool: - t := uint64(0) - if x.OneofBool { - t = 1 - } - b.EncodeVarint(115<<3 | proto.WireVarint) - b.EncodeVarint(t) - case *TestAllTypes_OneofUint64: - b.EncodeVarint(116<<3 | proto.WireVarint) - b.EncodeVarint(uint64(x.OneofUint64)) - case *TestAllTypes_OneofFloat: - b.EncodeVarint(117<<3 | proto.WireFixed32) - b.EncodeFixed32(uint64(math.Float32bits(x.OneofFloat))) - case *TestAllTypes_OneofDouble: - b.EncodeVarint(118<<3 | proto.WireFixed64) - b.EncodeFixed64(math.Float64bits(x.OneofDouble)) - case *TestAllTypes_OneofEnum: - b.EncodeVarint(119<<3 | proto.WireVarint) - b.EncodeVarint(uint64(x.OneofEnum)) case nil: default: return fmt.Errorf("TestAllTypes.OneofField has unexpected type %T", x) @@ -1573,41 +1500,6 @@ func _TestAllTypes_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.B x, err := b.DecodeRawBytes(true) m.OneofField = &TestAllTypes_OneofBytes{x} return true, err - case 115: // oneof_field.oneof_bool - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.OneofField = &TestAllTypes_OneofBool{x != 0} - return true, err - case 116: // oneof_field.oneof_uint64 - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.OneofField = &TestAllTypes_OneofUint64{x} - return true, err - case 117: // oneof_field.oneof_float - if wire != proto.WireFixed32 { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeFixed32() - m.OneofField = &TestAllTypes_OneofFloat{math.Float32frombits(uint32(x))} - return true, err - case 118: // oneof_field.oneof_double - if wire != proto.WireFixed64 { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeFixed64() - m.OneofField = &TestAllTypes_OneofDouble{math.Float64frombits(x)} - return true, err - case 119: // oneof_field.oneof_enum - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.OneofField = &TestAllTypes_OneofEnum{TestAllTypes_NestedEnum(x)} - return true, err default: return false, nil } @@ -1618,36 +1510,21 @@ func _TestAllTypes_OneofSizer(msg proto.Message) (n int) { // oneof_field switch x := m.OneofField.(type) { case *TestAllTypes_OneofUint32: - n += proto.SizeVarint(111<<3 | proto.WireVarint) + n += 2 // tag and wire n += proto.SizeVarint(uint64(x.OneofUint32)) case *TestAllTypes_OneofNestedMessage: s := proto.Size(x.OneofNestedMessage) - n += proto.SizeVarint(112<<3 | proto.WireBytes) + n += 2 // tag and wire n += proto.SizeVarint(uint64(s)) n += s case *TestAllTypes_OneofString: - n += proto.SizeVarint(113<<3 | proto.WireBytes) + n += 2 // tag and wire n += proto.SizeVarint(uint64(len(x.OneofString))) n += len(x.OneofString) case *TestAllTypes_OneofBytes: - n += proto.SizeVarint(114<<3 | proto.WireBytes) + n += 2 // tag and wire n += proto.SizeVarint(uint64(len(x.OneofBytes))) n += len(x.OneofBytes) - case *TestAllTypes_OneofBool: - n += proto.SizeVarint(115<<3 | proto.WireVarint) - n += 1 - case *TestAllTypes_OneofUint64: - n += proto.SizeVarint(116<<3 | proto.WireVarint) - n += proto.SizeVarint(uint64(x.OneofUint64)) - case *TestAllTypes_OneofFloat: - n += proto.SizeVarint(117<<3 | proto.WireFixed32) - n += 4 - case *TestAllTypes_OneofDouble: - n += proto.SizeVarint(118<<3 | proto.WireFixed64) - n += 8 - case *TestAllTypes_OneofEnum: - n += proto.SizeVarint(119<<3 | proto.WireVarint) - n += proto.SizeVarint(uint64(x.OneofEnum)) case nil: default: panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) @@ -1656,14 +1533,36 @@ func _TestAllTypes_OneofSizer(msg proto.Message) (n int) { } type TestAllTypes_NestedMessage struct { - A int32 `protobuf:"varint,1,opt,name=a" json:"a,omitempty"` - Corecursive *TestAllTypes `protobuf:"bytes,2,opt,name=corecursive" json:"corecursive,omitempty"` + A int32 `protobuf:"varint,1,opt,name=a" json:"a,omitempty"` + Corecursive *TestAllTypes `protobuf:"bytes,2,opt,name=corecursive" json:"corecursive,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *TestAllTypes_NestedMessage) Reset() { *m = TestAllTypes_NestedMessage{} } -func (m *TestAllTypes_NestedMessage) String() string { return proto.CompactTextString(m) } -func (*TestAllTypes_NestedMessage) ProtoMessage() {} -func (*TestAllTypes_NestedMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2, 0} } +func (m *TestAllTypes_NestedMessage) Reset() { *m = TestAllTypes_NestedMessage{} } +func (m *TestAllTypes_NestedMessage) String() string { return proto.CompactTextString(m) } +func (*TestAllTypes_NestedMessage) ProtoMessage() {} +func (*TestAllTypes_NestedMessage) Descriptor() ([]byte, []int) { + return fileDescriptor_conformance_48ac832451f5d6c3, []int{2, 0} +} +func (m *TestAllTypes_NestedMessage) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TestAllTypes_NestedMessage.Unmarshal(m, b) +} +func (m *TestAllTypes_NestedMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TestAllTypes_NestedMessage.Marshal(b, m, deterministic) +} +func (dst *TestAllTypes_NestedMessage) XXX_Merge(src proto.Message) { + xxx_messageInfo_TestAllTypes_NestedMessage.Merge(dst, src) +} +func (m *TestAllTypes_NestedMessage) XXX_Size() int { + return xxx_messageInfo_TestAllTypes_NestedMessage.Size(m) +} +func (m *TestAllTypes_NestedMessage) XXX_DiscardUnknown() { + xxx_messageInfo_TestAllTypes_NestedMessage.DiscardUnknown(m) +} + +var xxx_messageInfo_TestAllTypes_NestedMessage proto.InternalMessageInfo func (m *TestAllTypes_NestedMessage) GetA() int32 { if m != nil { @@ -1680,13 +1579,35 @@ func (m *TestAllTypes_NestedMessage) GetCorecursive() *TestAllTypes { } type ForeignMessage struct { - C int32 `protobuf:"varint,1,opt,name=c" json:"c,omitempty"` + C int32 `protobuf:"varint,1,opt,name=c" json:"c,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ForeignMessage) Reset() { *m = ForeignMessage{} } +func (m *ForeignMessage) String() string { return proto.CompactTextString(m) } +func (*ForeignMessage) ProtoMessage() {} +func (*ForeignMessage) Descriptor() ([]byte, []int) { + return fileDescriptor_conformance_48ac832451f5d6c3, []int{3} +} +func (m *ForeignMessage) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ForeignMessage.Unmarshal(m, b) +} +func (m *ForeignMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ForeignMessage.Marshal(b, m, deterministic) +} +func (dst *ForeignMessage) XXX_Merge(src proto.Message) { + xxx_messageInfo_ForeignMessage.Merge(dst, src) +} +func (m *ForeignMessage) XXX_Size() int { + return xxx_messageInfo_ForeignMessage.Size(m) +} +func (m *ForeignMessage) XXX_DiscardUnknown() { + xxx_messageInfo_ForeignMessage.DiscardUnknown(m) } -func (m *ForeignMessage) Reset() { *m = ForeignMessage{} } -func (m *ForeignMessage) String() string { return proto.CompactTextString(m) } -func (*ForeignMessage) ProtoMessage() {} -func (*ForeignMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } +var xxx_messageInfo_ForeignMessage proto.InternalMessageInfo func (m *ForeignMessage) GetC() int32 { if m != nil { @@ -1699,6 +1620,25 @@ func init() { proto.RegisterType((*ConformanceRequest)(nil), "conformance.ConformanceRequest") proto.RegisterType((*ConformanceResponse)(nil), "conformance.ConformanceResponse") proto.RegisterType((*TestAllTypes)(nil), "conformance.TestAllTypes") + proto.RegisterMapType((map[bool]bool)(nil), "conformance.TestAllTypes.MapBoolBoolEntry") + proto.RegisterMapType((map[uint32]uint32)(nil), "conformance.TestAllTypes.MapFixed32Fixed32Entry") + proto.RegisterMapType((map[uint64]uint64)(nil), "conformance.TestAllTypes.MapFixed64Fixed64Entry") + proto.RegisterMapType((map[int32]float64)(nil), "conformance.TestAllTypes.MapInt32DoubleEntry") + proto.RegisterMapType((map[int32]float32)(nil), "conformance.TestAllTypes.MapInt32FloatEntry") + proto.RegisterMapType((map[int32]int32)(nil), "conformance.TestAllTypes.MapInt32Int32Entry") + proto.RegisterMapType((map[int64]int64)(nil), "conformance.TestAllTypes.MapInt64Int64Entry") + proto.RegisterMapType((map[int32]int32)(nil), "conformance.TestAllTypes.MapSfixed32Sfixed32Entry") + proto.RegisterMapType((map[int64]int64)(nil), "conformance.TestAllTypes.MapSfixed64Sfixed64Entry") + proto.RegisterMapType((map[int32]int32)(nil), "conformance.TestAllTypes.MapSint32Sint32Entry") + proto.RegisterMapType((map[int64]int64)(nil), "conformance.TestAllTypes.MapSint64Sint64Entry") + proto.RegisterMapType((map[string][]byte)(nil), "conformance.TestAllTypes.MapStringBytesEntry") + proto.RegisterMapType((map[string]ForeignEnum)(nil), "conformance.TestAllTypes.MapStringForeignEnumEntry") + proto.RegisterMapType((map[string]*ForeignMessage)(nil), "conformance.TestAllTypes.MapStringForeignMessageEntry") + proto.RegisterMapType((map[string]TestAllTypes_NestedEnum)(nil), "conformance.TestAllTypes.MapStringNestedEnumEntry") + proto.RegisterMapType((map[string]*TestAllTypes_NestedMessage)(nil), "conformance.TestAllTypes.MapStringNestedMessageEntry") + proto.RegisterMapType((map[string]string)(nil), "conformance.TestAllTypes.MapStringStringEntry") + proto.RegisterMapType((map[uint32]uint32)(nil), "conformance.TestAllTypes.MapUint32Uint32Entry") + proto.RegisterMapType((map[uint64]uint64)(nil), "conformance.TestAllTypes.MapUint64Uint64Entry") proto.RegisterType((*TestAllTypes_NestedMessage)(nil), "conformance.TestAllTypes.NestedMessage") proto.RegisterType((*ForeignMessage)(nil), "conformance.ForeignMessage") proto.RegisterEnum("conformance.WireFormat", WireFormat_name, WireFormat_value) @@ -1706,180 +1646,171 @@ func init() { proto.RegisterEnum("conformance.TestAllTypes_NestedEnum", TestAllTypes_NestedEnum_name, TestAllTypes_NestedEnum_value) } -func init() { proto.RegisterFile("conformance_proto/conformance.proto", fileDescriptor0) } - -var fileDescriptor0 = []byte{ - // 2737 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x5a, 0xd9, 0x72, 0xdb, 0xc8, - 0xd5, 0x16, 0x08, 0x59, 0x4b, 0x93, 0x92, 0xa8, 0xd6, 0xd6, 0x96, 0x5d, 0x63, 0x58, 0xb2, 0x7f, - 0xd3, 0xf6, 0x8c, 0xac, 0x05, 0x86, 0x65, 0xcf, 0x3f, 0x8e, 0x45, 0x9b, 0xb4, 0xe4, 0x8c, 0x25, - 0x17, 0x64, 0x8d, 0xab, 0x9c, 0x0b, 0x06, 0xa6, 0x20, 0x15, 0xc7, 0x24, 0xc1, 0x01, 0x48, 0x4f, - 0x94, 0xcb, 0xbc, 0x41, 0xf6, 0x7d, 0xbd, 0xcf, 0x7a, 0x93, 0xa4, 0x92, 0xab, 0x54, 0x6e, 0xb2, - 0x27, 0x95, 0x3d, 0x79, 0x85, 0xbc, 0x43, 0x52, 0xbd, 0xa2, 0xbb, 0x01, 0x50, 0xf4, 0x54, 0x0d, - 0x25, 0x1e, 0x7c, 0xfd, 0x9d, 0xd3, 0xe7, 0x1c, 0x7c, 0x2d, 0x1c, 0x18, 0x2c, 0xd7, 0x83, 0xf6, - 0x51, 0x10, 0xb6, 0xbc, 0x76, 0xdd, 0xaf, 0x75, 0xc2, 0xa0, 0x1b, 0xdc, 0x90, 0x2c, 0x2b, 0xc4, - 0x02, 0xf3, 0x92, 0x69, 0xf1, 0xec, 0x71, 0x10, 0x1c, 0x37, 0xfd, 0x1b, 0xe4, 0xd2, 0x8b, 0xde, - 0xd1, 0x0d, 0xaf, 0x7d, 0x42, 0x71, 0x8b, 0x6f, 0xe8, 0x97, 0x0e, 0x7b, 0xa1, 0xd7, 0x6d, 0x04, - 0x6d, 0x76, 0xdd, 0xd2, 0xaf, 0x1f, 0x35, 0xfc, 0xe6, 0x61, 0xad, 0xe5, 0x45, 0x2f, 0x19, 0xe2, - 0xbc, 0x8e, 0x88, 0xba, 0x61, 0xaf, 0xde, 0x65, 0x57, 0x2f, 0xe8, 0x57, 0xbb, 0x8d, 0x96, 0x1f, - 0x75, 0xbd, 0x56, 0x27, 0x2b, 0x80, 0x0f, 0x43, 0xaf, 0xd3, 0xf1, 0xc3, 0x88, 0x5e, 0x5f, 0xfa, - 0x85, 0x01, 0xe0, 0xfd, 0x78, 0x2f, 0xae, 0xff, 0x41, 0xcf, 0x8f, 0xba, 0xf0, 0x3a, 0x28, 0xf2, - 0x15, 0xb5, 0x8e, 0x77, 0xd2, 0x0c, 0xbc, 0x43, 0x64, 0x58, 0x46, 0xa9, 0xb0, 0x3d, 0xe4, 0x4e, - 0xf1, 0x2b, 0x4f, 0xe8, 0x05, 0xb8, 0x0c, 0x0a, 0xef, 0x47, 0x41, 0x5b, 0x00, 0x73, 0x96, 0x51, - 0x1a, 0xdf, 0x1e, 0x72, 0xf3, 0xd8, 0xca, 0x41, 0x7b, 0x60, 0x21, 0xa4, 0xe4, 0xfe, 0x61, 0x2d, - 0xe8, 0x75, 0x3b, 0xbd, 0x6e, 0x8d, 0x78, 0xed, 0x22, 0xd3, 0x32, 0x4a, 0x93, 0xeb, 0x0b, 0x2b, - 0x72, 0x9a, 0x9f, 0x35, 0x42, 0xbf, 0x4a, 0x2e, 0xbb, 0x73, 0x62, 0xdd, 0x1e, 0x59, 0x46, 0xcd, - 0xe5, 0x71, 0x30, 0xca, 0x1c, 0x2e, 0x7d, 0x2a, 0x07, 0x66, 0x94, 0x4d, 0x44, 0x9d, 0xa0, 0x1d, - 0xf9, 0xf0, 0x22, 0xc8, 0x77, 0xbc, 0x30, 0xf2, 0x6b, 0x7e, 0x18, 0x06, 0x21, 0xd9, 0x00, 0x8e, - 0x0b, 0x10, 0x63, 0x05, 0xdb, 0xe0, 0x55, 0x30, 0x15, 0xf9, 0x61, 0xc3, 0x6b, 0x36, 0x3e, 0xc9, - 0x61, 0x23, 0x0c, 0x36, 0x29, 0x2e, 0x50, 0xe8, 0x65, 0x30, 0x11, 0xf6, 0xda, 0x38, 0xc1, 0x0c, - 0xc8, 0xf7, 0x59, 0x60, 0x66, 0x0a, 0x4b, 0x4b, 0x9d, 0x39, 0x68, 0xea, 0x86, 0xd3, 0x52, 0xb7, - 0x08, 0x46, 0xa3, 0x97, 0x8d, 0x4e, 0xc7, 0x3f, 0x44, 0x67, 0xd8, 0x75, 0x6e, 0x28, 0x8f, 0x81, - 0x91, 0xd0, 0x8f, 0x7a, 0xcd, 0xee, 0xd2, 0x7f, 0xaa, 0xa0, 0xf0, 0xd4, 0x8f, 0xba, 0x5b, 0xcd, - 0xe6, 0xd3, 0x93, 0x8e, 0x1f, 0xc1, 0xcb, 0x60, 0x32, 0xe8, 0xe0, 0x5e, 0xf3, 0x9a, 0xb5, 0x46, - 0xbb, 0xbb, 0xb1, 0x4e, 0x12, 0x70, 0xc6, 0x9d, 0xe0, 0xd6, 0x1d, 0x6c, 0xd4, 0x61, 0x8e, 0x4d, - 0xf6, 0x65, 0x2a, 0x30, 0xc7, 0x86, 0x57, 0xc0, 0x94, 0x80, 0xf5, 0x28, 0x1d, 0xde, 0xd5, 0x84, - 0x2b, 0x56, 0x1f, 0x10, 0x6b, 0x02, 0xe8, 0xd8, 0x64, 0x57, 0xc3, 0x2a, 0x50, 0x63, 0x8c, 0x28, - 0x23, 0xde, 0xde, 0x74, 0x0c, 0xdc, 0x4f, 0x32, 0x46, 0x94, 0x11, 0xd7, 0x08, 0xaa, 0x40, 0xc7, - 0x86, 0x57, 0x41, 0x51, 0x00, 0x8f, 0x1a, 0x9f, 0xf0, 0x0f, 0x37, 0xd6, 0xd1, 0xa8, 0x65, 0x94, - 0x46, 0x5d, 0x41, 0x50, 0xa5, 0xe6, 0x24, 0xd4, 0xb1, 0xd1, 0x98, 0x65, 0x94, 0x46, 0x34, 0xa8, - 0x63, 0xc3, 0xeb, 0x60, 0x3a, 0x76, 0xcf, 0x69, 0xc7, 0x2d, 0xa3, 0x34, 0xe5, 0x0a, 0x8e, 0x7d, - 0x66, 0x4f, 0x01, 0x3b, 0x36, 0x02, 0x96, 0x51, 0x2a, 0xea, 0x60, 0xc7, 0x56, 0x52, 0x7f, 0xd4, - 0x0c, 0xbc, 0x2e, 0xca, 0x5b, 0x46, 0x29, 0x17, 0xa7, 0xbe, 0x8a, 0x8d, 0xca, 0xfe, 0x0f, 0x83, - 0xde, 0x8b, 0xa6, 0x8f, 0x0a, 0x96, 0x51, 0x32, 0xe2, 0xfd, 0x3f, 0x20, 0x56, 0xb8, 0x0c, 0xc4, - 0xca, 0xda, 0x8b, 0x20, 0x68, 0xa2, 0x09, 0xcb, 0x28, 0x8d, 0xb9, 0x05, 0x6e, 0x2c, 0x07, 0x41, - 0x53, 0xcd, 0x66, 0x37, 0x6c, 0xb4, 0x8f, 0xd1, 0x24, 0xee, 0x2a, 0x29, 0x9b, 0xc4, 0xaa, 0x44, - 0xf7, 0xe2, 0xa4, 0xeb, 0x47, 0x68, 0x0a, 0xb7, 0x71, 0x1c, 0x5d, 0x19, 0x1b, 0x61, 0x0d, 0x2c, - 0x08, 0x58, 0x9b, 0xde, 0xde, 0x2d, 0x3f, 0x8a, 0xbc, 0x63, 0x1f, 0x41, 0xcb, 0x28, 0xe5, 0xd7, - 0xaf, 0x28, 0x37, 0xb6, 0xdc, 0xa2, 0x2b, 0xbb, 0x04, 0xff, 0x98, 0xc2, 0xdd, 0x39, 0xce, 0xa3, - 0x98, 0xe1, 0x01, 0x40, 0x71, 0x96, 0x82, 0xd0, 0x6f, 0x1c, 0xb7, 0x85, 0x87, 0x19, 0xe2, 0xe1, - 0x9c, 0xe2, 0xa1, 0x4a, 0x31, 0x9c, 0x75, 0x5e, 0x24, 0x53, 0xb1, 0xc3, 0xf7, 0xc0, 0xac, 0x1e, - 0xb7, 0xdf, 0xee, 0xb5, 0xd0, 0x1c, 0x51, 0xa3, 0x4b, 0xa7, 0x05, 0x5d, 0x69, 0xf7, 0x5a, 0x2e, - 0x54, 0x23, 0xc6, 0x36, 0xf8, 0x2e, 0x98, 0x4b, 0x84, 0x4b, 0x88, 0xe7, 0x09, 0x31, 0x4a, 0x8b, - 0x95, 0x90, 0xcd, 0x68, 0x81, 0x12, 0x36, 0x47, 0x62, 0xa3, 0xd5, 0xaa, 0x75, 0x1a, 0x7e, 0xdd, - 0x47, 0x08, 0xd7, 0xac, 0x9c, 0x1b, 0xcb, 0xc5, 0xeb, 0x68, 0xdd, 0x9e, 0xe0, 0xcb, 0xf0, 0x8a, - 0xd4, 0x0a, 0xf5, 0x20, 0x3c, 0x44, 0x67, 0x19, 0xde, 0x88, 0xdb, 0xe1, 0x7e, 0x10, 0x1e, 0xc2, - 0x2a, 0x98, 0x0e, 0xfd, 0x7a, 0x2f, 0x8c, 0x1a, 0xaf, 0x7c, 0x91, 0xd6, 0x73, 0x24, 0xad, 0x67, - 0x33, 0x73, 0xe0, 0x16, 0xc5, 0x1a, 0x9e, 0xce, 0xcb, 0x60, 0x32, 0xf4, 0x3b, 0xbe, 0x87, 0xf3, - 0x48, 0x6f, 0xe6, 0x0b, 0x96, 0x89, 0xd5, 0x86, 0x5b, 0x85, 0xda, 0xc8, 0x30, 0xc7, 0x46, 0x96, - 0x65, 0x62, 0xb5, 0x91, 0x60, 0x54, 0x1b, 0x04, 0x8c, 0xa9, 0xcd, 0x45, 0xcb, 0xc4, 0x6a, 0xc3, - 0xcd, 0xb1, 0xda, 0x28, 0x40, 0xc7, 0x46, 0x4b, 0x96, 0x89, 0xd5, 0x46, 0x06, 0x6a, 0x8c, 0x4c, - 0x6d, 0x96, 0x2d, 0x13, 0xab, 0x0d, 0x37, 0xef, 0x27, 0x19, 0x99, 0xda, 0x5c, 0xb2, 0x4c, 0xac, - 0x36, 0x32, 0x90, 0xaa, 0x8d, 0x00, 0x72, 0x59, 0xb8, 0x6c, 0x99, 0x58, 0x6d, 0xb8, 0x5d, 0x52, - 0x1b, 0x15, 0xea, 0xd8, 0xe8, 0xff, 0x2c, 0x13, 0xab, 0x8d, 0x02, 0xa5, 0x6a, 0x13, 0xbb, 0xe7, - 0xb4, 0x57, 0x2c, 0x13, 0xab, 0x8d, 0x08, 0x40, 0x52, 0x1b, 0x0d, 0xec, 0xd8, 0xa8, 0x64, 0x99, - 0x58, 0x6d, 0x54, 0x30, 0x55, 0x9b, 0x38, 0x08, 0xa2, 0x36, 0x57, 0x2d, 0x13, 0xab, 0x8d, 0x08, - 0x81, 0xab, 0x8d, 0x80, 0x31, 0xb5, 0xb9, 0x66, 0x99, 0x58, 0x6d, 0xb8, 0x39, 0x56, 0x1b, 0x01, - 0x24, 0x6a, 0x73, 0xdd, 0x32, 0xb1, 0xda, 0x70, 0x23, 0x57, 0x9b, 0x38, 0x42, 0xaa, 0x36, 0x6f, - 0x5a, 0x26, 0x56, 0x1b, 0x11, 0x9f, 0x50, 0x9b, 0x98, 0x8d, 0xa8, 0xcd, 0x5b, 0x96, 0x89, 0xd5, - 0x46, 0xd0, 0x71, 0xb5, 0x11, 0x30, 0x4d, 0x6d, 0x56, 0x2d, 0xf3, 0xb5, 0xd4, 0x86, 0xf3, 0x24, - 0xd4, 0x26, 0xce, 0x92, 0xa6, 0x36, 0x6b, 0xc4, 0x43, 0x7f, 0xb5, 0x11, 0xc9, 0x4c, 0xa8, 0x8d, - 0x1e, 0x37, 0x11, 0x85, 0x0d, 0xcb, 0x1c, 0x5c, 0x6d, 0xd4, 0x88, 0xb9, 0xda, 0x24, 0xc2, 0x25, - 0xc4, 0x36, 0x21, 0xee, 0xa3, 0x36, 0x5a, 0xa0, 0x5c, 0x6d, 0xb4, 0x6a, 0x31, 0xb5, 0x71, 0x70, - 0xcd, 0xa8, 0xda, 0xa8, 0x75, 0x13, 0x6a, 0x23, 0xd6, 0x11, 0xb5, 0xb9, 0xc5, 0xf0, 0x46, 0xdc, - 0x0e, 0x44, 0x6d, 0x9e, 0x82, 0xa9, 0x96, 0xd7, 0xa1, 0x02, 0xc1, 0x64, 0x62, 0x93, 0x24, 0xf5, - 0xcd, 0xec, 0x0c, 0x3c, 0xf6, 0x3a, 0x44, 0x3b, 0xc8, 0x47, 0xa5, 0xdd, 0x0d, 0x4f, 0xdc, 0x89, - 0x96, 0x6c, 0x93, 0x58, 0x1d, 0x9b, 0xa9, 0xca, 0xed, 0xc1, 0x58, 0x1d, 0x9b, 0x7c, 0x28, 0xac, - 0xcc, 0x06, 0x9f, 0x83, 0x69, 0xcc, 0x4a, 0xe5, 0x87, 0xab, 0xd0, 0x1d, 0xc2, 0xbb, 0xd2, 0x97, - 0x97, 0x4a, 0x13, 0xfd, 0xa4, 0xcc, 0x38, 0x3c, 0xd9, 0x2a, 0x73, 0x3b, 0x36, 0x17, 0xae, 0xb7, - 0x07, 0xe4, 0x76, 0x6c, 0xfa, 0xa9, 0x72, 0x73, 0x2b, 0xe7, 0xa6, 0x22, 0xc7, 0xb5, 0xee, 0xff, - 0x07, 0xe0, 0xa6, 0x02, 0xb8, 0xaf, 0xc5, 0x2d, 0x5b, 0x65, 0x6e, 0xc7, 0xe6, 0xf2, 0xf8, 0xce, - 0x80, 0xdc, 0x8e, 0xbd, 0xaf, 0xc5, 0x2d, 0x5b, 0xe1, 0xc7, 0xc1, 0x0c, 0xe6, 0x66, 0xda, 0x26, - 0x24, 0xf5, 0x2e, 0x61, 0x5f, 0xed, 0xcb, 0xce, 0x74, 0x96, 0xfd, 0xa0, 0xfc, 0x38, 0x50, 0xd5, - 0xae, 0x78, 0x70, 0x6c, 0xa1, 0xc4, 0x1f, 0x19, 0xd4, 0x83, 0x63, 0xb3, 0x1f, 0x9a, 0x07, 0x61, - 0x87, 0x47, 0x60, 0x8e, 0xe4, 0x87, 0x6f, 0x42, 0x28, 0xf8, 0x3d, 0xe2, 0x63, 0xbd, 0x7f, 0x8e, - 0x18, 0x98, 0xff, 0xa4, 0x5e, 0x70, 0xc8, 0xfa, 0x15, 0xd5, 0x0f, 0xae, 0x04, 0xdf, 0xcb, 0xd6, - 0xc0, 0x7e, 0x1c, 0x9b, 0xff, 0xd4, 0xfd, 0xc4, 0x57, 0xd4, 0xfb, 0x95, 0x1e, 0x1a, 0xe5, 0x41, - 0xef, 0x57, 0x72, 0x9c, 0x68, 0xf7, 0x2b, 0x3d, 0x62, 0x9e, 0x81, 0x62, 0xcc, 0xca, 0xce, 0x98, - 0xfb, 0x84, 0xf6, 0xad, 0xd3, 0x69, 0xe9, 0xe9, 0x43, 0x79, 0x27, 0x5b, 0x8a, 0x11, 0xee, 0x02, - 0xec, 0x89, 0x9c, 0x46, 0xf4, 0x48, 0x7a, 0x40, 0x58, 0xaf, 0xf5, 0x65, 0xc5, 0xe7, 0x14, 0xfe, - 0x9f, 0x52, 0xe6, 0x5b, 0xb1, 0x45, 0xb4, 0x3b, 0x95, 0x42, 0x76, 0x7e, 0x55, 0x06, 0x69, 0x77, - 0x02, 0xa5, 0x9f, 0x52, 0xbb, 0x4b, 0x56, 0x9e, 0x04, 0xc6, 0x4d, 0x8f, 0xbc, 0xea, 0x00, 0x49, - 0xa0, 0xcb, 0xc9, 0x69, 0x18, 0x27, 0x41, 0x32, 0xc2, 0x0e, 0x38, 0x2b, 0x11, 0x6b, 0x87, 0xe4, - 0x43, 0xe2, 0xe1, 0xe6, 0x00, 0x1e, 0x94, 0x63, 0x91, 0x7a, 0x9a, 0x6f, 0xa5, 0x5e, 0x84, 0x11, - 0x58, 0x94, 0x3c, 0xea, 0xa7, 0xe6, 0x36, 0x71, 0xe9, 0x0c, 0xe0, 0x52, 0x3d, 0x33, 0xa9, 0xcf, - 0x85, 0x56, 0xfa, 0x55, 0x78, 0x0c, 0xe6, 0x93, 0xdb, 0x24, 0x47, 0xdf, 0xce, 0x20, 0xf7, 0x80, - 0xb4, 0x0d, 0x7c, 0xf4, 0x49, 0xf7, 0x80, 0x76, 0x05, 0xbe, 0x0f, 0x16, 0x52, 0x76, 0x47, 0x3c, - 0x3d, 0x22, 0x9e, 0x36, 0x06, 0xdf, 0x5a, 0xec, 0x6a, 0xb6, 0x95, 0x72, 0x09, 0x2e, 0x83, 0x42, - 0xd0, 0xf6, 0x83, 0x23, 0x7e, 0xdc, 0x04, 0xf8, 0x11, 0x7b, 0x7b, 0xc8, 0xcd, 0x13, 0x2b, 0x3b, - 0x3c, 0x3e, 0x06, 0x66, 0x29, 0x48, 0xab, 0x6d, 0xe7, 0xb5, 0x1e, 0xb7, 0xb6, 0x87, 0x5c, 0x48, - 0x68, 0xd4, 0x5a, 0x8a, 0x08, 0x58, 0xb7, 0x7f, 0xc0, 0x27, 0x12, 0xc4, 0xca, 0x7a, 0xf7, 0x22, - 0xa0, 0x5f, 0x59, 0xdb, 0x86, 0x6c, 0xbc, 0x01, 0x88, 0x91, 0x76, 0xe1, 0x05, 0x00, 0x18, 0x04, - 0xdf, 0x87, 0x11, 0x7e, 0x10, 0xdd, 0x1e, 0x72, 0xc7, 0x29, 0x02, 0xdf, 0x5b, 0xca, 0x56, 0x1d, - 0x1b, 0x75, 0x2d, 0xa3, 0x34, 0xac, 0x6c, 0xd5, 0xb1, 0x63, 0x47, 0x54, 0x7b, 0x7a, 0xf8, 0xf1, - 0x58, 0x38, 0xa2, 0x62, 0x22, 0x78, 0x98, 0x90, 0xbc, 0xc2, 0x8f, 0xc6, 0x82, 0x87, 0x09, 0x43, - 0x85, 0x47, 0x43, 0xca, 0xf6, 0xe1, 0xe0, 0x8f, 0x78, 0x22, 0x66, 0x52, 0x9e, 0x3d, 0xe9, 0x69, - 0x8c, 0x88, 0x0c, 0x9b, 0xa6, 0xa1, 0x5f, 0x19, 0x24, 0xf7, 0x8b, 0x2b, 0x74, 0xdc, 0xb6, 0xc2, - 0xe7, 0x3c, 0x2b, 0x78, 0xab, 0xef, 0x79, 0xcd, 0x9e, 0x1f, 0x3f, 0xa6, 0x61, 0xd3, 0x33, 0xba, - 0x0e, 0xba, 0x60, 0x5e, 0x9d, 0xd1, 0x08, 0xc6, 0x5f, 0x1b, 0xec, 0xd1, 0x56, 0x67, 0x24, 0x7a, - 0x47, 0x29, 0x67, 0x95, 0x49, 0x4e, 0x06, 0xa7, 0x63, 0x0b, 0xce, 0xdf, 0xf4, 0xe1, 0x74, 0xec, - 0x24, 0xa7, 0x63, 0x73, 0xce, 0x03, 0xe9, 0x21, 0xbf, 0xa7, 0x06, 0xfa, 0x5b, 0x4a, 0x7a, 0x3e, - 0x41, 0x7a, 0x20, 0x45, 0x3a, 0xa7, 0x0e, 0x89, 0xb2, 0x68, 0xa5, 0x58, 0x7f, 0xd7, 0x8f, 0x96, - 0x07, 0x3b, 0xa7, 0x8e, 0x94, 0xd2, 0x32, 0x40, 0x1a, 0x47, 0xb0, 0xfe, 0x3e, 0x2b, 0x03, 0xa4, - 0x97, 0xb4, 0x0c, 0x10, 0x5b, 0x5a, 0xa8, 0xb4, 0xd3, 0x04, 0xe9, 0x1f, 0xb2, 0x42, 0xa5, 0xcd, - 0xa7, 0x85, 0x4a, 0x8d, 0x69, 0xb4, 0x4c, 0x61, 0x38, 0xed, 0x1f, 0xb3, 0x68, 0xe9, 0x4d, 0xa8, - 0xd1, 0x52, 0x63, 0x5a, 0x06, 0xc8, 0x3d, 0x2a, 0x58, 0xff, 0x94, 0x95, 0x01, 0x72, 0xdb, 0x6a, - 0x19, 0x20, 0x36, 0xce, 0xb9, 0x27, 0x3d, 0x1c, 0x28, 0xcd, 0xff, 0x67, 0x83, 0xc8, 0x60, 0xdf, - 0xe6, 0x97, 0x1f, 0x0a, 0xa5, 0x20, 0xd5, 0x91, 0x81, 0x60, 0xfc, 0x8b, 0xc1, 0x9e, 0xb4, 0xfa, - 0x35, 0xbf, 0x32, 0x58, 0xc8, 0xe0, 0x94, 0x1a, 0xea, 0xaf, 0x7d, 0x38, 0x45, 0xf3, 0x2b, 0x53, - 0x08, 0xa9, 0x46, 0xda, 0x30, 0x42, 0x90, 0xfe, 0x8d, 0x92, 0x9e, 0xd2, 0xfc, 0xea, 0xcc, 0x22, - 0x8b, 0x56, 0x8a, 0xf5, 0xef, 0xfd, 0x68, 0x45, 0xf3, 0xab, 0x13, 0x8e, 0xb4, 0x0c, 0xa8, 0xcd, - 0xff, 0x8f, 0xac, 0x0c, 0xc8, 0xcd, 0xaf, 0x0c, 0x03, 0xd2, 0x42, 0xd5, 0x9a, 0xff, 0x9f, 0x59, - 0xa1, 0x2a, 0xcd, 0xaf, 0x8e, 0x0e, 0xd2, 0x68, 0xb5, 0xe6, 0xff, 0x57, 0x16, 0xad, 0xd2, 0xfc, - 0xea, 0xb3, 0x68, 0x5a, 0x06, 0xd4, 0xe6, 0xff, 0x77, 0x56, 0x06, 0xe4, 0xe6, 0x57, 0x06, 0x0e, - 0x9c, 0xf3, 0xa1, 0x34, 0xd7, 0xe5, 0xef, 0x70, 0xd0, 0x77, 0x73, 0x6c, 0x4e, 0x96, 0xd8, 0x3b, - 0x43, 0xc4, 0x33, 0x5f, 0x6e, 0x81, 0x8f, 0x80, 0x18, 0x1a, 0xd6, 0xc4, 0xcb, 0x1a, 0xf4, 0xbd, - 0x5c, 0xc6, 0xf9, 0xf1, 0x94, 0x43, 0x5c, 0xe1, 0x5f, 0x98, 0xe0, 0x47, 0xc1, 0x8c, 0x34, 0xc4, - 0xe6, 0x2f, 0x8e, 0xd0, 0xf7, 0xb3, 0xc8, 0xaa, 0x18, 0xf3, 0xd8, 0x8b, 0x5e, 0xc6, 0x64, 0xc2, - 0x04, 0xb7, 0xd4, 0xb9, 0x70, 0xaf, 0xde, 0x45, 0x3f, 0xa0, 0x44, 0x0b, 0x69, 0x45, 0xe8, 0xd5, - 0xbb, 0xca, 0xc4, 0xb8, 0x57, 0xef, 0xc2, 0x4d, 0x20, 0x66, 0x8b, 0x35, 0xaf, 0x7d, 0x82, 0x7e, - 0x48, 0xd7, 0xcf, 0x26, 0xd6, 0x6f, 0xb5, 0x4f, 0xdc, 0x3c, 0x87, 0x6e, 0xb5, 0x4f, 0xe0, 0x5d, - 0x69, 0xd6, 0xfc, 0x0a, 0x97, 0x01, 0xfd, 0x88, 0xae, 0x9d, 0x4f, 0xac, 0xa5, 0x55, 0x12, 0xd3, - 0x4d, 0xf2, 0x15, 0x97, 0x27, 0x6e, 0x50, 0x5e, 0x9e, 0x1f, 0xe7, 0x48, 0xb5, 0xfb, 0x95, 0x47, - 0xf4, 0xa5, 0x54, 0x1e, 0x41, 0x14, 0x97, 0xe7, 0x27, 0xb9, 0x0c, 0x85, 0x93, 0xca, 0xc3, 0x97, - 0xc5, 0xe5, 0x91, 0xb9, 0x48, 0x79, 0x48, 0x75, 0x7e, 0x9a, 0xc5, 0x25, 0x55, 0x27, 0x1e, 0x0a, - 0xb2, 0x55, 0xb8, 0x3a, 0xf2, 0xad, 0x82, 0xab, 0xf3, 0x4b, 0x4a, 0x94, 0x5d, 0x1d, 0xe9, 0xee, - 0x60, 0xd5, 0x11, 0x14, 0xb8, 0x3a, 0x3f, 0xa3, 0xeb, 0x33, 0xaa, 0xc3, 0xa1, 0xac, 0x3a, 0x62, - 0x25, 0xad, 0xce, 0xcf, 0xe9, 0xda, 0xcc, 0xea, 0x70, 0x38, 0xad, 0xce, 0x05, 0x00, 0xc8, 0xfe, - 0xdb, 0x5e, 0xcb, 0x5f, 0x43, 0x9f, 0x36, 0xc9, 0x6b, 0x28, 0xc9, 0x04, 0x2d, 0x90, 0xa7, 0xfd, - 0x8b, 0xbf, 0xae, 0xa3, 0xcf, 0xc8, 0x88, 0x5d, 0x6c, 0x82, 0x17, 0x41, 0xa1, 0x16, 0x43, 0x36, - 0xd0, 0x67, 0x19, 0xa4, 0xca, 0x21, 0x1b, 0x70, 0x09, 0x4c, 0x50, 0x04, 0x81, 0xd8, 0x35, 0xf4, - 0x39, 0x9d, 0x86, 0xfc, 0x3d, 0x49, 0xbe, 0xad, 0x62, 0xc8, 0x4d, 0xf4, 0x79, 0x8a, 0x90, 0x6d, - 0x70, 0x99, 0xd3, 0xac, 0x12, 0x1e, 0x07, 0x7d, 0x41, 0x01, 0x61, 0x1e, 0x47, 0xec, 0x08, 0x7f, - 0xbb, 0x85, 0xbe, 0xa8, 0x3b, 0xba, 0x85, 0x01, 0x22, 0xb4, 0x4d, 0xf4, 0x25, 0x3d, 0xda, 0xcd, - 0x78, 0xcb, 0xf8, 0xeb, 0x6d, 0xf4, 0x65, 0x9d, 0xe2, 0x36, 0x5c, 0x02, 0x85, 0xaa, 0x40, 0xac, - 0xad, 0xa2, 0xaf, 0xb0, 0x38, 0x04, 0xc9, 0xda, 0x2a, 0xc1, 0xec, 0x54, 0xde, 0x7d, 0x50, 0xdb, - 0xdd, 0x7a, 0x5c, 0x59, 0x5b, 0x43, 0x5f, 0xe5, 0x18, 0x6c, 0xa4, 0xb6, 0x18, 0x43, 0x72, 0xbd, - 0x8e, 0xbe, 0xa6, 0x60, 0x88, 0x0d, 0x5e, 0x02, 0x93, 0x35, 0x29, 0xbf, 0x6b, 0x1b, 0xe8, 0xeb, - 0x09, 0x6f, 0x1b, 0x14, 0x55, 0x8d, 0x51, 0x36, 0xfa, 0x46, 0x02, 0x65, 0xc7, 0x09, 0xa4, 0xa0, - 0x9b, 0xe8, 0x9b, 0x72, 0x02, 0x09, 0x48, 0xca, 0x32, 0xdd, 0x9d, 0x83, 0xbe, 0x95, 0x00, 0x39, - 0xd8, 0x9f, 0x14, 0xd3, 0xad, 0x5a, 0x0d, 0x7d, 0x3b, 0x81, 0xba, 0x85, 0x51, 0x52, 0x4c, 0x9b, - 0xb5, 0x1a, 0xfa, 0x4e, 0x22, 0xaa, 0xcd, 0xc5, 0xe7, 0x60, 0x42, 0x7d, 0xd0, 0x29, 0x00, 0xc3, - 0x63, 0x6f, 0x44, 0x0d, 0x0f, 0xbe, 0x0d, 0xf2, 0xf5, 0x40, 0xbc, 0xd4, 0x40, 0xb9, 0xd3, 0x5e, - 0x80, 0xc8, 0xe8, 0xc5, 0x7b, 0x00, 0x26, 0x87, 0x94, 0xb0, 0x08, 0xcc, 0x97, 0xfe, 0x09, 0x73, - 0x81, 0x7f, 0x85, 0xb3, 0xe0, 0x0c, 0xbd, 0x7d, 0x72, 0xc4, 0x46, 0xbf, 0xdc, 0xc9, 0x6d, 0x1a, - 0x31, 0x83, 0x3c, 0x90, 0x94, 0x19, 0xcc, 0x14, 0x06, 0x53, 0x66, 0x28, 0x83, 0xd9, 0xb4, 0xd1, - 0xa3, 0xcc, 0x31, 0x91, 0xc2, 0x31, 0x91, 0xce, 0xa1, 0x8c, 0x18, 0x65, 0x8e, 0xe1, 0x14, 0x8e, - 0xe1, 0x24, 0x47, 0x62, 0x94, 0x28, 0x73, 0x4c, 0xa7, 0x70, 0x4c, 0xa7, 0x73, 0x28, 0x23, 0x43, - 0x99, 0x03, 0xa6, 0x70, 0x40, 0x99, 0xe3, 0x01, 0x98, 0x4f, 0x1f, 0x0c, 0xca, 0x2c, 0xa3, 0x29, - 0x2c, 0xa3, 0x19, 0x2c, 0xea, 0xf0, 0x4f, 0x66, 0x19, 0x49, 0x61, 0x19, 0x91, 0x59, 0xaa, 0x00, - 0x65, 0x8d, 0xf7, 0x64, 0x9e, 0xa9, 0x14, 0x9e, 0xa9, 0x2c, 0x1e, 0x6d, 0x7c, 0x27, 0xf3, 0x14, - 0x53, 0x78, 0x8a, 0xa9, 0xdd, 0x26, 0x0f, 0xe9, 0x4e, 0xeb, 0xd7, 0x9c, 0xcc, 0xb0, 0x05, 0x66, - 0x52, 0xe6, 0x71, 0xa7, 0x51, 0x18, 0x32, 0xc5, 0x5d, 0x50, 0xd4, 0x87, 0x6f, 0xf2, 0xfa, 0xb1, - 0x94, 0xf5, 0x63, 0x29, 0x4d, 0xa2, 0x0f, 0xda, 0x64, 0x8e, 0xf1, 0x14, 0x8e, 0xf1, 0xe4, 0x36, - 0xf4, 0x89, 0xda, 0x69, 0x14, 0x05, 0x99, 0x22, 0x04, 0xe7, 0xfa, 0x8c, 0xcc, 0x52, 0xa8, 0xde, - 0x91, 0xa9, 0x5e, 0xe3, 0x7d, 0x95, 0xe4, 0xf3, 0x18, 0x9c, 0xef, 0x37, 0x33, 0x4b, 0x71, 0xba, - 0xa6, 0x3a, 0xed, 0xfb, 0x0a, 0x4b, 0x72, 0xd4, 0xa4, 0x0d, 0x97, 0x36, 0x2b, 0x4b, 0x71, 0x72, - 0x47, 0x76, 0x32, 0xe8, 0x4b, 0x2d, 0xc9, 0x9b, 0x07, 0xce, 0x66, 0xce, 0xcb, 0x52, 0xdc, 0xad, - 0xa8, 0xee, 0xb2, 0x5f, 0x75, 0xc5, 0x2e, 0x96, 0x6e, 0x03, 0x20, 0x4d, 0xf6, 0x46, 0x81, 0x59, - 0xdd, 0xdb, 0x2b, 0x0e, 0xe1, 0x5f, 0xca, 0x5b, 0x6e, 0xd1, 0xa0, 0xbf, 0x3c, 0x2f, 0xe6, 0xb0, - 0xbb, 0xdd, 0xca, 0xc3, 0xe2, 0x7f, 0xf9, 0x7f, 0x46, 0x79, 0x42, 0x8c, 0xa2, 0xf0, 0xa9, 0xb2, - 0xf4, 0x06, 0x98, 0xd4, 0x06, 0x92, 0x05, 0x60, 0xd4, 0xf9, 0x81, 0x52, 0xbf, 0x76, 0x13, 0x80, - 0xf8, 0xdf, 0x30, 0xc1, 0x29, 0x90, 0x3f, 0xd8, 0xdd, 0x7f, 0x52, 0xb9, 0xbf, 0x53, 0xdd, 0xa9, - 0x3c, 0x28, 0x0e, 0xc1, 0x02, 0x18, 0x7b, 0xe2, 0xee, 0x3d, 0xdd, 0x2b, 0x1f, 0x54, 0x8b, 0x06, - 0x1c, 0x03, 0xc3, 0x8f, 0xf6, 0xf7, 0x76, 0x8b, 0xb9, 0x6b, 0xf7, 0x40, 0x5e, 0x9e, 0x07, 0x4e, - 0x81, 0x7c, 0x75, 0xcf, 0xad, 0xec, 0x3c, 0xdc, 0xad, 0xd1, 0x48, 0x25, 0x03, 0x8d, 0x58, 0x31, - 0x3c, 0x2f, 0xe6, 0xca, 0x17, 0xc1, 0x85, 0x7a, 0xd0, 0x4a, 0xfc, 0x61, 0x26, 0x25, 0xe7, 0xc5, - 0x08, 0xb1, 0x6e, 0xfc, 0x2f, 0x00, 0x00, 0xff, 0xff, 0x33, 0xc2, 0x0c, 0xb6, 0xeb, 0x26, 0x00, - 0x00, +func init() { proto.RegisterFile("conformance.proto", fileDescriptor_conformance_48ac832451f5d6c3) } + +var fileDescriptor_conformance_48ac832451f5d6c3 = []byte{ + // 2600 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x5a, 0x5b, 0x73, 0x13, 0xc9, + 0x15, 0xf6, 0x68, 0xc0, 0x36, 0x2d, 0xd9, 0x96, 0xdb, 0xb7, 0xc6, 0x50, 0xcb, 0x60, 0x96, 0x20, + 0x60, 0xd7, 0xeb, 0xcb, 0x30, 0x5c, 0x36, 0x4b, 0xb0, 0xc0, 0x02, 0x93, 0xc5, 0xa2, 0xc6, 0x78, + 0xa9, 0x22, 0x0f, 0xca, 0x20, 0x8f, 0x5d, 0x5a, 0x24, 0x8d, 0x76, 0x66, 0xb4, 0x89, 0xf3, 0x98, + 0x7f, 0x90, 0xfb, 0xf5, 0x2f, 0xe4, 0x5a, 0x95, 0x4a, 0x52, 0xc9, 0x53, 0x2a, 0x2f, 0xb9, 0x27, + 0x95, 0x7b, 0xf2, 0x63, 0x92, 0xea, 0xeb, 0x74, 0xb7, 0x7a, 0x64, 0xb1, 0x55, 0x2b, 0x5b, 0xa7, + 0xbf, 0xfe, 0xce, 0xe9, 0xd3, 0x67, 0xbe, 0x76, 0x9f, 0x01, 0xcc, 0x36, 0xa3, 0xee, 0x61, 0x14, + 0x77, 0x82, 0x6e, 0x33, 0x5c, 0xed, 0xc5, 0x51, 0x1a, 0xc1, 0xa2, 0x64, 0x5a, 0x3e, 0x7b, 0x14, + 0x45, 0x47, 0xed, 0xf0, 0x1d, 0x32, 0xf4, 0xb2, 0x7f, 0xf8, 0x4e, 0xd0, 0x3d, 0xa6, 0xb8, 0xe5, + 0x37, 0xf4, 0xa1, 0x83, 0x7e, 0x1c, 0xa4, 0xad, 0xa8, 0xcb, 0xc6, 0x1d, 0x7d, 0xfc, 0xb0, 0x15, + 0xb6, 0x0f, 0x1a, 0x9d, 0x20, 0x79, 0xc5, 0x10, 0xe7, 0x75, 0x44, 0x92, 0xc6, 0xfd, 0x66, 0xca, + 0x46, 0x2f, 0xe8, 0xa3, 0x69, 0xab, 0x13, 0x26, 0x69, 0xd0, 0xe9, 0xe5, 0x05, 0xf0, 0xb9, 0x38, + 0xe8, 0xf5, 0xc2, 0x38, 0xa1, 0xe3, 0x2b, 0xbf, 0xb2, 0x00, 0xbc, 0x9f, 0xad, 0xc5, 0x0f, 0x3f, + 0xea, 0x87, 0x49, 0x0a, 0xaf, 0x83, 0x32, 0x9f, 0xd1, 0xe8, 0x05, 0xc7, 0xed, 0x28, 0x38, 0x40, + 0x96, 0x63, 0x55, 0x4a, 0x8f, 0xc6, 0xfc, 0x19, 0x3e, 0xf2, 0x94, 0x0e, 0xc0, 0x4b, 0xa0, 0xf4, + 0x61, 0x12, 0x75, 0x05, 0xb0, 0xe0, 0x58, 0x95, 0x33, 0x8f, 0xc6, 0xfc, 0x22, 0xb6, 0x72, 0x50, + 0x1d, 0x2c, 0xc5, 0x94, 0x3c, 0x3c, 0x68, 0x44, 0xfd, 0xb4, 0xd7, 0x4f, 0x1b, 0xc4, 0x6b, 0x8a, + 0x6c, 0xc7, 0xaa, 0x4c, 0x6f, 0x2c, 0xad, 0xca, 0x69, 0x7e, 0xde, 0x8a, 0xc3, 0x1a, 0x19, 0xf6, + 0x17, 0xc4, 0xbc, 0x3a, 0x99, 0x46, 0xcd, 0xd5, 0x33, 0x60, 0x82, 0x39, 0x5c, 0xf9, 0x62, 0x01, + 0xcc, 0x29, 0x8b, 0x48, 0x7a, 0x51, 0x37, 0x09, 0xe1, 0x45, 0x50, 0xec, 0x05, 0x71, 0x12, 0x36, + 0xc2, 0x38, 0x8e, 0x62, 0xb2, 0x00, 0x1c, 0x17, 0x20, 0xc6, 0x6d, 0x6c, 0x83, 0x57, 0xc1, 0x4c, + 0x12, 0xc6, 0xad, 0xa0, 0xdd, 0xfa, 0x02, 0x87, 0x8d, 0x33, 0xd8, 0xb4, 0x18, 0xa0, 0xd0, 0xcb, + 0x60, 0x2a, 0xee, 0x77, 0x71, 0x82, 0x19, 0x90, 0xaf, 0xb3, 0xc4, 0xcc, 0x14, 0x66, 0x4a, 0x9d, + 0x3d, 0x6a, 0xea, 0x4e, 0x99, 0x52, 0xb7, 0x0c, 0x26, 0x92, 0x57, 0xad, 0x5e, 0x2f, 0x3c, 0x40, + 0xa7, 0xd9, 0x38, 0x37, 0x54, 0x27, 0xc1, 0x78, 0x1c, 0x26, 0xfd, 0x76, 0xba, 0xf2, 0x93, 0xfb, + 0xa0, 0xf4, 0x2c, 0x4c, 0xd2, 0xad, 0x76, 0xfb, 0xd9, 0x71, 0x2f, 0x4c, 0xe0, 0x65, 0x30, 0x1d, + 0xf5, 0x70, 0xad, 0x05, 0xed, 0x46, 0xab, 0x9b, 0x6e, 0x6e, 0x90, 0x04, 0x9c, 0xf6, 0xa7, 0xb8, + 0x75, 0x07, 0x1b, 0x75, 0x98, 0xe7, 0x92, 0x75, 0xd9, 0x0a, 0xcc, 0x73, 0xe1, 0x15, 0x30, 0x23, + 0x60, 0x7d, 0x4a, 0x87, 0x57, 0x35, 0xe5, 0x8b, 0xd9, 0xfb, 0xc4, 0x3a, 0x00, 0xf4, 0x5c, 0xb2, + 0xaa, 0x53, 0x2a, 0x50, 0x63, 0x4c, 0x28, 0x23, 0x5e, 0xde, 0x6c, 0x06, 0xdc, 0x1b, 0x64, 0x4c, + 0x28, 0x23, 0xde, 0x23, 0xa8, 0x02, 0x3d, 0x17, 0x5e, 0x05, 0x65, 0x01, 0x3c, 0x6c, 0x7d, 0x3e, + 0x3c, 0xd8, 0xdc, 0x40, 0x13, 0x8e, 0x55, 0x99, 0xf0, 0x05, 0x41, 0x8d, 0x9a, 0x07, 0xa1, 0x9e, + 0x8b, 0x26, 0x1d, 0xab, 0x32, 0xae, 0x41, 0x3d, 0x17, 0x5e, 0x07, 0xb3, 0x99, 0x7b, 0x4e, 0x7b, + 0xc6, 0xb1, 0x2a, 0x33, 0xbe, 0xe0, 0xd8, 0x63, 0x76, 0x03, 0xd8, 0x73, 0x11, 0x70, 0xac, 0x4a, + 0x59, 0x07, 0x7b, 0xae, 0x92, 0xfa, 0xc3, 0x76, 0x14, 0xa4, 0xa8, 0xe8, 0x58, 0x95, 0x42, 0x96, + 0xfa, 0x1a, 0x36, 0x2a, 0xeb, 0x3f, 0x88, 0xfa, 0x2f, 0xdb, 0x21, 0x2a, 0x39, 0x56, 0xc5, 0xca, + 0xd6, 0xff, 0x80, 0x58, 0xe1, 0x25, 0x20, 0x66, 0x36, 0x5e, 0x46, 0x51, 0x1b, 0x4d, 0x39, 0x56, + 0x65, 0xd2, 0x2f, 0x71, 0x63, 0x35, 0x8a, 0xda, 0x6a, 0x36, 0xd3, 0xb8, 0xd5, 0x3d, 0x42, 0xd3, + 0xb8, 0xaa, 0xa4, 0x6c, 0x12, 0xab, 0x12, 0xdd, 0xcb, 0xe3, 0x34, 0x4c, 0xd0, 0x0c, 0x2e, 0xe3, + 0x2c, 0xba, 0x2a, 0x36, 0xc2, 0x06, 0x58, 0x12, 0xb0, 0x2e, 0x7d, 0xbc, 0x3b, 0x61, 0x92, 0x04, + 0x47, 0x21, 0x82, 0x8e, 0x55, 0x29, 0x6e, 0x5c, 0x51, 0x1e, 0x6c, 0xb9, 0x44, 0x57, 0x77, 0x09, + 0xfe, 0x09, 0x85, 0xfb, 0x0b, 0x9c, 0x47, 0x31, 0xc3, 0x7d, 0x80, 0xb2, 0x2c, 0x45, 0x71, 0xd8, + 0x3a, 0xea, 0x0a, 0x0f, 0x73, 0xc4, 0xc3, 0x39, 0xc5, 0x43, 0x8d, 0x62, 0x38, 0xeb, 0xa2, 0x48, + 0xa6, 0x62, 0x87, 0x1f, 0x80, 0x79, 0x3d, 0xee, 0xb0, 0xdb, 0xef, 0xa0, 0x05, 0xa2, 0x46, 0x6f, + 0x9e, 0x14, 0xf4, 0x76, 0xb7, 0xdf, 0xf1, 0xa1, 0x1a, 0x31, 0xb6, 0xc1, 0xf7, 0xc1, 0xc2, 0x40, + 0xb8, 0x84, 0x78, 0x91, 0x10, 0x23, 0x53, 0xac, 0x84, 0x6c, 0x4e, 0x0b, 0x94, 0xb0, 0x79, 0x12, + 0x1b, 0xdd, 0xad, 0x46, 0xaf, 0x15, 0x36, 0x43, 0x84, 0xf0, 0x9e, 0x55, 0x0b, 0x93, 0x85, 0x6c, + 0x1e, 0xdd, 0xb7, 0xa7, 0x78, 0x18, 0x5e, 0x91, 0x4a, 0xa1, 0x19, 0xc5, 0x07, 0xe8, 0x2c, 0xc3, + 0x5b, 0x59, 0x39, 0xdc, 0x8f, 0xe2, 0x03, 0x58, 0x03, 0xb3, 0x71, 0xd8, 0xec, 0xc7, 0x49, 0xeb, + 0xe3, 0x50, 0xa4, 0xf5, 0x1c, 0x49, 0xeb, 0xd9, 0xdc, 0x1c, 0xf8, 0x65, 0x31, 0x87, 0xa7, 0xf3, + 0x32, 0x98, 0x8e, 0xc3, 0x5e, 0x18, 0xe0, 0x3c, 0xd2, 0x87, 0xf9, 0x82, 0x63, 0x63, 0xb5, 0xe1, + 0x56, 0xa1, 0x36, 0x32, 0xcc, 0x73, 0x91, 0xe3, 0xd8, 0x58, 0x6d, 0x24, 0x18, 0xd5, 0x06, 0x01, + 0x63, 0x6a, 0x73, 0xd1, 0xb1, 0xb1, 0xda, 0x70, 0x73, 0xa6, 0x36, 0x0a, 0xd0, 0x73, 0xd1, 0x8a, + 0x63, 0x63, 0xb5, 0x91, 0x81, 0x1a, 0x23, 0x53, 0x9b, 0x4b, 0x8e, 0x8d, 0xd5, 0x86, 0x9b, 0xf7, + 0x06, 0x19, 0x99, 0xda, 0xbc, 0xe9, 0xd8, 0x58, 0x6d, 0x64, 0x20, 0x55, 0x1b, 0x01, 0xe4, 0xb2, + 0x70, 0xd9, 0xb1, 0xb1, 0xda, 0x70, 0xbb, 0xa4, 0x36, 0x2a, 0xd4, 0x73, 0xd1, 0x27, 0x1c, 0x1b, + 0xab, 0x8d, 0x02, 0xa5, 0x6a, 0x93, 0xb9, 0xe7, 0xb4, 0x57, 0x1c, 0x1b, 0xab, 0x8d, 0x08, 0x40, + 0x52, 0x1b, 0x0d, 0xec, 0xb9, 0xa8, 0xe2, 0xd8, 0x58, 0x6d, 0x54, 0x30, 0x55, 0x9b, 0x2c, 0x08, + 0xa2, 0x36, 0x57, 0x1d, 0x1b, 0xab, 0x8d, 0x08, 0x81, 0xab, 0x8d, 0x80, 0x31, 0xb5, 0xb9, 0xe6, + 0xd8, 0x58, 0x6d, 0xb8, 0x39, 0x53, 0x1b, 0x01, 0x24, 0x6a, 0x73, 0xdd, 0xb1, 0xb1, 0xda, 0x70, + 0x23, 0x57, 0x9b, 0x2c, 0x42, 0xaa, 0x36, 0x6f, 0x39, 0x36, 0x56, 0x1b, 0x11, 0x9f, 0x50, 0x9b, + 0x8c, 0x8d, 0xa8, 0xcd, 0xdb, 0x8e, 0x8d, 0xd5, 0x46, 0xd0, 0x71, 0xb5, 0x11, 0x30, 0x4d, 0x6d, + 0xd6, 0x1c, 0xfb, 0xb5, 0xd4, 0x86, 0xf3, 0x0c, 0xa8, 0x4d, 0x96, 0x25, 0x4d, 0x6d, 0xd6, 0x89, + 0x87, 0xe1, 0x6a, 0x23, 0x92, 0x39, 0xa0, 0x36, 0x7a, 0xdc, 0x44, 0x14, 0x36, 0x1d, 0x7b, 0x74, + 0xb5, 0x51, 0x23, 0xe6, 0x6a, 0x33, 0x10, 0x2e, 0x21, 0x76, 0x09, 0xf1, 0x10, 0xb5, 0xd1, 0x02, + 0xe5, 0x6a, 0xa3, 0xed, 0x16, 0x53, 0x1b, 0x0f, 0xef, 0x19, 0x55, 0x1b, 0x75, 0xdf, 0x84, 0xda, + 0x88, 0x79, 0x44, 0x6d, 0x6e, 0x32, 0xbc, 0x95, 0x95, 0x03, 0x51, 0x9b, 0x67, 0x60, 0xa6, 0x13, + 0xf4, 0xa8, 0x40, 0x30, 0x99, 0xb8, 0x45, 0x92, 0xfa, 0x56, 0x7e, 0x06, 0x9e, 0x04, 0x3d, 0xa2, + 0x1d, 0xe4, 0x63, 0xbb, 0x9b, 0xc6, 0xc7, 0xfe, 0x54, 0x47, 0xb6, 0x49, 0xac, 0x9e, 0xcb, 0x54, + 0xe5, 0xf6, 0x68, 0xac, 0x9e, 0x4b, 0x3e, 0x14, 0x56, 0x66, 0x83, 0x2f, 0xc0, 0x2c, 0x66, 0xa5, + 0xf2, 0xc3, 0x55, 0xe8, 0x0e, 0xe1, 0x5d, 0x1d, 0xca, 0x4b, 0xa5, 0x89, 0x7e, 0x52, 0x66, 0x1c, + 0x9e, 0x6c, 0x95, 0xb9, 0x3d, 0x97, 0x0b, 0xd7, 0xbb, 0x23, 0x72, 0x7b, 0x2e, 0xfd, 0x54, 0xb9, + 0xb9, 0x95, 0x73, 0x53, 0x91, 0xe3, 0x5a, 0xf7, 0xc9, 0x11, 0xb8, 0xa9, 0x00, 0xee, 0x69, 0x71, + 0xcb, 0x56, 0x99, 0xdb, 0x73, 0xb9, 0x3c, 0xbe, 0x37, 0x22, 0xb7, 0xe7, 0xee, 0x69, 0x71, 0xcb, + 0x56, 0xf8, 0x59, 0x30, 0x87, 0xb9, 0x99, 0xb6, 0x09, 0x49, 0xbd, 0x4b, 0xd8, 0xd7, 0x86, 0xb2, + 0x33, 0x9d, 0x65, 0x3f, 0x28, 0x3f, 0x0e, 0x54, 0xb5, 0x2b, 0x1e, 0x3c, 0x57, 0x28, 0xf1, 0xa7, + 0x46, 0xf5, 0xe0, 0xb9, 0xec, 0x87, 0xe6, 0x41, 0xd8, 0xe1, 0x21, 0x58, 0x20, 0xf9, 0xe1, 0x8b, + 0x10, 0x0a, 0x7e, 0x8f, 0xf8, 0xd8, 0x18, 0x9e, 0x23, 0x06, 0xe6, 0x3f, 0xa9, 0x17, 0x1c, 0xb2, + 0x3e, 0xa2, 0xfa, 0xc1, 0x3b, 0xc1, 0xd7, 0xb2, 0x35, 0xb2, 0x1f, 0xcf, 0xe5, 0x3f, 0x75, 0x3f, + 0xd9, 0x88, 0xfa, 0xbc, 0xd2, 0x43, 0xa3, 0x3a, 0xea, 0xf3, 0x4a, 0x8e, 0x13, 0xed, 0x79, 0xa5, + 0x47, 0xcc, 0x73, 0x50, 0xce, 0x58, 0xd9, 0x19, 0x73, 0x9f, 0xd0, 0xbe, 0x7d, 0x32, 0x2d, 0x3d, + 0x7d, 0x28, 0xef, 0x74, 0x47, 0x31, 0xc2, 0x5d, 0x80, 0x3d, 0x91, 0xd3, 0x88, 0x1e, 0x49, 0x0f, + 0x08, 0xeb, 0xb5, 0xa1, 0xac, 0xf8, 0x9c, 0xc2, 0xff, 0x53, 0xca, 0x62, 0x27, 0xb3, 0x88, 0x72, + 0xa7, 0x52, 0xc8, 0xce, 0xaf, 0xed, 0x51, 0xca, 0x9d, 0x40, 0xe9, 0xa7, 0x54, 0xee, 0x92, 0x95, + 0x27, 0x81, 0x71, 0xd3, 0x23, 0xaf, 0x36, 0x42, 0x12, 0xe8, 0x74, 0x72, 0x1a, 0x66, 0x49, 0x90, + 0x8c, 0xb0, 0x07, 0xce, 0x4a, 0xc4, 0xda, 0x21, 0xf9, 0x90, 0x78, 0xb8, 0x31, 0x82, 0x07, 0xe5, + 0x58, 0xa4, 0x9e, 0x16, 0x3b, 0xc6, 0x41, 0x98, 0x80, 0x65, 0xc9, 0xa3, 0x7e, 0x6a, 0x3e, 0x22, + 0x2e, 0xbd, 0x11, 0x5c, 0xaa, 0x67, 0x26, 0xf5, 0xb9, 0xd4, 0x31, 0x8f, 0xc2, 0x23, 0xb0, 0x38, + 0xb8, 0x4c, 0x72, 0xf4, 0xed, 0x8c, 0xf2, 0x0c, 0x48, 0xcb, 0xc0, 0x47, 0x9f, 0xf4, 0x0c, 0x68, + 0x23, 0xf0, 0x43, 0xb0, 0x64, 0x58, 0x1d, 0xf1, 0xf4, 0x98, 0x78, 0xda, 0x1c, 0x7d, 0x69, 0x99, + 0xab, 0xf9, 0x8e, 0x61, 0x08, 0x5e, 0x02, 0xa5, 0xa8, 0x1b, 0x46, 0x87, 0xfc, 0xb8, 0x89, 0xf0, + 0x15, 0xfb, 0xd1, 0x98, 0x5f, 0x24, 0x56, 0x76, 0x78, 0x7c, 0x06, 0xcc, 0x53, 0x90, 0xb6, 0xb7, + 0xbd, 0xd7, 0xba, 0x6e, 0x3d, 0x1a, 0xf3, 0x21, 0xa1, 0x51, 0xf7, 0x52, 0x44, 0xc0, 0xaa, 0xfd, + 0x23, 0xde, 0x91, 0x20, 0x56, 0x56, 0xbb, 0x17, 0x01, 0xfd, 0xca, 0xca, 0x36, 0x66, 0xed, 0x0d, + 0x40, 0x8c, 0xb4, 0x0a, 0xeb, 0xd2, 0xc5, 0x85, 0x3c, 0x8f, 0xac, 0xf1, 0x84, 0x7e, 0x63, 0x91, + 0x30, 0x97, 0x57, 0x69, 0x67, 0x6a, 0x95, 0xb7, 0x44, 0x56, 0xf1, 0x13, 0xf7, 0x41, 0xd0, 0xee, + 0x87, 0xd9, 0x8d, 0x06, 0x9b, 0x9e, 0xd3, 0x79, 0xd0, 0x07, 0x8b, 0x6a, 0x3b, 0x43, 0x30, 0xfe, + 0xd6, 0x62, 0xb7, 0x40, 0x9d, 0x91, 0x48, 0x03, 0xa5, 0x9c, 0x57, 0x9a, 0x1e, 0x39, 0x9c, 0x9e, + 0x2b, 0x38, 0x7f, 0x37, 0x84, 0xd3, 0x73, 0x07, 0x39, 0x3d, 0x97, 0x73, 0xee, 0x4b, 0xf7, 0xe1, + 0xbe, 0x1a, 0xe8, 0xef, 0x29, 0xe9, 0xf9, 0x01, 0xd2, 0x7d, 0x29, 0xd2, 0x05, 0xb5, 0x9f, 0x92, + 0x47, 0x2b, 0xc5, 0xfa, 0x87, 0x61, 0xb4, 0x3c, 0xd8, 0x05, 0xb5, 0xfb, 0x62, 0xca, 0x00, 0xd1, + 0x77, 0xc1, 0xfa, 0xc7, 0xbc, 0x0c, 0x10, 0x0d, 0xd7, 0x32, 0x40, 0x6c, 0xa6, 0x50, 0xa9, 0xba, + 0x0b, 0xd2, 0x3f, 0xe5, 0x85, 0x4a, 0x05, 0x5c, 0x0b, 0x95, 0x1a, 0x4d, 0xb4, 0xec, 0x61, 0xe4, + 0xb4, 0x7f, 0xce, 0xa3, 0xa5, 0xf5, 0xaa, 0xd1, 0x52, 0xa3, 0x29, 0x03, 0xa4, 0x9c, 0x05, 0xeb, + 0x5f, 0xf2, 0x32, 0x40, 0x2a, 0x5c, 0xcb, 0x00, 0xb1, 0x71, 0xce, 0xba, 0xf4, 0x77, 0xb4, 0x52, + 0xfc, 0x7f, 0xb5, 0x88, 0x62, 0x0c, 0x2d, 0x7e, 0xf9, 0xfe, 0x24, 0x05, 0xa9, 0xde, 0xae, 0x05, + 0xe3, 0xdf, 0x2c, 0x76, 0x29, 0x19, 0x56, 0xfc, 0xca, 0x1d, 0x3c, 0x87, 0x53, 0x2a, 0xa8, 0xbf, + 0x0f, 0xe1, 0x14, 0xc5, 0xaf, 0x5c, 0xd8, 0xa5, 0x3d, 0xd2, 0xee, 0xed, 0x82, 0xf4, 0x1f, 0x94, + 0xf4, 0x84, 0xe2, 0x57, 0xaf, 0xf7, 0x79, 0xb4, 0x52, 0xac, 0xff, 0x1c, 0x46, 0x2b, 0x8a, 0x5f, + 0x6d, 0x06, 0x98, 0x32, 0xa0, 0x16, 0xff, 0xbf, 0xf2, 0x32, 0x20, 0x17, 0xbf, 0x72, 0x6f, 0x36, + 0x85, 0xaa, 0x15, 0xff, 0xbf, 0xf3, 0x42, 0x55, 0x8a, 0x5f, 0xbd, 0x65, 0x9b, 0x68, 0xb5, 0xe2, + 0xff, 0x4f, 0x1e, 0xad, 0x52, 0xfc, 0xea, 0xb5, 0xcd, 0x94, 0x01, 0xb5, 0xf8, 0xff, 0x9b, 0x97, + 0x01, 0xb9, 0xf8, 0x95, 0xbb, 0x39, 0xe7, 0x7c, 0x28, 0xb5, 0x40, 0xf9, 0xeb, 0x0e, 0xf4, 0xbd, + 0x02, 0x6b, 0x29, 0x0d, 0xac, 0x9d, 0x21, 0xb2, 0xf6, 0x28, 0xb7, 0xc0, 0xc7, 0x40, 0xf4, 0xd7, + 0x1a, 0xe2, 0xbd, 0x06, 0xfa, 0x7e, 0x21, 0xe7, 0xfc, 0x78, 0xc6, 0x21, 0xbe, 0xf0, 0x2f, 0x4c, + 0xf0, 0xd3, 0x60, 0x4e, 0xea, 0xf7, 0xf2, 0x77, 0x2c, 0xe8, 0x07, 0x79, 0x64, 0x35, 0x8c, 0x79, + 0x12, 0x24, 0xaf, 0x32, 0x32, 0x61, 0x82, 0x5b, 0x6a, 0x0b, 0xb5, 0xdf, 0x4c, 0xd1, 0x0f, 0x29, + 0xd1, 0x92, 0x69, 0x13, 0xfa, 0xcd, 0x54, 0x69, 0xae, 0xf6, 0x9b, 0x29, 0xbc, 0x05, 0x44, 0x1b, + 0xae, 0x11, 0x74, 0x8f, 0xd1, 0x8f, 0xe8, 0xfc, 0xf9, 0x81, 0xf9, 0x5b, 0xdd, 0x63, 0xbf, 0xc8, + 0xa1, 0x5b, 0xdd, 0x63, 0x78, 0x57, 0x6a, 0xcb, 0x7e, 0x8c, 0xb7, 0x01, 0xfd, 0x98, 0xce, 0x5d, + 0x1c, 0x98, 0x4b, 0x77, 0x49, 0x34, 0x02, 0xc9, 0x57, 0xbc, 0x3d, 0x59, 0x81, 0xf2, 0xed, 0xf9, + 0x69, 0x81, 0xec, 0xf6, 0xb0, 0xed, 0x11, 0x75, 0x29, 0x6d, 0x8f, 0x20, 0xca, 0xb6, 0xe7, 0x67, + 0x85, 0x1c, 0x85, 0x93, 0xb6, 0x87, 0x4f, 0xcb, 0xb6, 0x47, 0xe6, 0x22, 0xdb, 0x43, 0x76, 0xe7, + 0xe7, 0x79, 0x5c, 0xd2, 0xee, 0x64, 0xfd, 0x33, 0x36, 0x0b, 0xef, 0x8e, 0xfc, 0xa8, 0xe0, 0xdd, + 0xf9, 0x35, 0x25, 0xca, 0xdf, 0x1d, 0xe9, 0xe9, 0x60, 0xbb, 0x23, 0x28, 0xf0, 0xee, 0xfc, 0x82, + 0xce, 0xcf, 0xd9, 0x1d, 0x0e, 0x65, 0xbb, 0x23, 0x66, 0xd2, 0xdd, 0xf9, 0x25, 0x9d, 0x9b, 0xbb, + 0x3b, 0x1c, 0x4e, 0x77, 0xe7, 0x02, 0x00, 0x64, 0xfd, 0xdd, 0xa0, 0x13, 0xae, 0xa3, 0x2f, 0xd9, + 0xe4, 0x8d, 0x8d, 0x64, 0x82, 0x0e, 0x28, 0xd2, 0xfa, 0xc5, 0x5f, 0x37, 0xd0, 0x97, 0x65, 0xc4, + 0x2e, 0x36, 0xc1, 0x8b, 0xa0, 0xd4, 0xc8, 0x20, 0x9b, 0xe8, 0x2b, 0x0c, 0x52, 0xe3, 0x90, 0x4d, + 0xb8, 0x02, 0xa6, 0x28, 0x82, 0x40, 0xdc, 0x06, 0xfa, 0xaa, 0x4e, 0xe3, 0xe2, 0xbf, 0xf1, 0xc8, + 0xb7, 0x35, 0x0c, 0xb9, 0x81, 0xbe, 0x46, 0x11, 0xb2, 0x0d, 0x5e, 0xe2, 0x34, 0x6b, 0x84, 0xc7, + 0x43, 0x5f, 0x57, 0x40, 0x98, 0xc7, 0x13, 0x2b, 0xc2, 0xdf, 0x6e, 0xa2, 0x6f, 0xe8, 0x8e, 0x6e, + 0x62, 0x80, 0x08, 0xed, 0x16, 0xfa, 0xa6, 0x1e, 0xed, 0xad, 0x6c, 0xc9, 0xf8, 0xeb, 0x6d, 0xf4, + 0x2d, 0x9d, 0xe2, 0x36, 0x5c, 0x01, 0xa5, 0x9a, 0x40, 0xac, 0xaf, 0xa1, 0x6f, 0xb3, 0x38, 0x04, + 0xc9, 0xfa, 0x1a, 0xc1, 0xec, 0x6c, 0xbf, 0xff, 0xa0, 0xb1, 0xbb, 0xf5, 0x64, 0x7b, 0x7d, 0x1d, + 0x7d, 0x87, 0x63, 0xb0, 0x91, 0xda, 0x32, 0x0c, 0xc9, 0xf5, 0x06, 0xfa, 0xae, 0x82, 0x21, 0xb6, + 0xe5, 0x17, 0x60, 0x4a, 0xfd, 0x8b, 0xb9, 0x04, 0xac, 0x80, 0xbd, 0x5a, 0xb3, 0x02, 0xf8, 0x2e, + 0x28, 0x36, 0x23, 0xd1, 0x1d, 0x47, 0x85, 0x93, 0x3a, 0xe9, 0x32, 0x7a, 0xf9, 0x1e, 0x80, 0x83, + 0xdd, 0x2e, 0x58, 0x06, 0xf6, 0xab, 0xf0, 0x98, 0xb9, 0xc0, 0xbf, 0xc2, 0x79, 0x70, 0x9a, 0x16, + 0x57, 0x81, 0xd8, 0xe8, 0x97, 0x3b, 0x85, 0x5b, 0x56, 0xc6, 0x20, 0x77, 0xb6, 0x64, 0x06, 0xdb, + 0xc0, 0x60, 0xcb, 0x0c, 0x55, 0x30, 0x6f, 0xea, 0x61, 0xc9, 0x1c, 0x53, 0x06, 0x8e, 0x29, 0x33, + 0x87, 0xd2, 0xab, 0x92, 0x39, 0x4e, 0x19, 0x38, 0x4e, 0x0d, 0x72, 0x0c, 0xf4, 0xa4, 0x64, 0x8e, + 0x59, 0x03, 0xc7, 0xac, 0x99, 0x43, 0xe9, 0x3d, 0xc9, 0x1c, 0xd0, 0xc0, 0x01, 0x65, 0x8e, 0x07, + 0x60, 0xd1, 0xdc, 0x61, 0x92, 0x59, 0x26, 0x0c, 0x2c, 0x13, 0x39, 0x2c, 0x6a, 0x17, 0x49, 0x66, + 0x19, 0x37, 0xb0, 0x8c, 0xcb, 0x2c, 0x35, 0x80, 0xf2, 0xfa, 0x44, 0x32, 0xcf, 0x8c, 0x81, 0x67, + 0x26, 0x8f, 0x47, 0xeb, 0x03, 0xc9, 0x3c, 0x65, 0x03, 0x4f, 0xd9, 0x58, 0x6d, 0x72, 0xb7, 0xe7, + 0xa4, 0x7a, 0x2d, 0xc8, 0x0c, 0x5b, 0x60, 0xce, 0xd0, 0xd8, 0x39, 0x89, 0xc2, 0x92, 0x29, 0xee, + 0x82, 0xb2, 0xde, 0xc5, 0x91, 0xe7, 0x4f, 0x1a, 0xe6, 0x4f, 0x1a, 0x8a, 0x44, 0xef, 0xd8, 0xc8, + 0x1c, 0x67, 0x0c, 0x1c, 0x67, 0x06, 0x97, 0xa1, 0xb7, 0x66, 0x4e, 0xa2, 0x28, 0xc9, 0x14, 0x31, + 0x38, 0x37, 0xa4, 0xf7, 0x62, 0xa0, 0x7a, 0x4f, 0xa6, 0x7a, 0x8d, 0x17, 0x1f, 0x92, 0xcf, 0x23, + 0x70, 0x7e, 0x58, 0xf3, 0xc5, 0xe0, 0x74, 0x5d, 0x75, 0x3a, 0xf4, 0x5d, 0x88, 0xe4, 0xa8, 0x4d, + 0x0b, 0xce, 0xd4, 0x74, 0x31, 0x38, 0xb9, 0x23, 0x3b, 0x19, 0xf5, 0xed, 0x88, 0xe4, 0x2d, 0x00, + 0x67, 0x73, 0x1b, 0x2f, 0x06, 0x77, 0xab, 0xaa, 0xbb, 0xfc, 0x77, 0x26, 0x99, 0x8b, 0x95, 0xdb, + 0x00, 0x48, 0x2d, 0xa2, 0x09, 0x60, 0xd7, 0xea, 0xf5, 0xf2, 0x18, 0xfe, 0xa5, 0xba, 0xe5, 0x97, + 0x2d, 0xfa, 0xcb, 0x8b, 0x72, 0x01, 0xbb, 0xdb, 0xdd, 0x7e, 0x58, 0xfe, 0x1f, 0xff, 0xcf, 0xaa, + 0x4e, 0xf1, 0xe6, 0x09, 0x39, 0xc0, 0x56, 0xde, 0x00, 0xd3, 0x5a, 0x67, 0xab, 0x04, 0xac, 0x26, + 0x3f, 0x50, 0x9a, 0xd7, 0x6e, 0x00, 0x90, 0xfd, 0x63, 0x18, 0x38, 0x03, 0x8a, 0xfb, 0xbb, 0x7b, + 0x4f, 0xb7, 0xef, 0xef, 0xd4, 0x76, 0xb6, 0x1f, 0x94, 0xc7, 0x60, 0x09, 0x4c, 0x3e, 0xf5, 0xeb, + 0xcf, 0xea, 0xd5, 0xfd, 0x5a, 0xd9, 0x82, 0x93, 0xe0, 0xd4, 0xe3, 0xbd, 0xfa, 0x6e, 0xb9, 0x70, + 0xed, 0x1e, 0x28, 0xca, 0x8d, 0xa5, 0x19, 0x50, 0xac, 0xd5, 0xfd, 0xed, 0x9d, 0x87, 0xbb, 0x0d, + 0x1a, 0xa9, 0x64, 0xa0, 0x11, 0x2b, 0x86, 0x17, 0xe5, 0x42, 0xf5, 0x22, 0xb8, 0xd0, 0x8c, 0x3a, + 0x03, 0x7f, 0xb6, 0x48, 0xc9, 0x79, 0x39, 0x4e, 0xac, 0x9b, 0xff, 0x0f, 0x00, 0x00, 0xff, 0xff, + 0x29, 0x30, 0x51, 0x54, 0x22, 0x25, 0x00, 0x00, } diff --git a/vendor/github.com/golang/protobuf/_conformance/conformance_proto/conformance.proto b/vendor/github.com/golang/protobuf/conformance/internal/conformance_proto/conformance.proto similarity index 96% rename from vendor/github.com/golang/protobuf/_conformance/conformance_proto/conformance.proto rename to vendor/github.com/golang/protobuf/conformance/internal/conformance_proto/conformance.proto index 95a8fd135..fc96074ac 100644 --- a/vendor/github.com/golang/protobuf/_conformance/conformance_proto/conformance.proto +++ b/vendor/github.com/golang/protobuf/conformance/internal/conformance_proto/conformance.proto @@ -210,11 +210,6 @@ message TestAllTypes { NestedMessage oneof_nested_message = 112; string oneof_string = 113; bytes oneof_bytes = 114; - bool oneof_bool = 115; - uint64 oneof_uint64 = 116; - float oneof_float = 117; - double oneof_double = 118; - NestedEnum oneof_enum = 119; } // Well-known types @@ -253,7 +248,6 @@ message TestAllTypes { repeated google.protobuf.Value repeated_value = 316; // Test field-name-to-JSON-name convention. - // (protobuf says names can be any valid C/C++ identifier.) int32 fieldname1 = 401; int32 field_name2 = 402; int32 _field_name3 = 403; @@ -266,12 +260,6 @@ message TestAllTypes { int32 Field_Name10 = 410; int32 FIELD_NAME11 = 411; int32 FIELD_name12 = 412; - int32 __field_name13 = 413; - int32 __Field_name14 = 414; - int32 field__name15 = 415; - int32 field__Name16 = 416; - int32 field_name17__ = 417; - int32 Field_name18__ = 418; } message ForeignMessage { diff --git a/vendor/github.com/golang/protobuf/conformance/test.sh b/vendor/github.com/golang/protobuf/conformance/test.sh new file mode 100755 index 000000000..e6de29b9a --- /dev/null +++ b/vendor/github.com/golang/protobuf/conformance/test.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +PROTOBUF_ROOT=$1 +CONFORMANCE_ROOT=$1/conformance +CONFORMANCE_TEST_RUNNER=$CONFORMANCE_ROOT/conformance-test-runner + +cd $(dirname $0) + +if [[ $PROTOBUF_ROOT == "" ]]; then + echo "usage: test.sh " >/dev/stderr + exit 1 +fi + +if [[ ! -x $CONFORMANCE_TEST_RUNNER ]]; then + echo "SKIP: conformance test runner not installed" >/dev/stderr + exit 0 +fi + +a=$CONFORMANCE_ROOT/conformance.proto +b=internal/conformance_proto/conformance.proto +if [[ $(diff $a $b) != "" ]]; then + cp $a $b + echo "WARNING: conformance.proto is out of date" >/dev/stderr +fi + +$CONFORMANCE_TEST_RUNNER --failure_list failure_list_go.txt ./conformance.sh diff --git a/vendor/github.com/golang/protobuf/jsonpb/jsonpb.go b/vendor/github.com/golang/protobuf/jsonpb/jsonpb.go index 110ae1384..ff368f33c 100644 --- a/vendor/github.com/golang/protobuf/jsonpb/jsonpb.go +++ b/vendor/github.com/golang/protobuf/jsonpb/jsonpb.go @@ -56,6 +56,8 @@ import ( stpb "github.com/golang/protobuf/ptypes/struct" ) +const secondInNanos = int64(time.Second / time.Nanosecond) + // Marshaler is a configurable object for converting between // protocol buffer objects and a JSON representation for them. type Marshaler struct { @@ -118,6 +120,14 @@ type JSONPBUnmarshaler interface { // Marshal marshals a protocol buffer into JSON. func (m *Marshaler) Marshal(out io.Writer, pb proto.Message) error { + v := reflect.ValueOf(pb) + if pb == nil || (v.Kind() == reflect.Ptr && v.IsNil()) { + return errors.New("Marshal called with nil") + } + // Check for unset required fields first. + if err := checkRequiredFields(pb); err != nil { + return err + } writer := &errWriter{writer: out} return m.marshalObject(writer, pb, "", "") } @@ -190,13 +200,22 @@ func (m *Marshaler) marshalObject(out *errWriter, v proto.Message, indent, typeU // Any is a bit more involved. return m.marshalAny(out, v, indent) case "Duration": - // "Generated output always contains 3, 6, or 9 fractional digits, + // "Generated output always contains 0, 3, 6, or 9 fractional digits, // depending on required precision." s, ns := s.Field(0).Int(), s.Field(1).Int() - d := time.Duration(s)*time.Second + time.Duration(ns)*time.Nanosecond - x := fmt.Sprintf("%.9f", d.Seconds()) + if ns <= -secondInNanos || ns >= secondInNanos { + return fmt.Errorf("ns out of range (%v, %v)", -secondInNanos, secondInNanos) + } + if (s > 0 && ns < 0) || (s < 0 && ns > 0) { + return errors.New("signs of seconds and nanos do not match") + } + if s < 0 { + ns = -ns + } + x := fmt.Sprintf("%d.%09d", s, ns) x = strings.TrimSuffix(x, "000") x = strings.TrimSuffix(x, "000") + x = strings.TrimSuffix(x, ".000") out.write(`"`) out.write(x) out.write(`s"`) @@ -207,13 +226,17 @@ func (m *Marshaler) marshalObject(out *errWriter, v proto.Message, indent, typeU return m.marshalValue(out, &proto.Properties{}, s.Field(0), indent) case "Timestamp": // "RFC 3339, where generated output will always be Z-normalized - // and uses 3, 6 or 9 fractional digits." + // and uses 0, 3, 6 or 9 fractional digits." s, ns := s.Field(0).Int(), s.Field(1).Int() + if ns < 0 || ns >= secondInNanos { + return fmt.Errorf("ns out of range [0, %v)", secondInNanos) + } t := time.Unix(s, ns).UTC() // time.RFC3339Nano isn't exactly right (we need to get 3/6/9 fractional digits). x := t.Format("2006-01-02T15:04:05.000000000") x = strings.TrimSuffix(x, "000") x = strings.TrimSuffix(x, "000") + x = strings.TrimSuffix(x, ".000") out.write(`"`) out.write(x) out.write(`Z"`) @@ -632,7 +655,10 @@ func (u *Unmarshaler) UnmarshalNext(dec *json.Decoder, pb proto.Message) error { if err := dec.Decode(&inputValue); err != nil { return err } - return u.unmarshalValue(reflect.ValueOf(pb).Elem(), inputValue, nil) + if err := u.unmarshalValue(reflect.ValueOf(pb).Elem(), inputValue, nil); err != nil { + return err + } + return checkRequiredFields(pb) } // Unmarshal unmarshals a JSON object stream into a protocol @@ -803,7 +829,7 @@ func (u *Unmarshaler) unmarshalValue(target reflect.Value, inputValue json.RawMe return fmt.Errorf("bad ListValue: %v", err) } - target.Field(0).Set(reflect.ValueOf(make([]*stpb.Value, len(s), len(s)))) + target.Field(0).Set(reflect.ValueOf(make([]*stpb.Value, len(s)))) for i, sv := range s { if err := u.unmarshalValue(target.Field(0).Index(i), sv, prop); err != nil { return err @@ -973,13 +999,6 @@ func (u *Unmarshaler) unmarshalValue(target reflect.Value, inputValue json.RawMe } if mp != nil { target.Set(reflect.MakeMap(targetType)) - var keyprop, valprop *proto.Properties - if prop != nil { - // These could still be nil if the protobuf metadata is broken somehow. - // TODO: This won't work because the fields are unexported. - // We should probably just reparse them. - //keyprop, valprop = prop.mkeyprop, prop.mvalprop - } for ks, raw := range mp { // Unmarshal map key. The core json library already decoded the key into a // string, so we handle that specially. Other types were quoted post-serialization. @@ -988,14 +1007,16 @@ func (u *Unmarshaler) unmarshalValue(target reflect.Value, inputValue json.RawMe k = reflect.ValueOf(ks) } else { k = reflect.New(targetType.Key()).Elem() - if err := u.unmarshalValue(k, json.RawMessage(ks), keyprop); err != nil { + // TODO: pass the correct Properties if needed. + if err := u.unmarshalValue(k, json.RawMessage(ks), nil); err != nil { return err } } // Unmarshal map value. v := reflect.New(targetType.Elem()).Elem() - if err := u.unmarshalValue(v, raw, valprop); err != nil { + // TODO: pass the correct Properties if needed. + if err := u.unmarshalValue(v, raw, nil); err != nil { return err } target.SetMapIndex(k, v) @@ -1081,3 +1102,140 @@ func (s mapKeys) Less(i, j int) bool { } return fmt.Sprint(s[i].Interface()) < fmt.Sprint(s[j].Interface()) } + +// checkRequiredFields returns an error if any required field in the given proto message is not set. +// This function is used by both Marshal and Unmarshal. While required fields only exist in a +// proto2 message, a proto3 message can contain proto2 message(s). +func checkRequiredFields(pb proto.Message) error { + // Most well-known type messages do not contain required fields. The "Any" type may contain + // a message that has required fields. + // + // When an Any message is being marshaled, the code will invoked proto.Unmarshal on Any.Value + // field in order to transform that into JSON, and that should have returned an error if a + // required field is not set in the embedded message. + // + // When an Any message is being unmarshaled, the code will have invoked proto.Marshal on the + // embedded message to store the serialized message in Any.Value field, and that should have + // returned an error if a required field is not set. + if _, ok := pb.(wkt); ok { + return nil + } + + v := reflect.ValueOf(pb) + // Skip message if it is not a struct pointer. + if v.Kind() != reflect.Ptr { + return nil + } + v = v.Elem() + if v.Kind() != reflect.Struct { + return nil + } + + for i := 0; i < v.NumField(); i++ { + field := v.Field(i) + sfield := v.Type().Field(i) + + if sfield.PkgPath != "" { + // blank PkgPath means the field is exported; skip if not exported + continue + } + + if strings.HasPrefix(sfield.Name, "XXX_") { + continue + } + + // Oneof field is an interface implemented by wrapper structs containing the actual oneof + // field, i.e. an interface containing &T{real_value}. + if sfield.Tag.Get("protobuf_oneof") != "" { + if field.Kind() != reflect.Interface { + continue + } + v := field.Elem() + if v.Kind() != reflect.Ptr || v.IsNil() { + continue + } + v = v.Elem() + if v.Kind() != reflect.Struct || v.NumField() < 1 { + continue + } + field = v.Field(0) + sfield = v.Type().Field(0) + } + + protoTag := sfield.Tag.Get("protobuf") + if protoTag == "" { + continue + } + var prop proto.Properties + prop.Init(sfield.Type, sfield.Name, protoTag, &sfield) + + switch field.Kind() { + case reflect.Map: + if field.IsNil() { + continue + } + // Check each map value. + keys := field.MapKeys() + for _, k := range keys { + v := field.MapIndex(k) + if err := checkRequiredFieldsInValue(v); err != nil { + return err + } + } + case reflect.Slice: + // Handle non-repeated type, e.g. bytes. + if !prop.Repeated { + if prop.Required && field.IsNil() { + return fmt.Errorf("required field %q is not set", prop.Name) + } + continue + } + + // Handle repeated type. + if field.IsNil() { + continue + } + // Check each slice item. + for i := 0; i < field.Len(); i++ { + v := field.Index(i) + if err := checkRequiredFieldsInValue(v); err != nil { + return err + } + } + case reflect.Ptr: + if field.IsNil() { + if prop.Required { + return fmt.Errorf("required field %q is not set", prop.Name) + } + continue + } + if err := checkRequiredFieldsInValue(field); err != nil { + return err + } + } + } + + // Handle proto2 extensions. + for _, ext := range proto.RegisteredExtensions(pb) { + if !proto.HasExtension(pb, ext) { + continue + } + ep, err := proto.GetExtension(pb, ext) + if err != nil { + return err + } + err = checkRequiredFieldsInValue(reflect.ValueOf(ep)) + if err != nil { + return err + } + } + + return nil +} + +func checkRequiredFieldsInValue(v reflect.Value) error { + if pm, ok := v.Interface().(proto.Message); ok { + return checkRequiredFields(pm) + } + return nil +} diff --git a/vendor/github.com/golang/protobuf/jsonpb/jsonpb_test_proto/Makefile b/vendor/github.com/golang/protobuf/jsonpb/jsonpb_test_proto/Makefile deleted file mode 100644 index eeda8ae53..000000000 --- a/vendor/github.com/golang/protobuf/jsonpb/jsonpb_test_proto/Makefile +++ /dev/null @@ -1,33 +0,0 @@ -# Go support for Protocol Buffers - Google's data interchange format -# -# Copyright 2015 The Go Authors. All rights reserved. -# https://github.com/golang/protobuf -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -regenerate: - protoc --go_out=Mgoogle/protobuf/any.proto=github.com/golang/protobuf/ptypes/any,Mgoogle/protobuf/duration.proto=github.com/golang/protobuf/ptypes/duration,Mgoogle/protobuf/struct.proto=github.com/golang/protobuf/ptypes/struct,Mgoogle/protobuf/timestamp.proto=github.com/golang/protobuf/ptypes/timestamp,Mgoogle/protobuf/wrappers.proto=github.com/golang/protobuf/ptypes/wrappers:. *.proto diff --git a/vendor/github.com/golang/protobuf/jsonpb/jsonpb_test_proto/more_test_objects.pb.go b/vendor/github.com/golang/protobuf/jsonpb/jsonpb_test_proto/more_test_objects.pb.go index ebb180e88..1bcce029c 100644 --- a/vendor/github.com/golang/protobuf/jsonpb/jsonpb_test_proto/more_test_objects.pb.go +++ b/vendor/github.com/golang/protobuf/jsonpb/jsonpb_test_proto/more_test_objects.pb.go @@ -1,29 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // source: more_test_objects.proto -/* -Package jsonpb is a generated protocol buffer package. - -It is generated from these files: - more_test_objects.proto - test_objects.proto - -It has these top-level messages: - Simple3 - SimpleSlice3 - SimpleMap3 - SimpleNull3 - Mappy - Simple - NonFinites - Repeats - Widget - Maps - MsgWithOneof - Real - Complex - KnownTypes -*/ package jsonpb import proto "github.com/golang/protobuf/proto" @@ -63,16 +40,40 @@ var Numeral_value = map[string]int32{ func (x Numeral) String() string { return proto.EnumName(Numeral_name, int32(x)) } -func (Numeral) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } +func (Numeral) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_more_test_objects_bef0d79b901f4c4a, []int{0} +} type Simple3 struct { - Dub float64 `protobuf:"fixed64,1,opt,name=dub" json:"dub,omitempty"` + Dub float64 `protobuf:"fixed64,1,opt,name=dub" json:"dub,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Simple3) Reset() { *m = Simple3{} } +func (m *Simple3) String() string { return proto.CompactTextString(m) } +func (*Simple3) ProtoMessage() {} +func (*Simple3) Descriptor() ([]byte, []int) { + return fileDescriptor_more_test_objects_bef0d79b901f4c4a, []int{0} +} +func (m *Simple3) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Simple3.Unmarshal(m, b) +} +func (m *Simple3) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Simple3.Marshal(b, m, deterministic) +} +func (dst *Simple3) XXX_Merge(src proto.Message) { + xxx_messageInfo_Simple3.Merge(dst, src) +} +func (m *Simple3) XXX_Size() int { + return xxx_messageInfo_Simple3.Size(m) +} +func (m *Simple3) XXX_DiscardUnknown() { + xxx_messageInfo_Simple3.DiscardUnknown(m) } -func (m *Simple3) Reset() { *m = Simple3{} } -func (m *Simple3) String() string { return proto.CompactTextString(m) } -func (*Simple3) ProtoMessage() {} -func (*Simple3) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } +var xxx_messageInfo_Simple3 proto.InternalMessageInfo func (m *Simple3) GetDub() float64 { if m != nil { @@ -82,13 +83,35 @@ func (m *Simple3) GetDub() float64 { } type SimpleSlice3 struct { - Slices []string `protobuf:"bytes,1,rep,name=slices" json:"slices,omitempty"` + Slices []string `protobuf:"bytes,1,rep,name=slices" json:"slices,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SimpleSlice3) Reset() { *m = SimpleSlice3{} } +func (m *SimpleSlice3) String() string { return proto.CompactTextString(m) } +func (*SimpleSlice3) ProtoMessage() {} +func (*SimpleSlice3) Descriptor() ([]byte, []int) { + return fileDescriptor_more_test_objects_bef0d79b901f4c4a, []int{1} +} +func (m *SimpleSlice3) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SimpleSlice3.Unmarshal(m, b) +} +func (m *SimpleSlice3) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SimpleSlice3.Marshal(b, m, deterministic) +} +func (dst *SimpleSlice3) XXX_Merge(src proto.Message) { + xxx_messageInfo_SimpleSlice3.Merge(dst, src) +} +func (m *SimpleSlice3) XXX_Size() int { + return xxx_messageInfo_SimpleSlice3.Size(m) +} +func (m *SimpleSlice3) XXX_DiscardUnknown() { + xxx_messageInfo_SimpleSlice3.DiscardUnknown(m) } -func (m *SimpleSlice3) Reset() { *m = SimpleSlice3{} } -func (m *SimpleSlice3) String() string { return proto.CompactTextString(m) } -func (*SimpleSlice3) ProtoMessage() {} -func (*SimpleSlice3) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } +var xxx_messageInfo_SimpleSlice3 proto.InternalMessageInfo func (m *SimpleSlice3) GetSlices() []string { if m != nil { @@ -98,13 +121,35 @@ func (m *SimpleSlice3) GetSlices() []string { } type SimpleMap3 struct { - Stringy map[string]string `protobuf:"bytes,1,rep,name=stringy" json:"stringy,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + Stringy map[string]string `protobuf:"bytes,1,rep,name=stringy" json:"stringy,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SimpleMap3) Reset() { *m = SimpleMap3{} } +func (m *SimpleMap3) String() string { return proto.CompactTextString(m) } +func (*SimpleMap3) ProtoMessage() {} +func (*SimpleMap3) Descriptor() ([]byte, []int) { + return fileDescriptor_more_test_objects_bef0d79b901f4c4a, []int{2} +} +func (m *SimpleMap3) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SimpleMap3.Unmarshal(m, b) +} +func (m *SimpleMap3) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SimpleMap3.Marshal(b, m, deterministic) +} +func (dst *SimpleMap3) XXX_Merge(src proto.Message) { + xxx_messageInfo_SimpleMap3.Merge(dst, src) +} +func (m *SimpleMap3) XXX_Size() int { + return xxx_messageInfo_SimpleMap3.Size(m) +} +func (m *SimpleMap3) XXX_DiscardUnknown() { + xxx_messageInfo_SimpleMap3.DiscardUnknown(m) } -func (m *SimpleMap3) Reset() { *m = SimpleMap3{} } -func (m *SimpleMap3) String() string { return proto.CompactTextString(m) } -func (*SimpleMap3) ProtoMessage() {} -func (*SimpleMap3) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } +var xxx_messageInfo_SimpleMap3 proto.InternalMessageInfo func (m *SimpleMap3) GetStringy() map[string]string { if m != nil { @@ -114,13 +159,35 @@ func (m *SimpleMap3) GetStringy() map[string]string { } type SimpleNull3 struct { - Simple *Simple3 `protobuf:"bytes,1,opt,name=simple" json:"simple,omitempty"` + Simple *Simple3 `protobuf:"bytes,1,opt,name=simple" json:"simple,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SimpleNull3) Reset() { *m = SimpleNull3{} } +func (m *SimpleNull3) String() string { return proto.CompactTextString(m) } +func (*SimpleNull3) ProtoMessage() {} +func (*SimpleNull3) Descriptor() ([]byte, []int) { + return fileDescriptor_more_test_objects_bef0d79b901f4c4a, []int{3} +} +func (m *SimpleNull3) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SimpleNull3.Unmarshal(m, b) +} +func (m *SimpleNull3) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SimpleNull3.Marshal(b, m, deterministic) +} +func (dst *SimpleNull3) XXX_Merge(src proto.Message) { + xxx_messageInfo_SimpleNull3.Merge(dst, src) +} +func (m *SimpleNull3) XXX_Size() int { + return xxx_messageInfo_SimpleNull3.Size(m) +} +func (m *SimpleNull3) XXX_DiscardUnknown() { + xxx_messageInfo_SimpleNull3.DiscardUnknown(m) } -func (m *SimpleNull3) Reset() { *m = SimpleNull3{} } -func (m *SimpleNull3) String() string { return proto.CompactTextString(m) } -func (*SimpleNull3) ProtoMessage() {} -func (*SimpleNull3) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } +var xxx_messageInfo_SimpleNull3 proto.InternalMessageInfo func (m *SimpleNull3) GetSimple() *Simple3 { if m != nil { @@ -130,22 +197,44 @@ func (m *SimpleNull3) GetSimple() *Simple3 { } type Mappy struct { - Nummy map[int64]int32 `protobuf:"bytes,1,rep,name=nummy" json:"nummy,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"varint,2,opt,name=value"` - Strry map[string]string `protobuf:"bytes,2,rep,name=strry" json:"strry,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - Objjy map[int32]*Simple3 `protobuf:"bytes,3,rep,name=objjy" json:"objjy,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - Buggy map[int64]string `protobuf:"bytes,4,rep,name=buggy" json:"buggy,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - Booly map[bool]bool `protobuf:"bytes,5,rep,name=booly" json:"booly,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"varint,2,opt,name=value"` - Enumy map[string]Numeral `protobuf:"bytes,6,rep,name=enumy" json:"enumy,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"varint,2,opt,name=value,enum=jsonpb.Numeral"` - S32Booly map[int32]bool `protobuf:"bytes,7,rep,name=s32booly" json:"s32booly,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"varint,2,opt,name=value"` - S64Booly map[int64]bool `protobuf:"bytes,8,rep,name=s64booly" json:"s64booly,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"varint,2,opt,name=value"` - U32Booly map[uint32]bool `protobuf:"bytes,9,rep,name=u32booly" json:"u32booly,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"varint,2,opt,name=value"` - U64Booly map[uint64]bool `protobuf:"bytes,10,rep,name=u64booly" json:"u64booly,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"varint,2,opt,name=value"` -} - -func (m *Mappy) Reset() { *m = Mappy{} } -func (m *Mappy) String() string { return proto.CompactTextString(m) } -func (*Mappy) ProtoMessage() {} -func (*Mappy) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} } + Nummy map[int64]int32 `protobuf:"bytes,1,rep,name=nummy" json:"nummy,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"varint,2,opt,name=value"` + Strry map[string]string `protobuf:"bytes,2,rep,name=strry" json:"strry,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + Objjy map[int32]*Simple3 `protobuf:"bytes,3,rep,name=objjy" json:"objjy,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + Buggy map[int64]string `protobuf:"bytes,4,rep,name=buggy" json:"buggy,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + Booly map[bool]bool `protobuf:"bytes,5,rep,name=booly" json:"booly,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"varint,2,opt,name=value"` + Enumy map[string]Numeral `protobuf:"bytes,6,rep,name=enumy" json:"enumy,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"varint,2,opt,name=value,enum=jsonpb.Numeral"` + S32Booly map[int32]bool `protobuf:"bytes,7,rep,name=s32booly" json:"s32booly,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"varint,2,opt,name=value"` + S64Booly map[int64]bool `protobuf:"bytes,8,rep,name=s64booly" json:"s64booly,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"varint,2,opt,name=value"` + U32Booly map[uint32]bool `protobuf:"bytes,9,rep,name=u32booly" json:"u32booly,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"varint,2,opt,name=value"` + U64Booly map[uint64]bool `protobuf:"bytes,10,rep,name=u64booly" json:"u64booly,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"varint,2,opt,name=value"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Mappy) Reset() { *m = Mappy{} } +func (m *Mappy) String() string { return proto.CompactTextString(m) } +func (*Mappy) ProtoMessage() {} +func (*Mappy) Descriptor() ([]byte, []int) { + return fileDescriptor_more_test_objects_bef0d79b901f4c4a, []int{4} +} +func (m *Mappy) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Mappy.Unmarshal(m, b) +} +func (m *Mappy) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Mappy.Marshal(b, m, deterministic) +} +func (dst *Mappy) XXX_Merge(src proto.Message) { + xxx_messageInfo_Mappy.Merge(dst, src) +} +func (m *Mappy) XXX_Size() int { + return xxx_messageInfo_Mappy.Size(m) +} +func (m *Mappy) XXX_DiscardUnknown() { + xxx_messageInfo_Mappy.DiscardUnknown(m) +} + +var xxx_messageInfo_Mappy proto.InternalMessageInfo func (m *Mappy) GetNummy() map[int64]int32 { if m != nil { @@ -221,14 +310,27 @@ func init() { proto.RegisterType((*Simple3)(nil), "jsonpb.Simple3") proto.RegisterType((*SimpleSlice3)(nil), "jsonpb.SimpleSlice3") proto.RegisterType((*SimpleMap3)(nil), "jsonpb.SimpleMap3") + proto.RegisterMapType((map[string]string)(nil), "jsonpb.SimpleMap3.StringyEntry") proto.RegisterType((*SimpleNull3)(nil), "jsonpb.SimpleNull3") proto.RegisterType((*Mappy)(nil), "jsonpb.Mappy") + proto.RegisterMapType((map[bool]bool)(nil), "jsonpb.Mappy.BoolyEntry") + proto.RegisterMapType((map[int64]string)(nil), "jsonpb.Mappy.BuggyEntry") + proto.RegisterMapType((map[string]Numeral)(nil), "jsonpb.Mappy.EnumyEntry") + proto.RegisterMapType((map[int64]int32)(nil), "jsonpb.Mappy.NummyEntry") + proto.RegisterMapType((map[int32]*Simple3)(nil), "jsonpb.Mappy.ObjjyEntry") + proto.RegisterMapType((map[int32]bool)(nil), "jsonpb.Mappy.S32boolyEntry") + proto.RegisterMapType((map[int64]bool)(nil), "jsonpb.Mappy.S64boolyEntry") + proto.RegisterMapType((map[string]string)(nil), "jsonpb.Mappy.StrryEntry") + proto.RegisterMapType((map[uint32]bool)(nil), "jsonpb.Mappy.U32boolyEntry") + proto.RegisterMapType((map[uint64]bool)(nil), "jsonpb.Mappy.U64boolyEntry") proto.RegisterEnum("jsonpb.Numeral", Numeral_name, Numeral_value) } -func init() { proto.RegisterFile("more_test_objects.proto", fileDescriptor0) } +func init() { + proto.RegisterFile("more_test_objects.proto", fileDescriptor_more_test_objects_bef0d79b901f4c4a) +} -var fileDescriptor0 = []byte{ +var fileDescriptor_more_test_objects_bef0d79b901f4c4a = []byte{ // 526 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0xdd, 0x6b, 0xdb, 0x3c, 0x14, 0x87, 0x5f, 0x27, 0xf5, 0xd7, 0x49, 0xfb, 0x2e, 0x88, 0xb1, 0x99, 0xf4, 0x62, 0xc5, 0xb0, diff --git a/vendor/github.com/golang/protobuf/jsonpb/jsonpb_test_proto/test_objects.pb.go b/vendor/github.com/golang/protobuf/jsonpb/jsonpb_test_proto/test_objects.pb.go index d413d740d..d9e24db2c 100644 --- a/vendor/github.com/golang/protobuf/jsonpb/jsonpb_test_proto/test_objects.pb.go +++ b/vendor/github.com/golang/protobuf/jsonpb/jsonpb_test_proto/test_objects.pb.go @@ -6,17 +6,23 @@ package jsonpb import proto "github.com/golang/protobuf/proto" import fmt "fmt" import math "math" -import google_protobuf "github.com/golang/protobuf/ptypes/any" -import google_protobuf1 "github.com/golang/protobuf/ptypes/duration" -import google_protobuf2 "github.com/golang/protobuf/ptypes/struct" -import google_protobuf3 "github.com/golang/protobuf/ptypes/timestamp" -import google_protobuf4 "github.com/golang/protobuf/ptypes/wrappers" +import any "github.com/golang/protobuf/ptypes/any" +import duration "github.com/golang/protobuf/ptypes/duration" +import _struct "github.com/golang/protobuf/ptypes/struct" +import timestamp "github.com/golang/protobuf/ptypes/timestamp" +import wrappers "github.com/golang/protobuf/ptypes/wrappers" // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + type Widget_Color int32 const ( @@ -52,28 +58,51 @@ func (x *Widget_Color) UnmarshalJSON(data []byte) error { *x = Widget_Color(value) return nil } -func (Widget_Color) EnumDescriptor() ([]byte, []int) { return fileDescriptor1, []int{3, 0} } +func (Widget_Color) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_test_objects_c6f6c615ab823e65, []int{3, 0} +} // Test message for holding primitive types. type Simple struct { - OBool *bool `protobuf:"varint,1,opt,name=o_bool,json=oBool" json:"o_bool,omitempty"` - OInt32 *int32 `protobuf:"varint,2,opt,name=o_int32,json=oInt32" json:"o_int32,omitempty"` - OInt64 *int64 `protobuf:"varint,3,opt,name=o_int64,json=oInt64" json:"o_int64,omitempty"` - OUint32 *uint32 `protobuf:"varint,4,opt,name=o_uint32,json=oUint32" json:"o_uint32,omitempty"` - OUint64 *uint64 `protobuf:"varint,5,opt,name=o_uint64,json=oUint64" json:"o_uint64,omitempty"` - OSint32 *int32 `protobuf:"zigzag32,6,opt,name=o_sint32,json=oSint32" json:"o_sint32,omitempty"` - OSint64 *int64 `protobuf:"zigzag64,7,opt,name=o_sint64,json=oSint64" json:"o_sint64,omitempty"` - OFloat *float32 `protobuf:"fixed32,8,opt,name=o_float,json=oFloat" json:"o_float,omitempty"` - ODouble *float64 `protobuf:"fixed64,9,opt,name=o_double,json=oDouble" json:"o_double,omitempty"` - OString *string `protobuf:"bytes,10,opt,name=o_string,json=oString" json:"o_string,omitempty"` - OBytes []byte `protobuf:"bytes,11,opt,name=o_bytes,json=oBytes" json:"o_bytes,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *Simple) Reset() { *m = Simple{} } -func (m *Simple) String() string { return proto.CompactTextString(m) } -func (*Simple) ProtoMessage() {} -func (*Simple) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{0} } + OBool *bool `protobuf:"varint,1,opt,name=o_bool,json=oBool" json:"o_bool,omitempty"` + OInt32 *int32 `protobuf:"varint,2,opt,name=o_int32,json=oInt32" json:"o_int32,omitempty"` + OInt64 *int64 `protobuf:"varint,3,opt,name=o_int64,json=oInt64" json:"o_int64,omitempty"` + OUint32 *uint32 `protobuf:"varint,4,opt,name=o_uint32,json=oUint32" json:"o_uint32,omitempty"` + OUint64 *uint64 `protobuf:"varint,5,opt,name=o_uint64,json=oUint64" json:"o_uint64,omitempty"` + OSint32 *int32 `protobuf:"zigzag32,6,opt,name=o_sint32,json=oSint32" json:"o_sint32,omitempty"` + OSint64 *int64 `protobuf:"zigzag64,7,opt,name=o_sint64,json=oSint64" json:"o_sint64,omitempty"` + OFloat *float32 `protobuf:"fixed32,8,opt,name=o_float,json=oFloat" json:"o_float,omitempty"` + ODouble *float64 `protobuf:"fixed64,9,opt,name=o_double,json=oDouble" json:"o_double,omitempty"` + OString *string `protobuf:"bytes,10,opt,name=o_string,json=oString" json:"o_string,omitempty"` + OBytes []byte `protobuf:"bytes,11,opt,name=o_bytes,json=oBytes" json:"o_bytes,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Simple) Reset() { *m = Simple{} } +func (m *Simple) String() string { return proto.CompactTextString(m) } +func (*Simple) ProtoMessage() {} +func (*Simple) Descriptor() ([]byte, []int) { + return fileDescriptor_test_objects_c6f6c615ab823e65, []int{0} +} +func (m *Simple) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Simple.Unmarshal(m, b) +} +func (m *Simple) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Simple.Marshal(b, m, deterministic) +} +func (dst *Simple) XXX_Merge(src proto.Message) { + xxx_messageInfo_Simple.Merge(dst, src) +} +func (m *Simple) XXX_Size() int { + return xxx_messageInfo_Simple.Size(m) +} +func (m *Simple) XXX_DiscardUnknown() { + xxx_messageInfo_Simple.DiscardUnknown(m) +} + +var xxx_messageInfo_Simple proto.InternalMessageInfo func (m *Simple) GetOBool() bool { if m != nil && m.OBool != nil { @@ -154,19 +183,40 @@ func (m *Simple) GetOBytes() []byte { // Test message for holding special non-finites primitives. type NonFinites struct { - FNan *float32 `protobuf:"fixed32,1,opt,name=f_nan,json=fNan" json:"f_nan,omitempty"` - FPinf *float32 `protobuf:"fixed32,2,opt,name=f_pinf,json=fPinf" json:"f_pinf,omitempty"` - FNinf *float32 `protobuf:"fixed32,3,opt,name=f_ninf,json=fNinf" json:"f_ninf,omitempty"` - DNan *float64 `protobuf:"fixed64,4,opt,name=d_nan,json=dNan" json:"d_nan,omitempty"` - DPinf *float64 `protobuf:"fixed64,5,opt,name=d_pinf,json=dPinf" json:"d_pinf,omitempty"` - DNinf *float64 `protobuf:"fixed64,6,opt,name=d_ninf,json=dNinf" json:"d_ninf,omitempty"` - XXX_unrecognized []byte `json:"-"` + FNan *float32 `protobuf:"fixed32,1,opt,name=f_nan,json=fNan" json:"f_nan,omitempty"` + FPinf *float32 `protobuf:"fixed32,2,opt,name=f_pinf,json=fPinf" json:"f_pinf,omitempty"` + FNinf *float32 `protobuf:"fixed32,3,opt,name=f_ninf,json=fNinf" json:"f_ninf,omitempty"` + DNan *float64 `protobuf:"fixed64,4,opt,name=d_nan,json=dNan" json:"d_nan,omitempty"` + DPinf *float64 `protobuf:"fixed64,5,opt,name=d_pinf,json=dPinf" json:"d_pinf,omitempty"` + DNinf *float64 `protobuf:"fixed64,6,opt,name=d_ninf,json=dNinf" json:"d_ninf,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *NonFinites) Reset() { *m = NonFinites{} } -func (m *NonFinites) String() string { return proto.CompactTextString(m) } -func (*NonFinites) ProtoMessage() {} -func (*NonFinites) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{1} } +func (m *NonFinites) Reset() { *m = NonFinites{} } +func (m *NonFinites) String() string { return proto.CompactTextString(m) } +func (*NonFinites) ProtoMessage() {} +func (*NonFinites) Descriptor() ([]byte, []int) { + return fileDescriptor_test_objects_c6f6c615ab823e65, []int{1} +} +func (m *NonFinites) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_NonFinites.Unmarshal(m, b) +} +func (m *NonFinites) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_NonFinites.Marshal(b, m, deterministic) +} +func (dst *NonFinites) XXX_Merge(src proto.Message) { + xxx_messageInfo_NonFinites.Merge(dst, src) +} +func (m *NonFinites) XXX_Size() int { + return xxx_messageInfo_NonFinites.Size(m) +} +func (m *NonFinites) XXX_DiscardUnknown() { + xxx_messageInfo_NonFinites.DiscardUnknown(m) +} + +var xxx_messageInfo_NonFinites proto.InternalMessageInfo func (m *NonFinites) GetFNan() float32 { if m != nil && m.FNan != nil { @@ -212,24 +262,45 @@ func (m *NonFinites) GetDNinf() float64 { // Test message for holding repeated primitives. type Repeats struct { - RBool []bool `protobuf:"varint,1,rep,name=r_bool,json=rBool" json:"r_bool,omitempty"` - RInt32 []int32 `protobuf:"varint,2,rep,name=r_int32,json=rInt32" json:"r_int32,omitempty"` - RInt64 []int64 `protobuf:"varint,3,rep,name=r_int64,json=rInt64" json:"r_int64,omitempty"` - RUint32 []uint32 `protobuf:"varint,4,rep,name=r_uint32,json=rUint32" json:"r_uint32,omitempty"` - RUint64 []uint64 `protobuf:"varint,5,rep,name=r_uint64,json=rUint64" json:"r_uint64,omitempty"` - RSint32 []int32 `protobuf:"zigzag32,6,rep,name=r_sint32,json=rSint32" json:"r_sint32,omitempty"` - RSint64 []int64 `protobuf:"zigzag64,7,rep,name=r_sint64,json=rSint64" json:"r_sint64,omitempty"` - RFloat []float32 `protobuf:"fixed32,8,rep,name=r_float,json=rFloat" json:"r_float,omitempty"` - RDouble []float64 `protobuf:"fixed64,9,rep,name=r_double,json=rDouble" json:"r_double,omitempty"` - RString []string `protobuf:"bytes,10,rep,name=r_string,json=rString" json:"r_string,omitempty"` - RBytes [][]byte `protobuf:"bytes,11,rep,name=r_bytes,json=rBytes" json:"r_bytes,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *Repeats) Reset() { *m = Repeats{} } -func (m *Repeats) String() string { return proto.CompactTextString(m) } -func (*Repeats) ProtoMessage() {} -func (*Repeats) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{2} } + RBool []bool `protobuf:"varint,1,rep,name=r_bool,json=rBool" json:"r_bool,omitempty"` + RInt32 []int32 `protobuf:"varint,2,rep,name=r_int32,json=rInt32" json:"r_int32,omitempty"` + RInt64 []int64 `protobuf:"varint,3,rep,name=r_int64,json=rInt64" json:"r_int64,omitempty"` + RUint32 []uint32 `protobuf:"varint,4,rep,name=r_uint32,json=rUint32" json:"r_uint32,omitempty"` + RUint64 []uint64 `protobuf:"varint,5,rep,name=r_uint64,json=rUint64" json:"r_uint64,omitempty"` + RSint32 []int32 `protobuf:"zigzag32,6,rep,name=r_sint32,json=rSint32" json:"r_sint32,omitempty"` + RSint64 []int64 `protobuf:"zigzag64,7,rep,name=r_sint64,json=rSint64" json:"r_sint64,omitempty"` + RFloat []float32 `protobuf:"fixed32,8,rep,name=r_float,json=rFloat" json:"r_float,omitempty"` + RDouble []float64 `protobuf:"fixed64,9,rep,name=r_double,json=rDouble" json:"r_double,omitempty"` + RString []string `protobuf:"bytes,10,rep,name=r_string,json=rString" json:"r_string,omitempty"` + RBytes [][]byte `protobuf:"bytes,11,rep,name=r_bytes,json=rBytes" json:"r_bytes,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Repeats) Reset() { *m = Repeats{} } +func (m *Repeats) String() string { return proto.CompactTextString(m) } +func (*Repeats) ProtoMessage() {} +func (*Repeats) Descriptor() ([]byte, []int) { + return fileDescriptor_test_objects_c6f6c615ab823e65, []int{2} +} +func (m *Repeats) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Repeats.Unmarshal(m, b) +} +func (m *Repeats) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Repeats.Marshal(b, m, deterministic) +} +func (dst *Repeats) XXX_Merge(src proto.Message) { + xxx_messageInfo_Repeats.Merge(dst, src) +} +func (m *Repeats) XXX_Size() int { + return xxx_messageInfo_Repeats.Size(m) +} +func (m *Repeats) XXX_DiscardUnknown() { + xxx_messageInfo_Repeats.DiscardUnknown(m) +} + +var xxx_messageInfo_Repeats proto.InternalMessageInfo func (m *Repeats) GetRBool() []bool { if m != nil { @@ -310,19 +381,40 @@ func (m *Repeats) GetRBytes() [][]byte { // Test message for holding enums and nested messages. type Widget struct { - Color *Widget_Color `protobuf:"varint,1,opt,name=color,enum=jsonpb.Widget_Color" json:"color,omitempty"` - RColor []Widget_Color `protobuf:"varint,2,rep,name=r_color,json=rColor,enum=jsonpb.Widget_Color" json:"r_color,omitempty"` - Simple *Simple `protobuf:"bytes,10,opt,name=simple" json:"simple,omitempty"` - RSimple []*Simple `protobuf:"bytes,11,rep,name=r_simple,json=rSimple" json:"r_simple,omitempty"` - Repeats *Repeats `protobuf:"bytes,20,opt,name=repeats" json:"repeats,omitempty"` - RRepeats []*Repeats `protobuf:"bytes,21,rep,name=r_repeats,json=rRepeats" json:"r_repeats,omitempty"` - XXX_unrecognized []byte `json:"-"` + Color *Widget_Color `protobuf:"varint,1,opt,name=color,enum=jsonpb.Widget_Color" json:"color,omitempty"` + RColor []Widget_Color `protobuf:"varint,2,rep,name=r_color,json=rColor,enum=jsonpb.Widget_Color" json:"r_color,omitempty"` + Simple *Simple `protobuf:"bytes,10,opt,name=simple" json:"simple,omitempty"` + RSimple []*Simple `protobuf:"bytes,11,rep,name=r_simple,json=rSimple" json:"r_simple,omitempty"` + Repeats *Repeats `protobuf:"bytes,20,opt,name=repeats" json:"repeats,omitempty"` + RRepeats []*Repeats `protobuf:"bytes,21,rep,name=r_repeats,json=rRepeats" json:"r_repeats,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Widget) Reset() { *m = Widget{} } +func (m *Widget) String() string { return proto.CompactTextString(m) } +func (*Widget) ProtoMessage() {} +func (*Widget) Descriptor() ([]byte, []int) { + return fileDescriptor_test_objects_c6f6c615ab823e65, []int{3} +} +func (m *Widget) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Widget.Unmarshal(m, b) +} +func (m *Widget) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Widget.Marshal(b, m, deterministic) +} +func (dst *Widget) XXX_Merge(src proto.Message) { + xxx_messageInfo_Widget.Merge(dst, src) +} +func (m *Widget) XXX_Size() int { + return xxx_messageInfo_Widget.Size(m) +} +func (m *Widget) XXX_DiscardUnknown() { + xxx_messageInfo_Widget.DiscardUnknown(m) } -func (m *Widget) Reset() { *m = Widget{} } -func (m *Widget) String() string { return proto.CompactTextString(m) } -func (*Widget) ProtoMessage() {} -func (*Widget) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{3} } +var xxx_messageInfo_Widget proto.InternalMessageInfo func (m *Widget) GetColor() Widget_Color { if m != nil && m.Color != nil { @@ -367,15 +459,36 @@ func (m *Widget) GetRRepeats() []*Repeats { } type Maps struct { - MInt64Str map[int64]string `protobuf:"bytes,1,rep,name=m_int64_str,json=mInt64Str" json:"m_int64_str,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - MBoolSimple map[bool]*Simple `protobuf:"bytes,2,rep,name=m_bool_simple,json=mBoolSimple" json:"m_bool_simple,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - XXX_unrecognized []byte `json:"-"` + MInt64Str map[int64]string `protobuf:"bytes,1,rep,name=m_int64_str,json=mInt64Str" json:"m_int64_str,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + MBoolSimple map[bool]*Simple `protobuf:"bytes,2,rep,name=m_bool_simple,json=mBoolSimple" json:"m_bool_simple,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Maps) Reset() { *m = Maps{} } +func (m *Maps) String() string { return proto.CompactTextString(m) } +func (*Maps) ProtoMessage() {} +func (*Maps) Descriptor() ([]byte, []int) { + return fileDescriptor_test_objects_c6f6c615ab823e65, []int{4} +} +func (m *Maps) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Maps.Unmarshal(m, b) +} +func (m *Maps) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Maps.Marshal(b, m, deterministic) +} +func (dst *Maps) XXX_Merge(src proto.Message) { + xxx_messageInfo_Maps.Merge(dst, src) +} +func (m *Maps) XXX_Size() int { + return xxx_messageInfo_Maps.Size(m) +} +func (m *Maps) XXX_DiscardUnknown() { + xxx_messageInfo_Maps.DiscardUnknown(m) } -func (m *Maps) Reset() { *m = Maps{} } -func (m *Maps) String() string { return proto.CompactTextString(m) } -func (*Maps) ProtoMessage() {} -func (*Maps) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{4} } +var xxx_messageInfo_Maps proto.InternalMessageInfo func (m *Maps) GetMInt64Str() map[int64]string { if m != nil { @@ -397,14 +510,36 @@ type MsgWithOneof struct { // *MsgWithOneof_Salary // *MsgWithOneof_Country // *MsgWithOneof_HomeAddress - Union isMsgWithOneof_Union `protobuf_oneof:"union"` - XXX_unrecognized []byte `json:"-"` + // *MsgWithOneof_MsgWithRequired + Union isMsgWithOneof_Union `protobuf_oneof:"union"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *MsgWithOneof) Reset() { *m = MsgWithOneof{} } -func (m *MsgWithOneof) String() string { return proto.CompactTextString(m) } -func (*MsgWithOneof) ProtoMessage() {} -func (*MsgWithOneof) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{5} } +func (m *MsgWithOneof) Reset() { *m = MsgWithOneof{} } +func (m *MsgWithOneof) String() string { return proto.CompactTextString(m) } +func (*MsgWithOneof) ProtoMessage() {} +func (*MsgWithOneof) Descriptor() ([]byte, []int) { + return fileDescriptor_test_objects_c6f6c615ab823e65, []int{5} +} +func (m *MsgWithOneof) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MsgWithOneof.Unmarshal(m, b) +} +func (m *MsgWithOneof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MsgWithOneof.Marshal(b, m, deterministic) +} +func (dst *MsgWithOneof) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgWithOneof.Merge(dst, src) +} +func (m *MsgWithOneof) XXX_Size() int { + return xxx_messageInfo_MsgWithOneof.Size(m) +} +func (m *MsgWithOneof) XXX_DiscardUnknown() { + xxx_messageInfo_MsgWithOneof.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgWithOneof proto.InternalMessageInfo type isMsgWithOneof_Union interface { isMsgWithOneof_Union() @@ -422,11 +557,15 @@ type MsgWithOneof_Country struct { type MsgWithOneof_HomeAddress struct { HomeAddress string `protobuf:"bytes,4,opt,name=home_address,json=homeAddress,oneof"` } +type MsgWithOneof_MsgWithRequired struct { + MsgWithRequired *MsgWithRequired `protobuf:"bytes,5,opt,name=msg_with_required,json=msgWithRequired,oneof"` +} -func (*MsgWithOneof_Title) isMsgWithOneof_Union() {} -func (*MsgWithOneof_Salary) isMsgWithOneof_Union() {} -func (*MsgWithOneof_Country) isMsgWithOneof_Union() {} -func (*MsgWithOneof_HomeAddress) isMsgWithOneof_Union() {} +func (*MsgWithOneof_Title) isMsgWithOneof_Union() {} +func (*MsgWithOneof_Salary) isMsgWithOneof_Union() {} +func (*MsgWithOneof_Country) isMsgWithOneof_Union() {} +func (*MsgWithOneof_HomeAddress) isMsgWithOneof_Union() {} +func (*MsgWithOneof_MsgWithRequired) isMsgWithOneof_Union() {} func (m *MsgWithOneof) GetUnion() isMsgWithOneof_Union { if m != nil { @@ -463,6 +602,13 @@ func (m *MsgWithOneof) GetHomeAddress() string { return "" } +func (m *MsgWithOneof) GetMsgWithRequired() *MsgWithRequired { + if x, ok := m.GetUnion().(*MsgWithOneof_MsgWithRequired); ok { + return x.MsgWithRequired + } + return nil +} + // XXX_OneofFuncs is for the internal use of the proto package. func (*MsgWithOneof) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { return _MsgWithOneof_OneofMarshaler, _MsgWithOneof_OneofUnmarshaler, _MsgWithOneof_OneofSizer, []interface{}{ @@ -470,6 +616,7 @@ func (*MsgWithOneof) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) (*MsgWithOneof_Salary)(nil), (*MsgWithOneof_Country)(nil), (*MsgWithOneof_HomeAddress)(nil), + (*MsgWithOneof_MsgWithRequired)(nil), } } @@ -489,6 +636,11 @@ func _MsgWithOneof_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { case *MsgWithOneof_HomeAddress: b.EncodeVarint(4<<3 | proto.WireBytes) b.EncodeStringBytes(x.HomeAddress) + case *MsgWithOneof_MsgWithRequired: + b.EncodeVarint(5<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.MsgWithRequired); err != nil { + return err + } case nil: default: return fmt.Errorf("MsgWithOneof.Union has unexpected type %T", x) @@ -527,6 +679,14 @@ func _MsgWithOneof_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.B x, err := b.DecodeStringBytes() m.Union = &MsgWithOneof_HomeAddress{x} return true, err + case 5: // union.msg_with_required + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(MsgWithRequired) + err := b.DecodeMessage(msg) + m.Union = &MsgWithOneof_MsgWithRequired{msg} + return true, err default: return false, nil } @@ -537,20 +697,25 @@ func _MsgWithOneof_OneofSizer(msg proto.Message) (n int) { // union switch x := m.Union.(type) { case *MsgWithOneof_Title: - n += proto.SizeVarint(1<<3 | proto.WireBytes) + n += 1 // tag and wire n += proto.SizeVarint(uint64(len(x.Title))) n += len(x.Title) case *MsgWithOneof_Salary: - n += proto.SizeVarint(2<<3 | proto.WireVarint) + n += 1 // tag and wire n += proto.SizeVarint(uint64(x.Salary)) case *MsgWithOneof_Country: - n += proto.SizeVarint(3<<3 | proto.WireBytes) + n += 1 // tag and wire n += proto.SizeVarint(uint64(len(x.Country))) n += len(x.Country) case *MsgWithOneof_HomeAddress: - n += proto.SizeVarint(4<<3 | proto.WireBytes) + n += 1 // tag and wire n += proto.SizeVarint(uint64(len(x.HomeAddress))) n += len(x.HomeAddress) + case *MsgWithOneof_MsgWithRequired: + s := proto.Size(x.MsgWithRequired) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s case nil: default: panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) @@ -560,22 +725,43 @@ func _MsgWithOneof_OneofSizer(msg proto.Message) (n int) { type Real struct { Value *float64 `protobuf:"fixed64,1,opt,name=value" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` proto.XXX_InternalExtensions `json:"-"` XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *Real) Reset() { *m = Real{} } -func (m *Real) String() string { return proto.CompactTextString(m) } -func (*Real) ProtoMessage() {} -func (*Real) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{6} } +func (m *Real) Reset() { *m = Real{} } +func (m *Real) String() string { return proto.CompactTextString(m) } +func (*Real) ProtoMessage() {} +func (*Real) Descriptor() ([]byte, []int) { + return fileDescriptor_test_objects_c6f6c615ab823e65, []int{6} +} var extRange_Real = []proto.ExtensionRange{ - {100, 536870911}, + {Start: 100, End: 536870911}, } func (*Real) ExtensionRangeArray() []proto.ExtensionRange { return extRange_Real } +func (m *Real) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Real.Unmarshal(m, b) +} +func (m *Real) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Real.Marshal(b, m, deterministic) +} +func (dst *Real) XXX_Merge(src proto.Message) { + xxx_messageInfo_Real.Merge(dst, src) +} +func (m *Real) XXX_Size() int { + return xxx_messageInfo_Real.Size(m) +} +func (m *Real) XXX_DiscardUnknown() { + xxx_messageInfo_Real.DiscardUnknown(m) +} + +var xxx_messageInfo_Real proto.InternalMessageInfo func (m *Real) GetValue() float64 { if m != nil && m.Value != nil { @@ -586,22 +772,43 @@ func (m *Real) GetValue() float64 { type Complex struct { Imaginary *float64 `protobuf:"fixed64,1,opt,name=imaginary" json:"imaginary,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` proto.XXX_InternalExtensions `json:"-"` XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *Complex) Reset() { *m = Complex{} } -func (m *Complex) String() string { return proto.CompactTextString(m) } -func (*Complex) ProtoMessage() {} -func (*Complex) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{7} } +func (m *Complex) Reset() { *m = Complex{} } +func (m *Complex) String() string { return proto.CompactTextString(m) } +func (*Complex) ProtoMessage() {} +func (*Complex) Descriptor() ([]byte, []int) { + return fileDescriptor_test_objects_c6f6c615ab823e65, []int{7} +} var extRange_Complex = []proto.ExtensionRange{ - {100, 536870911}, + {Start: 100, End: 536870911}, } func (*Complex) ExtensionRangeArray() []proto.ExtensionRange { return extRange_Complex } +func (m *Complex) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Complex.Unmarshal(m, b) +} +func (m *Complex) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Complex.Marshal(b, m, deterministic) +} +func (dst *Complex) XXX_Merge(src proto.Message) { + xxx_messageInfo_Complex.Merge(dst, src) +} +func (m *Complex) XXX_Size() int { + return xxx_messageInfo_Complex.Size(m) +} +func (m *Complex) XXX_DiscardUnknown() { + xxx_messageInfo_Complex.DiscardUnknown(m) +} + +var xxx_messageInfo_Complex proto.InternalMessageInfo func (m *Complex) GetImaginary() float64 { if m != nil && m.Imaginary != nil { @@ -620,134 +827,324 @@ var E_Complex_RealExtension = &proto.ExtensionDesc{ } type KnownTypes struct { - An *google_protobuf.Any `protobuf:"bytes,14,opt,name=an" json:"an,omitempty"` - Dur *google_protobuf1.Duration `protobuf:"bytes,1,opt,name=dur" json:"dur,omitempty"` - St *google_protobuf2.Struct `protobuf:"bytes,12,opt,name=st" json:"st,omitempty"` - Ts *google_protobuf3.Timestamp `protobuf:"bytes,2,opt,name=ts" json:"ts,omitempty"` - Lv *google_protobuf2.ListValue `protobuf:"bytes,15,opt,name=lv" json:"lv,omitempty"` - Val *google_protobuf2.Value `protobuf:"bytes,16,opt,name=val" json:"val,omitempty"` - Dbl *google_protobuf4.DoubleValue `protobuf:"bytes,3,opt,name=dbl" json:"dbl,omitempty"` - Flt *google_protobuf4.FloatValue `protobuf:"bytes,4,opt,name=flt" json:"flt,omitempty"` - I64 *google_protobuf4.Int64Value `protobuf:"bytes,5,opt,name=i64" json:"i64,omitempty"` - U64 *google_protobuf4.UInt64Value `protobuf:"bytes,6,opt,name=u64" json:"u64,omitempty"` - I32 *google_protobuf4.Int32Value `protobuf:"bytes,7,opt,name=i32" json:"i32,omitempty"` - U32 *google_protobuf4.UInt32Value `protobuf:"bytes,8,opt,name=u32" json:"u32,omitempty"` - Bool *google_protobuf4.BoolValue `protobuf:"bytes,9,opt,name=bool" json:"bool,omitempty"` - Str *google_protobuf4.StringValue `protobuf:"bytes,10,opt,name=str" json:"str,omitempty"` - Bytes *google_protobuf4.BytesValue `protobuf:"bytes,11,opt,name=bytes" json:"bytes,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *KnownTypes) Reset() { *m = KnownTypes{} } -func (m *KnownTypes) String() string { return proto.CompactTextString(m) } -func (*KnownTypes) ProtoMessage() {} -func (*KnownTypes) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{8} } - -func (m *KnownTypes) GetAn() *google_protobuf.Any { + An *any.Any `protobuf:"bytes,14,opt,name=an" json:"an,omitempty"` + Dur *duration.Duration `protobuf:"bytes,1,opt,name=dur" json:"dur,omitempty"` + St *_struct.Struct `protobuf:"bytes,12,opt,name=st" json:"st,omitempty"` + Ts *timestamp.Timestamp `protobuf:"bytes,2,opt,name=ts" json:"ts,omitempty"` + Lv *_struct.ListValue `protobuf:"bytes,15,opt,name=lv" json:"lv,omitempty"` + Val *_struct.Value `protobuf:"bytes,16,opt,name=val" json:"val,omitempty"` + Dbl *wrappers.DoubleValue `protobuf:"bytes,3,opt,name=dbl" json:"dbl,omitempty"` + Flt *wrappers.FloatValue `protobuf:"bytes,4,opt,name=flt" json:"flt,omitempty"` + I64 *wrappers.Int64Value `protobuf:"bytes,5,opt,name=i64" json:"i64,omitempty"` + U64 *wrappers.UInt64Value `protobuf:"bytes,6,opt,name=u64" json:"u64,omitempty"` + I32 *wrappers.Int32Value `protobuf:"bytes,7,opt,name=i32" json:"i32,omitempty"` + U32 *wrappers.UInt32Value `protobuf:"bytes,8,opt,name=u32" json:"u32,omitempty"` + Bool *wrappers.BoolValue `protobuf:"bytes,9,opt,name=bool" json:"bool,omitempty"` + Str *wrappers.StringValue `protobuf:"bytes,10,opt,name=str" json:"str,omitempty"` + Bytes *wrappers.BytesValue `protobuf:"bytes,11,opt,name=bytes" json:"bytes,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *KnownTypes) Reset() { *m = KnownTypes{} } +func (m *KnownTypes) String() string { return proto.CompactTextString(m) } +func (*KnownTypes) ProtoMessage() {} +func (*KnownTypes) Descriptor() ([]byte, []int) { + return fileDescriptor_test_objects_c6f6c615ab823e65, []int{8} +} +func (m *KnownTypes) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_KnownTypes.Unmarshal(m, b) +} +func (m *KnownTypes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_KnownTypes.Marshal(b, m, deterministic) +} +func (dst *KnownTypes) XXX_Merge(src proto.Message) { + xxx_messageInfo_KnownTypes.Merge(dst, src) +} +func (m *KnownTypes) XXX_Size() int { + return xxx_messageInfo_KnownTypes.Size(m) +} +func (m *KnownTypes) XXX_DiscardUnknown() { + xxx_messageInfo_KnownTypes.DiscardUnknown(m) +} + +var xxx_messageInfo_KnownTypes proto.InternalMessageInfo + +func (m *KnownTypes) GetAn() *any.Any { if m != nil { return m.An } return nil } -func (m *KnownTypes) GetDur() *google_protobuf1.Duration { +func (m *KnownTypes) GetDur() *duration.Duration { if m != nil { return m.Dur } return nil } -func (m *KnownTypes) GetSt() *google_protobuf2.Struct { +func (m *KnownTypes) GetSt() *_struct.Struct { if m != nil { return m.St } return nil } -func (m *KnownTypes) GetTs() *google_protobuf3.Timestamp { +func (m *KnownTypes) GetTs() *timestamp.Timestamp { if m != nil { return m.Ts } return nil } -func (m *KnownTypes) GetLv() *google_protobuf2.ListValue { +func (m *KnownTypes) GetLv() *_struct.ListValue { if m != nil { return m.Lv } return nil } -func (m *KnownTypes) GetVal() *google_protobuf2.Value { +func (m *KnownTypes) GetVal() *_struct.Value { if m != nil { return m.Val } return nil } -func (m *KnownTypes) GetDbl() *google_protobuf4.DoubleValue { +func (m *KnownTypes) GetDbl() *wrappers.DoubleValue { if m != nil { return m.Dbl } return nil } -func (m *KnownTypes) GetFlt() *google_protobuf4.FloatValue { +func (m *KnownTypes) GetFlt() *wrappers.FloatValue { if m != nil { return m.Flt } return nil } -func (m *KnownTypes) GetI64() *google_protobuf4.Int64Value { +func (m *KnownTypes) GetI64() *wrappers.Int64Value { if m != nil { return m.I64 } return nil } -func (m *KnownTypes) GetU64() *google_protobuf4.UInt64Value { +func (m *KnownTypes) GetU64() *wrappers.UInt64Value { if m != nil { return m.U64 } return nil } -func (m *KnownTypes) GetI32() *google_protobuf4.Int32Value { +func (m *KnownTypes) GetI32() *wrappers.Int32Value { if m != nil { return m.I32 } return nil } -func (m *KnownTypes) GetU32() *google_protobuf4.UInt32Value { +func (m *KnownTypes) GetU32() *wrappers.UInt32Value { if m != nil { return m.U32 } return nil } -func (m *KnownTypes) GetBool() *google_protobuf4.BoolValue { +func (m *KnownTypes) GetBool() *wrappers.BoolValue { if m != nil { return m.Bool } return nil } -func (m *KnownTypes) GetStr() *google_protobuf4.StringValue { +func (m *KnownTypes) GetStr() *wrappers.StringValue { if m != nil { return m.Str } return nil } -func (m *KnownTypes) GetBytes() *google_protobuf4.BytesValue { +func (m *KnownTypes) GetBytes() *wrappers.BytesValue { if m != nil { return m.Bytes } return nil } +// Test messages for marshaling/unmarshaling required fields. +type MsgWithRequired struct { + Str *string `protobuf:"bytes,1,req,name=str" json:"str,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MsgWithRequired) Reset() { *m = MsgWithRequired{} } +func (m *MsgWithRequired) String() string { return proto.CompactTextString(m) } +func (*MsgWithRequired) ProtoMessage() {} +func (*MsgWithRequired) Descriptor() ([]byte, []int) { + return fileDescriptor_test_objects_c6f6c615ab823e65, []int{9} +} +func (m *MsgWithRequired) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MsgWithRequired.Unmarshal(m, b) +} +func (m *MsgWithRequired) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MsgWithRequired.Marshal(b, m, deterministic) +} +func (dst *MsgWithRequired) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgWithRequired.Merge(dst, src) +} +func (m *MsgWithRequired) XXX_Size() int { + return xxx_messageInfo_MsgWithRequired.Size(m) +} +func (m *MsgWithRequired) XXX_DiscardUnknown() { + xxx_messageInfo_MsgWithRequired.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgWithRequired proto.InternalMessageInfo + +func (m *MsgWithRequired) GetStr() string { + if m != nil && m.Str != nil { + return *m.Str + } + return "" +} + +type MsgWithIndirectRequired struct { + Subm *MsgWithRequired `protobuf:"bytes,1,opt,name=subm" json:"subm,omitempty"` + MapField map[string]*MsgWithRequired `protobuf:"bytes,2,rep,name=map_field,json=mapField" json:"map_field,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + SliceField []*MsgWithRequired `protobuf:"bytes,3,rep,name=slice_field,json=sliceField" json:"slice_field,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MsgWithIndirectRequired) Reset() { *m = MsgWithIndirectRequired{} } +func (m *MsgWithIndirectRequired) String() string { return proto.CompactTextString(m) } +func (*MsgWithIndirectRequired) ProtoMessage() {} +func (*MsgWithIndirectRequired) Descriptor() ([]byte, []int) { + return fileDescriptor_test_objects_c6f6c615ab823e65, []int{10} +} +func (m *MsgWithIndirectRequired) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MsgWithIndirectRequired.Unmarshal(m, b) +} +func (m *MsgWithIndirectRequired) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MsgWithIndirectRequired.Marshal(b, m, deterministic) +} +func (dst *MsgWithIndirectRequired) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgWithIndirectRequired.Merge(dst, src) +} +func (m *MsgWithIndirectRequired) XXX_Size() int { + return xxx_messageInfo_MsgWithIndirectRequired.Size(m) +} +func (m *MsgWithIndirectRequired) XXX_DiscardUnknown() { + xxx_messageInfo_MsgWithIndirectRequired.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgWithIndirectRequired proto.InternalMessageInfo + +func (m *MsgWithIndirectRequired) GetSubm() *MsgWithRequired { + if m != nil { + return m.Subm + } + return nil +} + +func (m *MsgWithIndirectRequired) GetMapField() map[string]*MsgWithRequired { + if m != nil { + return m.MapField + } + return nil +} + +func (m *MsgWithIndirectRequired) GetSliceField() []*MsgWithRequired { + if m != nil { + return m.SliceField + } + return nil +} + +type MsgWithRequiredBytes struct { + Byts []byte `protobuf:"bytes,1,req,name=byts" json:"byts,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MsgWithRequiredBytes) Reset() { *m = MsgWithRequiredBytes{} } +func (m *MsgWithRequiredBytes) String() string { return proto.CompactTextString(m) } +func (*MsgWithRequiredBytes) ProtoMessage() {} +func (*MsgWithRequiredBytes) Descriptor() ([]byte, []int) { + return fileDescriptor_test_objects_c6f6c615ab823e65, []int{11} +} +func (m *MsgWithRequiredBytes) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MsgWithRequiredBytes.Unmarshal(m, b) +} +func (m *MsgWithRequiredBytes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MsgWithRequiredBytes.Marshal(b, m, deterministic) +} +func (dst *MsgWithRequiredBytes) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgWithRequiredBytes.Merge(dst, src) +} +func (m *MsgWithRequiredBytes) XXX_Size() int { + return xxx_messageInfo_MsgWithRequiredBytes.Size(m) +} +func (m *MsgWithRequiredBytes) XXX_DiscardUnknown() { + xxx_messageInfo_MsgWithRequiredBytes.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgWithRequiredBytes proto.InternalMessageInfo + +func (m *MsgWithRequiredBytes) GetByts() []byte { + if m != nil { + return m.Byts + } + return nil +} + +type MsgWithRequiredWKT struct { + Str *wrappers.StringValue `protobuf:"bytes,1,req,name=str" json:"str,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MsgWithRequiredWKT) Reset() { *m = MsgWithRequiredWKT{} } +func (m *MsgWithRequiredWKT) String() string { return proto.CompactTextString(m) } +func (*MsgWithRequiredWKT) ProtoMessage() {} +func (*MsgWithRequiredWKT) Descriptor() ([]byte, []int) { + return fileDescriptor_test_objects_c6f6c615ab823e65, []int{12} +} +func (m *MsgWithRequiredWKT) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MsgWithRequiredWKT.Unmarshal(m, b) +} +func (m *MsgWithRequiredWKT) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MsgWithRequiredWKT.Marshal(b, m, deterministic) +} +func (dst *MsgWithRequiredWKT) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgWithRequiredWKT.Merge(dst, src) +} +func (m *MsgWithRequiredWKT) XXX_Size() int { + return xxx_messageInfo_MsgWithRequiredWKT.Size(m) +} +func (m *MsgWithRequiredWKT) XXX_DiscardUnknown() { + xxx_messageInfo_MsgWithRequiredWKT.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgWithRequiredWKT proto.InternalMessageInfo + +func (m *MsgWithRequiredWKT) GetStr() *wrappers.StringValue { + if m != nil { + return m.Str + } + return nil +} + var E_Name = &proto.ExtensionDesc{ ExtendedType: (*Real)(nil), ExtensionType: (*string)(nil), @@ -757,96 +1154,125 @@ var E_Name = &proto.ExtensionDesc{ Filename: "test_objects.proto", } +var E_Extm = &proto.ExtensionDesc{ + ExtendedType: (*Real)(nil), + ExtensionType: (*MsgWithRequired)(nil), + Field: 125, + Name: "jsonpb.extm", + Tag: "bytes,125,opt,name=extm", + Filename: "test_objects.proto", +} + func init() { proto.RegisterType((*Simple)(nil), "jsonpb.Simple") proto.RegisterType((*NonFinites)(nil), "jsonpb.NonFinites") proto.RegisterType((*Repeats)(nil), "jsonpb.Repeats") proto.RegisterType((*Widget)(nil), "jsonpb.Widget") proto.RegisterType((*Maps)(nil), "jsonpb.Maps") + proto.RegisterMapType((map[bool]*Simple)(nil), "jsonpb.Maps.MBoolSimpleEntry") + proto.RegisterMapType((map[int64]string)(nil), "jsonpb.Maps.MInt64StrEntry") proto.RegisterType((*MsgWithOneof)(nil), "jsonpb.MsgWithOneof") proto.RegisterType((*Real)(nil), "jsonpb.Real") proto.RegisterType((*Complex)(nil), "jsonpb.Complex") proto.RegisterType((*KnownTypes)(nil), "jsonpb.KnownTypes") + proto.RegisterType((*MsgWithRequired)(nil), "jsonpb.MsgWithRequired") + proto.RegisterType((*MsgWithIndirectRequired)(nil), "jsonpb.MsgWithIndirectRequired") + proto.RegisterMapType((map[string]*MsgWithRequired)(nil), "jsonpb.MsgWithIndirectRequired.MapFieldEntry") + proto.RegisterType((*MsgWithRequiredBytes)(nil), "jsonpb.MsgWithRequiredBytes") + proto.RegisterType((*MsgWithRequiredWKT)(nil), "jsonpb.MsgWithRequiredWKT") proto.RegisterEnum("jsonpb.Widget_Color", Widget_Color_name, Widget_Color_value) proto.RegisterExtension(E_Complex_RealExtension) proto.RegisterExtension(E_Name) -} - -func init() { proto.RegisterFile("test_objects.proto", fileDescriptor1) } - -var fileDescriptor1 = []byte{ - // 1160 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x95, 0x41, 0x73, 0xdb, 0x44, - 0x14, 0xc7, 0x23, 0xc9, 0x92, 0xed, 0x75, 0x92, 0x9a, 0x6d, 0xda, 0x2a, 0x26, 0x80, 0xc6, 0x94, - 0x22, 0x0a, 0x75, 0x07, 0xc7, 0xe3, 0x61, 0x0a, 0x97, 0xa4, 0x71, 0x29, 0x43, 0x13, 0x98, 0x4d, - 0x43, 0x8f, 0x1e, 0x39, 0x5a, 0xbb, 0x2a, 0xf2, 0xae, 0x67, 0x77, 0x95, 0xd4, 0x03, 0x87, 0x9c, - 0x39, 0x32, 0x7c, 0x05, 0xf8, 0x08, 0x1c, 0xf8, 0x74, 0xcc, 0xdb, 0x95, 0xac, 0xc4, 0x8e, 0x4f, - 0xf1, 0x7b, 0xef, 0xff, 0xfe, 0x59, 0xed, 0x6f, 0x77, 0x1f, 0xc2, 0x8a, 0x4a, 0x35, 0xe4, 0xa3, - 0x77, 0xf4, 0x5c, 0xc9, 0xce, 0x4c, 0x70, 0xc5, 0xb1, 0xf7, 0x4e, 0x72, 0x36, 0x1b, 0xb5, 0x76, - 0x27, 0x9c, 0x4f, 0x52, 0xfa, 0x54, 0x67, 0x47, 0xd9, 0xf8, 0x69, 0xc4, 0xe6, 0x46, 0xd2, 0xfa, - 0x78, 0xb9, 0x14, 0x67, 0x22, 0x52, 0x09, 0x67, 0x79, 0x7d, 0x6f, 0xb9, 0x2e, 0x95, 0xc8, 0xce, - 0x55, 0x5e, 0xfd, 0x64, 0xb9, 0xaa, 0x92, 0x29, 0x95, 0x2a, 0x9a, 0xce, 0xd6, 0xd9, 0x5f, 0x8a, - 0x68, 0x36, 0xa3, 0x22, 0x5f, 0x61, 0xfb, 0x6f, 0x1b, 0x79, 0xa7, 0xc9, 0x74, 0x96, 0x52, 0x7c, - 0x0f, 0x79, 0x7c, 0x38, 0xe2, 0x3c, 0xf5, 0xad, 0xc0, 0x0a, 0x6b, 0xc4, 0xe5, 0x87, 0x9c, 0xa7, - 0xf8, 0x01, 0xaa, 0xf2, 0x61, 0xc2, 0xd4, 0x7e, 0xd7, 0xb7, 0x03, 0x2b, 0x74, 0x89, 0xc7, 0x7f, - 0x80, 0x68, 0x51, 0xe8, 0xf7, 0x7c, 0x27, 0xb0, 0x42, 0xc7, 0x14, 0xfa, 0x3d, 0xbc, 0x8b, 0x6a, - 0x7c, 0x98, 0x99, 0x96, 0x4a, 0x60, 0x85, 0x5b, 0xa4, 0xca, 0xcf, 0x74, 0x58, 0x96, 0xfa, 0x3d, - 0xdf, 0x0d, 0xac, 0xb0, 0x92, 0x97, 0x8a, 0x2e, 0x69, 0xba, 0xbc, 0xc0, 0x0a, 0x3f, 0x20, 0x55, - 0x7e, 0x7a, 0xad, 0x4b, 0x9a, 0xae, 0x6a, 0x60, 0x85, 0x38, 0x2f, 0xf5, 0x7b, 0x66, 0x11, 0xe3, - 0x94, 0x47, 0xca, 0xaf, 0x05, 0x56, 0x68, 0x13, 0x8f, 0xbf, 0x80, 0xc8, 0xf4, 0xc4, 0x3c, 0x1b, - 0xa5, 0xd4, 0xaf, 0x07, 0x56, 0x68, 0x91, 0x2a, 0x3f, 0xd2, 0x61, 0x6e, 0xa7, 0x44, 0xc2, 0x26, - 0x3e, 0x0a, 0xac, 0xb0, 0x0e, 0x76, 0x3a, 0x34, 0x76, 0xa3, 0xb9, 0xa2, 0xd2, 0x6f, 0x04, 0x56, - 0xb8, 0x49, 0x3c, 0x7e, 0x08, 0x51, 0xfb, 0x4f, 0x0b, 0xa1, 0x13, 0xce, 0x5e, 0x24, 0x2c, 0x51, - 0x54, 0xe2, 0xbb, 0xc8, 0x1d, 0x0f, 0x59, 0xc4, 0xf4, 0x56, 0xd9, 0xa4, 0x32, 0x3e, 0x89, 0x18, - 0x6c, 0xe0, 0x78, 0x38, 0x4b, 0xd8, 0x58, 0x6f, 0x94, 0x4d, 0xdc, 0xf1, 0xcf, 0x09, 0x1b, 0x9b, - 0x34, 0x83, 0xb4, 0x93, 0xa7, 0x4f, 0x20, 0x7d, 0x17, 0xb9, 0xb1, 0xb6, 0xa8, 0xe8, 0xd5, 0x55, - 0xe2, 0xdc, 0x22, 0x36, 0x16, 0xae, 0xce, 0xba, 0x71, 0x61, 0x11, 0x1b, 0x0b, 0x2f, 0x4f, 0x83, - 0x45, 0xfb, 0x1f, 0x1b, 0x55, 0x09, 0x9d, 0xd1, 0x48, 0x49, 0x90, 0x88, 0x82, 0x9e, 0x03, 0xf4, - 0x44, 0x41, 0x4f, 0x2c, 0xe8, 0x39, 0x40, 0x4f, 0x2c, 0xe8, 0x89, 0x05, 0x3d, 0x07, 0xe8, 0x89, - 0x05, 0x3d, 0x51, 0xd2, 0x73, 0x80, 0x9e, 0x28, 0xe9, 0x89, 0x92, 0x9e, 0x03, 0xf4, 0x44, 0x49, - 0x4f, 0x94, 0xf4, 0x1c, 0xa0, 0x27, 0x4e, 0xaf, 0x75, 0x2d, 0xe8, 0x39, 0x40, 0x4f, 0x94, 0xf4, - 0xc4, 0x82, 0x9e, 0x03, 0xf4, 0xc4, 0x82, 0x9e, 0x28, 0xe9, 0x39, 0x40, 0x4f, 0x94, 0xf4, 0x44, - 0x49, 0xcf, 0x01, 0x7a, 0xa2, 0xa4, 0x27, 0x16, 0xf4, 0x1c, 0xa0, 0x27, 0x0c, 0xbd, 0x7f, 0x6d, - 0xe4, 0xbd, 0x49, 0xe2, 0x09, 0x55, 0xf8, 0x31, 0x72, 0xcf, 0x79, 0xca, 0x85, 0x26, 0xb7, 0xdd, - 0xdd, 0xe9, 0x98, 0x2b, 0xda, 0x31, 0xe5, 0xce, 0x73, 0xa8, 0x11, 0x23, 0xc1, 0x4f, 0xc0, 0xcf, - 0xa8, 0x61, 0xf3, 0xd6, 0xa9, 0x3d, 0xa1, 0xff, 0xe2, 0x47, 0xc8, 0x93, 0xfa, 0x2a, 0xe9, 0x53, - 0xd5, 0xe8, 0x6e, 0x17, 0x6a, 0x73, 0xc1, 0x48, 0x5e, 0xc5, 0x5f, 0x98, 0x0d, 0xd1, 0x4a, 0x58, - 0xe7, 0xaa, 0x12, 0x36, 0x28, 0x97, 0x56, 0x85, 0x01, 0xec, 0xef, 0x68, 0xcf, 0x3b, 0x85, 0x32, - 0xe7, 0x4e, 0x8a, 0x3a, 0xfe, 0x0a, 0xd5, 0xc5, 0xb0, 0x10, 0xdf, 0xd3, 0xb6, 0x2b, 0xe2, 0x9a, - 0xc8, 0x7f, 0xb5, 0x3f, 0x43, 0xae, 0x59, 0x74, 0x15, 0x39, 0x64, 0x70, 0xd4, 0xdc, 0xc0, 0x75, - 0xe4, 0x7e, 0x4f, 0x06, 0x83, 0x93, 0xa6, 0x85, 0x6b, 0xa8, 0x72, 0xf8, 0xea, 0x6c, 0xd0, 0xb4, - 0xdb, 0x7f, 0xd9, 0xa8, 0x72, 0x1c, 0xcd, 0x24, 0xfe, 0x16, 0x35, 0xa6, 0xe6, 0xb8, 0xc0, 0xde, - 0xeb, 0x33, 0xd6, 0xe8, 0x7e, 0x58, 0xf8, 0x83, 0xa4, 0x73, 0xac, 0xcf, 0xcf, 0xa9, 0x12, 0x03, - 0xa6, 0xc4, 0x9c, 0xd4, 0xa7, 0x45, 0x8c, 0x0f, 0xd0, 0xd6, 0x54, 0x9f, 0xcd, 0xe2, 0xab, 0x6d, - 0xdd, 0xfe, 0xd1, 0xcd, 0x76, 0x38, 0xaf, 0xe6, 0xb3, 0x8d, 0x41, 0x63, 0x5a, 0x66, 0x5a, 0xdf, - 0xa1, 0xed, 0x9b, 0xfe, 0xb8, 0x89, 0x9c, 0x5f, 0xe9, 0x5c, 0x63, 0x74, 0x08, 0xfc, 0xc4, 0x3b, - 0xc8, 0xbd, 0x88, 0xd2, 0x8c, 0xea, 0xeb, 0x57, 0x27, 0x26, 0x78, 0x66, 0x7f, 0x63, 0xb5, 0x4e, - 0x50, 0x73, 0xd9, 0xfe, 0x7a, 0x7f, 0xcd, 0xf4, 0x3f, 0xbc, 0xde, 0xbf, 0x0a, 0xa5, 0xf4, 0x6b, - 0xff, 0x61, 0xa1, 0xcd, 0x63, 0x39, 0x79, 0x93, 0xa8, 0xb7, 0x3f, 0x31, 0xca, 0xc7, 0xf8, 0x3e, - 0x72, 0x55, 0xa2, 0x52, 0xaa, 0xed, 0xea, 0x2f, 0x37, 0x88, 0x09, 0xb1, 0x8f, 0x3c, 0x19, 0xa5, - 0x91, 0x98, 0x6b, 0x4f, 0xe7, 0xe5, 0x06, 0xc9, 0x63, 0xdc, 0x42, 0xd5, 0xe7, 0x3c, 0x83, 0x95, - 0xe8, 0x67, 0x01, 0x7a, 0x8a, 0x04, 0xfe, 0x14, 0x6d, 0xbe, 0xe5, 0x53, 0x3a, 0x8c, 0xe2, 0x58, - 0x50, 0x29, 0xf5, 0x0b, 0x01, 0x82, 0x06, 0x64, 0x0f, 0x4c, 0xf2, 0xb0, 0x8a, 0xdc, 0x8c, 0x25, - 0x9c, 0xb5, 0x1f, 0xa1, 0x0a, 0xa1, 0x51, 0x5a, 0x7e, 0xbe, 0x65, 0xde, 0x08, 0x1d, 0x3c, 0xae, - 0xd5, 0xe2, 0xe6, 0xd5, 0xd5, 0xd5, 0x95, 0xdd, 0xbe, 0x84, 0xff, 0x08, 0x5f, 0xf2, 0x1e, 0xef, - 0xa1, 0x7a, 0x32, 0x8d, 0x26, 0x09, 0x83, 0x95, 0x19, 0x79, 0x99, 0x28, 0x5b, 0xba, 0x47, 0x68, - 0x5b, 0xd0, 0x28, 0x1d, 0xd2, 0xf7, 0x8a, 0x32, 0x99, 0x70, 0x86, 0x37, 0xcb, 0x23, 0x15, 0xa5, - 0xfe, 0x6f, 0x37, 0xcf, 0x64, 0x6e, 0x4f, 0xb6, 0xa0, 0x69, 0x50, 0xf4, 0xb4, 0xff, 0x73, 0x11, - 0xfa, 0x91, 0xf1, 0x4b, 0xf6, 0x7a, 0x3e, 0xa3, 0x12, 0x3f, 0x44, 0x76, 0xc4, 0xfc, 0x6d, 0xdd, - 0xba, 0xd3, 0x31, 0xf3, 0xa9, 0x53, 0xcc, 0xa7, 0xce, 0x01, 0x9b, 0x13, 0x3b, 0x62, 0xf8, 0x4b, - 0xe4, 0xc4, 0x99, 0xb9, 0xa5, 0x8d, 0xee, 0xee, 0x8a, 0xec, 0x28, 0x9f, 0x92, 0x04, 0x54, 0xf8, - 0x73, 0x64, 0x4b, 0xe5, 0x6f, 0x6a, 0xed, 0x83, 0x15, 0xed, 0xa9, 0x9e, 0x98, 0xc4, 0x96, 0x70, - 0xfb, 0x6d, 0x25, 0x73, 0xbe, 0xad, 0x15, 0xe1, 0xeb, 0x62, 0x78, 0x12, 0x5b, 0x49, 0xd0, 0xa6, - 0x17, 0xfe, 0x9d, 0x35, 0xda, 0x57, 0x89, 0x54, 0xbf, 0xc0, 0x0e, 0x13, 0x3b, 0xbd, 0xc0, 0x21, - 0x72, 0x2e, 0xa2, 0xd4, 0x6f, 0x6a, 0xf1, 0xfd, 0x15, 0xb1, 0x11, 0x82, 0x04, 0x77, 0x90, 0x13, - 0x8f, 0x52, 0xcd, 0xbc, 0xd1, 0xdd, 0x5b, 0xfd, 0x2e, 0xfd, 0xc8, 0xe5, 0xfa, 0x78, 0x94, 0xe2, - 0x27, 0xc8, 0x19, 0xa7, 0x4a, 0x1f, 0x01, 0xb8, 0x70, 0xcb, 0x7a, 0xfd, 0x5c, 0xe6, 0xf2, 0x71, - 0xaa, 0x40, 0x9e, 0xe4, 0xb3, 0xf5, 0x36, 0xb9, 0xbe, 0x42, 0xb9, 0x3c, 0xe9, 0xf7, 0x60, 0x35, - 0x59, 0xbf, 0xa7, 0xa7, 0xca, 0x6d, 0xab, 0x39, 0xbb, 0xae, 0xcf, 0xfa, 0x3d, 0x6d, 0xbf, 0xdf, - 0xd5, 0x43, 0x78, 0x8d, 0xfd, 0x7e, 0xb7, 0xb0, 0xdf, 0xef, 0x6a, 0xfb, 0xfd, 0xae, 0x9e, 0xcc, - 0xeb, 0xec, 0x17, 0xfa, 0x4c, 0xeb, 0x2b, 0x7a, 0x84, 0xd5, 0xd7, 0x6c, 0x3a, 0xdc, 0x61, 0x23, - 0xd7, 0x3a, 0xf0, 0x87, 0xd7, 0x08, 0xad, 0xf1, 0x37, 0x63, 0x21, 0xf7, 0x97, 0x4a, 0xe0, 0xaf, - 0x91, 0x5b, 0x0e, 0xf7, 0xdb, 0x3e, 0x40, 0x8f, 0x0b, 0xd3, 0x60, 0x94, 0xcf, 0x02, 0x54, 0x61, - 0xd1, 0x94, 0x2e, 0x1d, 0xfc, 0xdf, 0xf5, 0x0b, 0xa3, 0x2b, 0xff, 0x07, 0x00, 0x00, 0xff, 0xff, - 0xd5, 0x39, 0x32, 0x09, 0xf9, 0x09, 0x00, 0x00, + proto.RegisterExtension(E_Extm) +} + +func init() { proto.RegisterFile("test_objects.proto", fileDescriptor_test_objects_c6f6c615ab823e65) } + +var fileDescriptor_test_objects_c6f6c615ab823e65 = []byte{ + // 1357 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x56, 0xdd, 0x72, 0x13, 0xc7, + 0x12, 0xf6, 0xee, 0x6a, 0xf5, 0xd3, 0xf2, 0x1f, 0x83, 0x81, 0xc5, 0x87, 0x73, 0x8e, 0x4a, 0x70, + 0x38, 0x0a, 0xc4, 0xa2, 0x22, 0xbb, 0x5c, 0x84, 0xe4, 0x06, 0x63, 0x13, 0x08, 0xe0, 0xa4, 0xc6, + 0x26, 0x5c, 0xaa, 0x56, 0xde, 0x91, 0x59, 0xb2, 0xbb, 0xa3, 0xcc, 0xcc, 0xda, 0xa8, 0x92, 0x54, + 0xf9, 0x19, 0x52, 0x79, 0x82, 0x54, 0x25, 0x8f, 0x90, 0x8b, 0xbc, 0x45, 0xde, 0x28, 0x35, 0x3d, + 0xb3, 0x5a, 0x59, 0x42, 0x95, 0x5c, 0x79, 0xbb, 0xfb, 0xeb, 0x4f, 0x33, 0xfd, 0xf5, 0x74, 0x1b, + 0x88, 0x62, 0x52, 0xf5, 0xf9, 0xe0, 0x1d, 0x3b, 0x51, 0xb2, 0x3b, 0x12, 0x5c, 0x71, 0x52, 0x7d, + 0x27, 0x79, 0x36, 0x1a, 0x6c, 0xde, 0x3c, 0xe5, 0xfc, 0x34, 0x61, 0x0f, 0xd0, 0x3b, 0xc8, 0x87, + 0x0f, 0xc2, 0x6c, 0x6c, 0x20, 0x9b, 0xff, 0x99, 0x0d, 0x45, 0xb9, 0x08, 0x55, 0xcc, 0x33, 0x1b, + 0xbf, 0x35, 0x1b, 0x97, 0x4a, 0xe4, 0x27, 0xca, 0x46, 0xff, 0x3b, 0x1b, 0x55, 0x71, 0xca, 0xa4, + 0x0a, 0xd3, 0xd1, 0x22, 0xfa, 0x73, 0x11, 0x8e, 0x46, 0x4c, 0xd8, 0x13, 0xb6, 0x7f, 0x75, 0xa1, + 0x7a, 0x14, 0xa7, 0xa3, 0x84, 0x91, 0x6b, 0x50, 0xe5, 0xfd, 0x01, 0xe7, 0x49, 0xe0, 0xb4, 0x9c, + 0x4e, 0x9d, 0xfa, 0x7c, 0x8f, 0xf3, 0x84, 0xdc, 0x80, 0x1a, 0xef, 0xc7, 0x99, 0xda, 0xee, 0x05, + 0x6e, 0xcb, 0xe9, 0xf8, 0xb4, 0xca, 0x9f, 0x6b, 0x6b, 0x12, 0xd8, 0xdd, 0x09, 0xbc, 0x96, 0xd3, + 0xf1, 0x4c, 0x60, 0x77, 0x87, 0xdc, 0x84, 0x3a, 0xef, 0xe7, 0x26, 0xa5, 0xd2, 0x72, 0x3a, 0x2b, + 0xb4, 0xc6, 0x5f, 0xa3, 0x59, 0x86, 0x76, 0x77, 0x02, 0xbf, 0xe5, 0x74, 0x2a, 0x36, 0x54, 0x64, + 0x49, 0x93, 0x55, 0x6d, 0x39, 0x9d, 0x2b, 0xb4, 0xc6, 0x8f, 0xa6, 0xb2, 0xa4, 0xc9, 0xaa, 0xb5, + 0x9c, 0x0e, 0xb1, 0xa1, 0xdd, 0x1d, 0x73, 0x88, 0x61, 0xc2, 0x43, 0x15, 0xd4, 0x5b, 0x4e, 0xc7, + 0xa5, 0x55, 0xfe, 0x54, 0x5b, 0x26, 0x27, 0xe2, 0xf9, 0x20, 0x61, 0x41, 0xa3, 0xe5, 0x74, 0x1c, + 0x5a, 0xe3, 0xfb, 0x68, 0x5a, 0x3a, 0x25, 0xe2, 0xec, 0x34, 0x80, 0x96, 0xd3, 0x69, 0x68, 0x3a, + 0x34, 0x0d, 0xdd, 0x60, 0xac, 0x98, 0x0c, 0x9a, 0x2d, 0xa7, 0xb3, 0x4c, 0xab, 0x7c, 0x4f, 0x5b, + 0xed, 0x9f, 0x1c, 0x80, 0x43, 0x9e, 0x3d, 0x8d, 0xb3, 0x58, 0x31, 0x49, 0xae, 0x82, 0x3f, 0xec, + 0x67, 0x61, 0x86, 0xa5, 0x72, 0x69, 0x65, 0x78, 0x18, 0x66, 0xba, 0x80, 0xc3, 0xfe, 0x28, 0xce, + 0x86, 0x58, 0x28, 0x97, 0xfa, 0xc3, 0xaf, 0xe3, 0x6c, 0x68, 0xdc, 0x99, 0x76, 0x7b, 0xd6, 0x7d, + 0xa8, 0xdd, 0x57, 0xc1, 0x8f, 0x90, 0xa2, 0x82, 0xa7, 0xab, 0x44, 0x96, 0x22, 0x32, 0x14, 0x3e, + 0x7a, 0xfd, 0xa8, 0xa0, 0x88, 0x0c, 0x45, 0xd5, 0xba, 0x35, 0x45, 0xfb, 0x37, 0x17, 0x6a, 0x94, + 0x8d, 0x58, 0xa8, 0xa4, 0x86, 0x88, 0x42, 0x3d, 0x4f, 0xab, 0x27, 0x0a, 0xf5, 0xc4, 0x44, 0x3d, + 0x4f, 0xab, 0x27, 0x26, 0xea, 0x89, 0x89, 0x7a, 0x9e, 0x56, 0x4f, 0x4c, 0xd4, 0x13, 0xa5, 0x7a, + 0x9e, 0x56, 0x4f, 0x94, 0xea, 0x89, 0x52, 0x3d, 0x4f, 0xab, 0x27, 0x4a, 0xf5, 0x44, 0xa9, 0x9e, + 0xa7, 0xd5, 0x13, 0x47, 0x53, 0x59, 0x13, 0xf5, 0x3c, 0xad, 0x9e, 0x28, 0xd5, 0x13, 0x13, 0xf5, + 0x3c, 0xad, 0x9e, 0x98, 0xa8, 0x27, 0x4a, 0xf5, 0x3c, 0xad, 0x9e, 0x28, 0xd5, 0x13, 0xa5, 0x7a, + 0x9e, 0x56, 0x4f, 0x94, 0xea, 0x89, 0x89, 0x7a, 0x9e, 0x56, 0x4f, 0x18, 0xf5, 0x7e, 0x77, 0xa1, + 0xfa, 0x26, 0x8e, 0x4e, 0x99, 0x22, 0xf7, 0xc0, 0x3f, 0xe1, 0x09, 0x17, 0xa8, 0xdc, 0x6a, 0x6f, + 0xa3, 0x6b, 0x9e, 0x68, 0xd7, 0x84, 0xbb, 0x4f, 0x74, 0x8c, 0x1a, 0x08, 0xd9, 0xd2, 0x7c, 0x06, + 0xad, 0x8b, 0xb7, 0x08, 0x5d, 0x15, 0xf8, 0x97, 0xdc, 0x85, 0xaa, 0xc4, 0xa7, 0x84, 0x5d, 0xd5, + 0xec, 0xad, 0x16, 0x68, 0xf3, 0xc0, 0xa8, 0x8d, 0x92, 0x8f, 0x4c, 0x41, 0x10, 0xa9, 0xcf, 0x39, + 0x8f, 0xd4, 0x05, 0xb2, 0xd0, 0x9a, 0x30, 0x02, 0x07, 0x1b, 0xc8, 0xb9, 0x56, 0x20, 0xad, 0xee, + 0xb4, 0x88, 0x93, 0x8f, 0xa1, 0x21, 0xfa, 0x05, 0xf8, 0x1a, 0xd2, 0xce, 0x81, 0xeb, 0xc2, 0x7e, + 0xb5, 0xff, 0x07, 0xbe, 0x39, 0x74, 0x0d, 0x3c, 0x7a, 0xb0, 0xbf, 0xbe, 0x44, 0x1a, 0xe0, 0x7f, + 0x41, 0x0f, 0x0e, 0x0e, 0xd7, 0x1d, 0x52, 0x87, 0xca, 0xde, 0xcb, 0xd7, 0x07, 0xeb, 0x6e, 0xfb, + 0x67, 0x17, 0x2a, 0xaf, 0xc2, 0x91, 0x24, 0x9f, 0x41, 0x33, 0x35, 0xed, 0xa2, 0x6b, 0x8f, 0x3d, + 0xd6, 0xec, 0xfd, 0xab, 0xe0, 0xd7, 0x90, 0xee, 0x2b, 0xec, 0x9f, 0x23, 0x25, 0x0e, 0x32, 0x25, + 0xc6, 0xb4, 0x91, 0x16, 0x36, 0x79, 0x0c, 0x2b, 0x29, 0xf6, 0x66, 0x71, 0x6b, 0x17, 0xd3, 0xff, + 0x7d, 0x39, 0x5d, 0xf7, 0xab, 0xb9, 0xb6, 0x21, 0x68, 0xa6, 0xa5, 0x67, 0xf3, 0x73, 0x58, 0xbd, + 0xcc, 0x4f, 0xd6, 0xc1, 0xfb, 0x96, 0x8d, 0x51, 0x46, 0x8f, 0xea, 0x4f, 0xb2, 0x01, 0xfe, 0x59, + 0x98, 0xe4, 0x0c, 0x9f, 0x5f, 0x83, 0x1a, 0xe3, 0x91, 0xfb, 0xd0, 0xd9, 0x3c, 0x84, 0xf5, 0x59, + 0xfa, 0xe9, 0xfc, 0xba, 0xc9, 0xbf, 0x33, 0x9d, 0x3f, 0x2f, 0x4a, 0xc9, 0xd7, 0xfe, 0xd3, 0x81, + 0xe5, 0x57, 0xf2, 0xf4, 0x4d, 0xac, 0xde, 0x7e, 0x95, 0x31, 0x3e, 0x24, 0xd7, 0xc1, 0x57, 0xb1, + 0x4a, 0x18, 0xd2, 0x35, 0x9e, 0x2d, 0x51, 0x63, 0x92, 0x00, 0xaa, 0x32, 0x4c, 0x42, 0x31, 0x46, + 0x4e, 0xef, 0xd9, 0x12, 0xb5, 0x36, 0xd9, 0x84, 0xda, 0x13, 0x9e, 0xeb, 0x93, 0xe0, 0x58, 0xd0, + 0x39, 0x85, 0x83, 0xdc, 0x86, 0xe5, 0xb7, 0x3c, 0x65, 0xfd, 0x30, 0x8a, 0x04, 0x93, 0x12, 0x27, + 0x84, 0x06, 0x34, 0xb5, 0xf7, 0xb1, 0x71, 0x92, 0x03, 0xb8, 0x92, 0xca, 0xd3, 0xfe, 0x79, 0xac, + 0xde, 0xf6, 0x05, 0xfb, 0x2e, 0x8f, 0x05, 0x8b, 0x70, 0x6a, 0x34, 0x7b, 0x37, 0x26, 0x85, 0x35, + 0x67, 0xa4, 0x36, 0xfc, 0x6c, 0x89, 0xae, 0xa5, 0x97, 0x5d, 0x7b, 0x35, 0xf0, 0xf3, 0x2c, 0xe6, + 0x59, 0xfb, 0x2e, 0x54, 0x28, 0x0b, 0x93, 0xb2, 0x8a, 0x8e, 0x19, 0x35, 0x68, 0xdc, 0xab, 0xd7, + 0xa3, 0xf5, 0x8b, 0x8b, 0x8b, 0x0b, 0xb7, 0x7d, 0xae, 0x0f, 0xae, 0x0b, 0xf2, 0x9e, 0xdc, 0x82, + 0x46, 0x9c, 0x86, 0xa7, 0x71, 0xa6, 0x2f, 0x68, 0xe0, 0xa5, 0xa3, 0x4c, 0xe9, 0xed, 0xc3, 0xaa, + 0x60, 0x61, 0xd2, 0x67, 0xef, 0x15, 0xcb, 0x64, 0xcc, 0x33, 0xb2, 0x5c, 0x76, 0x66, 0x98, 0x04, + 0xdf, 0x5f, 0x6e, 0x6d, 0x4b, 0x4f, 0x57, 0x74, 0xd2, 0x41, 0x91, 0xd3, 0xfe, 0xc3, 0x07, 0x78, + 0x91, 0xf1, 0xf3, 0xec, 0x78, 0x3c, 0x62, 0x92, 0xdc, 0x01, 0x37, 0xcc, 0x82, 0x55, 0x4c, 0xdd, + 0xe8, 0x9a, 0x35, 0xd7, 0x2d, 0xd6, 0x5c, 0xf7, 0x71, 0x36, 0xa6, 0x6e, 0x98, 0x91, 0xfb, 0xe0, + 0x45, 0xb9, 0x79, 0xec, 0xcd, 0xde, 0xcd, 0x39, 0xd8, 0xbe, 0x5d, 0xb6, 0x54, 0xa3, 0xc8, 0xff, + 0xc1, 0x95, 0x2a, 0x58, 0xb6, 0x35, 0x9c, 0xc5, 0x1e, 0xe1, 0xe2, 0xa5, 0xae, 0xd4, 0x43, 0xc4, + 0x55, 0xd2, 0xb6, 0xc9, 0xe6, 0x1c, 0xf0, 0xb8, 0xd8, 0xc1, 0xd4, 0x55, 0x52, 0x63, 0x93, 0xb3, + 0x60, 0x6d, 0x01, 0xf6, 0x65, 0x2c, 0xd5, 0x37, 0xba, 0xc2, 0xd4, 0x4d, 0xce, 0x48, 0x07, 0xbc, + 0xb3, 0x30, 0x09, 0xd6, 0x11, 0x7c, 0x7d, 0x0e, 0x6c, 0x80, 0x1a, 0x42, 0xba, 0xe0, 0x45, 0x83, + 0x04, 0x5b, 0xa7, 0xd9, 0xbb, 0x35, 0x7f, 0x2f, 0x9c, 0x95, 0x16, 0x1f, 0x0d, 0x12, 0xb2, 0x05, + 0xde, 0x30, 0x51, 0xd8, 0x49, 0xfa, 0xdd, 0xce, 0xe2, 0x71, 0xea, 0x5a, 0xf8, 0x30, 0x51, 0x1a, + 0x1e, 0xdb, 0x15, 0xfd, 0x21, 0x38, 0xbe, 0x44, 0x0b, 0x8f, 0x77, 0x77, 0xf4, 0x69, 0xf2, 0xdd, + 0x1d, 0x5c, 0x4e, 0x1f, 0x3a, 0xcd, 0xeb, 0x69, 0x7c, 0xbe, 0xbb, 0x83, 0xf4, 0xdb, 0x3d, 0xdc, + 0xe5, 0x0b, 0xe8, 0xb7, 0x7b, 0x05, 0xfd, 0x76, 0x0f, 0xe9, 0xb7, 0x7b, 0xb8, 0xe0, 0x17, 0xd1, + 0x4f, 0xf0, 0x39, 0xe2, 0x2b, 0xb8, 0x09, 0x1b, 0x0b, 0x8a, 0xae, 0x47, 0x81, 0x81, 0x23, 0x4e, + 0xf3, 0xeb, 0xa1, 0x06, 0x0b, 0xf8, 0xcd, 0x76, 0xb1, 0xfc, 0x52, 0x09, 0xf2, 0x09, 0xf8, 0xe5, + 0xff, 0x08, 0x1f, 0xba, 0x00, 0x6e, 0x1d, 0x93, 0x60, 0x90, 0xed, 0xdb, 0xb0, 0x36, 0xf3, 0x18, + 0xf5, 0x00, 0x32, 0xa3, 0xd4, 0xed, 0x34, 0x90, 0xb7, 0xfd, 0x8b, 0x0b, 0x37, 0x2c, 0xea, 0x79, + 0x16, 0xc5, 0x82, 0x9d, 0xa8, 0x09, 0xfa, 0x3e, 0x54, 0x64, 0x3e, 0x48, 0x6d, 0x27, 0x2f, 0x7a, + 0xe1, 0x14, 0x41, 0xe4, 0x4b, 0x68, 0xa4, 0xe1, 0xa8, 0x3f, 0x8c, 0x59, 0x12, 0xd9, 0x61, 0xbb, + 0x35, 0x93, 0x31, 0xfb, 0x03, 0x7a, 0x08, 0x3f, 0xd5, 0x78, 0x33, 0x7c, 0xeb, 0xa9, 0x35, 0xc9, + 0x43, 0x68, 0xca, 0x24, 0x3e, 0x61, 0x96, 0xcd, 0x43, 0xb6, 0x85, 0xbf, 0x0f, 0x88, 0xc5, 0xcc, + 0xcd, 0x63, 0x58, 0xb9, 0x44, 0x3a, 0x3d, 0x72, 0x1b, 0x66, 0xe4, 0x6e, 0x5d, 0x1e, 0xb9, 0x0b, + 0x69, 0xa7, 0x66, 0xef, 0x3d, 0xd8, 0x98, 0x89, 0x62, 0xb5, 0x09, 0x81, 0xca, 0x60, 0xac, 0x24, + 0xd6, 0x73, 0x99, 0xe2, 0x77, 0x7b, 0x1f, 0xc8, 0x0c, 0xf6, 0xcd, 0x8b, 0xe3, 0x42, 0x6e, 0x0d, + 0xfc, 0x27, 0x72, 0x3f, 0x6a, 0x41, 0x25, 0x0b, 0x53, 0x36, 0x33, 0xb4, 0x7e, 0xc0, 0x5b, 0x60, + 0xe4, 0xd1, 0xa7, 0x50, 0x61, 0xef, 0x55, 0x3a, 0x83, 0xf8, 0xf1, 0x6f, 0xa4, 0xd2, 0x29, 0x7f, + 0x05, 0x00, 0x00, 0xff, 0xff, 0xea, 0x06, 0x1a, 0xa9, 0x37, 0x0c, 0x00, 0x00, } diff --git a/vendor/github.com/golang/protobuf/jsonpb/jsonpb_test_proto/test_objects.proto b/vendor/github.com/golang/protobuf/jsonpb/jsonpb_test_proto/test_objects.proto index 0d2fc1fad..36eb6e8c6 100644 --- a/vendor/github.com/golang/protobuf/jsonpb/jsonpb_test_proto/test_objects.proto +++ b/vendor/github.com/golang/protobuf/jsonpb/jsonpb_test_proto/test_objects.proto @@ -107,6 +107,7 @@ message MsgWithOneof { int64 salary = 2; string Country = 3; string home_address = 4; + MsgWithRequired msg_with_required = 5; } } @@ -145,3 +146,26 @@ message KnownTypes { optional google.protobuf.StringValue str = 10; optional google.protobuf.BytesValue bytes = 11; } + +// Test messages for marshaling/unmarshaling required fields. +message MsgWithRequired { + required string str = 1; +} + +message MsgWithIndirectRequired { + optional MsgWithRequired subm = 1; + map map_field = 2; + repeated MsgWithRequired slice_field = 3; +} + +message MsgWithRequiredBytes { + required bytes byts = 1; +} + +message MsgWithRequiredWKT { + required google.protobuf.StringValue str = 1; +} + +extend Real { + optional MsgWithRequired extm = 125; +} diff --git a/vendor/github.com/golang/protobuf/proto/Makefile b/vendor/github.com/golang/protobuf/proto/Makefile deleted file mode 100644 index e2e0651a9..000000000 --- a/vendor/github.com/golang/protobuf/proto/Makefile +++ /dev/null @@ -1,43 +0,0 @@ -# Go support for Protocol Buffers - Google's data interchange format -# -# Copyright 2010 The Go Authors. All rights reserved. -# https://github.com/golang/protobuf -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -install: - go install - -test: install generate-test-pbs - go test - - -generate-test-pbs: - make install - make -C testdata - protoc --go_out=Mtestdata/test.proto=github.com/golang/protobuf/proto/testdata,Mgoogle/protobuf/any.proto=github.com/golang/protobuf/ptypes/any:. proto3_proto/proto3.proto - make diff --git a/vendor/github.com/golang/protobuf/proto/clone.go b/vendor/github.com/golang/protobuf/proto/clone.go index e392575b3..3cd3249f7 100644 --- a/vendor/github.com/golang/protobuf/proto/clone.go +++ b/vendor/github.com/golang/protobuf/proto/clone.go @@ -35,22 +35,39 @@ package proto import ( + "fmt" "log" "reflect" "strings" ) // Clone returns a deep copy of a protocol buffer. -func Clone(pb Message) Message { - in := reflect.ValueOf(pb) +func Clone(src Message) Message { + in := reflect.ValueOf(src) if in.IsNil() { - return pb + return src } - out := reflect.New(in.Type().Elem()) - // out is empty so a merge is a deep copy. - mergeStruct(out.Elem(), in.Elem()) - return out.Interface().(Message) + dst := out.Interface().(Message) + Merge(dst, src) + return dst +} + +// Merger is the interface representing objects that can merge messages of the same type. +type Merger interface { + // Merge merges src into this message. + // Required and optional fields that are set in src will be set to that value in dst. + // Elements of repeated fields will be appended. + // + // Merge may panic if called with a different argument type than the receiver. + Merge(src Message) +} + +// generatedMerger is the custom merge method that generated protos will have. +// We must add this method since a generate Merge method will conflict with +// many existing protos that have a Merge data field already defined. +type generatedMerger interface { + XXX_Merge(src Message) } // Merge merges src into dst. @@ -58,17 +75,24 @@ func Clone(pb Message) Message { // Elements of repeated fields will be appended. // Merge panics if src and dst are not the same type, or if dst is nil. func Merge(dst, src Message) { + if m, ok := dst.(Merger); ok { + m.Merge(src) + return + } + in := reflect.ValueOf(src) out := reflect.ValueOf(dst) if out.IsNil() { panic("proto: nil destination") } if in.Type() != out.Type() { - // Explicit test prior to mergeStruct so that mistyped nils will fail - panic("proto: type mismatch") + panic(fmt.Sprintf("proto.Merge(%T, %T) type mismatch", dst, src)) } if in.IsNil() { - // Merging nil into non-nil is a quiet no-op + return // Merge from nil src is a noop + } + if m, ok := dst.(generatedMerger); ok { + m.XXX_Merge(src) return } mergeStruct(out.Elem(), in.Elem()) @@ -84,7 +108,7 @@ func mergeStruct(out, in reflect.Value) { mergeAny(out.Field(i), in.Field(i), false, sprop.Prop[i]) } - if emIn, ok := extendable(in.Addr().Interface()); ok { + if emIn, err := extendable(in.Addr().Interface()); err == nil { emOut, _ := extendable(out.Addr().Interface()) mIn, muIn := emIn.extensionsRead() if mIn != nil { diff --git a/vendor/github.com/golang/protobuf/proto/decode.go b/vendor/github.com/golang/protobuf/proto/decode.go index aa207298f..d9aa3c42d 100644 --- a/vendor/github.com/golang/protobuf/proto/decode.go +++ b/vendor/github.com/golang/protobuf/proto/decode.go @@ -39,8 +39,6 @@ import ( "errors" "fmt" "io" - "os" - "reflect" ) // errOverflow is returned when an integer is too large to be represented. @@ -50,10 +48,6 @@ var errOverflow = errors.New("proto: integer overflow") // wire type is encountered. It does not get returned to user code. var ErrInternalBadWireType = errors.New("proto: internal error: bad wiretype for oneof") -// The fundamental decoders that interpret bytes on the wire. -// Those that take integer types all return uint64 and are -// therefore of type valueDecoder. - // DecodeVarint reads a varint-encoded integer from the slice. // It returns the integer and the number of bytes consumed, or // zero if there is not enough. @@ -267,9 +261,6 @@ func (p *Buffer) DecodeZigzag32() (x uint64, err error) { return } -// These are not ValueDecoders: they produce an array of bytes or a string. -// bytes, embedded messages - // DecodeRawBytes reads a count-delimited byte buffer from the Buffer. // This is the format used for the bytes protocol buffer // type and for embedded messages. @@ -311,81 +302,29 @@ func (p *Buffer) DecodeStringBytes() (s string, err error) { return string(buf), nil } -// Skip the next item in the buffer. Its wire type is decoded and presented as an argument. -// If the protocol buffer has extensions, and the field matches, add it as an extension. -// Otherwise, if the XXX_unrecognized field exists, append the skipped data there. -func (o *Buffer) skipAndSave(t reflect.Type, tag, wire int, base structPointer, unrecField field) error { - oi := o.index - - err := o.skip(t, tag, wire) - if err != nil { - return err - } - - if !unrecField.IsValid() { - return nil - } - - ptr := structPointer_Bytes(base, unrecField) - - // Add the skipped field to struct field - obuf := o.buf - - o.buf = *ptr - o.EncodeVarint(uint64(tag<<3 | wire)) - *ptr = append(o.buf, obuf[oi:o.index]...) - - o.buf = obuf - - return nil -} - -// Skip the next item in the buffer. Its wire type is decoded and presented as an argument. -func (o *Buffer) skip(t reflect.Type, tag, wire int) error { - - var u uint64 - var err error - - switch wire { - case WireVarint: - _, err = o.DecodeVarint() - case WireFixed64: - _, err = o.DecodeFixed64() - case WireBytes: - _, err = o.DecodeRawBytes(false) - case WireFixed32: - _, err = o.DecodeFixed32() - case WireStartGroup: - for { - u, err = o.DecodeVarint() - if err != nil { - break - } - fwire := int(u & 0x7) - if fwire == WireEndGroup { - break - } - ftag := int(u >> 3) - err = o.skip(t, ftag, fwire) - if err != nil { - break - } - } - default: - err = fmt.Errorf("proto: can't skip unknown wire type %d for %s", wire, t) - } - return err -} - // Unmarshaler is the interface representing objects that can -// unmarshal themselves. The method should reset the receiver before -// decoding starts. The argument points to data that may be +// unmarshal themselves. The argument points to data that may be // overwritten, so implementations should not keep references to the // buffer. +// Unmarshal implementations should not clear the receiver. +// Any unmarshaled data should be merged into the receiver. +// Callers of Unmarshal that do not want to retain existing data +// should Reset the receiver before calling Unmarshal. type Unmarshaler interface { Unmarshal([]byte) error } +// newUnmarshaler is the interface representing objects that can +// unmarshal themselves. The semantics are identical to Unmarshaler. +// +// This exists to support protoc-gen-go generated messages. +// The proto package will stop type-asserting to this interface in the future. +// +// DO NOT DEPEND ON THIS. +type newUnmarshaler interface { + XXX_Unmarshal([]byte) error +} + // Unmarshal parses the protocol buffer representation in buf and places the // decoded result in pb. If the struct underlying pb does not match // the data in buf, the results can be unpredictable. @@ -395,7 +334,13 @@ type Unmarshaler interface { // to preserve and append to existing data. func Unmarshal(buf []byte, pb Message) error { pb.Reset() - return UnmarshalMerge(buf, pb) + if u, ok := pb.(newUnmarshaler); ok { + return u.XXX_Unmarshal(buf) + } + if u, ok := pb.(Unmarshaler); ok { + return u.Unmarshal(buf) + } + return NewBuffer(buf).Unmarshal(pb) } // UnmarshalMerge parses the protocol buffer representation in buf and @@ -405,8 +350,16 @@ func Unmarshal(buf []byte, pb Message) error { // UnmarshalMerge merges into existing data in pb. // Most code should use Unmarshal instead. func UnmarshalMerge(buf []byte, pb Message) error { - // If the object can unmarshal itself, let it. + if u, ok := pb.(newUnmarshaler); ok { + return u.XXX_Unmarshal(buf) + } if u, ok := pb.(Unmarshaler); ok { + // NOTE: The history of proto have unfortunately been inconsistent + // whether Unmarshaler should or should not implicitly clear itself. + // Some implementations do, most do not. + // Thus, calling this here may or may not do what people want. + // + // See https://github.com/golang/protobuf/issues/424 return u.Unmarshal(buf) } return NewBuffer(buf).Unmarshal(pb) @@ -422,12 +375,17 @@ func (p *Buffer) DecodeMessage(pb Message) error { } // DecodeGroup reads a tag-delimited group from the Buffer. +// StartGroup tag is already consumed. This function consumes +// EndGroup tag. func (p *Buffer) DecodeGroup(pb Message) error { - typ, base, err := getbase(pb) - if err != nil { - return err + b := p.buf[p.index:] + x, y := findEndGroup(b) + if x < 0 { + return io.ErrUnexpectedEOF } - return p.unmarshalType(typ.Elem(), GetProperties(typ.Elem()), true, base) + err := Unmarshal(b[:x], pb) + p.index += y + return err } // Unmarshal parses the protocol buffer representation in the @@ -438,533 +396,33 @@ func (p *Buffer) DecodeGroup(pb Message) error { // Unlike proto.Unmarshal, this does not reset pb before starting to unmarshal. func (p *Buffer) Unmarshal(pb Message) error { // If the object can unmarshal itself, let it. - if u, ok := pb.(Unmarshaler); ok { - err := u.Unmarshal(p.buf[p.index:]) + if u, ok := pb.(newUnmarshaler); ok { + err := u.XXX_Unmarshal(p.buf[p.index:]) p.index = len(p.buf) return err } - - typ, base, err := getbase(pb) - if err != nil { - return err - } - - err = p.unmarshalType(typ.Elem(), GetProperties(typ.Elem()), false, base) - - if collectStats { - stats.Decode++ - } - - return err -} - -// unmarshalType does the work of unmarshaling a structure. -func (o *Buffer) unmarshalType(st reflect.Type, prop *StructProperties, is_group bool, base structPointer) error { - var state errorState - required, reqFields := prop.reqCount, uint64(0) - - var err error - for err == nil && o.index < len(o.buf) { - oi := o.index - var u uint64 - u, err = o.DecodeVarint() - if err != nil { - break - } - wire := int(u & 0x7) - if wire == WireEndGroup { - if is_group { - if required > 0 { - // Not enough information to determine the exact field. - // (See below.) - return &RequiredNotSetError{"{Unknown}"} - } - return nil // input is satisfied - } - return fmt.Errorf("proto: %s: wiretype end group for non-group", st) - } - tag := int(u >> 3) - if tag <= 0 { - return fmt.Errorf("proto: %s: illegal tag %d (wire type %d)", st, tag, wire) - } - fieldnum, ok := prop.decoderTags.get(tag) - if !ok { - // Maybe it's an extension? - if prop.extendable { - if e, _ := extendable(structPointer_Interface(base, st)); isExtensionField(e, int32(tag)) { - if err = o.skip(st, tag, wire); err == nil { - extmap := e.extensionsWrite() - ext := extmap[int32(tag)] // may be missing - ext.enc = append(ext.enc, o.buf[oi:o.index]...) - extmap[int32(tag)] = ext - } - continue - } - } - // Maybe it's a oneof? - if prop.oneofUnmarshaler != nil { - m := structPointer_Interface(base, st).(Message) - // First return value indicates whether tag is a oneof field. - ok, err = prop.oneofUnmarshaler(m, tag, wire, o) - if err == ErrInternalBadWireType { - // Map the error to something more descriptive. - // Do the formatting here to save generated code space. - err = fmt.Errorf("bad wiretype for oneof field in %T", m) - } - if ok { - continue - } - } - err = o.skipAndSave(st, tag, wire, base, prop.unrecField) - continue - } - p := prop.Prop[fieldnum] - - if p.dec == nil { - fmt.Fprintf(os.Stderr, "proto: no protobuf decoder for %s.%s\n", st, st.Field(fieldnum).Name) - continue - } - dec := p.dec - if wire != WireStartGroup && wire != p.WireType { - if wire == WireBytes && p.packedDec != nil { - // a packable field - dec = p.packedDec - } else { - err = fmt.Errorf("proto: bad wiretype for field %s.%s: got wiretype %d, want %d", st, st.Field(fieldnum).Name, wire, p.WireType) - continue - } - } - decErr := dec(o, p, base) - if decErr != nil && !state.shouldContinue(decErr, p) { - err = decErr - } - if err == nil && p.Required { - // Successfully decoded a required field. - if tag <= 64 { - // use bitmap for fields 1-64 to catch field reuse. - var mask uint64 = 1 << uint64(tag-1) - if reqFields&mask == 0 { - // new required field - reqFields |= mask - required-- - } - } else { - // This is imprecise. It can be fooled by a required field - // with a tag > 64 that is encoded twice; that's very rare. - // A fully correct implementation would require allocating - // a data structure, which we would like to avoid. - required-- - } - } - } - if err == nil { - if is_group { - return io.ErrUnexpectedEOF - } - if state.err != nil { - return state.err - } - if required > 0 { - // Not enough information to determine the exact field. If we use extra - // CPU, we could determine the field only if the missing required field - // has a tag <= 64 and we check reqFields. - return &RequiredNotSetError{"{Unknown}"} - } - } - return err -} - -// Individual type decoders -// For each, -// u is the decoded value, -// v is a pointer to the field (pointer) in the struct - -// Sizes of the pools to allocate inside the Buffer. -// The goal is modest amortization and allocation -// on at least 16-byte boundaries. -const ( - boolPoolSize = 16 - uint32PoolSize = 8 - uint64PoolSize = 4 -) - -// Decode a bool. -func (o *Buffer) dec_bool(p *Properties, base structPointer) error { - u, err := p.valDec(o) - if err != nil { - return err - } - if len(o.bools) == 0 { - o.bools = make([]bool, boolPoolSize) - } - o.bools[0] = u != 0 - *structPointer_Bool(base, p.field) = &o.bools[0] - o.bools = o.bools[1:] - return nil -} - -func (o *Buffer) dec_proto3_bool(p *Properties, base structPointer) error { - u, err := p.valDec(o) - if err != nil { - return err - } - *structPointer_BoolVal(base, p.field) = u != 0 - return nil -} - -// Decode an int32. -func (o *Buffer) dec_int32(p *Properties, base structPointer) error { - u, err := p.valDec(o) - if err != nil { - return err - } - word32_Set(structPointer_Word32(base, p.field), o, uint32(u)) - return nil -} - -func (o *Buffer) dec_proto3_int32(p *Properties, base structPointer) error { - u, err := p.valDec(o) - if err != nil { - return err - } - word32Val_Set(structPointer_Word32Val(base, p.field), uint32(u)) - return nil -} - -// Decode an int64. -func (o *Buffer) dec_int64(p *Properties, base structPointer) error { - u, err := p.valDec(o) - if err != nil { - return err - } - word64_Set(structPointer_Word64(base, p.field), o, u) - return nil -} - -func (o *Buffer) dec_proto3_int64(p *Properties, base structPointer) error { - u, err := p.valDec(o) - if err != nil { - return err - } - word64Val_Set(structPointer_Word64Val(base, p.field), o, u) - return nil -} - -// Decode a string. -func (o *Buffer) dec_string(p *Properties, base structPointer) error { - s, err := o.DecodeStringBytes() - if err != nil { - return err - } - *structPointer_String(base, p.field) = &s - return nil -} - -func (o *Buffer) dec_proto3_string(p *Properties, base structPointer) error { - s, err := o.DecodeStringBytes() - if err != nil { - return err - } - *structPointer_StringVal(base, p.field) = s - return nil -} - -// Decode a slice of bytes ([]byte). -func (o *Buffer) dec_slice_byte(p *Properties, base structPointer) error { - b, err := o.DecodeRawBytes(true) - if err != nil { - return err - } - *structPointer_Bytes(base, p.field) = b - return nil -} - -// Decode a slice of bools ([]bool). -func (o *Buffer) dec_slice_bool(p *Properties, base structPointer) error { - u, err := p.valDec(o) - if err != nil { - return err - } - v := structPointer_BoolSlice(base, p.field) - *v = append(*v, u != 0) - return nil -} - -// Decode a slice of bools ([]bool) in packed format. -func (o *Buffer) dec_slice_packed_bool(p *Properties, base structPointer) error { - v := structPointer_BoolSlice(base, p.field) - - nn, err := o.DecodeVarint() - if err != nil { - return err - } - nb := int(nn) // number of bytes of encoded bools - fin := o.index + nb - if fin < o.index { - return errOverflow - } - - y := *v - for o.index < fin { - u, err := p.valDec(o) - if err != nil { - return err - } - y = append(y, u != 0) - } - - *v = y - return nil -} - -// Decode a slice of int32s ([]int32). -func (o *Buffer) dec_slice_int32(p *Properties, base structPointer) error { - u, err := p.valDec(o) - if err != nil { - return err - } - structPointer_Word32Slice(base, p.field).Append(uint32(u)) - return nil -} - -// Decode a slice of int32s ([]int32) in packed format. -func (o *Buffer) dec_slice_packed_int32(p *Properties, base structPointer) error { - v := structPointer_Word32Slice(base, p.field) - - nn, err := o.DecodeVarint() - if err != nil { - return err - } - nb := int(nn) // number of bytes of encoded int32s - - fin := o.index + nb - if fin < o.index { - return errOverflow - } - for o.index < fin { - u, err := p.valDec(o) - if err != nil { - return err - } - v.Append(uint32(u)) - } - return nil -} - -// Decode a slice of int64s ([]int64). -func (o *Buffer) dec_slice_int64(p *Properties, base structPointer) error { - u, err := p.valDec(o) - if err != nil { - return err - } - - structPointer_Word64Slice(base, p.field).Append(u) - return nil -} - -// Decode a slice of int64s ([]int64) in packed format. -func (o *Buffer) dec_slice_packed_int64(p *Properties, base structPointer) error { - v := structPointer_Word64Slice(base, p.field) - - nn, err := o.DecodeVarint() - if err != nil { - return err - } - nb := int(nn) // number of bytes of encoded int64s - - fin := o.index + nb - if fin < o.index { - return errOverflow - } - for o.index < fin { - u, err := p.valDec(o) - if err != nil { - return err - } - v.Append(u) - } - return nil -} - -// Decode a slice of strings ([]string). -func (o *Buffer) dec_slice_string(p *Properties, base structPointer) error { - s, err := o.DecodeStringBytes() - if err != nil { - return err - } - v := structPointer_StringSlice(base, p.field) - *v = append(*v, s) - return nil -} - -// Decode a slice of slice of bytes ([][]byte). -func (o *Buffer) dec_slice_slice_byte(p *Properties, base structPointer) error { - b, err := o.DecodeRawBytes(true) - if err != nil { - return err - } - v := structPointer_BytesSlice(base, p.field) - *v = append(*v, b) - return nil -} - -// Decode a map field. -func (o *Buffer) dec_new_map(p *Properties, base structPointer) error { - raw, err := o.DecodeRawBytes(false) - if err != nil { - return err - } - oi := o.index // index at the end of this map entry - o.index -= len(raw) // move buffer back to start of map entry - - mptr := structPointer_NewAt(base, p.field, p.mtype) // *map[K]V - if mptr.Elem().IsNil() { - mptr.Elem().Set(reflect.MakeMap(mptr.Type().Elem())) - } - v := mptr.Elem() // map[K]V - - // Prepare addressable doubly-indirect placeholders for the key and value types. - // See enc_new_map for why. - keyptr := reflect.New(reflect.PtrTo(p.mtype.Key())).Elem() // addressable *K - keybase := toStructPointer(keyptr.Addr()) // **K - - var valbase structPointer - var valptr reflect.Value - switch p.mtype.Elem().Kind() { - case reflect.Slice: - // []byte - var dummy []byte - valptr = reflect.ValueOf(&dummy) // *[]byte - valbase = toStructPointer(valptr) // *[]byte - case reflect.Ptr: - // message; valptr is **Msg; need to allocate the intermediate pointer - valptr = reflect.New(reflect.PtrTo(p.mtype.Elem())).Elem() // addressable *V - valptr.Set(reflect.New(valptr.Type().Elem())) - valbase = toStructPointer(valptr) - default: - // everything else - valptr = reflect.New(reflect.PtrTo(p.mtype.Elem())).Elem() // addressable *V - valbase = toStructPointer(valptr.Addr()) // **V - } - - // Decode. - // This parses a restricted wire format, namely the encoding of a message - // with two fields. See enc_new_map for the format. - for o.index < oi { - // tagcode for key and value properties are always a single byte - // because they have tags 1 and 2. - tagcode := o.buf[o.index] - o.index++ - switch tagcode { - case p.mkeyprop.tagcode[0]: - if err := p.mkeyprop.dec(o, p.mkeyprop, keybase); err != nil { - return err - } - case p.mvalprop.tagcode[0]: - if err := p.mvalprop.dec(o, p.mvalprop, valbase); err != nil { - return err - } - default: - // TODO: Should we silently skip this instead? - return fmt.Errorf("proto: bad map data tag %d", raw[0]) - } - } - keyelem, valelem := keyptr.Elem(), valptr.Elem() - if !keyelem.IsValid() { - keyelem = reflect.Zero(p.mtype.Key()) - } - if !valelem.IsValid() { - valelem = reflect.Zero(p.mtype.Elem()) - } - - v.SetMapIndex(keyelem, valelem) - return nil -} - -// Decode a group. -func (o *Buffer) dec_struct_group(p *Properties, base structPointer) error { - bas := structPointer_GetStructPointer(base, p.field) - if structPointer_IsNil(bas) { - // allocate new nested message - bas = toStructPointer(reflect.New(p.stype)) - structPointer_SetStructPointer(base, p.field, bas) - } - return o.unmarshalType(p.stype, p.sprop, true, bas) -} - -// Decode an embedded message. -func (o *Buffer) dec_struct_message(p *Properties, base structPointer) (err error) { - raw, e := o.DecodeRawBytes(false) - if e != nil { - return e - } - - bas := structPointer_GetStructPointer(base, p.field) - if structPointer_IsNil(bas) { - // allocate new nested message - bas = toStructPointer(reflect.New(p.stype)) - structPointer_SetStructPointer(base, p.field, bas) - } - - // If the object can unmarshal itself, let it. - if p.isUnmarshaler { - iv := structPointer_Interface(bas, p.stype) - return iv.(Unmarshaler).Unmarshal(raw) - } - - obuf := o.buf - oi := o.index - o.buf = raw - o.index = 0 - - err = o.unmarshalType(p.stype, p.sprop, false, bas) - o.buf = obuf - o.index = oi - - return err -} - -// Decode a slice of embedded messages. -func (o *Buffer) dec_slice_struct_message(p *Properties, base structPointer) error { - return o.dec_slice_struct(p, false, base) -} - -// Decode a slice of embedded groups. -func (o *Buffer) dec_slice_struct_group(p *Properties, base structPointer) error { - return o.dec_slice_struct(p, true, base) -} - -// Decode a slice of structs ([]*struct). -func (o *Buffer) dec_slice_struct(p *Properties, is_group bool, base structPointer) error { - v := reflect.New(p.stype) - bas := toStructPointer(v) - structPointer_StructPointerSlice(base, p.field).Append(bas) - - if is_group { - err := o.unmarshalType(p.stype, p.sprop, is_group, bas) - return err - } - - raw, err := o.DecodeRawBytes(false) - if err != nil { + if u, ok := pb.(Unmarshaler); ok { + // NOTE: The history of proto have unfortunately been inconsistent + // whether Unmarshaler should or should not implicitly clear itself. + // Some implementations do, most do not. + // Thus, calling this here may or may not do what people want. + // + // See https://github.com/golang/protobuf/issues/424 + err := u.Unmarshal(p.buf[p.index:]) + p.index = len(p.buf) return err } - // If the object can unmarshal itself, let it. - if p.isUnmarshaler { - iv := v.Interface() - return iv.(Unmarshaler).Unmarshal(raw) - } - - obuf := o.buf - oi := o.index - o.buf = raw - o.index = 0 - - err = o.unmarshalType(p.stype, p.sprop, is_group, bas) - - o.buf = obuf - o.index = oi - + // Slow workaround for messages that aren't Unmarshalers. + // This includes some hand-coded .pb.go files and + // bootstrap protos. + // TODO: fix all of those and then add Unmarshal to + // the Message interface. Then: + // The cast above and code below can be deleted. + // The old unmarshaler can be deleted. + // Clients can call Unmarshal directly (can already do that, actually). + var info InternalMessageInfo + err := info.Unmarshal(pb, p.buf[p.index:]) + p.index = len(p.buf) return err } diff --git a/vendor/github.com/golang/protobuf/proto/discard.go b/vendor/github.com/golang/protobuf/proto/discard.go new file mode 100644 index 000000000..dea2617ce --- /dev/null +++ b/vendor/github.com/golang/protobuf/proto/discard.go @@ -0,0 +1,350 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2017 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package proto + +import ( + "fmt" + "reflect" + "strings" + "sync" + "sync/atomic" +) + +type generatedDiscarder interface { + XXX_DiscardUnknown() +} + +// DiscardUnknown recursively discards all unknown fields from this message +// and all embedded messages. +// +// When unmarshaling a message with unrecognized fields, the tags and values +// of such fields are preserved in the Message. This allows a later call to +// marshal to be able to produce a message that continues to have those +// unrecognized fields. To avoid this, DiscardUnknown is used to +// explicitly clear the unknown fields after unmarshaling. +// +// For proto2 messages, the unknown fields of message extensions are only +// discarded from messages that have been accessed via GetExtension. +func DiscardUnknown(m Message) { + if m, ok := m.(generatedDiscarder); ok { + m.XXX_DiscardUnknown() + return + } + // TODO: Dynamically populate a InternalMessageInfo for legacy messages, + // but the master branch has no implementation for InternalMessageInfo, + // so it would be more work to replicate that approach. + discardLegacy(m) +} + +// DiscardUnknown recursively discards all unknown fields. +func (a *InternalMessageInfo) DiscardUnknown(m Message) { + di := atomicLoadDiscardInfo(&a.discard) + if di == nil { + di = getDiscardInfo(reflect.TypeOf(m).Elem()) + atomicStoreDiscardInfo(&a.discard, di) + } + di.discard(toPointer(&m)) +} + +type discardInfo struct { + typ reflect.Type + + initialized int32 // 0: only typ is valid, 1: everything is valid + lock sync.Mutex + + fields []discardFieldInfo + unrecognized field +} + +type discardFieldInfo struct { + field field // Offset of field, guaranteed to be valid + discard func(src pointer) +} + +var ( + discardInfoMap = map[reflect.Type]*discardInfo{} + discardInfoLock sync.Mutex +) + +func getDiscardInfo(t reflect.Type) *discardInfo { + discardInfoLock.Lock() + defer discardInfoLock.Unlock() + di := discardInfoMap[t] + if di == nil { + di = &discardInfo{typ: t} + discardInfoMap[t] = di + } + return di +} + +func (di *discardInfo) discard(src pointer) { + if src.isNil() { + return // Nothing to do. + } + + if atomic.LoadInt32(&di.initialized) == 0 { + di.computeDiscardInfo() + } + + for _, fi := range di.fields { + sfp := src.offset(fi.field) + fi.discard(sfp) + } + + // For proto2 messages, only discard unknown fields in message extensions + // that have been accessed via GetExtension. + if em, err := extendable(src.asPointerTo(di.typ).Interface()); err == nil { + // Ignore lock since DiscardUnknown is not concurrency safe. + emm, _ := em.extensionsRead() + for _, mx := range emm { + if m, ok := mx.value.(Message); ok { + DiscardUnknown(m) + } + } + } + + if di.unrecognized.IsValid() { + *src.offset(di.unrecognized).toBytes() = nil + } +} + +func (di *discardInfo) computeDiscardInfo() { + di.lock.Lock() + defer di.lock.Unlock() + if di.initialized != 0 { + return + } + t := di.typ + n := t.NumField() + + for i := 0; i < n; i++ { + f := t.Field(i) + if strings.HasPrefix(f.Name, "XXX_") { + continue + } + + dfi := discardFieldInfo{field: toField(&f)} + tf := f.Type + + // Unwrap tf to get its most basic type. + var isPointer, isSlice bool + if tf.Kind() == reflect.Slice && tf.Elem().Kind() != reflect.Uint8 { + isSlice = true + tf = tf.Elem() + } + if tf.Kind() == reflect.Ptr { + isPointer = true + tf = tf.Elem() + } + if isPointer && isSlice && tf.Kind() != reflect.Struct { + panic(fmt.Sprintf("%v.%s cannot be a slice of pointers to primitive types", t, f.Name)) + } + + switch tf.Kind() { + case reflect.Struct: + switch { + case !isPointer: + panic(fmt.Sprintf("%v.%s cannot be a direct struct value", t, f.Name)) + case isSlice: // E.g., []*pb.T + di := getDiscardInfo(tf) + dfi.discard = func(src pointer) { + sps := src.getPointerSlice() + for _, sp := range sps { + if !sp.isNil() { + di.discard(sp) + } + } + } + default: // E.g., *pb.T + di := getDiscardInfo(tf) + dfi.discard = func(src pointer) { + sp := src.getPointer() + if !sp.isNil() { + di.discard(sp) + } + } + } + case reflect.Map: + switch { + case isPointer || isSlice: + panic(fmt.Sprintf("%v.%s cannot be a pointer to a map or a slice of map values", t, f.Name)) + default: // E.g., map[K]V + if tf.Elem().Kind() == reflect.Ptr { // Proto struct (e.g., *T) + dfi.discard = func(src pointer) { + sm := src.asPointerTo(tf).Elem() + if sm.Len() == 0 { + return + } + for _, key := range sm.MapKeys() { + val := sm.MapIndex(key) + DiscardUnknown(val.Interface().(Message)) + } + } + } else { + dfi.discard = func(pointer) {} // Noop + } + } + case reflect.Interface: + // Must be oneof field. + switch { + case isPointer || isSlice: + panic(fmt.Sprintf("%v.%s cannot be a pointer to a interface or a slice of interface values", t, f.Name)) + default: // E.g., interface{} + // TODO: Make this faster? + dfi.discard = func(src pointer) { + su := src.asPointerTo(tf).Elem() + if !su.IsNil() { + sv := su.Elem().Elem().Field(0) + if sv.Kind() == reflect.Ptr && sv.IsNil() { + return + } + switch sv.Type().Kind() { + case reflect.Ptr: // Proto struct (e.g., *T) + DiscardUnknown(sv.Interface().(Message)) + } + } + } + } + default: + continue + } + di.fields = append(di.fields, dfi) + } + + di.unrecognized = invalidField + if f, ok := t.FieldByName("XXX_unrecognized"); ok { + if f.Type != reflect.TypeOf([]byte{}) { + panic("expected XXX_unrecognized to be of type []byte") + } + di.unrecognized = toField(&f) + } + + atomic.StoreInt32(&di.initialized, 1) +} + +func discardLegacy(m Message) { + v := reflect.ValueOf(m) + if v.Kind() != reflect.Ptr || v.IsNil() { + return + } + v = v.Elem() + if v.Kind() != reflect.Struct { + return + } + t := v.Type() + + for i := 0; i < v.NumField(); i++ { + f := t.Field(i) + if strings.HasPrefix(f.Name, "XXX_") { + continue + } + vf := v.Field(i) + tf := f.Type + + // Unwrap tf to get its most basic type. + var isPointer, isSlice bool + if tf.Kind() == reflect.Slice && tf.Elem().Kind() != reflect.Uint8 { + isSlice = true + tf = tf.Elem() + } + if tf.Kind() == reflect.Ptr { + isPointer = true + tf = tf.Elem() + } + if isPointer && isSlice && tf.Kind() != reflect.Struct { + panic(fmt.Sprintf("%T.%s cannot be a slice of pointers to primitive types", m, f.Name)) + } + + switch tf.Kind() { + case reflect.Struct: + switch { + case !isPointer: + panic(fmt.Sprintf("%T.%s cannot be a direct struct value", m, f.Name)) + case isSlice: // E.g., []*pb.T + for j := 0; j < vf.Len(); j++ { + discardLegacy(vf.Index(j).Interface().(Message)) + } + default: // E.g., *pb.T + discardLegacy(vf.Interface().(Message)) + } + case reflect.Map: + switch { + case isPointer || isSlice: + panic(fmt.Sprintf("%T.%s cannot be a pointer to a map or a slice of map values", m, f.Name)) + default: // E.g., map[K]V + tv := vf.Type().Elem() + if tv.Kind() == reflect.Ptr && tv.Implements(protoMessageType) { // Proto struct (e.g., *T) + for _, key := range vf.MapKeys() { + val := vf.MapIndex(key) + discardLegacy(val.Interface().(Message)) + } + } + } + case reflect.Interface: + // Must be oneof field. + switch { + case isPointer || isSlice: + panic(fmt.Sprintf("%T.%s cannot be a pointer to a interface or a slice of interface values", m, f.Name)) + default: // E.g., test_proto.isCommunique_Union interface + if !vf.IsNil() && f.Tag.Get("protobuf_oneof") != "" { + vf = vf.Elem() // E.g., *test_proto.Communique_Msg + if !vf.IsNil() { + vf = vf.Elem() // E.g., test_proto.Communique_Msg + vf = vf.Field(0) // E.g., Proto struct (e.g., *T) or primitive value + if vf.Kind() == reflect.Ptr { + discardLegacy(vf.Interface().(Message)) + } + } + } + } + } + } + + if vf := v.FieldByName("XXX_unrecognized"); vf.IsValid() { + if vf.Type() != reflect.TypeOf([]byte{}) { + panic("expected XXX_unrecognized to be of type []byte") + } + vf.Set(reflect.ValueOf([]byte(nil))) + } + + // For proto2 messages, only discard unknown fields in message extensions + // that have been accessed via GetExtension. + if em, err := extendable(m); err == nil { + // Ignore lock since discardLegacy is not concurrency safe. + emm, _ := em.extensionsRead() + for _, mx := range emm { + if m, ok := mx.value.(Message); ok { + discardLegacy(m) + } + } + } +} diff --git a/vendor/github.com/golang/protobuf/proto/encode.go b/vendor/github.com/golang/protobuf/proto/encode.go index 8b84d1b22..c27d35f86 100644 --- a/vendor/github.com/golang/protobuf/proto/encode.go +++ b/vendor/github.com/golang/protobuf/proto/encode.go @@ -39,7 +39,6 @@ import ( "errors" "fmt" "reflect" - "sort" ) // RequiredNotSetError is the error returned if Marshal is called with @@ -82,10 +81,6 @@ var ( const maxVarintBytes = 10 // maximum length of a varint -// maxMarshalSize is the largest allowed size of an encoded protobuf, -// since C++ and Java use signed int32s for the size. -const maxMarshalSize = 1<<31 - 1 - // EncodeVarint returns the varint encoding of x. // This is the format for the // int32, int64, uint32, uint64, bool, and enum @@ -119,18 +114,27 @@ func (p *Buffer) EncodeVarint(x uint64) error { // SizeVarint returns the varint encoding size of an integer. func SizeVarint(x uint64) int { - return sizeVarint(x) -} - -func sizeVarint(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + switch { + case x < 1<<7: + return 1 + case x < 1<<14: + return 2 + case x < 1<<21: + return 3 + case x < 1<<28: + return 4 + case x < 1<<35: + return 5 + case x < 1<<42: + return 6 + case x < 1<<49: + return 7 + case x < 1<<56: + return 8 + case x < 1<<63: + return 9 + } + return 10 } // EncodeFixed64 writes a 64-bit integer to the Buffer. @@ -149,10 +153,6 @@ func (p *Buffer) EncodeFixed64(x uint64) error { return nil } -func sizeFixed64(x uint64) int { - return 8 -} - // EncodeFixed32 writes a 32-bit integer to the Buffer. // This is the format for the // fixed32, sfixed32, and float protocol buffer types. @@ -165,20 +165,12 @@ func (p *Buffer) EncodeFixed32(x uint64) error { return nil } -func sizeFixed32(x uint64) int { - return 4 -} - // EncodeZigzag64 writes a zigzag-encoded 64-bit integer // to the Buffer. // This is the format used for the sint64 protocol buffer type. func (p *Buffer) EncodeZigzag64(x uint64) error { // use signed number to get arithmetic right shift. - return p.EncodeVarint((x << 1) ^ uint64((int64(x) >> 63))) -} - -func sizeZigzag64(x uint64) int { - return sizeVarint((x << 1) ^ uint64((int64(x) >> 63))) + return p.EncodeVarint(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } // EncodeZigzag32 writes a zigzag-encoded 32-bit integer @@ -189,10 +181,6 @@ func (p *Buffer) EncodeZigzag32(x uint64) error { return p.EncodeVarint(uint64((uint32(x) << 1) ^ uint32((int32(x) >> 31)))) } -func sizeZigzag32(x uint64) int { - return sizeVarint(uint64((uint32(x) << 1) ^ uint32((int32(x) >> 31)))) -} - // EncodeRawBytes writes a count-delimited byte buffer to the Buffer. // This is the format used for the bytes protocol buffer // type and for embedded messages. @@ -202,11 +190,6 @@ func (p *Buffer) EncodeRawBytes(b []byte) error { return nil } -func sizeRawBytes(b []byte) int { - return sizeVarint(uint64(len(b))) + - len(b) -} - // EncodeStringBytes writes an encoded string to the Buffer. // This is the format used for the proto2 string type. func (p *Buffer) EncodeStringBytes(s string) error { @@ -215,319 +198,17 @@ func (p *Buffer) EncodeStringBytes(s string) error { return nil } -func sizeStringBytes(s string) int { - return sizeVarint(uint64(len(s))) + - len(s) -} - // Marshaler is the interface representing objects that can marshal themselves. type Marshaler interface { Marshal() ([]byte, error) } -// Marshal takes the protocol buffer -// and encodes it into the wire format, returning the data. -func Marshal(pb Message) ([]byte, error) { - // Can the object marshal itself? - if m, ok := pb.(Marshaler); ok { - return m.Marshal() - } - p := NewBuffer(nil) - err := p.Marshal(pb) - if p.buf == nil && err == nil { - // Return a non-nil slice on success. - return []byte{}, nil - } - return p.buf, err -} - // EncodeMessage writes the protocol buffer to the Buffer, // prefixed by a varint-encoded length. func (p *Buffer) EncodeMessage(pb Message) error { - t, base, err := getbase(pb) - if structPointer_IsNil(base) { - return ErrNil - } - if err == nil { - var state errorState - err = p.enc_len_struct(GetProperties(t.Elem()), base, &state) - } - return err -} - -// Marshal takes the protocol buffer -// and encodes it into the wire format, writing the result to the -// Buffer. -func (p *Buffer) Marshal(pb Message) error { - // Can the object marshal itself? - if m, ok := pb.(Marshaler); ok { - data, err := m.Marshal() - p.buf = append(p.buf, data...) - return err - } - - t, base, err := getbase(pb) - if structPointer_IsNil(base) { - return ErrNil - } - if err == nil { - err = p.enc_struct(GetProperties(t.Elem()), base) - } - - if collectStats { - (stats).Encode++ // Parens are to work around a goimports bug. - } - - if len(p.buf) > maxMarshalSize { - return ErrTooLarge - } - return err -} - -// Size returns the encoded size of a protocol buffer. -func Size(pb Message) (n int) { - // Can the object marshal itself? If so, Size is slow. - // TODO: add Size to Marshaler, or add a Sizer interface. - if m, ok := pb.(Marshaler); ok { - b, _ := m.Marshal() - return len(b) - } - - t, base, err := getbase(pb) - if structPointer_IsNil(base) { - return 0 - } - if err == nil { - n = size_struct(GetProperties(t.Elem()), base) - } - - if collectStats { - (stats).Size++ // Parens are to work around a goimports bug. - } - - return -} - -// Individual type encoders. - -// Encode a bool. -func (o *Buffer) enc_bool(p *Properties, base structPointer) error { - v := *structPointer_Bool(base, p.field) - if v == nil { - return ErrNil - } - x := 0 - if *v { - x = 1 - } - o.buf = append(o.buf, p.tagcode...) - p.valEnc(o, uint64(x)) - return nil -} - -func (o *Buffer) enc_proto3_bool(p *Properties, base structPointer) error { - v := *structPointer_BoolVal(base, p.field) - if !v { - return ErrNil - } - o.buf = append(o.buf, p.tagcode...) - p.valEnc(o, 1) - return nil -} - -func size_bool(p *Properties, base structPointer) int { - v := *structPointer_Bool(base, p.field) - if v == nil { - return 0 - } - return len(p.tagcode) + 1 // each bool takes exactly one byte -} - -func size_proto3_bool(p *Properties, base structPointer) int { - v := *structPointer_BoolVal(base, p.field) - if !v && !p.oneof { - return 0 - } - return len(p.tagcode) + 1 // each bool takes exactly one byte -} - -// Encode an int32. -func (o *Buffer) enc_int32(p *Properties, base structPointer) error { - v := structPointer_Word32(base, p.field) - if word32_IsNil(v) { - return ErrNil - } - x := int32(word32_Get(v)) // permit sign extension to use full 64-bit range - o.buf = append(o.buf, p.tagcode...) - p.valEnc(o, uint64(x)) - return nil -} - -func (o *Buffer) enc_proto3_int32(p *Properties, base structPointer) error { - v := structPointer_Word32Val(base, p.field) - x := int32(word32Val_Get(v)) // permit sign extension to use full 64-bit range - if x == 0 { - return ErrNil - } - o.buf = append(o.buf, p.tagcode...) - p.valEnc(o, uint64(x)) - return nil -} - -func size_int32(p *Properties, base structPointer) (n int) { - v := structPointer_Word32(base, p.field) - if word32_IsNil(v) { - return 0 - } - x := int32(word32_Get(v)) // permit sign extension to use full 64-bit range - n += len(p.tagcode) - n += p.valSize(uint64(x)) - return -} - -func size_proto3_int32(p *Properties, base structPointer) (n int) { - v := structPointer_Word32Val(base, p.field) - x := int32(word32Val_Get(v)) // permit sign extension to use full 64-bit range - if x == 0 && !p.oneof { - return 0 - } - n += len(p.tagcode) - n += p.valSize(uint64(x)) - return -} - -// Encode a uint32. -// Exactly the same as int32, except for no sign extension. -func (o *Buffer) enc_uint32(p *Properties, base structPointer) error { - v := structPointer_Word32(base, p.field) - if word32_IsNil(v) { - return ErrNil - } - x := word32_Get(v) - o.buf = append(o.buf, p.tagcode...) - p.valEnc(o, uint64(x)) - return nil -} - -func (o *Buffer) enc_proto3_uint32(p *Properties, base structPointer) error { - v := structPointer_Word32Val(base, p.field) - x := word32Val_Get(v) - if x == 0 { - return ErrNil - } - o.buf = append(o.buf, p.tagcode...) - p.valEnc(o, uint64(x)) - return nil -} - -func size_uint32(p *Properties, base structPointer) (n int) { - v := structPointer_Word32(base, p.field) - if word32_IsNil(v) { - return 0 - } - x := word32_Get(v) - n += len(p.tagcode) - n += p.valSize(uint64(x)) - return -} - -func size_proto3_uint32(p *Properties, base structPointer) (n int) { - v := structPointer_Word32Val(base, p.field) - x := word32Val_Get(v) - if x == 0 && !p.oneof { - return 0 - } - n += len(p.tagcode) - n += p.valSize(uint64(x)) - return -} - -// Encode an int64. -func (o *Buffer) enc_int64(p *Properties, base structPointer) error { - v := structPointer_Word64(base, p.field) - if word64_IsNil(v) { - return ErrNil - } - x := word64_Get(v) - o.buf = append(o.buf, p.tagcode...) - p.valEnc(o, x) - return nil -} - -func (o *Buffer) enc_proto3_int64(p *Properties, base structPointer) error { - v := structPointer_Word64Val(base, p.field) - x := word64Val_Get(v) - if x == 0 { - return ErrNil - } - o.buf = append(o.buf, p.tagcode...) - p.valEnc(o, x) - return nil -} - -func size_int64(p *Properties, base structPointer) (n int) { - v := structPointer_Word64(base, p.field) - if word64_IsNil(v) { - return 0 - } - x := word64_Get(v) - n += len(p.tagcode) - n += p.valSize(x) - return -} - -func size_proto3_int64(p *Properties, base structPointer) (n int) { - v := structPointer_Word64Val(base, p.field) - x := word64Val_Get(v) - if x == 0 && !p.oneof { - return 0 - } - n += len(p.tagcode) - n += p.valSize(x) - return -} - -// Encode a string. -func (o *Buffer) enc_string(p *Properties, base structPointer) error { - v := *structPointer_String(base, p.field) - if v == nil { - return ErrNil - } - x := *v - o.buf = append(o.buf, p.tagcode...) - o.EncodeStringBytes(x) - return nil -} - -func (o *Buffer) enc_proto3_string(p *Properties, base structPointer) error { - v := *structPointer_StringVal(base, p.field) - if v == "" { - return ErrNil - } - o.buf = append(o.buf, p.tagcode...) - o.EncodeStringBytes(v) - return nil -} - -func size_string(p *Properties, base structPointer) (n int) { - v := *structPointer_String(base, p.field) - if v == nil { - return 0 - } - x := *v - n += len(p.tagcode) - n += sizeStringBytes(x) - return -} - -func size_proto3_string(p *Properties, base structPointer) (n int) { - v := *structPointer_StringVal(base, p.field) - if v == "" && !p.oneof { - return 0 - } - n += len(p.tagcode) - n += sizeStringBytes(v) - return + siz := Size(pb) + p.EncodeVarint(uint64(siz)) + return p.Marshal(pb) } // All protocol buffer fields are nillable, but be careful. @@ -538,825 +219,3 @@ func isNil(v reflect.Value) bool { } return false } - -// Encode a message struct. -func (o *Buffer) enc_struct_message(p *Properties, base structPointer) error { - var state errorState - structp := structPointer_GetStructPointer(base, p.field) - if structPointer_IsNil(structp) { - return ErrNil - } - - // Can the object marshal itself? - if p.isMarshaler { - m := structPointer_Interface(structp, p.stype).(Marshaler) - data, err := m.Marshal() - if err != nil && !state.shouldContinue(err, nil) { - return err - } - o.buf = append(o.buf, p.tagcode...) - o.EncodeRawBytes(data) - return state.err - } - - o.buf = append(o.buf, p.tagcode...) - return o.enc_len_struct(p.sprop, structp, &state) -} - -func size_struct_message(p *Properties, base structPointer) int { - structp := structPointer_GetStructPointer(base, p.field) - if structPointer_IsNil(structp) { - return 0 - } - - // Can the object marshal itself? - if p.isMarshaler { - m := structPointer_Interface(structp, p.stype).(Marshaler) - data, _ := m.Marshal() - n0 := len(p.tagcode) - n1 := sizeRawBytes(data) - return n0 + n1 - } - - n0 := len(p.tagcode) - n1 := size_struct(p.sprop, structp) - n2 := sizeVarint(uint64(n1)) // size of encoded length - return n0 + n1 + n2 -} - -// Encode a group struct. -func (o *Buffer) enc_struct_group(p *Properties, base structPointer) error { - var state errorState - b := structPointer_GetStructPointer(base, p.field) - if structPointer_IsNil(b) { - return ErrNil - } - - o.EncodeVarint(uint64((p.Tag << 3) | WireStartGroup)) - err := o.enc_struct(p.sprop, b) - if err != nil && !state.shouldContinue(err, nil) { - return err - } - o.EncodeVarint(uint64((p.Tag << 3) | WireEndGroup)) - return state.err -} - -func size_struct_group(p *Properties, base structPointer) (n int) { - b := structPointer_GetStructPointer(base, p.field) - if structPointer_IsNil(b) { - return 0 - } - - n += sizeVarint(uint64((p.Tag << 3) | WireStartGroup)) - n += size_struct(p.sprop, b) - n += sizeVarint(uint64((p.Tag << 3) | WireEndGroup)) - return -} - -// Encode a slice of bools ([]bool). -func (o *Buffer) enc_slice_bool(p *Properties, base structPointer) error { - s := *structPointer_BoolSlice(base, p.field) - l := len(s) - if l == 0 { - return ErrNil - } - for _, x := range s { - o.buf = append(o.buf, p.tagcode...) - v := uint64(0) - if x { - v = 1 - } - p.valEnc(o, v) - } - return nil -} - -func size_slice_bool(p *Properties, base structPointer) int { - s := *structPointer_BoolSlice(base, p.field) - l := len(s) - if l == 0 { - return 0 - } - return l * (len(p.tagcode) + 1) // each bool takes exactly one byte -} - -// Encode a slice of bools ([]bool) in packed format. -func (o *Buffer) enc_slice_packed_bool(p *Properties, base structPointer) error { - s := *structPointer_BoolSlice(base, p.field) - l := len(s) - if l == 0 { - return ErrNil - } - o.buf = append(o.buf, p.tagcode...) - o.EncodeVarint(uint64(l)) // each bool takes exactly one byte - for _, x := range s { - v := uint64(0) - if x { - v = 1 - } - p.valEnc(o, v) - } - return nil -} - -func size_slice_packed_bool(p *Properties, base structPointer) (n int) { - s := *structPointer_BoolSlice(base, p.field) - l := len(s) - if l == 0 { - return 0 - } - n += len(p.tagcode) - n += sizeVarint(uint64(l)) - n += l // each bool takes exactly one byte - return -} - -// Encode a slice of bytes ([]byte). -func (o *Buffer) enc_slice_byte(p *Properties, base structPointer) error { - s := *structPointer_Bytes(base, p.field) - if s == nil { - return ErrNil - } - o.buf = append(o.buf, p.tagcode...) - o.EncodeRawBytes(s) - return nil -} - -func (o *Buffer) enc_proto3_slice_byte(p *Properties, base structPointer) error { - s := *structPointer_Bytes(base, p.field) - if len(s) == 0 { - return ErrNil - } - o.buf = append(o.buf, p.tagcode...) - o.EncodeRawBytes(s) - return nil -} - -func size_slice_byte(p *Properties, base structPointer) (n int) { - s := *structPointer_Bytes(base, p.field) - if s == nil && !p.oneof { - return 0 - } - n += len(p.tagcode) - n += sizeRawBytes(s) - return -} - -func size_proto3_slice_byte(p *Properties, base structPointer) (n int) { - s := *structPointer_Bytes(base, p.field) - if len(s) == 0 && !p.oneof { - return 0 - } - n += len(p.tagcode) - n += sizeRawBytes(s) - return -} - -// Encode a slice of int32s ([]int32). -func (o *Buffer) enc_slice_int32(p *Properties, base structPointer) error { - s := structPointer_Word32Slice(base, p.field) - l := s.Len() - if l == 0 { - return ErrNil - } - for i := 0; i < l; i++ { - o.buf = append(o.buf, p.tagcode...) - x := int32(s.Index(i)) // permit sign extension to use full 64-bit range - p.valEnc(o, uint64(x)) - } - return nil -} - -func size_slice_int32(p *Properties, base structPointer) (n int) { - s := structPointer_Word32Slice(base, p.field) - l := s.Len() - if l == 0 { - return 0 - } - for i := 0; i < l; i++ { - n += len(p.tagcode) - x := int32(s.Index(i)) // permit sign extension to use full 64-bit range - n += p.valSize(uint64(x)) - } - return -} - -// Encode a slice of int32s ([]int32) in packed format. -func (o *Buffer) enc_slice_packed_int32(p *Properties, base structPointer) error { - s := structPointer_Word32Slice(base, p.field) - l := s.Len() - if l == 0 { - return ErrNil - } - // TODO: Reuse a Buffer. - buf := NewBuffer(nil) - for i := 0; i < l; i++ { - x := int32(s.Index(i)) // permit sign extension to use full 64-bit range - p.valEnc(buf, uint64(x)) - } - - o.buf = append(o.buf, p.tagcode...) - o.EncodeVarint(uint64(len(buf.buf))) - o.buf = append(o.buf, buf.buf...) - return nil -} - -func size_slice_packed_int32(p *Properties, base structPointer) (n int) { - s := structPointer_Word32Slice(base, p.field) - l := s.Len() - if l == 0 { - return 0 - } - var bufSize int - for i := 0; i < l; i++ { - x := int32(s.Index(i)) // permit sign extension to use full 64-bit range - bufSize += p.valSize(uint64(x)) - } - - n += len(p.tagcode) - n += sizeVarint(uint64(bufSize)) - n += bufSize - return -} - -// Encode a slice of uint32s ([]uint32). -// Exactly the same as int32, except for no sign extension. -func (o *Buffer) enc_slice_uint32(p *Properties, base structPointer) error { - s := structPointer_Word32Slice(base, p.field) - l := s.Len() - if l == 0 { - return ErrNil - } - for i := 0; i < l; i++ { - o.buf = append(o.buf, p.tagcode...) - x := s.Index(i) - p.valEnc(o, uint64(x)) - } - return nil -} - -func size_slice_uint32(p *Properties, base structPointer) (n int) { - s := structPointer_Word32Slice(base, p.field) - l := s.Len() - if l == 0 { - return 0 - } - for i := 0; i < l; i++ { - n += len(p.tagcode) - x := s.Index(i) - n += p.valSize(uint64(x)) - } - return -} - -// Encode a slice of uint32s ([]uint32) in packed format. -// Exactly the same as int32, except for no sign extension. -func (o *Buffer) enc_slice_packed_uint32(p *Properties, base structPointer) error { - s := structPointer_Word32Slice(base, p.field) - l := s.Len() - if l == 0 { - return ErrNil - } - // TODO: Reuse a Buffer. - buf := NewBuffer(nil) - for i := 0; i < l; i++ { - p.valEnc(buf, uint64(s.Index(i))) - } - - o.buf = append(o.buf, p.tagcode...) - o.EncodeVarint(uint64(len(buf.buf))) - o.buf = append(o.buf, buf.buf...) - return nil -} - -func size_slice_packed_uint32(p *Properties, base structPointer) (n int) { - s := structPointer_Word32Slice(base, p.field) - l := s.Len() - if l == 0 { - return 0 - } - var bufSize int - for i := 0; i < l; i++ { - bufSize += p.valSize(uint64(s.Index(i))) - } - - n += len(p.tagcode) - n += sizeVarint(uint64(bufSize)) - n += bufSize - return -} - -// Encode a slice of int64s ([]int64). -func (o *Buffer) enc_slice_int64(p *Properties, base structPointer) error { - s := structPointer_Word64Slice(base, p.field) - l := s.Len() - if l == 0 { - return ErrNil - } - for i := 0; i < l; i++ { - o.buf = append(o.buf, p.tagcode...) - p.valEnc(o, s.Index(i)) - } - return nil -} - -func size_slice_int64(p *Properties, base structPointer) (n int) { - s := structPointer_Word64Slice(base, p.field) - l := s.Len() - if l == 0 { - return 0 - } - for i := 0; i < l; i++ { - n += len(p.tagcode) - n += p.valSize(s.Index(i)) - } - return -} - -// Encode a slice of int64s ([]int64) in packed format. -func (o *Buffer) enc_slice_packed_int64(p *Properties, base structPointer) error { - s := structPointer_Word64Slice(base, p.field) - l := s.Len() - if l == 0 { - return ErrNil - } - // TODO: Reuse a Buffer. - buf := NewBuffer(nil) - for i := 0; i < l; i++ { - p.valEnc(buf, s.Index(i)) - } - - o.buf = append(o.buf, p.tagcode...) - o.EncodeVarint(uint64(len(buf.buf))) - o.buf = append(o.buf, buf.buf...) - return nil -} - -func size_slice_packed_int64(p *Properties, base structPointer) (n int) { - s := structPointer_Word64Slice(base, p.field) - l := s.Len() - if l == 0 { - return 0 - } - var bufSize int - for i := 0; i < l; i++ { - bufSize += p.valSize(s.Index(i)) - } - - n += len(p.tagcode) - n += sizeVarint(uint64(bufSize)) - n += bufSize - return -} - -// Encode a slice of slice of bytes ([][]byte). -func (o *Buffer) enc_slice_slice_byte(p *Properties, base structPointer) error { - ss := *structPointer_BytesSlice(base, p.field) - l := len(ss) - if l == 0 { - return ErrNil - } - for i := 0; i < l; i++ { - o.buf = append(o.buf, p.tagcode...) - o.EncodeRawBytes(ss[i]) - } - return nil -} - -func size_slice_slice_byte(p *Properties, base structPointer) (n int) { - ss := *structPointer_BytesSlice(base, p.field) - l := len(ss) - if l == 0 { - return 0 - } - n += l * len(p.tagcode) - for i := 0; i < l; i++ { - n += sizeRawBytes(ss[i]) - } - return -} - -// Encode a slice of strings ([]string). -func (o *Buffer) enc_slice_string(p *Properties, base structPointer) error { - ss := *structPointer_StringSlice(base, p.field) - l := len(ss) - for i := 0; i < l; i++ { - o.buf = append(o.buf, p.tagcode...) - o.EncodeStringBytes(ss[i]) - } - return nil -} - -func size_slice_string(p *Properties, base structPointer) (n int) { - ss := *structPointer_StringSlice(base, p.field) - l := len(ss) - n += l * len(p.tagcode) - for i := 0; i < l; i++ { - n += sizeStringBytes(ss[i]) - } - return -} - -// Encode a slice of message structs ([]*struct). -func (o *Buffer) enc_slice_struct_message(p *Properties, base structPointer) error { - var state errorState - s := structPointer_StructPointerSlice(base, p.field) - l := s.Len() - - for i := 0; i < l; i++ { - structp := s.Index(i) - if structPointer_IsNil(structp) { - return errRepeatedHasNil - } - - // Can the object marshal itself? - if p.isMarshaler { - m := structPointer_Interface(structp, p.stype).(Marshaler) - data, err := m.Marshal() - if err != nil && !state.shouldContinue(err, nil) { - return err - } - o.buf = append(o.buf, p.tagcode...) - o.EncodeRawBytes(data) - continue - } - - o.buf = append(o.buf, p.tagcode...) - err := o.enc_len_struct(p.sprop, structp, &state) - if err != nil && !state.shouldContinue(err, nil) { - if err == ErrNil { - return errRepeatedHasNil - } - return err - } - } - return state.err -} - -func size_slice_struct_message(p *Properties, base structPointer) (n int) { - s := structPointer_StructPointerSlice(base, p.field) - l := s.Len() - n += l * len(p.tagcode) - for i := 0; i < l; i++ { - structp := s.Index(i) - if structPointer_IsNil(structp) { - return // return the size up to this point - } - - // Can the object marshal itself? - if p.isMarshaler { - m := structPointer_Interface(structp, p.stype).(Marshaler) - data, _ := m.Marshal() - n += sizeRawBytes(data) - continue - } - - n0 := size_struct(p.sprop, structp) - n1 := sizeVarint(uint64(n0)) // size of encoded length - n += n0 + n1 - } - return -} - -// Encode a slice of group structs ([]*struct). -func (o *Buffer) enc_slice_struct_group(p *Properties, base structPointer) error { - var state errorState - s := structPointer_StructPointerSlice(base, p.field) - l := s.Len() - - for i := 0; i < l; i++ { - b := s.Index(i) - if structPointer_IsNil(b) { - return errRepeatedHasNil - } - - o.EncodeVarint(uint64((p.Tag << 3) | WireStartGroup)) - - err := o.enc_struct(p.sprop, b) - - if err != nil && !state.shouldContinue(err, nil) { - if err == ErrNil { - return errRepeatedHasNil - } - return err - } - - o.EncodeVarint(uint64((p.Tag << 3) | WireEndGroup)) - } - return state.err -} - -func size_slice_struct_group(p *Properties, base structPointer) (n int) { - s := structPointer_StructPointerSlice(base, p.field) - l := s.Len() - - n += l * sizeVarint(uint64((p.Tag<<3)|WireStartGroup)) - n += l * sizeVarint(uint64((p.Tag<<3)|WireEndGroup)) - for i := 0; i < l; i++ { - b := s.Index(i) - if structPointer_IsNil(b) { - return // return size up to this point - } - - n += size_struct(p.sprop, b) - } - return -} - -// Encode an extension map. -func (o *Buffer) enc_map(p *Properties, base structPointer) error { - exts := structPointer_ExtMap(base, p.field) - if err := encodeExtensionsMap(*exts); err != nil { - return err - } - - return o.enc_map_body(*exts) -} - -func (o *Buffer) enc_exts(p *Properties, base structPointer) error { - exts := structPointer_Extensions(base, p.field) - - v, mu := exts.extensionsRead() - if v == nil { - return nil - } - - mu.Lock() - defer mu.Unlock() - if err := encodeExtensionsMap(v); err != nil { - return err - } - - return o.enc_map_body(v) -} - -func (o *Buffer) enc_map_body(v map[int32]Extension) error { - // Fast-path for common cases: zero or one extensions. - if len(v) <= 1 { - for _, e := range v { - o.buf = append(o.buf, e.enc...) - } - return nil - } - - // Sort keys to provide a deterministic encoding. - keys := make([]int, 0, len(v)) - for k := range v { - keys = append(keys, int(k)) - } - sort.Ints(keys) - - for _, k := range keys { - o.buf = append(o.buf, v[int32(k)].enc...) - } - return nil -} - -func size_map(p *Properties, base structPointer) int { - v := structPointer_ExtMap(base, p.field) - return extensionsMapSize(*v) -} - -func size_exts(p *Properties, base structPointer) int { - v := structPointer_Extensions(base, p.field) - return extensionsSize(v) -} - -// Encode a map field. -func (o *Buffer) enc_new_map(p *Properties, base structPointer) error { - var state errorState // XXX: or do we need to plumb this through? - - /* - A map defined as - map map_field = N; - is encoded in the same way as - message MapFieldEntry { - key_type key = 1; - value_type value = 2; - } - repeated MapFieldEntry map_field = N; - */ - - v := structPointer_NewAt(base, p.field, p.mtype).Elem() // map[K]V - if v.Len() == 0 { - return nil - } - - keycopy, valcopy, keybase, valbase := mapEncodeScratch(p.mtype) - - enc := func() error { - if err := p.mkeyprop.enc(o, p.mkeyprop, keybase); err != nil { - return err - } - if err := p.mvalprop.enc(o, p.mvalprop, valbase); err != nil && err != ErrNil { - return err - } - return nil - } - - // Don't sort map keys. It is not required by the spec, and C++ doesn't do it. - for _, key := range v.MapKeys() { - val := v.MapIndex(key) - - keycopy.Set(key) - valcopy.Set(val) - - o.buf = append(o.buf, p.tagcode...) - if err := o.enc_len_thing(enc, &state); err != nil { - return err - } - } - return nil -} - -func size_new_map(p *Properties, base structPointer) int { - v := structPointer_NewAt(base, p.field, p.mtype).Elem() // map[K]V - - keycopy, valcopy, keybase, valbase := mapEncodeScratch(p.mtype) - - n := 0 - for _, key := range v.MapKeys() { - val := v.MapIndex(key) - keycopy.Set(key) - valcopy.Set(val) - - // Tag codes for key and val are the responsibility of the sub-sizer. - keysize := p.mkeyprop.size(p.mkeyprop, keybase) - valsize := p.mvalprop.size(p.mvalprop, valbase) - entry := keysize + valsize - // Add on tag code and length of map entry itself. - n += len(p.tagcode) + sizeVarint(uint64(entry)) + entry - } - return n -} - -// mapEncodeScratch returns a new reflect.Value matching the map's value type, -// and a structPointer suitable for passing to an encoder or sizer. -func mapEncodeScratch(mapType reflect.Type) (keycopy, valcopy reflect.Value, keybase, valbase structPointer) { - // Prepare addressable doubly-indirect placeholders for the key and value types. - // This is needed because the element-type encoders expect **T, but the map iteration produces T. - - keycopy = reflect.New(mapType.Key()).Elem() // addressable K - keyptr := reflect.New(reflect.PtrTo(keycopy.Type())).Elem() // addressable *K - keyptr.Set(keycopy.Addr()) // - keybase = toStructPointer(keyptr.Addr()) // **K - - // Value types are more varied and require special handling. - switch mapType.Elem().Kind() { - case reflect.Slice: - // []byte - var dummy []byte - valcopy = reflect.ValueOf(&dummy).Elem() // addressable []byte - valbase = toStructPointer(valcopy.Addr()) - case reflect.Ptr: - // message; the generated field type is map[K]*Msg (so V is *Msg), - // so we only need one level of indirection. - valcopy = reflect.New(mapType.Elem()).Elem() // addressable V - valbase = toStructPointer(valcopy.Addr()) - default: - // everything else - valcopy = reflect.New(mapType.Elem()).Elem() // addressable V - valptr := reflect.New(reflect.PtrTo(valcopy.Type())).Elem() // addressable *V - valptr.Set(valcopy.Addr()) // - valbase = toStructPointer(valptr.Addr()) // **V - } - return -} - -// Encode a struct. -func (o *Buffer) enc_struct(prop *StructProperties, base structPointer) error { - var state errorState - // Encode fields in tag order so that decoders may use optimizations - // that depend on the ordering. - // https://developers.google.com/protocol-buffers/docs/encoding#order - for _, i := range prop.order { - p := prop.Prop[i] - if p.enc != nil { - err := p.enc(o, p, base) - if err != nil { - if err == ErrNil { - if p.Required && state.err == nil { - state.err = &RequiredNotSetError{p.Name} - } - } else if err == errRepeatedHasNil { - // Give more context to nil values in repeated fields. - return errors.New("repeated field " + p.OrigName + " has nil element") - } else if !state.shouldContinue(err, p) { - return err - } - } - if len(o.buf) > maxMarshalSize { - return ErrTooLarge - } - } - } - - // Do oneof fields. - if prop.oneofMarshaler != nil { - m := structPointer_Interface(base, prop.stype).(Message) - if err := prop.oneofMarshaler(m, o); err == ErrNil { - return errOneofHasNil - } else if err != nil { - return err - } - } - - // Add unrecognized fields at the end. - if prop.unrecField.IsValid() { - v := *structPointer_Bytes(base, prop.unrecField) - if len(o.buf)+len(v) > maxMarshalSize { - return ErrTooLarge - } - if len(v) > 0 { - o.buf = append(o.buf, v...) - } - } - - return state.err -} - -func size_struct(prop *StructProperties, base structPointer) (n int) { - for _, i := range prop.order { - p := prop.Prop[i] - if p.size != nil { - n += p.size(p, base) - } - } - - // Add unrecognized fields at the end. - if prop.unrecField.IsValid() { - v := *structPointer_Bytes(base, prop.unrecField) - n += len(v) - } - - // Factor in any oneof fields. - if prop.oneofSizer != nil { - m := structPointer_Interface(base, prop.stype).(Message) - n += prop.oneofSizer(m) - } - - return -} - -var zeroes [20]byte // longer than any conceivable sizeVarint - -// Encode a struct, preceded by its encoded length (as a varint). -func (o *Buffer) enc_len_struct(prop *StructProperties, base structPointer, state *errorState) error { - return o.enc_len_thing(func() error { return o.enc_struct(prop, base) }, state) -} - -// Encode something, preceded by its encoded length (as a varint). -func (o *Buffer) enc_len_thing(enc func() error, state *errorState) error { - iLen := len(o.buf) - o.buf = append(o.buf, 0, 0, 0, 0) // reserve four bytes for length - iMsg := len(o.buf) - err := enc() - if err != nil && !state.shouldContinue(err, nil) { - return err - } - lMsg := len(o.buf) - iMsg - lLen := sizeVarint(uint64(lMsg)) - switch x := lLen - (iMsg - iLen); { - case x > 0: // actual length is x bytes larger than the space we reserved - // Move msg x bytes right. - o.buf = append(o.buf, zeroes[:x]...) - copy(o.buf[iMsg+x:], o.buf[iMsg:iMsg+lMsg]) - case x < 0: // actual length is x bytes smaller than the space we reserved - // Move msg x bytes left. - copy(o.buf[iMsg+x:], o.buf[iMsg:iMsg+lMsg]) - o.buf = o.buf[:len(o.buf)+x] // x is negative - } - // Encode the length in the reserved space. - o.buf = o.buf[:iLen] - o.EncodeVarint(uint64(lMsg)) - o.buf = o.buf[:len(o.buf)+lMsg] - return state.err -} - -// errorState maintains the first error that occurs and updates that error -// with additional context. -type errorState struct { - err error -} - -// shouldContinue reports whether encoding should continue upon encountering the -// given error. If the error is RequiredNotSetError, shouldContinue returns true -// and, if this is the first appearance of that error, remembers it for future -// reporting. -// -// If prop is not nil, it may update any error with additional context about the -// field with the error. -func (s *errorState) shouldContinue(err error, prop *Properties) bool { - // Ignore unset required fields. - reqNotSet, ok := err.(*RequiredNotSetError) - if !ok { - return false - } - if s.err == nil { - if prop != nil { - err = &RequiredNotSetError{prop.Name + "." + reqNotSet.field} - } - s.err = err - } - return true -} diff --git a/vendor/github.com/golang/protobuf/proto/equal.go b/vendor/github.com/golang/protobuf/proto/equal.go index 2ed1cf596..d4db5a1c1 100644 --- a/vendor/github.com/golang/protobuf/proto/equal.go +++ b/vendor/github.com/golang/protobuf/proto/equal.go @@ -109,15 +109,6 @@ func equalStruct(v1, v2 reflect.Value) bool { // set/unset mismatch return false } - b1, ok := f1.Interface().(raw) - if ok { - b2 := f2.Interface().(raw) - // RawMessage - if !bytes.Equal(b1.Bytes(), b2.Bytes()) { - return false - } - continue - } f1, f2 = f1.Elem(), f2.Elem() } if !equalAny(f1, f2, sprop.Prop[i]) { @@ -146,11 +137,7 @@ func equalStruct(v1, v2 reflect.Value) bool { u1 := uf.Bytes() u2 := v2.FieldByName("XXX_unrecognized").Bytes() - if !bytes.Equal(u1, u2) { - return false - } - - return true + return bytes.Equal(u1, u2) } // v1 and v2 are known to have the same type. @@ -261,6 +248,15 @@ func equalExtMap(base reflect.Type, em1, em2 map[int32]Extension) bool { m1, m2 := e1.value, e2.value + if m1 == nil && m2 == nil { + // Both have only encoded form. + if bytes.Equal(e1.enc, e2.enc) { + continue + } + // The bytes are different, but the extensions might still be + // equal. We need to decode them to compare. + } + if m1 != nil && m2 != nil { // Both are unencoded. if !equalAny(reflect.ValueOf(m1), reflect.ValueOf(m2), nil) { @@ -276,8 +272,12 @@ func equalExtMap(base reflect.Type, em1, em2 map[int32]Extension) bool { desc = m[extNum] } if desc == nil { + // If both have only encoded form and the bytes are the same, + // it is handled above. We get here when the bytes are different. + // We don't know how to decode it, so just compare them as byte + // slices. log.Printf("proto: don't know how to compare extension %d of %v", extNum, base) - continue + return false } var err error if m1 == nil { diff --git a/vendor/github.com/golang/protobuf/proto/extensions.go b/vendor/github.com/golang/protobuf/proto/extensions.go index eaad21831..816a3b9d6 100644 --- a/vendor/github.com/golang/protobuf/proto/extensions.go +++ b/vendor/github.com/golang/protobuf/proto/extensions.go @@ -38,6 +38,7 @@ package proto import ( "errors" "fmt" + "io" "reflect" "strconv" "sync" @@ -91,14 +92,29 @@ func (n notLocker) Unlock() {} // extendable returns the extendableProto interface for the given generated proto message. // If the proto message has the old extension format, it returns a wrapper that implements // the extendableProto interface. -func extendable(p interface{}) (extendableProto, bool) { - if ep, ok := p.(extendableProto); ok { - return ep, ok - } - if ep, ok := p.(extendableProtoV1); ok { - return extensionAdapter{ep}, ok +func extendable(p interface{}) (extendableProto, error) { + switch p := p.(type) { + case extendableProto: + if isNilPtr(p) { + return nil, fmt.Errorf("proto: nil %T is not extendable", p) + } + return p, nil + case extendableProtoV1: + if isNilPtr(p) { + return nil, fmt.Errorf("proto: nil %T is not extendable", p) + } + return extensionAdapter{p}, nil } - return nil, false + // Don't allocate a specific error containing %T: + // this is the hot path for Clone and MarshalText. + return nil, errNotExtendable +} + +var errNotExtendable = errors.New("proto: not an extendable proto.Message") + +func isNilPtr(x interface{}) bool { + v := reflect.ValueOf(x) + return v.Kind() == reflect.Ptr && v.IsNil() } // XXX_InternalExtensions is an internal representation of proto extensions. @@ -143,9 +159,6 @@ func (e *XXX_InternalExtensions) extensionsRead() (map[int32]Extension, sync.Loc return e.p.extensionMap, &e.p.mu } -var extendableProtoType = reflect.TypeOf((*extendableProto)(nil)).Elem() -var extendableProtoV1Type = reflect.TypeOf((*extendableProtoV1)(nil)).Elem() - // ExtensionDesc represents an extension specification. // Used in generated code from the protocol compiler. type ExtensionDesc struct { @@ -179,8 +192,8 @@ type Extension struct { // SetRawExtension is for testing only. func SetRawExtension(base Message, id int32, b []byte) { - epb, ok := extendable(base) - if !ok { + epb, err := extendable(base) + if err != nil { return } extmap := epb.extensionsWrite() @@ -205,7 +218,7 @@ func checkExtensionTypes(pb extendableProto, extension *ExtensionDesc) error { pbi = ea.extendableProtoV1 } if a, b := reflect.TypeOf(pbi), reflect.TypeOf(extension.ExtendedType); a != b { - return errors.New("proto: bad extended type; " + b.String() + " does not extend " + a.String()) + return fmt.Errorf("proto: bad extended type; %v does not extend %v", b, a) } // Check the range. if !isExtensionField(pb, extension.Field) { @@ -250,85 +263,11 @@ func extensionProperties(ed *ExtensionDesc) *Properties { return prop } -// encode encodes any unmarshaled (unencoded) extensions in e. -func encodeExtensions(e *XXX_InternalExtensions) error { - m, mu := e.extensionsRead() - if m == nil { - return nil // fast path - } - mu.Lock() - defer mu.Unlock() - return encodeExtensionsMap(m) -} - -// encode encodes any unmarshaled (unencoded) extensions in e. -func encodeExtensionsMap(m map[int32]Extension) error { - for k, e := range m { - if e.value == nil || e.desc == nil { - // Extension is only in its encoded form. - continue - } - - // We don't skip extensions that have an encoded form set, - // because the extension value may have been mutated after - // the last time this function was called. - - et := reflect.TypeOf(e.desc.ExtensionType) - props := extensionProperties(e.desc) - - p := NewBuffer(nil) - // If e.value has type T, the encoder expects a *struct{ X T }. - // Pass a *T with a zero field and hope it all works out. - x := reflect.New(et) - x.Elem().Set(reflect.ValueOf(e.value)) - if err := props.enc(p, props, toStructPointer(x)); err != nil { - return err - } - e.enc = p.buf - m[k] = e - } - return nil -} - -func extensionsSize(e *XXX_InternalExtensions) (n int) { - m, mu := e.extensionsRead() - if m == nil { - return 0 - } - mu.Lock() - defer mu.Unlock() - return extensionsMapSize(m) -} - -func extensionsMapSize(m map[int32]Extension) (n int) { - for _, e := range m { - if e.value == nil || e.desc == nil { - // Extension is only in its encoded form. - n += len(e.enc) - continue - } - - // We don't skip extensions that have an encoded form set, - // because the extension value may have been mutated after - // the last time this function was called. - - et := reflect.TypeOf(e.desc.ExtensionType) - props := extensionProperties(e.desc) - - // If e.value has type T, the encoder expects a *struct{ X T }. - // Pass a *T with a zero field and hope it all works out. - x := reflect.New(et) - x.Elem().Set(reflect.ValueOf(e.value)) - n += props.size(props, toStructPointer(x)) - } - return -} - // HasExtension returns whether the given extension is present in pb. func HasExtension(pb Message, extension *ExtensionDesc) bool { // TODO: Check types, field numbers, etc.? - epb, ok := extendable(pb) - if !ok { + epb, err := extendable(pb) + if err != nil { return false } extmap, mu := epb.extensionsRead() @@ -336,15 +275,15 @@ func HasExtension(pb Message, extension *ExtensionDesc) bool { return false } mu.Lock() - _, ok = extmap[extension.Field] + _, ok := extmap[extension.Field] mu.Unlock() return ok } // ClearExtension removes the given extension from pb. func ClearExtension(pb Message, extension *ExtensionDesc) { - epb, ok := extendable(pb) - if !ok { + epb, err := extendable(pb) + if err != nil { return } // TODO: Check types, field numbers, etc.? @@ -352,16 +291,26 @@ func ClearExtension(pb Message, extension *ExtensionDesc) { delete(extmap, extension.Field) } -// GetExtension parses and returns the given extension of pb. -// If the extension is not present and has no default value it returns ErrMissingExtension. +// GetExtension retrieves a proto2 extended field from pb. +// +// If the descriptor is type complete (i.e., ExtensionDesc.ExtensionType is non-nil), +// then GetExtension parses the encoded field and returns a Go value of the specified type. +// If the field is not present, then the default value is returned (if one is specified), +// otherwise ErrMissingExtension is reported. +// +// If the descriptor is not type complete (i.e., ExtensionDesc.ExtensionType is nil), +// then GetExtension returns the raw encoded bytes of the field extension. func GetExtension(pb Message, extension *ExtensionDesc) (interface{}, error) { - epb, ok := extendable(pb) - if !ok { - return nil, errors.New("proto: not an extendable proto") + epb, err := extendable(pb) + if err != nil { + return nil, err } - if err := checkExtensionTypes(epb, extension); err != nil { - return nil, err + if extension.ExtendedType != nil { + // can only check type if this is a complete descriptor + if err := checkExtensionTypes(epb, extension); err != nil { + return nil, err + } } emap, mu := epb.extensionsRead() @@ -388,6 +337,11 @@ func GetExtension(pb Message, extension *ExtensionDesc) (interface{}, error) { return e.value, nil } + if extension.ExtensionType == nil { + // incomplete descriptor + return e.enc, nil + } + v, err := decodeExtension(e.enc, extension) if err != nil { return nil, err @@ -405,6 +359,11 @@ func GetExtension(pb Message, extension *ExtensionDesc) (interface{}, error) { // defaultExtensionValue returns the default value for extension. // If no default for an extension is defined ErrMissingExtension is returned. func defaultExtensionValue(extension *ExtensionDesc) (interface{}, error) { + if extension.ExtensionType == nil { + // incomplete descriptor, so no default + return nil, ErrMissingExtension + } + t := reflect.TypeOf(extension.ExtensionType) props := extensionProperties(extension) @@ -439,31 +398,28 @@ func defaultExtensionValue(extension *ExtensionDesc) (interface{}, error) { // decodeExtension decodes an extension encoded in b. func decodeExtension(b []byte, extension *ExtensionDesc) (interface{}, error) { - o := NewBuffer(b) - t := reflect.TypeOf(extension.ExtensionType) - - props := extensionProperties(extension) + unmarshal := typeUnmarshaler(t, extension.Tag) // t is a pointer to a struct, pointer to basic type or a slice. - // Allocate a "field" to store the pointer/slice itself; the - // pointer/slice will be stored here. We pass - // the address of this field to props.dec. - // This passes a zero field and a *t and lets props.dec - // interpret it as a *struct{ x t }. + // Allocate space to store the pointer/slice. value := reflect.New(t).Elem() + var err error for { - // Discard wire type and field number varint. It isn't needed. - if _, err := o.DecodeVarint(); err != nil { - return nil, err + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF } + b = b[n:] + wire := int(x) & 7 - if err := props.dec(o, props, toStructPointer(value.Addr())); err != nil { + b, err = unmarshal(b, valToPointer(value.Addr()), wire) + if err != nil { return nil, err } - if o.index >= len(o.buf) { + if len(b) == 0 { break } } @@ -473,9 +429,9 @@ func decodeExtension(b []byte, extension *ExtensionDesc) (interface{}, error) { // GetExtensions returns a slice of the extensions present in pb that are also listed in es. // The returned slice has the same length as es; missing extensions will appear as nil elements. func GetExtensions(pb Message, es []*ExtensionDesc) (extensions []interface{}, err error) { - epb, ok := extendable(pb) - if !ok { - return nil, errors.New("proto: not an extendable proto") + epb, err := extendable(pb) + if err != nil { + return nil, err } extensions = make([]interface{}, len(es)) for i, e := range es { @@ -494,9 +450,9 @@ func GetExtensions(pb Message, es []*ExtensionDesc) (extensions []interface{}, e // For non-registered extensions, ExtensionDescs returns an incomplete descriptor containing // just the Field field, which defines the extension's field number. func ExtensionDescs(pb Message) ([]*ExtensionDesc, error) { - epb, ok := extendable(pb) - if !ok { - return nil, fmt.Errorf("proto: %T is not an extendable proto.Message", pb) + epb, err := extendable(pb) + if err != nil { + return nil, err } registeredExtensions := RegisteredExtensions(pb) @@ -523,9 +479,9 @@ func ExtensionDescs(pb Message) ([]*ExtensionDesc, error) { // SetExtension sets the specified extension of pb to the specified value. func SetExtension(pb Message, extension *ExtensionDesc, value interface{}) error { - epb, ok := extendable(pb) - if !ok { - return errors.New("proto: not an extendable proto") + epb, err := extendable(pb) + if err != nil { + return err } if err := checkExtensionTypes(epb, extension); err != nil { return err @@ -550,8 +506,8 @@ func SetExtension(pb Message, extension *ExtensionDesc, value interface{}) error // ClearAllExtensions clears all extensions from pb. func ClearAllExtensions(pb Message) { - epb, ok := extendable(pb) - if !ok { + epb, err := extendable(pb) + if err != nil { return } m := epb.extensionsWrite() diff --git a/vendor/github.com/golang/protobuf/proto/lib.go b/vendor/github.com/golang/protobuf/proto/lib.go index 1c225504a..0e2191b8a 100644 --- a/vendor/github.com/golang/protobuf/proto/lib.go +++ b/vendor/github.com/golang/protobuf/proto/lib.go @@ -265,6 +265,7 @@ package proto import ( "encoding/json" + "errors" "fmt" "log" "reflect" @@ -273,6 +274,8 @@ import ( "sync" ) +var errInvalidUTF8 = errors.New("proto: invalid UTF-8 string") + // Message is implemented by generated protocol buffer messages. type Message interface { Reset() @@ -309,16 +312,7 @@ type Buffer struct { buf []byte // encode/decode byte stream index int // read point - // pools of basic types to amortize allocation. - bools []bool - uint32s []uint32 - uint64s []uint64 - - // extra pools, only used with pointer_reflect.go - int32s []int32 - int64s []int64 - float32s []float32 - float64s []float64 + deterministic bool } // NewBuffer allocates a new Buffer and initializes its internal data to @@ -343,6 +337,30 @@ func (p *Buffer) SetBuf(s []byte) { // Bytes returns the contents of the Buffer. func (p *Buffer) Bytes() []byte { return p.buf } +// SetDeterministic sets whether to use deterministic serialization. +// +// Deterministic serialization guarantees that for a given binary, equal +// messages will always be serialized to the same bytes. This implies: +// +// - Repeated serialization of a message will return the same bytes. +// - Different processes of the same binary (which may be executing on +// different machines) will serialize equal messages to the same bytes. +// +// Note that the deterministic serialization is NOT canonical across +// languages. It is not guaranteed to remain stable over time. It is unstable +// across different builds with schema changes due to unknown fields. +// Users who need canonical serialization (e.g., persistent storage in a +// canonical form, fingerprinting, etc.) should define their own +// canonicalization specification and implement their own serializer rather +// than relying on this API. +// +// If deterministic serialization is requested, map entries will be sorted +// by keys in lexographical order. This is an implementation detail and +// subject to change. +func (p *Buffer) SetDeterministic(deterministic bool) { + p.deterministic = deterministic +} + /* * Helper routines for simplifying the creation of optional fields of basic type. */ @@ -831,22 +849,12 @@ func fieldDefault(ft reflect.Type, prop *Properties) (sf *scalarField, nestedMes return sf, false, nil } +// mapKeys returns a sort.Interface to be used for sorting the map keys. // Map fields may have key types of non-float scalars, strings and enums. -// The easiest way to sort them in some deterministic order is to use fmt. -// If this turns out to be inefficient we can always consider other options, -// such as doing a Schwartzian transform. - func mapKeys(vs []reflect.Value) sort.Interface { - s := mapKeySorter{ - vs: vs, - // default Less function: textual comparison - less: func(a, b reflect.Value) bool { - return fmt.Sprint(a.Interface()) < fmt.Sprint(b.Interface()) - }, - } + s := mapKeySorter{vs: vs} - // Type specialization per https://developers.google.com/protocol-buffers/docs/proto#maps; - // numeric keys are sorted numerically. + // Type specialization per https://developers.google.com/protocol-buffers/docs/proto#maps. if len(vs) == 0 { return s } @@ -855,6 +863,12 @@ func mapKeys(vs []reflect.Value) sort.Interface { s.less = func(a, b reflect.Value) bool { return a.Int() < b.Int() } case reflect.Uint32, reflect.Uint64: s.less = func(a, b reflect.Value) bool { return a.Uint() < b.Uint() } + case reflect.Bool: + s.less = func(a, b reflect.Value) bool { return !a.Bool() && b.Bool() } // false < true + case reflect.String: + s.less = func(a, b reflect.Value) bool { return a.String() < b.String() } + default: + panic(fmt.Sprintf("unsupported map key type: %v", vs[0].Kind())) } return s @@ -895,3 +909,13 @@ const ProtoPackageIsVersion2 = true // ProtoPackageIsVersion1 is referenced from generated protocol buffer files // to assert that that code is compatible with this version of the proto package. const ProtoPackageIsVersion1 = true + +// InternalMessageInfo is a type used internally by generated .pb.go files. +// This type is not intended to be used by non-generated code. +// This type is not subject to any compatibility guarantee. +type InternalMessageInfo struct { + marshal *marshalInfo + unmarshal *unmarshalInfo + merge *mergeInfo + discard *discardInfo +} diff --git a/vendor/github.com/golang/protobuf/proto/message_set.go b/vendor/github.com/golang/protobuf/proto/message_set.go index fd982decd..3b6ca41d5 100644 --- a/vendor/github.com/golang/protobuf/proto/message_set.go +++ b/vendor/github.com/golang/protobuf/proto/message_set.go @@ -42,6 +42,7 @@ import ( "fmt" "reflect" "sort" + "sync" ) // errNoMessageTypeID occurs when a protocol buffer does not have a message type ID. @@ -94,10 +95,7 @@ func (ms *messageSet) find(pb Message) *_MessageSet_Item { } func (ms *messageSet) Has(pb Message) bool { - if ms.find(pb) != nil { - return true - } - return false + return ms.find(pb) != nil } func (ms *messageSet) Unmarshal(pb Message) error { @@ -150,46 +148,42 @@ func skipVarint(buf []byte) []byte { // MarshalMessageSet encodes the extension map represented by m in the message set wire format. // It is called by generated Marshal methods on protocol buffer messages with the message_set_wire_format option. func MarshalMessageSet(exts interface{}) ([]byte, error) { - var m map[int32]Extension + return marshalMessageSet(exts, false) +} + +// marshaMessageSet implements above function, with the opt to turn on / off deterministic during Marshal. +func marshalMessageSet(exts interface{}, deterministic bool) ([]byte, error) { switch exts := exts.(type) { case *XXX_InternalExtensions: - if err := encodeExtensions(exts); err != nil { - return nil, err - } - m, _ = exts.extensionsRead() + var u marshalInfo + siz := u.sizeMessageSet(exts) + b := make([]byte, 0, siz) + return u.appendMessageSet(b, exts, deterministic) + case map[int32]Extension: - if err := encodeExtensionsMap(exts); err != nil { - return nil, err + // This is an old-style extension map. + // Wrap it in a new-style XXX_InternalExtensions. + ie := XXX_InternalExtensions{ + p: &struct { + mu sync.Mutex + extensionMap map[int32]Extension + }{ + extensionMap: exts, + }, } - m = exts + + var u marshalInfo + siz := u.sizeMessageSet(&ie) + b := make([]byte, 0, siz) + return u.appendMessageSet(b, &ie, deterministic) + default: return nil, errors.New("proto: not an extension map") } - - // Sort extension IDs to provide a deterministic encoding. - // See also enc_map in encode.go. - ids := make([]int, 0, len(m)) - for id := range m { - ids = append(ids, int(id)) - } - sort.Ints(ids) - - ms := &messageSet{Item: make([]*_MessageSet_Item, 0, len(m))} - for _, id := range ids { - e := m[int32(id)] - // Remove the wire type and field number varint, as well as the length varint. - msg := skipVarint(skipVarint(e.enc)) - - ms.Item = append(ms.Item, &_MessageSet_Item{ - TypeId: Int32(int32(id)), - Message: msg, - }) - } - return Marshal(ms) } // UnmarshalMessageSet decodes the extension map encoded in buf in the message set wire format. -// It is called by generated Unmarshal methods on protocol buffer messages with the message_set_wire_format option. +// It is called by Unmarshal methods on protocol buffer messages with the message_set_wire_format option. func UnmarshalMessageSet(buf []byte, exts interface{}) error { var m map[int32]Extension switch exts := exts.(type) { @@ -235,7 +229,15 @@ func MarshalMessageSetJSON(exts interface{}) ([]byte, error) { var m map[int32]Extension switch exts := exts.(type) { case *XXX_InternalExtensions: - m, _ = exts.extensionsRead() + var mu sync.Locker + m, mu = exts.extensionsRead() + if m != nil { + // Keep the extensions map locked until we're done marshaling to prevent + // races between marshaling and unmarshaling the lazily-{en,de}coded + // values. + mu.Lock() + defer mu.Unlock() + } case map[int32]Extension: m = exts default: @@ -253,15 +255,16 @@ func MarshalMessageSetJSON(exts interface{}) ([]byte, error) { for i, id := range ids { ext := m[id] - if i > 0 { - b.WriteByte(',') - } - msd, ok := messageSetMap[id] if !ok { // Unknown type; we can't render it, so skip it. continue } + + if i > 0 && b.Len() > 1 { + b.WriteByte(',') + } + fmt.Fprintf(&b, `"[%s]":`, msd.name) x := ext.value diff --git a/vendor/github.com/golang/protobuf/proto/pointer_reflect.go b/vendor/github.com/golang/protobuf/proto/pointer_reflect.go index fb512e2e1..b6cad9083 100644 --- a/vendor/github.com/golang/protobuf/proto/pointer_reflect.go +++ b/vendor/github.com/golang/protobuf/proto/pointer_reflect.go @@ -29,7 +29,7 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// +build appengine js +// +build purego appengine js // This file contains an implementation of proto field accesses using package reflect. // It is slower than the code in pointer_unsafe.go but it avoids package unsafe and can @@ -38,32 +38,13 @@ package proto import ( - "math" "reflect" + "sync" ) -// A structPointer is a pointer to a struct. -type structPointer struct { - v reflect.Value -} - -// toStructPointer returns a structPointer equivalent to the given reflect value. -// The reflect value must itself be a pointer to a struct. -func toStructPointer(v reflect.Value) structPointer { - return structPointer{v} -} - -// IsNil reports whether p is nil. -func structPointer_IsNil(p structPointer) bool { - return p.v.IsNil() -} +const unsafeAllowed = false -// Interface returns the struct pointer as an interface value. -func structPointer_Interface(p structPointer, _ reflect.Type) interface{} { - return p.v.Interface() -} - -// A field identifies a field in a struct, accessible from a structPointer. +// A field identifies a field in a struct, accessible from a pointer. // In this implementation, a field is identified by the sequence of field indices // passed to reflect's FieldByIndex. type field []int @@ -76,409 +57,301 @@ func toField(f *reflect.StructField) field { // invalidField is an invalid field identifier. var invalidField = field(nil) +// zeroField is a noop when calling pointer.offset. +var zeroField = field([]int{}) + // IsValid reports whether the field identifier is valid. func (f field) IsValid() bool { return f != nil } -// field returns the given field in the struct as a reflect value. -func structPointer_field(p structPointer, f field) reflect.Value { - // Special case: an extension map entry with a value of type T - // passes a *T to the struct-handling code with a zero field, - // expecting that it will be treated as equivalent to *struct{ X T }, - // which has the same memory layout. We have to handle that case - // specially, because reflect will panic if we call FieldByIndex on a - // non-struct. - if f == nil { - return p.v.Elem() - } - - return p.v.Elem().FieldByIndex(f) +// The pointer type is for the table-driven decoder. +// The implementation here uses a reflect.Value of pointer type to +// create a generic pointer. In pointer_unsafe.go we use unsafe +// instead of reflect to implement the same (but faster) interface. +type pointer struct { + v reflect.Value } -// ifield returns the given field in the struct as an interface value. -func structPointer_ifield(p structPointer, f field) interface{} { - return structPointer_field(p, f).Addr().Interface() +// toPointer converts an interface of pointer type to a pointer +// that points to the same target. +func toPointer(i *Message) pointer { + return pointer{v: reflect.ValueOf(*i)} } -// Bytes returns the address of a []byte field in the struct. -func structPointer_Bytes(p structPointer, f field) *[]byte { - return structPointer_ifield(p, f).(*[]byte) +// toAddrPointer converts an interface to a pointer that points to +// the interface data. +func toAddrPointer(i *interface{}, isptr bool) pointer { + v := reflect.ValueOf(*i) + u := reflect.New(v.Type()) + u.Elem().Set(v) + return pointer{v: u} } -// BytesSlice returns the address of a [][]byte field in the struct. -func structPointer_BytesSlice(p structPointer, f field) *[][]byte { - return structPointer_ifield(p, f).(*[][]byte) +// valToPointer converts v to a pointer. v must be of pointer type. +func valToPointer(v reflect.Value) pointer { + return pointer{v: v} } -// Bool returns the address of a *bool field in the struct. -func structPointer_Bool(p structPointer, f field) **bool { - return structPointer_ifield(p, f).(**bool) +// offset converts from a pointer to a structure to a pointer to +// one of its fields. +func (p pointer) offset(f field) pointer { + return pointer{v: p.v.Elem().FieldByIndex(f).Addr()} } -// BoolVal returns the address of a bool field in the struct. -func structPointer_BoolVal(p structPointer, f field) *bool { - return structPointer_ifield(p, f).(*bool) +func (p pointer) isNil() bool { + return p.v.IsNil() } -// BoolSlice returns the address of a []bool field in the struct. -func structPointer_BoolSlice(p structPointer, f field) *[]bool { - return structPointer_ifield(p, f).(*[]bool) +// grow updates the slice s in place to make it one element longer. +// s must be addressable. +// Returns the (addressable) new element. +func grow(s reflect.Value) reflect.Value { + n, m := s.Len(), s.Cap() + if n < m { + s.SetLen(n + 1) + } else { + s.Set(reflect.Append(s, reflect.Zero(s.Type().Elem()))) + } + return s.Index(n) } -// String returns the address of a *string field in the struct. -func structPointer_String(p structPointer, f field) **string { - return structPointer_ifield(p, f).(**string) +func (p pointer) toInt64() *int64 { + return p.v.Interface().(*int64) } - -// StringVal returns the address of a string field in the struct. -func structPointer_StringVal(p structPointer, f field) *string { - return structPointer_ifield(p, f).(*string) +func (p pointer) toInt64Ptr() **int64 { + return p.v.Interface().(**int64) } - -// StringSlice returns the address of a []string field in the struct. -func structPointer_StringSlice(p structPointer, f field) *[]string { - return structPointer_ifield(p, f).(*[]string) +func (p pointer) toInt64Slice() *[]int64 { + return p.v.Interface().(*[]int64) } -// Extensions returns the address of an extension map field in the struct. -func structPointer_Extensions(p structPointer, f field) *XXX_InternalExtensions { - return structPointer_ifield(p, f).(*XXX_InternalExtensions) -} +var int32ptr = reflect.TypeOf((*int32)(nil)) -// ExtMap returns the address of an extension map field in the struct. -func structPointer_ExtMap(p structPointer, f field) *map[int32]Extension { - return structPointer_ifield(p, f).(*map[int32]Extension) +func (p pointer) toInt32() *int32 { + return p.v.Convert(int32ptr).Interface().(*int32) } -// NewAt returns the reflect.Value for a pointer to a field in the struct. -func structPointer_NewAt(p structPointer, f field, typ reflect.Type) reflect.Value { - return structPointer_field(p, f).Addr() +// The toInt32Ptr/Slice methods don't work because of enums. +// Instead, we must use set/get methods for the int32ptr/slice case. +/* + func (p pointer) toInt32Ptr() **int32 { + return p.v.Interface().(**int32) } - -// SetStructPointer writes a *struct field in the struct. -func structPointer_SetStructPointer(p structPointer, f field, q structPointer) { - structPointer_field(p, f).Set(q.v) + func (p pointer) toInt32Slice() *[]int32 { + return p.v.Interface().(*[]int32) } - -// GetStructPointer reads a *struct field in the struct. -func structPointer_GetStructPointer(p structPointer, f field) structPointer { - return structPointer{structPointer_field(p, f)} +*/ +func (p pointer) getInt32Ptr() *int32 { + if p.v.Type().Elem().Elem() == reflect.TypeOf(int32(0)) { + // raw int32 type + return p.v.Elem().Interface().(*int32) + } + // an enum + return p.v.Elem().Convert(int32PtrType).Interface().(*int32) +} +func (p pointer) setInt32Ptr(v int32) { + // Allocate value in a *int32. Possibly convert that to a *enum. + // Then assign it to a **int32 or **enum. + // Note: we can convert *int32 to *enum, but we can't convert + // **int32 to **enum! + p.v.Elem().Set(reflect.ValueOf(&v).Convert(p.v.Type().Elem())) +} + +// getInt32Slice copies []int32 from p as a new slice. +// This behavior differs from the implementation in pointer_unsafe.go. +func (p pointer) getInt32Slice() []int32 { + if p.v.Type().Elem().Elem() == reflect.TypeOf(int32(0)) { + // raw int32 type + return p.v.Elem().Interface().([]int32) + } + // an enum + // Allocate a []int32, then assign []enum's values into it. + // Note: we can't convert []enum to []int32. + slice := p.v.Elem() + s := make([]int32, slice.Len()) + for i := 0; i < slice.Len(); i++ { + s[i] = int32(slice.Index(i).Int()) + } + return s } -// StructPointerSlice the address of a []*struct field in the struct. -func structPointer_StructPointerSlice(p structPointer, f field) structPointerSlice { - return structPointerSlice{structPointer_field(p, f)} +// setInt32Slice copies []int32 into p as a new slice. +// This behavior differs from the implementation in pointer_unsafe.go. +func (p pointer) setInt32Slice(v []int32) { + if p.v.Type().Elem().Elem() == reflect.TypeOf(int32(0)) { + // raw int32 type + p.v.Elem().Set(reflect.ValueOf(v)) + return + } + // an enum + // Allocate a []enum, then assign []int32's values into it. + // Note: we can't convert []enum to []int32. + slice := reflect.MakeSlice(p.v.Type().Elem(), len(v), cap(v)) + for i, x := range v { + slice.Index(i).SetInt(int64(x)) + } + p.v.Elem().Set(slice) } - -// A structPointerSlice represents the address of a slice of pointers to structs -// (themselves messages or groups). That is, v.Type() is *[]*struct{...}. -type structPointerSlice struct { - v reflect.Value +func (p pointer) appendInt32Slice(v int32) { + grow(p.v.Elem()).SetInt(int64(v)) } -func (p structPointerSlice) Len() int { return p.v.Len() } -func (p structPointerSlice) Index(i int) structPointer { return structPointer{p.v.Index(i)} } -func (p structPointerSlice) Append(q structPointer) { - p.v.Set(reflect.Append(p.v, q.v)) +func (p pointer) toUint64() *uint64 { + return p.v.Interface().(*uint64) } - -var ( - int32Type = reflect.TypeOf(int32(0)) - uint32Type = reflect.TypeOf(uint32(0)) - float32Type = reflect.TypeOf(float32(0)) - int64Type = reflect.TypeOf(int64(0)) - uint64Type = reflect.TypeOf(uint64(0)) - float64Type = reflect.TypeOf(float64(0)) -) - -// A word32 represents a field of type *int32, *uint32, *float32, or *enum. -// That is, v.Type() is *int32, *uint32, *float32, or *enum and v is assignable. -type word32 struct { - v reflect.Value +func (p pointer) toUint64Ptr() **uint64 { + return p.v.Interface().(**uint64) } - -// IsNil reports whether p is nil. -func word32_IsNil(p word32) bool { - return p.v.IsNil() +func (p pointer) toUint64Slice() *[]uint64 { + return p.v.Interface().(*[]uint64) } - -// Set sets p to point at a newly allocated word with bits set to x. -func word32_Set(p word32, o *Buffer, x uint32) { - t := p.v.Type().Elem() - switch t { - case int32Type: - if len(o.int32s) == 0 { - o.int32s = make([]int32, uint32PoolSize) - } - o.int32s[0] = int32(x) - p.v.Set(reflect.ValueOf(&o.int32s[0])) - o.int32s = o.int32s[1:] - return - case uint32Type: - if len(o.uint32s) == 0 { - o.uint32s = make([]uint32, uint32PoolSize) - } - o.uint32s[0] = x - p.v.Set(reflect.ValueOf(&o.uint32s[0])) - o.uint32s = o.uint32s[1:] - return - case float32Type: - if len(o.float32s) == 0 { - o.float32s = make([]float32, uint32PoolSize) - } - o.float32s[0] = math.Float32frombits(x) - p.v.Set(reflect.ValueOf(&o.float32s[0])) - o.float32s = o.float32s[1:] - return - } - - // must be enum - p.v.Set(reflect.New(t)) - p.v.Elem().SetInt(int64(int32(x))) +func (p pointer) toUint32() *uint32 { + return p.v.Interface().(*uint32) } - -// Get gets the bits pointed at by p, as a uint32. -func word32_Get(p word32) uint32 { - elem := p.v.Elem() - switch elem.Kind() { - case reflect.Int32: - return uint32(elem.Int()) - case reflect.Uint32: - return uint32(elem.Uint()) - case reflect.Float32: - return math.Float32bits(float32(elem.Float())) - } - panic("unreachable") +func (p pointer) toUint32Ptr() **uint32 { + return p.v.Interface().(**uint32) } - -// Word32 returns a reference to a *int32, *uint32, *float32, or *enum field in the struct. -func structPointer_Word32(p structPointer, f field) word32 { - return word32{structPointer_field(p, f)} +func (p pointer) toUint32Slice() *[]uint32 { + return p.v.Interface().(*[]uint32) } - -// A word32Val represents a field of type int32, uint32, float32, or enum. -// That is, v.Type() is int32, uint32, float32, or enum and v is assignable. -type word32Val struct { - v reflect.Value +func (p pointer) toBool() *bool { + return p.v.Interface().(*bool) } - -// Set sets *p to x. -func word32Val_Set(p word32Val, x uint32) { - switch p.v.Type() { - case int32Type: - p.v.SetInt(int64(x)) - return - case uint32Type: - p.v.SetUint(uint64(x)) - return - case float32Type: - p.v.SetFloat(float64(math.Float32frombits(x))) - return - } - - // must be enum - p.v.SetInt(int64(int32(x))) +func (p pointer) toBoolPtr() **bool { + return p.v.Interface().(**bool) } - -// Get gets the bits pointed at by p, as a uint32. -func word32Val_Get(p word32Val) uint32 { - elem := p.v - switch elem.Kind() { - case reflect.Int32: - return uint32(elem.Int()) - case reflect.Uint32: - return uint32(elem.Uint()) - case reflect.Float32: - return math.Float32bits(float32(elem.Float())) - } - panic("unreachable") +func (p pointer) toBoolSlice() *[]bool { + return p.v.Interface().(*[]bool) } - -// Word32Val returns a reference to a int32, uint32, float32, or enum field in the struct. -func structPointer_Word32Val(p structPointer, f field) word32Val { - return word32Val{structPointer_field(p, f)} +func (p pointer) toFloat64() *float64 { + return p.v.Interface().(*float64) } - -// A word32Slice is a slice of 32-bit values. -// That is, v.Type() is []int32, []uint32, []float32, or []enum. -type word32Slice struct { - v reflect.Value +func (p pointer) toFloat64Ptr() **float64 { + return p.v.Interface().(**float64) } - -func (p word32Slice) Append(x uint32) { - n, m := p.v.Len(), p.v.Cap() - if n < m { - p.v.SetLen(n + 1) - } else { - t := p.v.Type().Elem() - p.v.Set(reflect.Append(p.v, reflect.Zero(t))) - } - elem := p.v.Index(n) - switch elem.Kind() { - case reflect.Int32: - elem.SetInt(int64(int32(x))) - case reflect.Uint32: - elem.SetUint(uint64(x)) - case reflect.Float32: - elem.SetFloat(float64(math.Float32frombits(x))) - } +func (p pointer) toFloat64Slice() *[]float64 { + return p.v.Interface().(*[]float64) } - -func (p word32Slice) Len() int { - return p.v.Len() +func (p pointer) toFloat32() *float32 { + return p.v.Interface().(*float32) } - -func (p word32Slice) Index(i int) uint32 { - elem := p.v.Index(i) - switch elem.Kind() { - case reflect.Int32: - return uint32(elem.Int()) - case reflect.Uint32: - return uint32(elem.Uint()) - case reflect.Float32: - return math.Float32bits(float32(elem.Float())) - } - panic("unreachable") +func (p pointer) toFloat32Ptr() **float32 { + return p.v.Interface().(**float32) } - -// Word32Slice returns a reference to a []int32, []uint32, []float32, or []enum field in the struct. -func structPointer_Word32Slice(p structPointer, f field) word32Slice { - return word32Slice{structPointer_field(p, f)} +func (p pointer) toFloat32Slice() *[]float32 { + return p.v.Interface().(*[]float32) } - -// word64 is like word32 but for 64-bit values. -type word64 struct { - v reflect.Value +func (p pointer) toString() *string { + return p.v.Interface().(*string) } - -func word64_Set(p word64, o *Buffer, x uint64) { - t := p.v.Type().Elem() - switch t { - case int64Type: - if len(o.int64s) == 0 { - o.int64s = make([]int64, uint64PoolSize) - } - o.int64s[0] = int64(x) - p.v.Set(reflect.ValueOf(&o.int64s[0])) - o.int64s = o.int64s[1:] - return - case uint64Type: - if len(o.uint64s) == 0 { - o.uint64s = make([]uint64, uint64PoolSize) - } - o.uint64s[0] = x - p.v.Set(reflect.ValueOf(&o.uint64s[0])) - o.uint64s = o.uint64s[1:] - return - case float64Type: - if len(o.float64s) == 0 { - o.float64s = make([]float64, uint64PoolSize) - } - o.float64s[0] = math.Float64frombits(x) - p.v.Set(reflect.ValueOf(&o.float64s[0])) - o.float64s = o.float64s[1:] - return - } - panic("unreachable") +func (p pointer) toStringPtr() **string { + return p.v.Interface().(**string) } - -func word64_IsNil(p word64) bool { - return p.v.IsNil() +func (p pointer) toStringSlice() *[]string { + return p.v.Interface().(*[]string) } - -func word64_Get(p word64) uint64 { - elem := p.v.Elem() - switch elem.Kind() { - case reflect.Int64: - return uint64(elem.Int()) - case reflect.Uint64: - return elem.Uint() - case reflect.Float64: - return math.Float64bits(elem.Float()) - } - panic("unreachable") +func (p pointer) toBytes() *[]byte { + return p.v.Interface().(*[]byte) } - -func structPointer_Word64(p structPointer, f field) word64 { - return word64{structPointer_field(p, f)} +func (p pointer) toBytesSlice() *[][]byte { + return p.v.Interface().(*[][]byte) +} +func (p pointer) toExtensions() *XXX_InternalExtensions { + return p.v.Interface().(*XXX_InternalExtensions) +} +func (p pointer) toOldExtensions() *map[int32]Extension { + return p.v.Interface().(*map[int32]Extension) +} +func (p pointer) getPointer() pointer { + return pointer{v: p.v.Elem()} +} +func (p pointer) setPointer(q pointer) { + p.v.Elem().Set(q.v) +} +func (p pointer) appendPointer(q pointer) { + grow(p.v.Elem()).Set(q.v) } -// word64Val is like word32Val but for 64-bit values. -type word64Val struct { - v reflect.Value +// getPointerSlice copies []*T from p as a new []pointer. +// This behavior differs from the implementation in pointer_unsafe.go. +func (p pointer) getPointerSlice() []pointer { + if p.v.IsNil() { + return nil + } + n := p.v.Elem().Len() + s := make([]pointer, n) + for i := 0; i < n; i++ { + s[i] = pointer{v: p.v.Elem().Index(i)} + } + return s } -func word64Val_Set(p word64Val, o *Buffer, x uint64) { - switch p.v.Type() { - case int64Type: - p.v.SetInt(int64(x)) - return - case uint64Type: - p.v.SetUint(x) - return - case float64Type: - p.v.SetFloat(math.Float64frombits(x)) +// setPointerSlice copies []pointer into p as a new []*T. +// This behavior differs from the implementation in pointer_unsafe.go. +func (p pointer) setPointerSlice(v []pointer) { + if v == nil { + p.v.Elem().Set(reflect.New(p.v.Elem().Type()).Elem()) return } - panic("unreachable") + s := reflect.MakeSlice(p.v.Elem().Type(), 0, len(v)) + for _, p := range v { + s = reflect.Append(s, p.v) + } + p.v.Elem().Set(s) } -func word64Val_Get(p word64Val) uint64 { - elem := p.v - switch elem.Kind() { - case reflect.Int64: - return uint64(elem.Int()) - case reflect.Uint64: - return elem.Uint() - case reflect.Float64: - return math.Float64bits(elem.Float()) +// getInterfacePointer returns a pointer that points to the +// interface data of the interface pointed by p. +func (p pointer) getInterfacePointer() pointer { + if p.v.Elem().IsNil() { + return pointer{v: p.v.Elem()} } - panic("unreachable") + return pointer{v: p.v.Elem().Elem().Elem().Field(0).Addr()} // *interface -> interface -> *struct -> struct } -func structPointer_Word64Val(p structPointer, f field) word64Val { - return word64Val{structPointer_field(p, f)} +func (p pointer) asPointerTo(t reflect.Type) reflect.Value { + // TODO: check that p.v.Type().Elem() == t? + return p.v } -type word64Slice struct { - v reflect.Value +func atomicLoadUnmarshalInfo(p **unmarshalInfo) *unmarshalInfo { + atomicLock.Lock() + defer atomicLock.Unlock() + return *p } - -func (p word64Slice) Append(x uint64) { - n, m := p.v.Len(), p.v.Cap() - if n < m { - p.v.SetLen(n + 1) - } else { - t := p.v.Type().Elem() - p.v.Set(reflect.Append(p.v, reflect.Zero(t))) - } - elem := p.v.Index(n) - switch elem.Kind() { - case reflect.Int64: - elem.SetInt(int64(int64(x))) - case reflect.Uint64: - elem.SetUint(uint64(x)) - case reflect.Float64: - elem.SetFloat(float64(math.Float64frombits(x))) - } +func atomicStoreUnmarshalInfo(p **unmarshalInfo, v *unmarshalInfo) { + atomicLock.Lock() + defer atomicLock.Unlock() + *p = v } - -func (p word64Slice) Len() int { - return p.v.Len() +func atomicLoadMarshalInfo(p **marshalInfo) *marshalInfo { + atomicLock.Lock() + defer atomicLock.Unlock() + return *p } - -func (p word64Slice) Index(i int) uint64 { - elem := p.v.Index(i) - switch elem.Kind() { - case reflect.Int64: - return uint64(elem.Int()) - case reflect.Uint64: - return uint64(elem.Uint()) - case reflect.Float64: - return math.Float64bits(float64(elem.Float())) - } - panic("unreachable") +func atomicStoreMarshalInfo(p **marshalInfo, v *marshalInfo) { + atomicLock.Lock() + defer atomicLock.Unlock() + *p = v } - -func structPointer_Word64Slice(p structPointer, f field) word64Slice { - return word64Slice{structPointer_field(p, f)} +func atomicLoadMergeInfo(p **mergeInfo) *mergeInfo { + atomicLock.Lock() + defer atomicLock.Unlock() + return *p +} +func atomicStoreMergeInfo(p **mergeInfo, v *mergeInfo) { + atomicLock.Lock() + defer atomicLock.Unlock() + *p = v } +func atomicLoadDiscardInfo(p **discardInfo) *discardInfo { + atomicLock.Lock() + defer atomicLock.Unlock() + return *p +} +func atomicStoreDiscardInfo(p **discardInfo, v *discardInfo) { + atomicLock.Lock() + defer atomicLock.Unlock() + *p = v +} + +var atomicLock sync.Mutex diff --git a/vendor/github.com/golang/protobuf/proto/pointer_unsafe.go b/vendor/github.com/golang/protobuf/proto/pointer_unsafe.go index 6b5567d47..d55a335d9 100644 --- a/vendor/github.com/golang/protobuf/proto/pointer_unsafe.go +++ b/vendor/github.com/golang/protobuf/proto/pointer_unsafe.go @@ -29,7 +29,7 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// +build !appengine,!js +// +build !purego,!appengine,!js // This file contains the implementation of the proto field accesses using package unsafe. @@ -37,38 +37,13 @@ package proto import ( "reflect" + "sync/atomic" "unsafe" ) -// NOTE: These type_Foo functions would more idiomatically be methods, -// but Go does not allow methods on pointer types, and we must preserve -// some pointer type for the garbage collector. We use these -// funcs with clunky names as our poor approximation to methods. -// -// An alternative would be -// type structPointer struct { p unsafe.Pointer } -// but that does not registerize as well. - -// A structPointer is a pointer to a struct. -type structPointer unsafe.Pointer - -// toStructPointer returns a structPointer equivalent to the given reflect value. -func toStructPointer(v reflect.Value) structPointer { - return structPointer(unsafe.Pointer(v.Pointer())) -} - -// IsNil reports whether p is nil. -func structPointer_IsNil(p structPointer) bool { - return p == nil -} - -// Interface returns the struct pointer, assumed to have element type t, -// as an interface value. -func structPointer_Interface(p structPointer, t reflect.Type) interface{} { - return reflect.NewAt(t, unsafe.Pointer(p)).Interface() -} +const unsafeAllowed = true -// A field identifies a field in a struct, accessible from a structPointer. +// A field identifies a field in a struct, accessible from a pointer. // In this implementation, a field is identified by its byte offset from the start of the struct. type field uintptr @@ -80,191 +55,254 @@ func toField(f *reflect.StructField) field { // invalidField is an invalid field identifier. const invalidField = ^field(0) +// zeroField is a noop when calling pointer.offset. +const zeroField = field(0) + // IsValid reports whether the field identifier is valid. func (f field) IsValid() bool { - return f != ^field(0) + return f != invalidField } -// Bytes returns the address of a []byte field in the struct. -func structPointer_Bytes(p structPointer, f field) *[]byte { - return (*[]byte)(unsafe.Pointer(uintptr(p) + uintptr(f))) +// The pointer type below is for the new table-driven encoder/decoder. +// The implementation here uses unsafe.Pointer to create a generic pointer. +// In pointer_reflect.go we use reflect instead of unsafe to implement +// the same (but slower) interface. +type pointer struct { + p unsafe.Pointer } -// BytesSlice returns the address of a [][]byte field in the struct. -func structPointer_BytesSlice(p structPointer, f field) *[][]byte { - return (*[][]byte)(unsafe.Pointer(uintptr(p) + uintptr(f))) -} +// size of pointer +var ptrSize = unsafe.Sizeof(uintptr(0)) -// Bool returns the address of a *bool field in the struct. -func structPointer_Bool(p structPointer, f field) **bool { - return (**bool)(unsafe.Pointer(uintptr(p) + uintptr(f))) +// toPointer converts an interface of pointer type to a pointer +// that points to the same target. +func toPointer(i *Message) pointer { + // Super-tricky - read pointer out of data word of interface value. + // Saves ~25ns over the equivalent: + // return valToPointer(reflect.ValueOf(*i)) + return pointer{p: (*[2]unsafe.Pointer)(unsafe.Pointer(i))[1]} } -// BoolVal returns the address of a bool field in the struct. -func structPointer_BoolVal(p structPointer, f field) *bool { - return (*bool)(unsafe.Pointer(uintptr(p) + uintptr(f))) +// toAddrPointer converts an interface to a pointer that points to +// the interface data. +func toAddrPointer(i *interface{}, isptr bool) pointer { + // Super-tricky - read or get the address of data word of interface value. + if isptr { + // The interface is of pointer type, thus it is a direct interface. + // The data word is the pointer data itself. We take its address. + return pointer{p: unsafe.Pointer(uintptr(unsafe.Pointer(i)) + ptrSize)} + } + // The interface is not of pointer type. The data word is the pointer + // to the data. + return pointer{p: (*[2]unsafe.Pointer)(unsafe.Pointer(i))[1]} } -// BoolSlice returns the address of a []bool field in the struct. -func structPointer_BoolSlice(p structPointer, f field) *[]bool { - return (*[]bool)(unsafe.Pointer(uintptr(p) + uintptr(f))) +// valToPointer converts v to a pointer. v must be of pointer type. +func valToPointer(v reflect.Value) pointer { + return pointer{p: unsafe.Pointer(v.Pointer())} } -// String returns the address of a *string field in the struct. -func structPointer_String(p structPointer, f field) **string { - return (**string)(unsafe.Pointer(uintptr(p) + uintptr(f))) +// offset converts from a pointer to a structure to a pointer to +// one of its fields. +func (p pointer) offset(f field) pointer { + // For safety, we should panic if !f.IsValid, however calling panic causes + // this to no longer be inlineable, which is a serious performance cost. + /* + if !f.IsValid() { + panic("invalid field") + } + */ + return pointer{p: unsafe.Pointer(uintptr(p.p) + uintptr(f))} } -// StringVal returns the address of a string field in the struct. -func structPointer_StringVal(p structPointer, f field) *string { - return (*string)(unsafe.Pointer(uintptr(p) + uintptr(f))) +func (p pointer) isNil() bool { + return p.p == nil } -// StringSlice returns the address of a []string field in the struct. -func structPointer_StringSlice(p structPointer, f field) *[]string { - return (*[]string)(unsafe.Pointer(uintptr(p) + uintptr(f))) +func (p pointer) toInt64() *int64 { + return (*int64)(p.p) } - -// ExtMap returns the address of an extension map field in the struct. -func structPointer_Extensions(p structPointer, f field) *XXX_InternalExtensions { - return (*XXX_InternalExtensions)(unsafe.Pointer(uintptr(p) + uintptr(f))) +func (p pointer) toInt64Ptr() **int64 { + return (**int64)(p.p) } - -func structPointer_ExtMap(p structPointer, f field) *map[int32]Extension { - return (*map[int32]Extension)(unsafe.Pointer(uintptr(p) + uintptr(f))) +func (p pointer) toInt64Slice() *[]int64 { + return (*[]int64)(p.p) } - -// NewAt returns the reflect.Value for a pointer to a field in the struct. -func structPointer_NewAt(p structPointer, f field, typ reflect.Type) reflect.Value { - return reflect.NewAt(typ, unsafe.Pointer(uintptr(p)+uintptr(f))) +func (p pointer) toInt32() *int32 { + return (*int32)(p.p) } -// SetStructPointer writes a *struct field in the struct. -func structPointer_SetStructPointer(p structPointer, f field, q structPointer) { - *(*structPointer)(unsafe.Pointer(uintptr(p) + uintptr(f))) = q +// See pointer_reflect.go for why toInt32Ptr/Slice doesn't exist. +/* + func (p pointer) toInt32Ptr() **int32 { + return (**int32)(p.p) + } + func (p pointer) toInt32Slice() *[]int32 { + return (*[]int32)(p.p) + } +*/ +func (p pointer) getInt32Ptr() *int32 { + return *(**int32)(p.p) } - -// GetStructPointer reads a *struct field in the struct. -func structPointer_GetStructPointer(p structPointer, f field) structPointer { - return *(*structPointer)(unsafe.Pointer(uintptr(p) + uintptr(f))) +func (p pointer) setInt32Ptr(v int32) { + *(**int32)(p.p) = &v } -// StructPointerSlice the address of a []*struct field in the struct. -func structPointer_StructPointerSlice(p structPointer, f field) *structPointerSlice { - return (*structPointerSlice)(unsafe.Pointer(uintptr(p) + uintptr(f))) +// getInt32Slice loads a []int32 from p. +// The value returned is aliased with the original slice. +// This behavior differs from the implementation in pointer_reflect.go. +func (p pointer) getInt32Slice() []int32 { + return *(*[]int32)(p.p) } -// A structPointerSlice represents a slice of pointers to structs (themselves submessages or groups). -type structPointerSlice []structPointer - -func (v *structPointerSlice) Len() int { return len(*v) } -func (v *structPointerSlice) Index(i int) structPointer { return (*v)[i] } -func (v *structPointerSlice) Append(p structPointer) { *v = append(*v, p) } - -// A word32 is the address of a "pointer to 32-bit value" field. -type word32 **uint32 - -// IsNil reports whether *v is nil. -func word32_IsNil(p word32) bool { - return *p == nil +// setInt32Slice stores a []int32 to p. +// The value set is aliased with the input slice. +// This behavior differs from the implementation in pointer_reflect.go. +func (p pointer) setInt32Slice(v []int32) { + *(*[]int32)(p.p) = v } -// Set sets *v to point at a newly allocated word set to x. -func word32_Set(p word32, o *Buffer, x uint32) { - if len(o.uint32s) == 0 { - o.uint32s = make([]uint32, uint32PoolSize) - } - o.uint32s[0] = x - *p = &o.uint32s[0] - o.uint32s = o.uint32s[1:] +// TODO: Can we get rid of appendInt32Slice and use setInt32Slice instead? +func (p pointer) appendInt32Slice(v int32) { + s := (*[]int32)(p.p) + *s = append(*s, v) } -// Get gets the value pointed at by *v. -func word32_Get(p word32) uint32 { - return **p +func (p pointer) toUint64() *uint64 { + return (*uint64)(p.p) } - -// Word32 returns the address of a *int32, *uint32, *float32, or *enum field in the struct. -func structPointer_Word32(p structPointer, f field) word32 { - return word32((**uint32)(unsafe.Pointer(uintptr(p) + uintptr(f)))) +func (p pointer) toUint64Ptr() **uint64 { + return (**uint64)(p.p) } - -// A word32Val is the address of a 32-bit value field. -type word32Val *uint32 - -// Set sets *p to x. -func word32Val_Set(p word32Val, x uint32) { - *p = x +func (p pointer) toUint64Slice() *[]uint64 { + return (*[]uint64)(p.p) } - -// Get gets the value pointed at by p. -func word32Val_Get(p word32Val) uint32 { - return *p +func (p pointer) toUint32() *uint32 { + return (*uint32)(p.p) } - -// Word32Val returns the address of a *int32, *uint32, *float32, or *enum field in the struct. -func structPointer_Word32Val(p structPointer, f field) word32Val { - return word32Val((*uint32)(unsafe.Pointer(uintptr(p) + uintptr(f)))) +func (p pointer) toUint32Ptr() **uint32 { + return (**uint32)(p.p) } - -// A word32Slice is a slice of 32-bit values. -type word32Slice []uint32 - -func (v *word32Slice) Append(x uint32) { *v = append(*v, x) } -func (v *word32Slice) Len() int { return len(*v) } -func (v *word32Slice) Index(i int) uint32 { return (*v)[i] } - -// Word32Slice returns the address of a []int32, []uint32, []float32, or []enum field in the struct. -func structPointer_Word32Slice(p structPointer, f field) *word32Slice { - return (*word32Slice)(unsafe.Pointer(uintptr(p) + uintptr(f))) +func (p pointer) toUint32Slice() *[]uint32 { + return (*[]uint32)(p.p) } - -// word64 is like word32 but for 64-bit values. -type word64 **uint64 - -func word64_Set(p word64, o *Buffer, x uint64) { - if len(o.uint64s) == 0 { - o.uint64s = make([]uint64, uint64PoolSize) - } - o.uint64s[0] = x - *p = &o.uint64s[0] - o.uint64s = o.uint64s[1:] +func (p pointer) toBool() *bool { + return (*bool)(p.p) } - -func word64_IsNil(p word64) bool { - return *p == nil +func (p pointer) toBoolPtr() **bool { + return (**bool)(p.p) } - -func word64_Get(p word64) uint64 { - return **p +func (p pointer) toBoolSlice() *[]bool { + return (*[]bool)(p.p) +} +func (p pointer) toFloat64() *float64 { + return (*float64)(p.p) +} +func (p pointer) toFloat64Ptr() **float64 { + return (**float64)(p.p) +} +func (p pointer) toFloat64Slice() *[]float64 { + return (*[]float64)(p.p) +} +func (p pointer) toFloat32() *float32 { + return (*float32)(p.p) +} +func (p pointer) toFloat32Ptr() **float32 { + return (**float32)(p.p) +} +func (p pointer) toFloat32Slice() *[]float32 { + return (*[]float32)(p.p) +} +func (p pointer) toString() *string { + return (*string)(p.p) +} +func (p pointer) toStringPtr() **string { + return (**string)(p.p) +} +func (p pointer) toStringSlice() *[]string { + return (*[]string)(p.p) +} +func (p pointer) toBytes() *[]byte { + return (*[]byte)(p.p) +} +func (p pointer) toBytesSlice() *[][]byte { + return (*[][]byte)(p.p) +} +func (p pointer) toExtensions() *XXX_InternalExtensions { + return (*XXX_InternalExtensions)(p.p) +} +func (p pointer) toOldExtensions() *map[int32]Extension { + return (*map[int32]Extension)(p.p) } -func structPointer_Word64(p structPointer, f field) word64 { - return word64((**uint64)(unsafe.Pointer(uintptr(p) + uintptr(f)))) +// getPointerSlice loads []*T from p as a []pointer. +// The value returned is aliased with the original slice. +// This behavior differs from the implementation in pointer_reflect.go. +func (p pointer) getPointerSlice() []pointer { + // Super-tricky - p should point to a []*T where T is a + // message type. We load it as []pointer. + return *(*[]pointer)(p.p) } -// word64Val is like word32Val but for 64-bit values. -type word64Val *uint64 +// setPointerSlice stores []pointer into p as a []*T. +// The value set is aliased with the input slice. +// This behavior differs from the implementation in pointer_reflect.go. +func (p pointer) setPointerSlice(v []pointer) { + // Super-tricky - p should point to a []*T where T is a + // message type. We store it as []pointer. + *(*[]pointer)(p.p) = v +} -func word64Val_Set(p word64Val, o *Buffer, x uint64) { - *p = x +// getPointer loads the pointer at p and returns it. +func (p pointer) getPointer() pointer { + return pointer{p: *(*unsafe.Pointer)(p.p)} } -func word64Val_Get(p word64Val) uint64 { - return *p +// setPointer stores the pointer q at p. +func (p pointer) setPointer(q pointer) { + *(*unsafe.Pointer)(p.p) = q.p } -func structPointer_Word64Val(p structPointer, f field) word64Val { - return word64Val((*uint64)(unsafe.Pointer(uintptr(p) + uintptr(f)))) +// append q to the slice pointed to by p. +func (p pointer) appendPointer(q pointer) { + s := (*[]unsafe.Pointer)(p.p) + *s = append(*s, q.p) } -// word64Slice is like word32Slice but for 64-bit values. -type word64Slice []uint64 +// getInterfacePointer returns a pointer that points to the +// interface data of the interface pointed by p. +func (p pointer) getInterfacePointer() pointer { + // Super-tricky - read pointer out of data word of interface value. + return pointer{p: (*(*[2]unsafe.Pointer)(p.p))[1]} +} -func (v *word64Slice) Append(x uint64) { *v = append(*v, x) } -func (v *word64Slice) Len() int { return len(*v) } -func (v *word64Slice) Index(i int) uint64 { return (*v)[i] } +// asPointerTo returns a reflect.Value that is a pointer to an +// object of type t stored at p. +func (p pointer) asPointerTo(t reflect.Type) reflect.Value { + return reflect.NewAt(t, p.p) +} -func structPointer_Word64Slice(p structPointer, f field) *word64Slice { - return (*word64Slice)(unsafe.Pointer(uintptr(p) + uintptr(f))) +func atomicLoadUnmarshalInfo(p **unmarshalInfo) *unmarshalInfo { + return (*unmarshalInfo)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(p)))) +} +func atomicStoreUnmarshalInfo(p **unmarshalInfo, v *unmarshalInfo) { + atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(p)), unsafe.Pointer(v)) +} +func atomicLoadMarshalInfo(p **marshalInfo) *marshalInfo { + return (*marshalInfo)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(p)))) +} +func atomicStoreMarshalInfo(p **marshalInfo, v *marshalInfo) { + atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(p)), unsafe.Pointer(v)) +} +func atomicLoadMergeInfo(p **mergeInfo) *mergeInfo { + return (*mergeInfo)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(p)))) +} +func atomicStoreMergeInfo(p **mergeInfo, v *mergeInfo) { + atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(p)), unsafe.Pointer(v)) +} +func atomicLoadDiscardInfo(p **discardInfo) *discardInfo { + return (*discardInfo)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(p)))) +} +func atomicStoreDiscardInfo(p **discardInfo, v *discardInfo) { + atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(p)), unsafe.Pointer(v)) } diff --git a/vendor/github.com/golang/protobuf/proto/properties.go b/vendor/github.com/golang/protobuf/proto/properties.go index ec2289c00..f710adab0 100644 --- a/vendor/github.com/golang/protobuf/proto/properties.go +++ b/vendor/github.com/golang/protobuf/proto/properties.go @@ -58,42 +58,6 @@ const ( WireFixed32 = 5 ) -const startSize = 10 // initial slice/string sizes - -// Encoders are defined in encode.go -// An encoder outputs the full representation of a field, including its -// tag and encoder type. -type encoder func(p *Buffer, prop *Properties, base structPointer) error - -// A valueEncoder encodes a single integer in a particular encoding. -type valueEncoder func(o *Buffer, x uint64) error - -// Sizers are defined in encode.go -// A sizer returns the encoded size of a field, including its tag and encoder -// type. -type sizer func(prop *Properties, base structPointer) int - -// A valueSizer returns the encoded size of a single integer in a particular -// encoding. -type valueSizer func(x uint64) int - -// Decoders are defined in decode.go -// A decoder creates a value from its wire representation. -// Unrecognized subelements are saved in unrec. -type decoder func(p *Buffer, prop *Properties, base structPointer) error - -// A valueDecoder decodes a single integer in a particular encoding. -type valueDecoder func(o *Buffer) (x uint64, err error) - -// A oneofMarshaler does the marshaling for all oneof fields in a message. -type oneofMarshaler func(Message, *Buffer) error - -// A oneofUnmarshaler does the unmarshaling for a oneof field in a message. -type oneofUnmarshaler func(Message, int, int, *Buffer) (bool, error) - -// A oneofSizer does the sizing for all oneof fields in a message. -type oneofSizer func(Message) int - // tagMap is an optimization over map[int]int for typical protocol buffer // use-cases. Encoded protocol buffers are often in tag order with small tag // numbers. @@ -140,13 +104,6 @@ type StructProperties struct { decoderTags tagMap // map from proto tag to struct field number decoderOrigNames map[string]int // map from original name to struct field number order []int // list of struct field numbers in tag order - unrecField field // field id of the XXX_unrecognized []byte field - extendable bool // is this an extendable proto - - oneofMarshaler oneofMarshaler - oneofUnmarshaler oneofUnmarshaler - oneofSizer oneofSizer - stype reflect.Type // OneofTypes contains information about the oneof fields in this message. // It is keyed by the original name of a field. @@ -187,36 +144,19 @@ type Properties struct { Default string // default value HasDefault bool // whether an explicit default was provided - def_uint64 uint64 - - enc encoder - valEnc valueEncoder // set for bool and numeric types only - field field - tagcode []byte // encoding of EncodeVarint((Tag<<3)|WireType) - tagbuf [8]byte - stype reflect.Type // set for struct types only - sprop *StructProperties // set for struct types only - isMarshaler bool - isUnmarshaler bool + + stype reflect.Type // set for struct types only + sprop *StructProperties // set for struct types only mtype reflect.Type // set for map types only mkeyprop *Properties // set for map types only mvalprop *Properties // set for map types only - - size sizer - valSize valueSizer // set for bool and numeric types only - - dec decoder - valDec valueDecoder // set for bool and numeric types only - - // If this is a packable field, this will be the decoder for the packed version of the field. - packedDec decoder } // String formats the properties in the protobuf struct field tag style. func (p *Properties) String() string { s := p.Wire - s = "," + s += "," s += strconv.Itoa(p.Tag) if p.Required { s += ",req" @@ -262,29 +202,14 @@ func (p *Properties) Parse(s string) { switch p.Wire { case "varint": p.WireType = WireVarint - p.valEnc = (*Buffer).EncodeVarint - p.valDec = (*Buffer).DecodeVarint - p.valSize = sizeVarint case "fixed32": p.WireType = WireFixed32 - p.valEnc = (*Buffer).EncodeFixed32 - p.valDec = (*Buffer).DecodeFixed32 - p.valSize = sizeFixed32 case "fixed64": p.WireType = WireFixed64 - p.valEnc = (*Buffer).EncodeFixed64 - p.valDec = (*Buffer).DecodeFixed64 - p.valSize = sizeFixed64 case "zigzag32": p.WireType = WireVarint - p.valEnc = (*Buffer).EncodeZigzag32 - p.valDec = (*Buffer).DecodeZigzag32 - p.valSize = sizeZigzag32 case "zigzag64": p.WireType = WireVarint - p.valEnc = (*Buffer).EncodeZigzag64 - p.valDec = (*Buffer).DecodeZigzag64 - p.valSize = sizeZigzag64 case "bytes", "group": p.WireType = WireBytes // no numeric converter for non-numeric types @@ -299,6 +224,7 @@ func (p *Properties) Parse(s string) { return } +outer: for i := 2; i < len(fields); i++ { f := fields[i] switch { @@ -326,229 +252,28 @@ func (p *Properties) Parse(s string) { if i+1 < len(fields) { // Commas aren't escaped, and def is always last. p.Default += "," + strings.Join(fields[i+1:], ",") - break + break outer } } } } -func logNoSliceEnc(t1, t2 reflect.Type) { - fmt.Fprintf(os.Stderr, "proto: no slice oenc for %T = []%T\n", t1, t2) -} - var protoMessageType = reflect.TypeOf((*Message)(nil)).Elem() -// Initialize the fields for encoding and decoding. -func (p *Properties) setEncAndDec(typ reflect.Type, f *reflect.StructField, lockGetProp bool) { - p.enc = nil - p.dec = nil - p.size = nil - +// setFieldProps initializes the field properties for submessages and maps. +func (p *Properties) setFieldProps(typ reflect.Type, f *reflect.StructField, lockGetProp bool) { switch t1 := typ; t1.Kind() { - default: - fmt.Fprintf(os.Stderr, "proto: no coders for %v\n", t1) - - // proto3 scalar types - - case reflect.Bool: - p.enc = (*Buffer).enc_proto3_bool - p.dec = (*Buffer).dec_proto3_bool - p.size = size_proto3_bool - case reflect.Int32: - p.enc = (*Buffer).enc_proto3_int32 - p.dec = (*Buffer).dec_proto3_int32 - p.size = size_proto3_int32 - case reflect.Uint32: - p.enc = (*Buffer).enc_proto3_uint32 - p.dec = (*Buffer).dec_proto3_int32 // can reuse - p.size = size_proto3_uint32 - case reflect.Int64, reflect.Uint64: - p.enc = (*Buffer).enc_proto3_int64 - p.dec = (*Buffer).dec_proto3_int64 - p.size = size_proto3_int64 - case reflect.Float32: - p.enc = (*Buffer).enc_proto3_uint32 // can just treat them as bits - p.dec = (*Buffer).dec_proto3_int32 - p.size = size_proto3_uint32 - case reflect.Float64: - p.enc = (*Buffer).enc_proto3_int64 // can just treat them as bits - p.dec = (*Buffer).dec_proto3_int64 - p.size = size_proto3_int64 - case reflect.String: - p.enc = (*Buffer).enc_proto3_string - p.dec = (*Buffer).dec_proto3_string - p.size = size_proto3_string - case reflect.Ptr: - switch t2 := t1.Elem(); t2.Kind() { - default: - fmt.Fprintf(os.Stderr, "proto: no encoder function for %v -> %v\n", t1, t2) - break - case reflect.Bool: - p.enc = (*Buffer).enc_bool - p.dec = (*Buffer).dec_bool - p.size = size_bool - case reflect.Int32: - p.enc = (*Buffer).enc_int32 - p.dec = (*Buffer).dec_int32 - p.size = size_int32 - case reflect.Uint32: - p.enc = (*Buffer).enc_uint32 - p.dec = (*Buffer).dec_int32 // can reuse - p.size = size_uint32 - case reflect.Int64, reflect.Uint64: - p.enc = (*Buffer).enc_int64 - p.dec = (*Buffer).dec_int64 - p.size = size_int64 - case reflect.Float32: - p.enc = (*Buffer).enc_uint32 // can just treat them as bits - p.dec = (*Buffer).dec_int32 - p.size = size_uint32 - case reflect.Float64: - p.enc = (*Buffer).enc_int64 // can just treat them as bits - p.dec = (*Buffer).dec_int64 - p.size = size_int64 - case reflect.String: - p.enc = (*Buffer).enc_string - p.dec = (*Buffer).dec_string - p.size = size_string - case reflect.Struct: + if t1.Elem().Kind() == reflect.Struct { p.stype = t1.Elem() - p.isMarshaler = isMarshaler(t1) - p.isUnmarshaler = isUnmarshaler(t1) - if p.Wire == "bytes" { - p.enc = (*Buffer).enc_struct_message - p.dec = (*Buffer).dec_struct_message - p.size = size_struct_message - } else { - p.enc = (*Buffer).enc_struct_group - p.dec = (*Buffer).dec_struct_group - p.size = size_struct_group - } } case reflect.Slice: - switch t2 := t1.Elem(); t2.Kind() { - default: - logNoSliceEnc(t1, t2) - break - case reflect.Bool: - if p.Packed { - p.enc = (*Buffer).enc_slice_packed_bool - p.size = size_slice_packed_bool - } else { - p.enc = (*Buffer).enc_slice_bool - p.size = size_slice_bool - } - p.dec = (*Buffer).dec_slice_bool - p.packedDec = (*Buffer).dec_slice_packed_bool - case reflect.Int32: - if p.Packed { - p.enc = (*Buffer).enc_slice_packed_int32 - p.size = size_slice_packed_int32 - } else { - p.enc = (*Buffer).enc_slice_int32 - p.size = size_slice_int32 - } - p.dec = (*Buffer).dec_slice_int32 - p.packedDec = (*Buffer).dec_slice_packed_int32 - case reflect.Uint32: - if p.Packed { - p.enc = (*Buffer).enc_slice_packed_uint32 - p.size = size_slice_packed_uint32 - } else { - p.enc = (*Buffer).enc_slice_uint32 - p.size = size_slice_uint32 - } - p.dec = (*Buffer).dec_slice_int32 - p.packedDec = (*Buffer).dec_slice_packed_int32 - case reflect.Int64, reflect.Uint64: - if p.Packed { - p.enc = (*Buffer).enc_slice_packed_int64 - p.size = size_slice_packed_int64 - } else { - p.enc = (*Buffer).enc_slice_int64 - p.size = size_slice_int64 - } - p.dec = (*Buffer).dec_slice_int64 - p.packedDec = (*Buffer).dec_slice_packed_int64 - case reflect.Uint8: - p.dec = (*Buffer).dec_slice_byte - if p.proto3 { - p.enc = (*Buffer).enc_proto3_slice_byte - p.size = size_proto3_slice_byte - } else { - p.enc = (*Buffer).enc_slice_byte - p.size = size_slice_byte - } - case reflect.Float32, reflect.Float64: - switch t2.Bits() { - case 32: - // can just treat them as bits - if p.Packed { - p.enc = (*Buffer).enc_slice_packed_uint32 - p.size = size_slice_packed_uint32 - } else { - p.enc = (*Buffer).enc_slice_uint32 - p.size = size_slice_uint32 - } - p.dec = (*Buffer).dec_slice_int32 - p.packedDec = (*Buffer).dec_slice_packed_int32 - case 64: - // can just treat them as bits - if p.Packed { - p.enc = (*Buffer).enc_slice_packed_int64 - p.size = size_slice_packed_int64 - } else { - p.enc = (*Buffer).enc_slice_int64 - p.size = size_slice_int64 - } - p.dec = (*Buffer).dec_slice_int64 - p.packedDec = (*Buffer).dec_slice_packed_int64 - default: - logNoSliceEnc(t1, t2) - break - } - case reflect.String: - p.enc = (*Buffer).enc_slice_string - p.dec = (*Buffer).dec_slice_string - p.size = size_slice_string - case reflect.Ptr: - switch t3 := t2.Elem(); t3.Kind() { - default: - fmt.Fprintf(os.Stderr, "proto: no ptr oenc for %T -> %T -> %T\n", t1, t2, t3) - break - case reflect.Struct: - p.stype = t2.Elem() - p.isMarshaler = isMarshaler(t2) - p.isUnmarshaler = isUnmarshaler(t2) - if p.Wire == "bytes" { - p.enc = (*Buffer).enc_slice_struct_message - p.dec = (*Buffer).dec_slice_struct_message - p.size = size_slice_struct_message - } else { - p.enc = (*Buffer).enc_slice_struct_group - p.dec = (*Buffer).dec_slice_struct_group - p.size = size_slice_struct_group - } - } - case reflect.Slice: - switch t2.Elem().Kind() { - default: - fmt.Fprintf(os.Stderr, "proto: no slice elem oenc for %T -> %T -> %T\n", t1, t2, t2.Elem()) - break - case reflect.Uint8: - p.enc = (*Buffer).enc_slice_slice_byte - p.dec = (*Buffer).dec_slice_slice_byte - p.size = size_slice_slice_byte - } + if t2 := t1.Elem(); t2.Kind() == reflect.Ptr && t2.Elem().Kind() == reflect.Struct { + p.stype = t2.Elem() } case reflect.Map: - p.enc = (*Buffer).enc_new_map - p.dec = (*Buffer).dec_new_map - p.size = size_new_map - p.mtype = t1 p.mkeyprop = &Properties{} p.mkeyprop.init(reflect.PtrTo(p.mtype.Key()), "Key", f.Tag.Get("protobuf_key"), nil, lockGetProp) @@ -562,20 +287,6 @@ func (p *Properties) setEncAndDec(typ reflect.Type, f *reflect.StructField, lock p.mvalprop.init(vtype, "Value", f.Tag.Get("protobuf_val"), nil, lockGetProp) } - // precalculate tag code - wire := p.WireType - if p.Packed { - wire = WireBytes - } - x := uint32(p.Tag)<<3 | uint32(wire) - i := 0 - for i = 0; x > 127; i++ { - p.tagbuf[i] = 0x80 | uint8(x&0x7F) - x >>= 7 - } - p.tagbuf[i] = uint8(x) - p.tagcode = p.tagbuf[0 : i+1] - if p.stype != nil { if lockGetProp { p.sprop = GetProperties(p.stype) @@ -586,32 +297,9 @@ func (p *Properties) setEncAndDec(typ reflect.Type, f *reflect.StructField, lock } var ( - marshalerType = reflect.TypeOf((*Marshaler)(nil)).Elem() - unmarshalerType = reflect.TypeOf((*Unmarshaler)(nil)).Elem() + marshalerType = reflect.TypeOf((*Marshaler)(nil)).Elem() ) -// isMarshaler reports whether type t implements Marshaler. -func isMarshaler(t reflect.Type) bool { - // We're checking for (likely) pointer-receiver methods - // so if t is not a pointer, something is very wrong. - // The calls above only invoke isMarshaler on pointer types. - if t.Kind() != reflect.Ptr { - panic("proto: misuse of isMarshaler") - } - return t.Implements(marshalerType) -} - -// isUnmarshaler reports whether type t implements Unmarshaler. -func isUnmarshaler(t reflect.Type) bool { - // We're checking for (likely) pointer-receiver methods - // so if t is not a pointer, something is very wrong. - // The calls above only invoke isUnmarshaler on pointer types. - if t.Kind() != reflect.Ptr { - panic("proto: misuse of isUnmarshaler") - } - return t.Implements(unmarshalerType) -} - // Init populates the properties from a protocol buffer struct tag. func (p *Properties) Init(typ reflect.Type, name, tag string, f *reflect.StructField) { p.init(typ, name, tag, f, true) @@ -621,14 +309,11 @@ func (p *Properties) init(typ reflect.Type, name, tag string, f *reflect.StructF // "bytes,49,opt,def=hello!" p.Name = name p.OrigName = name - if f != nil { - p.field = toField(f) - } if tag == "" { return } p.Parse(tag) - p.setEncAndDec(typ, f, lockGetProp) + p.setFieldProps(typ, f, lockGetProp) } var ( @@ -678,9 +363,6 @@ func getPropertiesLocked(t reflect.Type) *StructProperties { propertiesMap[t] = prop // build properties - prop.extendable = reflect.PtrTo(t).Implements(extendableProtoType) || - reflect.PtrTo(t).Implements(extendableProtoV1Type) - prop.unrecField = invalidField prop.Prop = make([]*Properties, t.NumField()) prop.order = make([]int, t.NumField()) @@ -690,17 +372,6 @@ func getPropertiesLocked(t reflect.Type) *StructProperties { name := f.Name p.init(f.Type, name, f.Tag.Get("protobuf"), &f, false) - if f.Name == "XXX_InternalExtensions" { // special case - p.enc = (*Buffer).enc_exts - p.dec = nil // not needed - p.size = size_exts - } else if f.Name == "XXX_extensions" { // special case - p.enc = (*Buffer).enc_map - p.dec = nil // not needed - p.size = size_map - } else if f.Name == "XXX_unrecognized" { // special case - prop.unrecField = toField(&f) - } oneof := f.Tag.Get("protobuf_oneof") // special case if oneof != "" { // Oneof fields don't use the traditional protobuf tag. @@ -715,9 +386,6 @@ func getPropertiesLocked(t reflect.Type) *StructProperties { } print("\n") } - if p.enc == nil && !strings.HasPrefix(f.Name, "XXX_") && oneof == "" { - fmt.Fprintln(os.Stderr, "proto: no encoder for", f.Name, f.Type.String(), "[GetProperties]") - } } // Re-order prop.order. @@ -728,8 +396,7 @@ func getPropertiesLocked(t reflect.Type) *StructProperties { } if om, ok := reflect.Zero(reflect.PtrTo(t)).Interface().(oneofMessage); ok { var oots []interface{} - prop.oneofMarshaler, prop.oneofUnmarshaler, prop.oneofSizer, oots = om.XXX_OneofFuncs() - prop.stype = t + _, _, _, oots = om.XXX_OneofFuncs() // Interpret oneof metadata. prop.OneofTypes = make(map[string]*OneofProperties) @@ -779,30 +446,6 @@ func getPropertiesLocked(t reflect.Type) *StructProperties { return prop } -// Return the Properties object for the x[0]'th field of the structure. -func propByIndex(t reflect.Type, x []int) *Properties { - if len(x) != 1 { - fmt.Fprintf(os.Stderr, "proto: field index dimension %d (not 1) for type %s\n", len(x), t) - return nil - } - prop := GetProperties(t) - return prop.Prop[x[0]] -} - -// Get the address and type of a pointer to a struct from an interface. -func getbase(pb Message) (t reflect.Type, b structPointer, err error) { - if pb == nil { - err = ErrNil - return - } - // get the reflect type of the pointer to the struct. - t = reflect.TypeOf(pb) - // get the address of the struct. - value := reflect.ValueOf(pb) - b = toStructPointer(value) - return -} - // A global registry of enum types. // The generated code will register the generated maps by calling RegisterEnum. @@ -826,20 +469,42 @@ func EnumValueMap(enumType string) map[string]int32 { // A registry of all linked message types. // The string is a fully-qualified proto name ("pkg.Message"). var ( - protoTypes = make(map[string]reflect.Type) - revProtoTypes = make(map[reflect.Type]string) + protoTypedNils = make(map[string]Message) // a map from proto names to typed nil pointers + protoMapTypes = make(map[string]reflect.Type) // a map from proto names to map types + revProtoTypes = make(map[reflect.Type]string) ) // RegisterType is called from generated code and maps from the fully qualified // proto name to the type (pointer to struct) of the protocol buffer. func RegisterType(x Message, name string) { - if _, ok := protoTypes[name]; ok { + if _, ok := protoTypedNils[name]; ok { // TODO: Some day, make this a panic. log.Printf("proto: duplicate proto type registered: %s", name) return } t := reflect.TypeOf(x) - protoTypes[name] = t + if v := reflect.ValueOf(x); v.Kind() == reflect.Ptr && v.Pointer() == 0 { + // Generated code always calls RegisterType with nil x. + // This check is just for extra safety. + protoTypedNils[name] = x + } else { + protoTypedNils[name] = reflect.Zero(t).Interface().(Message) + } + revProtoTypes[t] = name +} + +// RegisterMapType is called from generated code and maps from the fully qualified +// proto name to the native map type of the proto map definition. +func RegisterMapType(x interface{}, name string) { + if reflect.TypeOf(x).Kind() != reflect.Map { + panic(fmt.Sprintf("RegisterMapType(%T, %q); want map", x, name)) + } + if _, ok := protoMapTypes[name]; ok { + log.Printf("proto: duplicate proto type registered: %s", name) + return + } + t := reflect.TypeOf(x) + protoMapTypes[name] = t revProtoTypes[t] = name } @@ -855,7 +520,14 @@ func MessageName(x Message) string { } // MessageType returns the message type (pointer to struct) for a named message. -func MessageType(name string) reflect.Type { return protoTypes[name] } +// The type is not guaranteed to implement proto.Message if the name refers to a +// map entry. +func MessageType(name string) reflect.Type { + if t, ok := protoTypedNils[name]; ok { + return reflect.TypeOf(t) + } + return protoMapTypes[name] +} // A registry of all linked proto files. var ( diff --git a/vendor/github.com/golang/protobuf/proto/proto3_proto/proto3.pb.go b/vendor/github.com/golang/protobuf/proto/proto3_proto/proto3.pb.go index cc4d0489f..a80f08930 100644 --- a/vendor/github.com/golang/protobuf/proto/proto3_proto/proto3.pb.go +++ b/vendor/github.com/golang/protobuf/proto/proto3_proto/proto3.pb.go @@ -1,27 +1,13 @@ -// Code generated by protoc-gen-go. +// Code generated by protoc-gen-go. DO NOT EDIT. // source: proto3_proto/proto3.proto -// DO NOT EDIT! -/* -Package proto3_proto is a generated protocol buffer package. - -It is generated from these files: - proto3_proto/proto3.proto - -It has these top-level messages: - Message - Nested - MessageWithMap - IntMap - IntMaps -*/ package proto3_proto import proto "github.com/golang/protobuf/proto" import fmt "fmt" import math "math" -import google_protobuf "github.com/golang/protobuf/ptypes/any" -import testdata "github.com/golang/protobuf/proto/testdata" +import test_proto "github.com/golang/protobuf/proto/test_proto" +import any "github.com/golang/protobuf/ptypes/any" // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -59,33 +45,58 @@ var Message_Humour_value = map[string]int32{ func (x Message_Humour) String() string { return proto.EnumName(Message_Humour_name, int32(x)) } -func (Message_Humour) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0, 0} } +func (Message_Humour) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_proto3_e706e4ff19a5dbea, []int{0, 0} +} type Message struct { - Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - Hilarity Message_Humour `protobuf:"varint,2,opt,name=hilarity,enum=proto3_proto.Message_Humour" json:"hilarity,omitempty"` - HeightInCm uint32 `protobuf:"varint,3,opt,name=height_in_cm,json=heightInCm" json:"height_in_cm,omitempty"` - Data []byte `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"` - ResultCount int64 `protobuf:"varint,7,opt,name=result_count,json=resultCount" json:"result_count,omitempty"` - TrueScotsman bool `protobuf:"varint,8,opt,name=true_scotsman,json=trueScotsman" json:"true_scotsman,omitempty"` - Score float32 `protobuf:"fixed32,9,opt,name=score" json:"score,omitempty"` - Key []uint64 `protobuf:"varint,5,rep,packed,name=key" json:"key,omitempty"` - ShortKey []int32 `protobuf:"varint,19,rep,packed,name=short_key,json=shortKey" json:"short_key,omitempty"` - Nested *Nested `protobuf:"bytes,6,opt,name=nested" json:"nested,omitempty"` - RFunny []Message_Humour `protobuf:"varint,16,rep,packed,name=r_funny,json=rFunny,enum=proto3_proto.Message_Humour" json:"r_funny,omitempty"` - Terrain map[string]*Nested `protobuf:"bytes,10,rep,name=terrain" json:"terrain,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - Proto2Field *testdata.SubDefaults `protobuf:"bytes,11,opt,name=proto2_field,json=proto2Field" json:"proto2_field,omitempty"` - Proto2Value map[string]*testdata.SubDefaults `protobuf:"bytes,13,rep,name=proto2_value,json=proto2Value" json:"proto2_value,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - Anything *google_protobuf.Any `protobuf:"bytes,14,opt,name=anything" json:"anything,omitempty"` - ManyThings []*google_protobuf.Any `protobuf:"bytes,15,rep,name=many_things,json=manyThings" json:"many_things,omitempty"` - Submessage *Message `protobuf:"bytes,17,opt,name=submessage" json:"submessage,omitempty"` - Children []*Message `protobuf:"bytes,18,rep,name=children" json:"children,omitempty"` -} - -func (m *Message) Reset() { *m = Message{} } -func (m *Message) String() string { return proto.CompactTextString(m) } -func (*Message) ProtoMessage() {} -func (*Message) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } + Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Hilarity Message_Humour `protobuf:"varint,2,opt,name=hilarity,enum=proto3_proto.Message_Humour" json:"hilarity,omitempty"` + HeightInCm uint32 `protobuf:"varint,3,opt,name=height_in_cm,json=heightInCm" json:"height_in_cm,omitempty"` + Data []byte `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"` + ResultCount int64 `protobuf:"varint,7,opt,name=result_count,json=resultCount" json:"result_count,omitempty"` + TrueScotsman bool `protobuf:"varint,8,opt,name=true_scotsman,json=trueScotsman" json:"true_scotsman,omitempty"` + Score float32 `protobuf:"fixed32,9,opt,name=score" json:"score,omitempty"` + Key []uint64 `protobuf:"varint,5,rep,packed,name=key" json:"key,omitempty"` + ShortKey []int32 `protobuf:"varint,19,rep,packed,name=short_key,json=shortKey" json:"short_key,omitempty"` + Nested *Nested `protobuf:"bytes,6,opt,name=nested" json:"nested,omitempty"` + RFunny []Message_Humour `protobuf:"varint,16,rep,packed,name=r_funny,json=rFunny,enum=proto3_proto.Message_Humour" json:"r_funny,omitempty"` + Terrain map[string]*Nested `protobuf:"bytes,10,rep,name=terrain" json:"terrain,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + Proto2Field *test_proto.SubDefaults `protobuf:"bytes,11,opt,name=proto2_field,json=proto2Field" json:"proto2_field,omitempty"` + Proto2Value map[string]*test_proto.SubDefaults `protobuf:"bytes,13,rep,name=proto2_value,json=proto2Value" json:"proto2_value,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + Anything *any.Any `protobuf:"bytes,14,opt,name=anything" json:"anything,omitempty"` + ManyThings []*any.Any `protobuf:"bytes,15,rep,name=many_things,json=manyThings" json:"many_things,omitempty"` + Submessage *Message `protobuf:"bytes,17,opt,name=submessage" json:"submessage,omitempty"` + Children []*Message `protobuf:"bytes,18,rep,name=children" json:"children,omitempty"` + StringMap map[string]string `protobuf:"bytes,20,rep,name=string_map,json=stringMap" json:"string_map,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Message) Reset() { *m = Message{} } +func (m *Message) String() string { return proto.CompactTextString(m) } +func (*Message) ProtoMessage() {} +func (*Message) Descriptor() ([]byte, []int) { + return fileDescriptor_proto3_e706e4ff19a5dbea, []int{0} +} +func (m *Message) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Message.Unmarshal(m, b) +} +func (m *Message) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Message.Marshal(b, m, deterministic) +} +func (dst *Message) XXX_Merge(src proto.Message) { + xxx_messageInfo_Message.Merge(dst, src) +} +func (m *Message) XXX_Size() int { + return xxx_messageInfo_Message.Size(m) +} +func (m *Message) XXX_DiscardUnknown() { + xxx_messageInfo_Message.DiscardUnknown(m) +} + +var xxx_messageInfo_Message proto.InternalMessageInfo func (m *Message) GetName() string { if m != nil { @@ -171,28 +182,28 @@ func (m *Message) GetTerrain() map[string]*Nested { return nil } -func (m *Message) GetProto2Field() *testdata.SubDefaults { +func (m *Message) GetProto2Field() *test_proto.SubDefaults { if m != nil { return m.Proto2Field } return nil } -func (m *Message) GetProto2Value() map[string]*testdata.SubDefaults { +func (m *Message) GetProto2Value() map[string]*test_proto.SubDefaults { if m != nil { return m.Proto2Value } return nil } -func (m *Message) GetAnything() *google_protobuf.Any { +func (m *Message) GetAnything() *any.Any { if m != nil { return m.Anything } return nil } -func (m *Message) GetManyThings() []*google_protobuf.Any { +func (m *Message) GetManyThings() []*any.Any { if m != nil { return m.ManyThings } @@ -213,15 +224,44 @@ func (m *Message) GetChildren() []*Message { return nil } +func (m *Message) GetStringMap() map[string]string { + if m != nil { + return m.StringMap + } + return nil +} + type Nested struct { - Bunny string `protobuf:"bytes,1,opt,name=bunny" json:"bunny,omitempty"` - Cute bool `protobuf:"varint,2,opt,name=cute" json:"cute,omitempty"` + Bunny string `protobuf:"bytes,1,opt,name=bunny" json:"bunny,omitempty"` + Cute bool `protobuf:"varint,2,opt,name=cute" json:"cute,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Nested) Reset() { *m = Nested{} } +func (m *Nested) String() string { return proto.CompactTextString(m) } +func (*Nested) ProtoMessage() {} +func (*Nested) Descriptor() ([]byte, []int) { + return fileDescriptor_proto3_e706e4ff19a5dbea, []int{1} +} +func (m *Nested) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Nested.Unmarshal(m, b) +} +func (m *Nested) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Nested.Marshal(b, m, deterministic) +} +func (dst *Nested) XXX_Merge(src proto.Message) { + xxx_messageInfo_Nested.Merge(dst, src) +} +func (m *Nested) XXX_Size() int { + return xxx_messageInfo_Nested.Size(m) +} +func (m *Nested) XXX_DiscardUnknown() { + xxx_messageInfo_Nested.DiscardUnknown(m) } -func (m *Nested) Reset() { *m = Nested{} } -func (m *Nested) String() string { return proto.CompactTextString(m) } -func (*Nested) ProtoMessage() {} -func (*Nested) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } +var xxx_messageInfo_Nested proto.InternalMessageInfo func (m *Nested) GetBunny() string { if m != nil { @@ -238,13 +278,35 @@ func (m *Nested) GetCute() bool { } type MessageWithMap struct { - ByteMapping map[bool][]byte `protobuf:"bytes,1,rep,name=byte_mapping,json=byteMapping" json:"byte_mapping,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value,proto3"` + ByteMapping map[bool][]byte `protobuf:"bytes,1,rep,name=byte_mapping,json=byteMapping" json:"byte_mapping,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value,proto3"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MessageWithMap) Reset() { *m = MessageWithMap{} } +func (m *MessageWithMap) String() string { return proto.CompactTextString(m) } +func (*MessageWithMap) ProtoMessage() {} +func (*MessageWithMap) Descriptor() ([]byte, []int) { + return fileDescriptor_proto3_e706e4ff19a5dbea, []int{2} +} +func (m *MessageWithMap) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MessageWithMap.Unmarshal(m, b) +} +func (m *MessageWithMap) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MessageWithMap.Marshal(b, m, deterministic) +} +func (dst *MessageWithMap) XXX_Merge(src proto.Message) { + xxx_messageInfo_MessageWithMap.Merge(dst, src) +} +func (m *MessageWithMap) XXX_Size() int { + return xxx_messageInfo_MessageWithMap.Size(m) +} +func (m *MessageWithMap) XXX_DiscardUnknown() { + xxx_messageInfo_MessageWithMap.DiscardUnknown(m) } -func (m *MessageWithMap) Reset() { *m = MessageWithMap{} } -func (m *MessageWithMap) String() string { return proto.CompactTextString(m) } -func (*MessageWithMap) ProtoMessage() {} -func (*MessageWithMap) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } +var xxx_messageInfo_MessageWithMap proto.InternalMessageInfo func (m *MessageWithMap) GetByteMapping() map[bool][]byte { if m != nil { @@ -254,13 +316,35 @@ func (m *MessageWithMap) GetByteMapping() map[bool][]byte { } type IntMap struct { - Rtt map[int32]int32 `protobuf:"bytes,1,rep,name=rtt" json:"rtt,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"varint,2,opt,name=value"` + Rtt map[int32]int32 `protobuf:"bytes,1,rep,name=rtt" json:"rtt,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"varint,2,opt,name=value"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *IntMap) Reset() { *m = IntMap{} } +func (m *IntMap) String() string { return proto.CompactTextString(m) } +func (*IntMap) ProtoMessage() {} +func (*IntMap) Descriptor() ([]byte, []int) { + return fileDescriptor_proto3_e706e4ff19a5dbea, []int{3} +} +func (m *IntMap) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_IntMap.Unmarshal(m, b) +} +func (m *IntMap) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_IntMap.Marshal(b, m, deterministic) +} +func (dst *IntMap) XXX_Merge(src proto.Message) { + xxx_messageInfo_IntMap.Merge(dst, src) +} +func (m *IntMap) XXX_Size() int { + return xxx_messageInfo_IntMap.Size(m) +} +func (m *IntMap) XXX_DiscardUnknown() { + xxx_messageInfo_IntMap.DiscardUnknown(m) } -func (m *IntMap) Reset() { *m = IntMap{} } -func (m *IntMap) String() string { return proto.CompactTextString(m) } -func (*IntMap) ProtoMessage() {} -func (*IntMap) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } +var xxx_messageInfo_IntMap proto.InternalMessageInfo func (m *IntMap) GetRtt() map[int32]int32 { if m != nil { @@ -270,13 +354,35 @@ func (m *IntMap) GetRtt() map[int32]int32 { } type IntMaps struct { - Maps []*IntMap `protobuf:"bytes,1,rep,name=maps" json:"maps,omitempty"` + Maps []*IntMap `protobuf:"bytes,1,rep,name=maps" json:"maps,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *IntMaps) Reset() { *m = IntMaps{} } +func (m *IntMaps) String() string { return proto.CompactTextString(m) } +func (*IntMaps) ProtoMessage() {} +func (*IntMaps) Descriptor() ([]byte, []int) { + return fileDescriptor_proto3_e706e4ff19a5dbea, []int{4} +} +func (m *IntMaps) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_IntMaps.Unmarshal(m, b) +} +func (m *IntMaps) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_IntMaps.Marshal(b, m, deterministic) +} +func (dst *IntMaps) XXX_Merge(src proto.Message) { + xxx_messageInfo_IntMaps.Merge(dst, src) +} +func (m *IntMaps) XXX_Size() int { + return xxx_messageInfo_IntMaps.Size(m) +} +func (m *IntMaps) XXX_DiscardUnknown() { + xxx_messageInfo_IntMaps.DiscardUnknown(m) } -func (m *IntMaps) Reset() { *m = IntMaps{} } -func (m *IntMaps) String() string { return proto.CompactTextString(m) } -func (*IntMaps) ProtoMessage() {} -func (*IntMaps) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} } +var xxx_messageInfo_IntMaps proto.InternalMessageInfo func (m *IntMaps) GetMaps() []*IntMap { if m != nil { @@ -287,61 +393,69 @@ func (m *IntMaps) GetMaps() []*IntMap { func init() { proto.RegisterType((*Message)(nil), "proto3_proto.Message") + proto.RegisterMapType((map[string]*test_proto.SubDefaults)(nil), "proto3_proto.Message.Proto2ValueEntry") + proto.RegisterMapType((map[string]string)(nil), "proto3_proto.Message.StringMapEntry") + proto.RegisterMapType((map[string]*Nested)(nil), "proto3_proto.Message.TerrainEntry") proto.RegisterType((*Nested)(nil), "proto3_proto.Nested") proto.RegisterType((*MessageWithMap)(nil), "proto3_proto.MessageWithMap") + proto.RegisterMapType((map[bool][]byte)(nil), "proto3_proto.MessageWithMap.ByteMappingEntry") proto.RegisterType((*IntMap)(nil), "proto3_proto.IntMap") + proto.RegisterMapType((map[int32]int32)(nil), "proto3_proto.IntMap.RttEntry") proto.RegisterType((*IntMaps)(nil), "proto3_proto.IntMaps") proto.RegisterEnum("proto3_proto.Message_Humour", Message_Humour_name, Message_Humour_value) } -func init() { proto.RegisterFile("proto3_proto/proto3.proto", fileDescriptor0) } - -var fileDescriptor0 = []byte{ - // 733 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x84, 0x53, 0x6d, 0x6f, 0xf3, 0x34, - 0x14, 0x25, 0x4d, 0x5f, 0xd2, 0x9b, 0x74, 0x0b, 0x5e, 0x91, 0xbc, 0x02, 0x52, 0x28, 0x12, 0x8a, - 0x78, 0x49, 0xa1, 0xd3, 0xd0, 0x84, 0x10, 0x68, 0x1b, 0x9b, 0xa8, 0xd6, 0x95, 0xca, 0xdd, 0x98, - 0xf8, 0x14, 0xa5, 0xad, 0xdb, 0x46, 0x34, 0x4e, 0x49, 0x1c, 0xa4, 0xfc, 0x1d, 0xfe, 0x28, 0x8f, - 0x6c, 0xa7, 0x5d, 0x36, 0x65, 0xcf, 0xf3, 0x29, 0xf6, 0xf1, 0xb9, 0xf7, 0x9c, 0x1c, 0x5f, 0xc3, - 0xe9, 0x2e, 0x89, 0x79, 0x7c, 0xe6, 0xcb, 0xcf, 0x40, 0x6d, 0x3c, 0xf9, 0x41, 0x56, 0xf9, 0xa8, - 0x77, 0xba, 0x8e, 0xe3, 0xf5, 0x96, 0x2a, 0xca, 0x3c, 0x5b, 0x0d, 0x02, 0x96, 0x2b, 0x62, 0xef, - 0x84, 0xd3, 0x94, 0x2f, 0x03, 0x1e, 0x0c, 0xc4, 0x42, 0x81, 0xfd, 0xff, 0x5b, 0xd0, 0xba, 0xa7, - 0x69, 0x1a, 0xac, 0x29, 0x42, 0x50, 0x67, 0x41, 0x44, 0xb1, 0xe6, 0x68, 0x6e, 0x9b, 0xc8, 0x35, - 0xba, 0x00, 0x63, 0x13, 0x6e, 0x83, 0x24, 0xe4, 0x39, 0xae, 0x39, 0x9a, 0x7b, 0x34, 0xfc, 0xcc, - 0x2b, 0x0b, 0x7a, 0x45, 0xb1, 0xf7, 0x7b, 0x16, 0xc5, 0x59, 0x42, 0x0e, 0x6c, 0xe4, 0x80, 0xb5, - 0xa1, 0xe1, 0x7a, 0xc3, 0xfd, 0x90, 0xf9, 0x8b, 0x08, 0xeb, 0x8e, 0xe6, 0x76, 0x08, 0x28, 0x6c, - 0xc4, 0xae, 0x23, 0xa1, 0x27, 0xec, 0xe0, 0xba, 0xa3, 0xb9, 0x16, 0x91, 0x6b, 0xf4, 0x05, 0x58, - 0x09, 0x4d, 0xb3, 0x2d, 0xf7, 0x17, 0x71, 0xc6, 0x38, 0x6e, 0x39, 0x9a, 0xab, 0x13, 0x53, 0x61, - 0xd7, 0x02, 0x42, 0x5f, 0x42, 0x87, 0x27, 0x19, 0xf5, 0xd3, 0x45, 0xcc, 0xd3, 0x28, 0x60, 0xd8, - 0x70, 0x34, 0xd7, 0x20, 0x96, 0x00, 0x67, 0x05, 0x86, 0xba, 0xd0, 0x48, 0x17, 0x71, 0x42, 0x71, - 0xdb, 0xd1, 0xdc, 0x1a, 0x51, 0x1b, 0x64, 0x83, 0xfe, 0x37, 0xcd, 0x71, 0xc3, 0xd1, 0xdd, 0x3a, - 0x11, 0x4b, 0xf4, 0x29, 0xb4, 0xd3, 0x4d, 0x9c, 0x70, 0x5f, 0xe0, 0x27, 0x8e, 0xee, 0x36, 0x88, - 0x21, 0x81, 0x3b, 0x9a, 0xa3, 0x6f, 0xa1, 0xc9, 0x68, 0xca, 0xe9, 0x12, 0x37, 0x1d, 0xcd, 0x35, - 0x87, 0xdd, 0x97, 0xbf, 0x3e, 0x91, 0x67, 0xa4, 0xe0, 0xa0, 0x73, 0x68, 0x25, 0xfe, 0x2a, 0x63, - 0x2c, 0xc7, 0xb6, 0xa3, 0x7f, 0x30, 0xa9, 0x66, 0x72, 0x2b, 0xb8, 0xe8, 0x67, 0x68, 0x71, 0x9a, - 0x24, 0x41, 0xc8, 0x30, 0x38, 0xba, 0x6b, 0x0e, 0xfb, 0xd5, 0x65, 0x0f, 0x8a, 0x74, 0xc3, 0x78, - 0x92, 0x93, 0x7d, 0x09, 0xba, 0x00, 0x75, 0xff, 0x43, 0x7f, 0x15, 0xd2, 0xed, 0x12, 0x9b, 0xd2, - 0xe8, 0x27, 0xde, 0xfe, 0xae, 0xbd, 0x59, 0x36, 0xff, 0x8d, 0xae, 0x82, 0x6c, 0xcb, 0x53, 0x62, - 0x2a, 0xea, 0xad, 0x60, 0xa2, 0xd1, 0xa1, 0xf2, 0xdf, 0x60, 0x9b, 0x51, 0xdc, 0x91, 0xe2, 0x5f, - 0x55, 0x8b, 0x4f, 0x25, 0xf3, 0x4f, 0x41, 0x54, 0x06, 0x8a, 0x56, 0x12, 0x41, 0xdf, 0x83, 0x11, - 0xb0, 0x9c, 0x6f, 0x42, 0xb6, 0xc6, 0x47, 0x45, 0x52, 0x6a, 0x0e, 0xbd, 0xfd, 0x1c, 0x7a, 0x97, - 0x2c, 0x27, 0x07, 0x16, 0x3a, 0x07, 0x33, 0x0a, 0x58, 0xee, 0xcb, 0x5d, 0x8a, 0x8f, 0xa5, 0x76, - 0x75, 0x11, 0x08, 0xe2, 0x83, 0xe4, 0xa1, 0x73, 0x80, 0x34, 0x9b, 0x47, 0xca, 0x14, 0xfe, 0xb8, - 0xf8, 0xd7, 0x2a, 0xc7, 0xa4, 0x44, 0x44, 0x3f, 0x80, 0xb1, 0xd8, 0x84, 0xdb, 0x65, 0x42, 0x19, - 0x46, 0x52, 0xea, 0x8d, 0xa2, 0x03, 0xad, 0x37, 0x05, 0xab, 0x1c, 0xf8, 0x7e, 0x72, 0xd4, 0xd3, - 0x90, 0x93, 0xf3, 0x35, 0x34, 0x54, 0x70, 0xb5, 0xf7, 0xcc, 0x86, 0xa2, 0xfc, 0x54, 0xbb, 0xd0, - 0x7a, 0x8f, 0x60, 0xbf, 0x4e, 0xb1, 0xa2, 0xeb, 0x37, 0x2f, 0xbb, 0xbe, 0x71, 0x91, 0xcf, 0x6d, - 0xfb, 0xbf, 0x42, 0x53, 0x0d, 0x14, 0x32, 0xa1, 0xf5, 0x38, 0xb9, 0x9b, 0xfc, 0xf1, 0x34, 0xb1, - 0x3f, 0x42, 0x06, 0xd4, 0xa7, 0x8f, 0x93, 0x99, 0xad, 0xa1, 0x0e, 0xb4, 0x67, 0xe3, 0xcb, 0xe9, - 0xec, 0x61, 0x74, 0x7d, 0x67, 0xd7, 0xd0, 0x31, 0x98, 0x57, 0xa3, 0xf1, 0xd8, 0xbf, 0xba, 0x1c, - 0x8d, 0x6f, 0xfe, 0xb2, 0xf5, 0xfe, 0x10, 0x9a, 0xca, 0xac, 0x78, 0x33, 0x73, 0x39, 0xbe, 0xca, - 0x8f, 0xda, 0x88, 0x57, 0xba, 0xc8, 0xb8, 0x32, 0x64, 0x10, 0xb9, 0xee, 0xff, 0xa7, 0xc1, 0x51, - 0x91, 0xd9, 0x53, 0xc8, 0x37, 0xf7, 0xc1, 0x0e, 0x4d, 0xc1, 0x9a, 0xe7, 0x9c, 0xfa, 0x51, 0xb0, - 0xdb, 0x89, 0x39, 0xd0, 0x64, 0xce, 0xdf, 0x55, 0xe6, 0x5c, 0xd4, 0x78, 0x57, 0x39, 0xa7, 0xf7, - 0x8a, 0x5f, 0x4c, 0xd5, 0xfc, 0x19, 0xe9, 0xfd, 0x02, 0xf6, 0x6b, 0x42, 0x39, 0x30, 0x43, 0x05, - 0xd6, 0x2d, 0x07, 0x66, 0x95, 0x93, 0xf9, 0x07, 0x9a, 0x23, 0xc6, 0x85, 0xb7, 0x01, 0xe8, 0x09, - 0xe7, 0x85, 0xa5, 0xcf, 0x5f, 0x5a, 0x52, 0x14, 0x8f, 0x70, 0xae, 0x2c, 0x08, 0x66, 0xef, 0x47, - 0x30, 0xf6, 0x40, 0x59, 0xb2, 0x51, 0x21, 0xd9, 0x28, 0x4b, 0x9e, 0x41, 0x4b, 0xf5, 0x4b, 0x91, - 0x0b, 0xf5, 0x28, 0xd8, 0xa5, 0x85, 0x68, 0xb7, 0x4a, 0x94, 0x48, 0xc6, 0xbc, 0xa9, 0x8e, 0xde, - 0x05, 0x00, 0x00, 0xff, 0xff, 0x75, 0x38, 0xad, 0x84, 0xe4, 0x05, 0x00, 0x00, +func init() { proto.RegisterFile("proto3_proto/proto3.proto", fileDescriptor_proto3_e706e4ff19a5dbea) } + +var fileDescriptor_proto3_e706e4ff19a5dbea = []byte{ + // 774 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x94, 0x6f, 0x8f, 0xdb, 0x44, + 0x10, 0xc6, 0x71, 0x9c, 0x3f, 0xce, 0xd8, 0x77, 0x35, 0x4b, 0x2a, 0xb6, 0x01, 0x24, 0x13, 0x10, + 0xb2, 0x10, 0xf5, 0x41, 0xaa, 0x43, 0x55, 0x55, 0x81, 0xee, 0x8e, 0x56, 0x44, 0x77, 0x17, 0xa2, + 0xcd, 0x95, 0x13, 0xaf, 0xac, 0x4d, 0x6e, 0x93, 0x58, 0xc4, 0xeb, 0xe0, 0x5d, 0x23, 0xf9, 0x0b, + 0xf0, 0x41, 0xf8, 0xa4, 0x68, 0x77, 0x9d, 0xd4, 0xa9, 0x5c, 0xfa, 0x2a, 0xbb, 0x8f, 0x7f, 0x33, + 0xcf, 0x78, 0x66, 0x1c, 0x78, 0xb2, 0xcb, 0x33, 0x99, 0x3d, 0x8b, 0xf5, 0xcf, 0x99, 0xb9, 0x44, + 0xfa, 0x07, 0x79, 0xf5, 0x47, 0xc3, 0x27, 0xeb, 0x2c, 0x5b, 0x6f, 0x99, 0x41, 0x16, 0xc5, 0xea, + 0x8c, 0xf2, 0xd2, 0x80, 0xc3, 0xc7, 0x92, 0x09, 0x59, 0x65, 0x50, 0x47, 0x23, 0x8f, 0xfe, 0xe9, + 0x43, 0xef, 0x96, 0x09, 0x41, 0xd7, 0x0c, 0x21, 0x68, 0x73, 0x9a, 0x32, 0x6c, 0x05, 0x56, 0xd8, + 0x27, 0xfa, 0x8c, 0x9e, 0x83, 0xb3, 0x49, 0xb6, 0x34, 0x4f, 0x64, 0x89, 0x5b, 0x81, 0x15, 0x9e, + 0x8e, 0x3f, 0x8f, 0xea, 0x96, 0x51, 0x15, 0x1c, 0xfd, 0x5a, 0xa4, 0x59, 0x91, 0x93, 0x03, 0x8d, + 0x02, 0xf0, 0x36, 0x2c, 0x59, 0x6f, 0x64, 0x9c, 0xf0, 0x78, 0x99, 0x62, 0x3b, 0xb0, 0xc2, 0x13, + 0x02, 0x46, 0x9b, 0xf0, 0xab, 0x54, 0xf9, 0x3d, 0x50, 0x49, 0x71, 0x3b, 0xb0, 0x42, 0x8f, 0xe8, + 0x33, 0xfa, 0x12, 0xbc, 0x9c, 0x89, 0x62, 0x2b, 0xe3, 0x65, 0x56, 0x70, 0x89, 0x7b, 0x81, 0x15, + 0xda, 0xc4, 0x35, 0xda, 0x95, 0x92, 0xd0, 0x57, 0x70, 0x22, 0xf3, 0x82, 0xc5, 0x62, 0x99, 0x49, + 0x91, 0x52, 0x8e, 0x9d, 0xc0, 0x0a, 0x1d, 0xe2, 0x29, 0x71, 0x5e, 0x69, 0x68, 0x00, 0x1d, 0xb1, + 0xcc, 0x72, 0x86, 0xfb, 0x81, 0x15, 0xb6, 0x88, 0xb9, 0x20, 0x1f, 0xec, 0x3f, 0x59, 0x89, 0x3b, + 0x81, 0x1d, 0xb6, 0x89, 0x3a, 0xa2, 0xcf, 0xa0, 0x2f, 0x36, 0x59, 0x2e, 0x63, 0xa5, 0x7f, 0x12, + 0xd8, 0x61, 0x87, 0x38, 0x5a, 0xb8, 0x66, 0x25, 0xfa, 0x0e, 0xba, 0x9c, 0x09, 0xc9, 0x1e, 0x70, + 0x37, 0xb0, 0x42, 0x77, 0x3c, 0x38, 0x7e, 0xf5, 0xa9, 0x7e, 0x46, 0x2a, 0x06, 0x9d, 0x43, 0x2f, + 0x8f, 0x57, 0x05, 0xe7, 0x25, 0xf6, 0x03, 0xfb, 0x83, 0x9d, 0xea, 0xe6, 0xaf, 0x15, 0x8b, 0x5e, + 0x42, 0x4f, 0xb2, 0x3c, 0xa7, 0x09, 0xc7, 0x10, 0xd8, 0xa1, 0x3b, 0x1e, 0x35, 0x87, 0xdd, 0x19, + 0xe8, 0x15, 0x97, 0x79, 0x49, 0xf6, 0x21, 0xe8, 0x05, 0x98, 0x0d, 0x18, 0xc7, 0xab, 0x84, 0x6d, + 0x1f, 0xb0, 0xab, 0x0b, 0xfd, 0x34, 0x7a, 0x3b, 0xed, 0x68, 0x5e, 0x2c, 0x7e, 0x61, 0x2b, 0x5a, + 0x6c, 0xa5, 0x20, 0xae, 0x81, 0x5f, 0x2b, 0x16, 0x4d, 0x0e, 0xb1, 0x7f, 0xd3, 0x6d, 0xc1, 0xf0, + 0x89, 0xb6, 0xff, 0xa6, 0xd9, 0x7e, 0xa6, 0xc9, 0xdf, 0x15, 0x68, 0x4a, 0xa8, 0x52, 0x69, 0x05, + 0x7d, 0x0f, 0x0e, 0xe5, 0xa5, 0xdc, 0x24, 0x7c, 0x8d, 0x4f, 0xab, 0x5e, 0x99, 0x5d, 0x8c, 0xf6, + 0xbb, 0x18, 0x5d, 0xf0, 0x92, 0x1c, 0x28, 0x74, 0x0e, 0x6e, 0x4a, 0x79, 0x19, 0xeb, 0x9b, 0xc0, + 0x8f, 0xb4, 0x77, 0x73, 0x10, 0x28, 0xf0, 0x4e, 0x73, 0xe8, 0x1c, 0x40, 0x14, 0x8b, 0xd4, 0x14, + 0x85, 0x3f, 0xd6, 0x56, 0x8f, 0x1b, 0x2b, 0x26, 0x35, 0x10, 0xfd, 0x00, 0xce, 0x72, 0x93, 0x6c, + 0x1f, 0x72, 0xc6, 0x31, 0xd2, 0x56, 0xef, 0x09, 0x3a, 0x60, 0xe8, 0x0a, 0x40, 0xc8, 0x3c, 0xe1, + 0xeb, 0x38, 0xa5, 0x3b, 0x3c, 0xd0, 0x41, 0x5f, 0x37, 0xf7, 0x66, 0xae, 0xb9, 0x5b, 0xba, 0x33, + 0x9d, 0xe9, 0x8b, 0xfd, 0x7d, 0x38, 0x03, 0xaf, 0x3e, 0xb7, 0xfd, 0x02, 0x9a, 0x2f, 0x4c, 0x2f, + 0xe0, 0xb7, 0xd0, 0x31, 0xdd, 0x6f, 0xfd, 0xcf, 0x8a, 0x19, 0xe4, 0x45, 0xeb, 0xb9, 0x35, 0xbc, + 0x07, 0xff, 0xdd, 0x51, 0x34, 0x64, 0x7d, 0x7a, 0x9c, 0xf5, 0xbd, 0xfb, 0x50, 0x4b, 0xfc, 0x12, + 0x4e, 0x8f, 0xdf, 0xa3, 0x21, 0xed, 0xa0, 0x9e, 0xb6, 0x5f, 0x8b, 0x1e, 0xfd, 0x0c, 0x5d, 0xb3, + 0xd7, 0xc8, 0x85, 0xde, 0x9b, 0xe9, 0xf5, 0xf4, 0xb7, 0xfb, 0xa9, 0xff, 0x11, 0x72, 0xa0, 0x3d, + 0x7b, 0x33, 0x9d, 0xfb, 0x16, 0x3a, 0x81, 0xfe, 0xfc, 0xe6, 0x62, 0x36, 0xbf, 0x9b, 0x5c, 0x5d, + 0xfb, 0x2d, 0xf4, 0x08, 0xdc, 0xcb, 0xc9, 0xcd, 0x4d, 0x7c, 0x79, 0x31, 0xb9, 0x79, 0xf5, 0x87, + 0x6f, 0x8f, 0xc6, 0xd0, 0x35, 0x2f, 0xab, 0x4c, 0x16, 0xfa, 0x2b, 0x32, 0xc6, 0xe6, 0xa2, 0xfe, + 0x2c, 0x96, 0x85, 0x34, 0xce, 0x0e, 0xd1, 0xe7, 0xd1, 0xbf, 0x16, 0x9c, 0x56, 0x33, 0xb8, 0x4f, + 0xe4, 0xe6, 0x96, 0xee, 0xd0, 0x0c, 0xbc, 0x45, 0x29, 0x99, 0x9a, 0xd9, 0x4e, 0x2d, 0xa3, 0xa5, + 0xe7, 0xf6, 0xb4, 0x71, 0x6e, 0x55, 0x4c, 0x74, 0x59, 0x4a, 0x76, 0x6b, 0xf8, 0x6a, 0xb5, 0x17, + 0x6f, 0x95, 0xe1, 0x4f, 0xe0, 0xbf, 0x0b, 0xd4, 0x3b, 0xe3, 0x34, 0x74, 0xc6, 0xab, 0x77, 0xe6, + 0x2f, 0xe8, 0x4e, 0xb8, 0x54, 0xb5, 0x9d, 0x81, 0x9d, 0x4b, 0x59, 0x95, 0xf4, 0xc5, 0x71, 0x49, + 0x06, 0x89, 0x88, 0x94, 0xa6, 0x04, 0x45, 0x0e, 0x7f, 0x04, 0x67, 0x2f, 0xd4, 0x2d, 0x3b, 0x0d, + 0x96, 0x9d, 0xba, 0xe5, 0x33, 0xe8, 0x99, 0x7c, 0x02, 0x85, 0xd0, 0x4e, 0xe9, 0x4e, 0x54, 0xa6, + 0x83, 0x26, 0x53, 0xa2, 0x89, 0x45, 0xd7, 0x3c, 0xfa, 0x2f, 0x00, 0x00, 0xff, 0xff, 0x99, 0x24, + 0x6b, 0x12, 0x6d, 0x06, 0x00, 0x00, } diff --git a/vendor/github.com/golang/protobuf/proto/proto3_proto/proto3.proto b/vendor/github.com/golang/protobuf/proto/proto3_proto/proto3.proto index 204865571..c81fe1e5e 100644 --- a/vendor/github.com/golang/protobuf/proto/proto3_proto/proto3.proto +++ b/vendor/github.com/golang/protobuf/proto/proto3_proto/proto3.proto @@ -32,7 +32,7 @@ syntax = "proto3"; import "google/protobuf/any.proto"; -import "testdata/test.proto"; +import "test_proto/test.proto"; package proto3_proto; @@ -58,14 +58,16 @@ message Message { repeated Humour r_funny = 16; map terrain = 10; - testdata.SubDefaults proto2_field = 11; - map proto2_value = 13; + test_proto.SubDefaults proto2_field = 11; + map proto2_value = 13; google.protobuf.Any anything = 14; repeated google.protobuf.Any many_things = 15; Message submessage = 17; repeated Message children = 18; + + map string_map = 20; } message Nested { diff --git a/vendor/github.com/golang/protobuf/proto/table_marshal.go b/vendor/github.com/golang/protobuf/proto/table_marshal.go new file mode 100644 index 000000000..0f212b302 --- /dev/null +++ b/vendor/github.com/golang/protobuf/proto/table_marshal.go @@ -0,0 +1,2681 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2016 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package proto + +import ( + "errors" + "fmt" + "math" + "reflect" + "sort" + "strconv" + "strings" + "sync" + "sync/atomic" + "unicode/utf8" +) + +// a sizer takes a pointer to a field and the size of its tag, computes the size of +// the encoded data. +type sizer func(pointer, int) int + +// a marshaler takes a byte slice, a pointer to a field, and its tag (in wire format), +// marshals the field to the end of the slice, returns the slice and error (if any). +type marshaler func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) + +// marshalInfo is the information used for marshaling a message. +type marshalInfo struct { + typ reflect.Type + fields []*marshalFieldInfo + unrecognized field // offset of XXX_unrecognized + extensions field // offset of XXX_InternalExtensions + v1extensions field // offset of XXX_extensions + sizecache field // offset of XXX_sizecache + initialized int32 // 0 -- only typ is set, 1 -- fully initialized + messageset bool // uses message set wire format + hasmarshaler bool // has custom marshaler + sync.RWMutex // protect extElems map, also for initialization + extElems map[int32]*marshalElemInfo // info of extension elements +} + +// marshalFieldInfo is the information used for marshaling a field of a message. +type marshalFieldInfo struct { + field field + wiretag uint64 // tag in wire format + tagsize int // size of tag in wire format + sizer sizer + marshaler marshaler + isPointer bool + required bool // field is required + name string // name of the field, for error reporting + oneofElems map[reflect.Type]*marshalElemInfo // info of oneof elements +} + +// marshalElemInfo is the information used for marshaling an extension or oneof element. +type marshalElemInfo struct { + wiretag uint64 // tag in wire format + tagsize int // size of tag in wire format + sizer sizer + marshaler marshaler + isptr bool // elem is pointer typed, thus interface of this type is a direct interface (extension only) +} + +var ( + marshalInfoMap = map[reflect.Type]*marshalInfo{} + marshalInfoLock sync.Mutex +) + +// getMarshalInfo returns the information to marshal a given type of message. +// The info it returns may not necessarily initialized. +// t is the type of the message (NOT the pointer to it). +func getMarshalInfo(t reflect.Type) *marshalInfo { + marshalInfoLock.Lock() + u, ok := marshalInfoMap[t] + if !ok { + u = &marshalInfo{typ: t} + marshalInfoMap[t] = u + } + marshalInfoLock.Unlock() + return u +} + +// Size is the entry point from generated code, +// and should be ONLY called by generated code. +// It computes the size of encoded data of msg. +// a is a pointer to a place to store cached marshal info. +func (a *InternalMessageInfo) Size(msg Message) int { + u := getMessageMarshalInfo(msg, a) + ptr := toPointer(&msg) + if ptr.isNil() { + // We get here if msg is a typed nil ((*SomeMessage)(nil)), + // so it satisfies the interface, and msg == nil wouldn't + // catch it. We don't want crash in this case. + return 0 + } + return u.size(ptr) +} + +// Marshal is the entry point from generated code, +// and should be ONLY called by generated code. +// It marshals msg to the end of b. +// a is a pointer to a place to store cached marshal info. +func (a *InternalMessageInfo) Marshal(b []byte, msg Message, deterministic bool) ([]byte, error) { + u := getMessageMarshalInfo(msg, a) + ptr := toPointer(&msg) + if ptr.isNil() { + // We get here if msg is a typed nil ((*SomeMessage)(nil)), + // so it satisfies the interface, and msg == nil wouldn't + // catch it. We don't want crash in this case. + return b, ErrNil + } + return u.marshal(b, ptr, deterministic) +} + +func getMessageMarshalInfo(msg interface{}, a *InternalMessageInfo) *marshalInfo { + // u := a.marshal, but atomically. + // We use an atomic here to ensure memory consistency. + u := atomicLoadMarshalInfo(&a.marshal) + if u == nil { + // Get marshal information from type of message. + t := reflect.ValueOf(msg).Type() + if t.Kind() != reflect.Ptr { + panic(fmt.Sprintf("cannot handle non-pointer message type %v", t)) + } + u = getMarshalInfo(t.Elem()) + // Store it in the cache for later users. + // a.marshal = u, but atomically. + atomicStoreMarshalInfo(&a.marshal, u) + } + return u +} + +// size is the main function to compute the size of the encoded data of a message. +// ptr is the pointer to the message. +func (u *marshalInfo) size(ptr pointer) int { + if atomic.LoadInt32(&u.initialized) == 0 { + u.computeMarshalInfo() + } + + // If the message can marshal itself, let it do it, for compatibility. + // NOTE: This is not efficient. + if u.hasmarshaler { + m := ptr.asPointerTo(u.typ).Interface().(Marshaler) + b, _ := m.Marshal() + return len(b) + } + + n := 0 + for _, f := range u.fields { + if f.isPointer && ptr.offset(f.field).getPointer().isNil() { + // nil pointer always marshals to nothing + continue + } + n += f.sizer(ptr.offset(f.field), f.tagsize) + } + if u.extensions.IsValid() { + e := ptr.offset(u.extensions).toExtensions() + if u.messageset { + n += u.sizeMessageSet(e) + } else { + n += u.sizeExtensions(e) + } + } + if u.v1extensions.IsValid() { + m := *ptr.offset(u.v1extensions).toOldExtensions() + n += u.sizeV1Extensions(m) + } + if u.unrecognized.IsValid() { + s := *ptr.offset(u.unrecognized).toBytes() + n += len(s) + } + // cache the result for use in marshal + if u.sizecache.IsValid() { + atomic.StoreInt32(ptr.offset(u.sizecache).toInt32(), int32(n)) + } + return n +} + +// cachedsize gets the size from cache. If there is no cache (i.e. message is not generated), +// fall back to compute the size. +func (u *marshalInfo) cachedsize(ptr pointer) int { + if u.sizecache.IsValid() { + return int(atomic.LoadInt32(ptr.offset(u.sizecache).toInt32())) + } + return u.size(ptr) +} + +// marshal is the main function to marshal a message. It takes a byte slice and appends +// the encoded data to the end of the slice, returns the slice and error (if any). +// ptr is the pointer to the message. +// If deterministic is true, map is marshaled in deterministic order. +func (u *marshalInfo) marshal(b []byte, ptr pointer, deterministic bool) ([]byte, error) { + if atomic.LoadInt32(&u.initialized) == 0 { + u.computeMarshalInfo() + } + + // If the message can marshal itself, let it do it, for compatibility. + // NOTE: This is not efficient. + if u.hasmarshaler { + m := ptr.asPointerTo(u.typ).Interface().(Marshaler) + b1, err := m.Marshal() + b = append(b, b1...) + return b, err + } + + var err, errreq error + // The old marshaler encodes extensions at beginning. + if u.extensions.IsValid() { + e := ptr.offset(u.extensions).toExtensions() + if u.messageset { + b, err = u.appendMessageSet(b, e, deterministic) + } else { + b, err = u.appendExtensions(b, e, deterministic) + } + if err != nil { + return b, err + } + } + if u.v1extensions.IsValid() { + m := *ptr.offset(u.v1extensions).toOldExtensions() + b, err = u.appendV1Extensions(b, m, deterministic) + if err != nil { + return b, err + } + } + for _, f := range u.fields { + if f.required && errreq == nil { + if ptr.offset(f.field).getPointer().isNil() { + // Required field is not set. + // We record the error but keep going, to give a complete marshaling. + errreq = &RequiredNotSetError{f.name} + continue + } + } + if f.isPointer && ptr.offset(f.field).getPointer().isNil() { + // nil pointer always marshals to nothing + continue + } + b, err = f.marshaler(b, ptr.offset(f.field), f.wiretag, deterministic) + if err != nil { + if err1, ok := err.(*RequiredNotSetError); ok { + // Required field in submessage is not set. + // We record the error but keep going, to give a complete marshaling. + if errreq == nil { + errreq = &RequiredNotSetError{f.name + "." + err1.field} + } + continue + } + if err == errRepeatedHasNil { + err = errors.New("proto: repeated field " + f.name + " has nil element") + } + return b, err + } + } + if u.unrecognized.IsValid() { + s := *ptr.offset(u.unrecognized).toBytes() + b = append(b, s...) + } + return b, errreq +} + +// computeMarshalInfo initializes the marshal info. +func (u *marshalInfo) computeMarshalInfo() { + u.Lock() + defer u.Unlock() + if u.initialized != 0 { // non-atomic read is ok as it is protected by the lock + return + } + + t := u.typ + u.unrecognized = invalidField + u.extensions = invalidField + u.v1extensions = invalidField + u.sizecache = invalidField + + // If the message can marshal itself, let it do it, for compatibility. + // NOTE: This is not efficient. + if reflect.PtrTo(t).Implements(marshalerType) { + u.hasmarshaler = true + atomic.StoreInt32(&u.initialized, 1) + return + } + + // get oneof implementers + var oneofImplementers []interface{} + if m, ok := reflect.Zero(reflect.PtrTo(t)).Interface().(oneofMessage); ok { + _, _, _, oneofImplementers = m.XXX_OneofFuncs() + } + + n := t.NumField() + + // deal with XXX fields first + for i := 0; i < t.NumField(); i++ { + f := t.Field(i) + if !strings.HasPrefix(f.Name, "XXX_") { + continue + } + switch f.Name { + case "XXX_sizecache": + u.sizecache = toField(&f) + case "XXX_unrecognized": + u.unrecognized = toField(&f) + case "XXX_InternalExtensions": + u.extensions = toField(&f) + u.messageset = f.Tag.Get("protobuf_messageset") == "1" + case "XXX_extensions": + u.v1extensions = toField(&f) + case "XXX_NoUnkeyedLiteral": + // nothing to do + default: + panic("unknown XXX field: " + f.Name) + } + n-- + } + + // normal fields + fields := make([]marshalFieldInfo, n) // batch allocation + u.fields = make([]*marshalFieldInfo, 0, n) + for i, j := 0, 0; i < t.NumField(); i++ { + f := t.Field(i) + + if strings.HasPrefix(f.Name, "XXX_") { + continue + } + field := &fields[j] + j++ + field.name = f.Name + u.fields = append(u.fields, field) + if f.Tag.Get("protobuf_oneof") != "" { + field.computeOneofFieldInfo(&f, oneofImplementers) + continue + } + if f.Tag.Get("protobuf") == "" { + // field has no tag (not in generated message), ignore it + u.fields = u.fields[:len(u.fields)-1] + j-- + continue + } + field.computeMarshalFieldInfo(&f) + } + + // fields are marshaled in tag order on the wire. + sort.Sort(byTag(u.fields)) + + atomic.StoreInt32(&u.initialized, 1) +} + +// helper for sorting fields by tag +type byTag []*marshalFieldInfo + +func (a byTag) Len() int { return len(a) } +func (a byTag) Swap(i, j int) { a[i], a[j] = a[j], a[i] } +func (a byTag) Less(i, j int) bool { return a[i].wiretag < a[j].wiretag } + +// getExtElemInfo returns the information to marshal an extension element. +// The info it returns is initialized. +func (u *marshalInfo) getExtElemInfo(desc *ExtensionDesc) *marshalElemInfo { + // get from cache first + u.RLock() + e, ok := u.extElems[desc.Field] + u.RUnlock() + if ok { + return e + } + + t := reflect.TypeOf(desc.ExtensionType) // pointer or slice to basic type or struct + tags := strings.Split(desc.Tag, ",") + tag, err := strconv.Atoi(tags[1]) + if err != nil { + panic("tag is not an integer") + } + wt := wiretype(tags[0]) + sizer, marshaler := typeMarshaler(t, tags, false, false) + e = &marshalElemInfo{ + wiretag: uint64(tag)<<3 | wt, + tagsize: SizeVarint(uint64(tag) << 3), + sizer: sizer, + marshaler: marshaler, + isptr: t.Kind() == reflect.Ptr, + } + + // update cache + u.Lock() + if u.extElems == nil { + u.extElems = make(map[int32]*marshalElemInfo) + } + u.extElems[desc.Field] = e + u.Unlock() + return e +} + +// computeMarshalFieldInfo fills up the information to marshal a field. +func (fi *marshalFieldInfo) computeMarshalFieldInfo(f *reflect.StructField) { + // parse protobuf tag of the field. + // tag has format of "bytes,49,opt,name=foo,def=hello!" + tags := strings.Split(f.Tag.Get("protobuf"), ",") + if tags[0] == "" { + return + } + tag, err := strconv.Atoi(tags[1]) + if err != nil { + panic("tag is not an integer") + } + wt := wiretype(tags[0]) + if tags[2] == "req" { + fi.required = true + } + fi.setTag(f, tag, wt) + fi.setMarshaler(f, tags) +} + +func (fi *marshalFieldInfo) computeOneofFieldInfo(f *reflect.StructField, oneofImplementers []interface{}) { + fi.field = toField(f) + fi.wiretag = 1<<31 - 1 // Use a large tag number, make oneofs sorted at the end. This tag will not appear on the wire. + fi.isPointer = true + fi.sizer, fi.marshaler = makeOneOfMarshaler(fi, f) + fi.oneofElems = make(map[reflect.Type]*marshalElemInfo) + + ityp := f.Type // interface type + for _, o := range oneofImplementers { + t := reflect.TypeOf(o) + if !t.Implements(ityp) { + continue + } + sf := t.Elem().Field(0) // oneof implementer is a struct with a single field + tags := strings.Split(sf.Tag.Get("protobuf"), ",") + tag, err := strconv.Atoi(tags[1]) + if err != nil { + panic("tag is not an integer") + } + wt := wiretype(tags[0]) + sizer, marshaler := typeMarshaler(sf.Type, tags, false, true) // oneof should not omit any zero value + fi.oneofElems[t.Elem()] = &marshalElemInfo{ + wiretag: uint64(tag)<<3 | wt, + tagsize: SizeVarint(uint64(tag) << 3), + sizer: sizer, + marshaler: marshaler, + } + } +} + +type oneofMessage interface { + XXX_OneofFuncs() (func(Message, *Buffer) error, func(Message, int, int, *Buffer) (bool, error), func(Message) int, []interface{}) +} + +// wiretype returns the wire encoding of the type. +func wiretype(encoding string) uint64 { + switch encoding { + case "fixed32": + return WireFixed32 + case "fixed64": + return WireFixed64 + case "varint", "zigzag32", "zigzag64": + return WireVarint + case "bytes": + return WireBytes + case "group": + return WireStartGroup + } + panic("unknown wire type " + encoding) +} + +// setTag fills up the tag (in wire format) and its size in the info of a field. +func (fi *marshalFieldInfo) setTag(f *reflect.StructField, tag int, wt uint64) { + fi.field = toField(f) + fi.wiretag = uint64(tag)<<3 | wt + fi.tagsize = SizeVarint(uint64(tag) << 3) +} + +// setMarshaler fills up the sizer and marshaler in the info of a field. +func (fi *marshalFieldInfo) setMarshaler(f *reflect.StructField, tags []string) { + switch f.Type.Kind() { + case reflect.Map: + // map field + fi.isPointer = true + fi.sizer, fi.marshaler = makeMapMarshaler(f) + return + case reflect.Ptr, reflect.Slice: + fi.isPointer = true + } + fi.sizer, fi.marshaler = typeMarshaler(f.Type, tags, true, false) +} + +// typeMarshaler returns the sizer and marshaler of a given field. +// t is the type of the field. +// tags is the generated "protobuf" tag of the field. +// If nozero is true, zero value is not marshaled to the wire. +// If oneof is true, it is a oneof field. +func typeMarshaler(t reflect.Type, tags []string, nozero, oneof bool) (sizer, marshaler) { + encoding := tags[0] + + pointer := false + slice := false + if t.Kind() == reflect.Slice && t.Elem().Kind() != reflect.Uint8 { + slice = true + t = t.Elem() + } + if t.Kind() == reflect.Ptr { + pointer = true + t = t.Elem() + } + + packed := false + proto3 := false + for i := 2; i < len(tags); i++ { + if tags[i] == "packed" { + packed = true + } + if tags[i] == "proto3" { + proto3 = true + } + } + + switch t.Kind() { + case reflect.Bool: + if pointer { + return sizeBoolPtr, appendBoolPtr + } + if slice { + if packed { + return sizeBoolPackedSlice, appendBoolPackedSlice + } + return sizeBoolSlice, appendBoolSlice + } + if nozero { + return sizeBoolValueNoZero, appendBoolValueNoZero + } + return sizeBoolValue, appendBoolValue + case reflect.Uint32: + switch encoding { + case "fixed32": + if pointer { + return sizeFixed32Ptr, appendFixed32Ptr + } + if slice { + if packed { + return sizeFixed32PackedSlice, appendFixed32PackedSlice + } + return sizeFixed32Slice, appendFixed32Slice + } + if nozero { + return sizeFixed32ValueNoZero, appendFixed32ValueNoZero + } + return sizeFixed32Value, appendFixed32Value + case "varint": + if pointer { + return sizeVarint32Ptr, appendVarint32Ptr + } + if slice { + if packed { + return sizeVarint32PackedSlice, appendVarint32PackedSlice + } + return sizeVarint32Slice, appendVarint32Slice + } + if nozero { + return sizeVarint32ValueNoZero, appendVarint32ValueNoZero + } + return sizeVarint32Value, appendVarint32Value + } + case reflect.Int32: + switch encoding { + case "fixed32": + if pointer { + return sizeFixedS32Ptr, appendFixedS32Ptr + } + if slice { + if packed { + return sizeFixedS32PackedSlice, appendFixedS32PackedSlice + } + return sizeFixedS32Slice, appendFixedS32Slice + } + if nozero { + return sizeFixedS32ValueNoZero, appendFixedS32ValueNoZero + } + return sizeFixedS32Value, appendFixedS32Value + case "varint": + if pointer { + return sizeVarintS32Ptr, appendVarintS32Ptr + } + if slice { + if packed { + return sizeVarintS32PackedSlice, appendVarintS32PackedSlice + } + return sizeVarintS32Slice, appendVarintS32Slice + } + if nozero { + return sizeVarintS32ValueNoZero, appendVarintS32ValueNoZero + } + return sizeVarintS32Value, appendVarintS32Value + case "zigzag32": + if pointer { + return sizeZigzag32Ptr, appendZigzag32Ptr + } + if slice { + if packed { + return sizeZigzag32PackedSlice, appendZigzag32PackedSlice + } + return sizeZigzag32Slice, appendZigzag32Slice + } + if nozero { + return sizeZigzag32ValueNoZero, appendZigzag32ValueNoZero + } + return sizeZigzag32Value, appendZigzag32Value + } + case reflect.Uint64: + switch encoding { + case "fixed64": + if pointer { + return sizeFixed64Ptr, appendFixed64Ptr + } + if slice { + if packed { + return sizeFixed64PackedSlice, appendFixed64PackedSlice + } + return sizeFixed64Slice, appendFixed64Slice + } + if nozero { + return sizeFixed64ValueNoZero, appendFixed64ValueNoZero + } + return sizeFixed64Value, appendFixed64Value + case "varint": + if pointer { + return sizeVarint64Ptr, appendVarint64Ptr + } + if slice { + if packed { + return sizeVarint64PackedSlice, appendVarint64PackedSlice + } + return sizeVarint64Slice, appendVarint64Slice + } + if nozero { + return sizeVarint64ValueNoZero, appendVarint64ValueNoZero + } + return sizeVarint64Value, appendVarint64Value + } + case reflect.Int64: + switch encoding { + case "fixed64": + if pointer { + return sizeFixedS64Ptr, appendFixedS64Ptr + } + if slice { + if packed { + return sizeFixedS64PackedSlice, appendFixedS64PackedSlice + } + return sizeFixedS64Slice, appendFixedS64Slice + } + if nozero { + return sizeFixedS64ValueNoZero, appendFixedS64ValueNoZero + } + return sizeFixedS64Value, appendFixedS64Value + case "varint": + if pointer { + return sizeVarintS64Ptr, appendVarintS64Ptr + } + if slice { + if packed { + return sizeVarintS64PackedSlice, appendVarintS64PackedSlice + } + return sizeVarintS64Slice, appendVarintS64Slice + } + if nozero { + return sizeVarintS64ValueNoZero, appendVarintS64ValueNoZero + } + return sizeVarintS64Value, appendVarintS64Value + case "zigzag64": + if pointer { + return sizeZigzag64Ptr, appendZigzag64Ptr + } + if slice { + if packed { + return sizeZigzag64PackedSlice, appendZigzag64PackedSlice + } + return sizeZigzag64Slice, appendZigzag64Slice + } + if nozero { + return sizeZigzag64ValueNoZero, appendZigzag64ValueNoZero + } + return sizeZigzag64Value, appendZigzag64Value + } + case reflect.Float32: + if pointer { + return sizeFloat32Ptr, appendFloat32Ptr + } + if slice { + if packed { + return sizeFloat32PackedSlice, appendFloat32PackedSlice + } + return sizeFloat32Slice, appendFloat32Slice + } + if nozero { + return sizeFloat32ValueNoZero, appendFloat32ValueNoZero + } + return sizeFloat32Value, appendFloat32Value + case reflect.Float64: + if pointer { + return sizeFloat64Ptr, appendFloat64Ptr + } + if slice { + if packed { + return sizeFloat64PackedSlice, appendFloat64PackedSlice + } + return sizeFloat64Slice, appendFloat64Slice + } + if nozero { + return sizeFloat64ValueNoZero, appendFloat64ValueNoZero + } + return sizeFloat64Value, appendFloat64Value + case reflect.String: + if pointer { + return sizeStringPtr, appendStringPtr + } + if slice { + return sizeStringSlice, appendStringSlice + } + if nozero { + return sizeStringValueNoZero, appendStringValueNoZero + } + return sizeStringValue, appendStringValue + case reflect.Slice: + if slice { + return sizeBytesSlice, appendBytesSlice + } + if oneof { + // Oneof bytes field may also have "proto3" tag. + // We want to marshal it as a oneof field. Do this + // check before the proto3 check. + return sizeBytesOneof, appendBytesOneof + } + if proto3 { + return sizeBytes3, appendBytes3 + } + return sizeBytes, appendBytes + case reflect.Struct: + switch encoding { + case "group": + if slice { + return makeGroupSliceMarshaler(getMarshalInfo(t)) + } + return makeGroupMarshaler(getMarshalInfo(t)) + case "bytes": + if slice { + return makeMessageSliceMarshaler(getMarshalInfo(t)) + } + return makeMessageMarshaler(getMarshalInfo(t)) + } + } + panic(fmt.Sprintf("unknown or mismatched type: type: %v, wire type: %v", t, encoding)) +} + +// Below are functions to size/marshal a specific type of a field. +// They are stored in the field's info, and called by function pointers. +// They have type sizer or marshaler. + +func sizeFixed32Value(_ pointer, tagsize int) int { + return 4 + tagsize +} +func sizeFixed32ValueNoZero(ptr pointer, tagsize int) int { + v := *ptr.toUint32() + if v == 0 { + return 0 + } + return 4 + tagsize +} +func sizeFixed32Ptr(ptr pointer, tagsize int) int { + p := *ptr.toUint32Ptr() + if p == nil { + return 0 + } + return 4 + tagsize +} +func sizeFixed32Slice(ptr pointer, tagsize int) int { + s := *ptr.toUint32Slice() + return (4 + tagsize) * len(s) +} +func sizeFixed32PackedSlice(ptr pointer, tagsize int) int { + s := *ptr.toUint32Slice() + if len(s) == 0 { + return 0 + } + return 4*len(s) + SizeVarint(uint64(4*len(s))) + tagsize +} +func sizeFixedS32Value(_ pointer, tagsize int) int { + return 4 + tagsize +} +func sizeFixedS32ValueNoZero(ptr pointer, tagsize int) int { + v := *ptr.toInt32() + if v == 0 { + return 0 + } + return 4 + tagsize +} +func sizeFixedS32Ptr(ptr pointer, tagsize int) int { + p := ptr.getInt32Ptr() + if p == nil { + return 0 + } + return 4 + tagsize +} +func sizeFixedS32Slice(ptr pointer, tagsize int) int { + s := ptr.getInt32Slice() + return (4 + tagsize) * len(s) +} +func sizeFixedS32PackedSlice(ptr pointer, tagsize int) int { + s := ptr.getInt32Slice() + if len(s) == 0 { + return 0 + } + return 4*len(s) + SizeVarint(uint64(4*len(s))) + tagsize +} +func sizeFloat32Value(_ pointer, tagsize int) int { + return 4 + tagsize +} +func sizeFloat32ValueNoZero(ptr pointer, tagsize int) int { + v := math.Float32bits(*ptr.toFloat32()) + if v == 0 { + return 0 + } + return 4 + tagsize +} +func sizeFloat32Ptr(ptr pointer, tagsize int) int { + p := *ptr.toFloat32Ptr() + if p == nil { + return 0 + } + return 4 + tagsize +} +func sizeFloat32Slice(ptr pointer, tagsize int) int { + s := *ptr.toFloat32Slice() + return (4 + tagsize) * len(s) +} +func sizeFloat32PackedSlice(ptr pointer, tagsize int) int { + s := *ptr.toFloat32Slice() + if len(s) == 0 { + return 0 + } + return 4*len(s) + SizeVarint(uint64(4*len(s))) + tagsize +} +func sizeFixed64Value(_ pointer, tagsize int) int { + return 8 + tagsize +} +func sizeFixed64ValueNoZero(ptr pointer, tagsize int) int { + v := *ptr.toUint64() + if v == 0 { + return 0 + } + return 8 + tagsize +} +func sizeFixed64Ptr(ptr pointer, tagsize int) int { + p := *ptr.toUint64Ptr() + if p == nil { + return 0 + } + return 8 + tagsize +} +func sizeFixed64Slice(ptr pointer, tagsize int) int { + s := *ptr.toUint64Slice() + return (8 + tagsize) * len(s) +} +func sizeFixed64PackedSlice(ptr pointer, tagsize int) int { + s := *ptr.toUint64Slice() + if len(s) == 0 { + return 0 + } + return 8*len(s) + SizeVarint(uint64(8*len(s))) + tagsize +} +func sizeFixedS64Value(_ pointer, tagsize int) int { + return 8 + tagsize +} +func sizeFixedS64ValueNoZero(ptr pointer, tagsize int) int { + v := *ptr.toInt64() + if v == 0 { + return 0 + } + return 8 + tagsize +} +func sizeFixedS64Ptr(ptr pointer, tagsize int) int { + p := *ptr.toInt64Ptr() + if p == nil { + return 0 + } + return 8 + tagsize +} +func sizeFixedS64Slice(ptr pointer, tagsize int) int { + s := *ptr.toInt64Slice() + return (8 + tagsize) * len(s) +} +func sizeFixedS64PackedSlice(ptr pointer, tagsize int) int { + s := *ptr.toInt64Slice() + if len(s) == 0 { + return 0 + } + return 8*len(s) + SizeVarint(uint64(8*len(s))) + tagsize +} +func sizeFloat64Value(_ pointer, tagsize int) int { + return 8 + tagsize +} +func sizeFloat64ValueNoZero(ptr pointer, tagsize int) int { + v := math.Float64bits(*ptr.toFloat64()) + if v == 0 { + return 0 + } + return 8 + tagsize +} +func sizeFloat64Ptr(ptr pointer, tagsize int) int { + p := *ptr.toFloat64Ptr() + if p == nil { + return 0 + } + return 8 + tagsize +} +func sizeFloat64Slice(ptr pointer, tagsize int) int { + s := *ptr.toFloat64Slice() + return (8 + tagsize) * len(s) +} +func sizeFloat64PackedSlice(ptr pointer, tagsize int) int { + s := *ptr.toFloat64Slice() + if len(s) == 0 { + return 0 + } + return 8*len(s) + SizeVarint(uint64(8*len(s))) + tagsize +} +func sizeVarint32Value(ptr pointer, tagsize int) int { + v := *ptr.toUint32() + return SizeVarint(uint64(v)) + tagsize +} +func sizeVarint32ValueNoZero(ptr pointer, tagsize int) int { + v := *ptr.toUint32() + if v == 0 { + return 0 + } + return SizeVarint(uint64(v)) + tagsize +} +func sizeVarint32Ptr(ptr pointer, tagsize int) int { + p := *ptr.toUint32Ptr() + if p == nil { + return 0 + } + return SizeVarint(uint64(*p)) + tagsize +} +func sizeVarint32Slice(ptr pointer, tagsize int) int { + s := *ptr.toUint32Slice() + n := 0 + for _, v := range s { + n += SizeVarint(uint64(v)) + tagsize + } + return n +} +func sizeVarint32PackedSlice(ptr pointer, tagsize int) int { + s := *ptr.toUint32Slice() + if len(s) == 0 { + return 0 + } + n := 0 + for _, v := range s { + n += SizeVarint(uint64(v)) + } + return n + SizeVarint(uint64(n)) + tagsize +} +func sizeVarintS32Value(ptr pointer, tagsize int) int { + v := *ptr.toInt32() + return SizeVarint(uint64(v)) + tagsize +} +func sizeVarintS32ValueNoZero(ptr pointer, tagsize int) int { + v := *ptr.toInt32() + if v == 0 { + return 0 + } + return SizeVarint(uint64(v)) + tagsize +} +func sizeVarintS32Ptr(ptr pointer, tagsize int) int { + p := ptr.getInt32Ptr() + if p == nil { + return 0 + } + return SizeVarint(uint64(*p)) + tagsize +} +func sizeVarintS32Slice(ptr pointer, tagsize int) int { + s := ptr.getInt32Slice() + n := 0 + for _, v := range s { + n += SizeVarint(uint64(v)) + tagsize + } + return n +} +func sizeVarintS32PackedSlice(ptr pointer, tagsize int) int { + s := ptr.getInt32Slice() + if len(s) == 0 { + return 0 + } + n := 0 + for _, v := range s { + n += SizeVarint(uint64(v)) + } + return n + SizeVarint(uint64(n)) + tagsize +} +func sizeVarint64Value(ptr pointer, tagsize int) int { + v := *ptr.toUint64() + return SizeVarint(v) + tagsize +} +func sizeVarint64ValueNoZero(ptr pointer, tagsize int) int { + v := *ptr.toUint64() + if v == 0 { + return 0 + } + return SizeVarint(v) + tagsize +} +func sizeVarint64Ptr(ptr pointer, tagsize int) int { + p := *ptr.toUint64Ptr() + if p == nil { + return 0 + } + return SizeVarint(*p) + tagsize +} +func sizeVarint64Slice(ptr pointer, tagsize int) int { + s := *ptr.toUint64Slice() + n := 0 + for _, v := range s { + n += SizeVarint(v) + tagsize + } + return n +} +func sizeVarint64PackedSlice(ptr pointer, tagsize int) int { + s := *ptr.toUint64Slice() + if len(s) == 0 { + return 0 + } + n := 0 + for _, v := range s { + n += SizeVarint(v) + } + return n + SizeVarint(uint64(n)) + tagsize +} +func sizeVarintS64Value(ptr pointer, tagsize int) int { + v := *ptr.toInt64() + return SizeVarint(uint64(v)) + tagsize +} +func sizeVarintS64ValueNoZero(ptr pointer, tagsize int) int { + v := *ptr.toInt64() + if v == 0 { + return 0 + } + return SizeVarint(uint64(v)) + tagsize +} +func sizeVarintS64Ptr(ptr pointer, tagsize int) int { + p := *ptr.toInt64Ptr() + if p == nil { + return 0 + } + return SizeVarint(uint64(*p)) + tagsize +} +func sizeVarintS64Slice(ptr pointer, tagsize int) int { + s := *ptr.toInt64Slice() + n := 0 + for _, v := range s { + n += SizeVarint(uint64(v)) + tagsize + } + return n +} +func sizeVarintS64PackedSlice(ptr pointer, tagsize int) int { + s := *ptr.toInt64Slice() + if len(s) == 0 { + return 0 + } + n := 0 + for _, v := range s { + n += SizeVarint(uint64(v)) + } + return n + SizeVarint(uint64(n)) + tagsize +} +func sizeZigzag32Value(ptr pointer, tagsize int) int { + v := *ptr.toInt32() + return SizeVarint(uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) + tagsize +} +func sizeZigzag32ValueNoZero(ptr pointer, tagsize int) int { + v := *ptr.toInt32() + if v == 0 { + return 0 + } + return SizeVarint(uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) + tagsize +} +func sizeZigzag32Ptr(ptr pointer, tagsize int) int { + p := ptr.getInt32Ptr() + if p == nil { + return 0 + } + v := *p + return SizeVarint(uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) + tagsize +} +func sizeZigzag32Slice(ptr pointer, tagsize int) int { + s := ptr.getInt32Slice() + n := 0 + for _, v := range s { + n += SizeVarint(uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) + tagsize + } + return n +} +func sizeZigzag32PackedSlice(ptr pointer, tagsize int) int { + s := ptr.getInt32Slice() + if len(s) == 0 { + return 0 + } + n := 0 + for _, v := range s { + n += SizeVarint(uint64((uint32(v) << 1) ^ uint32((int32(v) >> 31)))) + } + return n + SizeVarint(uint64(n)) + tagsize +} +func sizeZigzag64Value(ptr pointer, tagsize int) int { + v := *ptr.toInt64() + return SizeVarint(uint64(v<<1)^uint64((int64(v)>>63))) + tagsize +} +func sizeZigzag64ValueNoZero(ptr pointer, tagsize int) int { + v := *ptr.toInt64() + if v == 0 { + return 0 + } + return SizeVarint(uint64(v<<1)^uint64((int64(v)>>63))) + tagsize +} +func sizeZigzag64Ptr(ptr pointer, tagsize int) int { + p := *ptr.toInt64Ptr() + if p == nil { + return 0 + } + v := *p + return SizeVarint(uint64(v<<1)^uint64((int64(v)>>63))) + tagsize +} +func sizeZigzag64Slice(ptr pointer, tagsize int) int { + s := *ptr.toInt64Slice() + n := 0 + for _, v := range s { + n += SizeVarint(uint64(v<<1)^uint64((int64(v)>>63))) + tagsize + } + return n +} +func sizeZigzag64PackedSlice(ptr pointer, tagsize int) int { + s := *ptr.toInt64Slice() + if len(s) == 0 { + return 0 + } + n := 0 + for _, v := range s { + n += SizeVarint(uint64(v<<1) ^ uint64((int64(v) >> 63))) + } + return n + SizeVarint(uint64(n)) + tagsize +} +func sizeBoolValue(_ pointer, tagsize int) int { + return 1 + tagsize +} +func sizeBoolValueNoZero(ptr pointer, tagsize int) int { + v := *ptr.toBool() + if !v { + return 0 + } + return 1 + tagsize +} +func sizeBoolPtr(ptr pointer, tagsize int) int { + p := *ptr.toBoolPtr() + if p == nil { + return 0 + } + return 1 + tagsize +} +func sizeBoolSlice(ptr pointer, tagsize int) int { + s := *ptr.toBoolSlice() + return (1 + tagsize) * len(s) +} +func sizeBoolPackedSlice(ptr pointer, tagsize int) int { + s := *ptr.toBoolSlice() + if len(s) == 0 { + return 0 + } + return len(s) + SizeVarint(uint64(len(s))) + tagsize +} +func sizeStringValue(ptr pointer, tagsize int) int { + v := *ptr.toString() + return len(v) + SizeVarint(uint64(len(v))) + tagsize +} +func sizeStringValueNoZero(ptr pointer, tagsize int) int { + v := *ptr.toString() + if v == "" { + return 0 + } + return len(v) + SizeVarint(uint64(len(v))) + tagsize +} +func sizeStringPtr(ptr pointer, tagsize int) int { + p := *ptr.toStringPtr() + if p == nil { + return 0 + } + v := *p + return len(v) + SizeVarint(uint64(len(v))) + tagsize +} +func sizeStringSlice(ptr pointer, tagsize int) int { + s := *ptr.toStringSlice() + n := 0 + for _, v := range s { + n += len(v) + SizeVarint(uint64(len(v))) + tagsize + } + return n +} +func sizeBytes(ptr pointer, tagsize int) int { + v := *ptr.toBytes() + if v == nil { + return 0 + } + return len(v) + SizeVarint(uint64(len(v))) + tagsize +} +func sizeBytes3(ptr pointer, tagsize int) int { + v := *ptr.toBytes() + if len(v) == 0 { + return 0 + } + return len(v) + SizeVarint(uint64(len(v))) + tagsize +} +func sizeBytesOneof(ptr pointer, tagsize int) int { + v := *ptr.toBytes() + return len(v) + SizeVarint(uint64(len(v))) + tagsize +} +func sizeBytesSlice(ptr pointer, tagsize int) int { + s := *ptr.toBytesSlice() + n := 0 + for _, v := range s { + n += len(v) + SizeVarint(uint64(len(v))) + tagsize + } + return n +} + +// appendFixed32 appends an encoded fixed32 to b. +func appendFixed32(b []byte, v uint32) []byte { + b = append(b, + byte(v), + byte(v>>8), + byte(v>>16), + byte(v>>24)) + return b +} + +// appendFixed64 appends an encoded fixed64 to b. +func appendFixed64(b []byte, v uint64) []byte { + b = append(b, + byte(v), + byte(v>>8), + byte(v>>16), + byte(v>>24), + byte(v>>32), + byte(v>>40), + byte(v>>48), + byte(v>>56)) + return b +} + +// appendVarint appends an encoded varint to b. +func appendVarint(b []byte, v uint64) []byte { + // TODO: make 1-byte (maybe 2-byte) case inline-able, once we + // have non-leaf inliner. + switch { + case v < 1<<7: + b = append(b, byte(v)) + case v < 1<<14: + b = append(b, + byte(v&0x7f|0x80), + byte(v>>7)) + case v < 1<<21: + b = append(b, + byte(v&0x7f|0x80), + byte((v>>7)&0x7f|0x80), + byte(v>>14)) + case v < 1<<28: + b = append(b, + byte(v&0x7f|0x80), + byte((v>>7)&0x7f|0x80), + byte((v>>14)&0x7f|0x80), + byte(v>>21)) + case v < 1<<35: + b = append(b, + byte(v&0x7f|0x80), + byte((v>>7)&0x7f|0x80), + byte((v>>14)&0x7f|0x80), + byte((v>>21)&0x7f|0x80), + byte(v>>28)) + case v < 1<<42: + b = append(b, + byte(v&0x7f|0x80), + byte((v>>7)&0x7f|0x80), + byte((v>>14)&0x7f|0x80), + byte((v>>21)&0x7f|0x80), + byte((v>>28)&0x7f|0x80), + byte(v>>35)) + case v < 1<<49: + b = append(b, + byte(v&0x7f|0x80), + byte((v>>7)&0x7f|0x80), + byte((v>>14)&0x7f|0x80), + byte((v>>21)&0x7f|0x80), + byte((v>>28)&0x7f|0x80), + byte((v>>35)&0x7f|0x80), + byte(v>>42)) + case v < 1<<56: + b = append(b, + byte(v&0x7f|0x80), + byte((v>>7)&0x7f|0x80), + byte((v>>14)&0x7f|0x80), + byte((v>>21)&0x7f|0x80), + byte((v>>28)&0x7f|0x80), + byte((v>>35)&0x7f|0x80), + byte((v>>42)&0x7f|0x80), + byte(v>>49)) + case v < 1<<63: + b = append(b, + byte(v&0x7f|0x80), + byte((v>>7)&0x7f|0x80), + byte((v>>14)&0x7f|0x80), + byte((v>>21)&0x7f|0x80), + byte((v>>28)&0x7f|0x80), + byte((v>>35)&0x7f|0x80), + byte((v>>42)&0x7f|0x80), + byte((v>>49)&0x7f|0x80), + byte(v>>56)) + default: + b = append(b, + byte(v&0x7f|0x80), + byte((v>>7)&0x7f|0x80), + byte((v>>14)&0x7f|0x80), + byte((v>>21)&0x7f|0x80), + byte((v>>28)&0x7f|0x80), + byte((v>>35)&0x7f|0x80), + byte((v>>42)&0x7f|0x80), + byte((v>>49)&0x7f|0x80), + byte((v>>56)&0x7f|0x80), + 1) + } + return b +} + +func appendFixed32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toUint32() + b = appendVarint(b, wiretag) + b = appendFixed32(b, v) + return b, nil +} +func appendFixed32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toUint32() + if v == 0 { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendFixed32(b, v) + return b, nil +} +func appendFixed32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + p := *ptr.toUint32Ptr() + if p == nil { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendFixed32(b, *p) + return b, nil +} +func appendFixed32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toUint32Slice() + for _, v := range s { + b = appendVarint(b, wiretag) + b = appendFixed32(b, v) + } + return b, nil +} +func appendFixed32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toUint32Slice() + if len(s) == 0 { + return b, nil + } + b = appendVarint(b, wiretag&^7|WireBytes) + b = appendVarint(b, uint64(4*len(s))) + for _, v := range s { + b = appendFixed32(b, v) + } + return b, nil +} +func appendFixedS32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toInt32() + b = appendVarint(b, wiretag) + b = appendFixed32(b, uint32(v)) + return b, nil +} +func appendFixedS32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toInt32() + if v == 0 { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendFixed32(b, uint32(v)) + return b, nil +} +func appendFixedS32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + p := ptr.getInt32Ptr() + if p == nil { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendFixed32(b, uint32(*p)) + return b, nil +} +func appendFixedS32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := ptr.getInt32Slice() + for _, v := range s { + b = appendVarint(b, wiretag) + b = appendFixed32(b, uint32(v)) + } + return b, nil +} +func appendFixedS32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := ptr.getInt32Slice() + if len(s) == 0 { + return b, nil + } + b = appendVarint(b, wiretag&^7|WireBytes) + b = appendVarint(b, uint64(4*len(s))) + for _, v := range s { + b = appendFixed32(b, uint32(v)) + } + return b, nil +} +func appendFloat32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := math.Float32bits(*ptr.toFloat32()) + b = appendVarint(b, wiretag) + b = appendFixed32(b, v) + return b, nil +} +func appendFloat32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := math.Float32bits(*ptr.toFloat32()) + if v == 0 { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendFixed32(b, v) + return b, nil +} +func appendFloat32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + p := *ptr.toFloat32Ptr() + if p == nil { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendFixed32(b, math.Float32bits(*p)) + return b, nil +} +func appendFloat32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toFloat32Slice() + for _, v := range s { + b = appendVarint(b, wiretag) + b = appendFixed32(b, math.Float32bits(v)) + } + return b, nil +} +func appendFloat32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toFloat32Slice() + if len(s) == 0 { + return b, nil + } + b = appendVarint(b, wiretag&^7|WireBytes) + b = appendVarint(b, uint64(4*len(s))) + for _, v := range s { + b = appendFixed32(b, math.Float32bits(v)) + } + return b, nil +} +func appendFixed64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toUint64() + b = appendVarint(b, wiretag) + b = appendFixed64(b, v) + return b, nil +} +func appendFixed64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toUint64() + if v == 0 { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendFixed64(b, v) + return b, nil +} +func appendFixed64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + p := *ptr.toUint64Ptr() + if p == nil { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendFixed64(b, *p) + return b, nil +} +func appendFixed64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toUint64Slice() + for _, v := range s { + b = appendVarint(b, wiretag) + b = appendFixed64(b, v) + } + return b, nil +} +func appendFixed64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toUint64Slice() + if len(s) == 0 { + return b, nil + } + b = appendVarint(b, wiretag&^7|WireBytes) + b = appendVarint(b, uint64(8*len(s))) + for _, v := range s { + b = appendFixed64(b, v) + } + return b, nil +} +func appendFixedS64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toInt64() + b = appendVarint(b, wiretag) + b = appendFixed64(b, uint64(v)) + return b, nil +} +func appendFixedS64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toInt64() + if v == 0 { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendFixed64(b, uint64(v)) + return b, nil +} +func appendFixedS64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + p := *ptr.toInt64Ptr() + if p == nil { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendFixed64(b, uint64(*p)) + return b, nil +} +func appendFixedS64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toInt64Slice() + for _, v := range s { + b = appendVarint(b, wiretag) + b = appendFixed64(b, uint64(v)) + } + return b, nil +} +func appendFixedS64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toInt64Slice() + if len(s) == 0 { + return b, nil + } + b = appendVarint(b, wiretag&^7|WireBytes) + b = appendVarint(b, uint64(8*len(s))) + for _, v := range s { + b = appendFixed64(b, uint64(v)) + } + return b, nil +} +func appendFloat64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := math.Float64bits(*ptr.toFloat64()) + b = appendVarint(b, wiretag) + b = appendFixed64(b, v) + return b, nil +} +func appendFloat64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := math.Float64bits(*ptr.toFloat64()) + if v == 0 { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendFixed64(b, v) + return b, nil +} +func appendFloat64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + p := *ptr.toFloat64Ptr() + if p == nil { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendFixed64(b, math.Float64bits(*p)) + return b, nil +} +func appendFloat64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toFloat64Slice() + for _, v := range s { + b = appendVarint(b, wiretag) + b = appendFixed64(b, math.Float64bits(v)) + } + return b, nil +} +func appendFloat64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toFloat64Slice() + if len(s) == 0 { + return b, nil + } + b = appendVarint(b, wiretag&^7|WireBytes) + b = appendVarint(b, uint64(8*len(s))) + for _, v := range s { + b = appendFixed64(b, math.Float64bits(v)) + } + return b, nil +} +func appendVarint32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toUint32() + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(v)) + return b, nil +} +func appendVarint32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toUint32() + if v == 0 { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(v)) + return b, nil +} +func appendVarint32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + p := *ptr.toUint32Ptr() + if p == nil { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(*p)) + return b, nil +} +func appendVarint32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toUint32Slice() + for _, v := range s { + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(v)) + } + return b, nil +} +func appendVarint32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toUint32Slice() + if len(s) == 0 { + return b, nil + } + b = appendVarint(b, wiretag&^7|WireBytes) + // compute size + n := 0 + for _, v := range s { + n += SizeVarint(uint64(v)) + } + b = appendVarint(b, uint64(n)) + for _, v := range s { + b = appendVarint(b, uint64(v)) + } + return b, nil +} +func appendVarintS32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toInt32() + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(v)) + return b, nil +} +func appendVarintS32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toInt32() + if v == 0 { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(v)) + return b, nil +} +func appendVarintS32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + p := ptr.getInt32Ptr() + if p == nil { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(*p)) + return b, nil +} +func appendVarintS32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := ptr.getInt32Slice() + for _, v := range s { + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(v)) + } + return b, nil +} +func appendVarintS32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := ptr.getInt32Slice() + if len(s) == 0 { + return b, nil + } + b = appendVarint(b, wiretag&^7|WireBytes) + // compute size + n := 0 + for _, v := range s { + n += SizeVarint(uint64(v)) + } + b = appendVarint(b, uint64(n)) + for _, v := range s { + b = appendVarint(b, uint64(v)) + } + return b, nil +} +func appendVarint64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toUint64() + b = appendVarint(b, wiretag) + b = appendVarint(b, v) + return b, nil +} +func appendVarint64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toUint64() + if v == 0 { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendVarint(b, v) + return b, nil +} +func appendVarint64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + p := *ptr.toUint64Ptr() + if p == nil { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendVarint(b, *p) + return b, nil +} +func appendVarint64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toUint64Slice() + for _, v := range s { + b = appendVarint(b, wiretag) + b = appendVarint(b, v) + } + return b, nil +} +func appendVarint64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toUint64Slice() + if len(s) == 0 { + return b, nil + } + b = appendVarint(b, wiretag&^7|WireBytes) + // compute size + n := 0 + for _, v := range s { + n += SizeVarint(v) + } + b = appendVarint(b, uint64(n)) + for _, v := range s { + b = appendVarint(b, v) + } + return b, nil +} +func appendVarintS64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toInt64() + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(v)) + return b, nil +} +func appendVarintS64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toInt64() + if v == 0 { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(v)) + return b, nil +} +func appendVarintS64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + p := *ptr.toInt64Ptr() + if p == nil { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(*p)) + return b, nil +} +func appendVarintS64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toInt64Slice() + for _, v := range s { + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(v)) + } + return b, nil +} +func appendVarintS64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toInt64Slice() + if len(s) == 0 { + return b, nil + } + b = appendVarint(b, wiretag&^7|WireBytes) + // compute size + n := 0 + for _, v := range s { + n += SizeVarint(uint64(v)) + } + b = appendVarint(b, uint64(n)) + for _, v := range s { + b = appendVarint(b, uint64(v)) + } + return b, nil +} +func appendZigzag32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toInt32() + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) + return b, nil +} +func appendZigzag32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toInt32() + if v == 0 { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) + return b, nil +} +func appendZigzag32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + p := ptr.getInt32Ptr() + if p == nil { + return b, nil + } + b = appendVarint(b, wiretag) + v := *p + b = appendVarint(b, uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) + return b, nil +} +func appendZigzag32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := ptr.getInt32Slice() + for _, v := range s { + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) + } + return b, nil +} +func appendZigzag32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := ptr.getInt32Slice() + if len(s) == 0 { + return b, nil + } + b = appendVarint(b, wiretag&^7|WireBytes) + // compute size + n := 0 + for _, v := range s { + n += SizeVarint(uint64((uint32(v) << 1) ^ uint32((int32(v) >> 31)))) + } + b = appendVarint(b, uint64(n)) + for _, v := range s { + b = appendVarint(b, uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) + } + return b, nil +} +func appendZigzag64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toInt64() + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(v<<1)^uint64((int64(v)>>63))) + return b, nil +} +func appendZigzag64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toInt64() + if v == 0 { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(v<<1)^uint64((int64(v)>>63))) + return b, nil +} +func appendZigzag64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + p := *ptr.toInt64Ptr() + if p == nil { + return b, nil + } + b = appendVarint(b, wiretag) + v := *p + b = appendVarint(b, uint64(v<<1)^uint64((int64(v)>>63))) + return b, nil +} +func appendZigzag64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toInt64Slice() + for _, v := range s { + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(v<<1)^uint64((int64(v)>>63))) + } + return b, nil +} +func appendZigzag64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toInt64Slice() + if len(s) == 0 { + return b, nil + } + b = appendVarint(b, wiretag&^7|WireBytes) + // compute size + n := 0 + for _, v := range s { + n += SizeVarint(uint64(v<<1) ^ uint64((int64(v) >> 63))) + } + b = appendVarint(b, uint64(n)) + for _, v := range s { + b = appendVarint(b, uint64(v<<1)^uint64((int64(v)>>63))) + } + return b, nil +} +func appendBoolValue(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toBool() + b = appendVarint(b, wiretag) + if v { + b = append(b, 1) + } else { + b = append(b, 0) + } + return b, nil +} +func appendBoolValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toBool() + if !v { + return b, nil + } + b = appendVarint(b, wiretag) + b = append(b, 1) + return b, nil +} + +func appendBoolPtr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + p := *ptr.toBoolPtr() + if p == nil { + return b, nil + } + b = appendVarint(b, wiretag) + if *p { + b = append(b, 1) + } else { + b = append(b, 0) + } + return b, nil +} +func appendBoolSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toBoolSlice() + for _, v := range s { + b = appendVarint(b, wiretag) + if v { + b = append(b, 1) + } else { + b = append(b, 0) + } + } + return b, nil +} +func appendBoolPackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toBoolSlice() + if len(s) == 0 { + return b, nil + } + b = appendVarint(b, wiretag&^7|WireBytes) + b = appendVarint(b, uint64(len(s))) + for _, v := range s { + if v { + b = append(b, 1) + } else { + b = append(b, 0) + } + } + return b, nil +} +func appendStringValue(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toString() + if !utf8.ValidString(v) { + return nil, errInvalidUTF8 + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(v))) + b = append(b, v...) + return b, nil +} +func appendStringValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toString() + if v == "" { + return b, nil + } + if !utf8.ValidString(v) { + return nil, errInvalidUTF8 + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(v))) + b = append(b, v...) + return b, nil +} +func appendStringPtr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + p := *ptr.toStringPtr() + if p == nil { + return b, nil + } + v := *p + if !utf8.ValidString(v) { + return nil, errInvalidUTF8 + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(v))) + b = append(b, v...) + return b, nil +} +func appendStringSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toStringSlice() + for _, v := range s { + if !utf8.ValidString(v) { + return nil, errInvalidUTF8 + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(v))) + b = append(b, v...) + } + return b, nil +} +func appendBytes(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toBytes() + if v == nil { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(v))) + b = append(b, v...) + return b, nil +} +func appendBytes3(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toBytes() + if len(v) == 0 { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(v))) + b = append(b, v...) + return b, nil +} +func appendBytesOneof(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toBytes() + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(v))) + b = append(b, v...) + return b, nil +} +func appendBytesSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toBytesSlice() + for _, v := range s { + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(v))) + b = append(b, v...) + } + return b, nil +} + +// makeGroupMarshaler returns the sizer and marshaler for a group. +// u is the marshal info of the underlying message. +func makeGroupMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + p := ptr.getPointer() + if p.isNil() { + return 0 + } + return u.size(p) + 2*tagsize + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + p := ptr.getPointer() + if p.isNil() { + return b, nil + } + var err error + b = appendVarint(b, wiretag) // start group + b, err = u.marshal(b, p, deterministic) + b = appendVarint(b, wiretag+(WireEndGroup-WireStartGroup)) // end group + return b, err + } +} + +// makeGroupSliceMarshaler returns the sizer and marshaler for a group slice. +// u is the marshal info of the underlying message. +func makeGroupSliceMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + s := ptr.getPointerSlice() + n := 0 + for _, v := range s { + if v.isNil() { + continue + } + n += u.size(v) + 2*tagsize + } + return n + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + s := ptr.getPointerSlice() + var err, errreq error + for _, v := range s { + if v.isNil() { + return b, errRepeatedHasNil + } + b = appendVarint(b, wiretag) // start group + b, err = u.marshal(b, v, deterministic) + b = appendVarint(b, wiretag+(WireEndGroup-WireStartGroup)) // end group + if err != nil { + if _, ok := err.(*RequiredNotSetError); ok { + // Required field in submessage is not set. + // We record the error but keep going, to give a complete marshaling. + if errreq == nil { + errreq = err + } + continue + } + if err == ErrNil { + err = errRepeatedHasNil + } + return b, err + } + } + return b, errreq + } +} + +// makeMessageMarshaler returns the sizer and marshaler for a message field. +// u is the marshal info of the message. +func makeMessageMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + p := ptr.getPointer() + if p.isNil() { + return 0 + } + siz := u.size(p) + return siz + SizeVarint(uint64(siz)) + tagsize + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + p := ptr.getPointer() + if p.isNil() { + return b, nil + } + b = appendVarint(b, wiretag) + siz := u.cachedsize(p) + b = appendVarint(b, uint64(siz)) + return u.marshal(b, p, deterministic) + } +} + +// makeMessageSliceMarshaler returns the sizer and marshaler for a message slice. +// u is the marshal info of the message. +func makeMessageSliceMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + s := ptr.getPointerSlice() + n := 0 + for _, v := range s { + if v.isNil() { + continue + } + siz := u.size(v) + n += siz + SizeVarint(uint64(siz)) + tagsize + } + return n + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + s := ptr.getPointerSlice() + var err, errreq error + for _, v := range s { + if v.isNil() { + return b, errRepeatedHasNil + } + b = appendVarint(b, wiretag) + siz := u.cachedsize(v) + b = appendVarint(b, uint64(siz)) + b, err = u.marshal(b, v, deterministic) + + if err != nil { + if _, ok := err.(*RequiredNotSetError); ok { + // Required field in submessage is not set. + // We record the error but keep going, to give a complete marshaling. + if errreq == nil { + errreq = err + } + continue + } + if err == ErrNil { + err = errRepeatedHasNil + } + return b, err + } + } + return b, errreq + } +} + +// makeMapMarshaler returns the sizer and marshaler for a map field. +// f is the pointer to the reflect data structure of the field. +func makeMapMarshaler(f *reflect.StructField) (sizer, marshaler) { + // figure out key and value type + t := f.Type + keyType := t.Key() + valType := t.Elem() + keyTags := strings.Split(f.Tag.Get("protobuf_key"), ",") + valTags := strings.Split(f.Tag.Get("protobuf_val"), ",") + keySizer, keyMarshaler := typeMarshaler(keyType, keyTags, false, false) // don't omit zero value in map + valSizer, valMarshaler := typeMarshaler(valType, valTags, false, false) // don't omit zero value in map + keyWireTag := 1<<3 | wiretype(keyTags[0]) + valWireTag := 2<<3 | wiretype(valTags[0]) + + // We create an interface to get the addresses of the map key and value. + // If value is pointer-typed, the interface is a direct interface, the + // idata itself is the value. Otherwise, the idata is the pointer to the + // value. + // Key cannot be pointer-typed. + valIsPtr := valType.Kind() == reflect.Ptr + return func(ptr pointer, tagsize int) int { + m := ptr.asPointerTo(t).Elem() // the map + n := 0 + for _, k := range m.MapKeys() { + ki := k.Interface() + vi := m.MapIndex(k).Interface() + kaddr := toAddrPointer(&ki, false) // pointer to key + vaddr := toAddrPointer(&vi, valIsPtr) // pointer to value + siz := keySizer(kaddr, 1) + valSizer(vaddr, 1) // tag of key = 1 (size=1), tag of val = 2 (size=1) + n += siz + SizeVarint(uint64(siz)) + tagsize + } + return n + }, + func(b []byte, ptr pointer, tag uint64, deterministic bool) ([]byte, error) { + m := ptr.asPointerTo(t).Elem() // the map + var err error + keys := m.MapKeys() + if len(keys) > 1 && deterministic { + sort.Sort(mapKeys(keys)) + } + for _, k := range keys { + ki := k.Interface() + vi := m.MapIndex(k).Interface() + kaddr := toAddrPointer(&ki, false) // pointer to key + vaddr := toAddrPointer(&vi, valIsPtr) // pointer to value + b = appendVarint(b, tag) + siz := keySizer(kaddr, 1) + valSizer(vaddr, 1) // tag of key = 1 (size=1), tag of val = 2 (size=1) + b = appendVarint(b, uint64(siz)) + b, err = keyMarshaler(b, kaddr, keyWireTag, deterministic) + if err != nil { + return b, err + } + b, err = valMarshaler(b, vaddr, valWireTag, deterministic) + if err != nil && err != ErrNil { // allow nil value in map + return b, err + } + } + return b, nil + } +} + +// makeOneOfMarshaler returns the sizer and marshaler for a oneof field. +// fi is the marshal info of the field. +// f is the pointer to the reflect data structure of the field. +func makeOneOfMarshaler(fi *marshalFieldInfo, f *reflect.StructField) (sizer, marshaler) { + // Oneof field is an interface. We need to get the actual data type on the fly. + t := f.Type + return func(ptr pointer, _ int) int { + p := ptr.getInterfacePointer() + if p.isNil() { + return 0 + } + v := ptr.asPointerTo(t).Elem().Elem().Elem() // *interface -> interface -> *struct -> struct + telem := v.Type() + e := fi.oneofElems[telem] + return e.sizer(p, e.tagsize) + }, + func(b []byte, ptr pointer, _ uint64, deterministic bool) ([]byte, error) { + p := ptr.getInterfacePointer() + if p.isNil() { + return b, nil + } + v := ptr.asPointerTo(t).Elem().Elem().Elem() // *interface -> interface -> *struct -> struct + telem := v.Type() + if telem.Field(0).Type.Kind() == reflect.Ptr && p.getPointer().isNil() { + return b, errOneofHasNil + } + e := fi.oneofElems[telem] + return e.marshaler(b, p, e.wiretag, deterministic) + } +} + +// sizeExtensions computes the size of encoded data for a XXX_InternalExtensions field. +func (u *marshalInfo) sizeExtensions(ext *XXX_InternalExtensions) int { + m, mu := ext.extensionsRead() + if m == nil { + return 0 + } + mu.Lock() + + n := 0 + for _, e := range m { + if e.value == nil || e.desc == nil { + // Extension is only in its encoded form. + n += len(e.enc) + continue + } + + // We don't skip extensions that have an encoded form set, + // because the extension value may have been mutated after + // the last time this function was called. + ei := u.getExtElemInfo(e.desc) + v := e.value + p := toAddrPointer(&v, ei.isptr) + n += ei.sizer(p, ei.tagsize) + } + mu.Unlock() + return n +} + +// appendExtensions marshals a XXX_InternalExtensions field to the end of byte slice b. +func (u *marshalInfo) appendExtensions(b []byte, ext *XXX_InternalExtensions, deterministic bool) ([]byte, error) { + m, mu := ext.extensionsRead() + if m == nil { + return b, nil + } + mu.Lock() + defer mu.Unlock() + + var err error + + // Fast-path for common cases: zero or one extensions. + // Don't bother sorting the keys. + if len(m) <= 1 { + for _, e := range m { + if e.value == nil || e.desc == nil { + // Extension is only in its encoded form. + b = append(b, e.enc...) + continue + } + + // We don't skip extensions that have an encoded form set, + // because the extension value may have been mutated after + // the last time this function was called. + + ei := u.getExtElemInfo(e.desc) + v := e.value + p := toAddrPointer(&v, ei.isptr) + b, err = ei.marshaler(b, p, ei.wiretag, deterministic) + if err != nil { + return b, err + } + } + return b, nil + } + + // Sort the keys to provide a deterministic encoding. + // Not sure this is required, but the old code does it. + keys := make([]int, 0, len(m)) + for k := range m { + keys = append(keys, int(k)) + } + sort.Ints(keys) + + for _, k := range keys { + e := m[int32(k)] + if e.value == nil || e.desc == nil { + // Extension is only in its encoded form. + b = append(b, e.enc...) + continue + } + + // We don't skip extensions that have an encoded form set, + // because the extension value may have been mutated after + // the last time this function was called. + + ei := u.getExtElemInfo(e.desc) + v := e.value + p := toAddrPointer(&v, ei.isptr) + b, err = ei.marshaler(b, p, ei.wiretag, deterministic) + if err != nil { + return b, err + } + } + return b, nil +} + +// message set format is: +// message MessageSet { +// repeated group Item = 1 { +// required int32 type_id = 2; +// required string message = 3; +// }; +// } + +// sizeMessageSet computes the size of encoded data for a XXX_InternalExtensions field +// in message set format (above). +func (u *marshalInfo) sizeMessageSet(ext *XXX_InternalExtensions) int { + m, mu := ext.extensionsRead() + if m == nil { + return 0 + } + mu.Lock() + + n := 0 + for id, e := range m { + n += 2 // start group, end group. tag = 1 (size=1) + n += SizeVarint(uint64(id)) + 1 // type_id, tag = 2 (size=1) + + if e.value == nil || e.desc == nil { + // Extension is only in its encoded form. + msgWithLen := skipVarint(e.enc) // skip old tag, but leave the length varint + siz := len(msgWithLen) + n += siz + 1 // message, tag = 3 (size=1) + continue + } + + // We don't skip extensions that have an encoded form set, + // because the extension value may have been mutated after + // the last time this function was called. + + ei := u.getExtElemInfo(e.desc) + v := e.value + p := toAddrPointer(&v, ei.isptr) + n += ei.sizer(p, 1) // message, tag = 3 (size=1) + } + mu.Unlock() + return n +} + +// appendMessageSet marshals a XXX_InternalExtensions field in message set format (above) +// to the end of byte slice b. +func (u *marshalInfo) appendMessageSet(b []byte, ext *XXX_InternalExtensions, deterministic bool) ([]byte, error) { + m, mu := ext.extensionsRead() + if m == nil { + return b, nil + } + mu.Lock() + defer mu.Unlock() + + var err error + + // Fast-path for common cases: zero or one extensions. + // Don't bother sorting the keys. + if len(m) <= 1 { + for id, e := range m { + b = append(b, 1<<3|WireStartGroup) + b = append(b, 2<<3|WireVarint) + b = appendVarint(b, uint64(id)) + + if e.value == nil || e.desc == nil { + // Extension is only in its encoded form. + msgWithLen := skipVarint(e.enc) // skip old tag, but leave the length varint + b = append(b, 3<<3|WireBytes) + b = append(b, msgWithLen...) + b = append(b, 1<<3|WireEndGroup) + continue + } + + // We don't skip extensions that have an encoded form set, + // because the extension value may have been mutated after + // the last time this function was called. + + ei := u.getExtElemInfo(e.desc) + v := e.value + p := toAddrPointer(&v, ei.isptr) + b, err = ei.marshaler(b, p, 3<<3|WireBytes, deterministic) + if err != nil { + return b, err + } + b = append(b, 1<<3|WireEndGroup) + } + return b, nil + } + + // Sort the keys to provide a deterministic encoding. + keys := make([]int, 0, len(m)) + for k := range m { + keys = append(keys, int(k)) + } + sort.Ints(keys) + + for _, id := range keys { + e := m[int32(id)] + b = append(b, 1<<3|WireStartGroup) + b = append(b, 2<<3|WireVarint) + b = appendVarint(b, uint64(id)) + + if e.value == nil || e.desc == nil { + // Extension is only in its encoded form. + msgWithLen := skipVarint(e.enc) // skip old tag, but leave the length varint + b = append(b, 3<<3|WireBytes) + b = append(b, msgWithLen...) + b = append(b, 1<<3|WireEndGroup) + continue + } + + // We don't skip extensions that have an encoded form set, + // because the extension value may have been mutated after + // the last time this function was called. + + ei := u.getExtElemInfo(e.desc) + v := e.value + p := toAddrPointer(&v, ei.isptr) + b, err = ei.marshaler(b, p, 3<<3|WireBytes, deterministic) + b = append(b, 1<<3|WireEndGroup) + if err != nil { + return b, err + } + } + return b, nil +} + +// sizeV1Extensions computes the size of encoded data for a V1-API extension field. +func (u *marshalInfo) sizeV1Extensions(m map[int32]Extension) int { + if m == nil { + return 0 + } + + n := 0 + for _, e := range m { + if e.value == nil || e.desc == nil { + // Extension is only in its encoded form. + n += len(e.enc) + continue + } + + // We don't skip extensions that have an encoded form set, + // because the extension value may have been mutated after + // the last time this function was called. + + ei := u.getExtElemInfo(e.desc) + v := e.value + p := toAddrPointer(&v, ei.isptr) + n += ei.sizer(p, ei.tagsize) + } + return n +} + +// appendV1Extensions marshals a V1-API extension field to the end of byte slice b. +func (u *marshalInfo) appendV1Extensions(b []byte, m map[int32]Extension, deterministic bool) ([]byte, error) { + if m == nil { + return b, nil + } + + // Sort the keys to provide a deterministic encoding. + keys := make([]int, 0, len(m)) + for k := range m { + keys = append(keys, int(k)) + } + sort.Ints(keys) + + var err error + for _, k := range keys { + e := m[int32(k)] + if e.value == nil || e.desc == nil { + // Extension is only in its encoded form. + b = append(b, e.enc...) + continue + } + + // We don't skip extensions that have an encoded form set, + // because the extension value may have been mutated after + // the last time this function was called. + + ei := u.getExtElemInfo(e.desc) + v := e.value + p := toAddrPointer(&v, ei.isptr) + b, err = ei.marshaler(b, p, ei.wiretag, deterministic) + if err != nil { + return b, err + } + } + return b, nil +} + +// newMarshaler is the interface representing objects that can marshal themselves. +// +// This exists to support protoc-gen-go generated messages. +// The proto package will stop type-asserting to this interface in the future. +// +// DO NOT DEPEND ON THIS. +type newMarshaler interface { + XXX_Size() int + XXX_Marshal(b []byte, deterministic bool) ([]byte, error) +} + +// Size returns the encoded size of a protocol buffer message. +// This is the main entry point. +func Size(pb Message) int { + if m, ok := pb.(newMarshaler); ok { + return m.XXX_Size() + } + if m, ok := pb.(Marshaler); ok { + // If the message can marshal itself, let it do it, for compatibility. + // NOTE: This is not efficient. + b, _ := m.Marshal() + return len(b) + } + // in case somehow we didn't generate the wrapper + if pb == nil { + return 0 + } + var info InternalMessageInfo + return info.Size(pb) +} + +// Marshal takes a protocol buffer message +// and encodes it into the wire format, returning the data. +// This is the main entry point. +func Marshal(pb Message) ([]byte, error) { + if m, ok := pb.(newMarshaler); ok { + siz := m.XXX_Size() + b := make([]byte, 0, siz) + return m.XXX_Marshal(b, false) + } + if m, ok := pb.(Marshaler); ok { + // If the message can marshal itself, let it do it, for compatibility. + // NOTE: This is not efficient. + return m.Marshal() + } + // in case somehow we didn't generate the wrapper + if pb == nil { + return nil, ErrNil + } + var info InternalMessageInfo + siz := info.Size(pb) + b := make([]byte, 0, siz) + return info.Marshal(b, pb, false) +} + +// Marshal takes a protocol buffer message +// and encodes it into the wire format, writing the result to the +// Buffer. +// This is an alternative entry point. It is not necessary to use +// a Buffer for most applications. +func (p *Buffer) Marshal(pb Message) error { + var err error + if m, ok := pb.(newMarshaler); ok { + siz := m.XXX_Size() + p.grow(siz) // make sure buf has enough capacity + p.buf, err = m.XXX_Marshal(p.buf, p.deterministic) + return err + } + if m, ok := pb.(Marshaler); ok { + // If the message can marshal itself, let it do it, for compatibility. + // NOTE: This is not efficient. + b, err := m.Marshal() + p.buf = append(p.buf, b...) + return err + } + // in case somehow we didn't generate the wrapper + if pb == nil { + return ErrNil + } + var info InternalMessageInfo + siz := info.Size(pb) + p.grow(siz) // make sure buf has enough capacity + p.buf, err = info.Marshal(p.buf, pb, p.deterministic) + return err +} + +// grow grows the buffer's capacity, if necessary, to guarantee space for +// another n bytes. After grow(n), at least n bytes can be written to the +// buffer without another allocation. +func (p *Buffer) grow(n int) { + need := len(p.buf) + n + if need <= cap(p.buf) { + return + } + newCap := len(p.buf) * 2 + if newCap < need { + newCap = need + } + p.buf = append(make([]byte, 0, newCap), p.buf...) +} diff --git a/vendor/github.com/golang/protobuf/proto/table_merge.go b/vendor/github.com/golang/protobuf/proto/table_merge.go new file mode 100644 index 000000000..5525def6a --- /dev/null +++ b/vendor/github.com/golang/protobuf/proto/table_merge.go @@ -0,0 +1,654 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2016 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package proto + +import ( + "fmt" + "reflect" + "strings" + "sync" + "sync/atomic" +) + +// Merge merges the src message into dst. +// This assumes that dst and src of the same type and are non-nil. +func (a *InternalMessageInfo) Merge(dst, src Message) { + mi := atomicLoadMergeInfo(&a.merge) + if mi == nil { + mi = getMergeInfo(reflect.TypeOf(dst).Elem()) + atomicStoreMergeInfo(&a.merge, mi) + } + mi.merge(toPointer(&dst), toPointer(&src)) +} + +type mergeInfo struct { + typ reflect.Type + + initialized int32 // 0: only typ is valid, 1: everything is valid + lock sync.Mutex + + fields []mergeFieldInfo + unrecognized field // Offset of XXX_unrecognized +} + +type mergeFieldInfo struct { + field field // Offset of field, guaranteed to be valid + + // isPointer reports whether the value in the field is a pointer. + // This is true for the following situations: + // * Pointer to struct + // * Pointer to basic type (proto2 only) + // * Slice (first value in slice header is a pointer) + // * String (first value in string header is a pointer) + isPointer bool + + // basicWidth reports the width of the field assuming that it is directly + // embedded in the struct (as is the case for basic types in proto3). + // The possible values are: + // 0: invalid + // 1: bool + // 4: int32, uint32, float32 + // 8: int64, uint64, float64 + basicWidth int + + // Where dst and src are pointers to the types being merged. + merge func(dst, src pointer) +} + +var ( + mergeInfoMap = map[reflect.Type]*mergeInfo{} + mergeInfoLock sync.Mutex +) + +func getMergeInfo(t reflect.Type) *mergeInfo { + mergeInfoLock.Lock() + defer mergeInfoLock.Unlock() + mi := mergeInfoMap[t] + if mi == nil { + mi = &mergeInfo{typ: t} + mergeInfoMap[t] = mi + } + return mi +} + +// merge merges src into dst assuming they are both of type *mi.typ. +func (mi *mergeInfo) merge(dst, src pointer) { + if dst.isNil() { + panic("proto: nil destination") + } + if src.isNil() { + return // Nothing to do. + } + + if atomic.LoadInt32(&mi.initialized) == 0 { + mi.computeMergeInfo() + } + + for _, fi := range mi.fields { + sfp := src.offset(fi.field) + + // As an optimization, we can avoid the merge function call cost + // if we know for sure that the source will have no effect + // by checking if it is the zero value. + if unsafeAllowed { + if fi.isPointer && sfp.getPointer().isNil() { // Could be slice or string + continue + } + if fi.basicWidth > 0 { + switch { + case fi.basicWidth == 1 && !*sfp.toBool(): + continue + case fi.basicWidth == 4 && *sfp.toUint32() == 0: + continue + case fi.basicWidth == 8 && *sfp.toUint64() == 0: + continue + } + } + } + + dfp := dst.offset(fi.field) + fi.merge(dfp, sfp) + } + + // TODO: Make this faster? + out := dst.asPointerTo(mi.typ).Elem() + in := src.asPointerTo(mi.typ).Elem() + if emIn, err := extendable(in.Addr().Interface()); err == nil { + emOut, _ := extendable(out.Addr().Interface()) + mIn, muIn := emIn.extensionsRead() + if mIn != nil { + mOut := emOut.extensionsWrite() + muIn.Lock() + mergeExtension(mOut, mIn) + muIn.Unlock() + } + } + + if mi.unrecognized.IsValid() { + if b := *src.offset(mi.unrecognized).toBytes(); len(b) > 0 { + *dst.offset(mi.unrecognized).toBytes() = append([]byte(nil), b...) + } + } +} + +func (mi *mergeInfo) computeMergeInfo() { + mi.lock.Lock() + defer mi.lock.Unlock() + if mi.initialized != 0 { + return + } + t := mi.typ + n := t.NumField() + + props := GetProperties(t) + for i := 0; i < n; i++ { + f := t.Field(i) + if strings.HasPrefix(f.Name, "XXX_") { + continue + } + + mfi := mergeFieldInfo{field: toField(&f)} + tf := f.Type + + // As an optimization, we can avoid the merge function call cost + // if we know for sure that the source will have no effect + // by checking if it is the zero value. + if unsafeAllowed { + switch tf.Kind() { + case reflect.Ptr, reflect.Slice, reflect.String: + // As a special case, we assume slices and strings are pointers + // since we know that the first field in the SliceSlice or + // StringHeader is a data pointer. + mfi.isPointer = true + case reflect.Bool: + mfi.basicWidth = 1 + case reflect.Int32, reflect.Uint32, reflect.Float32: + mfi.basicWidth = 4 + case reflect.Int64, reflect.Uint64, reflect.Float64: + mfi.basicWidth = 8 + } + } + + // Unwrap tf to get at its most basic type. + var isPointer, isSlice bool + if tf.Kind() == reflect.Slice && tf.Elem().Kind() != reflect.Uint8 { + isSlice = true + tf = tf.Elem() + } + if tf.Kind() == reflect.Ptr { + isPointer = true + tf = tf.Elem() + } + if isPointer && isSlice && tf.Kind() != reflect.Struct { + panic("both pointer and slice for basic type in " + tf.Name()) + } + + switch tf.Kind() { + case reflect.Int32: + switch { + case isSlice: // E.g., []int32 + mfi.merge = func(dst, src pointer) { + // NOTE: toInt32Slice is not defined (see pointer_reflect.go). + /* + sfsp := src.toInt32Slice() + if *sfsp != nil { + dfsp := dst.toInt32Slice() + *dfsp = append(*dfsp, *sfsp...) + if *dfsp == nil { + *dfsp = []int64{} + } + } + */ + sfs := src.getInt32Slice() + if sfs != nil { + dfs := dst.getInt32Slice() + dfs = append(dfs, sfs...) + if dfs == nil { + dfs = []int32{} + } + dst.setInt32Slice(dfs) + } + } + case isPointer: // E.g., *int32 + mfi.merge = func(dst, src pointer) { + // NOTE: toInt32Ptr is not defined (see pointer_reflect.go). + /* + sfpp := src.toInt32Ptr() + if *sfpp != nil { + dfpp := dst.toInt32Ptr() + if *dfpp == nil { + *dfpp = Int32(**sfpp) + } else { + **dfpp = **sfpp + } + } + */ + sfp := src.getInt32Ptr() + if sfp != nil { + dfp := dst.getInt32Ptr() + if dfp == nil { + dst.setInt32Ptr(*sfp) + } else { + *dfp = *sfp + } + } + } + default: // E.g., int32 + mfi.merge = func(dst, src pointer) { + if v := *src.toInt32(); v != 0 { + *dst.toInt32() = v + } + } + } + case reflect.Int64: + switch { + case isSlice: // E.g., []int64 + mfi.merge = func(dst, src pointer) { + sfsp := src.toInt64Slice() + if *sfsp != nil { + dfsp := dst.toInt64Slice() + *dfsp = append(*dfsp, *sfsp...) + if *dfsp == nil { + *dfsp = []int64{} + } + } + } + case isPointer: // E.g., *int64 + mfi.merge = func(dst, src pointer) { + sfpp := src.toInt64Ptr() + if *sfpp != nil { + dfpp := dst.toInt64Ptr() + if *dfpp == nil { + *dfpp = Int64(**sfpp) + } else { + **dfpp = **sfpp + } + } + } + default: // E.g., int64 + mfi.merge = func(dst, src pointer) { + if v := *src.toInt64(); v != 0 { + *dst.toInt64() = v + } + } + } + case reflect.Uint32: + switch { + case isSlice: // E.g., []uint32 + mfi.merge = func(dst, src pointer) { + sfsp := src.toUint32Slice() + if *sfsp != nil { + dfsp := dst.toUint32Slice() + *dfsp = append(*dfsp, *sfsp...) + if *dfsp == nil { + *dfsp = []uint32{} + } + } + } + case isPointer: // E.g., *uint32 + mfi.merge = func(dst, src pointer) { + sfpp := src.toUint32Ptr() + if *sfpp != nil { + dfpp := dst.toUint32Ptr() + if *dfpp == nil { + *dfpp = Uint32(**sfpp) + } else { + **dfpp = **sfpp + } + } + } + default: // E.g., uint32 + mfi.merge = func(dst, src pointer) { + if v := *src.toUint32(); v != 0 { + *dst.toUint32() = v + } + } + } + case reflect.Uint64: + switch { + case isSlice: // E.g., []uint64 + mfi.merge = func(dst, src pointer) { + sfsp := src.toUint64Slice() + if *sfsp != nil { + dfsp := dst.toUint64Slice() + *dfsp = append(*dfsp, *sfsp...) + if *dfsp == nil { + *dfsp = []uint64{} + } + } + } + case isPointer: // E.g., *uint64 + mfi.merge = func(dst, src pointer) { + sfpp := src.toUint64Ptr() + if *sfpp != nil { + dfpp := dst.toUint64Ptr() + if *dfpp == nil { + *dfpp = Uint64(**sfpp) + } else { + **dfpp = **sfpp + } + } + } + default: // E.g., uint64 + mfi.merge = func(dst, src pointer) { + if v := *src.toUint64(); v != 0 { + *dst.toUint64() = v + } + } + } + case reflect.Float32: + switch { + case isSlice: // E.g., []float32 + mfi.merge = func(dst, src pointer) { + sfsp := src.toFloat32Slice() + if *sfsp != nil { + dfsp := dst.toFloat32Slice() + *dfsp = append(*dfsp, *sfsp...) + if *dfsp == nil { + *dfsp = []float32{} + } + } + } + case isPointer: // E.g., *float32 + mfi.merge = func(dst, src pointer) { + sfpp := src.toFloat32Ptr() + if *sfpp != nil { + dfpp := dst.toFloat32Ptr() + if *dfpp == nil { + *dfpp = Float32(**sfpp) + } else { + **dfpp = **sfpp + } + } + } + default: // E.g., float32 + mfi.merge = func(dst, src pointer) { + if v := *src.toFloat32(); v != 0 { + *dst.toFloat32() = v + } + } + } + case reflect.Float64: + switch { + case isSlice: // E.g., []float64 + mfi.merge = func(dst, src pointer) { + sfsp := src.toFloat64Slice() + if *sfsp != nil { + dfsp := dst.toFloat64Slice() + *dfsp = append(*dfsp, *sfsp...) + if *dfsp == nil { + *dfsp = []float64{} + } + } + } + case isPointer: // E.g., *float64 + mfi.merge = func(dst, src pointer) { + sfpp := src.toFloat64Ptr() + if *sfpp != nil { + dfpp := dst.toFloat64Ptr() + if *dfpp == nil { + *dfpp = Float64(**sfpp) + } else { + **dfpp = **sfpp + } + } + } + default: // E.g., float64 + mfi.merge = func(dst, src pointer) { + if v := *src.toFloat64(); v != 0 { + *dst.toFloat64() = v + } + } + } + case reflect.Bool: + switch { + case isSlice: // E.g., []bool + mfi.merge = func(dst, src pointer) { + sfsp := src.toBoolSlice() + if *sfsp != nil { + dfsp := dst.toBoolSlice() + *dfsp = append(*dfsp, *sfsp...) + if *dfsp == nil { + *dfsp = []bool{} + } + } + } + case isPointer: // E.g., *bool + mfi.merge = func(dst, src pointer) { + sfpp := src.toBoolPtr() + if *sfpp != nil { + dfpp := dst.toBoolPtr() + if *dfpp == nil { + *dfpp = Bool(**sfpp) + } else { + **dfpp = **sfpp + } + } + } + default: // E.g., bool + mfi.merge = func(dst, src pointer) { + if v := *src.toBool(); v { + *dst.toBool() = v + } + } + } + case reflect.String: + switch { + case isSlice: // E.g., []string + mfi.merge = func(dst, src pointer) { + sfsp := src.toStringSlice() + if *sfsp != nil { + dfsp := dst.toStringSlice() + *dfsp = append(*dfsp, *sfsp...) + if *dfsp == nil { + *dfsp = []string{} + } + } + } + case isPointer: // E.g., *string + mfi.merge = func(dst, src pointer) { + sfpp := src.toStringPtr() + if *sfpp != nil { + dfpp := dst.toStringPtr() + if *dfpp == nil { + *dfpp = String(**sfpp) + } else { + **dfpp = **sfpp + } + } + } + default: // E.g., string + mfi.merge = func(dst, src pointer) { + if v := *src.toString(); v != "" { + *dst.toString() = v + } + } + } + case reflect.Slice: + isProto3 := props.Prop[i].proto3 + switch { + case isPointer: + panic("bad pointer in byte slice case in " + tf.Name()) + case tf.Elem().Kind() != reflect.Uint8: + panic("bad element kind in byte slice case in " + tf.Name()) + case isSlice: // E.g., [][]byte + mfi.merge = func(dst, src pointer) { + sbsp := src.toBytesSlice() + if *sbsp != nil { + dbsp := dst.toBytesSlice() + for _, sb := range *sbsp { + if sb == nil { + *dbsp = append(*dbsp, nil) + } else { + *dbsp = append(*dbsp, append([]byte{}, sb...)) + } + } + if *dbsp == nil { + *dbsp = [][]byte{} + } + } + } + default: // E.g., []byte + mfi.merge = func(dst, src pointer) { + sbp := src.toBytes() + if *sbp != nil { + dbp := dst.toBytes() + if !isProto3 || len(*sbp) > 0 { + *dbp = append([]byte{}, *sbp...) + } + } + } + } + case reflect.Struct: + switch { + case !isPointer: + panic(fmt.Sprintf("message field %s without pointer", tf)) + case isSlice: // E.g., []*pb.T + mi := getMergeInfo(tf) + mfi.merge = func(dst, src pointer) { + sps := src.getPointerSlice() + if sps != nil { + dps := dst.getPointerSlice() + for _, sp := range sps { + var dp pointer + if !sp.isNil() { + dp = valToPointer(reflect.New(tf)) + mi.merge(dp, sp) + } + dps = append(dps, dp) + } + if dps == nil { + dps = []pointer{} + } + dst.setPointerSlice(dps) + } + } + default: // E.g., *pb.T + mi := getMergeInfo(tf) + mfi.merge = func(dst, src pointer) { + sp := src.getPointer() + if !sp.isNil() { + dp := dst.getPointer() + if dp.isNil() { + dp = valToPointer(reflect.New(tf)) + dst.setPointer(dp) + } + mi.merge(dp, sp) + } + } + } + case reflect.Map: + switch { + case isPointer || isSlice: + panic("bad pointer or slice in map case in " + tf.Name()) + default: // E.g., map[K]V + mfi.merge = func(dst, src pointer) { + sm := src.asPointerTo(tf).Elem() + if sm.Len() == 0 { + return + } + dm := dst.asPointerTo(tf).Elem() + if dm.IsNil() { + dm.Set(reflect.MakeMap(tf)) + } + + switch tf.Elem().Kind() { + case reflect.Ptr: // Proto struct (e.g., *T) + for _, key := range sm.MapKeys() { + val := sm.MapIndex(key) + val = reflect.ValueOf(Clone(val.Interface().(Message))) + dm.SetMapIndex(key, val) + } + case reflect.Slice: // E.g. Bytes type (e.g., []byte) + for _, key := range sm.MapKeys() { + val := sm.MapIndex(key) + val = reflect.ValueOf(append([]byte{}, val.Bytes()...)) + dm.SetMapIndex(key, val) + } + default: // Basic type (e.g., string) + for _, key := range sm.MapKeys() { + val := sm.MapIndex(key) + dm.SetMapIndex(key, val) + } + } + } + } + case reflect.Interface: + // Must be oneof field. + switch { + case isPointer || isSlice: + panic("bad pointer or slice in interface case in " + tf.Name()) + default: // E.g., interface{} + // TODO: Make this faster? + mfi.merge = func(dst, src pointer) { + su := src.asPointerTo(tf).Elem() + if !su.IsNil() { + du := dst.asPointerTo(tf).Elem() + typ := su.Elem().Type() + if du.IsNil() || du.Elem().Type() != typ { + du.Set(reflect.New(typ.Elem())) // Initialize interface if empty + } + sv := su.Elem().Elem().Field(0) + if sv.Kind() == reflect.Ptr && sv.IsNil() { + return + } + dv := du.Elem().Elem().Field(0) + if dv.Kind() == reflect.Ptr && dv.IsNil() { + dv.Set(reflect.New(sv.Type().Elem())) // Initialize proto message if empty + } + switch sv.Type().Kind() { + case reflect.Ptr: // Proto struct (e.g., *T) + Merge(dv.Interface().(Message), sv.Interface().(Message)) + case reflect.Slice: // E.g. Bytes type (e.g., []byte) + dv.Set(reflect.ValueOf(append([]byte{}, sv.Bytes()...))) + default: // Basic type (e.g., string) + dv.Set(sv) + } + } + } + } + default: + panic(fmt.Sprintf("merger not found for type:%s", tf)) + } + mi.fields = append(mi.fields, mfi) + } + + mi.unrecognized = invalidField + if f, ok := t.FieldByName("XXX_unrecognized"); ok { + if f.Type != reflect.TypeOf([]byte{}) { + panic("expected XXX_unrecognized to be of type []byte") + } + mi.unrecognized = toField(&f) + } + + atomic.StoreInt32(&mi.initialized, 1) +} diff --git a/vendor/github.com/golang/protobuf/proto/table_unmarshal.go b/vendor/github.com/golang/protobuf/proto/table_unmarshal.go new file mode 100644 index 000000000..55f0340a3 --- /dev/null +++ b/vendor/github.com/golang/protobuf/proto/table_unmarshal.go @@ -0,0 +1,1967 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2016 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package proto + +import ( + "errors" + "fmt" + "io" + "math" + "reflect" + "strconv" + "strings" + "sync" + "sync/atomic" + "unicode/utf8" +) + +// Unmarshal is the entry point from the generated .pb.go files. +// This function is not intended to be used by non-generated code. +// This function is not subject to any compatibility guarantee. +// msg contains a pointer to a protocol buffer struct. +// b is the data to be unmarshaled into the protocol buffer. +// a is a pointer to a place to store cached unmarshal information. +func (a *InternalMessageInfo) Unmarshal(msg Message, b []byte) error { + // Load the unmarshal information for this message type. + // The atomic load ensures memory consistency. + u := atomicLoadUnmarshalInfo(&a.unmarshal) + if u == nil { + // Slow path: find unmarshal info for msg, update a with it. + u = getUnmarshalInfo(reflect.TypeOf(msg).Elem()) + atomicStoreUnmarshalInfo(&a.unmarshal, u) + } + // Then do the unmarshaling. + err := u.unmarshal(toPointer(&msg), b) + return err +} + +type unmarshalInfo struct { + typ reflect.Type // type of the protobuf struct + + // 0 = only typ field is initialized + // 1 = completely initialized + initialized int32 + lock sync.Mutex // prevents double initialization + dense []unmarshalFieldInfo // fields indexed by tag # + sparse map[uint64]unmarshalFieldInfo // fields indexed by tag # + reqFields []string // names of required fields + reqMask uint64 // 1< 0 { + // Read tag and wire type. + // Special case 1 and 2 byte varints. + var x uint64 + if b[0] < 128 { + x = uint64(b[0]) + b = b[1:] + } else if len(b) >= 2 && b[1] < 128 { + x = uint64(b[0]&0x7f) + uint64(b[1])<<7 + b = b[2:] + } else { + var n int + x, n = decodeVarint(b) + if n == 0 { + return io.ErrUnexpectedEOF + } + b = b[n:] + } + tag := x >> 3 + wire := int(x) & 7 + + // Dispatch on the tag to one of the unmarshal* functions below. + var f unmarshalFieldInfo + if tag < uint64(len(u.dense)) { + f = u.dense[tag] + } else { + f = u.sparse[tag] + } + if fn := f.unmarshal; fn != nil { + var err error + b, err = fn(b, m.offset(f.field), wire) + if err == nil { + reqMask |= f.reqMask + continue + } + if r, ok := err.(*RequiredNotSetError); ok { + // Remember this error, but keep parsing. We need to produce + // a full parse even if a required field is missing. + rnse = r + reqMask |= f.reqMask + continue + } + if err != errInternalBadWireType { + return err + } + // Fragments with bad wire type are treated as unknown fields. + } + + // Unknown tag. + if !u.unrecognized.IsValid() { + // Don't keep unrecognized data; just skip it. + var err error + b, err = skipField(b, wire) + if err != nil { + return err + } + continue + } + // Keep unrecognized data around. + // maybe in extensions, maybe in the unrecognized field. + z := m.offset(u.unrecognized).toBytes() + var emap map[int32]Extension + var e Extension + for _, r := range u.extensionRanges { + if uint64(r.Start) <= tag && tag <= uint64(r.End) { + if u.extensions.IsValid() { + mp := m.offset(u.extensions).toExtensions() + emap = mp.extensionsWrite() + e = emap[int32(tag)] + z = &e.enc + break + } + if u.oldExtensions.IsValid() { + p := m.offset(u.oldExtensions).toOldExtensions() + emap = *p + if emap == nil { + emap = map[int32]Extension{} + *p = emap + } + e = emap[int32(tag)] + z = &e.enc + break + } + panic("no extensions field available") + } + } + + // Use wire type to skip data. + var err error + b0 := b + b, err = skipField(b, wire) + if err != nil { + return err + } + *z = encodeVarint(*z, tag<<3|uint64(wire)) + *z = append(*z, b0[:len(b0)-len(b)]...) + + if emap != nil { + emap[int32(tag)] = e + } + } + if rnse != nil { + // A required field of a submessage/group is missing. Return that error. + return rnse + } + if reqMask != u.reqMask { + // A required field of this message is missing. + for _, n := range u.reqFields { + if reqMask&1 == 0 { + return &RequiredNotSetError{n} + } + reqMask >>= 1 + } + } + return nil +} + +// computeUnmarshalInfo fills in u with information for use +// in unmarshaling protocol buffers of type u.typ. +func (u *unmarshalInfo) computeUnmarshalInfo() { + u.lock.Lock() + defer u.lock.Unlock() + if u.initialized != 0 { + return + } + t := u.typ + n := t.NumField() + + // Set up the "not found" value for the unrecognized byte buffer. + // This is the default for proto3. + u.unrecognized = invalidField + u.extensions = invalidField + u.oldExtensions = invalidField + + // List of the generated type and offset for each oneof field. + type oneofField struct { + ityp reflect.Type // interface type of oneof field + field field // offset in containing message + } + var oneofFields []oneofField + + for i := 0; i < n; i++ { + f := t.Field(i) + if f.Name == "XXX_unrecognized" { + // The byte slice used to hold unrecognized input is special. + if f.Type != reflect.TypeOf(([]byte)(nil)) { + panic("bad type for XXX_unrecognized field: " + f.Type.Name()) + } + u.unrecognized = toField(&f) + continue + } + if f.Name == "XXX_InternalExtensions" { + // Ditto here. + if f.Type != reflect.TypeOf(XXX_InternalExtensions{}) { + panic("bad type for XXX_InternalExtensions field: " + f.Type.Name()) + } + u.extensions = toField(&f) + if f.Tag.Get("protobuf_messageset") == "1" { + u.isMessageSet = true + } + continue + } + if f.Name == "XXX_extensions" { + // An older form of the extensions field. + if f.Type != reflect.TypeOf((map[int32]Extension)(nil)) { + panic("bad type for XXX_extensions field: " + f.Type.Name()) + } + u.oldExtensions = toField(&f) + continue + } + if f.Name == "XXX_NoUnkeyedLiteral" || f.Name == "XXX_sizecache" { + continue + } + + oneof := f.Tag.Get("protobuf_oneof") + if oneof != "" { + oneofFields = append(oneofFields, oneofField{f.Type, toField(&f)}) + // The rest of oneof processing happens below. + continue + } + + tags := f.Tag.Get("protobuf") + tagArray := strings.Split(tags, ",") + if len(tagArray) < 2 { + panic("protobuf tag not enough fields in " + t.Name() + "." + f.Name + ": " + tags) + } + tag, err := strconv.Atoi(tagArray[1]) + if err != nil { + panic("protobuf tag field not an integer: " + tagArray[1]) + } + + name := "" + for _, tag := range tagArray[3:] { + if strings.HasPrefix(tag, "name=") { + name = tag[5:] + } + } + + // Extract unmarshaling function from the field (its type and tags). + unmarshal := fieldUnmarshaler(&f) + + // Required field? + var reqMask uint64 + if tagArray[2] == "req" { + bit := len(u.reqFields) + u.reqFields = append(u.reqFields, name) + reqMask = uint64(1) << uint(bit) + // TODO: if we have more than 64 required fields, we end up + // not verifying that all required fields are present. + // Fix this, perhaps using a count of required fields? + } + + // Store the info in the correct slot in the message. + u.setTag(tag, toField(&f), unmarshal, reqMask) + } + + // Find any types associated with oneof fields. + // TODO: XXX_OneofFuncs returns more info than we need. Get rid of some of it? + fn := reflect.Zero(reflect.PtrTo(t)).MethodByName("XXX_OneofFuncs") + if fn.IsValid() { + res := fn.Call(nil)[3] // last return value from XXX_OneofFuncs: []interface{} + for i := res.Len() - 1; i >= 0; i-- { + v := res.Index(i) // interface{} + tptr := reflect.ValueOf(v.Interface()).Type() // *Msg_X + typ := tptr.Elem() // Msg_X + + f := typ.Field(0) // oneof implementers have one field + baseUnmarshal := fieldUnmarshaler(&f) + tagstr := strings.Split(f.Tag.Get("protobuf"), ",")[1] + tag, err := strconv.Atoi(tagstr) + if err != nil { + panic("protobuf tag field not an integer: " + tagstr) + } + + // Find the oneof field that this struct implements. + // Might take O(n^2) to process all of the oneofs, but who cares. + for _, of := range oneofFields { + if tptr.Implements(of.ityp) { + // We have found the corresponding interface for this struct. + // That lets us know where this struct should be stored + // when we encounter it during unmarshaling. + unmarshal := makeUnmarshalOneof(typ, of.ityp, baseUnmarshal) + u.setTag(tag, of.field, unmarshal, 0) + } + } + } + } + + // Get extension ranges, if any. + fn = reflect.Zero(reflect.PtrTo(t)).MethodByName("ExtensionRangeArray") + if fn.IsValid() { + if !u.extensions.IsValid() && !u.oldExtensions.IsValid() { + panic("a message with extensions, but no extensions field in " + t.Name()) + } + u.extensionRanges = fn.Call(nil)[0].Interface().([]ExtensionRange) + } + + // Explicitly disallow tag 0. This will ensure we flag an error + // when decoding a buffer of all zeros. Without this code, we + // would decode and skip an all-zero buffer of even length. + // [0 0] is [tag=0/wiretype=varint varint-encoded-0]. + u.setTag(0, zeroField, func(b []byte, f pointer, w int) ([]byte, error) { + return nil, fmt.Errorf("proto: %s: illegal tag 0 (wire type %d)", t, w) + }, 0) + + // Set mask for required field check. + u.reqMask = uint64(1)<= 0 && (tag < 16 || tag < 2*n) { // TODO: what are the right numbers here? + for len(u.dense) <= tag { + u.dense = append(u.dense, unmarshalFieldInfo{}) + } + u.dense[tag] = i + return + } + if u.sparse == nil { + u.sparse = map[uint64]unmarshalFieldInfo{} + } + u.sparse[uint64(tag)] = i +} + +// fieldUnmarshaler returns an unmarshaler for the given field. +func fieldUnmarshaler(f *reflect.StructField) unmarshaler { + if f.Type.Kind() == reflect.Map { + return makeUnmarshalMap(f) + } + return typeUnmarshaler(f.Type, f.Tag.Get("protobuf")) +} + +// typeUnmarshaler returns an unmarshaler for the given field type / field tag pair. +func typeUnmarshaler(t reflect.Type, tags string) unmarshaler { + tagArray := strings.Split(tags, ",") + encoding := tagArray[0] + name := "unknown" + for _, tag := range tagArray[3:] { + if strings.HasPrefix(tag, "name=") { + name = tag[5:] + } + } + + // Figure out packaging (pointer, slice, or both) + slice := false + pointer := false + if t.Kind() == reflect.Slice && t.Elem().Kind() != reflect.Uint8 { + slice = true + t = t.Elem() + } + if t.Kind() == reflect.Ptr { + pointer = true + t = t.Elem() + } + + // We'll never have both pointer and slice for basic types. + if pointer && slice && t.Kind() != reflect.Struct { + panic("both pointer and slice for basic type in " + t.Name()) + } + + switch t.Kind() { + case reflect.Bool: + if pointer { + return unmarshalBoolPtr + } + if slice { + return unmarshalBoolSlice + } + return unmarshalBoolValue + case reflect.Int32: + switch encoding { + case "fixed32": + if pointer { + return unmarshalFixedS32Ptr + } + if slice { + return unmarshalFixedS32Slice + } + return unmarshalFixedS32Value + case "varint": + // this could be int32 or enum + if pointer { + return unmarshalInt32Ptr + } + if slice { + return unmarshalInt32Slice + } + return unmarshalInt32Value + case "zigzag32": + if pointer { + return unmarshalSint32Ptr + } + if slice { + return unmarshalSint32Slice + } + return unmarshalSint32Value + } + case reflect.Int64: + switch encoding { + case "fixed64": + if pointer { + return unmarshalFixedS64Ptr + } + if slice { + return unmarshalFixedS64Slice + } + return unmarshalFixedS64Value + case "varint": + if pointer { + return unmarshalInt64Ptr + } + if slice { + return unmarshalInt64Slice + } + return unmarshalInt64Value + case "zigzag64": + if pointer { + return unmarshalSint64Ptr + } + if slice { + return unmarshalSint64Slice + } + return unmarshalSint64Value + } + case reflect.Uint32: + switch encoding { + case "fixed32": + if pointer { + return unmarshalFixed32Ptr + } + if slice { + return unmarshalFixed32Slice + } + return unmarshalFixed32Value + case "varint": + if pointer { + return unmarshalUint32Ptr + } + if slice { + return unmarshalUint32Slice + } + return unmarshalUint32Value + } + case reflect.Uint64: + switch encoding { + case "fixed64": + if pointer { + return unmarshalFixed64Ptr + } + if slice { + return unmarshalFixed64Slice + } + return unmarshalFixed64Value + case "varint": + if pointer { + return unmarshalUint64Ptr + } + if slice { + return unmarshalUint64Slice + } + return unmarshalUint64Value + } + case reflect.Float32: + if pointer { + return unmarshalFloat32Ptr + } + if slice { + return unmarshalFloat32Slice + } + return unmarshalFloat32Value + case reflect.Float64: + if pointer { + return unmarshalFloat64Ptr + } + if slice { + return unmarshalFloat64Slice + } + return unmarshalFloat64Value + case reflect.Map: + panic("map type in typeUnmarshaler in " + t.Name()) + case reflect.Slice: + if pointer { + panic("bad pointer in slice case in " + t.Name()) + } + if slice { + return unmarshalBytesSlice + } + return unmarshalBytesValue + case reflect.String: + if pointer { + return unmarshalStringPtr + } + if slice { + return unmarshalStringSlice + } + return unmarshalStringValue + case reflect.Struct: + // message or group field + if !pointer { + panic(fmt.Sprintf("message/group field %s:%s without pointer", t, encoding)) + } + switch encoding { + case "bytes": + if slice { + return makeUnmarshalMessageSlicePtr(getUnmarshalInfo(t), name) + } + return makeUnmarshalMessagePtr(getUnmarshalInfo(t), name) + case "group": + if slice { + return makeUnmarshalGroupSlicePtr(getUnmarshalInfo(t), name) + } + return makeUnmarshalGroupPtr(getUnmarshalInfo(t), name) + } + } + panic(fmt.Sprintf("unmarshaler not found type:%s encoding:%s", t, encoding)) +} + +// Below are all the unmarshalers for individual fields of various types. + +func unmarshalInt64Value(b []byte, f pointer, w int) ([]byte, error) { + if w != WireVarint { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := int64(x) + *f.toInt64() = v + return b, nil +} + +func unmarshalInt64Ptr(b []byte, f pointer, w int) ([]byte, error) { + if w != WireVarint { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := int64(x) + *f.toInt64Ptr() = &v + return b, nil +} + +func unmarshalInt64Slice(b []byte, f pointer, w int) ([]byte, error) { + if w == WireBytes { // packed + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + res := b[x:] + b = b[:x] + for len(b) > 0 { + x, n = decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := int64(x) + s := f.toInt64Slice() + *s = append(*s, v) + } + return res, nil + } + if w != WireVarint { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := int64(x) + s := f.toInt64Slice() + *s = append(*s, v) + return b, nil +} + +func unmarshalSint64Value(b []byte, f pointer, w int) ([]byte, error) { + if w != WireVarint { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := int64(x>>1) ^ int64(x)<<63>>63 + *f.toInt64() = v + return b, nil +} + +func unmarshalSint64Ptr(b []byte, f pointer, w int) ([]byte, error) { + if w != WireVarint { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := int64(x>>1) ^ int64(x)<<63>>63 + *f.toInt64Ptr() = &v + return b, nil +} + +func unmarshalSint64Slice(b []byte, f pointer, w int) ([]byte, error) { + if w == WireBytes { // packed + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + res := b[x:] + b = b[:x] + for len(b) > 0 { + x, n = decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := int64(x>>1) ^ int64(x)<<63>>63 + s := f.toInt64Slice() + *s = append(*s, v) + } + return res, nil + } + if w != WireVarint { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := int64(x>>1) ^ int64(x)<<63>>63 + s := f.toInt64Slice() + *s = append(*s, v) + return b, nil +} + +func unmarshalUint64Value(b []byte, f pointer, w int) ([]byte, error) { + if w != WireVarint { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := uint64(x) + *f.toUint64() = v + return b, nil +} + +func unmarshalUint64Ptr(b []byte, f pointer, w int) ([]byte, error) { + if w != WireVarint { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := uint64(x) + *f.toUint64Ptr() = &v + return b, nil +} + +func unmarshalUint64Slice(b []byte, f pointer, w int) ([]byte, error) { + if w == WireBytes { // packed + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + res := b[x:] + b = b[:x] + for len(b) > 0 { + x, n = decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := uint64(x) + s := f.toUint64Slice() + *s = append(*s, v) + } + return res, nil + } + if w != WireVarint { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := uint64(x) + s := f.toUint64Slice() + *s = append(*s, v) + return b, nil +} + +func unmarshalInt32Value(b []byte, f pointer, w int) ([]byte, error) { + if w != WireVarint { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := int32(x) + *f.toInt32() = v + return b, nil +} + +func unmarshalInt32Ptr(b []byte, f pointer, w int) ([]byte, error) { + if w != WireVarint { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := int32(x) + f.setInt32Ptr(v) + return b, nil +} + +func unmarshalInt32Slice(b []byte, f pointer, w int) ([]byte, error) { + if w == WireBytes { // packed + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + res := b[x:] + b = b[:x] + for len(b) > 0 { + x, n = decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := int32(x) + f.appendInt32Slice(v) + } + return res, nil + } + if w != WireVarint { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := int32(x) + f.appendInt32Slice(v) + return b, nil +} + +func unmarshalSint32Value(b []byte, f pointer, w int) ([]byte, error) { + if w != WireVarint { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := int32(x>>1) ^ int32(x)<<31>>31 + *f.toInt32() = v + return b, nil +} + +func unmarshalSint32Ptr(b []byte, f pointer, w int) ([]byte, error) { + if w != WireVarint { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := int32(x>>1) ^ int32(x)<<31>>31 + f.setInt32Ptr(v) + return b, nil +} + +func unmarshalSint32Slice(b []byte, f pointer, w int) ([]byte, error) { + if w == WireBytes { // packed + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + res := b[x:] + b = b[:x] + for len(b) > 0 { + x, n = decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := int32(x>>1) ^ int32(x)<<31>>31 + f.appendInt32Slice(v) + } + return res, nil + } + if w != WireVarint { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := int32(x>>1) ^ int32(x)<<31>>31 + f.appendInt32Slice(v) + return b, nil +} + +func unmarshalUint32Value(b []byte, f pointer, w int) ([]byte, error) { + if w != WireVarint { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := uint32(x) + *f.toUint32() = v + return b, nil +} + +func unmarshalUint32Ptr(b []byte, f pointer, w int) ([]byte, error) { + if w != WireVarint { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := uint32(x) + *f.toUint32Ptr() = &v + return b, nil +} + +func unmarshalUint32Slice(b []byte, f pointer, w int) ([]byte, error) { + if w == WireBytes { // packed + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + res := b[x:] + b = b[:x] + for len(b) > 0 { + x, n = decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := uint32(x) + s := f.toUint32Slice() + *s = append(*s, v) + } + return res, nil + } + if w != WireVarint { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := uint32(x) + s := f.toUint32Slice() + *s = append(*s, v) + return b, nil +} + +func unmarshalFixed64Value(b []byte, f pointer, w int) ([]byte, error) { + if w != WireFixed64 { + return b, errInternalBadWireType + } + if len(b) < 8 { + return nil, io.ErrUnexpectedEOF + } + v := uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56 + *f.toUint64() = v + return b[8:], nil +} + +func unmarshalFixed64Ptr(b []byte, f pointer, w int) ([]byte, error) { + if w != WireFixed64 { + return b, errInternalBadWireType + } + if len(b) < 8 { + return nil, io.ErrUnexpectedEOF + } + v := uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56 + *f.toUint64Ptr() = &v + return b[8:], nil +} + +func unmarshalFixed64Slice(b []byte, f pointer, w int) ([]byte, error) { + if w == WireBytes { // packed + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + res := b[x:] + b = b[:x] + for len(b) > 0 { + if len(b) < 8 { + return nil, io.ErrUnexpectedEOF + } + v := uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56 + s := f.toUint64Slice() + *s = append(*s, v) + b = b[8:] + } + return res, nil + } + if w != WireFixed64 { + return b, errInternalBadWireType + } + if len(b) < 8 { + return nil, io.ErrUnexpectedEOF + } + v := uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56 + s := f.toUint64Slice() + *s = append(*s, v) + return b[8:], nil +} + +func unmarshalFixedS64Value(b []byte, f pointer, w int) ([]byte, error) { + if w != WireFixed64 { + return b, errInternalBadWireType + } + if len(b) < 8 { + return nil, io.ErrUnexpectedEOF + } + v := int64(b[0]) | int64(b[1])<<8 | int64(b[2])<<16 | int64(b[3])<<24 | int64(b[4])<<32 | int64(b[5])<<40 | int64(b[6])<<48 | int64(b[7])<<56 + *f.toInt64() = v + return b[8:], nil +} + +func unmarshalFixedS64Ptr(b []byte, f pointer, w int) ([]byte, error) { + if w != WireFixed64 { + return b, errInternalBadWireType + } + if len(b) < 8 { + return nil, io.ErrUnexpectedEOF + } + v := int64(b[0]) | int64(b[1])<<8 | int64(b[2])<<16 | int64(b[3])<<24 | int64(b[4])<<32 | int64(b[5])<<40 | int64(b[6])<<48 | int64(b[7])<<56 + *f.toInt64Ptr() = &v + return b[8:], nil +} + +func unmarshalFixedS64Slice(b []byte, f pointer, w int) ([]byte, error) { + if w == WireBytes { // packed + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + res := b[x:] + b = b[:x] + for len(b) > 0 { + if len(b) < 8 { + return nil, io.ErrUnexpectedEOF + } + v := int64(b[0]) | int64(b[1])<<8 | int64(b[2])<<16 | int64(b[3])<<24 | int64(b[4])<<32 | int64(b[5])<<40 | int64(b[6])<<48 | int64(b[7])<<56 + s := f.toInt64Slice() + *s = append(*s, v) + b = b[8:] + } + return res, nil + } + if w != WireFixed64 { + return b, errInternalBadWireType + } + if len(b) < 8 { + return nil, io.ErrUnexpectedEOF + } + v := int64(b[0]) | int64(b[1])<<8 | int64(b[2])<<16 | int64(b[3])<<24 | int64(b[4])<<32 | int64(b[5])<<40 | int64(b[6])<<48 | int64(b[7])<<56 + s := f.toInt64Slice() + *s = append(*s, v) + return b[8:], nil +} + +func unmarshalFixed32Value(b []byte, f pointer, w int) ([]byte, error) { + if w != WireFixed32 { + return b, errInternalBadWireType + } + if len(b) < 4 { + return nil, io.ErrUnexpectedEOF + } + v := uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24 + *f.toUint32() = v + return b[4:], nil +} + +func unmarshalFixed32Ptr(b []byte, f pointer, w int) ([]byte, error) { + if w != WireFixed32 { + return b, errInternalBadWireType + } + if len(b) < 4 { + return nil, io.ErrUnexpectedEOF + } + v := uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24 + *f.toUint32Ptr() = &v + return b[4:], nil +} + +func unmarshalFixed32Slice(b []byte, f pointer, w int) ([]byte, error) { + if w == WireBytes { // packed + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + res := b[x:] + b = b[:x] + for len(b) > 0 { + if len(b) < 4 { + return nil, io.ErrUnexpectedEOF + } + v := uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24 + s := f.toUint32Slice() + *s = append(*s, v) + b = b[4:] + } + return res, nil + } + if w != WireFixed32 { + return b, errInternalBadWireType + } + if len(b) < 4 { + return nil, io.ErrUnexpectedEOF + } + v := uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24 + s := f.toUint32Slice() + *s = append(*s, v) + return b[4:], nil +} + +func unmarshalFixedS32Value(b []byte, f pointer, w int) ([]byte, error) { + if w != WireFixed32 { + return b, errInternalBadWireType + } + if len(b) < 4 { + return nil, io.ErrUnexpectedEOF + } + v := int32(b[0]) | int32(b[1])<<8 | int32(b[2])<<16 | int32(b[3])<<24 + *f.toInt32() = v + return b[4:], nil +} + +func unmarshalFixedS32Ptr(b []byte, f pointer, w int) ([]byte, error) { + if w != WireFixed32 { + return b, errInternalBadWireType + } + if len(b) < 4 { + return nil, io.ErrUnexpectedEOF + } + v := int32(b[0]) | int32(b[1])<<8 | int32(b[2])<<16 | int32(b[3])<<24 + f.setInt32Ptr(v) + return b[4:], nil +} + +func unmarshalFixedS32Slice(b []byte, f pointer, w int) ([]byte, error) { + if w == WireBytes { // packed + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + res := b[x:] + b = b[:x] + for len(b) > 0 { + if len(b) < 4 { + return nil, io.ErrUnexpectedEOF + } + v := int32(b[0]) | int32(b[1])<<8 | int32(b[2])<<16 | int32(b[3])<<24 + f.appendInt32Slice(v) + b = b[4:] + } + return res, nil + } + if w != WireFixed32 { + return b, errInternalBadWireType + } + if len(b) < 4 { + return nil, io.ErrUnexpectedEOF + } + v := int32(b[0]) | int32(b[1])<<8 | int32(b[2])<<16 | int32(b[3])<<24 + f.appendInt32Slice(v) + return b[4:], nil +} + +func unmarshalBoolValue(b []byte, f pointer, w int) ([]byte, error) { + if w != WireVarint { + return b, errInternalBadWireType + } + // Note: any length varint is allowed, even though any sane + // encoder will use one byte. + // See https://github.com/golang/protobuf/issues/76 + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + // TODO: check if x>1? Tests seem to indicate no. + v := x != 0 + *f.toBool() = v + return b[n:], nil +} + +func unmarshalBoolPtr(b []byte, f pointer, w int) ([]byte, error) { + if w != WireVarint { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + v := x != 0 + *f.toBoolPtr() = &v + return b[n:], nil +} + +func unmarshalBoolSlice(b []byte, f pointer, w int) ([]byte, error) { + if w == WireBytes { // packed + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + res := b[x:] + b = b[:x] + for len(b) > 0 { + x, n = decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + v := x != 0 + s := f.toBoolSlice() + *s = append(*s, v) + b = b[n:] + } + return res, nil + } + if w != WireVarint { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + v := x != 0 + s := f.toBoolSlice() + *s = append(*s, v) + return b[n:], nil +} + +func unmarshalFloat64Value(b []byte, f pointer, w int) ([]byte, error) { + if w != WireFixed64 { + return b, errInternalBadWireType + } + if len(b) < 8 { + return nil, io.ErrUnexpectedEOF + } + v := math.Float64frombits(uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56) + *f.toFloat64() = v + return b[8:], nil +} + +func unmarshalFloat64Ptr(b []byte, f pointer, w int) ([]byte, error) { + if w != WireFixed64 { + return b, errInternalBadWireType + } + if len(b) < 8 { + return nil, io.ErrUnexpectedEOF + } + v := math.Float64frombits(uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56) + *f.toFloat64Ptr() = &v + return b[8:], nil +} + +func unmarshalFloat64Slice(b []byte, f pointer, w int) ([]byte, error) { + if w == WireBytes { // packed + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + res := b[x:] + b = b[:x] + for len(b) > 0 { + if len(b) < 8 { + return nil, io.ErrUnexpectedEOF + } + v := math.Float64frombits(uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56) + s := f.toFloat64Slice() + *s = append(*s, v) + b = b[8:] + } + return res, nil + } + if w != WireFixed64 { + return b, errInternalBadWireType + } + if len(b) < 8 { + return nil, io.ErrUnexpectedEOF + } + v := math.Float64frombits(uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56) + s := f.toFloat64Slice() + *s = append(*s, v) + return b[8:], nil +} + +func unmarshalFloat32Value(b []byte, f pointer, w int) ([]byte, error) { + if w != WireFixed32 { + return b, errInternalBadWireType + } + if len(b) < 4 { + return nil, io.ErrUnexpectedEOF + } + v := math.Float32frombits(uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24) + *f.toFloat32() = v + return b[4:], nil +} + +func unmarshalFloat32Ptr(b []byte, f pointer, w int) ([]byte, error) { + if w != WireFixed32 { + return b, errInternalBadWireType + } + if len(b) < 4 { + return nil, io.ErrUnexpectedEOF + } + v := math.Float32frombits(uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24) + *f.toFloat32Ptr() = &v + return b[4:], nil +} + +func unmarshalFloat32Slice(b []byte, f pointer, w int) ([]byte, error) { + if w == WireBytes { // packed + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + res := b[x:] + b = b[:x] + for len(b) > 0 { + if len(b) < 4 { + return nil, io.ErrUnexpectedEOF + } + v := math.Float32frombits(uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24) + s := f.toFloat32Slice() + *s = append(*s, v) + b = b[4:] + } + return res, nil + } + if w != WireFixed32 { + return b, errInternalBadWireType + } + if len(b) < 4 { + return nil, io.ErrUnexpectedEOF + } + v := math.Float32frombits(uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24) + s := f.toFloat32Slice() + *s = append(*s, v) + return b[4:], nil +} + +func unmarshalStringValue(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + v := string(b[:x]) + if !utf8.ValidString(v) { + return nil, errInvalidUTF8 + } + *f.toString() = v + return b[x:], nil +} + +func unmarshalStringPtr(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + v := string(b[:x]) + if !utf8.ValidString(v) { + return nil, errInvalidUTF8 + } + *f.toStringPtr() = &v + return b[x:], nil +} + +func unmarshalStringSlice(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + v := string(b[:x]) + if !utf8.ValidString(v) { + return nil, errInvalidUTF8 + } + s := f.toStringSlice() + *s = append(*s, v) + return b[x:], nil +} + +var emptyBuf [0]byte + +func unmarshalBytesValue(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + // The use of append here is a trick which avoids the zeroing + // that would be required if we used a make/copy pair. + // We append to emptyBuf instead of nil because we want + // a non-nil result even when the length is 0. + v := append(emptyBuf[:], b[:x]...) + *f.toBytes() = v + return b[x:], nil +} + +func unmarshalBytesSlice(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + v := append(emptyBuf[:], b[:x]...) + s := f.toBytesSlice() + *s = append(*s, v) + return b[x:], nil +} + +func makeUnmarshalMessagePtr(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + // First read the message field to see if something is there. + // The semantics of multiple submessages are weird. Instead of + // the last one winning (as it is for all other fields), multiple + // submessages are merged. + v := f.getPointer() + if v.isNil() { + v = valToPointer(reflect.New(sub.typ)) + f.setPointer(v) + } + err := sub.unmarshal(v, b[:x]) + if err != nil { + if r, ok := err.(*RequiredNotSetError); ok { + r.field = name + "." + r.field + } else { + return nil, err + } + } + return b[x:], err + } +} + +func makeUnmarshalMessageSlicePtr(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + v := valToPointer(reflect.New(sub.typ)) + err := sub.unmarshal(v, b[:x]) + if err != nil { + if r, ok := err.(*RequiredNotSetError); ok { + r.field = name + "." + r.field + } else { + return nil, err + } + } + f.appendPointer(v) + return b[x:], err + } +} + +func makeUnmarshalGroupPtr(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireStartGroup { + return b, errInternalBadWireType + } + x, y := findEndGroup(b) + if x < 0 { + return nil, io.ErrUnexpectedEOF + } + v := f.getPointer() + if v.isNil() { + v = valToPointer(reflect.New(sub.typ)) + f.setPointer(v) + } + err := sub.unmarshal(v, b[:x]) + if err != nil { + if r, ok := err.(*RequiredNotSetError); ok { + r.field = name + "." + r.field + } else { + return nil, err + } + } + return b[y:], err + } +} + +func makeUnmarshalGroupSlicePtr(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireStartGroup { + return b, errInternalBadWireType + } + x, y := findEndGroup(b) + if x < 0 { + return nil, io.ErrUnexpectedEOF + } + v := valToPointer(reflect.New(sub.typ)) + err := sub.unmarshal(v, b[:x]) + if err != nil { + if r, ok := err.(*RequiredNotSetError); ok { + r.field = name + "." + r.field + } else { + return nil, err + } + } + f.appendPointer(v) + return b[y:], err + } +} + +func makeUnmarshalMap(f *reflect.StructField) unmarshaler { + t := f.Type + kt := t.Key() + vt := t.Elem() + unmarshalKey := typeUnmarshaler(kt, f.Tag.Get("protobuf_key")) + unmarshalVal := typeUnmarshaler(vt, f.Tag.Get("protobuf_val")) + return func(b []byte, f pointer, w int) ([]byte, error) { + // The map entry is a submessage. Figure out how big it is. + if w != WireBytes { + return nil, fmt.Errorf("proto: bad wiretype for map field: got %d want %d", w, WireBytes) + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + r := b[x:] // unused data to return + b = b[:x] // data for map entry + + // Note: we could use #keys * #values ~= 200 functions + // to do map decoding without reflection. Probably not worth it. + // Maps will be somewhat slow. Oh well. + + // Read key and value from data. + k := reflect.New(kt) + v := reflect.New(vt) + for len(b) > 0 { + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + wire := int(x) & 7 + b = b[n:] + + var err error + switch x >> 3 { + case 1: + b, err = unmarshalKey(b, valToPointer(k), wire) + case 2: + b, err = unmarshalVal(b, valToPointer(v), wire) + default: + err = errInternalBadWireType // skip unknown tag + } + + if err == nil { + continue + } + if err != errInternalBadWireType { + return nil, err + } + + // Skip past unknown fields. + b, err = skipField(b, wire) + if err != nil { + return nil, err + } + } + + // Get map, allocate if needed. + m := f.asPointerTo(t).Elem() // an addressable map[K]T + if m.IsNil() { + m.Set(reflect.MakeMap(t)) + } + + // Insert into map. + m.SetMapIndex(k.Elem(), v.Elem()) + + return r, nil + } +} + +// makeUnmarshalOneof makes an unmarshaler for oneof fields. +// for: +// message Msg { +// oneof F { +// int64 X = 1; +// float64 Y = 2; +// } +// } +// typ is the type of the concrete entry for a oneof case (e.g. Msg_X). +// ityp is the interface type of the oneof field (e.g. isMsg_F). +// unmarshal is the unmarshaler for the base type of the oneof case (e.g. int64). +// Note that this function will be called once for each case in the oneof. +func makeUnmarshalOneof(typ, ityp reflect.Type, unmarshal unmarshaler) unmarshaler { + sf := typ.Field(0) + field0 := toField(&sf) + return func(b []byte, f pointer, w int) ([]byte, error) { + // Allocate holder for value. + v := reflect.New(typ) + + // Unmarshal data into holder. + // We unmarshal into the first field of the holder object. + var err error + b, err = unmarshal(b, valToPointer(v).offset(field0), w) + if err != nil { + return nil, err + } + + // Write pointer to holder into target field. + f.asPointerTo(ityp).Elem().Set(v) + + return b, nil + } +} + +// Error used by decode internally. +var errInternalBadWireType = errors.New("proto: internal error: bad wiretype") + +// skipField skips past a field of type wire and returns the remaining bytes. +func skipField(b []byte, wire int) ([]byte, error) { + switch wire { + case WireVarint: + _, k := decodeVarint(b) + if k == 0 { + return b, io.ErrUnexpectedEOF + } + b = b[k:] + case WireFixed32: + if len(b) < 4 { + return b, io.ErrUnexpectedEOF + } + b = b[4:] + case WireFixed64: + if len(b) < 8 { + return b, io.ErrUnexpectedEOF + } + b = b[8:] + case WireBytes: + m, k := decodeVarint(b) + if k == 0 || uint64(len(b)-k) < m { + return b, io.ErrUnexpectedEOF + } + b = b[uint64(k)+m:] + case WireStartGroup: + _, i := findEndGroup(b) + if i == -1 { + return b, io.ErrUnexpectedEOF + } + b = b[i:] + default: + return b, fmt.Errorf("proto: can't skip unknown wire type %d", wire) + } + return b, nil +} + +// findEndGroup finds the index of the next EndGroup tag. +// Groups may be nested, so the "next" EndGroup tag is the first +// unpaired EndGroup. +// findEndGroup returns the indexes of the start and end of the EndGroup tag. +// Returns (-1,-1) if it can't find one. +func findEndGroup(b []byte) (int, int) { + depth := 1 + i := 0 + for { + x, n := decodeVarint(b[i:]) + if n == 0 { + return -1, -1 + } + j := i + i += n + switch x & 7 { + case WireVarint: + _, k := decodeVarint(b[i:]) + if k == 0 { + return -1, -1 + } + i += k + case WireFixed32: + if len(b)-4 < i { + return -1, -1 + } + i += 4 + case WireFixed64: + if len(b)-8 < i { + return -1, -1 + } + i += 8 + case WireBytes: + m, k := decodeVarint(b[i:]) + if k == 0 { + return -1, -1 + } + i += k + if uint64(len(b)-i) < m { + return -1, -1 + } + i += int(m) + case WireStartGroup: + depth++ + case WireEndGroup: + depth-- + if depth == 0 { + return j, i + } + default: + return -1, -1 + } + } +} + +// encodeVarint appends a varint-encoded integer to b and returns the result. +func encodeVarint(b []byte, x uint64) []byte { + for x >= 1<<7 { + b = append(b, byte(x&0x7f|0x80)) + x >>= 7 + } + return append(b, byte(x)) +} + +// decodeVarint reads a varint-encoded integer from b. +// Returns the decoded integer and the number of bytes read. +// If there is an error, it returns 0,0. +func decodeVarint(b []byte) (uint64, int) { + var x, y uint64 + if len(b) <= 0 { + goto bad + } + x = uint64(b[0]) + if x < 0x80 { + return x, 1 + } + x -= 0x80 + + if len(b) <= 1 { + goto bad + } + y = uint64(b[1]) + x += y << 7 + if y < 0x80 { + return x, 2 + } + x -= 0x80 << 7 + + if len(b) <= 2 { + goto bad + } + y = uint64(b[2]) + x += y << 14 + if y < 0x80 { + return x, 3 + } + x -= 0x80 << 14 + + if len(b) <= 3 { + goto bad + } + y = uint64(b[3]) + x += y << 21 + if y < 0x80 { + return x, 4 + } + x -= 0x80 << 21 + + if len(b) <= 4 { + goto bad + } + y = uint64(b[4]) + x += y << 28 + if y < 0x80 { + return x, 5 + } + x -= 0x80 << 28 + + if len(b) <= 5 { + goto bad + } + y = uint64(b[5]) + x += y << 35 + if y < 0x80 { + return x, 6 + } + x -= 0x80 << 35 + + if len(b) <= 6 { + goto bad + } + y = uint64(b[6]) + x += y << 42 + if y < 0x80 { + return x, 7 + } + x -= 0x80 << 42 + + if len(b) <= 7 { + goto bad + } + y = uint64(b[7]) + x += y << 49 + if y < 0x80 { + return x, 8 + } + x -= 0x80 << 49 + + if len(b) <= 8 { + goto bad + } + y = uint64(b[8]) + x += y << 56 + if y < 0x80 { + return x, 9 + } + x -= 0x80 << 56 + + if len(b) <= 9 { + goto bad + } + y = uint64(b[9]) + x += y << 63 + if y < 2 { + return x, 10 + } + +bad: + return 0, 0 +} diff --git a/vendor/github.com/golang/protobuf/proto/test_proto/test.pb.go b/vendor/github.com/golang/protobuf/proto/test_proto/test.pb.go new file mode 100644 index 000000000..049b5dd2c --- /dev/null +++ b/vendor/github.com/golang/protobuf/proto/test_proto/test.pb.go @@ -0,0 +1,5118 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: test_proto/test.proto + +package test_proto // import "github.com/golang/protobuf/proto/test_proto" + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type FOO int32 + +const ( + FOO_FOO1 FOO = 1 +) + +var FOO_name = map[int32]string{ + 1: "FOO1", +} +var FOO_value = map[string]int32{ + "FOO1": 1, +} + +func (x FOO) Enum() *FOO { + p := new(FOO) + *p = x + return p +} +func (x FOO) String() string { + return proto.EnumName(FOO_name, int32(x)) +} +func (x *FOO) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(FOO_value, data, "FOO") + if err != nil { + return err + } + *x = FOO(value) + return nil +} +func (FOO) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_test_74787bfc6550f8a7, []int{0} +} + +// An enum, for completeness. +type GoTest_KIND int32 + +const ( + GoTest_VOID GoTest_KIND = 0 + // Basic types + GoTest_BOOL GoTest_KIND = 1 + GoTest_BYTES GoTest_KIND = 2 + GoTest_FINGERPRINT GoTest_KIND = 3 + GoTest_FLOAT GoTest_KIND = 4 + GoTest_INT GoTest_KIND = 5 + GoTest_STRING GoTest_KIND = 6 + GoTest_TIME GoTest_KIND = 7 + // Groupings + GoTest_TUPLE GoTest_KIND = 8 + GoTest_ARRAY GoTest_KIND = 9 + GoTest_MAP GoTest_KIND = 10 + // Table types + GoTest_TABLE GoTest_KIND = 11 + // Functions + GoTest_FUNCTION GoTest_KIND = 12 +) + +var GoTest_KIND_name = map[int32]string{ + 0: "VOID", + 1: "BOOL", + 2: "BYTES", + 3: "FINGERPRINT", + 4: "FLOAT", + 5: "INT", + 6: "STRING", + 7: "TIME", + 8: "TUPLE", + 9: "ARRAY", + 10: "MAP", + 11: "TABLE", + 12: "FUNCTION", +} +var GoTest_KIND_value = map[string]int32{ + "VOID": 0, + "BOOL": 1, + "BYTES": 2, + "FINGERPRINT": 3, + "FLOAT": 4, + "INT": 5, + "STRING": 6, + "TIME": 7, + "TUPLE": 8, + "ARRAY": 9, + "MAP": 10, + "TABLE": 11, + "FUNCTION": 12, +} + +func (x GoTest_KIND) Enum() *GoTest_KIND { + p := new(GoTest_KIND) + *p = x + return p +} +func (x GoTest_KIND) String() string { + return proto.EnumName(GoTest_KIND_name, int32(x)) +} +func (x *GoTest_KIND) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(GoTest_KIND_value, data, "GoTest_KIND") + if err != nil { + return err + } + *x = GoTest_KIND(value) + return nil +} +func (GoTest_KIND) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_test_74787bfc6550f8a7, []int{2, 0} +} + +type MyMessage_Color int32 + +const ( + MyMessage_RED MyMessage_Color = 0 + MyMessage_GREEN MyMessage_Color = 1 + MyMessage_BLUE MyMessage_Color = 2 +) + +var MyMessage_Color_name = map[int32]string{ + 0: "RED", + 1: "GREEN", + 2: "BLUE", +} +var MyMessage_Color_value = map[string]int32{ + "RED": 0, + "GREEN": 1, + "BLUE": 2, +} + +func (x MyMessage_Color) Enum() *MyMessage_Color { + p := new(MyMessage_Color) + *p = x + return p +} +func (x MyMessage_Color) String() string { + return proto.EnumName(MyMessage_Color_name, int32(x)) +} +func (x *MyMessage_Color) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(MyMessage_Color_value, data, "MyMessage_Color") + if err != nil { + return err + } + *x = MyMessage_Color(value) + return nil +} +func (MyMessage_Color) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_test_74787bfc6550f8a7, []int{13, 0} +} + +type DefaultsMessage_DefaultsEnum int32 + +const ( + DefaultsMessage_ZERO DefaultsMessage_DefaultsEnum = 0 + DefaultsMessage_ONE DefaultsMessage_DefaultsEnum = 1 + DefaultsMessage_TWO DefaultsMessage_DefaultsEnum = 2 +) + +var DefaultsMessage_DefaultsEnum_name = map[int32]string{ + 0: "ZERO", + 1: "ONE", + 2: "TWO", +} +var DefaultsMessage_DefaultsEnum_value = map[string]int32{ + "ZERO": 0, + "ONE": 1, + "TWO": 2, +} + +func (x DefaultsMessage_DefaultsEnum) Enum() *DefaultsMessage_DefaultsEnum { + p := new(DefaultsMessage_DefaultsEnum) + *p = x + return p +} +func (x DefaultsMessage_DefaultsEnum) String() string { + return proto.EnumName(DefaultsMessage_DefaultsEnum_name, int32(x)) +} +func (x *DefaultsMessage_DefaultsEnum) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(DefaultsMessage_DefaultsEnum_value, data, "DefaultsMessage_DefaultsEnum") + if err != nil { + return err + } + *x = DefaultsMessage_DefaultsEnum(value) + return nil +} +func (DefaultsMessage_DefaultsEnum) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_test_74787bfc6550f8a7, []int{16, 0} +} + +type Defaults_Color int32 + +const ( + Defaults_RED Defaults_Color = 0 + Defaults_GREEN Defaults_Color = 1 + Defaults_BLUE Defaults_Color = 2 +) + +var Defaults_Color_name = map[int32]string{ + 0: "RED", + 1: "GREEN", + 2: "BLUE", +} +var Defaults_Color_value = map[string]int32{ + "RED": 0, + "GREEN": 1, + "BLUE": 2, +} + +func (x Defaults_Color) Enum() *Defaults_Color { + p := new(Defaults_Color) + *p = x + return p +} +func (x Defaults_Color) String() string { + return proto.EnumName(Defaults_Color_name, int32(x)) +} +func (x *Defaults_Color) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(Defaults_Color_value, data, "Defaults_Color") + if err != nil { + return err + } + *x = Defaults_Color(value) + return nil +} +func (Defaults_Color) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_test_74787bfc6550f8a7, []int{21, 0} +} + +type RepeatedEnum_Color int32 + +const ( + RepeatedEnum_RED RepeatedEnum_Color = 1 +) + +var RepeatedEnum_Color_name = map[int32]string{ + 1: "RED", +} +var RepeatedEnum_Color_value = map[string]int32{ + "RED": 1, +} + +func (x RepeatedEnum_Color) Enum() *RepeatedEnum_Color { + p := new(RepeatedEnum_Color) + *p = x + return p +} +func (x RepeatedEnum_Color) String() string { + return proto.EnumName(RepeatedEnum_Color_name, int32(x)) +} +func (x *RepeatedEnum_Color) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(RepeatedEnum_Color_value, data, "RepeatedEnum_Color") + if err != nil { + return err + } + *x = RepeatedEnum_Color(value) + return nil +} +func (RepeatedEnum_Color) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_test_74787bfc6550f8a7, []int{23, 0} +} + +type GoEnum struct { + Foo *FOO `protobuf:"varint,1,req,name=foo,enum=test_proto.FOO" json:"foo,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GoEnum) Reset() { *m = GoEnum{} } +func (m *GoEnum) String() string { return proto.CompactTextString(m) } +func (*GoEnum) ProtoMessage() {} +func (*GoEnum) Descriptor() ([]byte, []int) { + return fileDescriptor_test_74787bfc6550f8a7, []int{0} +} +func (m *GoEnum) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GoEnum.Unmarshal(m, b) +} +func (m *GoEnum) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GoEnum.Marshal(b, m, deterministic) +} +func (dst *GoEnum) XXX_Merge(src proto.Message) { + xxx_messageInfo_GoEnum.Merge(dst, src) +} +func (m *GoEnum) XXX_Size() int { + return xxx_messageInfo_GoEnum.Size(m) +} +func (m *GoEnum) XXX_DiscardUnknown() { + xxx_messageInfo_GoEnum.DiscardUnknown(m) +} + +var xxx_messageInfo_GoEnum proto.InternalMessageInfo + +func (m *GoEnum) GetFoo() FOO { + if m != nil && m.Foo != nil { + return *m.Foo + } + return FOO_FOO1 +} + +type GoTestField struct { + Label *string `protobuf:"bytes,1,req,name=Label" json:"Label,omitempty"` + Type *string `protobuf:"bytes,2,req,name=Type" json:"Type,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GoTestField) Reset() { *m = GoTestField{} } +func (m *GoTestField) String() string { return proto.CompactTextString(m) } +func (*GoTestField) ProtoMessage() {} +func (*GoTestField) Descriptor() ([]byte, []int) { + return fileDescriptor_test_74787bfc6550f8a7, []int{1} +} +func (m *GoTestField) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GoTestField.Unmarshal(m, b) +} +func (m *GoTestField) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GoTestField.Marshal(b, m, deterministic) +} +func (dst *GoTestField) XXX_Merge(src proto.Message) { + xxx_messageInfo_GoTestField.Merge(dst, src) +} +func (m *GoTestField) XXX_Size() int { + return xxx_messageInfo_GoTestField.Size(m) +} +func (m *GoTestField) XXX_DiscardUnknown() { + xxx_messageInfo_GoTestField.DiscardUnknown(m) +} + +var xxx_messageInfo_GoTestField proto.InternalMessageInfo + +func (m *GoTestField) GetLabel() string { + if m != nil && m.Label != nil { + return *m.Label + } + return "" +} + +func (m *GoTestField) GetType() string { + if m != nil && m.Type != nil { + return *m.Type + } + return "" +} + +type GoTest struct { + // Some typical parameters + Kind *GoTest_KIND `protobuf:"varint,1,req,name=Kind,enum=test_proto.GoTest_KIND" json:"Kind,omitempty"` + Table *string `protobuf:"bytes,2,opt,name=Table" json:"Table,omitempty"` + Param *int32 `protobuf:"varint,3,opt,name=Param" json:"Param,omitempty"` + // Required, repeated and optional foreign fields. + RequiredField *GoTestField `protobuf:"bytes,4,req,name=RequiredField" json:"RequiredField,omitempty"` + RepeatedField []*GoTestField `protobuf:"bytes,5,rep,name=RepeatedField" json:"RepeatedField,omitempty"` + OptionalField *GoTestField `protobuf:"bytes,6,opt,name=OptionalField" json:"OptionalField,omitempty"` + // Required fields of all basic types + F_BoolRequired *bool `protobuf:"varint,10,req,name=F_Bool_required,json=FBoolRequired" json:"F_Bool_required,omitempty"` + F_Int32Required *int32 `protobuf:"varint,11,req,name=F_Int32_required,json=FInt32Required" json:"F_Int32_required,omitempty"` + F_Int64Required *int64 `protobuf:"varint,12,req,name=F_Int64_required,json=FInt64Required" json:"F_Int64_required,omitempty"` + F_Fixed32Required *uint32 `protobuf:"fixed32,13,req,name=F_Fixed32_required,json=FFixed32Required" json:"F_Fixed32_required,omitempty"` + F_Fixed64Required *uint64 `protobuf:"fixed64,14,req,name=F_Fixed64_required,json=FFixed64Required" json:"F_Fixed64_required,omitempty"` + F_Uint32Required *uint32 `protobuf:"varint,15,req,name=F_Uint32_required,json=FUint32Required" json:"F_Uint32_required,omitempty"` + F_Uint64Required *uint64 `protobuf:"varint,16,req,name=F_Uint64_required,json=FUint64Required" json:"F_Uint64_required,omitempty"` + F_FloatRequired *float32 `protobuf:"fixed32,17,req,name=F_Float_required,json=FFloatRequired" json:"F_Float_required,omitempty"` + F_DoubleRequired *float64 `protobuf:"fixed64,18,req,name=F_Double_required,json=FDoubleRequired" json:"F_Double_required,omitempty"` + F_StringRequired *string `protobuf:"bytes,19,req,name=F_String_required,json=FStringRequired" json:"F_String_required,omitempty"` + F_BytesRequired []byte `protobuf:"bytes,101,req,name=F_Bytes_required,json=FBytesRequired" json:"F_Bytes_required,omitempty"` + F_Sint32Required *int32 `protobuf:"zigzag32,102,req,name=F_Sint32_required,json=FSint32Required" json:"F_Sint32_required,omitempty"` + F_Sint64Required *int64 `protobuf:"zigzag64,103,req,name=F_Sint64_required,json=FSint64Required" json:"F_Sint64_required,omitempty"` + F_Sfixed32Required *int32 `protobuf:"fixed32,104,req,name=F_Sfixed32_required,json=FSfixed32Required" json:"F_Sfixed32_required,omitempty"` + F_Sfixed64Required *int64 `protobuf:"fixed64,105,req,name=F_Sfixed64_required,json=FSfixed64Required" json:"F_Sfixed64_required,omitempty"` + // Repeated fields of all basic types + F_BoolRepeated []bool `protobuf:"varint,20,rep,name=F_Bool_repeated,json=FBoolRepeated" json:"F_Bool_repeated,omitempty"` + F_Int32Repeated []int32 `protobuf:"varint,21,rep,name=F_Int32_repeated,json=FInt32Repeated" json:"F_Int32_repeated,omitempty"` + F_Int64Repeated []int64 `protobuf:"varint,22,rep,name=F_Int64_repeated,json=FInt64Repeated" json:"F_Int64_repeated,omitempty"` + F_Fixed32Repeated []uint32 `protobuf:"fixed32,23,rep,name=F_Fixed32_repeated,json=FFixed32Repeated" json:"F_Fixed32_repeated,omitempty"` + F_Fixed64Repeated []uint64 `protobuf:"fixed64,24,rep,name=F_Fixed64_repeated,json=FFixed64Repeated" json:"F_Fixed64_repeated,omitempty"` + F_Uint32Repeated []uint32 `protobuf:"varint,25,rep,name=F_Uint32_repeated,json=FUint32Repeated" json:"F_Uint32_repeated,omitempty"` + F_Uint64Repeated []uint64 `protobuf:"varint,26,rep,name=F_Uint64_repeated,json=FUint64Repeated" json:"F_Uint64_repeated,omitempty"` + F_FloatRepeated []float32 `protobuf:"fixed32,27,rep,name=F_Float_repeated,json=FFloatRepeated" json:"F_Float_repeated,omitempty"` + F_DoubleRepeated []float64 `protobuf:"fixed64,28,rep,name=F_Double_repeated,json=FDoubleRepeated" json:"F_Double_repeated,omitempty"` + F_StringRepeated []string `protobuf:"bytes,29,rep,name=F_String_repeated,json=FStringRepeated" json:"F_String_repeated,omitempty"` + F_BytesRepeated [][]byte `protobuf:"bytes,201,rep,name=F_Bytes_repeated,json=FBytesRepeated" json:"F_Bytes_repeated,omitempty"` + F_Sint32Repeated []int32 `protobuf:"zigzag32,202,rep,name=F_Sint32_repeated,json=FSint32Repeated" json:"F_Sint32_repeated,omitempty"` + F_Sint64Repeated []int64 `protobuf:"zigzag64,203,rep,name=F_Sint64_repeated,json=FSint64Repeated" json:"F_Sint64_repeated,omitempty"` + F_Sfixed32Repeated []int32 `protobuf:"fixed32,204,rep,name=F_Sfixed32_repeated,json=FSfixed32Repeated" json:"F_Sfixed32_repeated,omitempty"` + F_Sfixed64Repeated []int64 `protobuf:"fixed64,205,rep,name=F_Sfixed64_repeated,json=FSfixed64Repeated" json:"F_Sfixed64_repeated,omitempty"` + // Optional fields of all basic types + F_BoolOptional *bool `protobuf:"varint,30,opt,name=F_Bool_optional,json=FBoolOptional" json:"F_Bool_optional,omitempty"` + F_Int32Optional *int32 `protobuf:"varint,31,opt,name=F_Int32_optional,json=FInt32Optional" json:"F_Int32_optional,omitempty"` + F_Int64Optional *int64 `protobuf:"varint,32,opt,name=F_Int64_optional,json=FInt64Optional" json:"F_Int64_optional,omitempty"` + F_Fixed32Optional *uint32 `protobuf:"fixed32,33,opt,name=F_Fixed32_optional,json=FFixed32Optional" json:"F_Fixed32_optional,omitempty"` + F_Fixed64Optional *uint64 `protobuf:"fixed64,34,opt,name=F_Fixed64_optional,json=FFixed64Optional" json:"F_Fixed64_optional,omitempty"` + F_Uint32Optional *uint32 `protobuf:"varint,35,opt,name=F_Uint32_optional,json=FUint32Optional" json:"F_Uint32_optional,omitempty"` + F_Uint64Optional *uint64 `protobuf:"varint,36,opt,name=F_Uint64_optional,json=FUint64Optional" json:"F_Uint64_optional,omitempty"` + F_FloatOptional *float32 `protobuf:"fixed32,37,opt,name=F_Float_optional,json=FFloatOptional" json:"F_Float_optional,omitempty"` + F_DoubleOptional *float64 `protobuf:"fixed64,38,opt,name=F_Double_optional,json=FDoubleOptional" json:"F_Double_optional,omitempty"` + F_StringOptional *string `protobuf:"bytes,39,opt,name=F_String_optional,json=FStringOptional" json:"F_String_optional,omitempty"` + F_BytesOptional []byte `protobuf:"bytes,301,opt,name=F_Bytes_optional,json=FBytesOptional" json:"F_Bytes_optional,omitempty"` + F_Sint32Optional *int32 `protobuf:"zigzag32,302,opt,name=F_Sint32_optional,json=FSint32Optional" json:"F_Sint32_optional,omitempty"` + F_Sint64Optional *int64 `protobuf:"zigzag64,303,opt,name=F_Sint64_optional,json=FSint64Optional" json:"F_Sint64_optional,omitempty"` + F_Sfixed32Optional *int32 `protobuf:"fixed32,304,opt,name=F_Sfixed32_optional,json=FSfixed32Optional" json:"F_Sfixed32_optional,omitempty"` + F_Sfixed64Optional *int64 `protobuf:"fixed64,305,opt,name=F_Sfixed64_optional,json=FSfixed64Optional" json:"F_Sfixed64_optional,omitempty"` + // Default-valued fields of all basic types + F_BoolDefaulted *bool `protobuf:"varint,40,opt,name=F_Bool_defaulted,json=FBoolDefaulted,def=1" json:"F_Bool_defaulted,omitempty"` + F_Int32Defaulted *int32 `protobuf:"varint,41,opt,name=F_Int32_defaulted,json=FInt32Defaulted,def=32" json:"F_Int32_defaulted,omitempty"` + F_Int64Defaulted *int64 `protobuf:"varint,42,opt,name=F_Int64_defaulted,json=FInt64Defaulted,def=64" json:"F_Int64_defaulted,omitempty"` + F_Fixed32Defaulted *uint32 `protobuf:"fixed32,43,opt,name=F_Fixed32_defaulted,json=FFixed32Defaulted,def=320" json:"F_Fixed32_defaulted,omitempty"` + F_Fixed64Defaulted *uint64 `protobuf:"fixed64,44,opt,name=F_Fixed64_defaulted,json=FFixed64Defaulted,def=640" json:"F_Fixed64_defaulted,omitempty"` + F_Uint32Defaulted *uint32 `protobuf:"varint,45,opt,name=F_Uint32_defaulted,json=FUint32Defaulted,def=3200" json:"F_Uint32_defaulted,omitempty"` + F_Uint64Defaulted *uint64 `protobuf:"varint,46,opt,name=F_Uint64_defaulted,json=FUint64Defaulted,def=6400" json:"F_Uint64_defaulted,omitempty"` + F_FloatDefaulted *float32 `protobuf:"fixed32,47,opt,name=F_Float_defaulted,json=FFloatDefaulted,def=314159" json:"F_Float_defaulted,omitempty"` + F_DoubleDefaulted *float64 `protobuf:"fixed64,48,opt,name=F_Double_defaulted,json=FDoubleDefaulted,def=271828" json:"F_Double_defaulted,omitempty"` + F_StringDefaulted *string `protobuf:"bytes,49,opt,name=F_String_defaulted,json=FStringDefaulted,def=hello, \"world!\"\n" json:"F_String_defaulted,omitempty"` + F_BytesDefaulted []byte `protobuf:"bytes,401,opt,name=F_Bytes_defaulted,json=FBytesDefaulted,def=Bignose" json:"F_Bytes_defaulted,omitempty"` + F_Sint32Defaulted *int32 `protobuf:"zigzag32,402,opt,name=F_Sint32_defaulted,json=FSint32Defaulted,def=-32" json:"F_Sint32_defaulted,omitempty"` + F_Sint64Defaulted *int64 `protobuf:"zigzag64,403,opt,name=F_Sint64_defaulted,json=FSint64Defaulted,def=-64" json:"F_Sint64_defaulted,omitempty"` + F_Sfixed32Defaulted *int32 `protobuf:"fixed32,404,opt,name=F_Sfixed32_defaulted,json=FSfixed32Defaulted,def=-32" json:"F_Sfixed32_defaulted,omitempty"` + F_Sfixed64Defaulted *int64 `protobuf:"fixed64,405,opt,name=F_Sfixed64_defaulted,json=FSfixed64Defaulted,def=-64" json:"F_Sfixed64_defaulted,omitempty"` + // Packed repeated fields (no string or bytes). + F_BoolRepeatedPacked []bool `protobuf:"varint,50,rep,packed,name=F_Bool_repeated_packed,json=FBoolRepeatedPacked" json:"F_Bool_repeated_packed,omitempty"` + F_Int32RepeatedPacked []int32 `protobuf:"varint,51,rep,packed,name=F_Int32_repeated_packed,json=FInt32RepeatedPacked" json:"F_Int32_repeated_packed,omitempty"` + F_Int64RepeatedPacked []int64 `protobuf:"varint,52,rep,packed,name=F_Int64_repeated_packed,json=FInt64RepeatedPacked" json:"F_Int64_repeated_packed,omitempty"` + F_Fixed32RepeatedPacked []uint32 `protobuf:"fixed32,53,rep,packed,name=F_Fixed32_repeated_packed,json=FFixed32RepeatedPacked" json:"F_Fixed32_repeated_packed,omitempty"` + F_Fixed64RepeatedPacked []uint64 `protobuf:"fixed64,54,rep,packed,name=F_Fixed64_repeated_packed,json=FFixed64RepeatedPacked" json:"F_Fixed64_repeated_packed,omitempty"` + F_Uint32RepeatedPacked []uint32 `protobuf:"varint,55,rep,packed,name=F_Uint32_repeated_packed,json=FUint32RepeatedPacked" json:"F_Uint32_repeated_packed,omitempty"` + F_Uint64RepeatedPacked []uint64 `protobuf:"varint,56,rep,packed,name=F_Uint64_repeated_packed,json=FUint64RepeatedPacked" json:"F_Uint64_repeated_packed,omitempty"` + F_FloatRepeatedPacked []float32 `protobuf:"fixed32,57,rep,packed,name=F_Float_repeated_packed,json=FFloatRepeatedPacked" json:"F_Float_repeated_packed,omitempty"` + F_DoubleRepeatedPacked []float64 `protobuf:"fixed64,58,rep,packed,name=F_Double_repeated_packed,json=FDoubleRepeatedPacked" json:"F_Double_repeated_packed,omitempty"` + F_Sint32RepeatedPacked []int32 `protobuf:"zigzag32,502,rep,packed,name=F_Sint32_repeated_packed,json=FSint32RepeatedPacked" json:"F_Sint32_repeated_packed,omitempty"` + F_Sint64RepeatedPacked []int64 `protobuf:"zigzag64,503,rep,packed,name=F_Sint64_repeated_packed,json=FSint64RepeatedPacked" json:"F_Sint64_repeated_packed,omitempty"` + F_Sfixed32RepeatedPacked []int32 `protobuf:"fixed32,504,rep,packed,name=F_Sfixed32_repeated_packed,json=FSfixed32RepeatedPacked" json:"F_Sfixed32_repeated_packed,omitempty"` + F_Sfixed64RepeatedPacked []int64 `protobuf:"fixed64,505,rep,packed,name=F_Sfixed64_repeated_packed,json=FSfixed64RepeatedPacked" json:"F_Sfixed64_repeated_packed,omitempty"` + Requiredgroup *GoTest_RequiredGroup `protobuf:"group,70,req,name=RequiredGroup,json=requiredgroup" json:"requiredgroup,omitempty"` + Repeatedgroup []*GoTest_RepeatedGroup `protobuf:"group,80,rep,name=RepeatedGroup,json=repeatedgroup" json:"repeatedgroup,omitempty"` + Optionalgroup *GoTest_OptionalGroup `protobuf:"group,90,opt,name=OptionalGroup,json=optionalgroup" json:"optionalgroup,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GoTest) Reset() { *m = GoTest{} } +func (m *GoTest) String() string { return proto.CompactTextString(m) } +func (*GoTest) ProtoMessage() {} +func (*GoTest) Descriptor() ([]byte, []int) { + return fileDescriptor_test_74787bfc6550f8a7, []int{2} +} +func (m *GoTest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GoTest.Unmarshal(m, b) +} +func (m *GoTest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GoTest.Marshal(b, m, deterministic) +} +func (dst *GoTest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GoTest.Merge(dst, src) +} +func (m *GoTest) XXX_Size() int { + return xxx_messageInfo_GoTest.Size(m) +} +func (m *GoTest) XXX_DiscardUnknown() { + xxx_messageInfo_GoTest.DiscardUnknown(m) +} + +var xxx_messageInfo_GoTest proto.InternalMessageInfo + +const Default_GoTest_F_BoolDefaulted bool = true +const Default_GoTest_F_Int32Defaulted int32 = 32 +const Default_GoTest_F_Int64Defaulted int64 = 64 +const Default_GoTest_F_Fixed32Defaulted uint32 = 320 +const Default_GoTest_F_Fixed64Defaulted uint64 = 640 +const Default_GoTest_F_Uint32Defaulted uint32 = 3200 +const Default_GoTest_F_Uint64Defaulted uint64 = 6400 +const Default_GoTest_F_FloatDefaulted float32 = 314159 +const Default_GoTest_F_DoubleDefaulted float64 = 271828 +const Default_GoTest_F_StringDefaulted string = "hello, \"world!\"\n" + +var Default_GoTest_F_BytesDefaulted []byte = []byte("Bignose") + +const Default_GoTest_F_Sint32Defaulted int32 = -32 +const Default_GoTest_F_Sint64Defaulted int64 = -64 +const Default_GoTest_F_Sfixed32Defaulted int32 = -32 +const Default_GoTest_F_Sfixed64Defaulted int64 = -64 + +func (m *GoTest) GetKind() GoTest_KIND { + if m != nil && m.Kind != nil { + return *m.Kind + } + return GoTest_VOID +} + +func (m *GoTest) GetTable() string { + if m != nil && m.Table != nil { + return *m.Table + } + return "" +} + +func (m *GoTest) GetParam() int32 { + if m != nil && m.Param != nil { + return *m.Param + } + return 0 +} + +func (m *GoTest) GetRequiredField() *GoTestField { + if m != nil { + return m.RequiredField + } + return nil +} + +func (m *GoTest) GetRepeatedField() []*GoTestField { + if m != nil { + return m.RepeatedField + } + return nil +} + +func (m *GoTest) GetOptionalField() *GoTestField { + if m != nil { + return m.OptionalField + } + return nil +} + +func (m *GoTest) GetF_BoolRequired() bool { + if m != nil && m.F_BoolRequired != nil { + return *m.F_BoolRequired + } + return false +} + +func (m *GoTest) GetF_Int32Required() int32 { + if m != nil && m.F_Int32Required != nil { + return *m.F_Int32Required + } + return 0 +} + +func (m *GoTest) GetF_Int64Required() int64 { + if m != nil && m.F_Int64Required != nil { + return *m.F_Int64Required + } + return 0 +} + +func (m *GoTest) GetF_Fixed32Required() uint32 { + if m != nil && m.F_Fixed32Required != nil { + return *m.F_Fixed32Required + } + return 0 +} + +func (m *GoTest) GetF_Fixed64Required() uint64 { + if m != nil && m.F_Fixed64Required != nil { + return *m.F_Fixed64Required + } + return 0 +} + +func (m *GoTest) GetF_Uint32Required() uint32 { + if m != nil && m.F_Uint32Required != nil { + return *m.F_Uint32Required + } + return 0 +} + +func (m *GoTest) GetF_Uint64Required() uint64 { + if m != nil && m.F_Uint64Required != nil { + return *m.F_Uint64Required + } + return 0 +} + +func (m *GoTest) GetF_FloatRequired() float32 { + if m != nil && m.F_FloatRequired != nil { + return *m.F_FloatRequired + } + return 0 +} + +func (m *GoTest) GetF_DoubleRequired() float64 { + if m != nil && m.F_DoubleRequired != nil { + return *m.F_DoubleRequired + } + return 0 +} + +func (m *GoTest) GetF_StringRequired() string { + if m != nil && m.F_StringRequired != nil { + return *m.F_StringRequired + } + return "" +} + +func (m *GoTest) GetF_BytesRequired() []byte { + if m != nil { + return m.F_BytesRequired + } + return nil +} + +func (m *GoTest) GetF_Sint32Required() int32 { + if m != nil && m.F_Sint32Required != nil { + return *m.F_Sint32Required + } + return 0 +} + +func (m *GoTest) GetF_Sint64Required() int64 { + if m != nil && m.F_Sint64Required != nil { + return *m.F_Sint64Required + } + return 0 +} + +func (m *GoTest) GetF_Sfixed32Required() int32 { + if m != nil && m.F_Sfixed32Required != nil { + return *m.F_Sfixed32Required + } + return 0 +} + +func (m *GoTest) GetF_Sfixed64Required() int64 { + if m != nil && m.F_Sfixed64Required != nil { + return *m.F_Sfixed64Required + } + return 0 +} + +func (m *GoTest) GetF_BoolRepeated() []bool { + if m != nil { + return m.F_BoolRepeated + } + return nil +} + +func (m *GoTest) GetF_Int32Repeated() []int32 { + if m != nil { + return m.F_Int32Repeated + } + return nil +} + +func (m *GoTest) GetF_Int64Repeated() []int64 { + if m != nil { + return m.F_Int64Repeated + } + return nil +} + +func (m *GoTest) GetF_Fixed32Repeated() []uint32 { + if m != nil { + return m.F_Fixed32Repeated + } + return nil +} + +func (m *GoTest) GetF_Fixed64Repeated() []uint64 { + if m != nil { + return m.F_Fixed64Repeated + } + return nil +} + +func (m *GoTest) GetF_Uint32Repeated() []uint32 { + if m != nil { + return m.F_Uint32Repeated + } + return nil +} + +func (m *GoTest) GetF_Uint64Repeated() []uint64 { + if m != nil { + return m.F_Uint64Repeated + } + return nil +} + +func (m *GoTest) GetF_FloatRepeated() []float32 { + if m != nil { + return m.F_FloatRepeated + } + return nil +} + +func (m *GoTest) GetF_DoubleRepeated() []float64 { + if m != nil { + return m.F_DoubleRepeated + } + return nil +} + +func (m *GoTest) GetF_StringRepeated() []string { + if m != nil { + return m.F_StringRepeated + } + return nil +} + +func (m *GoTest) GetF_BytesRepeated() [][]byte { + if m != nil { + return m.F_BytesRepeated + } + return nil +} + +func (m *GoTest) GetF_Sint32Repeated() []int32 { + if m != nil { + return m.F_Sint32Repeated + } + return nil +} + +func (m *GoTest) GetF_Sint64Repeated() []int64 { + if m != nil { + return m.F_Sint64Repeated + } + return nil +} + +func (m *GoTest) GetF_Sfixed32Repeated() []int32 { + if m != nil { + return m.F_Sfixed32Repeated + } + return nil +} + +func (m *GoTest) GetF_Sfixed64Repeated() []int64 { + if m != nil { + return m.F_Sfixed64Repeated + } + return nil +} + +func (m *GoTest) GetF_BoolOptional() bool { + if m != nil && m.F_BoolOptional != nil { + return *m.F_BoolOptional + } + return false +} + +func (m *GoTest) GetF_Int32Optional() int32 { + if m != nil && m.F_Int32Optional != nil { + return *m.F_Int32Optional + } + return 0 +} + +func (m *GoTest) GetF_Int64Optional() int64 { + if m != nil && m.F_Int64Optional != nil { + return *m.F_Int64Optional + } + return 0 +} + +func (m *GoTest) GetF_Fixed32Optional() uint32 { + if m != nil && m.F_Fixed32Optional != nil { + return *m.F_Fixed32Optional + } + return 0 +} + +func (m *GoTest) GetF_Fixed64Optional() uint64 { + if m != nil && m.F_Fixed64Optional != nil { + return *m.F_Fixed64Optional + } + return 0 +} + +func (m *GoTest) GetF_Uint32Optional() uint32 { + if m != nil && m.F_Uint32Optional != nil { + return *m.F_Uint32Optional + } + return 0 +} + +func (m *GoTest) GetF_Uint64Optional() uint64 { + if m != nil && m.F_Uint64Optional != nil { + return *m.F_Uint64Optional + } + return 0 +} + +func (m *GoTest) GetF_FloatOptional() float32 { + if m != nil && m.F_FloatOptional != nil { + return *m.F_FloatOptional + } + return 0 +} + +func (m *GoTest) GetF_DoubleOptional() float64 { + if m != nil && m.F_DoubleOptional != nil { + return *m.F_DoubleOptional + } + return 0 +} + +func (m *GoTest) GetF_StringOptional() string { + if m != nil && m.F_StringOptional != nil { + return *m.F_StringOptional + } + return "" +} + +func (m *GoTest) GetF_BytesOptional() []byte { + if m != nil { + return m.F_BytesOptional + } + return nil +} + +func (m *GoTest) GetF_Sint32Optional() int32 { + if m != nil && m.F_Sint32Optional != nil { + return *m.F_Sint32Optional + } + return 0 +} + +func (m *GoTest) GetF_Sint64Optional() int64 { + if m != nil && m.F_Sint64Optional != nil { + return *m.F_Sint64Optional + } + return 0 +} + +func (m *GoTest) GetF_Sfixed32Optional() int32 { + if m != nil && m.F_Sfixed32Optional != nil { + return *m.F_Sfixed32Optional + } + return 0 +} + +func (m *GoTest) GetF_Sfixed64Optional() int64 { + if m != nil && m.F_Sfixed64Optional != nil { + return *m.F_Sfixed64Optional + } + return 0 +} + +func (m *GoTest) GetF_BoolDefaulted() bool { + if m != nil && m.F_BoolDefaulted != nil { + return *m.F_BoolDefaulted + } + return Default_GoTest_F_BoolDefaulted +} + +func (m *GoTest) GetF_Int32Defaulted() int32 { + if m != nil && m.F_Int32Defaulted != nil { + return *m.F_Int32Defaulted + } + return Default_GoTest_F_Int32Defaulted +} + +func (m *GoTest) GetF_Int64Defaulted() int64 { + if m != nil && m.F_Int64Defaulted != nil { + return *m.F_Int64Defaulted + } + return Default_GoTest_F_Int64Defaulted +} + +func (m *GoTest) GetF_Fixed32Defaulted() uint32 { + if m != nil && m.F_Fixed32Defaulted != nil { + return *m.F_Fixed32Defaulted + } + return Default_GoTest_F_Fixed32Defaulted +} + +func (m *GoTest) GetF_Fixed64Defaulted() uint64 { + if m != nil && m.F_Fixed64Defaulted != nil { + return *m.F_Fixed64Defaulted + } + return Default_GoTest_F_Fixed64Defaulted +} + +func (m *GoTest) GetF_Uint32Defaulted() uint32 { + if m != nil && m.F_Uint32Defaulted != nil { + return *m.F_Uint32Defaulted + } + return Default_GoTest_F_Uint32Defaulted +} + +func (m *GoTest) GetF_Uint64Defaulted() uint64 { + if m != nil && m.F_Uint64Defaulted != nil { + return *m.F_Uint64Defaulted + } + return Default_GoTest_F_Uint64Defaulted +} + +func (m *GoTest) GetF_FloatDefaulted() float32 { + if m != nil && m.F_FloatDefaulted != nil { + return *m.F_FloatDefaulted + } + return Default_GoTest_F_FloatDefaulted +} + +func (m *GoTest) GetF_DoubleDefaulted() float64 { + if m != nil && m.F_DoubleDefaulted != nil { + return *m.F_DoubleDefaulted + } + return Default_GoTest_F_DoubleDefaulted +} + +func (m *GoTest) GetF_StringDefaulted() string { + if m != nil && m.F_StringDefaulted != nil { + return *m.F_StringDefaulted + } + return Default_GoTest_F_StringDefaulted +} + +func (m *GoTest) GetF_BytesDefaulted() []byte { + if m != nil && m.F_BytesDefaulted != nil { + return m.F_BytesDefaulted + } + return append([]byte(nil), Default_GoTest_F_BytesDefaulted...) +} + +func (m *GoTest) GetF_Sint32Defaulted() int32 { + if m != nil && m.F_Sint32Defaulted != nil { + return *m.F_Sint32Defaulted + } + return Default_GoTest_F_Sint32Defaulted +} + +func (m *GoTest) GetF_Sint64Defaulted() int64 { + if m != nil && m.F_Sint64Defaulted != nil { + return *m.F_Sint64Defaulted + } + return Default_GoTest_F_Sint64Defaulted +} + +func (m *GoTest) GetF_Sfixed32Defaulted() int32 { + if m != nil && m.F_Sfixed32Defaulted != nil { + return *m.F_Sfixed32Defaulted + } + return Default_GoTest_F_Sfixed32Defaulted +} + +func (m *GoTest) GetF_Sfixed64Defaulted() int64 { + if m != nil && m.F_Sfixed64Defaulted != nil { + return *m.F_Sfixed64Defaulted + } + return Default_GoTest_F_Sfixed64Defaulted +} + +func (m *GoTest) GetF_BoolRepeatedPacked() []bool { + if m != nil { + return m.F_BoolRepeatedPacked + } + return nil +} + +func (m *GoTest) GetF_Int32RepeatedPacked() []int32 { + if m != nil { + return m.F_Int32RepeatedPacked + } + return nil +} + +func (m *GoTest) GetF_Int64RepeatedPacked() []int64 { + if m != nil { + return m.F_Int64RepeatedPacked + } + return nil +} + +func (m *GoTest) GetF_Fixed32RepeatedPacked() []uint32 { + if m != nil { + return m.F_Fixed32RepeatedPacked + } + return nil +} + +func (m *GoTest) GetF_Fixed64RepeatedPacked() []uint64 { + if m != nil { + return m.F_Fixed64RepeatedPacked + } + return nil +} + +func (m *GoTest) GetF_Uint32RepeatedPacked() []uint32 { + if m != nil { + return m.F_Uint32RepeatedPacked + } + return nil +} + +func (m *GoTest) GetF_Uint64RepeatedPacked() []uint64 { + if m != nil { + return m.F_Uint64RepeatedPacked + } + return nil +} + +func (m *GoTest) GetF_FloatRepeatedPacked() []float32 { + if m != nil { + return m.F_FloatRepeatedPacked + } + return nil +} + +func (m *GoTest) GetF_DoubleRepeatedPacked() []float64 { + if m != nil { + return m.F_DoubleRepeatedPacked + } + return nil +} + +func (m *GoTest) GetF_Sint32RepeatedPacked() []int32 { + if m != nil { + return m.F_Sint32RepeatedPacked + } + return nil +} + +func (m *GoTest) GetF_Sint64RepeatedPacked() []int64 { + if m != nil { + return m.F_Sint64RepeatedPacked + } + return nil +} + +func (m *GoTest) GetF_Sfixed32RepeatedPacked() []int32 { + if m != nil { + return m.F_Sfixed32RepeatedPacked + } + return nil +} + +func (m *GoTest) GetF_Sfixed64RepeatedPacked() []int64 { + if m != nil { + return m.F_Sfixed64RepeatedPacked + } + return nil +} + +func (m *GoTest) GetRequiredgroup() *GoTest_RequiredGroup { + if m != nil { + return m.Requiredgroup + } + return nil +} + +func (m *GoTest) GetRepeatedgroup() []*GoTest_RepeatedGroup { + if m != nil { + return m.Repeatedgroup + } + return nil +} + +func (m *GoTest) GetOptionalgroup() *GoTest_OptionalGroup { + if m != nil { + return m.Optionalgroup + } + return nil +} + +// Required, repeated, and optional groups. +type GoTest_RequiredGroup struct { + RequiredField *string `protobuf:"bytes,71,req,name=RequiredField" json:"RequiredField,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GoTest_RequiredGroup) Reset() { *m = GoTest_RequiredGroup{} } +func (m *GoTest_RequiredGroup) String() string { return proto.CompactTextString(m) } +func (*GoTest_RequiredGroup) ProtoMessage() {} +func (*GoTest_RequiredGroup) Descriptor() ([]byte, []int) { + return fileDescriptor_test_74787bfc6550f8a7, []int{2, 0} +} +func (m *GoTest_RequiredGroup) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GoTest_RequiredGroup.Unmarshal(m, b) +} +func (m *GoTest_RequiredGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GoTest_RequiredGroup.Marshal(b, m, deterministic) +} +func (dst *GoTest_RequiredGroup) XXX_Merge(src proto.Message) { + xxx_messageInfo_GoTest_RequiredGroup.Merge(dst, src) +} +func (m *GoTest_RequiredGroup) XXX_Size() int { + return xxx_messageInfo_GoTest_RequiredGroup.Size(m) +} +func (m *GoTest_RequiredGroup) XXX_DiscardUnknown() { + xxx_messageInfo_GoTest_RequiredGroup.DiscardUnknown(m) +} + +var xxx_messageInfo_GoTest_RequiredGroup proto.InternalMessageInfo + +func (m *GoTest_RequiredGroup) GetRequiredField() string { + if m != nil && m.RequiredField != nil { + return *m.RequiredField + } + return "" +} + +type GoTest_RepeatedGroup struct { + RequiredField *string `protobuf:"bytes,81,req,name=RequiredField" json:"RequiredField,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GoTest_RepeatedGroup) Reset() { *m = GoTest_RepeatedGroup{} } +func (m *GoTest_RepeatedGroup) String() string { return proto.CompactTextString(m) } +func (*GoTest_RepeatedGroup) ProtoMessage() {} +func (*GoTest_RepeatedGroup) Descriptor() ([]byte, []int) { + return fileDescriptor_test_74787bfc6550f8a7, []int{2, 1} +} +func (m *GoTest_RepeatedGroup) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GoTest_RepeatedGroup.Unmarshal(m, b) +} +func (m *GoTest_RepeatedGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GoTest_RepeatedGroup.Marshal(b, m, deterministic) +} +func (dst *GoTest_RepeatedGroup) XXX_Merge(src proto.Message) { + xxx_messageInfo_GoTest_RepeatedGroup.Merge(dst, src) +} +func (m *GoTest_RepeatedGroup) XXX_Size() int { + return xxx_messageInfo_GoTest_RepeatedGroup.Size(m) +} +func (m *GoTest_RepeatedGroup) XXX_DiscardUnknown() { + xxx_messageInfo_GoTest_RepeatedGroup.DiscardUnknown(m) +} + +var xxx_messageInfo_GoTest_RepeatedGroup proto.InternalMessageInfo + +func (m *GoTest_RepeatedGroup) GetRequiredField() string { + if m != nil && m.RequiredField != nil { + return *m.RequiredField + } + return "" +} + +type GoTest_OptionalGroup struct { + RequiredField *string `protobuf:"bytes,91,req,name=RequiredField" json:"RequiredField,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GoTest_OptionalGroup) Reset() { *m = GoTest_OptionalGroup{} } +func (m *GoTest_OptionalGroup) String() string { return proto.CompactTextString(m) } +func (*GoTest_OptionalGroup) ProtoMessage() {} +func (*GoTest_OptionalGroup) Descriptor() ([]byte, []int) { + return fileDescriptor_test_74787bfc6550f8a7, []int{2, 2} +} +func (m *GoTest_OptionalGroup) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GoTest_OptionalGroup.Unmarshal(m, b) +} +func (m *GoTest_OptionalGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GoTest_OptionalGroup.Marshal(b, m, deterministic) +} +func (dst *GoTest_OptionalGroup) XXX_Merge(src proto.Message) { + xxx_messageInfo_GoTest_OptionalGroup.Merge(dst, src) +} +func (m *GoTest_OptionalGroup) XXX_Size() int { + return xxx_messageInfo_GoTest_OptionalGroup.Size(m) +} +func (m *GoTest_OptionalGroup) XXX_DiscardUnknown() { + xxx_messageInfo_GoTest_OptionalGroup.DiscardUnknown(m) +} + +var xxx_messageInfo_GoTest_OptionalGroup proto.InternalMessageInfo + +func (m *GoTest_OptionalGroup) GetRequiredField() string { + if m != nil && m.RequiredField != nil { + return *m.RequiredField + } + return "" +} + +// For testing a group containing a required field. +type GoTestRequiredGroupField struct { + Group *GoTestRequiredGroupField_Group `protobuf:"group,1,req,name=Group,json=group" json:"group,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GoTestRequiredGroupField) Reset() { *m = GoTestRequiredGroupField{} } +func (m *GoTestRequiredGroupField) String() string { return proto.CompactTextString(m) } +func (*GoTestRequiredGroupField) ProtoMessage() {} +func (*GoTestRequiredGroupField) Descriptor() ([]byte, []int) { + return fileDescriptor_test_74787bfc6550f8a7, []int{3} +} +func (m *GoTestRequiredGroupField) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GoTestRequiredGroupField.Unmarshal(m, b) +} +func (m *GoTestRequiredGroupField) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GoTestRequiredGroupField.Marshal(b, m, deterministic) +} +func (dst *GoTestRequiredGroupField) XXX_Merge(src proto.Message) { + xxx_messageInfo_GoTestRequiredGroupField.Merge(dst, src) +} +func (m *GoTestRequiredGroupField) XXX_Size() int { + return xxx_messageInfo_GoTestRequiredGroupField.Size(m) +} +func (m *GoTestRequiredGroupField) XXX_DiscardUnknown() { + xxx_messageInfo_GoTestRequiredGroupField.DiscardUnknown(m) +} + +var xxx_messageInfo_GoTestRequiredGroupField proto.InternalMessageInfo + +func (m *GoTestRequiredGroupField) GetGroup() *GoTestRequiredGroupField_Group { + if m != nil { + return m.Group + } + return nil +} + +type GoTestRequiredGroupField_Group struct { + Field *int32 `protobuf:"varint,2,req,name=Field" json:"Field,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GoTestRequiredGroupField_Group) Reset() { *m = GoTestRequiredGroupField_Group{} } +func (m *GoTestRequiredGroupField_Group) String() string { return proto.CompactTextString(m) } +func (*GoTestRequiredGroupField_Group) ProtoMessage() {} +func (*GoTestRequiredGroupField_Group) Descriptor() ([]byte, []int) { + return fileDescriptor_test_74787bfc6550f8a7, []int{3, 0} +} +func (m *GoTestRequiredGroupField_Group) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GoTestRequiredGroupField_Group.Unmarshal(m, b) +} +func (m *GoTestRequiredGroupField_Group) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GoTestRequiredGroupField_Group.Marshal(b, m, deterministic) +} +func (dst *GoTestRequiredGroupField_Group) XXX_Merge(src proto.Message) { + xxx_messageInfo_GoTestRequiredGroupField_Group.Merge(dst, src) +} +func (m *GoTestRequiredGroupField_Group) XXX_Size() int { + return xxx_messageInfo_GoTestRequiredGroupField_Group.Size(m) +} +func (m *GoTestRequiredGroupField_Group) XXX_DiscardUnknown() { + xxx_messageInfo_GoTestRequiredGroupField_Group.DiscardUnknown(m) +} + +var xxx_messageInfo_GoTestRequiredGroupField_Group proto.InternalMessageInfo + +func (m *GoTestRequiredGroupField_Group) GetField() int32 { + if m != nil && m.Field != nil { + return *m.Field + } + return 0 +} + +// For testing skipping of unrecognized fields. +// Numbers are all big, larger than tag numbers in GoTestField, +// the message used in the corresponding test. +type GoSkipTest struct { + SkipInt32 *int32 `protobuf:"varint,11,req,name=skip_int32,json=skipInt32" json:"skip_int32,omitempty"` + SkipFixed32 *uint32 `protobuf:"fixed32,12,req,name=skip_fixed32,json=skipFixed32" json:"skip_fixed32,omitempty"` + SkipFixed64 *uint64 `protobuf:"fixed64,13,req,name=skip_fixed64,json=skipFixed64" json:"skip_fixed64,omitempty"` + SkipString *string `protobuf:"bytes,14,req,name=skip_string,json=skipString" json:"skip_string,omitempty"` + Skipgroup *GoSkipTest_SkipGroup `protobuf:"group,15,req,name=SkipGroup,json=skipgroup" json:"skipgroup,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GoSkipTest) Reset() { *m = GoSkipTest{} } +func (m *GoSkipTest) String() string { return proto.CompactTextString(m) } +func (*GoSkipTest) ProtoMessage() {} +func (*GoSkipTest) Descriptor() ([]byte, []int) { + return fileDescriptor_test_74787bfc6550f8a7, []int{4} +} +func (m *GoSkipTest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GoSkipTest.Unmarshal(m, b) +} +func (m *GoSkipTest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GoSkipTest.Marshal(b, m, deterministic) +} +func (dst *GoSkipTest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GoSkipTest.Merge(dst, src) +} +func (m *GoSkipTest) XXX_Size() int { + return xxx_messageInfo_GoSkipTest.Size(m) +} +func (m *GoSkipTest) XXX_DiscardUnknown() { + xxx_messageInfo_GoSkipTest.DiscardUnknown(m) +} + +var xxx_messageInfo_GoSkipTest proto.InternalMessageInfo + +func (m *GoSkipTest) GetSkipInt32() int32 { + if m != nil && m.SkipInt32 != nil { + return *m.SkipInt32 + } + return 0 +} + +func (m *GoSkipTest) GetSkipFixed32() uint32 { + if m != nil && m.SkipFixed32 != nil { + return *m.SkipFixed32 + } + return 0 +} + +func (m *GoSkipTest) GetSkipFixed64() uint64 { + if m != nil && m.SkipFixed64 != nil { + return *m.SkipFixed64 + } + return 0 +} + +func (m *GoSkipTest) GetSkipString() string { + if m != nil && m.SkipString != nil { + return *m.SkipString + } + return "" +} + +func (m *GoSkipTest) GetSkipgroup() *GoSkipTest_SkipGroup { + if m != nil { + return m.Skipgroup + } + return nil +} + +type GoSkipTest_SkipGroup struct { + GroupInt32 *int32 `protobuf:"varint,16,req,name=group_int32,json=groupInt32" json:"group_int32,omitempty"` + GroupString *string `protobuf:"bytes,17,req,name=group_string,json=groupString" json:"group_string,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GoSkipTest_SkipGroup) Reset() { *m = GoSkipTest_SkipGroup{} } +func (m *GoSkipTest_SkipGroup) String() string { return proto.CompactTextString(m) } +func (*GoSkipTest_SkipGroup) ProtoMessage() {} +func (*GoSkipTest_SkipGroup) Descriptor() ([]byte, []int) { + return fileDescriptor_test_74787bfc6550f8a7, []int{4, 0} +} +func (m *GoSkipTest_SkipGroup) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GoSkipTest_SkipGroup.Unmarshal(m, b) +} +func (m *GoSkipTest_SkipGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GoSkipTest_SkipGroup.Marshal(b, m, deterministic) +} +func (dst *GoSkipTest_SkipGroup) XXX_Merge(src proto.Message) { + xxx_messageInfo_GoSkipTest_SkipGroup.Merge(dst, src) +} +func (m *GoSkipTest_SkipGroup) XXX_Size() int { + return xxx_messageInfo_GoSkipTest_SkipGroup.Size(m) +} +func (m *GoSkipTest_SkipGroup) XXX_DiscardUnknown() { + xxx_messageInfo_GoSkipTest_SkipGroup.DiscardUnknown(m) +} + +var xxx_messageInfo_GoSkipTest_SkipGroup proto.InternalMessageInfo + +func (m *GoSkipTest_SkipGroup) GetGroupInt32() int32 { + if m != nil && m.GroupInt32 != nil { + return *m.GroupInt32 + } + return 0 +} + +func (m *GoSkipTest_SkipGroup) GetGroupString() string { + if m != nil && m.GroupString != nil { + return *m.GroupString + } + return "" +} + +// For testing packed/non-packed decoder switching. +// A serialized instance of one should be deserializable as the other. +type NonPackedTest struct { + A []int32 `protobuf:"varint,1,rep,name=a" json:"a,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *NonPackedTest) Reset() { *m = NonPackedTest{} } +func (m *NonPackedTest) String() string { return proto.CompactTextString(m) } +func (*NonPackedTest) ProtoMessage() {} +func (*NonPackedTest) Descriptor() ([]byte, []int) { + return fileDescriptor_test_74787bfc6550f8a7, []int{5} +} +func (m *NonPackedTest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_NonPackedTest.Unmarshal(m, b) +} +func (m *NonPackedTest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_NonPackedTest.Marshal(b, m, deterministic) +} +func (dst *NonPackedTest) XXX_Merge(src proto.Message) { + xxx_messageInfo_NonPackedTest.Merge(dst, src) +} +func (m *NonPackedTest) XXX_Size() int { + return xxx_messageInfo_NonPackedTest.Size(m) +} +func (m *NonPackedTest) XXX_DiscardUnknown() { + xxx_messageInfo_NonPackedTest.DiscardUnknown(m) +} + +var xxx_messageInfo_NonPackedTest proto.InternalMessageInfo + +func (m *NonPackedTest) GetA() []int32 { + if m != nil { + return m.A + } + return nil +} + +type PackedTest struct { + B []int32 `protobuf:"varint,1,rep,packed,name=b" json:"b,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PackedTest) Reset() { *m = PackedTest{} } +func (m *PackedTest) String() string { return proto.CompactTextString(m) } +func (*PackedTest) ProtoMessage() {} +func (*PackedTest) Descriptor() ([]byte, []int) { + return fileDescriptor_test_74787bfc6550f8a7, []int{6} +} +func (m *PackedTest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_PackedTest.Unmarshal(m, b) +} +func (m *PackedTest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_PackedTest.Marshal(b, m, deterministic) +} +func (dst *PackedTest) XXX_Merge(src proto.Message) { + xxx_messageInfo_PackedTest.Merge(dst, src) +} +func (m *PackedTest) XXX_Size() int { + return xxx_messageInfo_PackedTest.Size(m) +} +func (m *PackedTest) XXX_DiscardUnknown() { + xxx_messageInfo_PackedTest.DiscardUnknown(m) +} + +var xxx_messageInfo_PackedTest proto.InternalMessageInfo + +func (m *PackedTest) GetB() []int32 { + if m != nil { + return m.B + } + return nil +} + +type MaxTag struct { + // Maximum possible tag number. + LastField *string `protobuf:"bytes,536870911,opt,name=last_field,json=lastField" json:"last_field,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MaxTag) Reset() { *m = MaxTag{} } +func (m *MaxTag) String() string { return proto.CompactTextString(m) } +func (*MaxTag) ProtoMessage() {} +func (*MaxTag) Descriptor() ([]byte, []int) { + return fileDescriptor_test_74787bfc6550f8a7, []int{7} +} +func (m *MaxTag) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MaxTag.Unmarshal(m, b) +} +func (m *MaxTag) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MaxTag.Marshal(b, m, deterministic) +} +func (dst *MaxTag) XXX_Merge(src proto.Message) { + xxx_messageInfo_MaxTag.Merge(dst, src) +} +func (m *MaxTag) XXX_Size() int { + return xxx_messageInfo_MaxTag.Size(m) +} +func (m *MaxTag) XXX_DiscardUnknown() { + xxx_messageInfo_MaxTag.DiscardUnknown(m) +} + +var xxx_messageInfo_MaxTag proto.InternalMessageInfo + +func (m *MaxTag) GetLastField() string { + if m != nil && m.LastField != nil { + return *m.LastField + } + return "" +} + +type OldMessage struct { + Nested *OldMessage_Nested `protobuf:"bytes,1,opt,name=nested" json:"nested,omitempty"` + Num *int32 `protobuf:"varint,2,opt,name=num" json:"num,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *OldMessage) Reset() { *m = OldMessage{} } +func (m *OldMessage) String() string { return proto.CompactTextString(m) } +func (*OldMessage) ProtoMessage() {} +func (*OldMessage) Descriptor() ([]byte, []int) { + return fileDescriptor_test_74787bfc6550f8a7, []int{8} +} +func (m *OldMessage) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_OldMessage.Unmarshal(m, b) +} +func (m *OldMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_OldMessage.Marshal(b, m, deterministic) +} +func (dst *OldMessage) XXX_Merge(src proto.Message) { + xxx_messageInfo_OldMessage.Merge(dst, src) +} +func (m *OldMessage) XXX_Size() int { + return xxx_messageInfo_OldMessage.Size(m) +} +func (m *OldMessage) XXX_DiscardUnknown() { + xxx_messageInfo_OldMessage.DiscardUnknown(m) +} + +var xxx_messageInfo_OldMessage proto.InternalMessageInfo + +func (m *OldMessage) GetNested() *OldMessage_Nested { + if m != nil { + return m.Nested + } + return nil +} + +func (m *OldMessage) GetNum() int32 { + if m != nil && m.Num != nil { + return *m.Num + } + return 0 +} + +type OldMessage_Nested struct { + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *OldMessage_Nested) Reset() { *m = OldMessage_Nested{} } +func (m *OldMessage_Nested) String() string { return proto.CompactTextString(m) } +func (*OldMessage_Nested) ProtoMessage() {} +func (*OldMessage_Nested) Descriptor() ([]byte, []int) { + return fileDescriptor_test_74787bfc6550f8a7, []int{8, 0} +} +func (m *OldMessage_Nested) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_OldMessage_Nested.Unmarshal(m, b) +} +func (m *OldMessage_Nested) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_OldMessage_Nested.Marshal(b, m, deterministic) +} +func (dst *OldMessage_Nested) XXX_Merge(src proto.Message) { + xxx_messageInfo_OldMessage_Nested.Merge(dst, src) +} +func (m *OldMessage_Nested) XXX_Size() int { + return xxx_messageInfo_OldMessage_Nested.Size(m) +} +func (m *OldMessage_Nested) XXX_DiscardUnknown() { + xxx_messageInfo_OldMessage_Nested.DiscardUnknown(m) +} + +var xxx_messageInfo_OldMessage_Nested proto.InternalMessageInfo + +func (m *OldMessage_Nested) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +// NewMessage is wire compatible with OldMessage; +// imagine it as a future version. +type NewMessage struct { + Nested *NewMessage_Nested `protobuf:"bytes,1,opt,name=nested" json:"nested,omitempty"` + // This is an int32 in OldMessage. + Num *int64 `protobuf:"varint,2,opt,name=num" json:"num,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *NewMessage) Reset() { *m = NewMessage{} } +func (m *NewMessage) String() string { return proto.CompactTextString(m) } +func (*NewMessage) ProtoMessage() {} +func (*NewMessage) Descriptor() ([]byte, []int) { + return fileDescriptor_test_74787bfc6550f8a7, []int{9} +} +func (m *NewMessage) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_NewMessage.Unmarshal(m, b) +} +func (m *NewMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_NewMessage.Marshal(b, m, deterministic) +} +func (dst *NewMessage) XXX_Merge(src proto.Message) { + xxx_messageInfo_NewMessage.Merge(dst, src) +} +func (m *NewMessage) XXX_Size() int { + return xxx_messageInfo_NewMessage.Size(m) +} +func (m *NewMessage) XXX_DiscardUnknown() { + xxx_messageInfo_NewMessage.DiscardUnknown(m) +} + +var xxx_messageInfo_NewMessage proto.InternalMessageInfo + +func (m *NewMessage) GetNested() *NewMessage_Nested { + if m != nil { + return m.Nested + } + return nil +} + +func (m *NewMessage) GetNum() int64 { + if m != nil && m.Num != nil { + return *m.Num + } + return 0 +} + +type NewMessage_Nested struct { + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + FoodGroup *string `protobuf:"bytes,2,opt,name=food_group,json=foodGroup" json:"food_group,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *NewMessage_Nested) Reset() { *m = NewMessage_Nested{} } +func (m *NewMessage_Nested) String() string { return proto.CompactTextString(m) } +func (*NewMessage_Nested) ProtoMessage() {} +func (*NewMessage_Nested) Descriptor() ([]byte, []int) { + return fileDescriptor_test_74787bfc6550f8a7, []int{9, 0} +} +func (m *NewMessage_Nested) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_NewMessage_Nested.Unmarshal(m, b) +} +func (m *NewMessage_Nested) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_NewMessage_Nested.Marshal(b, m, deterministic) +} +func (dst *NewMessage_Nested) XXX_Merge(src proto.Message) { + xxx_messageInfo_NewMessage_Nested.Merge(dst, src) +} +func (m *NewMessage_Nested) XXX_Size() int { + return xxx_messageInfo_NewMessage_Nested.Size(m) +} +func (m *NewMessage_Nested) XXX_DiscardUnknown() { + xxx_messageInfo_NewMessage_Nested.DiscardUnknown(m) +} + +var xxx_messageInfo_NewMessage_Nested proto.InternalMessageInfo + +func (m *NewMessage_Nested) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *NewMessage_Nested) GetFoodGroup() string { + if m != nil && m.FoodGroup != nil { + return *m.FoodGroup + } + return "" +} + +type InnerMessage struct { + Host *string `protobuf:"bytes,1,req,name=host" json:"host,omitempty"` + Port *int32 `protobuf:"varint,2,opt,name=port,def=4000" json:"port,omitempty"` + Connected *bool `protobuf:"varint,3,opt,name=connected" json:"connected,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *InnerMessage) Reset() { *m = InnerMessage{} } +func (m *InnerMessage) String() string { return proto.CompactTextString(m) } +func (*InnerMessage) ProtoMessage() {} +func (*InnerMessage) Descriptor() ([]byte, []int) { + return fileDescriptor_test_74787bfc6550f8a7, []int{10} +} +func (m *InnerMessage) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_InnerMessage.Unmarshal(m, b) +} +func (m *InnerMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_InnerMessage.Marshal(b, m, deterministic) +} +func (dst *InnerMessage) XXX_Merge(src proto.Message) { + xxx_messageInfo_InnerMessage.Merge(dst, src) +} +func (m *InnerMessage) XXX_Size() int { + return xxx_messageInfo_InnerMessage.Size(m) +} +func (m *InnerMessage) XXX_DiscardUnknown() { + xxx_messageInfo_InnerMessage.DiscardUnknown(m) +} + +var xxx_messageInfo_InnerMessage proto.InternalMessageInfo + +const Default_InnerMessage_Port int32 = 4000 + +func (m *InnerMessage) GetHost() string { + if m != nil && m.Host != nil { + return *m.Host + } + return "" +} + +func (m *InnerMessage) GetPort() int32 { + if m != nil && m.Port != nil { + return *m.Port + } + return Default_InnerMessage_Port +} + +func (m *InnerMessage) GetConnected() bool { + if m != nil && m.Connected != nil { + return *m.Connected + } + return false +} + +type OtherMessage struct { + Key *int64 `protobuf:"varint,1,opt,name=key" json:"key,omitempty"` + Value []byte `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"` + Weight *float32 `protobuf:"fixed32,3,opt,name=weight" json:"weight,omitempty"` + Inner *InnerMessage `protobuf:"bytes,4,opt,name=inner" json:"inner,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + proto.XXX_InternalExtensions `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *OtherMessage) Reset() { *m = OtherMessage{} } +func (m *OtherMessage) String() string { return proto.CompactTextString(m) } +func (*OtherMessage) ProtoMessage() {} +func (*OtherMessage) Descriptor() ([]byte, []int) { + return fileDescriptor_test_74787bfc6550f8a7, []int{11} +} + +var extRange_OtherMessage = []proto.ExtensionRange{ + {Start: 100, End: 536870911}, +} + +func (*OtherMessage) ExtensionRangeArray() []proto.ExtensionRange { + return extRange_OtherMessage +} +func (m *OtherMessage) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_OtherMessage.Unmarshal(m, b) +} +func (m *OtherMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_OtherMessage.Marshal(b, m, deterministic) +} +func (dst *OtherMessage) XXX_Merge(src proto.Message) { + xxx_messageInfo_OtherMessage.Merge(dst, src) +} +func (m *OtherMessage) XXX_Size() int { + return xxx_messageInfo_OtherMessage.Size(m) +} +func (m *OtherMessage) XXX_DiscardUnknown() { + xxx_messageInfo_OtherMessage.DiscardUnknown(m) +} + +var xxx_messageInfo_OtherMessage proto.InternalMessageInfo + +func (m *OtherMessage) GetKey() int64 { + if m != nil && m.Key != nil { + return *m.Key + } + return 0 +} + +func (m *OtherMessage) GetValue() []byte { + if m != nil { + return m.Value + } + return nil +} + +func (m *OtherMessage) GetWeight() float32 { + if m != nil && m.Weight != nil { + return *m.Weight + } + return 0 +} + +func (m *OtherMessage) GetInner() *InnerMessage { + if m != nil { + return m.Inner + } + return nil +} + +type RequiredInnerMessage struct { + LeoFinallyWonAnOscar *InnerMessage `protobuf:"bytes,1,req,name=leo_finally_won_an_oscar,json=leoFinallyWonAnOscar" json:"leo_finally_won_an_oscar,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RequiredInnerMessage) Reset() { *m = RequiredInnerMessage{} } +func (m *RequiredInnerMessage) String() string { return proto.CompactTextString(m) } +func (*RequiredInnerMessage) ProtoMessage() {} +func (*RequiredInnerMessage) Descriptor() ([]byte, []int) { + return fileDescriptor_test_74787bfc6550f8a7, []int{12} +} +func (m *RequiredInnerMessage) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_RequiredInnerMessage.Unmarshal(m, b) +} +func (m *RequiredInnerMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_RequiredInnerMessage.Marshal(b, m, deterministic) +} +func (dst *RequiredInnerMessage) XXX_Merge(src proto.Message) { + xxx_messageInfo_RequiredInnerMessage.Merge(dst, src) +} +func (m *RequiredInnerMessage) XXX_Size() int { + return xxx_messageInfo_RequiredInnerMessage.Size(m) +} +func (m *RequiredInnerMessage) XXX_DiscardUnknown() { + xxx_messageInfo_RequiredInnerMessage.DiscardUnknown(m) +} + +var xxx_messageInfo_RequiredInnerMessage proto.InternalMessageInfo + +func (m *RequiredInnerMessage) GetLeoFinallyWonAnOscar() *InnerMessage { + if m != nil { + return m.LeoFinallyWonAnOscar + } + return nil +} + +type MyMessage struct { + Count *int32 `protobuf:"varint,1,req,name=count" json:"count,omitempty"` + Name *string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"` + Quote *string `protobuf:"bytes,3,opt,name=quote" json:"quote,omitempty"` + Pet []string `protobuf:"bytes,4,rep,name=pet" json:"pet,omitempty"` + Inner *InnerMessage `protobuf:"bytes,5,opt,name=inner" json:"inner,omitempty"` + Others []*OtherMessage `protobuf:"bytes,6,rep,name=others" json:"others,omitempty"` + WeMustGoDeeper *RequiredInnerMessage `protobuf:"bytes,13,opt,name=we_must_go_deeper,json=weMustGoDeeper" json:"we_must_go_deeper,omitempty"` + RepInner []*InnerMessage `protobuf:"bytes,12,rep,name=rep_inner,json=repInner" json:"rep_inner,omitempty"` + Bikeshed *MyMessage_Color `protobuf:"varint,7,opt,name=bikeshed,enum=test_proto.MyMessage_Color" json:"bikeshed,omitempty"` + Somegroup *MyMessage_SomeGroup `protobuf:"group,8,opt,name=SomeGroup,json=somegroup" json:"somegroup,omitempty"` + // This field becomes [][]byte in the generated code. + RepBytes [][]byte `protobuf:"bytes,10,rep,name=rep_bytes,json=repBytes" json:"rep_bytes,omitempty"` + Bigfloat *float64 `protobuf:"fixed64,11,opt,name=bigfloat" json:"bigfloat,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + proto.XXX_InternalExtensions `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MyMessage) Reset() { *m = MyMessage{} } +func (m *MyMessage) String() string { return proto.CompactTextString(m) } +func (*MyMessage) ProtoMessage() {} +func (*MyMessage) Descriptor() ([]byte, []int) { + return fileDescriptor_test_74787bfc6550f8a7, []int{13} +} + +var extRange_MyMessage = []proto.ExtensionRange{ + {Start: 100, End: 536870911}, +} + +func (*MyMessage) ExtensionRangeArray() []proto.ExtensionRange { + return extRange_MyMessage +} +func (m *MyMessage) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MyMessage.Unmarshal(m, b) +} +func (m *MyMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MyMessage.Marshal(b, m, deterministic) +} +func (dst *MyMessage) XXX_Merge(src proto.Message) { + xxx_messageInfo_MyMessage.Merge(dst, src) +} +func (m *MyMessage) XXX_Size() int { + return xxx_messageInfo_MyMessage.Size(m) +} +func (m *MyMessage) XXX_DiscardUnknown() { + xxx_messageInfo_MyMessage.DiscardUnknown(m) +} + +var xxx_messageInfo_MyMessage proto.InternalMessageInfo + +func (m *MyMessage) GetCount() int32 { + if m != nil && m.Count != nil { + return *m.Count + } + return 0 +} + +func (m *MyMessage) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *MyMessage) GetQuote() string { + if m != nil && m.Quote != nil { + return *m.Quote + } + return "" +} + +func (m *MyMessage) GetPet() []string { + if m != nil { + return m.Pet + } + return nil +} + +func (m *MyMessage) GetInner() *InnerMessage { + if m != nil { + return m.Inner + } + return nil +} + +func (m *MyMessage) GetOthers() []*OtherMessage { + if m != nil { + return m.Others + } + return nil +} + +func (m *MyMessage) GetWeMustGoDeeper() *RequiredInnerMessage { + if m != nil { + return m.WeMustGoDeeper + } + return nil +} + +func (m *MyMessage) GetRepInner() []*InnerMessage { + if m != nil { + return m.RepInner + } + return nil +} + +func (m *MyMessage) GetBikeshed() MyMessage_Color { + if m != nil && m.Bikeshed != nil { + return *m.Bikeshed + } + return MyMessage_RED +} + +func (m *MyMessage) GetSomegroup() *MyMessage_SomeGroup { + if m != nil { + return m.Somegroup + } + return nil +} + +func (m *MyMessage) GetRepBytes() [][]byte { + if m != nil { + return m.RepBytes + } + return nil +} + +func (m *MyMessage) GetBigfloat() float64 { + if m != nil && m.Bigfloat != nil { + return *m.Bigfloat + } + return 0 +} + +type MyMessage_SomeGroup struct { + GroupField *int32 `protobuf:"varint,9,opt,name=group_field,json=groupField" json:"group_field,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MyMessage_SomeGroup) Reset() { *m = MyMessage_SomeGroup{} } +func (m *MyMessage_SomeGroup) String() string { return proto.CompactTextString(m) } +func (*MyMessage_SomeGroup) ProtoMessage() {} +func (*MyMessage_SomeGroup) Descriptor() ([]byte, []int) { + return fileDescriptor_test_74787bfc6550f8a7, []int{13, 0} +} +func (m *MyMessage_SomeGroup) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MyMessage_SomeGroup.Unmarshal(m, b) +} +func (m *MyMessage_SomeGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MyMessage_SomeGroup.Marshal(b, m, deterministic) +} +func (dst *MyMessage_SomeGroup) XXX_Merge(src proto.Message) { + xxx_messageInfo_MyMessage_SomeGroup.Merge(dst, src) +} +func (m *MyMessage_SomeGroup) XXX_Size() int { + return xxx_messageInfo_MyMessage_SomeGroup.Size(m) +} +func (m *MyMessage_SomeGroup) XXX_DiscardUnknown() { + xxx_messageInfo_MyMessage_SomeGroup.DiscardUnknown(m) +} + +var xxx_messageInfo_MyMessage_SomeGroup proto.InternalMessageInfo + +func (m *MyMessage_SomeGroup) GetGroupField() int32 { + if m != nil && m.GroupField != nil { + return *m.GroupField + } + return 0 +} + +type Ext struct { + Data *string `protobuf:"bytes,1,opt,name=data" json:"data,omitempty"` + MapField map[int32]int32 `protobuf:"bytes,2,rep,name=map_field,json=mapField" json:"map_field,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"varint,2,opt,name=value"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Ext) Reset() { *m = Ext{} } +func (m *Ext) String() string { return proto.CompactTextString(m) } +func (*Ext) ProtoMessage() {} +func (*Ext) Descriptor() ([]byte, []int) { + return fileDescriptor_test_74787bfc6550f8a7, []int{14} +} +func (m *Ext) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Ext.Unmarshal(m, b) +} +func (m *Ext) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Ext.Marshal(b, m, deterministic) +} +func (dst *Ext) XXX_Merge(src proto.Message) { + xxx_messageInfo_Ext.Merge(dst, src) +} +func (m *Ext) XXX_Size() int { + return xxx_messageInfo_Ext.Size(m) +} +func (m *Ext) XXX_DiscardUnknown() { + xxx_messageInfo_Ext.DiscardUnknown(m) +} + +var xxx_messageInfo_Ext proto.InternalMessageInfo + +func (m *Ext) GetData() string { + if m != nil && m.Data != nil { + return *m.Data + } + return "" +} + +func (m *Ext) GetMapField() map[int32]int32 { + if m != nil { + return m.MapField + } + return nil +} + +var E_Ext_More = &proto.ExtensionDesc{ + ExtendedType: (*MyMessage)(nil), + ExtensionType: (*Ext)(nil), + Field: 103, + Name: "test_proto.Ext.more", + Tag: "bytes,103,opt,name=more", + Filename: "test_proto/test.proto", +} + +var E_Ext_Text = &proto.ExtensionDesc{ + ExtendedType: (*MyMessage)(nil), + ExtensionType: (*string)(nil), + Field: 104, + Name: "test_proto.Ext.text", + Tag: "bytes,104,opt,name=text", + Filename: "test_proto/test.proto", +} + +var E_Ext_Number = &proto.ExtensionDesc{ + ExtendedType: (*MyMessage)(nil), + ExtensionType: (*int32)(nil), + Field: 105, + Name: "test_proto.Ext.number", + Tag: "varint,105,opt,name=number", + Filename: "test_proto/test.proto", +} + +type ComplexExtension struct { + First *int32 `protobuf:"varint,1,opt,name=first" json:"first,omitempty"` + Second *int32 `protobuf:"varint,2,opt,name=second" json:"second,omitempty"` + Third []int32 `protobuf:"varint,3,rep,name=third" json:"third,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ComplexExtension) Reset() { *m = ComplexExtension{} } +func (m *ComplexExtension) String() string { return proto.CompactTextString(m) } +func (*ComplexExtension) ProtoMessage() {} +func (*ComplexExtension) Descriptor() ([]byte, []int) { + return fileDescriptor_test_74787bfc6550f8a7, []int{15} +} +func (m *ComplexExtension) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ComplexExtension.Unmarshal(m, b) +} +func (m *ComplexExtension) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ComplexExtension.Marshal(b, m, deterministic) +} +func (dst *ComplexExtension) XXX_Merge(src proto.Message) { + xxx_messageInfo_ComplexExtension.Merge(dst, src) +} +func (m *ComplexExtension) XXX_Size() int { + return xxx_messageInfo_ComplexExtension.Size(m) +} +func (m *ComplexExtension) XXX_DiscardUnknown() { + xxx_messageInfo_ComplexExtension.DiscardUnknown(m) +} + +var xxx_messageInfo_ComplexExtension proto.InternalMessageInfo + +func (m *ComplexExtension) GetFirst() int32 { + if m != nil && m.First != nil { + return *m.First + } + return 0 +} + +func (m *ComplexExtension) GetSecond() int32 { + if m != nil && m.Second != nil { + return *m.Second + } + return 0 +} + +func (m *ComplexExtension) GetThird() []int32 { + if m != nil { + return m.Third + } + return nil +} + +type DefaultsMessage struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + proto.XXX_InternalExtensions `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DefaultsMessage) Reset() { *m = DefaultsMessage{} } +func (m *DefaultsMessage) String() string { return proto.CompactTextString(m) } +func (*DefaultsMessage) ProtoMessage() {} +func (*DefaultsMessage) Descriptor() ([]byte, []int) { + return fileDescriptor_test_74787bfc6550f8a7, []int{16} +} + +var extRange_DefaultsMessage = []proto.ExtensionRange{ + {Start: 100, End: 536870911}, +} + +func (*DefaultsMessage) ExtensionRangeArray() []proto.ExtensionRange { + return extRange_DefaultsMessage +} +func (m *DefaultsMessage) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DefaultsMessage.Unmarshal(m, b) +} +func (m *DefaultsMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DefaultsMessage.Marshal(b, m, deterministic) +} +func (dst *DefaultsMessage) XXX_Merge(src proto.Message) { + xxx_messageInfo_DefaultsMessage.Merge(dst, src) +} +func (m *DefaultsMessage) XXX_Size() int { + return xxx_messageInfo_DefaultsMessage.Size(m) +} +func (m *DefaultsMessage) XXX_DiscardUnknown() { + xxx_messageInfo_DefaultsMessage.DiscardUnknown(m) +} + +var xxx_messageInfo_DefaultsMessage proto.InternalMessageInfo + +type MyMessageSet struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + proto.XXX_InternalExtensions `protobuf_messageset:"1" json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MyMessageSet) Reset() { *m = MyMessageSet{} } +func (m *MyMessageSet) String() string { return proto.CompactTextString(m) } +func (*MyMessageSet) ProtoMessage() {} +func (*MyMessageSet) Descriptor() ([]byte, []int) { + return fileDescriptor_test_74787bfc6550f8a7, []int{17} +} + +func (m *MyMessageSet) MarshalJSON() ([]byte, error) { + return proto.MarshalMessageSetJSON(&m.XXX_InternalExtensions) +} +func (m *MyMessageSet) UnmarshalJSON(buf []byte) error { + return proto.UnmarshalMessageSetJSON(buf, &m.XXX_InternalExtensions) +} + +var extRange_MyMessageSet = []proto.ExtensionRange{ + {Start: 100, End: 2147483646}, +} + +func (*MyMessageSet) ExtensionRangeArray() []proto.ExtensionRange { + return extRange_MyMessageSet +} +func (m *MyMessageSet) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MyMessageSet.Unmarshal(m, b) +} +func (m *MyMessageSet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MyMessageSet.Marshal(b, m, deterministic) +} +func (dst *MyMessageSet) XXX_Merge(src proto.Message) { + xxx_messageInfo_MyMessageSet.Merge(dst, src) +} +func (m *MyMessageSet) XXX_Size() int { + return xxx_messageInfo_MyMessageSet.Size(m) +} +func (m *MyMessageSet) XXX_DiscardUnknown() { + xxx_messageInfo_MyMessageSet.DiscardUnknown(m) +} + +var xxx_messageInfo_MyMessageSet proto.InternalMessageInfo + +type Empty struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Empty) Reset() { *m = Empty{} } +func (m *Empty) String() string { return proto.CompactTextString(m) } +func (*Empty) ProtoMessage() {} +func (*Empty) Descriptor() ([]byte, []int) { + return fileDescriptor_test_74787bfc6550f8a7, []int{18} +} +func (m *Empty) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Empty.Unmarshal(m, b) +} +func (m *Empty) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Empty.Marshal(b, m, deterministic) +} +func (dst *Empty) XXX_Merge(src proto.Message) { + xxx_messageInfo_Empty.Merge(dst, src) +} +func (m *Empty) XXX_Size() int { + return xxx_messageInfo_Empty.Size(m) +} +func (m *Empty) XXX_DiscardUnknown() { + xxx_messageInfo_Empty.DiscardUnknown(m) +} + +var xxx_messageInfo_Empty proto.InternalMessageInfo + +type MessageList struct { + Message []*MessageList_Message `protobuf:"group,1,rep,name=Message,json=message" json:"message,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MessageList) Reset() { *m = MessageList{} } +func (m *MessageList) String() string { return proto.CompactTextString(m) } +func (*MessageList) ProtoMessage() {} +func (*MessageList) Descriptor() ([]byte, []int) { + return fileDescriptor_test_74787bfc6550f8a7, []int{19} +} +func (m *MessageList) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MessageList.Unmarshal(m, b) +} +func (m *MessageList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MessageList.Marshal(b, m, deterministic) +} +func (dst *MessageList) XXX_Merge(src proto.Message) { + xxx_messageInfo_MessageList.Merge(dst, src) +} +func (m *MessageList) XXX_Size() int { + return xxx_messageInfo_MessageList.Size(m) +} +func (m *MessageList) XXX_DiscardUnknown() { + xxx_messageInfo_MessageList.DiscardUnknown(m) +} + +var xxx_messageInfo_MessageList proto.InternalMessageInfo + +func (m *MessageList) GetMessage() []*MessageList_Message { + if m != nil { + return m.Message + } + return nil +} + +type MessageList_Message struct { + Name *string `protobuf:"bytes,2,req,name=name" json:"name,omitempty"` + Count *int32 `protobuf:"varint,3,req,name=count" json:"count,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MessageList_Message) Reset() { *m = MessageList_Message{} } +func (m *MessageList_Message) String() string { return proto.CompactTextString(m) } +func (*MessageList_Message) ProtoMessage() {} +func (*MessageList_Message) Descriptor() ([]byte, []int) { + return fileDescriptor_test_74787bfc6550f8a7, []int{19, 0} +} +func (m *MessageList_Message) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MessageList_Message.Unmarshal(m, b) +} +func (m *MessageList_Message) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MessageList_Message.Marshal(b, m, deterministic) +} +func (dst *MessageList_Message) XXX_Merge(src proto.Message) { + xxx_messageInfo_MessageList_Message.Merge(dst, src) +} +func (m *MessageList_Message) XXX_Size() int { + return xxx_messageInfo_MessageList_Message.Size(m) +} +func (m *MessageList_Message) XXX_DiscardUnknown() { + xxx_messageInfo_MessageList_Message.DiscardUnknown(m) +} + +var xxx_messageInfo_MessageList_Message proto.InternalMessageInfo + +func (m *MessageList_Message) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *MessageList_Message) GetCount() int32 { + if m != nil && m.Count != nil { + return *m.Count + } + return 0 +} + +type Strings struct { + StringField *string `protobuf:"bytes,1,opt,name=string_field,json=stringField" json:"string_field,omitempty"` + BytesField []byte `protobuf:"bytes,2,opt,name=bytes_field,json=bytesField" json:"bytes_field,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Strings) Reset() { *m = Strings{} } +func (m *Strings) String() string { return proto.CompactTextString(m) } +func (*Strings) ProtoMessage() {} +func (*Strings) Descriptor() ([]byte, []int) { + return fileDescriptor_test_74787bfc6550f8a7, []int{20} +} +func (m *Strings) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Strings.Unmarshal(m, b) +} +func (m *Strings) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Strings.Marshal(b, m, deterministic) +} +func (dst *Strings) XXX_Merge(src proto.Message) { + xxx_messageInfo_Strings.Merge(dst, src) +} +func (m *Strings) XXX_Size() int { + return xxx_messageInfo_Strings.Size(m) +} +func (m *Strings) XXX_DiscardUnknown() { + xxx_messageInfo_Strings.DiscardUnknown(m) +} + +var xxx_messageInfo_Strings proto.InternalMessageInfo + +func (m *Strings) GetStringField() string { + if m != nil && m.StringField != nil { + return *m.StringField + } + return "" +} + +func (m *Strings) GetBytesField() []byte { + if m != nil { + return m.BytesField + } + return nil +} + +type Defaults struct { + // Default-valued fields of all basic types. + // Same as GoTest, but copied here to make testing easier. + F_Bool *bool `protobuf:"varint,1,opt,name=F_Bool,json=FBool,def=1" json:"F_Bool,omitempty"` + F_Int32 *int32 `protobuf:"varint,2,opt,name=F_Int32,json=FInt32,def=32" json:"F_Int32,omitempty"` + F_Int64 *int64 `protobuf:"varint,3,opt,name=F_Int64,json=FInt64,def=64" json:"F_Int64,omitempty"` + F_Fixed32 *uint32 `protobuf:"fixed32,4,opt,name=F_Fixed32,json=FFixed32,def=320" json:"F_Fixed32,omitempty"` + F_Fixed64 *uint64 `protobuf:"fixed64,5,opt,name=F_Fixed64,json=FFixed64,def=640" json:"F_Fixed64,omitempty"` + F_Uint32 *uint32 `protobuf:"varint,6,opt,name=F_Uint32,json=FUint32,def=3200" json:"F_Uint32,omitempty"` + F_Uint64 *uint64 `protobuf:"varint,7,opt,name=F_Uint64,json=FUint64,def=6400" json:"F_Uint64,omitempty"` + F_Float *float32 `protobuf:"fixed32,8,opt,name=F_Float,json=FFloat,def=314159" json:"F_Float,omitempty"` + F_Double *float64 `protobuf:"fixed64,9,opt,name=F_Double,json=FDouble,def=271828" json:"F_Double,omitempty"` + F_String *string `protobuf:"bytes,10,opt,name=F_String,json=FString,def=hello, \"world!\"\n" json:"F_String,omitempty"` + F_Bytes []byte `protobuf:"bytes,11,opt,name=F_Bytes,json=FBytes,def=Bignose" json:"F_Bytes,omitempty"` + F_Sint32 *int32 `protobuf:"zigzag32,12,opt,name=F_Sint32,json=FSint32,def=-32" json:"F_Sint32,omitempty"` + F_Sint64 *int64 `protobuf:"zigzag64,13,opt,name=F_Sint64,json=FSint64,def=-64" json:"F_Sint64,omitempty"` + F_Enum *Defaults_Color `protobuf:"varint,14,opt,name=F_Enum,json=FEnum,enum=test_proto.Defaults_Color,def=1" json:"F_Enum,omitempty"` + // More fields with crazy defaults. + F_Pinf *float32 `protobuf:"fixed32,15,opt,name=F_Pinf,json=FPinf,def=inf" json:"F_Pinf,omitempty"` + F_Ninf *float32 `protobuf:"fixed32,16,opt,name=F_Ninf,json=FNinf,def=-inf" json:"F_Ninf,omitempty"` + F_Nan *float32 `protobuf:"fixed32,17,opt,name=F_Nan,json=FNan,def=nan" json:"F_Nan,omitempty"` + // Sub-message. + Sub *SubDefaults `protobuf:"bytes,18,opt,name=sub" json:"sub,omitempty"` + // Redundant but explicit defaults. + StrZero *string `protobuf:"bytes,19,opt,name=str_zero,json=strZero,def=" json:"str_zero,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Defaults) Reset() { *m = Defaults{} } +func (m *Defaults) String() string { return proto.CompactTextString(m) } +func (*Defaults) ProtoMessage() {} +func (*Defaults) Descriptor() ([]byte, []int) { + return fileDescriptor_test_74787bfc6550f8a7, []int{21} +} +func (m *Defaults) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Defaults.Unmarshal(m, b) +} +func (m *Defaults) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Defaults.Marshal(b, m, deterministic) +} +func (dst *Defaults) XXX_Merge(src proto.Message) { + xxx_messageInfo_Defaults.Merge(dst, src) +} +func (m *Defaults) XXX_Size() int { + return xxx_messageInfo_Defaults.Size(m) +} +func (m *Defaults) XXX_DiscardUnknown() { + xxx_messageInfo_Defaults.DiscardUnknown(m) +} + +var xxx_messageInfo_Defaults proto.InternalMessageInfo + +const Default_Defaults_F_Bool bool = true +const Default_Defaults_F_Int32 int32 = 32 +const Default_Defaults_F_Int64 int64 = 64 +const Default_Defaults_F_Fixed32 uint32 = 320 +const Default_Defaults_F_Fixed64 uint64 = 640 +const Default_Defaults_F_Uint32 uint32 = 3200 +const Default_Defaults_F_Uint64 uint64 = 6400 +const Default_Defaults_F_Float float32 = 314159 +const Default_Defaults_F_Double float64 = 271828 +const Default_Defaults_F_String string = "hello, \"world!\"\n" + +var Default_Defaults_F_Bytes []byte = []byte("Bignose") + +const Default_Defaults_F_Sint32 int32 = -32 +const Default_Defaults_F_Sint64 int64 = -64 +const Default_Defaults_F_Enum Defaults_Color = Defaults_GREEN + +var Default_Defaults_F_Pinf float32 = float32(math.Inf(1)) +var Default_Defaults_F_Ninf float32 = float32(math.Inf(-1)) +var Default_Defaults_F_Nan float32 = float32(math.NaN()) + +func (m *Defaults) GetF_Bool() bool { + if m != nil && m.F_Bool != nil { + return *m.F_Bool + } + return Default_Defaults_F_Bool +} + +func (m *Defaults) GetF_Int32() int32 { + if m != nil && m.F_Int32 != nil { + return *m.F_Int32 + } + return Default_Defaults_F_Int32 +} + +func (m *Defaults) GetF_Int64() int64 { + if m != nil && m.F_Int64 != nil { + return *m.F_Int64 + } + return Default_Defaults_F_Int64 +} + +func (m *Defaults) GetF_Fixed32() uint32 { + if m != nil && m.F_Fixed32 != nil { + return *m.F_Fixed32 + } + return Default_Defaults_F_Fixed32 +} + +func (m *Defaults) GetF_Fixed64() uint64 { + if m != nil && m.F_Fixed64 != nil { + return *m.F_Fixed64 + } + return Default_Defaults_F_Fixed64 +} + +func (m *Defaults) GetF_Uint32() uint32 { + if m != nil && m.F_Uint32 != nil { + return *m.F_Uint32 + } + return Default_Defaults_F_Uint32 +} + +func (m *Defaults) GetF_Uint64() uint64 { + if m != nil && m.F_Uint64 != nil { + return *m.F_Uint64 + } + return Default_Defaults_F_Uint64 +} + +func (m *Defaults) GetF_Float() float32 { + if m != nil && m.F_Float != nil { + return *m.F_Float + } + return Default_Defaults_F_Float +} + +func (m *Defaults) GetF_Double() float64 { + if m != nil && m.F_Double != nil { + return *m.F_Double + } + return Default_Defaults_F_Double +} + +func (m *Defaults) GetF_String() string { + if m != nil && m.F_String != nil { + return *m.F_String + } + return Default_Defaults_F_String +} + +func (m *Defaults) GetF_Bytes() []byte { + if m != nil && m.F_Bytes != nil { + return m.F_Bytes + } + return append([]byte(nil), Default_Defaults_F_Bytes...) +} + +func (m *Defaults) GetF_Sint32() int32 { + if m != nil && m.F_Sint32 != nil { + return *m.F_Sint32 + } + return Default_Defaults_F_Sint32 +} + +func (m *Defaults) GetF_Sint64() int64 { + if m != nil && m.F_Sint64 != nil { + return *m.F_Sint64 + } + return Default_Defaults_F_Sint64 +} + +func (m *Defaults) GetF_Enum() Defaults_Color { + if m != nil && m.F_Enum != nil { + return *m.F_Enum + } + return Default_Defaults_F_Enum +} + +func (m *Defaults) GetF_Pinf() float32 { + if m != nil && m.F_Pinf != nil { + return *m.F_Pinf + } + return Default_Defaults_F_Pinf +} + +func (m *Defaults) GetF_Ninf() float32 { + if m != nil && m.F_Ninf != nil { + return *m.F_Ninf + } + return Default_Defaults_F_Ninf +} + +func (m *Defaults) GetF_Nan() float32 { + if m != nil && m.F_Nan != nil { + return *m.F_Nan + } + return Default_Defaults_F_Nan +} + +func (m *Defaults) GetSub() *SubDefaults { + if m != nil { + return m.Sub + } + return nil +} + +func (m *Defaults) GetStrZero() string { + if m != nil && m.StrZero != nil { + return *m.StrZero + } + return "" +} + +type SubDefaults struct { + N *int64 `protobuf:"varint,1,opt,name=n,def=7" json:"n,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SubDefaults) Reset() { *m = SubDefaults{} } +func (m *SubDefaults) String() string { return proto.CompactTextString(m) } +func (*SubDefaults) ProtoMessage() {} +func (*SubDefaults) Descriptor() ([]byte, []int) { + return fileDescriptor_test_74787bfc6550f8a7, []int{22} +} +func (m *SubDefaults) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SubDefaults.Unmarshal(m, b) +} +func (m *SubDefaults) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SubDefaults.Marshal(b, m, deterministic) +} +func (dst *SubDefaults) XXX_Merge(src proto.Message) { + xxx_messageInfo_SubDefaults.Merge(dst, src) +} +func (m *SubDefaults) XXX_Size() int { + return xxx_messageInfo_SubDefaults.Size(m) +} +func (m *SubDefaults) XXX_DiscardUnknown() { + xxx_messageInfo_SubDefaults.DiscardUnknown(m) +} + +var xxx_messageInfo_SubDefaults proto.InternalMessageInfo + +const Default_SubDefaults_N int64 = 7 + +func (m *SubDefaults) GetN() int64 { + if m != nil && m.N != nil { + return *m.N + } + return Default_SubDefaults_N +} + +type RepeatedEnum struct { + Color []RepeatedEnum_Color `protobuf:"varint,1,rep,name=color,enum=test_proto.RepeatedEnum_Color" json:"color,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RepeatedEnum) Reset() { *m = RepeatedEnum{} } +func (m *RepeatedEnum) String() string { return proto.CompactTextString(m) } +func (*RepeatedEnum) ProtoMessage() {} +func (*RepeatedEnum) Descriptor() ([]byte, []int) { + return fileDescriptor_test_74787bfc6550f8a7, []int{23} +} +func (m *RepeatedEnum) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_RepeatedEnum.Unmarshal(m, b) +} +func (m *RepeatedEnum) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_RepeatedEnum.Marshal(b, m, deterministic) +} +func (dst *RepeatedEnum) XXX_Merge(src proto.Message) { + xxx_messageInfo_RepeatedEnum.Merge(dst, src) +} +func (m *RepeatedEnum) XXX_Size() int { + return xxx_messageInfo_RepeatedEnum.Size(m) +} +func (m *RepeatedEnum) XXX_DiscardUnknown() { + xxx_messageInfo_RepeatedEnum.DiscardUnknown(m) +} + +var xxx_messageInfo_RepeatedEnum proto.InternalMessageInfo + +func (m *RepeatedEnum) GetColor() []RepeatedEnum_Color { + if m != nil { + return m.Color + } + return nil +} + +type MoreRepeated struct { + Bools []bool `protobuf:"varint,1,rep,name=bools" json:"bools,omitempty"` + BoolsPacked []bool `protobuf:"varint,2,rep,packed,name=bools_packed,json=boolsPacked" json:"bools_packed,omitempty"` + Ints []int32 `protobuf:"varint,3,rep,name=ints" json:"ints,omitempty"` + IntsPacked []int32 `protobuf:"varint,4,rep,packed,name=ints_packed,json=intsPacked" json:"ints_packed,omitempty"` + Int64SPacked []int64 `protobuf:"varint,7,rep,packed,name=int64s_packed,json=int64sPacked" json:"int64s_packed,omitempty"` + Strings []string `protobuf:"bytes,5,rep,name=strings" json:"strings,omitempty"` + Fixeds []uint32 `protobuf:"fixed32,6,rep,name=fixeds" json:"fixeds,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MoreRepeated) Reset() { *m = MoreRepeated{} } +func (m *MoreRepeated) String() string { return proto.CompactTextString(m) } +func (*MoreRepeated) ProtoMessage() {} +func (*MoreRepeated) Descriptor() ([]byte, []int) { + return fileDescriptor_test_74787bfc6550f8a7, []int{24} +} +func (m *MoreRepeated) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MoreRepeated.Unmarshal(m, b) +} +func (m *MoreRepeated) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MoreRepeated.Marshal(b, m, deterministic) +} +func (dst *MoreRepeated) XXX_Merge(src proto.Message) { + xxx_messageInfo_MoreRepeated.Merge(dst, src) +} +func (m *MoreRepeated) XXX_Size() int { + return xxx_messageInfo_MoreRepeated.Size(m) +} +func (m *MoreRepeated) XXX_DiscardUnknown() { + xxx_messageInfo_MoreRepeated.DiscardUnknown(m) +} + +var xxx_messageInfo_MoreRepeated proto.InternalMessageInfo + +func (m *MoreRepeated) GetBools() []bool { + if m != nil { + return m.Bools + } + return nil +} + +func (m *MoreRepeated) GetBoolsPacked() []bool { + if m != nil { + return m.BoolsPacked + } + return nil +} + +func (m *MoreRepeated) GetInts() []int32 { + if m != nil { + return m.Ints + } + return nil +} + +func (m *MoreRepeated) GetIntsPacked() []int32 { + if m != nil { + return m.IntsPacked + } + return nil +} + +func (m *MoreRepeated) GetInt64SPacked() []int64 { + if m != nil { + return m.Int64SPacked + } + return nil +} + +func (m *MoreRepeated) GetStrings() []string { + if m != nil { + return m.Strings + } + return nil +} + +func (m *MoreRepeated) GetFixeds() []uint32 { + if m != nil { + return m.Fixeds + } + return nil +} + +type GroupOld struct { + G *GroupOld_G `protobuf:"group,101,opt,name=G,json=g" json:"g,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GroupOld) Reset() { *m = GroupOld{} } +func (m *GroupOld) String() string { return proto.CompactTextString(m) } +func (*GroupOld) ProtoMessage() {} +func (*GroupOld) Descriptor() ([]byte, []int) { + return fileDescriptor_test_74787bfc6550f8a7, []int{25} +} +func (m *GroupOld) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GroupOld.Unmarshal(m, b) +} +func (m *GroupOld) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GroupOld.Marshal(b, m, deterministic) +} +func (dst *GroupOld) XXX_Merge(src proto.Message) { + xxx_messageInfo_GroupOld.Merge(dst, src) +} +func (m *GroupOld) XXX_Size() int { + return xxx_messageInfo_GroupOld.Size(m) +} +func (m *GroupOld) XXX_DiscardUnknown() { + xxx_messageInfo_GroupOld.DiscardUnknown(m) +} + +var xxx_messageInfo_GroupOld proto.InternalMessageInfo + +func (m *GroupOld) GetG() *GroupOld_G { + if m != nil { + return m.G + } + return nil +} + +type GroupOld_G struct { + X *int32 `protobuf:"varint,2,opt,name=x" json:"x,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GroupOld_G) Reset() { *m = GroupOld_G{} } +func (m *GroupOld_G) String() string { return proto.CompactTextString(m) } +func (*GroupOld_G) ProtoMessage() {} +func (*GroupOld_G) Descriptor() ([]byte, []int) { + return fileDescriptor_test_74787bfc6550f8a7, []int{25, 0} +} +func (m *GroupOld_G) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GroupOld_G.Unmarshal(m, b) +} +func (m *GroupOld_G) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GroupOld_G.Marshal(b, m, deterministic) +} +func (dst *GroupOld_G) XXX_Merge(src proto.Message) { + xxx_messageInfo_GroupOld_G.Merge(dst, src) +} +func (m *GroupOld_G) XXX_Size() int { + return xxx_messageInfo_GroupOld_G.Size(m) +} +func (m *GroupOld_G) XXX_DiscardUnknown() { + xxx_messageInfo_GroupOld_G.DiscardUnknown(m) +} + +var xxx_messageInfo_GroupOld_G proto.InternalMessageInfo + +func (m *GroupOld_G) GetX() int32 { + if m != nil && m.X != nil { + return *m.X + } + return 0 +} + +type GroupNew struct { + G *GroupNew_G `protobuf:"group,101,opt,name=G,json=g" json:"g,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GroupNew) Reset() { *m = GroupNew{} } +func (m *GroupNew) String() string { return proto.CompactTextString(m) } +func (*GroupNew) ProtoMessage() {} +func (*GroupNew) Descriptor() ([]byte, []int) { + return fileDescriptor_test_74787bfc6550f8a7, []int{26} +} +func (m *GroupNew) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GroupNew.Unmarshal(m, b) +} +func (m *GroupNew) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GroupNew.Marshal(b, m, deterministic) +} +func (dst *GroupNew) XXX_Merge(src proto.Message) { + xxx_messageInfo_GroupNew.Merge(dst, src) +} +func (m *GroupNew) XXX_Size() int { + return xxx_messageInfo_GroupNew.Size(m) +} +func (m *GroupNew) XXX_DiscardUnknown() { + xxx_messageInfo_GroupNew.DiscardUnknown(m) +} + +var xxx_messageInfo_GroupNew proto.InternalMessageInfo + +func (m *GroupNew) GetG() *GroupNew_G { + if m != nil { + return m.G + } + return nil +} + +type GroupNew_G struct { + X *int32 `protobuf:"varint,2,opt,name=x" json:"x,omitempty"` + Y *int32 `protobuf:"varint,3,opt,name=y" json:"y,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GroupNew_G) Reset() { *m = GroupNew_G{} } +func (m *GroupNew_G) String() string { return proto.CompactTextString(m) } +func (*GroupNew_G) ProtoMessage() {} +func (*GroupNew_G) Descriptor() ([]byte, []int) { + return fileDescriptor_test_74787bfc6550f8a7, []int{26, 0} +} +func (m *GroupNew_G) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GroupNew_G.Unmarshal(m, b) +} +func (m *GroupNew_G) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GroupNew_G.Marshal(b, m, deterministic) +} +func (dst *GroupNew_G) XXX_Merge(src proto.Message) { + xxx_messageInfo_GroupNew_G.Merge(dst, src) +} +func (m *GroupNew_G) XXX_Size() int { + return xxx_messageInfo_GroupNew_G.Size(m) +} +func (m *GroupNew_G) XXX_DiscardUnknown() { + xxx_messageInfo_GroupNew_G.DiscardUnknown(m) +} + +var xxx_messageInfo_GroupNew_G proto.InternalMessageInfo + +func (m *GroupNew_G) GetX() int32 { + if m != nil && m.X != nil { + return *m.X + } + return 0 +} + +func (m *GroupNew_G) GetY() int32 { + if m != nil && m.Y != nil { + return *m.Y + } + return 0 +} + +type FloatingPoint struct { + F *float64 `protobuf:"fixed64,1,req,name=f" json:"f,omitempty"` + Exact *bool `protobuf:"varint,2,opt,name=exact" json:"exact,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *FloatingPoint) Reset() { *m = FloatingPoint{} } +func (m *FloatingPoint) String() string { return proto.CompactTextString(m) } +func (*FloatingPoint) ProtoMessage() {} +func (*FloatingPoint) Descriptor() ([]byte, []int) { + return fileDescriptor_test_74787bfc6550f8a7, []int{27} +} +func (m *FloatingPoint) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_FloatingPoint.Unmarshal(m, b) +} +func (m *FloatingPoint) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_FloatingPoint.Marshal(b, m, deterministic) +} +func (dst *FloatingPoint) XXX_Merge(src proto.Message) { + xxx_messageInfo_FloatingPoint.Merge(dst, src) +} +func (m *FloatingPoint) XXX_Size() int { + return xxx_messageInfo_FloatingPoint.Size(m) +} +func (m *FloatingPoint) XXX_DiscardUnknown() { + xxx_messageInfo_FloatingPoint.DiscardUnknown(m) +} + +var xxx_messageInfo_FloatingPoint proto.InternalMessageInfo + +func (m *FloatingPoint) GetF() float64 { + if m != nil && m.F != nil { + return *m.F + } + return 0 +} + +func (m *FloatingPoint) GetExact() bool { + if m != nil && m.Exact != nil { + return *m.Exact + } + return false +} + +type MessageWithMap struct { + NameMapping map[int32]string `protobuf:"bytes,1,rep,name=name_mapping,json=nameMapping" json:"name_mapping,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + MsgMapping map[int64]*FloatingPoint `protobuf:"bytes,2,rep,name=msg_mapping,json=msgMapping" json:"msg_mapping,omitempty" protobuf_key:"zigzag64,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + ByteMapping map[bool][]byte `protobuf:"bytes,3,rep,name=byte_mapping,json=byteMapping" json:"byte_mapping,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + StrToStr map[string]string `protobuf:"bytes,4,rep,name=str_to_str,json=strToStr" json:"str_to_str,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MessageWithMap) Reset() { *m = MessageWithMap{} } +func (m *MessageWithMap) String() string { return proto.CompactTextString(m) } +func (*MessageWithMap) ProtoMessage() {} +func (*MessageWithMap) Descriptor() ([]byte, []int) { + return fileDescriptor_test_74787bfc6550f8a7, []int{28} +} +func (m *MessageWithMap) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MessageWithMap.Unmarshal(m, b) +} +func (m *MessageWithMap) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MessageWithMap.Marshal(b, m, deterministic) +} +func (dst *MessageWithMap) XXX_Merge(src proto.Message) { + xxx_messageInfo_MessageWithMap.Merge(dst, src) +} +func (m *MessageWithMap) XXX_Size() int { + return xxx_messageInfo_MessageWithMap.Size(m) +} +func (m *MessageWithMap) XXX_DiscardUnknown() { + xxx_messageInfo_MessageWithMap.DiscardUnknown(m) +} + +var xxx_messageInfo_MessageWithMap proto.InternalMessageInfo + +func (m *MessageWithMap) GetNameMapping() map[int32]string { + if m != nil { + return m.NameMapping + } + return nil +} + +func (m *MessageWithMap) GetMsgMapping() map[int64]*FloatingPoint { + if m != nil { + return m.MsgMapping + } + return nil +} + +func (m *MessageWithMap) GetByteMapping() map[bool][]byte { + if m != nil { + return m.ByteMapping + } + return nil +} + +func (m *MessageWithMap) GetStrToStr() map[string]string { + if m != nil { + return m.StrToStr + } + return nil +} + +type Oneof struct { + // Types that are valid to be assigned to Union: + // *Oneof_F_Bool + // *Oneof_F_Int32 + // *Oneof_F_Int64 + // *Oneof_F_Fixed32 + // *Oneof_F_Fixed64 + // *Oneof_F_Uint32 + // *Oneof_F_Uint64 + // *Oneof_F_Float + // *Oneof_F_Double + // *Oneof_F_String + // *Oneof_F_Bytes + // *Oneof_F_Sint32 + // *Oneof_F_Sint64 + // *Oneof_F_Enum + // *Oneof_F_Message + // *Oneof_FGroup + // *Oneof_F_Largest_Tag + Union isOneof_Union `protobuf_oneof:"union"` + // Types that are valid to be assigned to Tormato: + // *Oneof_Value + Tormato isOneof_Tormato `protobuf_oneof:"tormato"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Oneof) Reset() { *m = Oneof{} } +func (m *Oneof) String() string { return proto.CompactTextString(m) } +func (*Oneof) ProtoMessage() {} +func (*Oneof) Descriptor() ([]byte, []int) { + return fileDescriptor_test_74787bfc6550f8a7, []int{29} +} +func (m *Oneof) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Oneof.Unmarshal(m, b) +} +func (m *Oneof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Oneof.Marshal(b, m, deterministic) +} +func (dst *Oneof) XXX_Merge(src proto.Message) { + xxx_messageInfo_Oneof.Merge(dst, src) +} +func (m *Oneof) XXX_Size() int { + return xxx_messageInfo_Oneof.Size(m) +} +func (m *Oneof) XXX_DiscardUnknown() { + xxx_messageInfo_Oneof.DiscardUnknown(m) +} + +var xxx_messageInfo_Oneof proto.InternalMessageInfo + +type isOneof_Union interface { + isOneof_Union() +} +type isOneof_Tormato interface { + isOneof_Tormato() +} + +type Oneof_F_Bool struct { + F_Bool bool `protobuf:"varint,1,opt,name=F_Bool,json=FBool,oneof"` +} +type Oneof_F_Int32 struct { + F_Int32 int32 `protobuf:"varint,2,opt,name=F_Int32,json=FInt32,oneof"` +} +type Oneof_F_Int64 struct { + F_Int64 int64 `protobuf:"varint,3,opt,name=F_Int64,json=FInt64,oneof"` +} +type Oneof_F_Fixed32 struct { + F_Fixed32 uint32 `protobuf:"fixed32,4,opt,name=F_Fixed32,json=FFixed32,oneof"` +} +type Oneof_F_Fixed64 struct { + F_Fixed64 uint64 `protobuf:"fixed64,5,opt,name=F_Fixed64,json=FFixed64,oneof"` +} +type Oneof_F_Uint32 struct { + F_Uint32 uint32 `protobuf:"varint,6,opt,name=F_Uint32,json=FUint32,oneof"` +} +type Oneof_F_Uint64 struct { + F_Uint64 uint64 `protobuf:"varint,7,opt,name=F_Uint64,json=FUint64,oneof"` +} +type Oneof_F_Float struct { + F_Float float32 `protobuf:"fixed32,8,opt,name=F_Float,json=FFloat,oneof"` +} +type Oneof_F_Double struct { + F_Double float64 `protobuf:"fixed64,9,opt,name=F_Double,json=FDouble,oneof"` +} +type Oneof_F_String struct { + F_String string `protobuf:"bytes,10,opt,name=F_String,json=FString,oneof"` +} +type Oneof_F_Bytes struct { + F_Bytes []byte `protobuf:"bytes,11,opt,name=F_Bytes,json=FBytes,oneof"` +} +type Oneof_F_Sint32 struct { + F_Sint32 int32 `protobuf:"zigzag32,12,opt,name=F_Sint32,json=FSint32,oneof"` +} +type Oneof_F_Sint64 struct { + F_Sint64 int64 `protobuf:"zigzag64,13,opt,name=F_Sint64,json=FSint64,oneof"` +} +type Oneof_F_Enum struct { + F_Enum MyMessage_Color `protobuf:"varint,14,opt,name=F_Enum,json=FEnum,enum=test_proto.MyMessage_Color,oneof"` +} +type Oneof_F_Message struct { + F_Message *GoTestField `protobuf:"bytes,15,opt,name=F_Message,json=FMessage,oneof"` +} +type Oneof_FGroup struct { + FGroup *Oneof_F_Group `protobuf:"group,16,opt,name=F_Group,json=fGroup,oneof"` +} +type Oneof_F_Largest_Tag struct { + F_Largest_Tag int32 `protobuf:"varint,536870911,opt,name=F_Largest_Tag,json=FLargestTag,oneof"` +} +type Oneof_Value struct { + Value int32 `protobuf:"varint,100,opt,name=value,oneof"` +} + +func (*Oneof_F_Bool) isOneof_Union() {} +func (*Oneof_F_Int32) isOneof_Union() {} +func (*Oneof_F_Int64) isOneof_Union() {} +func (*Oneof_F_Fixed32) isOneof_Union() {} +func (*Oneof_F_Fixed64) isOneof_Union() {} +func (*Oneof_F_Uint32) isOneof_Union() {} +func (*Oneof_F_Uint64) isOneof_Union() {} +func (*Oneof_F_Float) isOneof_Union() {} +func (*Oneof_F_Double) isOneof_Union() {} +func (*Oneof_F_String) isOneof_Union() {} +func (*Oneof_F_Bytes) isOneof_Union() {} +func (*Oneof_F_Sint32) isOneof_Union() {} +func (*Oneof_F_Sint64) isOneof_Union() {} +func (*Oneof_F_Enum) isOneof_Union() {} +func (*Oneof_F_Message) isOneof_Union() {} +func (*Oneof_FGroup) isOneof_Union() {} +func (*Oneof_F_Largest_Tag) isOneof_Union() {} +func (*Oneof_Value) isOneof_Tormato() {} + +func (m *Oneof) GetUnion() isOneof_Union { + if m != nil { + return m.Union + } + return nil +} +func (m *Oneof) GetTormato() isOneof_Tormato { + if m != nil { + return m.Tormato + } + return nil +} + +func (m *Oneof) GetF_Bool() bool { + if x, ok := m.GetUnion().(*Oneof_F_Bool); ok { + return x.F_Bool + } + return false +} + +func (m *Oneof) GetF_Int32() int32 { + if x, ok := m.GetUnion().(*Oneof_F_Int32); ok { + return x.F_Int32 + } + return 0 +} + +func (m *Oneof) GetF_Int64() int64 { + if x, ok := m.GetUnion().(*Oneof_F_Int64); ok { + return x.F_Int64 + } + return 0 +} + +func (m *Oneof) GetF_Fixed32() uint32 { + if x, ok := m.GetUnion().(*Oneof_F_Fixed32); ok { + return x.F_Fixed32 + } + return 0 +} + +func (m *Oneof) GetF_Fixed64() uint64 { + if x, ok := m.GetUnion().(*Oneof_F_Fixed64); ok { + return x.F_Fixed64 + } + return 0 +} + +func (m *Oneof) GetF_Uint32() uint32 { + if x, ok := m.GetUnion().(*Oneof_F_Uint32); ok { + return x.F_Uint32 + } + return 0 +} + +func (m *Oneof) GetF_Uint64() uint64 { + if x, ok := m.GetUnion().(*Oneof_F_Uint64); ok { + return x.F_Uint64 + } + return 0 +} + +func (m *Oneof) GetF_Float() float32 { + if x, ok := m.GetUnion().(*Oneof_F_Float); ok { + return x.F_Float + } + return 0 +} + +func (m *Oneof) GetF_Double() float64 { + if x, ok := m.GetUnion().(*Oneof_F_Double); ok { + return x.F_Double + } + return 0 +} + +func (m *Oneof) GetF_String() string { + if x, ok := m.GetUnion().(*Oneof_F_String); ok { + return x.F_String + } + return "" +} + +func (m *Oneof) GetF_Bytes() []byte { + if x, ok := m.GetUnion().(*Oneof_F_Bytes); ok { + return x.F_Bytes + } + return nil +} + +func (m *Oneof) GetF_Sint32() int32 { + if x, ok := m.GetUnion().(*Oneof_F_Sint32); ok { + return x.F_Sint32 + } + return 0 +} + +func (m *Oneof) GetF_Sint64() int64 { + if x, ok := m.GetUnion().(*Oneof_F_Sint64); ok { + return x.F_Sint64 + } + return 0 +} + +func (m *Oneof) GetF_Enum() MyMessage_Color { + if x, ok := m.GetUnion().(*Oneof_F_Enum); ok { + return x.F_Enum + } + return MyMessage_RED +} + +func (m *Oneof) GetF_Message() *GoTestField { + if x, ok := m.GetUnion().(*Oneof_F_Message); ok { + return x.F_Message + } + return nil +} + +func (m *Oneof) GetFGroup() *Oneof_F_Group { + if x, ok := m.GetUnion().(*Oneof_FGroup); ok { + return x.FGroup + } + return nil +} + +func (m *Oneof) GetF_Largest_Tag() int32 { + if x, ok := m.GetUnion().(*Oneof_F_Largest_Tag); ok { + return x.F_Largest_Tag + } + return 0 +} + +func (m *Oneof) GetValue() int32 { + if x, ok := m.GetTormato().(*Oneof_Value); ok { + return x.Value + } + return 0 +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*Oneof) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _Oneof_OneofMarshaler, _Oneof_OneofUnmarshaler, _Oneof_OneofSizer, []interface{}{ + (*Oneof_F_Bool)(nil), + (*Oneof_F_Int32)(nil), + (*Oneof_F_Int64)(nil), + (*Oneof_F_Fixed32)(nil), + (*Oneof_F_Fixed64)(nil), + (*Oneof_F_Uint32)(nil), + (*Oneof_F_Uint64)(nil), + (*Oneof_F_Float)(nil), + (*Oneof_F_Double)(nil), + (*Oneof_F_String)(nil), + (*Oneof_F_Bytes)(nil), + (*Oneof_F_Sint32)(nil), + (*Oneof_F_Sint64)(nil), + (*Oneof_F_Enum)(nil), + (*Oneof_F_Message)(nil), + (*Oneof_FGroup)(nil), + (*Oneof_F_Largest_Tag)(nil), + (*Oneof_Value)(nil), + } +} + +func _Oneof_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*Oneof) + // union + switch x := m.Union.(type) { + case *Oneof_F_Bool: + t := uint64(0) + if x.F_Bool { + t = 1 + } + b.EncodeVarint(1<<3 | proto.WireVarint) + b.EncodeVarint(t) + case *Oneof_F_Int32: + b.EncodeVarint(2<<3 | proto.WireVarint) + b.EncodeVarint(uint64(x.F_Int32)) + case *Oneof_F_Int64: + b.EncodeVarint(3<<3 | proto.WireVarint) + b.EncodeVarint(uint64(x.F_Int64)) + case *Oneof_F_Fixed32: + b.EncodeVarint(4<<3 | proto.WireFixed32) + b.EncodeFixed32(uint64(x.F_Fixed32)) + case *Oneof_F_Fixed64: + b.EncodeVarint(5<<3 | proto.WireFixed64) + b.EncodeFixed64(uint64(x.F_Fixed64)) + case *Oneof_F_Uint32: + b.EncodeVarint(6<<3 | proto.WireVarint) + b.EncodeVarint(uint64(x.F_Uint32)) + case *Oneof_F_Uint64: + b.EncodeVarint(7<<3 | proto.WireVarint) + b.EncodeVarint(uint64(x.F_Uint64)) + case *Oneof_F_Float: + b.EncodeVarint(8<<3 | proto.WireFixed32) + b.EncodeFixed32(uint64(math.Float32bits(x.F_Float))) + case *Oneof_F_Double: + b.EncodeVarint(9<<3 | proto.WireFixed64) + b.EncodeFixed64(math.Float64bits(x.F_Double)) + case *Oneof_F_String: + b.EncodeVarint(10<<3 | proto.WireBytes) + b.EncodeStringBytes(x.F_String) + case *Oneof_F_Bytes: + b.EncodeVarint(11<<3 | proto.WireBytes) + b.EncodeRawBytes(x.F_Bytes) + case *Oneof_F_Sint32: + b.EncodeVarint(12<<3 | proto.WireVarint) + b.EncodeZigzag32(uint64(x.F_Sint32)) + case *Oneof_F_Sint64: + b.EncodeVarint(13<<3 | proto.WireVarint) + b.EncodeZigzag64(uint64(x.F_Sint64)) + case *Oneof_F_Enum: + b.EncodeVarint(14<<3 | proto.WireVarint) + b.EncodeVarint(uint64(x.F_Enum)) + case *Oneof_F_Message: + b.EncodeVarint(15<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.F_Message); err != nil { + return err + } + case *Oneof_FGroup: + b.EncodeVarint(16<<3 | proto.WireStartGroup) + if err := b.Marshal(x.FGroup); err != nil { + return err + } + b.EncodeVarint(16<<3 | proto.WireEndGroup) + case *Oneof_F_Largest_Tag: + b.EncodeVarint(536870911<<3 | proto.WireVarint) + b.EncodeVarint(uint64(x.F_Largest_Tag)) + case nil: + default: + return fmt.Errorf("Oneof.Union has unexpected type %T", x) + } + // tormato + switch x := m.Tormato.(type) { + case *Oneof_Value: + b.EncodeVarint(100<<3 | proto.WireVarint) + b.EncodeVarint(uint64(x.Value)) + case nil: + default: + return fmt.Errorf("Oneof.Tormato has unexpected type %T", x) + } + return nil +} + +func _Oneof_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*Oneof) + switch tag { + case 1: // union.F_Bool + if wire != proto.WireVarint { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeVarint() + m.Union = &Oneof_F_Bool{x != 0} + return true, err + case 2: // union.F_Int32 + if wire != proto.WireVarint { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeVarint() + m.Union = &Oneof_F_Int32{int32(x)} + return true, err + case 3: // union.F_Int64 + if wire != proto.WireVarint { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeVarint() + m.Union = &Oneof_F_Int64{int64(x)} + return true, err + case 4: // union.F_Fixed32 + if wire != proto.WireFixed32 { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeFixed32() + m.Union = &Oneof_F_Fixed32{uint32(x)} + return true, err + case 5: // union.F_Fixed64 + if wire != proto.WireFixed64 { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeFixed64() + m.Union = &Oneof_F_Fixed64{x} + return true, err + case 6: // union.F_Uint32 + if wire != proto.WireVarint { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeVarint() + m.Union = &Oneof_F_Uint32{uint32(x)} + return true, err + case 7: // union.F_Uint64 + if wire != proto.WireVarint { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeVarint() + m.Union = &Oneof_F_Uint64{x} + return true, err + case 8: // union.F_Float + if wire != proto.WireFixed32 { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeFixed32() + m.Union = &Oneof_F_Float{math.Float32frombits(uint32(x))} + return true, err + case 9: // union.F_Double + if wire != proto.WireFixed64 { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeFixed64() + m.Union = &Oneof_F_Double{math.Float64frombits(x)} + return true, err + case 10: // union.F_String + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeStringBytes() + m.Union = &Oneof_F_String{x} + return true, err + case 11: // union.F_Bytes + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeRawBytes(true) + m.Union = &Oneof_F_Bytes{x} + return true, err + case 12: // union.F_Sint32 + if wire != proto.WireVarint { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeZigzag32() + m.Union = &Oneof_F_Sint32{int32(x)} + return true, err + case 13: // union.F_Sint64 + if wire != proto.WireVarint { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeZigzag64() + m.Union = &Oneof_F_Sint64{int64(x)} + return true, err + case 14: // union.F_Enum + if wire != proto.WireVarint { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeVarint() + m.Union = &Oneof_F_Enum{MyMessage_Color(x)} + return true, err + case 15: // union.F_Message + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(GoTestField) + err := b.DecodeMessage(msg) + m.Union = &Oneof_F_Message{msg} + return true, err + case 16: // union.f_group + if wire != proto.WireStartGroup { + return true, proto.ErrInternalBadWireType + } + msg := new(Oneof_F_Group) + err := b.DecodeGroup(msg) + m.Union = &Oneof_FGroup{msg} + return true, err + case 536870911: // union.F_Largest_Tag + if wire != proto.WireVarint { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeVarint() + m.Union = &Oneof_F_Largest_Tag{int32(x)} + return true, err + case 100: // tormato.value + if wire != proto.WireVarint { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeVarint() + m.Tormato = &Oneof_Value{int32(x)} + return true, err + default: + return false, nil + } +} + +func _Oneof_OneofSizer(msg proto.Message) (n int) { + m := msg.(*Oneof) + // union + switch x := m.Union.(type) { + case *Oneof_F_Bool: + n += 1 // tag and wire + n += 1 + case *Oneof_F_Int32: + n += 1 // tag and wire + n += proto.SizeVarint(uint64(x.F_Int32)) + case *Oneof_F_Int64: + n += 1 // tag and wire + n += proto.SizeVarint(uint64(x.F_Int64)) + case *Oneof_F_Fixed32: + n += 1 // tag and wire + n += 4 + case *Oneof_F_Fixed64: + n += 1 // tag and wire + n += 8 + case *Oneof_F_Uint32: + n += 1 // tag and wire + n += proto.SizeVarint(uint64(x.F_Uint32)) + case *Oneof_F_Uint64: + n += 1 // tag and wire + n += proto.SizeVarint(uint64(x.F_Uint64)) + case *Oneof_F_Float: + n += 1 // tag and wire + n += 4 + case *Oneof_F_Double: + n += 1 // tag and wire + n += 8 + case *Oneof_F_String: + n += 1 // tag and wire + n += proto.SizeVarint(uint64(len(x.F_String))) + n += len(x.F_String) + case *Oneof_F_Bytes: + n += 1 // tag and wire + n += proto.SizeVarint(uint64(len(x.F_Bytes))) + n += len(x.F_Bytes) + case *Oneof_F_Sint32: + n += 1 // tag and wire + n += proto.SizeVarint(uint64((uint32(x.F_Sint32) << 1) ^ uint32((int32(x.F_Sint32) >> 31)))) + case *Oneof_F_Sint64: + n += 1 // tag and wire + n += proto.SizeVarint(uint64(uint64(x.F_Sint64<<1) ^ uint64((int64(x.F_Sint64) >> 63)))) + case *Oneof_F_Enum: + n += 1 // tag and wire + n += proto.SizeVarint(uint64(x.F_Enum)) + case *Oneof_F_Message: + s := proto.Size(x.F_Message) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *Oneof_FGroup: + n += 2 // tag and wire + n += proto.Size(x.FGroup) + n += 2 // tag and wire + case *Oneof_F_Largest_Tag: + n += 10 // tag and wire + n += proto.SizeVarint(uint64(x.F_Largest_Tag)) + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + // tormato + switch x := m.Tormato.(type) { + case *Oneof_Value: + n += 2 // tag and wire + n += proto.SizeVarint(uint64(x.Value)) + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +type Oneof_F_Group struct { + X *int32 `protobuf:"varint,17,opt,name=x" json:"x,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Oneof_F_Group) Reset() { *m = Oneof_F_Group{} } +func (m *Oneof_F_Group) String() string { return proto.CompactTextString(m) } +func (*Oneof_F_Group) ProtoMessage() {} +func (*Oneof_F_Group) Descriptor() ([]byte, []int) { + return fileDescriptor_test_74787bfc6550f8a7, []int{29, 0} +} +func (m *Oneof_F_Group) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Oneof_F_Group.Unmarshal(m, b) +} +func (m *Oneof_F_Group) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Oneof_F_Group.Marshal(b, m, deterministic) +} +func (dst *Oneof_F_Group) XXX_Merge(src proto.Message) { + xxx_messageInfo_Oneof_F_Group.Merge(dst, src) +} +func (m *Oneof_F_Group) XXX_Size() int { + return xxx_messageInfo_Oneof_F_Group.Size(m) +} +func (m *Oneof_F_Group) XXX_DiscardUnknown() { + xxx_messageInfo_Oneof_F_Group.DiscardUnknown(m) +} + +var xxx_messageInfo_Oneof_F_Group proto.InternalMessageInfo + +func (m *Oneof_F_Group) GetX() int32 { + if m != nil && m.X != nil { + return *m.X + } + return 0 +} + +type Communique struct { + MakeMeCry *bool `protobuf:"varint,1,opt,name=make_me_cry,json=makeMeCry" json:"make_me_cry,omitempty"` + // This is a oneof, called "union". + // + // Types that are valid to be assigned to Union: + // *Communique_Number + // *Communique_Name + // *Communique_Data + // *Communique_TempC + // *Communique_Col + // *Communique_Msg + Union isCommunique_Union `protobuf_oneof:"union"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Communique) Reset() { *m = Communique{} } +func (m *Communique) String() string { return proto.CompactTextString(m) } +func (*Communique) ProtoMessage() {} +func (*Communique) Descriptor() ([]byte, []int) { + return fileDescriptor_test_74787bfc6550f8a7, []int{30} +} +func (m *Communique) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Communique.Unmarshal(m, b) +} +func (m *Communique) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Communique.Marshal(b, m, deterministic) +} +func (dst *Communique) XXX_Merge(src proto.Message) { + xxx_messageInfo_Communique.Merge(dst, src) +} +func (m *Communique) XXX_Size() int { + return xxx_messageInfo_Communique.Size(m) +} +func (m *Communique) XXX_DiscardUnknown() { + xxx_messageInfo_Communique.DiscardUnknown(m) +} + +var xxx_messageInfo_Communique proto.InternalMessageInfo + +type isCommunique_Union interface { + isCommunique_Union() +} + +type Communique_Number struct { + Number int32 `protobuf:"varint,5,opt,name=number,oneof"` +} +type Communique_Name struct { + Name string `protobuf:"bytes,6,opt,name=name,oneof"` +} +type Communique_Data struct { + Data []byte `protobuf:"bytes,7,opt,name=data,oneof"` +} +type Communique_TempC struct { + TempC float64 `protobuf:"fixed64,8,opt,name=temp_c,json=tempC,oneof"` +} +type Communique_Col struct { + Col MyMessage_Color `protobuf:"varint,9,opt,name=col,enum=test_proto.MyMessage_Color,oneof"` +} +type Communique_Msg struct { + Msg *Strings `protobuf:"bytes,10,opt,name=msg,oneof"` +} + +func (*Communique_Number) isCommunique_Union() {} +func (*Communique_Name) isCommunique_Union() {} +func (*Communique_Data) isCommunique_Union() {} +func (*Communique_TempC) isCommunique_Union() {} +func (*Communique_Col) isCommunique_Union() {} +func (*Communique_Msg) isCommunique_Union() {} + +func (m *Communique) GetUnion() isCommunique_Union { + if m != nil { + return m.Union + } + return nil +} + +func (m *Communique) GetMakeMeCry() bool { + if m != nil && m.MakeMeCry != nil { + return *m.MakeMeCry + } + return false +} + +func (m *Communique) GetNumber() int32 { + if x, ok := m.GetUnion().(*Communique_Number); ok { + return x.Number + } + return 0 +} + +func (m *Communique) GetName() string { + if x, ok := m.GetUnion().(*Communique_Name); ok { + return x.Name + } + return "" +} + +func (m *Communique) GetData() []byte { + if x, ok := m.GetUnion().(*Communique_Data); ok { + return x.Data + } + return nil +} + +func (m *Communique) GetTempC() float64 { + if x, ok := m.GetUnion().(*Communique_TempC); ok { + return x.TempC + } + return 0 +} + +func (m *Communique) GetCol() MyMessage_Color { + if x, ok := m.GetUnion().(*Communique_Col); ok { + return x.Col + } + return MyMessage_RED +} + +func (m *Communique) GetMsg() *Strings { + if x, ok := m.GetUnion().(*Communique_Msg); ok { + return x.Msg + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*Communique) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _Communique_OneofMarshaler, _Communique_OneofUnmarshaler, _Communique_OneofSizer, []interface{}{ + (*Communique_Number)(nil), + (*Communique_Name)(nil), + (*Communique_Data)(nil), + (*Communique_TempC)(nil), + (*Communique_Col)(nil), + (*Communique_Msg)(nil), + } +} + +func _Communique_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*Communique) + // union + switch x := m.Union.(type) { + case *Communique_Number: + b.EncodeVarint(5<<3 | proto.WireVarint) + b.EncodeVarint(uint64(x.Number)) + case *Communique_Name: + b.EncodeVarint(6<<3 | proto.WireBytes) + b.EncodeStringBytes(x.Name) + case *Communique_Data: + b.EncodeVarint(7<<3 | proto.WireBytes) + b.EncodeRawBytes(x.Data) + case *Communique_TempC: + b.EncodeVarint(8<<3 | proto.WireFixed64) + b.EncodeFixed64(math.Float64bits(x.TempC)) + case *Communique_Col: + b.EncodeVarint(9<<3 | proto.WireVarint) + b.EncodeVarint(uint64(x.Col)) + case *Communique_Msg: + b.EncodeVarint(10<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Msg); err != nil { + return err + } + case nil: + default: + return fmt.Errorf("Communique.Union has unexpected type %T", x) + } + return nil +} + +func _Communique_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*Communique) + switch tag { + case 5: // union.number + if wire != proto.WireVarint { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeVarint() + m.Union = &Communique_Number{int32(x)} + return true, err + case 6: // union.name + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeStringBytes() + m.Union = &Communique_Name{x} + return true, err + case 7: // union.data + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeRawBytes(true) + m.Union = &Communique_Data{x} + return true, err + case 8: // union.temp_c + if wire != proto.WireFixed64 { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeFixed64() + m.Union = &Communique_TempC{math.Float64frombits(x)} + return true, err + case 9: // union.col + if wire != proto.WireVarint { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeVarint() + m.Union = &Communique_Col{MyMessage_Color(x)} + return true, err + case 10: // union.msg + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(Strings) + err := b.DecodeMessage(msg) + m.Union = &Communique_Msg{msg} + return true, err + default: + return false, nil + } +} + +func _Communique_OneofSizer(msg proto.Message) (n int) { + m := msg.(*Communique) + // union + switch x := m.Union.(type) { + case *Communique_Number: + n += 1 // tag and wire + n += proto.SizeVarint(uint64(x.Number)) + case *Communique_Name: + n += 1 // tag and wire + n += proto.SizeVarint(uint64(len(x.Name))) + n += len(x.Name) + case *Communique_Data: + n += 1 // tag and wire + n += proto.SizeVarint(uint64(len(x.Data))) + n += len(x.Data) + case *Communique_TempC: + n += 1 // tag and wire + n += 8 + case *Communique_Col: + n += 1 // tag and wire + n += proto.SizeVarint(uint64(x.Col)) + case *Communique_Msg: + s := proto.Size(x.Msg) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +var E_Greeting = &proto.ExtensionDesc{ + ExtendedType: (*MyMessage)(nil), + ExtensionType: ([]string)(nil), + Field: 106, + Name: "test_proto.greeting", + Tag: "bytes,106,rep,name=greeting", + Filename: "test_proto/test.proto", +} + +var E_Complex = &proto.ExtensionDesc{ + ExtendedType: (*OtherMessage)(nil), + ExtensionType: (*ComplexExtension)(nil), + Field: 200, + Name: "test_proto.complex", + Tag: "bytes,200,opt,name=complex", + Filename: "test_proto/test.proto", +} + +var E_RComplex = &proto.ExtensionDesc{ + ExtendedType: (*OtherMessage)(nil), + ExtensionType: ([]*ComplexExtension)(nil), + Field: 201, + Name: "test_proto.r_complex", + Tag: "bytes,201,rep,name=r_complex,json=rComplex", + Filename: "test_proto/test.proto", +} + +var E_NoDefaultDouble = &proto.ExtensionDesc{ + ExtendedType: (*DefaultsMessage)(nil), + ExtensionType: (*float64)(nil), + Field: 101, + Name: "test_proto.no_default_double", + Tag: "fixed64,101,opt,name=no_default_double,json=noDefaultDouble", + Filename: "test_proto/test.proto", +} + +var E_NoDefaultFloat = &proto.ExtensionDesc{ + ExtendedType: (*DefaultsMessage)(nil), + ExtensionType: (*float32)(nil), + Field: 102, + Name: "test_proto.no_default_float", + Tag: "fixed32,102,opt,name=no_default_float,json=noDefaultFloat", + Filename: "test_proto/test.proto", +} + +var E_NoDefaultInt32 = &proto.ExtensionDesc{ + ExtendedType: (*DefaultsMessage)(nil), + ExtensionType: (*int32)(nil), + Field: 103, + Name: "test_proto.no_default_int32", + Tag: "varint,103,opt,name=no_default_int32,json=noDefaultInt32", + Filename: "test_proto/test.proto", +} + +var E_NoDefaultInt64 = &proto.ExtensionDesc{ + ExtendedType: (*DefaultsMessage)(nil), + ExtensionType: (*int64)(nil), + Field: 104, + Name: "test_proto.no_default_int64", + Tag: "varint,104,opt,name=no_default_int64,json=noDefaultInt64", + Filename: "test_proto/test.proto", +} + +var E_NoDefaultUint32 = &proto.ExtensionDesc{ + ExtendedType: (*DefaultsMessage)(nil), + ExtensionType: (*uint32)(nil), + Field: 105, + Name: "test_proto.no_default_uint32", + Tag: "varint,105,opt,name=no_default_uint32,json=noDefaultUint32", + Filename: "test_proto/test.proto", +} + +var E_NoDefaultUint64 = &proto.ExtensionDesc{ + ExtendedType: (*DefaultsMessage)(nil), + ExtensionType: (*uint64)(nil), + Field: 106, + Name: "test_proto.no_default_uint64", + Tag: "varint,106,opt,name=no_default_uint64,json=noDefaultUint64", + Filename: "test_proto/test.proto", +} + +var E_NoDefaultSint32 = &proto.ExtensionDesc{ + ExtendedType: (*DefaultsMessage)(nil), + ExtensionType: (*int32)(nil), + Field: 107, + Name: "test_proto.no_default_sint32", + Tag: "zigzag32,107,opt,name=no_default_sint32,json=noDefaultSint32", + Filename: "test_proto/test.proto", +} + +var E_NoDefaultSint64 = &proto.ExtensionDesc{ + ExtendedType: (*DefaultsMessage)(nil), + ExtensionType: (*int64)(nil), + Field: 108, + Name: "test_proto.no_default_sint64", + Tag: "zigzag64,108,opt,name=no_default_sint64,json=noDefaultSint64", + Filename: "test_proto/test.proto", +} + +var E_NoDefaultFixed32 = &proto.ExtensionDesc{ + ExtendedType: (*DefaultsMessage)(nil), + ExtensionType: (*uint32)(nil), + Field: 109, + Name: "test_proto.no_default_fixed32", + Tag: "fixed32,109,opt,name=no_default_fixed32,json=noDefaultFixed32", + Filename: "test_proto/test.proto", +} + +var E_NoDefaultFixed64 = &proto.ExtensionDesc{ + ExtendedType: (*DefaultsMessage)(nil), + ExtensionType: (*uint64)(nil), + Field: 110, + Name: "test_proto.no_default_fixed64", + Tag: "fixed64,110,opt,name=no_default_fixed64,json=noDefaultFixed64", + Filename: "test_proto/test.proto", +} + +var E_NoDefaultSfixed32 = &proto.ExtensionDesc{ + ExtendedType: (*DefaultsMessage)(nil), + ExtensionType: (*int32)(nil), + Field: 111, + Name: "test_proto.no_default_sfixed32", + Tag: "fixed32,111,opt,name=no_default_sfixed32,json=noDefaultSfixed32", + Filename: "test_proto/test.proto", +} + +var E_NoDefaultSfixed64 = &proto.ExtensionDesc{ + ExtendedType: (*DefaultsMessage)(nil), + ExtensionType: (*int64)(nil), + Field: 112, + Name: "test_proto.no_default_sfixed64", + Tag: "fixed64,112,opt,name=no_default_sfixed64,json=noDefaultSfixed64", + Filename: "test_proto/test.proto", +} + +var E_NoDefaultBool = &proto.ExtensionDesc{ + ExtendedType: (*DefaultsMessage)(nil), + ExtensionType: (*bool)(nil), + Field: 113, + Name: "test_proto.no_default_bool", + Tag: "varint,113,opt,name=no_default_bool,json=noDefaultBool", + Filename: "test_proto/test.proto", +} + +var E_NoDefaultString = &proto.ExtensionDesc{ + ExtendedType: (*DefaultsMessage)(nil), + ExtensionType: (*string)(nil), + Field: 114, + Name: "test_proto.no_default_string", + Tag: "bytes,114,opt,name=no_default_string,json=noDefaultString", + Filename: "test_proto/test.proto", +} + +var E_NoDefaultBytes = &proto.ExtensionDesc{ + ExtendedType: (*DefaultsMessage)(nil), + ExtensionType: ([]byte)(nil), + Field: 115, + Name: "test_proto.no_default_bytes", + Tag: "bytes,115,opt,name=no_default_bytes,json=noDefaultBytes", + Filename: "test_proto/test.proto", +} + +var E_NoDefaultEnum = &proto.ExtensionDesc{ + ExtendedType: (*DefaultsMessage)(nil), + ExtensionType: (*DefaultsMessage_DefaultsEnum)(nil), + Field: 116, + Name: "test_proto.no_default_enum", + Tag: "varint,116,opt,name=no_default_enum,json=noDefaultEnum,enum=test_proto.DefaultsMessage_DefaultsEnum", + Filename: "test_proto/test.proto", +} + +var E_DefaultDouble = &proto.ExtensionDesc{ + ExtendedType: (*DefaultsMessage)(nil), + ExtensionType: (*float64)(nil), + Field: 201, + Name: "test_proto.default_double", + Tag: "fixed64,201,opt,name=default_double,json=defaultDouble,def=3.1415", + Filename: "test_proto/test.proto", +} + +var E_DefaultFloat = &proto.ExtensionDesc{ + ExtendedType: (*DefaultsMessage)(nil), + ExtensionType: (*float32)(nil), + Field: 202, + Name: "test_proto.default_float", + Tag: "fixed32,202,opt,name=default_float,json=defaultFloat,def=3.14", + Filename: "test_proto/test.proto", +} + +var E_DefaultInt32 = &proto.ExtensionDesc{ + ExtendedType: (*DefaultsMessage)(nil), + ExtensionType: (*int32)(nil), + Field: 203, + Name: "test_proto.default_int32", + Tag: "varint,203,opt,name=default_int32,json=defaultInt32,def=42", + Filename: "test_proto/test.proto", +} + +var E_DefaultInt64 = &proto.ExtensionDesc{ + ExtendedType: (*DefaultsMessage)(nil), + ExtensionType: (*int64)(nil), + Field: 204, + Name: "test_proto.default_int64", + Tag: "varint,204,opt,name=default_int64,json=defaultInt64,def=43", + Filename: "test_proto/test.proto", +} + +var E_DefaultUint32 = &proto.ExtensionDesc{ + ExtendedType: (*DefaultsMessage)(nil), + ExtensionType: (*uint32)(nil), + Field: 205, + Name: "test_proto.default_uint32", + Tag: "varint,205,opt,name=default_uint32,json=defaultUint32,def=44", + Filename: "test_proto/test.proto", +} + +var E_DefaultUint64 = &proto.ExtensionDesc{ + ExtendedType: (*DefaultsMessage)(nil), + ExtensionType: (*uint64)(nil), + Field: 206, + Name: "test_proto.default_uint64", + Tag: "varint,206,opt,name=default_uint64,json=defaultUint64,def=45", + Filename: "test_proto/test.proto", +} + +var E_DefaultSint32 = &proto.ExtensionDesc{ + ExtendedType: (*DefaultsMessage)(nil), + ExtensionType: (*int32)(nil), + Field: 207, + Name: "test_proto.default_sint32", + Tag: "zigzag32,207,opt,name=default_sint32,json=defaultSint32,def=46", + Filename: "test_proto/test.proto", +} + +var E_DefaultSint64 = &proto.ExtensionDesc{ + ExtendedType: (*DefaultsMessage)(nil), + ExtensionType: (*int64)(nil), + Field: 208, + Name: "test_proto.default_sint64", + Tag: "zigzag64,208,opt,name=default_sint64,json=defaultSint64,def=47", + Filename: "test_proto/test.proto", +} + +var E_DefaultFixed32 = &proto.ExtensionDesc{ + ExtendedType: (*DefaultsMessage)(nil), + ExtensionType: (*uint32)(nil), + Field: 209, + Name: "test_proto.default_fixed32", + Tag: "fixed32,209,opt,name=default_fixed32,json=defaultFixed32,def=48", + Filename: "test_proto/test.proto", +} + +var E_DefaultFixed64 = &proto.ExtensionDesc{ + ExtendedType: (*DefaultsMessage)(nil), + ExtensionType: (*uint64)(nil), + Field: 210, + Name: "test_proto.default_fixed64", + Tag: "fixed64,210,opt,name=default_fixed64,json=defaultFixed64,def=49", + Filename: "test_proto/test.proto", +} + +var E_DefaultSfixed32 = &proto.ExtensionDesc{ + ExtendedType: (*DefaultsMessage)(nil), + ExtensionType: (*int32)(nil), + Field: 211, + Name: "test_proto.default_sfixed32", + Tag: "fixed32,211,opt,name=default_sfixed32,json=defaultSfixed32,def=50", + Filename: "test_proto/test.proto", +} + +var E_DefaultSfixed64 = &proto.ExtensionDesc{ + ExtendedType: (*DefaultsMessage)(nil), + ExtensionType: (*int64)(nil), + Field: 212, + Name: "test_proto.default_sfixed64", + Tag: "fixed64,212,opt,name=default_sfixed64,json=defaultSfixed64,def=51", + Filename: "test_proto/test.proto", +} + +var E_DefaultBool = &proto.ExtensionDesc{ + ExtendedType: (*DefaultsMessage)(nil), + ExtensionType: (*bool)(nil), + Field: 213, + Name: "test_proto.default_bool", + Tag: "varint,213,opt,name=default_bool,json=defaultBool,def=1", + Filename: "test_proto/test.proto", +} + +var E_DefaultString = &proto.ExtensionDesc{ + ExtendedType: (*DefaultsMessage)(nil), + ExtensionType: (*string)(nil), + Field: 214, + Name: "test_proto.default_string", + Tag: "bytes,214,opt,name=default_string,json=defaultString,def=Hello, string,def=foo", + Filename: "test_proto/test.proto", +} + +var E_DefaultBytes = &proto.ExtensionDesc{ + ExtendedType: (*DefaultsMessage)(nil), + ExtensionType: ([]byte)(nil), + Field: 215, + Name: "test_proto.default_bytes", + Tag: "bytes,215,opt,name=default_bytes,json=defaultBytes,def=Hello, bytes", + Filename: "test_proto/test.proto", +} + +var E_DefaultEnum = &proto.ExtensionDesc{ + ExtendedType: (*DefaultsMessage)(nil), + ExtensionType: (*DefaultsMessage_DefaultsEnum)(nil), + Field: 216, + Name: "test_proto.default_enum", + Tag: "varint,216,opt,name=default_enum,json=defaultEnum,enum=test_proto.DefaultsMessage_DefaultsEnum,def=1", + Filename: "test_proto/test.proto", +} + +var E_X201 = &proto.ExtensionDesc{ + ExtendedType: (*MyMessageSet)(nil), + ExtensionType: (*Empty)(nil), + Field: 201, + Name: "test_proto.x201", + Tag: "bytes,201,opt,name=x201", + Filename: "test_proto/test.proto", +} + +var E_X202 = &proto.ExtensionDesc{ + ExtendedType: (*MyMessageSet)(nil), + ExtensionType: (*Empty)(nil), + Field: 202, + Name: "test_proto.x202", + Tag: "bytes,202,opt,name=x202", + Filename: "test_proto/test.proto", +} + +var E_X203 = &proto.ExtensionDesc{ + ExtendedType: (*MyMessageSet)(nil), + ExtensionType: (*Empty)(nil), + Field: 203, + Name: "test_proto.x203", + Tag: "bytes,203,opt,name=x203", + Filename: "test_proto/test.proto", +} + +var E_X204 = &proto.ExtensionDesc{ + ExtendedType: (*MyMessageSet)(nil), + ExtensionType: (*Empty)(nil), + Field: 204, + Name: "test_proto.x204", + Tag: "bytes,204,opt,name=x204", + Filename: "test_proto/test.proto", +} + +var E_X205 = &proto.ExtensionDesc{ + ExtendedType: (*MyMessageSet)(nil), + ExtensionType: (*Empty)(nil), + Field: 205, + Name: "test_proto.x205", + Tag: "bytes,205,opt,name=x205", + Filename: "test_proto/test.proto", +} + +var E_X206 = &proto.ExtensionDesc{ + ExtendedType: (*MyMessageSet)(nil), + ExtensionType: (*Empty)(nil), + Field: 206, + Name: "test_proto.x206", + Tag: "bytes,206,opt,name=x206", + Filename: "test_proto/test.proto", +} + +var E_X207 = &proto.ExtensionDesc{ + ExtendedType: (*MyMessageSet)(nil), + ExtensionType: (*Empty)(nil), + Field: 207, + Name: "test_proto.x207", + Tag: "bytes,207,opt,name=x207", + Filename: "test_proto/test.proto", +} + +var E_X208 = &proto.ExtensionDesc{ + ExtendedType: (*MyMessageSet)(nil), + ExtensionType: (*Empty)(nil), + Field: 208, + Name: "test_proto.x208", + Tag: "bytes,208,opt,name=x208", + Filename: "test_proto/test.proto", +} + +var E_X209 = &proto.ExtensionDesc{ + ExtendedType: (*MyMessageSet)(nil), + ExtensionType: (*Empty)(nil), + Field: 209, + Name: "test_proto.x209", + Tag: "bytes,209,opt,name=x209", + Filename: "test_proto/test.proto", +} + +var E_X210 = &proto.ExtensionDesc{ + ExtendedType: (*MyMessageSet)(nil), + ExtensionType: (*Empty)(nil), + Field: 210, + Name: "test_proto.x210", + Tag: "bytes,210,opt,name=x210", + Filename: "test_proto/test.proto", +} + +var E_X211 = &proto.ExtensionDesc{ + ExtendedType: (*MyMessageSet)(nil), + ExtensionType: (*Empty)(nil), + Field: 211, + Name: "test_proto.x211", + Tag: "bytes,211,opt,name=x211", + Filename: "test_proto/test.proto", +} + +var E_X212 = &proto.ExtensionDesc{ + ExtendedType: (*MyMessageSet)(nil), + ExtensionType: (*Empty)(nil), + Field: 212, + Name: "test_proto.x212", + Tag: "bytes,212,opt,name=x212", + Filename: "test_proto/test.proto", +} + +var E_X213 = &proto.ExtensionDesc{ + ExtendedType: (*MyMessageSet)(nil), + ExtensionType: (*Empty)(nil), + Field: 213, + Name: "test_proto.x213", + Tag: "bytes,213,opt,name=x213", + Filename: "test_proto/test.proto", +} + +var E_X214 = &proto.ExtensionDesc{ + ExtendedType: (*MyMessageSet)(nil), + ExtensionType: (*Empty)(nil), + Field: 214, + Name: "test_proto.x214", + Tag: "bytes,214,opt,name=x214", + Filename: "test_proto/test.proto", +} + +var E_X215 = &proto.ExtensionDesc{ + ExtendedType: (*MyMessageSet)(nil), + ExtensionType: (*Empty)(nil), + Field: 215, + Name: "test_proto.x215", + Tag: "bytes,215,opt,name=x215", + Filename: "test_proto/test.proto", +} + +var E_X216 = &proto.ExtensionDesc{ + ExtendedType: (*MyMessageSet)(nil), + ExtensionType: (*Empty)(nil), + Field: 216, + Name: "test_proto.x216", + Tag: "bytes,216,opt,name=x216", + Filename: "test_proto/test.proto", +} + +var E_X217 = &proto.ExtensionDesc{ + ExtendedType: (*MyMessageSet)(nil), + ExtensionType: (*Empty)(nil), + Field: 217, + Name: "test_proto.x217", + Tag: "bytes,217,opt,name=x217", + Filename: "test_proto/test.proto", +} + +var E_X218 = &proto.ExtensionDesc{ + ExtendedType: (*MyMessageSet)(nil), + ExtensionType: (*Empty)(nil), + Field: 218, + Name: "test_proto.x218", + Tag: "bytes,218,opt,name=x218", + Filename: "test_proto/test.proto", +} + +var E_X219 = &proto.ExtensionDesc{ + ExtendedType: (*MyMessageSet)(nil), + ExtensionType: (*Empty)(nil), + Field: 219, + Name: "test_proto.x219", + Tag: "bytes,219,opt,name=x219", + Filename: "test_proto/test.proto", +} + +var E_X220 = &proto.ExtensionDesc{ + ExtendedType: (*MyMessageSet)(nil), + ExtensionType: (*Empty)(nil), + Field: 220, + Name: "test_proto.x220", + Tag: "bytes,220,opt,name=x220", + Filename: "test_proto/test.proto", +} + +var E_X221 = &proto.ExtensionDesc{ + ExtendedType: (*MyMessageSet)(nil), + ExtensionType: (*Empty)(nil), + Field: 221, + Name: "test_proto.x221", + Tag: "bytes,221,opt,name=x221", + Filename: "test_proto/test.proto", +} + +var E_X222 = &proto.ExtensionDesc{ + ExtendedType: (*MyMessageSet)(nil), + ExtensionType: (*Empty)(nil), + Field: 222, + Name: "test_proto.x222", + Tag: "bytes,222,opt,name=x222", + Filename: "test_proto/test.proto", +} + +var E_X223 = &proto.ExtensionDesc{ + ExtendedType: (*MyMessageSet)(nil), + ExtensionType: (*Empty)(nil), + Field: 223, + Name: "test_proto.x223", + Tag: "bytes,223,opt,name=x223", + Filename: "test_proto/test.proto", +} + +var E_X224 = &proto.ExtensionDesc{ + ExtendedType: (*MyMessageSet)(nil), + ExtensionType: (*Empty)(nil), + Field: 224, + Name: "test_proto.x224", + Tag: "bytes,224,opt,name=x224", + Filename: "test_proto/test.proto", +} + +var E_X225 = &proto.ExtensionDesc{ + ExtendedType: (*MyMessageSet)(nil), + ExtensionType: (*Empty)(nil), + Field: 225, + Name: "test_proto.x225", + Tag: "bytes,225,opt,name=x225", + Filename: "test_proto/test.proto", +} + +var E_X226 = &proto.ExtensionDesc{ + ExtendedType: (*MyMessageSet)(nil), + ExtensionType: (*Empty)(nil), + Field: 226, + Name: "test_proto.x226", + Tag: "bytes,226,opt,name=x226", + Filename: "test_proto/test.proto", +} + +var E_X227 = &proto.ExtensionDesc{ + ExtendedType: (*MyMessageSet)(nil), + ExtensionType: (*Empty)(nil), + Field: 227, + Name: "test_proto.x227", + Tag: "bytes,227,opt,name=x227", + Filename: "test_proto/test.proto", +} + +var E_X228 = &proto.ExtensionDesc{ + ExtendedType: (*MyMessageSet)(nil), + ExtensionType: (*Empty)(nil), + Field: 228, + Name: "test_proto.x228", + Tag: "bytes,228,opt,name=x228", + Filename: "test_proto/test.proto", +} + +var E_X229 = &proto.ExtensionDesc{ + ExtendedType: (*MyMessageSet)(nil), + ExtensionType: (*Empty)(nil), + Field: 229, + Name: "test_proto.x229", + Tag: "bytes,229,opt,name=x229", + Filename: "test_proto/test.proto", +} + +var E_X230 = &proto.ExtensionDesc{ + ExtendedType: (*MyMessageSet)(nil), + ExtensionType: (*Empty)(nil), + Field: 230, + Name: "test_proto.x230", + Tag: "bytes,230,opt,name=x230", + Filename: "test_proto/test.proto", +} + +var E_X231 = &proto.ExtensionDesc{ + ExtendedType: (*MyMessageSet)(nil), + ExtensionType: (*Empty)(nil), + Field: 231, + Name: "test_proto.x231", + Tag: "bytes,231,opt,name=x231", + Filename: "test_proto/test.proto", +} + +var E_X232 = &proto.ExtensionDesc{ + ExtendedType: (*MyMessageSet)(nil), + ExtensionType: (*Empty)(nil), + Field: 232, + Name: "test_proto.x232", + Tag: "bytes,232,opt,name=x232", + Filename: "test_proto/test.proto", +} + +var E_X233 = &proto.ExtensionDesc{ + ExtendedType: (*MyMessageSet)(nil), + ExtensionType: (*Empty)(nil), + Field: 233, + Name: "test_proto.x233", + Tag: "bytes,233,opt,name=x233", + Filename: "test_proto/test.proto", +} + +var E_X234 = &proto.ExtensionDesc{ + ExtendedType: (*MyMessageSet)(nil), + ExtensionType: (*Empty)(nil), + Field: 234, + Name: "test_proto.x234", + Tag: "bytes,234,opt,name=x234", + Filename: "test_proto/test.proto", +} + +var E_X235 = &proto.ExtensionDesc{ + ExtendedType: (*MyMessageSet)(nil), + ExtensionType: (*Empty)(nil), + Field: 235, + Name: "test_proto.x235", + Tag: "bytes,235,opt,name=x235", + Filename: "test_proto/test.proto", +} + +var E_X236 = &proto.ExtensionDesc{ + ExtendedType: (*MyMessageSet)(nil), + ExtensionType: (*Empty)(nil), + Field: 236, + Name: "test_proto.x236", + Tag: "bytes,236,opt,name=x236", + Filename: "test_proto/test.proto", +} + +var E_X237 = &proto.ExtensionDesc{ + ExtendedType: (*MyMessageSet)(nil), + ExtensionType: (*Empty)(nil), + Field: 237, + Name: "test_proto.x237", + Tag: "bytes,237,opt,name=x237", + Filename: "test_proto/test.proto", +} + +var E_X238 = &proto.ExtensionDesc{ + ExtendedType: (*MyMessageSet)(nil), + ExtensionType: (*Empty)(nil), + Field: 238, + Name: "test_proto.x238", + Tag: "bytes,238,opt,name=x238", + Filename: "test_proto/test.proto", +} + +var E_X239 = &proto.ExtensionDesc{ + ExtendedType: (*MyMessageSet)(nil), + ExtensionType: (*Empty)(nil), + Field: 239, + Name: "test_proto.x239", + Tag: "bytes,239,opt,name=x239", + Filename: "test_proto/test.proto", +} + +var E_X240 = &proto.ExtensionDesc{ + ExtendedType: (*MyMessageSet)(nil), + ExtensionType: (*Empty)(nil), + Field: 240, + Name: "test_proto.x240", + Tag: "bytes,240,opt,name=x240", + Filename: "test_proto/test.proto", +} + +var E_X241 = &proto.ExtensionDesc{ + ExtendedType: (*MyMessageSet)(nil), + ExtensionType: (*Empty)(nil), + Field: 241, + Name: "test_proto.x241", + Tag: "bytes,241,opt,name=x241", + Filename: "test_proto/test.proto", +} + +var E_X242 = &proto.ExtensionDesc{ + ExtendedType: (*MyMessageSet)(nil), + ExtensionType: (*Empty)(nil), + Field: 242, + Name: "test_proto.x242", + Tag: "bytes,242,opt,name=x242", + Filename: "test_proto/test.proto", +} + +var E_X243 = &proto.ExtensionDesc{ + ExtendedType: (*MyMessageSet)(nil), + ExtensionType: (*Empty)(nil), + Field: 243, + Name: "test_proto.x243", + Tag: "bytes,243,opt,name=x243", + Filename: "test_proto/test.proto", +} + +var E_X244 = &proto.ExtensionDesc{ + ExtendedType: (*MyMessageSet)(nil), + ExtensionType: (*Empty)(nil), + Field: 244, + Name: "test_proto.x244", + Tag: "bytes,244,opt,name=x244", + Filename: "test_proto/test.proto", +} + +var E_X245 = &proto.ExtensionDesc{ + ExtendedType: (*MyMessageSet)(nil), + ExtensionType: (*Empty)(nil), + Field: 245, + Name: "test_proto.x245", + Tag: "bytes,245,opt,name=x245", + Filename: "test_proto/test.proto", +} + +var E_X246 = &proto.ExtensionDesc{ + ExtendedType: (*MyMessageSet)(nil), + ExtensionType: (*Empty)(nil), + Field: 246, + Name: "test_proto.x246", + Tag: "bytes,246,opt,name=x246", + Filename: "test_proto/test.proto", +} + +var E_X247 = &proto.ExtensionDesc{ + ExtendedType: (*MyMessageSet)(nil), + ExtensionType: (*Empty)(nil), + Field: 247, + Name: "test_proto.x247", + Tag: "bytes,247,opt,name=x247", + Filename: "test_proto/test.proto", +} + +var E_X248 = &proto.ExtensionDesc{ + ExtendedType: (*MyMessageSet)(nil), + ExtensionType: (*Empty)(nil), + Field: 248, + Name: "test_proto.x248", + Tag: "bytes,248,opt,name=x248", + Filename: "test_proto/test.proto", +} + +var E_X249 = &proto.ExtensionDesc{ + ExtendedType: (*MyMessageSet)(nil), + ExtensionType: (*Empty)(nil), + Field: 249, + Name: "test_proto.x249", + Tag: "bytes,249,opt,name=x249", + Filename: "test_proto/test.proto", +} + +var E_X250 = &proto.ExtensionDesc{ + ExtendedType: (*MyMessageSet)(nil), + ExtensionType: (*Empty)(nil), + Field: 250, + Name: "test_proto.x250", + Tag: "bytes,250,opt,name=x250", + Filename: "test_proto/test.proto", +} + +func init() { + proto.RegisterType((*GoEnum)(nil), "test_proto.GoEnum") + proto.RegisterType((*GoTestField)(nil), "test_proto.GoTestField") + proto.RegisterType((*GoTest)(nil), "test_proto.GoTest") + proto.RegisterType((*GoTest_RequiredGroup)(nil), "test_proto.GoTest.RequiredGroup") + proto.RegisterType((*GoTest_RepeatedGroup)(nil), "test_proto.GoTest.RepeatedGroup") + proto.RegisterType((*GoTest_OptionalGroup)(nil), "test_proto.GoTest.OptionalGroup") + proto.RegisterType((*GoTestRequiredGroupField)(nil), "test_proto.GoTestRequiredGroupField") + proto.RegisterType((*GoTestRequiredGroupField_Group)(nil), "test_proto.GoTestRequiredGroupField.Group") + proto.RegisterType((*GoSkipTest)(nil), "test_proto.GoSkipTest") + proto.RegisterType((*GoSkipTest_SkipGroup)(nil), "test_proto.GoSkipTest.SkipGroup") + proto.RegisterType((*NonPackedTest)(nil), "test_proto.NonPackedTest") + proto.RegisterType((*PackedTest)(nil), "test_proto.PackedTest") + proto.RegisterType((*MaxTag)(nil), "test_proto.MaxTag") + proto.RegisterType((*OldMessage)(nil), "test_proto.OldMessage") + proto.RegisterType((*OldMessage_Nested)(nil), "test_proto.OldMessage.Nested") + proto.RegisterType((*NewMessage)(nil), "test_proto.NewMessage") + proto.RegisterType((*NewMessage_Nested)(nil), "test_proto.NewMessage.Nested") + proto.RegisterType((*InnerMessage)(nil), "test_proto.InnerMessage") + proto.RegisterType((*OtherMessage)(nil), "test_proto.OtherMessage") + proto.RegisterType((*RequiredInnerMessage)(nil), "test_proto.RequiredInnerMessage") + proto.RegisterType((*MyMessage)(nil), "test_proto.MyMessage") + proto.RegisterType((*MyMessage_SomeGroup)(nil), "test_proto.MyMessage.SomeGroup") + proto.RegisterType((*Ext)(nil), "test_proto.Ext") + proto.RegisterMapType((map[int32]int32)(nil), "test_proto.Ext.MapFieldEntry") + proto.RegisterType((*ComplexExtension)(nil), "test_proto.ComplexExtension") + proto.RegisterType((*DefaultsMessage)(nil), "test_proto.DefaultsMessage") + proto.RegisterType((*MyMessageSet)(nil), "test_proto.MyMessageSet") + proto.RegisterType((*Empty)(nil), "test_proto.Empty") + proto.RegisterType((*MessageList)(nil), "test_proto.MessageList") + proto.RegisterType((*MessageList_Message)(nil), "test_proto.MessageList.Message") + proto.RegisterType((*Strings)(nil), "test_proto.Strings") + proto.RegisterType((*Defaults)(nil), "test_proto.Defaults") + proto.RegisterType((*SubDefaults)(nil), "test_proto.SubDefaults") + proto.RegisterType((*RepeatedEnum)(nil), "test_proto.RepeatedEnum") + proto.RegisterType((*MoreRepeated)(nil), "test_proto.MoreRepeated") + proto.RegisterType((*GroupOld)(nil), "test_proto.GroupOld") + proto.RegisterType((*GroupOld_G)(nil), "test_proto.GroupOld.G") + proto.RegisterType((*GroupNew)(nil), "test_proto.GroupNew") + proto.RegisterType((*GroupNew_G)(nil), "test_proto.GroupNew.G") + proto.RegisterType((*FloatingPoint)(nil), "test_proto.FloatingPoint") + proto.RegisterType((*MessageWithMap)(nil), "test_proto.MessageWithMap") + proto.RegisterMapType((map[bool][]byte)(nil), "test_proto.MessageWithMap.ByteMappingEntry") + proto.RegisterMapType((map[int64]*FloatingPoint)(nil), "test_proto.MessageWithMap.MsgMappingEntry") + proto.RegisterMapType((map[int32]string)(nil), "test_proto.MessageWithMap.NameMappingEntry") + proto.RegisterMapType((map[string]string)(nil), "test_proto.MessageWithMap.StrToStrEntry") + proto.RegisterType((*Oneof)(nil), "test_proto.Oneof") + proto.RegisterType((*Oneof_F_Group)(nil), "test_proto.Oneof.F_Group") + proto.RegisterType((*Communique)(nil), "test_proto.Communique") + proto.RegisterEnum("test_proto.FOO", FOO_name, FOO_value) + proto.RegisterEnum("test_proto.GoTest_KIND", GoTest_KIND_name, GoTest_KIND_value) + proto.RegisterEnum("test_proto.MyMessage_Color", MyMessage_Color_name, MyMessage_Color_value) + proto.RegisterEnum("test_proto.DefaultsMessage_DefaultsEnum", DefaultsMessage_DefaultsEnum_name, DefaultsMessage_DefaultsEnum_value) + proto.RegisterEnum("test_proto.Defaults_Color", Defaults_Color_name, Defaults_Color_value) + proto.RegisterEnum("test_proto.RepeatedEnum_Color", RepeatedEnum_Color_name, RepeatedEnum_Color_value) + proto.RegisterExtension(E_Ext_More) + proto.RegisterExtension(E_Ext_Text) + proto.RegisterExtension(E_Ext_Number) + proto.RegisterExtension(E_Greeting) + proto.RegisterExtension(E_Complex) + proto.RegisterExtension(E_RComplex) + proto.RegisterExtension(E_NoDefaultDouble) + proto.RegisterExtension(E_NoDefaultFloat) + proto.RegisterExtension(E_NoDefaultInt32) + proto.RegisterExtension(E_NoDefaultInt64) + proto.RegisterExtension(E_NoDefaultUint32) + proto.RegisterExtension(E_NoDefaultUint64) + proto.RegisterExtension(E_NoDefaultSint32) + proto.RegisterExtension(E_NoDefaultSint64) + proto.RegisterExtension(E_NoDefaultFixed32) + proto.RegisterExtension(E_NoDefaultFixed64) + proto.RegisterExtension(E_NoDefaultSfixed32) + proto.RegisterExtension(E_NoDefaultSfixed64) + proto.RegisterExtension(E_NoDefaultBool) + proto.RegisterExtension(E_NoDefaultString) + proto.RegisterExtension(E_NoDefaultBytes) + proto.RegisterExtension(E_NoDefaultEnum) + proto.RegisterExtension(E_DefaultDouble) + proto.RegisterExtension(E_DefaultFloat) + proto.RegisterExtension(E_DefaultInt32) + proto.RegisterExtension(E_DefaultInt64) + proto.RegisterExtension(E_DefaultUint32) + proto.RegisterExtension(E_DefaultUint64) + proto.RegisterExtension(E_DefaultSint32) + proto.RegisterExtension(E_DefaultSint64) + proto.RegisterExtension(E_DefaultFixed32) + proto.RegisterExtension(E_DefaultFixed64) + proto.RegisterExtension(E_DefaultSfixed32) + proto.RegisterExtension(E_DefaultSfixed64) + proto.RegisterExtension(E_DefaultBool) + proto.RegisterExtension(E_DefaultString) + proto.RegisterExtension(E_DefaultBytes) + proto.RegisterExtension(E_DefaultEnum) + proto.RegisterExtension(E_X201) + proto.RegisterExtension(E_X202) + proto.RegisterExtension(E_X203) + proto.RegisterExtension(E_X204) + proto.RegisterExtension(E_X205) + proto.RegisterExtension(E_X206) + proto.RegisterExtension(E_X207) + proto.RegisterExtension(E_X208) + proto.RegisterExtension(E_X209) + proto.RegisterExtension(E_X210) + proto.RegisterExtension(E_X211) + proto.RegisterExtension(E_X212) + proto.RegisterExtension(E_X213) + proto.RegisterExtension(E_X214) + proto.RegisterExtension(E_X215) + proto.RegisterExtension(E_X216) + proto.RegisterExtension(E_X217) + proto.RegisterExtension(E_X218) + proto.RegisterExtension(E_X219) + proto.RegisterExtension(E_X220) + proto.RegisterExtension(E_X221) + proto.RegisterExtension(E_X222) + proto.RegisterExtension(E_X223) + proto.RegisterExtension(E_X224) + proto.RegisterExtension(E_X225) + proto.RegisterExtension(E_X226) + proto.RegisterExtension(E_X227) + proto.RegisterExtension(E_X228) + proto.RegisterExtension(E_X229) + proto.RegisterExtension(E_X230) + proto.RegisterExtension(E_X231) + proto.RegisterExtension(E_X232) + proto.RegisterExtension(E_X233) + proto.RegisterExtension(E_X234) + proto.RegisterExtension(E_X235) + proto.RegisterExtension(E_X236) + proto.RegisterExtension(E_X237) + proto.RegisterExtension(E_X238) + proto.RegisterExtension(E_X239) + proto.RegisterExtension(E_X240) + proto.RegisterExtension(E_X241) + proto.RegisterExtension(E_X242) + proto.RegisterExtension(E_X243) + proto.RegisterExtension(E_X244) + proto.RegisterExtension(E_X245) + proto.RegisterExtension(E_X246) + proto.RegisterExtension(E_X247) + proto.RegisterExtension(E_X248) + proto.RegisterExtension(E_X249) + proto.RegisterExtension(E_X250) +} + +func init() { proto.RegisterFile("test_proto/test.proto", fileDescriptor_test_74787bfc6550f8a7) } + +var fileDescriptor_test_74787bfc6550f8a7 = []byte{ + // 4680 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x5b, 0xd9, 0x73, 0x1b, 0x47, + 0x7a, 0xd7, 0x0c, 0xee, 0x0f, 0x20, 0x31, 0x6c, 0xd1, 0x12, 0x44, 0x59, 0xd2, 0x08, 0x6b, 0xaf, + 0x61, 0xc9, 0xa2, 0x48, 0x60, 0x08, 0x49, 0x70, 0xec, 0xb2, 0x0e, 0x82, 0x62, 0x49, 0x24, 0xe4, + 0x21, 0x6d, 0x67, 0x95, 0x07, 0x14, 0x48, 0x0c, 0x40, 0xac, 0x80, 0x19, 0x18, 0x18, 0x44, 0x64, + 0x52, 0xa9, 0xf2, 0x63, 0xaa, 0xf2, 0x94, 0x4d, 0x52, 0x95, 0xf7, 0xbc, 0xe4, 0x25, 0xd7, 0x43, + 0xf2, 0x37, 0xc4, 0xd7, 0x5e, 0xde, 0x2b, 0xc9, 0x26, 0x9b, 0xfb, 0xce, 0xe6, 0xde, 0x23, 0x2f, + 0x4e, 0xf5, 0xd7, 0x3d, 0x33, 0x3d, 0x03, 0xa8, 0x45, 0x3e, 0x71, 0xa6, 0xfb, 0xf7, 0xfd, 0xfa, + 0xfa, 0xf5, 0xf7, 0xf5, 0xd7, 0x18, 0xc2, 0x0b, 0xae, 0x35, 0x76, 0x9b, 0xc3, 0x91, 0xe3, 0x3a, + 0xd7, 0xe9, 0xe3, 0x32, 0x3e, 0x12, 0x08, 0x8a, 0x8b, 0x57, 0x21, 0xb9, 0xe1, 0xac, 0xdb, 0x93, + 0x01, 0xb9, 0x0c, 0xb1, 0x8e, 0xe3, 0x14, 0x14, 0x5d, 0x2d, 0xcd, 0x97, 0xf3, 0xcb, 0x01, 0x66, + 0xb9, 0xde, 0x68, 0x98, 0xb4, 0xae, 0x78, 0x03, 0xb2, 0x1b, 0xce, 0xae, 0x35, 0x76, 0xeb, 0x3d, + 0xab, 0xdf, 0x26, 0x8b, 0x90, 0x78, 0xd8, 0xda, 0xb3, 0xfa, 0x68, 0x93, 0x31, 0xd9, 0x0b, 0x21, + 0x10, 0xdf, 0x3d, 0x1a, 0x5a, 0x05, 0x15, 0x0b, 0xf1, 0xb9, 0xf8, 0x87, 0x45, 0xda, 0x0c, 0xb5, + 0x24, 0x57, 0x21, 0xfe, 0xa0, 0x67, 0xb7, 0x79, 0x3b, 0x67, 0xc5, 0x76, 0x18, 0x62, 0xf9, 0xc1, + 0xe6, 0xf6, 0x3d, 0x13, 0x41, 0xb4, 0x85, 0xdd, 0xd6, 0x5e, 0x9f, 0x92, 0x29, 0xb4, 0x05, 0x7c, + 0xa1, 0xa5, 0x8f, 0x5a, 0xa3, 0xd6, 0xa0, 0x10, 0xd3, 0x95, 0x52, 0xc2, 0x64, 0x2f, 0xe4, 0x0d, + 0x98, 0x33, 0xad, 0xf7, 0x27, 0xbd, 0x91, 0xd5, 0xc6, 0xee, 0x15, 0xe2, 0xba, 0x5a, 0xca, 0xce, + 0x6a, 0x01, 0xab, 0xcd, 0x30, 0x9a, 0x99, 0x0f, 0xad, 0x96, 0xeb, 0x99, 0x27, 0xf4, 0xd8, 0x73, + 0xcc, 0x05, 0x34, 0x35, 0x6f, 0x0c, 0xdd, 0x9e, 0x63, 0xb7, 0xfa, 0xcc, 0x3c, 0xa9, 0x2b, 0x52, + 0xf3, 0x10, 0x9a, 0x7c, 0x11, 0xf2, 0xf5, 0xe6, 0x1d, 0xc7, 0xe9, 0x37, 0x47, 0xbc, 0x57, 0x05, + 0xd0, 0xd5, 0x52, 0xda, 0x9c, 0xab, 0xd3, 0x52, 0xaf, 0xab, 0xa4, 0x04, 0x5a, 0xbd, 0xb9, 0x69, + 0xbb, 0x95, 0x72, 0x00, 0xcc, 0xea, 0x6a, 0x29, 0x61, 0xce, 0xd7, 0xb1, 0x78, 0x0a, 0x59, 0x35, + 0x02, 0x64, 0x4e, 0x57, 0x4b, 0x31, 0x86, 0xac, 0x1a, 0x3e, 0xf2, 0x35, 0x20, 0xf5, 0x66, 0xbd, + 0x77, 0x68, 0xb5, 0x45, 0xd6, 0x39, 0x5d, 0x2d, 0xa5, 0x4c, 0xad, 0xce, 0x2b, 0x66, 0xa0, 0x45, + 0xe6, 0x79, 0x5d, 0x2d, 0x25, 0x3d, 0xb4, 0xc0, 0x7d, 0x05, 0x16, 0xea, 0xcd, 0x77, 0x7a, 0xe1, + 0x0e, 0xe7, 0x75, 0xb5, 0x34, 0x67, 0xe6, 0xeb, 0xac, 0x7c, 0x1a, 0x2b, 0x12, 0x6b, 0xba, 0x5a, + 0x8a, 0x73, 0xac, 0xc0, 0x8b, 0xa3, 0xab, 0xf7, 0x9d, 0x96, 0x1b, 0x40, 0x17, 0x74, 0xb5, 0xa4, + 0x9a, 0xf3, 0x75, 0x2c, 0x0e, 0xb3, 0xde, 0x73, 0x26, 0x7b, 0x7d, 0x2b, 0x80, 0x12, 0x5d, 0x2d, + 0x29, 0x66, 0xbe, 0xce, 0xca, 0xc3, 0xd8, 0x1d, 0x77, 0xd4, 0xb3, 0xbb, 0x01, 0xf6, 0x34, 0xea, + 0x38, 0x5f, 0x67, 0xe5, 0xe1, 0x1e, 0xdc, 0x39, 0x72, 0xad, 0x71, 0x00, 0xb5, 0x74, 0xb5, 0x94, + 0x33, 0xe7, 0xeb, 0x58, 0x1c, 0x61, 0x8d, 0xcc, 0x41, 0x47, 0x57, 0x4b, 0x0b, 0x94, 0x75, 0xc6, + 0x1c, 0xec, 0x44, 0xe6, 0xa0, 0xab, 0xab, 0x25, 0xc2, 0xb1, 0xc2, 0x1c, 0x2c, 0xc3, 0xe9, 0x7a, + 0x73, 0xa7, 0x13, 0x5d, 0xb8, 0x03, 0x5d, 0x2d, 0xe5, 0xcd, 0x85, 0xba, 0x57, 0x33, 0x0b, 0x2f, + 0xb2, 0xf7, 0x74, 0xb5, 0xa4, 0xf9, 0x78, 0x81, 0x5f, 0xd4, 0x24, 0x93, 0x7a, 0x61, 0x51, 0x8f, + 0x09, 0x9a, 0x64, 0x85, 0x61, 0x4d, 0x72, 0xe0, 0x0b, 0x7a, 0x4c, 0xd4, 0x64, 0x04, 0x89, 0xcd, + 0x73, 0xe4, 0x19, 0x3d, 0x26, 0x6a, 0x92, 0x23, 0x23, 0x9a, 0xe4, 0xd8, 0xb3, 0x7a, 0x2c, 0xac, + 0xc9, 0x29, 0xb4, 0xc8, 0x5c, 0xd0, 0x63, 0x61, 0x4d, 0x72, 0x74, 0x58, 0x93, 0x1c, 0x7c, 0x4e, + 0x8f, 0x85, 0x34, 0x19, 0xc5, 0x8a, 0xc4, 0x4b, 0x7a, 0x2c, 0xa4, 0x49, 0x71, 0x74, 0x9e, 0x26, + 0x39, 0xf4, 0xbc, 0x1e, 0x13, 0x35, 0x29, 0xb2, 0xfa, 0x9a, 0xe4, 0xd0, 0x17, 0xf5, 0x58, 0x48, + 0x93, 0x22, 0xd6, 0xd7, 0x24, 0xc7, 0x5e, 0xd0, 0x63, 0x21, 0x4d, 0x72, 0xec, 0xab, 0xa2, 0x26, + 0x39, 0xf4, 0x43, 0x45, 0x8f, 0x89, 0xa2, 0xe4, 0xd0, 0xab, 0x21, 0x51, 0x72, 0xec, 0x47, 0x14, + 0x2b, 0xaa, 0x32, 0x0a, 0x16, 0x67, 0xe1, 0x63, 0x0a, 0x16, 0x65, 0xc9, 0xc1, 0xd7, 0x23, 0xb2, + 0xe4, 0xf0, 0x4f, 0x28, 0x3c, 0xac, 0xcb, 0x69, 0x03, 0x91, 0xff, 0x53, 0x6a, 0x10, 0x16, 0x26, + 0x37, 0x08, 0x84, 0xe9, 0x70, 0x27, 0x5a, 0xb8, 0xa8, 0x2b, 0xbe, 0x30, 0x3d, 0xcf, 0x2a, 0x0a, + 0xd3, 0x07, 0x5e, 0xc2, 0x90, 0xc1, 0x85, 0x39, 0x85, 0xac, 0x1a, 0x01, 0x52, 0xd7, 0x95, 0x40, + 0x98, 0x3e, 0x32, 0x24, 0x4c, 0x1f, 0x7b, 0x59, 0x57, 0x44, 0x61, 0xce, 0x40, 0x8b, 0xcc, 0x45, + 0x5d, 0x11, 0x85, 0xe9, 0xa3, 0x45, 0x61, 0xfa, 0xe0, 0x2f, 0xe8, 0x8a, 0x20, 0xcc, 0x69, 0xac, + 0x48, 0xfc, 0x92, 0xae, 0x08, 0xc2, 0x0c, 0x8f, 0x8e, 0x09, 0xd3, 0x87, 0xbe, 0xac, 0x2b, 0x81, + 0x30, 0xc3, 0xac, 0x5c, 0x98, 0x3e, 0xf4, 0x8b, 0xba, 0x22, 0x08, 0x33, 0x8c, 0xe5, 0xc2, 0xf4, + 0xb1, 0xaf, 0x60, 0x9c, 0xf6, 0x84, 0xe9, 0x63, 0x05, 0x61, 0xfa, 0xd0, 0xdf, 0xa1, 0x31, 0xdd, + 0x17, 0xa6, 0x0f, 0x15, 0x85, 0xe9, 0x63, 0x7f, 0x97, 0x62, 0x03, 0x61, 0x4e, 0x83, 0xc5, 0x59, + 0xf8, 0x3d, 0x0a, 0x0e, 0x84, 0xe9, 0x83, 0xc3, 0xc2, 0xf4, 0xe1, 0xbf, 0x4f, 0xe1, 0xa2, 0x30, + 0x67, 0x19, 0x88, 0xfc, 0x7f, 0x40, 0x0d, 0x44, 0x61, 0xfa, 0x06, 0xcb, 0x38, 0x4c, 0x2a, 0xcc, + 0xb6, 0xd5, 0x69, 0x4d, 0xfa, 0x54, 0xc6, 0x25, 0xaa, 0xcc, 0x5a, 0xdc, 0x1d, 0x4d, 0x2c, 0x3a, + 0x56, 0xc7, 0xe9, 0xdf, 0xf3, 0xea, 0xc8, 0x32, 0xed, 0x3e, 0x13, 0x68, 0x60, 0xf0, 0x2a, 0x55, + 0x68, 0x4d, 0xad, 0x94, 0xcd, 0x3c, 0x53, 0xe9, 0x34, 0xbe, 0x6a, 0x08, 0xf8, 0x2b, 0x54, 0xa7, + 0x35, 0xb5, 0x6a, 0x30, 0x7c, 0xd5, 0x08, 0xf0, 0x15, 0x3a, 0x00, 0x4f, 0xac, 0x81, 0xc5, 0x55, + 0xaa, 0xd6, 0x5a, 0xac, 0x52, 0x5e, 0x31, 0x17, 0x3c, 0xc9, 0xce, 0x32, 0x0a, 0x35, 0xf3, 0x1a, + 0x15, 0x6d, 0x2d, 0x56, 0x35, 0x7c, 0x23, 0xb1, 0xa5, 0x32, 0x15, 0x3a, 0x97, 0x6e, 0x60, 0x73, + 0x8d, 0x6a, 0xb7, 0x16, 0xaf, 0x94, 0x57, 0x56, 0x4c, 0x8d, 0x2b, 0x78, 0x86, 0x4d, 0xa8, 0x9d, + 0x65, 0xaa, 0xe1, 0x5a, 0xbc, 0x6a, 0xf8, 0x36, 0xe1, 0x76, 0x16, 0x3c, 0x29, 0x07, 0x26, 0xd7, + 0xa9, 0x96, 0x6b, 0xc9, 0xca, 0xaa, 0xb1, 0xba, 0x76, 0xcb, 0xcc, 0x33, 0x4d, 0x07, 0x36, 0x06, + 0x6d, 0x87, 0x8b, 0x3a, 0x30, 0x5a, 0xa1, 0xaa, 0xae, 0x25, 0xcb, 0x37, 0x56, 0x6f, 0x96, 0x6f, + 0x9a, 0x1a, 0x57, 0x77, 0x60, 0xf5, 0x26, 0xb5, 0xe2, 0xf2, 0x0e, 0xac, 0x56, 0xa9, 0xbe, 0x6b, + 0xda, 0x81, 0xd5, 0xef, 0x3b, 0xaf, 0xe9, 0xc5, 0xa7, 0xce, 0xa8, 0xdf, 0xbe, 0x5c, 0x04, 0x53, + 0xe3, 0x8a, 0x17, 0x5b, 0x5d, 0xf0, 0x24, 0x1f, 0x98, 0xff, 0x2a, 0x3d, 0xb1, 0xe6, 0x6a, 0xa9, + 0x3b, 0xbd, 0xae, 0xed, 0x8c, 0x2d, 0x33, 0xcf, 0xc4, 0x1f, 0x99, 0x93, 0x9d, 0xe8, 0x3c, 0x7e, + 0x85, 0x9a, 0x2d, 0xd4, 0x62, 0xd7, 0x2a, 0x65, 0xda, 0xd2, 0xac, 0x79, 0xdc, 0x89, 0xce, 0xe3, + 0xaf, 0x51, 0x1b, 0x52, 0x8b, 0x5d, 0xab, 0x1a, 0xdc, 0x46, 0x9c, 0xc7, 0x2a, 0x2c, 0x0a, 0x7b, + 0x21, 0xb0, 0xfa, 0x75, 0x6a, 0x95, 0x67, 0x2d, 0x11, 0x7f, 0x47, 0xcc, 0xb4, 0x0b, 0xb5, 0xf6, + 0x1b, 0xd4, 0x4e, 0x63, 0xad, 0x11, 0x7f, 0x63, 0x04, 0x76, 0x37, 0xe0, 0x4c, 0xe4, 0x2c, 0xd1, + 0x1c, 0xb6, 0xf6, 0x9f, 0x58, 0xed, 0x42, 0x99, 0x1e, 0x29, 0xee, 0xa8, 0x9a, 0x62, 0x9e, 0x0e, + 0x1d, 0x2b, 0x1e, 0x61, 0x35, 0xb9, 0x05, 0x67, 0xa3, 0x87, 0x0b, 0xcf, 0xb2, 0x42, 0xcf, 0x18, + 0x68, 0xb9, 0x18, 0x3e, 0x67, 0x44, 0x4c, 0x85, 0xa0, 0xe2, 0x99, 0x1a, 0xf4, 0xd0, 0x11, 0x98, + 0x06, 0xb1, 0x85, 0x9b, 0xbe, 0x01, 0xe7, 0xa6, 0x8f, 0x1f, 0x9e, 0xf1, 0x1a, 0x3d, 0x85, 0xa0, + 0xf1, 0x99, 0xe8, 0x49, 0x64, 0xca, 0x7c, 0x46, 0xdb, 0x55, 0x7a, 0x2c, 0x11, 0xcd, 0xa7, 0x5a, + 0x7f, 0x1d, 0x0a, 0x53, 0x07, 0x14, 0xcf, 0xfa, 0x06, 0x3d, 0xa7, 0xa0, 0xf5, 0x0b, 0x91, 0xb3, + 0x4a, 0xd4, 0x78, 0x46, 0xd3, 0x37, 0xe9, 0xc1, 0x45, 0x30, 0x9e, 0x6a, 0x19, 0xa7, 0x2c, 0x7c, + 0x84, 0xf1, 0x6c, 0x6f, 0xd1, 0x93, 0x0c, 0x9f, 0xb2, 0xd0, 0x69, 0x46, 0x6c, 0x37, 0x72, 0xa6, + 0xf1, 0x6c, 0x6b, 0xf4, 0x68, 0xc3, 0xdb, 0x0d, 0x1f, 0x6f, 0xb8, 0xf1, 0xcf, 0x50, 0xe3, 0x9d, + 0xd9, 0x23, 0xfe, 0x51, 0x8c, 0x1e, 0x4a, 0xb8, 0xf5, 0xce, 0xac, 0x21, 0xfb, 0xd6, 0x33, 0x86, + 0xfc, 0x63, 0x6a, 0x4d, 0x04, 0xeb, 0xa9, 0x31, 0xbf, 0x05, 0x4b, 0x33, 0xce, 0x2b, 0x9e, 0xfd, + 0x4f, 0xa8, 0x7d, 0x1e, 0xed, 0xcf, 0x4e, 0x1d, 0x5d, 0xa6, 0x19, 0x66, 0xf4, 0xe0, 0xa7, 0x94, + 0x41, 0x0b, 0x31, 0x4c, 0xf5, 0xa1, 0x0e, 0x73, 0xde, 0x79, 0xbc, 0x3b, 0x72, 0x26, 0xc3, 0x42, + 0x5d, 0x57, 0x4b, 0x50, 0xd6, 0x67, 0x64, 0xc7, 0xde, 0xf1, 0x7c, 0x83, 0xe2, 0xcc, 0xb0, 0x19, + 0xe3, 0x61, 0xcc, 0x8c, 0xe7, 0x91, 0x1e, 0x7b, 0x26, 0x0f, 0xc3, 0xf9, 0x3c, 0x82, 0x19, 0xe5, + 0xf1, 0xc2, 0x1d, 0xe3, 0x79, 0xac, 0x2b, 0xcf, 0xe0, 0xf1, 0x82, 0x1f, 0xe7, 0x09, 0x99, 0x2d, + 0xad, 0x05, 0x39, 0x39, 0xd6, 0x93, 0x97, 0xa2, 0x49, 0xfa, 0x06, 0x66, 0x57, 0xe1, 0x42, 0x66, + 0x26, 0x74, 0x6f, 0xda, 0xec, 0xed, 0x67, 0x98, 0x85, 0x7a, 0x33, 0x6d, 0xf6, 0x73, 0x33, 0xcc, + 0x8a, 0xbf, 0xa9, 0x40, 0xfc, 0xc1, 0xe6, 0xf6, 0x3d, 0x92, 0x86, 0xf8, 0xbb, 0x8d, 0xcd, 0x7b, + 0xda, 0x29, 0xfa, 0x74, 0xa7, 0xd1, 0x78, 0xa8, 0x29, 0x24, 0x03, 0x89, 0x3b, 0x5f, 0xda, 0x5d, + 0xdf, 0xd1, 0x54, 0x92, 0x87, 0x6c, 0x7d, 0x73, 0x7b, 0x63, 0xdd, 0x7c, 0x64, 0x6e, 0x6e, 0xef, + 0x6a, 0x31, 0x5a, 0x57, 0x7f, 0xd8, 0xb8, 0xbd, 0xab, 0xc5, 0x49, 0x0a, 0x62, 0xb4, 0x2c, 0x41, + 0x00, 0x92, 0x3b, 0xbb, 0xe6, 0xe6, 0xf6, 0x86, 0x96, 0xa4, 0x2c, 0xbb, 0x9b, 0x5b, 0xeb, 0x5a, + 0x8a, 0x22, 0x77, 0xdf, 0x79, 0xf4, 0x70, 0x5d, 0x4b, 0xd3, 0xc7, 0xdb, 0xa6, 0x79, 0xfb, 0x4b, + 0x5a, 0x86, 0x1a, 0x6d, 0xdd, 0x7e, 0xa4, 0x01, 0x56, 0xdf, 0xbe, 0xf3, 0x70, 0x5d, 0xcb, 0x92, + 0x1c, 0xa4, 0xeb, 0xef, 0x6c, 0xdf, 0xdd, 0xdd, 0x6c, 0x6c, 0x6b, 0xb9, 0xe2, 0x2f, 0x42, 0x81, + 0x4d, 0x73, 0x68, 0x16, 0xd9, 0x95, 0xc1, 0x5b, 0x90, 0x60, 0x6b, 0xa3, 0xa0, 0x56, 0xae, 0x4c, + 0xaf, 0xcd, 0xb4, 0xd1, 0x32, 0x5b, 0x25, 0x66, 0xb8, 0x74, 0x01, 0x12, 0x6c, 0x9e, 0x16, 0x21, + 0xc1, 0xe6, 0x47, 0xc5, 0xab, 0x04, 0xf6, 0x52, 0xfc, 0x2d, 0x15, 0x60, 0xc3, 0xd9, 0x79, 0xd2, + 0x1b, 0xe2, 0xc5, 0xcd, 0x05, 0x80, 0xf1, 0x93, 0xde, 0xb0, 0x89, 0x3b, 0x90, 0x5f, 0x3a, 0x64, + 0x68, 0x09, 0xfa, 0x5e, 0x72, 0x19, 0x72, 0x58, 0xcd, 0xb7, 0x08, 0xde, 0x35, 0xa4, 0xcc, 0x2c, + 0x2d, 0xe3, 0x4e, 0x32, 0x0c, 0xa9, 0x1a, 0x78, 0xc5, 0x90, 0x14, 0x20, 0x55, 0x83, 0x5c, 0x02, + 0x7c, 0x6d, 0x8e, 0x31, 0x9a, 0xe2, 0xb5, 0x42, 0xc6, 0xc4, 0x76, 0x59, 0x7c, 0x25, 0x6f, 0x02, + 0xb6, 0xc9, 0x46, 0x9e, 0x9f, 0xb5, 0x4b, 0xbc, 0x0e, 0x2f, 0xd3, 0x07, 0x36, 0xde, 0xc0, 0x64, + 0xa9, 0x01, 0x19, 0xbf, 0x9c, 0xb6, 0x86, 0xa5, 0x7c, 0x4c, 0x1a, 0x8e, 0x09, 0xb0, 0xc8, 0x1f, + 0x14, 0x03, 0xf0, 0xfe, 0x2c, 0x60, 0x7f, 0x98, 0x11, 0xeb, 0x50, 0xf1, 0x02, 0xcc, 0x6d, 0x3b, + 0x36, 0xdb, 0xc7, 0x38, 0x4f, 0x39, 0x50, 0x5a, 0x05, 0x05, 0xf3, 0x5f, 0xa5, 0x55, 0xbc, 0x08, + 0x20, 0xd4, 0x69, 0xa0, 0xec, 0xb1, 0x3a, 0xf4, 0x07, 0xca, 0x5e, 0xf1, 0x2a, 0x24, 0xb7, 0x5a, + 0x87, 0xbb, 0xad, 0x2e, 0xb9, 0x0c, 0xd0, 0x6f, 0x8d, 0xdd, 0x66, 0x07, 0x57, 0xe2, 0xf3, 0xcf, + 0x3f, 0xff, 0x5c, 0xc1, 0xc3, 0x74, 0x86, 0x96, 0xb2, 0x15, 0x19, 0x03, 0x34, 0xfa, 0xed, 0x2d, + 0x6b, 0x3c, 0x6e, 0x75, 0x2d, 0xb2, 0x06, 0x49, 0xdb, 0x1a, 0xd3, 0xe8, 0xab, 0xe0, 0x5d, 0xd3, + 0x05, 0x71, 0x1e, 0x02, 0xdc, 0xf2, 0x36, 0x82, 0x4c, 0x0e, 0x26, 0x1a, 0xc4, 0xec, 0xc9, 0x00, + 0x6f, 0xd4, 0x12, 0x26, 0x7d, 0x5c, 0x7a, 0x11, 0x92, 0x0c, 0x43, 0x08, 0xc4, 0xed, 0xd6, 0xc0, + 0x2a, 0xb0, 0x96, 0xf1, 0xb9, 0xf8, 0x15, 0x05, 0x60, 0xdb, 0x7a, 0x7a, 0xac, 0x56, 0x03, 0x9c, + 0xa4, 0xd5, 0x18, 0x6b, 0xf5, 0x75, 0x59, 0xab, 0x54, 0x6d, 0x1d, 0xc7, 0x69, 0x37, 0xd9, 0x42, + 0xb3, 0xeb, 0xbf, 0x0c, 0x2d, 0xc1, 0x95, 0x2b, 0x3e, 0x86, 0xdc, 0xa6, 0x6d, 0x5b, 0x23, 0xaf, + 0x57, 0x04, 0xe2, 0x07, 0xce, 0xd8, 0xe5, 0x37, 0x91, 0xf8, 0x4c, 0x0a, 0x10, 0x1f, 0x3a, 0x23, + 0x97, 0x8d, 0xb4, 0x16, 0x37, 0x56, 0x56, 0x56, 0x4c, 0x2c, 0x21, 0x2f, 0x42, 0x66, 0xdf, 0xb1, + 0x6d, 0x6b, 0x9f, 0x0e, 0x23, 0x86, 0xa9, 0x63, 0x50, 0x50, 0xfc, 0x65, 0x05, 0x72, 0x0d, 0xf7, + 0x20, 0x20, 0xd7, 0x20, 0xf6, 0xc4, 0x3a, 0xc2, 0xee, 0xc5, 0x4c, 0xfa, 0x48, 0x37, 0xcc, 0xcf, + 0xb7, 0xfa, 0x13, 0x76, 0x2f, 0x99, 0x33, 0xd9, 0x0b, 0x39, 0x03, 0xc9, 0xa7, 0x56, 0xaf, 0x7b, + 0xe0, 0x22, 0xa7, 0x6a, 0xf2, 0x37, 0xb2, 0x0c, 0x89, 0x1e, 0xed, 0x6c, 0x21, 0x8e, 0x33, 0x56, + 0x10, 0x67, 0x4c, 0x1c, 0x85, 0xc9, 0x60, 0x57, 0xd2, 0xe9, 0xb6, 0xf6, 0xc1, 0x07, 0x1f, 0x7c, + 0xa0, 0x16, 0x0f, 0x60, 0xd1, 0xdb, 0xc4, 0xa1, 0xe1, 0x3e, 0x82, 0x42, 0xdf, 0x72, 0x9a, 0x9d, + 0x9e, 0xdd, 0xea, 0xf7, 0x8f, 0x9a, 0x4f, 0x1d, 0xbb, 0xd9, 0xb2, 0x9b, 0xce, 0x78, 0xbf, 0x35, + 0xc2, 0x29, 0x90, 0x35, 0xb2, 0xd8, 0xb7, 0x9c, 0x3a, 0x33, 0x7c, 0xcf, 0xb1, 0x6f, 0xdb, 0x0d, + 0x6a, 0x55, 0xfc, 0x2c, 0x0e, 0x99, 0xad, 0x23, 0x8f, 0x7f, 0x11, 0x12, 0xfb, 0xce, 0xc4, 0x66, + 0xf3, 0x99, 0x30, 0xd9, 0x8b, 0xbf, 0x4e, 0xaa, 0xb0, 0x4e, 0x8b, 0x90, 0x78, 0x7f, 0xe2, 0xb8, + 0x16, 0x0e, 0x39, 0x63, 0xb2, 0x17, 0x3a, 0x63, 0x43, 0xcb, 0x2d, 0xc4, 0xf1, 0x9a, 0x82, 0x3e, + 0x06, 0x73, 0x90, 0x38, 0xd6, 0x1c, 0x90, 0x15, 0x48, 0x3a, 0x74, 0x0d, 0xc6, 0x85, 0x24, 0xde, + 0xc3, 0x86, 0x0c, 0xc4, 0xd5, 0x31, 0x39, 0x8e, 0x3c, 0x80, 0x85, 0xa7, 0x56, 0x73, 0x30, 0x19, + 0xbb, 0xcd, 0xae, 0xd3, 0x6c, 0x5b, 0xd6, 0xd0, 0x1a, 0x15, 0xe6, 0xb0, 0xb5, 0x90, 0x87, 0x98, + 0x35, 0xa1, 0xe6, 0xfc, 0x53, 0x6b, 0x6b, 0x32, 0x76, 0x37, 0x9c, 0x7b, 0x68, 0x47, 0xd6, 0x20, + 0x33, 0xb2, 0xa8, 0x5f, 0xa0, 0x5d, 0xce, 0x4d, 0xf7, 0x20, 0x64, 0x9c, 0x1e, 0x59, 0x43, 0x2c, + 0x20, 0x37, 0x20, 0xbd, 0xd7, 0x7b, 0x62, 0x8d, 0x0f, 0xac, 0x76, 0x21, 0xa5, 0x2b, 0xa5, 0xf9, + 0xf2, 0x79, 0xd1, 0xca, 0x9f, 0xe0, 0xe5, 0xbb, 0x4e, 0xdf, 0x19, 0x99, 0x3e, 0x98, 0xbc, 0x01, + 0x99, 0xb1, 0x33, 0xb0, 0x98, 0xda, 0xd3, 0x18, 0x6c, 0x2f, 0xcd, 0xb6, 0xdc, 0x71, 0x06, 0x96, + 0xe7, 0xd5, 0x3c, 0x0b, 0x72, 0x9e, 0x75, 0x77, 0x8f, 0x26, 0x13, 0x05, 0xc0, 0x0b, 0x1f, 0xda, + 0x29, 0x4c, 0x2e, 0xc8, 0x12, 0xed, 0x54, 0xb7, 0x43, 0xcf, 0x6c, 0x85, 0x2c, 0xe6, 0xf2, 0xfe, + 0xfb, 0xd2, 0x6b, 0x90, 0xf1, 0x09, 0x03, 0x77, 0xc8, 0x5c, 0x50, 0x06, 0x3d, 0x04, 0x73, 0x87, + 0xcc, 0xff, 0xbc, 0x0c, 0x09, 0xec, 0x38, 0x8d, 0x5c, 0xe6, 0x3a, 0x0d, 0x94, 0x19, 0x48, 0x6c, + 0x98, 0xeb, 0xeb, 0xdb, 0x9a, 0x82, 0x31, 0xf3, 0xe1, 0x3b, 0xeb, 0x9a, 0x2a, 0xe8, 0xf7, 0xb7, + 0x55, 0x88, 0xad, 0x1f, 0xa2, 0x72, 0xda, 0x2d, 0xb7, 0xe5, 0xed, 0x70, 0xfa, 0x4c, 0x6a, 0x90, + 0x19, 0xb4, 0xbc, 0xb6, 0x54, 0x9c, 0xe2, 0x90, 0x2f, 0x59, 0x3f, 0x74, 0x97, 0xb7, 0x5a, 0xac, + 0xe5, 0x75, 0xdb, 0x1d, 0x1d, 0x99, 0xe9, 0x01, 0x7f, 0x5d, 0x7a, 0x1d, 0xe6, 0x42, 0x55, 0xe2, + 0x16, 0x4d, 0xcc, 0xd8, 0xa2, 0x09, 0xbe, 0x45, 0x6b, 0xea, 0x4d, 0xa5, 0x5c, 0x83, 0xf8, 0xc0, + 0x19, 0x59, 0xe4, 0x85, 0x99, 0x13, 0x5c, 0xe8, 0xa2, 0x64, 0xf2, 0x91, 0xae, 0x98, 0x68, 0x53, + 0x7e, 0x15, 0xe2, 0xae, 0x75, 0xe8, 0x3e, 0xcb, 0xf6, 0x80, 0x8d, 0x8f, 0x42, 0xca, 0xd7, 0x20, + 0x69, 0x4f, 0x06, 0x7b, 0xd6, 0xe8, 0x59, 0xe0, 0x1e, 0x76, 0x8c, 0x83, 0x8a, 0xef, 0x82, 0x76, + 0xd7, 0x19, 0x0c, 0xfb, 0xd6, 0xe1, 0xfa, 0xa1, 0x6b, 0xd9, 0xe3, 0x9e, 0x63, 0xd3, 0x31, 0x74, + 0x7a, 0x23, 0x74, 0x6b, 0x38, 0x06, 0x7c, 0xa1, 0x6e, 0x66, 0x6c, 0xed, 0x3b, 0x76, 0x9b, 0x0f, + 0x8d, 0xbf, 0x51, 0xb4, 0x7b, 0xd0, 0x1b, 0x51, 0x8f, 0x46, 0x83, 0x0f, 0x7b, 0x29, 0x6e, 0x40, + 0x9e, 0xa7, 0x61, 0x63, 0xde, 0x70, 0xf1, 0x0a, 0xe4, 0xbc, 0x22, 0xfc, 0xe5, 0x27, 0x0d, 0xf1, + 0xc7, 0xeb, 0x66, 0x43, 0x3b, 0x45, 0xd7, 0xb5, 0xb1, 0xbd, 0xae, 0x29, 0xf4, 0x61, 0xf7, 0xbd, + 0x46, 0x68, 0x2d, 0x5f, 0x84, 0x9c, 0xdf, 0xf7, 0x1d, 0xcb, 0xc5, 0x1a, 0x1a, 0xa5, 0x52, 0x35, + 0x35, 0xad, 0x14, 0x53, 0x90, 0x58, 0x1f, 0x0c, 0xdd, 0xa3, 0xe2, 0x2f, 0x41, 0x96, 0x83, 0x1e, + 0xf6, 0xc6, 0x2e, 0xb9, 0x05, 0xa9, 0x01, 0x1f, 0xaf, 0x82, 0x67, 0xd1, 0xb0, 0xac, 0x03, 0xa4, + 0xf7, 0x6c, 0x7a, 0xf8, 0xa5, 0x0a, 0xa4, 0x04, 0xf7, 0xce, 0x3d, 0x8f, 0x2a, 0x7a, 0x1e, 0xe6, + 0xa3, 0x62, 0x82, 0x8f, 0x2a, 0x6e, 0x41, 0x8a, 0x05, 0xe6, 0x31, 0x1e, 0x37, 0x58, 0xfe, 0xce, + 0x34, 0xc6, 0xc4, 0x97, 0x65, 0x65, 0xec, 0x0c, 0x75, 0x09, 0xb2, 0xb8, 0x67, 0x7c, 0x15, 0x52, + 0x6f, 0x0e, 0x58, 0xc4, 0x14, 0xff, 0x47, 0x09, 0x48, 0x7b, 0x73, 0x45, 0xce, 0x43, 0x92, 0x25, + 0xb1, 0x48, 0xe5, 0x5d, 0xea, 0x24, 0x30, 0x6d, 0x25, 0xe7, 0x21, 0xc5, 0x13, 0x55, 0x1e, 0x70, + 0xd4, 0x4a, 0xd9, 0x4c, 0xb2, 0xc4, 0xd4, 0xaf, 0xac, 0x1a, 0xe8, 0x27, 0xd9, 0x75, 0x4d, 0x92, + 0xa5, 0x9e, 0x44, 0x87, 0x8c, 0x9f, 0x6c, 0x62, 0x88, 0xe0, 0x77, 0x33, 0x69, 0x2f, 0xbb, 0x14, + 0x10, 0x55, 0x03, 0x1d, 0x28, 0xbf, 0x88, 0x49, 0xd7, 0x83, 0x73, 0x53, 0xda, 0x4b, 0x19, 0xf1, + 0x97, 0x27, 0xef, 0xd6, 0x25, 0xc5, 0x93, 0xc4, 0x00, 0x50, 0x35, 0xd0, 0x33, 0x79, 0x57, 0x2c, + 0x29, 0x9e, 0x08, 0x92, 0x4b, 0xb4, 0x8b, 0x98, 0xd8, 0xa1, 0xff, 0x09, 0xee, 0x53, 0x92, 0x2c, + 0xdd, 0x23, 0x97, 0x29, 0x03, 0xcb, 0xde, 0xd0, 0x35, 0x04, 0x97, 0x27, 0x29, 0x9e, 0xd4, 0x91, + 0xab, 0x14, 0xc2, 0xa6, 0xbf, 0x00, 0xcf, 0xb8, 0x29, 0x49, 0xf1, 0x9b, 0x12, 0xa2, 0xd3, 0x06, + 0xd1, 0x43, 0xa1, 0x57, 0x12, 0x6e, 0x45, 0x92, 0xec, 0x56, 0x84, 0x5c, 0x44, 0x3a, 0x36, 0xa8, + 0x5c, 0x70, 0x03, 0x92, 0xe2, 0x59, 0x60, 0x50, 0x8f, 0x67, 0x49, 0xff, 0xb6, 0x23, 0xc5, 0xf3, + 0x3c, 0x72, 0x93, 0xae, 0x17, 0x55, 0x78, 0x61, 0x1e, 0x7d, 0xf1, 0x92, 0x28, 0x3d, 0x6f, 0x55, + 0x99, 0x2b, 0xae, 0x31, 0x37, 0x66, 0x26, 0xea, 0xb8, 0x23, 0x96, 0xa8, 0xe5, 0xa3, 0x9e, 0xdd, + 0x29, 0xe4, 0x71, 0x2e, 0x62, 0x3d, 0xbb, 0x63, 0x26, 0xea, 0xb4, 0x84, 0xa9, 0x60, 0x9b, 0xd6, + 0x69, 0x58, 0x17, 0xbf, 0xc6, 0x2a, 0x69, 0x11, 0x29, 0x40, 0xa2, 0xde, 0xdc, 0x6e, 0xd9, 0x85, + 0x05, 0x66, 0x67, 0xb7, 0x6c, 0x33, 0x5e, 0xdf, 0x6e, 0xd9, 0xe4, 0x55, 0x88, 0x8d, 0x27, 0x7b, + 0x05, 0x32, 0xfd, 0xb3, 0xe0, 0xce, 0x64, 0xcf, 0xeb, 0x8c, 0x49, 0x31, 0xe4, 0x3c, 0xa4, 0xc7, + 0xee, 0xa8, 0xf9, 0x0b, 0xd6, 0xc8, 0x29, 0x9c, 0xc6, 0x69, 0x3c, 0x65, 0xa6, 0xc6, 0xee, 0xe8, + 0xb1, 0x35, 0x72, 0x8e, 0xe9, 0x83, 0x8b, 0x17, 0x21, 0x2b, 0xf0, 0x92, 0x3c, 0x28, 0x36, 0x3b, + 0xc0, 0xd4, 0x94, 0x1b, 0xa6, 0x62, 0x17, 0xdf, 0x85, 0x9c, 0x97, 0x62, 0xe1, 0x88, 0x0d, 0xba, + 0x9b, 0xfa, 0xce, 0x08, 0x77, 0xe9, 0x7c, 0xf9, 0x62, 0x38, 0x62, 0x06, 0x40, 0x1e, 0xb9, 0x18, + 0xb8, 0xa8, 0x45, 0x3a, 0xa3, 0x14, 0x7f, 0xa0, 0x40, 0x6e, 0xcb, 0x19, 0x05, 0xbf, 0x5f, 0x2c, + 0x42, 0x62, 0xcf, 0x71, 0xfa, 0x63, 0x24, 0x4e, 0x9b, 0xec, 0x85, 0xbc, 0x0c, 0x39, 0x7c, 0xf0, + 0x92, 0x64, 0xd5, 0xbf, 0x05, 0xca, 0x62, 0x39, 0xcf, 0x8b, 0x09, 0xc4, 0x7b, 0xb6, 0x3b, 0xe6, + 0x1e, 0x0d, 0x9f, 0xc9, 0x17, 0x20, 0x4b, 0xff, 0x7a, 0x96, 0x71, 0xff, 0x34, 0x0d, 0xb4, 0x98, + 0x1b, 0xbe, 0x02, 0x73, 0xa8, 0x01, 0x1f, 0x96, 0xf2, 0x6f, 0x7c, 0x72, 0xac, 0x82, 0x03, 0x0b, + 0x90, 0x62, 0x0e, 0x61, 0x8c, 0x3f, 0xf8, 0x66, 0x4c, 0xef, 0x95, 0xba, 0x59, 0x4c, 0x54, 0xd8, + 0x09, 0x24, 0x65, 0xf2, 0xb7, 0xe2, 0x5d, 0x48, 0x63, 0xb8, 0x6c, 0xf4, 0xdb, 0xe4, 0x25, 0x50, + 0xba, 0x05, 0x0b, 0xc3, 0xf5, 0x99, 0x50, 0x16, 0xc2, 0x01, 0xcb, 0x1b, 0xa6, 0xd2, 0x5d, 0x5a, + 0x00, 0x65, 0x83, 0xa6, 0x05, 0x87, 0xdc, 0x61, 0x2b, 0x87, 0xc5, 0xb7, 0x39, 0xc9, 0xb6, 0xf5, + 0x54, 0x4e, 0xb2, 0x6d, 0x3d, 0x65, 0x24, 0x97, 0xa6, 0x48, 0xe8, 0xdb, 0x11, 0xff, 0x0d, 0x5c, + 0x39, 0x2a, 0x56, 0x60, 0x0e, 0x37, 0x6a, 0xcf, 0xee, 0x3e, 0x72, 0x7a, 0x36, 0x26, 0x22, 0x1d, + 0x3c, 0xc0, 0x29, 0xa6, 0xd2, 0xa1, 0xeb, 0x60, 0x1d, 0xb6, 0xf6, 0xd9, 0x71, 0x38, 0x6d, 0xb2, + 0x97, 0xe2, 0xf7, 0xe3, 0x30, 0xcf, 0x9d, 0xec, 0x7b, 0x3d, 0xf7, 0x60, 0xab, 0x35, 0x24, 0xdb, + 0x90, 0xa3, 0xfe, 0xb5, 0x39, 0x68, 0x0d, 0x87, 0x74, 0x23, 0x2b, 0x18, 0x9a, 0xaf, 0xce, 0x70, + 0xdb, 0xdc, 0x62, 0x79, 0xbb, 0x35, 0xb0, 0xb6, 0x18, 0x9a, 0x05, 0xea, 0xac, 0x1d, 0x94, 0x90, + 0x07, 0x90, 0x1d, 0x8c, 0xbb, 0x3e, 0x1d, 0x8b, 0xf4, 0x57, 0x24, 0x74, 0x5b, 0xe3, 0x6e, 0x88, + 0x0d, 0x06, 0x7e, 0x01, 0xed, 0x1c, 0xf5, 0xce, 0x3e, 0x5b, 0xec, 0xb9, 0x9d, 0xa3, 0xae, 0x24, + 0xdc, 0xb9, 0xbd, 0xa0, 0x84, 0xd4, 0x01, 0xe8, 0x56, 0x73, 0x1d, 0x9a, 0xe1, 0xa1, 0x96, 0xb2, + 0xe5, 0x92, 0x84, 0x6d, 0xc7, 0x1d, 0xed, 0x3a, 0x3b, 0xee, 0x88, 0x1f, 0x48, 0xc6, 0xfc, 0x75, + 0xe9, 0x4d, 0xd0, 0xa2, 0xb3, 0xf0, 0xbc, 0x33, 0x49, 0x46, 0x38, 0x93, 0x2c, 0xfd, 0x2c, 0xe4, + 0x23, 0xc3, 0x16, 0xcd, 0x09, 0x33, 0xbf, 0x2e, 0x9a, 0x67, 0xcb, 0xe7, 0x42, 0xdf, 0x68, 0x88, + 0x4b, 0x2f, 0x32, 0xbf, 0x09, 0x5a, 0x74, 0x0a, 0x44, 0xea, 0xb4, 0x24, 0xa1, 0x41, 0xfb, 0xd7, + 0x61, 0x2e, 0x34, 0x68, 0xd1, 0x38, 0xf3, 0x9c, 0x61, 0x15, 0x7f, 0x25, 0x01, 0x89, 0x86, 0x6d, + 0x39, 0x1d, 0x72, 0x36, 0x1c, 0x3b, 0xef, 0x9f, 0xf2, 0xe2, 0xe6, 0xb9, 0x48, 0xdc, 0xbc, 0x7f, + 0xca, 0x8f, 0x9a, 0xe7, 0x22, 0x51, 0xd3, 0xab, 0xaa, 0x1a, 0xe4, 0xc2, 0x54, 0xcc, 0xbc, 0x7f, + 0x4a, 0x08, 0x98, 0x17, 0xa6, 0x02, 0x66, 0x50, 0x5d, 0x35, 0xa8, 0x83, 0x0d, 0x47, 0xcb, 0xfb, + 0xa7, 0x82, 0x48, 0x79, 0x3e, 0x1a, 0x29, 0xfd, 0xca, 0xaa, 0xc1, 0xba, 0x24, 0x44, 0x49, 0xec, + 0x12, 0x8b, 0x8f, 0xe7, 0xa3, 0xf1, 0x11, 0xed, 0x78, 0x64, 0x3c, 0x1f, 0x8d, 0x8c, 0x58, 0xc9, + 0x23, 0xe1, 0xb9, 0x48, 0x24, 0x44, 0x52, 0x16, 0x02, 0xcf, 0x47, 0x43, 0x20, 0xb3, 0x13, 0x7a, + 0x2a, 0xc6, 0x3f, 0xbf, 0xb2, 0x6a, 0x10, 0x23, 0x12, 0xfc, 0x64, 0x89, 0x08, 0xae, 0x06, 0x86, + 0x81, 0x2a, 0x9d, 0x38, 0xef, 0x80, 0x9a, 0x97, 0x7e, 0xc2, 0x82, 0x33, 0xea, 0x1d, 0xd0, 0x0c, + 0x48, 0x75, 0x78, 0xae, 0xae, 0xa1, 0x27, 0x0b, 0x89, 0x13, 0x25, 0xb0, 0x5c, 0x6f, 0xa2, 0x47, + 0xa3, 0xa3, 0xeb, 0xb0, 0x84, 0xa3, 0x04, 0x73, 0xf5, 0xe6, 0xc3, 0xd6, 0xa8, 0x4b, 0xa1, 0xbb, + 0xad, 0xae, 0x7f, 0xeb, 0x41, 0x55, 0x90, 0xad, 0xf3, 0x9a, 0xdd, 0x56, 0x97, 0x9c, 0xf1, 0x24, + 0xd6, 0xc6, 0x5a, 0x85, 0x8b, 0x6c, 0xe9, 0x2c, 0x9d, 0x3a, 0x46, 0x86, 0xbe, 0x71, 0x81, 0xfb, + 0xc6, 0x3b, 0x29, 0x48, 0x4c, 0xec, 0x9e, 0x63, 0xdf, 0xc9, 0x40, 0xca, 0x75, 0x46, 0x83, 0x96, + 0xeb, 0x14, 0x7f, 0xa8, 0x00, 0xdc, 0x75, 0x06, 0x83, 0x89, 0xdd, 0x7b, 0x7f, 0x62, 0x91, 0x8b, + 0x90, 0x1d, 0xb4, 0x9e, 0x58, 0xcd, 0x81, 0xd5, 0xdc, 0x1f, 0x79, 0xbb, 0x21, 0x43, 0x8b, 0xb6, + 0xac, 0xbb, 0xa3, 0x23, 0x52, 0xf0, 0x0e, 0xf0, 0xa8, 0x20, 0x14, 0x26, 0x3f, 0xd0, 0x2f, 0xf2, + 0xe3, 0x68, 0x92, 0xaf, 0xa4, 0x77, 0x20, 0x65, 0x49, 0x4e, 0x8a, 0xaf, 0x21, 0x4b, 0x73, 0xce, + 0x42, 0xd2, 0xb5, 0x06, 0xc3, 0xe6, 0x3e, 0x0a, 0x86, 0x8a, 0x22, 0x41, 0xdf, 0xef, 0x92, 0xeb, + 0x10, 0xdb, 0x77, 0xfa, 0x28, 0x95, 0xe7, 0xae, 0x0e, 0x45, 0x92, 0x57, 0x20, 0x36, 0x18, 0x33, + 0xf9, 0x64, 0xcb, 0xa7, 0x43, 0x27, 0x08, 0x16, 0xb2, 0x28, 0x70, 0x30, 0xee, 0xfa, 0x63, 0xbf, + 0x92, 0x87, 0x58, 0xbd, 0xd1, 0xa0, 0xa7, 0x82, 0x7a, 0xa3, 0xb1, 0xaa, 0x29, 0xb5, 0x55, 0x48, + 0x77, 0x47, 0x96, 0x45, 0x1d, 0xc5, 0xb3, 0xb2, 0x92, 0x2f, 0x63, 0x14, 0xf4, 0x61, 0xb5, 0xb7, + 0x21, 0xb5, 0xcf, 0xf2, 0x12, 0xf2, 0xcc, 0x1c, 0xbc, 0xf0, 0xc7, 0xec, 0x2e, 0xe8, 0x45, 0x11, + 0x10, 0xcd, 0x66, 0x4c, 0x8f, 0xa7, 0xb6, 0x0b, 0x99, 0x51, 0xf3, 0xf9, 0xa4, 0x1f, 0xb2, 0xc8, + 0x23, 0x27, 0x4d, 0x8f, 0x78, 0x51, 0x6d, 0x03, 0x16, 0x6c, 0xc7, 0xfb, 0x49, 0xaa, 0xd9, 0xe6, + 0xfb, 0x6e, 0xd6, 0x91, 0xcf, 0x6b, 0xc0, 0x62, 0x3f, 0x6c, 0xdb, 0x0e, 0xaf, 0x60, 0x7b, 0xb5, + 0xb6, 0x0e, 0x9a, 0x40, 0xd4, 0x61, 0x9b, 0x5b, 0xc6, 0xd3, 0x61, 0xbf, 0xa5, 0xfb, 0x3c, 0xe8, + 0x0f, 0x22, 0x34, 0x7c, 0xc7, 0xca, 0x68, 0xba, 0xec, 0xd3, 0x04, 0x9f, 0x06, 0x9d, 0xe0, 0x34, + 0x0d, 0xf5, 0x5f, 0x32, 0x9a, 0x03, 0xf6, 0xdd, 0x82, 0x48, 0x53, 0x35, 0x22, 0xb3, 0x33, 0x39, + 0x46, 0x77, 0x7a, 0xec, 0xc3, 0x03, 0x9f, 0x87, 0xb9, 0xc7, 0x19, 0x44, 0xcf, 0xeb, 0xd0, 0x97, + 0xd9, 0x57, 0x09, 0x21, 0xa2, 0xa9, 0x1e, 0x8d, 0x8f, 0xd1, 0xa3, 0x27, 0xec, 0x23, 0x00, 0x9f, + 0x68, 0x67, 0x56, 0x8f, 0xc6, 0xc7, 0xe8, 0x51, 0x9f, 0x7d, 0x20, 0x10, 0x22, 0xaa, 0x1a, 0xb5, + 0x4d, 0x20, 0xe2, 0xc2, 0xf3, 0x58, 0x22, 0x65, 0x1a, 0xb0, 0x0f, 0x3f, 0x82, 0xa5, 0x67, 0x46, + 0xb3, 0xa8, 0x9e, 0xd7, 0x29, 0x9b, 0x7d, 0x15, 0x12, 0xa6, 0xaa, 0x1a, 0xb5, 0x07, 0x70, 0x5a, + 0x1c, 0xde, 0xb1, 0xba, 0xe5, 0xb0, 0x4f, 0x1a, 0x82, 0x01, 0x72, 0xab, 0x99, 0x64, 0xcf, 0xeb, + 0xd8, 0x90, 0x7d, 0xee, 0x10, 0x21, 0xab, 0x1a, 0xb5, 0xbb, 0x90, 0x17, 0xc8, 0xf6, 0x30, 0x0b, + 0x96, 0x11, 0xbd, 0xcf, 0x3e, 0xd2, 0xf1, 0x89, 0x68, 0xfc, 0x8f, 0xae, 0x1e, 0x8b, 0x88, 0x52, + 0x9a, 0x11, 0xfb, 0xc6, 0x24, 0xe8, 0x0f, 0xda, 0x44, 0x36, 0xca, 0x1e, 0x0b, 0x9f, 0x32, 0x9e, + 0x31, 0xfb, 0xfe, 0x24, 0xe8, 0x0e, 0x35, 0xa9, 0x0d, 0x42, 0x83, 0xb2, 0x68, 0x50, 0x94, 0xb2, + 0xb8, 0xe8, 0xbf, 0x4b, 0x12, 0xc8, 0xb2, 0x78, 0xd9, 0x22, 0x0c, 0x9f, 0xbe, 0xd6, 0x1e, 0xc0, + 0xfc, 0x49, 0x5c, 0xd6, 0x87, 0x0a, 0xcb, 0xbc, 0x2b, 0xcb, 0x34, 0x39, 0x37, 0xe7, 0xda, 0x21, + 0xcf, 0xb5, 0x01, 0x73, 0x27, 0x70, 0x5b, 0x1f, 0x29, 0x2c, 0x7f, 0xa5, 0x5c, 0x66, 0xae, 0x1d, + 0xf6, 0x5d, 0x73, 0x27, 0x70, 0x5c, 0x1f, 0x2b, 0xec, 0xc2, 0xc3, 0x28, 0xfb, 0x34, 0x9e, 0xef, + 0x9a, 0x3b, 0x81, 0xe3, 0xfa, 0x84, 0xe5, 0xa7, 0xaa, 0x51, 0x11, 0x69, 0xd0, 0x53, 0xcc, 0x9f, + 0xc4, 0x71, 0x7d, 0xaa, 0xe0, 0x05, 0x88, 0x6a, 0x18, 0xfe, 0xfc, 0xf8, 0xbe, 0x6b, 0xfe, 0x24, + 0x8e, 0xeb, 0xab, 0x0a, 0x5e, 0x94, 0xa8, 0xc6, 0x5a, 0x88, 0x28, 0xdc, 0xa3, 0xe3, 0x38, 0xae, + 0xaf, 0x29, 0x78, 0x7b, 0xa1, 0x1a, 0x55, 0x9f, 0x68, 0x67, 0xaa, 0x47, 0xc7, 0x71, 0x5c, 0x5f, + 0xc7, 0x6c, 0xa0, 0xa6, 0x1a, 0x37, 0x42, 0x44, 0xe8, 0xbb, 0xf2, 0x27, 0x72, 0x5c, 0xdf, 0x50, + 0xf0, 0xa2, 0x49, 0x35, 0x6e, 0x9a, 0x5e, 0x0f, 0x02, 0xdf, 0x95, 0x3f, 0x91, 0xe3, 0xfa, 0xa6, + 0x82, 0x37, 0x52, 0xaa, 0x71, 0x2b, 0x4c, 0x85, 0xbe, 0x4b, 0x3b, 0x99, 0xe3, 0xfa, 0x4c, 0xc1, + 0xef, 0x4f, 0xd4, 0xb5, 0x15, 0xd3, 0xeb, 0x84, 0xe0, 0xbb, 0xb4, 0x93, 0x39, 0xae, 0x6f, 0x29, + 0xf8, 0x51, 0x8a, 0xba, 0xb6, 0x1a, 0x21, 0xab, 0x1a, 0xb5, 0x75, 0xc8, 0x1d, 0xdf, 0x71, 0x7d, + 0x5b, 0xbc, 0xef, 0xcb, 0xb6, 0x05, 0xef, 0xf5, 0x58, 0x58, 0xbf, 0x63, 0xb8, 0xae, 0xef, 0x60, + 0xd6, 0x54, 0x7b, 0xe1, 0x3e, 0xbb, 0x15, 0x63, 0x26, 0xaf, 0xb5, 0xad, 0xce, 0x1b, 0x1d, 0xc7, + 0x09, 0x96, 0x94, 0x39, 0xb4, 0x46, 0xb0, 0x7b, 0x8e, 0xe1, 0xcd, 0xbe, 0xab, 0xe0, 0x25, 0x5a, + 0x8e, 0x53, 0xa3, 0x85, 0xbf, 0x8f, 0x98, 0x6b, 0xb3, 0x83, 0x31, 0x3f, 0xdf, 0xaf, 0x7d, 0x4f, + 0x39, 0x99, 0x63, 0xab, 0xc5, 0x1a, 0xdb, 0xeb, 0xfe, 0xe4, 0x60, 0xc9, 0x5b, 0x10, 0x3f, 0x2c, + 0xaf, 0xac, 0x86, 0x8f, 0x78, 0xe2, 0x1d, 0x32, 0x73, 0x67, 0xd9, 0xf2, 0x42, 0xe8, 0xb2, 0x7d, + 0x30, 0x74, 0x8f, 0x4c, 0xb4, 0xe4, 0x0c, 0x65, 0x09, 0xc3, 0x47, 0x52, 0x86, 0x32, 0x67, 0xa8, + 0x48, 0x18, 0x3e, 0x96, 0x32, 0x54, 0x38, 0x83, 0x21, 0x61, 0xf8, 0x44, 0xca, 0x60, 0x70, 0x86, + 0x35, 0x09, 0xc3, 0xa7, 0x52, 0x86, 0x35, 0xce, 0x50, 0x95, 0x30, 0x7c, 0x55, 0xca, 0x50, 0xe5, + 0x0c, 0x37, 0x24, 0x0c, 0x5f, 0x93, 0x32, 0xdc, 0xe0, 0x0c, 0x37, 0x25, 0x0c, 0x5f, 0x97, 0x32, + 0xdc, 0xe4, 0x0c, 0xb7, 0x24, 0x0c, 0xdf, 0x90, 0x32, 0xdc, 0x62, 0x0c, 0xab, 0x2b, 0x12, 0x86, + 0x6f, 0xca, 0x18, 0x56, 0x57, 0x38, 0x83, 0x4c, 0x93, 0x9f, 0x49, 0x19, 0xb8, 0x26, 0x57, 0x65, + 0x9a, 0xfc, 0x96, 0x94, 0x81, 0x6b, 0x72, 0x55, 0xa6, 0xc9, 0x6f, 0x4b, 0x19, 0xb8, 0x26, 0x57, + 0x65, 0x9a, 0xfc, 0x8e, 0x94, 0x81, 0x6b, 0x72, 0x55, 0xa6, 0xc9, 0xef, 0x4a, 0x19, 0xb8, 0x26, + 0x57, 0x65, 0x9a, 0xfc, 0x9e, 0x94, 0x81, 0x6b, 0x72, 0x55, 0xa6, 0xc9, 0x3f, 0x91, 0x32, 0x70, + 0x4d, 0xae, 0xca, 0x34, 0xf9, 0xa7, 0x52, 0x06, 0xae, 0xc9, 0x55, 0x99, 0x26, 0xff, 0x4c, 0xca, + 0xc0, 0x35, 0x59, 0x96, 0x69, 0xf2, 0xfb, 0x32, 0x86, 0x32, 0xd7, 0x64, 0x59, 0xa6, 0xc9, 0x3f, + 0x97, 0x32, 0x70, 0x4d, 0x96, 0x65, 0x9a, 0xfc, 0x0b, 0x29, 0x03, 0xd7, 0x64, 0x59, 0xa6, 0xc9, + 0x1f, 0x48, 0x19, 0xb8, 0x26, 0xcb, 0x32, 0x4d, 0xfe, 0xa5, 0x94, 0x81, 0x6b, 0xb2, 0x2c, 0xd3, + 0xe4, 0x5f, 0x49, 0x19, 0xb8, 0x26, 0xcb, 0x32, 0x4d, 0xfe, 0xb5, 0x94, 0x81, 0x6b, 0xb2, 0x2c, + 0xd3, 0xe4, 0xdf, 0x48, 0x19, 0xb8, 0x26, 0xcb, 0x32, 0x4d, 0xfe, 0xad, 0x94, 0x81, 0x6b, 0xb2, + 0x2c, 0xd3, 0xe4, 0xdf, 0x49, 0x19, 0xb8, 0x26, 0x2b, 0x32, 0x4d, 0xfe, 0xbd, 0x8c, 0xa1, 0xc2, + 0x35, 0x59, 0x91, 0x69, 0xf2, 0x1f, 0xa4, 0x0c, 0x5c, 0x93, 0x15, 0x99, 0x26, 0xff, 0x51, 0xca, + 0xc0, 0x35, 0x59, 0x91, 0x69, 0xf2, 0x9f, 0xa4, 0x0c, 0x5c, 0x93, 0x15, 0x99, 0x26, 0xff, 0x59, + 0xca, 0xc0, 0x35, 0x59, 0x91, 0x69, 0xf2, 0x5f, 0xa4, 0x0c, 0x5c, 0x93, 0x15, 0x99, 0x26, 0xff, + 0x55, 0xca, 0xc0, 0x35, 0x59, 0x91, 0x69, 0xf2, 0xdf, 0xa4, 0x0c, 0x5c, 0x93, 0x15, 0x99, 0x26, + 0x7f, 0x28, 0x65, 0xe0, 0x9a, 0xac, 0xc8, 0x34, 0xf9, 0xef, 0x52, 0x06, 0xae, 0x49, 0x43, 0xa6, + 0xc9, 0xff, 0x90, 0x31, 0x18, 0x5c, 0x93, 0x86, 0x4c, 0x93, 0xff, 0x29, 0x65, 0xe0, 0x9a, 0x34, + 0x64, 0x9a, 0xfc, 0x2f, 0x29, 0x03, 0xd7, 0xa4, 0x21, 0xd3, 0xe4, 0x7f, 0x4b, 0x19, 0xb8, 0x26, + 0x0d, 0x99, 0x26, 0xff, 0x47, 0xca, 0xc0, 0x35, 0x69, 0xc8, 0x34, 0xf9, 0xbf, 0x52, 0x06, 0xae, + 0x49, 0x43, 0xa6, 0xc9, 0x1f, 0x49, 0x19, 0xb8, 0x26, 0x0d, 0x99, 0x26, 0x7f, 0x2c, 0x65, 0xe0, + 0x9a, 0x34, 0x64, 0x9a, 0xfc, 0x89, 0x94, 0x81, 0x6b, 0xd2, 0x90, 0x69, 0xf2, 0xa7, 0x52, 0x06, + 0xae, 0xc9, 0x35, 0x99, 0x26, 0xff, 0x4f, 0xc6, 0xb0, 0xb6, 0x72, 0xe7, 0xda, 0xe3, 0xab, 0xdd, + 0x9e, 0x7b, 0x30, 0xd9, 0x5b, 0xde, 0x77, 0x06, 0xd7, 0xbb, 0x4e, 0xbf, 0x65, 0x77, 0xaf, 0x23, + 0x6c, 0x6f, 0xd2, 0xb9, 0x1e, 0xfc, 0xeb, 0x35, 0x33, 0xfd, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, + 0x46, 0xc7, 0xb3, 0x38, 0x92, 0x3d, 0x00, 0x00, +} diff --git a/vendor/github.com/golang/protobuf/proto/testdata/test.proto b/vendor/github.com/golang/protobuf/proto/test_proto/test.proto similarity index 95% rename from vendor/github.com/golang/protobuf/proto/testdata/test.proto rename to vendor/github.com/golang/protobuf/proto/test_proto/test.proto index 70e3cfcda..22068a959 100644 --- a/vendor/github.com/golang/protobuf/proto/testdata/test.proto +++ b/vendor/github.com/golang/protobuf/proto/test_proto/test.proto @@ -33,7 +33,9 @@ syntax = "proto2"; -package testdata; +option go_package = "github.com/golang/protobuf/proto/test_proto"; + +package test_proto; enum FOO { FOO1 = 1; }; @@ -96,6 +98,8 @@ message GoTest { required bytes F_Bytes_required = 101; required sint32 F_Sint32_required = 102; required sint64 F_Sint64_required = 103; + required sfixed32 F_Sfixed32_required = 104; + required sfixed64 F_Sfixed64_required = 105; // Repeated fields of all basic types repeated bool F_Bool_repeated = 20; @@ -111,6 +115,8 @@ message GoTest { repeated bytes F_Bytes_repeated = 201; repeated sint32 F_Sint32_repeated = 202; repeated sint64 F_Sint64_repeated = 203; + repeated sfixed32 F_Sfixed32_repeated = 204; + repeated sfixed64 F_Sfixed64_repeated = 205; // Optional fields of all basic types optional bool F_Bool_optional = 30; @@ -126,6 +132,8 @@ message GoTest { optional bytes F_Bytes_optional = 301; optional sint32 F_Sint32_optional = 302; optional sint64 F_Sint64_optional = 303; + optional sfixed32 F_Sfixed32_optional = 304; + optional sfixed64 F_Sfixed64_optional = 305; // Default-valued fields of all basic types optional bool F_Bool_defaulted = 40 [default=true]; @@ -141,6 +149,8 @@ message GoTest { optional bytes F_Bytes_defaulted = 401 [default="Bignose"]; optional sint32 F_Sint32_defaulted = 402 [default = -32]; optional sint64 F_Sint64_defaulted = 403 [default = -64]; + optional sfixed32 F_Sfixed32_defaulted = 404 [default = -32]; + optional sfixed64 F_Sfixed64_defaulted = 405 [default = -64]; // Packed repeated fields (no string or bytes). repeated bool F_Bool_repeated_packed = 50 [packed=true]; @@ -154,6 +164,8 @@ message GoTest { repeated double F_Double_repeated_packed = 58 [packed=true]; repeated sint32 F_Sint32_repeated_packed = 502 [packed=true]; repeated sint64 F_Sint64_repeated_packed = 503 [packed=true]; + repeated sfixed32 F_Sfixed32_repeated_packed = 504 [packed=true]; + repeated sfixed64 F_Sfixed64_repeated_packed = 505 [packed=true]; // Required, repeated, and optional groups. required group RequiredGroup = 70 { @@ -285,10 +297,12 @@ message Ext { } optional string data = 1; + map map_field = 2; } extend MyMessage { repeated string greeting = 106; + // leave field 200 unregistered for testing } message ComplexExtension { @@ -342,7 +356,7 @@ extend DefaultsMessage { optional sfixed32 default_sfixed32 = 211 [default = 50]; optional sfixed64 default_sfixed64 = 212 [default = 51]; optional bool default_bool = 213 [default = true]; - optional string default_string = 214 [default = "Hello, string"]; + optional string default_string = 214 [default = "Hello, string,def=foo"]; optional bytes default_bytes = 215 [default = "Hello, bytes"]; optional DefaultsMessage.DefaultsEnum default_enum = 216 [default = ONE]; } diff --git a/vendor/github.com/golang/protobuf/proto/testdata/Makefile b/vendor/github.com/golang/protobuf/proto/testdata/Makefile deleted file mode 100644 index fc288628a..000000000 --- a/vendor/github.com/golang/protobuf/proto/testdata/Makefile +++ /dev/null @@ -1,50 +0,0 @@ -# Go support for Protocol Buffers - Google's data interchange format -# -# Copyright 2010 The Go Authors. All rights reserved. -# https://github.com/golang/protobuf -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -include ../../Make.protobuf - -all: regenerate - -regenerate: - rm -f test.pb.go - make test.pb.go - -# The following rules are just aids to development. Not needed for typical testing. - -diff: regenerate - git diff test.pb.go - -restore: - cp test.pb.go.golden test.pb.go - -preserve: - cp test.pb.go test.pb.go.golden diff --git a/vendor/github.com/golang/protobuf/proto/testdata/test.pb.go b/vendor/github.com/golang/protobuf/proto/testdata/test.pb.go deleted file mode 100644 index e980d1a03..000000000 --- a/vendor/github.com/golang/protobuf/proto/testdata/test.pb.go +++ /dev/null @@ -1,4147 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: test.proto - -/* -Package testdata is a generated protocol buffer package. - -It is generated from these files: - test.proto - -It has these top-level messages: - GoEnum - GoTestField - GoTest - GoTestRequiredGroupField - GoSkipTest - NonPackedTest - PackedTest - MaxTag - OldMessage - NewMessage - InnerMessage - OtherMessage - RequiredInnerMessage - MyMessage - Ext - ComplexExtension - DefaultsMessage - MyMessageSet - Empty - MessageList - Strings - Defaults - SubDefaults - RepeatedEnum - MoreRepeated - GroupOld - GroupNew - FloatingPoint - MessageWithMap - Oneof - Communique -*/ -package testdata - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package - -type FOO int32 - -const ( - FOO_FOO1 FOO = 1 -) - -var FOO_name = map[int32]string{ - 1: "FOO1", -} -var FOO_value = map[string]int32{ - "FOO1": 1, -} - -func (x FOO) Enum() *FOO { - p := new(FOO) - *p = x - return p -} -func (x FOO) String() string { - return proto.EnumName(FOO_name, int32(x)) -} -func (x *FOO) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(FOO_value, data, "FOO") - if err != nil { - return err - } - *x = FOO(value) - return nil -} -func (FOO) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } - -// An enum, for completeness. -type GoTest_KIND int32 - -const ( - GoTest_VOID GoTest_KIND = 0 - // Basic types - GoTest_BOOL GoTest_KIND = 1 - GoTest_BYTES GoTest_KIND = 2 - GoTest_FINGERPRINT GoTest_KIND = 3 - GoTest_FLOAT GoTest_KIND = 4 - GoTest_INT GoTest_KIND = 5 - GoTest_STRING GoTest_KIND = 6 - GoTest_TIME GoTest_KIND = 7 - // Groupings - GoTest_TUPLE GoTest_KIND = 8 - GoTest_ARRAY GoTest_KIND = 9 - GoTest_MAP GoTest_KIND = 10 - // Table types - GoTest_TABLE GoTest_KIND = 11 - // Functions - GoTest_FUNCTION GoTest_KIND = 12 -) - -var GoTest_KIND_name = map[int32]string{ - 0: "VOID", - 1: "BOOL", - 2: "BYTES", - 3: "FINGERPRINT", - 4: "FLOAT", - 5: "INT", - 6: "STRING", - 7: "TIME", - 8: "TUPLE", - 9: "ARRAY", - 10: "MAP", - 11: "TABLE", - 12: "FUNCTION", -} -var GoTest_KIND_value = map[string]int32{ - "VOID": 0, - "BOOL": 1, - "BYTES": 2, - "FINGERPRINT": 3, - "FLOAT": 4, - "INT": 5, - "STRING": 6, - "TIME": 7, - "TUPLE": 8, - "ARRAY": 9, - "MAP": 10, - "TABLE": 11, - "FUNCTION": 12, -} - -func (x GoTest_KIND) Enum() *GoTest_KIND { - p := new(GoTest_KIND) - *p = x - return p -} -func (x GoTest_KIND) String() string { - return proto.EnumName(GoTest_KIND_name, int32(x)) -} -func (x *GoTest_KIND) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(GoTest_KIND_value, data, "GoTest_KIND") - if err != nil { - return err - } - *x = GoTest_KIND(value) - return nil -} -func (GoTest_KIND) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{2, 0} } - -type MyMessage_Color int32 - -const ( - MyMessage_RED MyMessage_Color = 0 - MyMessage_GREEN MyMessage_Color = 1 - MyMessage_BLUE MyMessage_Color = 2 -) - -var MyMessage_Color_name = map[int32]string{ - 0: "RED", - 1: "GREEN", - 2: "BLUE", -} -var MyMessage_Color_value = map[string]int32{ - "RED": 0, - "GREEN": 1, - "BLUE": 2, -} - -func (x MyMessage_Color) Enum() *MyMessage_Color { - p := new(MyMessage_Color) - *p = x - return p -} -func (x MyMessage_Color) String() string { - return proto.EnumName(MyMessage_Color_name, int32(x)) -} -func (x *MyMessage_Color) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(MyMessage_Color_value, data, "MyMessage_Color") - if err != nil { - return err - } - *x = MyMessage_Color(value) - return nil -} -func (MyMessage_Color) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{13, 0} } - -type DefaultsMessage_DefaultsEnum int32 - -const ( - DefaultsMessage_ZERO DefaultsMessage_DefaultsEnum = 0 - DefaultsMessage_ONE DefaultsMessage_DefaultsEnum = 1 - DefaultsMessage_TWO DefaultsMessage_DefaultsEnum = 2 -) - -var DefaultsMessage_DefaultsEnum_name = map[int32]string{ - 0: "ZERO", - 1: "ONE", - 2: "TWO", -} -var DefaultsMessage_DefaultsEnum_value = map[string]int32{ - "ZERO": 0, - "ONE": 1, - "TWO": 2, -} - -func (x DefaultsMessage_DefaultsEnum) Enum() *DefaultsMessage_DefaultsEnum { - p := new(DefaultsMessage_DefaultsEnum) - *p = x - return p -} -func (x DefaultsMessage_DefaultsEnum) String() string { - return proto.EnumName(DefaultsMessage_DefaultsEnum_name, int32(x)) -} -func (x *DefaultsMessage_DefaultsEnum) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(DefaultsMessage_DefaultsEnum_value, data, "DefaultsMessage_DefaultsEnum") - if err != nil { - return err - } - *x = DefaultsMessage_DefaultsEnum(value) - return nil -} -func (DefaultsMessage_DefaultsEnum) EnumDescriptor() ([]byte, []int) { - return fileDescriptor0, []int{16, 0} -} - -type Defaults_Color int32 - -const ( - Defaults_RED Defaults_Color = 0 - Defaults_GREEN Defaults_Color = 1 - Defaults_BLUE Defaults_Color = 2 -) - -var Defaults_Color_name = map[int32]string{ - 0: "RED", - 1: "GREEN", - 2: "BLUE", -} -var Defaults_Color_value = map[string]int32{ - "RED": 0, - "GREEN": 1, - "BLUE": 2, -} - -func (x Defaults_Color) Enum() *Defaults_Color { - p := new(Defaults_Color) - *p = x - return p -} -func (x Defaults_Color) String() string { - return proto.EnumName(Defaults_Color_name, int32(x)) -} -func (x *Defaults_Color) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(Defaults_Color_value, data, "Defaults_Color") - if err != nil { - return err - } - *x = Defaults_Color(value) - return nil -} -func (Defaults_Color) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{21, 0} } - -type RepeatedEnum_Color int32 - -const ( - RepeatedEnum_RED RepeatedEnum_Color = 1 -) - -var RepeatedEnum_Color_name = map[int32]string{ - 1: "RED", -} -var RepeatedEnum_Color_value = map[string]int32{ - "RED": 1, -} - -func (x RepeatedEnum_Color) Enum() *RepeatedEnum_Color { - p := new(RepeatedEnum_Color) - *p = x - return p -} -func (x RepeatedEnum_Color) String() string { - return proto.EnumName(RepeatedEnum_Color_name, int32(x)) -} -func (x *RepeatedEnum_Color) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(RepeatedEnum_Color_value, data, "RepeatedEnum_Color") - if err != nil { - return err - } - *x = RepeatedEnum_Color(value) - return nil -} -func (RepeatedEnum_Color) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{23, 0} } - -type GoEnum struct { - Foo *FOO `protobuf:"varint,1,req,name=foo,enum=testdata.FOO" json:"foo,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *GoEnum) Reset() { *m = GoEnum{} } -func (m *GoEnum) String() string { return proto.CompactTextString(m) } -func (*GoEnum) ProtoMessage() {} -func (*GoEnum) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } - -func (m *GoEnum) GetFoo() FOO { - if m != nil && m.Foo != nil { - return *m.Foo - } - return FOO_FOO1 -} - -type GoTestField struct { - Label *string `protobuf:"bytes,1,req,name=Label" json:"Label,omitempty"` - Type *string `protobuf:"bytes,2,req,name=Type" json:"Type,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *GoTestField) Reset() { *m = GoTestField{} } -func (m *GoTestField) String() string { return proto.CompactTextString(m) } -func (*GoTestField) ProtoMessage() {} -func (*GoTestField) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } - -func (m *GoTestField) GetLabel() string { - if m != nil && m.Label != nil { - return *m.Label - } - return "" -} - -func (m *GoTestField) GetType() string { - if m != nil && m.Type != nil { - return *m.Type - } - return "" -} - -type GoTest struct { - // Some typical parameters - Kind *GoTest_KIND `protobuf:"varint,1,req,name=Kind,enum=testdata.GoTest_KIND" json:"Kind,omitempty"` - Table *string `protobuf:"bytes,2,opt,name=Table" json:"Table,omitempty"` - Param *int32 `protobuf:"varint,3,opt,name=Param" json:"Param,omitempty"` - // Required, repeated and optional foreign fields. - RequiredField *GoTestField `protobuf:"bytes,4,req,name=RequiredField" json:"RequiredField,omitempty"` - RepeatedField []*GoTestField `protobuf:"bytes,5,rep,name=RepeatedField" json:"RepeatedField,omitempty"` - OptionalField *GoTestField `protobuf:"bytes,6,opt,name=OptionalField" json:"OptionalField,omitempty"` - // Required fields of all basic types - F_BoolRequired *bool `protobuf:"varint,10,req,name=F_Bool_required,json=FBoolRequired" json:"F_Bool_required,omitempty"` - F_Int32Required *int32 `protobuf:"varint,11,req,name=F_Int32_required,json=FInt32Required" json:"F_Int32_required,omitempty"` - F_Int64Required *int64 `protobuf:"varint,12,req,name=F_Int64_required,json=FInt64Required" json:"F_Int64_required,omitempty"` - F_Fixed32Required *uint32 `protobuf:"fixed32,13,req,name=F_Fixed32_required,json=FFixed32Required" json:"F_Fixed32_required,omitempty"` - F_Fixed64Required *uint64 `protobuf:"fixed64,14,req,name=F_Fixed64_required,json=FFixed64Required" json:"F_Fixed64_required,omitempty"` - F_Uint32Required *uint32 `protobuf:"varint,15,req,name=F_Uint32_required,json=FUint32Required" json:"F_Uint32_required,omitempty"` - F_Uint64Required *uint64 `protobuf:"varint,16,req,name=F_Uint64_required,json=FUint64Required" json:"F_Uint64_required,omitempty"` - F_FloatRequired *float32 `protobuf:"fixed32,17,req,name=F_Float_required,json=FFloatRequired" json:"F_Float_required,omitempty"` - F_DoubleRequired *float64 `protobuf:"fixed64,18,req,name=F_Double_required,json=FDoubleRequired" json:"F_Double_required,omitempty"` - F_StringRequired *string `protobuf:"bytes,19,req,name=F_String_required,json=FStringRequired" json:"F_String_required,omitempty"` - F_BytesRequired []byte `protobuf:"bytes,101,req,name=F_Bytes_required,json=FBytesRequired" json:"F_Bytes_required,omitempty"` - F_Sint32Required *int32 `protobuf:"zigzag32,102,req,name=F_Sint32_required,json=FSint32Required" json:"F_Sint32_required,omitempty"` - F_Sint64Required *int64 `protobuf:"zigzag64,103,req,name=F_Sint64_required,json=FSint64Required" json:"F_Sint64_required,omitempty"` - // Repeated fields of all basic types - F_BoolRepeated []bool `protobuf:"varint,20,rep,name=F_Bool_repeated,json=FBoolRepeated" json:"F_Bool_repeated,omitempty"` - F_Int32Repeated []int32 `protobuf:"varint,21,rep,name=F_Int32_repeated,json=FInt32Repeated" json:"F_Int32_repeated,omitempty"` - F_Int64Repeated []int64 `protobuf:"varint,22,rep,name=F_Int64_repeated,json=FInt64Repeated" json:"F_Int64_repeated,omitempty"` - F_Fixed32Repeated []uint32 `protobuf:"fixed32,23,rep,name=F_Fixed32_repeated,json=FFixed32Repeated" json:"F_Fixed32_repeated,omitempty"` - F_Fixed64Repeated []uint64 `protobuf:"fixed64,24,rep,name=F_Fixed64_repeated,json=FFixed64Repeated" json:"F_Fixed64_repeated,omitempty"` - F_Uint32Repeated []uint32 `protobuf:"varint,25,rep,name=F_Uint32_repeated,json=FUint32Repeated" json:"F_Uint32_repeated,omitempty"` - F_Uint64Repeated []uint64 `protobuf:"varint,26,rep,name=F_Uint64_repeated,json=FUint64Repeated" json:"F_Uint64_repeated,omitempty"` - F_FloatRepeated []float32 `protobuf:"fixed32,27,rep,name=F_Float_repeated,json=FFloatRepeated" json:"F_Float_repeated,omitempty"` - F_DoubleRepeated []float64 `protobuf:"fixed64,28,rep,name=F_Double_repeated,json=FDoubleRepeated" json:"F_Double_repeated,omitempty"` - F_StringRepeated []string `protobuf:"bytes,29,rep,name=F_String_repeated,json=FStringRepeated" json:"F_String_repeated,omitempty"` - F_BytesRepeated [][]byte `protobuf:"bytes,201,rep,name=F_Bytes_repeated,json=FBytesRepeated" json:"F_Bytes_repeated,omitempty"` - F_Sint32Repeated []int32 `protobuf:"zigzag32,202,rep,name=F_Sint32_repeated,json=FSint32Repeated" json:"F_Sint32_repeated,omitempty"` - F_Sint64Repeated []int64 `protobuf:"zigzag64,203,rep,name=F_Sint64_repeated,json=FSint64Repeated" json:"F_Sint64_repeated,omitempty"` - // Optional fields of all basic types - F_BoolOptional *bool `protobuf:"varint,30,opt,name=F_Bool_optional,json=FBoolOptional" json:"F_Bool_optional,omitempty"` - F_Int32Optional *int32 `protobuf:"varint,31,opt,name=F_Int32_optional,json=FInt32Optional" json:"F_Int32_optional,omitempty"` - F_Int64Optional *int64 `protobuf:"varint,32,opt,name=F_Int64_optional,json=FInt64Optional" json:"F_Int64_optional,omitempty"` - F_Fixed32Optional *uint32 `protobuf:"fixed32,33,opt,name=F_Fixed32_optional,json=FFixed32Optional" json:"F_Fixed32_optional,omitempty"` - F_Fixed64Optional *uint64 `protobuf:"fixed64,34,opt,name=F_Fixed64_optional,json=FFixed64Optional" json:"F_Fixed64_optional,omitempty"` - F_Uint32Optional *uint32 `protobuf:"varint,35,opt,name=F_Uint32_optional,json=FUint32Optional" json:"F_Uint32_optional,omitempty"` - F_Uint64Optional *uint64 `protobuf:"varint,36,opt,name=F_Uint64_optional,json=FUint64Optional" json:"F_Uint64_optional,omitempty"` - F_FloatOptional *float32 `protobuf:"fixed32,37,opt,name=F_Float_optional,json=FFloatOptional" json:"F_Float_optional,omitempty"` - F_DoubleOptional *float64 `protobuf:"fixed64,38,opt,name=F_Double_optional,json=FDoubleOptional" json:"F_Double_optional,omitempty"` - F_StringOptional *string `protobuf:"bytes,39,opt,name=F_String_optional,json=FStringOptional" json:"F_String_optional,omitempty"` - F_BytesOptional []byte `protobuf:"bytes,301,opt,name=F_Bytes_optional,json=FBytesOptional" json:"F_Bytes_optional,omitempty"` - F_Sint32Optional *int32 `protobuf:"zigzag32,302,opt,name=F_Sint32_optional,json=FSint32Optional" json:"F_Sint32_optional,omitempty"` - F_Sint64Optional *int64 `protobuf:"zigzag64,303,opt,name=F_Sint64_optional,json=FSint64Optional" json:"F_Sint64_optional,omitempty"` - // Default-valued fields of all basic types - F_BoolDefaulted *bool `protobuf:"varint,40,opt,name=F_Bool_defaulted,json=FBoolDefaulted,def=1" json:"F_Bool_defaulted,omitempty"` - F_Int32Defaulted *int32 `protobuf:"varint,41,opt,name=F_Int32_defaulted,json=FInt32Defaulted,def=32" json:"F_Int32_defaulted,omitempty"` - F_Int64Defaulted *int64 `protobuf:"varint,42,opt,name=F_Int64_defaulted,json=FInt64Defaulted,def=64" json:"F_Int64_defaulted,omitempty"` - F_Fixed32Defaulted *uint32 `protobuf:"fixed32,43,opt,name=F_Fixed32_defaulted,json=FFixed32Defaulted,def=320" json:"F_Fixed32_defaulted,omitempty"` - F_Fixed64Defaulted *uint64 `protobuf:"fixed64,44,opt,name=F_Fixed64_defaulted,json=FFixed64Defaulted,def=640" json:"F_Fixed64_defaulted,omitempty"` - F_Uint32Defaulted *uint32 `protobuf:"varint,45,opt,name=F_Uint32_defaulted,json=FUint32Defaulted,def=3200" json:"F_Uint32_defaulted,omitempty"` - F_Uint64Defaulted *uint64 `protobuf:"varint,46,opt,name=F_Uint64_defaulted,json=FUint64Defaulted,def=6400" json:"F_Uint64_defaulted,omitempty"` - F_FloatDefaulted *float32 `protobuf:"fixed32,47,opt,name=F_Float_defaulted,json=FFloatDefaulted,def=314159" json:"F_Float_defaulted,omitempty"` - F_DoubleDefaulted *float64 `protobuf:"fixed64,48,opt,name=F_Double_defaulted,json=FDoubleDefaulted,def=271828" json:"F_Double_defaulted,omitempty"` - F_StringDefaulted *string `protobuf:"bytes,49,opt,name=F_String_defaulted,json=FStringDefaulted,def=hello, \"world!\"\n" json:"F_String_defaulted,omitempty"` - F_BytesDefaulted []byte `protobuf:"bytes,401,opt,name=F_Bytes_defaulted,json=FBytesDefaulted,def=Bignose" json:"F_Bytes_defaulted,omitempty"` - F_Sint32Defaulted *int32 `protobuf:"zigzag32,402,opt,name=F_Sint32_defaulted,json=FSint32Defaulted,def=-32" json:"F_Sint32_defaulted,omitempty"` - F_Sint64Defaulted *int64 `protobuf:"zigzag64,403,opt,name=F_Sint64_defaulted,json=FSint64Defaulted,def=-64" json:"F_Sint64_defaulted,omitempty"` - // Packed repeated fields (no string or bytes). - F_BoolRepeatedPacked []bool `protobuf:"varint,50,rep,packed,name=F_Bool_repeated_packed,json=FBoolRepeatedPacked" json:"F_Bool_repeated_packed,omitempty"` - F_Int32RepeatedPacked []int32 `protobuf:"varint,51,rep,packed,name=F_Int32_repeated_packed,json=FInt32RepeatedPacked" json:"F_Int32_repeated_packed,omitempty"` - F_Int64RepeatedPacked []int64 `protobuf:"varint,52,rep,packed,name=F_Int64_repeated_packed,json=FInt64RepeatedPacked" json:"F_Int64_repeated_packed,omitempty"` - F_Fixed32RepeatedPacked []uint32 `protobuf:"fixed32,53,rep,packed,name=F_Fixed32_repeated_packed,json=FFixed32RepeatedPacked" json:"F_Fixed32_repeated_packed,omitempty"` - F_Fixed64RepeatedPacked []uint64 `protobuf:"fixed64,54,rep,packed,name=F_Fixed64_repeated_packed,json=FFixed64RepeatedPacked" json:"F_Fixed64_repeated_packed,omitempty"` - F_Uint32RepeatedPacked []uint32 `protobuf:"varint,55,rep,packed,name=F_Uint32_repeated_packed,json=FUint32RepeatedPacked" json:"F_Uint32_repeated_packed,omitempty"` - F_Uint64RepeatedPacked []uint64 `protobuf:"varint,56,rep,packed,name=F_Uint64_repeated_packed,json=FUint64RepeatedPacked" json:"F_Uint64_repeated_packed,omitempty"` - F_FloatRepeatedPacked []float32 `protobuf:"fixed32,57,rep,packed,name=F_Float_repeated_packed,json=FFloatRepeatedPacked" json:"F_Float_repeated_packed,omitempty"` - F_DoubleRepeatedPacked []float64 `protobuf:"fixed64,58,rep,packed,name=F_Double_repeated_packed,json=FDoubleRepeatedPacked" json:"F_Double_repeated_packed,omitempty"` - F_Sint32RepeatedPacked []int32 `protobuf:"zigzag32,502,rep,packed,name=F_Sint32_repeated_packed,json=FSint32RepeatedPacked" json:"F_Sint32_repeated_packed,omitempty"` - F_Sint64RepeatedPacked []int64 `protobuf:"zigzag64,503,rep,packed,name=F_Sint64_repeated_packed,json=FSint64RepeatedPacked" json:"F_Sint64_repeated_packed,omitempty"` - Requiredgroup *GoTest_RequiredGroup `protobuf:"group,70,req,name=RequiredGroup,json=requiredgroup" json:"requiredgroup,omitempty"` - Repeatedgroup []*GoTest_RepeatedGroup `protobuf:"group,80,rep,name=RepeatedGroup,json=repeatedgroup" json:"repeatedgroup,omitempty"` - Optionalgroup *GoTest_OptionalGroup `protobuf:"group,90,opt,name=OptionalGroup,json=optionalgroup" json:"optionalgroup,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *GoTest) Reset() { *m = GoTest{} } -func (m *GoTest) String() string { return proto.CompactTextString(m) } -func (*GoTest) ProtoMessage() {} -func (*GoTest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } - -const Default_GoTest_F_BoolDefaulted bool = true -const Default_GoTest_F_Int32Defaulted int32 = 32 -const Default_GoTest_F_Int64Defaulted int64 = 64 -const Default_GoTest_F_Fixed32Defaulted uint32 = 320 -const Default_GoTest_F_Fixed64Defaulted uint64 = 640 -const Default_GoTest_F_Uint32Defaulted uint32 = 3200 -const Default_GoTest_F_Uint64Defaulted uint64 = 6400 -const Default_GoTest_F_FloatDefaulted float32 = 314159 -const Default_GoTest_F_DoubleDefaulted float64 = 271828 -const Default_GoTest_F_StringDefaulted string = "hello, \"world!\"\n" - -var Default_GoTest_F_BytesDefaulted []byte = []byte("Bignose") - -const Default_GoTest_F_Sint32Defaulted int32 = -32 -const Default_GoTest_F_Sint64Defaulted int64 = -64 - -func (m *GoTest) GetKind() GoTest_KIND { - if m != nil && m.Kind != nil { - return *m.Kind - } - return GoTest_VOID -} - -func (m *GoTest) GetTable() string { - if m != nil && m.Table != nil { - return *m.Table - } - return "" -} - -func (m *GoTest) GetParam() int32 { - if m != nil && m.Param != nil { - return *m.Param - } - return 0 -} - -func (m *GoTest) GetRequiredField() *GoTestField { - if m != nil { - return m.RequiredField - } - return nil -} - -func (m *GoTest) GetRepeatedField() []*GoTestField { - if m != nil { - return m.RepeatedField - } - return nil -} - -func (m *GoTest) GetOptionalField() *GoTestField { - if m != nil { - return m.OptionalField - } - return nil -} - -func (m *GoTest) GetF_BoolRequired() bool { - if m != nil && m.F_BoolRequired != nil { - return *m.F_BoolRequired - } - return false -} - -func (m *GoTest) GetF_Int32Required() int32 { - if m != nil && m.F_Int32Required != nil { - return *m.F_Int32Required - } - return 0 -} - -func (m *GoTest) GetF_Int64Required() int64 { - if m != nil && m.F_Int64Required != nil { - return *m.F_Int64Required - } - return 0 -} - -func (m *GoTest) GetF_Fixed32Required() uint32 { - if m != nil && m.F_Fixed32Required != nil { - return *m.F_Fixed32Required - } - return 0 -} - -func (m *GoTest) GetF_Fixed64Required() uint64 { - if m != nil && m.F_Fixed64Required != nil { - return *m.F_Fixed64Required - } - return 0 -} - -func (m *GoTest) GetF_Uint32Required() uint32 { - if m != nil && m.F_Uint32Required != nil { - return *m.F_Uint32Required - } - return 0 -} - -func (m *GoTest) GetF_Uint64Required() uint64 { - if m != nil && m.F_Uint64Required != nil { - return *m.F_Uint64Required - } - return 0 -} - -func (m *GoTest) GetF_FloatRequired() float32 { - if m != nil && m.F_FloatRequired != nil { - return *m.F_FloatRequired - } - return 0 -} - -func (m *GoTest) GetF_DoubleRequired() float64 { - if m != nil && m.F_DoubleRequired != nil { - return *m.F_DoubleRequired - } - return 0 -} - -func (m *GoTest) GetF_StringRequired() string { - if m != nil && m.F_StringRequired != nil { - return *m.F_StringRequired - } - return "" -} - -func (m *GoTest) GetF_BytesRequired() []byte { - if m != nil { - return m.F_BytesRequired - } - return nil -} - -func (m *GoTest) GetF_Sint32Required() int32 { - if m != nil && m.F_Sint32Required != nil { - return *m.F_Sint32Required - } - return 0 -} - -func (m *GoTest) GetF_Sint64Required() int64 { - if m != nil && m.F_Sint64Required != nil { - return *m.F_Sint64Required - } - return 0 -} - -func (m *GoTest) GetF_BoolRepeated() []bool { - if m != nil { - return m.F_BoolRepeated - } - return nil -} - -func (m *GoTest) GetF_Int32Repeated() []int32 { - if m != nil { - return m.F_Int32Repeated - } - return nil -} - -func (m *GoTest) GetF_Int64Repeated() []int64 { - if m != nil { - return m.F_Int64Repeated - } - return nil -} - -func (m *GoTest) GetF_Fixed32Repeated() []uint32 { - if m != nil { - return m.F_Fixed32Repeated - } - return nil -} - -func (m *GoTest) GetF_Fixed64Repeated() []uint64 { - if m != nil { - return m.F_Fixed64Repeated - } - return nil -} - -func (m *GoTest) GetF_Uint32Repeated() []uint32 { - if m != nil { - return m.F_Uint32Repeated - } - return nil -} - -func (m *GoTest) GetF_Uint64Repeated() []uint64 { - if m != nil { - return m.F_Uint64Repeated - } - return nil -} - -func (m *GoTest) GetF_FloatRepeated() []float32 { - if m != nil { - return m.F_FloatRepeated - } - return nil -} - -func (m *GoTest) GetF_DoubleRepeated() []float64 { - if m != nil { - return m.F_DoubleRepeated - } - return nil -} - -func (m *GoTest) GetF_StringRepeated() []string { - if m != nil { - return m.F_StringRepeated - } - return nil -} - -func (m *GoTest) GetF_BytesRepeated() [][]byte { - if m != nil { - return m.F_BytesRepeated - } - return nil -} - -func (m *GoTest) GetF_Sint32Repeated() []int32 { - if m != nil { - return m.F_Sint32Repeated - } - return nil -} - -func (m *GoTest) GetF_Sint64Repeated() []int64 { - if m != nil { - return m.F_Sint64Repeated - } - return nil -} - -func (m *GoTest) GetF_BoolOptional() bool { - if m != nil && m.F_BoolOptional != nil { - return *m.F_BoolOptional - } - return false -} - -func (m *GoTest) GetF_Int32Optional() int32 { - if m != nil && m.F_Int32Optional != nil { - return *m.F_Int32Optional - } - return 0 -} - -func (m *GoTest) GetF_Int64Optional() int64 { - if m != nil && m.F_Int64Optional != nil { - return *m.F_Int64Optional - } - return 0 -} - -func (m *GoTest) GetF_Fixed32Optional() uint32 { - if m != nil && m.F_Fixed32Optional != nil { - return *m.F_Fixed32Optional - } - return 0 -} - -func (m *GoTest) GetF_Fixed64Optional() uint64 { - if m != nil && m.F_Fixed64Optional != nil { - return *m.F_Fixed64Optional - } - return 0 -} - -func (m *GoTest) GetF_Uint32Optional() uint32 { - if m != nil && m.F_Uint32Optional != nil { - return *m.F_Uint32Optional - } - return 0 -} - -func (m *GoTest) GetF_Uint64Optional() uint64 { - if m != nil && m.F_Uint64Optional != nil { - return *m.F_Uint64Optional - } - return 0 -} - -func (m *GoTest) GetF_FloatOptional() float32 { - if m != nil && m.F_FloatOptional != nil { - return *m.F_FloatOptional - } - return 0 -} - -func (m *GoTest) GetF_DoubleOptional() float64 { - if m != nil && m.F_DoubleOptional != nil { - return *m.F_DoubleOptional - } - return 0 -} - -func (m *GoTest) GetF_StringOptional() string { - if m != nil && m.F_StringOptional != nil { - return *m.F_StringOptional - } - return "" -} - -func (m *GoTest) GetF_BytesOptional() []byte { - if m != nil { - return m.F_BytesOptional - } - return nil -} - -func (m *GoTest) GetF_Sint32Optional() int32 { - if m != nil && m.F_Sint32Optional != nil { - return *m.F_Sint32Optional - } - return 0 -} - -func (m *GoTest) GetF_Sint64Optional() int64 { - if m != nil && m.F_Sint64Optional != nil { - return *m.F_Sint64Optional - } - return 0 -} - -func (m *GoTest) GetF_BoolDefaulted() bool { - if m != nil && m.F_BoolDefaulted != nil { - return *m.F_BoolDefaulted - } - return Default_GoTest_F_BoolDefaulted -} - -func (m *GoTest) GetF_Int32Defaulted() int32 { - if m != nil && m.F_Int32Defaulted != nil { - return *m.F_Int32Defaulted - } - return Default_GoTest_F_Int32Defaulted -} - -func (m *GoTest) GetF_Int64Defaulted() int64 { - if m != nil && m.F_Int64Defaulted != nil { - return *m.F_Int64Defaulted - } - return Default_GoTest_F_Int64Defaulted -} - -func (m *GoTest) GetF_Fixed32Defaulted() uint32 { - if m != nil && m.F_Fixed32Defaulted != nil { - return *m.F_Fixed32Defaulted - } - return Default_GoTest_F_Fixed32Defaulted -} - -func (m *GoTest) GetF_Fixed64Defaulted() uint64 { - if m != nil && m.F_Fixed64Defaulted != nil { - return *m.F_Fixed64Defaulted - } - return Default_GoTest_F_Fixed64Defaulted -} - -func (m *GoTest) GetF_Uint32Defaulted() uint32 { - if m != nil && m.F_Uint32Defaulted != nil { - return *m.F_Uint32Defaulted - } - return Default_GoTest_F_Uint32Defaulted -} - -func (m *GoTest) GetF_Uint64Defaulted() uint64 { - if m != nil && m.F_Uint64Defaulted != nil { - return *m.F_Uint64Defaulted - } - return Default_GoTest_F_Uint64Defaulted -} - -func (m *GoTest) GetF_FloatDefaulted() float32 { - if m != nil && m.F_FloatDefaulted != nil { - return *m.F_FloatDefaulted - } - return Default_GoTest_F_FloatDefaulted -} - -func (m *GoTest) GetF_DoubleDefaulted() float64 { - if m != nil && m.F_DoubleDefaulted != nil { - return *m.F_DoubleDefaulted - } - return Default_GoTest_F_DoubleDefaulted -} - -func (m *GoTest) GetF_StringDefaulted() string { - if m != nil && m.F_StringDefaulted != nil { - return *m.F_StringDefaulted - } - return Default_GoTest_F_StringDefaulted -} - -func (m *GoTest) GetF_BytesDefaulted() []byte { - if m != nil && m.F_BytesDefaulted != nil { - return m.F_BytesDefaulted - } - return append([]byte(nil), Default_GoTest_F_BytesDefaulted...) -} - -func (m *GoTest) GetF_Sint32Defaulted() int32 { - if m != nil && m.F_Sint32Defaulted != nil { - return *m.F_Sint32Defaulted - } - return Default_GoTest_F_Sint32Defaulted -} - -func (m *GoTest) GetF_Sint64Defaulted() int64 { - if m != nil && m.F_Sint64Defaulted != nil { - return *m.F_Sint64Defaulted - } - return Default_GoTest_F_Sint64Defaulted -} - -func (m *GoTest) GetF_BoolRepeatedPacked() []bool { - if m != nil { - return m.F_BoolRepeatedPacked - } - return nil -} - -func (m *GoTest) GetF_Int32RepeatedPacked() []int32 { - if m != nil { - return m.F_Int32RepeatedPacked - } - return nil -} - -func (m *GoTest) GetF_Int64RepeatedPacked() []int64 { - if m != nil { - return m.F_Int64RepeatedPacked - } - return nil -} - -func (m *GoTest) GetF_Fixed32RepeatedPacked() []uint32 { - if m != nil { - return m.F_Fixed32RepeatedPacked - } - return nil -} - -func (m *GoTest) GetF_Fixed64RepeatedPacked() []uint64 { - if m != nil { - return m.F_Fixed64RepeatedPacked - } - return nil -} - -func (m *GoTest) GetF_Uint32RepeatedPacked() []uint32 { - if m != nil { - return m.F_Uint32RepeatedPacked - } - return nil -} - -func (m *GoTest) GetF_Uint64RepeatedPacked() []uint64 { - if m != nil { - return m.F_Uint64RepeatedPacked - } - return nil -} - -func (m *GoTest) GetF_FloatRepeatedPacked() []float32 { - if m != nil { - return m.F_FloatRepeatedPacked - } - return nil -} - -func (m *GoTest) GetF_DoubleRepeatedPacked() []float64 { - if m != nil { - return m.F_DoubleRepeatedPacked - } - return nil -} - -func (m *GoTest) GetF_Sint32RepeatedPacked() []int32 { - if m != nil { - return m.F_Sint32RepeatedPacked - } - return nil -} - -func (m *GoTest) GetF_Sint64RepeatedPacked() []int64 { - if m != nil { - return m.F_Sint64RepeatedPacked - } - return nil -} - -func (m *GoTest) GetRequiredgroup() *GoTest_RequiredGroup { - if m != nil { - return m.Requiredgroup - } - return nil -} - -func (m *GoTest) GetRepeatedgroup() []*GoTest_RepeatedGroup { - if m != nil { - return m.Repeatedgroup - } - return nil -} - -func (m *GoTest) GetOptionalgroup() *GoTest_OptionalGroup { - if m != nil { - return m.Optionalgroup - } - return nil -} - -// Required, repeated, and optional groups. -type GoTest_RequiredGroup struct { - RequiredField *string `protobuf:"bytes,71,req,name=RequiredField" json:"RequiredField,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *GoTest_RequiredGroup) Reset() { *m = GoTest_RequiredGroup{} } -func (m *GoTest_RequiredGroup) String() string { return proto.CompactTextString(m) } -func (*GoTest_RequiredGroup) ProtoMessage() {} -func (*GoTest_RequiredGroup) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2, 0} } - -func (m *GoTest_RequiredGroup) GetRequiredField() string { - if m != nil && m.RequiredField != nil { - return *m.RequiredField - } - return "" -} - -type GoTest_RepeatedGroup struct { - RequiredField *string `protobuf:"bytes,81,req,name=RequiredField" json:"RequiredField,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *GoTest_RepeatedGroup) Reset() { *m = GoTest_RepeatedGroup{} } -func (m *GoTest_RepeatedGroup) String() string { return proto.CompactTextString(m) } -func (*GoTest_RepeatedGroup) ProtoMessage() {} -func (*GoTest_RepeatedGroup) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2, 1} } - -func (m *GoTest_RepeatedGroup) GetRequiredField() string { - if m != nil && m.RequiredField != nil { - return *m.RequiredField - } - return "" -} - -type GoTest_OptionalGroup struct { - RequiredField *string `protobuf:"bytes,91,req,name=RequiredField" json:"RequiredField,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *GoTest_OptionalGroup) Reset() { *m = GoTest_OptionalGroup{} } -func (m *GoTest_OptionalGroup) String() string { return proto.CompactTextString(m) } -func (*GoTest_OptionalGroup) ProtoMessage() {} -func (*GoTest_OptionalGroup) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2, 2} } - -func (m *GoTest_OptionalGroup) GetRequiredField() string { - if m != nil && m.RequiredField != nil { - return *m.RequiredField - } - return "" -} - -// For testing a group containing a required field. -type GoTestRequiredGroupField struct { - Group *GoTestRequiredGroupField_Group `protobuf:"group,1,req,name=Group,json=group" json:"group,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *GoTestRequiredGroupField) Reset() { *m = GoTestRequiredGroupField{} } -func (m *GoTestRequiredGroupField) String() string { return proto.CompactTextString(m) } -func (*GoTestRequiredGroupField) ProtoMessage() {} -func (*GoTestRequiredGroupField) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } - -func (m *GoTestRequiredGroupField) GetGroup() *GoTestRequiredGroupField_Group { - if m != nil { - return m.Group - } - return nil -} - -type GoTestRequiredGroupField_Group struct { - Field *int32 `protobuf:"varint,2,req,name=Field" json:"Field,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *GoTestRequiredGroupField_Group) Reset() { *m = GoTestRequiredGroupField_Group{} } -func (m *GoTestRequiredGroupField_Group) String() string { return proto.CompactTextString(m) } -func (*GoTestRequiredGroupField_Group) ProtoMessage() {} -func (*GoTestRequiredGroupField_Group) Descriptor() ([]byte, []int) { - return fileDescriptor0, []int{3, 0} -} - -func (m *GoTestRequiredGroupField_Group) GetField() int32 { - if m != nil && m.Field != nil { - return *m.Field - } - return 0 -} - -// For testing skipping of unrecognized fields. -// Numbers are all big, larger than tag numbers in GoTestField, -// the message used in the corresponding test. -type GoSkipTest struct { - SkipInt32 *int32 `protobuf:"varint,11,req,name=skip_int32,json=skipInt32" json:"skip_int32,omitempty"` - SkipFixed32 *uint32 `protobuf:"fixed32,12,req,name=skip_fixed32,json=skipFixed32" json:"skip_fixed32,omitempty"` - SkipFixed64 *uint64 `protobuf:"fixed64,13,req,name=skip_fixed64,json=skipFixed64" json:"skip_fixed64,omitempty"` - SkipString *string `protobuf:"bytes,14,req,name=skip_string,json=skipString" json:"skip_string,omitempty"` - Skipgroup *GoSkipTest_SkipGroup `protobuf:"group,15,req,name=SkipGroup,json=skipgroup" json:"skipgroup,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *GoSkipTest) Reset() { *m = GoSkipTest{} } -func (m *GoSkipTest) String() string { return proto.CompactTextString(m) } -func (*GoSkipTest) ProtoMessage() {} -func (*GoSkipTest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} } - -func (m *GoSkipTest) GetSkipInt32() int32 { - if m != nil && m.SkipInt32 != nil { - return *m.SkipInt32 - } - return 0 -} - -func (m *GoSkipTest) GetSkipFixed32() uint32 { - if m != nil && m.SkipFixed32 != nil { - return *m.SkipFixed32 - } - return 0 -} - -func (m *GoSkipTest) GetSkipFixed64() uint64 { - if m != nil && m.SkipFixed64 != nil { - return *m.SkipFixed64 - } - return 0 -} - -func (m *GoSkipTest) GetSkipString() string { - if m != nil && m.SkipString != nil { - return *m.SkipString - } - return "" -} - -func (m *GoSkipTest) GetSkipgroup() *GoSkipTest_SkipGroup { - if m != nil { - return m.Skipgroup - } - return nil -} - -type GoSkipTest_SkipGroup struct { - GroupInt32 *int32 `protobuf:"varint,16,req,name=group_int32,json=groupInt32" json:"group_int32,omitempty"` - GroupString *string `protobuf:"bytes,17,req,name=group_string,json=groupString" json:"group_string,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *GoSkipTest_SkipGroup) Reset() { *m = GoSkipTest_SkipGroup{} } -func (m *GoSkipTest_SkipGroup) String() string { return proto.CompactTextString(m) } -func (*GoSkipTest_SkipGroup) ProtoMessage() {} -func (*GoSkipTest_SkipGroup) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4, 0} } - -func (m *GoSkipTest_SkipGroup) GetGroupInt32() int32 { - if m != nil && m.GroupInt32 != nil { - return *m.GroupInt32 - } - return 0 -} - -func (m *GoSkipTest_SkipGroup) GetGroupString() string { - if m != nil && m.GroupString != nil { - return *m.GroupString - } - return "" -} - -// For testing packed/non-packed decoder switching. -// A serialized instance of one should be deserializable as the other. -type NonPackedTest struct { - A []int32 `protobuf:"varint,1,rep,name=a" json:"a,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *NonPackedTest) Reset() { *m = NonPackedTest{} } -func (m *NonPackedTest) String() string { return proto.CompactTextString(m) } -func (*NonPackedTest) ProtoMessage() {} -func (*NonPackedTest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} } - -func (m *NonPackedTest) GetA() []int32 { - if m != nil { - return m.A - } - return nil -} - -type PackedTest struct { - B []int32 `protobuf:"varint,1,rep,packed,name=b" json:"b,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *PackedTest) Reset() { *m = PackedTest{} } -func (m *PackedTest) String() string { return proto.CompactTextString(m) } -func (*PackedTest) ProtoMessage() {} -func (*PackedTest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} } - -func (m *PackedTest) GetB() []int32 { - if m != nil { - return m.B - } - return nil -} - -type MaxTag struct { - // Maximum possible tag number. - LastField *string `protobuf:"bytes,536870911,opt,name=last_field,json=lastField" json:"last_field,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *MaxTag) Reset() { *m = MaxTag{} } -func (m *MaxTag) String() string { return proto.CompactTextString(m) } -func (*MaxTag) ProtoMessage() {} -func (*MaxTag) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} } - -func (m *MaxTag) GetLastField() string { - if m != nil && m.LastField != nil { - return *m.LastField - } - return "" -} - -type OldMessage struct { - Nested *OldMessage_Nested `protobuf:"bytes,1,opt,name=nested" json:"nested,omitempty"` - Num *int32 `protobuf:"varint,2,opt,name=num" json:"num,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *OldMessage) Reset() { *m = OldMessage{} } -func (m *OldMessage) String() string { return proto.CompactTextString(m) } -func (*OldMessage) ProtoMessage() {} -func (*OldMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} } - -func (m *OldMessage) GetNested() *OldMessage_Nested { - if m != nil { - return m.Nested - } - return nil -} - -func (m *OldMessage) GetNum() int32 { - if m != nil && m.Num != nil { - return *m.Num - } - return 0 -} - -type OldMessage_Nested struct { - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *OldMessage_Nested) Reset() { *m = OldMessage_Nested{} } -func (m *OldMessage_Nested) String() string { return proto.CompactTextString(m) } -func (*OldMessage_Nested) ProtoMessage() {} -func (*OldMessage_Nested) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8, 0} } - -func (m *OldMessage_Nested) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -// NewMessage is wire compatible with OldMessage; -// imagine it as a future version. -type NewMessage struct { - Nested *NewMessage_Nested `protobuf:"bytes,1,opt,name=nested" json:"nested,omitempty"` - // This is an int32 in OldMessage. - Num *int64 `protobuf:"varint,2,opt,name=num" json:"num,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *NewMessage) Reset() { *m = NewMessage{} } -func (m *NewMessage) String() string { return proto.CompactTextString(m) } -func (*NewMessage) ProtoMessage() {} -func (*NewMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} } - -func (m *NewMessage) GetNested() *NewMessage_Nested { - if m != nil { - return m.Nested - } - return nil -} - -func (m *NewMessage) GetNum() int64 { - if m != nil && m.Num != nil { - return *m.Num - } - return 0 -} - -type NewMessage_Nested struct { - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - FoodGroup *string `protobuf:"bytes,2,opt,name=food_group,json=foodGroup" json:"food_group,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *NewMessage_Nested) Reset() { *m = NewMessage_Nested{} } -func (m *NewMessage_Nested) String() string { return proto.CompactTextString(m) } -func (*NewMessage_Nested) ProtoMessage() {} -func (*NewMessage_Nested) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9, 0} } - -func (m *NewMessage_Nested) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *NewMessage_Nested) GetFoodGroup() string { - if m != nil && m.FoodGroup != nil { - return *m.FoodGroup - } - return "" -} - -type InnerMessage struct { - Host *string `protobuf:"bytes,1,req,name=host" json:"host,omitempty"` - Port *int32 `protobuf:"varint,2,opt,name=port,def=4000" json:"port,omitempty"` - Connected *bool `protobuf:"varint,3,opt,name=connected" json:"connected,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *InnerMessage) Reset() { *m = InnerMessage{} } -func (m *InnerMessage) String() string { return proto.CompactTextString(m) } -func (*InnerMessage) ProtoMessage() {} -func (*InnerMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10} } - -const Default_InnerMessage_Port int32 = 4000 - -func (m *InnerMessage) GetHost() string { - if m != nil && m.Host != nil { - return *m.Host - } - return "" -} - -func (m *InnerMessage) GetPort() int32 { - if m != nil && m.Port != nil { - return *m.Port - } - return Default_InnerMessage_Port -} - -func (m *InnerMessage) GetConnected() bool { - if m != nil && m.Connected != nil { - return *m.Connected - } - return false -} - -type OtherMessage struct { - Key *int64 `protobuf:"varint,1,opt,name=key" json:"key,omitempty"` - Value []byte `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"` - Weight *float32 `protobuf:"fixed32,3,opt,name=weight" json:"weight,omitempty"` - Inner *InnerMessage `protobuf:"bytes,4,opt,name=inner" json:"inner,omitempty"` - proto.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *OtherMessage) Reset() { *m = OtherMessage{} } -func (m *OtherMessage) String() string { return proto.CompactTextString(m) } -func (*OtherMessage) ProtoMessage() {} -func (*OtherMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{11} } - -var extRange_OtherMessage = []proto.ExtensionRange{ - {100, 536870911}, -} - -func (*OtherMessage) ExtensionRangeArray() []proto.ExtensionRange { - return extRange_OtherMessage -} - -func (m *OtherMessage) GetKey() int64 { - if m != nil && m.Key != nil { - return *m.Key - } - return 0 -} - -func (m *OtherMessage) GetValue() []byte { - if m != nil { - return m.Value - } - return nil -} - -func (m *OtherMessage) GetWeight() float32 { - if m != nil && m.Weight != nil { - return *m.Weight - } - return 0 -} - -func (m *OtherMessage) GetInner() *InnerMessage { - if m != nil { - return m.Inner - } - return nil -} - -type RequiredInnerMessage struct { - LeoFinallyWonAnOscar *InnerMessage `protobuf:"bytes,1,req,name=leo_finally_won_an_oscar,json=leoFinallyWonAnOscar" json:"leo_finally_won_an_oscar,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *RequiredInnerMessage) Reset() { *m = RequiredInnerMessage{} } -func (m *RequiredInnerMessage) String() string { return proto.CompactTextString(m) } -func (*RequiredInnerMessage) ProtoMessage() {} -func (*RequiredInnerMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{12} } - -func (m *RequiredInnerMessage) GetLeoFinallyWonAnOscar() *InnerMessage { - if m != nil { - return m.LeoFinallyWonAnOscar - } - return nil -} - -type MyMessage struct { - Count *int32 `protobuf:"varint,1,req,name=count" json:"count,omitempty"` - Name *string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"` - Quote *string `protobuf:"bytes,3,opt,name=quote" json:"quote,omitempty"` - Pet []string `protobuf:"bytes,4,rep,name=pet" json:"pet,omitempty"` - Inner *InnerMessage `protobuf:"bytes,5,opt,name=inner" json:"inner,omitempty"` - Others []*OtherMessage `protobuf:"bytes,6,rep,name=others" json:"others,omitempty"` - WeMustGoDeeper *RequiredInnerMessage `protobuf:"bytes,13,opt,name=we_must_go_deeper,json=weMustGoDeeper" json:"we_must_go_deeper,omitempty"` - RepInner []*InnerMessage `protobuf:"bytes,12,rep,name=rep_inner,json=repInner" json:"rep_inner,omitempty"` - Bikeshed *MyMessage_Color `protobuf:"varint,7,opt,name=bikeshed,enum=testdata.MyMessage_Color" json:"bikeshed,omitempty"` - Somegroup *MyMessage_SomeGroup `protobuf:"group,8,opt,name=SomeGroup,json=somegroup" json:"somegroup,omitempty"` - // This field becomes [][]byte in the generated code. - RepBytes [][]byte `protobuf:"bytes,10,rep,name=rep_bytes,json=repBytes" json:"rep_bytes,omitempty"` - Bigfloat *float64 `protobuf:"fixed64,11,opt,name=bigfloat" json:"bigfloat,omitempty"` - proto.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *MyMessage) Reset() { *m = MyMessage{} } -func (m *MyMessage) String() string { return proto.CompactTextString(m) } -func (*MyMessage) ProtoMessage() {} -func (*MyMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{13} } - -var extRange_MyMessage = []proto.ExtensionRange{ - {100, 536870911}, -} - -func (*MyMessage) ExtensionRangeArray() []proto.ExtensionRange { - return extRange_MyMessage -} - -func (m *MyMessage) GetCount() int32 { - if m != nil && m.Count != nil { - return *m.Count - } - return 0 -} - -func (m *MyMessage) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *MyMessage) GetQuote() string { - if m != nil && m.Quote != nil { - return *m.Quote - } - return "" -} - -func (m *MyMessage) GetPet() []string { - if m != nil { - return m.Pet - } - return nil -} - -func (m *MyMessage) GetInner() *InnerMessage { - if m != nil { - return m.Inner - } - return nil -} - -func (m *MyMessage) GetOthers() []*OtherMessage { - if m != nil { - return m.Others - } - return nil -} - -func (m *MyMessage) GetWeMustGoDeeper() *RequiredInnerMessage { - if m != nil { - return m.WeMustGoDeeper - } - return nil -} - -func (m *MyMessage) GetRepInner() []*InnerMessage { - if m != nil { - return m.RepInner - } - return nil -} - -func (m *MyMessage) GetBikeshed() MyMessage_Color { - if m != nil && m.Bikeshed != nil { - return *m.Bikeshed - } - return MyMessage_RED -} - -func (m *MyMessage) GetSomegroup() *MyMessage_SomeGroup { - if m != nil { - return m.Somegroup - } - return nil -} - -func (m *MyMessage) GetRepBytes() [][]byte { - if m != nil { - return m.RepBytes - } - return nil -} - -func (m *MyMessage) GetBigfloat() float64 { - if m != nil && m.Bigfloat != nil { - return *m.Bigfloat - } - return 0 -} - -type MyMessage_SomeGroup struct { - GroupField *int32 `protobuf:"varint,9,opt,name=group_field,json=groupField" json:"group_field,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *MyMessage_SomeGroup) Reset() { *m = MyMessage_SomeGroup{} } -func (m *MyMessage_SomeGroup) String() string { return proto.CompactTextString(m) } -func (*MyMessage_SomeGroup) ProtoMessage() {} -func (*MyMessage_SomeGroup) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{13, 0} } - -func (m *MyMessage_SomeGroup) GetGroupField() int32 { - if m != nil && m.GroupField != nil { - return *m.GroupField - } - return 0 -} - -type Ext struct { - Data *string `protobuf:"bytes,1,opt,name=data" json:"data,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *Ext) Reset() { *m = Ext{} } -func (m *Ext) String() string { return proto.CompactTextString(m) } -func (*Ext) ProtoMessage() {} -func (*Ext) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{14} } - -func (m *Ext) GetData() string { - if m != nil && m.Data != nil { - return *m.Data - } - return "" -} - -var E_Ext_More = &proto.ExtensionDesc{ - ExtendedType: (*MyMessage)(nil), - ExtensionType: (*Ext)(nil), - Field: 103, - Name: "testdata.Ext.more", - Tag: "bytes,103,opt,name=more", - Filename: "test.proto", -} - -var E_Ext_Text = &proto.ExtensionDesc{ - ExtendedType: (*MyMessage)(nil), - ExtensionType: (*string)(nil), - Field: 104, - Name: "testdata.Ext.text", - Tag: "bytes,104,opt,name=text", - Filename: "test.proto", -} - -var E_Ext_Number = &proto.ExtensionDesc{ - ExtendedType: (*MyMessage)(nil), - ExtensionType: (*int32)(nil), - Field: 105, - Name: "testdata.Ext.number", - Tag: "varint,105,opt,name=number", - Filename: "test.proto", -} - -type ComplexExtension struct { - First *int32 `protobuf:"varint,1,opt,name=first" json:"first,omitempty"` - Second *int32 `protobuf:"varint,2,opt,name=second" json:"second,omitempty"` - Third []int32 `protobuf:"varint,3,rep,name=third" json:"third,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *ComplexExtension) Reset() { *m = ComplexExtension{} } -func (m *ComplexExtension) String() string { return proto.CompactTextString(m) } -func (*ComplexExtension) ProtoMessage() {} -func (*ComplexExtension) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{15} } - -func (m *ComplexExtension) GetFirst() int32 { - if m != nil && m.First != nil { - return *m.First - } - return 0 -} - -func (m *ComplexExtension) GetSecond() int32 { - if m != nil && m.Second != nil { - return *m.Second - } - return 0 -} - -func (m *ComplexExtension) GetThird() []int32 { - if m != nil { - return m.Third - } - return nil -} - -type DefaultsMessage struct { - proto.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *DefaultsMessage) Reset() { *m = DefaultsMessage{} } -func (m *DefaultsMessage) String() string { return proto.CompactTextString(m) } -func (*DefaultsMessage) ProtoMessage() {} -func (*DefaultsMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{16} } - -var extRange_DefaultsMessage = []proto.ExtensionRange{ - {100, 536870911}, -} - -func (*DefaultsMessage) ExtensionRangeArray() []proto.ExtensionRange { - return extRange_DefaultsMessage -} - -type MyMessageSet struct { - proto.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *MyMessageSet) Reset() { *m = MyMessageSet{} } -func (m *MyMessageSet) String() string { return proto.CompactTextString(m) } -func (*MyMessageSet) ProtoMessage() {} -func (*MyMessageSet) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{17} } - -func (m *MyMessageSet) Marshal() ([]byte, error) { - return proto.MarshalMessageSet(&m.XXX_InternalExtensions) -} -func (m *MyMessageSet) Unmarshal(buf []byte) error { - return proto.UnmarshalMessageSet(buf, &m.XXX_InternalExtensions) -} -func (m *MyMessageSet) MarshalJSON() ([]byte, error) { - return proto.MarshalMessageSetJSON(&m.XXX_InternalExtensions) -} -func (m *MyMessageSet) UnmarshalJSON(buf []byte) error { - return proto.UnmarshalMessageSetJSON(buf, &m.XXX_InternalExtensions) -} - -// ensure MyMessageSet satisfies proto.Marshaler and proto.Unmarshaler -var _ proto.Marshaler = (*MyMessageSet)(nil) -var _ proto.Unmarshaler = (*MyMessageSet)(nil) - -var extRange_MyMessageSet = []proto.ExtensionRange{ - {100, 2147483646}, -} - -func (*MyMessageSet) ExtensionRangeArray() []proto.ExtensionRange { - return extRange_MyMessageSet -} - -type Empty struct { - XXX_unrecognized []byte `json:"-"` -} - -func (m *Empty) Reset() { *m = Empty{} } -func (m *Empty) String() string { return proto.CompactTextString(m) } -func (*Empty) ProtoMessage() {} -func (*Empty) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{18} } - -type MessageList struct { - Message []*MessageList_Message `protobuf:"group,1,rep,name=Message,json=message" json:"message,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *MessageList) Reset() { *m = MessageList{} } -func (m *MessageList) String() string { return proto.CompactTextString(m) } -func (*MessageList) ProtoMessage() {} -func (*MessageList) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{19} } - -func (m *MessageList) GetMessage() []*MessageList_Message { - if m != nil { - return m.Message - } - return nil -} - -type MessageList_Message struct { - Name *string `protobuf:"bytes,2,req,name=name" json:"name,omitempty"` - Count *int32 `protobuf:"varint,3,req,name=count" json:"count,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *MessageList_Message) Reset() { *m = MessageList_Message{} } -func (m *MessageList_Message) String() string { return proto.CompactTextString(m) } -func (*MessageList_Message) ProtoMessage() {} -func (*MessageList_Message) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{19, 0} } - -func (m *MessageList_Message) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *MessageList_Message) GetCount() int32 { - if m != nil && m.Count != nil { - return *m.Count - } - return 0 -} - -type Strings struct { - StringField *string `protobuf:"bytes,1,opt,name=string_field,json=stringField" json:"string_field,omitempty"` - BytesField []byte `protobuf:"bytes,2,opt,name=bytes_field,json=bytesField" json:"bytes_field,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *Strings) Reset() { *m = Strings{} } -func (m *Strings) String() string { return proto.CompactTextString(m) } -func (*Strings) ProtoMessage() {} -func (*Strings) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{20} } - -func (m *Strings) GetStringField() string { - if m != nil && m.StringField != nil { - return *m.StringField - } - return "" -} - -func (m *Strings) GetBytesField() []byte { - if m != nil { - return m.BytesField - } - return nil -} - -type Defaults struct { - // Default-valued fields of all basic types. - // Same as GoTest, but copied here to make testing easier. - F_Bool *bool `protobuf:"varint,1,opt,name=F_Bool,json=FBool,def=1" json:"F_Bool,omitempty"` - F_Int32 *int32 `protobuf:"varint,2,opt,name=F_Int32,json=FInt32,def=32" json:"F_Int32,omitempty"` - F_Int64 *int64 `protobuf:"varint,3,opt,name=F_Int64,json=FInt64,def=64" json:"F_Int64,omitempty"` - F_Fixed32 *uint32 `protobuf:"fixed32,4,opt,name=F_Fixed32,json=FFixed32,def=320" json:"F_Fixed32,omitempty"` - F_Fixed64 *uint64 `protobuf:"fixed64,5,opt,name=F_Fixed64,json=FFixed64,def=640" json:"F_Fixed64,omitempty"` - F_Uint32 *uint32 `protobuf:"varint,6,opt,name=F_Uint32,json=FUint32,def=3200" json:"F_Uint32,omitempty"` - F_Uint64 *uint64 `protobuf:"varint,7,opt,name=F_Uint64,json=FUint64,def=6400" json:"F_Uint64,omitempty"` - F_Float *float32 `protobuf:"fixed32,8,opt,name=F_Float,json=FFloat,def=314159" json:"F_Float,omitempty"` - F_Double *float64 `protobuf:"fixed64,9,opt,name=F_Double,json=FDouble,def=271828" json:"F_Double,omitempty"` - F_String *string `protobuf:"bytes,10,opt,name=F_String,json=FString,def=hello, \"world!\"\n" json:"F_String,omitempty"` - F_Bytes []byte `protobuf:"bytes,11,opt,name=F_Bytes,json=FBytes,def=Bignose" json:"F_Bytes,omitempty"` - F_Sint32 *int32 `protobuf:"zigzag32,12,opt,name=F_Sint32,json=FSint32,def=-32" json:"F_Sint32,omitempty"` - F_Sint64 *int64 `protobuf:"zigzag64,13,opt,name=F_Sint64,json=FSint64,def=-64" json:"F_Sint64,omitempty"` - F_Enum *Defaults_Color `protobuf:"varint,14,opt,name=F_Enum,json=FEnum,enum=testdata.Defaults_Color,def=1" json:"F_Enum,omitempty"` - // More fields with crazy defaults. - F_Pinf *float32 `protobuf:"fixed32,15,opt,name=F_Pinf,json=FPinf,def=inf" json:"F_Pinf,omitempty"` - F_Ninf *float32 `protobuf:"fixed32,16,opt,name=F_Ninf,json=FNinf,def=-inf" json:"F_Ninf,omitempty"` - F_Nan *float32 `protobuf:"fixed32,17,opt,name=F_Nan,json=FNan,def=nan" json:"F_Nan,omitempty"` - // Sub-message. - Sub *SubDefaults `protobuf:"bytes,18,opt,name=sub" json:"sub,omitempty"` - // Redundant but explicit defaults. - StrZero *string `protobuf:"bytes,19,opt,name=str_zero,json=strZero,def=" json:"str_zero,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *Defaults) Reset() { *m = Defaults{} } -func (m *Defaults) String() string { return proto.CompactTextString(m) } -func (*Defaults) ProtoMessage() {} -func (*Defaults) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{21} } - -const Default_Defaults_F_Bool bool = true -const Default_Defaults_F_Int32 int32 = 32 -const Default_Defaults_F_Int64 int64 = 64 -const Default_Defaults_F_Fixed32 uint32 = 320 -const Default_Defaults_F_Fixed64 uint64 = 640 -const Default_Defaults_F_Uint32 uint32 = 3200 -const Default_Defaults_F_Uint64 uint64 = 6400 -const Default_Defaults_F_Float float32 = 314159 -const Default_Defaults_F_Double float64 = 271828 -const Default_Defaults_F_String string = "hello, \"world!\"\n" - -var Default_Defaults_F_Bytes []byte = []byte("Bignose") - -const Default_Defaults_F_Sint32 int32 = -32 -const Default_Defaults_F_Sint64 int64 = -64 -const Default_Defaults_F_Enum Defaults_Color = Defaults_GREEN - -var Default_Defaults_F_Pinf float32 = float32(math.Inf(1)) -var Default_Defaults_F_Ninf float32 = float32(math.Inf(-1)) -var Default_Defaults_F_Nan float32 = float32(math.NaN()) - -func (m *Defaults) GetF_Bool() bool { - if m != nil && m.F_Bool != nil { - return *m.F_Bool - } - return Default_Defaults_F_Bool -} - -func (m *Defaults) GetF_Int32() int32 { - if m != nil && m.F_Int32 != nil { - return *m.F_Int32 - } - return Default_Defaults_F_Int32 -} - -func (m *Defaults) GetF_Int64() int64 { - if m != nil && m.F_Int64 != nil { - return *m.F_Int64 - } - return Default_Defaults_F_Int64 -} - -func (m *Defaults) GetF_Fixed32() uint32 { - if m != nil && m.F_Fixed32 != nil { - return *m.F_Fixed32 - } - return Default_Defaults_F_Fixed32 -} - -func (m *Defaults) GetF_Fixed64() uint64 { - if m != nil && m.F_Fixed64 != nil { - return *m.F_Fixed64 - } - return Default_Defaults_F_Fixed64 -} - -func (m *Defaults) GetF_Uint32() uint32 { - if m != nil && m.F_Uint32 != nil { - return *m.F_Uint32 - } - return Default_Defaults_F_Uint32 -} - -func (m *Defaults) GetF_Uint64() uint64 { - if m != nil && m.F_Uint64 != nil { - return *m.F_Uint64 - } - return Default_Defaults_F_Uint64 -} - -func (m *Defaults) GetF_Float() float32 { - if m != nil && m.F_Float != nil { - return *m.F_Float - } - return Default_Defaults_F_Float -} - -func (m *Defaults) GetF_Double() float64 { - if m != nil && m.F_Double != nil { - return *m.F_Double - } - return Default_Defaults_F_Double -} - -func (m *Defaults) GetF_String() string { - if m != nil && m.F_String != nil { - return *m.F_String - } - return Default_Defaults_F_String -} - -func (m *Defaults) GetF_Bytes() []byte { - if m != nil && m.F_Bytes != nil { - return m.F_Bytes - } - return append([]byte(nil), Default_Defaults_F_Bytes...) -} - -func (m *Defaults) GetF_Sint32() int32 { - if m != nil && m.F_Sint32 != nil { - return *m.F_Sint32 - } - return Default_Defaults_F_Sint32 -} - -func (m *Defaults) GetF_Sint64() int64 { - if m != nil && m.F_Sint64 != nil { - return *m.F_Sint64 - } - return Default_Defaults_F_Sint64 -} - -func (m *Defaults) GetF_Enum() Defaults_Color { - if m != nil && m.F_Enum != nil { - return *m.F_Enum - } - return Default_Defaults_F_Enum -} - -func (m *Defaults) GetF_Pinf() float32 { - if m != nil && m.F_Pinf != nil { - return *m.F_Pinf - } - return Default_Defaults_F_Pinf -} - -func (m *Defaults) GetF_Ninf() float32 { - if m != nil && m.F_Ninf != nil { - return *m.F_Ninf - } - return Default_Defaults_F_Ninf -} - -func (m *Defaults) GetF_Nan() float32 { - if m != nil && m.F_Nan != nil { - return *m.F_Nan - } - return Default_Defaults_F_Nan -} - -func (m *Defaults) GetSub() *SubDefaults { - if m != nil { - return m.Sub - } - return nil -} - -func (m *Defaults) GetStrZero() string { - if m != nil && m.StrZero != nil { - return *m.StrZero - } - return "" -} - -type SubDefaults struct { - N *int64 `protobuf:"varint,1,opt,name=n,def=7" json:"n,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *SubDefaults) Reset() { *m = SubDefaults{} } -func (m *SubDefaults) String() string { return proto.CompactTextString(m) } -func (*SubDefaults) ProtoMessage() {} -func (*SubDefaults) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{22} } - -const Default_SubDefaults_N int64 = 7 - -func (m *SubDefaults) GetN() int64 { - if m != nil && m.N != nil { - return *m.N - } - return Default_SubDefaults_N -} - -type RepeatedEnum struct { - Color []RepeatedEnum_Color `protobuf:"varint,1,rep,name=color,enum=testdata.RepeatedEnum_Color" json:"color,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *RepeatedEnum) Reset() { *m = RepeatedEnum{} } -func (m *RepeatedEnum) String() string { return proto.CompactTextString(m) } -func (*RepeatedEnum) ProtoMessage() {} -func (*RepeatedEnum) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{23} } - -func (m *RepeatedEnum) GetColor() []RepeatedEnum_Color { - if m != nil { - return m.Color - } - return nil -} - -type MoreRepeated struct { - Bools []bool `protobuf:"varint,1,rep,name=bools" json:"bools,omitempty"` - BoolsPacked []bool `protobuf:"varint,2,rep,packed,name=bools_packed,json=boolsPacked" json:"bools_packed,omitempty"` - Ints []int32 `protobuf:"varint,3,rep,name=ints" json:"ints,omitempty"` - IntsPacked []int32 `protobuf:"varint,4,rep,packed,name=ints_packed,json=intsPacked" json:"ints_packed,omitempty"` - Int64SPacked []int64 `protobuf:"varint,7,rep,packed,name=int64s_packed,json=int64sPacked" json:"int64s_packed,omitempty"` - Strings []string `protobuf:"bytes,5,rep,name=strings" json:"strings,omitempty"` - Fixeds []uint32 `protobuf:"fixed32,6,rep,name=fixeds" json:"fixeds,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *MoreRepeated) Reset() { *m = MoreRepeated{} } -func (m *MoreRepeated) String() string { return proto.CompactTextString(m) } -func (*MoreRepeated) ProtoMessage() {} -func (*MoreRepeated) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{24} } - -func (m *MoreRepeated) GetBools() []bool { - if m != nil { - return m.Bools - } - return nil -} - -func (m *MoreRepeated) GetBoolsPacked() []bool { - if m != nil { - return m.BoolsPacked - } - return nil -} - -func (m *MoreRepeated) GetInts() []int32 { - if m != nil { - return m.Ints - } - return nil -} - -func (m *MoreRepeated) GetIntsPacked() []int32 { - if m != nil { - return m.IntsPacked - } - return nil -} - -func (m *MoreRepeated) GetInt64SPacked() []int64 { - if m != nil { - return m.Int64SPacked - } - return nil -} - -func (m *MoreRepeated) GetStrings() []string { - if m != nil { - return m.Strings - } - return nil -} - -func (m *MoreRepeated) GetFixeds() []uint32 { - if m != nil { - return m.Fixeds - } - return nil -} - -type GroupOld struct { - G *GroupOld_G `protobuf:"group,101,opt,name=G,json=g" json:"g,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *GroupOld) Reset() { *m = GroupOld{} } -func (m *GroupOld) String() string { return proto.CompactTextString(m) } -func (*GroupOld) ProtoMessage() {} -func (*GroupOld) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{25} } - -func (m *GroupOld) GetG() *GroupOld_G { - if m != nil { - return m.G - } - return nil -} - -type GroupOld_G struct { - X *int32 `protobuf:"varint,2,opt,name=x" json:"x,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *GroupOld_G) Reset() { *m = GroupOld_G{} } -func (m *GroupOld_G) String() string { return proto.CompactTextString(m) } -func (*GroupOld_G) ProtoMessage() {} -func (*GroupOld_G) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{25, 0} } - -func (m *GroupOld_G) GetX() int32 { - if m != nil && m.X != nil { - return *m.X - } - return 0 -} - -type GroupNew struct { - G *GroupNew_G `protobuf:"group,101,opt,name=G,json=g" json:"g,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *GroupNew) Reset() { *m = GroupNew{} } -func (m *GroupNew) String() string { return proto.CompactTextString(m) } -func (*GroupNew) ProtoMessage() {} -func (*GroupNew) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{26} } - -func (m *GroupNew) GetG() *GroupNew_G { - if m != nil { - return m.G - } - return nil -} - -type GroupNew_G struct { - X *int32 `protobuf:"varint,2,opt,name=x" json:"x,omitempty"` - Y *int32 `protobuf:"varint,3,opt,name=y" json:"y,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *GroupNew_G) Reset() { *m = GroupNew_G{} } -func (m *GroupNew_G) String() string { return proto.CompactTextString(m) } -func (*GroupNew_G) ProtoMessage() {} -func (*GroupNew_G) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{26, 0} } - -func (m *GroupNew_G) GetX() int32 { - if m != nil && m.X != nil { - return *m.X - } - return 0 -} - -func (m *GroupNew_G) GetY() int32 { - if m != nil && m.Y != nil { - return *m.Y - } - return 0 -} - -type FloatingPoint struct { - F *float64 `protobuf:"fixed64,1,req,name=f" json:"f,omitempty"` - Exact *bool `protobuf:"varint,2,opt,name=exact" json:"exact,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *FloatingPoint) Reset() { *m = FloatingPoint{} } -func (m *FloatingPoint) String() string { return proto.CompactTextString(m) } -func (*FloatingPoint) ProtoMessage() {} -func (*FloatingPoint) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{27} } - -func (m *FloatingPoint) GetF() float64 { - if m != nil && m.F != nil { - return *m.F - } - return 0 -} - -func (m *FloatingPoint) GetExact() bool { - if m != nil && m.Exact != nil { - return *m.Exact - } - return false -} - -type MessageWithMap struct { - NameMapping map[int32]string `protobuf:"bytes,1,rep,name=name_mapping,json=nameMapping" json:"name_mapping,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - MsgMapping map[int64]*FloatingPoint `protobuf:"bytes,2,rep,name=msg_mapping,json=msgMapping" json:"msg_mapping,omitempty" protobuf_key:"zigzag64,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - ByteMapping map[bool][]byte `protobuf:"bytes,3,rep,name=byte_mapping,json=byteMapping" json:"byte_mapping,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - StrToStr map[string]string `protobuf:"bytes,4,rep,name=str_to_str,json=strToStr" json:"str_to_str,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *MessageWithMap) Reset() { *m = MessageWithMap{} } -func (m *MessageWithMap) String() string { return proto.CompactTextString(m) } -func (*MessageWithMap) ProtoMessage() {} -func (*MessageWithMap) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{28} } - -func (m *MessageWithMap) GetNameMapping() map[int32]string { - if m != nil { - return m.NameMapping - } - return nil -} - -func (m *MessageWithMap) GetMsgMapping() map[int64]*FloatingPoint { - if m != nil { - return m.MsgMapping - } - return nil -} - -func (m *MessageWithMap) GetByteMapping() map[bool][]byte { - if m != nil { - return m.ByteMapping - } - return nil -} - -func (m *MessageWithMap) GetStrToStr() map[string]string { - if m != nil { - return m.StrToStr - } - return nil -} - -type Oneof struct { - // Types that are valid to be assigned to Union: - // *Oneof_F_Bool - // *Oneof_F_Int32 - // *Oneof_F_Int64 - // *Oneof_F_Fixed32 - // *Oneof_F_Fixed64 - // *Oneof_F_Uint32 - // *Oneof_F_Uint64 - // *Oneof_F_Float - // *Oneof_F_Double - // *Oneof_F_String - // *Oneof_F_Bytes - // *Oneof_F_Sint32 - // *Oneof_F_Sint64 - // *Oneof_F_Enum - // *Oneof_F_Message - // *Oneof_FGroup - // *Oneof_F_Largest_Tag - Union isOneof_Union `protobuf_oneof:"union"` - // Types that are valid to be assigned to Tormato: - // *Oneof_Value - Tormato isOneof_Tormato `protobuf_oneof:"tormato"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *Oneof) Reset() { *m = Oneof{} } -func (m *Oneof) String() string { return proto.CompactTextString(m) } -func (*Oneof) ProtoMessage() {} -func (*Oneof) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{29} } - -type isOneof_Union interface { - isOneof_Union() -} -type isOneof_Tormato interface { - isOneof_Tormato() -} - -type Oneof_F_Bool struct { - F_Bool bool `protobuf:"varint,1,opt,name=F_Bool,json=FBool,oneof"` -} -type Oneof_F_Int32 struct { - F_Int32 int32 `protobuf:"varint,2,opt,name=F_Int32,json=FInt32,oneof"` -} -type Oneof_F_Int64 struct { - F_Int64 int64 `protobuf:"varint,3,opt,name=F_Int64,json=FInt64,oneof"` -} -type Oneof_F_Fixed32 struct { - F_Fixed32 uint32 `protobuf:"fixed32,4,opt,name=F_Fixed32,json=FFixed32,oneof"` -} -type Oneof_F_Fixed64 struct { - F_Fixed64 uint64 `protobuf:"fixed64,5,opt,name=F_Fixed64,json=FFixed64,oneof"` -} -type Oneof_F_Uint32 struct { - F_Uint32 uint32 `protobuf:"varint,6,opt,name=F_Uint32,json=FUint32,oneof"` -} -type Oneof_F_Uint64 struct { - F_Uint64 uint64 `protobuf:"varint,7,opt,name=F_Uint64,json=FUint64,oneof"` -} -type Oneof_F_Float struct { - F_Float float32 `protobuf:"fixed32,8,opt,name=F_Float,json=FFloat,oneof"` -} -type Oneof_F_Double struct { - F_Double float64 `protobuf:"fixed64,9,opt,name=F_Double,json=FDouble,oneof"` -} -type Oneof_F_String struct { - F_String string `protobuf:"bytes,10,opt,name=F_String,json=FString,oneof"` -} -type Oneof_F_Bytes struct { - F_Bytes []byte `protobuf:"bytes,11,opt,name=F_Bytes,json=FBytes,oneof"` -} -type Oneof_F_Sint32 struct { - F_Sint32 int32 `protobuf:"zigzag32,12,opt,name=F_Sint32,json=FSint32,oneof"` -} -type Oneof_F_Sint64 struct { - F_Sint64 int64 `protobuf:"zigzag64,13,opt,name=F_Sint64,json=FSint64,oneof"` -} -type Oneof_F_Enum struct { - F_Enum MyMessage_Color `protobuf:"varint,14,opt,name=F_Enum,json=FEnum,enum=testdata.MyMessage_Color,oneof"` -} -type Oneof_F_Message struct { - F_Message *GoTestField `protobuf:"bytes,15,opt,name=F_Message,json=FMessage,oneof"` -} -type Oneof_FGroup struct { - FGroup *Oneof_F_Group `protobuf:"group,16,opt,name=F_Group,json=fGroup,oneof"` -} -type Oneof_F_Largest_Tag struct { - F_Largest_Tag int32 `protobuf:"varint,536870911,opt,name=F_Largest_Tag,json=FLargestTag,oneof"` -} -type Oneof_Value struct { - Value int32 `protobuf:"varint,100,opt,name=value,oneof"` -} - -func (*Oneof_F_Bool) isOneof_Union() {} -func (*Oneof_F_Int32) isOneof_Union() {} -func (*Oneof_F_Int64) isOneof_Union() {} -func (*Oneof_F_Fixed32) isOneof_Union() {} -func (*Oneof_F_Fixed64) isOneof_Union() {} -func (*Oneof_F_Uint32) isOneof_Union() {} -func (*Oneof_F_Uint64) isOneof_Union() {} -func (*Oneof_F_Float) isOneof_Union() {} -func (*Oneof_F_Double) isOneof_Union() {} -func (*Oneof_F_String) isOneof_Union() {} -func (*Oneof_F_Bytes) isOneof_Union() {} -func (*Oneof_F_Sint32) isOneof_Union() {} -func (*Oneof_F_Sint64) isOneof_Union() {} -func (*Oneof_F_Enum) isOneof_Union() {} -func (*Oneof_F_Message) isOneof_Union() {} -func (*Oneof_FGroup) isOneof_Union() {} -func (*Oneof_F_Largest_Tag) isOneof_Union() {} -func (*Oneof_Value) isOneof_Tormato() {} - -func (m *Oneof) GetUnion() isOneof_Union { - if m != nil { - return m.Union - } - return nil -} -func (m *Oneof) GetTormato() isOneof_Tormato { - if m != nil { - return m.Tormato - } - return nil -} - -func (m *Oneof) GetF_Bool() bool { - if x, ok := m.GetUnion().(*Oneof_F_Bool); ok { - return x.F_Bool - } - return false -} - -func (m *Oneof) GetF_Int32() int32 { - if x, ok := m.GetUnion().(*Oneof_F_Int32); ok { - return x.F_Int32 - } - return 0 -} - -func (m *Oneof) GetF_Int64() int64 { - if x, ok := m.GetUnion().(*Oneof_F_Int64); ok { - return x.F_Int64 - } - return 0 -} - -func (m *Oneof) GetF_Fixed32() uint32 { - if x, ok := m.GetUnion().(*Oneof_F_Fixed32); ok { - return x.F_Fixed32 - } - return 0 -} - -func (m *Oneof) GetF_Fixed64() uint64 { - if x, ok := m.GetUnion().(*Oneof_F_Fixed64); ok { - return x.F_Fixed64 - } - return 0 -} - -func (m *Oneof) GetF_Uint32() uint32 { - if x, ok := m.GetUnion().(*Oneof_F_Uint32); ok { - return x.F_Uint32 - } - return 0 -} - -func (m *Oneof) GetF_Uint64() uint64 { - if x, ok := m.GetUnion().(*Oneof_F_Uint64); ok { - return x.F_Uint64 - } - return 0 -} - -func (m *Oneof) GetF_Float() float32 { - if x, ok := m.GetUnion().(*Oneof_F_Float); ok { - return x.F_Float - } - return 0 -} - -func (m *Oneof) GetF_Double() float64 { - if x, ok := m.GetUnion().(*Oneof_F_Double); ok { - return x.F_Double - } - return 0 -} - -func (m *Oneof) GetF_String() string { - if x, ok := m.GetUnion().(*Oneof_F_String); ok { - return x.F_String - } - return "" -} - -func (m *Oneof) GetF_Bytes() []byte { - if x, ok := m.GetUnion().(*Oneof_F_Bytes); ok { - return x.F_Bytes - } - return nil -} - -func (m *Oneof) GetF_Sint32() int32 { - if x, ok := m.GetUnion().(*Oneof_F_Sint32); ok { - return x.F_Sint32 - } - return 0 -} - -func (m *Oneof) GetF_Sint64() int64 { - if x, ok := m.GetUnion().(*Oneof_F_Sint64); ok { - return x.F_Sint64 - } - return 0 -} - -func (m *Oneof) GetF_Enum() MyMessage_Color { - if x, ok := m.GetUnion().(*Oneof_F_Enum); ok { - return x.F_Enum - } - return MyMessage_RED -} - -func (m *Oneof) GetF_Message() *GoTestField { - if x, ok := m.GetUnion().(*Oneof_F_Message); ok { - return x.F_Message - } - return nil -} - -func (m *Oneof) GetFGroup() *Oneof_F_Group { - if x, ok := m.GetUnion().(*Oneof_FGroup); ok { - return x.FGroup - } - return nil -} - -func (m *Oneof) GetF_Largest_Tag() int32 { - if x, ok := m.GetUnion().(*Oneof_F_Largest_Tag); ok { - return x.F_Largest_Tag - } - return 0 -} - -func (m *Oneof) GetValue() int32 { - if x, ok := m.GetTormato().(*Oneof_Value); ok { - return x.Value - } - return 0 -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*Oneof) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _Oneof_OneofMarshaler, _Oneof_OneofUnmarshaler, _Oneof_OneofSizer, []interface{}{ - (*Oneof_F_Bool)(nil), - (*Oneof_F_Int32)(nil), - (*Oneof_F_Int64)(nil), - (*Oneof_F_Fixed32)(nil), - (*Oneof_F_Fixed64)(nil), - (*Oneof_F_Uint32)(nil), - (*Oneof_F_Uint64)(nil), - (*Oneof_F_Float)(nil), - (*Oneof_F_Double)(nil), - (*Oneof_F_String)(nil), - (*Oneof_F_Bytes)(nil), - (*Oneof_F_Sint32)(nil), - (*Oneof_F_Sint64)(nil), - (*Oneof_F_Enum)(nil), - (*Oneof_F_Message)(nil), - (*Oneof_FGroup)(nil), - (*Oneof_F_Largest_Tag)(nil), - (*Oneof_Value)(nil), - } -} - -func _Oneof_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*Oneof) - // union - switch x := m.Union.(type) { - case *Oneof_F_Bool: - t := uint64(0) - if x.F_Bool { - t = 1 - } - b.EncodeVarint(1<<3 | proto.WireVarint) - b.EncodeVarint(t) - case *Oneof_F_Int32: - b.EncodeVarint(2<<3 | proto.WireVarint) - b.EncodeVarint(uint64(x.F_Int32)) - case *Oneof_F_Int64: - b.EncodeVarint(3<<3 | proto.WireVarint) - b.EncodeVarint(uint64(x.F_Int64)) - case *Oneof_F_Fixed32: - b.EncodeVarint(4<<3 | proto.WireFixed32) - b.EncodeFixed32(uint64(x.F_Fixed32)) - case *Oneof_F_Fixed64: - b.EncodeVarint(5<<3 | proto.WireFixed64) - b.EncodeFixed64(uint64(x.F_Fixed64)) - case *Oneof_F_Uint32: - b.EncodeVarint(6<<3 | proto.WireVarint) - b.EncodeVarint(uint64(x.F_Uint32)) - case *Oneof_F_Uint64: - b.EncodeVarint(7<<3 | proto.WireVarint) - b.EncodeVarint(uint64(x.F_Uint64)) - case *Oneof_F_Float: - b.EncodeVarint(8<<3 | proto.WireFixed32) - b.EncodeFixed32(uint64(math.Float32bits(x.F_Float))) - case *Oneof_F_Double: - b.EncodeVarint(9<<3 | proto.WireFixed64) - b.EncodeFixed64(math.Float64bits(x.F_Double)) - case *Oneof_F_String: - b.EncodeVarint(10<<3 | proto.WireBytes) - b.EncodeStringBytes(x.F_String) - case *Oneof_F_Bytes: - b.EncodeVarint(11<<3 | proto.WireBytes) - b.EncodeRawBytes(x.F_Bytes) - case *Oneof_F_Sint32: - b.EncodeVarint(12<<3 | proto.WireVarint) - b.EncodeZigzag32(uint64(x.F_Sint32)) - case *Oneof_F_Sint64: - b.EncodeVarint(13<<3 | proto.WireVarint) - b.EncodeZigzag64(uint64(x.F_Sint64)) - case *Oneof_F_Enum: - b.EncodeVarint(14<<3 | proto.WireVarint) - b.EncodeVarint(uint64(x.F_Enum)) - case *Oneof_F_Message: - b.EncodeVarint(15<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.F_Message); err != nil { - return err - } - case *Oneof_FGroup: - b.EncodeVarint(16<<3 | proto.WireStartGroup) - if err := b.Marshal(x.FGroup); err != nil { - return err - } - b.EncodeVarint(16<<3 | proto.WireEndGroup) - case *Oneof_F_Largest_Tag: - b.EncodeVarint(536870911<<3 | proto.WireVarint) - b.EncodeVarint(uint64(x.F_Largest_Tag)) - case nil: - default: - return fmt.Errorf("Oneof.Union has unexpected type %T", x) - } - // tormato - switch x := m.Tormato.(type) { - case *Oneof_Value: - b.EncodeVarint(100<<3 | proto.WireVarint) - b.EncodeVarint(uint64(x.Value)) - case nil: - default: - return fmt.Errorf("Oneof.Tormato has unexpected type %T", x) - } - return nil -} - -func _Oneof_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*Oneof) - switch tag { - case 1: // union.F_Bool - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.Union = &Oneof_F_Bool{x != 0} - return true, err - case 2: // union.F_Int32 - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.Union = &Oneof_F_Int32{int32(x)} - return true, err - case 3: // union.F_Int64 - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.Union = &Oneof_F_Int64{int64(x)} - return true, err - case 4: // union.F_Fixed32 - if wire != proto.WireFixed32 { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeFixed32() - m.Union = &Oneof_F_Fixed32{uint32(x)} - return true, err - case 5: // union.F_Fixed64 - if wire != proto.WireFixed64 { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeFixed64() - m.Union = &Oneof_F_Fixed64{x} - return true, err - case 6: // union.F_Uint32 - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.Union = &Oneof_F_Uint32{uint32(x)} - return true, err - case 7: // union.F_Uint64 - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.Union = &Oneof_F_Uint64{x} - return true, err - case 8: // union.F_Float - if wire != proto.WireFixed32 { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeFixed32() - m.Union = &Oneof_F_Float{math.Float32frombits(uint32(x))} - return true, err - case 9: // union.F_Double - if wire != proto.WireFixed64 { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeFixed64() - m.Union = &Oneof_F_Double{math.Float64frombits(x)} - return true, err - case 10: // union.F_String - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.Union = &Oneof_F_String{x} - return true, err - case 11: // union.F_Bytes - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeRawBytes(true) - m.Union = &Oneof_F_Bytes{x} - return true, err - case 12: // union.F_Sint32 - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeZigzag32() - m.Union = &Oneof_F_Sint32{int32(x)} - return true, err - case 13: // union.F_Sint64 - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeZigzag64() - m.Union = &Oneof_F_Sint64{int64(x)} - return true, err - case 14: // union.F_Enum - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.Union = &Oneof_F_Enum{MyMessage_Color(x)} - return true, err - case 15: // union.F_Message - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(GoTestField) - err := b.DecodeMessage(msg) - m.Union = &Oneof_F_Message{msg} - return true, err - case 16: // union.f_group - if wire != proto.WireStartGroup { - return true, proto.ErrInternalBadWireType - } - msg := new(Oneof_F_Group) - err := b.DecodeGroup(msg) - m.Union = &Oneof_FGroup{msg} - return true, err - case 536870911: // union.F_Largest_Tag - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.Union = &Oneof_F_Largest_Tag{int32(x)} - return true, err - case 100: // tormato.value - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.Tormato = &Oneof_Value{int32(x)} - return true, err - default: - return false, nil - } -} - -func _Oneof_OneofSizer(msg proto.Message) (n int) { - m := msg.(*Oneof) - // union - switch x := m.Union.(type) { - case *Oneof_F_Bool: - n += proto.SizeVarint(1<<3 | proto.WireVarint) - n += 1 - case *Oneof_F_Int32: - n += proto.SizeVarint(2<<3 | proto.WireVarint) - n += proto.SizeVarint(uint64(x.F_Int32)) - case *Oneof_F_Int64: - n += proto.SizeVarint(3<<3 | proto.WireVarint) - n += proto.SizeVarint(uint64(x.F_Int64)) - case *Oneof_F_Fixed32: - n += proto.SizeVarint(4<<3 | proto.WireFixed32) - n += 4 - case *Oneof_F_Fixed64: - n += proto.SizeVarint(5<<3 | proto.WireFixed64) - n += 8 - case *Oneof_F_Uint32: - n += proto.SizeVarint(6<<3 | proto.WireVarint) - n += proto.SizeVarint(uint64(x.F_Uint32)) - case *Oneof_F_Uint64: - n += proto.SizeVarint(7<<3 | proto.WireVarint) - n += proto.SizeVarint(uint64(x.F_Uint64)) - case *Oneof_F_Float: - n += proto.SizeVarint(8<<3 | proto.WireFixed32) - n += 4 - case *Oneof_F_Double: - n += proto.SizeVarint(9<<3 | proto.WireFixed64) - n += 8 - case *Oneof_F_String: - n += proto.SizeVarint(10<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(len(x.F_String))) - n += len(x.F_String) - case *Oneof_F_Bytes: - n += proto.SizeVarint(11<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(len(x.F_Bytes))) - n += len(x.F_Bytes) - case *Oneof_F_Sint32: - n += proto.SizeVarint(12<<3 | proto.WireVarint) - n += proto.SizeVarint(uint64((uint32(x.F_Sint32) << 1) ^ uint32((int32(x.F_Sint32) >> 31)))) - case *Oneof_F_Sint64: - n += proto.SizeVarint(13<<3 | proto.WireVarint) - n += proto.SizeVarint(uint64(uint64(x.F_Sint64<<1) ^ uint64((int64(x.F_Sint64) >> 63)))) - case *Oneof_F_Enum: - n += proto.SizeVarint(14<<3 | proto.WireVarint) - n += proto.SizeVarint(uint64(x.F_Enum)) - case *Oneof_F_Message: - s := proto.Size(x.F_Message) - n += proto.SizeVarint(15<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(s)) - n += s - case *Oneof_FGroup: - n += proto.SizeVarint(16<<3 | proto.WireStartGroup) - n += proto.Size(x.FGroup) - n += proto.SizeVarint(16<<3 | proto.WireEndGroup) - case *Oneof_F_Largest_Tag: - n += proto.SizeVarint(536870911<<3 | proto.WireVarint) - n += proto.SizeVarint(uint64(x.F_Largest_Tag)) - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - // tormato - switch x := m.Tormato.(type) { - case *Oneof_Value: - n += proto.SizeVarint(100<<3 | proto.WireVarint) - n += proto.SizeVarint(uint64(x.Value)) - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -type Oneof_F_Group struct { - X *int32 `protobuf:"varint,17,opt,name=x" json:"x,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *Oneof_F_Group) Reset() { *m = Oneof_F_Group{} } -func (m *Oneof_F_Group) String() string { return proto.CompactTextString(m) } -func (*Oneof_F_Group) ProtoMessage() {} -func (*Oneof_F_Group) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{29, 0} } - -func (m *Oneof_F_Group) GetX() int32 { - if m != nil && m.X != nil { - return *m.X - } - return 0 -} - -type Communique struct { - MakeMeCry *bool `protobuf:"varint,1,opt,name=make_me_cry,json=makeMeCry" json:"make_me_cry,omitempty"` - // This is a oneof, called "union". - // - // Types that are valid to be assigned to Union: - // *Communique_Number - // *Communique_Name - // *Communique_Data - // *Communique_TempC - // *Communique_Col - // *Communique_Msg - Union isCommunique_Union `protobuf_oneof:"union"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *Communique) Reset() { *m = Communique{} } -func (m *Communique) String() string { return proto.CompactTextString(m) } -func (*Communique) ProtoMessage() {} -func (*Communique) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{30} } - -type isCommunique_Union interface { - isCommunique_Union() -} - -type Communique_Number struct { - Number int32 `protobuf:"varint,5,opt,name=number,oneof"` -} -type Communique_Name struct { - Name string `protobuf:"bytes,6,opt,name=name,oneof"` -} -type Communique_Data struct { - Data []byte `protobuf:"bytes,7,opt,name=data,oneof"` -} -type Communique_TempC struct { - TempC float64 `protobuf:"fixed64,8,opt,name=temp_c,json=tempC,oneof"` -} -type Communique_Col struct { - Col MyMessage_Color `protobuf:"varint,9,opt,name=col,enum=testdata.MyMessage_Color,oneof"` -} -type Communique_Msg struct { - Msg *Strings `protobuf:"bytes,10,opt,name=msg,oneof"` -} - -func (*Communique_Number) isCommunique_Union() {} -func (*Communique_Name) isCommunique_Union() {} -func (*Communique_Data) isCommunique_Union() {} -func (*Communique_TempC) isCommunique_Union() {} -func (*Communique_Col) isCommunique_Union() {} -func (*Communique_Msg) isCommunique_Union() {} - -func (m *Communique) GetUnion() isCommunique_Union { - if m != nil { - return m.Union - } - return nil -} - -func (m *Communique) GetMakeMeCry() bool { - if m != nil && m.MakeMeCry != nil { - return *m.MakeMeCry - } - return false -} - -func (m *Communique) GetNumber() int32 { - if x, ok := m.GetUnion().(*Communique_Number); ok { - return x.Number - } - return 0 -} - -func (m *Communique) GetName() string { - if x, ok := m.GetUnion().(*Communique_Name); ok { - return x.Name - } - return "" -} - -func (m *Communique) GetData() []byte { - if x, ok := m.GetUnion().(*Communique_Data); ok { - return x.Data - } - return nil -} - -func (m *Communique) GetTempC() float64 { - if x, ok := m.GetUnion().(*Communique_TempC); ok { - return x.TempC - } - return 0 -} - -func (m *Communique) GetCol() MyMessage_Color { - if x, ok := m.GetUnion().(*Communique_Col); ok { - return x.Col - } - return MyMessage_RED -} - -func (m *Communique) GetMsg() *Strings { - if x, ok := m.GetUnion().(*Communique_Msg); ok { - return x.Msg - } - return nil -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*Communique) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _Communique_OneofMarshaler, _Communique_OneofUnmarshaler, _Communique_OneofSizer, []interface{}{ - (*Communique_Number)(nil), - (*Communique_Name)(nil), - (*Communique_Data)(nil), - (*Communique_TempC)(nil), - (*Communique_Col)(nil), - (*Communique_Msg)(nil), - } -} - -func _Communique_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*Communique) - // union - switch x := m.Union.(type) { - case *Communique_Number: - b.EncodeVarint(5<<3 | proto.WireVarint) - b.EncodeVarint(uint64(x.Number)) - case *Communique_Name: - b.EncodeVarint(6<<3 | proto.WireBytes) - b.EncodeStringBytes(x.Name) - case *Communique_Data: - b.EncodeVarint(7<<3 | proto.WireBytes) - b.EncodeRawBytes(x.Data) - case *Communique_TempC: - b.EncodeVarint(8<<3 | proto.WireFixed64) - b.EncodeFixed64(math.Float64bits(x.TempC)) - case *Communique_Col: - b.EncodeVarint(9<<3 | proto.WireVarint) - b.EncodeVarint(uint64(x.Col)) - case *Communique_Msg: - b.EncodeVarint(10<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Msg); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("Communique.Union has unexpected type %T", x) - } - return nil -} - -func _Communique_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*Communique) - switch tag { - case 5: // union.number - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.Union = &Communique_Number{int32(x)} - return true, err - case 6: // union.name - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.Union = &Communique_Name{x} - return true, err - case 7: // union.data - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeRawBytes(true) - m.Union = &Communique_Data{x} - return true, err - case 8: // union.temp_c - if wire != proto.WireFixed64 { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeFixed64() - m.Union = &Communique_TempC{math.Float64frombits(x)} - return true, err - case 9: // union.col - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.Union = &Communique_Col{MyMessage_Color(x)} - return true, err - case 10: // union.msg - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(Strings) - err := b.DecodeMessage(msg) - m.Union = &Communique_Msg{msg} - return true, err - default: - return false, nil - } -} - -func _Communique_OneofSizer(msg proto.Message) (n int) { - m := msg.(*Communique) - // union - switch x := m.Union.(type) { - case *Communique_Number: - n += proto.SizeVarint(5<<3 | proto.WireVarint) - n += proto.SizeVarint(uint64(x.Number)) - case *Communique_Name: - n += proto.SizeVarint(6<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(len(x.Name))) - n += len(x.Name) - case *Communique_Data: - n += proto.SizeVarint(7<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(len(x.Data))) - n += len(x.Data) - case *Communique_TempC: - n += proto.SizeVarint(8<<3 | proto.WireFixed64) - n += 8 - case *Communique_Col: - n += proto.SizeVarint(9<<3 | proto.WireVarint) - n += proto.SizeVarint(uint64(x.Col)) - case *Communique_Msg: - s := proto.Size(x.Msg) - n += proto.SizeVarint(10<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -var E_Greeting = &proto.ExtensionDesc{ - ExtendedType: (*MyMessage)(nil), - ExtensionType: ([]string)(nil), - Field: 106, - Name: "testdata.greeting", - Tag: "bytes,106,rep,name=greeting", - Filename: "test.proto", -} - -var E_Complex = &proto.ExtensionDesc{ - ExtendedType: (*OtherMessage)(nil), - ExtensionType: (*ComplexExtension)(nil), - Field: 200, - Name: "testdata.complex", - Tag: "bytes,200,opt,name=complex", - Filename: "test.proto", -} - -var E_RComplex = &proto.ExtensionDesc{ - ExtendedType: (*OtherMessage)(nil), - ExtensionType: ([]*ComplexExtension)(nil), - Field: 201, - Name: "testdata.r_complex", - Tag: "bytes,201,rep,name=r_complex,json=rComplex", - Filename: "test.proto", -} - -var E_NoDefaultDouble = &proto.ExtensionDesc{ - ExtendedType: (*DefaultsMessage)(nil), - ExtensionType: (*float64)(nil), - Field: 101, - Name: "testdata.no_default_double", - Tag: "fixed64,101,opt,name=no_default_double,json=noDefaultDouble", - Filename: "test.proto", -} - -var E_NoDefaultFloat = &proto.ExtensionDesc{ - ExtendedType: (*DefaultsMessage)(nil), - ExtensionType: (*float32)(nil), - Field: 102, - Name: "testdata.no_default_float", - Tag: "fixed32,102,opt,name=no_default_float,json=noDefaultFloat", - Filename: "test.proto", -} - -var E_NoDefaultInt32 = &proto.ExtensionDesc{ - ExtendedType: (*DefaultsMessage)(nil), - ExtensionType: (*int32)(nil), - Field: 103, - Name: "testdata.no_default_int32", - Tag: "varint,103,opt,name=no_default_int32,json=noDefaultInt32", - Filename: "test.proto", -} - -var E_NoDefaultInt64 = &proto.ExtensionDesc{ - ExtendedType: (*DefaultsMessage)(nil), - ExtensionType: (*int64)(nil), - Field: 104, - Name: "testdata.no_default_int64", - Tag: "varint,104,opt,name=no_default_int64,json=noDefaultInt64", - Filename: "test.proto", -} - -var E_NoDefaultUint32 = &proto.ExtensionDesc{ - ExtendedType: (*DefaultsMessage)(nil), - ExtensionType: (*uint32)(nil), - Field: 105, - Name: "testdata.no_default_uint32", - Tag: "varint,105,opt,name=no_default_uint32,json=noDefaultUint32", - Filename: "test.proto", -} - -var E_NoDefaultUint64 = &proto.ExtensionDesc{ - ExtendedType: (*DefaultsMessage)(nil), - ExtensionType: (*uint64)(nil), - Field: 106, - Name: "testdata.no_default_uint64", - Tag: "varint,106,opt,name=no_default_uint64,json=noDefaultUint64", - Filename: "test.proto", -} - -var E_NoDefaultSint32 = &proto.ExtensionDesc{ - ExtendedType: (*DefaultsMessage)(nil), - ExtensionType: (*int32)(nil), - Field: 107, - Name: "testdata.no_default_sint32", - Tag: "zigzag32,107,opt,name=no_default_sint32,json=noDefaultSint32", - Filename: "test.proto", -} - -var E_NoDefaultSint64 = &proto.ExtensionDesc{ - ExtendedType: (*DefaultsMessage)(nil), - ExtensionType: (*int64)(nil), - Field: 108, - Name: "testdata.no_default_sint64", - Tag: "zigzag64,108,opt,name=no_default_sint64,json=noDefaultSint64", - Filename: "test.proto", -} - -var E_NoDefaultFixed32 = &proto.ExtensionDesc{ - ExtendedType: (*DefaultsMessage)(nil), - ExtensionType: (*uint32)(nil), - Field: 109, - Name: "testdata.no_default_fixed32", - Tag: "fixed32,109,opt,name=no_default_fixed32,json=noDefaultFixed32", - Filename: "test.proto", -} - -var E_NoDefaultFixed64 = &proto.ExtensionDesc{ - ExtendedType: (*DefaultsMessage)(nil), - ExtensionType: (*uint64)(nil), - Field: 110, - Name: "testdata.no_default_fixed64", - Tag: "fixed64,110,opt,name=no_default_fixed64,json=noDefaultFixed64", - Filename: "test.proto", -} - -var E_NoDefaultSfixed32 = &proto.ExtensionDesc{ - ExtendedType: (*DefaultsMessage)(nil), - ExtensionType: (*int32)(nil), - Field: 111, - Name: "testdata.no_default_sfixed32", - Tag: "fixed32,111,opt,name=no_default_sfixed32,json=noDefaultSfixed32", - Filename: "test.proto", -} - -var E_NoDefaultSfixed64 = &proto.ExtensionDesc{ - ExtendedType: (*DefaultsMessage)(nil), - ExtensionType: (*int64)(nil), - Field: 112, - Name: "testdata.no_default_sfixed64", - Tag: "fixed64,112,opt,name=no_default_sfixed64,json=noDefaultSfixed64", - Filename: "test.proto", -} - -var E_NoDefaultBool = &proto.ExtensionDesc{ - ExtendedType: (*DefaultsMessage)(nil), - ExtensionType: (*bool)(nil), - Field: 113, - Name: "testdata.no_default_bool", - Tag: "varint,113,opt,name=no_default_bool,json=noDefaultBool", - Filename: "test.proto", -} - -var E_NoDefaultString = &proto.ExtensionDesc{ - ExtendedType: (*DefaultsMessage)(nil), - ExtensionType: (*string)(nil), - Field: 114, - Name: "testdata.no_default_string", - Tag: "bytes,114,opt,name=no_default_string,json=noDefaultString", - Filename: "test.proto", -} - -var E_NoDefaultBytes = &proto.ExtensionDesc{ - ExtendedType: (*DefaultsMessage)(nil), - ExtensionType: ([]byte)(nil), - Field: 115, - Name: "testdata.no_default_bytes", - Tag: "bytes,115,opt,name=no_default_bytes,json=noDefaultBytes", - Filename: "test.proto", -} - -var E_NoDefaultEnum = &proto.ExtensionDesc{ - ExtendedType: (*DefaultsMessage)(nil), - ExtensionType: (*DefaultsMessage_DefaultsEnum)(nil), - Field: 116, - Name: "testdata.no_default_enum", - Tag: "varint,116,opt,name=no_default_enum,json=noDefaultEnum,enum=testdata.DefaultsMessage_DefaultsEnum", - Filename: "test.proto", -} - -var E_DefaultDouble = &proto.ExtensionDesc{ - ExtendedType: (*DefaultsMessage)(nil), - ExtensionType: (*float64)(nil), - Field: 201, - Name: "testdata.default_double", - Tag: "fixed64,201,opt,name=default_double,json=defaultDouble,def=3.1415", - Filename: "test.proto", -} - -var E_DefaultFloat = &proto.ExtensionDesc{ - ExtendedType: (*DefaultsMessage)(nil), - ExtensionType: (*float32)(nil), - Field: 202, - Name: "testdata.default_float", - Tag: "fixed32,202,opt,name=default_float,json=defaultFloat,def=3.14", - Filename: "test.proto", -} - -var E_DefaultInt32 = &proto.ExtensionDesc{ - ExtendedType: (*DefaultsMessage)(nil), - ExtensionType: (*int32)(nil), - Field: 203, - Name: "testdata.default_int32", - Tag: "varint,203,opt,name=default_int32,json=defaultInt32,def=42", - Filename: "test.proto", -} - -var E_DefaultInt64 = &proto.ExtensionDesc{ - ExtendedType: (*DefaultsMessage)(nil), - ExtensionType: (*int64)(nil), - Field: 204, - Name: "testdata.default_int64", - Tag: "varint,204,opt,name=default_int64,json=defaultInt64,def=43", - Filename: "test.proto", -} - -var E_DefaultUint32 = &proto.ExtensionDesc{ - ExtendedType: (*DefaultsMessage)(nil), - ExtensionType: (*uint32)(nil), - Field: 205, - Name: "testdata.default_uint32", - Tag: "varint,205,opt,name=default_uint32,json=defaultUint32,def=44", - Filename: "test.proto", -} - -var E_DefaultUint64 = &proto.ExtensionDesc{ - ExtendedType: (*DefaultsMessage)(nil), - ExtensionType: (*uint64)(nil), - Field: 206, - Name: "testdata.default_uint64", - Tag: "varint,206,opt,name=default_uint64,json=defaultUint64,def=45", - Filename: "test.proto", -} - -var E_DefaultSint32 = &proto.ExtensionDesc{ - ExtendedType: (*DefaultsMessage)(nil), - ExtensionType: (*int32)(nil), - Field: 207, - Name: "testdata.default_sint32", - Tag: "zigzag32,207,opt,name=default_sint32,json=defaultSint32,def=46", - Filename: "test.proto", -} - -var E_DefaultSint64 = &proto.ExtensionDesc{ - ExtendedType: (*DefaultsMessage)(nil), - ExtensionType: (*int64)(nil), - Field: 208, - Name: "testdata.default_sint64", - Tag: "zigzag64,208,opt,name=default_sint64,json=defaultSint64,def=47", - Filename: "test.proto", -} - -var E_DefaultFixed32 = &proto.ExtensionDesc{ - ExtendedType: (*DefaultsMessage)(nil), - ExtensionType: (*uint32)(nil), - Field: 209, - Name: "testdata.default_fixed32", - Tag: "fixed32,209,opt,name=default_fixed32,json=defaultFixed32,def=48", - Filename: "test.proto", -} - -var E_DefaultFixed64 = &proto.ExtensionDesc{ - ExtendedType: (*DefaultsMessage)(nil), - ExtensionType: (*uint64)(nil), - Field: 210, - Name: "testdata.default_fixed64", - Tag: "fixed64,210,opt,name=default_fixed64,json=defaultFixed64,def=49", - Filename: "test.proto", -} - -var E_DefaultSfixed32 = &proto.ExtensionDesc{ - ExtendedType: (*DefaultsMessage)(nil), - ExtensionType: (*int32)(nil), - Field: 211, - Name: "testdata.default_sfixed32", - Tag: "fixed32,211,opt,name=default_sfixed32,json=defaultSfixed32,def=50", - Filename: "test.proto", -} - -var E_DefaultSfixed64 = &proto.ExtensionDesc{ - ExtendedType: (*DefaultsMessage)(nil), - ExtensionType: (*int64)(nil), - Field: 212, - Name: "testdata.default_sfixed64", - Tag: "fixed64,212,opt,name=default_sfixed64,json=defaultSfixed64,def=51", - Filename: "test.proto", -} - -var E_DefaultBool = &proto.ExtensionDesc{ - ExtendedType: (*DefaultsMessage)(nil), - ExtensionType: (*bool)(nil), - Field: 213, - Name: "testdata.default_bool", - Tag: "varint,213,opt,name=default_bool,json=defaultBool,def=1", - Filename: "test.proto", -} - -var E_DefaultString = &proto.ExtensionDesc{ - ExtendedType: (*DefaultsMessage)(nil), - ExtensionType: (*string)(nil), - Field: 214, - Name: "testdata.default_string", - Tag: "bytes,214,opt,name=default_string,json=defaultString,def=Hello, string", - Filename: "test.proto", -} - -var E_DefaultBytes = &proto.ExtensionDesc{ - ExtendedType: (*DefaultsMessage)(nil), - ExtensionType: ([]byte)(nil), - Field: 215, - Name: "testdata.default_bytes", - Tag: "bytes,215,opt,name=default_bytes,json=defaultBytes,def=Hello, bytes", - Filename: "test.proto", -} - -var E_DefaultEnum = &proto.ExtensionDesc{ - ExtendedType: (*DefaultsMessage)(nil), - ExtensionType: (*DefaultsMessage_DefaultsEnum)(nil), - Field: 216, - Name: "testdata.default_enum", - Tag: "varint,216,opt,name=default_enum,json=defaultEnum,enum=testdata.DefaultsMessage_DefaultsEnum,def=1", - Filename: "test.proto", -} - -var E_X201 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 201, - Name: "testdata.x201", - Tag: "bytes,201,opt,name=x201", - Filename: "test.proto", -} - -var E_X202 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 202, - Name: "testdata.x202", - Tag: "bytes,202,opt,name=x202", - Filename: "test.proto", -} - -var E_X203 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 203, - Name: "testdata.x203", - Tag: "bytes,203,opt,name=x203", - Filename: "test.proto", -} - -var E_X204 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 204, - Name: "testdata.x204", - Tag: "bytes,204,opt,name=x204", - Filename: "test.proto", -} - -var E_X205 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 205, - Name: "testdata.x205", - Tag: "bytes,205,opt,name=x205", - Filename: "test.proto", -} - -var E_X206 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 206, - Name: "testdata.x206", - Tag: "bytes,206,opt,name=x206", - Filename: "test.proto", -} - -var E_X207 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 207, - Name: "testdata.x207", - Tag: "bytes,207,opt,name=x207", - Filename: "test.proto", -} - -var E_X208 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 208, - Name: "testdata.x208", - Tag: "bytes,208,opt,name=x208", - Filename: "test.proto", -} - -var E_X209 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 209, - Name: "testdata.x209", - Tag: "bytes,209,opt,name=x209", - Filename: "test.proto", -} - -var E_X210 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 210, - Name: "testdata.x210", - Tag: "bytes,210,opt,name=x210", - Filename: "test.proto", -} - -var E_X211 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 211, - Name: "testdata.x211", - Tag: "bytes,211,opt,name=x211", - Filename: "test.proto", -} - -var E_X212 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 212, - Name: "testdata.x212", - Tag: "bytes,212,opt,name=x212", - Filename: "test.proto", -} - -var E_X213 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 213, - Name: "testdata.x213", - Tag: "bytes,213,opt,name=x213", - Filename: "test.proto", -} - -var E_X214 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 214, - Name: "testdata.x214", - Tag: "bytes,214,opt,name=x214", - Filename: "test.proto", -} - -var E_X215 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 215, - Name: "testdata.x215", - Tag: "bytes,215,opt,name=x215", - Filename: "test.proto", -} - -var E_X216 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 216, - Name: "testdata.x216", - Tag: "bytes,216,opt,name=x216", - Filename: "test.proto", -} - -var E_X217 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 217, - Name: "testdata.x217", - Tag: "bytes,217,opt,name=x217", - Filename: "test.proto", -} - -var E_X218 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 218, - Name: "testdata.x218", - Tag: "bytes,218,opt,name=x218", - Filename: "test.proto", -} - -var E_X219 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 219, - Name: "testdata.x219", - Tag: "bytes,219,opt,name=x219", - Filename: "test.proto", -} - -var E_X220 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 220, - Name: "testdata.x220", - Tag: "bytes,220,opt,name=x220", - Filename: "test.proto", -} - -var E_X221 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 221, - Name: "testdata.x221", - Tag: "bytes,221,opt,name=x221", - Filename: "test.proto", -} - -var E_X222 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 222, - Name: "testdata.x222", - Tag: "bytes,222,opt,name=x222", - Filename: "test.proto", -} - -var E_X223 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 223, - Name: "testdata.x223", - Tag: "bytes,223,opt,name=x223", - Filename: "test.proto", -} - -var E_X224 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 224, - Name: "testdata.x224", - Tag: "bytes,224,opt,name=x224", - Filename: "test.proto", -} - -var E_X225 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 225, - Name: "testdata.x225", - Tag: "bytes,225,opt,name=x225", - Filename: "test.proto", -} - -var E_X226 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 226, - Name: "testdata.x226", - Tag: "bytes,226,opt,name=x226", - Filename: "test.proto", -} - -var E_X227 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 227, - Name: "testdata.x227", - Tag: "bytes,227,opt,name=x227", - Filename: "test.proto", -} - -var E_X228 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 228, - Name: "testdata.x228", - Tag: "bytes,228,opt,name=x228", - Filename: "test.proto", -} - -var E_X229 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 229, - Name: "testdata.x229", - Tag: "bytes,229,opt,name=x229", - Filename: "test.proto", -} - -var E_X230 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 230, - Name: "testdata.x230", - Tag: "bytes,230,opt,name=x230", - Filename: "test.proto", -} - -var E_X231 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 231, - Name: "testdata.x231", - Tag: "bytes,231,opt,name=x231", - Filename: "test.proto", -} - -var E_X232 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 232, - Name: "testdata.x232", - Tag: "bytes,232,opt,name=x232", - Filename: "test.proto", -} - -var E_X233 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 233, - Name: "testdata.x233", - Tag: "bytes,233,opt,name=x233", - Filename: "test.proto", -} - -var E_X234 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 234, - Name: "testdata.x234", - Tag: "bytes,234,opt,name=x234", - Filename: "test.proto", -} - -var E_X235 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 235, - Name: "testdata.x235", - Tag: "bytes,235,opt,name=x235", - Filename: "test.proto", -} - -var E_X236 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 236, - Name: "testdata.x236", - Tag: "bytes,236,opt,name=x236", - Filename: "test.proto", -} - -var E_X237 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 237, - Name: "testdata.x237", - Tag: "bytes,237,opt,name=x237", - Filename: "test.proto", -} - -var E_X238 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 238, - Name: "testdata.x238", - Tag: "bytes,238,opt,name=x238", - Filename: "test.proto", -} - -var E_X239 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 239, - Name: "testdata.x239", - Tag: "bytes,239,opt,name=x239", - Filename: "test.proto", -} - -var E_X240 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 240, - Name: "testdata.x240", - Tag: "bytes,240,opt,name=x240", - Filename: "test.proto", -} - -var E_X241 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 241, - Name: "testdata.x241", - Tag: "bytes,241,opt,name=x241", - Filename: "test.proto", -} - -var E_X242 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 242, - Name: "testdata.x242", - Tag: "bytes,242,opt,name=x242", - Filename: "test.proto", -} - -var E_X243 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 243, - Name: "testdata.x243", - Tag: "bytes,243,opt,name=x243", - Filename: "test.proto", -} - -var E_X244 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 244, - Name: "testdata.x244", - Tag: "bytes,244,opt,name=x244", - Filename: "test.proto", -} - -var E_X245 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 245, - Name: "testdata.x245", - Tag: "bytes,245,opt,name=x245", - Filename: "test.proto", -} - -var E_X246 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 246, - Name: "testdata.x246", - Tag: "bytes,246,opt,name=x246", - Filename: "test.proto", -} - -var E_X247 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 247, - Name: "testdata.x247", - Tag: "bytes,247,opt,name=x247", - Filename: "test.proto", -} - -var E_X248 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 248, - Name: "testdata.x248", - Tag: "bytes,248,opt,name=x248", - Filename: "test.proto", -} - -var E_X249 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 249, - Name: "testdata.x249", - Tag: "bytes,249,opt,name=x249", - Filename: "test.proto", -} - -var E_X250 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 250, - Name: "testdata.x250", - Tag: "bytes,250,opt,name=x250", - Filename: "test.proto", -} - -func init() { - proto.RegisterType((*GoEnum)(nil), "testdata.GoEnum") - proto.RegisterType((*GoTestField)(nil), "testdata.GoTestField") - proto.RegisterType((*GoTest)(nil), "testdata.GoTest") - proto.RegisterType((*GoTest_RequiredGroup)(nil), "testdata.GoTest.RequiredGroup") - proto.RegisterType((*GoTest_RepeatedGroup)(nil), "testdata.GoTest.RepeatedGroup") - proto.RegisterType((*GoTest_OptionalGroup)(nil), "testdata.GoTest.OptionalGroup") - proto.RegisterType((*GoTestRequiredGroupField)(nil), "testdata.GoTestRequiredGroupField") - proto.RegisterType((*GoTestRequiredGroupField_Group)(nil), "testdata.GoTestRequiredGroupField.Group") - proto.RegisterType((*GoSkipTest)(nil), "testdata.GoSkipTest") - proto.RegisterType((*GoSkipTest_SkipGroup)(nil), "testdata.GoSkipTest.SkipGroup") - proto.RegisterType((*NonPackedTest)(nil), "testdata.NonPackedTest") - proto.RegisterType((*PackedTest)(nil), "testdata.PackedTest") - proto.RegisterType((*MaxTag)(nil), "testdata.MaxTag") - proto.RegisterType((*OldMessage)(nil), "testdata.OldMessage") - proto.RegisterType((*OldMessage_Nested)(nil), "testdata.OldMessage.Nested") - proto.RegisterType((*NewMessage)(nil), "testdata.NewMessage") - proto.RegisterType((*NewMessage_Nested)(nil), "testdata.NewMessage.Nested") - proto.RegisterType((*InnerMessage)(nil), "testdata.InnerMessage") - proto.RegisterType((*OtherMessage)(nil), "testdata.OtherMessage") - proto.RegisterType((*RequiredInnerMessage)(nil), "testdata.RequiredInnerMessage") - proto.RegisterType((*MyMessage)(nil), "testdata.MyMessage") - proto.RegisterType((*MyMessage_SomeGroup)(nil), "testdata.MyMessage.SomeGroup") - proto.RegisterType((*Ext)(nil), "testdata.Ext") - proto.RegisterType((*ComplexExtension)(nil), "testdata.ComplexExtension") - proto.RegisterType((*DefaultsMessage)(nil), "testdata.DefaultsMessage") - proto.RegisterType((*MyMessageSet)(nil), "testdata.MyMessageSet") - proto.RegisterType((*Empty)(nil), "testdata.Empty") - proto.RegisterType((*MessageList)(nil), "testdata.MessageList") - proto.RegisterType((*MessageList_Message)(nil), "testdata.MessageList.Message") - proto.RegisterType((*Strings)(nil), "testdata.Strings") - proto.RegisterType((*Defaults)(nil), "testdata.Defaults") - proto.RegisterType((*SubDefaults)(nil), "testdata.SubDefaults") - proto.RegisterType((*RepeatedEnum)(nil), "testdata.RepeatedEnum") - proto.RegisterType((*MoreRepeated)(nil), "testdata.MoreRepeated") - proto.RegisterType((*GroupOld)(nil), "testdata.GroupOld") - proto.RegisterType((*GroupOld_G)(nil), "testdata.GroupOld.G") - proto.RegisterType((*GroupNew)(nil), "testdata.GroupNew") - proto.RegisterType((*GroupNew_G)(nil), "testdata.GroupNew.G") - proto.RegisterType((*FloatingPoint)(nil), "testdata.FloatingPoint") - proto.RegisterType((*MessageWithMap)(nil), "testdata.MessageWithMap") - proto.RegisterType((*Oneof)(nil), "testdata.Oneof") - proto.RegisterType((*Oneof_F_Group)(nil), "testdata.Oneof.F_Group") - proto.RegisterType((*Communique)(nil), "testdata.Communique") - proto.RegisterEnum("testdata.FOO", FOO_name, FOO_value) - proto.RegisterEnum("testdata.GoTest_KIND", GoTest_KIND_name, GoTest_KIND_value) - proto.RegisterEnum("testdata.MyMessage_Color", MyMessage_Color_name, MyMessage_Color_value) - proto.RegisterEnum("testdata.DefaultsMessage_DefaultsEnum", DefaultsMessage_DefaultsEnum_name, DefaultsMessage_DefaultsEnum_value) - proto.RegisterEnum("testdata.Defaults_Color", Defaults_Color_name, Defaults_Color_value) - proto.RegisterEnum("testdata.RepeatedEnum_Color", RepeatedEnum_Color_name, RepeatedEnum_Color_value) - proto.RegisterExtension(E_Ext_More) - proto.RegisterExtension(E_Ext_Text) - proto.RegisterExtension(E_Ext_Number) - proto.RegisterExtension(E_Greeting) - proto.RegisterExtension(E_Complex) - proto.RegisterExtension(E_RComplex) - proto.RegisterExtension(E_NoDefaultDouble) - proto.RegisterExtension(E_NoDefaultFloat) - proto.RegisterExtension(E_NoDefaultInt32) - proto.RegisterExtension(E_NoDefaultInt64) - proto.RegisterExtension(E_NoDefaultUint32) - proto.RegisterExtension(E_NoDefaultUint64) - proto.RegisterExtension(E_NoDefaultSint32) - proto.RegisterExtension(E_NoDefaultSint64) - proto.RegisterExtension(E_NoDefaultFixed32) - proto.RegisterExtension(E_NoDefaultFixed64) - proto.RegisterExtension(E_NoDefaultSfixed32) - proto.RegisterExtension(E_NoDefaultSfixed64) - proto.RegisterExtension(E_NoDefaultBool) - proto.RegisterExtension(E_NoDefaultString) - proto.RegisterExtension(E_NoDefaultBytes) - proto.RegisterExtension(E_NoDefaultEnum) - proto.RegisterExtension(E_DefaultDouble) - proto.RegisterExtension(E_DefaultFloat) - proto.RegisterExtension(E_DefaultInt32) - proto.RegisterExtension(E_DefaultInt64) - proto.RegisterExtension(E_DefaultUint32) - proto.RegisterExtension(E_DefaultUint64) - proto.RegisterExtension(E_DefaultSint32) - proto.RegisterExtension(E_DefaultSint64) - proto.RegisterExtension(E_DefaultFixed32) - proto.RegisterExtension(E_DefaultFixed64) - proto.RegisterExtension(E_DefaultSfixed32) - proto.RegisterExtension(E_DefaultSfixed64) - proto.RegisterExtension(E_DefaultBool) - proto.RegisterExtension(E_DefaultString) - proto.RegisterExtension(E_DefaultBytes) - proto.RegisterExtension(E_DefaultEnum) - proto.RegisterExtension(E_X201) - proto.RegisterExtension(E_X202) - proto.RegisterExtension(E_X203) - proto.RegisterExtension(E_X204) - proto.RegisterExtension(E_X205) - proto.RegisterExtension(E_X206) - proto.RegisterExtension(E_X207) - proto.RegisterExtension(E_X208) - proto.RegisterExtension(E_X209) - proto.RegisterExtension(E_X210) - proto.RegisterExtension(E_X211) - proto.RegisterExtension(E_X212) - proto.RegisterExtension(E_X213) - proto.RegisterExtension(E_X214) - proto.RegisterExtension(E_X215) - proto.RegisterExtension(E_X216) - proto.RegisterExtension(E_X217) - proto.RegisterExtension(E_X218) - proto.RegisterExtension(E_X219) - proto.RegisterExtension(E_X220) - proto.RegisterExtension(E_X221) - proto.RegisterExtension(E_X222) - proto.RegisterExtension(E_X223) - proto.RegisterExtension(E_X224) - proto.RegisterExtension(E_X225) - proto.RegisterExtension(E_X226) - proto.RegisterExtension(E_X227) - proto.RegisterExtension(E_X228) - proto.RegisterExtension(E_X229) - proto.RegisterExtension(E_X230) - proto.RegisterExtension(E_X231) - proto.RegisterExtension(E_X232) - proto.RegisterExtension(E_X233) - proto.RegisterExtension(E_X234) - proto.RegisterExtension(E_X235) - proto.RegisterExtension(E_X236) - proto.RegisterExtension(E_X237) - proto.RegisterExtension(E_X238) - proto.RegisterExtension(E_X239) - proto.RegisterExtension(E_X240) - proto.RegisterExtension(E_X241) - proto.RegisterExtension(E_X242) - proto.RegisterExtension(E_X243) - proto.RegisterExtension(E_X244) - proto.RegisterExtension(E_X245) - proto.RegisterExtension(E_X246) - proto.RegisterExtension(E_X247) - proto.RegisterExtension(E_X248) - proto.RegisterExtension(E_X249) - proto.RegisterExtension(E_X250) -} - -func init() { proto.RegisterFile("test.proto", fileDescriptor0) } - -var fileDescriptor0 = []byte{ - // 4453 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x5a, 0xc9, 0x77, 0xdb, 0x48, - 0x7a, 0x37, 0xc0, 0xfd, 0x23, 0x25, 0x42, 0x65, 0xb5, 0x9b, 0x96, 0xbc, 0xc0, 0x9c, 0xe9, 0x6e, - 0x7a, 0xd3, 0x48, 0x20, 0x44, 0xdb, 0x74, 0xa7, 0xdf, 0xf3, 0x42, 0xca, 0x7a, 0x63, 0x89, 0x0a, - 0xa4, 0xee, 0x7e, 0xd3, 0x39, 0xf0, 0x51, 0x22, 0x44, 0xb3, 0x4d, 0x02, 0x34, 0x09, 0xc5, 0x52, - 0x72, 0xe9, 0x4b, 0x72, 0xcd, 0x76, 0xc9, 0x35, 0xa7, 0x9c, 0x92, 0xbc, 0x97, 0x7f, 0x22, 0xe9, - 0xee, 0x59, 0x7b, 0xd6, 0xac, 0x93, 0x7d, 0x99, 0xec, 0xdb, 0x4c, 0x92, 0x4b, 0xcf, 0xab, 0xaf, - 0x0a, 0x40, 0x01, 0x24, 0x20, 0xf9, 0x24, 0x56, 0xd5, 0xef, 0xf7, 0xd5, 0xf6, 0xab, 0xef, 0xab, - 0xaf, 0x20, 0x00, 0xc7, 0x9c, 0x38, 0x2b, 0xa3, 0xb1, 0xed, 0xd8, 0x24, 0x4b, 0x7f, 0x77, 0x3b, - 0x4e, 0xa7, 0x7c, 0x1d, 0xd2, 0x1b, 0x76, 0xc3, 0x3a, 0x1a, 0x92, 0xab, 0x90, 0x38, 0xb4, 0xed, - 0x92, 0xa4, 0xca, 0x95, 0x79, 0x6d, 0x6e, 0xc5, 0x45, 0xac, 0x34, 0x5b, 0x2d, 0x83, 0xb6, 0x94, - 0xef, 0x40, 0x7e, 0xc3, 0xde, 0x33, 0x27, 0x4e, 0xb3, 0x6f, 0x0e, 0xba, 0x64, 0x11, 0x52, 0x4f, - 0x3b, 0xfb, 0xe6, 0x00, 0x19, 0x39, 0x83, 0x15, 0x08, 0x81, 0xe4, 0xde, 0xc9, 0xc8, 0x2c, 0xc9, - 0x58, 0x89, 0xbf, 0xcb, 0xbf, 0x72, 0x85, 0x76, 0x42, 0x99, 0xe4, 0x3a, 0x24, 0xbf, 0xdc, 0xb7, - 0xba, 0xbc, 0x97, 0xd7, 0xfc, 0x5e, 0x58, 0xfb, 0xca, 0x97, 0x37, 0xb7, 0x1f, 0x1b, 0x08, 0xa1, - 0xf6, 0xf7, 0x3a, 0xfb, 0x03, 0x6a, 0x4a, 0xa2, 0xf6, 0xb1, 0x40, 0x6b, 0x77, 0x3a, 0xe3, 0xce, - 0xb0, 0x94, 0x50, 0xa5, 0x4a, 0xca, 0x60, 0x05, 0x72, 0x1f, 0xe6, 0x0c, 0xf3, 0xc5, 0x51, 0x7f, - 0x6c, 0x76, 0x71, 0x70, 0xa5, 0xa4, 0x2a, 0x57, 0xf2, 0xd3, 0xf6, 0xb1, 0xd1, 0x08, 0x62, 0x19, - 0x79, 0x64, 0x76, 0x1c, 0x97, 0x9c, 0x52, 0x13, 0xb1, 0x64, 0x01, 0x4b, 0xc9, 0xad, 0x91, 0xd3, - 0xb7, 0xad, 0xce, 0x80, 0x91, 0xd3, 0xaa, 0x14, 0x43, 0x0e, 0x60, 0xc9, 0x9b, 0x50, 0x6c, 0xb6, - 0x1f, 0xda, 0xf6, 0xa0, 0x3d, 0xe6, 0x23, 0x2a, 0x81, 0x2a, 0x57, 0xb2, 0xc6, 0x5c, 0x93, 0xd6, - 0xba, 0xc3, 0x24, 0x15, 0x50, 0x9a, 0xed, 0x4d, 0xcb, 0xa9, 0x6a, 0x3e, 0x30, 0xaf, 0xca, 0x95, - 0x94, 0x31, 0xdf, 0xc4, 0xea, 0x29, 0x64, 0x4d, 0xf7, 0x91, 0x05, 0x55, 0xae, 0x24, 0x18, 0xb2, - 0xa6, 0x7b, 0xc8, 0x5b, 0x40, 0x9a, 0xed, 0x66, 0xff, 0xd8, 0xec, 0x8a, 0x56, 0xe7, 0x54, 0xb9, - 0x92, 0x31, 0x94, 0x26, 0x6f, 0x98, 0x81, 0x16, 0x2d, 0xcf, 0xab, 0x72, 0x25, 0xed, 0xa2, 0x05, - 0xdb, 0x37, 0x60, 0xa1, 0xd9, 0x7e, 0xb7, 0x1f, 0x1c, 0x70, 0x51, 0x95, 0x2b, 0x73, 0x46, 0xb1, - 0xc9, 0xea, 0xa7, 0xb1, 0xa2, 0x61, 0x45, 0x95, 0x2b, 0x49, 0x8e, 0x15, 0xec, 0xe2, 0xec, 0x9a, - 0x03, 0xbb, 0xe3, 0xf8, 0xd0, 0x05, 0x55, 0xae, 0xc8, 0xc6, 0x7c, 0x13, 0xab, 0x83, 0x56, 0x1f, - 0xdb, 0x47, 0xfb, 0x03, 0xd3, 0x87, 0x12, 0x55, 0xae, 0x48, 0x46, 0xb1, 0xc9, 0xea, 0x83, 0xd8, - 0x5d, 0x67, 0xdc, 0xb7, 0x7a, 0x3e, 0xf6, 0x3c, 0xea, 0xb7, 0xd8, 0x64, 0xf5, 0xc1, 0x11, 0x3c, - 0x3c, 0x71, 0xcc, 0x89, 0x0f, 0x35, 0x55, 0xb9, 0x52, 0x30, 0xe6, 0x9b, 0x58, 0x1d, 0xb2, 0x1a, - 0x5a, 0x83, 0x43, 0x55, 0xae, 0x2c, 0x50, 0xab, 0x33, 0xd6, 0x60, 0x37, 0xb4, 0x06, 0x3d, 0x55, - 0xae, 0x10, 0x8e, 0x15, 0xd6, 0x40, 0xd4, 0x0c, 0x13, 0x62, 0x69, 0x51, 0x4d, 0x08, 0x9a, 0x61, - 0x95, 0x41, 0xcd, 0x70, 0xe0, 0x6b, 0x6a, 0x42, 0xd4, 0x4c, 0x08, 0x89, 0x9d, 0x73, 0xe4, 0x05, - 0x35, 0x21, 0x6a, 0x86, 0x23, 0x43, 0x9a, 0xe1, 0xd8, 0xd7, 0xd5, 0x44, 0x50, 0x33, 0x53, 0x68, - 0xd1, 0x72, 0x49, 0x4d, 0x04, 0x35, 0xc3, 0xd1, 0x41, 0xcd, 0x70, 0xf0, 0x45, 0x35, 0x11, 0xd0, - 0x4c, 0x18, 0x2b, 0x1a, 0x5e, 0x52, 0x13, 0x01, 0xcd, 0x88, 0xb3, 0x73, 0x35, 0xc3, 0xa1, 0xcb, - 0x6a, 0x42, 0xd4, 0x8c, 0x68, 0xd5, 0xd3, 0x0c, 0x87, 0x5e, 0x52, 0x13, 0x01, 0xcd, 0x88, 0x58, - 0x4f, 0x33, 0x1c, 0x7b, 0x59, 0x4d, 0x04, 0x34, 0xc3, 0xb1, 0xd7, 0x45, 0xcd, 0x70, 0xe8, 0xc7, - 0x92, 0x9a, 0x10, 0x45, 0xc3, 0xa1, 0x37, 0x03, 0xa2, 0xe1, 0xd8, 0x4f, 0x28, 0x56, 0x54, 0x4d, - 0x18, 0x2c, 0xae, 0xc2, 0xa7, 0x14, 0x2c, 0xca, 0x86, 0x83, 0x7d, 0xd9, 0xd8, 0xdc, 0x05, 0x95, - 0xae, 0xa8, 0x92, 0x27, 0x1b, 0xd7, 0x2f, 0x89, 0xb2, 0xf1, 0x80, 0x57, 0xd1, 0xd5, 0x72, 0xd9, - 0x4c, 0x21, 0x6b, 0xba, 0x8f, 0x54, 0x55, 0xc9, 0x97, 0x8d, 0x87, 0x0c, 0xc8, 0xc6, 0xc3, 0x5e, - 0x53, 0x25, 0x51, 0x36, 0x33, 0xd0, 0xa2, 0xe5, 0xb2, 0x2a, 0x89, 0xb2, 0xf1, 0xd0, 0xa2, 0x6c, - 0x3c, 0xf0, 0x17, 0x54, 0x49, 0x90, 0xcd, 0x34, 0x56, 0x34, 0xfc, 0x45, 0x55, 0x12, 0x64, 0x13, - 0x9c, 0x1d, 0x93, 0x8d, 0x07, 0x7d, 0x43, 0x95, 0x7c, 0xd9, 0x04, 0xad, 0x72, 0xd9, 0x78, 0xd0, - 0x37, 0x55, 0x49, 0x90, 0x4d, 0x10, 0xcb, 0x65, 0xe3, 0x61, 0xdf, 0xc2, 0xf8, 0xe6, 0xca, 0xc6, - 0xc3, 0x0a, 0xb2, 0xf1, 0xa0, 0xbf, 0x43, 0x63, 0xa1, 0x27, 0x1b, 0x0f, 0x2a, 0xca, 0xc6, 0xc3, - 0xfe, 0x2e, 0xc5, 0xfa, 0xb2, 0x99, 0x06, 0x8b, 0xab, 0xf0, 0x7b, 0x14, 0xec, 0xcb, 0xc6, 0x03, - 0xaf, 0xe0, 0x20, 0xa8, 0x6c, 0xba, 0xe6, 0x61, 0xe7, 0x68, 0x40, 0x25, 0x56, 0xa1, 0xba, 0xa9, - 0x27, 0x9d, 0xf1, 0x91, 0x49, 0x47, 0x62, 0xdb, 0x83, 0xc7, 0x6e, 0x1b, 0x59, 0xa1, 0xc6, 0x99, - 0x7c, 0x7c, 0xc2, 0x75, 0xaa, 0x9f, 0xba, 0x5c, 0xd5, 0x8c, 0x22, 0xd3, 0xd0, 0x34, 0xbe, 0xa6, - 0x0b, 0xf8, 0x1b, 0x54, 0x45, 0x75, 0xb9, 0xa6, 0x33, 0x7c, 0x4d, 0xf7, 0xf1, 0x55, 0x38, 0xef, - 0x4b, 0xc9, 0x67, 0xdc, 0xa4, 0x5a, 0xaa, 0x27, 0xaa, 0xda, 0xaa, 0xb1, 0xe0, 0x0a, 0x6a, 0x16, - 0x29, 0xd0, 0xcd, 0x2d, 0x2a, 0xa9, 0x7a, 0xa2, 0xa6, 0x7b, 0x24, 0xb1, 0x27, 0x8d, 0xca, 0x90, - 0x0b, 0xcb, 0xe7, 0xdc, 0xa6, 0xca, 0xaa, 0x27, 0xab, 0xda, 0xea, 0xaa, 0xa1, 0x70, 0x7d, 0xcd, - 0xe0, 0x04, 0xfa, 0x59, 0xa1, 0x0a, 0xab, 0x27, 0x6b, 0xba, 0xc7, 0x09, 0xf6, 0xb3, 0xe0, 0x0a, - 0xcd, 0xa7, 0x7c, 0x89, 0x2a, 0xad, 0x9e, 0xae, 0xae, 0xe9, 0x6b, 0xeb, 0xf7, 0x8c, 0x22, 0x53, - 0x9c, 0xcf, 0xd1, 0x69, 0x3f, 0x5c, 0x72, 0x3e, 0x69, 0x95, 0x6a, 0xae, 0x9e, 0xd6, 0xee, 0xac, - 0xdd, 0xd5, 0xee, 0x1a, 0x0a, 0xd7, 0x9e, 0xcf, 0x7a, 0x87, 0xb2, 0xb8, 0xf8, 0x7c, 0xd6, 0x1a, - 0x55, 0x5f, 0x5d, 0x79, 0x66, 0x0e, 0x06, 0xf6, 0x2d, 0xb5, 0xfc, 0xd2, 0x1e, 0x0f, 0xba, 0xd7, - 0xca, 0x60, 0x28, 0x5c, 0x8f, 0x62, 0xaf, 0x0b, 0xae, 0x20, 0x7d, 0xfa, 0xaf, 0xd1, 0x7b, 0x58, - 0xa1, 0x9e, 0x79, 0xd8, 0xef, 0x59, 0xf6, 0xc4, 0x34, 0x8a, 0x4c, 0x9a, 0xa1, 0x35, 0xd9, 0x0d, - 0xaf, 0xe3, 0xaf, 0x53, 0xda, 0x42, 0x3d, 0x71, 0xbb, 0xaa, 0xd1, 0x9e, 0x66, 0xad, 0xe3, 0x6e, - 0x78, 0x1d, 0x7f, 0x83, 0x72, 0x48, 0x3d, 0x71, 0xbb, 0xa6, 0x73, 0x8e, 0xb8, 0x8e, 0x77, 0xe0, - 0x42, 0x28, 0x2e, 0xb6, 0x47, 0x9d, 0x83, 0xe7, 0x66, 0xb7, 0xa4, 0xd1, 0xf0, 0xf8, 0x50, 0x56, - 0x24, 0xe3, 0x7c, 0x20, 0x44, 0xee, 0x60, 0x33, 0xb9, 0x07, 0xaf, 0x87, 0x03, 0xa5, 0xcb, 0xac, - 0xd2, 0x78, 0x89, 0xcc, 0xc5, 0x60, 0xcc, 0x0c, 0x51, 0x05, 0x07, 0xec, 0x52, 0x75, 0x1a, 0x40, - 0x7d, 0xaa, 0xef, 0x89, 0x39, 0xf5, 0x67, 0xe0, 0xe2, 0x74, 0x28, 0x75, 0xc9, 0xeb, 0x34, 0xa2, - 0x22, 0xf9, 0x42, 0x38, 0xaa, 0x4e, 0xd1, 0x67, 0xf4, 0x5d, 0xa3, 0x21, 0x56, 0xa4, 0x4f, 0xf5, - 0x7e, 0x1f, 0x4a, 0x53, 0xc1, 0xd6, 0x65, 0xdf, 0xa1, 0x31, 0x17, 0xd9, 0xaf, 0x85, 0xe2, 0x6e, - 0x98, 0x3c, 0xa3, 0xeb, 0xbb, 0x34, 0x08, 0x0b, 0xe4, 0xa9, 0x9e, 0x71, 0xc9, 0x82, 0xe1, 0xd8, - 0xe5, 0xde, 0xa3, 0x51, 0x99, 0x2f, 0x59, 0x20, 0x32, 0x8b, 0xfd, 0x86, 0xe2, 0xb3, 0xcb, 0xad, - 0xd3, 0x30, 0xcd, 0xfb, 0x0d, 0x86, 0x6a, 0x4e, 0x7e, 0x9b, 0x92, 0x77, 0x67, 0xcf, 0xf8, 0xc7, - 0x09, 0x1a, 0x60, 0x39, 0x7b, 0x77, 0xd6, 0x94, 0x3d, 0xf6, 0x8c, 0x29, 0xff, 0x84, 0xb2, 0x89, - 0xc0, 0x9e, 0x9a, 0xf3, 0x63, 0x98, 0x73, 0x6f, 0x75, 0xbd, 0xb1, 0x7d, 0x34, 0x2a, 0x35, 0x55, - 0xb9, 0x02, 0xda, 0x95, 0xa9, 0xec, 0xc7, 0xbd, 0xe4, 0x6d, 0x50, 0x94, 0x11, 0x24, 0x31, 0x2b, - 0xcc, 0x2e, 0xb3, 0xb2, 0xa3, 0x26, 0x22, 0xac, 0x30, 0x94, 0x67, 0x45, 0x20, 0x51, 0x2b, 0xae, - 0xd3, 0x67, 0x56, 0x3e, 0x50, 0xa5, 0x99, 0x56, 0xdc, 0x10, 0xc0, 0xad, 0x04, 0x48, 0x4b, 0xeb, - 0x7e, 0xbe, 0x85, 0xed, 0xe4, 0x8b, 0xe1, 0x04, 0x6c, 0x03, 0xef, 0xcf, 0xc1, 0x4a, 0x46, 0x13, - 0x06, 0x37, 0x4d, 0xfb, 0xd9, 0x08, 0x5a, 0x60, 0x34, 0xd3, 0xb4, 0x9f, 0x9b, 0x41, 0x2b, 0xff, - 0xa6, 0x04, 0x49, 0x9a, 0x4f, 0x92, 0x2c, 0x24, 0xdf, 0x6b, 0x6d, 0x3e, 0x56, 0xce, 0xd1, 0x5f, - 0x0f, 0x5b, 0xad, 0xa7, 0x8a, 0x44, 0x72, 0x90, 0x7a, 0xf8, 0x95, 0xbd, 0xc6, 0xae, 0x22, 0x93, - 0x22, 0xe4, 0x9b, 0x9b, 0xdb, 0x1b, 0x0d, 0x63, 0xc7, 0xd8, 0xdc, 0xde, 0x53, 0x12, 0xb4, 0xad, - 0xf9, 0xb4, 0xf5, 0x60, 0x4f, 0x49, 0x92, 0x0c, 0x24, 0x68, 0x5d, 0x8a, 0x00, 0xa4, 0x77, 0xf7, - 0x8c, 0xcd, 0xed, 0x0d, 0x25, 0x4d, 0xad, 0xec, 0x6d, 0x6e, 0x35, 0x94, 0x0c, 0x45, 0xee, 0xbd, - 0xbb, 0xf3, 0xb4, 0xa1, 0x64, 0xe9, 0xcf, 0x07, 0x86, 0xf1, 0xe0, 0x2b, 0x4a, 0x8e, 0x92, 0xb6, - 0x1e, 0xec, 0x28, 0x80, 0xcd, 0x0f, 0x1e, 0x3e, 0x6d, 0x28, 0x79, 0x52, 0x80, 0x6c, 0xf3, 0xdd, - 0xed, 0x47, 0x7b, 0x9b, 0xad, 0x6d, 0xa5, 0x50, 0x3e, 0x81, 0x12, 0x5b, 0xe6, 0xc0, 0x2a, 0xb2, - 0xa4, 0xf0, 0x1d, 0x48, 0xb1, 0x9d, 0x91, 0x50, 0x25, 0x95, 0xf0, 0xce, 0x4c, 0x53, 0x56, 0xd8, - 0x1e, 0x31, 0xda, 0xd2, 0x65, 0x48, 0xb1, 0x55, 0x5a, 0x84, 0x14, 0x5b, 0x1d, 0x19, 0x53, 0x45, - 0x56, 0x28, 0xff, 0x96, 0x0c, 0xb0, 0x61, 0xef, 0x3e, 0xef, 0x8f, 0x30, 0x21, 0xbf, 0x0c, 0x30, - 0x79, 0xde, 0x1f, 0xb5, 0x51, 0xf5, 0x3c, 0xa9, 0xcc, 0xd1, 0x1a, 0xf4, 0x77, 0xe4, 0x1a, 0x14, - 0xb0, 0xf9, 0x90, 0x79, 0x21, 0xcc, 0x25, 0x33, 0x46, 0x9e, 0xd6, 0x71, 0xc7, 0x14, 0x84, 0xd4, - 0x74, 0x4c, 0x21, 0xd3, 0x02, 0xa4, 0xa6, 0x93, 0xab, 0x80, 0xc5, 0xf6, 0x04, 0x23, 0x0a, 0xa6, - 0x8d, 0x39, 0x03, 0xfb, 0x65, 0x31, 0x86, 0xbc, 0x0d, 0xd8, 0x27, 0x9b, 0x77, 0x71, 0xfa, 0x74, - 0xb8, 0xc3, 0x5d, 0xa1, 0x3f, 0xd8, 0x6c, 0x7d, 0xc2, 0x52, 0x0b, 0x72, 0x5e, 0x3d, 0xed, 0x0b, - 0x6b, 0xf9, 0x8c, 0x14, 0x9c, 0x11, 0x60, 0x95, 0x37, 0x25, 0x06, 0xe0, 0xa3, 0x59, 0xc0, 0xd1, - 0x30, 0x12, 0x1b, 0x4e, 0xf9, 0x32, 0xcc, 0x6d, 0xdb, 0x16, 0x3b, 0xbd, 0xb8, 0x4a, 0x05, 0x90, - 0x3a, 0x25, 0x09, 0xb3, 0x27, 0xa9, 0x53, 0xbe, 0x02, 0x20, 0xb4, 0x29, 0x20, 0xed, 0xb3, 0x36, - 0xf4, 0x01, 0xd2, 0x7e, 0xf9, 0x26, 0xa4, 0xb7, 0x3a, 0xc7, 0x7b, 0x9d, 0x1e, 0xb9, 0x06, 0x30, - 0xe8, 0x4c, 0x9c, 0xf6, 0x21, 0xee, 0xc3, 0xe7, 0x9f, 0x7f, 0xfe, 0xb9, 0x84, 0x97, 0xbd, 0x1c, - 0xad, 0x65, 0xfb, 0xf1, 0x02, 0xa0, 0x35, 0xe8, 0x6e, 0x99, 0x93, 0x49, 0xa7, 0x67, 0x92, 0x2a, - 0xa4, 0x2d, 0x73, 0x42, 0xa3, 0x9d, 0x84, 0xef, 0x08, 0xcb, 0xfe, 0x2a, 0xf8, 0xa8, 0x95, 0x6d, - 0x84, 0x18, 0x1c, 0x4a, 0x14, 0x48, 0x58, 0x47, 0x43, 0x7c, 0x27, 0x49, 0x19, 0xf4, 0xe7, 0xd2, - 0x25, 0x48, 0x33, 0x0c, 0x21, 0x90, 0xb4, 0x3a, 0x43, 0xb3, 0xc4, 0xfa, 0xc5, 0xdf, 0xe5, 0x5f, - 0x95, 0x00, 0xb6, 0xcd, 0x97, 0x67, 0xe8, 0xd3, 0x47, 0xc5, 0xf4, 0x99, 0x60, 0x7d, 0xde, 0x8f, - 0xeb, 0x93, 0xea, 0xec, 0xd0, 0xb6, 0xbb, 0x6d, 0xb6, 0xc5, 0xec, 0x49, 0x27, 0x47, 0x6b, 0x70, - 0xd7, 0xca, 0x1f, 0x40, 0x61, 0xd3, 0xb2, 0xcc, 0xb1, 0x3b, 0x26, 0x02, 0xc9, 0x67, 0xf6, 0xc4, - 0xe1, 0x6f, 0x4b, 0xf8, 0x9b, 0x94, 0x20, 0x39, 0xb2, 0xc7, 0x0e, 0x9b, 0x67, 0x3d, 0xa9, 0xaf, - 0xae, 0xae, 0x1a, 0x58, 0x43, 0x2e, 0x41, 0xee, 0xc0, 0xb6, 0x2c, 0xf3, 0x80, 0x4e, 0x22, 0x81, - 0x69, 0x8d, 0x5f, 0x51, 0xfe, 0x65, 0x09, 0x0a, 0x2d, 0xe7, 0x99, 0x6f, 0x5c, 0x81, 0xc4, 0x73, - 0xf3, 0x04, 0x87, 0x97, 0x30, 0xe8, 0x4f, 0x7a, 0x54, 0x7e, 0xbe, 0x33, 0x38, 0x62, 0x6f, 0x4d, - 0x05, 0x83, 0x15, 0xc8, 0x05, 0x48, 0xbf, 0x34, 0xfb, 0xbd, 0x67, 0x0e, 0xda, 0x94, 0x0d, 0x5e, - 0x22, 0xb7, 0x20, 0xd5, 0xa7, 0x83, 0x2d, 0x25, 0x71, 0xbd, 0x2e, 0xf8, 0xeb, 0x25, 0xce, 0xc1, - 0x60, 0xa0, 0x1b, 0xd9, 0x6c, 0x57, 0xf9, 0xe8, 0xa3, 0x8f, 0x3e, 0x92, 0xcb, 0x87, 0xb0, 0xe8, - 0x1e, 0xde, 0xc0, 0x64, 0xb7, 0xa1, 0x34, 0x30, 0xed, 0xf6, 0x61, 0xdf, 0xea, 0x0c, 0x06, 0x27, - 0xed, 0x97, 0xb6, 0xd5, 0xee, 0x58, 0x6d, 0x7b, 0x72, 0xd0, 0x19, 0xe3, 0x02, 0x44, 0x77, 0xb1, - 0x38, 0x30, 0xed, 0x26, 0xa3, 0xbd, 0x6f, 0x5b, 0x0f, 0xac, 0x16, 0xe5, 0x94, 0xff, 0x20, 0x09, - 0xb9, 0xad, 0x13, 0xd7, 0xfa, 0x22, 0xa4, 0x0e, 0xec, 0x23, 0x8b, 0xad, 0x65, 0xca, 0x60, 0x05, - 0x6f, 0x8f, 0x64, 0x61, 0x8f, 0x16, 0x21, 0xf5, 0xe2, 0xc8, 0x76, 0x4c, 0x9c, 0x6e, 0xce, 0x60, - 0x05, 0xba, 0x5a, 0x23, 0xd3, 0x29, 0x25, 0x31, 0xb9, 0xa5, 0x3f, 0xfd, 0xf9, 0xa7, 0xce, 0x30, - 0x7f, 0xb2, 0x02, 0x69, 0x9b, 0xae, 0xfe, 0xa4, 0x94, 0xc6, 0x77, 0x35, 0x01, 0x2e, 0xee, 0x8a, - 0xc1, 0x51, 0x64, 0x13, 0x16, 0x5e, 0x9a, 0xed, 0xe1, 0xd1, 0xc4, 0x69, 0xf7, 0xec, 0x76, 0xd7, - 0x34, 0x47, 0xe6, 0xb8, 0x34, 0x87, 0x3d, 0x09, 0x3e, 0x61, 0xd6, 0x42, 0x1a, 0xf3, 0x2f, 0xcd, - 0xad, 0xa3, 0x89, 0xb3, 0x61, 0x3f, 0x46, 0x16, 0xa9, 0x42, 0x6e, 0x6c, 0x52, 0x4f, 0x40, 0x07, - 0x5b, 0x08, 0xf7, 0x1e, 0xa0, 0x66, 0xc7, 0xe6, 0x08, 0x2b, 0xc8, 0x3a, 0x64, 0xf7, 0xfb, 0xcf, - 0xcd, 0xc9, 0x33, 0xb3, 0x5b, 0xca, 0xa8, 0x52, 0x65, 0x5e, 0xbb, 0xe8, 0x73, 0xbc, 0x65, 0x5d, - 0x79, 0x64, 0x0f, 0xec, 0xb1, 0xe1, 0x41, 0xc9, 0x7d, 0xc8, 0x4d, 0xec, 0xa1, 0xc9, 0xf4, 0x9d, - 0xc5, 0xa0, 0x7a, 0x79, 0x16, 0x6f, 0xd7, 0x1e, 0x9a, 0xae, 0x07, 0x73, 0xf1, 0x64, 0x99, 0x0d, - 0x74, 0x9f, 0x5e, 0x9d, 0x4b, 0x80, 0x4f, 0x03, 0x74, 0x40, 0x78, 0x95, 0x26, 0x4b, 0x74, 0x40, - 0xbd, 0x43, 0x7a, 0x23, 0x2a, 0xe5, 0x31, 0xaf, 0xf4, 0xca, 0x4b, 0xb7, 0x20, 0xe7, 0x19, 0xf4, - 0x5d, 0x1f, 0x73, 0x37, 0x39, 0xf4, 0x07, 0xcc, 0xf5, 0x31, 0x5f, 0xf3, 0x06, 0xa4, 0x70, 0xd8, - 0x34, 0x42, 0x19, 0x0d, 0x1a, 0x10, 0x73, 0x90, 0xda, 0x30, 0x1a, 0x8d, 0x6d, 0x45, 0xc2, 0xd8, - 0xf8, 0xf4, 0xdd, 0x86, 0x22, 0x0b, 0x8a, 0xfd, 0x6d, 0x09, 0x12, 0x8d, 0x63, 0x54, 0x0b, 0x9d, - 0x86, 0x7b, 0xa2, 0xe9, 0x6f, 0xad, 0x06, 0xc9, 0xa1, 0x3d, 0x36, 0xc9, 0xf9, 0x19, 0xb3, 0x2c, - 0xf5, 0x70, 0xbf, 0x84, 0x57, 0xe4, 0xc6, 0xb1, 0x63, 0x20, 0x5e, 0x7b, 0x0b, 0x92, 0x8e, 0x79, - 0xec, 0xcc, 0xe6, 0x3d, 0x63, 0x1d, 0x50, 0x80, 0x76, 0x13, 0xd2, 0xd6, 0xd1, 0x70, 0xdf, 0x1c, - 0xcf, 0x86, 0xf6, 0x71, 0x7a, 0x1c, 0x52, 0x7e, 0x0f, 0x94, 0x47, 0xf6, 0x70, 0x34, 0x30, 0x8f, - 0x1b, 0xc7, 0x8e, 0x69, 0x4d, 0xfa, 0xb6, 0x45, 0xf5, 0x7c, 0xd8, 0x1f, 0xa3, 0x17, 0xc1, 0xb7, - 0x62, 0x2c, 0xd0, 0x53, 0x3d, 0x31, 0x0f, 0x6c, 0xab, 0xcb, 0x1d, 0x26, 0x2f, 0x51, 0xb4, 0xf3, - 0xac, 0x3f, 0xa6, 0x0e, 0x84, 0xfa, 0x79, 0x56, 0x28, 0x6f, 0x40, 0x91, 0xe7, 0x18, 0x13, 0xde, - 0x71, 0xf9, 0x06, 0x14, 0xdc, 0x2a, 0x7c, 0x38, 0xcf, 0x42, 0xf2, 0x83, 0x86, 0xd1, 0x52, 0xce, - 0xd1, 0x65, 0x6d, 0x6d, 0x37, 0x14, 0x89, 0xfe, 0xd8, 0x7b, 0xbf, 0x15, 0x58, 0xca, 0x4b, 0x50, - 0xf0, 0xc6, 0xbe, 0x6b, 0x3a, 0xd8, 0x42, 0x03, 0x42, 0xa6, 0x2e, 0x67, 0xa5, 0x72, 0x06, 0x52, - 0x8d, 0xe1, 0xc8, 0x39, 0x29, 0xff, 0x22, 0xe4, 0x39, 0xe8, 0x69, 0x7f, 0xe2, 0x90, 0x3b, 0x90, - 0x19, 0xf2, 0xf9, 0x4a, 0x78, 0xdd, 0x13, 0x35, 0xe5, 0xe3, 0xdc, 0xdf, 0x86, 0x8b, 0x5e, 0xaa, - 0x42, 0x46, 0xf0, 0xa5, 0xfc, 0xa8, 0xcb, 0xe2, 0x51, 0x67, 0x4e, 0x21, 0x21, 0x38, 0x85, 0xf2, - 0x16, 0x64, 0x58, 0x04, 0x9c, 0x60, 0x54, 0x67, 0xa9, 0x22, 0x13, 0x13, 0xdb, 0xf9, 0x3c, 0xab, - 0x63, 0x17, 0x95, 0xab, 0x90, 0x47, 0xc1, 0x72, 0x04, 0x73, 0x9d, 0x80, 0x55, 0x4c, 0x6e, 0xbf, - 0x9f, 0x82, 0xac, 0xbb, 0x52, 0x64, 0x19, 0xd2, 0x2c, 0x3f, 0x43, 0x53, 0xee, 0xfb, 0x41, 0x0a, - 0x33, 0x32, 0xb2, 0x0c, 0x19, 0x9e, 0x83, 0x71, 0xef, 0x2e, 0x57, 0x35, 0x23, 0xcd, 0x72, 0x2e, - 0xaf, 0xb1, 0xa6, 0xa3, 0x63, 0x62, 0x2f, 0x03, 0x69, 0x96, 0x55, 0x11, 0x15, 0x72, 0x5e, 0x1e, - 0x85, 0xfe, 0x98, 0x3f, 0x03, 0x64, 0xdd, 0xc4, 0x49, 0x40, 0xd4, 0x74, 0xf4, 0x58, 0x3c, 0xe7, - 0xcf, 0x36, 0xfd, 0xeb, 0x49, 0xd6, 0xcd, 0x86, 0xf0, 0xf9, 0xde, 0x4d, 0xf0, 0x33, 0x3c, 0xff, - 0xf1, 0x01, 0x35, 0x1d, 0x5d, 0x82, 0x9b, 0xcd, 0x67, 0x78, 0x8e, 0x43, 0xae, 0xd2, 0x21, 0x62, - 0xce, 0x82, 0x47, 0xdf, 0x4f, 0xdd, 0xd3, 0x2c, 0x93, 0x21, 0xd7, 0xa8, 0x05, 0x96, 0x98, 0xe0, - 0xb9, 0xf4, 0xf3, 0xf4, 0x0c, 0xcf, 0x57, 0xc8, 0x4d, 0x0a, 0x61, 0xcb, 0x5f, 0x82, 0x88, 0xa4, - 0x3c, 0xc3, 0x93, 0x72, 0xa2, 0xd2, 0x0e, 0xd1, 0x3d, 0xa0, 0x4b, 0x10, 0x12, 0xf0, 0x34, 0x4b, - 0xc0, 0xc9, 0x15, 0x34, 0xc7, 0x26, 0x55, 0xf0, 0x93, 0xed, 0x0c, 0x4f, 0x70, 0xfc, 0x76, 0xbc, - 0xb2, 0x79, 0x89, 0x75, 0x86, 0xa7, 0x30, 0xa4, 0x46, 0xf7, 0x8b, 0xea, 0xbb, 0x34, 0x8f, 0x4e, - 0xb0, 0xe4, 0x0b, 0xcf, 0xdd, 0x53, 0xe6, 0x03, 0xeb, 0xcc, 0x83, 0x18, 0xa9, 0x26, 0x9e, 0x86, - 0x25, 0xca, 0xdb, 0xe9, 0x5b, 0x87, 0xa5, 0x22, 0xae, 0x44, 0xa2, 0x6f, 0x1d, 0x1a, 0xa9, 0x26, - 0xad, 0x61, 0x1a, 0xd8, 0xa6, 0x6d, 0x0a, 0xb6, 0x25, 0x6f, 0xb3, 0x46, 0x5a, 0x45, 0x4a, 0x90, - 0x6a, 0xb6, 0xb7, 0x3b, 0x56, 0x69, 0x81, 0xf1, 0xac, 0x8e, 0x65, 0x24, 0x9b, 0xdb, 0x1d, 0x8b, - 0xbc, 0x05, 0x89, 0xc9, 0xd1, 0x7e, 0x89, 0x84, 0xbf, 0xac, 0xec, 0x1e, 0xed, 0xbb, 0x43, 0x31, - 0x28, 0x82, 0x2c, 0x43, 0x76, 0xe2, 0x8c, 0xdb, 0xbf, 0x60, 0x8e, 0xed, 0xd2, 0x79, 0x5c, 0xc2, - 0x73, 0x46, 0x66, 0xe2, 0x8c, 0x3f, 0x30, 0xc7, 0xf6, 0x19, 0x9d, 0x5f, 0xf9, 0x0a, 0xe4, 0x05, - 0xbb, 0xa4, 0x08, 0x92, 0xc5, 0x6e, 0x0a, 0x75, 0xe9, 0x8e, 0x21, 0x59, 0xe5, 0x3d, 0x28, 0xb8, - 0x39, 0x0c, 0xce, 0x57, 0xa3, 0x27, 0x69, 0x60, 0x8f, 0xf1, 0x7c, 0xce, 0x6b, 0x97, 0xc4, 0x10, - 0xe5, 0xc3, 0x78, 0xb8, 0x60, 0xd0, 0xb2, 0x12, 0x1a, 0x8a, 0x54, 0xfe, 0xa1, 0x04, 0x85, 0x2d, - 0x7b, 0xec, 0x3f, 0x30, 0x2f, 0x42, 0x6a, 0xdf, 0xb6, 0x07, 0x13, 0x34, 0x9b, 0x35, 0x58, 0x81, - 0xbc, 0x01, 0x05, 0xfc, 0xe1, 0xe6, 0x9e, 0xb2, 0xf7, 0xb4, 0x91, 0xc7, 0x7a, 0x9e, 0x70, 0x12, - 0x48, 0xf6, 0x2d, 0x67, 0xc2, 0x3d, 0x19, 0xfe, 0x26, 0x5f, 0x80, 0x3c, 0xfd, 0xeb, 0x32, 0x93, - 0xde, 0x85, 0x15, 0x68, 0x35, 0x27, 0xbe, 0x05, 0x73, 0xb8, 0xfb, 0x1e, 0x2c, 0xe3, 0x3d, 0x63, - 0x14, 0x58, 0x03, 0x07, 0x96, 0x20, 0xc3, 0x5c, 0xc1, 0x04, 0xbf, 0x96, 0xe5, 0x0c, 0xb7, 0x48, - 0xdd, 0x2b, 0x66, 0x02, 0x2c, 0xdc, 0x67, 0x0c, 0x5e, 0x2a, 0x3f, 0x80, 0x2c, 0x46, 0xa9, 0xd6, - 0xa0, 0x4b, 0xca, 0x20, 0xf5, 0x4a, 0x26, 0xc6, 0xc8, 0x45, 0xe1, 0x9a, 0xcf, 0x9b, 0x57, 0x36, - 0x0c, 0xa9, 0xb7, 0xb4, 0x00, 0xd2, 0x06, 0xbd, 0x77, 0x1f, 0x73, 0x37, 0x2d, 0x1d, 0x97, 0x5b, - 0xdc, 0xc4, 0xb6, 0xf9, 0x32, 0xce, 0xc4, 0xb6, 0xf9, 0x92, 0x99, 0xb8, 0x3a, 0x65, 0x82, 0x96, - 0x4e, 0xf8, 0xa7, 0x43, 0xe9, 0xa4, 0x5c, 0x85, 0x39, 0x3c, 0x9e, 0x7d, 0xab, 0xb7, 0x63, 0xf7, - 0x2d, 0xbc, 0xe7, 0x1f, 0xe2, 0x3d, 0x49, 0x32, 0xa4, 0x43, 0xba, 0x07, 0xe6, 0x71, 0xe7, 0x80, - 0xdd, 0x38, 0xb3, 0x06, 0x2b, 0x94, 0x3f, 0x4b, 0xc2, 0x3c, 0x77, 0xad, 0xef, 0xf7, 0x9d, 0x67, - 0x5b, 0x9d, 0x11, 0x79, 0x0a, 0x05, 0xea, 0x55, 0xdb, 0xc3, 0xce, 0x68, 0x44, 0x8f, 0xaf, 0x84, - 0x57, 0x8d, 0xeb, 0x53, 0xae, 0x9a, 0xe3, 0x57, 0xb6, 0x3b, 0x43, 0x73, 0x8b, 0x61, 0x1b, 0x96, - 0x33, 0x3e, 0x31, 0xf2, 0x96, 0x5f, 0x43, 0x36, 0x21, 0x3f, 0x9c, 0xf4, 0x3c, 0x63, 0x32, 0x1a, - 0xab, 0x44, 0x1a, 0xdb, 0x9a, 0xf4, 0x02, 0xb6, 0x60, 0xe8, 0x55, 0xd0, 0x81, 0x51, 0x7f, 0xec, - 0xd9, 0x4a, 0x9c, 0x32, 0x30, 0xea, 0x3a, 0x82, 0x03, 0xdb, 0xf7, 0x6b, 0xc8, 0x63, 0x00, 0x7a, - 0xbc, 0x1c, 0x9b, 0xa6, 0x4e, 0xa8, 0xa0, 0xbc, 0xf6, 0x66, 0xa4, 0xad, 0x5d, 0x67, 0xbc, 0x67, - 0xef, 0x3a, 0x63, 0x66, 0x88, 0x1e, 0x4c, 0x2c, 0x2e, 0xbd, 0x03, 0x4a, 0x78, 0xfe, 0xe2, 0x8d, - 0x3c, 0x35, 0xe3, 0x46, 0x9e, 0xe3, 0x37, 0xf2, 0xba, 0x7c, 0x57, 0x5a, 0x7a, 0x0f, 0x8a, 0xa1, - 0x29, 0x8b, 0x74, 0xc2, 0xe8, 0xb7, 0x45, 0x7a, 0x5e, 0x7b, 0x5d, 0xf8, 0x9c, 0x2d, 0x6e, 0xb8, - 0x68, 0xf7, 0x1d, 0x50, 0xc2, 0xd3, 0x17, 0x0d, 0x67, 0x63, 0x32, 0x05, 0xe4, 0xdf, 0x87, 0xb9, - 0xc0, 0x94, 0x45, 0x72, 0xee, 0x94, 0x49, 0x95, 0x7f, 0x29, 0x05, 0xa9, 0x96, 0x65, 0xda, 0x87, - 0xe4, 0xf5, 0x60, 0x9c, 0x7c, 0x72, 0xce, 0x8d, 0x91, 0x17, 0x43, 0x31, 0xf2, 0xc9, 0x39, 0x2f, - 0x42, 0x5e, 0x0c, 0x45, 0x48, 0xb7, 0xa9, 0xa6, 0x93, 0xcb, 0x53, 0xf1, 0xf1, 0xc9, 0x39, 0x21, - 0x38, 0x5e, 0x9e, 0x0a, 0x8e, 0x7e, 0x73, 0x4d, 0xa7, 0x0e, 0x35, 0x18, 0x19, 0x9f, 0x9c, 0xf3, - 0xa3, 0xe2, 0x72, 0x38, 0x2a, 0x7a, 0x8d, 0x35, 0x9d, 0x0d, 0x49, 0x88, 0x88, 0x38, 0x24, 0x16, - 0x0b, 0x97, 0xc3, 0xb1, 0x10, 0x79, 0x3c, 0x0a, 0x2e, 0x87, 0xa3, 0x20, 0x36, 0xf2, 0xa8, 0x77, - 0x31, 0x14, 0xf5, 0xd0, 0x28, 0x0b, 0x77, 0xcb, 0xe1, 0x70, 0xc7, 0x78, 0xc2, 0x48, 0xc5, 0x58, - 0xe7, 0x35, 0xd6, 0x74, 0xa2, 0x85, 0x02, 0x5d, 0xf4, 0x6d, 0x1f, 0xf7, 0x02, 0x9d, 0xbe, 0x4e, - 0x97, 0xcd, 0xbd, 0x88, 0x16, 0x63, 0xbe, 0xf8, 0xe3, 0x6a, 0xba, 0x17, 0x31, 0x0d, 0x32, 0x87, - 0x3c, 0x01, 0x56, 0xd0, 0x73, 0x09, 0xb2, 0xc4, 0xcd, 0x5f, 0x69, 0xb6, 0xd1, 0x83, 0xd1, 0x79, - 0x1d, 0xb2, 0x3b, 0x7d, 0x05, 0xe6, 0x9a, 0xed, 0xa7, 0x9d, 0x71, 0xcf, 0x9c, 0x38, 0xed, 0xbd, - 0x4e, 0xcf, 0x7b, 0x44, 0xa0, 0xfb, 0x9f, 0x6f, 0xf2, 0x96, 0xbd, 0x4e, 0x8f, 0x5c, 0x70, 0xc5, - 0xd5, 0xc5, 0x56, 0x89, 0xcb, 0x6b, 0xe9, 0x75, 0xba, 0x68, 0xcc, 0x18, 0xfa, 0xc2, 0x05, 0xee, - 0x0b, 0x1f, 0x66, 0x20, 0x75, 0x64, 0xf5, 0x6d, 0xeb, 0x61, 0x0e, 0x32, 0x8e, 0x3d, 0x1e, 0x76, - 0x1c, 0xbb, 0xfc, 0x23, 0x09, 0xe0, 0x91, 0x3d, 0x1c, 0x1e, 0x59, 0xfd, 0x17, 0x47, 0x26, 0xb9, - 0x02, 0xf9, 0x61, 0xe7, 0xb9, 0xd9, 0x1e, 0x9a, 0xed, 0x83, 0xb1, 0x7b, 0x0e, 0x72, 0xb4, 0x6a, - 0xcb, 0x7c, 0x34, 0x3e, 0x21, 0x25, 0xf7, 0x8a, 0x8e, 0xda, 0x41, 0x49, 0xf2, 0x2b, 0xfb, 0x22, - 0xbf, 0x74, 0xa6, 0xf9, 0x1e, 0xba, 0xd7, 0x4e, 0x96, 0x47, 0x64, 0xf8, 0xee, 0x61, 0x89, 0x4a, - 0xde, 0x31, 0x87, 0xa3, 0xf6, 0x01, 0x4a, 0x85, 0xca, 0x21, 0x45, 0xcb, 0x8f, 0xc8, 0x6d, 0x48, - 0x1c, 0xd8, 0x03, 0x14, 0xc9, 0x29, 0xfb, 0x42, 0x71, 0xe4, 0x0d, 0x48, 0x0c, 0x27, 0x4c, 0x36, - 0x79, 0x6d, 0x41, 0xb8, 0x27, 0xb0, 0xd0, 0x44, 0x61, 0xc3, 0x49, 0xcf, 0x9b, 0xf7, 0x8d, 0x22, - 0x24, 0x9a, 0xad, 0x16, 0x8d, 0xfd, 0xcd, 0x56, 0x6b, 0x4d, 0x91, 0xea, 0x5f, 0x82, 0x6c, 0x6f, - 0x6c, 0x9a, 0xd4, 0x3d, 0xcc, 0xce, 0x39, 0x3e, 0xc4, 0x58, 0xe7, 0x81, 0xea, 0x5b, 0x90, 0x39, - 0x60, 0x59, 0x07, 0x89, 0x48, 0x6b, 0x4b, 0x7f, 0xc8, 0x1e, 0x55, 0x96, 0xfc, 0xe6, 0x70, 0x9e, - 0x62, 0xb8, 0x36, 0xea, 0x3b, 0x90, 0x1b, 0xb7, 0x4f, 0x33, 0xf8, 0x31, 0x8b, 0x2e, 0x71, 0x06, - 0xb3, 0x63, 0x5e, 0x55, 0x6f, 0xc0, 0x82, 0x65, 0xbb, 0xdf, 0x50, 0xda, 0x5d, 0x76, 0xc6, 0x2e, - 0x4e, 0x5f, 0xe5, 0x5c, 0xe3, 0x26, 0xfb, 0x6e, 0x69, 0xd9, 0xbc, 0x81, 0x9d, 0xca, 0xfa, 0x23, - 0x50, 0x04, 0x33, 0x98, 0x7a, 0xc6, 0x59, 0x39, 0x64, 0x1f, 0x4a, 0x3d, 0x2b, 0x78, 0xee, 0x43, - 0x46, 0xd8, 0xc9, 0x8c, 0x31, 0xd2, 0x63, 0x5f, 0x9d, 0x3d, 0x23, 0xe8, 0xea, 0xa6, 0x8d, 0x50, - 0x5f, 0x13, 0x6d, 0xe4, 0x19, 0xfb, 0x20, 0x2d, 0x1a, 0xa9, 0xe9, 0xa1, 0x55, 0x39, 0x3a, 0x75, - 0x28, 0x7d, 0xf6, 0x3d, 0xd9, 0xb3, 0xc2, 0x1c, 0xe0, 0x0c, 0x33, 0xf1, 0x83, 0xf9, 0x90, 0x7d, - 0x6a, 0x0e, 0x98, 0x99, 0x1a, 0xcd, 0xe4, 0xd4, 0xd1, 0x3c, 0x67, 0xdf, 0x75, 0x3d, 0x33, 0xbb, - 0xb3, 0x46, 0x33, 0x39, 0x75, 0x34, 0x03, 0xf6, 0xc5, 0x37, 0x60, 0xa6, 0xa6, 0xd7, 0x37, 0x80, - 0x88, 0x5b, 0xcd, 0xe3, 0x44, 0x8c, 0x9d, 0x21, 0xfb, 0x8e, 0xef, 0x6f, 0x36, 0xa3, 0xcc, 0x32, - 0x14, 0x3f, 0x20, 0x8b, 0x7d, 0xe2, 0x0f, 0x1a, 0xaa, 0xe9, 0xf5, 0x4d, 0x38, 0x2f, 0x4e, 0xec, - 0x0c, 0x43, 0xb2, 0x55, 0xa9, 0x52, 0x34, 0x16, 0xfc, 0xa9, 0x71, 0xce, 0x4c, 0x53, 0xf1, 0x83, - 0x1a, 0xa9, 0x52, 0x45, 0x99, 0x32, 0x55, 0xd3, 0xeb, 0x0f, 0xa0, 0x28, 0x98, 0xda, 0xc7, 0x08, - 0x1d, 0x6d, 0xe6, 0x05, 0xfb, 0x5f, 0x0b, 0xcf, 0x0c, 0x8d, 0xe8, 0xe1, 0x1d, 0xe3, 0x31, 0x2e, - 0xda, 0xc8, 0x98, 0xfd, 0xa3, 0x80, 0x3f, 0x16, 0x64, 0x84, 0x8e, 0x04, 0xe6, 0xdf, 0x71, 0x56, - 0x26, 0xec, 0x5f, 0x08, 0xfc, 0xa1, 0x50, 0x42, 0xbd, 0x1f, 0x98, 0x8e, 0x49, 0x83, 0x5c, 0x8c, - 0x0d, 0x07, 0x3d, 0xf2, 0x9b, 0x91, 0x80, 0x15, 0xf1, 0x81, 0x44, 0x98, 0x36, 0x2d, 0xd6, 0x37, - 0x61, 0xfe, 0xec, 0x0e, 0xe9, 0x63, 0x89, 0x65, 0xcb, 0xd5, 0x15, 0x9a, 0x50, 0x1b, 0x73, 0xdd, - 0x80, 0x5f, 0x6a, 0xc0, 0xdc, 0x99, 0x9d, 0xd2, 0x27, 0x12, 0xcb, 0x39, 0xa9, 0x25, 0xa3, 0xd0, - 0x0d, 0x7a, 0xa6, 0xb9, 0x33, 0xbb, 0xa5, 0x4f, 0x25, 0xf6, 0x40, 0xa1, 0x6b, 0x9e, 0x11, 0xd7, - 0x33, 0xcd, 0x9d, 0xd9, 0x2d, 0x7d, 0x95, 0x65, 0x94, 0xb2, 0x5e, 0x15, 0x8d, 0xa0, 0x2f, 0x98, - 0x3f, 0xbb, 0x5b, 0xfa, 0x9a, 0x84, 0x8f, 0x15, 0xb2, 0xae, 0x7b, 0xeb, 0xe2, 0x79, 0xa6, 0xf9, - 0xb3, 0xbb, 0xa5, 0xaf, 0x4b, 0xf8, 0xa4, 0x21, 0xeb, 0xeb, 0x01, 0x33, 0xc1, 0xd1, 0x9c, 0xee, - 0x96, 0xbe, 0x21, 0xe1, 0x2b, 0x83, 0xac, 0xd7, 0x3c, 0x33, 0xbb, 0x53, 0xa3, 0x39, 0xdd, 0x2d, - 0x7d, 0x13, 0x6f, 0xf1, 0x75, 0x59, 0xbf, 0x13, 0x30, 0x83, 0x9e, 0xa9, 0xf8, 0x0a, 0x6e, 0xe9, - 0x5b, 0x12, 0x3e, 0x06, 0xc9, 0xfa, 0x5d, 0xc3, 0xed, 0xdd, 0xf7, 0x4c, 0xc5, 0x57, 0x70, 0x4b, - 0x9f, 0x49, 0xf8, 0x66, 0x24, 0xeb, 0xf7, 0x82, 0x86, 0xd0, 0x33, 0x29, 0xaf, 0xe2, 0x96, 0xbe, - 0x4d, 0x2d, 0x15, 0xeb, 0xf2, 0xfa, 0xaa, 0xe1, 0x0e, 0x40, 0xf0, 0x4c, 0xca, 0xab, 0xb8, 0xa5, - 0xef, 0x50, 0x53, 0x4a, 0x5d, 0x5e, 0x5f, 0x0b, 0x99, 0xaa, 0xe9, 0xf5, 0x47, 0x50, 0x38, 0xab, - 0x5b, 0xfa, 0xae, 0xf8, 0x16, 0x97, 0xef, 0x0a, 0xbe, 0x69, 0x47, 0xd8, 0xb3, 0x53, 0x1d, 0xd3, - 0xf7, 0x30, 0xc7, 0xa9, 0xcf, 0x3d, 0x61, 0xef, 0x55, 0x8c, 0xe0, 0x6f, 0x1f, 0x73, 0x53, 0x5b, - 0xfe, 0xf9, 0x38, 0xd5, 0x47, 0x7d, 0x5f, 0xc2, 0x47, 0xad, 0x02, 0x37, 0x88, 0x78, 0xef, 0xa4, - 0x30, 0x87, 0xf5, 0xa1, 0x3f, 0xcb, 0xd3, 0xbc, 0xd5, 0x0f, 0xa4, 0x57, 0x71, 0x57, 0xf5, 0x44, - 0x6b, 0xbb, 0xe1, 0x2d, 0x06, 0xd6, 0xbc, 0x0d, 0xc9, 0x63, 0x6d, 0x75, 0x4d, 0xbc, 0x92, 0x89, - 0x6f, 0xb9, 0xcc, 0x49, 0xe5, 0xb5, 0xa2, 0xf0, 0xdc, 0x3d, 0x1c, 0x39, 0x27, 0x06, 0xb2, 0x38, - 0x5b, 0x8b, 0x64, 0x7f, 0x12, 0xc3, 0xd6, 0x38, 0xbb, 0x1a, 0xc9, 0xfe, 0x34, 0x86, 0x5d, 0xe5, - 0x6c, 0x3d, 0x92, 0xfd, 0xd5, 0x18, 0xb6, 0xce, 0xd9, 0xeb, 0x91, 0xec, 0xaf, 0xc5, 0xb0, 0xd7, - 0x39, 0xbb, 0x16, 0xc9, 0xfe, 0x7a, 0x0c, 0xbb, 0xc6, 0xd9, 0x77, 0x22, 0xd9, 0xdf, 0x88, 0x61, - 0xdf, 0xe1, 0xec, 0xbb, 0x91, 0xec, 0x6f, 0xc6, 0xb0, 0xef, 0x72, 0xf6, 0xbd, 0x48, 0xf6, 0xb7, - 0x62, 0xd8, 0xf7, 0x18, 0x7b, 0x6d, 0x35, 0x92, 0xfd, 0x59, 0x34, 0x7b, 0x6d, 0x95, 0xb3, 0xa3, - 0xb5, 0xf6, 0xed, 0x18, 0x36, 0xd7, 0xda, 0x5a, 0xb4, 0xd6, 0xbe, 0x13, 0xc3, 0xe6, 0x5a, 0x5b, - 0x8b, 0xd6, 0xda, 0x77, 0x63, 0xd8, 0x5c, 0x6b, 0x6b, 0xd1, 0x5a, 0xfb, 0x5e, 0x0c, 0x9b, 0x6b, - 0x6d, 0x2d, 0x5a, 0x6b, 0xdf, 0x8f, 0x61, 0x73, 0xad, 0xad, 0x45, 0x6b, 0xed, 0x07, 0x31, 0x6c, - 0xae, 0xb5, 0xb5, 0x68, 0xad, 0xfd, 0x51, 0x0c, 0x9b, 0x6b, 0x6d, 0x2d, 0x5a, 0x6b, 0x7f, 0x1c, - 0xc3, 0xe6, 0x5a, 0x5b, 0x8b, 0xd6, 0xda, 0x9f, 0xc4, 0xb0, 0xb9, 0xd6, 0xb4, 0x68, 0xad, 0xfd, - 0x69, 0x34, 0x5b, 0xe3, 0x5a, 0xd3, 0xa2, 0xb5, 0xf6, 0x67, 0x31, 0x6c, 0xae, 0x35, 0x2d, 0x5a, - 0x6b, 0x7f, 0x1e, 0xc3, 0xe6, 0x5a, 0xd3, 0xa2, 0xb5, 0xf6, 0xc3, 0x18, 0x36, 0xd7, 0x9a, 0x16, - 0xad, 0xb5, 0xbf, 0x88, 0x61, 0x73, 0xad, 0x69, 0xd1, 0x5a, 0xfb, 0xcb, 0x18, 0x36, 0xd7, 0x9a, - 0x16, 0xad, 0xb5, 0xbf, 0x8a, 0x61, 0x73, 0xad, 0x69, 0xd1, 0x5a, 0xfb, 0xeb, 0x18, 0x36, 0xd7, - 0x9a, 0x16, 0xad, 0xb5, 0xbf, 0x89, 0x61, 0x73, 0xad, 0x69, 0xd1, 0x5a, 0xfb, 0xdb, 0x18, 0x36, - 0xd7, 0x5a, 0x35, 0x5a, 0x6b, 0x7f, 0x17, 0xcd, 0xae, 0x72, 0xad, 0x55, 0xa3, 0xb5, 0xf6, 0xf7, - 0x31, 0x6c, 0xae, 0xb5, 0x6a, 0xb4, 0xd6, 0xfe, 0x21, 0x86, 0xcd, 0xb5, 0x56, 0x8d, 0xd6, 0xda, - 0x3f, 0xc6, 0xb0, 0xb9, 0xd6, 0xaa, 0xd1, 0x5a, 0xfb, 0x51, 0x0c, 0x9b, 0x6b, 0xad, 0x1a, 0xad, - 0xb5, 0x7f, 0x8a, 0x61, 0x73, 0xad, 0x55, 0xa3, 0xb5, 0xf6, 0xcf, 0x31, 0x6c, 0xae, 0xb5, 0x6a, - 0xb4, 0xd6, 0xfe, 0x25, 0x86, 0xcd, 0xb5, 0x56, 0x8d, 0xd6, 0xda, 0xbf, 0xc6, 0xb0, 0xb9, 0xd6, - 0xaa, 0xd1, 0x5a, 0xfb, 0xb7, 0x18, 0x36, 0xd7, 0x9a, 0x1e, 0xad, 0xb5, 0x7f, 0x8f, 0x66, 0xeb, - 0x5c, 0x6b, 0x7a, 0xb4, 0xd6, 0xfe, 0x23, 0x86, 0xcd, 0xb5, 0xa6, 0x47, 0x6b, 0xed, 0x3f, 0x63, - 0xd8, 0x5c, 0x6b, 0x7a, 0xb4, 0xd6, 0xfe, 0x2b, 0x86, 0xcd, 0xb5, 0xa6, 0x47, 0x6b, 0xed, 0xbf, - 0x63, 0xd8, 0x5c, 0x6b, 0x7a, 0xb4, 0xd6, 0xfe, 0x27, 0x86, 0xcd, 0xb5, 0xa6, 0x47, 0x6b, 0xed, - 0xc7, 0x31, 0x6c, 0xae, 0x35, 0x3d, 0x5a, 0x6b, 0x3f, 0x89, 0x61, 0x73, 0xad, 0xe9, 0xd1, 0x5a, - 0xfb, 0xdf, 0x18, 0x36, 0xd7, 0x9a, 0x1e, 0xad, 0xb5, 0xff, 0x8b, 0x61, 0x73, 0xad, 0xad, 0x47, - 0x6b, 0xed, 0xff, 0xa3, 0xd9, 0xeb, 0xab, 0x3f, 0x0d, 0x00, 0x00, 0xff, 0xff, 0xaa, 0x00, 0xcd, - 0x32, 0x57, 0x39, 0x00, 0x00, -} diff --git a/vendor/github.com/golang/protobuf/proto/text.go b/vendor/github.com/golang/protobuf/proto/text.go index 965876bf0..2205fdaad 100644 --- a/vendor/github.com/golang/protobuf/proto/text.go +++ b/vendor/github.com/golang/protobuf/proto/text.go @@ -50,7 +50,6 @@ import ( var ( newline = []byte("\n") spaces = []byte(" ") - gtNewline = []byte(">\n") endBraceNewline = []byte("}\n") backslashN = []byte{'\\', 'n'} backslashR = []byte{'\\', 'r'} @@ -170,11 +169,6 @@ func writeName(w *textWriter, props *Properties) error { return nil } -// raw is the interface satisfied by RawMessage. -type raw interface { - Bytes() []byte -} - func requiresQuotes(u string) bool { // When type URL contains any characters except [0-9A-Za-z./\-]*, it must be quoted. for _, ch := range u { @@ -269,6 +263,10 @@ func (tm *TextMarshaler) writeStruct(w *textWriter, sv reflect.Value) error { props := sprops.Prop[i] name := st.Field(i).Name + if name == "XXX_NoUnkeyedLiteral" { + continue + } + if strings.HasPrefix(name, "XXX_") { // There are two XXX_ fields: // XXX_unrecognized []byte @@ -436,12 +434,6 @@ func (tm *TextMarshaler) writeStruct(w *textWriter, sv reflect.Value) error { return err } } - if b, ok := fv.Interface().(raw); ok { - if err := writeRaw(w, b.Bytes()); err != nil { - return err - } - continue - } // Enums have a String method, so writeAny will work fine. if err := tm.writeAny(w, fv, props); err != nil { @@ -455,7 +447,7 @@ func (tm *TextMarshaler) writeStruct(w *textWriter, sv reflect.Value) error { // Extensions (the XXX_extensions field). pv := sv.Addr() - if _, ok := extendable(pv.Interface()); ok { + if _, err := extendable(pv.Interface()); err == nil { if err := tm.writeExtensions(w, pv); err != nil { return err } @@ -464,27 +456,6 @@ func (tm *TextMarshaler) writeStruct(w *textWriter, sv reflect.Value) error { return nil } -// writeRaw writes an uninterpreted raw message. -func writeRaw(w *textWriter, b []byte) error { - if err := w.WriteByte('<'); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte('\n'); err != nil { - return err - } - } - w.indent() - if err := writeUnknownStruct(w, b); err != nil { - return err - } - w.unindent() - if err := w.WriteByte('>'); err != nil { - return err - } - return nil -} - // writeAny writes an arbitrary field. func (tm *TextMarshaler) writeAny(w *textWriter, v reflect.Value, props *Properties) error { v = reflect.Indirect(v) @@ -535,6 +506,19 @@ func (tm *TextMarshaler) writeAny(w *textWriter, v reflect.Value, props *Propert } } w.indent() + if v.CanAddr() { + // Calling v.Interface on a struct causes the reflect package to + // copy the entire struct. This is racy with the new Marshaler + // since we atomically update the XXX_sizecache. + // + // Thus, we retrieve a pointer to the struct if possible to avoid + // a race since v.Interface on the pointer doesn't copy the struct. + // + // If v is not addressable, then we are not worried about a race + // since it implies that the binary Marshaler cannot possibly be + // mutating this value. + v = v.Addr() + } if etm, ok := v.Interface().(encoding.TextMarshaler); ok { text, err := etm.MarshalText() if err != nil { @@ -543,8 +527,13 @@ func (tm *TextMarshaler) writeAny(w *textWriter, v reflect.Value, props *Propert if _, err = w.Write(text); err != nil { return err } - } else if err := tm.writeStruct(w, v); err != nil { - return err + } else { + if v.Kind() == reflect.Ptr { + v = v.Elem() + } + if err := tm.writeStruct(w, v); err != nil { + return err + } } w.unindent() if err := w.WriteByte(ket); err != nil { diff --git a/vendor/github.com/golang/protobuf/proto/text_parser.go b/vendor/github.com/golang/protobuf/proto/text_parser.go index 5e14513f2..0685bae36 100644 --- a/vendor/github.com/golang/protobuf/proto/text_parser.go +++ b/vendor/github.com/golang/protobuf/proto/text_parser.go @@ -206,7 +206,6 @@ func (p *textParser) advance() { var ( errBadUTF8 = errors.New("proto: bad UTF-8") - errBadHex = errors.New("proto: bad hexadecimal") ) func unquoteC(s string, quote rune) (string, error) { @@ -277,60 +276,47 @@ func unescape(s string) (ch string, tail string, err error) { return "?", s, nil // trigraph workaround case '\'', '"', '\\': return string(r), s, nil - case '0', '1', '2', '3', '4', '5', '6', '7', 'x', 'X': + case '0', '1', '2', '3', '4', '5', '6', '7': if len(s) < 2 { return "", "", fmt.Errorf(`\%c requires 2 following digits`, r) } - base := 8 - ss := s[:2] + ss := string(r) + s[:2] s = s[2:] - if r == 'x' || r == 'X' { - base = 16 - } else { - ss = string(r) + ss - } - i, err := strconv.ParseUint(ss, base, 8) + i, err := strconv.ParseUint(ss, 8, 8) if err != nil { - return "", "", err + return "", "", fmt.Errorf(`\%s contains non-octal digits`, ss) } return string([]byte{byte(i)}), s, nil - case 'u', 'U': - n := 4 - if r == 'U' { + case 'x', 'X', 'u', 'U': + var n int + switch r { + case 'x', 'X': + n = 2 + case 'u': + n = 4 + case 'U': n = 8 } if len(s) < n { - return "", "", fmt.Errorf(`\%c requires %d digits`, r, n) - } - - bs := make([]byte, n/2) - for i := 0; i < n; i += 2 { - a, ok1 := unhex(s[i]) - b, ok2 := unhex(s[i+1]) - if !ok1 || !ok2 { - return "", "", errBadHex - } - bs[i/2] = a<<4 | b + return "", "", fmt.Errorf(`\%c requires %d following digits`, r, n) } + ss := s[:n] s = s[n:] - return string(bs), s, nil + i, err := strconv.ParseUint(ss, 16, 64) + if err != nil { + return "", "", fmt.Errorf(`\%c%s contains non-hexadecimal digits`, r, ss) + } + if r == 'x' || r == 'X' { + return string([]byte{byte(i)}), s, nil + } + if i > utf8.MaxRune { + return "", "", fmt.Errorf(`\%c%s is not a valid Unicode code point`, r, ss) + } + return string(i), s, nil } return "", "", fmt.Errorf(`unknown escape \%c`, r) } -// Adapted from src/pkg/strconv/quote.go. -func unhex(b byte) (v byte, ok bool) { - switch { - case '0' <= b && b <= '9': - return b - '0', true - case 'a' <= b && b <= 'f': - return b - 'a' + 10, true - case 'A' <= b && b <= 'F': - return b - 'A' + 10, true - } - return 0, false -} - // Back off the parser by one token. Can only be done between calls to next(). // It makes the next advance() a no-op. func (p *textParser) back() { p.backed = true } @@ -728,6 +714,9 @@ func (p *textParser) consumeExtName() (string, error) { if tok.err != nil { return "", p.errorf("unrecognized type_url or extension name: %s", tok.err) } + if p.done && tok.value != "]" { + return "", p.errorf("unclosed type_url or extension name") + } } return strings.Join(parts, ""), nil } @@ -865,7 +854,7 @@ func (p *textParser) readAny(v reflect.Value, props *Properties) error { return p.readStruct(fv, terminator) case reflect.Uint32: if x, err := strconv.ParseUint(tok.value, 0, 32); err == nil { - fv.SetUint(x) + fv.SetUint(uint64(x)) return nil } case reflect.Uint64: @@ -883,13 +872,9 @@ func (p *textParser) readAny(v reflect.Value, props *Properties) error { // UnmarshalText returns *RequiredNotSetError. func UnmarshalText(s string, pb Message) error { if um, ok := pb.(encoding.TextUnmarshaler); ok { - err := um.UnmarshalText([]byte(s)) - return err + return um.UnmarshalText([]byte(s)) } pb.Reset() v := reflect.ValueOf(pb) - if pe := newTextParser(s).readStruct(v.Elem(), ""); pe != nil { - return pe - } - return nil + return newTextParser(s).readStruct(v.Elem(), "") } diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/Makefile b/vendor/github.com/golang/protobuf/protoc-gen-go/Makefile deleted file mode 100644 index a42cc3717..000000000 --- a/vendor/github.com/golang/protobuf/protoc-gen-go/Makefile +++ /dev/null @@ -1,33 +0,0 @@ -# Go support for Protocol Buffers - Google's data interchange format -# -# Copyright 2010 The Go Authors. All rights reserved. -# https://github.com/golang/protobuf -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -test: - cd testdata && make test diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/descriptor/Makefile b/vendor/github.com/golang/protobuf/protoc-gen-go/descriptor/Makefile deleted file mode 100644 index f706871a6..000000000 --- a/vendor/github.com/golang/protobuf/protoc-gen-go/descriptor/Makefile +++ /dev/null @@ -1,37 +0,0 @@ -# Go support for Protocol Buffers - Google's data interchange format -# -# Copyright 2010 The Go Authors. All rights reserved. -# https://github.com/golang/protobuf -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -# Not stored here, but descriptor.proto is in https://github.com/google/protobuf/ -# at src/google/protobuf/descriptor.proto -regenerate: - @echo WARNING! THIS RULE IS PROBABLY NOT RIGHT FOR YOUR INSTALLATION - cp $(HOME)/src/protobuf/include/google/protobuf/descriptor.proto . - protoc --go_out=../../../../.. -I$(HOME)/src/protobuf/include $(HOME)/src/protobuf/include/google/protobuf/descriptor.proto diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/descriptor/descriptor.pb.go b/vendor/github.com/golang/protobuf/protoc-gen-go/descriptor/descriptor.pb.go index c6a91bcab..e855b1f5c 100644 --- a/vendor/github.com/golang/protobuf/protoc-gen-go/descriptor/descriptor.pb.go +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/descriptor/descriptor.pb.go @@ -1,36 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // source: google/protobuf/descriptor.proto -/* -Package descriptor is a generated protocol buffer package. - -It is generated from these files: - google/protobuf/descriptor.proto - -It has these top-level messages: - FileDescriptorSet - FileDescriptorProto - DescriptorProto - ExtensionRangeOptions - FieldDescriptorProto - OneofDescriptorProto - EnumDescriptorProto - EnumValueDescriptorProto - ServiceDescriptorProto - MethodDescriptorProto - FileOptions - MessageOptions - FieldOptions - OneofOptions - EnumOptions - EnumValueOptions - ServiceOptions - MethodOptions - UninterpretedOption - SourceCodeInfo - GeneratedCodeInfo -*/ -package descriptor +package descriptor // import "github.com/golang/protobuf/protoc-gen-go/descriptor" import proto "github.com/golang/protobuf/proto" import fmt "fmt" @@ -138,7 +109,9 @@ func (x *FieldDescriptorProto_Type) UnmarshalJSON(data []byte) error { *x = FieldDescriptorProto_Type(value) return nil } -func (FieldDescriptorProto_Type) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{4, 0} } +func (FieldDescriptorProto_Type) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{4, 0} +} type FieldDescriptorProto_Label int32 @@ -177,7 +150,7 @@ func (x *FieldDescriptorProto_Label) UnmarshalJSON(data []byte) error { return nil } func (FieldDescriptorProto_Label) EnumDescriptor() ([]byte, []int) { - return fileDescriptor0, []int{4, 1} + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{4, 1} } // Generated classes can be optimized for speed or code size. @@ -217,7 +190,9 @@ func (x *FileOptions_OptimizeMode) UnmarshalJSON(data []byte) error { *x = FileOptions_OptimizeMode(value) return nil } -func (FileOptions_OptimizeMode) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{10, 0} } +func (FileOptions_OptimizeMode) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{10, 0} +} type FieldOptions_CType int32 @@ -255,7 +230,9 @@ func (x *FieldOptions_CType) UnmarshalJSON(data []byte) error { *x = FieldOptions_CType(value) return nil } -func (FieldOptions_CType) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{12, 0} } +func (FieldOptions_CType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{12, 0} +} type FieldOptions_JSType int32 @@ -295,7 +272,9 @@ func (x *FieldOptions_JSType) UnmarshalJSON(data []byte) error { *x = FieldOptions_JSType(value) return nil } -func (FieldOptions_JSType) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{12, 1} } +func (FieldOptions_JSType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{12, 1} +} // Is this method side-effect-free (or safe in HTTP parlance), or idempotent, // or neither? HTTP based RPC implementation may choose GET verb for safe @@ -336,20 +315,41 @@ func (x *MethodOptions_IdempotencyLevel) UnmarshalJSON(data []byte) error { return nil } func (MethodOptions_IdempotencyLevel) EnumDescriptor() ([]byte, []int) { - return fileDescriptor0, []int{17, 0} + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{17, 0} } // The protocol compiler can output a FileDescriptorSet containing the .proto // files it parses. type FileDescriptorSet struct { - File []*FileDescriptorProto `protobuf:"bytes,1,rep,name=file" json:"file,omitempty"` - XXX_unrecognized []byte `json:"-"` + File []*FileDescriptorProto `protobuf:"bytes,1,rep,name=file" json:"file,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *FileDescriptorSet) Reset() { *m = FileDescriptorSet{} } +func (m *FileDescriptorSet) String() string { return proto.CompactTextString(m) } +func (*FileDescriptorSet) ProtoMessage() {} +func (*FileDescriptorSet) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{0} +} +func (m *FileDescriptorSet) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_FileDescriptorSet.Unmarshal(m, b) +} +func (m *FileDescriptorSet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_FileDescriptorSet.Marshal(b, m, deterministic) +} +func (dst *FileDescriptorSet) XXX_Merge(src proto.Message) { + xxx_messageInfo_FileDescriptorSet.Merge(dst, src) +} +func (m *FileDescriptorSet) XXX_Size() int { + return xxx_messageInfo_FileDescriptorSet.Size(m) +} +func (m *FileDescriptorSet) XXX_DiscardUnknown() { + xxx_messageInfo_FileDescriptorSet.DiscardUnknown(m) } -func (m *FileDescriptorSet) Reset() { *m = FileDescriptorSet{} } -func (m *FileDescriptorSet) String() string { return proto.CompactTextString(m) } -func (*FileDescriptorSet) ProtoMessage() {} -func (*FileDescriptorSet) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } +var xxx_messageInfo_FileDescriptorSet proto.InternalMessageInfo func (m *FileDescriptorSet) GetFile() []*FileDescriptorProto { if m != nil { @@ -382,14 +382,35 @@ type FileDescriptorProto struct { SourceCodeInfo *SourceCodeInfo `protobuf:"bytes,9,opt,name=source_code_info,json=sourceCodeInfo" json:"source_code_info,omitempty"` // The syntax of the proto file. // The supported values are "proto2" and "proto3". - Syntax *string `protobuf:"bytes,12,opt,name=syntax" json:"syntax,omitempty"` - XXX_unrecognized []byte `json:"-"` + Syntax *string `protobuf:"bytes,12,opt,name=syntax" json:"syntax,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *FileDescriptorProto) Reset() { *m = FileDescriptorProto{} } +func (m *FileDescriptorProto) String() string { return proto.CompactTextString(m) } +func (*FileDescriptorProto) ProtoMessage() {} +func (*FileDescriptorProto) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{1} +} +func (m *FileDescriptorProto) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_FileDescriptorProto.Unmarshal(m, b) +} +func (m *FileDescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_FileDescriptorProto.Marshal(b, m, deterministic) +} +func (dst *FileDescriptorProto) XXX_Merge(src proto.Message) { + xxx_messageInfo_FileDescriptorProto.Merge(dst, src) +} +func (m *FileDescriptorProto) XXX_Size() int { + return xxx_messageInfo_FileDescriptorProto.Size(m) +} +func (m *FileDescriptorProto) XXX_DiscardUnknown() { + xxx_messageInfo_FileDescriptorProto.DiscardUnknown(m) } -func (m *FileDescriptorProto) Reset() { *m = FileDescriptorProto{} } -func (m *FileDescriptorProto) String() string { return proto.CompactTextString(m) } -func (*FileDescriptorProto) ProtoMessage() {} -func (*FileDescriptorProto) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } +var xxx_messageInfo_FileDescriptorProto proto.InternalMessageInfo func (m *FileDescriptorProto) GetName() string { if m != nil && m.Name != nil { @@ -488,14 +509,35 @@ type DescriptorProto struct { ReservedRange []*DescriptorProto_ReservedRange `protobuf:"bytes,9,rep,name=reserved_range,json=reservedRange" json:"reserved_range,omitempty"` // Reserved field names, which may not be used by fields in the same message. // A given name may only be reserved once. - ReservedName []string `protobuf:"bytes,10,rep,name=reserved_name,json=reservedName" json:"reserved_name,omitempty"` - XXX_unrecognized []byte `json:"-"` + ReservedName []string `protobuf:"bytes,10,rep,name=reserved_name,json=reservedName" json:"reserved_name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DescriptorProto) Reset() { *m = DescriptorProto{} } +func (m *DescriptorProto) String() string { return proto.CompactTextString(m) } +func (*DescriptorProto) ProtoMessage() {} +func (*DescriptorProto) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{2} +} +func (m *DescriptorProto) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DescriptorProto.Unmarshal(m, b) +} +func (m *DescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DescriptorProto.Marshal(b, m, deterministic) +} +func (dst *DescriptorProto) XXX_Merge(src proto.Message) { + xxx_messageInfo_DescriptorProto.Merge(dst, src) +} +func (m *DescriptorProto) XXX_Size() int { + return xxx_messageInfo_DescriptorProto.Size(m) +} +func (m *DescriptorProto) XXX_DiscardUnknown() { + xxx_messageInfo_DescriptorProto.DiscardUnknown(m) } -func (m *DescriptorProto) Reset() { *m = DescriptorProto{} } -func (m *DescriptorProto) String() string { return proto.CompactTextString(m) } -func (*DescriptorProto) ProtoMessage() {} -func (*DescriptorProto) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } +var xxx_messageInfo_DescriptorProto proto.InternalMessageInfo func (m *DescriptorProto) GetName() string { if m != nil && m.Name != nil { @@ -568,19 +610,38 @@ func (m *DescriptorProto) GetReservedName() []string { } type DescriptorProto_ExtensionRange struct { - Start *int32 `protobuf:"varint,1,opt,name=start" json:"start,omitempty"` - End *int32 `protobuf:"varint,2,opt,name=end" json:"end,omitempty"` - Options *ExtensionRangeOptions `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"` - XXX_unrecognized []byte `json:"-"` + Start *int32 `protobuf:"varint,1,opt,name=start" json:"start,omitempty"` + End *int32 `protobuf:"varint,2,opt,name=end" json:"end,omitempty"` + Options *ExtensionRangeOptions `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *DescriptorProto_ExtensionRange) Reset() { *m = DescriptorProto_ExtensionRange{} } func (m *DescriptorProto_ExtensionRange) String() string { return proto.CompactTextString(m) } func (*DescriptorProto_ExtensionRange) ProtoMessage() {} func (*DescriptorProto_ExtensionRange) Descriptor() ([]byte, []int) { - return fileDescriptor0, []int{2, 0} + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{2, 0} +} +func (m *DescriptorProto_ExtensionRange) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DescriptorProto_ExtensionRange.Unmarshal(m, b) +} +func (m *DescriptorProto_ExtensionRange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DescriptorProto_ExtensionRange.Marshal(b, m, deterministic) +} +func (dst *DescriptorProto_ExtensionRange) XXX_Merge(src proto.Message) { + xxx_messageInfo_DescriptorProto_ExtensionRange.Merge(dst, src) +} +func (m *DescriptorProto_ExtensionRange) XXX_Size() int { + return xxx_messageInfo_DescriptorProto_ExtensionRange.Size(m) +} +func (m *DescriptorProto_ExtensionRange) XXX_DiscardUnknown() { + xxx_messageInfo_DescriptorProto_ExtensionRange.DiscardUnknown(m) } +var xxx_messageInfo_DescriptorProto_ExtensionRange proto.InternalMessageInfo + func (m *DescriptorProto_ExtensionRange) GetStart() int32 { if m != nil && m.Start != nil { return *m.Start @@ -606,17 +667,36 @@ func (m *DescriptorProto_ExtensionRange) GetOptions() *ExtensionRangeOptions { // fields or extension ranges in the same message. Reserved ranges may // not overlap. type DescriptorProto_ReservedRange struct { - Start *int32 `protobuf:"varint,1,opt,name=start" json:"start,omitempty"` - End *int32 `protobuf:"varint,2,opt,name=end" json:"end,omitempty"` - XXX_unrecognized []byte `json:"-"` + Start *int32 `protobuf:"varint,1,opt,name=start" json:"start,omitempty"` + End *int32 `protobuf:"varint,2,opt,name=end" json:"end,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *DescriptorProto_ReservedRange) Reset() { *m = DescriptorProto_ReservedRange{} } func (m *DescriptorProto_ReservedRange) String() string { return proto.CompactTextString(m) } func (*DescriptorProto_ReservedRange) ProtoMessage() {} func (*DescriptorProto_ReservedRange) Descriptor() ([]byte, []int) { - return fileDescriptor0, []int{2, 1} + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{2, 1} +} +func (m *DescriptorProto_ReservedRange) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DescriptorProto_ReservedRange.Unmarshal(m, b) +} +func (m *DescriptorProto_ReservedRange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DescriptorProto_ReservedRange.Marshal(b, m, deterministic) +} +func (dst *DescriptorProto_ReservedRange) XXX_Merge(src proto.Message) { + xxx_messageInfo_DescriptorProto_ReservedRange.Merge(dst, src) +} +func (m *DescriptorProto_ReservedRange) XXX_Size() int { + return xxx_messageInfo_DescriptorProto_ReservedRange.Size(m) } +func (m *DescriptorProto_ReservedRange) XXX_DiscardUnknown() { + xxx_messageInfo_DescriptorProto_ReservedRange.DiscardUnknown(m) +} + +var xxx_messageInfo_DescriptorProto_ReservedRange proto.InternalMessageInfo func (m *DescriptorProto_ReservedRange) GetStart() int32 { if m != nil && m.Start != nil { @@ -635,22 +715,43 @@ func (m *DescriptorProto_ReservedRange) GetEnd() int32 { type ExtensionRangeOptions struct { // The parser stores options it doesn't recognize here. See above. UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` proto.XXX_InternalExtensions `json:"-"` XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *ExtensionRangeOptions) Reset() { *m = ExtensionRangeOptions{} } -func (m *ExtensionRangeOptions) String() string { return proto.CompactTextString(m) } -func (*ExtensionRangeOptions) ProtoMessage() {} -func (*ExtensionRangeOptions) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } +func (m *ExtensionRangeOptions) Reset() { *m = ExtensionRangeOptions{} } +func (m *ExtensionRangeOptions) String() string { return proto.CompactTextString(m) } +func (*ExtensionRangeOptions) ProtoMessage() {} +func (*ExtensionRangeOptions) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{3} +} var extRange_ExtensionRangeOptions = []proto.ExtensionRange{ - {1000, 536870911}, + {Start: 1000, End: 536870911}, } func (*ExtensionRangeOptions) ExtensionRangeArray() []proto.ExtensionRange { return extRange_ExtensionRangeOptions } +func (m *ExtensionRangeOptions) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ExtensionRangeOptions.Unmarshal(m, b) +} +func (m *ExtensionRangeOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ExtensionRangeOptions.Marshal(b, m, deterministic) +} +func (dst *ExtensionRangeOptions) XXX_Merge(src proto.Message) { + xxx_messageInfo_ExtensionRangeOptions.Merge(dst, src) +} +func (m *ExtensionRangeOptions) XXX_Size() int { + return xxx_messageInfo_ExtensionRangeOptions.Size(m) +} +func (m *ExtensionRangeOptions) XXX_DiscardUnknown() { + xxx_messageInfo_ExtensionRangeOptions.DiscardUnknown(m) +} + +var xxx_messageInfo_ExtensionRangeOptions proto.InternalMessageInfo func (m *ExtensionRangeOptions) GetUninterpretedOption() []*UninterpretedOption { if m != nil { @@ -689,15 +790,36 @@ type FieldDescriptorProto struct { // user has set a "json_name" option on this field, that option's value // will be used. Otherwise, it's deduced from the field's name by converting // it to camelCase. - JsonName *string `protobuf:"bytes,10,opt,name=json_name,json=jsonName" json:"json_name,omitempty"` - Options *FieldOptions `protobuf:"bytes,8,opt,name=options" json:"options,omitempty"` - XXX_unrecognized []byte `json:"-"` + JsonName *string `protobuf:"bytes,10,opt,name=json_name,json=jsonName" json:"json_name,omitempty"` + Options *FieldOptions `protobuf:"bytes,8,opt,name=options" json:"options,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *FieldDescriptorProto) Reset() { *m = FieldDescriptorProto{} } -func (m *FieldDescriptorProto) String() string { return proto.CompactTextString(m) } -func (*FieldDescriptorProto) ProtoMessage() {} -func (*FieldDescriptorProto) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} } +func (m *FieldDescriptorProto) Reset() { *m = FieldDescriptorProto{} } +func (m *FieldDescriptorProto) String() string { return proto.CompactTextString(m) } +func (*FieldDescriptorProto) ProtoMessage() {} +func (*FieldDescriptorProto) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{4} +} +func (m *FieldDescriptorProto) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_FieldDescriptorProto.Unmarshal(m, b) +} +func (m *FieldDescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_FieldDescriptorProto.Marshal(b, m, deterministic) +} +func (dst *FieldDescriptorProto) XXX_Merge(src proto.Message) { + xxx_messageInfo_FieldDescriptorProto.Merge(dst, src) +} +func (m *FieldDescriptorProto) XXX_Size() int { + return xxx_messageInfo_FieldDescriptorProto.Size(m) +} +func (m *FieldDescriptorProto) XXX_DiscardUnknown() { + xxx_messageInfo_FieldDescriptorProto.DiscardUnknown(m) +} + +var xxx_messageInfo_FieldDescriptorProto proto.InternalMessageInfo func (m *FieldDescriptorProto) GetName() string { if m != nil && m.Name != nil { @@ -771,15 +893,36 @@ func (m *FieldDescriptorProto) GetOptions() *FieldOptions { // Describes a oneof. type OneofDescriptorProto struct { - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - Options *OneofOptions `protobuf:"bytes,2,opt,name=options" json:"options,omitempty"` - XXX_unrecognized []byte `json:"-"` + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Options *OneofOptions `protobuf:"bytes,2,opt,name=options" json:"options,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *OneofDescriptorProto) Reset() { *m = OneofDescriptorProto{} } +func (m *OneofDescriptorProto) String() string { return proto.CompactTextString(m) } +func (*OneofDescriptorProto) ProtoMessage() {} +func (*OneofDescriptorProto) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{5} +} +func (m *OneofDescriptorProto) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_OneofDescriptorProto.Unmarshal(m, b) +} +func (m *OneofDescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_OneofDescriptorProto.Marshal(b, m, deterministic) +} +func (dst *OneofDescriptorProto) XXX_Merge(src proto.Message) { + xxx_messageInfo_OneofDescriptorProto.Merge(dst, src) +} +func (m *OneofDescriptorProto) XXX_Size() int { + return xxx_messageInfo_OneofDescriptorProto.Size(m) +} +func (m *OneofDescriptorProto) XXX_DiscardUnknown() { + xxx_messageInfo_OneofDescriptorProto.DiscardUnknown(m) } -func (m *OneofDescriptorProto) Reset() { *m = OneofDescriptorProto{} } -func (m *OneofDescriptorProto) String() string { return proto.CompactTextString(m) } -func (*OneofDescriptorProto) ProtoMessage() {} -func (*OneofDescriptorProto) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} } +var xxx_messageInfo_OneofDescriptorProto proto.InternalMessageInfo func (m *OneofDescriptorProto) GetName() string { if m != nil && m.Name != nil { @@ -797,16 +940,44 @@ func (m *OneofDescriptorProto) GetOptions() *OneofOptions { // Describes an enum type. type EnumDescriptorProto struct { - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - Value []*EnumValueDescriptorProto `protobuf:"bytes,2,rep,name=value" json:"value,omitempty"` - Options *EnumOptions `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"` - XXX_unrecognized []byte `json:"-"` + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Value []*EnumValueDescriptorProto `protobuf:"bytes,2,rep,name=value" json:"value,omitempty"` + Options *EnumOptions `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"` + // Range of reserved numeric values. Reserved numeric values may not be used + // by enum values in the same enum declaration. Reserved ranges may not + // overlap. + ReservedRange []*EnumDescriptorProto_EnumReservedRange `protobuf:"bytes,4,rep,name=reserved_range,json=reservedRange" json:"reserved_range,omitempty"` + // Reserved enum value names, which may not be reused. A given name may only + // be reserved once. + ReservedName []string `protobuf:"bytes,5,rep,name=reserved_name,json=reservedName" json:"reserved_name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *EnumDescriptorProto) Reset() { *m = EnumDescriptorProto{} } +func (m *EnumDescriptorProto) String() string { return proto.CompactTextString(m) } +func (*EnumDescriptorProto) ProtoMessage() {} +func (*EnumDescriptorProto) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{6} +} +func (m *EnumDescriptorProto) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_EnumDescriptorProto.Unmarshal(m, b) +} +func (m *EnumDescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_EnumDescriptorProto.Marshal(b, m, deterministic) +} +func (dst *EnumDescriptorProto) XXX_Merge(src proto.Message) { + xxx_messageInfo_EnumDescriptorProto.Merge(dst, src) +} +func (m *EnumDescriptorProto) XXX_Size() int { + return xxx_messageInfo_EnumDescriptorProto.Size(m) +} +func (m *EnumDescriptorProto) XXX_DiscardUnknown() { + xxx_messageInfo_EnumDescriptorProto.DiscardUnknown(m) } -func (m *EnumDescriptorProto) Reset() { *m = EnumDescriptorProto{} } -func (m *EnumDescriptorProto) String() string { return proto.CompactTextString(m) } -func (*EnumDescriptorProto) ProtoMessage() {} -func (*EnumDescriptorProto) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} } +var xxx_messageInfo_EnumDescriptorProto proto.InternalMessageInfo func (m *EnumDescriptorProto) GetName() string { if m != nil && m.Name != nil { @@ -829,18 +1000,105 @@ func (m *EnumDescriptorProto) GetOptions() *EnumOptions { return nil } +func (m *EnumDescriptorProto) GetReservedRange() []*EnumDescriptorProto_EnumReservedRange { + if m != nil { + return m.ReservedRange + } + return nil +} + +func (m *EnumDescriptorProto) GetReservedName() []string { + if m != nil { + return m.ReservedName + } + return nil +} + +// Range of reserved numeric values. Reserved values may not be used by +// entries in the same enum. Reserved ranges may not overlap. +// +// Note that this is distinct from DescriptorProto.ReservedRange in that it +// is inclusive such that it can appropriately represent the entire int32 +// domain. +type EnumDescriptorProto_EnumReservedRange struct { + Start *int32 `protobuf:"varint,1,opt,name=start" json:"start,omitempty"` + End *int32 `protobuf:"varint,2,opt,name=end" json:"end,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *EnumDescriptorProto_EnumReservedRange) Reset() { *m = EnumDescriptorProto_EnumReservedRange{} } +func (m *EnumDescriptorProto_EnumReservedRange) String() string { return proto.CompactTextString(m) } +func (*EnumDescriptorProto_EnumReservedRange) ProtoMessage() {} +func (*EnumDescriptorProto_EnumReservedRange) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{6, 0} +} +func (m *EnumDescriptorProto_EnumReservedRange) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_EnumDescriptorProto_EnumReservedRange.Unmarshal(m, b) +} +func (m *EnumDescriptorProto_EnumReservedRange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_EnumDescriptorProto_EnumReservedRange.Marshal(b, m, deterministic) +} +func (dst *EnumDescriptorProto_EnumReservedRange) XXX_Merge(src proto.Message) { + xxx_messageInfo_EnumDescriptorProto_EnumReservedRange.Merge(dst, src) +} +func (m *EnumDescriptorProto_EnumReservedRange) XXX_Size() int { + return xxx_messageInfo_EnumDescriptorProto_EnumReservedRange.Size(m) +} +func (m *EnumDescriptorProto_EnumReservedRange) XXX_DiscardUnknown() { + xxx_messageInfo_EnumDescriptorProto_EnumReservedRange.DiscardUnknown(m) +} + +var xxx_messageInfo_EnumDescriptorProto_EnumReservedRange proto.InternalMessageInfo + +func (m *EnumDescriptorProto_EnumReservedRange) GetStart() int32 { + if m != nil && m.Start != nil { + return *m.Start + } + return 0 +} + +func (m *EnumDescriptorProto_EnumReservedRange) GetEnd() int32 { + if m != nil && m.End != nil { + return *m.End + } + return 0 +} + // Describes a value within an enum. type EnumValueDescriptorProto struct { - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - Number *int32 `protobuf:"varint,2,opt,name=number" json:"number,omitempty"` - Options *EnumValueOptions `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"` - XXX_unrecognized []byte `json:"-"` + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Number *int32 `protobuf:"varint,2,opt,name=number" json:"number,omitempty"` + Options *EnumValueOptions `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *EnumValueDescriptorProto) Reset() { *m = EnumValueDescriptorProto{} } -func (m *EnumValueDescriptorProto) String() string { return proto.CompactTextString(m) } -func (*EnumValueDescriptorProto) ProtoMessage() {} -func (*EnumValueDescriptorProto) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} } +func (m *EnumValueDescriptorProto) Reset() { *m = EnumValueDescriptorProto{} } +func (m *EnumValueDescriptorProto) String() string { return proto.CompactTextString(m) } +func (*EnumValueDescriptorProto) ProtoMessage() {} +func (*EnumValueDescriptorProto) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{7} +} +func (m *EnumValueDescriptorProto) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_EnumValueDescriptorProto.Unmarshal(m, b) +} +func (m *EnumValueDescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_EnumValueDescriptorProto.Marshal(b, m, deterministic) +} +func (dst *EnumValueDescriptorProto) XXX_Merge(src proto.Message) { + xxx_messageInfo_EnumValueDescriptorProto.Merge(dst, src) +} +func (m *EnumValueDescriptorProto) XXX_Size() int { + return xxx_messageInfo_EnumValueDescriptorProto.Size(m) +} +func (m *EnumValueDescriptorProto) XXX_DiscardUnknown() { + xxx_messageInfo_EnumValueDescriptorProto.DiscardUnknown(m) +} + +var xxx_messageInfo_EnumValueDescriptorProto proto.InternalMessageInfo func (m *EnumValueDescriptorProto) GetName() string { if m != nil && m.Name != nil { @@ -865,16 +1123,37 @@ func (m *EnumValueDescriptorProto) GetOptions() *EnumValueOptions { // Describes a service. type ServiceDescriptorProto struct { - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - Method []*MethodDescriptorProto `protobuf:"bytes,2,rep,name=method" json:"method,omitempty"` - Options *ServiceOptions `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"` - XXX_unrecognized []byte `json:"-"` + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Method []*MethodDescriptorProto `protobuf:"bytes,2,rep,name=method" json:"method,omitempty"` + Options *ServiceOptions `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *ServiceDescriptorProto) Reset() { *m = ServiceDescriptorProto{} } -func (m *ServiceDescriptorProto) String() string { return proto.CompactTextString(m) } -func (*ServiceDescriptorProto) ProtoMessage() {} -func (*ServiceDescriptorProto) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} } +func (m *ServiceDescriptorProto) Reset() { *m = ServiceDescriptorProto{} } +func (m *ServiceDescriptorProto) String() string { return proto.CompactTextString(m) } +func (*ServiceDescriptorProto) ProtoMessage() {} +func (*ServiceDescriptorProto) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{8} +} +func (m *ServiceDescriptorProto) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ServiceDescriptorProto.Unmarshal(m, b) +} +func (m *ServiceDescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ServiceDescriptorProto.Marshal(b, m, deterministic) +} +func (dst *ServiceDescriptorProto) XXX_Merge(src proto.Message) { + xxx_messageInfo_ServiceDescriptorProto.Merge(dst, src) +} +func (m *ServiceDescriptorProto) XXX_Size() int { + return xxx_messageInfo_ServiceDescriptorProto.Size(m) +} +func (m *ServiceDescriptorProto) XXX_DiscardUnknown() { + xxx_messageInfo_ServiceDescriptorProto.DiscardUnknown(m) +} + +var xxx_messageInfo_ServiceDescriptorProto proto.InternalMessageInfo func (m *ServiceDescriptorProto) GetName() string { if m != nil && m.Name != nil { @@ -908,14 +1187,35 @@ type MethodDescriptorProto struct { // Identifies if client streams multiple client messages ClientStreaming *bool `protobuf:"varint,5,opt,name=client_streaming,json=clientStreaming,def=0" json:"client_streaming,omitempty"` // Identifies if server streams multiple server messages - ServerStreaming *bool `protobuf:"varint,6,opt,name=server_streaming,json=serverStreaming,def=0" json:"server_streaming,omitempty"` - XXX_unrecognized []byte `json:"-"` + ServerStreaming *bool `protobuf:"varint,6,opt,name=server_streaming,json=serverStreaming,def=0" json:"server_streaming,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MethodDescriptorProto) Reset() { *m = MethodDescriptorProto{} } +func (m *MethodDescriptorProto) String() string { return proto.CompactTextString(m) } +func (*MethodDescriptorProto) ProtoMessage() {} +func (*MethodDescriptorProto) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{9} +} +func (m *MethodDescriptorProto) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MethodDescriptorProto.Unmarshal(m, b) +} +func (m *MethodDescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MethodDescriptorProto.Marshal(b, m, deterministic) +} +func (dst *MethodDescriptorProto) XXX_Merge(src proto.Message) { + xxx_messageInfo_MethodDescriptorProto.Merge(dst, src) +} +func (m *MethodDescriptorProto) XXX_Size() int { + return xxx_messageInfo_MethodDescriptorProto.Size(m) +} +func (m *MethodDescriptorProto) XXX_DiscardUnknown() { + xxx_messageInfo_MethodDescriptorProto.DiscardUnknown(m) } -func (m *MethodDescriptorProto) Reset() { *m = MethodDescriptorProto{} } -func (m *MethodDescriptorProto) String() string { return proto.CompactTextString(m) } -func (*MethodDescriptorProto) ProtoMessage() {} -func (*MethodDescriptorProto) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} } +var xxx_messageInfo_MethodDescriptorProto proto.InternalMessageInfo const Default_MethodDescriptorProto_ClientStreaming bool = false const Default_MethodDescriptorProto_ServerStreaming bool = false @@ -982,7 +1282,7 @@ type FileOptions struct { // top-level extensions defined in the file. JavaMultipleFiles *bool `protobuf:"varint,10,opt,name=java_multiple_files,json=javaMultipleFiles,def=0" json:"java_multiple_files,omitempty"` // This option does nothing. - JavaGenerateEqualsAndHash *bool `protobuf:"varint,20,opt,name=java_generate_equals_and_hash,json=javaGenerateEqualsAndHash" json:"java_generate_equals_and_hash,omitempty"` + JavaGenerateEqualsAndHash *bool `protobuf:"varint,20,opt,name=java_generate_equals_and_hash,json=javaGenerateEqualsAndHash" json:"java_generate_equals_and_hash,omitempty"` // Deprecated: Do not use. // If set true, then the Java2 code generator will generate code that // throws an exception whenever an attempt is made to assign a non-UTF-8 // byte sequence to a string field. @@ -1036,24 +1336,46 @@ type FileOptions struct { // is empty. When this option is empty, the package name will be used for // determining the namespace. PhpNamespace *string `protobuf:"bytes,41,opt,name=php_namespace,json=phpNamespace" json:"php_namespace,omitempty"` - // The parser stores options it doesn't recognize here. See above. + // The parser stores options it doesn't recognize here. + // See the documentation for the "Options" section above. UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` proto.XXX_InternalExtensions `json:"-"` XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *FileOptions) Reset() { *m = FileOptions{} } -func (m *FileOptions) String() string { return proto.CompactTextString(m) } -func (*FileOptions) ProtoMessage() {} -func (*FileOptions) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10} } +func (m *FileOptions) Reset() { *m = FileOptions{} } +func (m *FileOptions) String() string { return proto.CompactTextString(m) } +func (*FileOptions) ProtoMessage() {} +func (*FileOptions) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{10} +} var extRange_FileOptions = []proto.ExtensionRange{ - {1000, 536870911}, + {Start: 1000, End: 536870911}, } func (*FileOptions) ExtensionRangeArray() []proto.ExtensionRange { return extRange_FileOptions } +func (m *FileOptions) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_FileOptions.Unmarshal(m, b) +} +func (m *FileOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_FileOptions.Marshal(b, m, deterministic) +} +func (dst *FileOptions) XXX_Merge(src proto.Message) { + xxx_messageInfo_FileOptions.Merge(dst, src) +} +func (m *FileOptions) XXX_Size() int { + return xxx_messageInfo_FileOptions.Size(m) +} +func (m *FileOptions) XXX_DiscardUnknown() { + xxx_messageInfo_FileOptions.DiscardUnknown(m) +} + +var xxx_messageInfo_FileOptions proto.InternalMessageInfo const Default_FileOptions_JavaMultipleFiles bool = false const Default_FileOptions_JavaStringCheckUtf8 bool = false @@ -1086,6 +1408,7 @@ func (m *FileOptions) GetJavaMultipleFiles() bool { return Default_FileOptions_JavaMultipleFiles } +// Deprecated: Do not use. func (m *FileOptions) GetJavaGenerateEqualsAndHash() bool { if m != nil && m.JavaGenerateEqualsAndHash != nil { return *m.JavaGenerateEqualsAndHash @@ -1251,22 +1574,43 @@ type MessageOptions struct { MapEntry *bool `protobuf:"varint,7,opt,name=map_entry,json=mapEntry" json:"map_entry,omitempty"` // The parser stores options it doesn't recognize here. See above. UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` proto.XXX_InternalExtensions `json:"-"` XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *MessageOptions) Reset() { *m = MessageOptions{} } -func (m *MessageOptions) String() string { return proto.CompactTextString(m) } -func (*MessageOptions) ProtoMessage() {} -func (*MessageOptions) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{11} } +func (m *MessageOptions) Reset() { *m = MessageOptions{} } +func (m *MessageOptions) String() string { return proto.CompactTextString(m) } +func (*MessageOptions) ProtoMessage() {} +func (*MessageOptions) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{11} +} var extRange_MessageOptions = []proto.ExtensionRange{ - {1000, 536870911}, + {Start: 1000, End: 536870911}, } func (*MessageOptions) ExtensionRangeArray() []proto.ExtensionRange { return extRange_MessageOptions } +func (m *MessageOptions) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MessageOptions.Unmarshal(m, b) +} +func (m *MessageOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MessageOptions.Marshal(b, m, deterministic) +} +func (dst *MessageOptions) XXX_Merge(src proto.Message) { + xxx_messageInfo_MessageOptions.Merge(dst, src) +} +func (m *MessageOptions) XXX_Size() int { + return xxx_messageInfo_MessageOptions.Size(m) +} +func (m *MessageOptions) XXX_DiscardUnknown() { + xxx_messageInfo_MessageOptions.DiscardUnknown(m) +} + +var xxx_messageInfo_MessageOptions proto.InternalMessageInfo const Default_MessageOptions_MessageSetWireFormat bool = false const Default_MessageOptions_NoStandardDescriptorAccessor bool = false @@ -1369,22 +1713,43 @@ type FieldOptions struct { Weak *bool `protobuf:"varint,10,opt,name=weak,def=0" json:"weak,omitempty"` // The parser stores options it doesn't recognize here. See above. UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` proto.XXX_InternalExtensions `json:"-"` XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *FieldOptions) Reset() { *m = FieldOptions{} } -func (m *FieldOptions) String() string { return proto.CompactTextString(m) } -func (*FieldOptions) ProtoMessage() {} -func (*FieldOptions) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{12} } +func (m *FieldOptions) Reset() { *m = FieldOptions{} } +func (m *FieldOptions) String() string { return proto.CompactTextString(m) } +func (*FieldOptions) ProtoMessage() {} +func (*FieldOptions) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{12} +} var extRange_FieldOptions = []proto.ExtensionRange{ - {1000, 536870911}, + {Start: 1000, End: 536870911}, } func (*FieldOptions) ExtensionRangeArray() []proto.ExtensionRange { return extRange_FieldOptions } +func (m *FieldOptions) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_FieldOptions.Unmarshal(m, b) +} +func (m *FieldOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_FieldOptions.Marshal(b, m, deterministic) +} +func (dst *FieldOptions) XXX_Merge(src proto.Message) { + xxx_messageInfo_FieldOptions.Merge(dst, src) +} +func (m *FieldOptions) XXX_Size() int { + return xxx_messageInfo_FieldOptions.Size(m) +} +func (m *FieldOptions) XXX_DiscardUnknown() { + xxx_messageInfo_FieldOptions.DiscardUnknown(m) +} + +var xxx_messageInfo_FieldOptions proto.InternalMessageInfo const Default_FieldOptions_Ctype FieldOptions_CType = FieldOptions_STRING const Default_FieldOptions_Jstype FieldOptions_JSType = FieldOptions_JS_NORMAL @@ -1444,22 +1809,43 @@ func (m *FieldOptions) GetUninterpretedOption() []*UninterpretedOption { type OneofOptions struct { // The parser stores options it doesn't recognize here. See above. UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` proto.XXX_InternalExtensions `json:"-"` XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *OneofOptions) Reset() { *m = OneofOptions{} } -func (m *OneofOptions) String() string { return proto.CompactTextString(m) } -func (*OneofOptions) ProtoMessage() {} -func (*OneofOptions) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{13} } +func (m *OneofOptions) Reset() { *m = OneofOptions{} } +func (m *OneofOptions) String() string { return proto.CompactTextString(m) } +func (*OneofOptions) ProtoMessage() {} +func (*OneofOptions) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{13} +} var extRange_OneofOptions = []proto.ExtensionRange{ - {1000, 536870911}, + {Start: 1000, End: 536870911}, } func (*OneofOptions) ExtensionRangeArray() []proto.ExtensionRange { return extRange_OneofOptions } +func (m *OneofOptions) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_OneofOptions.Unmarshal(m, b) +} +func (m *OneofOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_OneofOptions.Marshal(b, m, deterministic) +} +func (dst *OneofOptions) XXX_Merge(src proto.Message) { + xxx_messageInfo_OneofOptions.Merge(dst, src) +} +func (m *OneofOptions) XXX_Size() int { + return xxx_messageInfo_OneofOptions.Size(m) +} +func (m *OneofOptions) XXX_DiscardUnknown() { + xxx_messageInfo_OneofOptions.DiscardUnknown(m) +} + +var xxx_messageInfo_OneofOptions proto.InternalMessageInfo func (m *OneofOptions) GetUninterpretedOption() []*UninterpretedOption { if m != nil { @@ -1479,22 +1865,43 @@ type EnumOptions struct { Deprecated *bool `protobuf:"varint,3,opt,name=deprecated,def=0" json:"deprecated,omitempty"` // The parser stores options it doesn't recognize here. See above. UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` proto.XXX_InternalExtensions `json:"-"` XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *EnumOptions) Reset() { *m = EnumOptions{} } -func (m *EnumOptions) String() string { return proto.CompactTextString(m) } -func (*EnumOptions) ProtoMessage() {} -func (*EnumOptions) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{14} } +func (m *EnumOptions) Reset() { *m = EnumOptions{} } +func (m *EnumOptions) String() string { return proto.CompactTextString(m) } +func (*EnumOptions) ProtoMessage() {} +func (*EnumOptions) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{14} +} var extRange_EnumOptions = []proto.ExtensionRange{ - {1000, 536870911}, + {Start: 1000, End: 536870911}, } func (*EnumOptions) ExtensionRangeArray() []proto.ExtensionRange { return extRange_EnumOptions } +func (m *EnumOptions) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_EnumOptions.Unmarshal(m, b) +} +func (m *EnumOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_EnumOptions.Marshal(b, m, deterministic) +} +func (dst *EnumOptions) XXX_Merge(src proto.Message) { + xxx_messageInfo_EnumOptions.Merge(dst, src) +} +func (m *EnumOptions) XXX_Size() int { + return xxx_messageInfo_EnumOptions.Size(m) +} +func (m *EnumOptions) XXX_DiscardUnknown() { + xxx_messageInfo_EnumOptions.DiscardUnknown(m) +} + +var xxx_messageInfo_EnumOptions proto.InternalMessageInfo const Default_EnumOptions_Deprecated bool = false @@ -1527,22 +1934,43 @@ type EnumValueOptions struct { Deprecated *bool `protobuf:"varint,1,opt,name=deprecated,def=0" json:"deprecated,omitempty"` // The parser stores options it doesn't recognize here. See above. UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` proto.XXX_InternalExtensions `json:"-"` XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *EnumValueOptions) Reset() { *m = EnumValueOptions{} } -func (m *EnumValueOptions) String() string { return proto.CompactTextString(m) } -func (*EnumValueOptions) ProtoMessage() {} -func (*EnumValueOptions) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{15} } +func (m *EnumValueOptions) Reset() { *m = EnumValueOptions{} } +func (m *EnumValueOptions) String() string { return proto.CompactTextString(m) } +func (*EnumValueOptions) ProtoMessage() {} +func (*EnumValueOptions) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{15} +} var extRange_EnumValueOptions = []proto.ExtensionRange{ - {1000, 536870911}, + {Start: 1000, End: 536870911}, } func (*EnumValueOptions) ExtensionRangeArray() []proto.ExtensionRange { return extRange_EnumValueOptions } +func (m *EnumValueOptions) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_EnumValueOptions.Unmarshal(m, b) +} +func (m *EnumValueOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_EnumValueOptions.Marshal(b, m, deterministic) +} +func (dst *EnumValueOptions) XXX_Merge(src proto.Message) { + xxx_messageInfo_EnumValueOptions.Merge(dst, src) +} +func (m *EnumValueOptions) XXX_Size() int { + return xxx_messageInfo_EnumValueOptions.Size(m) +} +func (m *EnumValueOptions) XXX_DiscardUnknown() { + xxx_messageInfo_EnumValueOptions.DiscardUnknown(m) +} + +var xxx_messageInfo_EnumValueOptions proto.InternalMessageInfo const Default_EnumValueOptions_Deprecated bool = false @@ -1568,22 +1996,43 @@ type ServiceOptions struct { Deprecated *bool `protobuf:"varint,33,opt,name=deprecated,def=0" json:"deprecated,omitempty"` // The parser stores options it doesn't recognize here. See above. UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` proto.XXX_InternalExtensions `json:"-"` XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *ServiceOptions) Reset() { *m = ServiceOptions{} } -func (m *ServiceOptions) String() string { return proto.CompactTextString(m) } -func (*ServiceOptions) ProtoMessage() {} -func (*ServiceOptions) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{16} } +func (m *ServiceOptions) Reset() { *m = ServiceOptions{} } +func (m *ServiceOptions) String() string { return proto.CompactTextString(m) } +func (*ServiceOptions) ProtoMessage() {} +func (*ServiceOptions) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{16} +} var extRange_ServiceOptions = []proto.ExtensionRange{ - {1000, 536870911}, + {Start: 1000, End: 536870911}, } func (*ServiceOptions) ExtensionRangeArray() []proto.ExtensionRange { return extRange_ServiceOptions } +func (m *ServiceOptions) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ServiceOptions.Unmarshal(m, b) +} +func (m *ServiceOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ServiceOptions.Marshal(b, m, deterministic) +} +func (dst *ServiceOptions) XXX_Merge(src proto.Message) { + xxx_messageInfo_ServiceOptions.Merge(dst, src) +} +func (m *ServiceOptions) XXX_Size() int { + return xxx_messageInfo_ServiceOptions.Size(m) +} +func (m *ServiceOptions) XXX_DiscardUnknown() { + xxx_messageInfo_ServiceOptions.DiscardUnknown(m) +} + +var xxx_messageInfo_ServiceOptions proto.InternalMessageInfo const Default_ServiceOptions_Deprecated bool = false @@ -1610,22 +2059,43 @@ type MethodOptions struct { IdempotencyLevel *MethodOptions_IdempotencyLevel `protobuf:"varint,34,opt,name=idempotency_level,json=idempotencyLevel,enum=google.protobuf.MethodOptions_IdempotencyLevel,def=0" json:"idempotency_level,omitempty"` // The parser stores options it doesn't recognize here. See above. UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` proto.XXX_InternalExtensions `json:"-"` XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *MethodOptions) Reset() { *m = MethodOptions{} } -func (m *MethodOptions) String() string { return proto.CompactTextString(m) } -func (*MethodOptions) ProtoMessage() {} -func (*MethodOptions) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{17} } +func (m *MethodOptions) Reset() { *m = MethodOptions{} } +func (m *MethodOptions) String() string { return proto.CompactTextString(m) } +func (*MethodOptions) ProtoMessage() {} +func (*MethodOptions) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{17} +} var extRange_MethodOptions = []proto.ExtensionRange{ - {1000, 536870911}, + {Start: 1000, End: 536870911}, } func (*MethodOptions) ExtensionRangeArray() []proto.ExtensionRange { return extRange_MethodOptions } +func (m *MethodOptions) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MethodOptions.Unmarshal(m, b) +} +func (m *MethodOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MethodOptions.Marshal(b, m, deterministic) +} +func (dst *MethodOptions) XXX_Merge(src proto.Message) { + xxx_messageInfo_MethodOptions.Merge(dst, src) +} +func (m *MethodOptions) XXX_Size() int { + return xxx_messageInfo_MethodOptions.Size(m) +} +func (m *MethodOptions) XXX_DiscardUnknown() { + xxx_messageInfo_MethodOptions.DiscardUnknown(m) +} + +var xxx_messageInfo_MethodOptions proto.InternalMessageInfo const Default_MethodOptions_Deprecated bool = false const Default_MethodOptions_IdempotencyLevel MethodOptions_IdempotencyLevel = MethodOptions_IDEMPOTENCY_UNKNOWN @@ -1661,19 +2131,40 @@ type UninterpretedOption struct { Name []*UninterpretedOption_NamePart `protobuf:"bytes,2,rep,name=name" json:"name,omitempty"` // The value of the uninterpreted option, in whatever type the tokenizer // identified it as during parsing. Exactly one of these should be set. - IdentifierValue *string `protobuf:"bytes,3,opt,name=identifier_value,json=identifierValue" json:"identifier_value,omitempty"` - PositiveIntValue *uint64 `protobuf:"varint,4,opt,name=positive_int_value,json=positiveIntValue" json:"positive_int_value,omitempty"` - NegativeIntValue *int64 `protobuf:"varint,5,opt,name=negative_int_value,json=negativeIntValue" json:"negative_int_value,omitempty"` - DoubleValue *float64 `protobuf:"fixed64,6,opt,name=double_value,json=doubleValue" json:"double_value,omitempty"` - StringValue []byte `protobuf:"bytes,7,opt,name=string_value,json=stringValue" json:"string_value,omitempty"` - AggregateValue *string `protobuf:"bytes,8,opt,name=aggregate_value,json=aggregateValue" json:"aggregate_value,omitempty"` - XXX_unrecognized []byte `json:"-"` + IdentifierValue *string `protobuf:"bytes,3,opt,name=identifier_value,json=identifierValue" json:"identifier_value,omitempty"` + PositiveIntValue *uint64 `protobuf:"varint,4,opt,name=positive_int_value,json=positiveIntValue" json:"positive_int_value,omitempty"` + NegativeIntValue *int64 `protobuf:"varint,5,opt,name=negative_int_value,json=negativeIntValue" json:"negative_int_value,omitempty"` + DoubleValue *float64 `protobuf:"fixed64,6,opt,name=double_value,json=doubleValue" json:"double_value,omitempty"` + StringValue []byte `protobuf:"bytes,7,opt,name=string_value,json=stringValue" json:"string_value,omitempty"` + AggregateValue *string `protobuf:"bytes,8,opt,name=aggregate_value,json=aggregateValue" json:"aggregate_value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *UninterpretedOption) Reset() { *m = UninterpretedOption{} } -func (m *UninterpretedOption) String() string { return proto.CompactTextString(m) } -func (*UninterpretedOption) ProtoMessage() {} -func (*UninterpretedOption) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{18} } +func (m *UninterpretedOption) Reset() { *m = UninterpretedOption{} } +func (m *UninterpretedOption) String() string { return proto.CompactTextString(m) } +func (*UninterpretedOption) ProtoMessage() {} +func (*UninterpretedOption) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{18} +} +func (m *UninterpretedOption) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_UninterpretedOption.Unmarshal(m, b) +} +func (m *UninterpretedOption) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_UninterpretedOption.Marshal(b, m, deterministic) +} +func (dst *UninterpretedOption) XXX_Merge(src proto.Message) { + xxx_messageInfo_UninterpretedOption.Merge(dst, src) +} +func (m *UninterpretedOption) XXX_Size() int { + return xxx_messageInfo_UninterpretedOption.Size(m) +} +func (m *UninterpretedOption) XXX_DiscardUnknown() { + xxx_messageInfo_UninterpretedOption.DiscardUnknown(m) +} + +var xxx_messageInfo_UninterpretedOption proto.InternalMessageInfo func (m *UninterpretedOption) GetName() []*UninterpretedOption_NamePart { if m != nil { @@ -1730,18 +2221,37 @@ func (m *UninterpretedOption) GetAggregateValue() string { // E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents // "foo.(bar.baz).qux". type UninterpretedOption_NamePart struct { - NamePart *string `protobuf:"bytes,1,req,name=name_part,json=namePart" json:"name_part,omitempty"` - IsExtension *bool `protobuf:"varint,2,req,name=is_extension,json=isExtension" json:"is_extension,omitempty"` - XXX_unrecognized []byte `json:"-"` + NamePart *string `protobuf:"bytes,1,req,name=name_part,json=namePart" json:"name_part,omitempty"` + IsExtension *bool `protobuf:"varint,2,req,name=is_extension,json=isExtension" json:"is_extension,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *UninterpretedOption_NamePart) Reset() { *m = UninterpretedOption_NamePart{} } func (m *UninterpretedOption_NamePart) String() string { return proto.CompactTextString(m) } func (*UninterpretedOption_NamePart) ProtoMessage() {} func (*UninterpretedOption_NamePart) Descriptor() ([]byte, []int) { - return fileDescriptor0, []int{18, 0} + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{18, 0} +} +func (m *UninterpretedOption_NamePart) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_UninterpretedOption_NamePart.Unmarshal(m, b) +} +func (m *UninterpretedOption_NamePart) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_UninterpretedOption_NamePart.Marshal(b, m, deterministic) +} +func (dst *UninterpretedOption_NamePart) XXX_Merge(src proto.Message) { + xxx_messageInfo_UninterpretedOption_NamePart.Merge(dst, src) +} +func (m *UninterpretedOption_NamePart) XXX_Size() int { + return xxx_messageInfo_UninterpretedOption_NamePart.Size(m) +} +func (m *UninterpretedOption_NamePart) XXX_DiscardUnknown() { + xxx_messageInfo_UninterpretedOption_NamePart.DiscardUnknown(m) } +var xxx_messageInfo_UninterpretedOption_NamePart proto.InternalMessageInfo + func (m *UninterpretedOption_NamePart) GetNamePart() string { if m != nil && m.NamePart != nil { return *m.NamePart @@ -1802,14 +2312,35 @@ type SourceCodeInfo struct { // - Code which tries to interpret locations should probably be designed to // ignore those that it doesn't understand, as more types of locations could // be recorded in the future. - Location []*SourceCodeInfo_Location `protobuf:"bytes,1,rep,name=location" json:"location,omitempty"` - XXX_unrecognized []byte `json:"-"` + Location []*SourceCodeInfo_Location `protobuf:"bytes,1,rep,name=location" json:"location,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SourceCodeInfo) Reset() { *m = SourceCodeInfo{} } +func (m *SourceCodeInfo) String() string { return proto.CompactTextString(m) } +func (*SourceCodeInfo) ProtoMessage() {} +func (*SourceCodeInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{19} +} +func (m *SourceCodeInfo) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SourceCodeInfo.Unmarshal(m, b) +} +func (m *SourceCodeInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SourceCodeInfo.Marshal(b, m, deterministic) +} +func (dst *SourceCodeInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_SourceCodeInfo.Merge(dst, src) +} +func (m *SourceCodeInfo) XXX_Size() int { + return xxx_messageInfo_SourceCodeInfo.Size(m) +} +func (m *SourceCodeInfo) XXX_DiscardUnknown() { + xxx_messageInfo_SourceCodeInfo.DiscardUnknown(m) } -func (m *SourceCodeInfo) Reset() { *m = SourceCodeInfo{} } -func (m *SourceCodeInfo) String() string { return proto.CompactTextString(m) } -func (*SourceCodeInfo) ProtoMessage() {} -func (*SourceCodeInfo) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{19} } +var xxx_messageInfo_SourceCodeInfo proto.InternalMessageInfo func (m *SourceCodeInfo) GetLocation() []*SourceCodeInfo_Location { if m != nil { @@ -1899,13 +2430,34 @@ type SourceCodeInfo_Location struct { LeadingComments *string `protobuf:"bytes,3,opt,name=leading_comments,json=leadingComments" json:"leading_comments,omitempty"` TrailingComments *string `protobuf:"bytes,4,opt,name=trailing_comments,json=trailingComments" json:"trailing_comments,omitempty"` LeadingDetachedComments []string `protobuf:"bytes,6,rep,name=leading_detached_comments,json=leadingDetachedComments" json:"leading_detached_comments,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SourceCodeInfo_Location) Reset() { *m = SourceCodeInfo_Location{} } +func (m *SourceCodeInfo_Location) String() string { return proto.CompactTextString(m) } +func (*SourceCodeInfo_Location) ProtoMessage() {} +func (*SourceCodeInfo_Location) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{19, 0} +} +func (m *SourceCodeInfo_Location) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SourceCodeInfo_Location.Unmarshal(m, b) +} +func (m *SourceCodeInfo_Location) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SourceCodeInfo_Location.Marshal(b, m, deterministic) +} +func (dst *SourceCodeInfo_Location) XXX_Merge(src proto.Message) { + xxx_messageInfo_SourceCodeInfo_Location.Merge(dst, src) +} +func (m *SourceCodeInfo_Location) XXX_Size() int { + return xxx_messageInfo_SourceCodeInfo_Location.Size(m) +} +func (m *SourceCodeInfo_Location) XXX_DiscardUnknown() { + xxx_messageInfo_SourceCodeInfo_Location.DiscardUnknown(m) } -func (m *SourceCodeInfo_Location) Reset() { *m = SourceCodeInfo_Location{} } -func (m *SourceCodeInfo_Location) String() string { return proto.CompactTextString(m) } -func (*SourceCodeInfo_Location) ProtoMessage() {} -func (*SourceCodeInfo_Location) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{19, 0} } +var xxx_messageInfo_SourceCodeInfo_Location proto.InternalMessageInfo func (m *SourceCodeInfo_Location) GetPath() []int32 { if m != nil { @@ -1948,14 +2500,35 @@ func (m *SourceCodeInfo_Location) GetLeadingDetachedComments() []string { type GeneratedCodeInfo struct { // An Annotation connects some span of text in generated code to an element // of its generating .proto file. - Annotation []*GeneratedCodeInfo_Annotation `protobuf:"bytes,1,rep,name=annotation" json:"annotation,omitempty"` - XXX_unrecognized []byte `json:"-"` + Annotation []*GeneratedCodeInfo_Annotation `protobuf:"bytes,1,rep,name=annotation" json:"annotation,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *GeneratedCodeInfo) Reset() { *m = GeneratedCodeInfo{} } -func (m *GeneratedCodeInfo) String() string { return proto.CompactTextString(m) } -func (*GeneratedCodeInfo) ProtoMessage() {} -func (*GeneratedCodeInfo) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{20} } +func (m *GeneratedCodeInfo) Reset() { *m = GeneratedCodeInfo{} } +func (m *GeneratedCodeInfo) String() string { return proto.CompactTextString(m) } +func (*GeneratedCodeInfo) ProtoMessage() {} +func (*GeneratedCodeInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{20} +} +func (m *GeneratedCodeInfo) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GeneratedCodeInfo.Unmarshal(m, b) +} +func (m *GeneratedCodeInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GeneratedCodeInfo.Marshal(b, m, deterministic) +} +func (dst *GeneratedCodeInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_GeneratedCodeInfo.Merge(dst, src) +} +func (m *GeneratedCodeInfo) XXX_Size() int { + return xxx_messageInfo_GeneratedCodeInfo.Size(m) +} +func (m *GeneratedCodeInfo) XXX_DiscardUnknown() { + xxx_messageInfo_GeneratedCodeInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_GeneratedCodeInfo proto.InternalMessageInfo func (m *GeneratedCodeInfo) GetAnnotation() []*GeneratedCodeInfo_Annotation { if m != nil { @@ -1976,17 +2549,36 @@ type GeneratedCodeInfo_Annotation struct { // Identifies the ending offset in bytes in the generated code that // relates to the identified offset. The end offset should be one past // the last relevant byte (so the length of the text = end - begin). - End *int32 `protobuf:"varint,4,opt,name=end" json:"end,omitempty"` - XXX_unrecognized []byte `json:"-"` + End *int32 `protobuf:"varint,4,opt,name=end" json:"end,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GeneratedCodeInfo_Annotation) Reset() { *m = GeneratedCodeInfo_Annotation{} } func (m *GeneratedCodeInfo_Annotation) String() string { return proto.CompactTextString(m) } func (*GeneratedCodeInfo_Annotation) ProtoMessage() {} func (*GeneratedCodeInfo_Annotation) Descriptor() ([]byte, []int) { - return fileDescriptor0, []int{20, 0} + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{20, 0} +} +func (m *GeneratedCodeInfo_Annotation) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GeneratedCodeInfo_Annotation.Unmarshal(m, b) +} +func (m *GeneratedCodeInfo_Annotation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GeneratedCodeInfo_Annotation.Marshal(b, m, deterministic) +} +func (dst *GeneratedCodeInfo_Annotation) XXX_Merge(src proto.Message) { + xxx_messageInfo_GeneratedCodeInfo_Annotation.Merge(dst, src) +} +func (m *GeneratedCodeInfo_Annotation) XXX_Size() int { + return xxx_messageInfo_GeneratedCodeInfo_Annotation.Size(m) +} +func (m *GeneratedCodeInfo_Annotation) XXX_DiscardUnknown() { + xxx_messageInfo_GeneratedCodeInfo_Annotation.DiscardUnknown(m) } +var xxx_messageInfo_GeneratedCodeInfo_Annotation proto.InternalMessageInfo + func (m *GeneratedCodeInfo_Annotation) GetPath() []int32 { if m != nil { return m.Path @@ -2025,6 +2617,7 @@ func init() { proto.RegisterType((*FieldDescriptorProto)(nil), "google.protobuf.FieldDescriptorProto") proto.RegisterType((*OneofDescriptorProto)(nil), "google.protobuf.OneofDescriptorProto") proto.RegisterType((*EnumDescriptorProto)(nil), "google.protobuf.EnumDescriptorProto") + proto.RegisterType((*EnumDescriptorProto_EnumReservedRange)(nil), "google.protobuf.EnumDescriptorProto.EnumReservedRange") proto.RegisterType((*EnumValueDescriptorProto)(nil), "google.protobuf.EnumValueDescriptorProto") proto.RegisterType((*ServiceDescriptorProto)(nil), "google.protobuf.ServiceDescriptorProto") proto.RegisterType((*MethodDescriptorProto)(nil), "google.protobuf.MethodDescriptorProto") @@ -2050,166 +2643,170 @@ func init() { proto.RegisterEnum("google.protobuf.MethodOptions_IdempotencyLevel", MethodOptions_IdempotencyLevel_name, MethodOptions_IdempotencyLevel_value) } -func init() { proto.RegisterFile("google/protobuf/descriptor.proto", fileDescriptor0) } +func init() { + proto.RegisterFile("google/protobuf/descriptor.proto", fileDescriptor_descriptor_4df4cb5f42392df6) +} -var fileDescriptor0 = []byte{ - // 2519 bytes of a gzipped FileDescriptorProto +var fileDescriptor_descriptor_4df4cb5f42392df6 = []byte{ + // 2555 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x59, 0xdd, 0x6e, 0x1b, 0xc7, - 0x15, 0x0e, 0x7f, 0x45, 0x1e, 0x52, 0xd4, 0x68, 0xa4, 0xd8, 0x6b, 0xe5, 0xc7, 0x32, 0xf3, 0x63, - 0xd9, 0x69, 0xa8, 0x40, 0xb1, 0x1d, 0x47, 0x29, 0xd2, 0x52, 0xe4, 0x5a, 0xa1, 0x4a, 0x91, 0xec, - 0x92, 0x6a, 0x7e, 0x6e, 0x16, 0xa3, 0xdd, 0x21, 0xb9, 0xf6, 0x72, 0x77, 0xb3, 0xbb, 0xb4, 0xad, - 0xa0, 0x17, 0x06, 0x7a, 0x55, 0xa0, 0x0f, 0x50, 0x14, 0x45, 0x2f, 0x72, 0x13, 0xa0, 0x0f, 0x50, - 0x20, 0x77, 0x7d, 0x82, 0x02, 0x79, 0x83, 0xa2, 0x28, 0xd0, 0x3e, 0x46, 0x31, 0x33, 0xbb, 0xcb, - 0x5d, 0xfe, 0xc4, 0x6a, 0x80, 0x38, 0x57, 0xe4, 0x7c, 0xe7, 0x3b, 0x67, 0xce, 0x9c, 0x39, 0x33, - 0x73, 0x66, 0x16, 0x76, 0x47, 0xb6, 0x3d, 0x32, 0xe9, 0xbe, 0xe3, 0xda, 0xbe, 0x7d, 0x3e, 0x1d, - 0xee, 0xeb, 0xd4, 0xd3, 0x5c, 0xc3, 0xf1, 0x6d, 0xb7, 0xc6, 0x31, 0xbc, 0x21, 0x18, 0xb5, 0x90, - 0x51, 0x3d, 0x85, 0xcd, 0x07, 0x86, 0x49, 0x9b, 0x11, 0xb1, 0x4f, 0x7d, 0x7c, 0x1f, 0xb2, 0x43, - 0xc3, 0xa4, 0x52, 0x6a, 0x37, 0xb3, 0x57, 0x3a, 0x78, 0xb3, 0x36, 0xa7, 0x54, 0x4b, 0x6a, 0xf4, - 0x18, 0xac, 0x70, 0x8d, 0xea, 0xbf, 0xb3, 0xb0, 0xb5, 0x44, 0x8a, 0x31, 0x64, 0x2d, 0x32, 0x61, - 0x16, 0x53, 0x7b, 0x45, 0x85, 0xff, 0xc7, 0x12, 0xac, 0x39, 0x44, 0x7b, 0x44, 0x46, 0x54, 0x4a, - 0x73, 0x38, 0x6c, 0xe2, 0xd7, 0x01, 0x74, 0xea, 0x50, 0x4b, 0xa7, 0x96, 0x76, 0x21, 0x65, 0x76, - 0x33, 0x7b, 0x45, 0x25, 0x86, 0xe0, 0x77, 0x60, 0xd3, 0x99, 0x9e, 0x9b, 0x86, 0xa6, 0xc6, 0x68, - 0xb0, 0x9b, 0xd9, 0xcb, 0x29, 0x48, 0x08, 0x9a, 0x33, 0xf2, 0x4d, 0xd8, 0x78, 0x42, 0xc9, 0xa3, - 0x38, 0xb5, 0xc4, 0xa9, 0x15, 0x06, 0xc7, 0x88, 0x0d, 0x28, 0x4f, 0xa8, 0xe7, 0x91, 0x11, 0x55, - 0xfd, 0x0b, 0x87, 0x4a, 0x59, 0x3e, 0xfa, 0xdd, 0x85, 0xd1, 0xcf, 0x8f, 0xbc, 0x14, 0x68, 0x0d, - 0x2e, 0x1c, 0x8a, 0xeb, 0x50, 0xa4, 0xd6, 0x74, 0x22, 0x2c, 0xe4, 0x56, 0xc4, 0x4f, 0xb6, 0xa6, - 0x93, 0x79, 0x2b, 0x05, 0xa6, 0x16, 0x98, 0x58, 0xf3, 0xa8, 0xfb, 0xd8, 0xd0, 0xa8, 0x94, 0xe7, - 0x06, 0x6e, 0x2e, 0x18, 0xe8, 0x0b, 0xf9, 0xbc, 0x8d, 0x50, 0x0f, 0x37, 0xa0, 0x48, 0x9f, 0xfa, - 0xd4, 0xf2, 0x0c, 0xdb, 0x92, 0xd6, 0xb8, 0x91, 0xb7, 0x96, 0xcc, 0x22, 0x35, 0xf5, 0x79, 0x13, - 0x33, 0x3d, 0x7c, 0x0f, 0xd6, 0x6c, 0xc7, 0x37, 0x6c, 0xcb, 0x93, 0x0a, 0xbb, 0xa9, 0xbd, 0xd2, - 0xc1, 0xab, 0x4b, 0x13, 0xa1, 0x2b, 0x38, 0x4a, 0x48, 0xc6, 0x2d, 0x40, 0x9e, 0x3d, 0x75, 0x35, - 0xaa, 0x6a, 0xb6, 0x4e, 0x55, 0xc3, 0x1a, 0xda, 0x52, 0x91, 0x1b, 0xb8, 0xbe, 0x38, 0x10, 0x4e, - 0x6c, 0xd8, 0x3a, 0x6d, 0x59, 0x43, 0x5b, 0xa9, 0x78, 0x89, 0x36, 0xbe, 0x02, 0x79, 0xef, 0xc2, - 0xf2, 0xc9, 0x53, 0xa9, 0xcc, 0x33, 0x24, 0x68, 0x55, 0xbf, 0xcd, 0xc3, 0xc6, 0x65, 0x52, 0xec, - 0x23, 0xc8, 0x0d, 0xd9, 0x28, 0xa5, 0xf4, 0xff, 0x13, 0x03, 0xa1, 0x93, 0x0c, 0x62, 0xfe, 0x07, - 0x06, 0xb1, 0x0e, 0x25, 0x8b, 0x7a, 0x3e, 0xd5, 0x45, 0x46, 0x64, 0x2e, 0x99, 0x53, 0x20, 0x94, - 0x16, 0x53, 0x2a, 0xfb, 0x83, 0x52, 0xea, 0x33, 0xd8, 0x88, 0x5c, 0x52, 0x5d, 0x62, 0x8d, 0xc2, - 0xdc, 0xdc, 0x7f, 0x9e, 0x27, 0x35, 0x39, 0xd4, 0x53, 0x98, 0x9a, 0x52, 0xa1, 0x89, 0x36, 0x6e, - 0x02, 0xd8, 0x16, 0xb5, 0x87, 0xaa, 0x4e, 0x35, 0x53, 0x2a, 0xac, 0x88, 0x52, 0x97, 0x51, 0x16, - 0xa2, 0x64, 0x0b, 0x54, 0x33, 0xf1, 0x87, 0xb3, 0x54, 0x5b, 0x5b, 0x91, 0x29, 0xa7, 0x62, 0x91, - 0x2d, 0x64, 0xdb, 0x19, 0x54, 0x5c, 0xca, 0xf2, 0x9e, 0xea, 0xc1, 0xc8, 0x8a, 0xdc, 0x89, 0xda, - 0x73, 0x47, 0xa6, 0x04, 0x6a, 0x62, 0x60, 0xeb, 0x6e, 0xbc, 0x89, 0xdf, 0x80, 0x08, 0x50, 0x79, - 0x5a, 0x01, 0xdf, 0x85, 0xca, 0x21, 0xd8, 0x21, 0x13, 0xba, 0xf3, 0x15, 0x54, 0x92, 0xe1, 0xc1, - 0xdb, 0x90, 0xf3, 0x7c, 0xe2, 0xfa, 0x3c, 0x0b, 0x73, 0x8a, 0x68, 0x60, 0x04, 0x19, 0x6a, 0xe9, - 0x7c, 0x97, 0xcb, 0x29, 0xec, 0x2f, 0xfe, 0xe5, 0x6c, 0xc0, 0x19, 0x3e, 0xe0, 0xb7, 0x17, 0x67, - 0x34, 0x61, 0x79, 0x7e, 0xdc, 0x3b, 0x1f, 0xc0, 0x7a, 0x62, 0x00, 0x97, 0xed, 0xba, 0xfa, 0x5b, - 0x78, 0x79, 0xa9, 0x69, 0xfc, 0x19, 0x6c, 0x4f, 0x2d, 0xc3, 0xf2, 0xa9, 0xeb, 0xb8, 0x94, 0x65, - 0xac, 0xe8, 0x4a, 0xfa, 0xcf, 0xda, 0x8a, 0x9c, 0x3b, 0x8b, 0xb3, 0x85, 0x15, 0x65, 0x6b, 0xba, - 0x08, 0xde, 0x2e, 0x16, 0xfe, 0xbb, 0x86, 0x9e, 0x3d, 0x7b, 0xf6, 0x2c, 0x5d, 0xfd, 0x63, 0x1e, - 0xb6, 0x97, 0xad, 0x99, 0xa5, 0xcb, 0xf7, 0x0a, 0xe4, 0xad, 0xe9, 0xe4, 0x9c, 0xba, 0x3c, 0x48, - 0x39, 0x25, 0x68, 0xe1, 0x3a, 0xe4, 0x4c, 0x72, 0x4e, 0x4d, 0x29, 0xbb, 0x9b, 0xda, 0xab, 0x1c, - 0xbc, 0x73, 0xa9, 0x55, 0x59, 0x6b, 0x33, 0x15, 0x45, 0x68, 0xe2, 0x8f, 0x21, 0x1b, 0x6c, 0xd1, - 0xcc, 0xc2, 0xed, 0xcb, 0x59, 0x60, 0x6b, 0x49, 0xe1, 0x7a, 0xf8, 0x15, 0x28, 0xb2, 0x5f, 0x91, - 0x1b, 0x79, 0xee, 0x73, 0x81, 0x01, 0x2c, 0x2f, 0xf0, 0x0e, 0x14, 0xf8, 0x32, 0xd1, 0x69, 0x78, - 0xb4, 0x45, 0x6d, 0x96, 0x58, 0x3a, 0x1d, 0x92, 0xa9, 0xe9, 0xab, 0x8f, 0x89, 0x39, 0xa5, 0x3c, - 0xe1, 0x8b, 0x4a, 0x39, 0x00, 0x7f, 0xc3, 0x30, 0x7c, 0x1d, 0x4a, 0x62, 0x55, 0x19, 0x96, 0x4e, - 0x9f, 0xf2, 0xdd, 0x33, 0xa7, 0x88, 0x85, 0xd6, 0x62, 0x08, 0xeb, 0xfe, 0xa1, 0x67, 0x5b, 0x61, - 0x6a, 0xf2, 0x2e, 0x18, 0xc0, 0xbb, 0xff, 0x60, 0x7e, 0xe3, 0x7e, 0x6d, 0xf9, 0xf0, 0xe6, 0x73, - 0xaa, 0xfa, 0xb7, 0x34, 0x64, 0xf9, 0x7e, 0xb1, 0x01, 0xa5, 0xc1, 0xe7, 0x3d, 0x59, 0x6d, 0x76, - 0xcf, 0x8e, 0xda, 0x32, 0x4a, 0xe1, 0x0a, 0x00, 0x07, 0x1e, 0xb4, 0xbb, 0xf5, 0x01, 0x4a, 0x47, - 0xed, 0x56, 0x67, 0x70, 0xef, 0x0e, 0xca, 0x44, 0x0a, 0x67, 0x02, 0xc8, 0xc6, 0x09, 0xef, 0x1f, - 0xa0, 0x1c, 0x46, 0x50, 0x16, 0x06, 0x5a, 0x9f, 0xc9, 0xcd, 0x7b, 0x77, 0x50, 0x3e, 0x89, 0xbc, - 0x7f, 0x80, 0xd6, 0xf0, 0x3a, 0x14, 0x39, 0x72, 0xd4, 0xed, 0xb6, 0x51, 0x21, 0xb2, 0xd9, 0x1f, - 0x28, 0xad, 0xce, 0x31, 0x2a, 0x46, 0x36, 0x8f, 0x95, 0xee, 0x59, 0x0f, 0x41, 0x64, 0xe1, 0x54, - 0xee, 0xf7, 0xeb, 0xc7, 0x32, 0x2a, 0x45, 0x8c, 0xa3, 0xcf, 0x07, 0x72, 0x1f, 0x95, 0x13, 0x6e, - 0xbd, 0x7f, 0x80, 0xd6, 0xa3, 0x2e, 0xe4, 0xce, 0xd9, 0x29, 0xaa, 0xe0, 0x4d, 0x58, 0x17, 0x5d, - 0x84, 0x4e, 0x6c, 0xcc, 0x41, 0xf7, 0xee, 0x20, 0x34, 0x73, 0x44, 0x58, 0xd9, 0x4c, 0x00, 0xf7, - 0xee, 0x20, 0x5c, 0x6d, 0x40, 0x8e, 0x67, 0x17, 0xc6, 0x50, 0x69, 0xd7, 0x8f, 0xe4, 0xb6, 0xda, - 0xed, 0x0d, 0x5a, 0xdd, 0x4e, 0xbd, 0x8d, 0x52, 0x33, 0x4c, 0x91, 0x7f, 0x7d, 0xd6, 0x52, 0xe4, - 0x26, 0x4a, 0xc7, 0xb1, 0x9e, 0x5c, 0x1f, 0xc8, 0x4d, 0x94, 0xa9, 0x6a, 0xb0, 0xbd, 0x6c, 0x9f, - 0x5c, 0xba, 0x32, 0x62, 0x53, 0x9c, 0x5e, 0x31, 0xc5, 0xdc, 0xd6, 0xc2, 0x14, 0x7f, 0x9d, 0x82, - 0xad, 0x25, 0x67, 0xc5, 0xd2, 0x4e, 0x7e, 0x01, 0x39, 0x91, 0xa2, 0xe2, 0xf4, 0xbc, 0xb5, 0xf4, - 0xd0, 0xe1, 0x09, 0xbb, 0x70, 0x82, 0x72, 0xbd, 0x78, 0x05, 0x91, 0x59, 0x51, 0x41, 0x30, 0x13, - 0x0b, 0x4e, 0xfe, 0x2e, 0x05, 0xd2, 0x2a, 0xdb, 0xcf, 0xd9, 0x28, 0xd2, 0x89, 0x8d, 0xe2, 0xa3, - 0x79, 0x07, 0x6e, 0xac, 0x1e, 0xc3, 0x82, 0x17, 0xdf, 0xa4, 0xe0, 0xca, 0xf2, 0x42, 0x6b, 0xa9, - 0x0f, 0x1f, 0x43, 0x7e, 0x42, 0xfd, 0xb1, 0x1d, 0x16, 0x1b, 0x6f, 0x2f, 0x39, 0xc2, 0x98, 0x78, - 0x3e, 0x56, 0x81, 0x56, 0xfc, 0x0c, 0xcc, 0xac, 0xaa, 0x96, 0x84, 0x37, 0x0b, 0x9e, 0xfe, 0x3e, - 0x0d, 0x2f, 0x2f, 0x35, 0xbe, 0xd4, 0xd1, 0xd7, 0x00, 0x0c, 0xcb, 0x99, 0xfa, 0xa2, 0xa0, 0x10, - 0xfb, 0x53, 0x91, 0x23, 0x7c, 0xed, 0xb3, 0xbd, 0x67, 0xea, 0x47, 0xf2, 0x0c, 0x97, 0x83, 0x80, - 0x38, 0xe1, 0xfe, 0xcc, 0xd1, 0x2c, 0x77, 0xf4, 0xf5, 0x15, 0x23, 0x5d, 0x38, 0xab, 0xdf, 0x03, - 0xa4, 0x99, 0x06, 0xb5, 0x7c, 0xd5, 0xf3, 0x5d, 0x4a, 0x26, 0x86, 0x35, 0xe2, 0x1b, 0x70, 0xe1, - 0x30, 0x37, 0x24, 0xa6, 0x47, 0x95, 0x0d, 0x21, 0xee, 0x87, 0x52, 0xa6, 0xc1, 0xcf, 0x38, 0x37, - 0xa6, 0x91, 0x4f, 0x68, 0x08, 0x71, 0xa4, 0x51, 0xfd, 0xb6, 0x00, 0xa5, 0x58, 0x59, 0x8a, 0x6f, - 0x40, 0xf9, 0x21, 0x79, 0x4c, 0xd4, 0xf0, 0xaa, 0x21, 0x22, 0x51, 0x62, 0x58, 0x2f, 0xb8, 0x6e, - 0xbc, 0x07, 0xdb, 0x9c, 0x62, 0x4f, 0x7d, 0xea, 0xaa, 0x9a, 0x49, 0x3c, 0x8f, 0x07, 0xad, 0xc0, - 0xa9, 0x98, 0xc9, 0xba, 0x4c, 0xd4, 0x08, 0x25, 0xf8, 0x2e, 0x6c, 0x71, 0x8d, 0xc9, 0xd4, 0xf4, - 0x0d, 0xc7, 0xa4, 0x2a, 0xbb, 0xfc, 0x78, 0x7c, 0x23, 0x8e, 0x3c, 0xdb, 0x64, 0x8c, 0xd3, 0x80, - 0xc0, 0x3c, 0xf2, 0x70, 0x13, 0x5e, 0xe3, 0x6a, 0x23, 0x6a, 0x51, 0x97, 0xf8, 0x54, 0xa5, 0x5f, - 0x4e, 0x89, 0xe9, 0xa9, 0xc4, 0xd2, 0xd5, 0x31, 0xf1, 0xc6, 0xd2, 0x36, 0x33, 0x70, 0x94, 0x96, - 0x52, 0xca, 0x35, 0x46, 0x3c, 0x0e, 0x78, 0x32, 0xa7, 0xd5, 0x2d, 0xfd, 0x13, 0xe2, 0x8d, 0xf1, - 0x21, 0x5c, 0xe1, 0x56, 0x3c, 0xdf, 0x35, 0xac, 0x91, 0xaa, 0x8d, 0xa9, 0xf6, 0x48, 0x9d, 0xfa, - 0xc3, 0xfb, 0xd2, 0x2b, 0xf1, 0xfe, 0xb9, 0x87, 0x7d, 0xce, 0x69, 0x30, 0xca, 0x99, 0x3f, 0xbc, - 0x8f, 0xfb, 0x50, 0x66, 0x93, 0x31, 0x31, 0xbe, 0xa2, 0xea, 0xd0, 0x76, 0xf9, 0xc9, 0x52, 0x59, - 0xb2, 0xb2, 0x63, 0x11, 0xac, 0x75, 0x03, 0x85, 0x53, 0x5b, 0xa7, 0x87, 0xb9, 0x7e, 0x4f, 0x96, - 0x9b, 0x4a, 0x29, 0xb4, 0xf2, 0xc0, 0x76, 0x59, 0x42, 0x8d, 0xec, 0x28, 0xc0, 0x25, 0x91, 0x50, - 0x23, 0x3b, 0x0c, 0xef, 0x5d, 0xd8, 0xd2, 0x34, 0x31, 0x66, 0x43, 0x53, 0x83, 0x2b, 0x8a, 0x27, - 0xa1, 0x44, 0xb0, 0x34, 0xed, 0x58, 0x10, 0x82, 0x1c, 0xf7, 0xf0, 0x87, 0xf0, 0xf2, 0x2c, 0x58, - 0x71, 0xc5, 0xcd, 0x85, 0x51, 0xce, 0xab, 0xde, 0x85, 0x2d, 0xe7, 0x62, 0x51, 0x11, 0x27, 0x7a, - 0x74, 0x2e, 0xe6, 0xd5, 0x3e, 0x80, 0x6d, 0x67, 0xec, 0x2c, 0xea, 0xdd, 0x8e, 0xeb, 0x61, 0x67, - 0xec, 0xcc, 0x2b, 0xbe, 0xc5, 0xef, 0xab, 0x2e, 0xd5, 0x88, 0x4f, 0x75, 0xe9, 0x6a, 0x9c, 0x1e, - 0x13, 0xe0, 0x7d, 0x40, 0x9a, 0xa6, 0x52, 0x8b, 0x9c, 0x9b, 0x54, 0x25, 0x2e, 0xb5, 0x88, 0x27, - 0x5d, 0x8f, 0x93, 0x2b, 0x9a, 0x26, 0x73, 0x69, 0x9d, 0x0b, 0xf1, 0x6d, 0xd8, 0xb4, 0xcf, 0x1f, - 0x6a, 0x22, 0x25, 0x55, 0xc7, 0xa5, 0x43, 0xe3, 0xa9, 0xf4, 0x26, 0x8f, 0xef, 0x06, 0x13, 0xf0, - 0x84, 0xec, 0x71, 0x18, 0xdf, 0x02, 0xa4, 0x79, 0x63, 0xe2, 0x3a, 0xbc, 0x26, 0xf0, 0x1c, 0xa2, - 0x51, 0xe9, 0x2d, 0x41, 0x15, 0x78, 0x27, 0x84, 0xd9, 0x92, 0xf0, 0x9e, 0x18, 0x43, 0x3f, 0xb4, - 0x78, 0x53, 0x2c, 0x09, 0x8e, 0x05, 0xd6, 0xf6, 0x00, 0xb1, 0x50, 0x24, 0x3a, 0xde, 0xe3, 0xb4, - 0x8a, 0x33, 0x76, 0xe2, 0xfd, 0xbe, 0x01, 0xeb, 0x8c, 0x39, 0xeb, 0xf4, 0x96, 0xa8, 0x67, 0x9c, - 0x71, 0xac, 0xc7, 0x1f, 0xad, 0xb4, 0xac, 0x1e, 0x42, 0x39, 0x9e, 0x9f, 0xb8, 0x08, 0x22, 0x43, - 0x51, 0x8a, 0x9d, 0xf5, 0x8d, 0x6e, 0x93, 0x9d, 0xd2, 0x5f, 0xc8, 0x28, 0xcd, 0xaa, 0x85, 0x76, - 0x6b, 0x20, 0xab, 0xca, 0x59, 0x67, 0xd0, 0x3a, 0x95, 0x51, 0x26, 0x56, 0x96, 0x9e, 0x64, 0x0b, - 0x6f, 0xa3, 0x9b, 0xd5, 0xef, 0xd2, 0x50, 0x49, 0xde, 0x33, 0xf0, 0xcf, 0xe1, 0x6a, 0xf8, 0x28, - 0xe0, 0x51, 0x5f, 0x7d, 0x62, 0xb8, 0x7c, 0xe1, 0x4c, 0x88, 0xa8, 0xb3, 0xa3, 0xa9, 0xdb, 0x0e, - 0x58, 0x7d, 0xea, 0x7f, 0x6a, 0xb8, 0x6c, 0x59, 0x4c, 0x88, 0x8f, 0xdb, 0x70, 0xdd, 0xb2, 0x55, - 0xcf, 0x27, 0x96, 0x4e, 0x5c, 0x5d, 0x9d, 0x3d, 0xc7, 0xa8, 0x44, 0xd3, 0xa8, 0xe7, 0xd9, 0xe2, - 0xc0, 0x8a, 0xac, 0xbc, 0x6a, 0xd9, 0xfd, 0x80, 0x3c, 0xdb, 0xc9, 0xeb, 0x01, 0x75, 0x2e, 0xcd, - 0x32, 0xab, 0xd2, 0xec, 0x15, 0x28, 0x4e, 0x88, 0xa3, 0x52, 0xcb, 0x77, 0x2f, 0x78, 0x75, 0x59, - 0x50, 0x0a, 0x13, 0xe2, 0xc8, 0xac, 0xfd, 0x42, 0x8a, 0xfc, 0x93, 0x6c, 0xa1, 0x80, 0x8a, 0x27, - 0xd9, 0x42, 0x11, 0x41, 0xf5, 0x5f, 0x19, 0x28, 0xc7, 0xab, 0x4d, 0x56, 0xbc, 0x6b, 0xfc, 0x64, - 0x49, 0xf1, 0xbd, 0xe7, 0x8d, 0xef, 0xad, 0x4d, 0x6b, 0x0d, 0x76, 0xe4, 0x1c, 0xe6, 0x45, 0x0d, - 0xa8, 0x08, 0x4d, 0x76, 0xdc, 0xb3, 0xdd, 0x86, 0x8a, 0x7b, 0x4d, 0x41, 0x09, 0x5a, 0xf8, 0x18, - 0xf2, 0x0f, 0x3d, 0x6e, 0x3b, 0xcf, 0x6d, 0xbf, 0xf9, 0xfd, 0xb6, 0x4f, 0xfa, 0xdc, 0x78, 0xf1, - 0xa4, 0xaf, 0x76, 0xba, 0xca, 0x69, 0xbd, 0xad, 0x04, 0xea, 0xf8, 0x1a, 0x64, 0x4d, 0xf2, 0xd5, - 0x45, 0xf2, 0x70, 0xe2, 0xd0, 0x65, 0x27, 0xe1, 0x1a, 0x64, 0x9f, 0x50, 0xf2, 0x28, 0x79, 0x24, - 0x70, 0xe8, 0x47, 0x5c, 0x0c, 0xfb, 0x90, 0xe3, 0xf1, 0xc2, 0x00, 0x41, 0xc4, 0xd0, 0x4b, 0xb8, - 0x00, 0xd9, 0x46, 0x57, 0x61, 0x0b, 0x02, 0x41, 0x59, 0xa0, 0x6a, 0xaf, 0x25, 0x37, 0x64, 0x94, - 0xae, 0xde, 0x85, 0xbc, 0x08, 0x02, 0x5b, 0x2c, 0x51, 0x18, 0xd0, 0x4b, 0x41, 0x33, 0xb0, 0x91, - 0x0a, 0xa5, 0x67, 0xa7, 0x47, 0xb2, 0x82, 0xd2, 0xc9, 0xa9, 0xce, 0xa2, 0x5c, 0xd5, 0x83, 0x72, - 0xbc, 0xdc, 0x7c, 0x31, 0x57, 0xc9, 0xbf, 0xa7, 0xa0, 0x14, 0x2b, 0x1f, 0x59, 0xe1, 0x42, 0x4c, - 0xd3, 0x7e, 0xa2, 0x12, 0xd3, 0x20, 0x5e, 0x90, 0x1a, 0xc0, 0xa1, 0x3a, 0x43, 0x2e, 0x3b, 0x75, - 0x2f, 0x68, 0x89, 0xe4, 0x50, 0xbe, 0xfa, 0x97, 0x14, 0xa0, 0xf9, 0x02, 0x74, 0xce, 0xcd, 0xd4, - 0x4f, 0xe9, 0x66, 0xf5, 0xcf, 0x29, 0xa8, 0x24, 0xab, 0xce, 0x39, 0xf7, 0x6e, 0xfc, 0xa4, 0xee, - 0xfd, 0x33, 0x0d, 0xeb, 0x89, 0x5a, 0xf3, 0xb2, 0xde, 0x7d, 0x09, 0x9b, 0x86, 0x4e, 0x27, 0x8e, - 0xed, 0x53, 0x4b, 0xbb, 0x50, 0x4d, 0xfa, 0x98, 0x9a, 0x52, 0x95, 0x6f, 0x1a, 0xfb, 0xdf, 0x5f, - 0xcd, 0xd6, 0x5a, 0x33, 0xbd, 0x36, 0x53, 0x3b, 0xdc, 0x6a, 0x35, 0xe5, 0xd3, 0x5e, 0x77, 0x20, - 0x77, 0x1a, 0x9f, 0xab, 0x67, 0x9d, 0x5f, 0x75, 0xba, 0x9f, 0x76, 0x14, 0x64, 0xcc, 0xd1, 0x7e, - 0xc4, 0x65, 0xdf, 0x03, 0x34, 0xef, 0x14, 0xbe, 0x0a, 0xcb, 0xdc, 0x42, 0x2f, 0xe1, 0x2d, 0xd8, - 0xe8, 0x74, 0xd5, 0x7e, 0xab, 0x29, 0xab, 0xf2, 0x83, 0x07, 0x72, 0x63, 0xd0, 0x17, 0xd7, 0xfb, - 0x88, 0x3d, 0x48, 0x2c, 0xf0, 0xea, 0x9f, 0x32, 0xb0, 0xb5, 0xc4, 0x13, 0x5c, 0x0f, 0x6e, 0x16, - 0xe2, 0xb2, 0xf3, 0xee, 0x65, 0xbc, 0xaf, 0xb1, 0x82, 0xa0, 0x47, 0x5c, 0x3f, 0xb8, 0x88, 0xdc, - 0x02, 0x16, 0x25, 0xcb, 0x37, 0x86, 0x06, 0x75, 0x83, 0xd7, 0x10, 0x71, 0xdd, 0xd8, 0x98, 0xe1, - 0xe2, 0x41, 0xe4, 0x67, 0x80, 0x1d, 0xdb, 0x33, 0x7c, 0xe3, 0x31, 0x55, 0x0d, 0x2b, 0x7c, 0x3a, - 0x61, 0xd7, 0x8f, 0xac, 0x82, 0x42, 0x49, 0xcb, 0xf2, 0x23, 0xb6, 0x45, 0x47, 0x64, 0x8e, 0xcd, - 0x36, 0xf3, 0x8c, 0x82, 0x42, 0x49, 0xc4, 0xbe, 0x01, 0x65, 0xdd, 0x9e, 0xb2, 0x9a, 0x4c, 0xf0, - 0xd8, 0xd9, 0x91, 0x52, 0x4a, 0x02, 0x8b, 0x28, 0x41, 0xb5, 0x3d, 0x7b, 0xb3, 0x29, 0x2b, 0x25, - 0x81, 0x09, 0xca, 0x4d, 0xd8, 0x20, 0xa3, 0x91, 0xcb, 0x8c, 0x87, 0x86, 0xc4, 0xfd, 0xa1, 0x12, - 0xc1, 0x9c, 0xb8, 0x73, 0x02, 0x85, 0x30, 0x0e, 0xec, 0xa8, 0x66, 0x91, 0x50, 0x1d, 0xf1, 0x6e, - 0x97, 0xde, 0x2b, 0x2a, 0x05, 0x2b, 0x14, 0xde, 0x80, 0xb2, 0xe1, 0xa9, 0xb3, 0x27, 0xe8, 0xf4, - 0x6e, 0x7a, 0xaf, 0xa0, 0x94, 0x0c, 0x2f, 0x7a, 0xbe, 0xab, 0x7e, 0x93, 0x86, 0x4a, 0xf2, 0x09, - 0x1d, 0x37, 0xa1, 0x60, 0xda, 0x1a, 0xe1, 0xa9, 0x25, 0xbe, 0xdf, 0xec, 0x3d, 0xe7, 0xd5, 0xbd, - 0xd6, 0x0e, 0xf8, 0x4a, 0xa4, 0xb9, 0xf3, 0x8f, 0x14, 0x14, 0x42, 0x18, 0x5f, 0x81, 0xac, 0x43, - 0xfc, 0x31, 0x37, 0x97, 0x3b, 0x4a, 0xa3, 0x94, 0xc2, 0xdb, 0x0c, 0xf7, 0x1c, 0x62, 0xf1, 0x14, - 0x08, 0x70, 0xd6, 0x66, 0xf3, 0x6a, 0x52, 0xa2, 0xf3, 0xcb, 0x89, 0x3d, 0x99, 0x50, 0xcb, 0xf7, - 0xc2, 0x79, 0x0d, 0xf0, 0x46, 0x00, 0xe3, 0x77, 0x60, 0xd3, 0x77, 0x89, 0x61, 0x26, 0xb8, 0x59, - 0xce, 0x45, 0xa1, 0x20, 0x22, 0x1f, 0xc2, 0xb5, 0xd0, 0xae, 0x4e, 0x7d, 0xa2, 0x8d, 0xa9, 0x3e, - 0x53, 0xca, 0xf3, 0xf7, 0xd9, 0xab, 0x01, 0xa1, 0x19, 0xc8, 0x43, 0xdd, 0xea, 0x77, 0x29, 0xd8, - 0x0c, 0xaf, 0x53, 0x7a, 0x14, 0xac, 0x53, 0x00, 0x62, 0x59, 0xb6, 0x1f, 0x0f, 0xd7, 0x62, 0x2a, - 0x2f, 0xe8, 0xd5, 0xea, 0x91, 0x92, 0x12, 0x33, 0xb0, 0x33, 0x01, 0x98, 0x49, 0x56, 0x86, 0xed, - 0x3a, 0x94, 0x82, 0xef, 0x23, 0xfc, 0x23, 0x9b, 0xb8, 0x80, 0x83, 0x80, 0xd8, 0xbd, 0x0b, 0x6f, - 0x43, 0xee, 0x9c, 0x8e, 0x0c, 0x2b, 0x78, 0xf5, 0x14, 0x8d, 0xf0, 0x25, 0x37, 0x1b, 0xbd, 0xe4, - 0x1e, 0xfd, 0x21, 0x05, 0x5b, 0x9a, 0x3d, 0x99, 0xf7, 0xf7, 0x08, 0xcd, 0xbd, 0x02, 0x78, 0x9f, - 0xa4, 0xbe, 0xf8, 0x78, 0x64, 0xf8, 0xe3, 0xe9, 0x79, 0x4d, 0xb3, 0x27, 0xfb, 0x23, 0xdb, 0x24, - 0xd6, 0x68, 0xf6, 0x95, 0x90, 0xff, 0xd1, 0xde, 0x1d, 0x51, 0xeb, 0xdd, 0x91, 0x1d, 0xfb, 0x66, - 0xf8, 0xd1, 0xec, 0xef, 0xd7, 0xe9, 0xcc, 0x71, 0xef, 0xe8, 0xaf, 0xe9, 0x9d, 0x63, 0xd1, 0x57, - 0x2f, 0x8c, 0x8d, 0x42, 0x87, 0x26, 0xd5, 0xd8, 0x78, 0xff, 0x17, 0x00, 0x00, 0xff, 0xff, 0x0c, - 0xab, 0xb6, 0x37, 0x7e, 0x1c, 0x00, 0x00, + 0xf5, 0xcf, 0xf2, 0x4b, 0xe4, 0x21, 0x45, 0x8d, 0x46, 0x8a, 0xbd, 0x56, 0x3e, 0x2c, 0x33, 0x1f, + 0x96, 0x9d, 0x7f, 0xa8, 0xc0, 0xb1, 0x1d, 0x47, 0xfe, 0x23, 0x2d, 0x45, 0xae, 0x15, 0xaa, 0x12, + 0xc9, 0x2e, 0xa9, 0xe6, 0x03, 0x28, 0x16, 0xa3, 0xdd, 0x21, 0xb9, 0xf6, 0x72, 0x77, 0xb3, 0xbb, + 0xb4, 0xad, 0xa0, 0x17, 0x06, 0x7a, 0xd5, 0xab, 0xde, 0x16, 0x45, 0xd1, 0x8b, 0xde, 0x04, 0xe8, + 0x03, 0x14, 0xc8, 0x5d, 0x9f, 0xa0, 0x40, 0xde, 0xa0, 0x68, 0x0b, 0xb4, 0x8f, 0xd0, 0xcb, 0x62, + 0x66, 0x76, 0x97, 0xbb, 0x24, 0x15, 0x2b, 0x01, 0xe2, 0x5c, 0x91, 0xf3, 0x9b, 0xdf, 0x39, 0x73, + 0xe6, 0xcc, 0x99, 0x33, 0x67, 0x66, 0x61, 0x7b, 0xe4, 0x38, 0x23, 0x8b, 0xee, 0xba, 0x9e, 0x13, + 0x38, 0xa7, 0xd3, 0xe1, 0xae, 0x41, 0x7d, 0xdd, 0x33, 0xdd, 0xc0, 0xf1, 0xea, 0x1c, 0xc3, 0x6b, + 0x82, 0x51, 0x8f, 0x18, 0xb5, 0x63, 0x58, 0x7f, 0x60, 0x5a, 0xb4, 0x15, 0x13, 0xfb, 0x34, 0xc0, + 0xf7, 0x20, 0x37, 0x34, 0x2d, 0x2a, 0x4b, 0xdb, 0xd9, 0x9d, 0xf2, 0xad, 0x37, 0xeb, 0x73, 0x42, + 0xf5, 0xb4, 0x44, 0x8f, 0xc1, 0x2a, 0x97, 0xa8, 0xfd, 0x2b, 0x07, 0x1b, 0x4b, 0x7a, 0x31, 0x86, + 0x9c, 0x4d, 0x26, 0x4c, 0xa3, 0xb4, 0x53, 0x52, 0xf9, 0x7f, 0x2c, 0xc3, 0x8a, 0x4b, 0xf4, 0x47, + 0x64, 0x44, 0xe5, 0x0c, 0x87, 0xa3, 0x26, 0x7e, 0x1d, 0xc0, 0xa0, 0x2e, 0xb5, 0x0d, 0x6a, 0xeb, + 0x67, 0x72, 0x76, 0x3b, 0xbb, 0x53, 0x52, 0x13, 0x08, 0x7e, 0x07, 0xd6, 0xdd, 0xe9, 0xa9, 0x65, + 0xea, 0x5a, 0x82, 0x06, 0xdb, 0xd9, 0x9d, 0xbc, 0x8a, 0x44, 0x47, 0x6b, 0x46, 0xbe, 0x0e, 0x6b, + 0x4f, 0x28, 0x79, 0x94, 0xa4, 0x96, 0x39, 0xb5, 0xca, 0xe0, 0x04, 0xb1, 0x09, 0x95, 0x09, 0xf5, + 0x7d, 0x32, 0xa2, 0x5a, 0x70, 0xe6, 0x52, 0x39, 0xc7, 0x67, 0xbf, 0xbd, 0x30, 0xfb, 0xf9, 0x99, + 0x97, 0x43, 0xa9, 0xc1, 0x99, 0x4b, 0x71, 0x03, 0x4a, 0xd4, 0x9e, 0x4e, 0x84, 0x86, 0xfc, 0x39, + 0xfe, 0x53, 0xec, 0xe9, 0x64, 0x5e, 0x4b, 0x91, 0x89, 0x85, 0x2a, 0x56, 0x7c, 0xea, 0x3d, 0x36, + 0x75, 0x2a, 0x17, 0xb8, 0x82, 0xeb, 0x0b, 0x0a, 0xfa, 0xa2, 0x7f, 0x5e, 0x47, 0x24, 0x87, 0x9b, + 0x50, 0xa2, 0x4f, 0x03, 0x6a, 0xfb, 0xa6, 0x63, 0xcb, 0x2b, 0x5c, 0xc9, 0x5b, 0x4b, 0x56, 0x91, + 0x5a, 0xc6, 0xbc, 0x8a, 0x99, 0x1c, 0xbe, 0x0b, 0x2b, 0x8e, 0x1b, 0x98, 0x8e, 0xed, 0xcb, 0xc5, + 0x6d, 0x69, 0xa7, 0x7c, 0xeb, 0xd5, 0xa5, 0x81, 0xd0, 0x15, 0x1c, 0x35, 0x22, 0xe3, 0x36, 0x20, + 0xdf, 0x99, 0x7a, 0x3a, 0xd5, 0x74, 0xc7, 0xa0, 0x9a, 0x69, 0x0f, 0x1d, 0xb9, 0xc4, 0x15, 0x5c, + 0x5d, 0x9c, 0x08, 0x27, 0x36, 0x1d, 0x83, 0xb6, 0xed, 0xa1, 0xa3, 0x56, 0xfd, 0x54, 0x1b, 0x5f, + 0x82, 0x82, 0x7f, 0x66, 0x07, 0xe4, 0xa9, 0x5c, 0xe1, 0x11, 0x12, 0xb6, 0x6a, 0x5f, 0x17, 0x60, + 0xed, 0x22, 0x21, 0x76, 0x1f, 0xf2, 0x43, 0x36, 0x4b, 0x39, 0xf3, 0x5d, 0x7c, 0x20, 0x64, 0xd2, + 0x4e, 0x2c, 0x7c, 0x4f, 0x27, 0x36, 0xa0, 0x6c, 0x53, 0x3f, 0xa0, 0x86, 0x88, 0x88, 0xec, 0x05, + 0x63, 0x0a, 0x84, 0xd0, 0x62, 0x48, 0xe5, 0xbe, 0x57, 0x48, 0x7d, 0x0a, 0x6b, 0xb1, 0x49, 0x9a, + 0x47, 0xec, 0x51, 0x14, 0x9b, 0xbb, 0xcf, 0xb3, 0xa4, 0xae, 0x44, 0x72, 0x2a, 0x13, 0x53, 0xab, + 0x34, 0xd5, 0xc6, 0x2d, 0x00, 0xc7, 0xa6, 0xce, 0x50, 0x33, 0xa8, 0x6e, 0xc9, 0xc5, 0x73, 0xbc, + 0xd4, 0x65, 0x94, 0x05, 0x2f, 0x39, 0x02, 0xd5, 0x2d, 0xfc, 0xe1, 0x2c, 0xd4, 0x56, 0xce, 0x89, + 0x94, 0x63, 0xb1, 0xc9, 0x16, 0xa2, 0xed, 0x04, 0xaa, 0x1e, 0x65, 0x71, 0x4f, 0x8d, 0x70, 0x66, + 0x25, 0x6e, 0x44, 0xfd, 0xb9, 0x33, 0x53, 0x43, 0x31, 0x31, 0xb1, 0x55, 0x2f, 0xd9, 0xc4, 0x6f, + 0x40, 0x0c, 0x68, 0x3c, 0xac, 0x80, 0x67, 0xa1, 0x4a, 0x04, 0x76, 0xc8, 0x84, 0x6e, 0x7d, 0x09, + 0xd5, 0xb4, 0x7b, 0xf0, 0x26, 0xe4, 0xfd, 0x80, 0x78, 0x01, 0x8f, 0xc2, 0xbc, 0x2a, 0x1a, 0x18, + 0x41, 0x96, 0xda, 0x06, 0xcf, 0x72, 0x79, 0x95, 0xfd, 0xc5, 0x3f, 0x9d, 0x4d, 0x38, 0xcb, 0x27, + 0xfc, 0xf6, 0xe2, 0x8a, 0xa6, 0x34, 0xcf, 0xcf, 0x7b, 0xeb, 0x03, 0x58, 0x4d, 0x4d, 0xe0, 0xa2, + 0x43, 0xd7, 0x7e, 0x05, 0x2f, 0x2f, 0x55, 0x8d, 0x3f, 0x85, 0xcd, 0xa9, 0x6d, 0xda, 0x01, 0xf5, + 0x5c, 0x8f, 0xb2, 0x88, 0x15, 0x43, 0xc9, 0xff, 0x5e, 0x39, 0x27, 0xe6, 0x4e, 0x92, 0x6c, 0xa1, + 0x45, 0xdd, 0x98, 0x2e, 0x82, 0x37, 0x4b, 0xc5, 0xff, 0xac, 0xa0, 0x67, 0xcf, 0x9e, 0x3d, 0xcb, + 0xd4, 0x7e, 0x57, 0x80, 0xcd, 0x65, 0x7b, 0x66, 0xe9, 0xf6, 0xbd, 0x04, 0x05, 0x7b, 0x3a, 0x39, + 0xa5, 0x1e, 0x77, 0x52, 0x5e, 0x0d, 0x5b, 0xb8, 0x01, 0x79, 0x8b, 0x9c, 0x52, 0x4b, 0xce, 0x6d, + 0x4b, 0x3b, 0xd5, 0x5b, 0xef, 0x5c, 0x68, 0x57, 0xd6, 0x8f, 0x98, 0x88, 0x2a, 0x24, 0xf1, 0x47, + 0x90, 0x0b, 0x53, 0x34, 0xd3, 0x70, 0xf3, 0x62, 0x1a, 0xd8, 0x5e, 0x52, 0xb9, 0x1c, 0x7e, 0x05, + 0x4a, 0xec, 0x57, 0xc4, 0x46, 0x81, 0xdb, 0x5c, 0x64, 0x00, 0x8b, 0x0b, 0xbc, 0x05, 0x45, 0xbe, + 0x4d, 0x0c, 0x1a, 0x1d, 0x6d, 0x71, 0x9b, 0x05, 0x96, 0x41, 0x87, 0x64, 0x6a, 0x05, 0xda, 0x63, + 0x62, 0x4d, 0x29, 0x0f, 0xf8, 0x92, 0x5a, 0x09, 0xc1, 0x5f, 0x30, 0x0c, 0x5f, 0x85, 0xb2, 0xd8, + 0x55, 0xa6, 0x6d, 0xd0, 0xa7, 0x3c, 0x7b, 0xe6, 0x55, 0xb1, 0xd1, 0xda, 0x0c, 0x61, 0xc3, 0x3f, + 0xf4, 0x1d, 0x3b, 0x0a, 0x4d, 0x3e, 0x04, 0x03, 0xf8, 0xf0, 0x1f, 0xcc, 0x27, 0xee, 0xd7, 0x96, + 0x4f, 0x6f, 0x3e, 0xa6, 0x6a, 0x7f, 0xc9, 0x40, 0x8e, 0xe7, 0x8b, 0x35, 0x28, 0x0f, 0x3e, 0xeb, + 0x29, 0x5a, 0xab, 0x7b, 0xb2, 0x7f, 0xa4, 0x20, 0x09, 0x57, 0x01, 0x38, 0xf0, 0xe0, 0xa8, 0xdb, + 0x18, 0xa0, 0x4c, 0xdc, 0x6e, 0x77, 0x06, 0x77, 0x6f, 0xa3, 0x6c, 0x2c, 0x70, 0x22, 0x80, 0x5c, + 0x92, 0xf0, 0xfe, 0x2d, 0x94, 0xc7, 0x08, 0x2a, 0x42, 0x41, 0xfb, 0x53, 0xa5, 0x75, 0xf7, 0x36, + 0x2a, 0xa4, 0x91, 0xf7, 0x6f, 0xa1, 0x15, 0xbc, 0x0a, 0x25, 0x8e, 0xec, 0x77, 0xbb, 0x47, 0xa8, + 0x18, 0xeb, 0xec, 0x0f, 0xd4, 0x76, 0xe7, 0x00, 0x95, 0x62, 0x9d, 0x07, 0x6a, 0xf7, 0xa4, 0x87, + 0x20, 0xd6, 0x70, 0xac, 0xf4, 0xfb, 0x8d, 0x03, 0x05, 0x95, 0x63, 0xc6, 0xfe, 0x67, 0x03, 0xa5, + 0x8f, 0x2a, 0x29, 0xb3, 0xde, 0xbf, 0x85, 0x56, 0xe3, 0x21, 0x94, 0xce, 0xc9, 0x31, 0xaa, 0xe2, + 0x75, 0x58, 0x15, 0x43, 0x44, 0x46, 0xac, 0xcd, 0x41, 0x77, 0x6f, 0x23, 0x34, 0x33, 0x44, 0x68, + 0x59, 0x4f, 0x01, 0x77, 0x6f, 0x23, 0x5c, 0x6b, 0x42, 0x9e, 0x47, 0x17, 0xc6, 0x50, 0x3d, 0x6a, + 0xec, 0x2b, 0x47, 0x5a, 0xb7, 0x37, 0x68, 0x77, 0x3b, 0x8d, 0x23, 0x24, 0xcd, 0x30, 0x55, 0xf9, + 0xf9, 0x49, 0x5b, 0x55, 0x5a, 0x28, 0x93, 0xc4, 0x7a, 0x4a, 0x63, 0xa0, 0xb4, 0x50, 0xb6, 0xa6, + 0xc3, 0xe6, 0xb2, 0x3c, 0xb9, 0x74, 0x67, 0x24, 0x96, 0x38, 0x73, 0xce, 0x12, 0x73, 0x5d, 0x0b, + 0x4b, 0xfc, 0xcf, 0x0c, 0x6c, 0x2c, 0x39, 0x2b, 0x96, 0x0e, 0xf2, 0x13, 0xc8, 0x8b, 0x10, 0x15, + 0xa7, 0xe7, 0x8d, 0xa5, 0x87, 0x0e, 0x0f, 0xd8, 0x85, 0x13, 0x94, 0xcb, 0x25, 0x2b, 0x88, 0xec, + 0x39, 0x15, 0x04, 0x53, 0xb1, 0x90, 0xd3, 0x7f, 0xb9, 0x90, 0xd3, 0xc5, 0xb1, 0x77, 0xf7, 0x22, + 0xc7, 0x1e, 0xc7, 0xbe, 0x5b, 0x6e, 0xcf, 0x2f, 0xc9, 0xed, 0xf7, 0x61, 0x7d, 0x41, 0xd1, 0x85, + 0x73, 0xec, 0xaf, 0x25, 0x90, 0xcf, 0x73, 0xce, 0x73, 0x32, 0x5d, 0x26, 0x95, 0xe9, 0xee, 0xcf, + 0x7b, 0xf0, 0xda, 0xf9, 0x8b, 0xb0, 0xb0, 0xd6, 0x5f, 0x49, 0x70, 0x69, 0x79, 0xa5, 0xb8, 0xd4, + 0x86, 0x8f, 0xa0, 0x30, 0xa1, 0xc1, 0xd8, 0x89, 0xaa, 0xa5, 0xb7, 0x97, 0x9c, 0xc1, 0xac, 0x7b, + 0x7e, 0xb1, 0x43, 0xa9, 0xe4, 0x21, 0x9e, 0x3d, 0xaf, 0xdc, 0x13, 0xd6, 0x2c, 0x58, 0xfa, 0x9b, + 0x0c, 0xbc, 0xbc, 0x54, 0xf9, 0x52, 0x43, 0x5f, 0x03, 0x30, 0x6d, 0x77, 0x1a, 0x88, 0x8a, 0x48, + 0x24, 0xd8, 0x12, 0x47, 0x78, 0xf2, 0x62, 0xc9, 0x73, 0x1a, 0xc4, 0xfd, 0x59, 0xde, 0x0f, 0x02, + 0xe2, 0x84, 0x7b, 0x33, 0x43, 0x73, 0xdc, 0xd0, 0xd7, 0xcf, 0x99, 0xe9, 0x42, 0x60, 0xbe, 0x07, + 0x48, 0xb7, 0x4c, 0x6a, 0x07, 0x9a, 0x1f, 0x78, 0x94, 0x4c, 0x4c, 0x7b, 0xc4, 0x4f, 0x90, 0xe2, + 0x5e, 0x7e, 0x48, 0x2c, 0x9f, 0xaa, 0x6b, 0xa2, 0xbb, 0x1f, 0xf5, 0x32, 0x09, 0x1e, 0x40, 0x5e, + 0x42, 0xa2, 0x90, 0x92, 0x10, 0xdd, 0xb1, 0x44, 0xed, 0xeb, 0x22, 0x94, 0x13, 0x75, 0x35, 0xbe, + 0x06, 0x95, 0x87, 0xe4, 0x31, 0xd1, 0xa2, 0xbb, 0x92, 0xf0, 0x44, 0x99, 0x61, 0xbd, 0xf0, 0xbe, + 0xf4, 0x1e, 0x6c, 0x72, 0x8a, 0x33, 0x0d, 0xa8, 0xa7, 0xe9, 0x16, 0xf1, 0x7d, 0xee, 0xb4, 0x22, + 0xa7, 0x62, 0xd6, 0xd7, 0x65, 0x5d, 0xcd, 0xa8, 0x07, 0xdf, 0x81, 0x0d, 0x2e, 0x31, 0x99, 0x5a, + 0x81, 0xe9, 0x5a, 0x54, 0x63, 0xb7, 0x37, 0x9f, 0x9f, 0x24, 0xb1, 0x65, 0xeb, 0x8c, 0x71, 0x1c, + 0x12, 0x98, 0x45, 0x3e, 0x6e, 0xc1, 0x6b, 0x5c, 0x6c, 0x44, 0x6d, 0xea, 0x91, 0x80, 0x6a, 0xf4, + 0x8b, 0x29, 0xb1, 0x7c, 0x8d, 0xd8, 0x86, 0x36, 0x26, 0xfe, 0x58, 0xde, 0x64, 0x0a, 0xf6, 0x33, + 0xb2, 0xa4, 0x5e, 0x61, 0xc4, 0x83, 0x90, 0xa7, 0x70, 0x5a, 0xc3, 0x36, 0x3e, 0x26, 0xfe, 0x18, + 0xef, 0xc1, 0x25, 0xae, 0xc5, 0x0f, 0x3c, 0xd3, 0x1e, 0x69, 0xfa, 0x98, 0xea, 0x8f, 0xb4, 0x69, + 0x30, 0xbc, 0x27, 0xbf, 0x92, 0x1c, 0x9f, 0x5b, 0xd8, 0xe7, 0x9c, 0x26, 0xa3, 0x9c, 0x04, 0xc3, + 0x7b, 0xb8, 0x0f, 0x15, 0xb6, 0x18, 0x13, 0xf3, 0x4b, 0xaa, 0x0d, 0x1d, 0x8f, 0x1f, 0x8d, 0xd5, + 0x25, 0xa9, 0x29, 0xe1, 0xc1, 0x7a, 0x37, 0x14, 0x38, 0x76, 0x0c, 0xba, 0x97, 0xef, 0xf7, 0x14, + 0xa5, 0xa5, 0x96, 0x23, 0x2d, 0x0f, 0x1c, 0x8f, 0x05, 0xd4, 0xc8, 0x89, 0x1d, 0x5c, 0x16, 0x01, + 0x35, 0x72, 0x22, 0xf7, 0xde, 0x81, 0x0d, 0x5d, 0x17, 0x73, 0x36, 0x75, 0x2d, 0xbc, 0x63, 0xf9, + 0x32, 0x4a, 0x39, 0x4b, 0xd7, 0x0f, 0x04, 0x21, 0x8c, 0x71, 0x1f, 0x7f, 0x08, 0x2f, 0xcf, 0x9c, + 0x95, 0x14, 0x5c, 0x5f, 0x98, 0xe5, 0xbc, 0xe8, 0x1d, 0xd8, 0x70, 0xcf, 0x16, 0x05, 0x71, 0x6a, + 0x44, 0xf7, 0x6c, 0x5e, 0xec, 0x03, 0xd8, 0x74, 0xc7, 0xee, 0xa2, 0xdc, 0xcd, 0xa4, 0x1c, 0x76, + 0xc7, 0xee, 0xbc, 0xe0, 0x5b, 0xfc, 0xc2, 0xed, 0x51, 0x9d, 0x04, 0xd4, 0x90, 0x2f, 0x27, 0xe9, + 0x89, 0x0e, 0xbc, 0x0b, 0x48, 0xd7, 0x35, 0x6a, 0x93, 0x53, 0x8b, 0x6a, 0xc4, 0xa3, 0x36, 0xf1, + 0xe5, 0xab, 0x49, 0x72, 0x55, 0xd7, 0x15, 0xde, 0xdb, 0xe0, 0x9d, 0xf8, 0x26, 0xac, 0x3b, 0xa7, + 0x0f, 0x75, 0x11, 0x92, 0x9a, 0xeb, 0xd1, 0xa1, 0xf9, 0x54, 0x7e, 0x93, 0xfb, 0x77, 0x8d, 0x75, + 0xf0, 0x80, 0xec, 0x71, 0x18, 0xdf, 0x00, 0xa4, 0xfb, 0x63, 0xe2, 0xb9, 0x3c, 0x27, 0xfb, 0x2e, + 0xd1, 0xa9, 0xfc, 0x96, 0xa0, 0x0a, 0xbc, 0x13, 0xc1, 0x6c, 0x4b, 0xf8, 0x4f, 0xcc, 0x61, 0x10, + 0x69, 0xbc, 0x2e, 0xb6, 0x04, 0xc7, 0x42, 0x6d, 0x3b, 0x80, 0x98, 0x2b, 0x52, 0x03, 0xef, 0x70, + 0x5a, 0xd5, 0x1d, 0xbb, 0xc9, 0x71, 0xdf, 0x80, 0x55, 0xc6, 0x9c, 0x0d, 0x7a, 0x43, 0x14, 0x64, + 0xee, 0x38, 0x31, 0xe2, 0x0f, 0x56, 0x1b, 0xd7, 0xf6, 0xa0, 0x92, 0x8c, 0x4f, 0x5c, 0x02, 0x11, + 0xa1, 0x48, 0x62, 0xc5, 0x4a, 0xb3, 0xdb, 0x62, 0x65, 0xc6, 0xe7, 0x0a, 0xca, 0xb0, 0x72, 0xe7, + 0xa8, 0x3d, 0x50, 0x34, 0xf5, 0xa4, 0x33, 0x68, 0x1f, 0x2b, 0x28, 0x9b, 0xa8, 0xab, 0x0f, 0x73, + 0xc5, 0xb7, 0xd1, 0xf5, 0xda, 0x37, 0x19, 0xa8, 0xa6, 0x2f, 0x4a, 0xf8, 0xff, 0xe1, 0x72, 0xf4, + 0xaa, 0xe1, 0xd3, 0x40, 0x7b, 0x62, 0x7a, 0x7c, 0xe3, 0x4c, 0x88, 0x38, 0xc4, 0xe2, 0xa5, 0xdb, + 0x0c, 0x59, 0x7d, 0x1a, 0x7c, 0x62, 0x7a, 0x6c, 0x5b, 0x4c, 0x48, 0x80, 0x8f, 0xe0, 0xaa, 0xed, + 0x68, 0x7e, 0x40, 0x6c, 0x83, 0x78, 0x86, 0x36, 0x7b, 0x4f, 0xd2, 0x88, 0xae, 0x53, 0xdf, 0x77, + 0xc4, 0x81, 0x15, 0x6b, 0x79, 0xd5, 0x76, 0xfa, 0x21, 0x79, 0x96, 0xc9, 0x1b, 0x21, 0x75, 0x2e, + 0xcc, 0xb2, 0xe7, 0x85, 0xd9, 0x2b, 0x50, 0x9a, 0x10, 0x57, 0xa3, 0x76, 0xe0, 0x9d, 0xf1, 0xf2, + 0xb8, 0xa8, 0x16, 0x27, 0xc4, 0x55, 0x58, 0xfb, 0x85, 0xdc, 0x52, 0x0e, 0x73, 0xc5, 0x22, 0x2a, + 0x1d, 0xe6, 0x8a, 0x25, 0x04, 0xb5, 0x7f, 0x64, 0xa1, 0x92, 0x2c, 0x97, 0xd9, 0xed, 0x43, 0xe7, + 0x27, 0x8b, 0xc4, 0x73, 0xcf, 0x1b, 0xdf, 0x5a, 0x5c, 0xd7, 0x9b, 0xec, 0xc8, 0xd9, 0x2b, 0x88, + 0x22, 0x56, 0x15, 0x92, 0xec, 0xb8, 0x67, 0xd9, 0x86, 0x8a, 0xa2, 0xa1, 0xa8, 0x86, 0x2d, 0x7c, + 0x00, 0x85, 0x87, 0x3e, 0xd7, 0x5d, 0xe0, 0xba, 0xdf, 0xfc, 0x76, 0xdd, 0x87, 0x7d, 0xae, 0xbc, + 0x74, 0xd8, 0xd7, 0x3a, 0x5d, 0xf5, 0xb8, 0x71, 0xa4, 0x86, 0xe2, 0xf8, 0x0a, 0xe4, 0x2c, 0xf2, + 0xe5, 0x59, 0xfa, 0x70, 0xe2, 0xd0, 0x45, 0x17, 0xe1, 0x0a, 0xe4, 0x9e, 0x50, 0xf2, 0x28, 0x7d, + 0x24, 0x70, 0xe8, 0x07, 0xdc, 0x0c, 0xbb, 0x90, 0xe7, 0xfe, 0xc2, 0x00, 0xa1, 0xc7, 0xd0, 0x4b, + 0xb8, 0x08, 0xb9, 0x66, 0x57, 0x65, 0x1b, 0x02, 0x41, 0x45, 0xa0, 0x5a, 0xaf, 0xad, 0x34, 0x15, + 0x94, 0xa9, 0xdd, 0x81, 0x82, 0x70, 0x02, 0xdb, 0x2c, 0xb1, 0x1b, 0xd0, 0x4b, 0x61, 0x33, 0xd4, + 0x21, 0x45, 0xbd, 0x27, 0xc7, 0xfb, 0x8a, 0x8a, 0x32, 0xe9, 0xa5, 0xce, 0xa1, 0x7c, 0xcd, 0x87, + 0x4a, 0xb2, 0x5e, 0x7e, 0x31, 0x77, 0xe1, 0xbf, 0x4a, 0x50, 0x4e, 0xd4, 0xbf, 0xac, 0x70, 0x21, + 0x96, 0xe5, 0x3c, 0xd1, 0x88, 0x65, 0x12, 0x3f, 0x0c, 0x0d, 0xe0, 0x50, 0x83, 0x21, 0x17, 0x5d, + 0xba, 0x17, 0xb4, 0x45, 0xf2, 0xa8, 0x50, 0xfb, 0xa3, 0x04, 0x68, 0xbe, 0x00, 0x9d, 0x33, 0x53, + 0xfa, 0x31, 0xcd, 0xac, 0xfd, 0x41, 0x82, 0x6a, 0xba, 0xea, 0x9c, 0x33, 0xef, 0xda, 0x8f, 0x6a, + 0xde, 0xdf, 0x33, 0xb0, 0x9a, 0xaa, 0x35, 0x2f, 0x6a, 0xdd, 0x17, 0xb0, 0x6e, 0x1a, 0x74, 0xe2, + 0x3a, 0x01, 0xb5, 0xf5, 0x33, 0xcd, 0xa2, 0x8f, 0xa9, 0x25, 0xd7, 0x78, 0xd2, 0xd8, 0xfd, 0xf6, + 0x6a, 0xb6, 0xde, 0x9e, 0xc9, 0x1d, 0x31, 0xb1, 0xbd, 0x8d, 0x76, 0x4b, 0x39, 0xee, 0x75, 0x07, + 0x4a, 0xa7, 0xf9, 0x99, 0x76, 0xd2, 0xf9, 0x59, 0xa7, 0xfb, 0x49, 0x47, 0x45, 0xe6, 0x1c, 0xed, + 0x07, 0xdc, 0xf6, 0x3d, 0x40, 0xf3, 0x46, 0xe1, 0xcb, 0xb0, 0xcc, 0x2c, 0xf4, 0x12, 0xde, 0x80, + 0xb5, 0x4e, 0x57, 0xeb, 0xb7, 0x5b, 0x8a, 0xa6, 0x3c, 0x78, 0xa0, 0x34, 0x07, 0x7d, 0xf1, 0x3e, + 0x11, 0xb3, 0x07, 0xa9, 0x0d, 0x5e, 0xfb, 0x7d, 0x16, 0x36, 0x96, 0x58, 0x82, 0x1b, 0xe1, 0xcd, + 0x42, 0x5c, 0x76, 0xde, 0xbd, 0x88, 0xf5, 0x75, 0x56, 0x10, 0xf4, 0x88, 0x17, 0x84, 0x17, 0x91, + 0x1b, 0xc0, 0xbc, 0x64, 0x07, 0xe6, 0xd0, 0xa4, 0x5e, 0xf8, 0x9c, 0x23, 0xae, 0x1b, 0x6b, 0x33, + 0x5c, 0xbc, 0xe8, 0xfc, 0x1f, 0x60, 0xd7, 0xf1, 0xcd, 0xc0, 0x7c, 0x4c, 0x35, 0xd3, 0x8e, 0xde, + 0x7e, 0xd8, 0xf5, 0x23, 0xa7, 0xa2, 0xa8, 0xa7, 0x6d, 0x07, 0x31, 0xdb, 0xa6, 0x23, 0x32, 0xc7, + 0x66, 0xc9, 0x3c, 0xab, 0xa2, 0xa8, 0x27, 0x66, 0x5f, 0x83, 0x8a, 0xe1, 0x4c, 0x59, 0x4d, 0x26, + 0x78, 0xec, 0xec, 0x90, 0xd4, 0xb2, 0xc0, 0x62, 0x4a, 0x58, 0x6d, 0xcf, 0x1e, 0x9d, 0x2a, 0x6a, + 0x59, 0x60, 0x82, 0x72, 0x1d, 0xd6, 0xc8, 0x68, 0xe4, 0x31, 0xe5, 0x91, 0x22, 0x71, 0x7f, 0xa8, + 0xc6, 0x30, 0x27, 0x6e, 0x1d, 0x42, 0x31, 0xf2, 0x03, 0x3b, 0xaa, 0x99, 0x27, 0x34, 0x57, 0x5c, + 0x8a, 0x33, 0x3b, 0x25, 0xb5, 0x68, 0x47, 0x9d, 0xd7, 0xa0, 0x62, 0xfa, 0xda, 0xec, 0x0d, 0x3d, + 0xb3, 0x9d, 0xd9, 0x29, 0xaa, 0x65, 0xd3, 0x8f, 0xdf, 0x1f, 0x6b, 0x5f, 0x65, 0xa0, 0x9a, 0xfe, + 0x06, 0x80, 0x5b, 0x50, 0xb4, 0x1c, 0x9d, 0xf0, 0xd0, 0x12, 0x1f, 0xa0, 0x76, 0x9e, 0xf3, 0xd9, + 0xa0, 0x7e, 0x14, 0xf2, 0xd5, 0x58, 0x72, 0xeb, 0x6f, 0x12, 0x14, 0x23, 0x18, 0x5f, 0x82, 0x9c, + 0x4b, 0x82, 0x31, 0x57, 0x97, 0xdf, 0xcf, 0x20, 0x49, 0xe5, 0x6d, 0x86, 0xfb, 0x2e, 0xb1, 0x79, + 0x08, 0x84, 0x38, 0x6b, 0xb3, 0x75, 0xb5, 0x28, 0x31, 0xf8, 0xe5, 0xc4, 0x99, 0x4c, 0xa8, 0x1d, + 0xf8, 0xd1, 0xba, 0x86, 0x78, 0x33, 0x84, 0xf1, 0x3b, 0xb0, 0x1e, 0x78, 0xc4, 0xb4, 0x52, 0xdc, + 0x1c, 0xe7, 0xa2, 0xa8, 0x23, 0x26, 0xef, 0xc1, 0x95, 0x48, 0xaf, 0x41, 0x03, 0xa2, 0x8f, 0xa9, + 0x31, 0x13, 0x2a, 0xf0, 0x47, 0x88, 0xcb, 0x21, 0xa1, 0x15, 0xf6, 0x47, 0xb2, 0xb5, 0x6f, 0x24, + 0x58, 0x8f, 0xae, 0x53, 0x46, 0xec, 0xac, 0x63, 0x00, 0x62, 0xdb, 0x4e, 0x90, 0x74, 0xd7, 0x62, + 0x28, 0x2f, 0xc8, 0xd5, 0x1b, 0xb1, 0x90, 0x9a, 0x50, 0xb0, 0x35, 0x01, 0x98, 0xf5, 0x9c, 0xeb, + 0xb6, 0xab, 0x50, 0x0e, 0x3f, 0xf0, 0xf0, 0xaf, 0x84, 0xe2, 0x02, 0x0e, 0x02, 0x62, 0xf7, 0x2e, + 0xbc, 0x09, 0xf9, 0x53, 0x3a, 0x32, 0xed, 0xf0, 0xd9, 0x56, 0x34, 0xa2, 0x67, 0x92, 0x5c, 0xfc, + 0x4c, 0xb2, 0xff, 0x5b, 0x09, 0x36, 0x74, 0x67, 0x32, 0x6f, 0xef, 0x3e, 0x9a, 0x7b, 0x05, 0xf0, + 0x3f, 0x96, 0x3e, 0xff, 0x68, 0x64, 0x06, 0xe3, 0xe9, 0x69, 0x5d, 0x77, 0x26, 0xbb, 0x23, 0xc7, + 0x22, 0xf6, 0x68, 0xf6, 0x99, 0x93, 0xff, 0xd1, 0xdf, 0x1d, 0x51, 0xfb, 0xdd, 0x91, 0x93, 0xf8, + 0xe8, 0x79, 0x7f, 0xf6, 0xf7, 0xbf, 0x92, 0xf4, 0xa7, 0x4c, 0xf6, 0xa0, 0xb7, 0xff, 0xe7, 0xcc, + 0xd6, 0x81, 0x18, 0xae, 0x17, 0xb9, 0x47, 0xa5, 0x43, 0x8b, 0xea, 0x6c, 0xca, 0xff, 0x0b, 0x00, + 0x00, 0xff, 0xff, 0x1a, 0x28, 0x25, 0x79, 0x42, 0x1d, 0x00, 0x00, } diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/descriptor/descriptor.proto b/vendor/github.com/golang/protobuf/protoc-gen-go/descriptor/descriptor.proto index 4d4fb378f..8697a50de 100644 --- a/vendor/github.com/golang/protobuf/protoc-gen-go/descriptor/descriptor.proto +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/descriptor/descriptor.proto @@ -45,6 +45,7 @@ option java_package = "com.google.protobuf"; option java_outer_classname = "DescriptorProtos"; option csharp_namespace = "Google.Protobuf.Reflection"; option objc_class_prefix = "GPB"; +option cc_enable_arenas = true; // descriptor.proto must be optimized for speed because reflection-based // algorithms don't work during bootstrapping. @@ -225,6 +226,26 @@ message EnumDescriptorProto { repeated EnumValueDescriptorProto value = 2; optional EnumOptions options = 3; + + // Range of reserved numeric values. Reserved values may not be used by + // entries in the same enum. Reserved ranges may not overlap. + // + // Note that this is distinct from DescriptorProto.ReservedRange in that it + // is inclusive such that it can appropriately represent the entire int32 + // domain. + message EnumReservedRange { + optional int32 start = 1; // Inclusive. + optional int32 end = 2; // Inclusive. + } + + // Range of reserved numeric values. Reserved numeric values may not be used + // by enum values in the same enum declaration. Reserved ranges may not + // overlap. + repeated EnumReservedRange reserved_range = 4; + + // Reserved enum value names, which may not be reused. A given name may only + // be reserved once. + repeated string reserved_name = 5; } // Describes a value within an enum. @@ -396,10 +417,12 @@ message FileOptions { // determining the namespace. optional string php_namespace = 41; - // The parser stores options it doesn't recognize here. See above. + // The parser stores options it doesn't recognize here. + // See the documentation for the "Options" section above. repeated UninterpretedOption uninterpreted_option = 999; - // Clients can define custom options in extensions of this message. See above. + // Clients can define custom options in extensions of this message. + // See the documentation for the "Options" section above. extensions 1000 to max; reserved 38; diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/generator/Makefile b/vendor/github.com/golang/protobuf/protoc-gen-go/generator/Makefile deleted file mode 100644 index b5715c357..000000000 --- a/vendor/github.com/golang/protobuf/protoc-gen-go/generator/Makefile +++ /dev/null @@ -1,40 +0,0 @@ -# Go support for Protocol Buffers - Google's data interchange format -# -# Copyright 2010 The Go Authors. All rights reserved. -# https://github.com/golang/protobuf -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -include $(GOROOT)/src/Make.inc - -TARG=github.com/golang/protobuf/compiler/generator -GOFILES=\ - generator.go\ - -DEPS=../descriptor ../plugin ../../proto - -include $(GOROOT)/src/Make.pkg diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/generator/generator.go b/vendor/github.com/golang/protobuf/protoc-gen-go/generator/generator.go index 60d524645..e0aba85f3 100644 --- a/vendor/github.com/golang/protobuf/protoc-gen-go/generator/generator.go +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/generator/generator.go @@ -40,19 +40,24 @@ import ( "bufio" "bytes" "compress/gzip" + "crypto/sha256" + "encoding/hex" "fmt" + "go/build" "go/parser" "go/printer" "go/token" "log" "os" "path" + "sort" "strconv" "strings" "unicode" "unicode/utf8" "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/protoc-gen-go/generator/internal/remap" "github.com/golang/protobuf/protoc-gen-go/descriptor" plugin "github.com/golang/protobuf/protoc-gen-go/plugin" @@ -88,6 +93,14 @@ func RegisterPlugin(p Plugin) { plugins = append(plugins, p) } +// A GoImportPath is the import path of a Go package. e.g., "google.golang.org/genproto/protobuf". +type GoImportPath string + +func (p GoImportPath) String() string { return strconv.Quote(string(p)) } + +// A GoPackageName is the name of a Go package. e.g., "protobuf". +type GoPackageName string + // Each type we import as a protocol buffer (other than FileDescriptorProto) needs // a pointer to the FileDescriptorProto that represents it. These types achieve that // wrapping by placing each Proto inside a struct with the pointer to its File. The @@ -96,19 +109,21 @@ func RegisterPlugin(p Plugin) { // The file and package name method are common to messages and enums. type common struct { - file *descriptor.FileDescriptorProto // File this object comes from. + file *FileDescriptor // File this object comes from. } -// PackageName is name in the package clause in the generated file. -func (c *common) PackageName() string { return uniquePackageOf(c.file) } +// GoImportPath is the import path of the Go package containing the type. +func (c *common) GoImportPath() GoImportPath { + return c.file.importPath +} -func (c *common) File() *descriptor.FileDescriptorProto { return c.file } +func (c *common) File() *FileDescriptor { return c.file } func fileIsProto3(file *descriptor.FileDescriptorProto) bool { return file.GetSyntax() == "proto3" } -func (c *common) proto3() bool { return fileIsProto3(c.file) } +func (c *common) proto3() bool { return fileIsProto3(c.file.FileDescriptorProto) } // Descriptor represents a protocol buffer message. type Descriptor struct { @@ -134,7 +149,7 @@ func (d *Descriptor) TypeName() []string { for parent := d; parent != nil; parent = parent.parent { n++ } - s := make([]string, n, n) + s := make([]string, n) for parent := d; parent != nil; parent = parent.parent { n-- s[n] = parent.GetName() @@ -256,77 +271,61 @@ type FileDescriptor struct { // This is used for supporting public imports. exported map[Object][]symbol - index int // The index of this file in the list of files to generate code for + fingerprint string // Fingerprint of this file's contents. + importPath GoImportPath // Import path of this file's package. + packageName GoPackageName // Name of this file's Go package. proto3 bool // whether to generate proto3 code for this file } -// PackageName is the package name we'll use in the generated code to refer to this file. -func (d *FileDescriptor) PackageName() string { return uniquePackageOf(d.FileDescriptorProto) } - // VarName is the variable name we'll use in the generated code to refer // to the compressed bytes of this descriptor. It is not exported, so // it is only valid inside the generated package. -func (d *FileDescriptor) VarName() string { return fmt.Sprintf("fileDescriptor%d", d.index) } +func (d *FileDescriptor) VarName() string { + name := strings.Map(badToUnderscore, baseName(d.GetName())) + return fmt.Sprintf("fileDescriptor_%s_%s", name, d.fingerprint) +} // goPackageOption interprets the file's go_package option. // If there is no go_package, it returns ("", "", false). // If there's a simple name, it returns ("", pkg, true). // If the option implies an import path, it returns (impPath, pkg, true). -func (d *FileDescriptor) goPackageOption() (impPath, pkg string, ok bool) { - pkg = d.GetOptions().GetGoPackage() - if pkg == "" { - return - } - ok = true - // The presence of a slash implies there's an import path. - slash := strings.LastIndex(pkg, "/") - if slash < 0 { - return - } - impPath, pkg = pkg, pkg[slash+1:] - // A semicolon-delimited suffix overrides the package name. - sc := strings.IndexByte(impPath, ';') - if sc < 0 { - return +func (d *FileDescriptor) goPackageOption() (impPath GoImportPath, pkg GoPackageName, ok bool) { + opt := d.GetOptions().GetGoPackage() + if opt == "" { + return "", "", false } - impPath, pkg = impPath[:sc], impPath[sc+1:] - return -} - -// goPackageName returns the Go package name to use in the -// generated Go file. The result explicit reports whether the name -// came from an option go_package statement. If explicit is false, -// the name was derived from the protocol buffer's package statement -// or the input file name. -func (d *FileDescriptor) goPackageName() (name string, explicit bool) { - // Does the file have a "go_package" option? - if _, pkg, ok := d.goPackageOption(); ok { - return pkg, true + // A semicolon-delimited suffix delimits the import path and package name. + sc := strings.Index(opt, ";") + if sc >= 0 { + return GoImportPath(opt[:sc]), cleanPackageName(opt[sc+1:]), true } - - // Does the file have a package clause? - if pkg := d.GetPackage(); pkg != "" { - return pkg, false + // The presence of a slash implies there's an import path. + slash := strings.LastIndex(opt, "/") + if slash >= 0 { + return GoImportPath(opt), cleanPackageName(opt[slash+1:]), true } - // Use the file base name. - return baseName(d.GetName()), false + return "", cleanPackageName(opt), true } // goFileName returns the output name for the generated Go file. -func (d *FileDescriptor) goFileName() string { +func (d *FileDescriptor) goFileName(pathType pathType) string { name := *d.Name if ext := path.Ext(name); ext == ".proto" || ext == ".protodevel" { name = name[:len(name)-len(ext)] } name += ".pb.go" + if pathType == pathTypeSourceRelative { + return name + } + // Does the file have a "go_package" option? // If it does, it may override the filename. if impPath, _, ok := d.goPackageOption(); ok && impPath != "" { // Replace the existing dirname with the declared import path. _, name = path.Split(name) - name = path.Join(impPath, name) + name = path.Join(string(impPath), name) return name } @@ -341,14 +340,13 @@ func (d *FileDescriptor) addExport(obj Object, sym symbol) { type symbol interface { // GenerateAlias should generate an appropriate alias // for the symbol from the named package. - GenerateAlias(g *Generator, pkg string) + GenerateAlias(g *Generator, pkg GoPackageName) } type messageSymbol struct { sym string hasExtensions, isMessageSet bool - hasOneof bool - getters []getterSymbol + oneofTypes []string } type getterSymbol struct { @@ -358,144 +356,11 @@ type getterSymbol struct { genType bool // whether typ contains a generated type (message/group/enum) } -func (ms *messageSymbol) GenerateAlias(g *Generator, pkg string) { - remoteSym := pkg + "." + ms.sym - - g.P("type ", ms.sym, " ", remoteSym) - g.P("func (m *", ms.sym, ") Reset() { (*", remoteSym, ")(m).Reset() }") - g.P("func (m *", ms.sym, ") String() string { return (*", remoteSym, ")(m).String() }") - g.P("func (*", ms.sym, ") ProtoMessage() {}") - if ms.hasExtensions { - g.P("func (*", ms.sym, ") ExtensionRangeArray() []", g.Pkg["proto"], ".ExtensionRange ", - "{ return (*", remoteSym, ")(nil).ExtensionRangeArray() }") - if ms.isMessageSet { - g.P("func (m *", ms.sym, ") Marshal() ([]byte, error) ", - "{ return (*", remoteSym, ")(m).Marshal() }") - g.P("func (m *", ms.sym, ") Unmarshal(buf []byte) error ", - "{ return (*", remoteSym, ")(m).Unmarshal(buf) }") - } - } - if ms.hasOneof { - // Oneofs and public imports do not mix well. - // We can make them work okay for the binary format, - // but they're going to break weirdly for text/JSON. - enc := "_" + ms.sym + "_OneofMarshaler" - dec := "_" + ms.sym + "_OneofUnmarshaler" - size := "_" + ms.sym + "_OneofSizer" - encSig := "(msg " + g.Pkg["proto"] + ".Message, b *" + g.Pkg["proto"] + ".Buffer) error" - decSig := "(msg " + g.Pkg["proto"] + ".Message, tag, wire int, b *" + g.Pkg["proto"] + ".Buffer) (bool, error)" - sizeSig := "(msg " + g.Pkg["proto"] + ".Message) int" - g.P("func (m *", ms.sym, ") XXX_OneofFuncs() (func", encSig, ", func", decSig, ", func", sizeSig, ", []interface{}) {") - g.P("return ", enc, ", ", dec, ", ", size, ", nil") - g.P("}") - - g.P("func ", enc, encSig, " {") - g.P("m := msg.(*", ms.sym, ")") - g.P("m0 := (*", remoteSym, ")(m)") - g.P("enc, _, _, _ := m0.XXX_OneofFuncs()") - g.P("return enc(m0, b)") - g.P("}") - - g.P("func ", dec, decSig, " {") - g.P("m := msg.(*", ms.sym, ")") - g.P("m0 := (*", remoteSym, ")(m)") - g.P("_, dec, _, _ := m0.XXX_OneofFuncs()") - g.P("return dec(m0, tag, wire, b)") - g.P("}") - - g.P("func ", size, sizeSig, " {") - g.P("m := msg.(*", ms.sym, ")") - g.P("m0 := (*", remoteSym, ")(m)") - g.P("_, _, size, _ := m0.XXX_OneofFuncs()") - g.P("return size(m0)") - g.P("}") +func (ms *messageSymbol) GenerateAlias(g *Generator, pkg GoPackageName) { + g.P("type ", ms.sym, " = ", pkg, ".", ms.sym) + for _, name := range ms.oneofTypes { + g.P("type ", name, " = ", pkg, ".", name) } - for _, get := range ms.getters { - - if get.typeName != "" { - g.RecordTypeUse(get.typeName) - } - typ := get.typ - val := "(*" + remoteSym + ")(m)." + get.name + "()" - if get.genType { - // typ will be "*pkg.T" (message/group) or "pkg.T" (enum) - // or "map[t]*pkg.T" (map to message/enum). - // The first two of those might have a "[]" prefix if it is repeated. - // Drop any package qualifier since we have hoisted the type into this package. - rep := strings.HasPrefix(typ, "[]") - if rep { - typ = typ[2:] - } - isMap := strings.HasPrefix(typ, "map[") - star := typ[0] == '*' - if !isMap { // map types handled lower down - typ = typ[strings.Index(typ, ".")+1:] - } - if star { - typ = "*" + typ - } - if rep { - // Go does not permit conversion between slice types where both - // element types are named. That means we need to generate a bit - // of code in this situation. - // typ is the element type. - // val is the expression to get the slice from the imported type. - - ctyp := typ // conversion type expression; "Foo" or "(*Foo)" - if star { - ctyp = "(" + typ + ")" - } - - g.P("func (m *", ms.sym, ") ", get.name, "() []", typ, " {") - g.In() - g.P("o := ", val) - g.P("if o == nil {") - g.In() - g.P("return nil") - g.Out() - g.P("}") - g.P("s := make([]", typ, ", len(o))") - g.P("for i, x := range o {") - g.In() - g.P("s[i] = ", ctyp, "(x)") - g.Out() - g.P("}") - g.P("return s") - g.Out() - g.P("}") - continue - } - if isMap { - // Split map[keyTyp]valTyp. - bra, ket := strings.Index(typ, "["), strings.Index(typ, "]") - keyTyp, valTyp := typ[bra+1:ket], typ[ket+1:] - // Drop any package qualifier. - // Only the value type may be foreign. - star := valTyp[0] == '*' - valTyp = valTyp[strings.Index(valTyp, ".")+1:] - if star { - valTyp = "*" + valTyp - } - - typ := "map[" + keyTyp + "]" + valTyp - g.P("func (m *", ms.sym, ") ", get.name, "() ", typ, " {") - g.P("o := ", val) - g.P("if o == nil { return nil }") - g.P("s := make(", typ, ", len(o))") - g.P("for k, v := range o {") - g.P("s[k] = (", valTyp, ")(v)") - g.P("}") - g.P("return s") - g.P("}") - continue - } - // Convert imported type into the forwarding type. - val = "(" + typ + ")(" + val + ")" - } - - g.P("func (m *", ms.sym, ") ", get.name, "() ", typ, " { return ", val, " }") - } - } type enumSymbol struct { @@ -503,16 +368,11 @@ type enumSymbol struct { proto3 bool // Whether this came from a proto3 file. } -func (es enumSymbol) GenerateAlias(g *Generator, pkg string) { +func (es enumSymbol) GenerateAlias(g *Generator, pkg GoPackageName) { s := es.name - g.P("type ", s, " ", pkg, ".", s) + g.P("type ", s, " = ", pkg, ".", s) g.P("var ", s, "_name = ", pkg, ".", s, "_name") g.P("var ", s, "_value = ", pkg, ".", s, "_value") - g.P("func (x ", s, ") String() string { return (", pkg, ".", s, ")(x).String() }") - if !es.proto3 { - g.P("func (x ", s, ") Enum() *", s, "{ return (*", s, ")((", pkg, ".", s, ")(x).Enum()) }") - g.P("func (x *", s, ") UnmarshalJSON(data []byte) error { return (*", pkg, ".", s, ")(x).UnmarshalJSON(data) }") - } } type constOrVarSymbol struct { @@ -521,8 +381,8 @@ type constOrVarSymbol struct { cast string // if non-empty, a type cast is required (used for enums) } -func (cs constOrVarSymbol) GenerateAlias(g *Generator, pkg string) { - v := pkg + "." + cs.sym +func (cs constOrVarSymbol) GenerateAlias(g *Generator, pkg GoPackageName) { + v := string(pkg) + "." + cs.sym if cs.cast != "" { v = cs.cast + "(" + v + ")" } @@ -531,21 +391,9 @@ func (cs constOrVarSymbol) GenerateAlias(g *Generator, pkg string) { // Object is an interface abstracting the abilities shared by enums, messages, extensions and imported objects. type Object interface { - PackageName() string // The name we use in our output (a_b_c), possibly renamed for uniqueness. + GoImportPath() GoImportPath TypeName() []string - File() *descriptor.FileDescriptorProto -} - -// Each package name we generate must be unique. The package we're generating -// gets its own name but every other package must have a unique name that does -// not conflict in the code we generate. These names are chosen globally (although -// they don't have to be, it simplifies things to do them globally). -func uniquePackageOf(fd *descriptor.FileDescriptorProto) string { - s, ok := uniquePackageName[fd] - if !ok { - log.Fatal("internal error: no package name defined for " + fd.GetName()) - } - return s + File() *FileDescriptor } // Generator is the type whose methods generate the output, stored in the associated response structure. @@ -562,18 +410,30 @@ type Generator struct { Pkg map[string]string // The names under which we import support packages - packageName string // What we're calling ourselves. - allFiles []*FileDescriptor // All files in the tree - allFilesByName map[string]*FileDescriptor // All files by filename. - genFiles []*FileDescriptor // Those files we will generate output for. - file *FileDescriptor // The file we are compiling now. - usedPackages map[string]bool // Names of packages used in current file. - typeNameToObject map[string]Object // Key is a fully-qualified name in input syntax. - init []string // Lines to emit in the init function. + outputImportPath GoImportPath // Package we're generating code for. + allFiles []*FileDescriptor // All files in the tree + allFilesByName map[string]*FileDescriptor // All files by filename. + genFiles []*FileDescriptor // Those files we will generate output for. + file *FileDescriptor // The file we are compiling now. + packageNames map[GoImportPath]GoPackageName // Imported package names in the current file. + usedPackages map[GoImportPath]bool // Packages used in current file. + usedPackageNames map[GoPackageName]bool // Package names used in the current file. + typeNameToObject map[string]Object // Key is a fully-qualified name in input syntax. + init []string // Lines to emit in the init function. indent string + pathType pathType // How to generate output filenames. writeOutput bool + annotateCode bool // whether to store annotations + annotations []*descriptor.GeneratedCodeInfo_Annotation // annotations to store } +type pathType int + +const ( + pathTypeImport pathType = iota + pathTypeSourceRelative +) + // New creates a new generator and allocates the request and response protobufs. func New() *Generator { g := new(Generator) @@ -618,8 +478,21 @@ func (g *Generator) CommandLineParameters(parameter string) { g.ImportPrefix = v case "import_path": g.PackageImportPath = v + case "paths": + switch v { + case "import": + g.pathType = pathTypeImport + case "source_relative": + g.pathType = pathTypeSourceRelative + default: + g.Fail(fmt.Sprintf(`Unknown path type %q: want "import" or "source_relative".`, v)) + } case "plugins": pluginList = v + case "annotate_code": + if v == "true" { + g.annotateCode = true + } default: if len(k) > 0 && k[0] == 'M' { g.ImportMap[k[1:]] = v @@ -646,37 +519,42 @@ func (g *Generator) CommandLineParameters(parameter string) { // If its file is in a different package, it returns the package name we're using for this file, plus ".". // Otherwise it returns the empty string. func (g *Generator) DefaultPackageName(obj Object) string { - pkg := obj.PackageName() - if pkg == g.packageName { + importPath := obj.GoImportPath() + if importPath == g.outputImportPath { return "" } - return pkg + "." + return string(g.GoPackageName(importPath)) + "." } -// For each input file, the unique package name to use, underscored. -var uniquePackageName = make(map[*descriptor.FileDescriptorProto]string) +// GoPackageName returns the name used for a package. +func (g *Generator) GoPackageName(importPath GoImportPath) GoPackageName { + if name, ok := g.packageNames[importPath]; ok { + return name + } + name := cleanPackageName(baseName(string(importPath))) + for i, orig := 1, name; g.usedPackageNames[name]; i++ { + name = orig + GoPackageName(strconv.Itoa(i)) + } + g.packageNames[importPath] = name + g.usedPackageNames[name] = true + return name +} -// Package names already registered. Key is the name from the .proto file; -// value is the name that appears in the generated code. -var pkgNamesInUse = make(map[string]bool) +var globalPackageNames = map[GoPackageName]bool{ + "fmt": true, + "math": true, + "proto": true, +} -// Create and remember a guaranteed unique package name for this file descriptor. -// Pkg is the candidate name. If f is nil, it's a builtin package like "proto" and -// has no file descriptor. +// Create and remember a guaranteed unique package name. Pkg is the candidate name. +// The FileDescriptor parameter is unused. func RegisterUniquePackageName(pkg string, f *FileDescriptor) string { - // Convert dots to underscores before finding a unique alias. - pkg = strings.Map(badToUnderscore, pkg) - - for i, orig := 1, pkg; pkgNamesInUse[pkg]; i++ { - // It's a duplicate; must rename. - pkg = orig + strconv.Itoa(i) - } - // Install it. - pkgNamesInUse[pkg] = true - if f != nil { - uniquePackageName[f.FileDescriptorProto] = pkg + name := cleanPackageName(pkg) + for i, orig := 1, name; globalPackageNames[name]; i++ { + name = orig + GoPackageName(strconv.Itoa(i)) } - return pkg + globalPackageNames[name] = true + return string(name) } var isGoKeyword = map[string]bool{ @@ -707,97 +585,83 @@ var isGoKeyword = map[string]bool{ "var": true, } +func cleanPackageName(name string) GoPackageName { + name = strings.Map(badToUnderscore, name) + // Identifier must not be keyword: insert _. + if isGoKeyword[name] { + name = "_" + name + } + // Identifier must not begin with digit: insert _. + if r, _ := utf8.DecodeRuneInString(name); unicode.IsDigit(r) { + name = "_" + name + } + return GoPackageName(name) +} + // defaultGoPackage returns the package name to use, // derived from the import path of the package we're building code for. -func (g *Generator) defaultGoPackage() string { +func (g *Generator) defaultGoPackage() GoPackageName { p := g.PackageImportPath if i := strings.LastIndex(p, "/"); i >= 0 { p = p[i+1:] } - if p == "" { - return "" - } - - p = strings.Map(badToUnderscore, p) - // Identifier must not be keyword: insert _. - if isGoKeyword[p] { - p = "_" + p - } - // Identifier must not begin with digit: insert _. - if r, _ := utf8.DecodeRuneInString(p); unicode.IsDigit(r) { - p = "_" + p - } - return p + return cleanPackageName(p) } // SetPackageNames sets the package name for this run. // The package name must agree across all files being generated. // It also defines unique package names for all imported files. func (g *Generator) SetPackageNames() { - // Register the name for this package. It will be the first name - // registered so is guaranteed to be unmodified. - pkg, explicit := g.genFiles[0].goPackageName() + g.outputImportPath = g.genFiles[0].importPath - // Check all files for an explicit go_package option. + defaultPackageNames := make(map[GoImportPath]GoPackageName) for _, f := range g.genFiles { - thisPkg, thisExplicit := f.goPackageName() - if thisExplicit { - if !explicit { - // Let this file's go_package option serve for all input files. - pkg, explicit = thisPkg, true - } else if thisPkg != pkg { - g.Fail("inconsistent package names:", thisPkg, pkg) - } + if _, p, ok := f.goPackageOption(); ok { + defaultPackageNames[f.importPath] = p } } - - // If we don't have an explicit go_package option but we have an - // import path, use that. - if !explicit { - p := g.defaultGoPackage() - if p != "" { - pkg, explicit = p, true + for _, f := range g.genFiles { + if _, p, ok := f.goPackageOption(); ok { + // Source file: option go_package = "quux/bar"; + f.packageName = p + } else if p, ok := defaultPackageNames[f.importPath]; ok { + // A go_package option in another file in the same package. + // + // This is a poor choice in general, since every source file should + // contain a go_package option. Supported mainly for historical + // compatibility. + f.packageName = p + } else if p := g.defaultGoPackage(); p != "" { + // Command-line: import_path=quux/bar. + // + // The import_path flag sets a package name for files which don't + // contain a go_package option. + f.packageName = p + } else if p := f.GetPackage(); p != "" { + // Source file: package quux.bar; + f.packageName = cleanPackageName(p) + } else { + // Source filename. + f.packageName = cleanPackageName(baseName(f.GetName())) } } - // If there was no go_package and no import path to use, - // double-check that all the inputs have the same implicit - // Go package name. - if !explicit { - for _, f := range g.genFiles { - thisPkg, _ := f.goPackageName() - if thisPkg != pkg { - g.Fail("inconsistent package names:", thisPkg, pkg) - } + // Check that all files have a consistent package name and import path. + for _, f := range g.genFiles[1:] { + if a, b := g.genFiles[0].importPath, f.importPath; a != b { + g.Fail(fmt.Sprintf("inconsistent package import paths: %v, %v", a, b)) + } + if a, b := g.genFiles[0].packageName, f.packageName; a != b { + g.Fail(fmt.Sprintf("inconsistent package names: %v, %v", a, b)) } } - g.packageName = RegisterUniquePackageName(pkg, g.genFiles[0]) - - // Register the support package names. They might collide with the - // name of a package we import. + // Names of support packages. These never vary (if there are conflicts, + // we rename the conflicting package), so this could be removed someday. g.Pkg = map[string]string{ - "fmt": RegisterUniquePackageName("fmt", nil), - "math": RegisterUniquePackageName("math", nil), - "proto": RegisterUniquePackageName("proto", nil), - } - -AllFiles: - for _, f := range g.allFiles { - for _, genf := range g.genFiles { - if f == genf { - // In this package already. - uniquePackageName[f.FileDescriptorProto] = g.packageName - continue AllFiles - } - } - // The file is a dependency, so we want to ignore its go_package option - // because that is only relevant for its specific generated output. - pkg := f.GetPackage() - if pkg == "" { - pkg = baseName(*f.Name) - } - RegisterUniquePackageName(pkg, f) + "fmt": "fmt", + "math": "math", + "proto": "proto", } } @@ -807,27 +671,51 @@ AllFiles: func (g *Generator) WrapTypes() { g.allFiles = make([]*FileDescriptor, 0, len(g.Request.ProtoFile)) g.allFilesByName = make(map[string]*FileDescriptor, len(g.allFiles)) + genFileNames := make(map[string]bool) + for _, n := range g.Request.FileToGenerate { + genFileNames[n] = true + } for _, f := range g.Request.ProtoFile { - // We must wrap the descriptors before we wrap the enums - descs := wrapDescriptors(f) - g.buildNestedDescriptors(descs) - enums := wrapEnumDescriptors(f, descs) - g.buildNestedEnums(descs, enums) - exts := wrapExtensions(f) fd := &FileDescriptor{ FileDescriptorProto: f, - desc: descs, - enum: enums, - ext: exts, exported: make(map[Object][]symbol), proto3: fileIsProto3(f), } + // The import path may be set in a number of ways. + if substitution, ok := g.ImportMap[f.GetName()]; ok { + // Command-line: M=foo.proto=quux/bar. + // + // Explicit mapping of source file to import path. + fd.importPath = GoImportPath(substitution) + } else if genFileNames[f.GetName()] && g.PackageImportPath != "" { + // Command-line: import_path=quux/bar. + // + // The import_path flag sets the import path for every file that + // we generate code for. + fd.importPath = GoImportPath(g.PackageImportPath) + } else if p, _, _ := fd.goPackageOption(); p != "" { + // Source file: option go_package = "quux/bar"; + // + // The go_package option sets the import path. Most users should use this. + fd.importPath = p + } else { + // Source filename. + // + // Last resort when nothing else is available. + fd.importPath = GoImportPath(path.Dir(f.GetName())) + } + // We must wrap the descriptors before we wrap the enums + fd.desc = wrapDescriptors(fd) + g.buildNestedDescriptors(fd.desc) + fd.enum = wrapEnumDescriptors(fd, fd.desc) + g.buildNestedEnums(fd.desc, fd.enum) + fd.ext = wrapExtensions(fd) extractComments(fd) g.allFiles = append(g.allFiles, fd) g.allFilesByName[f.GetName()] = fd } for _, fd := range g.allFiles { - fd.imp = wrapImported(fd.FileDescriptorProto, g) + fd.imp = wrapImported(fd, g) } g.genFiles = make([]*FileDescriptor, 0, len(g.Request.FileToGenerate)) @@ -836,11 +724,27 @@ func (g *Generator) WrapTypes() { if fd == nil { g.Fail("could not find file named", fileName) } - fd.index = len(g.genFiles) + fingerprint, err := fingerprintProto(fd.FileDescriptorProto) + if err != nil { + g.Error(err) + } + fd.fingerprint = fingerprint g.genFiles = append(g.genFiles, fd) } } +// fingerprintProto returns a fingerprint for a message. +// The fingerprint is intended to prevent conflicts between generated fileds, +// not to provide cryptographic security. +func fingerprintProto(m proto.Message) (string, error) { + b, err := proto.Marshal(m) + if err != nil { + return "", err + } + h := sha256.Sum256(b) + return hex.EncodeToString(h[:8]), nil +} + // Scan the descriptors in this file. For each one, build the slice of nested descriptors func (g *Generator) buildNestedDescriptors(descs []*Descriptor) { for _, desc := range descs { @@ -873,7 +777,7 @@ func (g *Generator) buildNestedEnums(descs []*Descriptor, enums []*EnumDescripto } // Construct the Descriptor -func newDescriptor(desc *descriptor.DescriptorProto, parent *Descriptor, file *descriptor.FileDescriptorProto, index int) *Descriptor { +func newDescriptor(desc *descriptor.DescriptorProto, parent *Descriptor, file *FileDescriptor, index int) *Descriptor { d := &Descriptor{ common: common{file}, DescriptorProto: desc, @@ -910,7 +814,7 @@ func newDescriptor(desc *descriptor.DescriptorProto, parent *Descriptor, file *d } // Return a slice of all the Descriptors defined within this file -func wrapDescriptors(file *descriptor.FileDescriptorProto) []*Descriptor { +func wrapDescriptors(file *FileDescriptor) []*Descriptor { sl := make([]*Descriptor, 0, len(file.MessageType)+10) for i, desc := range file.MessageType { sl = wrapThisDescriptor(sl, desc, nil, file, i) @@ -919,7 +823,7 @@ func wrapDescriptors(file *descriptor.FileDescriptorProto) []*Descriptor { } // Wrap this Descriptor, recursively -func wrapThisDescriptor(sl []*Descriptor, desc *descriptor.DescriptorProto, parent *Descriptor, file *descriptor.FileDescriptorProto, index int) []*Descriptor { +func wrapThisDescriptor(sl []*Descriptor, desc *descriptor.DescriptorProto, parent *Descriptor, file *FileDescriptor, index int) []*Descriptor { sl = append(sl, newDescriptor(desc, parent, file, index)) me := sl[len(sl)-1] for i, nested := range desc.NestedType { @@ -929,7 +833,7 @@ func wrapThisDescriptor(sl []*Descriptor, desc *descriptor.DescriptorProto, pare } // Construct the EnumDescriptor -func newEnumDescriptor(desc *descriptor.EnumDescriptorProto, parent *Descriptor, file *descriptor.FileDescriptorProto, index int) *EnumDescriptor { +func newEnumDescriptor(desc *descriptor.EnumDescriptorProto, parent *Descriptor, file *FileDescriptor, index int) *EnumDescriptor { ed := &EnumDescriptor{ common: common{file}, EnumDescriptorProto: desc, @@ -945,7 +849,7 @@ func newEnumDescriptor(desc *descriptor.EnumDescriptorProto, parent *Descriptor, } // Return a slice of all the EnumDescriptors defined within this file -func wrapEnumDescriptors(file *descriptor.FileDescriptorProto, descs []*Descriptor) []*EnumDescriptor { +func wrapEnumDescriptors(file *FileDescriptor, descs []*Descriptor) []*EnumDescriptor { sl := make([]*EnumDescriptor, 0, len(file.EnumType)+10) // Top-level enums. for i, enum := range file.EnumType { @@ -961,7 +865,7 @@ func wrapEnumDescriptors(file *descriptor.FileDescriptorProto, descs []*Descript } // Return a slice of all the top-level ExtensionDescriptors defined within this file. -func wrapExtensions(file *descriptor.FileDescriptorProto) []*ExtensionDescriptor { +func wrapExtensions(file *FileDescriptor) []*ExtensionDescriptor { var sl []*ExtensionDescriptor for _, field := range file.Extension { sl = append(sl, &ExtensionDescriptor{common{file}, field, nil}) @@ -970,7 +874,7 @@ func wrapExtensions(file *descriptor.FileDescriptorProto) []*ExtensionDescriptor } // Return a slice of all the types that are publicly imported into this file. -func wrapImported(file *descriptor.FileDescriptorProto, g *Generator) (sl []*ImportedDescriptor) { +func wrapImported(file *FileDescriptor, g *Generator) (sl []*ImportedDescriptor) { for _, index := range file.PublicDependency { df := g.fileByName(file.Dependency[index]) for _, d := range df.desc { @@ -1070,35 +974,84 @@ func (g *Generator) ObjectNamed(typeName string) Object { return o } +// AnnotatedAtoms is a list of atoms (as consumed by P) that records the file name and proto AST path from which they originated. +type AnnotatedAtoms struct { + source string + path string + atoms []interface{} +} + +// Annotate records the file name and proto AST path of a list of atoms +// so that a later call to P can emit a link from each atom to its origin. +func Annotate(file *FileDescriptor, path string, atoms ...interface{}) *AnnotatedAtoms { + return &AnnotatedAtoms{source: *file.Name, path: path, atoms: atoms} +} + +// printAtom prints the (atomic, non-annotation) argument to the generated output. +func (g *Generator) printAtom(v interface{}) { + switch v := v.(type) { + case string: + g.WriteString(v) + case *string: + g.WriteString(*v) + case bool: + fmt.Fprint(g, v) + case *bool: + fmt.Fprint(g, *v) + case int: + fmt.Fprint(g, v) + case *int32: + fmt.Fprint(g, *v) + case *int64: + fmt.Fprint(g, *v) + case float64: + fmt.Fprint(g, v) + case *float64: + fmt.Fprint(g, *v) + case GoPackageName: + g.WriteString(string(v)) + case GoImportPath: + g.WriteString(strconv.Quote(string(v))) + default: + g.Fail(fmt.Sprintf("unknown type in printer: %T", v)) + } +} + // P prints the arguments to the generated output. It handles strings and int32s, plus -// handling indirections because they may be *string, etc. +// handling indirections because they may be *string, etc. Any inputs of type AnnotatedAtoms may emit +// annotations in a .meta file in addition to outputting the atoms themselves (if g.annotateCode +// is true). func (g *Generator) P(str ...interface{}) { if !g.writeOutput { return } g.WriteString(g.indent) for _, v := range str { - switch s := v.(type) { - case string: - g.WriteString(s) - case *string: - g.WriteString(*s) - case bool: - fmt.Fprintf(g, "%t", s) - case *bool: - fmt.Fprintf(g, "%t", *s) - case int: - fmt.Fprintf(g, "%d", s) - case *int32: - fmt.Fprintf(g, "%d", *s) - case *int64: - fmt.Fprintf(g, "%d", *s) - case float64: - fmt.Fprintf(g, "%g", s) - case *float64: - fmt.Fprintf(g, "%g", *s) + switch v := v.(type) { + case *AnnotatedAtoms: + begin := int32(g.Len()) + for _, v := range v.atoms { + g.printAtom(v) + } + if g.annotateCode { + end := int32(g.Len()) + var path []int32 + for _, token := range strings.Split(v.path, ",") { + val, err := strconv.ParseInt(token, 10, 32) + if err != nil { + g.Fail("could not parse proto AST path: ", err.Error()) + } + path = append(path, int32(val)) + } + g.annotations = append(g.annotations, &descriptor.GeneratedCodeInfo_Annotation{ + Path: path, + SourceFile: &v.source, + Begin: &begin, + End: &end, + }) + } default: - g.Fail(fmt.Sprintf("unknown type in printer: %T", v)) + g.printAtom(v) } } g.WriteByte('\n') @@ -1135,15 +1088,25 @@ func (g *Generator) GenerateAllFiles() { } for _, file := range g.allFiles { g.Reset() + g.annotations = nil g.writeOutput = genFileMap[file] g.generate(file) if !g.writeOutput { continue } + fname := file.goFileName(g.pathType) g.Response.File = append(g.Response.File, &plugin.CodeGeneratorResponse_File{ - Name: proto.String(file.goFileName()), + Name: proto.String(fname), Content: proto.String(g.String()), }) + if g.annotateCode { + // Store the generated code annotations in text, as the protoc plugin protocol requires that + // strings contain valid UTF-8. + g.Response.File = append(g.Response.File, &plugin.CodeGeneratorResponse_File{ + Name: proto.String(file.goFileName(g.pathType) + ".meta"), + Content: proto.String(proto.CompactTextString(&descriptor.GeneratedCodeInfo{Annotation: g.annotations})), + }) + } } } @@ -1154,32 +1117,24 @@ func (g *Generator) runPlugins(file *FileDescriptor) { } } -// FileOf return the FileDescriptor for this FileDescriptorProto. -func (g *Generator) FileOf(fd *descriptor.FileDescriptorProto) *FileDescriptor { - for _, file := range g.allFiles { - if file.FileDescriptorProto == fd { - return file - } - } - g.Fail("could not find file in table:", fd.GetName()) - return nil -} - // Fill the response protocol buffer with the generated output for all the files we're // supposed to generate. func (g *Generator) generate(file *FileDescriptor) { - g.file = g.FileOf(file.FileDescriptorProto) - g.usedPackages = make(map[string]bool) - - if g.file.index == 0 { - // For one file in the package, assert version compatibility. - g.P("// This is a compile-time assertion to ensure that this generated file") - g.P("// is compatible with the proto package it is being compiled against.") - g.P("// A compilation error at this line likely means your copy of the") - g.P("// proto package needs to be updated.") - g.P("const _ = ", g.Pkg["proto"], ".ProtoPackageIsVersion", generatedCodeVersion, " // please upgrade the proto package") - g.P() - } + g.file = file + g.usedPackages = make(map[GoImportPath]bool) + g.packageNames = make(map[GoImportPath]GoPackageName) + g.usedPackageNames = make(map[GoPackageName]bool) + for name := range globalPackageNames { + g.usedPackageNames[name] = true + } + + g.P("// This is a compile-time assertion to ensure that this generated file") + g.P("// is compatible with the proto package it is being compiled against.") + g.P("// A compilation error at this line likely means your copy of the") + g.P("// proto package needs to be updated.") + g.P("const _ = ", g.Pkg["proto"], ".ProtoPackageIsVersion", generatedCodeVersion, " // please upgrade the proto package") + g.P() + for _, td := range g.file.imp { g.generateImported(td) } @@ -1205,24 +1160,36 @@ func (g *Generator) generate(file *FileDescriptor) { // Generate header and imports last, though they appear first in the output. rem := g.Buffer + remAnno := g.annotations g.Buffer = new(bytes.Buffer) + g.annotations = nil g.generateHeader() g.generateImports() if !g.writeOutput { return } + // Adjust the offsets for annotations displaced by the header and imports. + for _, anno := range remAnno { + *anno.Begin += int32(g.Len()) + *anno.End += int32(g.Len()) + g.annotations = append(g.annotations, anno) + } g.Write(rem.Bytes()) - // Reformat generated code. + // Reformat generated code and patch annotation locations. fset := token.NewFileSet() - raw := g.Bytes() - ast, err := parser.ParseFile(fset, "", g, parser.ParseComments) + original := g.Bytes() + if g.annotateCode { + // make a copy independent of g; we'll need it after Reset. + original = append([]byte(nil), original...) + } + ast, err := parser.ParseFile(fset, "", original, parser.ParseComments) if err != nil { // Print out the bad code with line numbers. // This should never happen in practice, but it can while changing generated code, // so consider this a debugging aid. var src bytes.Buffer - s := bufio.NewScanner(bytes.NewReader(raw)) + s := bufio.NewScanner(bytes.NewReader(original)) for line := 1; s.Scan(); line++ { fmt.Fprintf(&src, "%5d\t%s\n", line, s.Bytes()) } @@ -1233,55 +1200,59 @@ func (g *Generator) generate(file *FileDescriptor) { if err != nil { g.Fail("generated Go source code could not be reformatted:", err.Error()) } + if g.annotateCode { + m, err := remap.Compute(original, g.Bytes()) + if err != nil { + g.Fail("formatted generated Go source code could not be mapped back to the original code:", err.Error()) + } + for _, anno := range g.annotations { + new, ok := m.Find(int(*anno.Begin), int(*anno.End)) + if !ok { + g.Fail("span in formatted generated Go source code could not be mapped back to the original code") + } + *anno.Begin = int32(new.Pos) + *anno.End = int32(new.End) + } + } } // Generate the header, including package definition func (g *Generator) generateHeader() { g.P("// Code generated by protoc-gen-go. DO NOT EDIT.") - g.P("// source: ", g.file.Name) + if g.file.GetOptions().GetDeprecated() { + g.P("// ", g.file.Name, " is a deprecated file.") + } else { + g.P("// source: ", g.file.Name) + } g.P() - name := g.file.PackageName() + importPath, _, _ := g.file.goPackageOption() + if importPath == "" { + g.P("package ", g.file.packageName) + } else { + g.P("package ", g.file.packageName, " // import ", GoImportPath(g.ImportPrefix)+importPath) + } + g.P() - if g.file.index == 0 { - // Generate package docs for the first file in the package. + if loc, ok := g.file.comments[strconv.Itoa(packagePath)]; ok { g.P("/*") - g.P("Package ", name, " is a generated protocol buffer package.") - g.P() - if loc, ok := g.file.comments[strconv.Itoa(packagePath)]; ok { - // not using g.PrintComments because this is a /* */ comment block. - text := strings.TrimSuffix(loc.GetLeadingComments(), "\n") - for _, line := range strings.Split(text, "\n") { - line = strings.TrimPrefix(line, " ") - // ensure we don't escape from the block comment - line = strings.Replace(line, "*/", "* /", -1) - g.P(line) - } - g.P() - } - var topMsgs []string - g.P("It is generated from these files:") - for _, f := range g.genFiles { - g.P("\t", f.Name) - for _, msg := range f.desc { - if msg.parent != nil { - continue - } - topMsgs = append(topMsgs, CamelCaseSlice(msg.TypeName())) - } - } - g.P() - g.P("It has these top-level messages:") - for _, msg := range topMsgs { - g.P("\t", msg) + // not using g.PrintComments because this is a /* */ comment block. + text := strings.TrimSuffix(loc.GetLeadingComments(), "\n") + for _, line := range strings.Split(text, "\n") { + line = strings.TrimPrefix(line, " ") + // ensure we don't escape from the block comment + line = strings.Replace(line, "*/", "* /", -1) + g.P(line) } g.P("*/") + g.P() } - - g.P("package ", name) - g.P() } +// deprecationComment is the standard comment added to deprecated +// messages, fields, enums, and enum values. +var deprecationComment = "// Deprecated: Do not use." + // PrintComments prints any comments from the source .proto file. // The path is a comma-separated list of integers. // It returns an indication of whether any comments were printed. @@ -1319,35 +1290,46 @@ func (g *Generator) generateImports() { // We almost always need a proto import. Rather than computing when we // do, which is tricky when there's a plugin, just import it and // reference it later. The same argument applies to the fmt and math packages. - g.P("import " + g.Pkg["proto"] + " " + strconv.Quote(g.ImportPrefix+"github.com/golang/protobuf/proto")) + g.P("import "+g.Pkg["proto"]+" ", GoImportPath(g.ImportPrefix)+"github.com/golang/protobuf/proto") g.P("import " + g.Pkg["fmt"] + ` "fmt"`) g.P("import " + g.Pkg["math"] + ` "math"`) + var ( + imports = make(map[GoImportPath]bool) + strongImports = make(map[GoImportPath]bool) + importPaths []string + ) for i, s := range g.file.Dependency { fd := g.fileByName(s) + importPath := fd.importPath // Do not import our own package. - if fd.PackageName() == g.packageName { + if importPath == g.file.importPath { continue } - filename := fd.goFileName() - // By default, import path is the dirname of the Go filename. - importPath := path.Dir(filename) - if substitution, ok := g.ImportMap[s]; ok { - importPath = substitution + if !imports[importPath] { + importPaths = append(importPaths, string(importPath)) + } + imports[importPath] = true + if !g.weak(int32(i)) { + strongImports[importPath] = true } - importPath = g.ImportPrefix + importPath + } + sort.Strings(importPaths) + for i := range importPaths { + importPath := GoImportPath(importPaths[i]) + packageName := g.GoPackageName(importPath) + fullPath := GoImportPath(g.ImportPrefix) + importPath // Skip weak imports. - if g.weak(int32(i)) { - g.P("// skipping weak import ", fd.PackageName(), " ", strconv.Quote(importPath)) + if !strongImports[importPath] { + g.P("// skipping weak import ", packageName, " ", fullPath) continue } // We need to import all the dependencies, even if we don't reference them, // because other code and tools depend on having the full transitive closure // of protocol buffer types in the binary. - pname := fd.PackageName() - if _, ok := g.usedPackages[pname]; !ok { - pname = "_" + if _, ok := g.usedPackages[importPath]; !ok { + packageName = "_" } - g.P("import ", pname, " ", strconv.Quote(importPath)) + g.P("import ", packageName, " ", fullPath) } g.P() // TODO: may need to worry about uniqueness across plugins @@ -1363,26 +1345,24 @@ func (g *Generator) generateImports() { } func (g *Generator) generateImported(id *ImportedDescriptor) { - // Don't generate public import symbols for files that we are generating - // code for, since those symbols will already be in this package. - // We can't simply avoid creating the ImportedDescriptor objects, - // because g.genFiles isn't populated at that stage. tn := id.TypeName() sn := tn[len(tn)-1] - df := g.FileOf(id.o.File()) + df := id.o.File() filename := *df.Name - for _, fd := range g.genFiles { - if *fd.Name == filename { - g.P("// Ignoring public import of ", sn, " from ", filename) - g.P() - return - } + if df.importPath == g.file.importPath { + // Don't generate type aliases for files in the same Go package as this one. + g.P("// Ignoring public import of ", sn, " from ", filename) + g.P() + return + } + if !supportTypeAliases { + g.Fail(fmt.Sprintf("%s: public imports require at least go1.9", filename)) } g.P("// ", sn, " from public import ", filename) - g.usedPackages[df.PackageName()] = true + g.usedPackages[df.importPath] = true for _, sym := range df.exported[id.o] { - sym.GenerateAlias(g, df.PackageName()) + sym.GenerateAlias(g, g.GoPackageName(df.importPath)) } g.P() @@ -1396,16 +1376,26 @@ func (g *Generator) generateEnum(enum *EnumDescriptor) { ccTypeName := CamelCaseSlice(typeName) ccPrefix := enum.prefix() + deprecatedEnum := "" + if enum.GetOptions().GetDeprecated() { + deprecatedEnum = deprecationComment + } g.PrintComments(enum.path) - g.P("type ", ccTypeName, " int32") + g.P("type ", Annotate(enum.file, enum.path, ccTypeName), " int32", deprecatedEnum) g.file.addExport(enum, enumSymbol{ccTypeName, enum.proto3()}) g.P("const (") g.In() for i, e := range enum.Value { - g.PrintComments(fmt.Sprintf("%s,%d,%d", enum.path, enumValuePath, i)) + etorPath := fmt.Sprintf("%s,%d,%d", enum.path, enumValuePath, i) + g.PrintComments(etorPath) + + deprecatedValue := "" + if e.GetOptions().GetDeprecated() { + deprecatedValue = deprecationComment + } name := ccPrefix + *e.Name - g.P(name, " ", ccTypeName, " = ", e.Number) + g.P(Annotate(enum.file, etorPath, name), " ", ccTypeName, " = ", e.Number, " ", deprecatedValue) g.file.addExport(enum, constOrVarSymbol{name, "const", ccTypeName}) } g.Out() @@ -1468,7 +1458,11 @@ func (g *Generator) generateEnum(enum *EnumDescriptor) { indexes = append([]string{strconv.Itoa(m.index)}, indexes...) } indexes = append(indexes, strconv.Itoa(enum.index)) - g.P("func (", ccTypeName, ") EnumDescriptor() ([]byte, []int) { return ", g.file.VarName(), ", []int{", strings.Join(indexes, ", "), "} }") + g.P("func (", ccTypeName, ") EnumDescriptor() ([]byte, []int) {") + g.In() + g.P("return ", g.file.VarName(), ", []int{", strings.Join(indexes, ", "), "}") + g.Out() + g.P("}") if enum.file.GetPackage() == "google.protobuf" && enum.GetName() == "NullValue" { g.P("func (", ccTypeName, `) XXX_WellKnownType() string { return "`, enum.GetName(), `" }`) } @@ -1535,7 +1529,7 @@ func (g *Generator) goTag(message *Descriptor, field *descriptor.FieldDescriptor } enum := "" if *field.Type == descriptor.FieldDescriptorProto_TYPE_ENUM { - // We avoid using obj.PackageName(), because we want to use the + // We avoid using obj.GoPackageName(), because we want to use the // original (proto-world) package name. obj := g.ObjectNamed(field.GetTypeName()) if id, ok := obj.(*ImportedDescriptor); ok { @@ -1617,12 +1611,6 @@ func (g *Generator) TypeName(obj Object) string { return g.DefaultPackageName(obj) + CamelCaseSlice(obj.TypeName()) } -// TypeNameWithPackage is like TypeName, but always includes the package -// name even if the object is in our own package. -func (g *Generator) TypeNameWithPackage(obj Object) string { - return obj.PackageName() + CamelCaseSlice(obj.TypeName()) -} - // GoType returns a string representing the type name, and the wire type func (g *Generator) GoType(message *Descriptor, field *descriptor.FieldDescriptorProto) (typ string, wire string) { // TODO: Options. @@ -1682,10 +1670,10 @@ func (g *Generator) GoType(message *Descriptor, field *descriptor.FieldDescripto } func (g *Generator) RecordTypeUse(t string) { - if obj, ok := g.typeNameToObject[t]; ok { + if _, ok := g.typeNameToObject[t]; ok { // Call ObjectNamed to get the true object to record the use. - obj = g.ObjectNamed(t) - g.usedPackages[obj.PackageName()] = true + obj := g.ObjectNamed(t) + g.usedPackages[obj.GoImportPath()] = true } } @@ -1746,8 +1734,19 @@ func (g *Generator) generateMessage(message *Descriptor) { oneofTypeName := make(map[*descriptor.FieldDescriptorProto]string) // without star oneofInsertPoints := make(map[int32]int) // oneof_index => offset of g.Buffer - g.PrintComments(message.path) - g.P("type ", ccTypeName, " struct {") + comments := g.PrintComments(message.path) + + // Guarantee deprecation comments appear after user-provided comments. + if message.GetOptions().GetDeprecated() { + if comments { + // Convention: Separate deprecation comments from original + // comments with an empty line. + g.P("//") + } + g.P(deprecationComment) + } + + g.P("type ", Annotate(message.file, message.path, ccTypeName), " struct {") g.In() // allocNames finds a conflict-free variation of the given strings, @@ -1794,7 +1793,8 @@ func (g *Generator) generateMessage(message *Descriptor) { // This is the first field of a oneof we haven't seen before. // Generate the union field. - com := g.PrintComments(fmt.Sprintf("%s,%d,%d", message.path, messageOneofPath, *field.OneofIndex)) + oneofFullPath := fmt.Sprintf("%s,%d,%d", message.path, messageOneofPath, *field.OneofIndex) + com := g.PrintComments(oneofFullPath) if com { g.P("//") } @@ -1807,7 +1807,7 @@ func (g *Generator) generateMessage(message *Descriptor) { oneofFieldName[*field.OneofIndex] = fname oneofDisc[*field.OneofIndex] = dname tag := `protobuf_oneof:"` + odp.GetName() + `"` - g.P(fname, " ", dname, " `", tag, "`") + g.P(Annotate(message.file, oneofFullPath, fname), " ", dname, " `", tag, "`") } if *field.Type == descriptor.FieldDescriptorProto_TYPE_MESSAGE { @@ -1871,16 +1871,26 @@ func (g *Generator) generateMessage(message *Descriptor) { continue } - g.PrintComments(fmt.Sprintf("%s,%d,%d", message.path, messageFieldPath, i)) - g.P(fieldName, "\t", typename, "\t`", tag, "`") + fieldDeprecated := "" + if field.GetOptions().GetDeprecated() { + fieldDeprecated = deprecationComment + } + + fieldFullPath := fmt.Sprintf("%s,%d,%d", message.path, messageFieldPath, i) + g.PrintComments(fieldFullPath) + g.P(Annotate(message.file, fieldFullPath, fieldName), "\t", typename, "\t`", tag, "`", fieldDeprecated) g.RecordTypeUse(field.GetTypeName()) } + g.P("XXX_NoUnkeyedLiteral\tstruct{} `json:\"-\"`") // prevent unkeyed struct literals if len(message.ExtensionRange) > 0 { - g.P(g.Pkg["proto"], ".XXX_InternalExtensions `json:\"-\"`") - } - if !message.proto3() { - g.P("XXX_unrecognized\t[]byte `json:\"-\"`") + messageset := "" + if opts := message.Options; opts != nil && opts.GetMessageSetWireFormat() { + messageset = "protobuf_messageset:\"1\" " + } + g.P(g.Pkg["proto"], ".XXX_InternalExtensions `", messageset, "json:\"-\"`") } + g.P("XXX_unrecognized\t[]byte `json:\"-\"`") + g.P("XXX_sizecache\tint32 `json:\"-\"`") g.Out() g.P("}") @@ -1892,12 +1902,25 @@ func (g *Generator) generateMessage(message *Descriptor) { all := g.Buffer.Bytes() rem := all[ip:] g.Buffer = bytes.NewBuffer(all[:ip:ip]) // set cap so we don't scribble on rem + oldLen := g.Buffer.Len() for _, field := range message.Field { if field.OneofIndex == nil || *field.OneofIndex != oi { continue } g.P("//\t*", oneofTypeName[field]) } + // If we've inserted text, we also need to fix up affected annotations (as + // they contain offsets that may need to be changed). + offset := int32(g.Buffer.Len() - oldLen) + ip32 := int32(ip) + for _, anno := range g.annotations { + if *anno.Begin >= ip32 { + *anno.Begin += offset + } + if *anno.End >= ip32 { + *anno.End += offset + } + } g.Buffer.Write(rem) } @@ -1909,7 +1932,11 @@ func (g *Generator) generateMessage(message *Descriptor) { for m := message; m != nil; m = m.parent { indexes = append([]string{strconv.Itoa(m.index)}, indexes...) } - g.P("func (*", ccTypeName, ") Descriptor() ([]byte, []int) { return ", g.file.VarName(), ", []int{", strings.Join(indexes, ", "), "} }") + g.P("func (*", ccTypeName, ") Descriptor() ([]byte, []int) {") + g.In() + g.P("return ", g.file.VarName(), ", []int{", strings.Join(indexes, ", "), "}") + g.Out() + g.P("}") // TODO: Revisit the decision to use a XXX_WellKnownType method // if we change proto.MessageName to work with multiple equivalents. if message.file.GetPackage() == "google.protobuf" && wellKnownTypes[message.GetName()] { @@ -1924,16 +1951,6 @@ func (g *Generator) generateMessage(message *Descriptor) { if opts := message.Options; opts != nil && opts.GetMessageSetWireFormat() { isMessageSet = true g.P() - g.P("func (m *", ccTypeName, ") Marshal() ([]byte, error) {") - g.In() - g.P("return ", g.Pkg["proto"], ".MarshalMessageSet(&m.XXX_InternalExtensions)") - g.Out() - g.P("}") - g.P("func (m *", ccTypeName, ") Unmarshal(buf []byte) error {") - g.In() - g.P("return ", g.Pkg["proto"], ".UnmarshalMessageSet(buf, &m.XXX_InternalExtensions)") - g.Out() - g.P("}") g.P("func (m *", ccTypeName, ") MarshalJSON() ([]byte, error) {") g.In() g.P("return ", g.Pkg["proto"], ".MarshalMessageSetJSON(&m.XXX_InternalExtensions)") @@ -1944,9 +1961,6 @@ func (g *Generator) generateMessage(message *Descriptor) { g.P("return ", g.Pkg["proto"], ".UnmarshalMessageSetJSON(buf, &m.XXX_InternalExtensions)") g.Out() g.P("}") - g.P("// ensure ", ccTypeName, " satisfies proto.Marshaler and proto.Unmarshaler") - g.P("var _ ", g.Pkg["proto"], ".Marshaler = (*", ccTypeName, ")(nil)") - g.P("var _ ", g.Pkg["proto"], ".Unmarshaler = (*", ccTypeName, ")(nil)") } g.P() @@ -1954,7 +1968,7 @@ func (g *Generator) generateMessage(message *Descriptor) { g.In() for _, r := range message.ExtensionRange { end := fmt.Sprint(*r.End - 1) // make range inclusive on both ends - g.P("{", r.Start, ", ", end, "},") + g.P("{Start: ", r.Start, ", End: ", end, "},") } g.Out() g.P("}") @@ -1965,6 +1979,45 @@ func (g *Generator) generateMessage(message *Descriptor) { g.P("}") } + // TODO: It does not scale to keep adding another method for every + // operation on protos that we want to switch over to using the + // table-driven approach. Instead, we should only add a single method + // that allows getting access to the *InternalMessageInfo struct and then + // calling Unmarshal, Marshal, Merge, Size, and Discard directly on that. + + // Wrapper for table-driven marshaling and unmarshaling. + g.P("func (m *", ccTypeName, ") XXX_Unmarshal(b []byte) error {") + g.In() + g.P("return xxx_messageInfo_", ccTypeName, ".Unmarshal(m, b)") + g.Out() + g.P("}") + + g.P("func (m *", ccTypeName, ") XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {") + g.In() + g.P("return xxx_messageInfo_", ccTypeName, ".Marshal(b, m, deterministic)") + g.Out() + g.P("}") + + g.P("func (dst *", ccTypeName, ") XXX_Merge(src ", g.Pkg["proto"], ".Message) {") + g.In() + g.P("xxx_messageInfo_", ccTypeName, ".Merge(dst, src)") + g.Out() + g.P("}") + + g.P("func (m *", ccTypeName, ") XXX_Size() int {") // avoid name clash with "Size" field in some message + g.In() + g.P("return xxx_messageInfo_", ccTypeName, ".Size(m)") + g.Out() + g.P("}") + + g.P("func (m *", ccTypeName, ") XXX_DiscardUnknown() {") + g.In() + g.P("xxx_messageInfo_", ccTypeName, ".DiscardUnknown(m)") + g.Out() + g.P("}") + + g.P("var xxx_messageInfo_", ccTypeName, " ", g.Pkg["proto"], ".InternalMessageInfo") + // Default constants defNames := make(map[*descriptor.FieldDescriptorProto]string) for _, field := range message.Field { @@ -2029,17 +2082,24 @@ func (g *Generator) generateMessage(message *Descriptor) { // TODO: Revisit this and consider reverting back to anonymous interfaces. for oi := range message.OneofDecl { dname := oneofDisc[int32(oi)] - g.P("type ", dname, " interface { ", dname, "() }") + g.P("type ", dname, " interface {") + g.In() + g.P(dname, "()") + g.Out() + g.P("}") } g.P() - for _, field := range message.Field { + var oneofTypes []string + for i, field := range message.Field { if field.OneofIndex == nil { continue } _, wiretype := g.GoType(message, field) tag := "protobuf:" + g.goTag(message, field, wiretype) - g.P("type ", oneofTypeName[field], " struct{ ", fieldNames[field], " ", fieldTypes[field], " `", tag, "` }") + fieldFullPath := fmt.Sprintf("%s,%d,%d", message.path, messageFieldPath, i) + g.P("type ", Annotate(message.file, fieldFullPath, oneofTypeName[field]), " struct{ ", Annotate(message.file, fieldFullPath, fieldNames[field]), " ", fieldTypes[field], " `", tag, "` }") g.RecordTypeUse(field.GetTypeName()) + oneofTypes = append(oneofTypes, oneofTypeName[field]) } g.P() for _, field := range message.Field { @@ -2051,7 +2111,8 @@ func (g *Generator) generateMessage(message *Descriptor) { g.P() for oi := range message.OneofDecl { fname := oneofFieldName[int32(oi)] - g.P("func (m *", ccTypeName, ") Get", fname, "() ", oneofDisc[int32(oi)], " {") + oneofFullPath := fmt.Sprintf("%s,%d,%d", message.path, messageOneofPath, oi) + g.P("func (m *", ccTypeName, ") ", Annotate(message.file, oneofFullPath, "Get"+fname), "() ", oneofDisc[int32(oi)], " {") g.P("if m != nil { return m.", fname, " }") g.P("return nil") g.P("}") @@ -2059,8 +2120,7 @@ func (g *Generator) generateMessage(message *Descriptor) { g.P() // Field getters - var getters []getterSymbol - for _, field := range message.Field { + for i, field := range message.Field { oneof := field.OneofIndex != nil fname := fieldNames[field] @@ -2074,38 +2134,13 @@ func (g *Generator) generateMessage(message *Descriptor) { typename = typename[1:] star = "*" } + fieldFullPath := fmt.Sprintf("%s,%d,%d", message.path, messageFieldPath, i) - // Only export getter symbols for basic types, - // and for messages and enums in the same package. - // Groups are not exported. - // Foreign types can't be hoisted through a public import because - // the importer may not already be importing the defining .proto. - // As an example, imagine we have an import tree like this: - // A.proto -> B.proto -> C.proto - // If A publicly imports B, we need to generate the getters from B in A's output, - // but if one such getter returns something from C then we cannot do that - // because A is not importing C already. - var getter, genType bool - switch *field.Type { - case descriptor.FieldDescriptorProto_TYPE_GROUP: - getter = false - case descriptor.FieldDescriptorProto_TYPE_MESSAGE, descriptor.FieldDescriptorProto_TYPE_ENUM: - // Only export getter if its return type is in this package. - getter = g.ObjectNamed(field.GetTypeName()).PackageName() == message.PackageName() - genType = true - default: - getter = true - } - if getter { - getters = append(getters, getterSymbol{ - name: mname, - typ: typename, - typeName: field.GetTypeName(), - genType: genType, - }) + if field.GetOptions().GetDeprecated() { + g.P(deprecationComment) } - g.P("func (m *", ccTypeName, ") "+mname+"() "+typename+" {") + g.P("func (m *", ccTypeName, ") ", Annotate(message.file, fieldFullPath, mname), "() "+typename+" {") g.In() def, hasDef := defNames[field] typeDefaultIsNil := false // whether this field type's default value is a literal nil unless specified @@ -2203,8 +2238,7 @@ func (g *Generator) generateMessage(message *Descriptor) { sym: ccTypeName, hasExtensions: hasExtensions, isMessageSet: isMessageSet, - hasOneof: len(message.OneofDecl) > 0, - getters: getters, + oneofTypes: oneofTypes, } g.file.addExport(message, ms) } @@ -2424,58 +2458,49 @@ func (g *Generator) generateMessage(message *Descriptor) { } g.P("case *", oneofTypeName[field], ":") val := "x." + fieldNames[field] - var wire, varint, fixed string + var varint, fixed string switch *field.Type { case descriptor.FieldDescriptorProto_TYPE_DOUBLE: - wire = "WireFixed64" fixed = "8" case descriptor.FieldDescriptorProto_TYPE_FLOAT: - wire = "WireFixed32" fixed = "4" case descriptor.FieldDescriptorProto_TYPE_INT64, descriptor.FieldDescriptorProto_TYPE_UINT64, descriptor.FieldDescriptorProto_TYPE_INT32, descriptor.FieldDescriptorProto_TYPE_UINT32, descriptor.FieldDescriptorProto_TYPE_ENUM: - wire = "WireVarint" varint = val case descriptor.FieldDescriptorProto_TYPE_FIXED64, descriptor.FieldDescriptorProto_TYPE_SFIXED64: - wire = "WireFixed64" fixed = "8" case descriptor.FieldDescriptorProto_TYPE_FIXED32, descriptor.FieldDescriptorProto_TYPE_SFIXED32: - wire = "WireFixed32" fixed = "4" case descriptor.FieldDescriptorProto_TYPE_BOOL: - wire = "WireVarint" fixed = "1" case descriptor.FieldDescriptorProto_TYPE_STRING: - wire = "WireBytes" fixed = "len(" + val + ")" varint = fixed case descriptor.FieldDescriptorProto_TYPE_GROUP: - wire = "WireStartGroup" fixed = g.Pkg["proto"] + ".Size(" + val + ")" case descriptor.FieldDescriptorProto_TYPE_MESSAGE: - wire = "WireBytes" g.P("s := ", g.Pkg["proto"], ".Size(", val, ")") fixed = "s" varint = fixed case descriptor.FieldDescriptorProto_TYPE_BYTES: - wire = "WireBytes" fixed = "len(" + val + ")" varint = fixed case descriptor.FieldDescriptorProto_TYPE_SINT32: - wire = "WireVarint" varint = "(uint32(" + val + ") << 1) ^ uint32((int32(" + val + ") >> 31))" case descriptor.FieldDescriptorProto_TYPE_SINT64: - wire = "WireVarint" varint = "uint64(" + val + " << 1) ^ uint64((int64(" + val + ") >> 63))" default: g.Fail("unhandled oneof field type ", field.Type.String()) } - g.P("n += ", g.Pkg["proto"], ".SizeVarint(", field.Number, "<<3|", g.Pkg["proto"], ".", wire, ")") + // Tag and wire varint is known statically, + // so don't generate code for that part of the size computation. + tagAndWireSize := proto.SizeVarint(uint64(*field.Number << 3)) // wire doesn't affect varint size + g.P("n += ", tagAndWireSize, " // tag and wire") if varint != "" { g.P("n += ", g.Pkg["proto"], ".SizeVarint(uint64(", varint, "))") } @@ -2483,7 +2508,7 @@ func (g *Generator) generateMessage(message *Descriptor) { g.P("n += ", fixed) } if *field.Type == descriptor.FieldDescriptorProto_TYPE_GROUP { - g.P("n += ", g.Pkg["proto"], ".SizeVarint(", field.Number, "<<3|", g.Pkg["proto"], ".WireEndGroup)") + g.P("n += ", tagAndWireSize, " // tag and wire") } } g.P("case nil:") @@ -2506,6 +2531,27 @@ func (g *Generator) generateMessage(message *Descriptor) { } g.addInitf("%s.RegisterType((*%s)(nil), %q)", g.Pkg["proto"], ccTypeName, fullName) + // Register types for native map types. + for _, k := range mapFieldKeys(mapFieldTypes) { + fullName := strings.TrimPrefix(*k.TypeName, ".") + g.addInitf("%s.RegisterMapType((%s)(nil), %q)", g.Pkg["proto"], mapFieldTypes[k], fullName) + } +} + +type byTypeName []*descriptor.FieldDescriptorProto + +func (a byTypeName) Len() int { return len(a) } +func (a byTypeName) Swap(i, j int) { a[i], a[j] = a[j], a[i] } +func (a byTypeName) Less(i, j int) bool { return *a[i].TypeName < *a[j].TypeName } + +// mapFieldKeys returns the keys of m in a consistent order. +func mapFieldKeys(m map[*descriptor.FieldDescriptorProto]string) []*descriptor.FieldDescriptorProto { + keys := make([]*descriptor.FieldDescriptorProto, 0, len(m)) + for k := range m { + keys = append(keys, k) + } + sort.Sort(byTypeName(keys)) + return keys } var escapeChars = [256]byte{ @@ -2594,10 +2640,15 @@ func (g *Generator) generateExtension(ext *ExtensionDescriptor) { typeName := ext.TypeName() // Special case for proto2 message sets: If this extension is extending - // proto2_bridge.MessageSet, and its final name component is "message_set_extension", + // proto2.bridge.MessageSet, and its final name component is "message_set_extension", // then drop that last component. + // + // TODO: This should be implemented in the text formatter rather than the generator. + // In addition, the situation for when to apply this special case is implemented + // differently in other languages: + // https://github.com/google/protobuf/blob/aff10976/src/google/protobuf/text_format.cc#L1560 mset := false - if extendedType == "*proto2_bridge.MessageSet" && typeName[len(typeName)-1] == "message_set_extension" { + if extDesc.GetOptions().GetMessageSetWireFormat() && typeName[len(typeName)-1] == "message_set_extension" { typeName = typeName[:len(typeName)-1] mset = true } @@ -2864,3 +2915,14 @@ const ( // tag numbers in EnumDescriptorProto enumValuePath = 2 // value ) + +var supportTypeAliases bool + +func init() { + for _, tag := range build.Default.ReleaseTags { + if tag == "go1.9" { + supportTypeAliases = true + return + } + } +} diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/generator/internal/remap/remap.go b/vendor/github.com/golang/protobuf/protoc-gen-go/generator/internal/remap/remap.go new file mode 100644 index 000000000..a9b61036c --- /dev/null +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/generator/internal/remap/remap.go @@ -0,0 +1,117 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2017 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +/* +Package remap handles tracking the locations of Go tokens in a source text +across a rewrite by the Go formatter. +*/ +package remap + +import ( + "fmt" + "go/scanner" + "go/token" +) + +// A Location represents a span of byte offsets in the source text. +type Location struct { + Pos, End int // End is exclusive +} + +// A Map represents a mapping between token locations in an input source text +// and locations in the correspnding output text. +type Map map[Location]Location + +// Find reports whether the specified span is recorded by m, and if so returns +// the new location it was mapped to. If the input span was not found, the +// returned location is the same as the input. +func (m Map) Find(pos, end int) (Location, bool) { + key := Location{ + Pos: pos, + End: end, + } + if loc, ok := m[key]; ok { + return loc, true + } + return key, false +} + +func (m Map) add(opos, oend, npos, nend int) { + m[Location{Pos: opos, End: oend}] = Location{Pos: npos, End: nend} +} + +// Compute constructs a location mapping from input to output. An error is +// reported if any of the tokens of output cannot be mapped. +func Compute(input, output []byte) (Map, error) { + itok := tokenize(input) + otok := tokenize(output) + if len(itok) != len(otok) { + return nil, fmt.Errorf("wrong number of tokens, %d ≠ %d", len(itok), len(otok)) + } + m := make(Map) + for i, ti := range itok { + to := otok[i] + if ti.Token != to.Token { + return nil, fmt.Errorf("token %d type mismatch: %s ≠ %s", i+1, ti, to) + } + m.add(ti.pos, ti.end, to.pos, to.end) + } + return m, nil +} + +// tokinfo records the span and type of a source token. +type tokinfo struct { + pos, end int + token.Token +} + +func tokenize(src []byte) []tokinfo { + fs := token.NewFileSet() + var s scanner.Scanner + s.Init(fs.AddFile("src", fs.Base(), len(src)), src, nil, scanner.ScanComments) + var info []tokinfo + for { + pos, next, lit := s.Scan() + switch next { + case token.SEMICOLON: + continue + } + info = append(info, tokinfo{ + pos: int(pos - 1), + end: int(pos + token.Pos(len(lit)) - 1), + Token: next, + }) + if next == token.EOF { + break + } + } + return info +} diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/grpc/grpc.go b/vendor/github.com/golang/protobuf/protoc-gen-go/grpc/grpc.go index 2660e47a2..1723680a8 100644 --- a/vendor/github.com/golang/protobuf/protoc-gen-go/grpc/grpc.go +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/grpc/grpc.go @@ -130,19 +130,23 @@ func (g *grpc) GenerateImports(file *generator.FileDescriptor) { return } g.P("import (") - g.P(contextPkg, " ", strconv.Quote(path.Join(g.gen.ImportPrefix, contextPkgPath))) - g.P(grpcPkg, " ", strconv.Quote(path.Join(g.gen.ImportPrefix, grpcPkgPath))) + g.P(contextPkg, " ", generator.GoImportPath(path.Join(string(g.gen.ImportPrefix), contextPkgPath))) + g.P(grpcPkg, " ", generator.GoImportPath(path.Join(string(g.gen.ImportPrefix), grpcPkgPath))) g.P(")") g.P() } // reservedClientName records whether a client name is reserved on the client side. var reservedClientName = map[string]bool{ -// TODO: do we need any in gRPC? + // TODO: do we need any in gRPC? } func unexport(s string) string { return strings.ToLower(s[:1]) + s[1:] } +// deprecationComment is the standard comment added to deprecated +// messages, fields, enums, and enum values. +var deprecationComment = "// Deprecated: Do not use." + // generateService generates all the code for the named service. func (g *grpc) generateService(file *generator.FileDescriptor, service *pb.ServiceDescriptorProto, index int) { path := fmt.Sprintf("6,%d", index) // 6 means service. @@ -153,12 +157,16 @@ func (g *grpc) generateService(file *generator.FileDescriptor, service *pb.Servi fullServName = pkg + "." + fullServName } servName := generator.CamelCase(origServName) + deprecated := service.GetOptions().GetDeprecated() g.P() g.P("// Client API for ", servName, " service") g.P() // Client interface. + if deprecated { + g.P(deprecationComment) + } g.P("type ", servName, "Client interface {") for i, method := range service.Method { g.gen.PrintComments(fmt.Sprintf("%s,2,%d", path, i)) // 2 means method in a service. @@ -174,6 +182,9 @@ func (g *grpc) generateService(file *generator.FileDescriptor, service *pb.Servi g.P() // NewClient factory. + if deprecated { + g.P(deprecationComment) + } g.P("func New", servName, "Client (cc *", grpcPkg, ".ClientConn) ", servName, "Client {") g.P("return &", unexport(servName), "Client{cc}") g.P("}") @@ -200,6 +211,9 @@ func (g *grpc) generateService(file *generator.FileDescriptor, service *pb.Servi g.P() // Server interface. + if deprecated { + g.P(deprecationComment) + } serverType := servName + "Server" g.P("type ", serverType, " interface {") for i, method := range service.Method { @@ -210,6 +224,9 @@ func (g *grpc) generateService(file *generator.FileDescriptor, service *pb.Servi g.P() // Server registration. + if deprecated { + g.P(deprecationComment) + } g.P("func Register", servName, "Server(s *", grpcPkg, ".Server, srv ", serverType, ") {") g.P("s.RegisterService(&", serviceDescVar, `, srv)`) g.P("}") @@ -283,6 +300,9 @@ func (g *grpc) generateClientMethod(servName, fullServName, serviceDescVar strin inType := g.typeName(method.GetInputType()) outType := g.typeName(method.GetOutputType()) + if method.GetOptions().GetDeprecated() { + g.P(deprecationComment) + } g.P("func (c *", unexport(servName), "Client) ", g.generateClientSignature(servName, method), "{") if !method.GetServerStreaming() && !method.GetClientStreaming() { g.P("out := new(", outType, ")") diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/plugin/Makefile b/vendor/github.com/golang/protobuf/protoc-gen-go/plugin/Makefile deleted file mode 100644 index bc0463d57..000000000 --- a/vendor/github.com/golang/protobuf/protoc-gen-go/plugin/Makefile +++ /dev/null @@ -1,45 +0,0 @@ -# Go support for Protocol Buffers - Google's data interchange format -# -# Copyright 2010 The Go Authors. All rights reserved. -# https://github.com/golang/protobuf -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -# Not stored here, but plugin.proto is in https://github.com/google/protobuf/ -# at src/google/protobuf/compiler/plugin.proto -# Also we need to fix an import. -regenerate: - @echo WARNING! THIS RULE IS PROBABLY NOT RIGHT FOR YOUR INSTALLATION - cp $(HOME)/src/protobuf/include/google/protobuf/compiler/plugin.proto . - protoc --go_out=Mgoogle/protobuf/descriptor.proto=github.com/golang/protobuf/protoc-gen-go/descriptor:../../../../.. \ - -I$(HOME)/src/protobuf/include $(HOME)/src/protobuf/include/google/protobuf/compiler/plugin.proto - -restore: - cp plugin.pb.golden plugin.pb.go - -preserve: - cp plugin.pb.go plugin.pb.golden diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/plugin/plugin.pb.go b/vendor/github.com/golang/protobuf/protoc-gen-go/plugin/plugin.pb.go index c608a248b..61bfc10e0 100644 --- a/vendor/github.com/golang/protobuf/protoc-gen-go/plugin/plugin.pb.go +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/plugin/plugin.pb.go @@ -37,14 +37,33 @@ type Version struct { Patch *int32 `protobuf:"varint,3,opt,name=patch" json:"patch,omitempty"` // A suffix for alpha, beta or rc release, e.g., "alpha-1", "rc2". It should // be empty for mainline stable releases. - Suffix *string `protobuf:"bytes,4,opt,name=suffix" json:"suffix,omitempty"` - XXX_unrecognized []byte `json:"-"` + Suffix *string `protobuf:"bytes,4,opt,name=suffix" json:"suffix,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *Version) Reset() { *m = Version{} } func (m *Version) String() string { return proto.CompactTextString(m) } func (*Version) ProtoMessage() {} func (*Version) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } +func (m *Version) Unmarshal(b []byte) error { + return xxx_messageInfo_Version.Unmarshal(m, b) +} +func (m *Version) Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Version.Marshal(b, m, deterministic) +} +func (dst *Version) XXX_Merge(src proto.Message) { + xxx_messageInfo_Version.Merge(dst, src) +} +func (m *Version) XXX_Size() int { + return xxx_messageInfo_Version.Size(m) +} +func (m *Version) XXX_DiscardUnknown() { + xxx_messageInfo_Version.DiscardUnknown(m) +} + +var xxx_messageInfo_Version proto.InternalMessageInfo func (m *Version) GetMajor() int32 { if m != nil && m.Major != nil { @@ -98,14 +117,33 @@ type CodeGeneratorRequest struct { // fully qualified. ProtoFile []*google_protobuf.FileDescriptorProto `protobuf:"bytes,15,rep,name=proto_file,json=protoFile" json:"proto_file,omitempty"` // The version number of protocol compiler. - CompilerVersion *Version `protobuf:"bytes,3,opt,name=compiler_version,json=compilerVersion" json:"compiler_version,omitempty"` - XXX_unrecognized []byte `json:"-"` + CompilerVersion *Version `protobuf:"bytes,3,opt,name=compiler_version,json=compilerVersion" json:"compiler_version,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *CodeGeneratorRequest) Reset() { *m = CodeGeneratorRequest{} } func (m *CodeGeneratorRequest) String() string { return proto.CompactTextString(m) } func (*CodeGeneratorRequest) ProtoMessage() {} func (*CodeGeneratorRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } +func (m *CodeGeneratorRequest) Unmarshal(b []byte) error { + return xxx_messageInfo_CodeGeneratorRequest.Unmarshal(m, b) +} +func (m *CodeGeneratorRequest) Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CodeGeneratorRequest.Marshal(b, m, deterministic) +} +func (dst *CodeGeneratorRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_CodeGeneratorRequest.Merge(dst, src) +} +func (m *CodeGeneratorRequest) XXX_Size() int { + return xxx_messageInfo_CodeGeneratorRequest.Size(m) +} +func (m *CodeGeneratorRequest) XXX_DiscardUnknown() { + xxx_messageInfo_CodeGeneratorRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_CodeGeneratorRequest proto.InternalMessageInfo func (m *CodeGeneratorRequest) GetFileToGenerate() []string { if m != nil { @@ -145,15 +183,34 @@ type CodeGeneratorResponse struct { // problem in protoc itself -- such as the input CodeGeneratorRequest being // unparseable -- should be reported by writing a message to stderr and // exiting with a non-zero status code. - Error *string `protobuf:"bytes,1,opt,name=error" json:"error,omitempty"` - File []*CodeGeneratorResponse_File `protobuf:"bytes,15,rep,name=file" json:"file,omitempty"` - XXX_unrecognized []byte `json:"-"` + Error *string `protobuf:"bytes,1,opt,name=error" json:"error,omitempty"` + File []*CodeGeneratorResponse_File `protobuf:"bytes,15,rep,name=file" json:"file,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *CodeGeneratorResponse) Reset() { *m = CodeGeneratorResponse{} } func (m *CodeGeneratorResponse) String() string { return proto.CompactTextString(m) } func (*CodeGeneratorResponse) ProtoMessage() {} func (*CodeGeneratorResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } +func (m *CodeGeneratorResponse) Unmarshal(b []byte) error { + return xxx_messageInfo_CodeGeneratorResponse.Unmarshal(m, b) +} +func (m *CodeGeneratorResponse) Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CodeGeneratorResponse.Marshal(b, m, deterministic) +} +func (dst *CodeGeneratorResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_CodeGeneratorResponse.Merge(dst, src) +} +func (m *CodeGeneratorResponse) XXX_Size() int { + return xxx_messageInfo_CodeGeneratorResponse.Size(m) +} +func (m *CodeGeneratorResponse) XXX_DiscardUnknown() { + xxx_messageInfo_CodeGeneratorResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_CodeGeneratorResponse proto.InternalMessageInfo func (m *CodeGeneratorResponse) GetError() string { if m != nil && m.Error != nil { @@ -222,14 +279,33 @@ type CodeGeneratorResponse_File struct { // If |insertion_point| is present, |name| must also be present. InsertionPoint *string `protobuf:"bytes,2,opt,name=insertion_point,json=insertionPoint" json:"insertion_point,omitempty"` // The file contents. - Content *string `protobuf:"bytes,15,opt,name=content" json:"content,omitempty"` - XXX_unrecognized []byte `json:"-"` + Content *string `protobuf:"bytes,15,opt,name=content" json:"content,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *CodeGeneratorResponse_File) Reset() { *m = CodeGeneratorResponse_File{} } func (m *CodeGeneratorResponse_File) String() string { return proto.CompactTextString(m) } func (*CodeGeneratorResponse_File) ProtoMessage() {} func (*CodeGeneratorResponse_File) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2, 0} } +func (m *CodeGeneratorResponse_File) Unmarshal(b []byte) error { + return xxx_messageInfo_CodeGeneratorResponse_File.Unmarshal(m, b) +} +func (m *CodeGeneratorResponse_File) Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CodeGeneratorResponse_File.Marshal(b, m, deterministic) +} +func (dst *CodeGeneratorResponse_File) XXX_Merge(src proto.Message) { + xxx_messageInfo_CodeGeneratorResponse_File.Merge(dst, src) +} +func (m *CodeGeneratorResponse_File) XXX_Size() int { + return xxx_messageInfo_CodeGeneratorResponse_File.Size(m) +} +func (m *CodeGeneratorResponse_File) XXX_DiscardUnknown() { + xxx_messageInfo_CodeGeneratorResponse_File.DiscardUnknown(m) +} + +var xxx_messageInfo_CodeGeneratorResponse_File proto.InternalMessageInfo func (m *CodeGeneratorResponse_File) GetName() string { if m != nil && m.Name != nil { diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/Makefile b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/Makefile deleted file mode 100644 index a0bf9fefd..000000000 --- a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/Makefile +++ /dev/null @@ -1,73 +0,0 @@ -# Go support for Protocol Buffers - Google's data interchange format -# -# Copyright 2010 The Go Authors. All rights reserved. -# https://github.com/golang/protobuf -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -all: - @echo run make test - -include ../../Make.protobuf - -test: golden testbuild - -#test: golden testbuild extension_test -# ./extension_test -# @echo PASS - -my_test/test.pb.go: my_test/test.proto - protoc --go_out=Mmulti/multi1.proto=github.com/golang/protobuf/protoc-gen-go/testdata/multi:. $< - -golden: - make -B my_test/test.pb.go - sed -i -e '/return.*fileDescriptor/d' my_test/test.pb.go - sed -i -e '/^var fileDescriptor/,/^}/d' my_test/test.pb.go - sed -i -e '/proto.RegisterFile.*fileDescriptor/d' my_test/test.pb.go - gofmt -w my_test/test.pb.go - diff -w my_test/test.pb.go my_test/test.pb.go.golden - -nuke: clean - -testbuild: regenerate - go test - -regenerate: - # Invoke protoc once to generate three independent .pb.go files in the same package. - protoc --go_out=. multi/multi1.proto multi/multi2.proto multi/multi3.proto - -#extension_test: extension_test.$O -# $(LD) -L. -o $@ $< - -#multi.a: multi3.pb.$O multi2.pb.$O multi1.pb.$O -# rm -f multi.a -# $(QUOTED_GOBIN)/gopack grc $@ $< - -#test.pb.go: imp.pb.go -#multi1.pb.go: multi2.pb.go multi3.pb.go -#main.$O: imp.pb.$O test.pb.$O multi.a -#extension_test.$O: extension_base.pb.$O extension_extra.pb.$O extension_user.pb.$O diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/deprecated/deprecated.pb.go b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/deprecated/deprecated.pb.go new file mode 100644 index 000000000..6ebae9da3 --- /dev/null +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/deprecated/deprecated.pb.go @@ -0,0 +1,232 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// deprecated/deprecated.proto is a deprecated file. + +package deprecated // import "github.com/golang/protobuf/protoc-gen-go/testdata/deprecated" + +/* +package deprecated contains only deprecated messages and services. +*/ + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +import ( + context "golang.org/x/net/context" + grpc "google.golang.org/grpc" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +// DeprecatedEnum contains deprecated values. +type DeprecatedEnum int32 // Deprecated: Do not use. +const ( + // DEPRECATED is the iota value of this enum. + DeprecatedEnum_DEPRECATED DeprecatedEnum = 0 // Deprecated: Do not use. +) + +var DeprecatedEnum_name = map[int32]string{ + 0: "DEPRECATED", +} +var DeprecatedEnum_value = map[string]int32{ + "DEPRECATED": 0, +} + +func (x DeprecatedEnum) String() string { + return proto.EnumName(DeprecatedEnum_name, int32(x)) +} +func (DeprecatedEnum) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_deprecated_9e1889ba21817fad, []int{0} +} + +// DeprecatedRequest is a request to DeprecatedCall. +// +// Deprecated: Do not use. +type DeprecatedRequest struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DeprecatedRequest) Reset() { *m = DeprecatedRequest{} } +func (m *DeprecatedRequest) String() string { return proto.CompactTextString(m) } +func (*DeprecatedRequest) ProtoMessage() {} +func (*DeprecatedRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_deprecated_9e1889ba21817fad, []int{0} +} +func (m *DeprecatedRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DeprecatedRequest.Unmarshal(m, b) +} +func (m *DeprecatedRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DeprecatedRequest.Marshal(b, m, deterministic) +} +func (dst *DeprecatedRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_DeprecatedRequest.Merge(dst, src) +} +func (m *DeprecatedRequest) XXX_Size() int { + return xxx_messageInfo_DeprecatedRequest.Size(m) +} +func (m *DeprecatedRequest) XXX_DiscardUnknown() { + xxx_messageInfo_DeprecatedRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_DeprecatedRequest proto.InternalMessageInfo + +// Deprecated: Do not use. +type DeprecatedResponse struct { + // DeprecatedField contains a DeprecatedEnum. + DeprecatedField DeprecatedEnum `protobuf:"varint,1,opt,name=deprecated_field,json=deprecatedField,enum=deprecated.DeprecatedEnum" json:"deprecated_field,omitempty"` // Deprecated: Do not use. + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DeprecatedResponse) Reset() { *m = DeprecatedResponse{} } +func (m *DeprecatedResponse) String() string { return proto.CompactTextString(m) } +func (*DeprecatedResponse) ProtoMessage() {} +func (*DeprecatedResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_deprecated_9e1889ba21817fad, []int{1} +} +func (m *DeprecatedResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DeprecatedResponse.Unmarshal(m, b) +} +func (m *DeprecatedResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DeprecatedResponse.Marshal(b, m, deterministic) +} +func (dst *DeprecatedResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_DeprecatedResponse.Merge(dst, src) +} +func (m *DeprecatedResponse) XXX_Size() int { + return xxx_messageInfo_DeprecatedResponse.Size(m) +} +func (m *DeprecatedResponse) XXX_DiscardUnknown() { + xxx_messageInfo_DeprecatedResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_DeprecatedResponse proto.InternalMessageInfo + +// Deprecated: Do not use. +func (m *DeprecatedResponse) GetDeprecatedField() DeprecatedEnum { + if m != nil { + return m.DeprecatedField + } + return DeprecatedEnum_DEPRECATED +} + +func init() { + proto.RegisterType((*DeprecatedRequest)(nil), "deprecated.DeprecatedRequest") + proto.RegisterType((*DeprecatedResponse)(nil), "deprecated.DeprecatedResponse") + proto.RegisterEnum("deprecated.DeprecatedEnum", DeprecatedEnum_name, DeprecatedEnum_value) +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// Client API for DeprecatedService service + +// Deprecated: Do not use. +type DeprecatedServiceClient interface { + // DeprecatedCall takes a DeprecatedRequest and returns a DeprecatedResponse. + DeprecatedCall(ctx context.Context, in *DeprecatedRequest, opts ...grpc.CallOption) (*DeprecatedResponse, error) +} + +type deprecatedServiceClient struct { + cc *grpc.ClientConn +} + +// Deprecated: Do not use. +func NewDeprecatedServiceClient(cc *grpc.ClientConn) DeprecatedServiceClient { + return &deprecatedServiceClient{cc} +} + +// Deprecated: Do not use. +func (c *deprecatedServiceClient) DeprecatedCall(ctx context.Context, in *DeprecatedRequest, opts ...grpc.CallOption) (*DeprecatedResponse, error) { + out := new(DeprecatedResponse) + err := grpc.Invoke(ctx, "/deprecated.DeprecatedService/DeprecatedCall", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Server API for DeprecatedService service + +// Deprecated: Do not use. +type DeprecatedServiceServer interface { + // DeprecatedCall takes a DeprecatedRequest and returns a DeprecatedResponse. + DeprecatedCall(context.Context, *DeprecatedRequest) (*DeprecatedResponse, error) +} + +// Deprecated: Do not use. +func RegisterDeprecatedServiceServer(s *grpc.Server, srv DeprecatedServiceServer) { + s.RegisterService(&_DeprecatedService_serviceDesc, srv) +} + +func _DeprecatedService_DeprecatedCall_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeprecatedRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DeprecatedServiceServer).DeprecatedCall(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/deprecated.DeprecatedService/DeprecatedCall", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DeprecatedServiceServer).DeprecatedCall(ctx, req.(*DeprecatedRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _DeprecatedService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "deprecated.DeprecatedService", + HandlerType: (*DeprecatedServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "DeprecatedCall", + Handler: _DeprecatedService_DeprecatedCall_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "deprecated/deprecated.proto", +} + +func init() { + proto.RegisterFile("deprecated/deprecated.proto", fileDescriptor_deprecated_9e1889ba21817fad) +} + +var fileDescriptor_deprecated_9e1889ba21817fad = []byte{ + // 248 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4e, 0x49, 0x2d, 0x28, + 0x4a, 0x4d, 0x4e, 0x2c, 0x49, 0x4d, 0xd1, 0x47, 0x30, 0xf5, 0x0a, 0x8a, 0xf2, 0x4b, 0xf2, 0x85, + 0xb8, 0x10, 0x22, 0x4a, 0xe2, 0x5c, 0x82, 0x2e, 0x70, 0x5e, 0x50, 0x6a, 0x61, 0x69, 0x6a, 0x71, + 0x89, 0x15, 0x93, 0x04, 0xa3, 0x52, 0x32, 0x97, 0x10, 0xb2, 0x44, 0x71, 0x41, 0x7e, 0x5e, 0x71, + 0xaa, 0x90, 0x27, 0x97, 0x00, 0x42, 0x73, 0x7c, 0x5a, 0x66, 0x6a, 0x4e, 0x8a, 0x04, 0xa3, 0x02, + 0xa3, 0x06, 0x9f, 0x91, 0x94, 0x1e, 0x92, 0x3d, 0x08, 0x9d, 0xae, 0x79, 0xa5, 0xb9, 0x4e, 0x4c, + 0x12, 0x8c, 0x41, 0xfc, 0x08, 0x69, 0x37, 0x90, 0x36, 0x90, 0x25, 0x5a, 0x1a, 0x5c, 0x7c, 0xa8, + 0x4a, 0x85, 0x84, 0xb8, 0xb8, 0x5c, 0x5c, 0x03, 0x82, 0x5c, 0x9d, 0x1d, 0x43, 0x5c, 0x5d, 0x04, + 0x18, 0xa4, 0x98, 0x38, 0x18, 0xa5, 0x98, 0x24, 0x18, 0x8d, 0xf2, 0x90, 0xdd, 0x19, 0x9c, 0x5a, + 0x54, 0x96, 0x99, 0x9c, 0x2a, 0x14, 0x82, 0xac, 0xdd, 0x39, 0x31, 0x27, 0x47, 0x48, 0x16, 0xbb, + 0x2b, 0xa0, 0x1e, 0x93, 0x92, 0xc3, 0x25, 0x0d, 0xf1, 0x9e, 0x12, 0x73, 0x07, 0x13, 0xa3, 0x14, + 0x88, 0x70, 0x72, 0x8c, 0xb2, 0x49, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, + 0x4f, 0xcf, 0xcf, 0x49, 0xcc, 0x4b, 0xd7, 0x07, 0x07, 0x5f, 0x52, 0x69, 0x1a, 0x84, 0x91, 0xac, + 0x9b, 0x9e, 0x9a, 0xa7, 0x9b, 0x9e, 0xaf, 0x5f, 0x92, 0x5a, 0x5c, 0x92, 0x92, 0x58, 0x92, 0x88, + 0x14, 0xd2, 0x3b, 0x18, 0x19, 0x93, 0xd8, 0xc0, 0xaa, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, + 0x0e, 0xf5, 0x6c, 0x87, 0x8c, 0x01, 0x00, 0x00, +} diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/deprecated/deprecated.proto b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/deprecated/deprecated.proto new file mode 100644 index 000000000..b314166d2 --- /dev/null +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/deprecated/deprecated.proto @@ -0,0 +1,69 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2018 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +syntax = "proto3"; + +// package deprecated contains only deprecated messages and services. +package deprecated; + +option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/deprecated"; + +option deprecated = true; // file-level deprecation + +// DeprecatedRequest is a request to DeprecatedCall. +message DeprecatedRequest { + option deprecated = true; +} + +message DeprecatedResponse { + // comment for DeprecatedResponse is omitted to guarantee deprecation + // message doesn't append unnecessary comments. + option deprecated = true; + // DeprecatedField contains a DeprecatedEnum. + DeprecatedEnum deprecated_field = 1 [deprecated=true]; +} + +// DeprecatedEnum contains deprecated values. +enum DeprecatedEnum { + option deprecated = true; + // DEPRECATED is the iota value of this enum. + DEPRECATED = 0 [deprecated=true]; +} + +// DeprecatedService is for making DeprecatedCalls +service DeprecatedService { + option deprecated = true; + + // DeprecatedCall takes a DeprecatedRequest and returns a DeprecatedResponse. + rpc DeprecatedCall(DeprecatedRequest) returns (DeprecatedResponse) { + option deprecated = true; + } +} diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/extension_base/extension_base.pb.go b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/extension_base/extension_base.pb.go new file mode 100644 index 000000000..a08e8eda5 --- /dev/null +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/extension_base/extension_base.pb.go @@ -0,0 +1,139 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: extension_base/extension_base.proto + +package extension_base // import "github.com/golang/protobuf/protoc-gen-go/testdata/extension_base" + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type BaseMessage struct { + Height *int32 `protobuf:"varint,1,opt,name=height" json:"height,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + proto.XXX_InternalExtensions `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *BaseMessage) Reset() { *m = BaseMessage{} } +func (m *BaseMessage) String() string { return proto.CompactTextString(m) } +func (*BaseMessage) ProtoMessage() {} +func (*BaseMessage) Descriptor() ([]byte, []int) { + return fileDescriptor_extension_base_41d3c712c9fc37fc, []int{0} +} + +var extRange_BaseMessage = []proto.ExtensionRange{ + {Start: 4, End: 9}, + {Start: 16, End: 536870911}, +} + +func (*BaseMessage) ExtensionRangeArray() []proto.ExtensionRange { + return extRange_BaseMessage +} +func (m *BaseMessage) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_BaseMessage.Unmarshal(m, b) +} +func (m *BaseMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_BaseMessage.Marshal(b, m, deterministic) +} +func (dst *BaseMessage) XXX_Merge(src proto.Message) { + xxx_messageInfo_BaseMessage.Merge(dst, src) +} +func (m *BaseMessage) XXX_Size() int { + return xxx_messageInfo_BaseMessage.Size(m) +} +func (m *BaseMessage) XXX_DiscardUnknown() { + xxx_messageInfo_BaseMessage.DiscardUnknown(m) +} + +var xxx_messageInfo_BaseMessage proto.InternalMessageInfo + +func (m *BaseMessage) GetHeight() int32 { + if m != nil && m.Height != nil { + return *m.Height + } + return 0 +} + +// Another message that may be extended, using message_set_wire_format. +type OldStyleMessage struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + proto.XXX_InternalExtensions `protobuf_messageset:"1" json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *OldStyleMessage) Reset() { *m = OldStyleMessage{} } +func (m *OldStyleMessage) String() string { return proto.CompactTextString(m) } +func (*OldStyleMessage) ProtoMessage() {} +func (*OldStyleMessage) Descriptor() ([]byte, []int) { + return fileDescriptor_extension_base_41d3c712c9fc37fc, []int{1} +} + +func (m *OldStyleMessage) MarshalJSON() ([]byte, error) { + return proto.MarshalMessageSetJSON(&m.XXX_InternalExtensions) +} +func (m *OldStyleMessage) UnmarshalJSON(buf []byte) error { + return proto.UnmarshalMessageSetJSON(buf, &m.XXX_InternalExtensions) +} + +var extRange_OldStyleMessage = []proto.ExtensionRange{ + {Start: 100, End: 2147483646}, +} + +func (*OldStyleMessage) ExtensionRangeArray() []proto.ExtensionRange { + return extRange_OldStyleMessage +} +func (m *OldStyleMessage) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_OldStyleMessage.Unmarshal(m, b) +} +func (m *OldStyleMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_OldStyleMessage.Marshal(b, m, deterministic) +} +func (dst *OldStyleMessage) XXX_Merge(src proto.Message) { + xxx_messageInfo_OldStyleMessage.Merge(dst, src) +} +func (m *OldStyleMessage) XXX_Size() int { + return xxx_messageInfo_OldStyleMessage.Size(m) +} +func (m *OldStyleMessage) XXX_DiscardUnknown() { + xxx_messageInfo_OldStyleMessage.DiscardUnknown(m) +} + +var xxx_messageInfo_OldStyleMessage proto.InternalMessageInfo + +func init() { + proto.RegisterType((*BaseMessage)(nil), "extension_base.BaseMessage") + proto.RegisterType((*OldStyleMessage)(nil), "extension_base.OldStyleMessage") +} + +func init() { + proto.RegisterFile("extension_base/extension_base.proto", fileDescriptor_extension_base_41d3c712c9fc37fc) +} + +var fileDescriptor_extension_base_41d3c712c9fc37fc = []byte{ + // 179 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4e, 0xad, 0x28, 0x49, + 0xcd, 0x2b, 0xce, 0xcc, 0xcf, 0x8b, 0x4f, 0x4a, 0x2c, 0x4e, 0xd5, 0x47, 0xe5, 0xea, 0x15, 0x14, + 0xe5, 0x97, 0xe4, 0x0b, 0xf1, 0xa1, 0x8a, 0x2a, 0x99, 0x72, 0x71, 0x3b, 0x25, 0x16, 0xa7, 0xfa, + 0xa6, 0x16, 0x17, 0x27, 0xa6, 0xa7, 0x0a, 0x89, 0x71, 0xb1, 0x65, 0xa4, 0x66, 0xa6, 0x67, 0x94, + 0x48, 0x30, 0x2a, 0x30, 0x6a, 0xb0, 0x06, 0x41, 0x79, 0x5a, 0x2c, 0x1c, 0x2c, 0x02, 0x5c, 0x5a, + 0x1c, 0x1c, 0x02, 0x02, 0x0d, 0x0d, 0x0d, 0x0d, 0x4c, 0x4a, 0xf2, 0x5c, 0xfc, 0xfe, 0x39, 0x29, + 0xc1, 0x25, 0x95, 0x39, 0x30, 0xad, 0x5a, 0x1c, 0x1c, 0x29, 0x02, 0xff, 0xff, 0xff, 0xff, 0xcf, + 0x6e, 0xc5, 0xc4, 0xc1, 0xe8, 0xe4, 0x14, 0xe5, 0x90, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, + 0x9c, 0x9f, 0xab, 0x9f, 0x9e, 0x9f, 0x93, 0x98, 0x97, 0xae, 0x0f, 0x76, 0x42, 0x52, 0x69, 0x1a, + 0x84, 0x91, 0xac, 0x9b, 0x9e, 0x9a, 0xa7, 0x9b, 0x9e, 0xaf, 0x5f, 0x92, 0x5a, 0x5c, 0x92, 0x92, + 0x58, 0x92, 0x88, 0xe6, 0x62, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x7a, 0x7f, 0xb7, 0x2a, 0xd1, + 0x00, 0x00, 0x00, +} diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/extension_base.proto b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/extension_base/extension_base.proto similarity index 95% rename from vendor/github.com/golang/protobuf/protoc-gen-go/testdata/extension_base.proto rename to vendor/github.com/golang/protobuf/protoc-gen-go/testdata/extension_base/extension_base.proto index 94acfc1bc..0ba74def8 100644 --- a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/extension_base.proto +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/extension_base/extension_base.proto @@ -33,6 +33,8 @@ syntax = "proto2"; package extension_base; +option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/extension_base"; + message BaseMessage { optional int32 height = 1; extensions 4 to 9; diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/extension_extra/extension_extra.pb.go b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/extension_extra/extension_extra.pb.go new file mode 100644 index 000000000..b37321690 --- /dev/null +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/extension_extra/extension_extra.pb.go @@ -0,0 +1,78 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: extension_extra/extension_extra.proto + +package extension_extra // import "github.com/golang/protobuf/protoc-gen-go/testdata/extension_extra" + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type ExtraMessage struct { + Width *int32 `protobuf:"varint,1,opt,name=width" json:"width,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ExtraMessage) Reset() { *m = ExtraMessage{} } +func (m *ExtraMessage) String() string { return proto.CompactTextString(m) } +func (*ExtraMessage) ProtoMessage() {} +func (*ExtraMessage) Descriptor() ([]byte, []int) { + return fileDescriptor_extension_extra_83adf2410f49f816, []int{0} +} +func (m *ExtraMessage) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ExtraMessage.Unmarshal(m, b) +} +func (m *ExtraMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ExtraMessage.Marshal(b, m, deterministic) +} +func (dst *ExtraMessage) XXX_Merge(src proto.Message) { + xxx_messageInfo_ExtraMessage.Merge(dst, src) +} +func (m *ExtraMessage) XXX_Size() int { + return xxx_messageInfo_ExtraMessage.Size(m) +} +func (m *ExtraMessage) XXX_DiscardUnknown() { + xxx_messageInfo_ExtraMessage.DiscardUnknown(m) +} + +var xxx_messageInfo_ExtraMessage proto.InternalMessageInfo + +func (m *ExtraMessage) GetWidth() int32 { + if m != nil && m.Width != nil { + return *m.Width + } + return 0 +} + +func init() { + proto.RegisterType((*ExtraMessage)(nil), "extension_extra.ExtraMessage") +} + +func init() { + proto.RegisterFile("extension_extra/extension_extra.proto", fileDescriptor_extension_extra_83adf2410f49f816) +} + +var fileDescriptor_extension_extra_83adf2410f49f816 = []byte{ + // 133 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4d, 0xad, 0x28, 0x49, + 0xcd, 0x2b, 0xce, 0xcc, 0xcf, 0x8b, 0x4f, 0xad, 0x28, 0x29, 0x4a, 0xd4, 0x47, 0xe3, 0xeb, 0x15, + 0x14, 0xe5, 0x97, 0xe4, 0x0b, 0xf1, 0xa3, 0x09, 0x2b, 0xa9, 0x70, 0xf1, 0xb8, 0x82, 0x18, 0xbe, + 0xa9, 0xc5, 0xc5, 0x89, 0xe9, 0xa9, 0x42, 0x22, 0x5c, 0xac, 0xe5, 0x99, 0x29, 0x25, 0x19, 0x12, + 0x8c, 0x0a, 0x8c, 0x1a, 0xac, 0x41, 0x10, 0x8e, 0x93, 0x73, 0x94, 0x63, 0x7a, 0x66, 0x49, 0x46, + 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x7e, 0x7a, 0x7e, 0x4e, 0x62, 0x5e, 0xba, 0x3e, 0xd8, 0xc4, + 0xa4, 0xd2, 0x34, 0x08, 0x23, 0x59, 0x37, 0x3d, 0x35, 0x4f, 0x37, 0x3d, 0x5f, 0xbf, 0x24, 0xb5, + 0xb8, 0x24, 0x25, 0xb1, 0x04, 0xc3, 0x05, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0xf1, 0xec, 0xe3, + 0xb7, 0xa3, 0x00, 0x00, 0x00, +} diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/extension_extra.proto b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/extension_extra/extension_extra.proto similarity index 95% rename from vendor/github.com/golang/protobuf/protoc-gen-go/testdata/extension_extra.proto rename to vendor/github.com/golang/protobuf/protoc-gen-go/testdata/extension_extra/extension_extra.proto index fca7f600c..1dd03e70b 100644 --- a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/extension_extra.proto +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/extension_extra/extension_extra.proto @@ -33,6 +33,8 @@ syntax = "proto2"; package extension_extra; +option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/extension_extra"; + message ExtraMessage { optional int32 width = 1; } diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/extension_user/extension_user.pb.go b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/extension_user/extension_user.pb.go new file mode 100644 index 000000000..c71879215 --- /dev/null +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/extension_user/extension_user.pb.go @@ -0,0 +1,401 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: extension_user/extension_user.proto + +package extension_user // import "github.com/golang/protobuf/protoc-gen-go/testdata/extension_user" + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" +import extension_base "github.com/golang/protobuf/protoc-gen-go/testdata/extension_base" +import extension_extra "github.com/golang/protobuf/protoc-gen-go/testdata/extension_extra" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type UserMessage struct { + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Rank *string `protobuf:"bytes,2,opt,name=rank" json:"rank,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *UserMessage) Reset() { *m = UserMessage{} } +func (m *UserMessage) String() string { return proto.CompactTextString(m) } +func (*UserMessage) ProtoMessage() {} +func (*UserMessage) Descriptor() ([]byte, []int) { + return fileDescriptor_extension_user_af41b5e0bdfb7846, []int{0} +} +func (m *UserMessage) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_UserMessage.Unmarshal(m, b) +} +func (m *UserMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_UserMessage.Marshal(b, m, deterministic) +} +func (dst *UserMessage) XXX_Merge(src proto.Message) { + xxx_messageInfo_UserMessage.Merge(dst, src) +} +func (m *UserMessage) XXX_Size() int { + return xxx_messageInfo_UserMessage.Size(m) +} +func (m *UserMessage) XXX_DiscardUnknown() { + xxx_messageInfo_UserMessage.DiscardUnknown(m) +} + +var xxx_messageInfo_UserMessage proto.InternalMessageInfo + +func (m *UserMessage) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *UserMessage) GetRank() string { + if m != nil && m.Rank != nil { + return *m.Rank + } + return "" +} + +// Extend inside the scope of another type +type LoudMessage struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + proto.XXX_InternalExtensions `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *LoudMessage) Reset() { *m = LoudMessage{} } +func (m *LoudMessage) String() string { return proto.CompactTextString(m) } +func (*LoudMessage) ProtoMessage() {} +func (*LoudMessage) Descriptor() ([]byte, []int) { + return fileDescriptor_extension_user_af41b5e0bdfb7846, []int{1} +} + +var extRange_LoudMessage = []proto.ExtensionRange{ + {Start: 100, End: 536870911}, +} + +func (*LoudMessage) ExtensionRangeArray() []proto.ExtensionRange { + return extRange_LoudMessage +} +func (m *LoudMessage) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_LoudMessage.Unmarshal(m, b) +} +func (m *LoudMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_LoudMessage.Marshal(b, m, deterministic) +} +func (dst *LoudMessage) XXX_Merge(src proto.Message) { + xxx_messageInfo_LoudMessage.Merge(dst, src) +} +func (m *LoudMessage) XXX_Size() int { + return xxx_messageInfo_LoudMessage.Size(m) +} +func (m *LoudMessage) XXX_DiscardUnknown() { + xxx_messageInfo_LoudMessage.DiscardUnknown(m) +} + +var xxx_messageInfo_LoudMessage proto.InternalMessageInfo + +var E_LoudMessage_Volume = &proto.ExtensionDesc{ + ExtendedType: (*extension_base.BaseMessage)(nil), + ExtensionType: (*uint32)(nil), + Field: 8, + Name: "extension_user.LoudMessage.volume", + Tag: "varint,8,opt,name=volume", + Filename: "extension_user/extension_user.proto", +} + +// Extend inside the scope of another type, using a message. +type LoginMessage struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *LoginMessage) Reset() { *m = LoginMessage{} } +func (m *LoginMessage) String() string { return proto.CompactTextString(m) } +func (*LoginMessage) ProtoMessage() {} +func (*LoginMessage) Descriptor() ([]byte, []int) { + return fileDescriptor_extension_user_af41b5e0bdfb7846, []int{2} +} +func (m *LoginMessage) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_LoginMessage.Unmarshal(m, b) +} +func (m *LoginMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_LoginMessage.Marshal(b, m, deterministic) +} +func (dst *LoginMessage) XXX_Merge(src proto.Message) { + xxx_messageInfo_LoginMessage.Merge(dst, src) +} +func (m *LoginMessage) XXX_Size() int { + return xxx_messageInfo_LoginMessage.Size(m) +} +func (m *LoginMessage) XXX_DiscardUnknown() { + xxx_messageInfo_LoginMessage.DiscardUnknown(m) +} + +var xxx_messageInfo_LoginMessage proto.InternalMessageInfo + +var E_LoginMessage_UserMessage = &proto.ExtensionDesc{ + ExtendedType: (*extension_base.BaseMessage)(nil), + ExtensionType: (*UserMessage)(nil), + Field: 16, + Name: "extension_user.LoginMessage.user_message", + Tag: "bytes,16,opt,name=user_message,json=userMessage", + Filename: "extension_user/extension_user.proto", +} + +type Detail struct { + Color *string `protobuf:"bytes,1,opt,name=color" json:"color,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Detail) Reset() { *m = Detail{} } +func (m *Detail) String() string { return proto.CompactTextString(m) } +func (*Detail) ProtoMessage() {} +func (*Detail) Descriptor() ([]byte, []int) { + return fileDescriptor_extension_user_af41b5e0bdfb7846, []int{3} +} +func (m *Detail) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Detail.Unmarshal(m, b) +} +func (m *Detail) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Detail.Marshal(b, m, deterministic) +} +func (dst *Detail) XXX_Merge(src proto.Message) { + xxx_messageInfo_Detail.Merge(dst, src) +} +func (m *Detail) XXX_Size() int { + return xxx_messageInfo_Detail.Size(m) +} +func (m *Detail) XXX_DiscardUnknown() { + xxx_messageInfo_Detail.DiscardUnknown(m) +} + +var xxx_messageInfo_Detail proto.InternalMessageInfo + +func (m *Detail) GetColor() string { + if m != nil && m.Color != nil { + return *m.Color + } + return "" +} + +// An extension of an extension +type Announcement struct { + Words *string `protobuf:"bytes,1,opt,name=words" json:"words,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Announcement) Reset() { *m = Announcement{} } +func (m *Announcement) String() string { return proto.CompactTextString(m) } +func (*Announcement) ProtoMessage() {} +func (*Announcement) Descriptor() ([]byte, []int) { + return fileDescriptor_extension_user_af41b5e0bdfb7846, []int{4} +} +func (m *Announcement) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Announcement.Unmarshal(m, b) +} +func (m *Announcement) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Announcement.Marshal(b, m, deterministic) +} +func (dst *Announcement) XXX_Merge(src proto.Message) { + xxx_messageInfo_Announcement.Merge(dst, src) +} +func (m *Announcement) XXX_Size() int { + return xxx_messageInfo_Announcement.Size(m) +} +func (m *Announcement) XXX_DiscardUnknown() { + xxx_messageInfo_Announcement.DiscardUnknown(m) +} + +var xxx_messageInfo_Announcement proto.InternalMessageInfo + +func (m *Announcement) GetWords() string { + if m != nil && m.Words != nil { + return *m.Words + } + return "" +} + +var E_Announcement_LoudExt = &proto.ExtensionDesc{ + ExtendedType: (*LoudMessage)(nil), + ExtensionType: (*Announcement)(nil), + Field: 100, + Name: "extension_user.Announcement.loud_ext", + Tag: "bytes,100,opt,name=loud_ext,json=loudExt", + Filename: "extension_user/extension_user.proto", +} + +// Something that can be put in a message set. +type OldStyleParcel struct { + Name *string `protobuf:"bytes,1,req,name=name" json:"name,omitempty"` + Height *int32 `protobuf:"varint,2,opt,name=height" json:"height,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *OldStyleParcel) Reset() { *m = OldStyleParcel{} } +func (m *OldStyleParcel) String() string { return proto.CompactTextString(m) } +func (*OldStyleParcel) ProtoMessage() {} +func (*OldStyleParcel) Descriptor() ([]byte, []int) { + return fileDescriptor_extension_user_af41b5e0bdfb7846, []int{5} +} +func (m *OldStyleParcel) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_OldStyleParcel.Unmarshal(m, b) +} +func (m *OldStyleParcel) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_OldStyleParcel.Marshal(b, m, deterministic) +} +func (dst *OldStyleParcel) XXX_Merge(src proto.Message) { + xxx_messageInfo_OldStyleParcel.Merge(dst, src) +} +func (m *OldStyleParcel) XXX_Size() int { + return xxx_messageInfo_OldStyleParcel.Size(m) +} +func (m *OldStyleParcel) XXX_DiscardUnknown() { + xxx_messageInfo_OldStyleParcel.DiscardUnknown(m) +} + +var xxx_messageInfo_OldStyleParcel proto.InternalMessageInfo + +func (m *OldStyleParcel) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *OldStyleParcel) GetHeight() int32 { + if m != nil && m.Height != nil { + return *m.Height + } + return 0 +} + +var E_OldStyleParcel_MessageSetExtension = &proto.ExtensionDesc{ + ExtendedType: (*extension_base.OldStyleMessage)(nil), + ExtensionType: (*OldStyleParcel)(nil), + Field: 2001, + Name: "extension_user.OldStyleParcel", + Tag: "bytes,2001,opt,name=message_set_extension,json=messageSetExtension", + Filename: "extension_user/extension_user.proto", +} + +var E_UserMessage = &proto.ExtensionDesc{ + ExtendedType: (*extension_base.BaseMessage)(nil), + ExtensionType: (*UserMessage)(nil), + Field: 5, + Name: "extension_user.user_message", + Tag: "bytes,5,opt,name=user_message,json=userMessage", + Filename: "extension_user/extension_user.proto", +} + +var E_ExtraMessage = &proto.ExtensionDesc{ + ExtendedType: (*extension_base.BaseMessage)(nil), + ExtensionType: (*extension_extra.ExtraMessage)(nil), + Field: 9, + Name: "extension_user.extra_message", + Tag: "bytes,9,opt,name=extra_message,json=extraMessage", + Filename: "extension_user/extension_user.proto", +} + +var E_Width = &proto.ExtensionDesc{ + ExtendedType: (*extension_base.BaseMessage)(nil), + ExtensionType: (*int32)(nil), + Field: 6, + Name: "extension_user.width", + Tag: "varint,6,opt,name=width", + Filename: "extension_user/extension_user.proto", +} + +var E_Area = &proto.ExtensionDesc{ + ExtendedType: (*extension_base.BaseMessage)(nil), + ExtensionType: (*int64)(nil), + Field: 7, + Name: "extension_user.area", + Tag: "varint,7,opt,name=area", + Filename: "extension_user/extension_user.proto", +} + +var E_Detail = &proto.ExtensionDesc{ + ExtendedType: (*extension_base.BaseMessage)(nil), + ExtensionType: ([]*Detail)(nil), + Field: 17, + Name: "extension_user.detail", + Tag: "bytes,17,rep,name=detail", + Filename: "extension_user/extension_user.proto", +} + +func init() { + proto.RegisterType((*UserMessage)(nil), "extension_user.UserMessage") + proto.RegisterType((*LoudMessage)(nil), "extension_user.LoudMessage") + proto.RegisterType((*LoginMessage)(nil), "extension_user.LoginMessage") + proto.RegisterType((*Detail)(nil), "extension_user.Detail") + proto.RegisterType((*Announcement)(nil), "extension_user.Announcement") + proto.RegisterMessageSetType((*OldStyleParcel)(nil), 2001, "extension_user.OldStyleParcel") + proto.RegisterType((*OldStyleParcel)(nil), "extension_user.OldStyleParcel") + proto.RegisterExtension(E_LoudMessage_Volume) + proto.RegisterExtension(E_LoginMessage_UserMessage) + proto.RegisterExtension(E_Announcement_LoudExt) + proto.RegisterExtension(E_OldStyleParcel_MessageSetExtension) + proto.RegisterExtension(E_UserMessage) + proto.RegisterExtension(E_ExtraMessage) + proto.RegisterExtension(E_Width) + proto.RegisterExtension(E_Area) + proto.RegisterExtension(E_Detail) +} + +func init() { + proto.RegisterFile("extension_user/extension_user.proto", fileDescriptor_extension_user_af41b5e0bdfb7846) +} + +var fileDescriptor_extension_user_af41b5e0bdfb7846 = []byte{ + // 492 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0x51, 0x6f, 0x94, 0x40, + 0x10, 0x0e, 0x6d, 0x8f, 0x5e, 0x87, 0x6b, 0xad, 0xa8, 0xcd, 0xa5, 0x6a, 0x25, 0x18, 0x13, 0x62, + 0xd2, 0x23, 0x62, 0x7c, 0xe1, 0x49, 0x2f, 0xde, 0x93, 0x67, 0x34, 0x54, 0x5f, 0xf4, 0x81, 0xec, + 0xc1, 0xc8, 0x91, 0xc2, 0xae, 0xd9, 0x5d, 0xec, 0xe9, 0xd3, 0xfd, 0x26, 0xff, 0x89, 0xff, 0xc8, + 0xb0, 0x2c, 0x2d, 0x87, 0xc9, 0xc5, 0xbe, 0x90, 0xfd, 0x86, 0x6f, 0xbe, 0x99, 0xfd, 0x66, 0x00, + 0x9e, 0xe2, 0x4a, 0x22, 0x15, 0x39, 0xa3, 0x71, 0x25, 0x90, 0xfb, 0x9b, 0x70, 0xf2, 0x9d, 0x33, + 0xc9, 0xec, 0xa3, 0xcd, 0xe8, 0x69, 0x27, 0x69, 0x41, 0x04, 0xfa, 0x9b, 0xb0, 0x49, 0x3a, 0x7d, + 0x76, 0x13, 0xc5, 0x95, 0xe4, 0xc4, 0xef, 0xe1, 0x86, 0xe6, 0xbe, 0x02, 0xeb, 0xb3, 0x40, 0xfe, + 0x1e, 0x85, 0x20, 0x19, 0xda, 0x36, 0xec, 0x51, 0x52, 0xe2, 0xd8, 0x70, 0x0c, 0xef, 0x20, 0x52, + 0xe7, 0x3a, 0xc6, 0x09, 0xbd, 0x1c, 0xef, 0x34, 0xb1, 0xfa, 0xec, 0xce, 0xc1, 0x9a, 0xb3, 0x2a, + 0xd5, 0x69, 0xcf, 0x87, 0xc3, 0xf4, 0x78, 0xbd, 0x5e, 0xaf, 0x77, 0x82, 0x97, 0x60, 0xfe, 0x60, + 0x45, 0x55, 0xa2, 0xfd, 0x70, 0xd2, 0xeb, 0x6b, 0x4a, 0x04, 0xea, 0x84, 0xf1, 0xd0, 0x31, 0xbc, + 0xc3, 0x48, 0x53, 0xdd, 0x4b, 0x18, 0xcd, 0x59, 0x96, 0x53, 0xfd, 0x36, 0xf8, 0x0a, 0xa3, 0xfa, + 0xa2, 0x71, 0xa9, 0xbb, 0xda, 0x2a, 0x75, 0xec, 0x18, 0x9e, 0x15, 0x74, 0x29, 0xca, 0xba, 0xce, + 0xad, 0x22, 0xab, 0xba, 0x01, 0xee, 0x19, 0x98, 0x6f, 0x51, 0x92, 0xbc, 0xb0, 0xef, 0xc3, 0x20, + 0x61, 0x05, 0xe3, 0xfa, 0xb6, 0x0d, 0x70, 0x7f, 0xc1, 0xe8, 0x0d, 0xa5, 0xac, 0xa2, 0x09, 0x96, + 0x48, 0x65, 0xcd, 0xba, 0x62, 0x3c, 0x15, 0x2d, 0x4b, 0x81, 0xe0, 0x13, 0x0c, 0x0b, 0x56, 0xa5, + 0xb5, 0x97, 0xf6, 0x3f, 0xb5, 0x3b, 0xd6, 0x8c, 0x53, 0xd5, 0xde, 0xa3, 0x3e, 0xa5, 0x5b, 0x22, + 0xda, 0xaf, 0xa5, 0x66, 0x2b, 0xe9, 0xfe, 0x36, 0xe0, 0xe8, 0x43, 0x91, 0x5e, 0xc8, 0x9f, 0x05, + 0x7e, 0x24, 0x3c, 0xc1, 0xa2, 0x33, 0x91, 0x9d, 0xeb, 0x89, 0x9c, 0x80, 0xb9, 0xc4, 0x3c, 0x5b, + 0x4a, 0x35, 0x93, 0x41, 0xa4, 0x51, 0x20, 0xe1, 0x81, 0xb6, 0x2c, 0x16, 0x28, 0xe3, 0xeb, 0x92, + 0xf6, 0x93, 0xbe, 0x81, 0x6d, 0x91, 0xb6, 0xcb, 0x3f, 0x77, 0x54, 0x9b, 0x67, 0xfd, 0x36, 0x37, + 0x9b, 0x89, 0xee, 0x69, 0xf9, 0x0b, 0x94, 0xb3, 0x96, 0x18, 0xde, 0x6a, 0x5a, 0x83, 0xdb, 0x4d, + 0x2b, 0x8c, 0xe1, 0x50, 0xad, 0xeb, 0xff, 0xa9, 0x1f, 0x28, 0xf5, 0xc7, 0x93, 0xfe, 0xae, 0xcf, + 0xea, 0x67, 0xab, 0x3f, 0xc2, 0x0e, 0x0a, 0x5f, 0xc0, 0xe0, 0x2a, 0x4f, 0xe5, 0x72, 0xbb, 0xb0, + 0xa9, 0x7c, 0x6e, 0x98, 0xa1, 0x0f, 0x7b, 0x84, 0x23, 0xd9, 0x9e, 0xb1, 0xef, 0x18, 0xde, 0x6e, + 0xa4, 0x88, 0xe1, 0x3b, 0x30, 0xd3, 0x66, 0xe5, 0xb6, 0xa6, 0xdc, 0x75, 0x76, 0x3d, 0x2b, 0x38, + 0xe9, 0x7b, 0xd3, 0x6c, 0x6b, 0xa4, 0x25, 0xa6, 0xd3, 0x2f, 0xaf, 0xb3, 0x5c, 0x2e, 0xab, 0xc5, + 0x24, 0x61, 0xa5, 0x9f, 0xb1, 0x82, 0xd0, 0xcc, 0x57, 0x1f, 0xf3, 0xa2, 0xfa, 0xd6, 0x1c, 0x92, + 0xf3, 0x0c, 0xe9, 0x79, 0xc6, 0x7c, 0x89, 0x42, 0xa6, 0x44, 0x92, 0xde, 0x7f, 0xe5, 0x6f, 0x00, + 0x00, 0x00, 0xff, 0xff, 0xdf, 0x18, 0x64, 0x15, 0x77, 0x04, 0x00, 0x00, +} diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/extension_user.proto b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/extension_user/extension_user.proto similarity index 94% rename from vendor/github.com/golang/protobuf/protoc-gen-go/testdata/extension_user.proto rename to vendor/github.com/golang/protobuf/protoc-gen-go/testdata/extension_user/extension_user.proto index ff65873dd..033c186c0 100644 --- a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/extension_user.proto +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/extension_user/extension_user.proto @@ -31,11 +31,13 @@ syntax = "proto2"; -import "extension_base.proto"; -import "extension_extra.proto"; +import "extension_base/extension_base.proto"; +import "extension_extra/extension_extra.proto"; package extension_user; +option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/extension_user"; + message UserMessage { optional string name = 1; optional string rank = 2; diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/grpc/grpc.pb.go b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/grpc/grpc.pb.go new file mode 100644 index 000000000..0bb4cbfd1 --- /dev/null +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/grpc/grpc.pb.go @@ -0,0 +1,444 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: grpc/grpc.proto + +package testing // import "github.com/golang/protobuf/protoc-gen-go/testdata/grpc" + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +import ( + context "golang.org/x/net/context" + grpc "google.golang.org/grpc" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type SimpleRequest struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SimpleRequest) Reset() { *m = SimpleRequest{} } +func (m *SimpleRequest) String() string { return proto.CompactTextString(m) } +func (*SimpleRequest) ProtoMessage() {} +func (*SimpleRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_grpc_65bf3902e49ee873, []int{0} +} +func (m *SimpleRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SimpleRequest.Unmarshal(m, b) +} +func (m *SimpleRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SimpleRequest.Marshal(b, m, deterministic) +} +func (dst *SimpleRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_SimpleRequest.Merge(dst, src) +} +func (m *SimpleRequest) XXX_Size() int { + return xxx_messageInfo_SimpleRequest.Size(m) +} +func (m *SimpleRequest) XXX_DiscardUnknown() { + xxx_messageInfo_SimpleRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_SimpleRequest proto.InternalMessageInfo + +type SimpleResponse struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SimpleResponse) Reset() { *m = SimpleResponse{} } +func (m *SimpleResponse) String() string { return proto.CompactTextString(m) } +func (*SimpleResponse) ProtoMessage() {} +func (*SimpleResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_grpc_65bf3902e49ee873, []int{1} +} +func (m *SimpleResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SimpleResponse.Unmarshal(m, b) +} +func (m *SimpleResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SimpleResponse.Marshal(b, m, deterministic) +} +func (dst *SimpleResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_SimpleResponse.Merge(dst, src) +} +func (m *SimpleResponse) XXX_Size() int { + return xxx_messageInfo_SimpleResponse.Size(m) +} +func (m *SimpleResponse) XXX_DiscardUnknown() { + xxx_messageInfo_SimpleResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_SimpleResponse proto.InternalMessageInfo + +type StreamMsg struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StreamMsg) Reset() { *m = StreamMsg{} } +func (m *StreamMsg) String() string { return proto.CompactTextString(m) } +func (*StreamMsg) ProtoMessage() {} +func (*StreamMsg) Descriptor() ([]byte, []int) { + return fileDescriptor_grpc_65bf3902e49ee873, []int{2} +} +func (m *StreamMsg) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_StreamMsg.Unmarshal(m, b) +} +func (m *StreamMsg) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_StreamMsg.Marshal(b, m, deterministic) +} +func (dst *StreamMsg) XXX_Merge(src proto.Message) { + xxx_messageInfo_StreamMsg.Merge(dst, src) +} +func (m *StreamMsg) XXX_Size() int { + return xxx_messageInfo_StreamMsg.Size(m) +} +func (m *StreamMsg) XXX_DiscardUnknown() { + xxx_messageInfo_StreamMsg.DiscardUnknown(m) +} + +var xxx_messageInfo_StreamMsg proto.InternalMessageInfo + +type StreamMsg2 struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StreamMsg2) Reset() { *m = StreamMsg2{} } +func (m *StreamMsg2) String() string { return proto.CompactTextString(m) } +func (*StreamMsg2) ProtoMessage() {} +func (*StreamMsg2) Descriptor() ([]byte, []int) { + return fileDescriptor_grpc_65bf3902e49ee873, []int{3} +} +func (m *StreamMsg2) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_StreamMsg2.Unmarshal(m, b) +} +func (m *StreamMsg2) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_StreamMsg2.Marshal(b, m, deterministic) +} +func (dst *StreamMsg2) XXX_Merge(src proto.Message) { + xxx_messageInfo_StreamMsg2.Merge(dst, src) +} +func (m *StreamMsg2) XXX_Size() int { + return xxx_messageInfo_StreamMsg2.Size(m) +} +func (m *StreamMsg2) XXX_DiscardUnknown() { + xxx_messageInfo_StreamMsg2.DiscardUnknown(m) +} + +var xxx_messageInfo_StreamMsg2 proto.InternalMessageInfo + +func init() { + proto.RegisterType((*SimpleRequest)(nil), "grpc.testing.SimpleRequest") + proto.RegisterType((*SimpleResponse)(nil), "grpc.testing.SimpleResponse") + proto.RegisterType((*StreamMsg)(nil), "grpc.testing.StreamMsg") + proto.RegisterType((*StreamMsg2)(nil), "grpc.testing.StreamMsg2") +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// Client API for Test service + +type TestClient interface { + UnaryCall(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (*SimpleResponse, error) + // This RPC streams from the server only. + Downstream(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (Test_DownstreamClient, error) + // This RPC streams from the client. + Upstream(ctx context.Context, opts ...grpc.CallOption) (Test_UpstreamClient, error) + // This one streams in both directions. + Bidi(ctx context.Context, opts ...grpc.CallOption) (Test_BidiClient, error) +} + +type testClient struct { + cc *grpc.ClientConn +} + +func NewTestClient(cc *grpc.ClientConn) TestClient { + return &testClient{cc} +} + +func (c *testClient) UnaryCall(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (*SimpleResponse, error) { + out := new(SimpleResponse) + err := grpc.Invoke(ctx, "/grpc.testing.Test/UnaryCall", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *testClient) Downstream(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (Test_DownstreamClient, error) { + stream, err := grpc.NewClientStream(ctx, &_Test_serviceDesc.Streams[0], c.cc, "/grpc.testing.Test/Downstream", opts...) + if err != nil { + return nil, err + } + x := &testDownstreamClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type Test_DownstreamClient interface { + Recv() (*StreamMsg, error) + grpc.ClientStream +} + +type testDownstreamClient struct { + grpc.ClientStream +} + +func (x *testDownstreamClient) Recv() (*StreamMsg, error) { + m := new(StreamMsg) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *testClient) Upstream(ctx context.Context, opts ...grpc.CallOption) (Test_UpstreamClient, error) { + stream, err := grpc.NewClientStream(ctx, &_Test_serviceDesc.Streams[1], c.cc, "/grpc.testing.Test/Upstream", opts...) + if err != nil { + return nil, err + } + x := &testUpstreamClient{stream} + return x, nil +} + +type Test_UpstreamClient interface { + Send(*StreamMsg) error + CloseAndRecv() (*SimpleResponse, error) + grpc.ClientStream +} + +type testUpstreamClient struct { + grpc.ClientStream +} + +func (x *testUpstreamClient) Send(m *StreamMsg) error { + return x.ClientStream.SendMsg(m) +} + +func (x *testUpstreamClient) CloseAndRecv() (*SimpleResponse, error) { + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + m := new(SimpleResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *testClient) Bidi(ctx context.Context, opts ...grpc.CallOption) (Test_BidiClient, error) { + stream, err := grpc.NewClientStream(ctx, &_Test_serviceDesc.Streams[2], c.cc, "/grpc.testing.Test/Bidi", opts...) + if err != nil { + return nil, err + } + x := &testBidiClient{stream} + return x, nil +} + +type Test_BidiClient interface { + Send(*StreamMsg) error + Recv() (*StreamMsg2, error) + grpc.ClientStream +} + +type testBidiClient struct { + grpc.ClientStream +} + +func (x *testBidiClient) Send(m *StreamMsg) error { + return x.ClientStream.SendMsg(m) +} + +func (x *testBidiClient) Recv() (*StreamMsg2, error) { + m := new(StreamMsg2) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +// Server API for Test service + +type TestServer interface { + UnaryCall(context.Context, *SimpleRequest) (*SimpleResponse, error) + // This RPC streams from the server only. + Downstream(*SimpleRequest, Test_DownstreamServer) error + // This RPC streams from the client. + Upstream(Test_UpstreamServer) error + // This one streams in both directions. + Bidi(Test_BidiServer) error +} + +func RegisterTestServer(s *grpc.Server, srv TestServer) { + s.RegisterService(&_Test_serviceDesc, srv) +} + +func _Test_UnaryCall_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SimpleRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TestServer).UnaryCall(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.testing.Test/UnaryCall", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TestServer).UnaryCall(ctx, req.(*SimpleRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Test_Downstream_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(SimpleRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(TestServer).Downstream(m, &testDownstreamServer{stream}) +} + +type Test_DownstreamServer interface { + Send(*StreamMsg) error + grpc.ServerStream +} + +type testDownstreamServer struct { + grpc.ServerStream +} + +func (x *testDownstreamServer) Send(m *StreamMsg) error { + return x.ServerStream.SendMsg(m) +} + +func _Test_Upstream_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(TestServer).Upstream(&testUpstreamServer{stream}) +} + +type Test_UpstreamServer interface { + SendAndClose(*SimpleResponse) error + Recv() (*StreamMsg, error) + grpc.ServerStream +} + +type testUpstreamServer struct { + grpc.ServerStream +} + +func (x *testUpstreamServer) SendAndClose(m *SimpleResponse) error { + return x.ServerStream.SendMsg(m) +} + +func (x *testUpstreamServer) Recv() (*StreamMsg, error) { + m := new(StreamMsg) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func _Test_Bidi_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(TestServer).Bidi(&testBidiServer{stream}) +} + +type Test_BidiServer interface { + Send(*StreamMsg2) error + Recv() (*StreamMsg, error) + grpc.ServerStream +} + +type testBidiServer struct { + grpc.ServerStream +} + +func (x *testBidiServer) Send(m *StreamMsg2) error { + return x.ServerStream.SendMsg(m) +} + +func (x *testBidiServer) Recv() (*StreamMsg, error) { + m := new(StreamMsg) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +var _Test_serviceDesc = grpc.ServiceDesc{ + ServiceName: "grpc.testing.Test", + HandlerType: (*TestServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "UnaryCall", + Handler: _Test_UnaryCall_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "Downstream", + Handler: _Test_Downstream_Handler, + ServerStreams: true, + }, + { + StreamName: "Upstream", + Handler: _Test_Upstream_Handler, + ClientStreams: true, + }, + { + StreamName: "Bidi", + Handler: _Test_Bidi_Handler, + ServerStreams: true, + ClientStreams: true, + }, + }, + Metadata: "grpc/grpc.proto", +} + +func init() { proto.RegisterFile("grpc/grpc.proto", fileDescriptor_grpc_65bf3902e49ee873) } + +var fileDescriptor_grpc_65bf3902e49ee873 = []byte{ + // 244 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x4f, 0x2f, 0x2a, 0x48, + 0xd6, 0x07, 0x11, 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, 0x3c, 0x60, 0x76, 0x49, 0x6a, 0x71, + 0x49, 0x66, 0x5e, 0xba, 0x12, 0x3f, 0x17, 0x6f, 0x70, 0x66, 0x6e, 0x41, 0x4e, 0x6a, 0x50, 0x6a, + 0x61, 0x69, 0x6a, 0x71, 0x89, 0x92, 0x00, 0x17, 0x1f, 0x4c, 0xa0, 0xb8, 0x20, 0x3f, 0xaf, 0x38, + 0x55, 0x89, 0x9b, 0x8b, 0x33, 0xb8, 0xa4, 0x28, 0x35, 0x31, 0xd7, 0xb7, 0x38, 0x5d, 0x89, 0x87, + 0x8b, 0x0b, 0xce, 0x31, 0x32, 0x9a, 0xc1, 0xc4, 0xc5, 0x12, 0x92, 0x5a, 0x5c, 0x22, 0xe4, 0xc6, + 0xc5, 0x19, 0x9a, 0x97, 0x58, 0x54, 0xe9, 0x9c, 0x98, 0x93, 0x23, 0x24, 0xad, 0x87, 0x6c, 0x85, + 0x1e, 0x8a, 0xf9, 0x52, 0x32, 0xd8, 0x25, 0x21, 0x76, 0x09, 0xb9, 0x70, 0x71, 0xb9, 0xe4, 0x97, + 0xe7, 0x15, 0x83, 0xad, 0xc0, 0x6f, 0x90, 0x38, 0x9a, 0x24, 0xcc, 0x55, 0x06, 0x8c, 0x42, 0xce, + 0x5c, 0x1c, 0xa1, 0x05, 0x50, 0x33, 0x70, 0x29, 0xc3, 0xef, 0x10, 0x0d, 0x46, 0x21, 0x5b, 0x2e, + 0x16, 0xa7, 0xcc, 0x94, 0x4c, 0xdc, 0x06, 0x48, 0xe0, 0x90, 0x30, 0xd2, 0x60, 0x34, 0x60, 0x74, + 0x72, 0x88, 0xb2, 0x4b, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xcf, + 0xcf, 0x49, 0xcc, 0x4b, 0xd7, 0x07, 0xc7, 0x40, 0x52, 0x69, 0x1a, 0x84, 0x91, 0xac, 0x9b, 0x9e, + 0x9a, 0xa7, 0x9b, 0x9e, 0xaf, 0x0f, 0x32, 0x22, 0x25, 0xb1, 0x24, 0x11, 0x1c, 0x4d, 0xd6, 0x50, + 0x03, 0x93, 0xd8, 0xc0, 0x8a, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x90, 0xb9, 0x95, 0x42, + 0xc2, 0x01, 0x00, 0x00, +} diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/grpc.proto b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/grpc/grpc.proto similarity index 96% rename from vendor/github.com/golang/protobuf/protoc-gen-go/testdata/grpc.proto rename to vendor/github.com/golang/protobuf/protoc-gen-go/testdata/grpc/grpc.proto index b8bc41acd..0e5c64a91 100644 --- a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/grpc.proto +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/grpc/grpc.proto @@ -33,6 +33,8 @@ syntax = "proto3"; package grpc.testing; +option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/grpc;testing"; + message SimpleRequest { } diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imp.pb.go.golden b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imp.pb.go.golden deleted file mode 100644 index 784a4f865..000000000 --- a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imp.pb.go.golden +++ /dev/null @@ -1,113 +0,0 @@ -// Code generated by protoc-gen-go. -// source: imp.proto -// DO NOT EDIT! - -package imp - -import proto "github.com/golang/protobuf/proto" -import "math" -import "os" -import imp1 "imp2.pb" - -// Reference proto & math imports to suppress error if they are not otherwise used. -var _ = proto.GetString -var _ = math.Inf - -// Types from public import imp2.proto -type PubliclyImportedMessage imp1.PubliclyImportedMessage - -func (this *PubliclyImportedMessage) Reset() { (*imp1.PubliclyImportedMessage)(this).Reset() } -func (this *PubliclyImportedMessage) String() string { - return (*imp1.PubliclyImportedMessage)(this).String() -} - -// PubliclyImportedMessage from public import imp.proto - -type ImportedMessage_Owner int32 - -const ( - ImportedMessage_DAVE ImportedMessage_Owner = 1 - ImportedMessage_MIKE ImportedMessage_Owner = 2 -) - -var ImportedMessage_Owner_name = map[int32]string{ - 1: "DAVE", - 2: "MIKE", -} -var ImportedMessage_Owner_value = map[string]int32{ - "DAVE": 1, - "MIKE": 2, -} - -// NewImportedMessage_Owner is deprecated. Use x.Enum() instead. -func NewImportedMessage_Owner(x ImportedMessage_Owner) *ImportedMessage_Owner { - e := ImportedMessage_Owner(x) - return &e -} -func (x ImportedMessage_Owner) Enum() *ImportedMessage_Owner { - p := new(ImportedMessage_Owner) - *p = x - return p -} -func (x ImportedMessage_Owner) String() string { - return proto.EnumName(ImportedMessage_Owner_name, int32(x)) -} - -type ImportedMessage struct { - Field *int64 `protobuf:"varint,1,req,name=field" json:"field,omitempty"` - XXX_extensions map[int32][]byte `json:",omitempty"` - XXX_unrecognized []byte `json:",omitempty"` -} - -func (this *ImportedMessage) Reset() { *this = ImportedMessage{} } -func (this *ImportedMessage) String() string { return proto.CompactTextString(this) } - -var extRange_ImportedMessage = []proto.ExtensionRange{ - proto.ExtensionRange{90, 100}, -} - -func (*ImportedMessage) ExtensionRangeArray() []proto.ExtensionRange { - return extRange_ImportedMessage -} -func (this *ImportedMessage) ExtensionMap() map[int32][]byte { - if this.XXX_extensions == nil { - this.XXX_extensions = make(map[int32][]byte) - } - return this.XXX_extensions -} - -type ImportedExtendable struct { - XXX_extensions map[int32][]byte `json:",omitempty"` - XXX_unrecognized []byte `json:",omitempty"` -} - -func (this *ImportedExtendable) Reset() { *this = ImportedExtendable{} } -func (this *ImportedExtendable) String() string { return proto.CompactTextString(this) } - -func (this *ImportedExtendable) Marshal() ([]byte, error) { - return proto.MarshalMessageSet(this.ExtensionMap()) -} -func (this *ImportedExtendable) Unmarshal(buf []byte) error { - return proto.UnmarshalMessageSet(buf, this.ExtensionMap()) -} -// ensure ImportedExtendable satisfies proto.Marshaler and proto.Unmarshaler -var _ proto.Marshaler = (*ImportedExtendable)(nil) -var _ proto.Unmarshaler = (*ImportedExtendable)(nil) - -var extRange_ImportedExtendable = []proto.ExtensionRange{ - proto.ExtensionRange{100, 536870911}, -} - -func (*ImportedExtendable) ExtensionRangeArray() []proto.ExtensionRange { - return extRange_ImportedExtendable -} -func (this *ImportedExtendable) ExtensionMap() map[int32][]byte { - if this.XXX_extensions == nil { - this.XXX_extensions = make(map[int32][]byte) - } - return this.XXX_extensions -} - -func init() { - proto.RegisterEnum("imp.ImportedMessage_Owner", ImportedMessage_Owner_name, ImportedMessage_Owner_value) -} diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/import_public/a.pb.go b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/import_public/a.pb.go new file mode 100644 index 000000000..5b780fd5c --- /dev/null +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/import_public/a.pb.go @@ -0,0 +1,110 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: import_public/a.proto + +package import_public // import "github.com/golang/protobuf/protoc-gen-go/testdata/import_public" + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" +import sub "github.com/golang/protobuf/protoc-gen-go/testdata/import_public/sub" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +// M from public import import_public/sub/a.proto +type M = sub.M + +// E from public import import_public/sub/a.proto +type E = sub.E + +var E_name = sub.E_name +var E_value = sub.E_value + +const E_ZERO = E(sub.E_ZERO) + +// Ignoring public import of Local from import_public/b.proto + +type Public struct { + M *sub.M `protobuf:"bytes,1,opt,name=m" json:"m,omitempty"` + E sub.E `protobuf:"varint,2,opt,name=e,enum=goproto.test.import_public.sub.E" json:"e,omitempty"` + Local *Local `protobuf:"bytes,3,opt,name=local" json:"local,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Public) Reset() { *m = Public{} } +func (m *Public) String() string { return proto.CompactTextString(m) } +func (*Public) ProtoMessage() {} +func (*Public) Descriptor() ([]byte, []int) { + return fileDescriptor_a_c0314c022b7c17d8, []int{0} +} +func (m *Public) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Public.Unmarshal(m, b) +} +func (m *Public) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Public.Marshal(b, m, deterministic) +} +func (dst *Public) XXX_Merge(src proto.Message) { + xxx_messageInfo_Public.Merge(dst, src) +} +func (m *Public) XXX_Size() int { + return xxx_messageInfo_Public.Size(m) +} +func (m *Public) XXX_DiscardUnknown() { + xxx_messageInfo_Public.DiscardUnknown(m) +} + +var xxx_messageInfo_Public proto.InternalMessageInfo + +func (m *Public) GetM() *sub.M { + if m != nil { + return m.M + } + return nil +} + +func (m *Public) GetE() sub.E { + if m != nil { + return m.E + } + return sub.E_ZERO +} + +func (m *Public) GetLocal() *Local { + if m != nil { + return m.Local + } + return nil +} + +func init() { + proto.RegisterType((*Public)(nil), "goproto.test.import_public.Public") +} + +func init() { proto.RegisterFile("import_public/a.proto", fileDescriptor_a_c0314c022b7c17d8) } + +var fileDescriptor_a_c0314c022b7c17d8 = []byte{ + // 200 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xcd, 0xcc, 0x2d, 0xc8, + 0x2f, 0x2a, 0x89, 0x2f, 0x28, 0x4d, 0xca, 0xc9, 0x4c, 0xd6, 0x4f, 0xd4, 0x2b, 0x28, 0xca, 0x2f, + 0xc9, 0x17, 0x92, 0x4a, 0xcf, 0x07, 0x33, 0xf4, 0x4a, 0x52, 0x8b, 0x4b, 0xf4, 0x50, 0xd4, 0x48, + 0x49, 0xa2, 0x6a, 0x29, 0x2e, 0x4d, 0x82, 0x69, 0x93, 0x42, 0x33, 0x2d, 0x09, 0x22, 0xac, 0xb4, + 0x98, 0x91, 0x8b, 0x2d, 0x00, 0x2c, 0x24, 0xa4, 0xcf, 0xc5, 0x98, 0x2b, 0xc1, 0xa8, 0xc0, 0xa8, + 0xc1, 0x6d, 0xa4, 0xa8, 0x87, 0xdb, 0x12, 0xbd, 0xe2, 0xd2, 0x24, 0x3d, 0xdf, 0x20, 0xc6, 0x5c, + 0x90, 0x86, 0x54, 0x09, 0x26, 0x05, 0x46, 0x0d, 0x3e, 0xc2, 0x1a, 0x5c, 0x83, 0x18, 0x53, 0x85, + 0xcc, 0xb9, 0x58, 0x73, 0xf2, 0x93, 0x13, 0x73, 0x24, 0x98, 0x09, 0xdb, 0xe2, 0x03, 0x52, 0x18, + 0x04, 0x51, 0xef, 0xe4, 0x18, 0x65, 0x9f, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, + 0xab, 0x9f, 0x9e, 0x9f, 0x93, 0x98, 0x97, 0xae, 0x0f, 0xd6, 0x9a, 0x54, 0x9a, 0x06, 0x61, 0x24, + 0xeb, 0xa6, 0xa7, 0xe6, 0xe9, 0xa6, 0xe7, 0xeb, 0x83, 0xcc, 0x4a, 0x49, 0x2c, 0x49, 0xd4, 0x47, + 0x31, 0x2f, 0x80, 0x21, 0x80, 0x31, 0x89, 0x0d, 0xac, 0xd2, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, + 0x70, 0xc5, 0xc3, 0x79, 0x5a, 0x01, 0x00, 0x00, +} diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/import_public/a.proto b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/import_public/a.proto new file mode 100644 index 000000000..957ad8971 --- /dev/null +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/import_public/a.proto @@ -0,0 +1,45 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2018 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +syntax = "proto3"; + +package goproto.test.import_public; + +option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/import_public"; + +import public "import_public/sub/a.proto"; // Different Go package. +import public "import_public/b.proto"; // Same Go package. + +message Public { + goproto.test.import_public.sub.M m = 1; + goproto.test.import_public.sub.E e = 2; + Local local = 3; +} diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/import_public/b.pb.go b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/import_public/b.pb.go new file mode 100644 index 000000000..427aa4f32 --- /dev/null +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/import_public/b.pb.go @@ -0,0 +1,87 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: import_public/b.proto + +package import_public // import "github.com/golang/protobuf/protoc-gen-go/testdata/import_public" + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" +import sub "github.com/golang/protobuf/protoc-gen-go/testdata/import_public/sub" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type Local struct { + M *sub.M `protobuf:"bytes,1,opt,name=m" json:"m,omitempty"` + E sub.E `protobuf:"varint,2,opt,name=e,enum=goproto.test.import_public.sub.E" json:"e,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Local) Reset() { *m = Local{} } +func (m *Local) String() string { return proto.CompactTextString(m) } +func (*Local) ProtoMessage() {} +func (*Local) Descriptor() ([]byte, []int) { + return fileDescriptor_b_7f20a805fad67bd0, []int{0} +} +func (m *Local) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Local.Unmarshal(m, b) +} +func (m *Local) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Local.Marshal(b, m, deterministic) +} +func (dst *Local) XXX_Merge(src proto.Message) { + xxx_messageInfo_Local.Merge(dst, src) +} +func (m *Local) XXX_Size() int { + return xxx_messageInfo_Local.Size(m) +} +func (m *Local) XXX_DiscardUnknown() { + xxx_messageInfo_Local.DiscardUnknown(m) +} + +var xxx_messageInfo_Local proto.InternalMessageInfo + +func (m *Local) GetM() *sub.M { + if m != nil { + return m.M + } + return nil +} + +func (m *Local) GetE() sub.E { + if m != nil { + return m.E + } + return sub.E_ZERO +} + +func init() { + proto.RegisterType((*Local)(nil), "goproto.test.import_public.Local") +} + +func init() { proto.RegisterFile("import_public/b.proto", fileDescriptor_b_7f20a805fad67bd0) } + +var fileDescriptor_b_7f20a805fad67bd0 = []byte{ + // 174 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xcd, 0xcc, 0x2d, 0xc8, + 0x2f, 0x2a, 0x89, 0x2f, 0x28, 0x4d, 0xca, 0xc9, 0x4c, 0xd6, 0x4f, 0xd2, 0x2b, 0x28, 0xca, 0x2f, + 0xc9, 0x17, 0x92, 0x4a, 0xcf, 0x07, 0x33, 0xf4, 0x4a, 0x52, 0x8b, 0x4b, 0xf4, 0x50, 0xd4, 0x48, + 0x49, 0xa2, 0x6a, 0x29, 0x2e, 0x4d, 0xd2, 0x4f, 0x84, 0x68, 0x53, 0xca, 0xe4, 0x62, 0xf5, 0xc9, + 0x4f, 0x4e, 0xcc, 0x11, 0xd2, 0xe7, 0x62, 0xcc, 0x95, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x36, 0x52, + 0xd4, 0xc3, 0x6d, 0x96, 0x5e, 0x71, 0x69, 0x92, 0x9e, 0x6f, 0x10, 0x63, 0x2e, 0x48, 0x43, 0xaa, + 0x04, 0x93, 0x02, 0xa3, 0x06, 0x1f, 0x61, 0x0d, 0xae, 0x41, 0x8c, 0xa9, 0x4e, 0x8e, 0x51, 0xf6, + 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0xe9, 0xf9, 0x39, 0x89, 0x79, + 0xe9, 0xfa, 0x60, 0x6d, 0x49, 0xa5, 0x69, 0x10, 0x46, 0xb2, 0x6e, 0x7a, 0x6a, 0x9e, 0x6e, 0x7a, + 0xbe, 0x3e, 0xc8, 0x9c, 0x94, 0xc4, 0x92, 0x44, 0x7d, 0x14, 0xb3, 0x92, 0xd8, 0xc0, 0xaa, 0x8c, + 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xd6, 0x2b, 0x5f, 0x8e, 0x04, 0x01, 0x00, 0x00, +} diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/import_public/b.proto b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/import_public/b.proto new file mode 100644 index 000000000..1dbca3e49 --- /dev/null +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/import_public/b.proto @@ -0,0 +1,43 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2018 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +syntax = "proto3"; + +package goproto.test.import_public; + +option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/import_public"; + +import "import_public/sub/a.proto"; + +message Local { + goproto.test.import_public.sub.M m = 1; + goproto.test.import_public.sub.E e = 2; +} diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/import_public/sub/a.pb.go b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/import_public/sub/a.pb.go new file mode 100644 index 000000000..4f8f6d243 --- /dev/null +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/import_public/sub/a.pb.go @@ -0,0 +1,100 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: import_public/sub/a.proto + +package sub // import "github.com/golang/protobuf/protoc-gen-go/testdata/import_public/sub" + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type E int32 + +const ( + E_ZERO E = 0 +) + +var E_name = map[int32]string{ + 0: "ZERO", +} +var E_value = map[string]int32{ + "ZERO": 0, +} + +func (x E) String() string { + return proto.EnumName(E_name, int32(x)) +} +func (E) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_a_91ca0264a534463a, []int{0} +} + +type M struct { + // Field using a type in the same Go package, but a different source file. + M2 *M2 `protobuf:"bytes,1,opt,name=m2" json:"m2,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *M) Reset() { *m = M{} } +func (m *M) String() string { return proto.CompactTextString(m) } +func (*M) ProtoMessage() {} +func (*M) Descriptor() ([]byte, []int) { + return fileDescriptor_a_91ca0264a534463a, []int{0} +} +func (m *M) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_M.Unmarshal(m, b) +} +func (m *M) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_M.Marshal(b, m, deterministic) +} +func (dst *M) XXX_Merge(src proto.Message) { + xxx_messageInfo_M.Merge(dst, src) +} +func (m *M) XXX_Size() int { + return xxx_messageInfo_M.Size(m) +} +func (m *M) XXX_DiscardUnknown() { + xxx_messageInfo_M.DiscardUnknown(m) +} + +var xxx_messageInfo_M proto.InternalMessageInfo + +func (m *M) GetM2() *M2 { + if m != nil { + return m.M2 + } + return nil +} + +func init() { + proto.RegisterType((*M)(nil), "goproto.test.import_public.sub.M") + proto.RegisterEnum("goproto.test.import_public.sub.E", E_name, E_value) +} + +func init() { proto.RegisterFile("import_public/sub/a.proto", fileDescriptor_a_91ca0264a534463a) } + +var fileDescriptor_a_91ca0264a534463a = []byte{ + // 172 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcc, 0xcc, 0x2d, 0xc8, + 0x2f, 0x2a, 0x89, 0x2f, 0x28, 0x4d, 0xca, 0xc9, 0x4c, 0xd6, 0x2f, 0x2e, 0x4d, 0xd2, 0x4f, 0xd4, + 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, 0x4b, 0xcf, 0x07, 0x33, 0xf4, 0x4a, 0x52, 0x8b, 0x4b, + 0xf4, 0x50, 0xd4, 0xe9, 0x15, 0x97, 0x26, 0x49, 0x61, 0xd1, 0x9a, 0x04, 0xd1, 0xaa, 0x64, 0xce, + 0xc5, 0xe8, 0x2b, 0x64, 0xc4, 0xc5, 0x94, 0x6b, 0x24, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0x6d, 0xa4, + 0xa4, 0x87, 0xdf, 0x30, 0x3d, 0x5f, 0xa3, 0x20, 0xa6, 0x5c, 0x23, 0x2d, 0x5e, 0x2e, 0x46, 0x57, + 0x21, 0x0e, 0x2e, 0x96, 0x28, 0xd7, 0x20, 0x7f, 0x01, 0x06, 0x27, 0xd7, 0x28, 0xe7, 0xf4, 0xcc, + 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0xfd, 0xf4, 0xfc, 0x9c, 0xc4, 0xbc, 0x74, 0x7d, + 0xb0, 0x39, 0x49, 0xa5, 0x69, 0x10, 0x46, 0xb2, 0x6e, 0x7a, 0x6a, 0x9e, 0x6e, 0x7a, 0xbe, 0x3e, + 0xc8, 0xe0, 0x94, 0xc4, 0x92, 0x44, 0x7d, 0x0c, 0x67, 0x25, 0xb1, 0x81, 0x55, 0x1a, 0x03, 0x02, + 0x00, 0x00, 0xff, 0xff, 0x81, 0xcc, 0x07, 0x7d, 0xed, 0x00, 0x00, 0x00, +} diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imp.proto b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/import_public/sub/a.proto similarity index 67% rename from vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imp.proto rename to vendor/github.com/golang/protobuf/protoc-gen-go/testdata/import_public/sub/a.proto index 156e078d1..4494c818a 100644 --- a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imp.proto +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/import_public/sub/a.proto @@ -1,6 +1,6 @@ // Go support for Protocol Buffers - Google's data interchange format // -// Copyright 2010 The Go Authors. All rights reserved. +// Copyright 2018 The Go Authors. All rights reserved. // https://github.com/golang/protobuf // // Redistribution and use in source and binary forms, with or without @@ -29,42 +29,19 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -syntax = "proto2"; +syntax = "proto3"; -package imp; +package goproto.test.import_public.sub; -import "imp2.proto"; -import "imp3.proto"; +option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/import_public/sub"; -message ImportedMessage { - required int64 field = 1; +import "import_public/sub/b.proto"; - // The forwarded getters for these fields are fiddly to get right. - optional ImportedMessage2 local_msg = 2; - optional ForeignImportedMessage foreign_msg = 3; // in imp3.proto - optional Owner enum_field = 4; - oneof union { - int32 state = 9; - } - - repeated string name = 5; - repeated Owner boss = 6; - repeated ImportedMessage2 memo = 7; - - map msg_map = 8; - - enum Owner { - DAVE = 1; - MIKE = 2; - } - - extensions 90 to 100; -} - -message ImportedMessage2 { +message M { + // Field using a type in the same Go package, but a different source file. + M2 m2 = 1; } -message ImportedExtendable { - option message_set_wire_format = true; - extensions 100 to max; +enum E { + ZERO = 0; } diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/import_public/sub/b.pb.go b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/import_public/sub/b.pb.go new file mode 100644 index 000000000..d57a3bb9a --- /dev/null +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/import_public/sub/b.pb.go @@ -0,0 +1,67 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: import_public/sub/b.proto + +package sub // import "github.com/golang/protobuf/protoc-gen-go/testdata/import_public/sub" + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type M2 struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *M2) Reset() { *m = M2{} } +func (m *M2) String() string { return proto.CompactTextString(m) } +func (*M2) ProtoMessage() {} +func (*M2) Descriptor() ([]byte, []int) { + return fileDescriptor_b_eba25180453d86b4, []int{0} +} +func (m *M2) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_M2.Unmarshal(m, b) +} +func (m *M2) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_M2.Marshal(b, m, deterministic) +} +func (dst *M2) XXX_Merge(src proto.Message) { + xxx_messageInfo_M2.Merge(dst, src) +} +func (m *M2) XXX_Size() int { + return xxx_messageInfo_M2.Size(m) +} +func (m *M2) XXX_DiscardUnknown() { + xxx_messageInfo_M2.DiscardUnknown(m) +} + +var xxx_messageInfo_M2 proto.InternalMessageInfo + +func init() { + proto.RegisterType((*M2)(nil), "goproto.test.import_public.sub.M2") +} + +func init() { proto.RegisterFile("import_public/sub/b.proto", fileDescriptor_b_eba25180453d86b4) } + +var fileDescriptor_b_eba25180453d86b4 = []byte{ + // 127 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcc, 0xcc, 0x2d, 0xc8, + 0x2f, 0x2a, 0x89, 0x2f, 0x28, 0x4d, 0xca, 0xc9, 0x4c, 0xd6, 0x2f, 0x2e, 0x4d, 0xd2, 0x4f, 0xd2, + 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, 0x4b, 0xcf, 0x07, 0x33, 0xf4, 0x4a, 0x52, 0x8b, 0x4b, + 0xf4, 0x50, 0xd4, 0xe9, 0x15, 0x97, 0x26, 0x29, 0xb1, 0x70, 0x31, 0xf9, 0x1a, 0x39, 0xb9, 0x46, + 0x39, 0xa7, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0xa7, 0xe7, 0xe7, 0x24, + 0xe6, 0xa5, 0xeb, 0x83, 0xf5, 0x25, 0x95, 0xa6, 0x41, 0x18, 0xc9, 0xba, 0xe9, 0xa9, 0x79, 0xba, + 0xe9, 0xf9, 0xfa, 0x20, 0x83, 0x52, 0x12, 0x4b, 0x12, 0xf5, 0x31, 0x2c, 0x4d, 0x62, 0x03, 0xab, + 0x34, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x64, 0x42, 0xe4, 0xa8, 0x90, 0x00, 0x00, 0x00, +} diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/import_public/sub/b.proto b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/import_public/sub/b.proto new file mode 100644 index 000000000..c7299e0f2 --- /dev/null +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/import_public/sub/b.proto @@ -0,0 +1,39 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2018 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +syntax = "proto3"; + +package goproto.test.import_public.sub; + +option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/import_public/sub"; + +message M2 { +} diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imports/fmt/m.pb.go b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imports/fmt/m.pb.go new file mode 100644 index 000000000..ca312d6cc --- /dev/null +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imports/fmt/m.pb.go @@ -0,0 +1,66 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: imports/fmt/m.proto + +package fmt // import "github.com/golang/protobuf/protoc-gen-go/testdata/imports/fmt" + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type M struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *M) Reset() { *m = M{} } +func (m *M) String() string { return proto.CompactTextString(m) } +func (*M) ProtoMessage() {} +func (*M) Descriptor() ([]byte, []int) { + return fileDescriptor_m_867dd34c461422b8, []int{0} +} +func (m *M) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_M.Unmarshal(m, b) +} +func (m *M) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_M.Marshal(b, m, deterministic) +} +func (dst *M) XXX_Merge(src proto.Message) { + xxx_messageInfo_M.Merge(dst, src) +} +func (m *M) XXX_Size() int { + return xxx_messageInfo_M.Size(m) +} +func (m *M) XXX_DiscardUnknown() { + xxx_messageInfo_M.DiscardUnknown(m) +} + +var xxx_messageInfo_M proto.InternalMessageInfo + +func init() { + proto.RegisterType((*M)(nil), "fmt.M") +} + +func init() { proto.RegisterFile("imports/fmt/m.proto", fileDescriptor_m_867dd34c461422b8) } + +var fileDescriptor_m_867dd34c461422b8 = []byte{ + // 109 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xce, 0xcc, 0x2d, 0xc8, + 0x2f, 0x2a, 0x29, 0xd6, 0x4f, 0xcb, 0x2d, 0xd1, 0xcf, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, + 0x62, 0x4e, 0xcb, 0x2d, 0x51, 0x62, 0xe6, 0x62, 0xf4, 0x75, 0xb2, 0x8f, 0xb2, 0x4d, 0xcf, 0x2c, + 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xcf, 0xcf, 0x49, 0xcc, 0x4b, 0xd7, 0x07, + 0x2b, 0x4a, 0x2a, 0x4d, 0x83, 0x30, 0x92, 0x75, 0xd3, 0x53, 0xf3, 0x74, 0xd3, 0xf3, 0xf5, 0x4b, + 0x52, 0x8b, 0x4b, 0x52, 0x12, 0x4b, 0x12, 0xf5, 0x91, 0x8c, 0x4c, 0x62, 0x03, 0xab, 0x31, 0x06, + 0x04, 0x00, 0x00, 0xff, 0xff, 0xc4, 0xc9, 0xee, 0xbe, 0x68, 0x00, 0x00, 0x00, +} diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imp3.proto b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imports/fmt/m.proto similarity index 89% rename from vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imp3.proto rename to vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imports/fmt/m.proto index 58fc7598b..142d8cfac 100644 --- a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imp3.proto +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imports/fmt/m.proto @@ -1,6 +1,6 @@ // Go support for Protocol Buffers - Google's data interchange format // -// Copyright 2012 The Go Authors. All rights reserved. +// Copyright 2018 The Go Authors. All rights reserved. // https://github.com/golang/protobuf // // Redistribution and use in source and binary forms, with or without @@ -29,10 +29,7 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -syntax = "proto2"; - -package imp; - -message ForeignImportedMessage { - optional string tuber = 1; -} +syntax = "proto3"; +package fmt; +option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/imports/fmt"; +message M {} diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_a_1/m1.pb.go b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_a_1/m1.pb.go new file mode 100644 index 000000000..82ec35e10 --- /dev/null +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_a_1/m1.pb.go @@ -0,0 +1,130 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: imports/test_a_1/m1.proto + +package test_a_1 // import "github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_a_1" + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type E1 int32 + +const ( + E1_E1_ZERO E1 = 0 +) + +var E1_name = map[int32]string{ + 0: "E1_ZERO", +} +var E1_value = map[string]int32{ + "E1_ZERO": 0, +} + +func (x E1) String() string { + return proto.EnumName(E1_name, int32(x)) +} +func (E1) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_m1_56a2598431d21e61, []int{0} +} + +type M1 struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *M1) Reset() { *m = M1{} } +func (m *M1) String() string { return proto.CompactTextString(m) } +func (*M1) ProtoMessage() {} +func (*M1) Descriptor() ([]byte, []int) { + return fileDescriptor_m1_56a2598431d21e61, []int{0} +} +func (m *M1) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_M1.Unmarshal(m, b) +} +func (m *M1) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_M1.Marshal(b, m, deterministic) +} +func (dst *M1) XXX_Merge(src proto.Message) { + xxx_messageInfo_M1.Merge(dst, src) +} +func (m *M1) XXX_Size() int { + return xxx_messageInfo_M1.Size(m) +} +func (m *M1) XXX_DiscardUnknown() { + xxx_messageInfo_M1.DiscardUnknown(m) +} + +var xxx_messageInfo_M1 proto.InternalMessageInfo + +type M1_1 struct { + M1 *M1 `protobuf:"bytes,1,opt,name=m1" json:"m1,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *M1_1) Reset() { *m = M1_1{} } +func (m *M1_1) String() string { return proto.CompactTextString(m) } +func (*M1_1) ProtoMessage() {} +func (*M1_1) Descriptor() ([]byte, []int) { + return fileDescriptor_m1_56a2598431d21e61, []int{1} +} +func (m *M1_1) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_M1_1.Unmarshal(m, b) +} +func (m *M1_1) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_M1_1.Marshal(b, m, deterministic) +} +func (dst *M1_1) XXX_Merge(src proto.Message) { + xxx_messageInfo_M1_1.Merge(dst, src) +} +func (m *M1_1) XXX_Size() int { + return xxx_messageInfo_M1_1.Size(m) +} +func (m *M1_1) XXX_DiscardUnknown() { + xxx_messageInfo_M1_1.DiscardUnknown(m) +} + +var xxx_messageInfo_M1_1 proto.InternalMessageInfo + +func (m *M1_1) GetM1() *M1 { + if m != nil { + return m.M1 + } + return nil +} + +func init() { + proto.RegisterType((*M1)(nil), "test.a.M1") + proto.RegisterType((*M1_1)(nil), "test.a.M1_1") + proto.RegisterEnum("test.a.E1", E1_name, E1_value) +} + +func init() { proto.RegisterFile("imports/test_a_1/m1.proto", fileDescriptor_m1_56a2598431d21e61) } + +var fileDescriptor_m1_56a2598431d21e61 = []byte{ + // 165 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcc, 0xcc, 0x2d, 0xc8, + 0x2f, 0x2a, 0x29, 0xd6, 0x2f, 0x49, 0x2d, 0x2e, 0x89, 0x4f, 0x8c, 0x37, 0xd4, 0xcf, 0x35, 0xd4, + 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x03, 0x09, 0xe9, 0x25, 0x2a, 0xb1, 0x70, 0x31, 0xf9, + 0x1a, 0x2a, 0x29, 0x71, 0xb1, 0xf8, 0x1a, 0xc6, 0x1b, 0x0a, 0x49, 0x71, 0x31, 0xe5, 0x1a, 0x4a, + 0x30, 0x2a, 0x30, 0x6a, 0x70, 0x1b, 0x71, 0xe9, 0x41, 0x94, 0xe8, 0xf9, 0x1a, 0x06, 0x31, 0xe5, + 0x1a, 0x6a, 0x09, 0x72, 0x31, 0xb9, 0x1a, 0x0a, 0x71, 0x73, 0xb1, 0xbb, 0x1a, 0xc6, 0x47, 0xb9, + 0x06, 0xf9, 0x0b, 0x30, 0x38, 0xb9, 0x44, 0x39, 0xa5, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, + 0xe7, 0xe7, 0xea, 0xa7, 0xe7, 0xe7, 0x24, 0xe6, 0xa5, 0xeb, 0x83, 0xcd, 0x4f, 0x2a, 0x4d, 0x83, + 0x30, 0x92, 0x75, 0xd3, 0x53, 0xf3, 0x74, 0xd3, 0xf3, 0xc1, 0x4e, 0x48, 0x49, 0x2c, 0x49, 0xd4, + 0x47, 0x77, 0x53, 0x12, 0x1b, 0x58, 0xa1, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0xcc, 0xae, 0xc9, + 0xcd, 0xae, 0x00, 0x00, 0x00, +} diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_a_1/m1.proto b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_a_1/m1.proto new file mode 100644 index 000000000..da54c1ee4 --- /dev/null +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_a_1/m1.proto @@ -0,0 +1,44 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2018 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +syntax = "proto3"; +package test.a; +option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_a_1"; + +message M1 {} + +message M1_1 { + M1 m1 = 1; +} + +enum E1 { + E1_ZERO = 0; +} diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_a_1/m2.pb.go b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_a_1/m2.pb.go new file mode 100644 index 000000000..1b629bf32 --- /dev/null +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_a_1/m2.pb.go @@ -0,0 +1,67 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: imports/test_a_1/m2.proto + +package test_a_1 // import "github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_a_1" + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type M2 struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *M2) Reset() { *m = M2{} } +func (m *M2) String() string { return proto.CompactTextString(m) } +func (*M2) ProtoMessage() {} +func (*M2) Descriptor() ([]byte, []int) { + return fileDescriptor_m2_ccd6356c045a9ac3, []int{0} +} +func (m *M2) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_M2.Unmarshal(m, b) +} +func (m *M2) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_M2.Marshal(b, m, deterministic) +} +func (dst *M2) XXX_Merge(src proto.Message) { + xxx_messageInfo_M2.Merge(dst, src) +} +func (m *M2) XXX_Size() int { + return xxx_messageInfo_M2.Size(m) +} +func (m *M2) XXX_DiscardUnknown() { + xxx_messageInfo_M2.DiscardUnknown(m) +} + +var xxx_messageInfo_M2 proto.InternalMessageInfo + +func init() { + proto.RegisterType((*M2)(nil), "test.a.M2") +} + +func init() { proto.RegisterFile("imports/test_a_1/m2.proto", fileDescriptor_m2_ccd6356c045a9ac3) } + +var fileDescriptor_m2_ccd6356c045a9ac3 = []byte{ + // 114 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcc, 0xcc, 0x2d, 0xc8, + 0x2f, 0x2a, 0x29, 0xd6, 0x2f, 0x49, 0x2d, 0x2e, 0x89, 0x4f, 0x8c, 0x37, 0xd4, 0xcf, 0x35, 0xd2, + 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x03, 0x09, 0xe9, 0x25, 0x2a, 0xb1, 0x70, 0x31, 0xf9, + 0x1a, 0x39, 0xb9, 0x44, 0x39, 0xa5, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, + 0xa7, 0xe7, 0xe7, 0x24, 0xe6, 0xa5, 0xeb, 0x83, 0x15, 0x26, 0x95, 0xa6, 0x41, 0x18, 0xc9, 0xba, + 0xe9, 0xa9, 0x79, 0xba, 0xe9, 0xf9, 0x60, 0xb3, 0x52, 0x12, 0x4b, 0x12, 0xf5, 0xd1, 0x0d, 0x4f, + 0x62, 0x03, 0x2b, 0x34, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0xe3, 0xe0, 0x7e, 0xc0, 0x77, 0x00, + 0x00, 0x00, +} diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imp2.proto b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_a_1/m2.proto similarity index 88% rename from vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imp2.proto rename to vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_a_1/m2.proto index 3bb0632b2..49499dc9c 100644 --- a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imp2.proto +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_a_1/m2.proto @@ -1,6 +1,6 @@ // Go support for Protocol Buffers - Google's data interchange format // -// Copyright 2011 The Go Authors. All rights reserved. +// Copyright 2018 The Go Authors. All rights reserved. // https://github.com/golang/protobuf // // Redistribution and use in source and binary forms, with or without @@ -29,15 +29,7 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -syntax = "proto2"; - -package imp; - -message PubliclyImportedMessage { - optional int64 field = 1; -} - -enum PubliclyImportedEnum { - GLASSES = 1; - HAIR = 2; -} +syntax = "proto3"; +package test.a; +option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_a_1"; +message M2 {} diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_a_2/m3.pb.go b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_a_2/m3.pb.go new file mode 100644 index 000000000..e3895d2be --- /dev/null +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_a_2/m3.pb.go @@ -0,0 +1,67 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: imports/test_a_2/m3.proto + +package test_a_2 // import "github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_a_2" + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type M3 struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *M3) Reset() { *m = M3{} } +func (m *M3) String() string { return proto.CompactTextString(m) } +func (*M3) ProtoMessage() {} +func (*M3) Descriptor() ([]byte, []int) { + return fileDescriptor_m3_de310e87d08d4216, []int{0} +} +func (m *M3) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_M3.Unmarshal(m, b) +} +func (m *M3) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_M3.Marshal(b, m, deterministic) +} +func (dst *M3) XXX_Merge(src proto.Message) { + xxx_messageInfo_M3.Merge(dst, src) +} +func (m *M3) XXX_Size() int { + return xxx_messageInfo_M3.Size(m) +} +func (m *M3) XXX_DiscardUnknown() { + xxx_messageInfo_M3.DiscardUnknown(m) +} + +var xxx_messageInfo_M3 proto.InternalMessageInfo + +func init() { + proto.RegisterType((*M3)(nil), "test.a.M3") +} + +func init() { proto.RegisterFile("imports/test_a_2/m3.proto", fileDescriptor_m3_de310e87d08d4216) } + +var fileDescriptor_m3_de310e87d08d4216 = []byte{ + // 114 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcc, 0xcc, 0x2d, 0xc8, + 0x2f, 0x2a, 0x29, 0xd6, 0x2f, 0x49, 0x2d, 0x2e, 0x89, 0x4f, 0x8c, 0x37, 0xd2, 0xcf, 0x35, 0xd6, + 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x03, 0x09, 0xe9, 0x25, 0x2a, 0xb1, 0x70, 0x31, 0xf9, + 0x1a, 0x3b, 0xb9, 0x44, 0x39, 0xa5, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, + 0xa7, 0xe7, 0xe7, 0x24, 0xe6, 0xa5, 0xeb, 0x83, 0x15, 0x26, 0x95, 0xa6, 0x41, 0x18, 0xc9, 0xba, + 0xe9, 0xa9, 0x79, 0xba, 0xe9, 0xf9, 0x60, 0xb3, 0x52, 0x12, 0x4b, 0x12, 0xf5, 0xd1, 0x0d, 0x4f, + 0x62, 0x03, 0x2b, 0x34, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x23, 0x86, 0x27, 0x47, 0x77, 0x00, + 0x00, 0x00, +} diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_a_2/m3.proto b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_a_2/m3.proto new file mode 100644 index 000000000..5e811ef84 --- /dev/null +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_a_2/m3.proto @@ -0,0 +1,35 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2018 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +syntax = "proto3"; +package test.a; +option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_a_2"; +message M3 {} diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_a_2/m4.pb.go b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_a_2/m4.pb.go new file mode 100644 index 000000000..65a3bad29 --- /dev/null +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_a_2/m4.pb.go @@ -0,0 +1,67 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: imports/test_a_2/m4.proto + +package test_a_2 // import "github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_a_2" + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type M4 struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *M4) Reset() { *m = M4{} } +func (m *M4) String() string { return proto.CompactTextString(m) } +func (*M4) ProtoMessage() {} +func (*M4) Descriptor() ([]byte, []int) { + return fileDescriptor_m4_da12b386229f3791, []int{0} +} +func (m *M4) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_M4.Unmarshal(m, b) +} +func (m *M4) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_M4.Marshal(b, m, deterministic) +} +func (dst *M4) XXX_Merge(src proto.Message) { + xxx_messageInfo_M4.Merge(dst, src) +} +func (m *M4) XXX_Size() int { + return xxx_messageInfo_M4.Size(m) +} +func (m *M4) XXX_DiscardUnknown() { + xxx_messageInfo_M4.DiscardUnknown(m) +} + +var xxx_messageInfo_M4 proto.InternalMessageInfo + +func init() { + proto.RegisterType((*M4)(nil), "test.a.M4") +} + +func init() { proto.RegisterFile("imports/test_a_2/m4.proto", fileDescriptor_m4_da12b386229f3791) } + +var fileDescriptor_m4_da12b386229f3791 = []byte{ + // 114 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcc, 0xcc, 0x2d, 0xc8, + 0x2f, 0x2a, 0x29, 0xd6, 0x2f, 0x49, 0x2d, 0x2e, 0x89, 0x4f, 0x8c, 0x37, 0xd2, 0xcf, 0x35, 0xd1, + 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x03, 0x09, 0xe9, 0x25, 0x2a, 0xb1, 0x70, 0x31, 0xf9, + 0x9a, 0x38, 0xb9, 0x44, 0x39, 0xa5, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, + 0xa7, 0xe7, 0xe7, 0x24, 0xe6, 0xa5, 0xeb, 0x83, 0x15, 0x26, 0x95, 0xa6, 0x41, 0x18, 0xc9, 0xba, + 0xe9, 0xa9, 0x79, 0xba, 0xe9, 0xf9, 0x60, 0xb3, 0x52, 0x12, 0x4b, 0x12, 0xf5, 0xd1, 0x0d, 0x4f, + 0x62, 0x03, 0x2b, 0x34, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x58, 0xcb, 0x10, 0xc8, 0x77, 0x00, + 0x00, 0x00, +} diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_a_2/m4.proto b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_a_2/m4.proto new file mode 100644 index 000000000..8f8fe3e12 --- /dev/null +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_a_2/m4.proto @@ -0,0 +1,35 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2018 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +syntax = "proto3"; +package test.a; +option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_a_2"; +message M4 {} diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_b_1/m1.pb.go b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_b_1/m1.pb.go new file mode 100644 index 000000000..831f41498 --- /dev/null +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_b_1/m1.pb.go @@ -0,0 +1,67 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: imports/test_b_1/m1.proto + +package beta // import "github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_b_1" + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type M1 struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *M1) Reset() { *m = M1{} } +func (m *M1) String() string { return proto.CompactTextString(m) } +func (*M1) ProtoMessage() {} +func (*M1) Descriptor() ([]byte, []int) { + return fileDescriptor_m1_aff127b054aec649, []int{0} +} +func (m *M1) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_M1.Unmarshal(m, b) +} +func (m *M1) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_M1.Marshal(b, m, deterministic) +} +func (dst *M1) XXX_Merge(src proto.Message) { + xxx_messageInfo_M1.Merge(dst, src) +} +func (m *M1) XXX_Size() int { + return xxx_messageInfo_M1.Size(m) +} +func (m *M1) XXX_DiscardUnknown() { + xxx_messageInfo_M1.DiscardUnknown(m) +} + +var xxx_messageInfo_M1 proto.InternalMessageInfo + +func init() { + proto.RegisterType((*M1)(nil), "test.b.part1.M1") +} + +func init() { proto.RegisterFile("imports/test_b_1/m1.proto", fileDescriptor_m1_aff127b054aec649) } + +var fileDescriptor_m1_aff127b054aec649 = []byte{ + // 125 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcc, 0xcc, 0x2d, 0xc8, + 0x2f, 0x2a, 0x29, 0xd6, 0x2f, 0x49, 0x2d, 0x2e, 0x89, 0x4f, 0x8a, 0x37, 0xd4, 0xcf, 0x35, 0xd4, + 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x01, 0x09, 0xe9, 0x25, 0xe9, 0x15, 0x24, 0x16, 0x95, + 0x18, 0x2a, 0xb1, 0x70, 0x31, 0xf9, 0x1a, 0x3a, 0x79, 0x46, 0xb9, 0xa7, 0x67, 0x96, 0x64, 0x94, + 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0xa7, 0xe7, 0xe7, 0x24, 0xe6, 0xa5, 0xeb, 0x83, 0x95, 0x27, + 0x95, 0xa6, 0x41, 0x18, 0xc9, 0xba, 0xe9, 0xa9, 0x79, 0xba, 0xe9, 0xf9, 0x60, 0x13, 0x53, 0x12, + 0x4b, 0x12, 0xf5, 0xd1, 0xad, 0xb0, 0x4e, 0x4a, 0x2d, 0x49, 0x4c, 0x62, 0x03, 0xab, 0x36, 0x06, + 0x04, 0x00, 0x00, 0xff, 0xff, 0x4a, 0xf1, 0x3b, 0x7f, 0x82, 0x00, 0x00, 0x00, +} diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_b_1/m1.proto b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_b_1/m1.proto new file mode 100644 index 000000000..2c35ec4ae --- /dev/null +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_b_1/m1.proto @@ -0,0 +1,35 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2018 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +syntax = "proto3"; +package test.b.part1; +option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_b_1;beta"; +message M1 {} diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_b_1/m2.pb.go b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_b_1/m2.pb.go new file mode 100644 index 000000000..bc741056a --- /dev/null +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_b_1/m2.pb.go @@ -0,0 +1,67 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: imports/test_b_1/m2.proto + +package beta // import "github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_b_1" + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type M2 struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *M2) Reset() { *m = M2{} } +func (m *M2) String() string { return proto.CompactTextString(m) } +func (*M2) ProtoMessage() {} +func (*M2) Descriptor() ([]byte, []int) { + return fileDescriptor_m2_0c59cab35ba1b0d8, []int{0} +} +func (m *M2) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_M2.Unmarshal(m, b) +} +func (m *M2) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_M2.Marshal(b, m, deterministic) +} +func (dst *M2) XXX_Merge(src proto.Message) { + xxx_messageInfo_M2.Merge(dst, src) +} +func (m *M2) XXX_Size() int { + return xxx_messageInfo_M2.Size(m) +} +func (m *M2) XXX_DiscardUnknown() { + xxx_messageInfo_M2.DiscardUnknown(m) +} + +var xxx_messageInfo_M2 proto.InternalMessageInfo + +func init() { + proto.RegisterType((*M2)(nil), "test.b.part2.M2") +} + +func init() { proto.RegisterFile("imports/test_b_1/m2.proto", fileDescriptor_m2_0c59cab35ba1b0d8) } + +var fileDescriptor_m2_0c59cab35ba1b0d8 = []byte{ + // 125 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcc, 0xcc, 0x2d, 0xc8, + 0x2f, 0x2a, 0x29, 0xd6, 0x2f, 0x49, 0x2d, 0x2e, 0x89, 0x4f, 0x8a, 0x37, 0xd4, 0xcf, 0x35, 0xd2, + 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x01, 0x09, 0xe9, 0x25, 0xe9, 0x15, 0x24, 0x16, 0x95, + 0x18, 0x29, 0xb1, 0x70, 0x31, 0xf9, 0x1a, 0x39, 0x79, 0x46, 0xb9, 0xa7, 0x67, 0x96, 0x64, 0x94, + 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0xa7, 0xe7, 0xe7, 0x24, 0xe6, 0xa5, 0xeb, 0x83, 0x95, 0x27, + 0x95, 0xa6, 0x41, 0x18, 0xc9, 0xba, 0xe9, 0xa9, 0x79, 0xba, 0xe9, 0xf9, 0x60, 0x13, 0x53, 0x12, + 0x4b, 0x12, 0xf5, 0xd1, 0xad, 0xb0, 0x4e, 0x4a, 0x2d, 0x49, 0x4c, 0x62, 0x03, 0xab, 0x36, 0x06, + 0x04, 0x00, 0x00, 0xff, 0xff, 0x44, 0x29, 0xbe, 0x6d, 0x82, 0x00, 0x00, 0x00, +} diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_b_1/m2.proto b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_b_1/m2.proto new file mode 100644 index 000000000..13723be41 --- /dev/null +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_b_1/m2.proto @@ -0,0 +1,35 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2018 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +syntax = "proto3"; +package test.b.part2; +option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_b_1;beta"; +message M2 {} diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_import_a1m1.pb.go b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_import_a1m1.pb.go new file mode 100644 index 000000000..72daffdbf --- /dev/null +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_import_a1m1.pb.go @@ -0,0 +1,80 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: imports/test_import_a1m1.proto + +package imports // import "github.com/golang/protobuf/protoc-gen-go/testdata/imports" + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" +import test_a_1 "github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_a_1" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type A1M1 struct { + F *test_a_1.M1 `protobuf:"bytes,1,opt,name=f" json:"f,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *A1M1) Reset() { *m = A1M1{} } +func (m *A1M1) String() string { return proto.CompactTextString(m) } +func (*A1M1) ProtoMessage() {} +func (*A1M1) Descriptor() ([]byte, []int) { + return fileDescriptor_test_import_a1m1_d7f2b5c638a69f6e, []int{0} +} +func (m *A1M1) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_A1M1.Unmarshal(m, b) +} +func (m *A1M1) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_A1M1.Marshal(b, m, deterministic) +} +func (dst *A1M1) XXX_Merge(src proto.Message) { + xxx_messageInfo_A1M1.Merge(dst, src) +} +func (m *A1M1) XXX_Size() int { + return xxx_messageInfo_A1M1.Size(m) +} +func (m *A1M1) XXX_DiscardUnknown() { + xxx_messageInfo_A1M1.DiscardUnknown(m) +} + +var xxx_messageInfo_A1M1 proto.InternalMessageInfo + +func (m *A1M1) GetF() *test_a_1.M1 { + if m != nil { + return m.F + } + return nil +} + +func init() { + proto.RegisterType((*A1M1)(nil), "test.A1M1") +} + +func init() { + proto.RegisterFile("imports/test_import_a1m1.proto", fileDescriptor_test_import_a1m1_d7f2b5c638a69f6e) +} + +var fileDescriptor_test_import_a1m1_d7f2b5c638a69f6e = []byte{ + // 149 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcb, 0xcc, 0x2d, 0xc8, + 0x2f, 0x2a, 0x29, 0xd6, 0x2f, 0x49, 0x2d, 0x2e, 0x89, 0x87, 0x70, 0xe2, 0x13, 0x0d, 0x73, 0x0d, + 0xf5, 0x0a, 0x8a, 0xf2, 0x4b, 0xf2, 0x85, 0x58, 0x40, 0xe2, 0x52, 0x92, 0x28, 0xaa, 0x12, 0xe3, + 0x0d, 0xf5, 0x61, 0x0a, 0x94, 0x14, 0xb8, 0x58, 0x1c, 0x0d, 0x7d, 0x0d, 0x85, 0x24, 0xb8, 0x18, + 0xd3, 0x24, 0x18, 0x15, 0x18, 0x35, 0xb8, 0x8d, 0xb8, 0xf4, 0x40, 0xca, 0xf4, 0x12, 0xf5, 0x7c, + 0x0d, 0x83, 0x18, 0xd3, 0x9c, 0xac, 0xa3, 0x2c, 0xd3, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, + 0xf3, 0x73, 0xf5, 0xd3, 0xf3, 0x73, 0x12, 0xf3, 0xd2, 0xf5, 0xc1, 0x9a, 0x93, 0x4a, 0xd3, 0x20, + 0x8c, 0x64, 0xdd, 0xf4, 0xd4, 0x3c, 0xdd, 0xf4, 0x7c, 0xb0, 0xf9, 0x29, 0x89, 0x25, 0x89, 0xfa, + 0x50, 0x0b, 0x93, 0xd8, 0xc0, 0xf2, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x84, 0x2f, 0x18, + 0x23, 0xa8, 0x00, 0x00, 0x00, +} diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_import_a1m1.proto b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_import_a1m1.proto new file mode 100644 index 000000000..abf07f2a4 --- /dev/null +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_import_a1m1.proto @@ -0,0 +1,42 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2018 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +syntax = "proto3"; + +package test; + +option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/imports"; + +import "imports/test_a_1/m1.proto"; + +message A1M1 { + test.a.M1 f = 1; +} diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_import_a1m2.pb.go b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_import_a1m2.pb.go new file mode 100644 index 000000000..9e36ebdeb --- /dev/null +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_import_a1m2.pb.go @@ -0,0 +1,80 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: imports/test_import_a1m2.proto + +package imports // import "github.com/golang/protobuf/protoc-gen-go/testdata/imports" + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" +import test_a_1 "github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_a_1" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type A1M2 struct { + F *test_a_1.M2 `protobuf:"bytes,1,opt,name=f" json:"f,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *A1M2) Reset() { *m = A1M2{} } +func (m *A1M2) String() string { return proto.CompactTextString(m) } +func (*A1M2) ProtoMessage() {} +func (*A1M2) Descriptor() ([]byte, []int) { + return fileDescriptor_test_import_a1m2_9a3281ce9464e116, []int{0} +} +func (m *A1M2) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_A1M2.Unmarshal(m, b) +} +func (m *A1M2) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_A1M2.Marshal(b, m, deterministic) +} +func (dst *A1M2) XXX_Merge(src proto.Message) { + xxx_messageInfo_A1M2.Merge(dst, src) +} +func (m *A1M2) XXX_Size() int { + return xxx_messageInfo_A1M2.Size(m) +} +func (m *A1M2) XXX_DiscardUnknown() { + xxx_messageInfo_A1M2.DiscardUnknown(m) +} + +var xxx_messageInfo_A1M2 proto.InternalMessageInfo + +func (m *A1M2) GetF() *test_a_1.M2 { + if m != nil { + return m.F + } + return nil +} + +func init() { + proto.RegisterType((*A1M2)(nil), "test.A1M2") +} + +func init() { + proto.RegisterFile("imports/test_import_a1m2.proto", fileDescriptor_test_import_a1m2_9a3281ce9464e116) +} + +var fileDescriptor_test_import_a1m2_9a3281ce9464e116 = []byte{ + // 149 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcb, 0xcc, 0x2d, 0xc8, + 0x2f, 0x2a, 0x29, 0xd6, 0x2f, 0x49, 0x2d, 0x2e, 0x89, 0x87, 0x70, 0xe2, 0x13, 0x0d, 0x73, 0x8d, + 0xf4, 0x0a, 0x8a, 0xf2, 0x4b, 0xf2, 0x85, 0x58, 0x40, 0xe2, 0x52, 0x92, 0x28, 0xaa, 0x12, 0xe3, + 0x0d, 0xf5, 0x61, 0x0a, 0x94, 0x14, 0xb8, 0x58, 0x1c, 0x0d, 0x7d, 0x8d, 0x84, 0x24, 0xb8, 0x18, + 0xd3, 0x24, 0x18, 0x15, 0x18, 0x35, 0xb8, 0x8d, 0xb8, 0xf4, 0x40, 0xca, 0xf4, 0x12, 0xf5, 0x7c, + 0x8d, 0x82, 0x18, 0xd3, 0x9c, 0xac, 0xa3, 0x2c, 0xd3, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, + 0xf3, 0x73, 0xf5, 0xd3, 0xf3, 0x73, 0x12, 0xf3, 0xd2, 0xf5, 0xc1, 0x9a, 0x93, 0x4a, 0xd3, 0x20, + 0x8c, 0x64, 0xdd, 0xf4, 0xd4, 0x3c, 0xdd, 0xf4, 0x7c, 0xb0, 0xf9, 0x29, 0x89, 0x25, 0x89, 0xfa, + 0x50, 0x0b, 0x93, 0xd8, 0xc0, 0xf2, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x1f, 0x88, 0xfb, + 0xea, 0xa8, 0x00, 0x00, 0x00, +} diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_import_a1m2.proto b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_import_a1m2.proto new file mode 100644 index 000000000..5c53950da --- /dev/null +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_import_a1m2.proto @@ -0,0 +1,42 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2018 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +syntax = "proto3"; + +package test; + +option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/imports"; + +import "imports/test_a_1/m2.proto"; + +message A1M2 { + test.a.M2 f = 1; +} diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_import_all.pb.go b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_import_all.pb.go new file mode 100644 index 000000000..f40e0b738 --- /dev/null +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_import_all.pb.go @@ -0,0 +1,138 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: imports/test_import_all.proto + +package imports // import "github.com/golang/protobuf/protoc-gen-go/testdata/imports" + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" +import fmt1 "github.com/golang/protobuf/protoc-gen-go/testdata/imports/fmt" +import test_a_1 "github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_a_1" +import test_a_2 "github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_a_2" +import test_b_1 "github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_b_1" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type All struct { + Am1 *test_a_1.M1 `protobuf:"bytes,1,opt,name=am1" json:"am1,omitempty"` + Am2 *test_a_1.M2 `protobuf:"bytes,2,opt,name=am2" json:"am2,omitempty"` + Am3 *test_a_2.M3 `protobuf:"bytes,3,opt,name=am3" json:"am3,omitempty"` + Am4 *test_a_2.M4 `protobuf:"bytes,4,opt,name=am4" json:"am4,omitempty"` + Bm1 *test_b_1.M1 `protobuf:"bytes,5,opt,name=bm1" json:"bm1,omitempty"` + Bm2 *test_b_1.M2 `protobuf:"bytes,6,opt,name=bm2" json:"bm2,omitempty"` + Fmt *fmt1.M `protobuf:"bytes,7,opt,name=fmt" json:"fmt,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *All) Reset() { *m = All{} } +func (m *All) String() string { return proto.CompactTextString(m) } +func (*All) ProtoMessage() {} +func (*All) Descriptor() ([]byte, []int) { + return fileDescriptor_test_import_all_b41dc4592e4a4f3b, []int{0} +} +func (m *All) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_All.Unmarshal(m, b) +} +func (m *All) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_All.Marshal(b, m, deterministic) +} +func (dst *All) XXX_Merge(src proto.Message) { + xxx_messageInfo_All.Merge(dst, src) +} +func (m *All) XXX_Size() int { + return xxx_messageInfo_All.Size(m) +} +func (m *All) XXX_DiscardUnknown() { + xxx_messageInfo_All.DiscardUnknown(m) +} + +var xxx_messageInfo_All proto.InternalMessageInfo + +func (m *All) GetAm1() *test_a_1.M1 { + if m != nil { + return m.Am1 + } + return nil +} + +func (m *All) GetAm2() *test_a_1.M2 { + if m != nil { + return m.Am2 + } + return nil +} + +func (m *All) GetAm3() *test_a_2.M3 { + if m != nil { + return m.Am3 + } + return nil +} + +func (m *All) GetAm4() *test_a_2.M4 { + if m != nil { + return m.Am4 + } + return nil +} + +func (m *All) GetBm1() *test_b_1.M1 { + if m != nil { + return m.Bm1 + } + return nil +} + +func (m *All) GetBm2() *test_b_1.M2 { + if m != nil { + return m.Bm2 + } + return nil +} + +func (m *All) GetFmt() *fmt1.M { + if m != nil { + return m.Fmt + } + return nil +} + +func init() { + proto.RegisterType((*All)(nil), "test.All") +} + +func init() { + proto.RegisterFile("imports/test_import_all.proto", fileDescriptor_test_import_all_b41dc4592e4a4f3b) +} + +var fileDescriptor_test_import_all_b41dc4592e4a4f3b = []byte{ + // 258 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0xd0, 0xb1, 0x4e, 0xc3, 0x30, + 0x10, 0x06, 0x60, 0x15, 0x97, 0x20, 0x99, 0x05, 0x85, 0xc5, 0x20, 0x90, 0x50, 0x27, 0x96, 0xda, + 0xb2, 0x9d, 0x05, 0x31, 0xc1, 0xde, 0xa5, 0x23, 0x4b, 0x64, 0x97, 0xc6, 0x54, 0xf2, 0xd5, 0x51, + 0x7a, 0x7d, 0x5e, 0x5e, 0x05, 0xd9, 0x07, 0x12, 0x84, 0x66, 0x4b, 0xfe, 0xef, 0xb7, 0xce, 0x3e, + 0x7e, 0xbf, 0x83, 0x3e, 0x0d, 0x78, 0x50, 0xb8, 0x3d, 0x60, 0x4b, 0x3f, 0xad, 0x8b, 0x51, 0xf6, + 0x43, 0xc2, 0x54, 0xcf, 0x73, 0x7c, 0x7b, 0xf3, 0xa7, 0xe4, 0x5a, 0xad, 0x40, 0x53, 0xe1, 0x14, + 0x99, 0x09, 0x32, 0x0a, 0xec, 0x34, 0x35, 0x27, 0xc9, 0x4f, 0xcf, 0xf2, 0xbf, 0x67, 0x5d, 0xff, + 0x50, 0x07, 0xa8, 0x80, 0xc2, 0xc5, 0xe7, 0x8c, 0xb3, 0x97, 0x18, 0xeb, 0x3b, 0xce, 0x1c, 0x68, + 0x31, 0x7b, 0x98, 0x3d, 0x5e, 0x1a, 0x2e, 0xf3, 0x69, 0xe9, 0xe4, 0x4a, 0xaf, 0x73, 0x4c, 0x6a, + 0xc4, 0xd9, 0x48, 0x4d, 0x56, 0x43, 0x6a, 0x05, 0x1b, 0xa9, 0xcd, 0x6a, 0x49, 0x1b, 0x31, 0x1f, + 0x69, 0x93, 0xb5, 0xa9, 0x17, 0x9c, 0x79, 0xd0, 0xe2, 0xbc, 0xe8, 0x15, 0xa9, 0x97, 0xbd, 0x1b, + 0x50, 0x97, 0xe9, 0x1e, 0x34, 0x75, 0x8c, 0xa8, 0xfe, 0x77, 0x4c, 0xb9, 0x83, 0x07, 0x53, 0x0b, + 0xce, 0x3a, 0x40, 0x71, 0x51, 0x3a, 0x95, 0xec, 0x00, 0xe5, 0x6a, 0x9d, 0xa3, 0xd7, 0xe7, 0xb7, + 0xa7, 0xb0, 0xc3, 0x8f, 0xa3, 0x97, 0x9b, 0x04, 0x2a, 0xa4, 0xe8, 0xf6, 0x41, 0x95, 0xc7, 0xfb, + 0x63, 0x47, 0x1f, 0x9b, 0x65, 0xd8, 0xee, 0x97, 0x21, 0x95, 0xa5, 0xbd, 0x3b, 0x74, 0xea, 0x7b, + 0x55, 0xbe, 0x2a, 0x6e, 0xbf, 0x02, 0x00, 0x00, 0xff, 0xff, 0x95, 0x39, 0xa3, 0x82, 0x03, 0x02, + 0x00, 0x00, +} diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_import_all.proto b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_import_all.proto new file mode 100644 index 000000000..582d722e3 --- /dev/null +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_import_all.proto @@ -0,0 +1,58 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2018 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +syntax = "proto3"; + +package test; + +option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/imports"; + +// test_a_1/m*.proto are in the same Go package and proto package. +// test_a_*/*.proto are in different Go packages, but the same proto package. +// test_b_1/*.proto are in the same Go package, but different proto packages. +// fmt/m.proto has a package name which conflicts with "fmt". +import "imports/test_a_1/m1.proto"; +import "imports/test_a_1/m2.proto"; +import "imports/test_a_2/m3.proto"; +import "imports/test_a_2/m4.proto"; +import "imports/test_b_1/m1.proto"; +import "imports/test_b_1/m2.proto"; +import "imports/fmt/m.proto"; + +message All { + test.a.M1 am1 = 1; + test.a.M2 am2 = 2; + test.a.M3 am3 = 3; + test.a.M4 am4 = 4; + test.b.part1.M1 bm1 = 5; + test.b.part2.M2 bm2 = 6; + fmt.M fmt = 7; +} diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/multi/multi1.pb.go b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/multi/multi1.pb.go new file mode 100644 index 000000000..da0fdf8fd --- /dev/null +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/multi/multi1.pb.go @@ -0,0 +1,96 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: multi/multi1.proto + +package multitest // import "github.com/golang/protobuf/protoc-gen-go/testdata/multi" + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type Multi1 struct { + Multi2 *Multi2 `protobuf:"bytes,1,req,name=multi2" json:"multi2,omitempty"` + Color *Multi2_Color `protobuf:"varint,2,opt,name=color,enum=multitest.Multi2_Color" json:"color,omitempty"` + HatType *Multi3_HatType `protobuf:"varint,3,opt,name=hat_type,json=hatType,enum=multitest.Multi3_HatType" json:"hat_type,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Multi1) Reset() { *m = Multi1{} } +func (m *Multi1) String() string { return proto.CompactTextString(m) } +func (*Multi1) ProtoMessage() {} +func (*Multi1) Descriptor() ([]byte, []int) { + return fileDescriptor_multi1_08e50c6822e808b8, []int{0} +} +func (m *Multi1) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Multi1.Unmarshal(m, b) +} +func (m *Multi1) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Multi1.Marshal(b, m, deterministic) +} +func (dst *Multi1) XXX_Merge(src proto.Message) { + xxx_messageInfo_Multi1.Merge(dst, src) +} +func (m *Multi1) XXX_Size() int { + return xxx_messageInfo_Multi1.Size(m) +} +func (m *Multi1) XXX_DiscardUnknown() { + xxx_messageInfo_Multi1.DiscardUnknown(m) +} + +var xxx_messageInfo_Multi1 proto.InternalMessageInfo + +func (m *Multi1) GetMulti2() *Multi2 { + if m != nil { + return m.Multi2 + } + return nil +} + +func (m *Multi1) GetColor() Multi2_Color { + if m != nil && m.Color != nil { + return *m.Color + } + return Multi2_BLUE +} + +func (m *Multi1) GetHatType() Multi3_HatType { + if m != nil && m.HatType != nil { + return *m.HatType + } + return Multi3_FEDORA +} + +func init() { + proto.RegisterType((*Multi1)(nil), "multitest.Multi1") +} + +func init() { proto.RegisterFile("multi/multi1.proto", fileDescriptor_multi1_08e50c6822e808b8) } + +var fileDescriptor_multi1_08e50c6822e808b8 = []byte{ + // 200 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xca, 0x2d, 0xcd, 0x29, + 0xc9, 0xd4, 0x07, 0x93, 0x86, 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, 0x9c, 0x60, 0x5e, 0x49, + 0x6a, 0x71, 0x89, 0x14, 0xb2, 0xb4, 0x11, 0x44, 0x1a, 0x45, 0xcc, 0x18, 0x22, 0xa6, 0x34, 0x83, + 0x91, 0x8b, 0xcd, 0x17, 0x6c, 0x86, 0x90, 0x26, 0x17, 0x1b, 0x44, 0xb9, 0x04, 0xa3, 0x02, 0x93, + 0x06, 0xb7, 0x91, 0xa0, 0x1e, 0xdc, 0x38, 0x3d, 0xb0, 0x12, 0xa3, 0x20, 0xa8, 0x02, 0x21, 0x5d, + 0x2e, 0xd6, 0xe4, 0xfc, 0x9c, 0xfc, 0x22, 0x09, 0x26, 0x05, 0x46, 0x0d, 0x3e, 0x23, 0x71, 0x0c, + 0x95, 0x7a, 0xce, 0x20, 0xe9, 0x20, 0x88, 0x2a, 0x21, 0x13, 0x2e, 0x8e, 0x8c, 0xc4, 0x92, 0xf8, + 0x92, 0xca, 0x82, 0x54, 0x09, 0x66, 0xb0, 0x0e, 0x49, 0x74, 0x1d, 0xc6, 0x7a, 0x1e, 0x89, 0x25, + 0x21, 0x95, 0x05, 0xa9, 0x41, 0xec, 0x19, 0x10, 0x86, 0x93, 0x73, 0x94, 0x63, 0x7a, 0x66, 0x49, + 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x7e, 0x7a, 0x7e, 0x4e, 0x62, 0x5e, 0xba, 0x3e, 0xd8, + 0xd5, 0x49, 0xa5, 0x69, 0x10, 0x46, 0xb2, 0x6e, 0x7a, 0x6a, 0x9e, 0x6e, 0x7a, 0xbe, 0x3e, 0xc8, + 0xa0, 0x94, 0xc4, 0x92, 0x44, 0x88, 0xe7, 0xac, 0xe1, 0x86, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, + 0x60, 0x7d, 0xfc, 0x9f, 0x27, 0x01, 0x00, 0x00, +} diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/multi/multi1.proto b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/multi/multi1.proto index 0da6e0af4..d3a32041e 100644 --- a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/multi/multi1.proto +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/multi/multi1.proto @@ -36,6 +36,8 @@ import "multi/multi3.proto"; package multitest; +option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/multi;multitest"; + message Multi1 { required Multi2 multi2 = 1; optional Multi2.Color color = 2; diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/multi/multi2.pb.go b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/multi/multi2.pb.go new file mode 100644 index 000000000..b66ce7930 --- /dev/null +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/multi/multi2.pb.go @@ -0,0 +1,128 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: multi/multi2.proto + +package multitest // import "github.com/golang/protobuf/protoc-gen-go/testdata/multi" + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type Multi2_Color int32 + +const ( + Multi2_BLUE Multi2_Color = 1 + Multi2_GREEN Multi2_Color = 2 + Multi2_RED Multi2_Color = 3 +) + +var Multi2_Color_name = map[int32]string{ + 1: "BLUE", + 2: "GREEN", + 3: "RED", +} +var Multi2_Color_value = map[string]int32{ + "BLUE": 1, + "GREEN": 2, + "RED": 3, +} + +func (x Multi2_Color) Enum() *Multi2_Color { + p := new(Multi2_Color) + *p = x + return p +} +func (x Multi2_Color) String() string { + return proto.EnumName(Multi2_Color_name, int32(x)) +} +func (x *Multi2_Color) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(Multi2_Color_value, data, "Multi2_Color") + if err != nil { + return err + } + *x = Multi2_Color(value) + return nil +} +func (Multi2_Color) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_multi2_c47490ad66d93e67, []int{0, 0} +} + +type Multi2 struct { + RequiredValue *int32 `protobuf:"varint,1,req,name=required_value,json=requiredValue" json:"required_value,omitempty"` + Color *Multi2_Color `protobuf:"varint,2,opt,name=color,enum=multitest.Multi2_Color" json:"color,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Multi2) Reset() { *m = Multi2{} } +func (m *Multi2) String() string { return proto.CompactTextString(m) } +func (*Multi2) ProtoMessage() {} +func (*Multi2) Descriptor() ([]byte, []int) { + return fileDescriptor_multi2_c47490ad66d93e67, []int{0} +} +func (m *Multi2) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Multi2.Unmarshal(m, b) +} +func (m *Multi2) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Multi2.Marshal(b, m, deterministic) +} +func (dst *Multi2) XXX_Merge(src proto.Message) { + xxx_messageInfo_Multi2.Merge(dst, src) +} +func (m *Multi2) XXX_Size() int { + return xxx_messageInfo_Multi2.Size(m) +} +func (m *Multi2) XXX_DiscardUnknown() { + xxx_messageInfo_Multi2.DiscardUnknown(m) +} + +var xxx_messageInfo_Multi2 proto.InternalMessageInfo + +func (m *Multi2) GetRequiredValue() int32 { + if m != nil && m.RequiredValue != nil { + return *m.RequiredValue + } + return 0 +} + +func (m *Multi2) GetColor() Multi2_Color { + if m != nil && m.Color != nil { + return *m.Color + } + return Multi2_BLUE +} + +func init() { + proto.RegisterType((*Multi2)(nil), "multitest.Multi2") + proto.RegisterEnum("multitest.Multi2_Color", Multi2_Color_name, Multi2_Color_value) +} + +func init() { proto.RegisterFile("multi/multi2.proto", fileDescriptor_multi2_c47490ad66d93e67) } + +var fileDescriptor_multi2_c47490ad66d93e67 = []byte{ + // 202 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xca, 0x2d, 0xcd, 0x29, + 0xc9, 0xd4, 0x07, 0x93, 0x46, 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, 0x9c, 0x60, 0x5e, 0x49, + 0x6a, 0x71, 0x89, 0x52, 0x2b, 0x23, 0x17, 0x9b, 0x2f, 0x58, 0x4e, 0x48, 0x95, 0x8b, 0xaf, 0x28, + 0xb5, 0xb0, 0x34, 0xb3, 0x28, 0x35, 0x25, 0xbe, 0x2c, 0x31, 0xa7, 0x34, 0x55, 0x82, 0x51, 0x81, + 0x49, 0x83, 0x35, 0x88, 0x17, 0x26, 0x1a, 0x06, 0x12, 0x14, 0xd2, 0xe5, 0x62, 0x4d, 0xce, 0xcf, + 0xc9, 0x2f, 0x92, 0x60, 0x52, 0x60, 0xd4, 0xe0, 0x33, 0x12, 0xd7, 0x83, 0x1b, 0xa6, 0x07, 0x31, + 0x48, 0xcf, 0x19, 0x24, 0x1d, 0x04, 0x51, 0xa5, 0xa4, 0xca, 0xc5, 0x0a, 0xe6, 0x0b, 0x71, 0x70, + 0xb1, 0x38, 0xf9, 0x84, 0xba, 0x0a, 0x30, 0x0a, 0x71, 0x72, 0xb1, 0xba, 0x07, 0xb9, 0xba, 0xfa, + 0x09, 0x30, 0x09, 0xb1, 0x73, 0x31, 0x07, 0xb9, 0xba, 0x08, 0x30, 0x3b, 0x39, 0x47, 0x39, 0xa6, + 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0xa7, 0xe7, 0xe7, 0x24, 0xe6, 0xa5, + 0xeb, 0x83, 0x5d, 0x9b, 0x54, 0x9a, 0x06, 0x61, 0x24, 0xeb, 0xa6, 0xa7, 0xe6, 0xe9, 0xa6, 0xe7, + 0xeb, 0x83, 0xec, 0x4a, 0x49, 0x2c, 0x49, 0x84, 0x78, 0xca, 0x1a, 0x6e, 0x3f, 0x20, 0x00, 0x00, + 0xff, 0xff, 0x49, 0x3b, 0x52, 0x44, 0xec, 0x00, 0x00, 0x00, +} diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/multi/multi2.proto b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/multi/multi2.proto index e6bfc71b3..ec5b431e3 100644 --- a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/multi/multi2.proto +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/multi/multi2.proto @@ -33,6 +33,8 @@ syntax = "proto2"; package multitest; +option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/multi;multitest"; + message Multi2 { required int32 required_value = 1; diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/multi/multi3.pb.go b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/multi/multi3.pb.go new file mode 100644 index 000000000..f03c350a0 --- /dev/null +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/multi/multi3.pb.go @@ -0,0 +1,115 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: multi/multi3.proto + +package multitest // import "github.com/golang/protobuf/protoc-gen-go/testdata/multi" + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type Multi3_HatType int32 + +const ( + Multi3_FEDORA Multi3_HatType = 1 + Multi3_FEZ Multi3_HatType = 2 +) + +var Multi3_HatType_name = map[int32]string{ + 1: "FEDORA", + 2: "FEZ", +} +var Multi3_HatType_value = map[string]int32{ + "FEDORA": 1, + "FEZ": 2, +} + +func (x Multi3_HatType) Enum() *Multi3_HatType { + p := new(Multi3_HatType) + *p = x + return p +} +func (x Multi3_HatType) String() string { + return proto.EnumName(Multi3_HatType_name, int32(x)) +} +func (x *Multi3_HatType) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(Multi3_HatType_value, data, "Multi3_HatType") + if err != nil { + return err + } + *x = Multi3_HatType(value) + return nil +} +func (Multi3_HatType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_multi3_d55a72b4628b7875, []int{0, 0} +} + +type Multi3 struct { + HatType *Multi3_HatType `protobuf:"varint,1,opt,name=hat_type,json=hatType,enum=multitest.Multi3_HatType" json:"hat_type,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Multi3) Reset() { *m = Multi3{} } +func (m *Multi3) String() string { return proto.CompactTextString(m) } +func (*Multi3) ProtoMessage() {} +func (*Multi3) Descriptor() ([]byte, []int) { + return fileDescriptor_multi3_d55a72b4628b7875, []int{0} +} +func (m *Multi3) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Multi3.Unmarshal(m, b) +} +func (m *Multi3) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Multi3.Marshal(b, m, deterministic) +} +func (dst *Multi3) XXX_Merge(src proto.Message) { + xxx_messageInfo_Multi3.Merge(dst, src) +} +func (m *Multi3) XXX_Size() int { + return xxx_messageInfo_Multi3.Size(m) +} +func (m *Multi3) XXX_DiscardUnknown() { + xxx_messageInfo_Multi3.DiscardUnknown(m) +} + +var xxx_messageInfo_Multi3 proto.InternalMessageInfo + +func (m *Multi3) GetHatType() Multi3_HatType { + if m != nil && m.HatType != nil { + return *m.HatType + } + return Multi3_FEDORA +} + +func init() { + proto.RegisterType((*Multi3)(nil), "multitest.Multi3") + proto.RegisterEnum("multitest.Multi3_HatType", Multi3_HatType_name, Multi3_HatType_value) +} + +func init() { proto.RegisterFile("multi/multi3.proto", fileDescriptor_multi3_d55a72b4628b7875) } + +var fileDescriptor_multi3_d55a72b4628b7875 = []byte{ + // 170 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xca, 0x2d, 0xcd, 0x29, + 0xc9, 0xd4, 0x07, 0x93, 0xc6, 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, 0x9c, 0x60, 0x5e, 0x49, + 0x6a, 0x71, 0x89, 0x52, 0x1c, 0x17, 0x9b, 0x2f, 0x58, 0x4a, 0xc8, 0x84, 0x8b, 0x23, 0x23, 0xb1, + 0x24, 0xbe, 0xa4, 0xb2, 0x20, 0x55, 0x82, 0x51, 0x81, 0x51, 0x83, 0xcf, 0x48, 0x52, 0x0f, 0xae, + 0x4e, 0x0f, 0xa2, 0x48, 0xcf, 0x23, 0xb1, 0x24, 0xa4, 0xb2, 0x20, 0x35, 0x88, 0x3d, 0x03, 0xc2, + 0x50, 0x92, 0xe3, 0x62, 0x87, 0x8a, 0x09, 0x71, 0x71, 0xb1, 0xb9, 0xb9, 0xba, 0xf8, 0x07, 0x39, + 0x0a, 0x30, 0x0a, 0xb1, 0x73, 0x31, 0xbb, 0xb9, 0x46, 0x09, 0x30, 0x39, 0x39, 0x47, 0x39, 0xa6, + 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0xa7, 0xe7, 0xe7, 0x24, 0xe6, 0xa5, + 0xeb, 0x83, 0x5d, 0x91, 0x54, 0x9a, 0x06, 0x61, 0x24, 0xeb, 0xa6, 0xa7, 0xe6, 0xe9, 0xa6, 0xe7, + 0xeb, 0x83, 0x2c, 0x4a, 0x49, 0x2c, 0x49, 0x84, 0x38, 0xd6, 0x1a, 0x6e, 0x39, 0x20, 0x00, 0x00, + 0xff, 0xff, 0xd5, 0xa4, 0x1a, 0x0e, 0xc4, 0x00, 0x00, 0x00, +} diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/multi/multi3.proto b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/multi/multi3.proto index 146c255bd..8690b8815 100644 --- a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/multi/multi3.proto +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/multi/multi3.proto @@ -33,6 +33,8 @@ syntax = "proto2"; package multitest; +option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/multi;multitest"; + message Multi3 { enum HatType { FEDORA = 1; diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/my_test/test.pb.go b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/my_test/test.pb.go index 1954e3fb7..8cf6a698f 100644 --- a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/my_test/test.pb.go +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/my_test/test.pb.go @@ -1,24 +1,11 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // source: my_test/test.proto -/* -Package my_test is a generated protocol buffer package. +package test // import "github.com/golang/protobuf/protoc-gen-go/testdata/my_test" +/* This package holds interesting messages. - -It is generated from these files: - my_test/test.proto - -It has these top-level messages: - Request - Reply - OtherBase - ReplyExtensions - OtherReplyExtensions - OldReply - Communique */ -package my_test import proto "github.com/golang/protobuf/proto" import fmt "fmt" @@ -69,6 +56,9 @@ func (x *HatType) UnmarshalJSON(data []byte) error { *x = HatType(value) return nil } +func (HatType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_test_2309d445eee26af7, []int{0} +} // This enum represents days of the week. type Days int32 @@ -106,6 +96,9 @@ func (x *Days) UnmarshalJSON(data []byte) error { *x = Days(value) return nil } +func (Days) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_test_2309d445eee26af7, []int{1} +} type Request_Color int32 @@ -142,6 +135,9 @@ func (x *Request_Color) UnmarshalJSON(data []byte) error { *x = Request_Color(value) return nil } +func (Request_Color) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_test_2309d445eee26af7, []int{0, 0} +} type Reply_Entry_Game int32 @@ -175,6 +171,9 @@ func (x *Reply_Entry_Game) UnmarshalJSON(data []byte) error { *x = Reply_Entry_Game(value) return nil } +func (Reply_Entry_Game) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_test_2309d445eee26af7, []int{1, 0, 0} +} // This is a message that might be sent somewhere. type Request struct { @@ -191,13 +190,35 @@ type Request struct { MsgMapping map[int64]*Reply `protobuf:"bytes,15,rep,name=msg_mapping,json=msgMapping" json:"msg_mapping,omitempty" protobuf_key:"zigzag64,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` Reset_ *int32 `protobuf:"varint,12,opt,name=reset" json:"reset,omitempty"` // This field should not conflict with any getters. - GetKey_ *string `protobuf:"bytes,16,opt,name=get_key,json=getKey" json:"get_key,omitempty"` - XXX_unrecognized []byte `json:"-"` + GetKey_ *string `protobuf:"bytes,16,opt,name=get_key,json=getKey" json:"get_key,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *Request) Reset() { *m = Request{} } func (m *Request) String() string { return proto.CompactTextString(m) } func (*Request) ProtoMessage() {} +func (*Request) Descriptor() ([]byte, []int) { + return fileDescriptor_test_2309d445eee26af7, []int{0} +} +func (m *Request) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Request.Unmarshal(m, b) +} +func (m *Request) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Request.Marshal(b, m, deterministic) +} +func (dst *Request) XXX_Merge(src proto.Message) { + xxx_messageInfo_Request.Merge(dst, src) +} +func (m *Request) XXX_Size() int { + return xxx_messageInfo_Request.Size(m) +} +func (m *Request) XXX_DiscardUnknown() { + xxx_messageInfo_Request.DiscardUnknown(m) +} + +var xxx_messageInfo_Request proto.InternalMessageInfo const Default_Request_Hat HatType = HatType_FEDORA @@ -267,13 +288,35 @@ func (m *Request) GetGetKey_() string { } type Request_SomeGroup struct { - GroupField *int32 `protobuf:"varint,9,opt,name=group_field,json=groupField" json:"group_field,omitempty"` - XXX_unrecognized []byte `json:"-"` + GroupField *int32 `protobuf:"varint,9,opt,name=group_field,json=groupField" json:"group_field,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *Request_SomeGroup) Reset() { *m = Request_SomeGroup{} } func (m *Request_SomeGroup) String() string { return proto.CompactTextString(m) } func (*Request_SomeGroup) ProtoMessage() {} +func (*Request_SomeGroup) Descriptor() ([]byte, []int) { + return fileDescriptor_test_2309d445eee26af7, []int{0, 0} +} +func (m *Request_SomeGroup) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Request_SomeGroup.Unmarshal(m, b) +} +func (m *Request_SomeGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Request_SomeGroup.Marshal(b, m, deterministic) +} +func (dst *Request_SomeGroup) XXX_Merge(src proto.Message) { + xxx_messageInfo_Request_SomeGroup.Merge(dst, src) +} +func (m *Request_SomeGroup) XXX_Size() int { + return xxx_messageInfo_Request_SomeGroup.Size(m) +} +func (m *Request_SomeGroup) XXX_DiscardUnknown() { + xxx_messageInfo_Request_SomeGroup.DiscardUnknown(m) +} + +var xxx_messageInfo_Request_SomeGroup proto.InternalMessageInfo func (m *Request_SomeGroup) GetGroupField() int32 { if m != nil && m.GroupField != nil { @@ -285,21 +328,43 @@ func (m *Request_SomeGroup) GetGroupField() int32 { type Reply struct { Found []*Reply_Entry `protobuf:"bytes,1,rep,name=found" json:"found,omitempty"` CompactKeys []int32 `protobuf:"varint,2,rep,packed,name=compact_keys,json=compactKeys" json:"compact_keys,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` proto.XXX_InternalExtensions `json:"-"` XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *Reply) Reset() { *m = Reply{} } func (m *Reply) String() string { return proto.CompactTextString(m) } func (*Reply) ProtoMessage() {} +func (*Reply) Descriptor() ([]byte, []int) { + return fileDescriptor_test_2309d445eee26af7, []int{1} +} var extRange_Reply = []proto.ExtensionRange{ - {100, 536870911}, + {Start: 100, End: 536870911}, } func (*Reply) ExtensionRangeArray() []proto.ExtensionRange { return extRange_Reply } +func (m *Reply) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Reply.Unmarshal(m, b) +} +func (m *Reply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Reply.Marshal(b, m, deterministic) +} +func (dst *Reply) XXX_Merge(src proto.Message) { + xxx_messageInfo_Reply.Merge(dst, src) +} +func (m *Reply) XXX_Size() int { + return xxx_messageInfo_Reply.Size(m) +} +func (m *Reply) XXX_DiscardUnknown() { + xxx_messageInfo_Reply.DiscardUnknown(m) +} + +var xxx_messageInfo_Reply proto.InternalMessageInfo func (m *Reply) GetFound() []*Reply_Entry { if m != nil { @@ -316,15 +381,37 @@ func (m *Reply) GetCompactKeys() []int32 { } type Reply_Entry struct { - KeyThatNeeds_1234Camel_CasIng *int64 `protobuf:"varint,1,req,name=key_that_needs_1234camel_CasIng,json=keyThatNeeds1234camelCasIng" json:"key_that_needs_1234camel_CasIng,omitempty"` - Value *int64 `protobuf:"varint,2,opt,name=value,def=7" json:"value,omitempty"` - XMyFieldName_2 *int64 `protobuf:"varint,3,opt,name=_my_field_name_2,json=MyFieldName2" json:"_my_field_name_2,omitempty"` - XXX_unrecognized []byte `json:"-"` + KeyThatNeeds_1234Camel_CasIng *int64 `protobuf:"varint,1,req,name=key_that_needs_1234camel_CasIng,json=keyThatNeeds1234camelCasIng" json:"key_that_needs_1234camel_CasIng,omitempty"` + Value *int64 `protobuf:"varint,2,opt,name=value,def=7" json:"value,omitempty"` + XMyFieldName_2 *int64 `protobuf:"varint,3,opt,name=_my_field_name_2,json=MyFieldName2" json:"_my_field_name_2,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *Reply_Entry) Reset() { *m = Reply_Entry{} } func (m *Reply_Entry) String() string { return proto.CompactTextString(m) } func (*Reply_Entry) ProtoMessage() {} +func (*Reply_Entry) Descriptor() ([]byte, []int) { + return fileDescriptor_test_2309d445eee26af7, []int{1, 0} +} +func (m *Reply_Entry) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Reply_Entry.Unmarshal(m, b) +} +func (m *Reply_Entry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Reply_Entry.Marshal(b, m, deterministic) +} +func (dst *Reply_Entry) XXX_Merge(src proto.Message) { + xxx_messageInfo_Reply_Entry.Merge(dst, src) +} +func (m *Reply_Entry) XXX_Size() int { + return xxx_messageInfo_Reply_Entry.Size(m) +} +func (m *Reply_Entry) XXX_DiscardUnknown() { + xxx_messageInfo_Reply_Entry.DiscardUnknown(m) +} + +var xxx_messageInfo_Reply_Entry proto.InternalMessageInfo const Default_Reply_Entry_Value int64 = 7 @@ -350,22 +437,44 @@ func (m *Reply_Entry) GetXMyFieldName_2() int64 { } type OtherBase struct { - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` proto.XXX_InternalExtensions `json:"-"` XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *OtherBase) Reset() { *m = OtherBase{} } func (m *OtherBase) String() string { return proto.CompactTextString(m) } func (*OtherBase) ProtoMessage() {} +func (*OtherBase) Descriptor() ([]byte, []int) { + return fileDescriptor_test_2309d445eee26af7, []int{2} +} var extRange_OtherBase = []proto.ExtensionRange{ - {100, 536870911}, + {Start: 100, End: 536870911}, } func (*OtherBase) ExtensionRangeArray() []proto.ExtensionRange { return extRange_OtherBase } +func (m *OtherBase) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_OtherBase.Unmarshal(m, b) +} +func (m *OtherBase) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_OtherBase.Marshal(b, m, deterministic) +} +func (dst *OtherBase) XXX_Merge(src proto.Message) { + xxx_messageInfo_OtherBase.Merge(dst, src) +} +func (m *OtherBase) XXX_Size() int { + return xxx_messageInfo_OtherBase.Size(m) +} +func (m *OtherBase) XXX_DiscardUnknown() { + xxx_messageInfo_OtherBase.DiscardUnknown(m) +} + +var xxx_messageInfo_OtherBase proto.InternalMessageInfo func (m *OtherBase) GetName() string { if m != nil && m.Name != nil { @@ -375,12 +484,34 @@ func (m *OtherBase) GetName() string { } type ReplyExtensions struct { - XXX_unrecognized []byte `json:"-"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *ReplyExtensions) Reset() { *m = ReplyExtensions{} } func (m *ReplyExtensions) String() string { return proto.CompactTextString(m) } func (*ReplyExtensions) ProtoMessage() {} +func (*ReplyExtensions) Descriptor() ([]byte, []int) { + return fileDescriptor_test_2309d445eee26af7, []int{3} +} +func (m *ReplyExtensions) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ReplyExtensions.Unmarshal(m, b) +} +func (m *ReplyExtensions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ReplyExtensions.Marshal(b, m, deterministic) +} +func (dst *ReplyExtensions) XXX_Merge(src proto.Message) { + xxx_messageInfo_ReplyExtensions.Merge(dst, src) +} +func (m *ReplyExtensions) XXX_Size() int { + return xxx_messageInfo_ReplyExtensions.Size(m) +} +func (m *ReplyExtensions) XXX_DiscardUnknown() { + xxx_messageInfo_ReplyExtensions.DiscardUnknown(m) +} + +var xxx_messageInfo_ReplyExtensions proto.InternalMessageInfo var E_ReplyExtensions_Time = &proto.ExtensionDesc{ ExtendedType: (*Reply)(nil), @@ -410,13 +541,35 @@ var E_ReplyExtensions_Donut = &proto.ExtensionDesc{ } type OtherReplyExtensions struct { - Key *int32 `protobuf:"varint,1,opt,name=key" json:"key,omitempty"` - XXX_unrecognized []byte `json:"-"` + Key *int32 `protobuf:"varint,1,opt,name=key" json:"key,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *OtherReplyExtensions) Reset() { *m = OtherReplyExtensions{} } func (m *OtherReplyExtensions) String() string { return proto.CompactTextString(m) } func (*OtherReplyExtensions) ProtoMessage() {} +func (*OtherReplyExtensions) Descriptor() ([]byte, []int) { + return fileDescriptor_test_2309d445eee26af7, []int{4} +} +func (m *OtherReplyExtensions) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_OtherReplyExtensions.Unmarshal(m, b) +} +func (m *OtherReplyExtensions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_OtherReplyExtensions.Marshal(b, m, deterministic) +} +func (dst *OtherReplyExtensions) XXX_Merge(src proto.Message) { + xxx_messageInfo_OtherReplyExtensions.Merge(dst, src) +} +func (m *OtherReplyExtensions) XXX_Size() int { + return xxx_messageInfo_OtherReplyExtensions.Size(m) +} +func (m *OtherReplyExtensions) XXX_DiscardUnknown() { + xxx_messageInfo_OtherReplyExtensions.DiscardUnknown(m) +} + +var xxx_messageInfo_OtherReplyExtensions proto.InternalMessageInfo func (m *OtherReplyExtensions) GetKey() int32 { if m != nil && m.Key != nil { @@ -426,20 +579,19 @@ func (m *OtherReplyExtensions) GetKey() int32 { } type OldReply struct { - proto.XXX_InternalExtensions `json:"-"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + proto.XXX_InternalExtensions `protobuf_messageset:"1" json:"-"` XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *OldReply) Reset() { *m = OldReply{} } func (m *OldReply) String() string { return proto.CompactTextString(m) } func (*OldReply) ProtoMessage() {} - -func (m *OldReply) Marshal() ([]byte, error) { - return proto.MarshalMessageSet(&m.XXX_InternalExtensions) -} -func (m *OldReply) Unmarshal(buf []byte) error { - return proto.UnmarshalMessageSet(buf, &m.XXX_InternalExtensions) +func (*OldReply) Descriptor() ([]byte, []int) { + return fileDescriptor_test_2309d445eee26af7, []int{5} } + func (m *OldReply) MarshalJSON() ([]byte, error) { return proto.MarshalMessageSetJSON(&m.XXX_InternalExtensions) } @@ -447,17 +599,30 @@ func (m *OldReply) UnmarshalJSON(buf []byte) error { return proto.UnmarshalMessageSetJSON(buf, &m.XXX_InternalExtensions) } -// ensure OldReply satisfies proto.Marshaler and proto.Unmarshaler -var _ proto.Marshaler = (*OldReply)(nil) -var _ proto.Unmarshaler = (*OldReply)(nil) - var extRange_OldReply = []proto.ExtensionRange{ - {100, 2147483646}, + {Start: 100, End: 2147483646}, } func (*OldReply) ExtensionRangeArray() []proto.ExtensionRange { return extRange_OldReply } +func (m *OldReply) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_OldReply.Unmarshal(m, b) +} +func (m *OldReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_OldReply.Marshal(b, m, deterministic) +} +func (dst *OldReply) XXX_Merge(src proto.Message) { + xxx_messageInfo_OldReply.Merge(dst, src) +} +func (m *OldReply) XXX_Size() int { + return xxx_messageInfo_OldReply.Size(m) +} +func (m *OldReply) XXX_DiscardUnknown() { + xxx_messageInfo_OldReply.DiscardUnknown(m) +} + +var xxx_messageInfo_OldReply proto.InternalMessageInfo type Communique struct { MakeMeCry *bool `protobuf:"varint,1,opt,name=make_me_cry,json=makeMeCry" json:"make_me_cry,omitempty"` @@ -474,13 +639,35 @@ type Communique struct { // *Communique_Delta_ // *Communique_Msg // *Communique_Somegroup - Union isCommunique_Union `protobuf_oneof:"union"` - XXX_unrecognized []byte `json:"-"` + Union isCommunique_Union `protobuf_oneof:"union"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *Communique) Reset() { *m = Communique{} } func (m *Communique) String() string { return proto.CompactTextString(m) } func (*Communique) ProtoMessage() {} +func (*Communique) Descriptor() ([]byte, []int) { + return fileDescriptor_test_2309d445eee26af7, []int{6} +} +func (m *Communique) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Communique.Unmarshal(m, b) +} +func (m *Communique) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Communique.Marshal(b, m, deterministic) +} +func (dst *Communique) XXX_Merge(src proto.Message) { + xxx_messageInfo_Communique.Merge(dst, src) +} +func (m *Communique) XXX_Size() int { + return xxx_messageInfo_Communique.Size(m) +} +func (m *Communique) XXX_DiscardUnknown() { + xxx_messageInfo_Communique.DiscardUnknown(m) +} + +var xxx_messageInfo_Communique proto.InternalMessageInfo type isCommunique_Union interface { isCommunique_Union() @@ -511,7 +698,7 @@ type Communique_Delta_ struct { Delta int32 `protobuf:"zigzag32,12,opt,name=delta,oneof"` } type Communique_Msg struct { - Msg *Reply `protobuf:"bytes,13,opt,name=msg,oneof"` + Msg *Reply `protobuf:"bytes,16,opt,name=msg,oneof"` } type Communique_Somegroup struct { Somegroup *Communique_SomeGroup `protobuf:"group,14,opt,name=SomeGroup,json=somegroup,oneof"` @@ -661,7 +848,7 @@ func _Communique_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { b.EncodeVarint(12<<3 | proto.WireVarint) b.EncodeZigzag32(uint64(x.Delta)) case *Communique_Msg: - b.EncodeVarint(13<<3 | proto.WireBytes) + b.EncodeVarint(16<<3 | proto.WireBytes) if err := b.EncodeMessage(x.Msg); err != nil { return err } @@ -737,7 +924,7 @@ func _Communique_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buf x, err := b.DecodeZigzag32() m.Union = &Communique_Delta_{int32(x)} return true, err - case 13: // union.msg + case 16: // union.msg if wire != proto.WireBytes { return true, proto.ErrInternalBadWireType } @@ -763,40 +950,40 @@ func _Communique_OneofSizer(msg proto.Message) (n int) { // union switch x := m.Union.(type) { case *Communique_Number: - n += proto.SizeVarint(5<<3 | proto.WireVarint) + n += 1 // tag and wire n += proto.SizeVarint(uint64(x.Number)) case *Communique_Name: - n += proto.SizeVarint(6<<3 | proto.WireBytes) + n += 1 // tag and wire n += proto.SizeVarint(uint64(len(x.Name))) n += len(x.Name) case *Communique_Data: - n += proto.SizeVarint(7<<3 | proto.WireBytes) + n += 1 // tag and wire n += proto.SizeVarint(uint64(len(x.Data))) n += len(x.Data) case *Communique_TempC: - n += proto.SizeVarint(8<<3 | proto.WireFixed64) + n += 1 // tag and wire n += 8 case *Communique_Height: - n += proto.SizeVarint(9<<3 | proto.WireFixed32) + n += 1 // tag and wire n += 4 case *Communique_Today: - n += proto.SizeVarint(10<<3 | proto.WireVarint) + n += 1 // tag and wire n += proto.SizeVarint(uint64(x.Today)) case *Communique_Maybe: - n += proto.SizeVarint(11<<3 | proto.WireVarint) + n += 1 // tag and wire n += 1 case *Communique_Delta_: - n += proto.SizeVarint(12<<3 | proto.WireVarint) + n += 1 // tag and wire n += proto.SizeVarint(uint64((uint32(x.Delta) << 1) ^ uint32((int32(x.Delta) >> 31)))) case *Communique_Msg: s := proto.Size(x.Msg) - n += proto.SizeVarint(13<<3 | proto.WireBytes) + n += 2 // tag and wire n += proto.SizeVarint(uint64(s)) n += s case *Communique_Somegroup: - n += proto.SizeVarint(14<<3 | proto.WireStartGroup) + n += 1 // tag and wire n += proto.Size(x.Somegroup) - n += proto.SizeVarint(14<<3 | proto.WireEndGroup) + n += 1 // tag and wire case nil: default: panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) @@ -805,13 +992,35 @@ func _Communique_OneofSizer(msg proto.Message) (n int) { } type Communique_SomeGroup struct { - Member *string `protobuf:"bytes,15,opt,name=member" json:"member,omitempty"` - XXX_unrecognized []byte `json:"-"` + Member *string `protobuf:"bytes,15,opt,name=member" json:"member,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *Communique_SomeGroup) Reset() { *m = Communique_SomeGroup{} } func (m *Communique_SomeGroup) String() string { return proto.CompactTextString(m) } func (*Communique_SomeGroup) ProtoMessage() {} +func (*Communique_SomeGroup) Descriptor() ([]byte, []int) { + return fileDescriptor_test_2309d445eee26af7, []int{6, 0} +} +func (m *Communique_SomeGroup) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Communique_SomeGroup.Unmarshal(m, b) +} +func (m *Communique_SomeGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Communique_SomeGroup.Marshal(b, m, deterministic) +} +func (dst *Communique_SomeGroup) XXX_Merge(src proto.Message) { + xxx_messageInfo_Communique_SomeGroup.Merge(dst, src) +} +func (m *Communique_SomeGroup) XXX_Size() int { + return xxx_messageInfo_Communique_SomeGroup.Size(m) +} +func (m *Communique_SomeGroup) XXX_DiscardUnknown() { + xxx_messageInfo_Communique_SomeGroup.DiscardUnknown(m) +} + +var xxx_messageInfo_Communique_SomeGroup proto.InternalMessageInfo func (m *Communique_SomeGroup) GetMember() string { if m != nil && m.Member != nil { @@ -821,12 +1030,34 @@ func (m *Communique_SomeGroup) GetMember() string { } type Communique_Delta struct { - XXX_unrecognized []byte `json:"-"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *Communique_Delta) Reset() { *m = Communique_Delta{} } func (m *Communique_Delta) String() string { return proto.CompactTextString(m) } func (*Communique_Delta) ProtoMessage() {} +func (*Communique_Delta) Descriptor() ([]byte, []int) { + return fileDescriptor_test_2309d445eee26af7, []int{6, 1} +} +func (m *Communique_Delta) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Communique_Delta.Unmarshal(m, b) +} +func (m *Communique_Delta) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Communique_Delta.Marshal(b, m, deterministic) +} +func (dst *Communique_Delta) XXX_Merge(src proto.Message) { + xxx_messageInfo_Communique_Delta.Merge(dst, src) +} +func (m *Communique_Delta) XXX_Size() int { + return xxx_messageInfo_Communique_Delta.Size(m) +} +func (m *Communique_Delta) XXX_DiscardUnknown() { + xxx_messageInfo_Communique_Delta.DiscardUnknown(m) +} + +var xxx_messageInfo_Communique_Delta proto.InternalMessageInfo var E_Tag = &proto.ExtensionDesc{ ExtendedType: (*Reply)(nil), @@ -848,6 +1079,8 @@ var E_Donut = &proto.ExtensionDesc{ func init() { proto.RegisterType((*Request)(nil), "my.test.Request") + proto.RegisterMapType((map[int64]*Reply)(nil), "my.test.Request.MsgMappingEntry") + proto.RegisterMapType((map[int32]string)(nil), "my.test.Request.NameMappingEntry") proto.RegisterType((*Request_SomeGroup)(nil), "my.test.Request.SomeGroup") proto.RegisterType((*Reply)(nil), "my.test.Reply") proto.RegisterType((*Reply_Entry)(nil), "my.test.Reply.Entry") @@ -868,3 +1101,74 @@ func init() { proto.RegisterExtension(E_Tag) proto.RegisterExtension(E_Donut) } + +func init() { proto.RegisterFile("my_test/test.proto", fileDescriptor_test_2309d445eee26af7) } + +var fileDescriptor_test_2309d445eee26af7 = []byte{ + // 1033 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x55, 0xdd, 0x6e, 0xe3, 0x44, + 0x14, 0xce, 0xd8, 0x71, 0x7e, 0x4e, 0x42, 0x6b, 0x46, 0x55, 0x6b, 0x05, 0xed, 0xd6, 0x04, 0x8a, + 0x4c, 0xc5, 0xa6, 0xda, 0x80, 0xc4, 0x2a, 0x88, 0xd5, 0x36, 0x3f, 0x6d, 0xaa, 0x6d, 0x12, 0x69, + 0xda, 0x5e, 0xb0, 0x37, 0xd6, 0x34, 0x9e, 0x3a, 0xa6, 0x19, 0x3b, 0x6b, 0x8f, 0x11, 0xbe, 0xeb, + 0x53, 0xc0, 0x6b, 0x70, 0xcf, 0x0b, 0xf1, 0x16, 0x45, 0x33, 0x0e, 0x49, 0xda, 0xa0, 0xbd, 0xb1, + 0x7c, 0xce, 0xf9, 0xce, 0xe7, 0x39, 0x3f, 0xfe, 0x06, 0x30, 0xcf, 0x5c, 0xc1, 0x12, 0x71, 0x22, + 0x1f, 0xad, 0x45, 0x1c, 0x89, 0x08, 0x97, 0x79, 0xd6, 0x92, 0x66, 0x03, 0xf3, 0x74, 0x2e, 0x82, + 0x13, 0xf5, 0x7c, 0x9d, 0x07, 0x9b, 0xff, 0x14, 0xa1, 0x4c, 0xd8, 0xc7, 0x94, 0x25, 0x02, 0x9b, + 0xa0, 0xdf, 0xb3, 0xcc, 0x42, 0xb6, 0xee, 0xe8, 0x44, 0xbe, 0x62, 0x07, 0xf4, 0x59, 0xca, 0x2c, + 0xdd, 0x46, 0xce, 0x4e, 0x7b, 0xbf, 0xb5, 0x24, 0x6a, 0x2d, 0x13, 0x5a, 0xbd, 0x68, 0x1e, 0xc5, + 0x44, 0x42, 0xf0, 0x31, 0xe8, 0x33, 0x2a, 0xac, 0xa2, 0x42, 0x9a, 0x2b, 0xe4, 0x90, 0x8a, 0xeb, + 0x6c, 0xc1, 0x3a, 0xa5, 0xb3, 0x41, 0x7f, 0x42, 0x4e, 0x89, 0x04, 0xe1, 0x43, 0xa8, 0x78, 0x8c, + 0x7a, 0xf3, 0x20, 0x64, 0x56, 0xd9, 0x46, 0x8e, 0xd6, 0xd1, 0x83, 0xf0, 0x8e, 0xac, 0x9c, 0xf8, + 0x0d, 0x54, 0x93, 0x88, 0x33, 0x3f, 0x8e, 0xd2, 0x85, 0x55, 0xb1, 0x91, 0x03, 0xed, 0xc6, 0xd6, + 0xc7, 0xaf, 0x22, 0xce, 0xce, 0x25, 0x82, 0xac, 0xc1, 0xb8, 0x0f, 0xf5, 0x90, 0x72, 0xe6, 0x72, + 0xba, 0x58, 0x04, 0xa1, 0x6f, 0xed, 0xd8, 0xba, 0x53, 0x6b, 0x7f, 0xb9, 0x95, 0x3c, 0xa6, 0x9c, + 0x8d, 0x72, 0xcc, 0x20, 0x14, 0x71, 0x46, 0x6a, 0xe1, 0xda, 0x83, 0x4f, 0xa1, 0xc6, 0x13, 0x7f, + 0x45, 0xb2, 0xab, 0x48, 0xec, 0x2d, 0x92, 0x51, 0xe2, 0x3f, 0xe1, 0x00, 0xbe, 0x72, 0xe0, 0x3d, + 0x30, 0x62, 0x96, 0x30, 0x61, 0xd5, 0x6d, 0xe4, 0x18, 0x24, 0x37, 0xf0, 0x01, 0x94, 0x7d, 0x26, + 0x5c, 0xd9, 0x65, 0xd3, 0x46, 0x4e, 0x95, 0x94, 0x7c, 0x26, 0xde, 0xb3, 0xac, 0xf1, 0x1d, 0x54, + 0x57, 0xf5, 0xe0, 0x43, 0xa8, 0xa9, 0x6a, 0xdc, 0xbb, 0x80, 0xcd, 0x3d, 0xab, 0xaa, 0x18, 0x40, + 0xb9, 0xce, 0xa4, 0xa7, 0xf1, 0x16, 0xcc, 0xe7, 0x05, 0xac, 0x87, 0x27, 0xc1, 0x6a, 0x78, 0x7b, + 0x60, 0xfc, 0x46, 0xe7, 0x29, 0xb3, 0x34, 0xf5, 0xa9, 0xdc, 0xe8, 0x68, 0x6f, 0x50, 0x63, 0x04, + 0xbb, 0xcf, 0xce, 0xbe, 0x99, 0x8e, 0xf3, 0xf4, 0xaf, 0x37, 0xd3, 0x6b, 0xed, 0x9d, 0x8d, 0xf2, + 0x17, 0xf3, 0x6c, 0x83, 0xae, 0x79, 0x04, 0x86, 0xda, 0x04, 0x5c, 0x06, 0x9d, 0x0c, 0xfa, 0x66, + 0x01, 0x57, 0xc1, 0x38, 0x27, 0x83, 0xc1, 0xd8, 0x44, 0xb8, 0x02, 0xc5, 0xee, 0xe5, 0xcd, 0xc0, + 0xd4, 0x9a, 0x7f, 0x6a, 0x60, 0xa8, 0x5c, 0x7c, 0x0c, 0xc6, 0x5d, 0x94, 0x86, 0x9e, 0x5a, 0xb5, + 0x5a, 0x7b, 0xef, 0x29, 0x75, 0x2b, 0xef, 0x66, 0x0e, 0xc1, 0x47, 0x50, 0x9f, 0x46, 0x7c, 0x41, + 0xa7, 0xaa, 0x6d, 0x89, 0xa5, 0xd9, 0xba, 0x63, 0x74, 0x35, 0x13, 0x91, 0xda, 0xd2, 0xff, 0x9e, + 0x65, 0x49, 0xe3, 0x2f, 0x04, 0x46, 0x5e, 0x49, 0x1f, 0x0e, 0xef, 0x59, 0xe6, 0x8a, 0x19, 0x15, + 0x6e, 0xc8, 0x98, 0x97, 0xb8, 0xaf, 0xdb, 0xdf, 0xff, 0x30, 0xa5, 0x9c, 0xcd, 0xdd, 0x1e, 0x4d, + 0x2e, 0x42, 0xdf, 0x42, 0xb6, 0xe6, 0xe8, 0xe4, 0x8b, 0x7b, 0x96, 0x5d, 0xcf, 0xa8, 0x18, 0x4b, + 0xd0, 0x0a, 0x93, 0x43, 0xf0, 0xc1, 0x66, 0xf5, 0x7a, 0x07, 0xfd, 0xb8, 0x2c, 0x18, 0x7f, 0x03, + 0xa6, 0xcb, 0xb3, 0x7c, 0x34, 0xae, 0xda, 0xb5, 0xb6, 0xfa, 0x3f, 0x74, 0x52, 0x1f, 0x65, 0x6a, + 0x3c, 0x72, 0x34, 0xed, 0xa6, 0x0d, 0xc5, 0x73, 0xca, 0x19, 0xae, 0x43, 0xe5, 0x6c, 0x32, 0xb9, + 0xee, 0x9e, 0x5e, 0x5e, 0x9a, 0x08, 0x03, 0x94, 0xae, 0x07, 0xe3, 0xf1, 0xc5, 0x95, 0xa9, 0x1d, + 0x57, 0x2a, 0x9e, 0xf9, 0xf0, 0xf0, 0xf0, 0xa0, 0x35, 0xbf, 0x85, 0xea, 0x44, 0xcc, 0x58, 0xdc, + 0xa5, 0x09, 0xc3, 0x18, 0x8a, 0x92, 0x56, 0x8d, 0xa2, 0x4a, 0xd4, 0xfb, 0x06, 0xf4, 0x6f, 0x04, + 0xbb, 0xaa, 0x4b, 0x83, 0xdf, 0x05, 0x0b, 0x93, 0x20, 0x0a, 0x93, 0x76, 0x13, 0x8a, 0x22, 0xe0, + 0x0c, 0x3f, 0x1b, 0x91, 0xc5, 0x6c, 0xe4, 0x20, 0xa2, 0x62, 0xed, 0x77, 0x50, 0x9a, 0xd2, 0x38, + 0x8e, 0xc4, 0x16, 0x2a, 0x50, 0xe3, 0xb5, 0x9e, 0x7a, 0xd7, 0xec, 0x64, 0x99, 0xd7, 0xee, 0x82, + 0xe1, 0x45, 0x61, 0x2a, 0x30, 0x5e, 0x41, 0x57, 0x87, 0x56, 0x9f, 0xfa, 0x14, 0x49, 0x9e, 0xda, + 0x74, 0x60, 0x4f, 0xe5, 0x3c, 0x0b, 0x6f, 0x2f, 0x6f, 0xd3, 0x82, 0xca, 0x64, 0xee, 0x29, 0x9c, + 0xaa, 0xfe, 0xf1, 0xf1, 0xf1, 0xb1, 0xdc, 0xd1, 0x2a, 0xa8, 0xf9, 0x87, 0x0e, 0xd0, 0x8b, 0x38, + 0x4f, 0xc3, 0xe0, 0x63, 0xca, 0xf0, 0x4b, 0xa8, 0x71, 0x7a, 0xcf, 0x5c, 0xce, 0xdc, 0x69, 0x9c, + 0x53, 0x54, 0x48, 0x55, 0xba, 0x46, 0xac, 0x17, 0x67, 0xd8, 0x82, 0x52, 0x98, 0xf2, 0x5b, 0x16, + 0x5b, 0x86, 0x64, 0x1f, 0x16, 0xc8, 0xd2, 0xc6, 0x7b, 0xcb, 0x46, 0x97, 0x64, 0xa3, 0x87, 0x85, + 0xbc, 0xd5, 0xd2, 0xeb, 0x51, 0x41, 0x95, 0x30, 0xd5, 0xa5, 0x57, 0x5a, 0xf8, 0x00, 0x4a, 0x82, + 0xf1, 0x85, 0x3b, 0x55, 0x72, 0x84, 0x86, 0x05, 0x62, 0x48, 0xbb, 0x27, 0xe9, 0x67, 0x2c, 0xf0, + 0x67, 0x42, 0xfd, 0xa6, 0x9a, 0xa4, 0xcf, 0x6d, 0x7c, 0x04, 0x86, 0x88, 0x3c, 0x9a, 0x59, 0xa0, + 0x34, 0xf1, 0xb3, 0x55, 0x6f, 0xfa, 0x34, 0x4b, 0x14, 0x81, 0x8c, 0xe2, 0x7d, 0x30, 0x38, 0xcd, + 0x6e, 0x99, 0x55, 0x93, 0x27, 0x97, 0x7e, 0x65, 0x4a, 0xbf, 0xc7, 0xe6, 0x82, 0x2a, 0x01, 0xf9, + 0x5c, 0xfa, 0x95, 0x89, 0x9b, 0xa0, 0xf3, 0xc4, 0x57, 0xf2, 0xb1, 0xf5, 0x53, 0x0e, 0x0b, 0x44, + 0x06, 0xf1, 0xcf, 0x9b, 0xfa, 0xb9, 0xa3, 0xf4, 0xf3, 0xc5, 0x0a, 0xb9, 0xee, 0xdd, 0x5a, 0x42, + 0x87, 0x85, 0x0d, 0x11, 0x6d, 0x7c, 0xb5, 0x29, 0x46, 0xfb, 0x50, 0xe2, 0x4c, 0xf5, 0x6f, 0x37, + 0x57, 0xac, 0xdc, 0x6a, 0x94, 0xc1, 0xe8, 0xcb, 0x03, 0x75, 0xcb, 0x60, 0xa4, 0x61, 0x10, 0x85, + 0xc7, 0x2f, 0xa1, 0xbc, 0x94, 0x7b, 0xb9, 0xe6, 0xb9, 0xe0, 0x9b, 0x48, 0x8a, 0xc2, 0xd9, 0xe0, + 0x83, 0xa9, 0x1d, 0xb7, 0xa0, 0x28, 0x4b, 0x97, 0xc1, 0xd1, 0x64, 0xdc, 0x3f, 0xfd, 0xc5, 0x44, + 0xb8, 0x06, 0xe5, 0xeb, 0x9b, 0xc1, 0x95, 0x34, 0x34, 0xa9, 0x1a, 0x97, 0x37, 0xe3, 0xfe, 0x85, + 0x89, 0x1a, 0x9a, 0x89, 0x3a, 0x36, 0xe8, 0x82, 0xfa, 0x5b, 0xfb, 0xea, 0xab, 0x63, 0xc8, 0x50, + 0xa7, 0xf7, 0xdf, 0x4a, 0x3e, 0xc7, 0xfc, 0xaa, 0xba, 0xf3, 0xe2, 0xe9, 0xa2, 0xfe, 0xff, 0x4e, + 0x76, 0xdf, 0x7d, 0x78, 0xeb, 0x07, 0x62, 0x96, 0xde, 0xb6, 0xa6, 0x11, 0x3f, 0xf1, 0xa3, 0x39, + 0x0d, 0xfd, 0x13, 0x75, 0x39, 0xde, 0xa6, 0x77, 0xf9, 0xcb, 0xf4, 0x95, 0xcf, 0xc2, 0x57, 0x7e, + 0xa4, 0x6e, 0x55, 0xb9, 0x0f, 0x27, 0xcb, 0x6b, 0xf6, 0x27, 0xf9, 0xf8, 0x37, 0x00, 0x00, 0xff, + 0xff, 0x12, 0xd5, 0x46, 0x00, 0x75, 0x07, 0x00, 0x00, +} diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/my_test/test.pb.go.golden b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/my_test/test.pb.go.golden deleted file mode 100644 index 1954e3fb7..000000000 --- a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/my_test/test.pb.go.golden +++ /dev/null @@ -1,870 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: my_test/test.proto - -/* -Package my_test is a generated protocol buffer package. - -This package holds interesting messages. - -It is generated from these files: - my_test/test.proto - -It has these top-level messages: - Request - Reply - OtherBase - ReplyExtensions - OtherReplyExtensions - OldReply - Communique -*/ -package my_test - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" -import _ "github.com/golang/protobuf/protoc-gen-go/testdata/multi" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package - -type HatType int32 - -const ( - // deliberately skipping 0 - HatType_FEDORA HatType = 1 - HatType_FEZ HatType = 2 -) - -var HatType_name = map[int32]string{ - 1: "FEDORA", - 2: "FEZ", -} -var HatType_value = map[string]int32{ - "FEDORA": 1, - "FEZ": 2, -} - -func (x HatType) Enum() *HatType { - p := new(HatType) - *p = x - return p -} -func (x HatType) String() string { - return proto.EnumName(HatType_name, int32(x)) -} -func (x *HatType) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(HatType_value, data, "HatType") - if err != nil { - return err - } - *x = HatType(value) - return nil -} - -// This enum represents days of the week. -type Days int32 - -const ( - Days_MONDAY Days = 1 - Days_TUESDAY Days = 2 - Days_LUNDI Days = 1 -) - -var Days_name = map[int32]string{ - 1: "MONDAY", - 2: "TUESDAY", - // Duplicate value: 1: "LUNDI", -} -var Days_value = map[string]int32{ - "MONDAY": 1, - "TUESDAY": 2, - "LUNDI": 1, -} - -func (x Days) Enum() *Days { - p := new(Days) - *p = x - return p -} -func (x Days) String() string { - return proto.EnumName(Days_name, int32(x)) -} -func (x *Days) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(Days_value, data, "Days") - if err != nil { - return err - } - *x = Days(value) - return nil -} - -type Request_Color int32 - -const ( - Request_RED Request_Color = 0 - Request_GREEN Request_Color = 1 - Request_BLUE Request_Color = 2 -) - -var Request_Color_name = map[int32]string{ - 0: "RED", - 1: "GREEN", - 2: "BLUE", -} -var Request_Color_value = map[string]int32{ - "RED": 0, - "GREEN": 1, - "BLUE": 2, -} - -func (x Request_Color) Enum() *Request_Color { - p := new(Request_Color) - *p = x - return p -} -func (x Request_Color) String() string { - return proto.EnumName(Request_Color_name, int32(x)) -} -func (x *Request_Color) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(Request_Color_value, data, "Request_Color") - if err != nil { - return err - } - *x = Request_Color(value) - return nil -} - -type Reply_Entry_Game int32 - -const ( - Reply_Entry_FOOTBALL Reply_Entry_Game = 1 - Reply_Entry_TENNIS Reply_Entry_Game = 2 -) - -var Reply_Entry_Game_name = map[int32]string{ - 1: "FOOTBALL", - 2: "TENNIS", -} -var Reply_Entry_Game_value = map[string]int32{ - "FOOTBALL": 1, - "TENNIS": 2, -} - -func (x Reply_Entry_Game) Enum() *Reply_Entry_Game { - p := new(Reply_Entry_Game) - *p = x - return p -} -func (x Reply_Entry_Game) String() string { - return proto.EnumName(Reply_Entry_Game_name, int32(x)) -} -func (x *Reply_Entry_Game) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(Reply_Entry_Game_value, data, "Reply_Entry_Game") - if err != nil { - return err - } - *x = Reply_Entry_Game(value) - return nil -} - -// This is a message that might be sent somewhere. -type Request struct { - Key []int64 `protobuf:"varint,1,rep,name=key" json:"key,omitempty"` - // optional imp.ImportedMessage imported_message = 2; - Hue *Request_Color `protobuf:"varint,3,opt,name=hue,enum=my.test.Request_Color" json:"hue,omitempty"` - Hat *HatType `protobuf:"varint,4,opt,name=hat,enum=my.test.HatType,def=1" json:"hat,omitempty"` - // optional imp.ImportedMessage.Owner owner = 6; - Deadline *float32 `protobuf:"fixed32,7,opt,name=deadline,def=inf" json:"deadline,omitempty"` - Somegroup *Request_SomeGroup `protobuf:"group,8,opt,name=SomeGroup,json=somegroup" json:"somegroup,omitempty"` - // This is a map field. It will generate map[int32]string. - NameMapping map[int32]string `protobuf:"bytes,14,rep,name=name_mapping,json=nameMapping" json:"name_mapping,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - // This is a map field whose value type is a message. - MsgMapping map[int64]*Reply `protobuf:"bytes,15,rep,name=msg_mapping,json=msgMapping" json:"msg_mapping,omitempty" protobuf_key:"zigzag64,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - Reset_ *int32 `protobuf:"varint,12,opt,name=reset" json:"reset,omitempty"` - // This field should not conflict with any getters. - GetKey_ *string `protobuf:"bytes,16,opt,name=get_key,json=getKey" json:"get_key,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *Request) Reset() { *m = Request{} } -func (m *Request) String() string { return proto.CompactTextString(m) } -func (*Request) ProtoMessage() {} - -const Default_Request_Hat HatType = HatType_FEDORA - -var Default_Request_Deadline float32 = float32(math.Inf(1)) - -func (m *Request) GetKey() []int64 { - if m != nil { - return m.Key - } - return nil -} - -func (m *Request) GetHue() Request_Color { - if m != nil && m.Hue != nil { - return *m.Hue - } - return Request_RED -} - -func (m *Request) GetHat() HatType { - if m != nil && m.Hat != nil { - return *m.Hat - } - return Default_Request_Hat -} - -func (m *Request) GetDeadline() float32 { - if m != nil && m.Deadline != nil { - return *m.Deadline - } - return Default_Request_Deadline -} - -func (m *Request) GetSomegroup() *Request_SomeGroup { - if m != nil { - return m.Somegroup - } - return nil -} - -func (m *Request) GetNameMapping() map[int32]string { - if m != nil { - return m.NameMapping - } - return nil -} - -func (m *Request) GetMsgMapping() map[int64]*Reply { - if m != nil { - return m.MsgMapping - } - return nil -} - -func (m *Request) GetReset_() int32 { - if m != nil && m.Reset_ != nil { - return *m.Reset_ - } - return 0 -} - -func (m *Request) GetGetKey_() string { - if m != nil && m.GetKey_ != nil { - return *m.GetKey_ - } - return "" -} - -type Request_SomeGroup struct { - GroupField *int32 `protobuf:"varint,9,opt,name=group_field,json=groupField" json:"group_field,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *Request_SomeGroup) Reset() { *m = Request_SomeGroup{} } -func (m *Request_SomeGroup) String() string { return proto.CompactTextString(m) } -func (*Request_SomeGroup) ProtoMessage() {} - -func (m *Request_SomeGroup) GetGroupField() int32 { - if m != nil && m.GroupField != nil { - return *m.GroupField - } - return 0 -} - -type Reply struct { - Found []*Reply_Entry `protobuf:"bytes,1,rep,name=found" json:"found,omitempty"` - CompactKeys []int32 `protobuf:"varint,2,rep,packed,name=compact_keys,json=compactKeys" json:"compact_keys,omitempty"` - proto.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *Reply) Reset() { *m = Reply{} } -func (m *Reply) String() string { return proto.CompactTextString(m) } -func (*Reply) ProtoMessage() {} - -var extRange_Reply = []proto.ExtensionRange{ - {100, 536870911}, -} - -func (*Reply) ExtensionRangeArray() []proto.ExtensionRange { - return extRange_Reply -} - -func (m *Reply) GetFound() []*Reply_Entry { - if m != nil { - return m.Found - } - return nil -} - -func (m *Reply) GetCompactKeys() []int32 { - if m != nil { - return m.CompactKeys - } - return nil -} - -type Reply_Entry struct { - KeyThatNeeds_1234Camel_CasIng *int64 `protobuf:"varint,1,req,name=key_that_needs_1234camel_CasIng,json=keyThatNeeds1234camelCasIng" json:"key_that_needs_1234camel_CasIng,omitempty"` - Value *int64 `protobuf:"varint,2,opt,name=value,def=7" json:"value,omitempty"` - XMyFieldName_2 *int64 `protobuf:"varint,3,opt,name=_my_field_name_2,json=MyFieldName2" json:"_my_field_name_2,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *Reply_Entry) Reset() { *m = Reply_Entry{} } -func (m *Reply_Entry) String() string { return proto.CompactTextString(m) } -func (*Reply_Entry) ProtoMessage() {} - -const Default_Reply_Entry_Value int64 = 7 - -func (m *Reply_Entry) GetKeyThatNeeds_1234Camel_CasIng() int64 { - if m != nil && m.KeyThatNeeds_1234Camel_CasIng != nil { - return *m.KeyThatNeeds_1234Camel_CasIng - } - return 0 -} - -func (m *Reply_Entry) GetValue() int64 { - if m != nil && m.Value != nil { - return *m.Value - } - return Default_Reply_Entry_Value -} - -func (m *Reply_Entry) GetXMyFieldName_2() int64 { - if m != nil && m.XMyFieldName_2 != nil { - return *m.XMyFieldName_2 - } - return 0 -} - -type OtherBase struct { - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - proto.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *OtherBase) Reset() { *m = OtherBase{} } -func (m *OtherBase) String() string { return proto.CompactTextString(m) } -func (*OtherBase) ProtoMessage() {} - -var extRange_OtherBase = []proto.ExtensionRange{ - {100, 536870911}, -} - -func (*OtherBase) ExtensionRangeArray() []proto.ExtensionRange { - return extRange_OtherBase -} - -func (m *OtherBase) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -type ReplyExtensions struct { - XXX_unrecognized []byte `json:"-"` -} - -func (m *ReplyExtensions) Reset() { *m = ReplyExtensions{} } -func (m *ReplyExtensions) String() string { return proto.CompactTextString(m) } -func (*ReplyExtensions) ProtoMessage() {} - -var E_ReplyExtensions_Time = &proto.ExtensionDesc{ - ExtendedType: (*Reply)(nil), - ExtensionType: (*float64)(nil), - Field: 101, - Name: "my.test.ReplyExtensions.time", - Tag: "fixed64,101,opt,name=time", - Filename: "my_test/test.proto", -} - -var E_ReplyExtensions_Carrot = &proto.ExtensionDesc{ - ExtendedType: (*Reply)(nil), - ExtensionType: (*ReplyExtensions)(nil), - Field: 105, - Name: "my.test.ReplyExtensions.carrot", - Tag: "bytes,105,opt,name=carrot", - Filename: "my_test/test.proto", -} - -var E_ReplyExtensions_Donut = &proto.ExtensionDesc{ - ExtendedType: (*OtherBase)(nil), - ExtensionType: (*ReplyExtensions)(nil), - Field: 101, - Name: "my.test.ReplyExtensions.donut", - Tag: "bytes,101,opt,name=donut", - Filename: "my_test/test.proto", -} - -type OtherReplyExtensions struct { - Key *int32 `protobuf:"varint,1,opt,name=key" json:"key,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *OtherReplyExtensions) Reset() { *m = OtherReplyExtensions{} } -func (m *OtherReplyExtensions) String() string { return proto.CompactTextString(m) } -func (*OtherReplyExtensions) ProtoMessage() {} - -func (m *OtherReplyExtensions) GetKey() int32 { - if m != nil && m.Key != nil { - return *m.Key - } - return 0 -} - -type OldReply struct { - proto.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *OldReply) Reset() { *m = OldReply{} } -func (m *OldReply) String() string { return proto.CompactTextString(m) } -func (*OldReply) ProtoMessage() {} - -func (m *OldReply) Marshal() ([]byte, error) { - return proto.MarshalMessageSet(&m.XXX_InternalExtensions) -} -func (m *OldReply) Unmarshal(buf []byte) error { - return proto.UnmarshalMessageSet(buf, &m.XXX_InternalExtensions) -} -func (m *OldReply) MarshalJSON() ([]byte, error) { - return proto.MarshalMessageSetJSON(&m.XXX_InternalExtensions) -} -func (m *OldReply) UnmarshalJSON(buf []byte) error { - return proto.UnmarshalMessageSetJSON(buf, &m.XXX_InternalExtensions) -} - -// ensure OldReply satisfies proto.Marshaler and proto.Unmarshaler -var _ proto.Marshaler = (*OldReply)(nil) -var _ proto.Unmarshaler = (*OldReply)(nil) - -var extRange_OldReply = []proto.ExtensionRange{ - {100, 2147483646}, -} - -func (*OldReply) ExtensionRangeArray() []proto.ExtensionRange { - return extRange_OldReply -} - -type Communique struct { - MakeMeCry *bool `protobuf:"varint,1,opt,name=make_me_cry,json=makeMeCry" json:"make_me_cry,omitempty"` - // This is a oneof, called "union". - // - // Types that are valid to be assigned to Union: - // *Communique_Number - // *Communique_Name - // *Communique_Data - // *Communique_TempC - // *Communique_Height - // *Communique_Today - // *Communique_Maybe - // *Communique_Delta_ - // *Communique_Msg - // *Communique_Somegroup - Union isCommunique_Union `protobuf_oneof:"union"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *Communique) Reset() { *m = Communique{} } -func (m *Communique) String() string { return proto.CompactTextString(m) } -func (*Communique) ProtoMessage() {} - -type isCommunique_Union interface { - isCommunique_Union() -} - -type Communique_Number struct { - Number int32 `protobuf:"varint,5,opt,name=number,oneof"` -} -type Communique_Name struct { - Name string `protobuf:"bytes,6,opt,name=name,oneof"` -} -type Communique_Data struct { - Data []byte `protobuf:"bytes,7,opt,name=data,oneof"` -} -type Communique_TempC struct { - TempC float64 `protobuf:"fixed64,8,opt,name=temp_c,json=tempC,oneof"` -} -type Communique_Height struct { - Height float32 `protobuf:"fixed32,9,opt,name=height,oneof"` -} -type Communique_Today struct { - Today Days `protobuf:"varint,10,opt,name=today,enum=my.test.Days,oneof"` -} -type Communique_Maybe struct { - Maybe bool `protobuf:"varint,11,opt,name=maybe,oneof"` -} -type Communique_Delta_ struct { - Delta int32 `protobuf:"zigzag32,12,opt,name=delta,oneof"` -} -type Communique_Msg struct { - Msg *Reply `protobuf:"bytes,13,opt,name=msg,oneof"` -} -type Communique_Somegroup struct { - Somegroup *Communique_SomeGroup `protobuf:"group,14,opt,name=SomeGroup,json=somegroup,oneof"` -} - -func (*Communique_Number) isCommunique_Union() {} -func (*Communique_Name) isCommunique_Union() {} -func (*Communique_Data) isCommunique_Union() {} -func (*Communique_TempC) isCommunique_Union() {} -func (*Communique_Height) isCommunique_Union() {} -func (*Communique_Today) isCommunique_Union() {} -func (*Communique_Maybe) isCommunique_Union() {} -func (*Communique_Delta_) isCommunique_Union() {} -func (*Communique_Msg) isCommunique_Union() {} -func (*Communique_Somegroup) isCommunique_Union() {} - -func (m *Communique) GetUnion() isCommunique_Union { - if m != nil { - return m.Union - } - return nil -} - -func (m *Communique) GetMakeMeCry() bool { - if m != nil && m.MakeMeCry != nil { - return *m.MakeMeCry - } - return false -} - -func (m *Communique) GetNumber() int32 { - if x, ok := m.GetUnion().(*Communique_Number); ok { - return x.Number - } - return 0 -} - -func (m *Communique) GetName() string { - if x, ok := m.GetUnion().(*Communique_Name); ok { - return x.Name - } - return "" -} - -func (m *Communique) GetData() []byte { - if x, ok := m.GetUnion().(*Communique_Data); ok { - return x.Data - } - return nil -} - -func (m *Communique) GetTempC() float64 { - if x, ok := m.GetUnion().(*Communique_TempC); ok { - return x.TempC - } - return 0 -} - -func (m *Communique) GetHeight() float32 { - if x, ok := m.GetUnion().(*Communique_Height); ok { - return x.Height - } - return 0 -} - -func (m *Communique) GetToday() Days { - if x, ok := m.GetUnion().(*Communique_Today); ok { - return x.Today - } - return Days_MONDAY -} - -func (m *Communique) GetMaybe() bool { - if x, ok := m.GetUnion().(*Communique_Maybe); ok { - return x.Maybe - } - return false -} - -func (m *Communique) GetDelta() int32 { - if x, ok := m.GetUnion().(*Communique_Delta_); ok { - return x.Delta - } - return 0 -} - -func (m *Communique) GetMsg() *Reply { - if x, ok := m.GetUnion().(*Communique_Msg); ok { - return x.Msg - } - return nil -} - -func (m *Communique) GetSomegroup() *Communique_SomeGroup { - if x, ok := m.GetUnion().(*Communique_Somegroup); ok { - return x.Somegroup - } - return nil -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*Communique) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _Communique_OneofMarshaler, _Communique_OneofUnmarshaler, _Communique_OneofSizer, []interface{}{ - (*Communique_Number)(nil), - (*Communique_Name)(nil), - (*Communique_Data)(nil), - (*Communique_TempC)(nil), - (*Communique_Height)(nil), - (*Communique_Today)(nil), - (*Communique_Maybe)(nil), - (*Communique_Delta_)(nil), - (*Communique_Msg)(nil), - (*Communique_Somegroup)(nil), - } -} - -func _Communique_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*Communique) - // union - switch x := m.Union.(type) { - case *Communique_Number: - b.EncodeVarint(5<<3 | proto.WireVarint) - b.EncodeVarint(uint64(x.Number)) - case *Communique_Name: - b.EncodeVarint(6<<3 | proto.WireBytes) - b.EncodeStringBytes(x.Name) - case *Communique_Data: - b.EncodeVarint(7<<3 | proto.WireBytes) - b.EncodeRawBytes(x.Data) - case *Communique_TempC: - b.EncodeVarint(8<<3 | proto.WireFixed64) - b.EncodeFixed64(math.Float64bits(x.TempC)) - case *Communique_Height: - b.EncodeVarint(9<<3 | proto.WireFixed32) - b.EncodeFixed32(uint64(math.Float32bits(x.Height))) - case *Communique_Today: - b.EncodeVarint(10<<3 | proto.WireVarint) - b.EncodeVarint(uint64(x.Today)) - case *Communique_Maybe: - t := uint64(0) - if x.Maybe { - t = 1 - } - b.EncodeVarint(11<<3 | proto.WireVarint) - b.EncodeVarint(t) - case *Communique_Delta_: - b.EncodeVarint(12<<3 | proto.WireVarint) - b.EncodeZigzag32(uint64(x.Delta)) - case *Communique_Msg: - b.EncodeVarint(13<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Msg); err != nil { - return err - } - case *Communique_Somegroup: - b.EncodeVarint(14<<3 | proto.WireStartGroup) - if err := b.Marshal(x.Somegroup); err != nil { - return err - } - b.EncodeVarint(14<<3 | proto.WireEndGroup) - case nil: - default: - return fmt.Errorf("Communique.Union has unexpected type %T", x) - } - return nil -} - -func _Communique_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*Communique) - switch tag { - case 5: // union.number - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.Union = &Communique_Number{int32(x)} - return true, err - case 6: // union.name - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.Union = &Communique_Name{x} - return true, err - case 7: // union.data - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeRawBytes(true) - m.Union = &Communique_Data{x} - return true, err - case 8: // union.temp_c - if wire != proto.WireFixed64 { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeFixed64() - m.Union = &Communique_TempC{math.Float64frombits(x)} - return true, err - case 9: // union.height - if wire != proto.WireFixed32 { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeFixed32() - m.Union = &Communique_Height{math.Float32frombits(uint32(x))} - return true, err - case 10: // union.today - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.Union = &Communique_Today{Days(x)} - return true, err - case 11: // union.maybe - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.Union = &Communique_Maybe{x != 0} - return true, err - case 12: // union.delta - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeZigzag32() - m.Union = &Communique_Delta_{int32(x)} - return true, err - case 13: // union.msg - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(Reply) - err := b.DecodeMessage(msg) - m.Union = &Communique_Msg{msg} - return true, err - case 14: // union.somegroup - if wire != proto.WireStartGroup { - return true, proto.ErrInternalBadWireType - } - msg := new(Communique_SomeGroup) - err := b.DecodeGroup(msg) - m.Union = &Communique_Somegroup{msg} - return true, err - default: - return false, nil - } -} - -func _Communique_OneofSizer(msg proto.Message) (n int) { - m := msg.(*Communique) - // union - switch x := m.Union.(type) { - case *Communique_Number: - n += proto.SizeVarint(5<<3 | proto.WireVarint) - n += proto.SizeVarint(uint64(x.Number)) - case *Communique_Name: - n += proto.SizeVarint(6<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(len(x.Name))) - n += len(x.Name) - case *Communique_Data: - n += proto.SizeVarint(7<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(len(x.Data))) - n += len(x.Data) - case *Communique_TempC: - n += proto.SizeVarint(8<<3 | proto.WireFixed64) - n += 8 - case *Communique_Height: - n += proto.SizeVarint(9<<3 | proto.WireFixed32) - n += 4 - case *Communique_Today: - n += proto.SizeVarint(10<<3 | proto.WireVarint) - n += proto.SizeVarint(uint64(x.Today)) - case *Communique_Maybe: - n += proto.SizeVarint(11<<3 | proto.WireVarint) - n += 1 - case *Communique_Delta_: - n += proto.SizeVarint(12<<3 | proto.WireVarint) - n += proto.SizeVarint(uint64((uint32(x.Delta) << 1) ^ uint32((int32(x.Delta) >> 31)))) - case *Communique_Msg: - s := proto.Size(x.Msg) - n += proto.SizeVarint(13<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(s)) - n += s - case *Communique_Somegroup: - n += proto.SizeVarint(14<<3 | proto.WireStartGroup) - n += proto.Size(x.Somegroup) - n += proto.SizeVarint(14<<3 | proto.WireEndGroup) - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -type Communique_SomeGroup struct { - Member *string `protobuf:"bytes,15,opt,name=member" json:"member,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *Communique_SomeGroup) Reset() { *m = Communique_SomeGroup{} } -func (m *Communique_SomeGroup) String() string { return proto.CompactTextString(m) } -func (*Communique_SomeGroup) ProtoMessage() {} - -func (m *Communique_SomeGroup) GetMember() string { - if m != nil && m.Member != nil { - return *m.Member - } - return "" -} - -type Communique_Delta struct { - XXX_unrecognized []byte `json:"-"` -} - -func (m *Communique_Delta) Reset() { *m = Communique_Delta{} } -func (m *Communique_Delta) String() string { return proto.CompactTextString(m) } -func (*Communique_Delta) ProtoMessage() {} - -var E_Tag = &proto.ExtensionDesc{ - ExtendedType: (*Reply)(nil), - ExtensionType: (*string)(nil), - Field: 103, - Name: "my.test.tag", - Tag: "bytes,103,opt,name=tag", - Filename: "my_test/test.proto", -} - -var E_Donut = &proto.ExtensionDesc{ - ExtendedType: (*Reply)(nil), - ExtensionType: (*OtherReplyExtensions)(nil), - Field: 106, - Name: "my.test.donut", - Tag: "bytes,106,opt,name=donut", - Filename: "my_test/test.proto", -} - -func init() { - proto.RegisterType((*Request)(nil), "my.test.Request") - proto.RegisterType((*Request_SomeGroup)(nil), "my.test.Request.SomeGroup") - proto.RegisterType((*Reply)(nil), "my.test.Reply") - proto.RegisterType((*Reply_Entry)(nil), "my.test.Reply.Entry") - proto.RegisterType((*OtherBase)(nil), "my.test.OtherBase") - proto.RegisterType((*ReplyExtensions)(nil), "my.test.ReplyExtensions") - proto.RegisterType((*OtherReplyExtensions)(nil), "my.test.OtherReplyExtensions") - proto.RegisterType((*OldReply)(nil), "my.test.OldReply") - proto.RegisterType((*Communique)(nil), "my.test.Communique") - proto.RegisterType((*Communique_SomeGroup)(nil), "my.test.Communique.SomeGroup") - proto.RegisterType((*Communique_Delta)(nil), "my.test.Communique.Delta") - proto.RegisterEnum("my.test.HatType", HatType_name, HatType_value) - proto.RegisterEnum("my.test.Days", Days_name, Days_value) - proto.RegisterEnum("my.test.Request_Color", Request_Color_name, Request_Color_value) - proto.RegisterEnum("my.test.Reply_Entry_Game", Reply_Entry_Game_name, Reply_Entry_Game_value) - proto.RegisterExtension(E_ReplyExtensions_Time) - proto.RegisterExtension(E_ReplyExtensions_Carrot) - proto.RegisterExtension(E_ReplyExtensions_Donut) - proto.RegisterExtension(E_Tag) - proto.RegisterExtension(E_Donut) -} diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/my_test/test.proto b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/my_test/test.proto index 8e7094632..1ef3fd029 100644 --- a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/my_test/test.proto +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/my_test/test.proto @@ -34,6 +34,8 @@ syntax = "proto2"; // This package holds interesting messages. package my.test; // dotted package name +option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/my_test;test"; + //import "imp.proto"; import "multi/multi1.proto"; // unused import @@ -145,7 +147,7 @@ message Communique { Days today = 10; bool maybe = 11; sint32 delta = 12; // name will conflict with Delta below - Reply msg = 13; + Reply msg = 16; // requires two bytes to encode field tag group SomeGroup = 14 { optional string member = 15; } diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/proto3/proto3.pb.go b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/proto3/proto3.pb.go new file mode 100644 index 000000000..3b0ad8491 --- /dev/null +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/proto3/proto3.pb.go @@ -0,0 +1,196 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: proto3/proto3.proto + +package proto3 // import "github.com/golang/protobuf/protoc-gen-go/testdata/proto3" + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type Request_Flavour int32 + +const ( + Request_SWEET Request_Flavour = 0 + Request_SOUR Request_Flavour = 1 + Request_UMAMI Request_Flavour = 2 + Request_GOPHERLICIOUS Request_Flavour = 3 +) + +var Request_Flavour_name = map[int32]string{ + 0: "SWEET", + 1: "SOUR", + 2: "UMAMI", + 3: "GOPHERLICIOUS", +} +var Request_Flavour_value = map[string]int32{ + "SWEET": 0, + "SOUR": 1, + "UMAMI": 2, + "GOPHERLICIOUS": 3, +} + +func (x Request_Flavour) String() string { + return proto.EnumName(Request_Flavour_name, int32(x)) +} +func (Request_Flavour) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_proto3_a752e09251f17e01, []int{0, 0} +} + +type Request struct { + Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Key []int64 `protobuf:"varint,2,rep,packed,name=key" json:"key,omitempty"` + Taste Request_Flavour `protobuf:"varint,3,opt,name=taste,enum=proto3.Request_Flavour" json:"taste,omitempty"` + Book *Book `protobuf:"bytes,4,opt,name=book" json:"book,omitempty"` + Unpacked []int64 `protobuf:"varint,5,rep,name=unpacked" json:"unpacked,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Request) Reset() { *m = Request{} } +func (m *Request) String() string { return proto.CompactTextString(m) } +func (*Request) ProtoMessage() {} +func (*Request) Descriptor() ([]byte, []int) { + return fileDescriptor_proto3_a752e09251f17e01, []int{0} +} +func (m *Request) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Request.Unmarshal(m, b) +} +func (m *Request) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Request.Marshal(b, m, deterministic) +} +func (dst *Request) XXX_Merge(src proto.Message) { + xxx_messageInfo_Request.Merge(dst, src) +} +func (m *Request) XXX_Size() int { + return xxx_messageInfo_Request.Size(m) +} +func (m *Request) XXX_DiscardUnknown() { + xxx_messageInfo_Request.DiscardUnknown(m) +} + +var xxx_messageInfo_Request proto.InternalMessageInfo + +func (m *Request) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *Request) GetKey() []int64 { + if m != nil { + return m.Key + } + return nil +} + +func (m *Request) GetTaste() Request_Flavour { + if m != nil { + return m.Taste + } + return Request_SWEET +} + +func (m *Request) GetBook() *Book { + if m != nil { + return m.Book + } + return nil +} + +func (m *Request) GetUnpacked() []int64 { + if m != nil { + return m.Unpacked + } + return nil +} + +type Book struct { + Title string `protobuf:"bytes,1,opt,name=title" json:"title,omitempty"` + RawData []byte `protobuf:"bytes,2,opt,name=raw_data,json=rawData,proto3" json:"raw_data,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Book) Reset() { *m = Book{} } +func (m *Book) String() string { return proto.CompactTextString(m) } +func (*Book) ProtoMessage() {} +func (*Book) Descriptor() ([]byte, []int) { + return fileDescriptor_proto3_a752e09251f17e01, []int{1} +} +func (m *Book) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Book.Unmarshal(m, b) +} +func (m *Book) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Book.Marshal(b, m, deterministic) +} +func (dst *Book) XXX_Merge(src proto.Message) { + xxx_messageInfo_Book.Merge(dst, src) +} +func (m *Book) XXX_Size() int { + return xxx_messageInfo_Book.Size(m) +} +func (m *Book) XXX_DiscardUnknown() { + xxx_messageInfo_Book.DiscardUnknown(m) +} + +var xxx_messageInfo_Book proto.InternalMessageInfo + +func (m *Book) GetTitle() string { + if m != nil { + return m.Title + } + return "" +} + +func (m *Book) GetRawData() []byte { + if m != nil { + return m.RawData + } + return nil +} + +func init() { + proto.RegisterType((*Request)(nil), "proto3.Request") + proto.RegisterType((*Book)(nil), "proto3.Book") + proto.RegisterEnum("proto3.Request_Flavour", Request_Flavour_name, Request_Flavour_value) +} + +func init() { proto.RegisterFile("proto3/proto3.proto", fileDescriptor_proto3_a752e09251f17e01) } + +var fileDescriptor_proto3_a752e09251f17e01 = []byte{ + // 306 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x3c, 0x90, 0xcf, 0x4e, 0xf2, 0x40, + 0x14, 0xc5, 0x99, 0xfe, 0xf9, 0x80, 0xfb, 0xa1, 0x19, 0xaf, 0x26, 0x8e, 0x1b, 0x33, 0x61, 0xd5, + 0x0d, 0x25, 0xc1, 0x85, 0xc6, 0xb8, 0x11, 0x45, 0x25, 0x91, 0x60, 0x06, 0x89, 0x89, 0x1b, 0x33, + 0x85, 0xb1, 0x92, 0x42, 0x07, 0xcb, 0x54, 0xe2, 0xcb, 0xfa, 0x2c, 0xa6, 0x9d, 0xe2, 0xea, 0x9e, + 0x7b, 0xe7, 0xe4, 0x77, 0x32, 0x07, 0x0e, 0xd7, 0x99, 0x36, 0xfa, 0xac, 0x6b, 0x47, 0x58, 0x0e, + 0xfc, 0x67, 0xb7, 0xf6, 0x0f, 0x81, 0xba, 0x50, 0x9f, 0xb9, 0xda, 0x18, 0x44, 0xf0, 0x52, 0xb9, + 0x52, 0x8c, 0x70, 0x12, 0x34, 0x45, 0xa9, 0x91, 0x82, 0x9b, 0xa8, 0x6f, 0xe6, 0x70, 0x37, 0x70, + 0x45, 0x21, 0xb1, 0x03, 0xbe, 0x91, 0x1b, 0xa3, 0x98, 0xcb, 0x49, 0xb0, 0xdf, 0x3b, 0x0e, 0x2b, + 0x6e, 0x45, 0x09, 0xef, 0x96, 0xf2, 0x4b, 0xe7, 0x99, 0xb0, 0x2e, 0xe4, 0xe0, 0x45, 0x5a, 0x27, + 0xcc, 0xe3, 0x24, 0xf8, 0xdf, 0x6b, 0xed, 0xdc, 0x7d, 0xad, 0x13, 0x51, 0xbe, 0xe0, 0x29, 0x34, + 0xf2, 0x74, 0x2d, 0x67, 0x89, 0x9a, 0x33, 0xbf, 0xc8, 0xe9, 0x3b, 0xb4, 0x26, 0xfe, 0x6e, 0xed, + 0x2b, 0xa8, 0x57, 0x4c, 0x6c, 0x82, 0x3f, 0x79, 0x19, 0x0c, 0x9e, 0x69, 0x0d, 0x1b, 0xe0, 0x4d, + 0xc6, 0x53, 0x41, 0x49, 0x71, 0x9c, 0x8e, 0xae, 0x47, 0x43, 0xea, 0xe0, 0x01, 0xec, 0xdd, 0x8f, + 0x9f, 0x1e, 0x06, 0xe2, 0x71, 0x78, 0x33, 0x1c, 0x4f, 0x27, 0xd4, 0x6d, 0x9f, 0x83, 0x57, 0x64, + 0xe1, 0x11, 0xf8, 0x66, 0x61, 0x96, 0xbb, 0xdf, 0xd9, 0x05, 0x4f, 0xa0, 0x91, 0xc9, 0xed, 0xdb, + 0x5c, 0x1a, 0xc9, 0x1c, 0x4e, 0x82, 0x96, 0xa8, 0x67, 0x72, 0x7b, 0x2b, 0x8d, 0xec, 0x5f, 0xbe, + 0x5e, 0xc4, 0x0b, 0xf3, 0x91, 0x47, 0xe1, 0x4c, 0xaf, 0xba, 0xb1, 0x5e, 0xca, 0x34, 0xb6, 0x1d, + 0x46, 0xf9, 0xbb, 0x15, 0xb3, 0x4e, 0xac, 0xd2, 0x4e, 0xac, 0xbb, 0x46, 0x6d, 0x4c, 0xc1, 0xa8, + 0x3a, 0x8e, 0xaa, 0x76, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0xec, 0x71, 0xee, 0xdb, 0x7b, 0x01, + 0x00, 0x00, +} diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/proto3.proto b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/proto3/proto3.proto similarity index 96% rename from vendor/github.com/golang/protobuf/protoc-gen-go/testdata/proto3.proto rename to vendor/github.com/golang/protobuf/protoc-gen-go/testdata/proto3/proto3.proto index 869b9af5a..79954e4e2 100644 --- a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/proto3.proto +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/proto3/proto3.proto @@ -33,6 +33,8 @@ syntax = "proto3"; package proto3; +option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/proto3"; + message Request { enum Flavour { SWEET = 0; diff --git a/vendor/github.com/golang/protobuf/ptypes/any/any.pb.go b/vendor/github.com/golang/protobuf/ptypes/any/any.pb.go index f34601723..f67edc7dc 100644 --- a/vendor/github.com/golang/protobuf/ptypes/any/any.pb.go +++ b/vendor/github.com/golang/protobuf/ptypes/any/any.pb.go @@ -1,16 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // source: google/protobuf/any.proto -/* -Package any is a generated protocol buffer package. - -It is generated from these files: - google/protobuf/any.proto - -It has these top-level messages: - Any -*/ -package any +package any // import "github.com/golang/protobuf/ptypes/any" import proto "github.com/golang/protobuf/proto" import fmt "fmt" @@ -132,14 +123,36 @@ type Any struct { // TypeUrl string `protobuf:"bytes,1,opt,name=type_url,json=typeUrl" json:"type_url,omitempty"` // Must be a valid serialized protocol buffer of the above specified type. - Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` + Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Any) Reset() { *m = Any{} } +func (m *Any) String() string { return proto.CompactTextString(m) } +func (*Any) ProtoMessage() {} +func (*Any) Descriptor() ([]byte, []int) { + return fileDescriptor_any_744b9ca530f228db, []int{0} +} +func (*Any) XXX_WellKnownType() string { return "Any" } +func (m *Any) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Any.Unmarshal(m, b) +} +func (m *Any) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Any.Marshal(b, m, deterministic) +} +func (dst *Any) XXX_Merge(src proto.Message) { + xxx_messageInfo_Any.Merge(dst, src) +} +func (m *Any) XXX_Size() int { + return xxx_messageInfo_Any.Size(m) +} +func (m *Any) XXX_DiscardUnknown() { + xxx_messageInfo_Any.DiscardUnknown(m) } -func (m *Any) Reset() { *m = Any{} } -func (m *Any) String() string { return proto.CompactTextString(m) } -func (*Any) ProtoMessage() {} -func (*Any) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } -func (*Any) XXX_WellKnownType() string { return "Any" } +var xxx_messageInfo_Any proto.InternalMessageInfo func (m *Any) GetTypeUrl() string { if m != nil { @@ -159,9 +172,9 @@ func init() { proto.RegisterType((*Any)(nil), "google.protobuf.Any") } -func init() { proto.RegisterFile("google/protobuf/any.proto", fileDescriptor0) } +func init() { proto.RegisterFile("google/protobuf/any.proto", fileDescriptor_any_744b9ca530f228db) } -var fileDescriptor0 = []byte{ +var fileDescriptor_any_744b9ca530f228db = []byte{ // 185 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4c, 0xcf, 0xcf, 0x4f, 0xcf, 0x49, 0xd5, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0x4f, 0xcc, 0xab, 0xd4, diff --git a/vendor/github.com/golang/protobuf/ptypes/duration/duration.pb.go b/vendor/github.com/golang/protobuf/ptypes/duration/duration.pb.go index b2410a098..4d75473b8 100644 --- a/vendor/github.com/golang/protobuf/ptypes/duration/duration.pb.go +++ b/vendor/github.com/golang/protobuf/ptypes/duration/duration.pb.go @@ -1,16 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // source: google/protobuf/duration.proto -/* -Package duration is a generated protocol buffer package. - -It is generated from these files: - google/protobuf/duration.proto - -It has these top-level messages: - Duration -*/ -package duration +package duration // import "github.com/golang/protobuf/ptypes/duration" import proto "github.com/golang/protobuf/proto" import fmt "fmt" @@ -98,14 +89,36 @@ type Duration struct { // of one second or more, a non-zero value for the `nanos` field must be // of the same sign as the `seconds` field. Must be from -999,999,999 // to +999,999,999 inclusive. - Nanos int32 `protobuf:"varint,2,opt,name=nanos" json:"nanos,omitempty"` + Nanos int32 `protobuf:"varint,2,opt,name=nanos" json:"nanos,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *Duration) Reset() { *m = Duration{} } -func (m *Duration) String() string { return proto.CompactTextString(m) } -func (*Duration) ProtoMessage() {} -func (*Duration) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } -func (*Duration) XXX_WellKnownType() string { return "Duration" } +func (m *Duration) Reset() { *m = Duration{} } +func (m *Duration) String() string { return proto.CompactTextString(m) } +func (*Duration) ProtoMessage() {} +func (*Duration) Descriptor() ([]byte, []int) { + return fileDescriptor_duration_e7d612259e3f0613, []int{0} +} +func (*Duration) XXX_WellKnownType() string { return "Duration" } +func (m *Duration) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Duration.Unmarshal(m, b) +} +func (m *Duration) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Duration.Marshal(b, m, deterministic) +} +func (dst *Duration) XXX_Merge(src proto.Message) { + xxx_messageInfo_Duration.Merge(dst, src) +} +func (m *Duration) XXX_Size() int { + return xxx_messageInfo_Duration.Size(m) +} +func (m *Duration) XXX_DiscardUnknown() { + xxx_messageInfo_Duration.DiscardUnknown(m) +} + +var xxx_messageInfo_Duration proto.InternalMessageInfo func (m *Duration) GetSeconds() int64 { if m != nil { @@ -125,9 +138,11 @@ func init() { proto.RegisterType((*Duration)(nil), "google.protobuf.Duration") } -func init() { proto.RegisterFile("google/protobuf/duration.proto", fileDescriptor0) } +func init() { + proto.RegisterFile("google/protobuf/duration.proto", fileDescriptor_duration_e7d612259e3f0613) +} -var fileDescriptor0 = []byte{ +var fileDescriptor_duration_e7d612259e3f0613 = []byte{ // 190 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4b, 0xcf, 0xcf, 0x4f, 0xcf, 0x49, 0xd5, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0x4f, 0x29, 0x2d, 0x4a, diff --git a/vendor/github.com/golang/protobuf/ptypes/empty/empty.pb.go b/vendor/github.com/golang/protobuf/ptypes/empty/empty.pb.go index e877b72c3..a69b403ce 100644 --- a/vendor/github.com/golang/protobuf/ptypes/empty/empty.pb.go +++ b/vendor/github.com/golang/protobuf/ptypes/empty/empty.pb.go @@ -1,16 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // source: google/protobuf/empty.proto -/* -Package empty is a generated protocol buffer package. - -It is generated from these files: - google/protobuf/empty.proto - -It has these top-level messages: - Empty -*/ -package empty +package empty // import "github.com/golang/protobuf/ptypes/empty" import proto "github.com/golang/protobuf/proto" import fmt "fmt" @@ -37,21 +28,43 @@ const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package // // The JSON representation for `Empty` is empty JSON object `{}`. type Empty struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Empty) Reset() { *m = Empty{} } +func (m *Empty) String() string { return proto.CompactTextString(m) } +func (*Empty) ProtoMessage() {} +func (*Empty) Descriptor() ([]byte, []int) { + return fileDescriptor_empty_39e6d6db0632e5b2, []int{0} +} +func (*Empty) XXX_WellKnownType() string { return "Empty" } +func (m *Empty) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Empty.Unmarshal(m, b) +} +func (m *Empty) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Empty.Marshal(b, m, deterministic) +} +func (dst *Empty) XXX_Merge(src proto.Message) { + xxx_messageInfo_Empty.Merge(dst, src) +} +func (m *Empty) XXX_Size() int { + return xxx_messageInfo_Empty.Size(m) +} +func (m *Empty) XXX_DiscardUnknown() { + xxx_messageInfo_Empty.DiscardUnknown(m) } -func (m *Empty) Reset() { *m = Empty{} } -func (m *Empty) String() string { return proto.CompactTextString(m) } -func (*Empty) ProtoMessage() {} -func (*Empty) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } -func (*Empty) XXX_WellKnownType() string { return "Empty" } +var xxx_messageInfo_Empty proto.InternalMessageInfo func init() { proto.RegisterType((*Empty)(nil), "google.protobuf.Empty") } -func init() { proto.RegisterFile("google/protobuf/empty.proto", fileDescriptor0) } +func init() { proto.RegisterFile("google/protobuf/empty.proto", fileDescriptor_empty_39e6d6db0632e5b2) } -var fileDescriptor0 = []byte{ +var fileDescriptor_empty_39e6d6db0632e5b2 = []byte{ // 148 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4e, 0xcf, 0xcf, 0x4f, 0xcf, 0x49, 0xd5, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0x4f, 0xcd, 0x2d, 0x28, diff --git a/vendor/github.com/golang/protobuf/ptypes/regen.sh b/vendor/github.com/golang/protobuf/ptypes/regen.sh deleted file mode 100755 index b50a9414a..000000000 --- a/vendor/github.com/golang/protobuf/ptypes/regen.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash -e -# -# This script fetches and rebuilds the "well-known types" protocol buffers. -# To run this you will need protoc and goprotobuf installed; -# see https://github.com/golang/protobuf for instructions. -# You also need Go and Git installed. - -PKG=github.com/golang/protobuf/ptypes -UPSTREAM=https://github.com/google/protobuf -UPSTREAM_SUBDIR=src/google/protobuf -PROTO_FILES=(any duration empty struct timestamp wrappers) - -function die() { - echo 1>&2 $* - exit 1 -} - -# Sanity check that the right tools are accessible. -for tool in go git protoc protoc-gen-go; do - q=$(which $tool) || die "didn't find $tool" - echo 1>&2 "$tool: $q" -done - -tmpdir=$(mktemp -d -t regen-wkt.XXXXXX) -trap 'rm -rf $tmpdir' EXIT - -echo -n 1>&2 "finding package dir... " -pkgdir=$(go list -f '{{.Dir}}' $PKG) -echo 1>&2 $pkgdir -base=$(echo $pkgdir | sed "s,/$PKG\$,,") -echo 1>&2 "base: $base" -cd "$base" - -echo 1>&2 "fetching latest protos... " -git clone -q $UPSTREAM $tmpdir - -for file in ${PROTO_FILES[@]}; do - echo 1>&2 "* $file" - protoc --go_out=. -I$tmpdir/src $tmpdir/src/google/protobuf/$file.proto || die - cp $tmpdir/src/google/protobuf/$file.proto $PKG/$file -done - -echo 1>&2 "All OK" diff --git a/vendor/github.com/golang/protobuf/ptypes/struct/struct.pb.go b/vendor/github.com/golang/protobuf/ptypes/struct/struct.pb.go index 4cfe60818..442c0e099 100644 --- a/vendor/github.com/golang/protobuf/ptypes/struct/struct.pb.go +++ b/vendor/github.com/golang/protobuf/ptypes/struct/struct.pb.go @@ -1,18 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // source: google/protobuf/struct.proto -/* -Package structpb is a generated protocol buffer package. - -It is generated from these files: - google/protobuf/struct.proto - -It has these top-level messages: - Struct - Value - ListValue -*/ -package structpb +package structpb // import "github.com/golang/protobuf/ptypes/struct" import proto "github.com/golang/protobuf/proto" import fmt "fmt" @@ -50,8 +39,10 @@ var NullValue_value = map[string]int32{ func (x NullValue) String() string { return proto.EnumName(NullValue_name, int32(x)) } -func (NullValue) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } -func (NullValue) XXX_WellKnownType() string { return "NullValue" } +func (NullValue) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_struct_3a5a94e0c7801b27, []int{0} +} +func (NullValue) XXX_WellKnownType() string { return "NullValue" } // `Struct` represents a structured data value, consisting of fields // which map to dynamically typed values. In some languages, `Struct` @@ -63,14 +54,36 @@ func (NullValue) XXX_WellKnownType() string { return "NullValue" } // The JSON representation for `Struct` is JSON object. type Struct struct { // Unordered map of dynamically typed values. - Fields map[string]*Value `protobuf:"bytes,1,rep,name=fields" json:"fields,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + Fields map[string]*Value `protobuf:"bytes,1,rep,name=fields" json:"fields,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *Struct) Reset() { *m = Struct{} } -func (m *Struct) String() string { return proto.CompactTextString(m) } -func (*Struct) ProtoMessage() {} -func (*Struct) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } -func (*Struct) XXX_WellKnownType() string { return "Struct" } +func (m *Struct) Reset() { *m = Struct{} } +func (m *Struct) String() string { return proto.CompactTextString(m) } +func (*Struct) ProtoMessage() {} +func (*Struct) Descriptor() ([]byte, []int) { + return fileDescriptor_struct_3a5a94e0c7801b27, []int{0} +} +func (*Struct) XXX_WellKnownType() string { return "Struct" } +func (m *Struct) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Struct.Unmarshal(m, b) +} +func (m *Struct) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Struct.Marshal(b, m, deterministic) +} +func (dst *Struct) XXX_Merge(src proto.Message) { + xxx_messageInfo_Struct.Merge(dst, src) +} +func (m *Struct) XXX_Size() int { + return xxx_messageInfo_Struct.Size(m) +} +func (m *Struct) XXX_DiscardUnknown() { + xxx_messageInfo_Struct.DiscardUnknown(m) +} + +var xxx_messageInfo_Struct proto.InternalMessageInfo func (m *Struct) GetFields() map[string]*Value { if m != nil { @@ -95,14 +108,36 @@ type Value struct { // *Value_BoolValue // *Value_StructValue // *Value_ListValue - Kind isValue_Kind `protobuf_oneof:"kind"` + Kind isValue_Kind `protobuf_oneof:"kind"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Value) Reset() { *m = Value{} } +func (m *Value) String() string { return proto.CompactTextString(m) } +func (*Value) ProtoMessage() {} +func (*Value) Descriptor() ([]byte, []int) { + return fileDescriptor_struct_3a5a94e0c7801b27, []int{1} +} +func (*Value) XXX_WellKnownType() string { return "Value" } +func (m *Value) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Value.Unmarshal(m, b) +} +func (m *Value) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Value.Marshal(b, m, deterministic) +} +func (dst *Value) XXX_Merge(src proto.Message) { + xxx_messageInfo_Value.Merge(dst, src) +} +func (m *Value) XXX_Size() int { + return xxx_messageInfo_Value.Size(m) +} +func (m *Value) XXX_DiscardUnknown() { + xxx_messageInfo_Value.DiscardUnknown(m) } -func (m *Value) Reset() { *m = Value{} } -func (m *Value) String() string { return proto.CompactTextString(m) } -func (*Value) ProtoMessage() {} -func (*Value) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } -func (*Value) XXX_WellKnownType() string { return "Value" } +var xxx_messageInfo_Value proto.InternalMessageInfo type isValue_Kind interface { isValue_Kind() @@ -289,26 +324,26 @@ func _Value_OneofSizer(msg proto.Message) (n int) { // kind switch x := m.Kind.(type) { case *Value_NullValue: - n += proto.SizeVarint(1<<3 | proto.WireVarint) + n += 1 // tag and wire n += proto.SizeVarint(uint64(x.NullValue)) case *Value_NumberValue: - n += proto.SizeVarint(2<<3 | proto.WireFixed64) + n += 1 // tag and wire n += 8 case *Value_StringValue: - n += proto.SizeVarint(3<<3 | proto.WireBytes) + n += 1 // tag and wire n += proto.SizeVarint(uint64(len(x.StringValue))) n += len(x.StringValue) case *Value_BoolValue: - n += proto.SizeVarint(4<<3 | proto.WireVarint) + n += 1 // tag and wire n += 1 case *Value_StructValue: s := proto.Size(x.StructValue) - n += proto.SizeVarint(5<<3 | proto.WireBytes) + n += 1 // tag and wire n += proto.SizeVarint(uint64(s)) n += s case *Value_ListValue: s := proto.Size(x.ListValue) - n += proto.SizeVarint(6<<3 | proto.WireBytes) + n += 1 // tag and wire n += proto.SizeVarint(uint64(s)) n += s case nil: @@ -323,14 +358,36 @@ func _Value_OneofSizer(msg proto.Message) (n int) { // The JSON representation for `ListValue` is JSON array. type ListValue struct { // Repeated field of dynamically typed values. - Values []*Value `protobuf:"bytes,1,rep,name=values" json:"values,omitempty"` + Values []*Value `protobuf:"bytes,1,rep,name=values" json:"values,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *ListValue) Reset() { *m = ListValue{} } -func (m *ListValue) String() string { return proto.CompactTextString(m) } -func (*ListValue) ProtoMessage() {} -func (*ListValue) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } -func (*ListValue) XXX_WellKnownType() string { return "ListValue" } +func (m *ListValue) Reset() { *m = ListValue{} } +func (m *ListValue) String() string { return proto.CompactTextString(m) } +func (*ListValue) ProtoMessage() {} +func (*ListValue) Descriptor() ([]byte, []int) { + return fileDescriptor_struct_3a5a94e0c7801b27, []int{2} +} +func (*ListValue) XXX_WellKnownType() string { return "ListValue" } +func (m *ListValue) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ListValue.Unmarshal(m, b) +} +func (m *ListValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ListValue.Marshal(b, m, deterministic) +} +func (dst *ListValue) XXX_Merge(src proto.Message) { + xxx_messageInfo_ListValue.Merge(dst, src) +} +func (m *ListValue) XXX_Size() int { + return xxx_messageInfo_ListValue.Size(m) +} +func (m *ListValue) XXX_DiscardUnknown() { + xxx_messageInfo_ListValue.DiscardUnknown(m) +} + +var xxx_messageInfo_ListValue proto.InternalMessageInfo func (m *ListValue) GetValues() []*Value { if m != nil { @@ -341,14 +398,17 @@ func (m *ListValue) GetValues() []*Value { func init() { proto.RegisterType((*Struct)(nil), "google.protobuf.Struct") + proto.RegisterMapType((map[string]*Value)(nil), "google.protobuf.Struct.FieldsEntry") proto.RegisterType((*Value)(nil), "google.protobuf.Value") proto.RegisterType((*ListValue)(nil), "google.protobuf.ListValue") proto.RegisterEnum("google.protobuf.NullValue", NullValue_name, NullValue_value) } -func init() { proto.RegisterFile("google/protobuf/struct.proto", fileDescriptor0) } +func init() { + proto.RegisterFile("google/protobuf/struct.proto", fileDescriptor_struct_3a5a94e0c7801b27) +} -var fileDescriptor0 = []byte{ +var fileDescriptor_struct_3a5a94e0c7801b27 = []byte{ // 417 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x92, 0x41, 0x8b, 0xd3, 0x40, 0x14, 0xc7, 0x3b, 0xc9, 0x36, 0x98, 0x17, 0x59, 0x97, 0x11, 0xb4, 0xac, 0xa2, 0xa1, 0x7b, 0x09, diff --git a/vendor/github.com/golang/protobuf/ptypes/timestamp/timestamp.pb.go b/vendor/github.com/golang/protobuf/ptypes/timestamp/timestamp.pb.go index e23e4a25d..e9c222282 100644 --- a/vendor/github.com/golang/protobuf/ptypes/timestamp/timestamp.pb.go +++ b/vendor/github.com/golang/protobuf/ptypes/timestamp/timestamp.pb.go @@ -1,16 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // source: google/protobuf/timestamp.proto -/* -Package timestamp is a generated protocol buffer package. - -It is generated from these files: - google/protobuf/timestamp.proto - -It has these top-level messages: - Timestamp -*/ -package timestamp +package timestamp // import "github.com/golang/protobuf/ptypes/timestamp" import proto "github.com/golang/protobuf/proto" import fmt "fmt" @@ -101,7 +92,7 @@ const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package // to this format using [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) // with the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one // can use the Joda Time's [`ISODateTimeFormat.dateTime()`]( -// http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()) +// http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime--) // to obtain a formatter capable of generating timestamps in this format. // // @@ -114,14 +105,36 @@ type Timestamp struct { // second values with fractions must still have non-negative nanos values // that count forward in time. Must be from 0 to 999,999,999 // inclusive. - Nanos int32 `protobuf:"varint,2,opt,name=nanos" json:"nanos,omitempty"` + Nanos int32 `protobuf:"varint,2,opt,name=nanos" json:"nanos,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *Timestamp) Reset() { *m = Timestamp{} } -func (m *Timestamp) String() string { return proto.CompactTextString(m) } -func (*Timestamp) ProtoMessage() {} -func (*Timestamp) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } -func (*Timestamp) XXX_WellKnownType() string { return "Timestamp" } +func (m *Timestamp) Reset() { *m = Timestamp{} } +func (m *Timestamp) String() string { return proto.CompactTextString(m) } +func (*Timestamp) ProtoMessage() {} +func (*Timestamp) Descriptor() ([]byte, []int) { + return fileDescriptor_timestamp_b826e8e5fba671a8, []int{0} +} +func (*Timestamp) XXX_WellKnownType() string { return "Timestamp" } +func (m *Timestamp) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Timestamp.Unmarshal(m, b) +} +func (m *Timestamp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Timestamp.Marshal(b, m, deterministic) +} +func (dst *Timestamp) XXX_Merge(src proto.Message) { + xxx_messageInfo_Timestamp.Merge(dst, src) +} +func (m *Timestamp) XXX_Size() int { + return xxx_messageInfo_Timestamp.Size(m) +} +func (m *Timestamp) XXX_DiscardUnknown() { + xxx_messageInfo_Timestamp.DiscardUnknown(m) +} + +var xxx_messageInfo_Timestamp proto.InternalMessageInfo func (m *Timestamp) GetSeconds() int64 { if m != nil { @@ -141,9 +154,11 @@ func init() { proto.RegisterType((*Timestamp)(nil), "google.protobuf.Timestamp") } -func init() { proto.RegisterFile("google/protobuf/timestamp.proto", fileDescriptor0) } +func init() { + proto.RegisterFile("google/protobuf/timestamp.proto", fileDescriptor_timestamp_b826e8e5fba671a8) +} -var fileDescriptor0 = []byte{ +var fileDescriptor_timestamp_b826e8e5fba671a8 = []byte{ // 191 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4f, 0xcf, 0xcf, 0x4f, 0xcf, 0x49, 0xd5, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0x2f, 0xc9, 0xcc, 0x4d, diff --git a/vendor/github.com/golang/protobuf/ptypes/timestamp/timestamp.proto b/vendor/github.com/golang/protobuf/ptypes/timestamp/timestamp.proto index b7cbd1750..06750ab1f 100644 --- a/vendor/github.com/golang/protobuf/ptypes/timestamp/timestamp.proto +++ b/vendor/github.com/golang/protobuf/ptypes/timestamp/timestamp.proto @@ -114,7 +114,7 @@ option objc_class_prefix = "GPB"; // to this format using [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) // with the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one // can use the Joda Time's [`ISODateTimeFormat.dateTime()`]( -// http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()) +// http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime--) // to obtain a formatter capable of generating timestamps in this format. // // diff --git a/vendor/github.com/golang/protobuf/ptypes/wrappers/wrappers.pb.go b/vendor/github.com/golang/protobuf/ptypes/wrappers/wrappers.pb.go index 0ed59bf19..d1fc4d0b8 100644 --- a/vendor/github.com/golang/protobuf/ptypes/wrappers/wrappers.pb.go +++ b/vendor/github.com/golang/protobuf/ptypes/wrappers/wrappers.pb.go @@ -1,24 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // source: google/protobuf/wrappers.proto -/* -Package wrappers is a generated protocol buffer package. - -It is generated from these files: - google/protobuf/wrappers.proto - -It has these top-level messages: - DoubleValue - FloatValue - Int64Value - UInt64Value - Int32Value - UInt32Value - BoolValue - StringValue - BytesValue -*/ -package wrappers +package wrappers // import "github.com/golang/protobuf/ptypes/wrappers" import proto "github.com/golang/protobuf/proto" import fmt "fmt" @@ -40,14 +23,36 @@ const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package // The JSON representation for `DoubleValue` is JSON number. type DoubleValue struct { // The double value. - Value float64 `protobuf:"fixed64,1,opt,name=value" json:"value,omitempty"` + Value float64 `protobuf:"fixed64,1,opt,name=value" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *DoubleValue) Reset() { *m = DoubleValue{} } -func (m *DoubleValue) String() string { return proto.CompactTextString(m) } -func (*DoubleValue) ProtoMessage() {} -func (*DoubleValue) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } -func (*DoubleValue) XXX_WellKnownType() string { return "DoubleValue" } +func (m *DoubleValue) Reset() { *m = DoubleValue{} } +func (m *DoubleValue) String() string { return proto.CompactTextString(m) } +func (*DoubleValue) ProtoMessage() {} +func (*DoubleValue) Descriptor() ([]byte, []int) { + return fileDescriptor_wrappers_16c7c35c009f3253, []int{0} +} +func (*DoubleValue) XXX_WellKnownType() string { return "DoubleValue" } +func (m *DoubleValue) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DoubleValue.Unmarshal(m, b) +} +func (m *DoubleValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DoubleValue.Marshal(b, m, deterministic) +} +func (dst *DoubleValue) XXX_Merge(src proto.Message) { + xxx_messageInfo_DoubleValue.Merge(dst, src) +} +func (m *DoubleValue) XXX_Size() int { + return xxx_messageInfo_DoubleValue.Size(m) +} +func (m *DoubleValue) XXX_DiscardUnknown() { + xxx_messageInfo_DoubleValue.DiscardUnknown(m) +} + +var xxx_messageInfo_DoubleValue proto.InternalMessageInfo func (m *DoubleValue) GetValue() float64 { if m != nil { @@ -61,14 +66,36 @@ func (m *DoubleValue) GetValue() float64 { // The JSON representation for `FloatValue` is JSON number. type FloatValue struct { // The float value. - Value float32 `protobuf:"fixed32,1,opt,name=value" json:"value,omitempty"` + Value float32 `protobuf:"fixed32,1,opt,name=value" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *FloatValue) Reset() { *m = FloatValue{} } -func (m *FloatValue) String() string { return proto.CompactTextString(m) } -func (*FloatValue) ProtoMessage() {} -func (*FloatValue) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } -func (*FloatValue) XXX_WellKnownType() string { return "FloatValue" } +func (m *FloatValue) Reset() { *m = FloatValue{} } +func (m *FloatValue) String() string { return proto.CompactTextString(m) } +func (*FloatValue) ProtoMessage() {} +func (*FloatValue) Descriptor() ([]byte, []int) { + return fileDescriptor_wrappers_16c7c35c009f3253, []int{1} +} +func (*FloatValue) XXX_WellKnownType() string { return "FloatValue" } +func (m *FloatValue) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_FloatValue.Unmarshal(m, b) +} +func (m *FloatValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_FloatValue.Marshal(b, m, deterministic) +} +func (dst *FloatValue) XXX_Merge(src proto.Message) { + xxx_messageInfo_FloatValue.Merge(dst, src) +} +func (m *FloatValue) XXX_Size() int { + return xxx_messageInfo_FloatValue.Size(m) +} +func (m *FloatValue) XXX_DiscardUnknown() { + xxx_messageInfo_FloatValue.DiscardUnknown(m) +} + +var xxx_messageInfo_FloatValue proto.InternalMessageInfo func (m *FloatValue) GetValue() float32 { if m != nil { @@ -82,14 +109,36 @@ func (m *FloatValue) GetValue() float32 { // The JSON representation for `Int64Value` is JSON string. type Int64Value struct { // The int64 value. - Value int64 `protobuf:"varint,1,opt,name=value" json:"value,omitempty"` + Value int64 `protobuf:"varint,1,opt,name=value" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *Int64Value) Reset() { *m = Int64Value{} } -func (m *Int64Value) String() string { return proto.CompactTextString(m) } -func (*Int64Value) ProtoMessage() {} -func (*Int64Value) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } -func (*Int64Value) XXX_WellKnownType() string { return "Int64Value" } +func (m *Int64Value) Reset() { *m = Int64Value{} } +func (m *Int64Value) String() string { return proto.CompactTextString(m) } +func (*Int64Value) ProtoMessage() {} +func (*Int64Value) Descriptor() ([]byte, []int) { + return fileDescriptor_wrappers_16c7c35c009f3253, []int{2} +} +func (*Int64Value) XXX_WellKnownType() string { return "Int64Value" } +func (m *Int64Value) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Int64Value.Unmarshal(m, b) +} +func (m *Int64Value) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Int64Value.Marshal(b, m, deterministic) +} +func (dst *Int64Value) XXX_Merge(src proto.Message) { + xxx_messageInfo_Int64Value.Merge(dst, src) +} +func (m *Int64Value) XXX_Size() int { + return xxx_messageInfo_Int64Value.Size(m) +} +func (m *Int64Value) XXX_DiscardUnknown() { + xxx_messageInfo_Int64Value.DiscardUnknown(m) +} + +var xxx_messageInfo_Int64Value proto.InternalMessageInfo func (m *Int64Value) GetValue() int64 { if m != nil { @@ -103,14 +152,36 @@ func (m *Int64Value) GetValue() int64 { // The JSON representation for `UInt64Value` is JSON string. type UInt64Value struct { // The uint64 value. - Value uint64 `protobuf:"varint,1,opt,name=value" json:"value,omitempty"` + Value uint64 `protobuf:"varint,1,opt,name=value" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *UInt64Value) Reset() { *m = UInt64Value{} } +func (m *UInt64Value) String() string { return proto.CompactTextString(m) } +func (*UInt64Value) ProtoMessage() {} +func (*UInt64Value) Descriptor() ([]byte, []int) { + return fileDescriptor_wrappers_16c7c35c009f3253, []int{3} +} +func (*UInt64Value) XXX_WellKnownType() string { return "UInt64Value" } +func (m *UInt64Value) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_UInt64Value.Unmarshal(m, b) +} +func (m *UInt64Value) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_UInt64Value.Marshal(b, m, deterministic) +} +func (dst *UInt64Value) XXX_Merge(src proto.Message) { + xxx_messageInfo_UInt64Value.Merge(dst, src) +} +func (m *UInt64Value) XXX_Size() int { + return xxx_messageInfo_UInt64Value.Size(m) +} +func (m *UInt64Value) XXX_DiscardUnknown() { + xxx_messageInfo_UInt64Value.DiscardUnknown(m) } -func (m *UInt64Value) Reset() { *m = UInt64Value{} } -func (m *UInt64Value) String() string { return proto.CompactTextString(m) } -func (*UInt64Value) ProtoMessage() {} -func (*UInt64Value) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } -func (*UInt64Value) XXX_WellKnownType() string { return "UInt64Value" } +var xxx_messageInfo_UInt64Value proto.InternalMessageInfo func (m *UInt64Value) GetValue() uint64 { if m != nil { @@ -124,14 +195,36 @@ func (m *UInt64Value) GetValue() uint64 { // The JSON representation for `Int32Value` is JSON number. type Int32Value struct { // The int32 value. - Value int32 `protobuf:"varint,1,opt,name=value" json:"value,omitempty"` + Value int32 `protobuf:"varint,1,opt,name=value" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *Int32Value) Reset() { *m = Int32Value{} } -func (m *Int32Value) String() string { return proto.CompactTextString(m) } -func (*Int32Value) ProtoMessage() {} -func (*Int32Value) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} } -func (*Int32Value) XXX_WellKnownType() string { return "Int32Value" } +func (m *Int32Value) Reset() { *m = Int32Value{} } +func (m *Int32Value) String() string { return proto.CompactTextString(m) } +func (*Int32Value) ProtoMessage() {} +func (*Int32Value) Descriptor() ([]byte, []int) { + return fileDescriptor_wrappers_16c7c35c009f3253, []int{4} +} +func (*Int32Value) XXX_WellKnownType() string { return "Int32Value" } +func (m *Int32Value) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Int32Value.Unmarshal(m, b) +} +func (m *Int32Value) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Int32Value.Marshal(b, m, deterministic) +} +func (dst *Int32Value) XXX_Merge(src proto.Message) { + xxx_messageInfo_Int32Value.Merge(dst, src) +} +func (m *Int32Value) XXX_Size() int { + return xxx_messageInfo_Int32Value.Size(m) +} +func (m *Int32Value) XXX_DiscardUnknown() { + xxx_messageInfo_Int32Value.DiscardUnknown(m) +} + +var xxx_messageInfo_Int32Value proto.InternalMessageInfo func (m *Int32Value) GetValue() int32 { if m != nil { @@ -145,14 +238,36 @@ func (m *Int32Value) GetValue() int32 { // The JSON representation for `UInt32Value` is JSON number. type UInt32Value struct { // The uint32 value. - Value uint32 `protobuf:"varint,1,opt,name=value" json:"value,omitempty"` + Value uint32 `protobuf:"varint,1,opt,name=value" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *UInt32Value) Reset() { *m = UInt32Value{} } +func (m *UInt32Value) String() string { return proto.CompactTextString(m) } +func (*UInt32Value) ProtoMessage() {} +func (*UInt32Value) Descriptor() ([]byte, []int) { + return fileDescriptor_wrappers_16c7c35c009f3253, []int{5} +} +func (*UInt32Value) XXX_WellKnownType() string { return "UInt32Value" } +func (m *UInt32Value) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_UInt32Value.Unmarshal(m, b) +} +func (m *UInt32Value) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_UInt32Value.Marshal(b, m, deterministic) +} +func (dst *UInt32Value) XXX_Merge(src proto.Message) { + xxx_messageInfo_UInt32Value.Merge(dst, src) +} +func (m *UInt32Value) XXX_Size() int { + return xxx_messageInfo_UInt32Value.Size(m) +} +func (m *UInt32Value) XXX_DiscardUnknown() { + xxx_messageInfo_UInt32Value.DiscardUnknown(m) } -func (m *UInt32Value) Reset() { *m = UInt32Value{} } -func (m *UInt32Value) String() string { return proto.CompactTextString(m) } -func (*UInt32Value) ProtoMessage() {} -func (*UInt32Value) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} } -func (*UInt32Value) XXX_WellKnownType() string { return "UInt32Value" } +var xxx_messageInfo_UInt32Value proto.InternalMessageInfo func (m *UInt32Value) GetValue() uint32 { if m != nil { @@ -166,14 +281,36 @@ func (m *UInt32Value) GetValue() uint32 { // The JSON representation for `BoolValue` is JSON `true` and `false`. type BoolValue struct { // The bool value. - Value bool `protobuf:"varint,1,opt,name=value" json:"value,omitempty"` + Value bool `protobuf:"varint,1,opt,name=value" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *BoolValue) Reset() { *m = BoolValue{} } +func (m *BoolValue) String() string { return proto.CompactTextString(m) } +func (*BoolValue) ProtoMessage() {} +func (*BoolValue) Descriptor() ([]byte, []int) { + return fileDescriptor_wrappers_16c7c35c009f3253, []int{6} +} +func (*BoolValue) XXX_WellKnownType() string { return "BoolValue" } +func (m *BoolValue) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_BoolValue.Unmarshal(m, b) +} +func (m *BoolValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_BoolValue.Marshal(b, m, deterministic) +} +func (dst *BoolValue) XXX_Merge(src proto.Message) { + xxx_messageInfo_BoolValue.Merge(dst, src) +} +func (m *BoolValue) XXX_Size() int { + return xxx_messageInfo_BoolValue.Size(m) +} +func (m *BoolValue) XXX_DiscardUnknown() { + xxx_messageInfo_BoolValue.DiscardUnknown(m) } -func (m *BoolValue) Reset() { *m = BoolValue{} } -func (m *BoolValue) String() string { return proto.CompactTextString(m) } -func (*BoolValue) ProtoMessage() {} -func (*BoolValue) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} } -func (*BoolValue) XXX_WellKnownType() string { return "BoolValue" } +var xxx_messageInfo_BoolValue proto.InternalMessageInfo func (m *BoolValue) GetValue() bool { if m != nil { @@ -187,14 +324,36 @@ func (m *BoolValue) GetValue() bool { // The JSON representation for `StringValue` is JSON string. type StringValue struct { // The string value. - Value string `protobuf:"bytes,1,opt,name=value" json:"value,omitempty"` + Value string `protobuf:"bytes,1,opt,name=value" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *StringValue) Reset() { *m = StringValue{} } -func (m *StringValue) String() string { return proto.CompactTextString(m) } -func (*StringValue) ProtoMessage() {} -func (*StringValue) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} } -func (*StringValue) XXX_WellKnownType() string { return "StringValue" } +func (m *StringValue) Reset() { *m = StringValue{} } +func (m *StringValue) String() string { return proto.CompactTextString(m) } +func (*StringValue) ProtoMessage() {} +func (*StringValue) Descriptor() ([]byte, []int) { + return fileDescriptor_wrappers_16c7c35c009f3253, []int{7} +} +func (*StringValue) XXX_WellKnownType() string { return "StringValue" } +func (m *StringValue) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_StringValue.Unmarshal(m, b) +} +func (m *StringValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_StringValue.Marshal(b, m, deterministic) +} +func (dst *StringValue) XXX_Merge(src proto.Message) { + xxx_messageInfo_StringValue.Merge(dst, src) +} +func (m *StringValue) XXX_Size() int { + return xxx_messageInfo_StringValue.Size(m) +} +func (m *StringValue) XXX_DiscardUnknown() { + xxx_messageInfo_StringValue.DiscardUnknown(m) +} + +var xxx_messageInfo_StringValue proto.InternalMessageInfo func (m *StringValue) GetValue() string { if m != nil { @@ -208,14 +367,36 @@ func (m *StringValue) GetValue() string { // The JSON representation for `BytesValue` is JSON string. type BytesValue struct { // The bytes value. - Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` + Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *BytesValue) Reset() { *m = BytesValue{} } +func (m *BytesValue) String() string { return proto.CompactTextString(m) } +func (*BytesValue) ProtoMessage() {} +func (*BytesValue) Descriptor() ([]byte, []int) { + return fileDescriptor_wrappers_16c7c35c009f3253, []int{8} +} +func (*BytesValue) XXX_WellKnownType() string { return "BytesValue" } +func (m *BytesValue) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_BytesValue.Unmarshal(m, b) +} +func (m *BytesValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_BytesValue.Marshal(b, m, deterministic) +} +func (dst *BytesValue) XXX_Merge(src proto.Message) { + xxx_messageInfo_BytesValue.Merge(dst, src) +} +func (m *BytesValue) XXX_Size() int { + return xxx_messageInfo_BytesValue.Size(m) +} +func (m *BytesValue) XXX_DiscardUnknown() { + xxx_messageInfo_BytesValue.DiscardUnknown(m) } -func (m *BytesValue) Reset() { *m = BytesValue{} } -func (m *BytesValue) String() string { return proto.CompactTextString(m) } -func (*BytesValue) ProtoMessage() {} -func (*BytesValue) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} } -func (*BytesValue) XXX_WellKnownType() string { return "BytesValue" } +var xxx_messageInfo_BytesValue proto.InternalMessageInfo func (m *BytesValue) GetValue() []byte { if m != nil { @@ -236,9 +417,11 @@ func init() { proto.RegisterType((*BytesValue)(nil), "google.protobuf.BytesValue") } -func init() { proto.RegisterFile("google/protobuf/wrappers.proto", fileDescriptor0) } +func init() { + proto.RegisterFile("google/protobuf/wrappers.proto", fileDescriptor_wrappers_16c7c35c009f3253) +} -var fileDescriptor0 = []byte{ +var fileDescriptor_wrappers_16c7c35c009f3253 = []byte{ // 259 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4b, 0xcf, 0xcf, 0x4f, 0xcf, 0x49, 0xd5, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0x2f, 0x2f, 0x4a, 0x2c, diff --git a/vendor/github.com/golang/protobuf/regenerate.sh b/vendor/github.com/golang/protobuf/regenerate.sh new file mode 100755 index 000000000..dc7e2d1f6 --- /dev/null +++ b/vendor/github.com/golang/protobuf/regenerate.sh @@ -0,0 +1,53 @@ +#!/bin/bash + +set -e + +# Install the working tree's protoc-gen-gen in a tempdir. +tmpdir=$(mktemp -d -t regen-wkt.XXXXXX) +trap 'rm -rf $tmpdir' EXIT +mkdir -p $tmpdir/bin +PATH=$tmpdir/bin:$PATH +GOBIN=$tmpdir/bin go install ./protoc-gen-go + +# Public imports require at least Go 1.9. +supportTypeAliases="" +if go list -f '{{context.ReleaseTags}}' runtime | grep -q go1.9; then + supportTypeAliases=1 +fi + +# Generate various test protos. +PROTO_DIRS=( + conformance/internal/conformance_proto + jsonpb/jsonpb_test_proto + proto + protoc-gen-go/testdata +) +for dir in ${PROTO_DIRS[@]}; do + for p in `find $dir -name "*.proto"`; do + if [[ $p == */import_public/* && ! $supportTypeAliases ]]; then + echo "# $p (skipped)" + continue; + fi + echo "# $p" + protoc -I$dir --go_out=plugins=grpc,paths=source_relative:$dir $p + done +done + +# Deriving the location of the source protos from the path to the +# protoc binary may be a bit odd, but this is what protoc itself does. +PROTO_INCLUDE=$(dirname $(dirname $(which protoc)))/include + +# Well-known types. +WKT_PROTOS=(any duration empty struct timestamp wrappers) +for p in ${WKT_PROTOS[@]}; do + echo "# google/protobuf/$p.proto" + protoc --go_out=paths=source_relative:$tmpdir google/protobuf/$p.proto + cp $tmpdir/google/protobuf/$p.pb.go ptypes/$p + cp $PROTO_INCLUDE/google/protobuf/$p.proto ptypes/$p +done + +# descriptor.proto. +echo "# google/protobuf/descriptor.proto" +protoc --go_out=paths=source_relative:$tmpdir google/protobuf/descriptor.proto +cp $tmpdir/google/protobuf/descriptor.pb.go protoc-gen-go/descriptor +cp $PROTO_INCLUDE/google/protobuf/descriptor.proto protoc-gen-go/descriptor diff --git a/vendor/github.com/google/goexpect/expect.go b/vendor/github.com/google/goexpect/expect.go index 2017a75f7..8e2c88b98 100644 --- a/vendor/github.com/google/goexpect/expect.go +++ b/vendor/github.com/google/goexpect/expect.go @@ -142,6 +142,15 @@ func changeChk(f func(*GExpect) bool) Option { } } +// SetEnv sets the environmental variables of the spawned process. +func SetEnv(env []string) Option { + return func(e *GExpect) Option { + prev := e.cmd.Env + e.cmd.Env = env + return SetEnv(prev) + } +} + // BatchCommands. const ( // BatchSend for invoking Send in a batch diff --git a/vendor/github.com/google/goterm/README b/vendor/github.com/google/goterm/README index d9e6c5830..76ae47bf6 100644 --- a/vendor/github.com/google/goterm/README +++ b/vendor/github.com/google/goterm/README @@ -3,3 +3,22 @@ also contains some convenience functions for colors, SSH <> termios translations reading passwords etc. The PTY and termios parts are Linux specific. + +## Get the code +`go get github.com/google/goterm/term` + +## + +``` +package main + +import ( + "fmt" + + "github.com/google/goterm/term" +) + +func main() { + fmt.Println(term.Blue("Hello blue world")) +} +``` diff --git a/vendor/github.com/json-iterator/go/Gopkg.lock b/vendor/github.com/json-iterator/go/Gopkg.lock index 338f1c68a..3719afe8e 100644 --- a/vendor/github.com/json-iterator/go/Gopkg.lock +++ b/vendor/github.com/json-iterator/go/Gopkg.lock @@ -1,6 +1,12 @@ # This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. +[[projects]] + name = "github.com/json-iterator/go" + packages = ["."] + revision = "ca39e5af3ece67bbcda3d0f4f56a8e24d9f2dad4" + version = "1.1.3" + [[projects]] name = "github.com/modern-go/concurrent" packages = ["."] @@ -16,6 +22,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "ac7003b5a981716353a43055ab7d4c5357403cb30a60de2dbdeb446c1544beaa" + inputs-digest = "56a0b9e9e61d2bc8af5e1b68537401b7f4d60805eda3d107058f3171aa5cf793" solver-name = "gps-cdcl" solver-version = 1 diff --git a/vendor/github.com/json-iterator/go/config.go b/vendor/github.com/json-iterator/go/config.go index bd66947d7..835819129 100644 --- a/vendor/github.com/json-iterator/go/config.go +++ b/vendor/github.com/json-iterator/go/config.go @@ -2,12 +2,13 @@ package jsoniter import ( "encoding/json" - "github.com/modern-go/concurrent" - "github.com/modern-go/reflect2" "io" "reflect" "sync" "unsafe" + + "github.com/modern-go/concurrent" + "github.com/modern-go/reflect2" ) // Config customize how the API should behave. @@ -23,6 +24,7 @@ type Config struct { OnlyTaggedField bool ValidateJsonRawMessage bool ObjectFieldMustBeSimpleString bool + CaseSensitive bool } // API the public interface of this package. @@ -75,6 +77,7 @@ type frozenConfig struct { extensions []Extension streamPool *sync.Pool iteratorPool *sync.Pool + caseSensitive bool } func (cfg *frozenConfig) initCache() { @@ -128,6 +131,7 @@ func (cfg Config) Froze() API { objectFieldMustBeSimpleString: cfg.ObjectFieldMustBeSimpleString, onlyTaggedField: cfg.OnlyTaggedField, disallowUnknownFields: cfg.DisallowUnknownFields, + caseSensitive: cfg.CaseSensitive, } api.streamPool = &sync.Pool{ New: func() interface{} { diff --git a/vendor/github.com/json-iterator/go/iter_object.go b/vendor/github.com/json-iterator/go/iter_object.go index ebd3da895..6e7c370ab 100644 --- a/vendor/github.com/json-iterator/go/iter_object.go +++ b/vendor/github.com/json-iterator/go/iter_object.go @@ -60,7 +60,7 @@ func (iter *Iterator) readFieldHash() int64 { if b == '\\' { iter.head = i for _, b := range iter.readStringSlowPath() { - if 'A' <= b && b <= 'Z' { + if 'A' <= b && b <= 'Z' && !iter.cfg.caseSensitive { b += 'a' - 'A' } hash ^= int64(b) @@ -82,7 +82,7 @@ func (iter *Iterator) readFieldHash() int64 { } return hash } - if 'A' <= b && b <= 'Z' { + if 'A' <= b && b <= 'Z' && !iter.cfg.caseSensitive { b += 'a' - 'A' } hash ^= int64(b) @@ -95,10 +95,14 @@ func (iter *Iterator) readFieldHash() int64 { } } -func calcHash(str string) int64 { +func calcHash(str string, caseSensitive bool) int64 { hash := int64(0x811c9dc5) for _, b := range str { - hash ^= int64(unicode.ToLower(b)) + if caseSensitive { + hash ^= int64(b) + } else { + hash ^= int64(unicode.ToLower(b)) + } hash *= 0x1000193 } return int64(hash) diff --git a/vendor/github.com/json-iterator/go/reflect.go b/vendor/github.com/json-iterator/go/reflect.go index 5c7d3a8a0..be7a0e218 100644 --- a/vendor/github.com/json-iterator/go/reflect.go +++ b/vendor/github.com/json-iterator/go/reflect.go @@ -2,9 +2,10 @@ package jsoniter import ( "fmt" - "github.com/modern-go/reflect2" "reflect" "unsafe" + + "github.com/modern-go/reflect2" ) // ValDecoder is an internal type registered to cache as needed. @@ -40,6 +41,14 @@ type ctx struct { decoders map[reflect2.Type]ValDecoder } +func (b *ctx) caseSensitive() bool { + if b.frozenConfig == nil { + // default is case-insensitive + return false + } + return b.frozenConfig.caseSensitive +} + func (b *ctx) append(prefix string) *ctx { return &ctx{ frozenConfig: b.frozenConfig, diff --git a/vendor/github.com/json-iterator/go/reflect_native.go b/vendor/github.com/json-iterator/go/reflect_native.go index fac4d9f77..9042eb0cb 100644 --- a/vendor/github.com/json-iterator/go/reflect_native.go +++ b/vendor/github.com/json-iterator/go/reflect_native.go @@ -1,7 +1,6 @@ package jsoniter import ( - "bytes" "encoding/base64" "reflect" "strconv" @@ -418,20 +417,11 @@ func (codec *base64Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { } switch iter.WhatIsNext() { case StringValue: - encoding := base64.StdEncoding - src := iter.SkipAndReturnBytes() - // New line characters (\r and \n) are ignored. - // Refer to https://golang.org/pkg/encoding/base64/#Encoding.Decode - src = bytes.Replace(src, []byte(`\r`), []byte{}, -1) - src = bytes.Replace(src, []byte(`\n`), []byte{}, -1) - src = src[1 : len(src)-1] - decodedLen := encoding.DecodedLen(len(src)) - dst := make([]byte, decodedLen) - len, err := encoding.Decode(dst, src) + src := iter.ReadString() + dst, err := base64.StdEncoding.DecodeString(src) if err != nil { iter.ReportError("decode base64", err.Error()) } else { - dst = dst[:len] codec.sliceType.UnsafeSet(ptr, unsafe.Pointer(&dst)) } case ArrayValue: diff --git a/vendor/github.com/json-iterator/go/reflect_struct_decoder.go b/vendor/github.com/json-iterator/go/reflect_struct_decoder.go index fd7664786..355d2d116 100644 --- a/vendor/github.com/json-iterator/go/reflect_struct_decoder.go +++ b/vendor/github.com/json-iterator/go/reflect_struct_decoder.go @@ -2,10 +2,11 @@ package jsoniter import ( "fmt" - "github.com/modern-go/reflect2" "io" "strings" "unsafe" + + "github.com/modern-go/reflect2" ) func decoderOfStruct(ctx *ctx, typ reflect2.Type) ValDecoder { @@ -31,11 +32,15 @@ func decoderOfStruct(ctx *ctx, typ reflect2.Type) ValDecoder { for k, binding := range bindings { fields[k] = binding.Decoder.(*structFieldDecoder) } - for k, binding := range bindings { - if _, found := fields[strings.ToLower(k)]; !found { - fields[strings.ToLower(k)] = binding.Decoder.(*structFieldDecoder) + + if !ctx.caseSensitive() { + for k, binding := range bindings { + if _, found := fields[strings.ToLower(k)]; !found { + fields[strings.ToLower(k)] = binding.Decoder.(*structFieldDecoder) + } } } + return createStructDecoder(ctx, typ, fields) } @@ -46,12 +51,13 @@ func createStructDecoder(ctx *ctx, typ reflect2.Type, fields map[string]*structF knownHash := map[int64]struct{}{ 0: {}, } + switch len(fields) { case 0: return &skipObjectDecoder{typ} case 1: for fieldName, fieldDecoder := range fields { - fieldHash := calcHash(fieldName) + fieldHash := calcHash(fieldName, ctx.caseSensitive()) _, known := knownHash[fieldHash] if known { return &generalStructDecoder{typ, fields, false} @@ -65,7 +71,7 @@ func createStructDecoder(ctx *ctx, typ reflect2.Type, fields map[string]*structF var fieldDecoder1 *structFieldDecoder var fieldDecoder2 *structFieldDecoder for fieldName, fieldDecoder := range fields { - fieldHash := calcHash(fieldName) + fieldHash := calcHash(fieldName, ctx.caseSensitive()) _, known := knownHash[fieldHash] if known { return &generalStructDecoder{typ, fields, false} @@ -88,7 +94,7 @@ func createStructDecoder(ctx *ctx, typ reflect2.Type, fields map[string]*structF var fieldDecoder2 *structFieldDecoder var fieldDecoder3 *structFieldDecoder for fieldName, fieldDecoder := range fields { - fieldHash := calcHash(fieldName) + fieldHash := calcHash(fieldName, ctx.caseSensitive()) _, known := knownHash[fieldHash] if known { return &generalStructDecoder{typ, fields, false} @@ -119,7 +125,7 @@ func createStructDecoder(ctx *ctx, typ reflect2.Type, fields map[string]*structF var fieldDecoder3 *structFieldDecoder var fieldDecoder4 *structFieldDecoder for fieldName, fieldDecoder := range fields { - fieldHash := calcHash(fieldName) + fieldHash := calcHash(fieldName, ctx.caseSensitive()) _, known := knownHash[fieldHash] if known { return &generalStructDecoder{typ, fields, false} @@ -156,7 +162,7 @@ func createStructDecoder(ctx *ctx, typ reflect2.Type, fields map[string]*structF var fieldDecoder4 *structFieldDecoder var fieldDecoder5 *structFieldDecoder for fieldName, fieldDecoder := range fields { - fieldHash := calcHash(fieldName) + fieldHash := calcHash(fieldName, ctx.caseSensitive()) _, known := knownHash[fieldHash] if known { return &generalStructDecoder{typ, fields, false} @@ -199,7 +205,7 @@ func createStructDecoder(ctx *ctx, typ reflect2.Type, fields map[string]*structF var fieldDecoder5 *structFieldDecoder var fieldDecoder6 *structFieldDecoder for fieldName, fieldDecoder := range fields { - fieldHash := calcHash(fieldName) + fieldHash := calcHash(fieldName, ctx.caseSensitive()) _, known := knownHash[fieldHash] if known { return &generalStructDecoder{typ, fields, false} @@ -248,7 +254,7 @@ func createStructDecoder(ctx *ctx, typ reflect2.Type, fields map[string]*structF var fieldDecoder6 *structFieldDecoder var fieldDecoder7 *structFieldDecoder for fieldName, fieldDecoder := range fields { - fieldHash := calcHash(fieldName) + fieldHash := calcHash(fieldName, ctx.caseSensitive()) _, known := knownHash[fieldHash] if known { return &generalStructDecoder{typ, fields, false} @@ -303,7 +309,7 @@ func createStructDecoder(ctx *ctx, typ reflect2.Type, fields map[string]*structF var fieldDecoder7 *structFieldDecoder var fieldDecoder8 *structFieldDecoder for fieldName, fieldDecoder := range fields { - fieldHash := calcHash(fieldName) + fieldHash := calcHash(fieldName, ctx.caseSensitive()) _, known := knownHash[fieldHash] if known { return &generalStructDecoder{typ, fields, false} @@ -364,7 +370,7 @@ func createStructDecoder(ctx *ctx, typ reflect2.Type, fields map[string]*structF var fieldDecoder8 *structFieldDecoder var fieldDecoder9 *structFieldDecoder for fieldName, fieldDecoder := range fields { - fieldHash := calcHash(fieldName) + fieldHash := calcHash(fieldName, ctx.caseSensitive()) _, known := knownHash[fieldHash] if known { return &generalStructDecoder{typ, fields, false} @@ -431,7 +437,7 @@ func createStructDecoder(ctx *ctx, typ reflect2.Type, fields map[string]*structF var fieldDecoder9 *structFieldDecoder var fieldDecoder10 *structFieldDecoder for fieldName, fieldDecoder := range fields { - fieldHash := calcHash(fieldName) + fieldHash := calcHash(fieldName, ctx.caseSensitive()) _, known := knownHash[fieldHash] if known { return &generalStructDecoder{typ, fields, false} @@ -513,13 +519,13 @@ func (decoder *generalStructDecoder) decodeOneField(ptr unsafe.Pointer, iter *It fieldBytes := iter.ReadStringAsSlice() field = *(*string)(unsafe.Pointer(&fieldBytes)) fieldDecoder = decoder.fields[field] - if fieldDecoder == nil { + if fieldDecoder == nil && !iter.cfg.caseSensitive { fieldDecoder = decoder.fields[strings.ToLower(field)] } } else { field = iter.ReadString() fieldDecoder = decoder.fields[field] - if fieldDecoder == nil { + if fieldDecoder == nil && !iter.cfg.caseSensitive { fieldDecoder = decoder.fields[strings.ToLower(field)] } } diff --git a/vendor/github.com/spf13/cobra/.circleci/config.yml b/vendor/github.com/spf13/cobra/.circleci/config.yml index bbba32b7f..066df2251 100644 --- a/vendor/github.com/spf13/cobra/.circleci/config.yml +++ b/vendor/github.com/spf13/cobra/.circleci/config.yml @@ -13,7 +13,7 @@ base: &base name: "All Commands" command: | mkdir -p bin - curl -Lso bin/shellcheck https://github.com/caarlos0/shellcheck-docker/releases/download/v0.4.3/shellcheck + curl -Lso bin/shellcheck https://github.com/caarlos0/shellcheck-docker/releases/download/v0.4.6/shellcheck chmod +x bin/shellcheck go get -t -v ./... PATH=$PATH:$PWD/bin go test -v ./... diff --git a/vendor/github.com/spf13/cobra/bash_completions.go b/vendor/github.com/spf13/cobra/bash_completions.go index 291eae7d8..8fa8f486f 100644 --- a/vendor/github.com/spf13/cobra/bash_completions.go +++ b/vendor/github.com/spf13/cobra/bash_completions.go @@ -251,6 +251,14 @@ __%[1]s_handle_word() __%[1]s_handle_command elif [[ $c -eq 0 ]]; then __%[1]s_handle_command + elif __%[1]s_contains_word "${words[c]}" "${command_aliases[@]}"; then + # aliashash variable is an associative array which is only supported in bash > 3. + if [[ -z "${BASH_VERSION}" || "${BASH_VERSINFO[0]}" -gt 3 ]]; then + words[c]=${aliashash[${words[c]}]} + __%[1]s_handle_command + else + __%[1]s_handle_noun + fi else __%[1]s_handle_noun fi @@ -266,6 +274,7 @@ func writePostscript(buf *bytes.Buffer, name string) { buf.WriteString(fmt.Sprintf(`{ local cur prev words cword declare -A flaghash 2>/dev/null || : + declare -A aliashash 2>/dev/null || : if declare -F _init_completion >/dev/null 2>&1; then _init_completion -s || return else @@ -305,6 +314,7 @@ func writeCommands(buf *bytes.Buffer, cmd *Command) { continue } buf.WriteString(fmt.Sprintf(" commands+=(%q)\n", c.Name())) + writeCmdAliases(buf, c) } buf.WriteString("\n") } @@ -443,6 +453,21 @@ func writeRequiredNouns(buf *bytes.Buffer, cmd *Command) { } } +func writeCmdAliases(buf *bytes.Buffer, cmd *Command) { + if len(cmd.Aliases) == 0 { + return + } + + sort.Sort(sort.StringSlice(cmd.Aliases)) + + buf.WriteString(fmt.Sprint(` if [[ -z "${BASH_VERSION}" || "${BASH_VERSINFO[0]}" -gt 3 ]]; then`, "\n")) + for _, value := range cmd.Aliases { + buf.WriteString(fmt.Sprintf(" command_aliases+=(%q)\n", value)) + buf.WriteString(fmt.Sprintf(" aliashash[%q]=%q\n", value, cmd.Name())) + } + buf.WriteString(` fi`) + buf.WriteString("\n") +} func writeArgAliases(buf *bytes.Buffer, cmd *Command) { buf.WriteString(" noun_aliases=()\n") sort.Sort(sort.StringSlice(cmd.ArgAliases)) @@ -469,6 +494,10 @@ func gen(buf *bytes.Buffer, cmd *Command) { } buf.WriteString(fmt.Sprintf(" last_command=%q\n", commandName)) + buf.WriteString("\n") + buf.WriteString(" command_aliases=()\n") + buf.WriteString("\n") + writeCommands(buf, cmd) writeFlags(buf, cmd) writeRequiredFlag(buf, cmd) diff --git a/vendor/github.com/spf13/cobra/bash_completions.md b/vendor/github.com/spf13/cobra/bash_completions.md index 8d01f456f..e79d4769d 100644 --- a/vendor/github.com/spf13/cobra/bash_completions.md +++ b/vendor/github.com/spf13/cobra/bash_completions.md @@ -181,7 +181,7 @@ a custom flag completion function with cobra.BashCompCustom: ```go annotation := make(map[string][]string) - annotation[cobra.BashCompFilenameExt] = []string{"__kubectl_get_namespaces"} + annotation[cobra.BashCompCustom] = []string{"__kubectl_get_namespaces"} flag := &pflag.Flag{ Name: "namespace", diff --git a/vendor/github.com/spf13/cobra/cobra/cmd/init.go b/vendor/github.com/spf13/cobra/cobra/cmd/init.go index 244137015..d65e6c8c5 100644 --- a/vendor/github.com/spf13/cobra/cobra/cmd/init.go +++ b/vendor/github.com/spf13/cobra/cobra/cmd/init.go @@ -65,7 +65,7 @@ Init will not use an existing directory with contents.`, initializeProject(project) fmt.Fprintln(cmd.OutOrStdout(), `Your Cobra application is ready at -`+project.AbsPath()+`. +`+project.AbsPath()+` Give it a try by going there and running `+"`go run main.go`."+` Add commands to it by running `+"`cobra add [cmdname]`.") diff --git a/vendor/github.com/spf13/cobra/command.go b/vendor/github.com/spf13/cobra/command.go index 15b811279..34d1bf367 100644 --- a/vendor/github.com/spf13/cobra/command.go +++ b/vendor/github.com/spf13/cobra/command.go @@ -27,6 +27,9 @@ import ( flag "github.com/spf13/pflag" ) +// FParseErrWhitelist configures Flag parse errors to be ignored +type FParseErrWhitelist flag.ParseErrorsWhitelist + // Command is just that, a command for your application. // E.g. 'go run ...' - 'run' is the command. Cobra requires // you to define the usage and description as part of your command @@ -137,6 +140,9 @@ type Command struct { // TraverseChildren parses flags on all parents before executing child command. TraverseChildren bool + //FParseErrWhitelist flag parse errors to be ignored + FParseErrWhitelist FParseErrWhitelist + // commands is the list of commands supported by this program. commands []*Command // parent is a parent command for this command. @@ -1463,6 +1469,10 @@ func (c *Command) ParseFlags(args []string) error { } beforeErrorBufLen := c.flagErrorBuf.Len() c.mergePersistentFlags() + + //do it here after merging all flags and just before parse + c.Flags().ParseErrorsWhitelist = flag.ParseErrorsWhitelist(c.FParseErrWhitelist) + err := c.Flags().Parse(args) // Print warnings if they occurred (e.g. deprecated flag messages). if c.flagErrorBuf.Len()-beforeErrorBufLen > 0 && err == nil { diff --git a/vendor/github.com/spf13/cobra/doc/man_docs.go b/vendor/github.com/spf13/cobra/doc/man_docs.go index ce92332dd..baa48118a 100644 --- a/vendor/github.com/spf13/cobra/doc/man_docs.go +++ b/vendor/github.com/spf13/cobra/doc/man_docs.go @@ -176,13 +176,13 @@ func manPrintFlags(buf *bytes.Buffer, flags *pflag.FlagSet) { func manPrintOptions(buf *bytes.Buffer, command *cobra.Command) { flags := command.NonInheritedFlags() - if flags.HasFlags() { + if flags.HasAvailableFlags() { buf.WriteString("# OPTIONS\n") manPrintFlags(buf, flags) buf.WriteString("\n") } flags = command.InheritedFlags() - if flags.HasFlags() { + if flags.HasAvailableFlags() { buf.WriteString("# OPTIONS INHERITED FROM PARENT COMMANDS\n") manPrintFlags(buf, flags) buf.WriteString("\n") diff --git a/vendor/github.com/spf13/cobra/doc/md_docs.go b/vendor/github.com/spf13/cobra/doc/md_docs.go index d7a2c2b62..d76f6d5ec 100644 --- a/vendor/github.com/spf13/cobra/doc/md_docs.go +++ b/vendor/github.com/spf13/cobra/doc/md_docs.go @@ -29,7 +29,7 @@ import ( func printOptions(buf *bytes.Buffer, cmd *cobra.Command, name string) error { flags := cmd.NonInheritedFlags() flags.SetOutput(buf) - if flags.HasFlags() { + if flags.HasAvailableFlags() { buf.WriteString("### Options\n\n```\n") flags.PrintDefaults() buf.WriteString("```\n\n") @@ -37,7 +37,7 @@ func printOptions(buf *bytes.Buffer, cmd *cobra.Command, name string) error { parentFlags := cmd.InheritedFlags() parentFlags.SetOutput(buf) - if parentFlags.HasFlags() { + if parentFlags.HasAvailableFlags() { buf.WriteString("### Options inherited from parent commands\n\n```\n") parentFlags.PrintDefaults() buf.WriteString("```\n\n") diff --git a/vendor/github.com/spf13/cobra/doc/rest_docs.go b/vendor/github.com/spf13/cobra/doc/rest_docs.go index 4913e3ee2..051d8dc83 100644 --- a/vendor/github.com/spf13/cobra/doc/rest_docs.go +++ b/vendor/github.com/spf13/cobra/doc/rest_docs.go @@ -29,7 +29,7 @@ import ( func printOptionsReST(buf *bytes.Buffer, cmd *cobra.Command, name string) error { flags := cmd.NonInheritedFlags() flags.SetOutput(buf) - if flags.HasFlags() { + if flags.HasAvailableFlags() { buf.WriteString("Options\n") buf.WriteString("~~~~~~~\n\n::\n\n") flags.PrintDefaults() @@ -38,7 +38,7 @@ func printOptionsReST(buf *bytes.Buffer, cmd *cobra.Command, name string) error parentFlags := cmd.InheritedFlags() parentFlags.SetOutput(buf) - if parentFlags.HasFlags() { + if parentFlags.HasAvailableFlags() { buf.WriteString("Options inherited from parent commands\n") buf.WriteString("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n::\n\n") parentFlags.PrintDefaults() diff --git a/vendor/google.golang.org/grpc/.travis.yml b/vendor/google.golang.org/grpc/.travis.yml index 3c2621ab7..a3c54b6be 100644 --- a/vendor/google.golang.org/grpc/.travis.yml +++ b/vendor/google.golang.org/grpc/.travis.yml @@ -11,14 +11,20 @@ matrix: include: - go: 1.10.x env: RUN386=1 + - go: 1.9.x + env: GAE=1 + - go: 1.10.x + env: GRPC_GO_RETRY=on go_import_path: google.golang.org/grpc before_install: - if [[ -n "$RUN386" ]]; then export GOARCH=386; fi - if [[ "$TRAVIS_GO_VERSION" = 1.10* && "$GOARCH" != "386" ]]; then ./vet.sh -install || exit 1; fi + - if [[ "$GAE" = 1 ]]; then source ./install_gae.sh || exit 1; fi script: - if [[ "$TRAVIS_GO_VERSION" = 1.10* && "$GOARCH" != "386" ]]; then ./vet.sh || exit 1; fi + - if [[ "$GAE" = 1 ]]; then make testappengine || exit 1; exit 0; fi - make test || exit 1 - if [[ "$GOARCH" != "386" ]]; then make testrace; fi diff --git a/vendor/google.golang.org/grpc/Documentation/concurrency.md b/vendor/google.golang.org/grpc/Documentation/concurrency.md new file mode 100644 index 000000000..d0c1142a0 --- /dev/null +++ b/vendor/google.golang.org/grpc/Documentation/concurrency.md @@ -0,0 +1,33 @@ +# Concurrency + +In general, gRPC-go provides a concurrency-friendly API. What follows are some +guidelines. + +## Clients + +A [ClientConn][client-conn] can safely be accessed concurrently. Using +[helloworld][helloworld] as an example, one could share the `ClientConn` across +multiple goroutines to create multiple `GreeterClient` types. In this case, RPCs +would be sent in parallel. + +## Streams + +When using streams, one must take care to avoid calling either `SendMsg` or +`RecvMsg` multiple times against the same [Stream][stream] from different +goroutines. In other words, it's safe to have a goroutine calling `SendMsg` and +another goroutine calling `RecvMsg` on the same stream at the same time. But it +is not safe to call `SendMsg` on the same stream in different goroutines, or to +call `RecvMsg` on the same stream in different goroutines. + +## Servers + +Each RPC handler attached to a registered server will be invoked in its own +goroutine. For example, [SayHello][say-hello] will be invoked in its own +goroutine. The same is true for service handlers for streaming RPCs, as seen +in the route guide example [here][route-guide-stream]. + +[helloworld]: https://github.com/grpc/grpc-go/blob/master/examples/helloworld/greeter_client/main.go#L43 +[client-conn]: https://godoc.org/google.golang.org/grpc#ClientConn +[stream]: https://godoc.org/google.golang.org/grpc#Stream +[say-hello]: https://github.com/grpc/grpc-go/blob/master/examples/helloworld/greeter_server/main.go#L41 +[route-guide-stream]: https://github.com/grpc/grpc-go/blob/master/examples/route_guide/server/server.go#L126 diff --git a/vendor/google.golang.org/grpc/Documentation/log_levels.md b/vendor/google.golang.org/grpc/Documentation/log_levels.md new file mode 100644 index 000000000..6839f6d09 --- /dev/null +++ b/vendor/google.golang.org/grpc/Documentation/log_levels.md @@ -0,0 +1,49 @@ +# Log Levels + +This document describes the different log levels supported by the grpc-go +library, and under what conditions they should be used. + +### Info + +Info messages are for informational purposes and may aid in the debugging of +applications or the gRPC library. + +Examples: +- The name resolver received an update. +- The balancer updated its picker. +- Significant gRPC state is changing. + +At verbosity of 0 (the default), any single info message should not be output +more than once every 5 minutes under normal operation. + +### Warning + +Warning messages indicate problems that are non-fatal for the application, but +could lead to unexpected behavior or subsequent errors. + +Examples: +- Resolver could not resolve target name. +- Error received while connecting to a server. +- Lost or corrupt connection with remote endpoint. + +### Error + +Error messages represent errors in the usage of gRPC that cannot be returned to +the application as errors, or internal gRPC-Go errors that are recoverable. + +Internal errors are detected during gRPC tests and will result in test failures. + +Examples: +- Invalid arguments passed to a function that cannot return an error. +- An internal error that cannot be returned or would be inappropriate to return + to the user. + +### Fatal + +Fatal errors are severe internal errors that are unrecoverable. These lead +directly to panics, and are avoided as much as possible. + +Example: +- Internal invariant was violated. +- User attempted an action that cannot return an error gracefully, but would + lead to an invalid state if performed. diff --git a/vendor/google.golang.org/grpc/Documentation/stickiness.md b/vendor/google.golang.org/grpc/Documentation/stickiness.md deleted file mode 100644 index e5db053a6..000000000 --- a/vendor/google.golang.org/grpc/Documentation/stickiness.md +++ /dev/null @@ -1,46 +0,0 @@ -# Stickiness - -With load balancer, each RPC pick a different backend based on the load -balancing policy. Stickiness policies try to preserve peers for the duration of -a session, so that RPCs with the same stickiness key will be directed to the -same server. - -Note that there's only "soft" stickiness now, which means RPCs with the same -stickienss key could still be sent to different servers. If stickiness is -critical for the system, server side application level handling is still -necessary. - -## Stickiness Key - -A stickiness key works as the session id. RPCs with the same stickiness key will -be assigned to the same backend. - -Stickiness key is set as part of the custom metadata. - -## Enable stickiness - -Stickiness can be enabled by setting `stickinessKey` field in [service -config](https://github.com/grpc/grpc/blob/master/doc/service_config.md). - -```json -{ - "stickinessKey": "sessionid" -} -``` - -The value `sesseionid` will be used as the key of the metadata entry that -defines the stickiness key for each RPC. - -## Send RPC with stickiness - -To set the stickiness key for an RPC, set the corresponding metadata. The -following RPC will be sent with stickiness key `session1`. - -```go -// "sessionid" is the metadata key specified by service config, "session1" is -// the stickiness key for this RPC. -md := metadata.Paris("sessionid", "session1") - -ctx := metadata.NewOutgoingContext(context.Background(), md) -resp, err := client.SomeRPC(ctx, req) -``` diff --git a/vendor/google.golang.org/grpc/Makefile b/vendor/google.golang.org/grpc/Makefile index 6f393a808..50454530f 100644 --- a/vendor/google.golang.org/grpc/Makefile +++ b/vendor/google.golang.org/grpc/Makefile @@ -9,6 +9,9 @@ updatedeps: testdeps: go get -d -v -t google.golang.org/grpc/... +testgaedeps: + goapp get -d -v -t -tags 'appengine appenginevm' google.golang.org/grpc/... + updatetestdeps: go get -d -v -t -u -f google.golang.org/grpc/... @@ -31,6 +34,9 @@ test: testdeps testrace: testdeps go test -race -cpu 1,4 -timeout 7m google.golang.org/grpc/... +testappengine: testgaedeps + goapp test -cpu 1,4 -timeout 5m google.golang.org/grpc/... + clean: go clean -i google.golang.org/grpc/... @@ -39,6 +45,7 @@ clean: deps \ updatedeps \ testdeps \ + testgaedeps \ updatetestdeps \ build \ proto \ diff --git a/vendor/google.golang.org/grpc/backoff.go b/vendor/google.golang.org/grpc/backoff.go index c40facce5..fa31565fd 100644 --- a/vendor/google.golang.org/grpc/backoff.go +++ b/vendor/google.golang.org/grpc/backoff.go @@ -16,81 +16,23 @@ * */ +// See internal/backoff package for the backoff implementation. This file is +// kept for the exported types and API backward compatility. + package grpc import ( - "math/rand" "time" ) // DefaultBackoffConfig uses values specified for backoff in // https://github.com/grpc/grpc/blob/master/doc/connection-backoff.md. var DefaultBackoffConfig = BackoffConfig{ - MaxDelay: 120 * time.Second, - baseDelay: 1.0 * time.Second, - factor: 1.6, - jitter: 0.2, -} - -// backoffStrategy defines the methodology for backing off after a grpc -// connection failure. -// -// This is unexported until the gRPC project decides whether or not to allow -// alternative backoff strategies. Once a decision is made, this type and its -// method may be exported. -type backoffStrategy interface { - // backoff returns the amount of time to wait before the next retry given - // the number of consecutive failures. - backoff(retries int) time.Duration + MaxDelay: 120 * time.Second, } // BackoffConfig defines the parameters for the default gRPC backoff strategy. type BackoffConfig struct { // MaxDelay is the upper bound of backoff delay. MaxDelay time.Duration - - // TODO(stevvooe): The following fields are not exported, as allowing - // changes would violate the current gRPC specification for backoff. If - // gRPC decides to allow more interesting backoff strategies, these fields - // may be opened up in the future. - - // baseDelay is the amount of time to wait before retrying after the first - // failure. - baseDelay time.Duration - - // factor is applied to the backoff after each retry. - factor float64 - - // jitter provides a range to randomize backoff delays. - jitter float64 -} - -func setDefaults(bc *BackoffConfig) { - md := bc.MaxDelay - *bc = DefaultBackoffConfig - - if md > 0 { - bc.MaxDelay = md - } -} - -func (bc BackoffConfig) backoff(retries int) time.Duration { - if retries == 0 { - return bc.baseDelay - } - backoff, max := float64(bc.baseDelay), float64(bc.MaxDelay) - for backoff < max && retries > 0 { - backoff *= bc.factor - retries-- - } - if backoff > max { - backoff = max - } - // Randomize backoff delays so that if a cluster of requests start at - // the same time, they won't operate in lockstep. - backoff *= 1 + bc.jitter*(rand.Float64()*2-1) - if backoff < 0 { - return 0 - } - return time.Duration(backoff) } diff --git a/vendor/google.golang.org/grpc/balancer/balancer.go b/vendor/google.golang.org/grpc/balancer/balancer.go index 63b8d7137..f9d83c2f3 100644 --- a/vendor/google.golang.org/grpc/balancer/balancer.go +++ b/vendor/google.golang.org/grpc/balancer/balancer.go @@ -226,3 +226,45 @@ type Balancer interface { // ClientConn.RemoveSubConn for its existing SubConns. Close() } + +// ConnectivityStateEvaluator takes the connectivity states of multiple SubConns +// and returns one aggregated connectivity state. +// +// It's not thread safe. +type ConnectivityStateEvaluator struct { + numReady uint64 // Number of addrConns in ready state. + numConnecting uint64 // Number of addrConns in connecting state. + numTransientFailure uint64 // Number of addrConns in transientFailure. +} + +// RecordTransition records state change happening in subConn and based on that +// it evaluates what aggregated state should be. +// +// - If at least one SubConn in Ready, the aggregated state is Ready; +// - Else if at least one SubConn in Connecting, the aggregated state is Connecting; +// - Else the aggregated state is TransientFailure. +// +// Idle and Shutdown are not considered. +func (cse *ConnectivityStateEvaluator) RecordTransition(oldState, newState connectivity.State) connectivity.State { + // Update counters. + for idx, state := range []connectivity.State{oldState, newState} { + updateVal := 2*uint64(idx) - 1 // -1 for oldState and +1 for new. + switch state { + case connectivity.Ready: + cse.numReady += updateVal + case connectivity.Connecting: + cse.numConnecting += updateVal + case connectivity.TransientFailure: + cse.numTransientFailure += updateVal + } + } + + // Evaluate. + if cse.numReady > 0 { + return connectivity.Ready + } + if cse.numConnecting > 0 { + return connectivity.Connecting + } + return connectivity.TransientFailure +} diff --git a/vendor/google.golang.org/grpc/balancer/grpclb/grpc_lb_v1/load_balancer.pb.go b/vendor/google.golang.org/grpc/balancer/grpclb/grpc_lb_v1/load_balancer.pb.go new file mode 100644 index 000000000..f64716df2 --- /dev/null +++ b/vendor/google.golang.org/grpc/balancer/grpclb/grpc_lb_v1/load_balancer.pb.go @@ -0,0 +1,836 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: grpc/lb/v1/load_balancer.proto + +package grpc_lb_v1 // import "google.golang.org/grpc/balancer/grpclb/grpc_lb_v1" + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" +import duration "github.com/golang/protobuf/ptypes/duration" +import timestamp "github.com/golang/protobuf/ptypes/timestamp" + +import ( + context "golang.org/x/net/context" + grpc "google.golang.org/grpc" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type LoadBalanceRequest struct { + // Types that are valid to be assigned to LoadBalanceRequestType: + // *LoadBalanceRequest_InitialRequest + // *LoadBalanceRequest_ClientStats + LoadBalanceRequestType isLoadBalanceRequest_LoadBalanceRequestType `protobuf_oneof:"load_balance_request_type"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *LoadBalanceRequest) Reset() { *m = LoadBalanceRequest{} } +func (m *LoadBalanceRequest) String() string { return proto.CompactTextString(m) } +func (*LoadBalanceRequest) ProtoMessage() {} +func (*LoadBalanceRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_load_balancer_eea3e5156960c20a, []int{0} +} +func (m *LoadBalanceRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_LoadBalanceRequest.Unmarshal(m, b) +} +func (m *LoadBalanceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_LoadBalanceRequest.Marshal(b, m, deterministic) +} +func (dst *LoadBalanceRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_LoadBalanceRequest.Merge(dst, src) +} +func (m *LoadBalanceRequest) XXX_Size() int { + return xxx_messageInfo_LoadBalanceRequest.Size(m) +} +func (m *LoadBalanceRequest) XXX_DiscardUnknown() { + xxx_messageInfo_LoadBalanceRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_LoadBalanceRequest proto.InternalMessageInfo + +type isLoadBalanceRequest_LoadBalanceRequestType interface { + isLoadBalanceRequest_LoadBalanceRequestType() +} + +type LoadBalanceRequest_InitialRequest struct { + InitialRequest *InitialLoadBalanceRequest `protobuf:"bytes,1,opt,name=initial_request,json=initialRequest,proto3,oneof"` +} +type LoadBalanceRequest_ClientStats struct { + ClientStats *ClientStats `protobuf:"bytes,2,opt,name=client_stats,json=clientStats,proto3,oneof"` +} + +func (*LoadBalanceRequest_InitialRequest) isLoadBalanceRequest_LoadBalanceRequestType() {} +func (*LoadBalanceRequest_ClientStats) isLoadBalanceRequest_LoadBalanceRequestType() {} + +func (m *LoadBalanceRequest) GetLoadBalanceRequestType() isLoadBalanceRequest_LoadBalanceRequestType { + if m != nil { + return m.LoadBalanceRequestType + } + return nil +} + +func (m *LoadBalanceRequest) GetInitialRequest() *InitialLoadBalanceRequest { + if x, ok := m.GetLoadBalanceRequestType().(*LoadBalanceRequest_InitialRequest); ok { + return x.InitialRequest + } + return nil +} + +func (m *LoadBalanceRequest) GetClientStats() *ClientStats { + if x, ok := m.GetLoadBalanceRequestType().(*LoadBalanceRequest_ClientStats); ok { + return x.ClientStats + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*LoadBalanceRequest) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _LoadBalanceRequest_OneofMarshaler, _LoadBalanceRequest_OneofUnmarshaler, _LoadBalanceRequest_OneofSizer, []interface{}{ + (*LoadBalanceRequest_InitialRequest)(nil), + (*LoadBalanceRequest_ClientStats)(nil), + } +} + +func _LoadBalanceRequest_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*LoadBalanceRequest) + // load_balance_request_type + switch x := m.LoadBalanceRequestType.(type) { + case *LoadBalanceRequest_InitialRequest: + b.EncodeVarint(1<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.InitialRequest); err != nil { + return err + } + case *LoadBalanceRequest_ClientStats: + b.EncodeVarint(2<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.ClientStats); err != nil { + return err + } + case nil: + default: + return fmt.Errorf("LoadBalanceRequest.LoadBalanceRequestType has unexpected type %T", x) + } + return nil +} + +func _LoadBalanceRequest_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*LoadBalanceRequest) + switch tag { + case 1: // load_balance_request_type.initial_request + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(InitialLoadBalanceRequest) + err := b.DecodeMessage(msg) + m.LoadBalanceRequestType = &LoadBalanceRequest_InitialRequest{msg} + return true, err + case 2: // load_balance_request_type.client_stats + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(ClientStats) + err := b.DecodeMessage(msg) + m.LoadBalanceRequestType = &LoadBalanceRequest_ClientStats{msg} + return true, err + default: + return false, nil + } +} + +func _LoadBalanceRequest_OneofSizer(msg proto.Message) (n int) { + m := msg.(*LoadBalanceRequest) + // load_balance_request_type + switch x := m.LoadBalanceRequestType.(type) { + case *LoadBalanceRequest_InitialRequest: + s := proto.Size(x.InitialRequest) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *LoadBalanceRequest_ClientStats: + s := proto.Size(x.ClientStats) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +type InitialLoadBalanceRequest struct { + // The name of the load balanced service (e.g., service.googleapis.com). Its + // length should be less than 256 bytes. + // The name might include a port number. How to handle the port number is up + // to the balancer. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *InitialLoadBalanceRequest) Reset() { *m = InitialLoadBalanceRequest{} } +func (m *InitialLoadBalanceRequest) String() string { return proto.CompactTextString(m) } +func (*InitialLoadBalanceRequest) ProtoMessage() {} +func (*InitialLoadBalanceRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_load_balancer_eea3e5156960c20a, []int{1} +} +func (m *InitialLoadBalanceRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_InitialLoadBalanceRequest.Unmarshal(m, b) +} +func (m *InitialLoadBalanceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_InitialLoadBalanceRequest.Marshal(b, m, deterministic) +} +func (dst *InitialLoadBalanceRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_InitialLoadBalanceRequest.Merge(dst, src) +} +func (m *InitialLoadBalanceRequest) XXX_Size() int { + return xxx_messageInfo_InitialLoadBalanceRequest.Size(m) +} +func (m *InitialLoadBalanceRequest) XXX_DiscardUnknown() { + xxx_messageInfo_InitialLoadBalanceRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_InitialLoadBalanceRequest proto.InternalMessageInfo + +func (m *InitialLoadBalanceRequest) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +// Contains the number of calls finished for a particular load balance token. +type ClientStatsPerToken struct { + // See Server.load_balance_token. + LoadBalanceToken string `protobuf:"bytes,1,opt,name=load_balance_token,json=loadBalanceToken,proto3" json:"load_balance_token,omitempty"` + // The total number of RPCs that finished associated with the token. + NumCalls int64 `protobuf:"varint,2,opt,name=num_calls,json=numCalls,proto3" json:"num_calls,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ClientStatsPerToken) Reset() { *m = ClientStatsPerToken{} } +func (m *ClientStatsPerToken) String() string { return proto.CompactTextString(m) } +func (*ClientStatsPerToken) ProtoMessage() {} +func (*ClientStatsPerToken) Descriptor() ([]byte, []int) { + return fileDescriptor_load_balancer_eea3e5156960c20a, []int{2} +} +func (m *ClientStatsPerToken) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ClientStatsPerToken.Unmarshal(m, b) +} +func (m *ClientStatsPerToken) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ClientStatsPerToken.Marshal(b, m, deterministic) +} +func (dst *ClientStatsPerToken) XXX_Merge(src proto.Message) { + xxx_messageInfo_ClientStatsPerToken.Merge(dst, src) +} +func (m *ClientStatsPerToken) XXX_Size() int { + return xxx_messageInfo_ClientStatsPerToken.Size(m) +} +func (m *ClientStatsPerToken) XXX_DiscardUnknown() { + xxx_messageInfo_ClientStatsPerToken.DiscardUnknown(m) +} + +var xxx_messageInfo_ClientStatsPerToken proto.InternalMessageInfo + +func (m *ClientStatsPerToken) GetLoadBalanceToken() string { + if m != nil { + return m.LoadBalanceToken + } + return "" +} + +func (m *ClientStatsPerToken) GetNumCalls() int64 { + if m != nil { + return m.NumCalls + } + return 0 +} + +// Contains client level statistics that are useful to load balancing. Each +// count except the timestamp should be reset to zero after reporting the stats. +type ClientStats struct { + // The timestamp of generating the report. + Timestamp *timestamp.Timestamp `protobuf:"bytes,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + // The total number of RPCs that started. + NumCallsStarted int64 `protobuf:"varint,2,opt,name=num_calls_started,json=numCallsStarted,proto3" json:"num_calls_started,omitempty"` + // The total number of RPCs that finished. + NumCallsFinished int64 `protobuf:"varint,3,opt,name=num_calls_finished,json=numCallsFinished,proto3" json:"num_calls_finished,omitempty"` + // The total number of RPCs that failed to reach a server except dropped RPCs. + NumCallsFinishedWithClientFailedToSend int64 `protobuf:"varint,6,opt,name=num_calls_finished_with_client_failed_to_send,json=numCallsFinishedWithClientFailedToSend,proto3" json:"num_calls_finished_with_client_failed_to_send,omitempty"` + // The total number of RPCs that finished and are known to have been received + // by a server. + NumCallsFinishedKnownReceived int64 `protobuf:"varint,7,opt,name=num_calls_finished_known_received,json=numCallsFinishedKnownReceived,proto3" json:"num_calls_finished_known_received,omitempty"` + // The list of dropped calls. + CallsFinishedWithDrop []*ClientStatsPerToken `protobuf:"bytes,8,rep,name=calls_finished_with_drop,json=callsFinishedWithDrop,proto3" json:"calls_finished_with_drop,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ClientStats) Reset() { *m = ClientStats{} } +func (m *ClientStats) String() string { return proto.CompactTextString(m) } +func (*ClientStats) ProtoMessage() {} +func (*ClientStats) Descriptor() ([]byte, []int) { + return fileDescriptor_load_balancer_eea3e5156960c20a, []int{3} +} +func (m *ClientStats) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ClientStats.Unmarshal(m, b) +} +func (m *ClientStats) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ClientStats.Marshal(b, m, deterministic) +} +func (dst *ClientStats) XXX_Merge(src proto.Message) { + xxx_messageInfo_ClientStats.Merge(dst, src) +} +func (m *ClientStats) XXX_Size() int { + return xxx_messageInfo_ClientStats.Size(m) +} +func (m *ClientStats) XXX_DiscardUnknown() { + xxx_messageInfo_ClientStats.DiscardUnknown(m) +} + +var xxx_messageInfo_ClientStats proto.InternalMessageInfo + +func (m *ClientStats) GetTimestamp() *timestamp.Timestamp { + if m != nil { + return m.Timestamp + } + return nil +} + +func (m *ClientStats) GetNumCallsStarted() int64 { + if m != nil { + return m.NumCallsStarted + } + return 0 +} + +func (m *ClientStats) GetNumCallsFinished() int64 { + if m != nil { + return m.NumCallsFinished + } + return 0 +} + +func (m *ClientStats) GetNumCallsFinishedWithClientFailedToSend() int64 { + if m != nil { + return m.NumCallsFinishedWithClientFailedToSend + } + return 0 +} + +func (m *ClientStats) GetNumCallsFinishedKnownReceived() int64 { + if m != nil { + return m.NumCallsFinishedKnownReceived + } + return 0 +} + +func (m *ClientStats) GetCallsFinishedWithDrop() []*ClientStatsPerToken { + if m != nil { + return m.CallsFinishedWithDrop + } + return nil +} + +type LoadBalanceResponse struct { + // Types that are valid to be assigned to LoadBalanceResponseType: + // *LoadBalanceResponse_InitialResponse + // *LoadBalanceResponse_ServerList + LoadBalanceResponseType isLoadBalanceResponse_LoadBalanceResponseType `protobuf_oneof:"load_balance_response_type"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *LoadBalanceResponse) Reset() { *m = LoadBalanceResponse{} } +func (m *LoadBalanceResponse) String() string { return proto.CompactTextString(m) } +func (*LoadBalanceResponse) ProtoMessage() {} +func (*LoadBalanceResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_load_balancer_eea3e5156960c20a, []int{4} +} +func (m *LoadBalanceResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_LoadBalanceResponse.Unmarshal(m, b) +} +func (m *LoadBalanceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_LoadBalanceResponse.Marshal(b, m, deterministic) +} +func (dst *LoadBalanceResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_LoadBalanceResponse.Merge(dst, src) +} +func (m *LoadBalanceResponse) XXX_Size() int { + return xxx_messageInfo_LoadBalanceResponse.Size(m) +} +func (m *LoadBalanceResponse) XXX_DiscardUnknown() { + xxx_messageInfo_LoadBalanceResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_LoadBalanceResponse proto.InternalMessageInfo + +type isLoadBalanceResponse_LoadBalanceResponseType interface { + isLoadBalanceResponse_LoadBalanceResponseType() +} + +type LoadBalanceResponse_InitialResponse struct { + InitialResponse *InitialLoadBalanceResponse `protobuf:"bytes,1,opt,name=initial_response,json=initialResponse,proto3,oneof"` +} +type LoadBalanceResponse_ServerList struct { + ServerList *ServerList `protobuf:"bytes,2,opt,name=server_list,json=serverList,proto3,oneof"` +} + +func (*LoadBalanceResponse_InitialResponse) isLoadBalanceResponse_LoadBalanceResponseType() {} +func (*LoadBalanceResponse_ServerList) isLoadBalanceResponse_LoadBalanceResponseType() {} + +func (m *LoadBalanceResponse) GetLoadBalanceResponseType() isLoadBalanceResponse_LoadBalanceResponseType { + if m != nil { + return m.LoadBalanceResponseType + } + return nil +} + +func (m *LoadBalanceResponse) GetInitialResponse() *InitialLoadBalanceResponse { + if x, ok := m.GetLoadBalanceResponseType().(*LoadBalanceResponse_InitialResponse); ok { + return x.InitialResponse + } + return nil +} + +func (m *LoadBalanceResponse) GetServerList() *ServerList { + if x, ok := m.GetLoadBalanceResponseType().(*LoadBalanceResponse_ServerList); ok { + return x.ServerList + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*LoadBalanceResponse) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _LoadBalanceResponse_OneofMarshaler, _LoadBalanceResponse_OneofUnmarshaler, _LoadBalanceResponse_OneofSizer, []interface{}{ + (*LoadBalanceResponse_InitialResponse)(nil), + (*LoadBalanceResponse_ServerList)(nil), + } +} + +func _LoadBalanceResponse_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*LoadBalanceResponse) + // load_balance_response_type + switch x := m.LoadBalanceResponseType.(type) { + case *LoadBalanceResponse_InitialResponse: + b.EncodeVarint(1<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.InitialResponse); err != nil { + return err + } + case *LoadBalanceResponse_ServerList: + b.EncodeVarint(2<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.ServerList); err != nil { + return err + } + case nil: + default: + return fmt.Errorf("LoadBalanceResponse.LoadBalanceResponseType has unexpected type %T", x) + } + return nil +} + +func _LoadBalanceResponse_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*LoadBalanceResponse) + switch tag { + case 1: // load_balance_response_type.initial_response + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(InitialLoadBalanceResponse) + err := b.DecodeMessage(msg) + m.LoadBalanceResponseType = &LoadBalanceResponse_InitialResponse{msg} + return true, err + case 2: // load_balance_response_type.server_list + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(ServerList) + err := b.DecodeMessage(msg) + m.LoadBalanceResponseType = &LoadBalanceResponse_ServerList{msg} + return true, err + default: + return false, nil + } +} + +func _LoadBalanceResponse_OneofSizer(msg proto.Message) (n int) { + m := msg.(*LoadBalanceResponse) + // load_balance_response_type + switch x := m.LoadBalanceResponseType.(type) { + case *LoadBalanceResponse_InitialResponse: + s := proto.Size(x.InitialResponse) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *LoadBalanceResponse_ServerList: + s := proto.Size(x.ServerList) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +type InitialLoadBalanceResponse struct { + // This is an application layer redirect that indicates the client should use + // the specified server for load balancing. When this field is non-empty in + // the response, the client should open a separate connection to the + // load_balancer_delegate and call the BalanceLoad method. Its length should + // be less than 64 bytes. + LoadBalancerDelegate string `protobuf:"bytes,1,opt,name=load_balancer_delegate,json=loadBalancerDelegate,proto3" json:"load_balancer_delegate,omitempty"` + // This interval defines how often the client should send the client stats + // to the load balancer. Stats should only be reported when the duration is + // positive. + ClientStatsReportInterval *duration.Duration `protobuf:"bytes,2,opt,name=client_stats_report_interval,json=clientStatsReportInterval,proto3" json:"client_stats_report_interval,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *InitialLoadBalanceResponse) Reset() { *m = InitialLoadBalanceResponse{} } +func (m *InitialLoadBalanceResponse) String() string { return proto.CompactTextString(m) } +func (*InitialLoadBalanceResponse) ProtoMessage() {} +func (*InitialLoadBalanceResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_load_balancer_eea3e5156960c20a, []int{5} +} +func (m *InitialLoadBalanceResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_InitialLoadBalanceResponse.Unmarshal(m, b) +} +func (m *InitialLoadBalanceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_InitialLoadBalanceResponse.Marshal(b, m, deterministic) +} +func (dst *InitialLoadBalanceResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_InitialLoadBalanceResponse.Merge(dst, src) +} +func (m *InitialLoadBalanceResponse) XXX_Size() int { + return xxx_messageInfo_InitialLoadBalanceResponse.Size(m) +} +func (m *InitialLoadBalanceResponse) XXX_DiscardUnknown() { + xxx_messageInfo_InitialLoadBalanceResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_InitialLoadBalanceResponse proto.InternalMessageInfo + +func (m *InitialLoadBalanceResponse) GetLoadBalancerDelegate() string { + if m != nil { + return m.LoadBalancerDelegate + } + return "" +} + +func (m *InitialLoadBalanceResponse) GetClientStatsReportInterval() *duration.Duration { + if m != nil { + return m.ClientStatsReportInterval + } + return nil +} + +type ServerList struct { + // Contains a list of servers selected by the load balancer. The list will + // be updated when server resolutions change or as needed to balance load + // across more servers. The client should consume the server list in order + // unless instructed otherwise via the client_config. + Servers []*Server `protobuf:"bytes,1,rep,name=servers,proto3" json:"servers,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ServerList) Reset() { *m = ServerList{} } +func (m *ServerList) String() string { return proto.CompactTextString(m) } +func (*ServerList) ProtoMessage() {} +func (*ServerList) Descriptor() ([]byte, []int) { + return fileDescriptor_load_balancer_eea3e5156960c20a, []int{6} +} +func (m *ServerList) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ServerList.Unmarshal(m, b) +} +func (m *ServerList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ServerList.Marshal(b, m, deterministic) +} +func (dst *ServerList) XXX_Merge(src proto.Message) { + xxx_messageInfo_ServerList.Merge(dst, src) +} +func (m *ServerList) XXX_Size() int { + return xxx_messageInfo_ServerList.Size(m) +} +func (m *ServerList) XXX_DiscardUnknown() { + xxx_messageInfo_ServerList.DiscardUnknown(m) +} + +var xxx_messageInfo_ServerList proto.InternalMessageInfo + +func (m *ServerList) GetServers() []*Server { + if m != nil { + return m.Servers + } + return nil +} + +// Contains server information. When the drop field is not true, use the other +// fields. +type Server struct { + // A resolved address for the server, serialized in network-byte-order. It may + // either be an IPv4 or IPv6 address. + IpAddress []byte `protobuf:"bytes,1,opt,name=ip_address,json=ipAddress,proto3" json:"ip_address,omitempty"` + // A resolved port number for the server. + Port int32 `protobuf:"varint,2,opt,name=port,proto3" json:"port,omitempty"` + // An opaque but printable token for load reporting. The client must include + // the token of the picked server into the initial metadata when it starts a + // call to that server. The token is used by the server to verify the request + // and to allow the server to report load to the gRPC LB system. The token is + // also used in client stats for reporting dropped calls. + // + // Its length can be variable but must be less than 50 bytes. + LoadBalanceToken string `protobuf:"bytes,3,opt,name=load_balance_token,json=loadBalanceToken,proto3" json:"load_balance_token,omitempty"` + // Indicates whether this particular request should be dropped by the client. + // If the request is dropped, there will be a corresponding entry in + // ClientStats.calls_finished_with_drop. + Drop bool `protobuf:"varint,4,opt,name=drop,proto3" json:"drop,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Server) Reset() { *m = Server{} } +func (m *Server) String() string { return proto.CompactTextString(m) } +func (*Server) ProtoMessage() {} +func (*Server) Descriptor() ([]byte, []int) { + return fileDescriptor_load_balancer_eea3e5156960c20a, []int{7} +} +func (m *Server) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Server.Unmarshal(m, b) +} +func (m *Server) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Server.Marshal(b, m, deterministic) +} +func (dst *Server) XXX_Merge(src proto.Message) { + xxx_messageInfo_Server.Merge(dst, src) +} +func (m *Server) XXX_Size() int { + return xxx_messageInfo_Server.Size(m) +} +func (m *Server) XXX_DiscardUnknown() { + xxx_messageInfo_Server.DiscardUnknown(m) +} + +var xxx_messageInfo_Server proto.InternalMessageInfo + +func (m *Server) GetIpAddress() []byte { + if m != nil { + return m.IpAddress + } + return nil +} + +func (m *Server) GetPort() int32 { + if m != nil { + return m.Port + } + return 0 +} + +func (m *Server) GetLoadBalanceToken() string { + if m != nil { + return m.LoadBalanceToken + } + return "" +} + +func (m *Server) GetDrop() bool { + if m != nil { + return m.Drop + } + return false +} + +func init() { + proto.RegisterType((*LoadBalanceRequest)(nil), "grpc.lb.v1.LoadBalanceRequest") + proto.RegisterType((*InitialLoadBalanceRequest)(nil), "grpc.lb.v1.InitialLoadBalanceRequest") + proto.RegisterType((*ClientStatsPerToken)(nil), "grpc.lb.v1.ClientStatsPerToken") + proto.RegisterType((*ClientStats)(nil), "grpc.lb.v1.ClientStats") + proto.RegisterType((*LoadBalanceResponse)(nil), "grpc.lb.v1.LoadBalanceResponse") + proto.RegisterType((*InitialLoadBalanceResponse)(nil), "grpc.lb.v1.InitialLoadBalanceResponse") + proto.RegisterType((*ServerList)(nil), "grpc.lb.v1.ServerList") + proto.RegisterType((*Server)(nil), "grpc.lb.v1.Server") +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// LoadBalancerClient is the client API for LoadBalancer service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type LoadBalancerClient interface { + // Bidirectional rpc to get a list of servers. + BalanceLoad(ctx context.Context, opts ...grpc.CallOption) (LoadBalancer_BalanceLoadClient, error) +} + +type loadBalancerClient struct { + cc *grpc.ClientConn +} + +func NewLoadBalancerClient(cc *grpc.ClientConn) LoadBalancerClient { + return &loadBalancerClient{cc} +} + +func (c *loadBalancerClient) BalanceLoad(ctx context.Context, opts ...grpc.CallOption) (LoadBalancer_BalanceLoadClient, error) { + stream, err := c.cc.NewStream(ctx, &_LoadBalancer_serviceDesc.Streams[0], "/grpc.lb.v1.LoadBalancer/BalanceLoad", opts...) + if err != nil { + return nil, err + } + x := &loadBalancerBalanceLoadClient{stream} + return x, nil +} + +type LoadBalancer_BalanceLoadClient interface { + Send(*LoadBalanceRequest) error + Recv() (*LoadBalanceResponse, error) + grpc.ClientStream +} + +type loadBalancerBalanceLoadClient struct { + grpc.ClientStream +} + +func (x *loadBalancerBalanceLoadClient) Send(m *LoadBalanceRequest) error { + return x.ClientStream.SendMsg(m) +} + +func (x *loadBalancerBalanceLoadClient) Recv() (*LoadBalanceResponse, error) { + m := new(LoadBalanceResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +// LoadBalancerServer is the server API for LoadBalancer service. +type LoadBalancerServer interface { + // Bidirectional rpc to get a list of servers. + BalanceLoad(LoadBalancer_BalanceLoadServer) error +} + +func RegisterLoadBalancerServer(s *grpc.Server, srv LoadBalancerServer) { + s.RegisterService(&_LoadBalancer_serviceDesc, srv) +} + +func _LoadBalancer_BalanceLoad_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(LoadBalancerServer).BalanceLoad(&loadBalancerBalanceLoadServer{stream}) +} + +type LoadBalancer_BalanceLoadServer interface { + Send(*LoadBalanceResponse) error + Recv() (*LoadBalanceRequest, error) + grpc.ServerStream +} + +type loadBalancerBalanceLoadServer struct { + grpc.ServerStream +} + +func (x *loadBalancerBalanceLoadServer) Send(m *LoadBalanceResponse) error { + return x.ServerStream.SendMsg(m) +} + +func (x *loadBalancerBalanceLoadServer) Recv() (*LoadBalanceRequest, error) { + m := new(LoadBalanceRequest) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +var _LoadBalancer_serviceDesc = grpc.ServiceDesc{ + ServiceName: "grpc.lb.v1.LoadBalancer", + HandlerType: (*LoadBalancerServer)(nil), + Methods: []grpc.MethodDesc{}, + Streams: []grpc.StreamDesc{ + { + StreamName: "BalanceLoad", + Handler: _LoadBalancer_BalanceLoad_Handler, + ServerStreams: true, + ClientStreams: true, + }, + }, + Metadata: "grpc/lb/v1/load_balancer.proto", +} + +func init() { + proto.RegisterFile("grpc/lb/v1/load_balancer.proto", fileDescriptor_load_balancer_eea3e5156960c20a) +} + +var fileDescriptor_load_balancer_eea3e5156960c20a = []byte{ + // 756 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x55, 0xdd, 0x6e, 0x23, 0x35, + 0x14, 0xee, 0x90, 0x69, 0x36, 0x39, 0xa9, 0xb6, 0x59, 0x2f, 0x2c, 0x93, 0xec, 0x6e, 0x5b, 0x22, + 0xb1, 0x8a, 0xd0, 0x32, 0x43, 0x0a, 0x17, 0x20, 0x71, 0x01, 0xd9, 0x6a, 0x95, 0x2d, 0xbd, 0x88, + 0x9c, 0x4a, 0x54, 0x95, 0x90, 0x99, 0xc9, 0xb8, 0xa9, 0x55, 0xc7, 0x1e, 0x3c, 0x4e, 0x2a, 0xae, + 0x79, 0x1f, 0xc4, 0x2b, 0x20, 0x5e, 0x0c, 0x8d, 0xed, 0x49, 0xa6, 0x49, 0xa3, 0xbd, 0x69, 0x3d, + 0xe7, 0x7c, 0xfe, 0xce, 0xef, 0xe7, 0xc0, 0xd1, 0x4c, 0x65, 0xd3, 0x88, 0x27, 0xd1, 0x72, 0x10, + 0x71, 0x19, 0xa7, 0x24, 0x89, 0x79, 0x2c, 0xa6, 0x54, 0x85, 0x99, 0x92, 0x5a, 0x22, 0x28, 0xfc, + 0x21, 0x4f, 0xc2, 0xe5, 0xa0, 0x7b, 0x34, 0x93, 0x72, 0xc6, 0x69, 0x64, 0x3c, 0xc9, 0xe2, 0x26, + 0x4a, 0x17, 0x2a, 0xd6, 0x4c, 0x0a, 0x8b, 0xed, 0x1e, 0x6f, 0xfa, 0x35, 0x9b, 0xd3, 0x5c, 0xc7, + 0xf3, 0xcc, 0x02, 0x7a, 0xff, 0x7a, 0x80, 0x2e, 0x64, 0x9c, 0x0e, 0x6d, 0x0c, 0x4c, 0xff, 0x58, + 0xd0, 0x5c, 0xa3, 0x31, 0x1c, 0x32, 0xc1, 0x34, 0x8b, 0x39, 0x51, 0xd6, 0x14, 0x78, 0x27, 0x5e, + 0xbf, 0x75, 0xfa, 0x65, 0xb8, 0x8e, 0x1e, 0x7e, 0xb0, 0x90, 0xed, 0xfb, 0xa3, 0x3d, 0xfc, 0xd4, + 0xdd, 0x2f, 0x19, 0x7f, 0x84, 0x83, 0x29, 0x67, 0x54, 0x68, 0x92, 0xeb, 0x58, 0xe7, 0xc1, 0x27, + 0x86, 0xee, 0xf3, 0x2a, 0xdd, 0x3b, 0xe3, 0x9f, 0x14, 0xee, 0xd1, 0x1e, 0x6e, 0x4d, 0xd7, 0x9f, + 0xc3, 0x97, 0xd0, 0xa9, 0xb6, 0xa2, 0x4c, 0x8a, 0xe8, 0x3f, 0x33, 0xda, 0x8b, 0xa0, 0xb3, 0x33, + 0x13, 0x84, 0xc0, 0x17, 0xf1, 0x9c, 0x9a, 0xf4, 0x9b, 0xd8, 0x9c, 0x7b, 0xbf, 0xc3, 0xf3, 0x4a, + 0xac, 0x31, 0x55, 0x97, 0xf2, 0x8e, 0x0a, 0xf4, 0x16, 0xd0, 0x83, 0x20, 0xba, 0xb0, 0xba, 0x8b, + 0x6d, 0xbe, 0xa6, 0xb6, 0xe8, 0x97, 0xd0, 0x14, 0x8b, 0x39, 0x99, 0xc6, 0x9c, 0xdb, 0x6a, 0x6a, + 0xb8, 0x21, 0x16, 0xf3, 0x77, 0xc5, 0x77, 0xef, 0x9f, 0x1a, 0xb4, 0x2a, 0x21, 0xd0, 0xf7, 0xd0, + 0x5c, 0x75, 0xde, 0x75, 0xb2, 0x1b, 0xda, 0xd9, 0x84, 0xe5, 0x6c, 0xc2, 0xcb, 0x12, 0x81, 0xd7, + 0x60, 0xf4, 0x15, 0x3c, 0x5b, 0x85, 0x29, 0x5a, 0xa7, 0x34, 0x4d, 0x5d, 0xb8, 0xc3, 0x32, 0xdc, + 0xc4, 0x9a, 0x8b, 0x02, 0xd6, 0xd8, 0x1b, 0x26, 0x58, 0x7e, 0x4b, 0xd3, 0xa0, 0x66, 0xc0, 0xed, + 0x12, 0xfc, 0xde, 0xd9, 0xd1, 0x6f, 0xf0, 0xf5, 0x36, 0x9a, 0xdc, 0x33, 0x7d, 0x4b, 0xdc, 0xa4, + 0x6e, 0x62, 0xc6, 0x69, 0x4a, 0xb4, 0x24, 0x39, 0x15, 0x69, 0x50, 0x37, 0x44, 0x6f, 0x36, 0x89, + 0x7e, 0x65, 0xfa, 0xd6, 0xd6, 0xfa, 0xde, 0xe0, 0x2f, 0xe5, 0x84, 0x8a, 0x14, 0x8d, 0xe0, 0x8b, + 0x47, 0xe8, 0xef, 0x84, 0xbc, 0x17, 0x44, 0xd1, 0x29, 0x65, 0x4b, 0x9a, 0x06, 0x4f, 0x0c, 0xe5, + 0xeb, 0x4d, 0xca, 0x5f, 0x0a, 0x14, 0x76, 0x20, 0x74, 0x05, 0xc1, 0x63, 0x49, 0xa6, 0x4a, 0x66, + 0x41, 0xe3, 0xa4, 0xd6, 0x6f, 0x9d, 0x1e, 0xef, 0x58, 0xa3, 0x72, 0xb4, 0xf8, 0xb3, 0xe9, 0x66, + 0xc6, 0x67, 0x4a, 0x66, 0xe7, 0x7e, 0xc3, 0x6f, 0xef, 0x9f, 0xfb, 0x8d, 0xfd, 0x76, 0xbd, 0xf7, + 0x9f, 0x07, 0xcf, 0x1f, 0xec, 0x4f, 0x9e, 0x49, 0x91, 0x53, 0x34, 0x81, 0xf6, 0x5a, 0x0a, 0xd6, + 0xe6, 0x26, 0xf8, 0xe6, 0x63, 0x5a, 0xb0, 0xe8, 0xd1, 0x1e, 0x3e, 0x5c, 0x89, 0xc1, 0x91, 0xfe, + 0x00, 0xad, 0x9c, 0xaa, 0x25, 0x55, 0x84, 0xb3, 0x5c, 0x3b, 0x31, 0xbc, 0xa8, 0xf2, 0x4d, 0x8c, + 0xfb, 0x82, 0x19, 0x31, 0x41, 0xbe, 0xfa, 0x1a, 0xbe, 0x82, 0xee, 0x86, 0x14, 0x2c, 0xa7, 0xd5, + 0xc2, 0xdf, 0x1e, 0x74, 0x77, 0xa7, 0x82, 0xbe, 0x83, 0x17, 0x0f, 0x9e, 0x14, 0x92, 0x52, 0x4e, + 0x67, 0xb1, 0x2e, 0xf5, 0xf1, 0x69, 0x65, 0xcd, 0xd5, 0x99, 0xf3, 0xa1, 0x6b, 0x78, 0x55, 0xd5, + 0x2e, 0x51, 0x34, 0x93, 0x4a, 0x13, 0x26, 0x34, 0x55, 0xcb, 0x98, 0xbb, 0xf4, 0x3b, 0x5b, 0x0b, + 0x7d, 0xe6, 0x1e, 0x23, 0xdc, 0xa9, 0x68, 0x19, 0x9b, 0xcb, 0x1f, 0xdc, 0xdd, 0xde, 0x4f, 0x00, + 0xeb, 0x52, 0xd1, 0x5b, 0x78, 0x62, 0x4b, 0xcd, 0x03, 0xcf, 0x4c, 0x16, 0x6d, 0xf7, 0x04, 0x97, + 0x90, 0x73, 0xbf, 0x51, 0x6b, 0xfb, 0xbd, 0xbf, 0x3c, 0xa8, 0x5b, 0x0f, 0x7a, 0x0d, 0xc0, 0x32, + 0x12, 0xa7, 0xa9, 0xa2, 0x79, 0x6e, 0x4a, 0x3a, 0xc0, 0x4d, 0x96, 0xfd, 0x6c, 0x0d, 0xc5, 0x5b, + 0x50, 0xc4, 0x36, 0xf9, 0xee, 0x63, 0x73, 0xde, 0x21, 0xfa, 0xda, 0x0e, 0xd1, 0x23, 0xf0, 0xcd, + 0xda, 0xf9, 0x27, 0x5e, 0xbf, 0x81, 0xcd, 0xd9, 0xae, 0xcf, 0x69, 0x02, 0x07, 0x95, 0x86, 0x2b, + 0x84, 0xa1, 0xe5, 0xce, 0x85, 0x19, 0x1d, 0x55, 0xeb, 0xd8, 0x7e, 0xa6, 0xba, 0xc7, 0x3b, 0xfd, + 0x76, 0x72, 0x7d, 0xef, 0x1b, 0x6f, 0x78, 0x05, 0x4f, 0x99, 0xb4, 0xc0, 0xe2, 0x0f, 0x4f, 0x86, + 0xcf, 0xaa, 0x31, 0xc7, 0x45, 0xdf, 0xc7, 0xde, 0xf5, 0xc0, 0xcd, 0x61, 0x26, 0x79, 0x2c, 0x66, + 0xa1, 0x54, 0xb3, 0xc8, 0xfc, 0xa4, 0x94, 0x43, 0x8f, 0xec, 0x65, 0xf3, 0x8f, 0xf0, 0x84, 0x2c, + 0x07, 0x49, 0xdd, 0xcc, 0xec, 0xdb, 0xff, 0x03, 0x00, 0x00, 0xff, 0xff, 0x5f, 0xc0, 0x96, 0xfd, + 0x7c, 0x06, 0x00, 0x00, +} diff --git a/vendor/google.golang.org/grpc/grpclb.go b/vendor/google.golang.org/grpc/balancer/grpclb/grpclb.go similarity index 85% rename from vendor/google.golang.org/grpc/grpclb.go rename to vendor/google.golang.org/grpc/balancer/grpclb/grpclb.go index 9761dfbb4..0162ac7a0 100644 --- a/vendor/google.golang.org/grpc/grpclb.go +++ b/vendor/google.golang.org/grpc/balancer/grpclb/grpclb.go @@ -16,19 +16,29 @@ * */ -package grpc +//go:generate ./regenerate.sh + +// Package grpclb defines a grpclb balancer. +// +// To install grpclb balancer, import this package as: +// import _ "google.golang.org/grpc/balancer/grpclb" +package grpclb import ( + "errors" "strconv" "strings" "sync" "time" + durationpb "github.com/golang/protobuf/ptypes/duration" "golang.org/x/net/context" + "google.golang.org/grpc" "google.golang.org/grpc/balancer" + lbpb "google.golang.org/grpc/balancer/grpclb/grpc_lb_v1" "google.golang.org/grpc/connectivity" - lbpb "google.golang.org/grpc/grpclb/grpc_lb_v1/messages" "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/internal/backoff" "google.golang.org/grpc/resolver" ) @@ -38,7 +48,21 @@ const ( grpclbName = "grpclb" ) -func convertDuration(d *lbpb.Duration) time.Duration { +var ( + // defaultBackoffConfig configures the backoff strategy that's used when the + // init handshake in the RPC is unsuccessful. It's not for the clientconn + // reconnect backoff. + // + // It has the same value as the default grpc.DefaultBackoffConfig. + // + // TODO: make backoff configurable. + defaultBackoffConfig = backoff.Exponential{ + MaxDelay: 120 * time.Second, + } + errServerTerminatedConnection = errors.New("grpclb: failed to recv server list: server terminated connection") +) + +func convertDuration(d *durationpb.Duration) time.Duration { if d == nil { return 0 } @@ -49,16 +73,16 @@ func convertDuration(d *lbpb.Duration) time.Duration { // Mostly copied from generated pb.go file. // To avoid circular dependency. type loadBalancerClient struct { - cc *ClientConn + cc *grpc.ClientConn } -func (c *loadBalancerClient) BalanceLoad(ctx context.Context, opts ...CallOption) (*balanceLoadClientStream, error) { - desc := &StreamDesc{ +func (c *loadBalancerClient) BalanceLoad(ctx context.Context, opts ...grpc.CallOption) (*balanceLoadClientStream, error) { + desc := &grpc.StreamDesc{ StreamName: "BalanceLoad", ServerStreams: true, ClientStreams: true, } - stream, err := NewClientStream(ctx, desc, c.cc, "/grpc.lb.v1.LoadBalancer/BalanceLoad", opts...) + stream, err := c.cc.NewStream(ctx, desc, "/grpc.lb.v1.LoadBalancer/BalanceLoad", opts...) if err != nil { return nil, err } @@ -67,7 +91,7 @@ func (c *loadBalancerClient) BalanceLoad(ctx context.Context, opts ...CallOption } type balanceLoadClientStream struct { - ClientStream + grpc.ClientStream } func (x *balanceLoadClientStream) Send(m *lbpb.LoadBalanceRequest) error { @@ -88,16 +112,16 @@ func init() { // newLBBuilder creates a builder for grpclb. func newLBBuilder() balancer.Builder { - return NewLBBuilderWithFallbackTimeout(defaultFallbackTimeout) + return newLBBuilderWithFallbackTimeout(defaultFallbackTimeout) } -// NewLBBuilderWithFallbackTimeout creates a grpclb builder with the given +// newLBBuilderWithFallbackTimeout creates a grpclb builder with the given // fallbackTimeout. If no response is received from the remote balancer within // fallbackTimeout, the backend addresses from the resolved address list will be // used. // // Only call this function when a non-default fallback timeout is needed. -func NewLBBuilderWithFallbackTimeout(fallbackTimeout time.Duration) balancer.Builder { +func newLBBuilderWithFallbackTimeout(fallbackTimeout time.Duration) balancer.Builder { return &lbBuilder{ fallbackTimeout: fallbackTimeout, } @@ -134,11 +158,12 @@ func (b *lbBuilder) Build(cc balancer.ClientConn, opt balancer.BuildOptions) bal doneCh: make(chan struct{}), manualResolver: r, - csEvltr: &connectivityStateEvaluator{}, + csEvltr: &balancer.ConnectivityStateEvaluator{}, subConns: make(map[resolver.Address]balancer.SubConn), scStates: make(map[balancer.SubConn]connectivity.State), picker: &errPicker{err: balancer.ErrNoSubConnAvailable}, - clientStats: &rpcStats{}, + clientStats: newRPCStats(), + backoff: defaultBackoffConfig, // TODO: make backoff configurable. } return lb @@ -156,7 +181,9 @@ type lbBalancer struct { // send to remote LB ClientConn through this resolver. manualResolver *lbManualResolver // The ClientConn to talk to the remote balancer. - ccRemoteLB *ClientConn + ccRemoteLB *grpc.ClientConn + // backoff for calling remote balancer. + backoff backoff.Strategy // Support client side load reporting. Each picker gets a reference to this, // and will update its content. @@ -173,7 +200,7 @@ type lbBalancer struct { // but with only READY SCs will be gerenated. backendAddrs []resolver.Address // Roundrobin functionalities. - csEvltr *connectivityStateEvaluator + csEvltr *balancer.ConnectivityStateEvaluator state connectivity.State subConns map[resolver.Address]balancer.SubConn // Used to new/remove SubConn. scStates map[balancer.SubConn]connectivity.State // Used to filter READY SubConns. @@ -243,7 +270,7 @@ func (lb *lbBalancer) HandleSubConnStateChange(sc balancer.SubConn, s connectivi } oldAggrState := lb.state - lb.state = lb.csEvltr.recordTransition(oldS, s) + lb.state = lb.csEvltr.RecordTransition(oldS, s) // Regenerate picker when one of the following happens: // - this sc became ready from not-ready diff --git a/vendor/google.golang.org/grpc/grpclb_picker.go b/vendor/google.golang.org/grpc/balancer/grpclb/grpclb_picker.go similarity index 65% rename from vendor/google.golang.org/grpc/grpclb_picker.go rename to vendor/google.golang.org/grpc/balancer/grpclb/grpclb_picker.go index 872c7ccea..d77af401b 100644 --- a/vendor/google.golang.org/grpc/grpclb_picker.go +++ b/vendor/google.golang.org/grpc/balancer/grpclb/grpclb_picker.go @@ -16,7 +16,7 @@ * */ -package grpc +package grpclb import ( "sync" @@ -24,55 +24,70 @@ import ( "golang.org/x/net/context" "google.golang.org/grpc/balancer" + lbpb "google.golang.org/grpc/balancer/grpclb/grpc_lb_v1" "google.golang.org/grpc/codes" - lbpb "google.golang.org/grpc/grpclb/grpc_lb_v1/messages" "google.golang.org/grpc/status" ) +// rpcStats is same as lbmpb.ClientStats, except that numCallsDropped is a map +// instead of a slice. type rpcStats struct { - NumCallsStarted int64 - NumCallsFinished int64 - NumCallsFinishedWithDropForRateLimiting int64 - NumCallsFinishedWithDropForLoadBalancing int64 - NumCallsFinishedWithClientFailedToSend int64 - NumCallsFinishedKnownReceived int64 + // Only access the following fields atomically. + numCallsStarted int64 + numCallsFinished int64 + numCallsFinishedWithClientFailedToSend int64 + numCallsFinishedKnownReceived int64 + + mu sync.Mutex + // map load_balance_token -> num_calls_dropped + numCallsDropped map[string]int64 +} + +func newRPCStats() *rpcStats { + return &rpcStats{ + numCallsDropped: make(map[string]int64), + } } // toClientStats converts rpcStats to lbpb.ClientStats, and clears rpcStats. func (s *rpcStats) toClientStats() *lbpb.ClientStats { stats := &lbpb.ClientStats{ - NumCallsStarted: atomic.SwapInt64(&s.NumCallsStarted, 0), - NumCallsFinished: atomic.SwapInt64(&s.NumCallsFinished, 0), - NumCallsFinishedWithDropForRateLimiting: atomic.SwapInt64(&s.NumCallsFinishedWithDropForRateLimiting, 0), - NumCallsFinishedWithDropForLoadBalancing: atomic.SwapInt64(&s.NumCallsFinishedWithDropForLoadBalancing, 0), - NumCallsFinishedWithClientFailedToSend: atomic.SwapInt64(&s.NumCallsFinishedWithClientFailedToSend, 0), - NumCallsFinishedKnownReceived: atomic.SwapInt64(&s.NumCallsFinishedKnownReceived, 0), + NumCallsStarted: atomic.SwapInt64(&s.numCallsStarted, 0), + NumCallsFinished: atomic.SwapInt64(&s.numCallsFinished, 0), + NumCallsFinishedWithClientFailedToSend: atomic.SwapInt64(&s.numCallsFinishedWithClientFailedToSend, 0), + NumCallsFinishedKnownReceived: atomic.SwapInt64(&s.numCallsFinishedKnownReceived, 0), + } + s.mu.Lock() + dropped := s.numCallsDropped + s.numCallsDropped = make(map[string]int64) + s.mu.Unlock() + for token, count := range dropped { + stats.CallsFinishedWithDrop = append(stats.CallsFinishedWithDrop, &lbpb.ClientStatsPerToken{ + LoadBalanceToken: token, + NumCalls: count, + }) } return stats } -func (s *rpcStats) dropForRateLimiting() { - atomic.AddInt64(&s.NumCallsStarted, 1) - atomic.AddInt64(&s.NumCallsFinishedWithDropForRateLimiting, 1) - atomic.AddInt64(&s.NumCallsFinished, 1) -} - -func (s *rpcStats) dropForLoadBalancing() { - atomic.AddInt64(&s.NumCallsStarted, 1) - atomic.AddInt64(&s.NumCallsFinishedWithDropForLoadBalancing, 1) - atomic.AddInt64(&s.NumCallsFinished, 1) +func (s *rpcStats) drop(token string) { + atomic.AddInt64(&s.numCallsStarted, 1) + s.mu.Lock() + s.numCallsDropped[token]++ + s.mu.Unlock() + atomic.AddInt64(&s.numCallsFinished, 1) } func (s *rpcStats) failedToSend() { - atomic.AddInt64(&s.NumCallsStarted, 1) - atomic.AddInt64(&s.NumCallsFinishedWithClientFailedToSend, 1) - atomic.AddInt64(&s.NumCallsFinished, 1) + atomic.AddInt64(&s.numCallsStarted, 1) + atomic.AddInt64(&s.numCallsFinishedWithClientFailedToSend, 1) + atomic.AddInt64(&s.numCallsFinished, 1) } func (s *rpcStats) knownReceived() { - atomic.AddInt64(&s.NumCallsStarted, 1) - atomic.AddInt64(&s.NumCallsFinishedKnownReceived, 1) - atomic.AddInt64(&s.NumCallsFinished, 1) + atomic.AddInt64(&s.numCallsStarted, 1) + atomic.AddInt64(&s.numCallsFinishedKnownReceived, 1) + atomic.AddInt64(&s.numCallsFinished, 1) } type errPicker struct { @@ -131,12 +146,8 @@ func (p *lbPicker) Pick(ctx context.Context, opts balancer.PickOptions) (balance p.serverListNext = (p.serverListNext + 1) % len(p.serverList) // If it's a drop, return an error and fail the RPC. - if s.DropForRateLimiting { - p.stats.dropForRateLimiting() - return nil, nil, status.Errorf(codes.Unavailable, "request dropped by grpclb") - } - if s.DropForLoadBalancing { - p.stats.dropForLoadBalancing() + if s.Drop { + p.stats.drop(s.LoadBalanceToken) return nil, nil, status.Errorf(codes.Unavailable, "request dropped by grpclb") } diff --git a/vendor/google.golang.org/grpc/grpclb_remote_balancer.go b/vendor/google.golang.org/grpc/balancer/grpclb/grpclb_remote_balancer.go similarity index 74% rename from vendor/google.golang.org/grpc/grpclb_remote_balancer.go rename to vendor/google.golang.org/grpc/balancer/grpclb/grpclb_remote_balancer.go index b8dd4f18c..d0ecd68be 100644 --- a/vendor/google.golang.org/grpc/grpclb_remote_balancer.go +++ b/vendor/google.golang.org/grpc/balancer/grpclb/grpclb_remote_balancer.go @@ -16,21 +16,24 @@ * */ -package grpc +package grpclb import ( "fmt" + "io" "net" "reflect" "time" + timestamppb "github.com/golang/protobuf/ptypes/timestamp" "golang.org/x/net/context" + "google.golang.org/grpc" "google.golang.org/grpc/balancer" - "google.golang.org/grpc/channelz" - + lbpb "google.golang.org/grpc/balancer/grpclb/grpc_lb_v1" "google.golang.org/grpc/connectivity" - lbpb "google.golang.org/grpc/grpclb/grpc_lb_v1/messages" "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/internal" + "google.golang.org/grpc/internal/channelz" "google.golang.org/grpc/metadata" "google.golang.org/grpc/resolver" ) @@ -54,8 +57,8 @@ func (lb *lbBalancer) processServerList(l *lbpb.ServerList) { lb.fullServerList = l.Servers var backendAddrs []resolver.Address - for _, s := range l.Servers { - if s.DropForLoadBalancing || s.DropForRateLimiting { + for i, s := range l.Servers { + if s.Drop { continue } @@ -71,7 +74,8 @@ func (lb *lbBalancer) processServerList(l *lbpb.ServerList) { Addr: fmt.Sprintf("%s:%d", ipStr, s.Port), Metadata: &md, } - + grpclog.Infof("lbBalancer: server list entry[%d]: ipStr:|%s|, port:|%d|, load balancer token:|%v|", + i, ipStr, s.Port, s.LoadBalanceToken) backendAddrs = append(backendAddrs, addr) } @@ -143,6 +147,9 @@ func (lb *lbBalancer) readServerList(s *balanceLoadClientStream) error { for { reply, err := s.Recv() if err != nil { + if err == io.EOF { + return errServerTerminatedConnection + } return fmt.Errorf("grpclb: failed to recv server list: %v", err) } if serverList := reply.GetServerList(); serverList != nil { @@ -162,7 +169,7 @@ func (lb *lbBalancer) sendLoadReport(s *balanceLoadClientStream, interval time.D } stats := lb.clientStats.toClientStats() t := time.Now() - stats.Timestamp = &lbpb.Timestamp{ + stats.Timestamp = ×tamppb.Timestamp{ Seconds: t.Unix(), Nanos: int32(t.Nanosecond()), } @@ -176,13 +183,13 @@ func (lb *lbBalancer) sendLoadReport(s *balanceLoadClientStream, interval time.D } } -func (lb *lbBalancer) callRemoteBalancer() error { +func (lb *lbBalancer) callRemoteBalancer() (backoff bool, _ error) { lbClient := &loadBalancerClient{cc: lb.ccRemoteLB} ctx, cancel := context.WithCancel(context.Background()) defer cancel() - stream, err := lbClient.BalanceLoad(ctx, FailFast(false)) + stream, err := lbClient.BalanceLoad(ctx, grpc.FailFast(false)) if err != nil { - return fmt.Errorf("grpclb: failed to perform RPC to the remote balancer %v", err) + return true, fmt.Errorf("grpclb: failed to perform RPC to the remote balancer %v", err) } // grpclb handshake on the stream. @@ -194,18 +201,18 @@ func (lb *lbBalancer) callRemoteBalancer() error { }, } if err := stream.Send(initReq); err != nil { - return fmt.Errorf("grpclb: failed to send init request: %v", err) + return true, fmt.Errorf("grpclb: failed to send init request: %v", err) } reply, err := stream.Recv() if err != nil { - return fmt.Errorf("grpclb: failed to recv init response: %v", err) + return true, fmt.Errorf("grpclb: failed to recv init response: %v", err) } initResp := reply.GetInitialResponse() if initResp == nil { - return fmt.Errorf("grpclb: reply from remote balancer did not include initial response") + return true, fmt.Errorf("grpclb: reply from remote balancer did not include initial response") } if initResp.LoadBalancerDelegate != "" { - return fmt.Errorf("grpclb: Delegation is not supported") + return true, fmt.Errorf("grpclb: Delegation is not supported") } go func() { @@ -213,51 +220,72 @@ func (lb *lbBalancer) callRemoteBalancer() error { lb.sendLoadReport(stream, d) } }() - return lb.readServerList(stream) + // No backoff if init req/resp handshake was successful. + return false, lb.readServerList(stream) } func (lb *lbBalancer) watchRemoteBalancer() { + var retryCount int for { - err := lb.callRemoteBalancer() + doBackoff, err := lb.callRemoteBalancer() select { case <-lb.doneCh: return default: if err != nil { - grpclog.Error(err) + if err == errServerTerminatedConnection { + grpclog.Info(err) + } else { + grpclog.Error(err) + } } } + if !doBackoff { + retryCount = 0 + continue + } + + timer := time.NewTimer(lb.backoff.Backoff(retryCount)) + select { + case <-timer.C: + case <-lb.doneCh: + timer.Stop() + return + } + retryCount++ } } func (lb *lbBalancer) dialRemoteLB(remoteLBName string) { - var dopts []DialOption + var dopts []grpc.DialOption if creds := lb.opt.DialCreds; creds != nil { if err := creds.OverrideServerName(remoteLBName); err == nil { - dopts = append(dopts, WithTransportCredentials(creds)) + dopts = append(dopts, grpc.WithTransportCredentials(creds)) } else { grpclog.Warningf("grpclb: failed to override the server name in the credentials: %v, using Insecure", err) - dopts = append(dopts, WithInsecure()) + dopts = append(dopts, grpc.WithInsecure()) } } else { - dopts = append(dopts, WithInsecure()) + dopts = append(dopts, grpc.WithInsecure()) } if lb.opt.Dialer != nil { // WithDialer takes a different type of function, so we instead use a // special DialOption here. - dopts = append(dopts, withContextDialer(lb.opt.Dialer)) + wcd := internal.WithContextDialer.(func(func(context.Context, string) (net.Conn, error)) grpc.DialOption) + dopts = append(dopts, wcd(lb.opt.Dialer)) } // Explicitly set pickfirst as the balancer. - dopts = append(dopts, WithBalancerName(PickFirstBalancerName)) - dopts = append(dopts, withResolverBuilder(lb.manualResolver)) + dopts = append(dopts, grpc.WithBalancerName(grpc.PickFirstBalancerName)) + wrb := internal.WithResolverBuilder.(func(resolver.Builder) grpc.DialOption) + dopts = append(dopts, wrb(lb.manualResolver)) if channelz.IsOn() { - dopts = append(dopts, WithChannelzParentID(lb.opt.ChannelzParentID)) + dopts = append(dopts, grpc.WithChannelzParentID(lb.opt.ChannelzParentID)) } // DialContext using manualResolver.Scheme, which is a random scheme generated // when init grpclb. The target name is not important. - cc, err := DialContext(context.Background(), "grpclb:///grpclb.server", dopts...) + cc, err := grpc.DialContext(context.Background(), "grpclb:///grpclb.server", dopts...) if err != nil { grpclog.Fatalf("failed to dial: %v", err) } diff --git a/vendor/google.golang.org/grpc/grpclb_util.go b/vendor/google.golang.org/grpc/balancer/grpclb/grpclb_util.go similarity index 99% rename from vendor/google.golang.org/grpc/grpclb_util.go rename to vendor/google.golang.org/grpc/balancer/grpclb/grpclb_util.go index 063ba9d85..3194c0707 100644 --- a/vendor/google.golang.org/grpc/grpclb_util.go +++ b/vendor/google.golang.org/grpc/balancer/grpclb/grpclb_util.go @@ -16,7 +16,7 @@ * */ -package grpc +package grpclb import ( "fmt" diff --git a/vendor/google.golang.org/grpc/balancer/grpclb/regenerate.sh b/vendor/google.golang.org/grpc/balancer/grpclb/regenerate.sh new file mode 100755 index 000000000..b8978e11b --- /dev/null +++ b/vendor/google.golang.org/grpc/balancer/grpclb/regenerate.sh @@ -0,0 +1,33 @@ +#!/bin/bash +# Copyright 2018 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -eux -o pipefail + +TMP=$(mktemp -d) + +function finish { + rm -rf "$TMP" +} +trap finish EXIT + +pushd "$TMP" +mkdir -p grpc/lb/v1 +curl https://raw.githubusercontent.com/grpc/grpc-proto/master/grpc/lb/v1/load_balancer.proto > grpc/lb/v1/load_balancer.proto + +protoc --go_out=plugins=grpc,paths=source_relative:. -I. grpc/lb/v1/*.proto +popd +rm -f grpc_lb_v1/*.pb.go +cp "$TMP"/grpc/lb/v1/*.pb.go grpc_lb_v1/ + diff --git a/vendor/google.golang.org/grpc/balancer_v1_wrapper.go b/vendor/google.golang.org/grpc/balancer_v1_wrapper.go index b7abc6b74..e0ce32cfb 100644 --- a/vendor/google.golang.org/grpc/balancer_v1_wrapper.go +++ b/vendor/google.golang.org/grpc/balancer_v1_wrapper.go @@ -55,7 +55,7 @@ func (bwb *balancerWrapperBuilder) Build(cc balancer.ClientConn, opts balancer.B startCh: make(chan struct{}), conns: make(map[resolver.Address]balancer.SubConn), connSt: make(map[balancer.SubConn]*scState), - csEvltr: &connectivityStateEvaluator{}, + csEvltr: &balancer.ConnectivityStateEvaluator{}, state: connectivity.Idle, } cc.UpdateBalancerState(connectivity.Idle, bw) @@ -80,10 +80,6 @@ type balancerWrapper struct { cc balancer.ClientConn targetAddr string // Target without the scheme. - // To aggregate the connectivity state. - csEvltr *connectivityStateEvaluator - state connectivity.State - mu sync.Mutex conns map[resolver.Address]balancer.SubConn connSt map[balancer.SubConn]*scState @@ -92,6 +88,10 @@ type balancerWrapper struct { // - NewSubConn is created, cc wants to notify balancer of state changes; // - Build hasn't return, cc doesn't have access to balancer. startCh chan struct{} + + // To aggregate the connectivity state. + csEvltr *balancer.ConnectivityStateEvaluator + state connectivity.State } // lbWatcher watches the Notify channel of the balancer and manages @@ -248,7 +248,7 @@ func (bw *balancerWrapper) HandleSubConnStateChange(sc balancer.SubConn, s conne scSt.down(errConnClosing) } } - sa := bw.csEvltr.recordTransition(oldS, s) + sa := bw.csEvltr.RecordTransition(oldS, s) if bw.state != sa { bw.state = sa } @@ -326,47 +326,3 @@ func (bw *balancerWrapper) Pick(ctx context.Context, opts balancer.PickOptions) return sc, done, nil } - -// connectivityStateEvaluator gets updated by addrConns when their -// states transition, based on which it evaluates the state of -// ClientConn. -type connectivityStateEvaluator struct { - mu sync.Mutex - numReady uint64 // Number of addrConns in ready state. - numConnecting uint64 // Number of addrConns in connecting state. - numTransientFailure uint64 // Number of addrConns in transientFailure. -} - -// recordTransition records state change happening in every subConn and based on -// that it evaluates what aggregated state should be. -// It can only transition between Ready, Connecting and TransientFailure. Other states, -// Idle and Shutdown are transitioned into by ClientConn; in the beginning of the connection -// before any subConn is created ClientConn is in idle state. In the end when ClientConn -// closes it is in Shutdown state. -// TODO Note that in later releases, a ClientConn with no activity will be put into an Idle state. -func (cse *connectivityStateEvaluator) recordTransition(oldState, newState connectivity.State) connectivity.State { - cse.mu.Lock() - defer cse.mu.Unlock() - - // Update counters. - for idx, state := range []connectivity.State{oldState, newState} { - updateVal := 2*uint64(idx) - 1 // -1 for oldState and +1 for new. - switch state { - case connectivity.Ready: - cse.numReady += updateVal - case connectivity.Connecting: - cse.numConnecting += updateVal - case connectivity.TransientFailure: - cse.numTransientFailure += updateVal - } - } - - // Evaluate. - if cse.numReady > 0 { - return connectivity.Ready - } - if cse.numConnecting > 0 { - return connectivity.Connecting - } - return connectivity.TransientFailure -} diff --git a/vendor/google.golang.org/grpc/benchmark/benchmark.go b/vendor/google.golang.org/grpc/benchmark/benchmark.go index dc5d97afb..ec9b50b2f 100644 --- a/vendor/google.golang.org/grpc/benchmark/benchmark.go +++ b/vendor/google.golang.org/grpc/benchmark/benchmark.go @@ -226,9 +226,14 @@ func DoByteBufStreamingRoundTrip(stream testpb.BenchmarkService_StreamingCallCli // NewClientConn creates a gRPC client connection to addr. func NewClientConn(addr string, opts ...grpc.DialOption) *grpc.ClientConn { + return NewClientConnWithContext(context.Background(), addr, opts...) +} + +// NewClientConnWithContext creates a gRPC client connection to addr using ctx. +func NewClientConnWithContext(ctx context.Context, addr string, opts ...grpc.DialOption) *grpc.ClientConn { opts = append(opts, grpc.WithWriteBufferSize(128*1024)) opts = append(opts, grpc.WithReadBufferSize(128*1024)) - conn, err := grpc.Dial(addr, opts...) + conn, err := grpc.DialContext(ctx, addr, opts...) if err != nil { grpclog.Fatalf("NewClientConn(%q) failed to create a ClientConn %v", addr, err) } diff --git a/vendor/google.golang.org/grpc/benchmark/client/main.go b/vendor/google.golang.org/grpc/benchmark/client/main.go index 9aa587e3a..13a5fb3e6 100644 --- a/vendor/google.golang.org/grpc/benchmark/client/main.go +++ b/vendor/google.golang.org/grpc/benchmark/client/main.go @@ -20,14 +20,15 @@ package main import ( "flag" - "math" - "net" - "net/http" - _ "net/http/pprof" + "fmt" + "os" + "runtime" + "runtime/pprof" "sync" "time" "golang.org/x/net/context" + "golang.org/x/sys/unix" "google.golang.org/grpc" "google.golang.org/grpc/benchmark" testpb "google.golang.org/grpc/benchmark/grpc_testing" @@ -36,145 +37,159 @@ import ( ) var ( - server = flag.String("server", "", "The server address") - maxConcurrentRPCs = flag.Int("max_concurrent_rpcs", 1, "The max number of concurrent RPCs") - duration = flag.Int("duration", math.MaxInt32, "The duration in seconds to run the benchmark client") - trace = flag.Bool("trace", true, "Whether tracing is on") - rpcType = flag.Int("rpc_type", 0, + port = flag.String("port", "50051", "Localhost port to connect to.") + numRPC = flag.Int("r", 1, "The number of concurrent RPCs on each connection.") + numConn = flag.Int("c", 1, "The number of parallel connections.") + warmupDur = flag.Int("w", 10, "Warm-up duration in seconds") + duration = flag.Int("d", 60, "Benchmark duration in seconds") + rqSize = flag.Int("req", 1, "Request message size in bytes.") + rspSize = flag.Int("resp", 1, "Response message size in bytes.") + rpcType = flag.String("rpc_type", "unary", `Configure different client rpc type. Valid options are: - 0 : unary call; - 1 : streaming call.`) + unary; + streaming.`) + testName = flag.String("test_name", "", "Name of the test used for creating profiles.") + wg sync.WaitGroup + hopts = stats.HistogramOptions{ + NumBuckets: 2495, + GrowthFactor: .01, + } + mu sync.Mutex + hists []*stats.Histogram ) -func unaryCaller(client testpb.BenchmarkServiceClient) { - benchmark.DoUnaryCall(client, 1, 1) -} - -func streamCaller(stream testpb.BenchmarkService_StreamingCallClient) { - benchmark.DoStreamingRoundTrip(stream, 1, 1) -} - -func buildConnection() (s *stats.Stats, conn *grpc.ClientConn, tc testpb.BenchmarkServiceClient) { - s = stats.NewStats(256) - conn = benchmark.NewClientConn(*server) - tc = testpb.NewBenchmarkServiceClient(conn) - return s, conn, tc +func main() { + flag.Parse() + if *testName == "" { + grpclog.Fatalf("test_name not set") + } + req := &testpb.SimpleRequest{ + ResponseType: testpb.PayloadType_COMPRESSABLE, + ResponseSize: int32(*rspSize), + Payload: &testpb.Payload{ + Type: testpb.PayloadType_COMPRESSABLE, + Body: make([]byte, *rqSize), + }, + } + connectCtx, connectCancel := context.WithDeadline(context.Background(), time.Now().Add(5*time.Second)) + defer connectCancel() + ccs := buildConnections(connectCtx) + warmDeadline := time.Now().Add(time.Duration(*warmupDur) * time.Second) + endDeadline := warmDeadline.Add(time.Duration(*duration) * time.Second) + cf, err := os.Create("/tmp/" + *testName + ".cpu") + if err != nil { + grpclog.Fatalf("Error creating file: %v", err) + } + defer cf.Close() + pprof.StartCPUProfile(cf) + cpuBeg := getCPUTime() + for _, cc := range ccs { + runWithConn(cc, req, warmDeadline, endDeadline) + } + wg.Wait() + cpu := time.Duration(getCPUTime() - cpuBeg) + pprof.StopCPUProfile() + mf, err := os.Create("/tmp/" + *testName + ".mem") + if err != nil { + grpclog.Fatalf("Error creating file: %v", err) + } + defer mf.Close() + runtime.GC() // materialize all statistics + if err := pprof.WriteHeapProfile(mf); err != nil { + grpclog.Fatalf("Error writing memory profile: %v", err) + } + hist := stats.NewHistogram(hopts) + for _, h := range hists { + hist.Merge(h) + } + parseHist(hist) + fmt.Println("Client CPU utilization:", cpu) + fmt.Println("Client CPU profile:", cf.Name()) + fmt.Println("Client Mem Profile:", mf.Name()) } -func closeLoopUnary() { - s, conn, tc := buildConnection() - - for i := 0; i < 100; i++ { - unaryCaller(tc) +func buildConnections(ctx context.Context) []*grpc.ClientConn { + ccs := make([]*grpc.ClientConn, *numConn) + for i := range ccs { + ccs[i] = benchmark.NewClientConnWithContext(ctx, "localhost:"+*port, grpc.WithInsecure(), grpc.WithBlock()) } - ch := make(chan int, *maxConcurrentRPCs*4) - var ( - mu sync.Mutex - wg sync.WaitGroup - ) - wg.Add(*maxConcurrentRPCs) + return ccs +} - for i := 0; i < *maxConcurrentRPCs; i++ { +func runWithConn(cc *grpc.ClientConn, req *testpb.SimpleRequest, warmDeadline, endDeadline time.Time) { + for i := 0; i < *numRPC; i++ { + wg.Add(1) go func() { - for range ch { + defer wg.Done() + caller := makeCaller(cc, req) + hist := stats.NewHistogram(hopts) + for { start := time.Now() - unaryCaller(tc) - elapse := time.Since(start) - mu.Lock() - s.Add(elapse) - mu.Unlock() + if start.After(endDeadline) { + mu.Lock() + hists = append(hists, hist) + mu.Unlock() + return + } + caller() + elapsed := time.Since(start) + if start.After(warmDeadline) { + hist.Add(elapsed.Nanoseconds()) + } } - wg.Done() }() } - // Stop the client when time is up. - done := make(chan struct{}) - go func() { - <-time.After(time.Duration(*duration) * time.Second) - close(done) - }() - ok := true - for ok { - select { - case ch <- 0: - case <-done: - ok = false - } - } - close(ch) - wg.Wait() - conn.Close() - grpclog.Println(s.String()) - } -func closeLoopStream() { - s, conn, tc := buildConnection() - ch := make(chan int, *maxConcurrentRPCs*4) - var ( - mu sync.Mutex - wg sync.WaitGroup - ) - wg.Add(*maxConcurrentRPCs) - // Distribute RPCs over maxConcurrentCalls workers. - for i := 0; i < *maxConcurrentRPCs; i++ { - go func() { - stream, err := tc.StreamingCall(context.Background()) - if err != nil { - grpclog.Fatalf("%v.StreamingCall(_) = _, %v", tc, err) - } - // Do some warm up. - for i := 0; i < 100; i++ { - streamCaller(stream) - } - for range ch { - start := time.Now() - streamCaller(stream) - elapse := time.Since(start) - mu.Lock() - s.Add(elapse) - mu.Unlock() +func makeCaller(cc *grpc.ClientConn, req *testpb.SimpleRequest) func() { + client := testpb.NewBenchmarkServiceClient(cc) + if *rpcType == "unary" { + return func() { + if _, err := client.UnaryCall(context.Background(), req); err != nil { + grpclog.Fatalf("RPC failed: %v", err) } - wg.Done() - }() + } } - // Stop the client when time is up. - done := make(chan struct{}) - go func() { - <-time.After(time.Duration(*duration) * time.Second) - close(done) - }() - ok := true - for ok { - select { - case ch <- 0: - case <-done: - ok = false + stream, err := client.StreamingCall(context.Background()) + if err != nil { + grpclog.Fatalf("RPC failed: %v", err) + } + return func() { + if err := stream.Send(req); err != nil { + grpclog.Fatalf("Streaming RPC failed to send: %v", err) + } + if _, err := stream.Recv(); err != nil { + grpclog.Fatalf("Streaming RPC failed to read: %v", err) } } - close(ch) - wg.Wait() - conn.Close() - grpclog.Println(s.String()) } -func main() { - flag.Parse() - grpc.EnableTracing = *trace - go func() { - lis, err := net.Listen("tcp", ":0") - if err != nil { - grpclog.Fatalf("Failed to listen: %v", err) - } - grpclog.Println("Client profiling address: ", lis.Addr().String()) - if err := http.Serve(lis, nil); err != nil { - grpclog.Fatalf("Failed to serve: %v", err) +func parseHist(hist *stats.Histogram) { + fmt.Println("qps:", float64(hist.Count)/float64(*duration)) + fmt.Printf("Latency: (50/90/99 %%ile): %v/%v/%v\n", + time.Duration(median(.5, hist)), + time.Duration(median(.9, hist)), + time.Duration(median(.99, hist))) +} + +func median(percentile float64, h *stats.Histogram) int64 { + need := int64(float64(h.Count) * percentile) + have := int64(0) + for _, bucket := range h.Buckets { + count := bucket.Count + if have+count >= need { + percent := float64(need-have) / float64(count) + return int64((1.0-percent)*bucket.LowBound + percent*bucket.LowBound*(1.0+hopts.GrowthFactor)) } - }() - switch *rpcType { - case 0: - closeLoopUnary() - case 1: - closeLoopStream() + have += bucket.Count + } + panic("should have found a bound") +} + +func getCPUTime() int64 { + var ts unix.Timespec + if err := unix.ClockGettime(unix.CLOCK_PROCESS_CPUTIME_ID, &ts); err != nil { + grpclog.Fatal(err) } + return ts.Nano() } diff --git a/vendor/google.golang.org/grpc/benchmark/grpc_testing/control.pb.go b/vendor/google.golang.org/grpc/benchmark/grpc_testing/control.pb.go index b88832f75..22134427a 100644 --- a/vendor/google.golang.org/grpc/benchmark/grpc_testing/control.pb.go +++ b/vendor/google.golang.org/grpc/benchmark/grpc_testing/control.pb.go @@ -1,56 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // source: control.proto -/* -Package grpc_testing is a generated protocol buffer package. - -It is generated from these files: - control.proto - messages.proto - payloads.proto - services.proto - stats.proto - -It has these top-level messages: - PoissonParams - UniformParams - DeterministicParams - ParetoParams - ClosedLoopParams - LoadParams - SecurityParams - ClientConfig - ClientStatus - Mark - ClientArgs - ServerConfig - ServerArgs - ServerStatus - CoreRequest - CoreResponse - Void - Scenario - Scenarios - Payload - EchoStatus - SimpleRequest - SimpleResponse - StreamingInputCallRequest - StreamingInputCallResponse - ResponseParameters - StreamingOutputCallRequest - StreamingOutputCallResponse - ReconnectParams - ReconnectInfo - ByteBufferParams - SimpleProtoParams - ComplexProtoParams - PayloadConfig - ServerStats - HistogramParams - HistogramData - ClientStats -*/ package grpc_testing import proto "github.com/golang/protobuf/proto" @@ -87,7 +37,9 @@ var ClientType_value = map[string]int32{ func (x ClientType) String() string { return proto.EnumName(ClientType_name, int32(x)) } -func (ClientType) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } +func (ClientType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_control_63d6a60a9ad7e299, []int{0} +} type ServerType int32 @@ -111,7 +63,9 @@ var ServerType_value = map[string]int32{ func (x ServerType) String() string { return proto.EnumName(ServerType_name, int32(x)) } -func (ServerType) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } +func (ServerType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_control_63d6a60a9ad7e299, []int{1} +} type RpcType int32 @@ -132,19 +86,43 @@ var RpcType_value = map[string]int32{ func (x RpcType) String() string { return proto.EnumName(RpcType_name, int32(x)) } -func (RpcType) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } +func (RpcType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_control_63d6a60a9ad7e299, []int{2} +} // Parameters of poisson process distribution, which is a good representation // of activity coming in from independent identical stationary sources. type PoissonParams struct { // The rate of arrivals (a.k.a. lambda parameter of the exp distribution). - OfferedLoad float64 `protobuf:"fixed64,1,opt,name=offered_load,json=offeredLoad" json:"offered_load,omitempty"` + OfferedLoad float64 `protobuf:"fixed64,1,opt,name=offered_load,json=offeredLoad,proto3" json:"offered_load,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *PoissonParams) Reset() { *m = PoissonParams{} } -func (m *PoissonParams) String() string { return proto.CompactTextString(m) } -func (*PoissonParams) ProtoMessage() {} -func (*PoissonParams) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } +func (m *PoissonParams) Reset() { *m = PoissonParams{} } +func (m *PoissonParams) String() string { return proto.CompactTextString(m) } +func (*PoissonParams) ProtoMessage() {} +func (*PoissonParams) Descriptor() ([]byte, []int) { + return fileDescriptor_control_63d6a60a9ad7e299, []int{0} +} +func (m *PoissonParams) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_PoissonParams.Unmarshal(m, b) +} +func (m *PoissonParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_PoissonParams.Marshal(b, m, deterministic) +} +func (dst *PoissonParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_PoissonParams.Merge(dst, src) +} +func (m *PoissonParams) XXX_Size() int { + return xxx_messageInfo_PoissonParams.Size(m) +} +func (m *PoissonParams) XXX_DiscardUnknown() { + xxx_messageInfo_PoissonParams.DiscardUnknown(m) +} + +var xxx_messageInfo_PoissonParams proto.InternalMessageInfo func (m *PoissonParams) GetOfferedLoad() float64 { if m != nil { @@ -154,14 +132,36 @@ func (m *PoissonParams) GetOfferedLoad() float64 { } type UniformParams struct { - InterarrivalLo float64 `protobuf:"fixed64,1,opt,name=interarrival_lo,json=interarrivalLo" json:"interarrival_lo,omitempty"` - InterarrivalHi float64 `protobuf:"fixed64,2,opt,name=interarrival_hi,json=interarrivalHi" json:"interarrival_hi,omitempty"` + InterarrivalLo float64 `protobuf:"fixed64,1,opt,name=interarrival_lo,json=interarrivalLo,proto3" json:"interarrival_lo,omitempty"` + InterarrivalHi float64 `protobuf:"fixed64,2,opt,name=interarrival_hi,json=interarrivalHi,proto3" json:"interarrival_hi,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *UniformParams) Reset() { *m = UniformParams{} } +func (m *UniformParams) String() string { return proto.CompactTextString(m) } +func (*UniformParams) ProtoMessage() {} +func (*UniformParams) Descriptor() ([]byte, []int) { + return fileDescriptor_control_63d6a60a9ad7e299, []int{1} +} +func (m *UniformParams) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_UniformParams.Unmarshal(m, b) +} +func (m *UniformParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_UniformParams.Marshal(b, m, deterministic) +} +func (dst *UniformParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_UniformParams.Merge(dst, src) +} +func (m *UniformParams) XXX_Size() int { + return xxx_messageInfo_UniformParams.Size(m) +} +func (m *UniformParams) XXX_DiscardUnknown() { + xxx_messageInfo_UniformParams.DiscardUnknown(m) } -func (m *UniformParams) Reset() { *m = UniformParams{} } -func (m *UniformParams) String() string { return proto.CompactTextString(m) } -func (*UniformParams) ProtoMessage() {} -func (*UniformParams) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } +var xxx_messageInfo_UniformParams proto.InternalMessageInfo func (m *UniformParams) GetInterarrivalLo() float64 { if m != nil { @@ -178,13 +178,35 @@ func (m *UniformParams) GetInterarrivalHi() float64 { } type DeterministicParams struct { - OfferedLoad float64 `protobuf:"fixed64,1,opt,name=offered_load,json=offeredLoad" json:"offered_load,omitempty"` + OfferedLoad float64 `protobuf:"fixed64,1,opt,name=offered_load,json=offeredLoad,proto3" json:"offered_load,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *DeterministicParams) Reset() { *m = DeterministicParams{} } -func (m *DeterministicParams) String() string { return proto.CompactTextString(m) } -func (*DeterministicParams) ProtoMessage() {} -func (*DeterministicParams) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } +func (m *DeterministicParams) Reset() { *m = DeterministicParams{} } +func (m *DeterministicParams) String() string { return proto.CompactTextString(m) } +func (*DeterministicParams) ProtoMessage() {} +func (*DeterministicParams) Descriptor() ([]byte, []int) { + return fileDescriptor_control_63d6a60a9ad7e299, []int{2} +} +func (m *DeterministicParams) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DeterministicParams.Unmarshal(m, b) +} +func (m *DeterministicParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DeterministicParams.Marshal(b, m, deterministic) +} +func (dst *DeterministicParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_DeterministicParams.Merge(dst, src) +} +func (m *DeterministicParams) XXX_Size() int { + return xxx_messageInfo_DeterministicParams.Size(m) +} +func (m *DeterministicParams) XXX_DiscardUnknown() { + xxx_messageInfo_DeterministicParams.DiscardUnknown(m) +} + +var xxx_messageInfo_DeterministicParams proto.InternalMessageInfo func (m *DeterministicParams) GetOfferedLoad() float64 { if m != nil { @@ -194,14 +216,36 @@ func (m *DeterministicParams) GetOfferedLoad() float64 { } type ParetoParams struct { - InterarrivalBase float64 `protobuf:"fixed64,1,opt,name=interarrival_base,json=interarrivalBase" json:"interarrival_base,omitempty"` - Alpha float64 `protobuf:"fixed64,2,opt,name=alpha" json:"alpha,omitempty"` + InterarrivalBase float64 `protobuf:"fixed64,1,opt,name=interarrival_base,json=interarrivalBase,proto3" json:"interarrival_base,omitempty"` + Alpha float64 `protobuf:"fixed64,2,opt,name=alpha,proto3" json:"alpha,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *ParetoParams) Reset() { *m = ParetoParams{} } -func (m *ParetoParams) String() string { return proto.CompactTextString(m) } -func (*ParetoParams) ProtoMessage() {} -func (*ParetoParams) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } +func (m *ParetoParams) Reset() { *m = ParetoParams{} } +func (m *ParetoParams) String() string { return proto.CompactTextString(m) } +func (*ParetoParams) ProtoMessage() {} +func (*ParetoParams) Descriptor() ([]byte, []int) { + return fileDescriptor_control_63d6a60a9ad7e299, []int{3} +} +func (m *ParetoParams) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ParetoParams.Unmarshal(m, b) +} +func (m *ParetoParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ParetoParams.Marshal(b, m, deterministic) +} +func (dst *ParetoParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_ParetoParams.Merge(dst, src) +} +func (m *ParetoParams) XXX_Size() int { + return xxx_messageInfo_ParetoParams.Size(m) +} +func (m *ParetoParams) XXX_DiscardUnknown() { + xxx_messageInfo_ParetoParams.DiscardUnknown(m) +} + +var xxx_messageInfo_ParetoParams proto.InternalMessageInfo func (m *ParetoParams) GetInterarrivalBase() float64 { if m != nil { @@ -220,12 +264,34 @@ func (m *ParetoParams) GetAlpha() float64 { // Once an RPC finishes, immediately start a new one. // No configuration parameters needed. type ClosedLoopParams struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ClosedLoopParams) Reset() { *m = ClosedLoopParams{} } +func (m *ClosedLoopParams) String() string { return proto.CompactTextString(m) } +func (*ClosedLoopParams) ProtoMessage() {} +func (*ClosedLoopParams) Descriptor() ([]byte, []int) { + return fileDescriptor_control_63d6a60a9ad7e299, []int{4} +} +func (m *ClosedLoopParams) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ClosedLoopParams.Unmarshal(m, b) +} +func (m *ClosedLoopParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ClosedLoopParams.Marshal(b, m, deterministic) +} +func (dst *ClosedLoopParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_ClosedLoopParams.Merge(dst, src) +} +func (m *ClosedLoopParams) XXX_Size() int { + return xxx_messageInfo_ClosedLoopParams.Size(m) +} +func (m *ClosedLoopParams) XXX_DiscardUnknown() { + xxx_messageInfo_ClosedLoopParams.DiscardUnknown(m) } -func (m *ClosedLoopParams) Reset() { *m = ClosedLoopParams{} } -func (m *ClosedLoopParams) String() string { return proto.CompactTextString(m) } -func (*ClosedLoopParams) ProtoMessage() {} -func (*ClosedLoopParams) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} } +var xxx_messageInfo_ClosedLoopParams proto.InternalMessageInfo type LoadParams struct { // Types that are valid to be assigned to Load: @@ -234,32 +300,54 @@ type LoadParams struct { // *LoadParams_Uniform // *LoadParams_Determ // *LoadParams_Pareto - Load isLoadParams_Load `protobuf_oneof:"load"` + Load isLoadParams_Load `protobuf_oneof:"load"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *LoadParams) Reset() { *m = LoadParams{} } -func (m *LoadParams) String() string { return proto.CompactTextString(m) } -func (*LoadParams) ProtoMessage() {} -func (*LoadParams) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} } +func (m *LoadParams) Reset() { *m = LoadParams{} } +func (m *LoadParams) String() string { return proto.CompactTextString(m) } +func (*LoadParams) ProtoMessage() {} +func (*LoadParams) Descriptor() ([]byte, []int) { + return fileDescriptor_control_63d6a60a9ad7e299, []int{5} +} +func (m *LoadParams) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_LoadParams.Unmarshal(m, b) +} +func (m *LoadParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_LoadParams.Marshal(b, m, deterministic) +} +func (dst *LoadParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_LoadParams.Merge(dst, src) +} +func (m *LoadParams) XXX_Size() int { + return xxx_messageInfo_LoadParams.Size(m) +} +func (m *LoadParams) XXX_DiscardUnknown() { + xxx_messageInfo_LoadParams.DiscardUnknown(m) +} + +var xxx_messageInfo_LoadParams proto.InternalMessageInfo type isLoadParams_Load interface { isLoadParams_Load() } type LoadParams_ClosedLoop struct { - ClosedLoop *ClosedLoopParams `protobuf:"bytes,1,opt,name=closed_loop,json=closedLoop,oneof"` + ClosedLoop *ClosedLoopParams `protobuf:"bytes,1,opt,name=closed_loop,json=closedLoop,proto3,oneof"` } type LoadParams_Poisson struct { - Poisson *PoissonParams `protobuf:"bytes,2,opt,name=poisson,oneof"` + Poisson *PoissonParams `protobuf:"bytes,2,opt,name=poisson,proto3,oneof"` } type LoadParams_Uniform struct { - Uniform *UniformParams `protobuf:"bytes,3,opt,name=uniform,oneof"` + Uniform *UniformParams `protobuf:"bytes,3,opt,name=uniform,proto3,oneof"` } type LoadParams_Determ struct { - Determ *DeterministicParams `protobuf:"bytes,4,opt,name=determ,oneof"` + Determ *DeterministicParams `protobuf:"bytes,4,opt,name=determ,proto3,oneof"` } type LoadParams_Pareto struct { - Pareto *ParetoParams `protobuf:"bytes,5,opt,name=pareto,oneof"` + Pareto *ParetoParams `protobuf:"bytes,5,opt,name=pareto,proto3,oneof"` } func (*LoadParams_ClosedLoop) isLoadParams_Load() {} @@ -411,27 +499,27 @@ func _LoadParams_OneofSizer(msg proto.Message) (n int) { switch x := m.Load.(type) { case *LoadParams_ClosedLoop: s := proto.Size(x.ClosedLoop) - n += proto.SizeVarint(1<<3 | proto.WireBytes) + n += 1 // tag and wire n += proto.SizeVarint(uint64(s)) n += s case *LoadParams_Poisson: s := proto.Size(x.Poisson) - n += proto.SizeVarint(2<<3 | proto.WireBytes) + n += 1 // tag and wire n += proto.SizeVarint(uint64(s)) n += s case *LoadParams_Uniform: s := proto.Size(x.Uniform) - n += proto.SizeVarint(3<<3 | proto.WireBytes) + n += 1 // tag and wire n += proto.SizeVarint(uint64(s)) n += s case *LoadParams_Determ: s := proto.Size(x.Determ) - n += proto.SizeVarint(4<<3 | proto.WireBytes) + n += 1 // tag and wire n += proto.SizeVarint(uint64(s)) n += s case *LoadParams_Pareto: s := proto.Size(x.Pareto) - n += proto.SizeVarint(5<<3 | proto.WireBytes) + n += 1 // tag and wire n += proto.SizeVarint(uint64(s)) n += s case nil: @@ -443,14 +531,36 @@ func _LoadParams_OneofSizer(msg proto.Message) (n int) { // presence of SecurityParams implies use of TLS type SecurityParams struct { - UseTestCa bool `protobuf:"varint,1,opt,name=use_test_ca,json=useTestCa" json:"use_test_ca,omitempty"` - ServerHostOverride string `protobuf:"bytes,2,opt,name=server_host_override,json=serverHostOverride" json:"server_host_override,omitempty"` + UseTestCa bool `protobuf:"varint,1,opt,name=use_test_ca,json=useTestCa,proto3" json:"use_test_ca,omitempty"` + ServerHostOverride string `protobuf:"bytes,2,opt,name=server_host_override,json=serverHostOverride,proto3" json:"server_host_override,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SecurityParams) Reset() { *m = SecurityParams{} } +func (m *SecurityParams) String() string { return proto.CompactTextString(m) } +func (*SecurityParams) ProtoMessage() {} +func (*SecurityParams) Descriptor() ([]byte, []int) { + return fileDescriptor_control_63d6a60a9ad7e299, []int{6} +} +func (m *SecurityParams) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SecurityParams.Unmarshal(m, b) +} +func (m *SecurityParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SecurityParams.Marshal(b, m, deterministic) +} +func (dst *SecurityParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_SecurityParams.Merge(dst, src) +} +func (m *SecurityParams) XXX_Size() int { + return xxx_messageInfo_SecurityParams.Size(m) +} +func (m *SecurityParams) XXX_DiscardUnknown() { + xxx_messageInfo_SecurityParams.DiscardUnknown(m) } -func (m *SecurityParams) Reset() { *m = SecurityParams{} } -func (m *SecurityParams) String() string { return proto.CompactTextString(m) } -func (*SecurityParams) ProtoMessage() {} -func (*SecurityParams) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} } +var xxx_messageInfo_SecurityParams proto.InternalMessageInfo func (m *SecurityParams) GetUseTestCa() bool { if m != nil { @@ -468,31 +578,53 @@ func (m *SecurityParams) GetServerHostOverride() string { type ClientConfig struct { // List of targets to connect to. At least one target needs to be specified. - ServerTargets []string `protobuf:"bytes,1,rep,name=server_targets,json=serverTargets" json:"server_targets,omitempty"` - ClientType ClientType `protobuf:"varint,2,opt,name=client_type,json=clientType,enum=grpc.testing.ClientType" json:"client_type,omitempty"` - SecurityParams *SecurityParams `protobuf:"bytes,3,opt,name=security_params,json=securityParams" json:"security_params,omitempty"` + ServerTargets []string `protobuf:"bytes,1,rep,name=server_targets,json=serverTargets,proto3" json:"server_targets,omitempty"` + ClientType ClientType `protobuf:"varint,2,opt,name=client_type,json=clientType,proto3,enum=grpc.testing.ClientType" json:"client_type,omitempty"` + SecurityParams *SecurityParams `protobuf:"bytes,3,opt,name=security_params,json=securityParams,proto3" json:"security_params,omitempty"` // How many concurrent RPCs to start for each channel. // For synchronous client, use a separate thread for each outstanding RPC. - OutstandingRpcsPerChannel int32 `protobuf:"varint,4,opt,name=outstanding_rpcs_per_channel,json=outstandingRpcsPerChannel" json:"outstanding_rpcs_per_channel,omitempty"` + OutstandingRpcsPerChannel int32 `protobuf:"varint,4,opt,name=outstanding_rpcs_per_channel,json=outstandingRpcsPerChannel,proto3" json:"outstanding_rpcs_per_channel,omitempty"` // Number of independent client channels to create. // i-th channel will connect to server_target[i % server_targets.size()] - ClientChannels int32 `protobuf:"varint,5,opt,name=client_channels,json=clientChannels" json:"client_channels,omitempty"` + ClientChannels int32 `protobuf:"varint,5,opt,name=client_channels,json=clientChannels,proto3" json:"client_channels,omitempty"` // Only for async client. Number of threads to use to start/manage RPCs. - AsyncClientThreads int32 `protobuf:"varint,7,opt,name=async_client_threads,json=asyncClientThreads" json:"async_client_threads,omitempty"` - RpcType RpcType `protobuf:"varint,8,opt,name=rpc_type,json=rpcType,enum=grpc.testing.RpcType" json:"rpc_type,omitempty"` + AsyncClientThreads int32 `protobuf:"varint,7,opt,name=async_client_threads,json=asyncClientThreads,proto3" json:"async_client_threads,omitempty"` + RpcType RpcType `protobuf:"varint,8,opt,name=rpc_type,json=rpcType,proto3,enum=grpc.testing.RpcType" json:"rpc_type,omitempty"` // The requested load for the entire client (aggregated over all the threads). - LoadParams *LoadParams `protobuf:"bytes,10,opt,name=load_params,json=loadParams" json:"load_params,omitempty"` - PayloadConfig *PayloadConfig `protobuf:"bytes,11,opt,name=payload_config,json=payloadConfig" json:"payload_config,omitempty"` - HistogramParams *HistogramParams `protobuf:"bytes,12,opt,name=histogram_params,json=histogramParams" json:"histogram_params,omitempty"` + LoadParams *LoadParams `protobuf:"bytes,10,opt,name=load_params,json=loadParams,proto3" json:"load_params,omitempty"` + PayloadConfig *PayloadConfig `protobuf:"bytes,11,opt,name=payload_config,json=payloadConfig,proto3" json:"payload_config,omitempty"` + HistogramParams *HistogramParams `protobuf:"bytes,12,opt,name=histogram_params,json=histogramParams,proto3" json:"histogram_params,omitempty"` // Specify the cores we should run the client on, if desired - CoreList []int32 `protobuf:"varint,13,rep,packed,name=core_list,json=coreList" json:"core_list,omitempty"` - CoreLimit int32 `protobuf:"varint,14,opt,name=core_limit,json=coreLimit" json:"core_limit,omitempty"` + CoreList []int32 `protobuf:"varint,13,rep,packed,name=core_list,json=coreList,proto3" json:"core_list,omitempty"` + CoreLimit int32 `protobuf:"varint,14,opt,name=core_limit,json=coreLimit,proto3" json:"core_limit,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *ClientConfig) Reset() { *m = ClientConfig{} } -func (m *ClientConfig) String() string { return proto.CompactTextString(m) } -func (*ClientConfig) ProtoMessage() {} -func (*ClientConfig) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} } +func (m *ClientConfig) Reset() { *m = ClientConfig{} } +func (m *ClientConfig) String() string { return proto.CompactTextString(m) } +func (*ClientConfig) ProtoMessage() {} +func (*ClientConfig) Descriptor() ([]byte, []int) { + return fileDescriptor_control_63d6a60a9ad7e299, []int{7} +} +func (m *ClientConfig) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ClientConfig.Unmarshal(m, b) +} +func (m *ClientConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ClientConfig.Marshal(b, m, deterministic) +} +func (dst *ClientConfig) XXX_Merge(src proto.Message) { + xxx_messageInfo_ClientConfig.Merge(dst, src) +} +func (m *ClientConfig) XXX_Size() int { + return xxx_messageInfo_ClientConfig.Size(m) +} +func (m *ClientConfig) XXX_DiscardUnknown() { + xxx_messageInfo_ClientConfig.DiscardUnknown(m) +} + +var xxx_messageInfo_ClientConfig proto.InternalMessageInfo func (m *ClientConfig) GetServerTargets() []string { if m != nil { @@ -579,13 +711,35 @@ func (m *ClientConfig) GetCoreLimit() int32 { } type ClientStatus struct { - Stats *ClientStats `protobuf:"bytes,1,opt,name=stats" json:"stats,omitempty"` + Stats *ClientStats `protobuf:"bytes,1,opt,name=stats,proto3" json:"stats,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *ClientStatus) Reset() { *m = ClientStatus{} } -func (m *ClientStatus) String() string { return proto.CompactTextString(m) } -func (*ClientStatus) ProtoMessage() {} -func (*ClientStatus) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} } +func (m *ClientStatus) Reset() { *m = ClientStatus{} } +func (m *ClientStatus) String() string { return proto.CompactTextString(m) } +func (*ClientStatus) ProtoMessage() {} +func (*ClientStatus) Descriptor() ([]byte, []int) { + return fileDescriptor_control_63d6a60a9ad7e299, []int{8} +} +func (m *ClientStatus) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ClientStatus.Unmarshal(m, b) +} +func (m *ClientStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ClientStatus.Marshal(b, m, deterministic) +} +func (dst *ClientStatus) XXX_Merge(src proto.Message) { + xxx_messageInfo_ClientStatus.Merge(dst, src) +} +func (m *ClientStatus) XXX_Size() int { + return xxx_messageInfo_ClientStatus.Size(m) +} +func (m *ClientStatus) XXX_DiscardUnknown() { + xxx_messageInfo_ClientStatus.DiscardUnknown(m) +} + +var xxx_messageInfo_ClientStatus proto.InternalMessageInfo func (m *ClientStatus) GetStats() *ClientStats { if m != nil { @@ -597,13 +751,35 @@ func (m *ClientStatus) GetStats() *ClientStats { // Request current stats type Mark struct { // if true, the stats will be reset after taking their snapshot. - Reset_ bool `protobuf:"varint,1,opt,name=reset" json:"reset,omitempty"` + Reset_ bool `protobuf:"varint,1,opt,name=reset,proto3" json:"reset,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Mark) Reset() { *m = Mark{} } +func (m *Mark) String() string { return proto.CompactTextString(m) } +func (*Mark) ProtoMessage() {} +func (*Mark) Descriptor() ([]byte, []int) { + return fileDescriptor_control_63d6a60a9ad7e299, []int{9} +} +func (m *Mark) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Mark.Unmarshal(m, b) +} +func (m *Mark) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Mark.Marshal(b, m, deterministic) +} +func (dst *Mark) XXX_Merge(src proto.Message) { + xxx_messageInfo_Mark.Merge(dst, src) +} +func (m *Mark) XXX_Size() int { + return xxx_messageInfo_Mark.Size(m) +} +func (m *Mark) XXX_DiscardUnknown() { + xxx_messageInfo_Mark.DiscardUnknown(m) } -func (m *Mark) Reset() { *m = Mark{} } -func (m *Mark) String() string { return proto.CompactTextString(m) } -func (*Mark) ProtoMessage() {} -func (*Mark) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} } +var xxx_messageInfo_Mark proto.InternalMessageInfo func (m *Mark) GetReset_() bool { if m != nil { @@ -616,23 +792,45 @@ type ClientArgs struct { // Types that are valid to be assigned to Argtype: // *ClientArgs_Setup // *ClientArgs_Mark - Argtype isClientArgs_Argtype `protobuf_oneof:"argtype"` + Argtype isClientArgs_Argtype `protobuf_oneof:"argtype"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *ClientArgs) Reset() { *m = ClientArgs{} } -func (m *ClientArgs) String() string { return proto.CompactTextString(m) } -func (*ClientArgs) ProtoMessage() {} -func (*ClientArgs) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10} } +func (m *ClientArgs) Reset() { *m = ClientArgs{} } +func (m *ClientArgs) String() string { return proto.CompactTextString(m) } +func (*ClientArgs) ProtoMessage() {} +func (*ClientArgs) Descriptor() ([]byte, []int) { + return fileDescriptor_control_63d6a60a9ad7e299, []int{10} +} +func (m *ClientArgs) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ClientArgs.Unmarshal(m, b) +} +func (m *ClientArgs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ClientArgs.Marshal(b, m, deterministic) +} +func (dst *ClientArgs) XXX_Merge(src proto.Message) { + xxx_messageInfo_ClientArgs.Merge(dst, src) +} +func (m *ClientArgs) XXX_Size() int { + return xxx_messageInfo_ClientArgs.Size(m) +} +func (m *ClientArgs) XXX_DiscardUnknown() { + xxx_messageInfo_ClientArgs.DiscardUnknown(m) +} + +var xxx_messageInfo_ClientArgs proto.InternalMessageInfo type isClientArgs_Argtype interface { isClientArgs_Argtype() } type ClientArgs_Setup struct { - Setup *ClientConfig `protobuf:"bytes,1,opt,name=setup,oneof"` + Setup *ClientConfig `protobuf:"bytes,1,opt,name=setup,proto3,oneof"` } type ClientArgs_Mark struct { - Mark *Mark `protobuf:"bytes,2,opt,name=mark,oneof"` + Mark *Mark `protobuf:"bytes,2,opt,name=mark,proto3,oneof"` } func (*ClientArgs_Setup) isClientArgs_Argtype() {} @@ -718,12 +916,12 @@ func _ClientArgs_OneofSizer(msg proto.Message) (n int) { switch x := m.Argtype.(type) { case *ClientArgs_Setup: s := proto.Size(x.Setup) - n += proto.SizeVarint(1<<3 | proto.WireBytes) + n += 1 // tag and wire n += proto.SizeVarint(uint64(s)) n += s case *ClientArgs_Mark: s := proto.Size(x.Mark) - n += proto.SizeVarint(2<<3 | proto.WireBytes) + n += 1 // tag and wire n += proto.SizeVarint(uint64(s)) n += s case nil: @@ -734,24 +932,46 @@ func _ClientArgs_OneofSizer(msg proto.Message) (n int) { } type ServerConfig struct { - ServerType ServerType `protobuf:"varint,1,opt,name=server_type,json=serverType,enum=grpc.testing.ServerType" json:"server_type,omitempty"` - SecurityParams *SecurityParams `protobuf:"bytes,2,opt,name=security_params,json=securityParams" json:"security_params,omitempty"` + ServerType ServerType `protobuf:"varint,1,opt,name=server_type,json=serverType,proto3,enum=grpc.testing.ServerType" json:"server_type,omitempty"` + SecurityParams *SecurityParams `protobuf:"bytes,2,opt,name=security_params,json=securityParams,proto3" json:"security_params,omitempty"` // Port on which to listen. Zero means pick unused port. - Port int32 `protobuf:"varint,4,opt,name=port" json:"port,omitempty"` + Port int32 `protobuf:"varint,4,opt,name=port,proto3" json:"port,omitempty"` // Only for async server. Number of threads used to serve the requests. - AsyncServerThreads int32 `protobuf:"varint,7,opt,name=async_server_threads,json=asyncServerThreads" json:"async_server_threads,omitempty"` + AsyncServerThreads int32 `protobuf:"varint,7,opt,name=async_server_threads,json=asyncServerThreads,proto3" json:"async_server_threads,omitempty"` // Specify the number of cores to limit server to, if desired - CoreLimit int32 `protobuf:"varint,8,opt,name=core_limit,json=coreLimit" json:"core_limit,omitempty"` + CoreLimit int32 `protobuf:"varint,8,opt,name=core_limit,json=coreLimit,proto3" json:"core_limit,omitempty"` // payload config, used in generic server - PayloadConfig *PayloadConfig `protobuf:"bytes,9,opt,name=payload_config,json=payloadConfig" json:"payload_config,omitempty"` + PayloadConfig *PayloadConfig `protobuf:"bytes,9,opt,name=payload_config,json=payloadConfig,proto3" json:"payload_config,omitempty"` // Specify the cores we should run the server on, if desired - CoreList []int32 `protobuf:"varint,10,rep,packed,name=core_list,json=coreList" json:"core_list,omitempty"` + CoreList []int32 `protobuf:"varint,10,rep,packed,name=core_list,json=coreList,proto3" json:"core_list,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ServerConfig) Reset() { *m = ServerConfig{} } +func (m *ServerConfig) String() string { return proto.CompactTextString(m) } +func (*ServerConfig) ProtoMessage() {} +func (*ServerConfig) Descriptor() ([]byte, []int) { + return fileDescriptor_control_63d6a60a9ad7e299, []int{11} +} +func (m *ServerConfig) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ServerConfig.Unmarshal(m, b) +} +func (m *ServerConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ServerConfig.Marshal(b, m, deterministic) +} +func (dst *ServerConfig) XXX_Merge(src proto.Message) { + xxx_messageInfo_ServerConfig.Merge(dst, src) +} +func (m *ServerConfig) XXX_Size() int { + return xxx_messageInfo_ServerConfig.Size(m) +} +func (m *ServerConfig) XXX_DiscardUnknown() { + xxx_messageInfo_ServerConfig.DiscardUnknown(m) } -func (m *ServerConfig) Reset() { *m = ServerConfig{} } -func (m *ServerConfig) String() string { return proto.CompactTextString(m) } -func (*ServerConfig) ProtoMessage() {} -func (*ServerConfig) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{11} } +var xxx_messageInfo_ServerConfig proto.InternalMessageInfo func (m *ServerConfig) GetServerType() ServerType { if m != nil { @@ -806,23 +1026,45 @@ type ServerArgs struct { // Types that are valid to be assigned to Argtype: // *ServerArgs_Setup // *ServerArgs_Mark - Argtype isServerArgs_Argtype `protobuf_oneof:"argtype"` + Argtype isServerArgs_Argtype `protobuf_oneof:"argtype"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ServerArgs) Reset() { *m = ServerArgs{} } +func (m *ServerArgs) String() string { return proto.CompactTextString(m) } +func (*ServerArgs) ProtoMessage() {} +func (*ServerArgs) Descriptor() ([]byte, []int) { + return fileDescriptor_control_63d6a60a9ad7e299, []int{12} +} +func (m *ServerArgs) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ServerArgs.Unmarshal(m, b) +} +func (m *ServerArgs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ServerArgs.Marshal(b, m, deterministic) +} +func (dst *ServerArgs) XXX_Merge(src proto.Message) { + xxx_messageInfo_ServerArgs.Merge(dst, src) +} +func (m *ServerArgs) XXX_Size() int { + return xxx_messageInfo_ServerArgs.Size(m) +} +func (m *ServerArgs) XXX_DiscardUnknown() { + xxx_messageInfo_ServerArgs.DiscardUnknown(m) } -func (m *ServerArgs) Reset() { *m = ServerArgs{} } -func (m *ServerArgs) String() string { return proto.CompactTextString(m) } -func (*ServerArgs) ProtoMessage() {} -func (*ServerArgs) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{12} } +var xxx_messageInfo_ServerArgs proto.InternalMessageInfo type isServerArgs_Argtype interface { isServerArgs_Argtype() } type ServerArgs_Setup struct { - Setup *ServerConfig `protobuf:"bytes,1,opt,name=setup,oneof"` + Setup *ServerConfig `protobuf:"bytes,1,opt,name=setup,proto3,oneof"` } type ServerArgs_Mark struct { - Mark *Mark `protobuf:"bytes,2,opt,name=mark,oneof"` + Mark *Mark `protobuf:"bytes,2,opt,name=mark,proto3,oneof"` } func (*ServerArgs_Setup) isServerArgs_Argtype() {} @@ -908,12 +1150,12 @@ func _ServerArgs_OneofSizer(msg proto.Message) (n int) { switch x := m.Argtype.(type) { case *ServerArgs_Setup: s := proto.Size(x.Setup) - n += proto.SizeVarint(1<<3 | proto.WireBytes) + n += 1 // tag and wire n += proto.SizeVarint(uint64(s)) n += s case *ServerArgs_Mark: s := proto.Size(x.Mark) - n += proto.SizeVarint(2<<3 | proto.WireBytes) + n += 1 // tag and wire n += proto.SizeVarint(uint64(s)) n += s case nil: @@ -924,17 +1166,39 @@ func _ServerArgs_OneofSizer(msg proto.Message) (n int) { } type ServerStatus struct { - Stats *ServerStats `protobuf:"bytes,1,opt,name=stats" json:"stats,omitempty"` + Stats *ServerStats `protobuf:"bytes,1,opt,name=stats,proto3" json:"stats,omitempty"` // the port bound by the server - Port int32 `protobuf:"varint,2,opt,name=port" json:"port,omitempty"` + Port int32 `protobuf:"varint,2,opt,name=port,proto3" json:"port,omitempty"` // Number of cores available to the server - Cores int32 `protobuf:"varint,3,opt,name=cores" json:"cores,omitempty"` + Cores int32 `protobuf:"varint,3,opt,name=cores,proto3" json:"cores,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *ServerStatus) Reset() { *m = ServerStatus{} } -func (m *ServerStatus) String() string { return proto.CompactTextString(m) } -func (*ServerStatus) ProtoMessage() {} -func (*ServerStatus) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{13} } +func (m *ServerStatus) Reset() { *m = ServerStatus{} } +func (m *ServerStatus) String() string { return proto.CompactTextString(m) } +func (*ServerStatus) ProtoMessage() {} +func (*ServerStatus) Descriptor() ([]byte, []int) { + return fileDescriptor_control_63d6a60a9ad7e299, []int{13} +} +func (m *ServerStatus) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ServerStatus.Unmarshal(m, b) +} +func (m *ServerStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ServerStatus.Marshal(b, m, deterministic) +} +func (dst *ServerStatus) XXX_Merge(src proto.Message) { + xxx_messageInfo_ServerStatus.Merge(dst, src) +} +func (m *ServerStatus) XXX_Size() int { + return xxx_messageInfo_ServerStatus.Size(m) +} +func (m *ServerStatus) XXX_DiscardUnknown() { + xxx_messageInfo_ServerStatus.DiscardUnknown(m) +} + +var xxx_messageInfo_ServerStatus proto.InternalMessageInfo func (m *ServerStatus) GetStats() *ServerStats { if m != nil { @@ -958,22 +1222,66 @@ func (m *ServerStatus) GetCores() int32 { } type CoreRequest struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CoreRequest) Reset() { *m = CoreRequest{} } +func (m *CoreRequest) String() string { return proto.CompactTextString(m) } +func (*CoreRequest) ProtoMessage() {} +func (*CoreRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_control_63d6a60a9ad7e299, []int{14} +} +func (m *CoreRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_CoreRequest.Unmarshal(m, b) +} +func (m *CoreRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CoreRequest.Marshal(b, m, deterministic) +} +func (dst *CoreRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_CoreRequest.Merge(dst, src) +} +func (m *CoreRequest) XXX_Size() int { + return xxx_messageInfo_CoreRequest.Size(m) +} +func (m *CoreRequest) XXX_DiscardUnknown() { + xxx_messageInfo_CoreRequest.DiscardUnknown(m) } -func (m *CoreRequest) Reset() { *m = CoreRequest{} } -func (m *CoreRequest) String() string { return proto.CompactTextString(m) } -func (*CoreRequest) ProtoMessage() {} -func (*CoreRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{14} } +var xxx_messageInfo_CoreRequest proto.InternalMessageInfo type CoreResponse struct { // Number of cores available on the server - Cores int32 `protobuf:"varint,1,opt,name=cores" json:"cores,omitempty"` + Cores int32 `protobuf:"varint,1,opt,name=cores,proto3" json:"cores,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *CoreResponse) Reset() { *m = CoreResponse{} } -func (m *CoreResponse) String() string { return proto.CompactTextString(m) } -func (*CoreResponse) ProtoMessage() {} -func (*CoreResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{15} } +func (m *CoreResponse) Reset() { *m = CoreResponse{} } +func (m *CoreResponse) String() string { return proto.CompactTextString(m) } +func (*CoreResponse) ProtoMessage() {} +func (*CoreResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_control_63d6a60a9ad7e299, []int{15} +} +func (m *CoreResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_CoreResponse.Unmarshal(m, b) +} +func (m *CoreResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CoreResponse.Marshal(b, m, deterministic) +} +func (dst *CoreResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_CoreResponse.Merge(dst, src) +} +func (m *CoreResponse) XXX_Size() int { + return xxx_messageInfo_CoreResponse.Size(m) +} +func (m *CoreResponse) XXX_DiscardUnknown() { + xxx_messageInfo_CoreResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_CoreResponse proto.InternalMessageInfo func (m *CoreResponse) GetCores() int32 { if m != nil { @@ -983,37 +1291,81 @@ func (m *CoreResponse) GetCores() int32 { } type Void struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Void) Reset() { *m = Void{} } +func (m *Void) String() string { return proto.CompactTextString(m) } +func (*Void) ProtoMessage() {} +func (*Void) Descriptor() ([]byte, []int) { + return fileDescriptor_control_63d6a60a9ad7e299, []int{16} +} +func (m *Void) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Void.Unmarshal(m, b) +} +func (m *Void) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Void.Marshal(b, m, deterministic) +} +func (dst *Void) XXX_Merge(src proto.Message) { + xxx_messageInfo_Void.Merge(dst, src) +} +func (m *Void) XXX_Size() int { + return xxx_messageInfo_Void.Size(m) +} +func (m *Void) XXX_DiscardUnknown() { + xxx_messageInfo_Void.DiscardUnknown(m) } -func (m *Void) Reset() { *m = Void{} } -func (m *Void) String() string { return proto.CompactTextString(m) } -func (*Void) ProtoMessage() {} -func (*Void) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{16} } +var xxx_messageInfo_Void proto.InternalMessageInfo // A single performance scenario: input to qps_json_driver type Scenario struct { // Human readable name for this scenario - Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // Client configuration - ClientConfig *ClientConfig `protobuf:"bytes,2,opt,name=client_config,json=clientConfig" json:"client_config,omitempty"` + ClientConfig *ClientConfig `protobuf:"bytes,2,opt,name=client_config,json=clientConfig,proto3" json:"client_config,omitempty"` // Number of clients to start for the test - NumClients int32 `protobuf:"varint,3,opt,name=num_clients,json=numClients" json:"num_clients,omitempty"` + NumClients int32 `protobuf:"varint,3,opt,name=num_clients,json=numClients,proto3" json:"num_clients,omitempty"` // Server configuration - ServerConfig *ServerConfig `protobuf:"bytes,4,opt,name=server_config,json=serverConfig" json:"server_config,omitempty"` + ServerConfig *ServerConfig `protobuf:"bytes,4,opt,name=server_config,json=serverConfig,proto3" json:"server_config,omitempty"` // Number of servers to start for the test - NumServers int32 `protobuf:"varint,5,opt,name=num_servers,json=numServers" json:"num_servers,omitempty"` + NumServers int32 `protobuf:"varint,5,opt,name=num_servers,json=numServers,proto3" json:"num_servers,omitempty"` // Warmup period, in seconds - WarmupSeconds int32 `protobuf:"varint,6,opt,name=warmup_seconds,json=warmupSeconds" json:"warmup_seconds,omitempty"` + WarmupSeconds int32 `protobuf:"varint,6,opt,name=warmup_seconds,json=warmupSeconds,proto3" json:"warmup_seconds,omitempty"` // Benchmark time, in seconds - BenchmarkSeconds int32 `protobuf:"varint,7,opt,name=benchmark_seconds,json=benchmarkSeconds" json:"benchmark_seconds,omitempty"` + BenchmarkSeconds int32 `protobuf:"varint,7,opt,name=benchmark_seconds,json=benchmarkSeconds,proto3" json:"benchmark_seconds,omitempty"` // Number of workers to spawn locally (usually zero) - SpawnLocalWorkerCount int32 `protobuf:"varint,8,opt,name=spawn_local_worker_count,json=spawnLocalWorkerCount" json:"spawn_local_worker_count,omitempty"` + SpawnLocalWorkerCount int32 `protobuf:"varint,8,opt,name=spawn_local_worker_count,json=spawnLocalWorkerCount,proto3" json:"spawn_local_worker_count,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *Scenario) Reset() { *m = Scenario{} } -func (m *Scenario) String() string { return proto.CompactTextString(m) } -func (*Scenario) ProtoMessage() {} -func (*Scenario) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{17} } +func (m *Scenario) Reset() { *m = Scenario{} } +func (m *Scenario) String() string { return proto.CompactTextString(m) } +func (*Scenario) ProtoMessage() {} +func (*Scenario) Descriptor() ([]byte, []int) { + return fileDescriptor_control_63d6a60a9ad7e299, []int{17} +} +func (m *Scenario) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Scenario.Unmarshal(m, b) +} +func (m *Scenario) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Scenario.Marshal(b, m, deterministic) +} +func (dst *Scenario) XXX_Merge(src proto.Message) { + xxx_messageInfo_Scenario.Merge(dst, src) +} +func (m *Scenario) XXX_Size() int { + return xxx_messageInfo_Scenario.Size(m) +} +func (m *Scenario) XXX_DiscardUnknown() { + xxx_messageInfo_Scenario.DiscardUnknown(m) +} + +var xxx_messageInfo_Scenario proto.InternalMessageInfo func (m *Scenario) GetName() string { if m != nil { @@ -1073,13 +1425,35 @@ func (m *Scenario) GetSpawnLocalWorkerCount() int32 { // A set of scenarios to be run with qps_json_driver type Scenarios struct { - Scenarios []*Scenario `protobuf:"bytes,1,rep,name=scenarios" json:"scenarios,omitempty"` + Scenarios []*Scenario `protobuf:"bytes,1,rep,name=scenarios,proto3" json:"scenarios,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Scenarios) Reset() { *m = Scenarios{} } +func (m *Scenarios) String() string { return proto.CompactTextString(m) } +func (*Scenarios) ProtoMessage() {} +func (*Scenarios) Descriptor() ([]byte, []int) { + return fileDescriptor_control_63d6a60a9ad7e299, []int{18} +} +func (m *Scenarios) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Scenarios.Unmarshal(m, b) +} +func (m *Scenarios) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Scenarios.Marshal(b, m, deterministic) +} +func (dst *Scenarios) XXX_Merge(src proto.Message) { + xxx_messageInfo_Scenarios.Merge(dst, src) +} +func (m *Scenarios) XXX_Size() int { + return xxx_messageInfo_Scenarios.Size(m) +} +func (m *Scenarios) XXX_DiscardUnknown() { + xxx_messageInfo_Scenarios.DiscardUnknown(m) } -func (m *Scenarios) Reset() { *m = Scenarios{} } -func (m *Scenarios) String() string { return proto.CompactTextString(m) } -func (*Scenarios) ProtoMessage() {} -func (*Scenarios) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{18} } +var xxx_messageInfo_Scenarios proto.InternalMessageInfo func (m *Scenarios) GetScenarios() []*Scenario { if m != nil { @@ -1113,9 +1487,9 @@ func init() { proto.RegisterEnum("grpc.testing.RpcType", RpcType_name, RpcType_value) } -func init() { proto.RegisterFile("control.proto", fileDescriptor0) } +func init() { proto.RegisterFile("control.proto", fileDescriptor_control_63d6a60a9ad7e299) } -var fileDescriptor0 = []byte{ +var fileDescriptor_control_63d6a60a9ad7e299 = []byte{ // 1179 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0x6f, 0x6f, 0xdb, 0xb6, 0x13, 0xb6, 0x1d, 0xdb, 0xb1, 0x4e, 0xb6, 0xe3, 0x1f, 0x7f, 0xe9, 0xa0, 0xa6, 0x69, 0x97, 0x6a, diff --git a/vendor/google.golang.org/grpc/benchmark/grpc_testing/messages.pb.go b/vendor/google.golang.org/grpc/benchmark/grpc_testing/messages.pb.go index b34c5d59a..9354eeaa0 100644 --- a/vendor/google.golang.org/grpc/benchmark/grpc_testing/messages.pb.go +++ b/vendor/google.golang.org/grpc/benchmark/grpc_testing/messages.pb.go @@ -12,6 +12,12 @@ var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + // The type of payload that should be returned. type PayloadType int32 @@ -38,7 +44,9 @@ var PayloadType_value = map[string]int32{ func (x PayloadType) String() string { return proto.EnumName(PayloadType_name, int32(x)) } -func (PayloadType) EnumDescriptor() ([]byte, []int) { return fileDescriptor1, []int{0} } +func (PayloadType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_messages_5c70222ad96bf232, []int{0} +} // Compression algorithms type CompressionType int32 @@ -64,20 +72,44 @@ var CompressionType_value = map[string]int32{ func (x CompressionType) String() string { return proto.EnumName(CompressionType_name, int32(x)) } -func (CompressionType) EnumDescriptor() ([]byte, []int) { return fileDescriptor1, []int{1} } +func (CompressionType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_messages_5c70222ad96bf232, []int{1} +} // A block of data, to simply increase gRPC message size. type Payload struct { // The type of data in body. - Type PayloadType `protobuf:"varint,1,opt,name=type,enum=grpc.testing.PayloadType" json:"type,omitempty"` + Type PayloadType `protobuf:"varint,1,opt,name=type,proto3,enum=grpc.testing.PayloadType" json:"type,omitempty"` // Primary contents of payload. - Body []byte `protobuf:"bytes,2,opt,name=body,proto3" json:"body,omitempty"` + Body []byte `protobuf:"bytes,2,opt,name=body,proto3" json:"body,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Payload) Reset() { *m = Payload{} } +func (m *Payload) String() string { return proto.CompactTextString(m) } +func (*Payload) ProtoMessage() {} +func (*Payload) Descriptor() ([]byte, []int) { + return fileDescriptor_messages_5c70222ad96bf232, []int{0} +} +func (m *Payload) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Payload.Unmarshal(m, b) +} +func (m *Payload) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Payload.Marshal(b, m, deterministic) +} +func (dst *Payload) XXX_Merge(src proto.Message) { + xxx_messageInfo_Payload.Merge(dst, src) +} +func (m *Payload) XXX_Size() int { + return xxx_messageInfo_Payload.Size(m) +} +func (m *Payload) XXX_DiscardUnknown() { + xxx_messageInfo_Payload.DiscardUnknown(m) } -func (m *Payload) Reset() { *m = Payload{} } -func (m *Payload) String() string { return proto.CompactTextString(m) } -func (*Payload) ProtoMessage() {} -func (*Payload) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{0} } +var xxx_messageInfo_Payload proto.InternalMessageInfo func (m *Payload) GetType() PayloadType { if m != nil { @@ -96,14 +128,36 @@ func (m *Payload) GetBody() []byte { // A protobuf representation for grpc status. This is used by test // clients to specify a status that the server should attempt to return. type EchoStatus struct { - Code int32 `protobuf:"varint,1,opt,name=code" json:"code,omitempty"` - Message string `protobuf:"bytes,2,opt,name=message" json:"message,omitempty"` + Code int32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"` + Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *EchoStatus) Reset() { *m = EchoStatus{} } -func (m *EchoStatus) String() string { return proto.CompactTextString(m) } -func (*EchoStatus) ProtoMessage() {} -func (*EchoStatus) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{1} } +func (m *EchoStatus) Reset() { *m = EchoStatus{} } +func (m *EchoStatus) String() string { return proto.CompactTextString(m) } +func (*EchoStatus) ProtoMessage() {} +func (*EchoStatus) Descriptor() ([]byte, []int) { + return fileDescriptor_messages_5c70222ad96bf232, []int{1} +} +func (m *EchoStatus) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_EchoStatus.Unmarshal(m, b) +} +func (m *EchoStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_EchoStatus.Marshal(b, m, deterministic) +} +func (dst *EchoStatus) XXX_Merge(src proto.Message) { + xxx_messageInfo_EchoStatus.Merge(dst, src) +} +func (m *EchoStatus) XXX_Size() int { + return xxx_messageInfo_EchoStatus.Size(m) +} +func (m *EchoStatus) XXX_DiscardUnknown() { + xxx_messageInfo_EchoStatus.DiscardUnknown(m) +} + +var xxx_messageInfo_EchoStatus proto.InternalMessageInfo func (m *EchoStatus) GetCode() int32 { if m != nil { @@ -123,26 +177,48 @@ func (m *EchoStatus) GetMessage() string { type SimpleRequest struct { // Desired payload type in the response from the server. // If response_type is RANDOM, server randomly chooses one from other formats. - ResponseType PayloadType `protobuf:"varint,1,opt,name=response_type,json=responseType,enum=grpc.testing.PayloadType" json:"response_type,omitempty"` + ResponseType PayloadType `protobuf:"varint,1,opt,name=response_type,json=responseType,proto3,enum=grpc.testing.PayloadType" json:"response_type,omitempty"` // Desired payload size in the response from the server. // If response_type is COMPRESSABLE, this denotes the size before compression. - ResponseSize int32 `protobuf:"varint,2,opt,name=response_size,json=responseSize" json:"response_size,omitempty"` + ResponseSize int32 `protobuf:"varint,2,opt,name=response_size,json=responseSize,proto3" json:"response_size,omitempty"` // Optional input payload sent along with the request. - Payload *Payload `protobuf:"bytes,3,opt,name=payload" json:"payload,omitempty"` + Payload *Payload `protobuf:"bytes,3,opt,name=payload,proto3" json:"payload,omitempty"` // Whether SimpleResponse should include username. - FillUsername bool `protobuf:"varint,4,opt,name=fill_username,json=fillUsername" json:"fill_username,omitempty"` + FillUsername bool `protobuf:"varint,4,opt,name=fill_username,json=fillUsername,proto3" json:"fill_username,omitempty"` // Whether SimpleResponse should include OAuth scope. - FillOauthScope bool `protobuf:"varint,5,opt,name=fill_oauth_scope,json=fillOauthScope" json:"fill_oauth_scope,omitempty"` + FillOauthScope bool `protobuf:"varint,5,opt,name=fill_oauth_scope,json=fillOauthScope,proto3" json:"fill_oauth_scope,omitempty"` // Compression algorithm to be used by the server for the response (stream) - ResponseCompression CompressionType `protobuf:"varint,6,opt,name=response_compression,json=responseCompression,enum=grpc.testing.CompressionType" json:"response_compression,omitempty"` + ResponseCompression CompressionType `protobuf:"varint,6,opt,name=response_compression,json=responseCompression,proto3,enum=grpc.testing.CompressionType" json:"response_compression,omitempty"` // Whether server should return a given status - ResponseStatus *EchoStatus `protobuf:"bytes,7,opt,name=response_status,json=responseStatus" json:"response_status,omitempty"` + ResponseStatus *EchoStatus `protobuf:"bytes,7,opt,name=response_status,json=responseStatus,proto3" json:"response_status,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SimpleRequest) Reset() { *m = SimpleRequest{} } +func (m *SimpleRequest) String() string { return proto.CompactTextString(m) } +func (*SimpleRequest) ProtoMessage() {} +func (*SimpleRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_messages_5c70222ad96bf232, []int{2} +} +func (m *SimpleRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SimpleRequest.Unmarshal(m, b) +} +func (m *SimpleRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SimpleRequest.Marshal(b, m, deterministic) +} +func (dst *SimpleRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_SimpleRequest.Merge(dst, src) +} +func (m *SimpleRequest) XXX_Size() int { + return xxx_messageInfo_SimpleRequest.Size(m) +} +func (m *SimpleRequest) XXX_DiscardUnknown() { + xxx_messageInfo_SimpleRequest.DiscardUnknown(m) } -func (m *SimpleRequest) Reset() { *m = SimpleRequest{} } -func (m *SimpleRequest) String() string { return proto.CompactTextString(m) } -func (*SimpleRequest) ProtoMessage() {} -func (*SimpleRequest) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{2} } +var xxx_messageInfo_SimpleRequest proto.InternalMessageInfo func (m *SimpleRequest) GetResponseType() PayloadType { if m != nil { @@ -196,18 +272,40 @@ func (m *SimpleRequest) GetResponseStatus() *EchoStatus { // Unary response, as configured by the request. type SimpleResponse struct { // Payload to increase message size. - Payload *Payload `protobuf:"bytes,1,opt,name=payload" json:"payload,omitempty"` + Payload *Payload `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"` // The user the request came from, for verifying authentication was // successful when the client expected it. - Username string `protobuf:"bytes,2,opt,name=username" json:"username,omitempty"` + Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"` // OAuth scope. - OauthScope string `protobuf:"bytes,3,opt,name=oauth_scope,json=oauthScope" json:"oauth_scope,omitempty"` + OauthScope string `protobuf:"bytes,3,opt,name=oauth_scope,json=oauthScope,proto3" json:"oauth_scope,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SimpleResponse) Reset() { *m = SimpleResponse{} } +func (m *SimpleResponse) String() string { return proto.CompactTextString(m) } +func (*SimpleResponse) ProtoMessage() {} +func (*SimpleResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_messages_5c70222ad96bf232, []int{3} +} +func (m *SimpleResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SimpleResponse.Unmarshal(m, b) +} +func (m *SimpleResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SimpleResponse.Marshal(b, m, deterministic) +} +func (dst *SimpleResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_SimpleResponse.Merge(dst, src) +} +func (m *SimpleResponse) XXX_Size() int { + return xxx_messageInfo_SimpleResponse.Size(m) +} +func (m *SimpleResponse) XXX_DiscardUnknown() { + xxx_messageInfo_SimpleResponse.DiscardUnknown(m) } -func (m *SimpleResponse) Reset() { *m = SimpleResponse{} } -func (m *SimpleResponse) String() string { return proto.CompactTextString(m) } -func (*SimpleResponse) ProtoMessage() {} -func (*SimpleResponse) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{3} } +var xxx_messageInfo_SimpleResponse proto.InternalMessageInfo func (m *SimpleResponse) GetPayload() *Payload { if m != nil { @@ -233,13 +331,35 @@ func (m *SimpleResponse) GetOauthScope() string { // Client-streaming request. type StreamingInputCallRequest struct { // Optional input payload sent along with the request. - Payload *Payload `protobuf:"bytes,1,opt,name=payload" json:"payload,omitempty"` + Payload *Payload `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StreamingInputCallRequest) Reset() { *m = StreamingInputCallRequest{} } +func (m *StreamingInputCallRequest) String() string { return proto.CompactTextString(m) } +func (*StreamingInputCallRequest) ProtoMessage() {} +func (*StreamingInputCallRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_messages_5c70222ad96bf232, []int{4} +} +func (m *StreamingInputCallRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_StreamingInputCallRequest.Unmarshal(m, b) +} +func (m *StreamingInputCallRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_StreamingInputCallRequest.Marshal(b, m, deterministic) +} +func (dst *StreamingInputCallRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_StreamingInputCallRequest.Merge(dst, src) +} +func (m *StreamingInputCallRequest) XXX_Size() int { + return xxx_messageInfo_StreamingInputCallRequest.Size(m) +} +func (m *StreamingInputCallRequest) XXX_DiscardUnknown() { + xxx_messageInfo_StreamingInputCallRequest.DiscardUnknown(m) } -func (m *StreamingInputCallRequest) Reset() { *m = StreamingInputCallRequest{} } -func (m *StreamingInputCallRequest) String() string { return proto.CompactTextString(m) } -func (*StreamingInputCallRequest) ProtoMessage() {} -func (*StreamingInputCallRequest) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{4} } +var xxx_messageInfo_StreamingInputCallRequest proto.InternalMessageInfo func (m *StreamingInputCallRequest) GetPayload() *Payload { if m != nil { @@ -251,13 +371,35 @@ func (m *StreamingInputCallRequest) GetPayload() *Payload { // Client-streaming response. type StreamingInputCallResponse struct { // Aggregated size of payloads received from the client. - AggregatedPayloadSize int32 `protobuf:"varint,1,opt,name=aggregated_payload_size,json=aggregatedPayloadSize" json:"aggregated_payload_size,omitempty"` + AggregatedPayloadSize int32 `protobuf:"varint,1,opt,name=aggregated_payload_size,json=aggregatedPayloadSize,proto3" json:"aggregated_payload_size,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StreamingInputCallResponse) Reset() { *m = StreamingInputCallResponse{} } +func (m *StreamingInputCallResponse) String() string { return proto.CompactTextString(m) } +func (*StreamingInputCallResponse) ProtoMessage() {} +func (*StreamingInputCallResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_messages_5c70222ad96bf232, []int{5} +} +func (m *StreamingInputCallResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_StreamingInputCallResponse.Unmarshal(m, b) +} +func (m *StreamingInputCallResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_StreamingInputCallResponse.Marshal(b, m, deterministic) +} +func (dst *StreamingInputCallResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_StreamingInputCallResponse.Merge(dst, src) +} +func (m *StreamingInputCallResponse) XXX_Size() int { + return xxx_messageInfo_StreamingInputCallResponse.Size(m) +} +func (m *StreamingInputCallResponse) XXX_DiscardUnknown() { + xxx_messageInfo_StreamingInputCallResponse.DiscardUnknown(m) } -func (m *StreamingInputCallResponse) Reset() { *m = StreamingInputCallResponse{} } -func (m *StreamingInputCallResponse) String() string { return proto.CompactTextString(m) } -func (*StreamingInputCallResponse) ProtoMessage() {} -func (*StreamingInputCallResponse) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{5} } +var xxx_messageInfo_StreamingInputCallResponse proto.InternalMessageInfo func (m *StreamingInputCallResponse) GetAggregatedPayloadSize() int32 { if m != nil { @@ -270,16 +412,38 @@ func (m *StreamingInputCallResponse) GetAggregatedPayloadSize() int32 { type ResponseParameters struct { // Desired payload sizes in responses from the server. // If response_type is COMPRESSABLE, this denotes the size before compression. - Size int32 `protobuf:"varint,1,opt,name=size" json:"size,omitempty"` + Size int32 `protobuf:"varint,1,opt,name=size,proto3" json:"size,omitempty"` // Desired interval between consecutive responses in the response stream in // microseconds. - IntervalUs int32 `protobuf:"varint,2,opt,name=interval_us,json=intervalUs" json:"interval_us,omitempty"` + IntervalUs int32 `protobuf:"varint,2,opt,name=interval_us,json=intervalUs,proto3" json:"interval_us,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ResponseParameters) Reset() { *m = ResponseParameters{} } +func (m *ResponseParameters) String() string { return proto.CompactTextString(m) } +func (*ResponseParameters) ProtoMessage() {} +func (*ResponseParameters) Descriptor() ([]byte, []int) { + return fileDescriptor_messages_5c70222ad96bf232, []int{6} +} +func (m *ResponseParameters) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ResponseParameters.Unmarshal(m, b) +} +func (m *ResponseParameters) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ResponseParameters.Marshal(b, m, deterministic) +} +func (dst *ResponseParameters) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResponseParameters.Merge(dst, src) +} +func (m *ResponseParameters) XXX_Size() int { + return xxx_messageInfo_ResponseParameters.Size(m) +} +func (m *ResponseParameters) XXX_DiscardUnknown() { + xxx_messageInfo_ResponseParameters.DiscardUnknown(m) } -func (m *ResponseParameters) Reset() { *m = ResponseParameters{} } -func (m *ResponseParameters) String() string { return proto.CompactTextString(m) } -func (*ResponseParameters) ProtoMessage() {} -func (*ResponseParameters) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{6} } +var xxx_messageInfo_ResponseParameters proto.InternalMessageInfo func (m *ResponseParameters) GetSize() int32 { if m != nil { @@ -301,21 +465,43 @@ type StreamingOutputCallRequest struct { // If response_type is RANDOM, the payload from each response in the stream // might be of different types. This is to simulate a mixed type of payload // stream. - ResponseType PayloadType `protobuf:"varint,1,opt,name=response_type,json=responseType,enum=grpc.testing.PayloadType" json:"response_type,omitempty"` + ResponseType PayloadType `protobuf:"varint,1,opt,name=response_type,json=responseType,proto3,enum=grpc.testing.PayloadType" json:"response_type,omitempty"` // Configuration for each expected response message. - ResponseParameters []*ResponseParameters `protobuf:"bytes,2,rep,name=response_parameters,json=responseParameters" json:"response_parameters,omitempty"` + ResponseParameters []*ResponseParameters `protobuf:"bytes,2,rep,name=response_parameters,json=responseParameters,proto3" json:"response_parameters,omitempty"` // Optional input payload sent along with the request. - Payload *Payload `protobuf:"bytes,3,opt,name=payload" json:"payload,omitempty"` + Payload *Payload `protobuf:"bytes,3,opt,name=payload,proto3" json:"payload,omitempty"` // Compression algorithm to be used by the server for the response (stream) - ResponseCompression CompressionType `protobuf:"varint,6,opt,name=response_compression,json=responseCompression,enum=grpc.testing.CompressionType" json:"response_compression,omitempty"` + ResponseCompression CompressionType `protobuf:"varint,6,opt,name=response_compression,json=responseCompression,proto3,enum=grpc.testing.CompressionType" json:"response_compression,omitempty"` // Whether server should return a given status - ResponseStatus *EchoStatus `protobuf:"bytes,7,opt,name=response_status,json=responseStatus" json:"response_status,omitempty"` + ResponseStatus *EchoStatus `protobuf:"bytes,7,opt,name=response_status,json=responseStatus,proto3" json:"response_status,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StreamingOutputCallRequest) Reset() { *m = StreamingOutputCallRequest{} } +func (m *StreamingOutputCallRequest) String() string { return proto.CompactTextString(m) } +func (*StreamingOutputCallRequest) ProtoMessage() {} +func (*StreamingOutputCallRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_messages_5c70222ad96bf232, []int{7} +} +func (m *StreamingOutputCallRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_StreamingOutputCallRequest.Unmarshal(m, b) +} +func (m *StreamingOutputCallRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_StreamingOutputCallRequest.Marshal(b, m, deterministic) +} +func (dst *StreamingOutputCallRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_StreamingOutputCallRequest.Merge(dst, src) +} +func (m *StreamingOutputCallRequest) XXX_Size() int { + return xxx_messageInfo_StreamingOutputCallRequest.Size(m) +} +func (m *StreamingOutputCallRequest) XXX_DiscardUnknown() { + xxx_messageInfo_StreamingOutputCallRequest.DiscardUnknown(m) } -func (m *StreamingOutputCallRequest) Reset() { *m = StreamingOutputCallRequest{} } -func (m *StreamingOutputCallRequest) String() string { return proto.CompactTextString(m) } -func (*StreamingOutputCallRequest) ProtoMessage() {} -func (*StreamingOutputCallRequest) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{7} } +var xxx_messageInfo_StreamingOutputCallRequest proto.InternalMessageInfo func (m *StreamingOutputCallRequest) GetResponseType() PayloadType { if m != nil { @@ -355,13 +541,35 @@ func (m *StreamingOutputCallRequest) GetResponseStatus() *EchoStatus { // Server-streaming response, as configured by the request and parameters. type StreamingOutputCallResponse struct { // Payload to increase response size. - Payload *Payload `protobuf:"bytes,1,opt,name=payload" json:"payload,omitempty"` + Payload *Payload `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StreamingOutputCallResponse) Reset() { *m = StreamingOutputCallResponse{} } +func (m *StreamingOutputCallResponse) String() string { return proto.CompactTextString(m) } +func (*StreamingOutputCallResponse) ProtoMessage() {} +func (*StreamingOutputCallResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_messages_5c70222ad96bf232, []int{8} +} +func (m *StreamingOutputCallResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_StreamingOutputCallResponse.Unmarshal(m, b) +} +func (m *StreamingOutputCallResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_StreamingOutputCallResponse.Marshal(b, m, deterministic) +} +func (dst *StreamingOutputCallResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_StreamingOutputCallResponse.Merge(dst, src) +} +func (m *StreamingOutputCallResponse) XXX_Size() int { + return xxx_messageInfo_StreamingOutputCallResponse.Size(m) +} +func (m *StreamingOutputCallResponse) XXX_DiscardUnknown() { + xxx_messageInfo_StreamingOutputCallResponse.DiscardUnknown(m) } -func (m *StreamingOutputCallResponse) Reset() { *m = StreamingOutputCallResponse{} } -func (m *StreamingOutputCallResponse) String() string { return proto.CompactTextString(m) } -func (*StreamingOutputCallResponse) ProtoMessage() {} -func (*StreamingOutputCallResponse) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{8} } +var xxx_messageInfo_StreamingOutputCallResponse proto.InternalMessageInfo func (m *StreamingOutputCallResponse) GetPayload() *Payload { if m != nil { @@ -373,13 +581,35 @@ func (m *StreamingOutputCallResponse) GetPayload() *Payload { // For reconnect interop test only. // Client tells server what reconnection parameters it used. type ReconnectParams struct { - MaxReconnectBackoffMs int32 `protobuf:"varint,1,opt,name=max_reconnect_backoff_ms,json=maxReconnectBackoffMs" json:"max_reconnect_backoff_ms,omitempty"` + MaxReconnectBackoffMs int32 `protobuf:"varint,1,opt,name=max_reconnect_backoff_ms,json=maxReconnectBackoffMs,proto3" json:"max_reconnect_backoff_ms,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ReconnectParams) Reset() { *m = ReconnectParams{} } +func (m *ReconnectParams) String() string { return proto.CompactTextString(m) } +func (*ReconnectParams) ProtoMessage() {} +func (*ReconnectParams) Descriptor() ([]byte, []int) { + return fileDescriptor_messages_5c70222ad96bf232, []int{9} +} +func (m *ReconnectParams) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ReconnectParams.Unmarshal(m, b) +} +func (m *ReconnectParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ReconnectParams.Marshal(b, m, deterministic) +} +func (dst *ReconnectParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_ReconnectParams.Merge(dst, src) +} +func (m *ReconnectParams) XXX_Size() int { + return xxx_messageInfo_ReconnectParams.Size(m) +} +func (m *ReconnectParams) XXX_DiscardUnknown() { + xxx_messageInfo_ReconnectParams.DiscardUnknown(m) } -func (m *ReconnectParams) Reset() { *m = ReconnectParams{} } -func (m *ReconnectParams) String() string { return proto.CompactTextString(m) } -func (*ReconnectParams) ProtoMessage() {} -func (*ReconnectParams) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{9} } +var xxx_messageInfo_ReconnectParams proto.InternalMessageInfo func (m *ReconnectParams) GetMaxReconnectBackoffMs() int32 { if m != nil { @@ -392,14 +622,36 @@ func (m *ReconnectParams) GetMaxReconnectBackoffMs() int32 { // Server tells client whether its reconnects are following the spec and the // reconnect backoffs it saw. type ReconnectInfo struct { - Passed bool `protobuf:"varint,1,opt,name=passed" json:"passed,omitempty"` - BackoffMs []int32 `protobuf:"varint,2,rep,packed,name=backoff_ms,json=backoffMs" json:"backoff_ms,omitempty"` + Passed bool `protobuf:"varint,1,opt,name=passed,proto3" json:"passed,omitempty"` + BackoffMs []int32 `protobuf:"varint,2,rep,packed,name=backoff_ms,json=backoffMs,proto3" json:"backoff_ms,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ReconnectInfo) Reset() { *m = ReconnectInfo{} } +func (m *ReconnectInfo) String() string { return proto.CompactTextString(m) } +func (*ReconnectInfo) ProtoMessage() {} +func (*ReconnectInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_messages_5c70222ad96bf232, []int{10} +} +func (m *ReconnectInfo) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ReconnectInfo.Unmarshal(m, b) +} +func (m *ReconnectInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ReconnectInfo.Marshal(b, m, deterministic) +} +func (dst *ReconnectInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_ReconnectInfo.Merge(dst, src) +} +func (m *ReconnectInfo) XXX_Size() int { + return xxx_messageInfo_ReconnectInfo.Size(m) +} +func (m *ReconnectInfo) XXX_DiscardUnknown() { + xxx_messageInfo_ReconnectInfo.DiscardUnknown(m) } -func (m *ReconnectInfo) Reset() { *m = ReconnectInfo{} } -func (m *ReconnectInfo) String() string { return proto.CompactTextString(m) } -func (*ReconnectInfo) ProtoMessage() {} -func (*ReconnectInfo) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{10} } +var xxx_messageInfo_ReconnectInfo proto.InternalMessageInfo func (m *ReconnectInfo) GetPassed() bool { if m != nil { @@ -431,9 +683,9 @@ func init() { proto.RegisterEnum("grpc.testing.CompressionType", CompressionType_name, CompressionType_value) } -func init() { proto.RegisterFile("messages.proto", fileDescriptor1) } +func init() { proto.RegisterFile("messages.proto", fileDescriptor_messages_5c70222ad96bf232) } -var fileDescriptor1 = []byte{ +var fileDescriptor_messages_5c70222ad96bf232 = []byte{ // 652 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x55, 0x4d, 0x6f, 0xd3, 0x40, 0x10, 0xc5, 0xf9, 0xee, 0x24, 0x4d, 0xa3, 0x85, 0x82, 0x5b, 0x54, 0x11, 0x99, 0x4b, 0x54, 0x89, diff --git a/vendor/google.golang.org/grpc/benchmark/grpc_testing/payloads.pb.go b/vendor/google.golang.org/grpc/benchmark/grpc_testing/payloads.pb.go index d70d1f745..1882fe7e2 100644 --- a/vendor/google.golang.org/grpc/benchmark/grpc_testing/payloads.pb.go +++ b/vendor/google.golang.org/grpc/benchmark/grpc_testing/payloads.pb.go @@ -12,15 +12,43 @@ var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + type ByteBufferParams struct { - ReqSize int32 `protobuf:"varint,1,opt,name=req_size,json=reqSize" json:"req_size,omitempty"` - RespSize int32 `protobuf:"varint,2,opt,name=resp_size,json=respSize" json:"resp_size,omitempty"` + ReqSize int32 `protobuf:"varint,1,opt,name=req_size,json=reqSize,proto3" json:"req_size,omitempty"` + RespSize int32 `protobuf:"varint,2,opt,name=resp_size,json=respSize,proto3" json:"resp_size,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ByteBufferParams) Reset() { *m = ByteBufferParams{} } +func (m *ByteBufferParams) String() string { return proto.CompactTextString(m) } +func (*ByteBufferParams) ProtoMessage() {} +func (*ByteBufferParams) Descriptor() ([]byte, []int) { + return fileDescriptor_payloads_3abc71de35f06c83, []int{0} +} +func (m *ByteBufferParams) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ByteBufferParams.Unmarshal(m, b) +} +func (m *ByteBufferParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ByteBufferParams.Marshal(b, m, deterministic) +} +func (dst *ByteBufferParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_ByteBufferParams.Merge(dst, src) +} +func (m *ByteBufferParams) XXX_Size() int { + return xxx_messageInfo_ByteBufferParams.Size(m) +} +func (m *ByteBufferParams) XXX_DiscardUnknown() { + xxx_messageInfo_ByteBufferParams.DiscardUnknown(m) } -func (m *ByteBufferParams) Reset() { *m = ByteBufferParams{} } -func (m *ByteBufferParams) String() string { return proto.CompactTextString(m) } -func (*ByteBufferParams) ProtoMessage() {} -func (*ByteBufferParams) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{0} } +var xxx_messageInfo_ByteBufferParams proto.InternalMessageInfo func (m *ByteBufferParams) GetReqSize() int32 { if m != nil { @@ -37,14 +65,36 @@ func (m *ByteBufferParams) GetRespSize() int32 { } type SimpleProtoParams struct { - ReqSize int32 `protobuf:"varint,1,opt,name=req_size,json=reqSize" json:"req_size,omitempty"` - RespSize int32 `protobuf:"varint,2,opt,name=resp_size,json=respSize" json:"resp_size,omitempty"` + ReqSize int32 `protobuf:"varint,1,opt,name=req_size,json=reqSize,proto3" json:"req_size,omitempty"` + RespSize int32 `protobuf:"varint,2,opt,name=resp_size,json=respSize,proto3" json:"resp_size,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SimpleProtoParams) Reset() { *m = SimpleProtoParams{} } +func (m *SimpleProtoParams) String() string { return proto.CompactTextString(m) } +func (*SimpleProtoParams) ProtoMessage() {} +func (*SimpleProtoParams) Descriptor() ([]byte, []int) { + return fileDescriptor_payloads_3abc71de35f06c83, []int{1} +} +func (m *SimpleProtoParams) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SimpleProtoParams.Unmarshal(m, b) +} +func (m *SimpleProtoParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SimpleProtoParams.Marshal(b, m, deterministic) +} +func (dst *SimpleProtoParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_SimpleProtoParams.Merge(dst, src) +} +func (m *SimpleProtoParams) XXX_Size() int { + return xxx_messageInfo_SimpleProtoParams.Size(m) +} +func (m *SimpleProtoParams) XXX_DiscardUnknown() { + xxx_messageInfo_SimpleProtoParams.DiscardUnknown(m) } -func (m *SimpleProtoParams) Reset() { *m = SimpleProtoParams{} } -func (m *SimpleProtoParams) String() string { return proto.CompactTextString(m) } -func (*SimpleProtoParams) ProtoMessage() {} -func (*SimpleProtoParams) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{1} } +var xxx_messageInfo_SimpleProtoParams proto.InternalMessageInfo func (m *SimpleProtoParams) GetReqSize() int32 { if m != nil { @@ -61,38 +111,82 @@ func (m *SimpleProtoParams) GetRespSize() int32 { } type ComplexProtoParams struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *ComplexProtoParams) Reset() { *m = ComplexProtoParams{} } -func (m *ComplexProtoParams) String() string { return proto.CompactTextString(m) } -func (*ComplexProtoParams) ProtoMessage() {} -func (*ComplexProtoParams) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{2} } +func (m *ComplexProtoParams) Reset() { *m = ComplexProtoParams{} } +func (m *ComplexProtoParams) String() string { return proto.CompactTextString(m) } +func (*ComplexProtoParams) ProtoMessage() {} +func (*ComplexProtoParams) Descriptor() ([]byte, []int) { + return fileDescriptor_payloads_3abc71de35f06c83, []int{2} +} +func (m *ComplexProtoParams) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ComplexProtoParams.Unmarshal(m, b) +} +func (m *ComplexProtoParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ComplexProtoParams.Marshal(b, m, deterministic) +} +func (dst *ComplexProtoParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_ComplexProtoParams.Merge(dst, src) +} +func (m *ComplexProtoParams) XXX_Size() int { + return xxx_messageInfo_ComplexProtoParams.Size(m) +} +func (m *ComplexProtoParams) XXX_DiscardUnknown() { + xxx_messageInfo_ComplexProtoParams.DiscardUnknown(m) +} + +var xxx_messageInfo_ComplexProtoParams proto.InternalMessageInfo type PayloadConfig struct { // Types that are valid to be assigned to Payload: // *PayloadConfig_BytebufParams // *PayloadConfig_SimpleParams // *PayloadConfig_ComplexParams - Payload isPayloadConfig_Payload `protobuf_oneof:"payload"` + Payload isPayloadConfig_Payload `protobuf_oneof:"payload"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PayloadConfig) Reset() { *m = PayloadConfig{} } +func (m *PayloadConfig) String() string { return proto.CompactTextString(m) } +func (*PayloadConfig) ProtoMessage() {} +func (*PayloadConfig) Descriptor() ([]byte, []int) { + return fileDescriptor_payloads_3abc71de35f06c83, []int{3} +} +func (m *PayloadConfig) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_PayloadConfig.Unmarshal(m, b) +} +func (m *PayloadConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_PayloadConfig.Marshal(b, m, deterministic) +} +func (dst *PayloadConfig) XXX_Merge(src proto.Message) { + xxx_messageInfo_PayloadConfig.Merge(dst, src) +} +func (m *PayloadConfig) XXX_Size() int { + return xxx_messageInfo_PayloadConfig.Size(m) +} +func (m *PayloadConfig) XXX_DiscardUnknown() { + xxx_messageInfo_PayloadConfig.DiscardUnknown(m) } -func (m *PayloadConfig) Reset() { *m = PayloadConfig{} } -func (m *PayloadConfig) String() string { return proto.CompactTextString(m) } -func (*PayloadConfig) ProtoMessage() {} -func (*PayloadConfig) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{3} } +var xxx_messageInfo_PayloadConfig proto.InternalMessageInfo type isPayloadConfig_Payload interface { isPayloadConfig_Payload() } type PayloadConfig_BytebufParams struct { - BytebufParams *ByteBufferParams `protobuf:"bytes,1,opt,name=bytebuf_params,json=bytebufParams,oneof"` + BytebufParams *ByteBufferParams `protobuf:"bytes,1,opt,name=bytebuf_params,json=bytebufParams,proto3,oneof"` } type PayloadConfig_SimpleParams struct { - SimpleParams *SimpleProtoParams `protobuf:"bytes,2,opt,name=simple_params,json=simpleParams,oneof"` + SimpleParams *SimpleProtoParams `protobuf:"bytes,2,opt,name=simple_params,json=simpleParams,proto3,oneof"` } type PayloadConfig_ComplexParams struct { - ComplexParams *ComplexProtoParams `protobuf:"bytes,3,opt,name=complex_params,json=complexParams,oneof"` + ComplexParams *ComplexProtoParams `protobuf:"bytes,3,opt,name=complex_params,json=complexParams,proto3,oneof"` } func (*PayloadConfig_BytebufParams) isPayloadConfig_Payload() {} @@ -200,17 +294,17 @@ func _PayloadConfig_OneofSizer(msg proto.Message) (n int) { switch x := m.Payload.(type) { case *PayloadConfig_BytebufParams: s := proto.Size(x.BytebufParams) - n += proto.SizeVarint(1<<3 | proto.WireBytes) + n += 1 // tag and wire n += proto.SizeVarint(uint64(s)) n += s case *PayloadConfig_SimpleParams: s := proto.Size(x.SimpleParams) - n += proto.SizeVarint(2<<3 | proto.WireBytes) + n += 1 // tag and wire n += proto.SizeVarint(uint64(s)) n += s case *PayloadConfig_ComplexParams: s := proto.Size(x.ComplexParams) - n += proto.SizeVarint(3<<3 | proto.WireBytes) + n += 1 // tag and wire n += proto.SizeVarint(uint64(s)) n += s case nil: @@ -227,9 +321,9 @@ func init() { proto.RegisterType((*PayloadConfig)(nil), "grpc.testing.PayloadConfig") } -func init() { proto.RegisterFile("payloads.proto", fileDescriptor2) } +func init() { proto.RegisterFile("payloads.proto", fileDescriptor_payloads_3abc71de35f06c83) } -var fileDescriptor2 = []byte{ +var fileDescriptor_payloads_3abc71de35f06c83 = []byte{ // 254 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x2b, 0x48, 0xac, 0xcc, 0xc9, 0x4f, 0x4c, 0x29, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x49, 0x2f, 0x2a, 0x48, diff --git a/vendor/google.golang.org/grpc/benchmark/grpc_testing/services.pb.go b/vendor/google.golang.org/grpc/benchmark/grpc_testing/services.pb.go index 50e350595..5156ae733 100644 --- a/vendor/google.golang.org/grpc/benchmark/grpc_testing/services.pb.go +++ b/vendor/google.golang.org/grpc/benchmark/grpc_testing/services.pb.go @@ -17,6 +17,12 @@ var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + // Reference imports to suppress errors if they are not otherwise used. var _ context.Context var _ grpc.ClientConn @@ -25,8 +31,9 @@ var _ grpc.ClientConn // is compatible with the grpc package it is being compiled against. const _ = grpc.SupportPackageIsVersion4 -// Client API for BenchmarkService service - +// BenchmarkServiceClient is the client API for BenchmarkService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type BenchmarkServiceClient interface { // One request followed by one response. // The server returns the client payload as-is. @@ -46,7 +53,7 @@ func NewBenchmarkServiceClient(cc *grpc.ClientConn) BenchmarkServiceClient { func (c *benchmarkServiceClient) UnaryCall(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (*SimpleResponse, error) { out := new(SimpleResponse) - err := grpc.Invoke(ctx, "/grpc.testing.BenchmarkService/UnaryCall", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/grpc.testing.BenchmarkService/UnaryCall", in, out, opts...) if err != nil { return nil, err } @@ -54,7 +61,7 @@ func (c *benchmarkServiceClient) UnaryCall(ctx context.Context, in *SimpleReques } func (c *benchmarkServiceClient) StreamingCall(ctx context.Context, opts ...grpc.CallOption) (BenchmarkService_StreamingCallClient, error) { - stream, err := grpc.NewClientStream(ctx, &_BenchmarkService_serviceDesc.Streams[0], c.cc, "/grpc.testing.BenchmarkService/StreamingCall", opts...) + stream, err := c.cc.NewStream(ctx, &_BenchmarkService_serviceDesc.Streams[0], "/grpc.testing.BenchmarkService/StreamingCall", opts...) if err != nil { return nil, err } @@ -84,8 +91,7 @@ func (x *benchmarkServiceStreamingCallClient) Recv() (*SimpleResponse, error) { return m, nil } -// Server API for BenchmarkService service - +// BenchmarkServiceServer is the server API for BenchmarkService service. type BenchmarkServiceServer interface { // One request followed by one response. // The server returns the client payload as-is. @@ -163,8 +169,9 @@ var _BenchmarkService_serviceDesc = grpc.ServiceDesc{ Metadata: "services.proto", } -// Client API for WorkerService service - +// WorkerServiceClient is the client API for WorkerService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type WorkerServiceClient interface { // Start server with specified workload. // First request sent specifies the ServerConfig followed by ServerStatus @@ -195,7 +202,7 @@ func NewWorkerServiceClient(cc *grpc.ClientConn) WorkerServiceClient { } func (c *workerServiceClient) RunServer(ctx context.Context, opts ...grpc.CallOption) (WorkerService_RunServerClient, error) { - stream, err := grpc.NewClientStream(ctx, &_WorkerService_serviceDesc.Streams[0], c.cc, "/grpc.testing.WorkerService/RunServer", opts...) + stream, err := c.cc.NewStream(ctx, &_WorkerService_serviceDesc.Streams[0], "/grpc.testing.WorkerService/RunServer", opts...) if err != nil { return nil, err } @@ -226,7 +233,7 @@ func (x *workerServiceRunServerClient) Recv() (*ServerStatus, error) { } func (c *workerServiceClient) RunClient(ctx context.Context, opts ...grpc.CallOption) (WorkerService_RunClientClient, error) { - stream, err := grpc.NewClientStream(ctx, &_WorkerService_serviceDesc.Streams[1], c.cc, "/grpc.testing.WorkerService/RunClient", opts...) + stream, err := c.cc.NewStream(ctx, &_WorkerService_serviceDesc.Streams[1], "/grpc.testing.WorkerService/RunClient", opts...) if err != nil { return nil, err } @@ -258,7 +265,7 @@ func (x *workerServiceRunClientClient) Recv() (*ClientStatus, error) { func (c *workerServiceClient) CoreCount(ctx context.Context, in *CoreRequest, opts ...grpc.CallOption) (*CoreResponse, error) { out := new(CoreResponse) - err := grpc.Invoke(ctx, "/grpc.testing.WorkerService/CoreCount", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/grpc.testing.WorkerService/CoreCount", in, out, opts...) if err != nil { return nil, err } @@ -267,15 +274,14 @@ func (c *workerServiceClient) CoreCount(ctx context.Context, in *CoreRequest, op func (c *workerServiceClient) QuitWorker(ctx context.Context, in *Void, opts ...grpc.CallOption) (*Void, error) { out := new(Void) - err := grpc.Invoke(ctx, "/grpc.testing.WorkerService/QuitWorker", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/grpc.testing.WorkerService/QuitWorker", in, out, opts...) if err != nil { return nil, err } return out, nil } -// Server API for WorkerService service - +// WorkerServiceServer is the server API for WorkerService service. type WorkerServiceServer interface { // Start server with specified workload. // First request sent specifies the ServerConfig followed by ServerStatus @@ -419,9 +425,9 @@ var _WorkerService_serviceDesc = grpc.ServiceDesc{ Metadata: "services.proto", } -func init() { proto.RegisterFile("services.proto", fileDescriptor3) } +func init() { proto.RegisterFile("services.proto", fileDescriptor_services_bf68f4d7cbd0e0a1) } -var fileDescriptor3 = []byte{ +var fileDescriptor_services_bf68f4d7cbd0e0a1 = []byte{ // 255 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x91, 0xc1, 0x4a, 0xc4, 0x30, 0x10, 0x86, 0xa9, 0x07, 0xa1, 0xc1, 0x2e, 0x92, 0x93, 0x46, 0x1f, 0xc0, 0x53, 0x91, 0xd5, 0x17, diff --git a/vendor/google.golang.org/grpc/benchmark/grpc_testing/stats.pb.go b/vendor/google.golang.org/grpc/benchmark/grpc_testing/stats.pb.go index d69cb7410..abc2aea76 100644 --- a/vendor/google.golang.org/grpc/benchmark/grpc_testing/stats.pb.go +++ b/vendor/google.golang.org/grpc/benchmark/grpc_testing/stats.pb.go @@ -12,20 +12,48 @@ var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + type ServerStats struct { // wall clock time change in seconds since last reset - TimeElapsed float64 `protobuf:"fixed64,1,opt,name=time_elapsed,json=timeElapsed" json:"time_elapsed,omitempty"` + TimeElapsed float64 `protobuf:"fixed64,1,opt,name=time_elapsed,json=timeElapsed,proto3" json:"time_elapsed,omitempty"` // change in user time (in seconds) used by the server since last reset - TimeUser float64 `protobuf:"fixed64,2,opt,name=time_user,json=timeUser" json:"time_user,omitempty"` + TimeUser float64 `protobuf:"fixed64,2,opt,name=time_user,json=timeUser,proto3" json:"time_user,omitempty"` // change in server time (in seconds) used by the server process and all // threads since last reset - TimeSystem float64 `protobuf:"fixed64,3,opt,name=time_system,json=timeSystem" json:"time_system,omitempty"` + TimeSystem float64 `protobuf:"fixed64,3,opt,name=time_system,json=timeSystem,proto3" json:"time_system,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ServerStats) Reset() { *m = ServerStats{} } +func (m *ServerStats) String() string { return proto.CompactTextString(m) } +func (*ServerStats) ProtoMessage() {} +func (*ServerStats) Descriptor() ([]byte, []int) { + return fileDescriptor_stats_8ba831c0cb3c3440, []int{0} +} +func (m *ServerStats) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ServerStats.Unmarshal(m, b) +} +func (m *ServerStats) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ServerStats.Marshal(b, m, deterministic) +} +func (dst *ServerStats) XXX_Merge(src proto.Message) { + xxx_messageInfo_ServerStats.Merge(dst, src) +} +func (m *ServerStats) XXX_Size() int { + return xxx_messageInfo_ServerStats.Size(m) +} +func (m *ServerStats) XXX_DiscardUnknown() { + xxx_messageInfo_ServerStats.DiscardUnknown(m) } -func (m *ServerStats) Reset() { *m = ServerStats{} } -func (m *ServerStats) String() string { return proto.CompactTextString(m) } -func (*ServerStats) ProtoMessage() {} -func (*ServerStats) Descriptor() ([]byte, []int) { return fileDescriptor4, []int{0} } +var xxx_messageInfo_ServerStats proto.InternalMessageInfo func (m *ServerStats) GetTimeElapsed() float64 { if m != nil { @@ -50,14 +78,36 @@ func (m *ServerStats) GetTimeSystem() float64 { // Histogram params based on grpc/support/histogram.c type HistogramParams struct { - Resolution float64 `protobuf:"fixed64,1,opt,name=resolution" json:"resolution,omitempty"` - MaxPossible float64 `protobuf:"fixed64,2,opt,name=max_possible,json=maxPossible" json:"max_possible,omitempty"` + Resolution float64 `protobuf:"fixed64,1,opt,name=resolution,proto3" json:"resolution,omitempty"` + MaxPossible float64 `protobuf:"fixed64,2,opt,name=max_possible,json=maxPossible,proto3" json:"max_possible,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HistogramParams) Reset() { *m = HistogramParams{} } +func (m *HistogramParams) String() string { return proto.CompactTextString(m) } +func (*HistogramParams) ProtoMessage() {} +func (*HistogramParams) Descriptor() ([]byte, []int) { + return fileDescriptor_stats_8ba831c0cb3c3440, []int{1} +} +func (m *HistogramParams) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_HistogramParams.Unmarshal(m, b) +} +func (m *HistogramParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_HistogramParams.Marshal(b, m, deterministic) +} +func (dst *HistogramParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_HistogramParams.Merge(dst, src) +} +func (m *HistogramParams) XXX_Size() int { + return xxx_messageInfo_HistogramParams.Size(m) +} +func (m *HistogramParams) XXX_DiscardUnknown() { + xxx_messageInfo_HistogramParams.DiscardUnknown(m) } -func (m *HistogramParams) Reset() { *m = HistogramParams{} } -func (m *HistogramParams) String() string { return proto.CompactTextString(m) } -func (*HistogramParams) ProtoMessage() {} -func (*HistogramParams) Descriptor() ([]byte, []int) { return fileDescriptor4, []int{1} } +var xxx_messageInfo_HistogramParams proto.InternalMessageInfo func (m *HistogramParams) GetResolution() float64 { if m != nil { @@ -75,18 +125,40 @@ func (m *HistogramParams) GetMaxPossible() float64 { // Histogram data based on grpc/support/histogram.c type HistogramData struct { - Bucket []uint32 `protobuf:"varint,1,rep,packed,name=bucket" json:"bucket,omitempty"` - MinSeen float64 `protobuf:"fixed64,2,opt,name=min_seen,json=minSeen" json:"min_seen,omitempty"` - MaxSeen float64 `protobuf:"fixed64,3,opt,name=max_seen,json=maxSeen" json:"max_seen,omitempty"` - Sum float64 `protobuf:"fixed64,4,opt,name=sum" json:"sum,omitempty"` - SumOfSquares float64 `protobuf:"fixed64,5,opt,name=sum_of_squares,json=sumOfSquares" json:"sum_of_squares,omitempty"` - Count float64 `protobuf:"fixed64,6,opt,name=count" json:"count,omitempty"` + Bucket []uint32 `protobuf:"varint,1,rep,packed,name=bucket,proto3" json:"bucket,omitempty"` + MinSeen float64 `protobuf:"fixed64,2,opt,name=min_seen,json=minSeen,proto3" json:"min_seen,omitempty"` + MaxSeen float64 `protobuf:"fixed64,3,opt,name=max_seen,json=maxSeen,proto3" json:"max_seen,omitempty"` + Sum float64 `protobuf:"fixed64,4,opt,name=sum,proto3" json:"sum,omitempty"` + SumOfSquares float64 `protobuf:"fixed64,5,opt,name=sum_of_squares,json=sumOfSquares,proto3" json:"sum_of_squares,omitempty"` + Count float64 `protobuf:"fixed64,6,opt,name=count,proto3" json:"count,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *HistogramData) Reset() { *m = HistogramData{} } -func (m *HistogramData) String() string { return proto.CompactTextString(m) } -func (*HistogramData) ProtoMessage() {} -func (*HistogramData) Descriptor() ([]byte, []int) { return fileDescriptor4, []int{2} } +func (m *HistogramData) Reset() { *m = HistogramData{} } +func (m *HistogramData) String() string { return proto.CompactTextString(m) } +func (*HistogramData) ProtoMessage() {} +func (*HistogramData) Descriptor() ([]byte, []int) { + return fileDescriptor_stats_8ba831c0cb3c3440, []int{2} +} +func (m *HistogramData) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_HistogramData.Unmarshal(m, b) +} +func (m *HistogramData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_HistogramData.Marshal(b, m, deterministic) +} +func (dst *HistogramData) XXX_Merge(src proto.Message) { + xxx_messageInfo_HistogramData.Merge(dst, src) +} +func (m *HistogramData) XXX_Size() int { + return xxx_messageInfo_HistogramData.Size(m) +} +func (m *HistogramData) XXX_DiscardUnknown() { + xxx_messageInfo_HistogramData.DiscardUnknown(m) +} + +var xxx_messageInfo_HistogramData proto.InternalMessageInfo func (m *HistogramData) GetBucket() []uint32 { if m != nil { @@ -132,17 +204,39 @@ func (m *HistogramData) GetCount() float64 { type ClientStats struct { // Latency histogram. Data points are in nanoseconds. - Latencies *HistogramData `protobuf:"bytes,1,opt,name=latencies" json:"latencies,omitempty"` + Latencies *HistogramData `protobuf:"bytes,1,opt,name=latencies,proto3" json:"latencies,omitempty"` // See ServerStats for details. - TimeElapsed float64 `protobuf:"fixed64,2,opt,name=time_elapsed,json=timeElapsed" json:"time_elapsed,omitempty"` - TimeUser float64 `protobuf:"fixed64,3,opt,name=time_user,json=timeUser" json:"time_user,omitempty"` - TimeSystem float64 `protobuf:"fixed64,4,opt,name=time_system,json=timeSystem" json:"time_system,omitempty"` + TimeElapsed float64 `protobuf:"fixed64,2,opt,name=time_elapsed,json=timeElapsed,proto3" json:"time_elapsed,omitempty"` + TimeUser float64 `protobuf:"fixed64,3,opt,name=time_user,json=timeUser,proto3" json:"time_user,omitempty"` + TimeSystem float64 `protobuf:"fixed64,4,opt,name=time_system,json=timeSystem,proto3" json:"time_system,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ClientStats) Reset() { *m = ClientStats{} } +func (m *ClientStats) String() string { return proto.CompactTextString(m) } +func (*ClientStats) ProtoMessage() {} +func (*ClientStats) Descriptor() ([]byte, []int) { + return fileDescriptor_stats_8ba831c0cb3c3440, []int{3} +} +func (m *ClientStats) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ClientStats.Unmarshal(m, b) +} +func (m *ClientStats) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ClientStats.Marshal(b, m, deterministic) +} +func (dst *ClientStats) XXX_Merge(src proto.Message) { + xxx_messageInfo_ClientStats.Merge(dst, src) +} +func (m *ClientStats) XXX_Size() int { + return xxx_messageInfo_ClientStats.Size(m) +} +func (m *ClientStats) XXX_DiscardUnknown() { + xxx_messageInfo_ClientStats.DiscardUnknown(m) } -func (m *ClientStats) Reset() { *m = ClientStats{} } -func (m *ClientStats) String() string { return proto.CompactTextString(m) } -func (*ClientStats) ProtoMessage() {} -func (*ClientStats) Descriptor() ([]byte, []int) { return fileDescriptor4, []int{3} } +var xxx_messageInfo_ClientStats proto.InternalMessageInfo func (m *ClientStats) GetLatencies() *HistogramData { if m != nil { @@ -179,9 +273,9 @@ func init() { proto.RegisterType((*ClientStats)(nil), "grpc.testing.ClientStats") } -func init() { proto.RegisterFile("stats.proto", fileDescriptor4) } +func init() { proto.RegisterFile("stats.proto", fileDescriptor_stats_8ba831c0cb3c3440) } -var fileDescriptor4 = []byte{ +var fileDescriptor_stats_8ba831c0cb3c3440 = []byte{ // 341 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0xc1, 0x4a, 0xeb, 0x40, 0x14, 0x86, 0x49, 0xd3, 0xf6, 0xb6, 0x27, 0xed, 0xbd, 0x97, 0x41, 0x24, 0x52, 0xd0, 0x1a, 0x5c, diff --git a/vendor/google.golang.org/grpc/benchmark/run_bench.sh b/vendor/google.golang.org/grpc/benchmark/run_bench.sh new file mode 100755 index 000000000..045de1602 --- /dev/null +++ b/vendor/google.golang.org/grpc/benchmark/run_bench.sh @@ -0,0 +1,187 @@ +#!/bin/bash + +rpcs=(1) +conns=(1) +warmup=10 +dur=10 +reqs=(1) +resps=(1) +rpc_types=(unary) + +# idx[0] = idx value for rpcs +# idx[1] = idx value for conns +# idx[2] = idx value for reqs +# idx[3] = idx value for resps +# idx[4] = idx value for rpc_types +idx=(0 0 0 0 0) +idx_max=(1 1 1 1 1) + +inc() +{ + for i in $(seq $((${#idx[@]}-1)) -1 0); do + idx[${i}]=$((${idx[${i}]}+1)) + if [ ${idx[${i}]} == ${idx_max[${i}]} ]; then + idx[${i}]=0 + else + break + fi + done + local fin + fin=1 + # Check to see if we have looped back to the beginning. + for v in ${idx[@]}; do + if [ ${v} != 0 ]; then + fin=0 + break + fi + done + if [ ${fin} == 1 ]; then + rm -Rf ${out_dir} + clean_and_die 0 + fi +} + +clean_and_die() { + rm -Rf ${out_dir} + exit $1 +} + +run(){ + local nr + nr=${rpcs[${idx[0]}]} + local nc + nc=${conns[${idx[1]}]} + req_sz=${reqs[${idx[2]}]} + resp_sz=${resps[${idx[3]}]} + r_type=${rpc_types[${idx[4]}]} + # Following runs one benchmark + base_port=50051 + delta=0 + test_name="r_"${nr}"_c_"${nc}"_req_"${req_sz}"_resp_"${resp_sz}"_"${r_type}"_"$(date +%s) + echo "================================================================================" + echo ${test_name} + while : + do + port=$((${base_port}+${delta})) + + # Launch the server in background + ${out_dir}/server --port=${port} --test_name="Server_"${test_name}& + server_pid=$(echo $!) + + # Launch the client + ${out_dir}/client --port=${port} --d=${dur} --w=${warmup} --r=${nr} --c=${nc} --req=${req_sz} --resp=${resp_sz} --rpc_type=${r_type} --test_name="client_"${test_name} + client_status=$(echo $?) + + kill ${server_pid} + wait ${server_pid} + + if [ ${client_status} == 0 ]; then + break + fi + + delta=$((${delta}+1)) + if [ ${delta} == 10 ]; then + echo "Continuous 10 failed runs. Exiting now." + rm -Rf ${out_dir} + clean_and_die 1 + fi + done + +} + +set_param(){ + local argname=$1 + shift + local idx=$1 + shift + if [ $# -eq 0 ]; then + echo "${argname} not specified" + exit 1 + fi + PARAM=($(echo $1 | sed 's/,/ /g')) + if [ ${idx} -lt 0 ]; then + return + fi + idx_max[${idx}]=${#PARAM[@]} +} + +while [ $# -gt 0 ]; do + case "$1" in + -r) + shift + set_param "number of rpcs" 0 $1 + rpcs=(${PARAM[@]}) + shift + ;; + -c) + shift + set_param "number of connections" 1 $1 + conns=(${PARAM[@]}) + shift + ;; + -w) + shift + set_param "warm-up period" -1 $1 + warmup=${PARAM} + shift + ;; + -d) + shift + set_param "duration" -1 $1 + dur=${PARAM} + shift + ;; + -req) + shift + set_param "request size" 2 $1 + reqs=(${PARAM[@]}) + shift + ;; + -resp) + shift + set_param "response size" 3 $1 + resps=(${PARAM[@]}) + shift + ;; + -rpc_type) + shift + set_param "rpc type" 4 $1 + rpc_types=(${PARAM[@]}) + shift + ;; + -h|--help) + echo "Following are valid options:" + echo + echo "-h, --help show brief help" + echo "-w warm-up duration in seconds, default value is 10" + echo "-d benchmark duration in seconds, default value is 60" + echo "" + echo "Each of the following can have multiple comma separated values." + echo "" + echo "-r number of RPCs, default value is 1" + echo "-c number of Connections, default value is 1" + echo "-req req size in bytes, default value is 1" + echo "-resp resp size in bytes, default value is 1" + echo "-rpc_type valid values are unary|streaming, default is unary" + ;; + *) + echo "Incorrect option $1" + exit 1 + ;; + esac +done + +# Build server and client +out_dir=$(mktemp -d oss_benchXXX) + +go build -o ${out_dir}/server $GOPATH/src/google.golang.org/grpc/benchmark/server/main.go && go build -o ${out_dir}/client $GOPATH/src/google.golang.org/grpc/benchmark/client/main.go +if [ $? != 0 ]; then + clean_and_die 1 +fi + + +while : +do + run + inc +done diff --git a/vendor/google.golang.org/grpc/benchmark/server/main.go b/vendor/google.golang.org/grpc/benchmark/server/main.go index b6e87aa7c..253657e0e 100644 --- a/vendor/google.golang.org/grpc/benchmark/server/main.go +++ b/vendor/google.golang.org/grpc/benchmark/server/main.go @@ -20,37 +20,71 @@ package main import ( "flag" - "math" + "fmt" "net" - "net/http" _ "net/http/pprof" + "os" + "os/signal" + "runtime" + "runtime/pprof" + "syscall" "time" + "golang.org/x/sys/unix" "google.golang.org/grpc/benchmark" "google.golang.org/grpc/grpclog" ) -var duration = flag.Int("duration", math.MaxInt32, "The duration in seconds to run the benchmark server") +var ( + port = flag.String("port", "50051", "Localhost port to listen on.") + testName = flag.String("test_name", "", "Name of the test used for creating profiles.") +) func main() { flag.Parse() - go func() { - lis, err := net.Listen("tcp", ":0") - if err != nil { - grpclog.Fatalf("Failed to listen: %v", err) - } - grpclog.Println("Server profiling address: ", lis.Addr().String()) - if err := http.Serve(lis, nil); err != nil { - grpclog.Fatalf("Failed to serve: %v", err) - } - }() - lis, err := net.Listen("tcp", "localhost:0") + if *testName == "" { + grpclog.Fatalf("test name not set") + } + lis, err := net.Listen("tcp", ":"+*port) if err != nil { grpclog.Fatalf("Failed to listen: %v", err) } - addr := lis.Addr().String() - stopper := benchmark.StartServer(benchmark.ServerInfo{Type: "protobuf", Listener: lis}) // listen on all interfaces - grpclog.Println("Server Address: ", addr) - <-time.After(time.Duration(*duration) * time.Second) - stopper() + defer lis.Close() + + cf, err := os.Create("/tmp/" + *testName + ".cpu") + if err != nil { + grpclog.Fatalf("Failed to create file: %v", err) + } + defer cf.Close() + pprof.StartCPUProfile(cf) + cpuBeg := getCPUTime() + // Launch server in a separate goroutine. + stop := benchmark.StartServer(benchmark.ServerInfo{Type: "protobuf", Listener: lis}) + // Wait on OS terminate signal. + ch := make(chan os.Signal, 1) + signal.Notify(ch, syscall.SIGTERM) + <-ch + cpu := time.Duration(getCPUTime() - cpuBeg) + stop() + pprof.StopCPUProfile() + mf, err := os.Create("/tmp/" + *testName + ".mem") + if err != nil { + grpclog.Fatalf("Failed to create file: %v", err) + } + defer mf.Close() + runtime.GC() // materialize all statistics + if err := pprof.WriteHeapProfile(mf); err != nil { + grpclog.Fatalf("Failed to write memory profile: %v", err) + } + fmt.Println("Server CPU utilization:", cpu) + fmt.Println("Server CPU profile:", cf.Name()) + fmt.Println("Server Mem Profile:", mf.Name()) +} + +func getCPUTime() int64 { + var ts unix.Timespec + if err := unix.ClockGettime(unix.CLOCK_PROCESS_CPUTIME_ID, &ts); err != nil { + grpclog.Fatal(err) + } + return ts.Nano() } diff --git a/vendor/google.golang.org/grpc/benchmark/worker/benchmark_client.go b/vendor/google.golang.org/grpc/benchmark/worker/benchmark_client.go index 00adfa1df..56cf087f4 100644 --- a/vendor/google.golang.org/grpc/benchmark/worker/benchmark_client.go +++ b/vendor/google.golang.org/grpc/benchmark/worker/benchmark_client.go @@ -81,20 +81,20 @@ func printClientConfig(config *testpb.ClientConfig) { // will always create sync client // - async client threads. // - core list - grpclog.Printf(" * client type: %v (ignored, always creates sync client)", config.ClientType) - grpclog.Printf(" * async client threads: %v (ignored)", config.AsyncClientThreads) + grpclog.Infof(" * client type: %v (ignored, always creates sync client)", config.ClientType) + grpclog.Infof(" * async client threads: %v (ignored)", config.AsyncClientThreads) // TODO: use cores specified by CoreList when setting list of cores is supported in go. - grpclog.Printf(" * core list: %v (ignored)", config.CoreList) - - grpclog.Printf(" - security params: %v", config.SecurityParams) - grpclog.Printf(" - core limit: %v", config.CoreLimit) - grpclog.Printf(" - payload config: %v", config.PayloadConfig) - grpclog.Printf(" - rpcs per chann: %v", config.OutstandingRpcsPerChannel) - grpclog.Printf(" - channel number: %v", config.ClientChannels) - grpclog.Printf(" - load params: %v", config.LoadParams) - grpclog.Printf(" - rpc type: %v", config.RpcType) - grpclog.Printf(" - histogram params: %v", config.HistogramParams) - grpclog.Printf(" - server targets: %v", config.ServerTargets) + grpclog.Infof(" * core list: %v (ignored)", config.CoreList) + + grpclog.Infof(" - security params: %v", config.SecurityParams) + grpclog.Infof(" - core limit: %v", config.CoreLimit) + grpclog.Infof(" - payload config: %v", config.PayloadConfig) + grpclog.Infof(" - rpcs per chann: %v", config.OutstandingRpcsPerChannel) + grpclog.Infof(" - channel number: %v", config.ClientChannels) + grpclog.Infof(" - load params: %v", config.LoadParams) + grpclog.Infof(" - rpc type: %v", config.RpcType) + grpclog.Infof(" - histogram params: %v", config.HistogramParams) + grpclog.Infof(" - server targets: %v", config.ServerTargets) } func setupClientEnv(config *testpb.ClientConfig) { diff --git a/vendor/google.golang.org/grpc/benchmark/worker/benchmark_server.go b/vendor/google.golang.org/grpc/benchmark/worker/benchmark_server.go index 639c0fe1c..9b1f676fa 100644 --- a/vendor/google.golang.org/grpc/benchmark/worker/benchmark_server.go +++ b/vendor/google.golang.org/grpc/benchmark/worker/benchmark_server.go @@ -59,15 +59,15 @@ func printServerConfig(config *testpb.ServerConfig) { // will always start sync server // - async server threads // - core list - grpclog.Printf(" * server type: %v (ignored, always starts sync server)", config.ServerType) - grpclog.Printf(" * async server threads: %v (ignored)", config.AsyncServerThreads) + grpclog.Infof(" * server type: %v (ignored, always starts sync server)", config.ServerType) + grpclog.Infof(" * async server threads: %v (ignored)", config.AsyncServerThreads) // TODO: use cores specified by CoreList when setting list of cores is supported in go. - grpclog.Printf(" * core list: %v (ignored)", config.CoreList) + grpclog.Infof(" * core list: %v (ignored)", config.CoreList) - grpclog.Printf(" - security params: %v", config.SecurityParams) - grpclog.Printf(" - core limit: %v", config.CoreLimit) - grpclog.Printf(" - port: %v", config.Port) - grpclog.Printf(" - payload config: %v", config.PayloadConfig) + grpclog.Infof(" - security params: %v", config.SecurityParams) + grpclog.Infof(" - core limit: %v", config.CoreLimit) + grpclog.Infof(" - port: %v", config.Port) + grpclog.Infof(" - payload config: %v", config.PayloadConfig) } func startBenchmarkServer(config *testpb.ServerConfig, serverPort int) (*benchmarkServer, error) { @@ -112,7 +112,7 @@ func startBenchmarkServer(config *testpb.ServerConfig, serverPort int) (*benchma if port == 0 { port = serverPort } - lis, err := net.Listen("tcp", fmt.Sprintf("localhost:%d", port)) + lis, err := net.Listen("tcp", fmt.Sprintf(":%d", port)) if err != nil { grpclog.Fatalf("Failed to listen: %v", err) } @@ -147,7 +147,7 @@ func startBenchmarkServer(config *testpb.ServerConfig, serverPort int) (*benchma }, opts...) } - grpclog.Printf("benchmark server listening at %v", addr) + grpclog.Infof("benchmark server listening at %v", addr) addrSplitted := strings.Split(addr, ":") p, err := strconv.Atoi(addrSplitted[len(addrSplitted)-1]) if err != nil { diff --git a/vendor/google.golang.org/grpc/benchmark/worker/main.go b/vendor/google.golang.org/grpc/benchmark/worker/main.go index 096a05abe..3d2fd6173 100644 --- a/vendor/google.golang.org/grpc/benchmark/worker/main.go +++ b/vendor/google.golang.org/grpc/benchmark/worker/main.go @@ -79,7 +79,7 @@ func (s *workerServer) RunServer(stream testpb.WorkerService_RunServerServer) er var bs *benchmarkServer defer func() { // Close benchmark server when stream ends. - grpclog.Printf("closing benchmark server") + grpclog.Infof("closing benchmark server") if bs != nil { bs.closeFunc() } @@ -96,9 +96,9 @@ func (s *workerServer) RunServer(stream testpb.WorkerService_RunServerServer) er var out *testpb.ServerStatus switch argtype := in.Argtype.(type) { case *testpb.ServerArgs_Setup: - grpclog.Printf("server setup received:") + grpclog.Infof("server setup received:") if bs != nil { - grpclog.Printf("server setup received when server already exists, closing the existing server") + grpclog.Infof("server setup received when server already exists, closing the existing server") bs.closeFunc() } bs, err = startBenchmarkServer(argtype.Setup, s.serverPort) @@ -112,8 +112,8 @@ func (s *workerServer) RunServer(stream testpb.WorkerService_RunServerServer) er } case *testpb.ServerArgs_Mark: - grpclog.Printf("server mark received:") - grpclog.Printf(" - %v", argtype) + grpclog.Infof("server mark received:") + grpclog.Infof(" - %v", argtype) if bs == nil { return status.Error(codes.InvalidArgument, "server does not exist when mark received") } @@ -134,7 +134,7 @@ func (s *workerServer) RunClient(stream testpb.WorkerService_RunClientServer) er var bc *benchmarkClient defer func() { // Shut down benchmark client when stream ends. - grpclog.Printf("shuting down benchmark client") + grpclog.Infof("shuting down benchmark client") if bc != nil { bc.shutdown() } @@ -151,9 +151,9 @@ func (s *workerServer) RunClient(stream testpb.WorkerService_RunClientServer) er var out *testpb.ClientStatus switch t := in.Argtype.(type) { case *testpb.ClientArgs_Setup: - grpclog.Printf("client setup received:") + grpclog.Infof("client setup received:") if bc != nil { - grpclog.Printf("client setup received when client already exists, shuting down the existing client") + grpclog.Infof("client setup received when client already exists, shuting down the existing client") bc.shutdown() } bc, err = startBenchmarkClient(t.Setup) @@ -165,8 +165,8 @@ func (s *workerServer) RunClient(stream testpb.WorkerService_RunClientServer) er } case *testpb.ClientArgs_Mark: - grpclog.Printf("client mark received:") - grpclog.Printf(" - %v", t) + grpclog.Infof("client mark received:") + grpclog.Infof(" - %v", t) if bc == nil { return status.Error(codes.InvalidArgument, "client does not exist when mark received") } @@ -182,12 +182,12 @@ func (s *workerServer) RunClient(stream testpb.WorkerService_RunClientServer) er } func (s *workerServer) CoreCount(ctx context.Context, in *testpb.CoreRequest) (*testpb.CoreResponse, error) { - grpclog.Printf("core count: %v", runtime.NumCPU()) + grpclog.Infof("core count: %v", runtime.NumCPU()) return &testpb.CoreResponse{Cores: int32(runtime.NumCPU())}, nil } func (s *workerServer) QuitWorker(ctx context.Context, in *testpb.Void) (*testpb.Void, error) { - grpclog.Printf("quitting worker") + grpclog.Infof("quitting worker") s.stop <- true return &testpb.Void{}, nil } @@ -200,7 +200,7 @@ func main() { if err != nil { grpclog.Fatalf("failed to listen: %v", err) } - grpclog.Printf("worker listening at port %v", *driverPort) + grpclog.Infof("worker listening at port %v", *driverPort) s := grpc.NewServer() stop := make(chan bool) @@ -221,8 +221,8 @@ func main() { if *pprofPort >= 0 { go func() { - grpclog.Println("Starting pprof server on port " + strconv.Itoa(*pprofPort)) - grpclog.Println(http.ListenAndServe("localhost:"+strconv.Itoa(*pprofPort), nil)) + grpclog.Infoln("Starting pprof server on port " + strconv.Itoa(*pprofPort)) + grpclog.Infoln(http.ListenAndServe("localhost:"+strconv.Itoa(*pprofPort), nil)) }() } diff --git a/vendor/google.golang.org/grpc/call.go b/vendor/google.golang.org/grpc/call.go index f73b7d552..180d79d06 100644 --- a/vendor/google.golang.org/grpc/call.go +++ b/vendor/google.golang.org/grpc/call.go @@ -63,31 +63,12 @@ func Invoke(ctx context.Context, method string, args, reply interface{}, cc *Cli var unaryStreamDesc = &StreamDesc{ServerStreams: false, ClientStreams: false} func invoke(ctx context.Context, method string, req, reply interface{}, cc *ClientConn, opts ...CallOption) error { - // TODO: implement retries in clientStream and make this simply - // newClientStream, SendMsg, RecvMsg. - firstAttempt := true - for { - csInt, err := newClientStream(ctx, unaryStreamDesc, cc, method, opts...) - if err != nil { - return err - } - cs := csInt.(*clientStream) - if err := cs.SendMsg(req); err != nil { - if !cs.c.failFast && cs.attempt.s.Unprocessed() && firstAttempt { - // TODO: Add a field to header for grpc-transparent-retry-attempts - firstAttempt = false - continue - } - return err - } - if err := cs.RecvMsg(reply); err != nil { - if !cs.c.failFast && cs.attempt.s.Unprocessed() && firstAttempt { - // TODO: Add a field to header for grpc-transparent-retry-attempts - firstAttempt = false - continue - } - return err - } - return nil + cs, err := newClientStream(ctx, unaryStreamDesc, cc, method, opts...) + if err != nil { + return err } + if err := cs.SendMsg(req); err != nil { + return err + } + return cs.RecvMsg(reply) } diff --git a/vendor/google.golang.org/grpc/channelz/grpc_channelz_v1/channelz.pb.go b/vendor/google.golang.org/grpc/channelz/grpc_channelz_v1/channelz.pb.go new file mode 100644 index 000000000..747b8f833 --- /dev/null +++ b/vendor/google.golang.org/grpc/channelz/grpc_channelz_v1/channelz.pb.go @@ -0,0 +1,3257 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: grpc/channelz/v1/channelz.proto + +package grpc_channelz_v1 // import "google.golang.org/grpc/channelz/grpc_channelz_v1" + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" +import any "github.com/golang/protobuf/ptypes/any" +import duration "github.com/golang/protobuf/ptypes/duration" +import timestamp "github.com/golang/protobuf/ptypes/timestamp" +import wrappers "github.com/golang/protobuf/ptypes/wrappers" + +import ( + context "golang.org/x/net/context" + grpc "google.golang.org/grpc" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type ChannelConnectivityState_State int32 + +const ( + ChannelConnectivityState_UNKNOWN ChannelConnectivityState_State = 0 + ChannelConnectivityState_IDLE ChannelConnectivityState_State = 1 + ChannelConnectivityState_CONNECTING ChannelConnectivityState_State = 2 + ChannelConnectivityState_READY ChannelConnectivityState_State = 3 + ChannelConnectivityState_TRANSIENT_FAILURE ChannelConnectivityState_State = 4 + ChannelConnectivityState_SHUTDOWN ChannelConnectivityState_State = 5 +) + +var ChannelConnectivityState_State_name = map[int32]string{ + 0: "UNKNOWN", + 1: "IDLE", + 2: "CONNECTING", + 3: "READY", + 4: "TRANSIENT_FAILURE", + 5: "SHUTDOWN", +} +var ChannelConnectivityState_State_value = map[string]int32{ + "UNKNOWN": 0, + "IDLE": 1, + "CONNECTING": 2, + "READY": 3, + "TRANSIENT_FAILURE": 4, + "SHUTDOWN": 5, +} + +func (x ChannelConnectivityState_State) String() string { + return proto.EnumName(ChannelConnectivityState_State_name, int32(x)) +} +func (ChannelConnectivityState_State) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_channelz_ce3ed45d08251f2f, []int{2, 0} +} + +// The supported severity levels of trace events. +type ChannelTraceEvent_Severity int32 + +const ( + ChannelTraceEvent_CT_UNKNOWN ChannelTraceEvent_Severity = 0 + ChannelTraceEvent_CT_INFO ChannelTraceEvent_Severity = 1 + ChannelTraceEvent_CT_WARNING ChannelTraceEvent_Severity = 2 + ChannelTraceEvent_CT_ERROR ChannelTraceEvent_Severity = 3 +) + +var ChannelTraceEvent_Severity_name = map[int32]string{ + 0: "CT_UNKNOWN", + 1: "CT_INFO", + 2: "CT_WARNING", + 3: "CT_ERROR", +} +var ChannelTraceEvent_Severity_value = map[string]int32{ + "CT_UNKNOWN": 0, + "CT_INFO": 1, + "CT_WARNING": 2, + "CT_ERROR": 3, +} + +func (x ChannelTraceEvent_Severity) String() string { + return proto.EnumName(ChannelTraceEvent_Severity_name, int32(x)) +} +func (ChannelTraceEvent_Severity) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_channelz_ce3ed45d08251f2f, []int{4, 0} +} + +// Channel is a logical grouping of channels, subchannels, and sockets. +type Channel struct { + // The identifier for this channel. This should bet set. + Ref *ChannelRef `protobuf:"bytes,1,opt,name=ref,proto3" json:"ref,omitempty"` + // Data specific to this channel. + Data *ChannelData `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` + // There are no ordering guarantees on the order of channel refs. + // There may not be cycles in the ref graph. + // A channel ref may be present in more than one channel or subchannel. + ChannelRef []*ChannelRef `protobuf:"bytes,3,rep,name=channel_ref,json=channelRef,proto3" json:"channel_ref,omitempty"` + // At most one of 'channel_ref+subchannel_ref' and 'socket' is set. + // There are no ordering guarantees on the order of subchannel refs. + // There may not be cycles in the ref graph. + // A sub channel ref may be present in more than one channel or subchannel. + SubchannelRef []*SubchannelRef `protobuf:"bytes,4,rep,name=subchannel_ref,json=subchannelRef,proto3" json:"subchannel_ref,omitempty"` + // There are no ordering guarantees on the order of sockets. + SocketRef []*SocketRef `protobuf:"bytes,5,rep,name=socket_ref,json=socketRef,proto3" json:"socket_ref,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Channel) Reset() { *m = Channel{} } +func (m *Channel) String() string { return proto.CompactTextString(m) } +func (*Channel) ProtoMessage() {} +func (*Channel) Descriptor() ([]byte, []int) { + return fileDescriptor_channelz_ce3ed45d08251f2f, []int{0} +} +func (m *Channel) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Channel.Unmarshal(m, b) +} +func (m *Channel) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Channel.Marshal(b, m, deterministic) +} +func (dst *Channel) XXX_Merge(src proto.Message) { + xxx_messageInfo_Channel.Merge(dst, src) +} +func (m *Channel) XXX_Size() int { + return xxx_messageInfo_Channel.Size(m) +} +func (m *Channel) XXX_DiscardUnknown() { + xxx_messageInfo_Channel.DiscardUnknown(m) +} + +var xxx_messageInfo_Channel proto.InternalMessageInfo + +func (m *Channel) GetRef() *ChannelRef { + if m != nil { + return m.Ref + } + return nil +} + +func (m *Channel) GetData() *ChannelData { + if m != nil { + return m.Data + } + return nil +} + +func (m *Channel) GetChannelRef() []*ChannelRef { + if m != nil { + return m.ChannelRef + } + return nil +} + +func (m *Channel) GetSubchannelRef() []*SubchannelRef { + if m != nil { + return m.SubchannelRef + } + return nil +} + +func (m *Channel) GetSocketRef() []*SocketRef { + if m != nil { + return m.SocketRef + } + return nil +} + +// Subchannel is a logical grouping of channels, subchannels, and sockets. +// A subchannel is load balanced over by it's ancestor +type Subchannel struct { + // The identifier for this channel. + Ref *SubchannelRef `protobuf:"bytes,1,opt,name=ref,proto3" json:"ref,omitempty"` + // Data specific to this channel. + Data *ChannelData `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` + // There are no ordering guarantees on the order of channel refs. + // There may not be cycles in the ref graph. + // A channel ref may be present in more than one channel or subchannel. + ChannelRef []*ChannelRef `protobuf:"bytes,3,rep,name=channel_ref,json=channelRef,proto3" json:"channel_ref,omitempty"` + // At most one of 'channel_ref+subchannel_ref' and 'socket' is set. + // There are no ordering guarantees on the order of subchannel refs. + // There may not be cycles in the ref graph. + // A sub channel ref may be present in more than one channel or subchannel. + SubchannelRef []*SubchannelRef `protobuf:"bytes,4,rep,name=subchannel_ref,json=subchannelRef,proto3" json:"subchannel_ref,omitempty"` + // There are no ordering guarantees on the order of sockets. + SocketRef []*SocketRef `protobuf:"bytes,5,rep,name=socket_ref,json=socketRef,proto3" json:"socket_ref,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Subchannel) Reset() { *m = Subchannel{} } +func (m *Subchannel) String() string { return proto.CompactTextString(m) } +func (*Subchannel) ProtoMessage() {} +func (*Subchannel) Descriptor() ([]byte, []int) { + return fileDescriptor_channelz_ce3ed45d08251f2f, []int{1} +} +func (m *Subchannel) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Subchannel.Unmarshal(m, b) +} +func (m *Subchannel) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Subchannel.Marshal(b, m, deterministic) +} +func (dst *Subchannel) XXX_Merge(src proto.Message) { + xxx_messageInfo_Subchannel.Merge(dst, src) +} +func (m *Subchannel) XXX_Size() int { + return xxx_messageInfo_Subchannel.Size(m) +} +func (m *Subchannel) XXX_DiscardUnknown() { + xxx_messageInfo_Subchannel.DiscardUnknown(m) +} + +var xxx_messageInfo_Subchannel proto.InternalMessageInfo + +func (m *Subchannel) GetRef() *SubchannelRef { + if m != nil { + return m.Ref + } + return nil +} + +func (m *Subchannel) GetData() *ChannelData { + if m != nil { + return m.Data + } + return nil +} + +func (m *Subchannel) GetChannelRef() []*ChannelRef { + if m != nil { + return m.ChannelRef + } + return nil +} + +func (m *Subchannel) GetSubchannelRef() []*SubchannelRef { + if m != nil { + return m.SubchannelRef + } + return nil +} + +func (m *Subchannel) GetSocketRef() []*SocketRef { + if m != nil { + return m.SocketRef + } + return nil +} + +// These come from the specified states in this document: +// https://github.com/grpc/grpc/blob/master/doc/connectivity-semantics-and-api.md +type ChannelConnectivityState struct { + State ChannelConnectivityState_State `protobuf:"varint,1,opt,name=state,proto3,enum=grpc.channelz.v1.ChannelConnectivityState_State" json:"state,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ChannelConnectivityState) Reset() { *m = ChannelConnectivityState{} } +func (m *ChannelConnectivityState) String() string { return proto.CompactTextString(m) } +func (*ChannelConnectivityState) ProtoMessage() {} +func (*ChannelConnectivityState) Descriptor() ([]byte, []int) { + return fileDescriptor_channelz_ce3ed45d08251f2f, []int{2} +} +func (m *ChannelConnectivityState) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ChannelConnectivityState.Unmarshal(m, b) +} +func (m *ChannelConnectivityState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ChannelConnectivityState.Marshal(b, m, deterministic) +} +func (dst *ChannelConnectivityState) XXX_Merge(src proto.Message) { + xxx_messageInfo_ChannelConnectivityState.Merge(dst, src) +} +func (m *ChannelConnectivityState) XXX_Size() int { + return xxx_messageInfo_ChannelConnectivityState.Size(m) +} +func (m *ChannelConnectivityState) XXX_DiscardUnknown() { + xxx_messageInfo_ChannelConnectivityState.DiscardUnknown(m) +} + +var xxx_messageInfo_ChannelConnectivityState proto.InternalMessageInfo + +func (m *ChannelConnectivityState) GetState() ChannelConnectivityState_State { + if m != nil { + return m.State + } + return ChannelConnectivityState_UNKNOWN +} + +// Channel data is data related to a specific Channel or Subchannel. +type ChannelData struct { + // The connectivity state of the channel or subchannel. Implementations + // should always set this. + State *ChannelConnectivityState `protobuf:"bytes,1,opt,name=state,proto3" json:"state,omitempty"` + // The target this channel originally tried to connect to. May be absent + Target string `protobuf:"bytes,2,opt,name=target,proto3" json:"target,omitempty"` + // A trace of recent events on the channel. May be absent. + Trace *ChannelTrace `protobuf:"bytes,3,opt,name=trace,proto3" json:"trace,omitempty"` + // The number of calls started on the channel + CallsStarted int64 `protobuf:"varint,4,opt,name=calls_started,json=callsStarted,proto3" json:"calls_started,omitempty"` + // The number of calls that have completed with an OK status + CallsSucceeded int64 `protobuf:"varint,5,opt,name=calls_succeeded,json=callsSucceeded,proto3" json:"calls_succeeded,omitempty"` + // The number of calls that have completed with a non-OK status + CallsFailed int64 `protobuf:"varint,6,opt,name=calls_failed,json=callsFailed,proto3" json:"calls_failed,omitempty"` + // The last time a call was started on the channel. + LastCallStartedTimestamp *timestamp.Timestamp `protobuf:"bytes,7,opt,name=last_call_started_timestamp,json=lastCallStartedTimestamp,proto3" json:"last_call_started_timestamp,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ChannelData) Reset() { *m = ChannelData{} } +func (m *ChannelData) String() string { return proto.CompactTextString(m) } +func (*ChannelData) ProtoMessage() {} +func (*ChannelData) Descriptor() ([]byte, []int) { + return fileDescriptor_channelz_ce3ed45d08251f2f, []int{3} +} +func (m *ChannelData) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ChannelData.Unmarshal(m, b) +} +func (m *ChannelData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ChannelData.Marshal(b, m, deterministic) +} +func (dst *ChannelData) XXX_Merge(src proto.Message) { + xxx_messageInfo_ChannelData.Merge(dst, src) +} +func (m *ChannelData) XXX_Size() int { + return xxx_messageInfo_ChannelData.Size(m) +} +func (m *ChannelData) XXX_DiscardUnknown() { + xxx_messageInfo_ChannelData.DiscardUnknown(m) +} + +var xxx_messageInfo_ChannelData proto.InternalMessageInfo + +func (m *ChannelData) GetState() *ChannelConnectivityState { + if m != nil { + return m.State + } + return nil +} + +func (m *ChannelData) GetTarget() string { + if m != nil { + return m.Target + } + return "" +} + +func (m *ChannelData) GetTrace() *ChannelTrace { + if m != nil { + return m.Trace + } + return nil +} + +func (m *ChannelData) GetCallsStarted() int64 { + if m != nil { + return m.CallsStarted + } + return 0 +} + +func (m *ChannelData) GetCallsSucceeded() int64 { + if m != nil { + return m.CallsSucceeded + } + return 0 +} + +func (m *ChannelData) GetCallsFailed() int64 { + if m != nil { + return m.CallsFailed + } + return 0 +} + +func (m *ChannelData) GetLastCallStartedTimestamp() *timestamp.Timestamp { + if m != nil { + return m.LastCallStartedTimestamp + } + return nil +} + +// A trace event is an interesting thing that happened to a channel or +// subchannel, such as creation, address resolution, subchannel creation, etc. +type ChannelTraceEvent struct { + // High level description of the event. + Description string `protobuf:"bytes,1,opt,name=description,proto3" json:"description,omitempty"` + // the severity of the trace event + Severity ChannelTraceEvent_Severity `protobuf:"varint,2,opt,name=severity,proto3,enum=grpc.channelz.v1.ChannelTraceEvent_Severity" json:"severity,omitempty"` + // When this event occurred. + Timestamp *timestamp.Timestamp `protobuf:"bytes,3,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + // ref of referenced channel or subchannel. + // Optional, only present if this event refers to a child object. For example, + // this field would be filled if this trace event was for a subchannel being + // created. + // + // Types that are valid to be assigned to ChildRef: + // *ChannelTraceEvent_ChannelRef + // *ChannelTraceEvent_SubchannelRef + ChildRef isChannelTraceEvent_ChildRef `protobuf_oneof:"child_ref"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ChannelTraceEvent) Reset() { *m = ChannelTraceEvent{} } +func (m *ChannelTraceEvent) String() string { return proto.CompactTextString(m) } +func (*ChannelTraceEvent) ProtoMessage() {} +func (*ChannelTraceEvent) Descriptor() ([]byte, []int) { + return fileDescriptor_channelz_ce3ed45d08251f2f, []int{4} +} +func (m *ChannelTraceEvent) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ChannelTraceEvent.Unmarshal(m, b) +} +func (m *ChannelTraceEvent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ChannelTraceEvent.Marshal(b, m, deterministic) +} +func (dst *ChannelTraceEvent) XXX_Merge(src proto.Message) { + xxx_messageInfo_ChannelTraceEvent.Merge(dst, src) +} +func (m *ChannelTraceEvent) XXX_Size() int { + return xxx_messageInfo_ChannelTraceEvent.Size(m) +} +func (m *ChannelTraceEvent) XXX_DiscardUnknown() { + xxx_messageInfo_ChannelTraceEvent.DiscardUnknown(m) +} + +var xxx_messageInfo_ChannelTraceEvent proto.InternalMessageInfo + +type isChannelTraceEvent_ChildRef interface { + isChannelTraceEvent_ChildRef() +} + +type ChannelTraceEvent_ChannelRef struct { + ChannelRef *ChannelRef `protobuf:"bytes,4,opt,name=channel_ref,json=channelRef,proto3,oneof"` +} +type ChannelTraceEvent_SubchannelRef struct { + SubchannelRef *SubchannelRef `protobuf:"bytes,5,opt,name=subchannel_ref,json=subchannelRef,proto3,oneof"` +} + +func (*ChannelTraceEvent_ChannelRef) isChannelTraceEvent_ChildRef() {} +func (*ChannelTraceEvent_SubchannelRef) isChannelTraceEvent_ChildRef() {} + +func (m *ChannelTraceEvent) GetChildRef() isChannelTraceEvent_ChildRef { + if m != nil { + return m.ChildRef + } + return nil +} + +func (m *ChannelTraceEvent) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + +func (m *ChannelTraceEvent) GetSeverity() ChannelTraceEvent_Severity { + if m != nil { + return m.Severity + } + return ChannelTraceEvent_CT_UNKNOWN +} + +func (m *ChannelTraceEvent) GetTimestamp() *timestamp.Timestamp { + if m != nil { + return m.Timestamp + } + return nil +} + +func (m *ChannelTraceEvent) GetChannelRef() *ChannelRef { + if x, ok := m.GetChildRef().(*ChannelTraceEvent_ChannelRef); ok { + return x.ChannelRef + } + return nil +} + +func (m *ChannelTraceEvent) GetSubchannelRef() *SubchannelRef { + if x, ok := m.GetChildRef().(*ChannelTraceEvent_SubchannelRef); ok { + return x.SubchannelRef + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*ChannelTraceEvent) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _ChannelTraceEvent_OneofMarshaler, _ChannelTraceEvent_OneofUnmarshaler, _ChannelTraceEvent_OneofSizer, []interface{}{ + (*ChannelTraceEvent_ChannelRef)(nil), + (*ChannelTraceEvent_SubchannelRef)(nil), + } +} + +func _ChannelTraceEvent_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*ChannelTraceEvent) + // child_ref + switch x := m.ChildRef.(type) { + case *ChannelTraceEvent_ChannelRef: + b.EncodeVarint(4<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.ChannelRef); err != nil { + return err + } + case *ChannelTraceEvent_SubchannelRef: + b.EncodeVarint(5<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.SubchannelRef); err != nil { + return err + } + case nil: + default: + return fmt.Errorf("ChannelTraceEvent.ChildRef has unexpected type %T", x) + } + return nil +} + +func _ChannelTraceEvent_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*ChannelTraceEvent) + switch tag { + case 4: // child_ref.channel_ref + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(ChannelRef) + err := b.DecodeMessage(msg) + m.ChildRef = &ChannelTraceEvent_ChannelRef{msg} + return true, err + case 5: // child_ref.subchannel_ref + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(SubchannelRef) + err := b.DecodeMessage(msg) + m.ChildRef = &ChannelTraceEvent_SubchannelRef{msg} + return true, err + default: + return false, nil + } +} + +func _ChannelTraceEvent_OneofSizer(msg proto.Message) (n int) { + m := msg.(*ChannelTraceEvent) + // child_ref + switch x := m.ChildRef.(type) { + case *ChannelTraceEvent_ChannelRef: + s := proto.Size(x.ChannelRef) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *ChannelTraceEvent_SubchannelRef: + s := proto.Size(x.SubchannelRef) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +// ChannelTrace represents the recent events that have occurred on the channel. +type ChannelTrace struct { + // Number of events ever logged in this tracing object. This can differ from + // events.size() because events can be overwritten or garbage collected by + // implementations. + NumEventsLogged int64 `protobuf:"varint,1,opt,name=num_events_logged,json=numEventsLogged,proto3" json:"num_events_logged,omitempty"` + // Time that this channel was created. + CreationTimestamp *timestamp.Timestamp `protobuf:"bytes,2,opt,name=creation_timestamp,json=creationTimestamp,proto3" json:"creation_timestamp,omitempty"` + // List of events that have occurred on this channel. + Events []*ChannelTraceEvent `protobuf:"bytes,3,rep,name=events,proto3" json:"events,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ChannelTrace) Reset() { *m = ChannelTrace{} } +func (m *ChannelTrace) String() string { return proto.CompactTextString(m) } +func (*ChannelTrace) ProtoMessage() {} +func (*ChannelTrace) Descriptor() ([]byte, []int) { + return fileDescriptor_channelz_ce3ed45d08251f2f, []int{5} +} +func (m *ChannelTrace) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ChannelTrace.Unmarshal(m, b) +} +func (m *ChannelTrace) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ChannelTrace.Marshal(b, m, deterministic) +} +func (dst *ChannelTrace) XXX_Merge(src proto.Message) { + xxx_messageInfo_ChannelTrace.Merge(dst, src) +} +func (m *ChannelTrace) XXX_Size() int { + return xxx_messageInfo_ChannelTrace.Size(m) +} +func (m *ChannelTrace) XXX_DiscardUnknown() { + xxx_messageInfo_ChannelTrace.DiscardUnknown(m) +} + +var xxx_messageInfo_ChannelTrace proto.InternalMessageInfo + +func (m *ChannelTrace) GetNumEventsLogged() int64 { + if m != nil { + return m.NumEventsLogged + } + return 0 +} + +func (m *ChannelTrace) GetCreationTimestamp() *timestamp.Timestamp { + if m != nil { + return m.CreationTimestamp + } + return nil +} + +func (m *ChannelTrace) GetEvents() []*ChannelTraceEvent { + if m != nil { + return m.Events + } + return nil +} + +// ChannelRef is a reference to a Channel. +type ChannelRef struct { + // The globally unique id for this channel. Must be a positive number. + ChannelId int64 `protobuf:"varint,1,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` + // An optional name associated with the channel. + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ChannelRef) Reset() { *m = ChannelRef{} } +func (m *ChannelRef) String() string { return proto.CompactTextString(m) } +func (*ChannelRef) ProtoMessage() {} +func (*ChannelRef) Descriptor() ([]byte, []int) { + return fileDescriptor_channelz_ce3ed45d08251f2f, []int{6} +} +func (m *ChannelRef) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ChannelRef.Unmarshal(m, b) +} +func (m *ChannelRef) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ChannelRef.Marshal(b, m, deterministic) +} +func (dst *ChannelRef) XXX_Merge(src proto.Message) { + xxx_messageInfo_ChannelRef.Merge(dst, src) +} +func (m *ChannelRef) XXX_Size() int { + return xxx_messageInfo_ChannelRef.Size(m) +} +func (m *ChannelRef) XXX_DiscardUnknown() { + xxx_messageInfo_ChannelRef.DiscardUnknown(m) +} + +var xxx_messageInfo_ChannelRef proto.InternalMessageInfo + +func (m *ChannelRef) GetChannelId() int64 { + if m != nil { + return m.ChannelId + } + return 0 +} + +func (m *ChannelRef) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +// ChannelRef is a reference to a Subchannel. +type SubchannelRef struct { + // The globally unique id for this subchannel. Must be a positive number. + SubchannelId int64 `protobuf:"varint,7,opt,name=subchannel_id,json=subchannelId,proto3" json:"subchannel_id,omitempty"` + // An optional name associated with the subchannel. + Name string `protobuf:"bytes,8,opt,name=name,proto3" json:"name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SubchannelRef) Reset() { *m = SubchannelRef{} } +func (m *SubchannelRef) String() string { return proto.CompactTextString(m) } +func (*SubchannelRef) ProtoMessage() {} +func (*SubchannelRef) Descriptor() ([]byte, []int) { + return fileDescriptor_channelz_ce3ed45d08251f2f, []int{7} +} +func (m *SubchannelRef) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SubchannelRef.Unmarshal(m, b) +} +func (m *SubchannelRef) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SubchannelRef.Marshal(b, m, deterministic) +} +func (dst *SubchannelRef) XXX_Merge(src proto.Message) { + xxx_messageInfo_SubchannelRef.Merge(dst, src) +} +func (m *SubchannelRef) XXX_Size() int { + return xxx_messageInfo_SubchannelRef.Size(m) +} +func (m *SubchannelRef) XXX_DiscardUnknown() { + xxx_messageInfo_SubchannelRef.DiscardUnknown(m) +} + +var xxx_messageInfo_SubchannelRef proto.InternalMessageInfo + +func (m *SubchannelRef) GetSubchannelId() int64 { + if m != nil { + return m.SubchannelId + } + return 0 +} + +func (m *SubchannelRef) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +// SocketRef is a reference to a Socket. +type SocketRef struct { + SocketId int64 `protobuf:"varint,3,opt,name=socket_id,json=socketId,proto3" json:"socket_id,omitempty"` + // An optional name associated with the socket. + Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SocketRef) Reset() { *m = SocketRef{} } +func (m *SocketRef) String() string { return proto.CompactTextString(m) } +func (*SocketRef) ProtoMessage() {} +func (*SocketRef) Descriptor() ([]byte, []int) { + return fileDescriptor_channelz_ce3ed45d08251f2f, []int{8} +} +func (m *SocketRef) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SocketRef.Unmarshal(m, b) +} +func (m *SocketRef) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SocketRef.Marshal(b, m, deterministic) +} +func (dst *SocketRef) XXX_Merge(src proto.Message) { + xxx_messageInfo_SocketRef.Merge(dst, src) +} +func (m *SocketRef) XXX_Size() int { + return xxx_messageInfo_SocketRef.Size(m) +} +func (m *SocketRef) XXX_DiscardUnknown() { + xxx_messageInfo_SocketRef.DiscardUnknown(m) +} + +var xxx_messageInfo_SocketRef proto.InternalMessageInfo + +func (m *SocketRef) GetSocketId() int64 { + if m != nil { + return m.SocketId + } + return 0 +} + +func (m *SocketRef) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +// ServerRef is a reference to a Server. +type ServerRef struct { + // A globally unique identifier for this server. Must be a positive number. + ServerId int64 `protobuf:"varint,5,opt,name=server_id,json=serverId,proto3" json:"server_id,omitempty"` + // An optional name associated with the server. + Name string `protobuf:"bytes,6,opt,name=name,proto3" json:"name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ServerRef) Reset() { *m = ServerRef{} } +func (m *ServerRef) String() string { return proto.CompactTextString(m) } +func (*ServerRef) ProtoMessage() {} +func (*ServerRef) Descriptor() ([]byte, []int) { + return fileDescriptor_channelz_ce3ed45d08251f2f, []int{9} +} +func (m *ServerRef) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ServerRef.Unmarshal(m, b) +} +func (m *ServerRef) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ServerRef.Marshal(b, m, deterministic) +} +func (dst *ServerRef) XXX_Merge(src proto.Message) { + xxx_messageInfo_ServerRef.Merge(dst, src) +} +func (m *ServerRef) XXX_Size() int { + return xxx_messageInfo_ServerRef.Size(m) +} +func (m *ServerRef) XXX_DiscardUnknown() { + xxx_messageInfo_ServerRef.DiscardUnknown(m) +} + +var xxx_messageInfo_ServerRef proto.InternalMessageInfo + +func (m *ServerRef) GetServerId() int64 { + if m != nil { + return m.ServerId + } + return 0 +} + +func (m *ServerRef) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +// Server represents a single server. There may be multiple servers in a single +// program. +type Server struct { + // The identifier for a Server. This should be set. + Ref *ServerRef `protobuf:"bytes,1,opt,name=ref,proto3" json:"ref,omitempty"` + // The associated data of the Server. + Data *ServerData `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` + // The sockets that the server is listening on. There are no ordering + // guarantees. This may be absent. + ListenSocket []*SocketRef `protobuf:"bytes,3,rep,name=listen_socket,json=listenSocket,proto3" json:"listen_socket,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Server) Reset() { *m = Server{} } +func (m *Server) String() string { return proto.CompactTextString(m) } +func (*Server) ProtoMessage() {} +func (*Server) Descriptor() ([]byte, []int) { + return fileDescriptor_channelz_ce3ed45d08251f2f, []int{10} +} +func (m *Server) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Server.Unmarshal(m, b) +} +func (m *Server) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Server.Marshal(b, m, deterministic) +} +func (dst *Server) XXX_Merge(src proto.Message) { + xxx_messageInfo_Server.Merge(dst, src) +} +func (m *Server) XXX_Size() int { + return xxx_messageInfo_Server.Size(m) +} +func (m *Server) XXX_DiscardUnknown() { + xxx_messageInfo_Server.DiscardUnknown(m) +} + +var xxx_messageInfo_Server proto.InternalMessageInfo + +func (m *Server) GetRef() *ServerRef { + if m != nil { + return m.Ref + } + return nil +} + +func (m *Server) GetData() *ServerData { + if m != nil { + return m.Data + } + return nil +} + +func (m *Server) GetListenSocket() []*SocketRef { + if m != nil { + return m.ListenSocket + } + return nil +} + +// ServerData is data for a specific Server. +type ServerData struct { + // A trace of recent events on the server. May be absent. + Trace *ChannelTrace `protobuf:"bytes,1,opt,name=trace,proto3" json:"trace,omitempty"` + // The number of incoming calls started on the server + CallsStarted int64 `protobuf:"varint,2,opt,name=calls_started,json=callsStarted,proto3" json:"calls_started,omitempty"` + // The number of incoming calls that have completed with an OK status + CallsSucceeded int64 `protobuf:"varint,3,opt,name=calls_succeeded,json=callsSucceeded,proto3" json:"calls_succeeded,omitempty"` + // The number of incoming calls that have a completed with a non-OK status + CallsFailed int64 `protobuf:"varint,4,opt,name=calls_failed,json=callsFailed,proto3" json:"calls_failed,omitempty"` + // The last time a call was started on the server. + LastCallStartedTimestamp *timestamp.Timestamp `protobuf:"bytes,5,opt,name=last_call_started_timestamp,json=lastCallStartedTimestamp,proto3" json:"last_call_started_timestamp,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ServerData) Reset() { *m = ServerData{} } +func (m *ServerData) String() string { return proto.CompactTextString(m) } +func (*ServerData) ProtoMessage() {} +func (*ServerData) Descriptor() ([]byte, []int) { + return fileDescriptor_channelz_ce3ed45d08251f2f, []int{11} +} +func (m *ServerData) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ServerData.Unmarshal(m, b) +} +func (m *ServerData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ServerData.Marshal(b, m, deterministic) +} +func (dst *ServerData) XXX_Merge(src proto.Message) { + xxx_messageInfo_ServerData.Merge(dst, src) +} +func (m *ServerData) XXX_Size() int { + return xxx_messageInfo_ServerData.Size(m) +} +func (m *ServerData) XXX_DiscardUnknown() { + xxx_messageInfo_ServerData.DiscardUnknown(m) +} + +var xxx_messageInfo_ServerData proto.InternalMessageInfo + +func (m *ServerData) GetTrace() *ChannelTrace { + if m != nil { + return m.Trace + } + return nil +} + +func (m *ServerData) GetCallsStarted() int64 { + if m != nil { + return m.CallsStarted + } + return 0 +} + +func (m *ServerData) GetCallsSucceeded() int64 { + if m != nil { + return m.CallsSucceeded + } + return 0 +} + +func (m *ServerData) GetCallsFailed() int64 { + if m != nil { + return m.CallsFailed + } + return 0 +} + +func (m *ServerData) GetLastCallStartedTimestamp() *timestamp.Timestamp { + if m != nil { + return m.LastCallStartedTimestamp + } + return nil +} + +// Information about an actual connection. Pronounced "sock-ay". +type Socket struct { + // The identifier for the Socket. + Ref *SocketRef `protobuf:"bytes,1,opt,name=ref,proto3" json:"ref,omitempty"` + // Data specific to this Socket. + Data *SocketData `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` + // The locally bound address. + Local *Address `protobuf:"bytes,3,opt,name=local,proto3" json:"local,omitempty"` + // The remote bound address. May be absent. + Remote *Address `protobuf:"bytes,4,opt,name=remote,proto3" json:"remote,omitempty"` + // Security details for this socket. May be absent if not available, or + // there is no security on the socket. + Security *Security `protobuf:"bytes,5,opt,name=security,proto3" json:"security,omitempty"` + // Optional, represents the name of the remote endpoint, if different than + // the original target name. + RemoteName string `protobuf:"bytes,6,opt,name=remote_name,json=remoteName,proto3" json:"remote_name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Socket) Reset() { *m = Socket{} } +func (m *Socket) String() string { return proto.CompactTextString(m) } +func (*Socket) ProtoMessage() {} +func (*Socket) Descriptor() ([]byte, []int) { + return fileDescriptor_channelz_ce3ed45d08251f2f, []int{12} +} +func (m *Socket) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Socket.Unmarshal(m, b) +} +func (m *Socket) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Socket.Marshal(b, m, deterministic) +} +func (dst *Socket) XXX_Merge(src proto.Message) { + xxx_messageInfo_Socket.Merge(dst, src) +} +func (m *Socket) XXX_Size() int { + return xxx_messageInfo_Socket.Size(m) +} +func (m *Socket) XXX_DiscardUnknown() { + xxx_messageInfo_Socket.DiscardUnknown(m) +} + +var xxx_messageInfo_Socket proto.InternalMessageInfo + +func (m *Socket) GetRef() *SocketRef { + if m != nil { + return m.Ref + } + return nil +} + +func (m *Socket) GetData() *SocketData { + if m != nil { + return m.Data + } + return nil +} + +func (m *Socket) GetLocal() *Address { + if m != nil { + return m.Local + } + return nil +} + +func (m *Socket) GetRemote() *Address { + if m != nil { + return m.Remote + } + return nil +} + +func (m *Socket) GetSecurity() *Security { + if m != nil { + return m.Security + } + return nil +} + +func (m *Socket) GetRemoteName() string { + if m != nil { + return m.RemoteName + } + return "" +} + +// SocketData is data associated for a specific Socket. The fields present +// are specific to the implementation, so there may be minor differences in +// the semantics. (e.g. flow control windows) +type SocketData struct { + // The number of streams that have been started. + StreamsStarted int64 `protobuf:"varint,1,opt,name=streams_started,json=streamsStarted,proto3" json:"streams_started,omitempty"` + // The number of streams that have ended successfully: + // On client side, received frame with eos bit set; + // On server side, sent frame with eos bit set. + StreamsSucceeded int64 `protobuf:"varint,2,opt,name=streams_succeeded,json=streamsSucceeded,proto3" json:"streams_succeeded,omitempty"` + // The number of streams that have ended unsuccessfully: + // On client side, ended without receiving frame with eos bit set; + // On server side, ended without sending frame with eos bit set. + StreamsFailed int64 `protobuf:"varint,3,opt,name=streams_failed,json=streamsFailed,proto3" json:"streams_failed,omitempty"` + // The number of grpc messages successfully sent on this socket. + MessagesSent int64 `protobuf:"varint,4,opt,name=messages_sent,json=messagesSent,proto3" json:"messages_sent,omitempty"` + // The number of grpc messages received on this socket. + MessagesReceived int64 `protobuf:"varint,5,opt,name=messages_received,json=messagesReceived,proto3" json:"messages_received,omitempty"` + // The number of keep alives sent. This is typically implemented with HTTP/2 + // ping messages. + KeepAlivesSent int64 `protobuf:"varint,6,opt,name=keep_alives_sent,json=keepAlivesSent,proto3" json:"keep_alives_sent,omitempty"` + // The last time a stream was created by this endpoint. Usually unset for + // servers. + LastLocalStreamCreatedTimestamp *timestamp.Timestamp `protobuf:"bytes,7,opt,name=last_local_stream_created_timestamp,json=lastLocalStreamCreatedTimestamp,proto3" json:"last_local_stream_created_timestamp,omitempty"` + // The last time a stream was created by the remote endpoint. Usually unset + // for clients. + LastRemoteStreamCreatedTimestamp *timestamp.Timestamp `protobuf:"bytes,8,opt,name=last_remote_stream_created_timestamp,json=lastRemoteStreamCreatedTimestamp,proto3" json:"last_remote_stream_created_timestamp,omitempty"` + // The last time a message was sent by this endpoint. + LastMessageSentTimestamp *timestamp.Timestamp `protobuf:"bytes,9,opt,name=last_message_sent_timestamp,json=lastMessageSentTimestamp,proto3" json:"last_message_sent_timestamp,omitempty"` + // The last time a message was received by this endpoint. + LastMessageReceivedTimestamp *timestamp.Timestamp `protobuf:"bytes,10,opt,name=last_message_received_timestamp,json=lastMessageReceivedTimestamp,proto3" json:"last_message_received_timestamp,omitempty"` + // The amount of window, granted to the local endpoint by the remote endpoint. + // This may be slightly out of date due to network latency. This does NOT + // include stream level or TCP level flow control info. + LocalFlowControlWindow *wrappers.Int64Value `protobuf:"bytes,11,opt,name=local_flow_control_window,json=localFlowControlWindow,proto3" json:"local_flow_control_window,omitempty"` + // The amount of window, granted to the remote endpoint by the local endpoint. + // This may be slightly out of date due to network latency. This does NOT + // include stream level or TCP level flow control info. + RemoteFlowControlWindow *wrappers.Int64Value `protobuf:"bytes,12,opt,name=remote_flow_control_window,json=remoteFlowControlWindow,proto3" json:"remote_flow_control_window,omitempty"` + // Socket options set on this socket. May be absent. + Option []*SocketOption `protobuf:"bytes,13,rep,name=option,proto3" json:"option,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SocketData) Reset() { *m = SocketData{} } +func (m *SocketData) String() string { return proto.CompactTextString(m) } +func (*SocketData) ProtoMessage() {} +func (*SocketData) Descriptor() ([]byte, []int) { + return fileDescriptor_channelz_ce3ed45d08251f2f, []int{13} +} +func (m *SocketData) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SocketData.Unmarshal(m, b) +} +func (m *SocketData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SocketData.Marshal(b, m, deterministic) +} +func (dst *SocketData) XXX_Merge(src proto.Message) { + xxx_messageInfo_SocketData.Merge(dst, src) +} +func (m *SocketData) XXX_Size() int { + return xxx_messageInfo_SocketData.Size(m) +} +func (m *SocketData) XXX_DiscardUnknown() { + xxx_messageInfo_SocketData.DiscardUnknown(m) +} + +var xxx_messageInfo_SocketData proto.InternalMessageInfo + +func (m *SocketData) GetStreamsStarted() int64 { + if m != nil { + return m.StreamsStarted + } + return 0 +} + +func (m *SocketData) GetStreamsSucceeded() int64 { + if m != nil { + return m.StreamsSucceeded + } + return 0 +} + +func (m *SocketData) GetStreamsFailed() int64 { + if m != nil { + return m.StreamsFailed + } + return 0 +} + +func (m *SocketData) GetMessagesSent() int64 { + if m != nil { + return m.MessagesSent + } + return 0 +} + +func (m *SocketData) GetMessagesReceived() int64 { + if m != nil { + return m.MessagesReceived + } + return 0 +} + +func (m *SocketData) GetKeepAlivesSent() int64 { + if m != nil { + return m.KeepAlivesSent + } + return 0 +} + +func (m *SocketData) GetLastLocalStreamCreatedTimestamp() *timestamp.Timestamp { + if m != nil { + return m.LastLocalStreamCreatedTimestamp + } + return nil +} + +func (m *SocketData) GetLastRemoteStreamCreatedTimestamp() *timestamp.Timestamp { + if m != nil { + return m.LastRemoteStreamCreatedTimestamp + } + return nil +} + +func (m *SocketData) GetLastMessageSentTimestamp() *timestamp.Timestamp { + if m != nil { + return m.LastMessageSentTimestamp + } + return nil +} + +func (m *SocketData) GetLastMessageReceivedTimestamp() *timestamp.Timestamp { + if m != nil { + return m.LastMessageReceivedTimestamp + } + return nil +} + +func (m *SocketData) GetLocalFlowControlWindow() *wrappers.Int64Value { + if m != nil { + return m.LocalFlowControlWindow + } + return nil +} + +func (m *SocketData) GetRemoteFlowControlWindow() *wrappers.Int64Value { + if m != nil { + return m.RemoteFlowControlWindow + } + return nil +} + +func (m *SocketData) GetOption() []*SocketOption { + if m != nil { + return m.Option + } + return nil +} + +// Address represents the address used to create the socket. +type Address struct { + // Types that are valid to be assigned to Address: + // *Address_TcpipAddress + // *Address_UdsAddress_ + // *Address_OtherAddress_ + Address isAddress_Address `protobuf_oneof:"address"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Address) Reset() { *m = Address{} } +func (m *Address) String() string { return proto.CompactTextString(m) } +func (*Address) ProtoMessage() {} +func (*Address) Descriptor() ([]byte, []int) { + return fileDescriptor_channelz_ce3ed45d08251f2f, []int{14} +} +func (m *Address) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Address.Unmarshal(m, b) +} +func (m *Address) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Address.Marshal(b, m, deterministic) +} +func (dst *Address) XXX_Merge(src proto.Message) { + xxx_messageInfo_Address.Merge(dst, src) +} +func (m *Address) XXX_Size() int { + return xxx_messageInfo_Address.Size(m) +} +func (m *Address) XXX_DiscardUnknown() { + xxx_messageInfo_Address.DiscardUnknown(m) +} + +var xxx_messageInfo_Address proto.InternalMessageInfo + +type isAddress_Address interface { + isAddress_Address() +} + +type Address_TcpipAddress struct { + TcpipAddress *Address_TcpIpAddress `protobuf:"bytes,1,opt,name=tcpip_address,json=tcpipAddress,proto3,oneof"` +} +type Address_UdsAddress_ struct { + UdsAddress *Address_UdsAddress `protobuf:"bytes,2,opt,name=uds_address,json=udsAddress,proto3,oneof"` +} +type Address_OtherAddress_ struct { + OtherAddress *Address_OtherAddress `protobuf:"bytes,3,opt,name=other_address,json=otherAddress,proto3,oneof"` +} + +func (*Address_TcpipAddress) isAddress_Address() {} +func (*Address_UdsAddress_) isAddress_Address() {} +func (*Address_OtherAddress_) isAddress_Address() {} + +func (m *Address) GetAddress() isAddress_Address { + if m != nil { + return m.Address + } + return nil +} + +func (m *Address) GetTcpipAddress() *Address_TcpIpAddress { + if x, ok := m.GetAddress().(*Address_TcpipAddress); ok { + return x.TcpipAddress + } + return nil +} + +func (m *Address) GetUdsAddress() *Address_UdsAddress { + if x, ok := m.GetAddress().(*Address_UdsAddress_); ok { + return x.UdsAddress + } + return nil +} + +func (m *Address) GetOtherAddress() *Address_OtherAddress { + if x, ok := m.GetAddress().(*Address_OtherAddress_); ok { + return x.OtherAddress + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*Address) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _Address_OneofMarshaler, _Address_OneofUnmarshaler, _Address_OneofSizer, []interface{}{ + (*Address_TcpipAddress)(nil), + (*Address_UdsAddress_)(nil), + (*Address_OtherAddress_)(nil), + } +} + +func _Address_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*Address) + // address + switch x := m.Address.(type) { + case *Address_TcpipAddress: + b.EncodeVarint(1<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.TcpipAddress); err != nil { + return err + } + case *Address_UdsAddress_: + b.EncodeVarint(2<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.UdsAddress); err != nil { + return err + } + case *Address_OtherAddress_: + b.EncodeVarint(3<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.OtherAddress); err != nil { + return err + } + case nil: + default: + return fmt.Errorf("Address.Address has unexpected type %T", x) + } + return nil +} + +func _Address_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*Address) + switch tag { + case 1: // address.tcpip_address + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(Address_TcpIpAddress) + err := b.DecodeMessage(msg) + m.Address = &Address_TcpipAddress{msg} + return true, err + case 2: // address.uds_address + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(Address_UdsAddress) + err := b.DecodeMessage(msg) + m.Address = &Address_UdsAddress_{msg} + return true, err + case 3: // address.other_address + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(Address_OtherAddress) + err := b.DecodeMessage(msg) + m.Address = &Address_OtherAddress_{msg} + return true, err + default: + return false, nil + } +} + +func _Address_OneofSizer(msg proto.Message) (n int) { + m := msg.(*Address) + // address + switch x := m.Address.(type) { + case *Address_TcpipAddress: + s := proto.Size(x.TcpipAddress) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *Address_UdsAddress_: + s := proto.Size(x.UdsAddress) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *Address_OtherAddress_: + s := proto.Size(x.OtherAddress) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +type Address_TcpIpAddress struct { + // Either the IPv4 or IPv6 address in bytes. Will be either 4 bytes or 16 + // bytes in length. + IpAddress []byte `protobuf:"bytes,1,opt,name=ip_address,json=ipAddress,proto3" json:"ip_address,omitempty"` + // 0-64k, or -1 if not appropriate. + Port int32 `protobuf:"varint,2,opt,name=port,proto3" json:"port,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Address_TcpIpAddress) Reset() { *m = Address_TcpIpAddress{} } +func (m *Address_TcpIpAddress) String() string { return proto.CompactTextString(m) } +func (*Address_TcpIpAddress) ProtoMessage() {} +func (*Address_TcpIpAddress) Descriptor() ([]byte, []int) { + return fileDescriptor_channelz_ce3ed45d08251f2f, []int{14, 0} +} +func (m *Address_TcpIpAddress) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Address_TcpIpAddress.Unmarshal(m, b) +} +func (m *Address_TcpIpAddress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Address_TcpIpAddress.Marshal(b, m, deterministic) +} +func (dst *Address_TcpIpAddress) XXX_Merge(src proto.Message) { + xxx_messageInfo_Address_TcpIpAddress.Merge(dst, src) +} +func (m *Address_TcpIpAddress) XXX_Size() int { + return xxx_messageInfo_Address_TcpIpAddress.Size(m) +} +func (m *Address_TcpIpAddress) XXX_DiscardUnknown() { + xxx_messageInfo_Address_TcpIpAddress.DiscardUnknown(m) +} + +var xxx_messageInfo_Address_TcpIpAddress proto.InternalMessageInfo + +func (m *Address_TcpIpAddress) GetIpAddress() []byte { + if m != nil { + return m.IpAddress + } + return nil +} + +func (m *Address_TcpIpAddress) GetPort() int32 { + if m != nil { + return m.Port + } + return 0 +} + +// A Unix Domain Socket address. +type Address_UdsAddress struct { + Filename string `protobuf:"bytes,1,opt,name=filename,proto3" json:"filename,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Address_UdsAddress) Reset() { *m = Address_UdsAddress{} } +func (m *Address_UdsAddress) String() string { return proto.CompactTextString(m) } +func (*Address_UdsAddress) ProtoMessage() {} +func (*Address_UdsAddress) Descriptor() ([]byte, []int) { + return fileDescriptor_channelz_ce3ed45d08251f2f, []int{14, 1} +} +func (m *Address_UdsAddress) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Address_UdsAddress.Unmarshal(m, b) +} +func (m *Address_UdsAddress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Address_UdsAddress.Marshal(b, m, deterministic) +} +func (dst *Address_UdsAddress) XXX_Merge(src proto.Message) { + xxx_messageInfo_Address_UdsAddress.Merge(dst, src) +} +func (m *Address_UdsAddress) XXX_Size() int { + return xxx_messageInfo_Address_UdsAddress.Size(m) +} +func (m *Address_UdsAddress) XXX_DiscardUnknown() { + xxx_messageInfo_Address_UdsAddress.DiscardUnknown(m) +} + +var xxx_messageInfo_Address_UdsAddress proto.InternalMessageInfo + +func (m *Address_UdsAddress) GetFilename() string { + if m != nil { + return m.Filename + } + return "" +} + +// An address type not included above. +type Address_OtherAddress struct { + // The human readable version of the value. This value should be set. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // The actual address message. + Value *any.Any `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Address_OtherAddress) Reset() { *m = Address_OtherAddress{} } +func (m *Address_OtherAddress) String() string { return proto.CompactTextString(m) } +func (*Address_OtherAddress) ProtoMessage() {} +func (*Address_OtherAddress) Descriptor() ([]byte, []int) { + return fileDescriptor_channelz_ce3ed45d08251f2f, []int{14, 2} +} +func (m *Address_OtherAddress) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Address_OtherAddress.Unmarshal(m, b) +} +func (m *Address_OtherAddress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Address_OtherAddress.Marshal(b, m, deterministic) +} +func (dst *Address_OtherAddress) XXX_Merge(src proto.Message) { + xxx_messageInfo_Address_OtherAddress.Merge(dst, src) +} +func (m *Address_OtherAddress) XXX_Size() int { + return xxx_messageInfo_Address_OtherAddress.Size(m) +} +func (m *Address_OtherAddress) XXX_DiscardUnknown() { + xxx_messageInfo_Address_OtherAddress.DiscardUnknown(m) +} + +var xxx_messageInfo_Address_OtherAddress proto.InternalMessageInfo + +func (m *Address_OtherAddress) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *Address_OtherAddress) GetValue() *any.Any { + if m != nil { + return m.Value + } + return nil +} + +// Security represents details about how secure the socket is. +type Security struct { + // Types that are valid to be assigned to Model: + // *Security_Tls_ + // *Security_Other + Model isSecurity_Model `protobuf_oneof:"model"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Security) Reset() { *m = Security{} } +func (m *Security) String() string { return proto.CompactTextString(m) } +func (*Security) ProtoMessage() {} +func (*Security) Descriptor() ([]byte, []int) { + return fileDescriptor_channelz_ce3ed45d08251f2f, []int{15} +} +func (m *Security) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Security.Unmarshal(m, b) +} +func (m *Security) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Security.Marshal(b, m, deterministic) +} +func (dst *Security) XXX_Merge(src proto.Message) { + xxx_messageInfo_Security.Merge(dst, src) +} +func (m *Security) XXX_Size() int { + return xxx_messageInfo_Security.Size(m) +} +func (m *Security) XXX_DiscardUnknown() { + xxx_messageInfo_Security.DiscardUnknown(m) +} + +var xxx_messageInfo_Security proto.InternalMessageInfo + +type isSecurity_Model interface { + isSecurity_Model() +} + +type Security_Tls_ struct { + Tls *Security_Tls `protobuf:"bytes,1,opt,name=tls,proto3,oneof"` +} +type Security_Other struct { + Other *Security_OtherSecurity `protobuf:"bytes,2,opt,name=other,proto3,oneof"` +} + +func (*Security_Tls_) isSecurity_Model() {} +func (*Security_Other) isSecurity_Model() {} + +func (m *Security) GetModel() isSecurity_Model { + if m != nil { + return m.Model + } + return nil +} + +func (m *Security) GetTls() *Security_Tls { + if x, ok := m.GetModel().(*Security_Tls_); ok { + return x.Tls + } + return nil +} + +func (m *Security) GetOther() *Security_OtherSecurity { + if x, ok := m.GetModel().(*Security_Other); ok { + return x.Other + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*Security) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _Security_OneofMarshaler, _Security_OneofUnmarshaler, _Security_OneofSizer, []interface{}{ + (*Security_Tls_)(nil), + (*Security_Other)(nil), + } +} + +func _Security_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*Security) + // model + switch x := m.Model.(type) { + case *Security_Tls_: + b.EncodeVarint(1<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Tls); err != nil { + return err + } + case *Security_Other: + b.EncodeVarint(2<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Other); err != nil { + return err + } + case nil: + default: + return fmt.Errorf("Security.Model has unexpected type %T", x) + } + return nil +} + +func _Security_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*Security) + switch tag { + case 1: // model.tls + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(Security_Tls) + err := b.DecodeMessage(msg) + m.Model = &Security_Tls_{msg} + return true, err + case 2: // model.other + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(Security_OtherSecurity) + err := b.DecodeMessage(msg) + m.Model = &Security_Other{msg} + return true, err + default: + return false, nil + } +} + +func _Security_OneofSizer(msg proto.Message) (n int) { + m := msg.(*Security) + // model + switch x := m.Model.(type) { + case *Security_Tls_: + s := proto.Size(x.Tls) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *Security_Other: + s := proto.Size(x.Other) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +type Security_Tls struct { + // Types that are valid to be assigned to CipherSuite: + // *Security_Tls_StandardName + // *Security_Tls_OtherName + CipherSuite isSecurity_Tls_CipherSuite `protobuf_oneof:"cipher_suite"` + // the certificate used by this endpoint. + LocalCertificate []byte `protobuf:"bytes,3,opt,name=local_certificate,json=localCertificate,proto3" json:"local_certificate,omitempty"` + // the certificate used by the remote endpoint. + RemoteCertificate []byte `protobuf:"bytes,4,opt,name=remote_certificate,json=remoteCertificate,proto3" json:"remote_certificate,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Security_Tls) Reset() { *m = Security_Tls{} } +func (m *Security_Tls) String() string { return proto.CompactTextString(m) } +func (*Security_Tls) ProtoMessage() {} +func (*Security_Tls) Descriptor() ([]byte, []int) { + return fileDescriptor_channelz_ce3ed45d08251f2f, []int{15, 0} +} +func (m *Security_Tls) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Security_Tls.Unmarshal(m, b) +} +func (m *Security_Tls) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Security_Tls.Marshal(b, m, deterministic) +} +func (dst *Security_Tls) XXX_Merge(src proto.Message) { + xxx_messageInfo_Security_Tls.Merge(dst, src) +} +func (m *Security_Tls) XXX_Size() int { + return xxx_messageInfo_Security_Tls.Size(m) +} +func (m *Security_Tls) XXX_DiscardUnknown() { + xxx_messageInfo_Security_Tls.DiscardUnknown(m) +} + +var xxx_messageInfo_Security_Tls proto.InternalMessageInfo + +type isSecurity_Tls_CipherSuite interface { + isSecurity_Tls_CipherSuite() +} + +type Security_Tls_StandardName struct { + StandardName string `protobuf:"bytes,1,opt,name=standard_name,json=standardName,proto3,oneof"` +} +type Security_Tls_OtherName struct { + OtherName string `protobuf:"bytes,2,opt,name=other_name,json=otherName,proto3,oneof"` +} + +func (*Security_Tls_StandardName) isSecurity_Tls_CipherSuite() {} +func (*Security_Tls_OtherName) isSecurity_Tls_CipherSuite() {} + +func (m *Security_Tls) GetCipherSuite() isSecurity_Tls_CipherSuite { + if m != nil { + return m.CipherSuite + } + return nil +} + +func (m *Security_Tls) GetStandardName() string { + if x, ok := m.GetCipherSuite().(*Security_Tls_StandardName); ok { + return x.StandardName + } + return "" +} + +func (m *Security_Tls) GetOtherName() string { + if x, ok := m.GetCipherSuite().(*Security_Tls_OtherName); ok { + return x.OtherName + } + return "" +} + +func (m *Security_Tls) GetLocalCertificate() []byte { + if m != nil { + return m.LocalCertificate + } + return nil +} + +func (m *Security_Tls) GetRemoteCertificate() []byte { + if m != nil { + return m.RemoteCertificate + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*Security_Tls) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _Security_Tls_OneofMarshaler, _Security_Tls_OneofUnmarshaler, _Security_Tls_OneofSizer, []interface{}{ + (*Security_Tls_StandardName)(nil), + (*Security_Tls_OtherName)(nil), + } +} + +func _Security_Tls_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*Security_Tls) + // cipher_suite + switch x := m.CipherSuite.(type) { + case *Security_Tls_StandardName: + b.EncodeVarint(1<<3 | proto.WireBytes) + b.EncodeStringBytes(x.StandardName) + case *Security_Tls_OtherName: + b.EncodeVarint(2<<3 | proto.WireBytes) + b.EncodeStringBytes(x.OtherName) + case nil: + default: + return fmt.Errorf("Security_Tls.CipherSuite has unexpected type %T", x) + } + return nil +} + +func _Security_Tls_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*Security_Tls) + switch tag { + case 1: // cipher_suite.standard_name + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeStringBytes() + m.CipherSuite = &Security_Tls_StandardName{x} + return true, err + case 2: // cipher_suite.other_name + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeStringBytes() + m.CipherSuite = &Security_Tls_OtherName{x} + return true, err + default: + return false, nil + } +} + +func _Security_Tls_OneofSizer(msg proto.Message) (n int) { + m := msg.(*Security_Tls) + // cipher_suite + switch x := m.CipherSuite.(type) { + case *Security_Tls_StandardName: + n += 1 // tag and wire + n += proto.SizeVarint(uint64(len(x.StandardName))) + n += len(x.StandardName) + case *Security_Tls_OtherName: + n += 1 // tag and wire + n += proto.SizeVarint(uint64(len(x.OtherName))) + n += len(x.OtherName) + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +type Security_OtherSecurity struct { + // The human readable version of the value. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // The actual security details message. + Value *any.Any `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Security_OtherSecurity) Reset() { *m = Security_OtherSecurity{} } +func (m *Security_OtherSecurity) String() string { return proto.CompactTextString(m) } +func (*Security_OtherSecurity) ProtoMessage() {} +func (*Security_OtherSecurity) Descriptor() ([]byte, []int) { + return fileDescriptor_channelz_ce3ed45d08251f2f, []int{15, 1} +} +func (m *Security_OtherSecurity) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Security_OtherSecurity.Unmarshal(m, b) +} +func (m *Security_OtherSecurity) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Security_OtherSecurity.Marshal(b, m, deterministic) +} +func (dst *Security_OtherSecurity) XXX_Merge(src proto.Message) { + xxx_messageInfo_Security_OtherSecurity.Merge(dst, src) +} +func (m *Security_OtherSecurity) XXX_Size() int { + return xxx_messageInfo_Security_OtherSecurity.Size(m) +} +func (m *Security_OtherSecurity) XXX_DiscardUnknown() { + xxx_messageInfo_Security_OtherSecurity.DiscardUnknown(m) +} + +var xxx_messageInfo_Security_OtherSecurity proto.InternalMessageInfo + +func (m *Security_OtherSecurity) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *Security_OtherSecurity) GetValue() *any.Any { + if m != nil { + return m.Value + } + return nil +} + +// SocketOption represents socket options for a socket. Specifically, these +// are the options returned by getsockopt(). +type SocketOption struct { + // The full name of the socket option. Typically this will be the upper case + // name, such as "SO_REUSEPORT". + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // The human readable value of this socket option. At least one of value or + // additional will be set. + Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` + // Additional data associated with the socket option. At least one of value + // or additional will be set. + Additional *any.Any `protobuf:"bytes,3,opt,name=additional,proto3" json:"additional,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SocketOption) Reset() { *m = SocketOption{} } +func (m *SocketOption) String() string { return proto.CompactTextString(m) } +func (*SocketOption) ProtoMessage() {} +func (*SocketOption) Descriptor() ([]byte, []int) { + return fileDescriptor_channelz_ce3ed45d08251f2f, []int{16} +} +func (m *SocketOption) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SocketOption.Unmarshal(m, b) +} +func (m *SocketOption) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SocketOption.Marshal(b, m, deterministic) +} +func (dst *SocketOption) XXX_Merge(src proto.Message) { + xxx_messageInfo_SocketOption.Merge(dst, src) +} +func (m *SocketOption) XXX_Size() int { + return xxx_messageInfo_SocketOption.Size(m) +} +func (m *SocketOption) XXX_DiscardUnknown() { + xxx_messageInfo_SocketOption.DiscardUnknown(m) +} + +var xxx_messageInfo_SocketOption proto.InternalMessageInfo + +func (m *SocketOption) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *SocketOption) GetValue() string { + if m != nil { + return m.Value + } + return "" +} + +func (m *SocketOption) GetAdditional() *any.Any { + if m != nil { + return m.Additional + } + return nil +} + +// For use with SocketOption's additional field. This is primarily used for +// SO_RCVTIMEO and SO_SNDTIMEO +type SocketOptionTimeout struct { + Duration *duration.Duration `protobuf:"bytes,1,opt,name=duration,proto3" json:"duration,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SocketOptionTimeout) Reset() { *m = SocketOptionTimeout{} } +func (m *SocketOptionTimeout) String() string { return proto.CompactTextString(m) } +func (*SocketOptionTimeout) ProtoMessage() {} +func (*SocketOptionTimeout) Descriptor() ([]byte, []int) { + return fileDescriptor_channelz_ce3ed45d08251f2f, []int{17} +} +func (m *SocketOptionTimeout) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SocketOptionTimeout.Unmarshal(m, b) +} +func (m *SocketOptionTimeout) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SocketOptionTimeout.Marshal(b, m, deterministic) +} +func (dst *SocketOptionTimeout) XXX_Merge(src proto.Message) { + xxx_messageInfo_SocketOptionTimeout.Merge(dst, src) +} +func (m *SocketOptionTimeout) XXX_Size() int { + return xxx_messageInfo_SocketOptionTimeout.Size(m) +} +func (m *SocketOptionTimeout) XXX_DiscardUnknown() { + xxx_messageInfo_SocketOptionTimeout.DiscardUnknown(m) +} + +var xxx_messageInfo_SocketOptionTimeout proto.InternalMessageInfo + +func (m *SocketOptionTimeout) GetDuration() *duration.Duration { + if m != nil { + return m.Duration + } + return nil +} + +// For use with SocketOption's additional field. This is primarily used for +// SO_LINGER. +type SocketOptionLinger struct { + // active maps to `struct linger.l_onoff` + Active bool `protobuf:"varint,1,opt,name=active,proto3" json:"active,omitempty"` + // duration maps to `struct linger.l_linger` + Duration *duration.Duration `protobuf:"bytes,2,opt,name=duration,proto3" json:"duration,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SocketOptionLinger) Reset() { *m = SocketOptionLinger{} } +func (m *SocketOptionLinger) String() string { return proto.CompactTextString(m) } +func (*SocketOptionLinger) ProtoMessage() {} +func (*SocketOptionLinger) Descriptor() ([]byte, []int) { + return fileDescriptor_channelz_ce3ed45d08251f2f, []int{18} +} +func (m *SocketOptionLinger) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SocketOptionLinger.Unmarshal(m, b) +} +func (m *SocketOptionLinger) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SocketOptionLinger.Marshal(b, m, deterministic) +} +func (dst *SocketOptionLinger) XXX_Merge(src proto.Message) { + xxx_messageInfo_SocketOptionLinger.Merge(dst, src) +} +func (m *SocketOptionLinger) XXX_Size() int { + return xxx_messageInfo_SocketOptionLinger.Size(m) +} +func (m *SocketOptionLinger) XXX_DiscardUnknown() { + xxx_messageInfo_SocketOptionLinger.DiscardUnknown(m) +} + +var xxx_messageInfo_SocketOptionLinger proto.InternalMessageInfo + +func (m *SocketOptionLinger) GetActive() bool { + if m != nil { + return m.Active + } + return false +} + +func (m *SocketOptionLinger) GetDuration() *duration.Duration { + if m != nil { + return m.Duration + } + return nil +} + +// For use with SocketOption's additional field. Tcp info for +// SOL_TCP and TCP_INFO. +type SocketOptionTcpInfo struct { + TcpiState uint32 `protobuf:"varint,1,opt,name=tcpi_state,json=tcpiState,proto3" json:"tcpi_state,omitempty"` + TcpiCaState uint32 `protobuf:"varint,2,opt,name=tcpi_ca_state,json=tcpiCaState,proto3" json:"tcpi_ca_state,omitempty"` + TcpiRetransmits uint32 `protobuf:"varint,3,opt,name=tcpi_retransmits,json=tcpiRetransmits,proto3" json:"tcpi_retransmits,omitempty"` + TcpiProbes uint32 `protobuf:"varint,4,opt,name=tcpi_probes,json=tcpiProbes,proto3" json:"tcpi_probes,omitempty"` + TcpiBackoff uint32 `protobuf:"varint,5,opt,name=tcpi_backoff,json=tcpiBackoff,proto3" json:"tcpi_backoff,omitempty"` + TcpiOptions uint32 `protobuf:"varint,6,opt,name=tcpi_options,json=tcpiOptions,proto3" json:"tcpi_options,omitempty"` + TcpiSndWscale uint32 `protobuf:"varint,7,opt,name=tcpi_snd_wscale,json=tcpiSndWscale,proto3" json:"tcpi_snd_wscale,omitempty"` + TcpiRcvWscale uint32 `protobuf:"varint,8,opt,name=tcpi_rcv_wscale,json=tcpiRcvWscale,proto3" json:"tcpi_rcv_wscale,omitempty"` + TcpiRto uint32 `protobuf:"varint,9,opt,name=tcpi_rto,json=tcpiRto,proto3" json:"tcpi_rto,omitempty"` + TcpiAto uint32 `protobuf:"varint,10,opt,name=tcpi_ato,json=tcpiAto,proto3" json:"tcpi_ato,omitempty"` + TcpiSndMss uint32 `protobuf:"varint,11,opt,name=tcpi_snd_mss,json=tcpiSndMss,proto3" json:"tcpi_snd_mss,omitempty"` + TcpiRcvMss uint32 `protobuf:"varint,12,opt,name=tcpi_rcv_mss,json=tcpiRcvMss,proto3" json:"tcpi_rcv_mss,omitempty"` + TcpiUnacked uint32 `protobuf:"varint,13,opt,name=tcpi_unacked,json=tcpiUnacked,proto3" json:"tcpi_unacked,omitempty"` + TcpiSacked uint32 `protobuf:"varint,14,opt,name=tcpi_sacked,json=tcpiSacked,proto3" json:"tcpi_sacked,omitempty"` + TcpiLost uint32 `protobuf:"varint,15,opt,name=tcpi_lost,json=tcpiLost,proto3" json:"tcpi_lost,omitempty"` + TcpiRetrans uint32 `protobuf:"varint,16,opt,name=tcpi_retrans,json=tcpiRetrans,proto3" json:"tcpi_retrans,omitempty"` + TcpiFackets uint32 `protobuf:"varint,17,opt,name=tcpi_fackets,json=tcpiFackets,proto3" json:"tcpi_fackets,omitempty"` + TcpiLastDataSent uint32 `protobuf:"varint,18,opt,name=tcpi_last_data_sent,json=tcpiLastDataSent,proto3" json:"tcpi_last_data_sent,omitempty"` + TcpiLastAckSent uint32 `protobuf:"varint,19,opt,name=tcpi_last_ack_sent,json=tcpiLastAckSent,proto3" json:"tcpi_last_ack_sent,omitempty"` + TcpiLastDataRecv uint32 `protobuf:"varint,20,opt,name=tcpi_last_data_recv,json=tcpiLastDataRecv,proto3" json:"tcpi_last_data_recv,omitempty"` + TcpiLastAckRecv uint32 `protobuf:"varint,21,opt,name=tcpi_last_ack_recv,json=tcpiLastAckRecv,proto3" json:"tcpi_last_ack_recv,omitempty"` + TcpiPmtu uint32 `protobuf:"varint,22,opt,name=tcpi_pmtu,json=tcpiPmtu,proto3" json:"tcpi_pmtu,omitempty"` + TcpiRcvSsthresh uint32 `protobuf:"varint,23,opt,name=tcpi_rcv_ssthresh,json=tcpiRcvSsthresh,proto3" json:"tcpi_rcv_ssthresh,omitempty"` + TcpiRtt uint32 `protobuf:"varint,24,opt,name=tcpi_rtt,json=tcpiRtt,proto3" json:"tcpi_rtt,omitempty"` + TcpiRttvar uint32 `protobuf:"varint,25,opt,name=tcpi_rttvar,json=tcpiRttvar,proto3" json:"tcpi_rttvar,omitempty"` + TcpiSndSsthresh uint32 `protobuf:"varint,26,opt,name=tcpi_snd_ssthresh,json=tcpiSndSsthresh,proto3" json:"tcpi_snd_ssthresh,omitempty"` + TcpiSndCwnd uint32 `protobuf:"varint,27,opt,name=tcpi_snd_cwnd,json=tcpiSndCwnd,proto3" json:"tcpi_snd_cwnd,omitempty"` + TcpiAdvmss uint32 `protobuf:"varint,28,opt,name=tcpi_advmss,json=tcpiAdvmss,proto3" json:"tcpi_advmss,omitempty"` + TcpiReordering uint32 `protobuf:"varint,29,opt,name=tcpi_reordering,json=tcpiReordering,proto3" json:"tcpi_reordering,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SocketOptionTcpInfo) Reset() { *m = SocketOptionTcpInfo{} } +func (m *SocketOptionTcpInfo) String() string { return proto.CompactTextString(m) } +func (*SocketOptionTcpInfo) ProtoMessage() {} +func (*SocketOptionTcpInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_channelz_ce3ed45d08251f2f, []int{19} +} +func (m *SocketOptionTcpInfo) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SocketOptionTcpInfo.Unmarshal(m, b) +} +func (m *SocketOptionTcpInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SocketOptionTcpInfo.Marshal(b, m, deterministic) +} +func (dst *SocketOptionTcpInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_SocketOptionTcpInfo.Merge(dst, src) +} +func (m *SocketOptionTcpInfo) XXX_Size() int { + return xxx_messageInfo_SocketOptionTcpInfo.Size(m) +} +func (m *SocketOptionTcpInfo) XXX_DiscardUnknown() { + xxx_messageInfo_SocketOptionTcpInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_SocketOptionTcpInfo proto.InternalMessageInfo + +func (m *SocketOptionTcpInfo) GetTcpiState() uint32 { + if m != nil { + return m.TcpiState + } + return 0 +} + +func (m *SocketOptionTcpInfo) GetTcpiCaState() uint32 { + if m != nil { + return m.TcpiCaState + } + return 0 +} + +func (m *SocketOptionTcpInfo) GetTcpiRetransmits() uint32 { + if m != nil { + return m.TcpiRetransmits + } + return 0 +} + +func (m *SocketOptionTcpInfo) GetTcpiProbes() uint32 { + if m != nil { + return m.TcpiProbes + } + return 0 +} + +func (m *SocketOptionTcpInfo) GetTcpiBackoff() uint32 { + if m != nil { + return m.TcpiBackoff + } + return 0 +} + +func (m *SocketOptionTcpInfo) GetTcpiOptions() uint32 { + if m != nil { + return m.TcpiOptions + } + return 0 +} + +func (m *SocketOptionTcpInfo) GetTcpiSndWscale() uint32 { + if m != nil { + return m.TcpiSndWscale + } + return 0 +} + +func (m *SocketOptionTcpInfo) GetTcpiRcvWscale() uint32 { + if m != nil { + return m.TcpiRcvWscale + } + return 0 +} + +func (m *SocketOptionTcpInfo) GetTcpiRto() uint32 { + if m != nil { + return m.TcpiRto + } + return 0 +} + +func (m *SocketOptionTcpInfo) GetTcpiAto() uint32 { + if m != nil { + return m.TcpiAto + } + return 0 +} + +func (m *SocketOptionTcpInfo) GetTcpiSndMss() uint32 { + if m != nil { + return m.TcpiSndMss + } + return 0 +} + +func (m *SocketOptionTcpInfo) GetTcpiRcvMss() uint32 { + if m != nil { + return m.TcpiRcvMss + } + return 0 +} + +func (m *SocketOptionTcpInfo) GetTcpiUnacked() uint32 { + if m != nil { + return m.TcpiUnacked + } + return 0 +} + +func (m *SocketOptionTcpInfo) GetTcpiSacked() uint32 { + if m != nil { + return m.TcpiSacked + } + return 0 +} + +func (m *SocketOptionTcpInfo) GetTcpiLost() uint32 { + if m != nil { + return m.TcpiLost + } + return 0 +} + +func (m *SocketOptionTcpInfo) GetTcpiRetrans() uint32 { + if m != nil { + return m.TcpiRetrans + } + return 0 +} + +func (m *SocketOptionTcpInfo) GetTcpiFackets() uint32 { + if m != nil { + return m.TcpiFackets + } + return 0 +} + +func (m *SocketOptionTcpInfo) GetTcpiLastDataSent() uint32 { + if m != nil { + return m.TcpiLastDataSent + } + return 0 +} + +func (m *SocketOptionTcpInfo) GetTcpiLastAckSent() uint32 { + if m != nil { + return m.TcpiLastAckSent + } + return 0 +} + +func (m *SocketOptionTcpInfo) GetTcpiLastDataRecv() uint32 { + if m != nil { + return m.TcpiLastDataRecv + } + return 0 +} + +func (m *SocketOptionTcpInfo) GetTcpiLastAckRecv() uint32 { + if m != nil { + return m.TcpiLastAckRecv + } + return 0 +} + +func (m *SocketOptionTcpInfo) GetTcpiPmtu() uint32 { + if m != nil { + return m.TcpiPmtu + } + return 0 +} + +func (m *SocketOptionTcpInfo) GetTcpiRcvSsthresh() uint32 { + if m != nil { + return m.TcpiRcvSsthresh + } + return 0 +} + +func (m *SocketOptionTcpInfo) GetTcpiRtt() uint32 { + if m != nil { + return m.TcpiRtt + } + return 0 +} + +func (m *SocketOptionTcpInfo) GetTcpiRttvar() uint32 { + if m != nil { + return m.TcpiRttvar + } + return 0 +} + +func (m *SocketOptionTcpInfo) GetTcpiSndSsthresh() uint32 { + if m != nil { + return m.TcpiSndSsthresh + } + return 0 +} + +func (m *SocketOptionTcpInfo) GetTcpiSndCwnd() uint32 { + if m != nil { + return m.TcpiSndCwnd + } + return 0 +} + +func (m *SocketOptionTcpInfo) GetTcpiAdvmss() uint32 { + if m != nil { + return m.TcpiAdvmss + } + return 0 +} + +func (m *SocketOptionTcpInfo) GetTcpiReordering() uint32 { + if m != nil { + return m.TcpiReordering + } + return 0 +} + +type GetTopChannelsRequest struct { + // start_channel_id indicates that only channels at or above this id should be + // included in the results. + StartChannelId int64 `protobuf:"varint,1,opt,name=start_channel_id,json=startChannelId,proto3" json:"start_channel_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetTopChannelsRequest) Reset() { *m = GetTopChannelsRequest{} } +func (m *GetTopChannelsRequest) String() string { return proto.CompactTextString(m) } +func (*GetTopChannelsRequest) ProtoMessage() {} +func (*GetTopChannelsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_channelz_ce3ed45d08251f2f, []int{20} +} +func (m *GetTopChannelsRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetTopChannelsRequest.Unmarshal(m, b) +} +func (m *GetTopChannelsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetTopChannelsRequest.Marshal(b, m, deterministic) +} +func (dst *GetTopChannelsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetTopChannelsRequest.Merge(dst, src) +} +func (m *GetTopChannelsRequest) XXX_Size() int { + return xxx_messageInfo_GetTopChannelsRequest.Size(m) +} +func (m *GetTopChannelsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetTopChannelsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetTopChannelsRequest proto.InternalMessageInfo + +func (m *GetTopChannelsRequest) GetStartChannelId() int64 { + if m != nil { + return m.StartChannelId + } + return 0 +} + +type GetTopChannelsResponse struct { + // list of channels that the connection detail service knows about. Sorted in + // ascending channel_id order. + Channel []*Channel `protobuf:"bytes,1,rep,name=channel,proto3" json:"channel,omitempty"` + // If set, indicates that the list of channels is the final list. Requesting + // more channels can only return more if they are created after this RPC + // completes. + End bool `protobuf:"varint,2,opt,name=end,proto3" json:"end,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetTopChannelsResponse) Reset() { *m = GetTopChannelsResponse{} } +func (m *GetTopChannelsResponse) String() string { return proto.CompactTextString(m) } +func (*GetTopChannelsResponse) ProtoMessage() {} +func (*GetTopChannelsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_channelz_ce3ed45d08251f2f, []int{21} +} +func (m *GetTopChannelsResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetTopChannelsResponse.Unmarshal(m, b) +} +func (m *GetTopChannelsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetTopChannelsResponse.Marshal(b, m, deterministic) +} +func (dst *GetTopChannelsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetTopChannelsResponse.Merge(dst, src) +} +func (m *GetTopChannelsResponse) XXX_Size() int { + return xxx_messageInfo_GetTopChannelsResponse.Size(m) +} +func (m *GetTopChannelsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetTopChannelsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetTopChannelsResponse proto.InternalMessageInfo + +func (m *GetTopChannelsResponse) GetChannel() []*Channel { + if m != nil { + return m.Channel + } + return nil +} + +func (m *GetTopChannelsResponse) GetEnd() bool { + if m != nil { + return m.End + } + return false +} + +type GetServersRequest struct { + // start_server_id indicates that only servers at or above this id should be + // included in the results. + StartServerId int64 `protobuf:"varint,1,opt,name=start_server_id,json=startServerId,proto3" json:"start_server_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetServersRequest) Reset() { *m = GetServersRequest{} } +func (m *GetServersRequest) String() string { return proto.CompactTextString(m) } +func (*GetServersRequest) ProtoMessage() {} +func (*GetServersRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_channelz_ce3ed45d08251f2f, []int{22} +} +func (m *GetServersRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetServersRequest.Unmarshal(m, b) +} +func (m *GetServersRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetServersRequest.Marshal(b, m, deterministic) +} +func (dst *GetServersRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetServersRequest.Merge(dst, src) +} +func (m *GetServersRequest) XXX_Size() int { + return xxx_messageInfo_GetServersRequest.Size(m) +} +func (m *GetServersRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetServersRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetServersRequest proto.InternalMessageInfo + +func (m *GetServersRequest) GetStartServerId() int64 { + if m != nil { + return m.StartServerId + } + return 0 +} + +type GetServersResponse struct { + // list of servers that the connection detail service knows about. Sorted in + // ascending server_id order. + Server []*Server `protobuf:"bytes,1,rep,name=server,proto3" json:"server,omitempty"` + // If set, indicates that the list of servers is the final list. Requesting + // more servers will only return more if they are created after this RPC + // completes. + End bool `protobuf:"varint,2,opt,name=end,proto3" json:"end,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetServersResponse) Reset() { *m = GetServersResponse{} } +func (m *GetServersResponse) String() string { return proto.CompactTextString(m) } +func (*GetServersResponse) ProtoMessage() {} +func (*GetServersResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_channelz_ce3ed45d08251f2f, []int{23} +} +func (m *GetServersResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetServersResponse.Unmarshal(m, b) +} +func (m *GetServersResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetServersResponse.Marshal(b, m, deterministic) +} +func (dst *GetServersResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetServersResponse.Merge(dst, src) +} +func (m *GetServersResponse) XXX_Size() int { + return xxx_messageInfo_GetServersResponse.Size(m) +} +func (m *GetServersResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetServersResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetServersResponse proto.InternalMessageInfo + +func (m *GetServersResponse) GetServer() []*Server { + if m != nil { + return m.Server + } + return nil +} + +func (m *GetServersResponse) GetEnd() bool { + if m != nil { + return m.End + } + return false +} + +type GetServerSocketsRequest struct { + ServerId int64 `protobuf:"varint,1,opt,name=server_id,json=serverId,proto3" json:"server_id,omitempty"` + // start_socket_id indicates that only sockets at or above this id should be + // included in the results. + StartSocketId int64 `protobuf:"varint,2,opt,name=start_socket_id,json=startSocketId,proto3" json:"start_socket_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetServerSocketsRequest) Reset() { *m = GetServerSocketsRequest{} } +func (m *GetServerSocketsRequest) String() string { return proto.CompactTextString(m) } +func (*GetServerSocketsRequest) ProtoMessage() {} +func (*GetServerSocketsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_channelz_ce3ed45d08251f2f, []int{24} +} +func (m *GetServerSocketsRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetServerSocketsRequest.Unmarshal(m, b) +} +func (m *GetServerSocketsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetServerSocketsRequest.Marshal(b, m, deterministic) +} +func (dst *GetServerSocketsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetServerSocketsRequest.Merge(dst, src) +} +func (m *GetServerSocketsRequest) XXX_Size() int { + return xxx_messageInfo_GetServerSocketsRequest.Size(m) +} +func (m *GetServerSocketsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetServerSocketsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetServerSocketsRequest proto.InternalMessageInfo + +func (m *GetServerSocketsRequest) GetServerId() int64 { + if m != nil { + return m.ServerId + } + return 0 +} + +func (m *GetServerSocketsRequest) GetStartSocketId() int64 { + if m != nil { + return m.StartSocketId + } + return 0 +} + +type GetServerSocketsResponse struct { + // list of socket refs that the connection detail service knows about. Sorted in + // ascending socket_id order. + SocketRef []*SocketRef `protobuf:"bytes,1,rep,name=socket_ref,json=socketRef,proto3" json:"socket_ref,omitempty"` + // If set, indicates that the list of sockets is the final list. Requesting + // more sockets will only return more if they are created after this RPC + // completes. + End bool `protobuf:"varint,2,opt,name=end,proto3" json:"end,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetServerSocketsResponse) Reset() { *m = GetServerSocketsResponse{} } +func (m *GetServerSocketsResponse) String() string { return proto.CompactTextString(m) } +func (*GetServerSocketsResponse) ProtoMessage() {} +func (*GetServerSocketsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_channelz_ce3ed45d08251f2f, []int{25} +} +func (m *GetServerSocketsResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetServerSocketsResponse.Unmarshal(m, b) +} +func (m *GetServerSocketsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetServerSocketsResponse.Marshal(b, m, deterministic) +} +func (dst *GetServerSocketsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetServerSocketsResponse.Merge(dst, src) +} +func (m *GetServerSocketsResponse) XXX_Size() int { + return xxx_messageInfo_GetServerSocketsResponse.Size(m) +} +func (m *GetServerSocketsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetServerSocketsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetServerSocketsResponse proto.InternalMessageInfo + +func (m *GetServerSocketsResponse) GetSocketRef() []*SocketRef { + if m != nil { + return m.SocketRef + } + return nil +} + +func (m *GetServerSocketsResponse) GetEnd() bool { + if m != nil { + return m.End + } + return false +} + +type GetChannelRequest struct { + // channel_id is the identifier of the specific channel to get. + ChannelId int64 `protobuf:"varint,1,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetChannelRequest) Reset() { *m = GetChannelRequest{} } +func (m *GetChannelRequest) String() string { return proto.CompactTextString(m) } +func (*GetChannelRequest) ProtoMessage() {} +func (*GetChannelRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_channelz_ce3ed45d08251f2f, []int{26} +} +func (m *GetChannelRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetChannelRequest.Unmarshal(m, b) +} +func (m *GetChannelRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetChannelRequest.Marshal(b, m, deterministic) +} +func (dst *GetChannelRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetChannelRequest.Merge(dst, src) +} +func (m *GetChannelRequest) XXX_Size() int { + return xxx_messageInfo_GetChannelRequest.Size(m) +} +func (m *GetChannelRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetChannelRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetChannelRequest proto.InternalMessageInfo + +func (m *GetChannelRequest) GetChannelId() int64 { + if m != nil { + return m.ChannelId + } + return 0 +} + +type GetChannelResponse struct { + // The Channel that corresponds to the requested channel_id. This field + // should be set. + Channel *Channel `protobuf:"bytes,1,opt,name=channel,proto3" json:"channel,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetChannelResponse) Reset() { *m = GetChannelResponse{} } +func (m *GetChannelResponse) String() string { return proto.CompactTextString(m) } +func (*GetChannelResponse) ProtoMessage() {} +func (*GetChannelResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_channelz_ce3ed45d08251f2f, []int{27} +} +func (m *GetChannelResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetChannelResponse.Unmarshal(m, b) +} +func (m *GetChannelResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetChannelResponse.Marshal(b, m, deterministic) +} +func (dst *GetChannelResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetChannelResponse.Merge(dst, src) +} +func (m *GetChannelResponse) XXX_Size() int { + return xxx_messageInfo_GetChannelResponse.Size(m) +} +func (m *GetChannelResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetChannelResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetChannelResponse proto.InternalMessageInfo + +func (m *GetChannelResponse) GetChannel() *Channel { + if m != nil { + return m.Channel + } + return nil +} + +type GetSubchannelRequest struct { + // subchannel_id is the identifier of the specific subchannel to get. + SubchannelId int64 `protobuf:"varint,1,opt,name=subchannel_id,json=subchannelId,proto3" json:"subchannel_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetSubchannelRequest) Reset() { *m = GetSubchannelRequest{} } +func (m *GetSubchannelRequest) String() string { return proto.CompactTextString(m) } +func (*GetSubchannelRequest) ProtoMessage() {} +func (*GetSubchannelRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_channelz_ce3ed45d08251f2f, []int{28} +} +func (m *GetSubchannelRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetSubchannelRequest.Unmarshal(m, b) +} +func (m *GetSubchannelRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetSubchannelRequest.Marshal(b, m, deterministic) +} +func (dst *GetSubchannelRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetSubchannelRequest.Merge(dst, src) +} +func (m *GetSubchannelRequest) XXX_Size() int { + return xxx_messageInfo_GetSubchannelRequest.Size(m) +} +func (m *GetSubchannelRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetSubchannelRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetSubchannelRequest proto.InternalMessageInfo + +func (m *GetSubchannelRequest) GetSubchannelId() int64 { + if m != nil { + return m.SubchannelId + } + return 0 +} + +type GetSubchannelResponse struct { + // The Subchannel that corresponds to the requested subchannel_id. This + // field should be set. + Subchannel *Subchannel `protobuf:"bytes,1,opt,name=subchannel,proto3" json:"subchannel,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetSubchannelResponse) Reset() { *m = GetSubchannelResponse{} } +func (m *GetSubchannelResponse) String() string { return proto.CompactTextString(m) } +func (*GetSubchannelResponse) ProtoMessage() {} +func (*GetSubchannelResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_channelz_ce3ed45d08251f2f, []int{29} +} +func (m *GetSubchannelResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetSubchannelResponse.Unmarshal(m, b) +} +func (m *GetSubchannelResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetSubchannelResponse.Marshal(b, m, deterministic) +} +func (dst *GetSubchannelResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetSubchannelResponse.Merge(dst, src) +} +func (m *GetSubchannelResponse) XXX_Size() int { + return xxx_messageInfo_GetSubchannelResponse.Size(m) +} +func (m *GetSubchannelResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetSubchannelResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetSubchannelResponse proto.InternalMessageInfo + +func (m *GetSubchannelResponse) GetSubchannel() *Subchannel { + if m != nil { + return m.Subchannel + } + return nil +} + +type GetSocketRequest struct { + // socket_id is the identifier of the specific socket to get. + SocketId int64 `protobuf:"varint,1,opt,name=socket_id,json=socketId,proto3" json:"socket_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetSocketRequest) Reset() { *m = GetSocketRequest{} } +func (m *GetSocketRequest) String() string { return proto.CompactTextString(m) } +func (*GetSocketRequest) ProtoMessage() {} +func (*GetSocketRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_channelz_ce3ed45d08251f2f, []int{30} +} +func (m *GetSocketRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetSocketRequest.Unmarshal(m, b) +} +func (m *GetSocketRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetSocketRequest.Marshal(b, m, deterministic) +} +func (dst *GetSocketRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetSocketRequest.Merge(dst, src) +} +func (m *GetSocketRequest) XXX_Size() int { + return xxx_messageInfo_GetSocketRequest.Size(m) +} +func (m *GetSocketRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetSocketRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetSocketRequest proto.InternalMessageInfo + +func (m *GetSocketRequest) GetSocketId() int64 { + if m != nil { + return m.SocketId + } + return 0 +} + +type GetSocketResponse struct { + // The Socket that corresponds to the requested socket_id. This field + // should be set. + Socket *Socket `protobuf:"bytes,1,opt,name=socket,proto3" json:"socket,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetSocketResponse) Reset() { *m = GetSocketResponse{} } +func (m *GetSocketResponse) String() string { return proto.CompactTextString(m) } +func (*GetSocketResponse) ProtoMessage() {} +func (*GetSocketResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_channelz_ce3ed45d08251f2f, []int{31} +} +func (m *GetSocketResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetSocketResponse.Unmarshal(m, b) +} +func (m *GetSocketResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetSocketResponse.Marshal(b, m, deterministic) +} +func (dst *GetSocketResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetSocketResponse.Merge(dst, src) +} +func (m *GetSocketResponse) XXX_Size() int { + return xxx_messageInfo_GetSocketResponse.Size(m) +} +func (m *GetSocketResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetSocketResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetSocketResponse proto.InternalMessageInfo + +func (m *GetSocketResponse) GetSocket() *Socket { + if m != nil { + return m.Socket + } + return nil +} + +func init() { + proto.RegisterType((*Channel)(nil), "grpc.channelz.v1.Channel") + proto.RegisterType((*Subchannel)(nil), "grpc.channelz.v1.Subchannel") + proto.RegisterType((*ChannelConnectivityState)(nil), "grpc.channelz.v1.ChannelConnectivityState") + proto.RegisterType((*ChannelData)(nil), "grpc.channelz.v1.ChannelData") + proto.RegisterType((*ChannelTraceEvent)(nil), "grpc.channelz.v1.ChannelTraceEvent") + proto.RegisterType((*ChannelTrace)(nil), "grpc.channelz.v1.ChannelTrace") + proto.RegisterType((*ChannelRef)(nil), "grpc.channelz.v1.ChannelRef") + proto.RegisterType((*SubchannelRef)(nil), "grpc.channelz.v1.SubchannelRef") + proto.RegisterType((*SocketRef)(nil), "grpc.channelz.v1.SocketRef") + proto.RegisterType((*ServerRef)(nil), "grpc.channelz.v1.ServerRef") + proto.RegisterType((*Server)(nil), "grpc.channelz.v1.Server") + proto.RegisterType((*ServerData)(nil), "grpc.channelz.v1.ServerData") + proto.RegisterType((*Socket)(nil), "grpc.channelz.v1.Socket") + proto.RegisterType((*SocketData)(nil), "grpc.channelz.v1.SocketData") + proto.RegisterType((*Address)(nil), "grpc.channelz.v1.Address") + proto.RegisterType((*Address_TcpIpAddress)(nil), "grpc.channelz.v1.Address.TcpIpAddress") + proto.RegisterType((*Address_UdsAddress)(nil), "grpc.channelz.v1.Address.UdsAddress") + proto.RegisterType((*Address_OtherAddress)(nil), "grpc.channelz.v1.Address.OtherAddress") + proto.RegisterType((*Security)(nil), "grpc.channelz.v1.Security") + proto.RegisterType((*Security_Tls)(nil), "grpc.channelz.v1.Security.Tls") + proto.RegisterType((*Security_OtherSecurity)(nil), "grpc.channelz.v1.Security.OtherSecurity") + proto.RegisterType((*SocketOption)(nil), "grpc.channelz.v1.SocketOption") + proto.RegisterType((*SocketOptionTimeout)(nil), "grpc.channelz.v1.SocketOptionTimeout") + proto.RegisterType((*SocketOptionLinger)(nil), "grpc.channelz.v1.SocketOptionLinger") + proto.RegisterType((*SocketOptionTcpInfo)(nil), "grpc.channelz.v1.SocketOptionTcpInfo") + proto.RegisterType((*GetTopChannelsRequest)(nil), "grpc.channelz.v1.GetTopChannelsRequest") + proto.RegisterType((*GetTopChannelsResponse)(nil), "grpc.channelz.v1.GetTopChannelsResponse") + proto.RegisterType((*GetServersRequest)(nil), "grpc.channelz.v1.GetServersRequest") + proto.RegisterType((*GetServersResponse)(nil), "grpc.channelz.v1.GetServersResponse") + proto.RegisterType((*GetServerSocketsRequest)(nil), "grpc.channelz.v1.GetServerSocketsRequest") + proto.RegisterType((*GetServerSocketsResponse)(nil), "grpc.channelz.v1.GetServerSocketsResponse") + proto.RegisterType((*GetChannelRequest)(nil), "grpc.channelz.v1.GetChannelRequest") + proto.RegisterType((*GetChannelResponse)(nil), "grpc.channelz.v1.GetChannelResponse") + proto.RegisterType((*GetSubchannelRequest)(nil), "grpc.channelz.v1.GetSubchannelRequest") + proto.RegisterType((*GetSubchannelResponse)(nil), "grpc.channelz.v1.GetSubchannelResponse") + proto.RegisterType((*GetSocketRequest)(nil), "grpc.channelz.v1.GetSocketRequest") + proto.RegisterType((*GetSocketResponse)(nil), "grpc.channelz.v1.GetSocketResponse") + proto.RegisterEnum("grpc.channelz.v1.ChannelConnectivityState_State", ChannelConnectivityState_State_name, ChannelConnectivityState_State_value) + proto.RegisterEnum("grpc.channelz.v1.ChannelTraceEvent_Severity", ChannelTraceEvent_Severity_name, ChannelTraceEvent_Severity_value) +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// ChannelzClient is the client API for Channelz service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type ChannelzClient interface { + // Gets all root channels (i.e. channels the application has directly + // created). This does not include subchannels nor non-top level channels. + GetTopChannels(ctx context.Context, in *GetTopChannelsRequest, opts ...grpc.CallOption) (*GetTopChannelsResponse, error) + // Gets all servers that exist in the process. + GetServers(ctx context.Context, in *GetServersRequest, opts ...grpc.CallOption) (*GetServersResponse, error) + // Gets all server sockets that exist in the process. + GetServerSockets(ctx context.Context, in *GetServerSocketsRequest, opts ...grpc.CallOption) (*GetServerSocketsResponse, error) + // Returns a single Channel, or else a NOT_FOUND code. + GetChannel(ctx context.Context, in *GetChannelRequest, opts ...grpc.CallOption) (*GetChannelResponse, error) + // Returns a single Subchannel, or else a NOT_FOUND code. + GetSubchannel(ctx context.Context, in *GetSubchannelRequest, opts ...grpc.CallOption) (*GetSubchannelResponse, error) + // Returns a single Socket or else a NOT_FOUND code. + GetSocket(ctx context.Context, in *GetSocketRequest, opts ...grpc.CallOption) (*GetSocketResponse, error) +} + +type channelzClient struct { + cc *grpc.ClientConn +} + +func NewChannelzClient(cc *grpc.ClientConn) ChannelzClient { + return &channelzClient{cc} +} + +func (c *channelzClient) GetTopChannels(ctx context.Context, in *GetTopChannelsRequest, opts ...grpc.CallOption) (*GetTopChannelsResponse, error) { + out := new(GetTopChannelsResponse) + err := c.cc.Invoke(ctx, "/grpc.channelz.v1.Channelz/GetTopChannels", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *channelzClient) GetServers(ctx context.Context, in *GetServersRequest, opts ...grpc.CallOption) (*GetServersResponse, error) { + out := new(GetServersResponse) + err := c.cc.Invoke(ctx, "/grpc.channelz.v1.Channelz/GetServers", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *channelzClient) GetServerSockets(ctx context.Context, in *GetServerSocketsRequest, opts ...grpc.CallOption) (*GetServerSocketsResponse, error) { + out := new(GetServerSocketsResponse) + err := c.cc.Invoke(ctx, "/grpc.channelz.v1.Channelz/GetServerSockets", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *channelzClient) GetChannel(ctx context.Context, in *GetChannelRequest, opts ...grpc.CallOption) (*GetChannelResponse, error) { + out := new(GetChannelResponse) + err := c.cc.Invoke(ctx, "/grpc.channelz.v1.Channelz/GetChannel", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *channelzClient) GetSubchannel(ctx context.Context, in *GetSubchannelRequest, opts ...grpc.CallOption) (*GetSubchannelResponse, error) { + out := new(GetSubchannelResponse) + err := c.cc.Invoke(ctx, "/grpc.channelz.v1.Channelz/GetSubchannel", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *channelzClient) GetSocket(ctx context.Context, in *GetSocketRequest, opts ...grpc.CallOption) (*GetSocketResponse, error) { + out := new(GetSocketResponse) + err := c.cc.Invoke(ctx, "/grpc.channelz.v1.Channelz/GetSocket", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// ChannelzServer is the server API for Channelz service. +type ChannelzServer interface { + // Gets all root channels (i.e. channels the application has directly + // created). This does not include subchannels nor non-top level channels. + GetTopChannels(context.Context, *GetTopChannelsRequest) (*GetTopChannelsResponse, error) + // Gets all servers that exist in the process. + GetServers(context.Context, *GetServersRequest) (*GetServersResponse, error) + // Gets all server sockets that exist in the process. + GetServerSockets(context.Context, *GetServerSocketsRequest) (*GetServerSocketsResponse, error) + // Returns a single Channel, or else a NOT_FOUND code. + GetChannel(context.Context, *GetChannelRequest) (*GetChannelResponse, error) + // Returns a single Subchannel, or else a NOT_FOUND code. + GetSubchannel(context.Context, *GetSubchannelRequest) (*GetSubchannelResponse, error) + // Returns a single Socket or else a NOT_FOUND code. + GetSocket(context.Context, *GetSocketRequest) (*GetSocketResponse, error) +} + +func RegisterChannelzServer(s *grpc.Server, srv ChannelzServer) { + s.RegisterService(&_Channelz_serviceDesc, srv) +} + +func _Channelz_GetTopChannels_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetTopChannelsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ChannelzServer).GetTopChannels(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.channelz.v1.Channelz/GetTopChannels", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ChannelzServer).GetTopChannels(ctx, req.(*GetTopChannelsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Channelz_GetServers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetServersRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ChannelzServer).GetServers(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.channelz.v1.Channelz/GetServers", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ChannelzServer).GetServers(ctx, req.(*GetServersRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Channelz_GetServerSockets_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetServerSocketsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ChannelzServer).GetServerSockets(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.channelz.v1.Channelz/GetServerSockets", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ChannelzServer).GetServerSockets(ctx, req.(*GetServerSocketsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Channelz_GetChannel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetChannelRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ChannelzServer).GetChannel(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.channelz.v1.Channelz/GetChannel", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ChannelzServer).GetChannel(ctx, req.(*GetChannelRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Channelz_GetSubchannel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetSubchannelRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ChannelzServer).GetSubchannel(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.channelz.v1.Channelz/GetSubchannel", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ChannelzServer).GetSubchannel(ctx, req.(*GetSubchannelRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Channelz_GetSocket_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetSocketRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ChannelzServer).GetSocket(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.channelz.v1.Channelz/GetSocket", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ChannelzServer).GetSocket(ctx, req.(*GetSocketRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Channelz_serviceDesc = grpc.ServiceDesc{ + ServiceName: "grpc.channelz.v1.Channelz", + HandlerType: (*ChannelzServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetTopChannels", + Handler: _Channelz_GetTopChannels_Handler, + }, + { + MethodName: "GetServers", + Handler: _Channelz_GetServers_Handler, + }, + { + MethodName: "GetServerSockets", + Handler: _Channelz_GetServerSockets_Handler, + }, + { + MethodName: "GetChannel", + Handler: _Channelz_GetChannel_Handler, + }, + { + MethodName: "GetSubchannel", + Handler: _Channelz_GetSubchannel_Handler, + }, + { + MethodName: "GetSocket", + Handler: _Channelz_GetSocket_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "grpc/channelz/v1/channelz.proto", +} + +func init() { + proto.RegisterFile("grpc/channelz/v1/channelz.proto", fileDescriptor_channelz_ce3ed45d08251f2f) +} + +var fileDescriptor_channelz_ce3ed45d08251f2f = []byte{ + // 2515 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x59, 0x4b, 0x6f, 0xdb, 0xca, + 0x15, 0xb6, 0xde, 0xd4, 0xd1, 0x23, 0xf2, 0xe4, 0x45, 0x2b, 0x0f, 0xbb, 0x74, 0x6e, 0xe2, 0x9b, + 0x34, 0x72, 0xec, 0x9b, 0x06, 0x45, 0xd3, 0xa2, 0x57, 0x56, 0xec, 0x58, 0xae, 0x23, 0x07, 0x94, + 0x7c, 0x93, 0xdb, 0xc5, 0xe5, 0x65, 0xc8, 0xb1, 0xcc, 0x9a, 0x22, 0x55, 0xce, 0x48, 0x46, 0xb2, + 0xed, 0xbe, 0xcb, 0xa2, 0xbf, 0xa0, 0x9b, 0x2e, 0x0a, 0x14, 0x28, 0xd0, 0x6e, 0x8b, 0xfe, 0x99, + 0xfe, 0x8b, 0x62, 0x1e, 0x7c, 0xc8, 0x92, 0x2c, 0x07, 0x59, 0x76, 0x63, 0x88, 0x87, 0xdf, 0xf9, + 0xce, 0x99, 0xf3, 0x9a, 0xe1, 0x18, 0x56, 0xfb, 0xc1, 0xd0, 0xda, 0xb4, 0x4e, 0x4d, 0xcf, 0xc3, + 0xee, 0xa7, 0xcd, 0xf1, 0x56, 0xf4, 0xbb, 0x31, 0x0c, 0x7c, 0xea, 0xa3, 0x1a, 0x03, 0x34, 0x22, + 0xe1, 0x78, 0xab, 0xbe, 0xd2, 0xf7, 0xfd, 0xbe, 0x8b, 0x37, 0xf9, 0xfb, 0x0f, 0xa3, 0x93, 0x4d, + 0xd3, 0xfb, 0x28, 0xc0, 0xf5, 0xfb, 0x17, 0x5f, 0xd9, 0xa3, 0xc0, 0xa4, 0x8e, 0xef, 0xc9, 0xf7, + 0xab, 0x17, 0xdf, 0x53, 0x67, 0x80, 0x09, 0x35, 0x07, 0xc3, 0x79, 0x04, 0xe7, 0x81, 0x39, 0x1c, + 0xe2, 0x80, 0x88, 0xf7, 0xda, 0xdf, 0xd2, 0x50, 0x68, 0x09, 0x5f, 0x50, 0x03, 0x32, 0x01, 0x3e, + 0x51, 0x53, 0x6b, 0xa9, 0x8d, 0xd2, 0xf6, 0xdd, 0xc6, 0x45, 0x3f, 0x1b, 0x12, 0xa7, 0xe3, 0x13, + 0x9d, 0x01, 0xd1, 0x16, 0x64, 0x6d, 0x93, 0x9a, 0x6a, 0x9a, 0x2b, 0xdc, 0x9b, 0xab, 0xf0, 0xca, + 0xa4, 0xa6, 0xce, 0xa1, 0xe8, 0x57, 0x50, 0x92, 0x00, 0x83, 0x99, 0xca, 0xac, 0x65, 0x16, 0x9a, + 0x02, 0x2b, 0xfa, 0x8d, 0xf6, 0xa0, 0x4a, 0x46, 0x1f, 0x92, 0x0c, 0x59, 0xce, 0xb0, 0x3a, 0xcd, + 0xd0, 0x8d, 0x70, 0x8c, 0xa4, 0x42, 0x92, 0x8f, 0xe8, 0x17, 0x00, 0xc4, 0xb7, 0xce, 0x30, 0xe5, + 0x1c, 0x39, 0xce, 0x71, 0x67, 0x06, 0x07, 0xc7, 0x30, 0xfd, 0x22, 0x09, 0x7f, 0x6a, 0xff, 0x48, + 0x03, 0xc4, 0xe4, 0x68, 0x2b, 0x19, 0xb4, 0x85, 0x7e, 0xfc, 0x1f, 0xc7, 0xed, 0xdf, 0x29, 0x50, + 0xa5, 0x7b, 0x2d, 0xdf, 0xf3, 0xb0, 0x45, 0x9d, 0xb1, 0x43, 0x3f, 0x76, 0xa9, 0x49, 0x31, 0xda, + 0x83, 0x1c, 0x61, 0x3f, 0x78, 0x1c, 0xab, 0xdb, 0xcf, 0xe6, 0xae, 0x6c, 0x4a, 0xb5, 0xc1, 0xff, + 0xea, 0x42, 0x5d, 0xfb, 0x01, 0x72, 0x82, 0xb0, 0x04, 0x85, 0xe3, 0xce, 0x6f, 0x3a, 0x47, 0xef, + 0x3a, 0xb5, 0x25, 0xa4, 0x40, 0xb6, 0xfd, 0xea, 0x70, 0xb7, 0x96, 0x42, 0x55, 0x80, 0xd6, 0x51, + 0xa7, 0xb3, 0xdb, 0xea, 0xb5, 0x3b, 0xaf, 0x6b, 0x69, 0x54, 0x84, 0x9c, 0xbe, 0xdb, 0x7c, 0xf5, + 0x7d, 0x2d, 0x83, 0x6e, 0xc2, 0x72, 0x4f, 0x6f, 0x76, 0xba, 0xed, 0xdd, 0x4e, 0xcf, 0xd8, 0x6b, + 0xb6, 0x0f, 0x8f, 0xf5, 0xdd, 0x5a, 0x16, 0x95, 0x41, 0xe9, 0xee, 0x1f, 0xf7, 0x5e, 0x31, 0xa6, + 0x9c, 0xf6, 0xdf, 0x34, 0x94, 0x12, 0xd9, 0x41, 0xdf, 0x26, 0xfd, 0x2e, 0x6d, 0x3f, 0xbe, 0xba, + 0xdf, 0xd2, 0x63, 0x74, 0x0b, 0xf2, 0xd4, 0x0c, 0xfa, 0x98, 0xf2, 0x72, 0x28, 0xea, 0xf2, 0x09, + 0x3d, 0x87, 0x1c, 0x0d, 0x4c, 0x0b, 0xab, 0x19, 0xce, 0x7c, 0x7f, 0x2e, 0x73, 0x8f, 0xa1, 0x74, + 0x01, 0x46, 0xeb, 0x50, 0xb1, 0x4c, 0xd7, 0x25, 0x06, 0xa1, 0x66, 0x40, 0xb1, 0xad, 0x66, 0xd7, + 0x52, 0x1b, 0x19, 0xbd, 0xcc, 0x85, 0x5d, 0x21, 0x43, 0x8f, 0xe0, 0x9a, 0x04, 0x8d, 0x2c, 0x0b, + 0x63, 0x1b, 0xdb, 0x6a, 0x8e, 0xc3, 0xaa, 0x02, 0x16, 0x4a, 0xd1, 0x4f, 0x40, 0x28, 0x1a, 0x27, + 0xa6, 0xe3, 0x62, 0x5b, 0xcd, 0x73, 0x54, 0x89, 0xcb, 0xf6, 0xb8, 0x08, 0x7d, 0x0f, 0x77, 0x5c, + 0x93, 0x50, 0x83, 0xc9, 0x42, 0xa3, 0x46, 0x34, 0x84, 0xd4, 0x02, 0x77, 0xbe, 0xde, 0x10, 0x53, + 0xa8, 0x11, 0x4e, 0xa1, 0x46, 0x2f, 0x44, 0xe8, 0x2a, 0x53, 0x6f, 0x99, 0xae, 0x2b, 0xbd, 0x8b, + 0xde, 0x68, 0x7f, 0xce, 0xc0, 0x72, 0x72, 0x8d, 0xbb, 0x63, 0xec, 0x51, 0xb4, 0x06, 0x25, 0x1b, + 0x13, 0x2b, 0x70, 0x86, 0x6c, 0x0c, 0xf2, 0xb8, 0x17, 0xf5, 0xa4, 0x08, 0xed, 0x83, 0x42, 0xf0, + 0x18, 0x07, 0x0e, 0xfd, 0xc8, 0x63, 0x5a, 0xdd, 0xfe, 0xe9, 0xe5, 0xc1, 0xe3, 0xc4, 0x8d, 0xae, + 0xd4, 0xd1, 0x23, 0x6d, 0xf4, 0x73, 0x28, 0xc6, 0x4b, 0xc9, 0x2c, 0x5c, 0x4a, 0x0c, 0x46, 0xbf, + 0x9e, 0xec, 0xd7, 0xec, 0xe2, 0x91, 0xba, 0xbf, 0x34, 0xd1, 0xb1, 0xfb, 0x53, 0x1d, 0x9b, 0xbb, + 0xd2, 0x84, 0xd9, 0x5f, 0xba, 0xd0, 0xb3, 0xda, 0x2e, 0x28, 0xe1, 0xd2, 0x78, 0xf9, 0xf7, 0x8c, + 0xb8, 0x31, 0x4a, 0x50, 0x68, 0xf5, 0x8c, 0x76, 0x67, 0xef, 0x48, 0xf6, 0x46, 0xcf, 0x78, 0xd7, + 0xd4, 0x3b, 0xa2, 0x37, 0xca, 0xa0, 0xb4, 0x7a, 0xc6, 0xae, 0xae, 0x1f, 0xe9, 0xb5, 0xcc, 0x4e, + 0x09, 0x8a, 0xd6, 0xa9, 0xe3, 0xda, 0xcc, 0x17, 0xd6, 0xcb, 0xe5, 0x64, 0x04, 0xd1, 0x63, 0x58, + 0xf6, 0x46, 0x03, 0x03, 0xb3, 0x48, 0x12, 0xc3, 0xf5, 0xfb, 0x7d, 0x6c, 0xf3, 0xdc, 0x64, 0xf4, + 0x6b, 0xde, 0x68, 0xc0, 0x23, 0x4c, 0x0e, 0xb9, 0x18, 0xb5, 0x01, 0x59, 0x01, 0xe6, 0xbb, 0x58, + 0xa2, 0x52, 0xd2, 0x0b, 0xc3, 0xbb, 0x1c, 0x6a, 0x45, 0x22, 0xf4, 0x12, 0xf2, 0xc2, 0xa4, 0x9c, + 0x88, 0xeb, 0x57, 0x48, 0xb4, 0x2e, 0x55, 0x34, 0x0b, 0x20, 0x0e, 0x3f, 0xba, 0x07, 0x61, 0xf8, + 0x0d, 0x27, 0x74, 0xbd, 0x28, 0x25, 0x6d, 0x1b, 0x21, 0xc8, 0x7a, 0xe6, 0x00, 0xcb, 0x26, 0xe5, + 0xbf, 0x0f, 0xb2, 0x4a, 0xa6, 0x96, 0x3d, 0xc8, 0x2a, 0xd9, 0x5a, 0xee, 0x20, 0xab, 0xe4, 0x6a, + 0xf9, 0x83, 0xac, 0x92, 0xaf, 0x15, 0x0e, 0xb2, 0x4a, 0xa1, 0xa6, 0x1c, 0x64, 0x15, 0xa5, 0x56, + 0xd4, 0x5c, 0xa8, 0x4c, 0xe4, 0x87, 0x75, 0x68, 0x22, 0xb1, 0x8e, 0xcd, 0x5b, 0x24, 0xa3, 0x97, + 0x63, 0x61, 0xc2, 0x9a, 0x32, 0x61, 0x2d, 0x55, 0x4b, 0x1f, 0x64, 0x95, 0x74, 0x2d, 0x33, 0xcf, + 0xb2, 0xf6, 0x23, 0x14, 0xa3, 0xd9, 0x8b, 0xee, 0x80, 0x9c, 0xbe, 0xcc, 0x4a, 0x86, 0x5b, 0x51, + 0x84, 0x20, 0x61, 0x21, 0x3b, 0xd7, 0xc2, 0xec, 0xf5, 0x30, 0x0b, 0x38, 0x18, 0xe3, 0x20, 0xb4, + 0xc0, 0x1f, 0x98, 0x85, 0x9c, 0xb4, 0xc0, 0x05, 0x09, 0x0b, 0xf9, 0x2b, 0xad, 0x21, 0xb6, 0xf0, + 0xd7, 0x14, 0xe4, 0x85, 0x09, 0xf4, 0x34, 0xb9, 0xb7, 0xce, 0xda, 0x67, 0x42, 0x4f, 0xc4, 0xbe, + 0xfa, 0x6c, 0x62, 0x5f, 0xbd, 0x3b, 0x0f, 0x9f, 0xd8, 0x56, 0xbf, 0x85, 0x8a, 0xeb, 0x10, 0x8a, + 0x3d, 0x43, 0x04, 0x46, 0x96, 0xd1, 0xa5, 0x5b, 0x5a, 0x59, 0x68, 0x08, 0x81, 0xf6, 0x47, 0x76, + 0x1a, 0x88, 0x68, 0xe3, 0xa9, 0x9d, 0xfa, 0xa2, 0xa9, 0x9d, 0xbe, 0xda, 0xd4, 0xce, 0x5c, 0x69, + 0x6a, 0x67, 0x3f, 0x7b, 0x6a, 0xe7, 0xbe, 0x60, 0x6a, 0xff, 0x25, 0x0d, 0x79, 0x11, 0x9b, 0xc5, + 0xe9, 0x8b, 0x62, 0x7a, 0xc5, 0xf4, 0x71, 0x7c, 0x22, 0x7d, 0x9b, 0x90, 0x73, 0x7d, 0xcb, 0x74, + 0xe5, 0x6c, 0x5e, 0x99, 0x56, 0x69, 0xda, 0x76, 0x80, 0x09, 0xd1, 0x05, 0x0e, 0x6d, 0x41, 0x3e, + 0xc0, 0x03, 0x9f, 0x62, 0x39, 0x91, 0x2f, 0xd1, 0x90, 0x40, 0xf4, 0x82, 0xed, 0x26, 0xd6, 0x88, + 0xef, 0x26, 0x51, 0x5c, 0xa6, 0x0b, 0x4b, 0x20, 0xf4, 0x08, 0x8b, 0x56, 0xa1, 0x24, 0x18, 0x8c, + 0x44, 0x17, 0x80, 0x10, 0x75, 0xcc, 0x01, 0xd6, 0xfe, 0x50, 0x00, 0x88, 0x57, 0xc4, 0xd2, 0x4b, + 0x68, 0x80, 0xcd, 0x41, 0x5c, 0x05, 0x62, 0x08, 0x55, 0xa5, 0x38, 0xac, 0x83, 0x27, 0xb0, 0x1c, + 0x01, 0xa3, 0x4a, 0x10, 0x05, 0x53, 0x0b, 0xa1, 0x51, 0x2d, 0x7c, 0x05, 0xa1, 0x7a, 0x58, 0x0d, + 0xa2, 0x66, 0x2a, 0x52, 0x2a, 0xeb, 0x61, 0x1d, 0x2a, 0x03, 0x4c, 0x88, 0xd9, 0xc7, 0xc4, 0x20, + 0xd8, 0xa3, 0xe1, 0xb1, 0x21, 0x14, 0x76, 0xd9, 0xce, 0xfb, 0x04, 0x96, 0x23, 0x50, 0x80, 0x2d, + 0xec, 0x8c, 0xa3, 0x83, 0x43, 0x2d, 0x7c, 0xa1, 0x4b, 0x39, 0xda, 0x80, 0xda, 0x19, 0xc6, 0x43, + 0xc3, 0x74, 0x9d, 0x71, 0x48, 0x2a, 0x8e, 0x0f, 0x55, 0x26, 0x6f, 0x72, 0x31, 0xa7, 0x3d, 0x85, + 0x75, 0x5e, 0x8b, 0x3c, 0x43, 0x86, 0xf0, 0xcb, 0xe0, 0xa3, 0xfe, 0x33, 0x4f, 0x12, 0xab, 0x8c, + 0xe6, 0x90, 0xb1, 0x74, 0x39, 0x49, 0x4b, 0x70, 0xc4, 0xbb, 0xc5, 0xef, 0xe0, 0x01, 0xb7, 0x24, + 0xf3, 0x32, 0xd7, 0x94, 0xb2, 0xd0, 0xd4, 0x1a, 0xe3, 0xd1, 0x39, 0xcd, 0x1c, 0x5b, 0x61, 0x87, + 0xc9, 0xc0, 0xf0, 0x00, 0x24, 0x4c, 0x14, 0xaf, 0xd6, 0x61, 0x6f, 0x84, 0x36, 0x8b, 0x53, 0x4c, + 0x6d, 0xc2, 0xea, 0x04, 0x75, 0x98, 0x8b, 0x04, 0x3d, 0x2c, 0xa4, 0xbf, 0x9b, 0xa0, 0x0f, 0x93, + 0x16, 0x9b, 0xf8, 0x0e, 0x56, 0x44, 0x3a, 0x4e, 0x5c, 0xff, 0xdc, 0xb0, 0x7c, 0x8f, 0x06, 0xbe, + 0x6b, 0x9c, 0x3b, 0x9e, 0xed, 0x9f, 0xab, 0xa5, 0xb0, 0x9f, 0x2f, 0x90, 0xb7, 0x3d, 0xfa, 0xe2, + 0xf9, 0x77, 0xa6, 0x3b, 0xc2, 0xfa, 0x2d, 0xae, 0xbd, 0xe7, 0xfa, 0xe7, 0x2d, 0xa1, 0xfb, 0x8e, + 0xab, 0xa2, 0xf7, 0x50, 0x97, 0xc1, 0x9f, 0x45, 0x5c, 0x5e, 0x4c, 0x7c, 0x5b, 0xa8, 0x4f, 0x33, + 0xbf, 0x80, 0xbc, 0x2f, 0x4e, 0x84, 0x15, 0x3e, 0xc2, 0xef, 0xcf, 0x1b, 0x1f, 0x47, 0x1c, 0xa5, + 0x4b, 0xb4, 0xf6, 0xcf, 0x0c, 0x14, 0x64, 0xcb, 0xa3, 0x37, 0x50, 0xa1, 0xd6, 0xd0, 0x19, 0x1a, + 0xa6, 0x10, 0xc8, 0xc9, 0xf5, 0x70, 0xee, 0x90, 0x68, 0xf4, 0xac, 0x61, 0x7b, 0x28, 0x1f, 0xf6, + 0x97, 0xf4, 0x32, 0x57, 0x0f, 0xe9, 0x5e, 0x43, 0x69, 0x64, 0x93, 0x88, 0x4c, 0x8c, 0xb5, 0x07, + 0xf3, 0xc9, 0x8e, 0x6d, 0x12, 0x53, 0xc1, 0x28, 0x7a, 0x62, 0x7e, 0xf9, 0xf4, 0x14, 0x07, 0x11, + 0x55, 0x66, 0x91, 0x5f, 0x47, 0x0c, 0x9e, 0xf0, 0xcb, 0x4f, 0x3c, 0xd7, 0x9b, 0x50, 0x4e, 0xfa, + 0xcd, 0x4e, 0x3e, 0x17, 0xd6, 0x5c, 0xd6, 0x8b, 0xf1, 0x32, 0x10, 0x64, 0x87, 0x7e, 0x20, 0x3e, + 0x4f, 0x72, 0x3a, 0xff, 0x5d, 0xdf, 0x00, 0x88, 0xbd, 0x45, 0x75, 0x50, 0x4e, 0x1c, 0x17, 0xf3, + 0x39, 0x27, 0xce, 0xe3, 0xd1, 0x73, 0xbd, 0x03, 0xe5, 0xa4, 0x33, 0xd1, 0xa9, 0x20, 0x15, 0x9f, + 0x0a, 0xd0, 0x63, 0xc8, 0x8d, 0x59, 0x76, 0x65, 0x88, 0x6e, 0x4c, 0x15, 0x40, 0xd3, 0xfb, 0xa8, + 0x0b, 0xc8, 0x4e, 0x11, 0x0a, 0xd2, 0x53, 0xed, 0x4f, 0x19, 0x76, 0xb2, 0x95, 0xe3, 0x76, 0x1b, + 0x32, 0xd4, 0x25, 0xf3, 0xb7, 0xdd, 0x10, 0xd8, 0xe8, 0xb9, 0x2c, 0x22, 0x0c, 0xcc, 0x3e, 0xde, + 0x78, 0x60, 0xa4, 0xdd, 0x8d, 0x4b, 0xb4, 0xf8, 0x1a, 0xc2, 0xa7, 0xfd, 0x25, 0x5d, 0x28, 0xd6, + 0xff, 0x95, 0x82, 0x4c, 0xcf, 0x25, 0xe8, 0x2b, 0xa8, 0x10, 0x6a, 0x7a, 0xb6, 0x19, 0xd8, 0x46, + 0xbc, 0x3c, 0x16, 0xf9, 0x50, 0xcc, 0x46, 0x3e, 0x5a, 0x05, 0x10, 0x89, 0x8c, 0x8f, 0x92, 0xfb, + 0x4b, 0x7a, 0x91, 0xcb, 0x38, 0xe0, 0x09, 0x2c, 0x8b, 0xbe, 0xb3, 0x70, 0x40, 0x9d, 0x13, 0xc7, + 0x62, 0x9f, 0x96, 0x19, 0x9e, 0x91, 0x1a, 0x7f, 0xd1, 0x8a, 0xe5, 0xe8, 0x29, 0x20, 0xd9, 0x4c, + 0x49, 0x74, 0x96, 0xa3, 0x97, 0xc5, 0x9b, 0x04, 0x7c, 0xa7, 0x0a, 0x65, 0xcb, 0x19, 0x32, 0xeb, + 0x64, 0xe4, 0x50, 0x5c, 0x3f, 0x82, 0xca, 0xc4, 0xaa, 0xbe, 0x38, 0x35, 0x05, 0xc8, 0x0d, 0x7c, + 0x1b, 0xbb, 0x9a, 0x07, 0xe5, 0x64, 0xaf, 0xcd, 0x24, 0xbe, 0x91, 0x24, 0x2e, 0x4a, 0x0a, 0xf4, + 0x1c, 0xc0, 0xb4, 0x6d, 0x87, 0x69, 0x45, 0xbb, 0xfa, 0x6c, 0x9b, 0x09, 0x9c, 0x76, 0x08, 0xd7, + 0x93, 0xf6, 0xd8, 0x18, 0xf3, 0x47, 0x14, 0xfd, 0x0c, 0x94, 0xf0, 0xb6, 0x4c, 0xd6, 0xc5, 0xca, + 0x14, 0xd5, 0x2b, 0x09, 0xd0, 0x23, 0xa8, 0x66, 0x01, 0x4a, 0xb2, 0x1d, 0x3a, 0x5e, 0x1f, 0x07, + 0xec, 0x33, 0xdd, 0x64, 0x9f, 0xef, 0x62, 0x15, 0x8a, 0x2e, 0x9f, 0x26, 0x8c, 0xa4, 0xaf, 0x6e, + 0xe4, 0xef, 0xca, 0x05, 0x9f, 0xad, 0x61, 0xdb, 0x3b, 0xf1, 0x59, 0x2f, 0xb2, 0x19, 0x62, 0xc4, + 0x97, 0x0a, 0x15, 0xbd, 0xc8, 0x24, 0xe2, 0x56, 0x43, 0x13, 0x13, 0xca, 0xb0, 0x4c, 0x89, 0x48, + 0x73, 0x44, 0x89, 0x09, 0x5b, 0xa6, 0xc0, 0x7c, 0x0d, 0x35, 0x8e, 0x09, 0x30, 0x0d, 0x4c, 0x8f, + 0x0c, 0x1c, 0x2a, 0x06, 0x46, 0x45, 0xbf, 0xc6, 0xe4, 0x7a, 0x2c, 0x66, 0x67, 0x14, 0x0e, 0x1d, + 0x06, 0xfe, 0x07, 0x4c, 0x78, 0xe9, 0x54, 0x74, 0xee, 0xc0, 0x5b, 0x2e, 0x61, 0x47, 0x49, 0x0e, + 0xf8, 0x60, 0x5a, 0x67, 0xfe, 0x89, 0xf8, 0x06, 0x95, 0xe6, 0x76, 0x84, 0x28, 0x82, 0x88, 0x79, + 0x4a, 0xf8, 0x26, 0x2f, 0x21, 0x62, 0x69, 0x04, 0x3d, 0x84, 0x6b, 0x62, 0x51, 0x9e, 0x6d, 0x9c, + 0x13, 0xcb, 0x74, 0x31, 0xdf, 0xcd, 0x2b, 0x3a, 0x5f, 0x4c, 0xd7, 0xb3, 0xdf, 0x71, 0x61, 0x84, + 0x0b, 0xac, 0x71, 0x88, 0x53, 0x62, 0x9c, 0x6e, 0x8d, 0x25, 0x6e, 0x05, 0x14, 0x81, 0xa3, 0x3e, + 0xdf, 0x48, 0x2b, 0x7a, 0x81, 0x03, 0xa8, 0x1f, 0xbd, 0x32, 0xa9, 0xcf, 0x37, 0x41, 0xf9, 0xaa, + 0x49, 0x7d, 0xb4, 0x26, 0x1d, 0x65, 0x5e, 0x0c, 0x08, 0xe1, 0xdb, 0x98, 0x5c, 0x6d, 0xd7, 0xb3, + 0xdf, 0x10, 0x12, 0x21, 0x98, 0x7d, 0x86, 0x28, 0xc7, 0x08, 0xdd, 0x1a, 0x33, 0x44, 0xb8, 0xd8, + 0x91, 0x67, 0x5a, 0x67, 0xd8, 0x56, 0x2b, 0xf1, 0x62, 0x8f, 0x85, 0x28, 0x8a, 0x29, 0x11, 0x88, + 0x6a, 0xc2, 0x8a, 0x00, 0xdc, 0x01, 0x9e, 0x50, 0xc3, 0xf5, 0x09, 0x55, 0xaf, 0xf1, 0xd7, 0xdc, + 0xe7, 0x43, 0x9f, 0xd0, 0xc8, 0x80, 0x4c, 0x9e, 0x5a, 0x8b, 0x0d, 0xc8, 0xc4, 0x45, 0x90, 0x13, + 0x46, 0x47, 0x89, 0xba, 0x1c, 0x43, 0xf6, 0x84, 0x08, 0x3d, 0x85, 0xeb, 0xc2, 0x04, 0x3b, 0x26, + 0xb0, 0x93, 0xb2, 0x38, 0x7f, 0x21, 0x8e, 0xe4, 0xd5, 0x71, 0x68, 0x12, 0x7e, 0xec, 0x94, 0x07, + 0x3b, 0x14, 0xc3, 0x4d, 0xeb, 0x4c, 0xa0, 0xaf, 0xc7, 0x35, 0xc3, 0xd0, 0x4d, 0xeb, 0x8c, 0x83, + 0xa7, 0xb9, 0x03, 0x6c, 0x8d, 0xd5, 0x1b, 0xd3, 0xdc, 0x3a, 0xb6, 0xc6, 0xd3, 0xdc, 0x1c, 0x7d, + 0x73, 0x8a, 0x9b, 0x83, 0xc3, 0xd0, 0x0c, 0x07, 0x74, 0xa4, 0xde, 0x8a, 0x43, 0xf3, 0x76, 0x40, + 0x47, 0xe8, 0x31, 0x2c, 0x47, 0xd9, 0x21, 0x84, 0x9e, 0x06, 0x98, 0x9c, 0xaa, 0xb7, 0x13, 0x85, + 0x6d, 0x8d, 0xbb, 0x52, 0x9c, 0xa8, 0x10, 0xaa, 0xaa, 0xc9, 0x0a, 0xa1, 0x51, 0x7e, 0x02, 0x4a, + 0xc7, 0x66, 0xa0, 0xae, 0x24, 0x72, 0xcc, 0x25, 0x91, 0x1d, 0x56, 0x27, 0x91, 0x9d, 0x7a, 0x6c, + 0xa7, 0xeb, 0xd9, 0x91, 0x9d, 0xb0, 0x1f, 0x19, 0xd6, 0x3a, 0xf7, 0x6c, 0xf5, 0x4e, 0x9c, 0x8c, + 0xae, 0x67, 0xb7, 0xce, 0xbd, 0xb8, 0x20, 0x4c, 0x7b, 0xcc, 0x8a, 0xea, 0x6e, 0x6c, 0xb0, 0xc9, + 0x25, 0xec, 0xe4, 0x2f, 0x73, 0xee, 0x07, 0x36, 0x0e, 0x1c, 0xaf, 0xaf, 0xde, 0xe3, 0xa0, 0xaa, + 0x48, 0x7b, 0x28, 0xd5, 0x9a, 0x70, 0xf3, 0x35, 0xa6, 0x3d, 0x7f, 0x28, 0xbf, 0x21, 0x89, 0x8e, + 0x7f, 0x3f, 0xc2, 0x84, 0xb2, 0xc3, 0x36, 0xff, 0x66, 0x30, 0xa6, 0x6e, 0x30, 0xaa, 0x5c, 0xde, + 0x0a, 0x2f, 0x16, 0x34, 0x03, 0x6e, 0x5d, 0xa4, 0x20, 0x43, 0xdf, 0x23, 0x18, 0x7d, 0x03, 0x05, + 0xa9, 0xad, 0xa6, 0xf8, 0x09, 0x6a, 0x65, 0xfe, 0x6d, 0x55, 0x88, 0x44, 0x35, 0xc8, 0x60, 0x4f, + 0x7c, 0x7d, 0x28, 0x3a, 0xfb, 0xa9, 0xbd, 0x84, 0xe5, 0xd7, 0x98, 0x8a, 0x2f, 0xe2, 0xc8, 0xbf, + 0x87, 0xec, 0xdb, 0x86, 0xf9, 0x17, 0xdf, 0x16, 0xa4, 0xc2, 0xcf, 0x10, 0x33, 0x90, 0xe8, 0xb6, + 0xad, 0xbd, 0x07, 0x94, 0x54, 0x96, 0x9e, 0x3d, 0x83, 0xbc, 0xd0, 0x93, 0x8e, 0xa9, 0x73, 0x2f, + 0x02, 0x24, 0x6e, 0x86, 0x5b, 0x3f, 0xc0, 0xed, 0x88, 0x59, 0xcc, 0xdd, 0xc8, 0xb9, 0x89, 0x4b, + 0x8c, 0xd4, 0x85, 0x4b, 0x8c, 0xd8, 0xf3, 0xe8, 0x26, 0x25, 0x9d, 0xf4, 0x5c, 0x5e, 0xa7, 0x68, + 0xa7, 0xa0, 0x4e, 0xf3, 0x4b, 0xff, 0x27, 0x2f, 0xcd, 0x53, 0x9f, 0x73, 0x69, 0x3e, 0x63, 0x25, + 0xdb, 0x3c, 0xc0, 0xd1, 0xc5, 0x95, 0x58, 0xc3, 0xe5, 0x97, 0x57, 0x5a, 0x9b, 0xc7, 0x35, 0xd2, + 0x99, 0x95, 0xf1, 0xd4, 0xd5, 0x32, 0xae, 0xbd, 0x84, 0x1b, 0x6c, 0xa1, 0x89, 0x2b, 0x2d, 0xe1, + 0xc1, 0xd4, 0xb5, 0x56, 0x6a, 0xfa, 0x5a, 0x4b, 0x3b, 0xe6, 0x05, 0x9c, 0x54, 0x96, 0xae, 0xfc, + 0x12, 0x20, 0x06, 0xce, 0xff, 0x07, 0x54, 0x42, 0x33, 0x81, 0xd7, 0x36, 0xa1, 0xc6, 0x68, 0x65, + 0xd0, 0xe2, 0xac, 0x46, 0x29, 0x4b, 0x4d, 0x5e, 0x7e, 0x69, 0xbb, 0xa2, 0x48, 0xa5, 0x42, 0xa2, + 0xcc, 0xc4, 0x25, 0x90, 0xb0, 0xaf, 0xce, 0x4d, 0x91, 0xc4, 0x6d, 0xff, 0x27, 0x0b, 0x8a, 0x0c, + 0xd0, 0x27, 0x64, 0x41, 0x75, 0xb2, 0xb3, 0xd0, 0xa3, 0x69, 0x82, 0x99, 0xed, 0x5b, 0xdf, 0x58, + 0x0c, 0x94, 0x3e, 0xbe, 0x03, 0x88, 0x1b, 0x04, 0xad, 0xcf, 0xd4, 0x9b, 0xec, 0xbd, 0xfa, 0x83, + 0xcb, 0x41, 0x92, 0xd8, 0x11, 0x21, 0x4c, 0xd6, 0x2f, 0xfa, 0xfa, 0x12, 0xcd, 0xc9, 0x1e, 0xaa, + 0x3f, 0xbe, 0x0a, 0x74, 0x62, 0x0d, 0xe1, 0xff, 0x1c, 0x67, 0xaf, 0x61, 0xb2, 0xbc, 0xe7, 0xac, + 0xe1, 0x62, 0x3d, 0xff, 0x08, 0x95, 0x89, 0xea, 0x42, 0x0f, 0x67, 0x7b, 0x75, 0xb1, 0x76, 0xeb, + 0x8f, 0x16, 0xe2, 0xa4, 0x85, 0x1e, 0x14, 0xa3, 0xba, 0x41, 0xda, 0x6c, 0xad, 0x64, 0x15, 0xd6, + 0xd7, 0x2f, 0xc5, 0x08, 0xd6, 0x9d, 0xf7, 0x70, 0xdd, 0xf1, 0xa7, 0x80, 0x3b, 0x95, 0xb0, 0xb4, + 0xde, 0xb2, 0x73, 0xe4, 0xdb, 0xd4, 0x6f, 0x9f, 0xc9, 0x73, 0x65, 0xdf, 0x77, 0x4d, 0xaf, 0xdf, + 0xf0, 0x83, 0xfe, 0xe6, 0xe4, 0xff, 0x9a, 0xd9, 0x53, 0xb8, 0x05, 0x7c, 0x32, 0xc6, 0x5b, 0x1f, + 0xf2, 0xfc, 0x08, 0xfa, 0xcd, 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0xd3, 0x7a, 0xae, 0xc5, 0x94, + 0x1e, 0x00, 0x00, +} diff --git a/vendor/google.golang.org/grpc/channelz/service/func_linux.go b/vendor/google.golang.org/grpc/channelz/service/func_linux.go new file mode 100644 index 000000000..192c3a1fa --- /dev/null +++ b/vendor/google.golang.org/grpc/channelz/service/func_linux.go @@ -0,0 +1,105 @@ +// +build !appengine + +/* + * + * Copyright 2018 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package service + +import ( + "github.com/golang/protobuf/ptypes" + channelzpb "google.golang.org/grpc/channelz/grpc_channelz_v1" + "google.golang.org/grpc/internal/channelz" +) + +func sockoptToProto(skopts *channelz.SocketOptionData) []*channelzpb.SocketOption { + var opts []*channelzpb.SocketOption + if skopts.Linger != nil { + additional, err := ptypes.MarshalAny(&channelzpb.SocketOptionLinger{ + Active: skopts.Linger.Onoff != 0, + Duration: convertToPtypesDuration(int64(skopts.Linger.Linger), 0), + }) + if err == nil { + opts = append(opts, &channelzpb.SocketOption{ + Name: "SO_LINGER", + Additional: additional, + }) + } + } + if skopts.RecvTimeout != nil { + additional, err := ptypes.MarshalAny(&channelzpb.SocketOptionTimeout{ + Duration: convertToPtypesDuration(int64(skopts.RecvTimeout.Sec), int64(skopts.RecvTimeout.Usec)), + }) + if err == nil { + opts = append(opts, &channelzpb.SocketOption{ + Name: "SO_RCVTIMEO", + Additional: additional, + }) + } + } + if skopts.SendTimeout != nil { + additional, err := ptypes.MarshalAny(&channelzpb.SocketOptionTimeout{ + Duration: convertToPtypesDuration(int64(skopts.SendTimeout.Sec), int64(skopts.SendTimeout.Usec)), + }) + if err == nil { + opts = append(opts, &channelzpb.SocketOption{ + Name: "SO_SNDTIMEO", + Additional: additional, + }) + } + } + if skopts.TCPInfo != nil { + additional, err := ptypes.MarshalAny(&channelzpb.SocketOptionTcpInfo{ + TcpiState: uint32(skopts.TCPInfo.State), + TcpiCaState: uint32(skopts.TCPInfo.Ca_state), + TcpiRetransmits: uint32(skopts.TCPInfo.Retransmits), + TcpiProbes: uint32(skopts.TCPInfo.Probes), + TcpiBackoff: uint32(skopts.TCPInfo.Backoff), + TcpiOptions: uint32(skopts.TCPInfo.Options), + // https://golang.org/pkg/syscall/#TCPInfo + // TCPInfo struct does not contain info about TcpiSndWscale and TcpiRcvWscale. + TcpiRto: skopts.TCPInfo.Rto, + TcpiAto: skopts.TCPInfo.Ato, + TcpiSndMss: skopts.TCPInfo.Snd_mss, + TcpiRcvMss: skopts.TCPInfo.Rcv_mss, + TcpiUnacked: skopts.TCPInfo.Unacked, + TcpiSacked: skopts.TCPInfo.Sacked, + TcpiLost: skopts.TCPInfo.Lost, + TcpiRetrans: skopts.TCPInfo.Retrans, + TcpiFackets: skopts.TCPInfo.Fackets, + TcpiLastDataSent: skopts.TCPInfo.Last_data_sent, + TcpiLastAckSent: skopts.TCPInfo.Last_ack_sent, + TcpiLastDataRecv: skopts.TCPInfo.Last_data_recv, + TcpiLastAckRecv: skopts.TCPInfo.Last_ack_recv, + TcpiPmtu: skopts.TCPInfo.Pmtu, + TcpiRcvSsthresh: skopts.TCPInfo.Rcv_ssthresh, + TcpiRtt: skopts.TCPInfo.Rtt, + TcpiRttvar: skopts.TCPInfo.Rttvar, + TcpiSndSsthresh: skopts.TCPInfo.Snd_ssthresh, + TcpiSndCwnd: skopts.TCPInfo.Snd_cwnd, + TcpiAdvmss: skopts.TCPInfo.Advmss, + TcpiReordering: skopts.TCPInfo.Reordering, + }) + if err == nil { + opts = append(opts, &channelzpb.SocketOption{ + Name: "TCP_INFO", + Additional: additional, + }) + } + } + return opts +} diff --git a/vendor/google.golang.org/grpc/channelz/service/func_nonlinux.go b/vendor/google.golang.org/grpc/channelz/service/func_nonlinux.go new file mode 100644 index 000000000..eb53334ed --- /dev/null +++ b/vendor/google.golang.org/grpc/channelz/service/func_nonlinux.go @@ -0,0 +1,30 @@ +// +build !linux appengine + +/* + * + * Copyright 2018 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package service + +import ( + channelzpb "google.golang.org/grpc/channelz/grpc_channelz_v1" + "google.golang.org/grpc/internal/channelz" +) + +func sockoptToProto(skopts *channelz.SocketOptionData) []*channelzpb.SocketOption { + return nil +} diff --git a/vendor/google.golang.org/grpc/channelz/service/regenerate.sh b/vendor/google.golang.org/grpc/channelz/service/regenerate.sh new file mode 100755 index 000000000..9c255b12c --- /dev/null +++ b/vendor/google.golang.org/grpc/channelz/service/regenerate.sh @@ -0,0 +1,33 @@ +#!/bin/bash +# Copyright 2018 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -eux -o pipefail + +TMP=$(mktemp -d) + +function finish { + rm -rf "$TMP" +} +trap finish EXIT + +pushd "$TMP" +mkdir -p grpc/channelz/v1 +curl https://raw.githubusercontent.com/grpc/grpc-proto/master/grpc/channelz/v1/channelz.proto > grpc/channelz/v1/channelz.proto + +protoc --go_out=plugins=grpc,paths=source_relative:. -I. grpc/channelz/v1/*.proto +popd +rm -f ../grpc_channelz_v1/*.pb.go +cp "$TMP"/grpc/channelz/v1/*.pb.go ../grpc_channelz_v1/ + diff --git a/vendor/google.golang.org/grpc/channelz/service/service.go b/vendor/google.golang.org/grpc/channelz/service/service.go new file mode 100644 index 000000000..a1c45d517 --- /dev/null +++ b/vendor/google.golang.org/grpc/channelz/service/service.go @@ -0,0 +1,300 @@ +/* + * + * Copyright 2018 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +//go:generate ./regenerate.sh + +// Package service provides an implementation for channelz service server. +package service + +import ( + "net" + "time" + + "github.com/golang/protobuf/ptypes" + durpb "github.com/golang/protobuf/ptypes/duration" + wrpb "github.com/golang/protobuf/ptypes/wrappers" + "golang.org/x/net/context" + "google.golang.org/grpc" + channelzgrpc "google.golang.org/grpc/channelz/grpc_channelz_v1" + channelzpb "google.golang.org/grpc/channelz/grpc_channelz_v1" + "google.golang.org/grpc/connectivity" + "google.golang.org/grpc/credentials" + "google.golang.org/grpc/internal/channelz" +) + +func convertToPtypesDuration(sec int64, usec int64) *durpb.Duration { + return ptypes.DurationProto(time.Duration(sec*1e9 + usec*1e3)) +} + +// RegisterChannelzServiceToServer registers the channelz service to the given server. +func RegisterChannelzServiceToServer(s *grpc.Server) { + channelzgrpc.RegisterChannelzServer(s, &serverImpl{}) +} + +func newCZServer() channelzgrpc.ChannelzServer { + return &serverImpl{} +} + +type serverImpl struct{} + +func connectivityStateToProto(s connectivity.State) *channelzpb.ChannelConnectivityState { + switch s { + case connectivity.Idle: + return &channelzpb.ChannelConnectivityState{State: channelzpb.ChannelConnectivityState_IDLE} + case connectivity.Connecting: + return &channelzpb.ChannelConnectivityState{State: channelzpb.ChannelConnectivityState_CONNECTING} + case connectivity.Ready: + return &channelzpb.ChannelConnectivityState{State: channelzpb.ChannelConnectivityState_READY} + case connectivity.TransientFailure: + return &channelzpb.ChannelConnectivityState{State: channelzpb.ChannelConnectivityState_TRANSIENT_FAILURE} + case connectivity.Shutdown: + return &channelzpb.ChannelConnectivityState{State: channelzpb.ChannelConnectivityState_SHUTDOWN} + default: + return &channelzpb.ChannelConnectivityState{State: channelzpb.ChannelConnectivityState_UNKNOWN} + } +} + +func channelMetricToProto(cm *channelz.ChannelMetric) *channelzpb.Channel { + c := &channelzpb.Channel{} + c.Ref = &channelzpb.ChannelRef{ChannelId: cm.ID, Name: cm.RefName} + + c.Data = &channelzpb.ChannelData{ + State: connectivityStateToProto(cm.ChannelData.State), + Target: cm.ChannelData.Target, + CallsStarted: cm.ChannelData.CallsStarted, + CallsSucceeded: cm.ChannelData.CallsSucceeded, + CallsFailed: cm.ChannelData.CallsFailed, + } + if ts, err := ptypes.TimestampProto(cm.ChannelData.LastCallStartedTimestamp); err == nil { + c.Data.LastCallStartedTimestamp = ts + } + nestedChans := make([]*channelzpb.ChannelRef, 0, len(cm.NestedChans)) + for id, ref := range cm.NestedChans { + nestedChans = append(nestedChans, &channelzpb.ChannelRef{ChannelId: id, Name: ref}) + } + c.ChannelRef = nestedChans + + subChans := make([]*channelzpb.SubchannelRef, 0, len(cm.SubChans)) + for id, ref := range cm.SubChans { + subChans = append(subChans, &channelzpb.SubchannelRef{SubchannelId: id, Name: ref}) + } + c.SubchannelRef = subChans + + sockets := make([]*channelzpb.SocketRef, 0, len(cm.Sockets)) + for id, ref := range cm.Sockets { + sockets = append(sockets, &channelzpb.SocketRef{SocketId: id, Name: ref}) + } + c.SocketRef = sockets + return c +} + +func subChannelMetricToProto(cm *channelz.SubChannelMetric) *channelzpb.Subchannel { + sc := &channelzpb.Subchannel{} + sc.Ref = &channelzpb.SubchannelRef{SubchannelId: cm.ID, Name: cm.RefName} + + sc.Data = &channelzpb.ChannelData{ + State: connectivityStateToProto(cm.ChannelData.State), + Target: cm.ChannelData.Target, + CallsStarted: cm.ChannelData.CallsStarted, + CallsSucceeded: cm.ChannelData.CallsSucceeded, + CallsFailed: cm.ChannelData.CallsFailed, + } + if ts, err := ptypes.TimestampProto(cm.ChannelData.LastCallStartedTimestamp); err == nil { + sc.Data.LastCallStartedTimestamp = ts + } + nestedChans := make([]*channelzpb.ChannelRef, 0, len(cm.NestedChans)) + for id, ref := range cm.NestedChans { + nestedChans = append(nestedChans, &channelzpb.ChannelRef{ChannelId: id, Name: ref}) + } + sc.ChannelRef = nestedChans + + subChans := make([]*channelzpb.SubchannelRef, 0, len(cm.SubChans)) + for id, ref := range cm.SubChans { + subChans = append(subChans, &channelzpb.SubchannelRef{SubchannelId: id, Name: ref}) + } + sc.SubchannelRef = subChans + + sockets := make([]*channelzpb.SocketRef, 0, len(cm.Sockets)) + for id, ref := range cm.Sockets { + sockets = append(sockets, &channelzpb.SocketRef{SocketId: id, Name: ref}) + } + sc.SocketRef = sockets + return sc +} + +func securityToProto(se credentials.ChannelzSecurityValue) *channelzpb.Security { + switch v := se.(type) { + case *credentials.TLSChannelzSecurityValue: + return &channelzpb.Security{Model: &channelzpb.Security_Tls_{Tls: &channelzpb.Security_Tls{ + CipherSuite: &channelzpb.Security_Tls_StandardName{StandardName: v.StandardName}, + LocalCertificate: v.LocalCertificate, + RemoteCertificate: v.RemoteCertificate, + }}} + case *credentials.OtherChannelzSecurityValue: + otherSecurity := &channelzpb.Security_OtherSecurity{ + Name: v.Name, + } + if anyval, err := ptypes.MarshalAny(v.Value); err == nil { + otherSecurity.Value = anyval + } + return &channelzpb.Security{Model: &channelzpb.Security_Other{Other: otherSecurity}} + } + return nil +} + +func addrToProto(a net.Addr) *channelzpb.Address { + switch a.Network() { + case "udp": + // TODO: Address_OtherAddress{}. Need proto def for Value. + case "ip": + // Note zone info is discarded through the conversion. + return &channelzpb.Address{Address: &channelzpb.Address_TcpipAddress{TcpipAddress: &channelzpb.Address_TcpIpAddress{IpAddress: a.(*net.IPAddr).IP}}} + case "ip+net": + // Note mask info is discarded through the conversion. + return &channelzpb.Address{Address: &channelzpb.Address_TcpipAddress{TcpipAddress: &channelzpb.Address_TcpIpAddress{IpAddress: a.(*net.IPNet).IP}}} + case "tcp": + // Note zone info is discarded through the conversion. + return &channelzpb.Address{Address: &channelzpb.Address_TcpipAddress{TcpipAddress: &channelzpb.Address_TcpIpAddress{IpAddress: a.(*net.TCPAddr).IP, Port: int32(a.(*net.TCPAddr).Port)}}} + case "unix", "unixgram", "unixpacket": + return &channelzpb.Address{Address: &channelzpb.Address_UdsAddress_{UdsAddress: &channelzpb.Address_UdsAddress{Filename: a.String()}}} + default: + } + return &channelzpb.Address{} +} + +func socketMetricToProto(sm *channelz.SocketMetric) *channelzpb.Socket { + s := &channelzpb.Socket{} + s.Ref = &channelzpb.SocketRef{SocketId: sm.ID, Name: sm.RefName} + + s.Data = &channelzpb.SocketData{ + StreamsStarted: sm.SocketData.StreamsStarted, + StreamsSucceeded: sm.SocketData.StreamsSucceeded, + StreamsFailed: sm.SocketData.StreamsFailed, + MessagesSent: sm.SocketData.MessagesSent, + MessagesReceived: sm.SocketData.MessagesReceived, + KeepAlivesSent: sm.SocketData.KeepAlivesSent, + } + if ts, err := ptypes.TimestampProto(sm.SocketData.LastLocalStreamCreatedTimestamp); err == nil { + s.Data.LastLocalStreamCreatedTimestamp = ts + } + if ts, err := ptypes.TimestampProto(sm.SocketData.LastRemoteStreamCreatedTimestamp); err == nil { + s.Data.LastRemoteStreamCreatedTimestamp = ts + } + if ts, err := ptypes.TimestampProto(sm.SocketData.LastMessageSentTimestamp); err == nil { + s.Data.LastMessageSentTimestamp = ts + } + if ts, err := ptypes.TimestampProto(sm.SocketData.LastMessageReceivedTimestamp); err == nil { + s.Data.LastMessageReceivedTimestamp = ts + } + s.Data.LocalFlowControlWindow = &wrpb.Int64Value{Value: sm.SocketData.LocalFlowControlWindow} + s.Data.RemoteFlowControlWindow = &wrpb.Int64Value{Value: sm.SocketData.RemoteFlowControlWindow} + + if sm.SocketData.SocketOptions != nil { + s.Data.Option = sockoptToProto(sm.SocketData.SocketOptions) + } + if sm.SocketData.Security != nil { + s.Security = securityToProto(sm.SocketData.Security) + } + + if sm.SocketData.LocalAddr != nil { + s.Local = addrToProto(sm.SocketData.LocalAddr) + } + if sm.SocketData.RemoteAddr != nil { + s.Remote = addrToProto(sm.SocketData.RemoteAddr) + } + s.RemoteName = sm.SocketData.RemoteName + return s +} + +func (s *serverImpl) GetTopChannels(ctx context.Context, req *channelzpb.GetTopChannelsRequest) (*channelzpb.GetTopChannelsResponse, error) { + metrics, end := channelz.GetTopChannels(req.GetStartChannelId()) + resp := &channelzpb.GetTopChannelsResponse{} + for _, m := range metrics { + resp.Channel = append(resp.Channel, channelMetricToProto(m)) + } + resp.End = end + return resp, nil +} + +func serverMetricToProto(sm *channelz.ServerMetric) *channelzpb.Server { + s := &channelzpb.Server{} + s.Ref = &channelzpb.ServerRef{ServerId: sm.ID, Name: sm.RefName} + + s.Data = &channelzpb.ServerData{ + CallsStarted: sm.ServerData.CallsStarted, + CallsSucceeded: sm.ServerData.CallsSucceeded, + CallsFailed: sm.ServerData.CallsFailed, + } + + if ts, err := ptypes.TimestampProto(sm.ServerData.LastCallStartedTimestamp); err == nil { + s.Data.LastCallStartedTimestamp = ts + } + sockets := make([]*channelzpb.SocketRef, 0, len(sm.ListenSockets)) + for id, ref := range sm.ListenSockets { + sockets = append(sockets, &channelzpb.SocketRef{SocketId: id, Name: ref}) + } + s.ListenSocket = sockets + return s +} + +func (s *serverImpl) GetServers(ctx context.Context, req *channelzpb.GetServersRequest) (*channelzpb.GetServersResponse, error) { + metrics, end := channelz.GetServers(req.GetStartServerId()) + resp := &channelzpb.GetServersResponse{} + for _, m := range metrics { + resp.Server = append(resp.Server, serverMetricToProto(m)) + } + resp.End = end + return resp, nil +} + +func (s *serverImpl) GetServerSockets(ctx context.Context, req *channelzpb.GetServerSocketsRequest) (*channelzpb.GetServerSocketsResponse, error) { + metrics, end := channelz.GetServerSockets(req.GetServerId(), req.GetStartSocketId()) + resp := &channelzpb.GetServerSocketsResponse{} + for _, m := range metrics { + resp.SocketRef = append(resp.SocketRef, &channelzpb.SocketRef{SocketId: m.ID, Name: m.RefName}) + } + resp.End = end + return resp, nil +} + +func (s *serverImpl) GetChannel(ctx context.Context, req *channelzpb.GetChannelRequest) (*channelzpb.GetChannelResponse, error) { + var metric *channelz.ChannelMetric + if metric = channelz.GetChannel(req.GetChannelId()); metric == nil { + return &channelzpb.GetChannelResponse{}, nil + } + resp := &channelzpb.GetChannelResponse{Channel: channelMetricToProto(metric)} + return resp, nil +} + +func (s *serverImpl) GetSubchannel(ctx context.Context, req *channelzpb.GetSubchannelRequest) (*channelzpb.GetSubchannelResponse, error) { + var metric *channelz.SubChannelMetric + if metric = channelz.GetSubChannel(req.GetSubchannelId()); metric == nil { + return &channelzpb.GetSubchannelResponse{}, nil + } + resp := &channelzpb.GetSubchannelResponse{Subchannel: subChannelMetricToProto(metric)} + return resp, nil +} + +func (s *serverImpl) GetSocket(ctx context.Context, req *channelzpb.GetSocketRequest) (*channelzpb.GetSocketResponse, error) { + var metric *channelz.SocketMetric + if metric = channelz.GetSocket(req.GetSocketId()); metric == nil { + return &channelzpb.GetSocketResponse{}, nil + } + resp := &channelzpb.GetSocketResponse{Socket: socketMetricToProto(metric)} + return resp, nil +} diff --git a/vendor/google.golang.org/grpc/clientconn.go b/vendor/google.golang.org/grpc/clientconn.go index 9745484c8..199f77474 100644 --- a/vendor/google.golang.org/grpc/clientconn.go +++ b/vendor/google.golang.org/grpc/clientconn.go @@ -26,17 +26,21 @@ import ( "reflect" "strings" "sync" + "sync/atomic" "time" "golang.org/x/net/context" "golang.org/x/net/trace" "google.golang.org/grpc/balancer" _ "google.golang.org/grpc/balancer/roundrobin" // To register roundrobin. - "google.golang.org/grpc/channelz" "google.golang.org/grpc/codes" "google.golang.org/grpc/connectivity" "google.golang.org/grpc/credentials" "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/internal" + "google.golang.org/grpc/internal/backoff" + "google.golang.org/grpc/internal/channelz" + "google.golang.org/grpc/internal/envconfig" "google.golang.org/grpc/keepalive" "google.golang.org/grpc/resolver" _ "google.golang.org/grpc/resolver/dns" // To register dns resolver. @@ -49,6 +53,8 @@ import ( const ( // minimum time to give a connection to complete minConnectTimeout = 20 * time.Second + // must match grpclbName in grpclb/grpclb.go + grpclbName = "grpclb" ) var ( @@ -97,7 +103,7 @@ type dialOptions struct { streamInt StreamClientInterceptor cp Compressor dc Decompressor - bs backoffStrategy + bs backoff.Strategy block bool insecure bool timeout time.Duration @@ -108,14 +114,19 @@ type dialOptions struct { // balancer, and also by WithBalancerName dial option. balancerBuilder balancer.Builder // This is to support grpclb. - resolverBuilder resolver.Builder - waitForHandshake bool - channelzParentID int64 + resolverBuilder resolver.Builder + waitForHandshake bool + channelzParentID int64 + disableServiceConfig bool + disableRetry bool } const ( defaultClientMaxReceiveMessageSize = 1024 * 1024 * 4 defaultClientMaxSendMessageSize = math.MaxInt32 + // http2IOBufSize specifies the buffer size for sending frames. + defaultWriteBufSize = 32 * 1024 + defaultReadBufSize = 32 * 1024 ) // RegisterChannelz turns on channelz service. @@ -136,8 +147,11 @@ func WithWaitForHandshake() DialOption { } } -// WithWriteBufferSize lets you set the size of write buffer, this determines how much data can be batched -// before doing a write on the wire. +// WithWriteBufferSize determines how much data can be batched before doing a write on the wire. +// The corresponding memory allocation for this buffer will be twice the size to keep syscalls low. +// The default value for this buffer is 32KB. +// Zero will disable the write buffer such that each write will be on underlying connection. +// Note: A Send call may not directly translate to a write. func WithWriteBufferSize(s int) DialOption { return func(o *dialOptions) { o.copts.WriteBufferSize = s @@ -146,6 +160,9 @@ func WithWriteBufferSize(s int) DialOption { // WithReadBufferSize lets you set the size of read buffer, this determines how much data can be read at most // for each read syscall. +// The default value for this buffer is 32KB +// Zero will disable read buffer for a connection so data framer can access the underlying +// conn directly. func WithReadBufferSize(s int) DialOption { return func(o *dialOptions) { o.copts.ReadBufferSize = s @@ -168,7 +185,9 @@ func WithInitialConnWindowSize(s int32) DialOption { } } -// WithMaxMsgSize returns a DialOption which sets the maximum message size the client can receive. Deprecated: use WithDefaultCallOptions(MaxCallRecvMsgSize(s)) instead. +// WithMaxMsgSize returns a DialOption which sets the maximum message size the client can receive. +// +// Deprecated: use WithDefaultCallOptions(MaxCallRecvMsgSize(s)) instead. func WithMaxMsgSize(s int) DialOption { return WithDefaultCallOptions(MaxCallRecvMsgSize(s)) } @@ -251,7 +270,8 @@ func withResolverBuilder(b resolver.Builder) DialOption { } // WithServiceConfig returns a DialOption which has a channel to read the service configuration. -// DEPRECATED: service config should be received through name resolver, as specified here. +// +// Deprecated: service config should be received through name resolver, as specified here. // https://github.com/grpc/grpc/blob/master/doc/service_config.md func WithServiceConfig(c <-chan ServiceConfig) DialOption { return func(o *dialOptions) { @@ -271,17 +291,17 @@ func WithBackoffMaxDelay(md time.Duration) DialOption { // Use WithBackoffMaxDelay until more parameters on BackoffConfig are opened up // for use. func WithBackoffConfig(b BackoffConfig) DialOption { - // Set defaults to ensure that provided BackoffConfig is valid and - // unexported fields get default values. - setDefaults(&b) - return withBackoff(b) + + return withBackoff(backoff.Exponential{ + MaxDelay: b.MaxDelay, + }) } // withBackoff sets the backoff strategy used for connectRetryNum after a // failed connection attempt. // // This can be exported if arbitrary backoff strategies are allowed by gRPC. -func withBackoff(bs backoffStrategy) DialOption { +func withBackoff(bs backoff.Strategy) DialOption { return func(o *dialOptions) { o.bs = bs } @@ -322,6 +342,7 @@ func WithPerRPCCredentials(creds credentials.PerRPCCredentials) DialOption { // WithTimeout returns a DialOption that configures a timeout for dialing a ClientConn // initially. This is valid if and only if WithBlock() is present. +// // Deprecated: use DialContext and context.WithTimeout instead. func WithTimeout(d time.Duration) DialOption { return func(o *dialOptions) { @@ -335,6 +356,11 @@ func withContextDialer(f func(context.Context, string) (net.Conn, error)) DialOp } } +func init() { + internal.WithContextDialer = withContextDialer + internal.WithResolverBuilder = withResolverBuilder +} + // WithDialer returns a DialOption that specifies a function to use for dialing network addresses. // If FailOnNonTempDialError() is set to true, and an error is returned by f, gRPC checks the error's // Temporary() method to decide if it should try to reconnect to the network address. @@ -412,6 +438,41 @@ func WithChannelzParentID(id int64) DialOption { } } +// WithDisableServiceConfig returns a DialOption that causes grpc to ignore any +// service config provided by the resolver and provides a hint to the resolver +// to not fetch service configs. +func WithDisableServiceConfig() DialOption { + return func(o *dialOptions) { + o.disableServiceConfig = true + } +} + +// WithDisableRetry returns a DialOption that disables retries, even if the +// service config enables them. This does not impact transparent retries, +// which will happen automatically if no data is written to the wire or if the +// RPC is unprocessed by the remote server. +// +// Retry support is currently disabled by default, but will be enabled by +// default in the future. Until then, it may be enabled by setting the +// environment variable "GRPC_GO_RETRY" to "on". +// +// This API is EXPERIMENTAL. +func WithDisableRetry() DialOption { + return func(o *dialOptions) { + o.disableRetry = true + } +} + +func defaultDialOptions() dialOptions { + return dialOptions{ + disableRetry: !envconfig.Retry, + copts: transport.ConnectOptions{ + WriteBufferSize: defaultWriteBufSize, + ReadBufferSize: defaultReadBufSize, + }, + } +} + // Dial creates a client connection to the given target. func Dial(target string, opts ...DialOption) (*ClientConn, error) { return DialContext(context.Background(), target, opts...) @@ -435,14 +496,16 @@ func Dial(target string, opts ...DialOption) (*ClientConn, error) { // e.g. to use dns resolver, a "dns:///" prefix should be applied to the target. func DialContext(ctx context.Context, target string, opts ...DialOption) (conn *ClientConn, err error) { cc := &ClientConn{ - target: target, - csMgr: &connectivityStateManager{}, - conns: make(map[*addrConn]struct{}), - + target: target, + csMgr: &connectivityStateManager{}, + conns: make(map[*addrConn]struct{}), + dopts: defaultDialOptions(), blockingpicker: newPickerWrapper(), } + cc.retryThrottler.Store((*retryThrottler)(nil)) cc.ctx, cc.cancel = context.WithCancel(context.Background()) + cc.dopts = defaultDialOptions() for _, opt := range opts { opt(&cc.dopts) } @@ -518,7 +581,9 @@ func DialContext(ctx context.Context, target string, opts ...DialOption) (conn * } } if cc.dopts.bs == nil { - cc.dopts.bs = DefaultBackoffConfig + cc.dopts.bs = backoff.Exponential{ + MaxDelay: DefaultBackoffConfig.MaxDelay, + } } if cc.dopts.resolverBuilder == nil { // Only try to parse target when resolver builder is not already set. @@ -674,6 +739,7 @@ type ClientConn struct { preBalancerName string // previous balancer name. curAddresses []resolver.Address balancerWrapper *ccBalancerWrapper + retryThrottler atomic.Value channelzID int64 // channelz unique identification number czmu sync.RWMutex @@ -805,8 +871,6 @@ func (cc *ClientConn) switchBalancer(name string) { if cc.balancerWrapper != nil { cc.balancerWrapper.close() } - // Clear all stickiness state. - cc.blockingpicker.clearStickinessState() builder := balancer.Get(name) if builder == nil { @@ -998,6 +1062,9 @@ func (cc *ClientConn) getTransport(ctx context.Context, failfast bool) (transpor // handleServiceConfig parses the service config string in JSON format to Go native // struct ServiceConfig, and store both the struct and the JSON string in ClientConn. func (cc *ClientConn) handleServiceConfig(js string) error { + if cc.dopts.disableServiceConfig { + return nil + } sc, err := parseServiceConfig(js) if err != nil { return err @@ -1005,6 +1072,19 @@ func (cc *ClientConn) handleServiceConfig(js string) error { cc.mu.Lock() cc.scRaw = js cc.sc = sc + + if sc.retryThrottling != nil { + newThrottler := &retryThrottler{ + tokens: sc.retryThrottling.MaxTokens, + max: sc.retryThrottling.MaxTokens, + thresh: sc.retryThrottling.MaxTokens / 2, + ratio: sc.retryThrottling.TokenRatio, + } + cc.retryThrottler.Store(newThrottler) + } else { + cc.retryThrottler.Store((*retryThrottler)(nil)) + } + if sc.LB != nil && *sc.LB != grpclbName { // "grpclb" is not a valid balancer option in service config. if cc.curBalancerName == grpclbName { // If current balancer is grpclb, there's at least one grpclb @@ -1019,25 +1099,14 @@ func (cc *ClientConn) handleServiceConfig(js string) error { } } - if envConfigStickinessOn { - var newStickinessMDKey string - if sc.stickinessMetadataKey != nil && *sc.stickinessMetadataKey != "" { - newStickinessMDKey = *sc.stickinessMetadataKey - } - // newStickinessMDKey is "" if one of the following happens: - // - stickinessMetadataKey is set to "" - // - stickinessMetadataKey field doesn't exist in service config - cc.blockingpicker.updateStickinessMDKey(strings.ToLower(newStickinessMDKey)) - } - cc.mu.Unlock() return nil } func (cc *ClientConn) resolveNow(o resolver.ResolveNowOption) { - cc.mu.Lock() + cc.mu.RLock() r := cc.resolverWrapper - cc.mu.Unlock() + cc.mu.RUnlock() if r == nil { return } @@ -1186,7 +1255,7 @@ func (ac *addrConn) resetTransport() error { // This means either a successful HTTP2 connection was established // or this is the first time this addrConn is trying to establish a // connection. - backoffFor := ac.dopts.bs.backoff(connectRetryNum) // time.Duration. + backoffFor := ac.dopts.bs.Backoff(connectRetryNum) // time.Duration. // This will be the duration that dial gets to finish. dialDuration := getMinConnectTimeout() if backoffFor > dialDuration { @@ -1523,13 +1592,6 @@ func (ac *addrConn) getState() connectivity.State { return ac.state } -func (ac *addrConn) getCurAddr() (ret resolver.Address) { - ac.mu.Lock() - ret = ac.curAddr - ac.mu.Unlock() - return -} - func (ac *addrConn) ChannelzMetric() *channelz.ChannelInternalMetric { ac.mu.Lock() addr := ac.curAddr.Addr @@ -1566,6 +1628,43 @@ func (ac *addrConn) incrCallsFailed() { ac.czmu.Unlock() } +type retryThrottler struct { + max float64 + thresh float64 + ratio float64 + + mu sync.Mutex + tokens float64 // TODO(dfawley): replace with atomic and remove lock. +} + +// throttle subtracts a retry token from the pool and returns whether a retry +// should be throttled (disallowed) based upon the retry throttling policy in +// the service config. +func (rt *retryThrottler) throttle() bool { + if rt == nil { + return false + } + rt.mu.Lock() + defer rt.mu.Unlock() + rt.tokens-- + if rt.tokens < 0 { + rt.tokens = 0 + } + return rt.tokens <= rt.thresh +} + +func (rt *retryThrottler) successfulRPC() { + if rt == nil { + return + } + rt.mu.Lock() + defer rt.mu.Unlock() + rt.tokens += rt.ratio + if rt.tokens > rt.max { + rt.tokens = rt.max + } +} + // ErrClientConnTimeout indicates that the ClientConn cannot establish the // underlying connections within the specified timeout. // diff --git a/vendor/google.golang.org/grpc/codes/codes.go b/vendor/google.golang.org/grpc/codes/codes.go index a8280ae66..d9b9d5782 100644 --- a/vendor/google.golang.org/grpc/codes/codes.go +++ b/vendor/google.golang.org/grpc/codes/codes.go @@ -22,6 +22,7 @@ package codes // import "google.golang.org/grpc/codes" import ( "fmt" + "strconv" ) // A Code is an unsigned 32-bit error code as defined in the gRPC spec. @@ -143,6 +144,8 @@ const ( // Unauthenticated indicates the request does not have valid // authentication credentials for the operation. Unauthenticated Code = 16 + + _maxCode = 17 ) var strToCode = map[string]Code{ @@ -176,6 +179,16 @@ func (c *Code) UnmarshalJSON(b []byte) error { if c == nil { return fmt.Errorf("nil receiver passed to UnmarshalJSON") } + + if ci, err := strconv.ParseUint(string(b), 10, 32); err == nil { + if ci >= _maxCode { + return fmt.Errorf("invalid code: %q", ci) + } + + *c = Code(ci) + return nil + } + if jc, ok := strToCode[string(b)]; ok { *c = jc return nil diff --git a/vendor/google.golang.org/grpc/credentials/alts/alts.go b/vendor/google.golang.org/grpc/credentials/alts/alts.go index c24c5faf3..940056543 100644 --- a/vendor/google.golang.org/grpc/credentials/alts/alts.go +++ b/vendor/google.golang.org/grpc/credentials/alts/alts.go @@ -131,7 +131,6 @@ func DefaultServerOptions() *ServerOptions { // It implements credentials.TransportCredentials interface. type altsTC struct { info *credentials.ProtocolInfo - hsAddr string side core.Side accounts []string hsAddress string @@ -269,8 +268,16 @@ func (g *altsTC) Info() credentials.ProtocolInfo { func (g *altsTC) Clone() credentials.TransportCredentials { info := *g.info + var accounts []string + if g.accounts != nil { + accounts = make([]string, len(g.accounts)) + copy(accounts, g.accounts) + } return &altsTC{ - info: &info, + info: &info, + side: g.side, + hsAddress: g.hsAddress, + accounts: accounts, } } diff --git a/vendor/google.golang.org/grpc/credentials/alts/core/common.go b/vendor/google.golang.org/grpc/credentials/alts/core/common.go index 0112d51cd..b7baf77ac 100644 --- a/vendor/google.golang.org/grpc/credentials/alts/core/common.go +++ b/vendor/google.golang.org/grpc/credentials/alts/core/common.go @@ -16,6 +16,8 @@ * */ +//go:generate ./regenerate.sh + // Package core contains common core functionality for ALTS. // Disclaimer: users should NEVER reference this package directly. package core diff --git a/vendor/google.golang.org/grpc/credentials/alts/core/handshaker/handshaker.go b/vendor/google.golang.org/grpc/credentials/alts/core/handshaker/handshaker.go index d6568468d..a20497851 100644 --- a/vendor/google.golang.org/grpc/credentials/alts/core/handshaker/handshaker.go +++ b/vendor/google.golang.org/grpc/credentials/alts/core/handshaker/handshaker.go @@ -33,6 +33,7 @@ import ( "google.golang.org/grpc/credentials/alts/core" "google.golang.org/grpc/credentials/alts/core/authinfo" "google.golang.org/grpc/credentials/alts/core/conn" + altsgrpc "google.golang.org/grpc/credentials/alts/core/proto/grpc_gcp" altspb "google.golang.org/grpc/credentials/alts/core/proto/grpc_gcp" ) @@ -135,7 +136,7 @@ func DefaultServerHandshakerOptions() *ServerHandshakerOptions { // server. type altsHandshaker struct { // RPC stream used to access the ALTS Handshaker service. - stream altspb.HandshakerService_DoHandshakeClient + stream altsgrpc.HandshakerService_DoHandshakeClient // the connection to the peer. conn net.Conn // client handshake options. @@ -150,7 +151,7 @@ type altsHandshaker struct { // stub created using the passed conn and used to talk to the ALTS Handshaker // service in the metadata server. func NewClientHandshaker(ctx context.Context, conn *grpc.ClientConn, c net.Conn, opts *ClientHandshakerOptions) (core.Handshaker, error) { - stream, err := altspb.NewHandshakerServiceClient(conn).DoHandshake(ctx, grpc.FailFast(false)) + stream, err := altsgrpc.NewHandshakerServiceClient(conn).DoHandshake(ctx, grpc.FailFast(false)) if err != nil { return nil, err } @@ -166,7 +167,7 @@ func NewClientHandshaker(ctx context.Context, conn *grpc.ClientConn, c net.Conn, // stub created using the passed conn and used to talk to the ALTS Handshaker // service in the metadata server. func NewServerHandshaker(ctx context.Context, conn *grpc.ClientConn, c net.Conn, opts *ServerHandshakerOptions) (core.Handshaker, error) { - stream, err := altspb.NewHandshakerServiceClient(conn).DoHandshake(ctx, grpc.FailFast(false)) + stream, err := altsgrpc.NewHandshakerServiceClient(conn).DoHandshake(ctx, grpc.FailFast(false)) if err != nil { return nil, err } diff --git a/vendor/google.golang.org/grpc/credentials/alts/core/proto/grpc_gcp/altscontext.pb.go b/vendor/google.golang.org/grpc/credentials/alts/core/proto/grpc_gcp/altscontext.pb.go index 4375ed1fd..cd4fe79bb 100644 --- a/vendor/google.golang.org/grpc/credentials/alts/core/proto/grpc_gcp/altscontext.pb.go +++ b/vendor/google.golang.org/grpc/credentials/alts/core/proto/grpc_gcp/altscontext.pb.go @@ -1,29 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. -// source: altscontext.proto - -/* -Package grpc_gcp is a generated protocol buffer package. - -It is generated from these files: - altscontext.proto - handshaker.proto - transport_security_common.proto - -It has these top-level messages: - AltsContext - Endpoint - Identity - StartClientHandshakeReq - ServerHandshakeParameters - StartServerHandshakeReq - NextHandshakeMessageReq - HandshakerReq - HandshakerResult - HandshakerStatus - HandshakerResp - RpcProtocolVersions -*/ -package grpc_gcp +// source: grpc/gcp/altscontext.proto + +package grpc_gcp // import "google.golang.org/grpc/credentials/alts/core/proto/grpc_gcp" import proto "github.com/golang/protobuf/proto" import fmt "fmt" @@ -42,23 +20,45 @@ const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package type AltsContext struct { // The application protocol negotiated for this connection. - ApplicationProtocol string `protobuf:"bytes,1,opt,name=application_protocol,json=applicationProtocol" json:"application_protocol,omitempty"` + ApplicationProtocol string `protobuf:"bytes,1,opt,name=application_protocol,json=applicationProtocol,proto3" json:"application_protocol,omitempty"` // The record protocol negotiated for this connection. - RecordProtocol string `protobuf:"bytes,2,opt,name=record_protocol,json=recordProtocol" json:"record_protocol,omitempty"` + RecordProtocol string `protobuf:"bytes,2,opt,name=record_protocol,json=recordProtocol,proto3" json:"record_protocol,omitempty"` // The security level of the created secure channel. - SecurityLevel SecurityLevel `protobuf:"varint,3,opt,name=security_level,json=securityLevel,enum=grpc.gcp.SecurityLevel" json:"security_level,omitempty"` + SecurityLevel SecurityLevel `protobuf:"varint,3,opt,name=security_level,json=securityLevel,proto3,enum=grpc.gcp.SecurityLevel" json:"security_level,omitempty"` // The peer service account. - PeerServiceAccount string `protobuf:"bytes,4,opt,name=peer_service_account,json=peerServiceAccount" json:"peer_service_account,omitempty"` + PeerServiceAccount string `protobuf:"bytes,4,opt,name=peer_service_account,json=peerServiceAccount,proto3" json:"peer_service_account,omitempty"` // The local service account. - LocalServiceAccount string `protobuf:"bytes,5,opt,name=local_service_account,json=localServiceAccount" json:"local_service_account,omitempty"` + LocalServiceAccount string `protobuf:"bytes,5,opt,name=local_service_account,json=localServiceAccount,proto3" json:"local_service_account,omitempty"` // The RPC protocol versions supported by the peer. - PeerRpcVersions *RpcProtocolVersions `protobuf:"bytes,6,opt,name=peer_rpc_versions,json=peerRpcVersions" json:"peer_rpc_versions,omitempty"` + PeerRpcVersions *RpcProtocolVersions `protobuf:"bytes,6,opt,name=peer_rpc_versions,json=peerRpcVersions,proto3" json:"peer_rpc_versions,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *AltsContext) Reset() { *m = AltsContext{} } -func (m *AltsContext) String() string { return proto.CompactTextString(m) } -func (*AltsContext) ProtoMessage() {} -func (*AltsContext) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } +func (m *AltsContext) Reset() { *m = AltsContext{} } +func (m *AltsContext) String() string { return proto.CompactTextString(m) } +func (*AltsContext) ProtoMessage() {} +func (*AltsContext) Descriptor() ([]byte, []int) { + return fileDescriptor_altscontext_2f63c0ac7e856743, []int{0} +} +func (m *AltsContext) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_AltsContext.Unmarshal(m, b) +} +func (m *AltsContext) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_AltsContext.Marshal(b, m, deterministic) +} +func (dst *AltsContext) XXX_Merge(src proto.Message) { + xxx_messageInfo_AltsContext.Merge(dst, src) +} +func (m *AltsContext) XXX_Size() int { + return xxx_messageInfo_AltsContext.Size(m) +} +func (m *AltsContext) XXX_DiscardUnknown() { + xxx_messageInfo_AltsContext.DiscardUnknown(m) +} + +var xxx_messageInfo_AltsContext proto.InternalMessageInfo func (m *AltsContext) GetApplicationProtocol() string { if m != nil { @@ -106,26 +106,32 @@ func init() { proto.RegisterType((*AltsContext)(nil), "grpc.gcp.AltsContext") } -func init() { proto.RegisterFile("altscontext.proto", fileDescriptor0) } - -var fileDescriptor0 = []byte{ - // 284 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x91, 0xc1, 0x4a, 0x03, 0x31, - 0x10, 0x86, 0xd9, 0xaa, 0x45, 0x53, 0x6c, 0x69, 0x6c, 0xe9, 0x22, 0x88, 0xc5, 0x8b, 0x3d, 0x2d, - 0xba, 0xde, 0x85, 0xea, 0x49, 0xf0, 0x20, 0x5b, 0xf0, 0x1a, 0xe2, 0x18, 0x4a, 0x20, 0xcd, 0x84, - 0x49, 0xba, 0xe8, 0xab, 0xfa, 0x34, 0xb2, 0xc9, 0x6e, 0x5b, 0xf4, 0x98, 0xf9, 0xbe, 0x3f, 0x33, - 0x93, 0xb0, 0xb1, 0x34, 0xc1, 0x03, 0xda, 0xa0, 0xbe, 0x42, 0xe1, 0x08, 0x03, 0xf2, 0xd3, 0x35, - 0x39, 0x28, 0xd6, 0xe0, 0x2e, 0xaf, 0x03, 0x49, 0xeb, 0x1d, 0x52, 0x10, 0x5e, 0xc1, 0x96, 0x74, - 0xf8, 0x16, 0x80, 0x9b, 0x0d, 0xda, 0xa4, 0xde, 0xfc, 0xf4, 0xd8, 0x60, 0x69, 0x82, 0x7f, 0x4e, - 0x17, 0xf0, 0x7b, 0x36, 0x91, 0xce, 0x19, 0x0d, 0x32, 0x68, 0xb4, 0x22, 0x4a, 0x80, 0x26, 0xcf, - 0xe6, 0xd9, 0xe2, 0xac, 0xba, 0x38, 0x60, 0x6f, 0x2d, 0xe2, 0xb7, 0x6c, 0x44, 0x0a, 0x90, 0x3e, - 0xf7, 0x76, 0x2f, 0xda, 0xc3, 0x54, 0xde, 0x89, 0x8f, 0x6c, 0xb8, 0x1b, 0xc2, 0xa8, 0x5a, 0x99, - 0xfc, 0x68, 0x9e, 0x2d, 0x86, 0xe5, 0xac, 0xe8, 0xe6, 0x2d, 0x56, 0x2d, 0x7f, 0x6d, 0x70, 0x75, - 0xee, 0x0f, 0x8f, 0xfc, 0x8e, 0x4d, 0x9c, 0x52, 0x24, 0xbc, 0xa2, 0x5a, 0x83, 0x12, 0x12, 0x00, - 0xb7, 0x36, 0xe4, 0xc7, 0xb1, 0x1b, 0x6f, 0xd8, 0x2a, 0xa1, 0x65, 0x22, 0xbc, 0x64, 0x53, 0x83, - 0x20, 0xcd, 0xbf, 0xc8, 0x49, 0x5a, 0x27, 0xc2, 0x3f, 0x99, 0x17, 0x36, 0x8e, 0x5d, 0xc8, 0x81, - 0xa8, 0x15, 0x79, 0x8d, 0xd6, 0xe7, 0xfd, 0x79, 0xb6, 0x18, 0x94, 0x57, 0xfb, 0x41, 0x2b, 0x07, - 0xdd, 0x5e, 0xef, 0xad, 0x54, 0x8d, 0x9a, 0x5c, 0xe5, 0xa0, 0x2b, 0x3c, 0xcd, 0xd8, 0x54, 0x63, - 0xca, 0x34, 0x9f, 0x54, 0x68, 0x1b, 0x14, 0x59, 0x69, 0x3e, 0xfa, 0xf1, 0xa5, 0x1e, 0x7e, 0x03, - 0x00, 0x00, 0xff, 0xff, 0x36, 0xd0, 0xe1, 0x63, 0xbc, 0x01, 0x00, 0x00, +func init() { + proto.RegisterFile("grpc/gcp/altscontext.proto", fileDescriptor_altscontext_2f63c0ac7e856743) +} + +var fileDescriptor_altscontext_2f63c0ac7e856743 = []byte{ + // 338 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x91, 0x4d, 0x4b, 0x23, 0x41, + 0x10, 0x86, 0x99, 0xec, 0x6e, 0xd8, 0xed, 0xb0, 0xc9, 0xee, 0x6c, 0xc2, 0x0e, 0x01, 0x21, 0x78, + 0x71, 0x4e, 0x33, 0x1a, 0x8f, 0x82, 0x90, 0x78, 0x12, 0x3c, 0x84, 0x09, 0x78, 0xf0, 0x32, 0xb4, + 0x95, 0xa2, 0x6d, 0xe8, 0x74, 0x35, 0xd5, 0x9d, 0xa0, 0x7f, 0xd5, 0x5f, 0x23, 0xd3, 0x93, 0x2f, + 0xf4, 0x58, 0xf5, 0xbc, 0x6f, 0x7d, 0x8a, 0xb1, 0x62, 0x07, 0xa5, 0x02, 0x57, 0x4a, 0x13, 0x3c, + 0x90, 0x0d, 0xf8, 0x1a, 0x0a, 0xc7, 0x14, 0x28, 0xfd, 0xd9, 0xb0, 0x42, 0x81, 0x1b, 0xe7, 0x07, + 0x55, 0x60, 0x69, 0xbd, 0x23, 0x0e, 0xb5, 0x47, 0xd8, 0xb0, 0x0e, 0x6f, 0x35, 0xd0, 0x7a, 0x4d, + 0xb6, 0xf5, 0x9c, 0xbf, 0x77, 0x44, 0x6f, 0x66, 0x82, 0xbf, 0x6b, 0x2b, 0xa5, 0x57, 0x62, 0x28, + 0x9d, 0x33, 0x1a, 0x64, 0xd0, 0x64, 0xeb, 0x28, 0x02, 0x32, 0x59, 0x32, 0x49, 0xf2, 0x5f, 0xd5, + 0xbf, 0x13, 0xb6, 0xd8, 0xa1, 0xf4, 0x42, 0x0c, 0x18, 0x81, 0x78, 0x75, 0x54, 0x77, 0xa2, 0xba, + 0xdf, 0xa6, 0x0f, 0xc2, 0x5b, 0xd1, 0x3f, 0x0c, 0x61, 0x70, 0x8b, 0x26, 0xfb, 0x36, 0x49, 0xf2, + 0xfe, 0xf4, 0x7f, 0xb1, 0x1f, 0xbc, 0x58, 0xee, 0xf8, 0x43, 0x83, 0xab, 0xdf, 0xfe, 0x34, 0x4c, + 0x2f, 0xc5, 0xd0, 0x21, 0x72, 0xed, 0x91, 0xb7, 0x1a, 0xb0, 0x96, 0x00, 0xb4, 0xb1, 0x21, 0xfb, + 0x1e, 0xbb, 0xa5, 0x0d, 0x5b, 0xb6, 0x68, 0xd6, 0x92, 0x74, 0x2a, 0x46, 0x86, 0x40, 0x9a, 0x2f, + 0x96, 0x1f, 0xed, 0x3a, 0x11, 0x7e, 0xf2, 0xdc, 0x8b, 0xbf, 0xb1, 0x0b, 0x3b, 0xa8, 0xb7, 0xc8, + 0x5e, 0x93, 0xf5, 0x59, 0x77, 0x92, 0xe4, 0xbd, 0xe9, 0xd9, 0x71, 0xd0, 0xca, 0xc1, 0x7e, 0xaf, + 0xc7, 0x9d, 0xa8, 0x1a, 0x34, 0xbe, 0xca, 0xc1, 0x3e, 0x31, 0x7f, 0x11, 0x23, 0x4d, 0xad, 0xa7, + 0xf9, 0x56, 0xa1, 0x6d, 0x40, 0xb6, 0xd2, 0xcc, 0xff, 0x9c, 0x9c, 0x3c, 0x96, 0x59, 0x24, 0x4f, + 0x37, 0x8a, 0x48, 0x19, 0x2c, 0x14, 0x19, 0x69, 0x55, 0x41, 0xac, 0xca, 0xf8, 0x45, 0x60, 0x5c, + 0xa1, 0x0d, 0x5a, 0x1a, 0x1f, 0x7f, 0x5e, 0x02, 0x31, 0x96, 0xf1, 0xd4, 0x51, 0x50, 0x2b, 0x70, + 0xcf, 0xdd, 0x18, 0x5f, 0x7f, 0x04, 0x00, 0x00, 0xff, 0xff, 0xe8, 0x41, 0xe3, 0x52, 0x1f, 0x02, + 0x00, 0x00, } diff --git a/vendor/google.golang.org/grpc/credentials/alts/core/proto/grpc_gcp/altscontext.proto b/vendor/google.golang.org/grpc/credentials/alts/core/proto/grpc_gcp/altscontext.proto deleted file mode 100644 index 9a1dad5f5..000000000 --- a/vendor/google.golang.org/grpc/credentials/alts/core/proto/grpc_gcp/altscontext.proto +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2018 gRPC authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -import "transport_security_common.proto"; - -package grpc.gcp; - -option java_package = "io.grpc.alts.internal"; - -message AltsContext { - // The application protocol negotiated for this connection. - string application_protocol = 1; - - // The record protocol negotiated for this connection. - string record_protocol = 2; - - // The security level of the created secure channel. - SecurityLevel security_level = 3; - - // The peer service account. - string peer_service_account = 4; - - // The local service account. - string local_service_account = 5; - - // The RPC protocol versions supported by the peer. - RpcProtocolVersions peer_rpc_versions = 6; -} diff --git a/vendor/google.golang.org/grpc/credentials/alts/core/proto/grpc_gcp/handshaker.pb.go b/vendor/google.golang.org/grpc/credentials/alts/core/proto/grpc_gcp/handshaker.pb.go index 9c3e86070..01e87194b 100644 --- a/vendor/google.golang.org/grpc/credentials/alts/core/proto/grpc_gcp/handshaker.pb.go +++ b/vendor/google.golang.org/grpc/credentials/alts/core/proto/grpc_gcp/handshaker.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. -// source: handshaker.proto +// source: grpc/gcp/handshaker.proto -package grpc_gcp +package grpc_gcp // import "google.golang.org/grpc/credentials/alts/core/proto/grpc_gcp" import proto "github.com/golang/protobuf/proto" import fmt "fmt" @@ -17,6 +17,12 @@ var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + type HandshakeProtocol int32 const ( @@ -42,7 +48,9 @@ var HandshakeProtocol_value = map[string]int32{ func (x HandshakeProtocol) String() string { return proto.EnumName(HandshakeProtocol_name, int32(x)) } -func (HandshakeProtocol) EnumDescriptor() ([]byte, []int) { return fileDescriptor1, []int{0} } +func (HandshakeProtocol) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_handshaker_b28e45bdd1661054, []int{0} +} type NetworkProtocol int32 @@ -66,22 +74,46 @@ var NetworkProtocol_value = map[string]int32{ func (x NetworkProtocol) String() string { return proto.EnumName(NetworkProtocol_name, int32(x)) } -func (NetworkProtocol) EnumDescriptor() ([]byte, []int) { return fileDescriptor1, []int{1} } +func (NetworkProtocol) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_handshaker_b28e45bdd1661054, []int{1} +} type Endpoint struct { // IP address. It should contain an IPv4 or IPv6 string literal, e.g. // "192.168.0.1" or "2001:db8::1". - IpAddress string `protobuf:"bytes,1,opt,name=ip_address,json=ipAddress" json:"ip_address,omitempty"` + IpAddress string `protobuf:"bytes,1,opt,name=ip_address,json=ipAddress,proto3" json:"ip_address,omitempty"` // Port number. - Port int32 `protobuf:"varint,2,opt,name=port" json:"port,omitempty"` + Port int32 `protobuf:"varint,2,opt,name=port,proto3" json:"port,omitempty"` // Network protocol (e.g., TCP, UDP) associated with this endpoint. - Protocol NetworkProtocol `protobuf:"varint,3,opt,name=protocol,enum=grpc.gcp.NetworkProtocol" json:"protocol,omitempty"` + Protocol NetworkProtocol `protobuf:"varint,3,opt,name=protocol,proto3,enum=grpc.gcp.NetworkProtocol" json:"protocol,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Endpoint) Reset() { *m = Endpoint{} } +func (m *Endpoint) String() string { return proto.CompactTextString(m) } +func (*Endpoint) ProtoMessage() {} +func (*Endpoint) Descriptor() ([]byte, []int) { + return fileDescriptor_handshaker_b28e45bdd1661054, []int{0} +} +func (m *Endpoint) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Endpoint.Unmarshal(m, b) +} +func (m *Endpoint) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Endpoint.Marshal(b, m, deterministic) +} +func (dst *Endpoint) XXX_Merge(src proto.Message) { + xxx_messageInfo_Endpoint.Merge(dst, src) +} +func (m *Endpoint) XXX_Size() int { + return xxx_messageInfo_Endpoint.Size(m) +} +func (m *Endpoint) XXX_DiscardUnknown() { + xxx_messageInfo_Endpoint.DiscardUnknown(m) } -func (m *Endpoint) Reset() { *m = Endpoint{} } -func (m *Endpoint) String() string { return proto.CompactTextString(m) } -func (*Endpoint) ProtoMessage() {} -func (*Endpoint) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{0} } +var xxx_messageInfo_Endpoint proto.InternalMessageInfo func (m *Endpoint) GetIpAddress() string { if m != nil { @@ -108,23 +140,45 @@ type Identity struct { // Types that are valid to be assigned to IdentityOneof: // *Identity_ServiceAccount // *Identity_Hostname - IdentityOneof isIdentity_IdentityOneof `protobuf_oneof:"identity_oneof"` + IdentityOneof isIdentity_IdentityOneof `protobuf_oneof:"identity_oneof"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Identity) Reset() { *m = Identity{} } +func (m *Identity) String() string { return proto.CompactTextString(m) } +func (*Identity) ProtoMessage() {} +func (*Identity) Descriptor() ([]byte, []int) { + return fileDescriptor_handshaker_b28e45bdd1661054, []int{1} +} +func (m *Identity) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Identity.Unmarshal(m, b) +} +func (m *Identity) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Identity.Marshal(b, m, deterministic) +} +func (dst *Identity) XXX_Merge(src proto.Message) { + xxx_messageInfo_Identity.Merge(dst, src) +} +func (m *Identity) XXX_Size() int { + return xxx_messageInfo_Identity.Size(m) +} +func (m *Identity) XXX_DiscardUnknown() { + xxx_messageInfo_Identity.DiscardUnknown(m) } -func (m *Identity) Reset() { *m = Identity{} } -func (m *Identity) String() string { return proto.CompactTextString(m) } -func (*Identity) ProtoMessage() {} -func (*Identity) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{1} } +var xxx_messageInfo_Identity proto.InternalMessageInfo type isIdentity_IdentityOneof interface { isIdentity_IdentityOneof() } type Identity_ServiceAccount struct { - ServiceAccount string `protobuf:"bytes,1,opt,name=service_account,json=serviceAccount,oneof"` + ServiceAccount string `protobuf:"bytes,1,opt,name=service_account,json=serviceAccount,proto3,oneof"` } type Identity_Hostname struct { - Hostname string `protobuf:"bytes,2,opt,name=hostname,oneof"` + Hostname string `protobuf:"bytes,2,opt,name=hostname,proto3,oneof"` } func (*Identity_ServiceAccount) isIdentity_IdentityOneof() {} @@ -203,11 +257,11 @@ func _Identity_OneofSizer(msg proto.Message) (n int) { // identity_oneof switch x := m.IdentityOneof.(type) { case *Identity_ServiceAccount: - n += proto.SizeVarint(1<<3 | proto.WireBytes) + n += 1 // tag and wire n += proto.SizeVarint(uint64(len(x.ServiceAccount))) n += len(x.ServiceAccount) case *Identity_Hostname: - n += proto.SizeVarint(2<<3 | proto.WireBytes) + n += 1 // tag and wire n += proto.SizeVarint(uint64(len(x.Hostname))) n += len(x.Hostname) case nil: @@ -219,38 +273,60 @@ func _Identity_OneofSizer(msg proto.Message) (n int) { type StartClientHandshakeReq struct { // Handshake security protocol requested by the client. - HandshakeSecurityProtocol HandshakeProtocol `protobuf:"varint,1,opt,name=handshake_security_protocol,json=handshakeSecurityProtocol,enum=grpc.gcp.HandshakeProtocol" json:"handshake_security_protocol,omitempty"` + HandshakeSecurityProtocol HandshakeProtocol `protobuf:"varint,1,opt,name=handshake_security_protocol,json=handshakeSecurityProtocol,proto3,enum=grpc.gcp.HandshakeProtocol" json:"handshake_security_protocol,omitempty"` // The application protocols supported by the client, e.g., "h2" (for http2), // "grpc". - ApplicationProtocols []string `protobuf:"bytes,2,rep,name=application_protocols,json=applicationProtocols" json:"application_protocols,omitempty"` + ApplicationProtocols []string `protobuf:"bytes,2,rep,name=application_protocols,json=applicationProtocols,proto3" json:"application_protocols,omitempty"` // The record protocols supported by the client, e.g., // "ALTSRP_GCM_AES128". - RecordProtocols []string `protobuf:"bytes,3,rep,name=record_protocols,json=recordProtocols" json:"record_protocols,omitempty"` + RecordProtocols []string `protobuf:"bytes,3,rep,name=record_protocols,json=recordProtocols,proto3" json:"record_protocols,omitempty"` // (Optional) Describes which server identities are acceptable by the client. // If target identities are provided and none of them matches the peer // identity of the server, handshake will fail. - TargetIdentities []*Identity `protobuf:"bytes,4,rep,name=target_identities,json=targetIdentities" json:"target_identities,omitempty"` + TargetIdentities []*Identity `protobuf:"bytes,4,rep,name=target_identities,json=targetIdentities,proto3" json:"target_identities,omitempty"` // (Optional) Application may specify a local identity. Otherwise, the // handshaker chooses a default local identity. - LocalIdentity *Identity `protobuf:"bytes,5,opt,name=local_identity,json=localIdentity" json:"local_identity,omitempty"` + LocalIdentity *Identity `protobuf:"bytes,5,opt,name=local_identity,json=localIdentity,proto3" json:"local_identity,omitempty"` // (Optional) Local endpoint information of the connection to the server, // such as local IP address, port number, and network protocol. - LocalEndpoint *Endpoint `protobuf:"bytes,6,opt,name=local_endpoint,json=localEndpoint" json:"local_endpoint,omitempty"` + LocalEndpoint *Endpoint `protobuf:"bytes,6,opt,name=local_endpoint,json=localEndpoint,proto3" json:"local_endpoint,omitempty"` // (Optional) Endpoint information of the remote server, such as IP address, // port number, and network protocol. - RemoteEndpoint *Endpoint `protobuf:"bytes,7,opt,name=remote_endpoint,json=remoteEndpoint" json:"remote_endpoint,omitempty"` + RemoteEndpoint *Endpoint `protobuf:"bytes,7,opt,name=remote_endpoint,json=remoteEndpoint,proto3" json:"remote_endpoint,omitempty"` // (Optional) If target name is provided, a secure naming check is performed // to verify that the peer authenticated identity is indeed authorized to run // the target name. - TargetName string `protobuf:"bytes,8,opt,name=target_name,json=targetName" json:"target_name,omitempty"` + TargetName string `protobuf:"bytes,8,opt,name=target_name,json=targetName,proto3" json:"target_name,omitempty"` // (Optional) RPC protocol versions supported by the client. - RpcVersions *RpcProtocolVersions `protobuf:"bytes,9,opt,name=rpc_versions,json=rpcVersions" json:"rpc_versions,omitempty"` + RpcVersions *RpcProtocolVersions `protobuf:"bytes,9,opt,name=rpc_versions,json=rpcVersions,proto3" json:"rpc_versions,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StartClientHandshakeReq) Reset() { *m = StartClientHandshakeReq{} } +func (m *StartClientHandshakeReq) String() string { return proto.CompactTextString(m) } +func (*StartClientHandshakeReq) ProtoMessage() {} +func (*StartClientHandshakeReq) Descriptor() ([]byte, []int) { + return fileDescriptor_handshaker_b28e45bdd1661054, []int{2} +} +func (m *StartClientHandshakeReq) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_StartClientHandshakeReq.Unmarshal(m, b) +} +func (m *StartClientHandshakeReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_StartClientHandshakeReq.Marshal(b, m, deterministic) +} +func (dst *StartClientHandshakeReq) XXX_Merge(src proto.Message) { + xxx_messageInfo_StartClientHandshakeReq.Merge(dst, src) +} +func (m *StartClientHandshakeReq) XXX_Size() int { + return xxx_messageInfo_StartClientHandshakeReq.Size(m) +} +func (m *StartClientHandshakeReq) XXX_DiscardUnknown() { + xxx_messageInfo_StartClientHandshakeReq.DiscardUnknown(m) } -func (m *StartClientHandshakeReq) Reset() { *m = StartClientHandshakeReq{} } -func (m *StartClientHandshakeReq) String() string { return proto.CompactTextString(m) } -func (*StartClientHandshakeReq) ProtoMessage() {} -func (*StartClientHandshakeReq) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{2} } +var xxx_messageInfo_StartClientHandshakeReq proto.InternalMessageInfo func (m *StartClientHandshakeReq) GetHandshakeSecurityProtocol() HandshakeProtocol { if m != nil { @@ -318,16 +394,38 @@ func (m *StartClientHandshakeReq) GetRpcVersions() *RpcProtocolVersions { type ServerHandshakeParameters struct { // The record protocols supported by the server, e.g., // "ALTSRP_GCM_AES128". - RecordProtocols []string `protobuf:"bytes,1,rep,name=record_protocols,json=recordProtocols" json:"record_protocols,omitempty"` + RecordProtocols []string `protobuf:"bytes,1,rep,name=record_protocols,json=recordProtocols,proto3" json:"record_protocols,omitempty"` // (Optional) A list of local identities supported by the server, if // specified. Otherwise, the handshaker chooses a default local identity. - LocalIdentities []*Identity `protobuf:"bytes,2,rep,name=local_identities,json=localIdentities" json:"local_identities,omitempty"` + LocalIdentities []*Identity `protobuf:"bytes,2,rep,name=local_identities,json=localIdentities,proto3" json:"local_identities,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ServerHandshakeParameters) Reset() { *m = ServerHandshakeParameters{} } +func (m *ServerHandshakeParameters) String() string { return proto.CompactTextString(m) } +func (*ServerHandshakeParameters) ProtoMessage() {} +func (*ServerHandshakeParameters) Descriptor() ([]byte, []int) { + return fileDescriptor_handshaker_b28e45bdd1661054, []int{3} +} +func (m *ServerHandshakeParameters) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ServerHandshakeParameters.Unmarshal(m, b) +} +func (m *ServerHandshakeParameters) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ServerHandshakeParameters.Marshal(b, m, deterministic) +} +func (dst *ServerHandshakeParameters) XXX_Merge(src proto.Message) { + xxx_messageInfo_ServerHandshakeParameters.Merge(dst, src) +} +func (m *ServerHandshakeParameters) XXX_Size() int { + return xxx_messageInfo_ServerHandshakeParameters.Size(m) +} +func (m *ServerHandshakeParameters) XXX_DiscardUnknown() { + xxx_messageInfo_ServerHandshakeParameters.DiscardUnknown(m) } -func (m *ServerHandshakeParameters) Reset() { *m = ServerHandshakeParameters{} } -func (m *ServerHandshakeParameters) String() string { return proto.CompactTextString(m) } -func (*ServerHandshakeParameters) ProtoMessage() {} -func (*ServerHandshakeParameters) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{3} } +var xxx_messageInfo_ServerHandshakeParameters proto.InternalMessageInfo func (m *ServerHandshakeParameters) GetRecordProtocols() []string { if m != nil { @@ -346,30 +444,52 @@ func (m *ServerHandshakeParameters) GetLocalIdentities() []*Identity { type StartServerHandshakeReq struct { // The application protocols supported by the server, e.g., "h2" (for http2), // "grpc". - ApplicationProtocols []string `protobuf:"bytes,1,rep,name=application_protocols,json=applicationProtocols" json:"application_protocols,omitempty"` + ApplicationProtocols []string `protobuf:"bytes,1,rep,name=application_protocols,json=applicationProtocols,proto3" json:"application_protocols,omitempty"` // Handshake parameters (record protocols and local identities supported by // the server) mapped by the handshake protocol. Each handshake security // protocol (e.g., TLS or ALTS) has its own set of record protocols and local // identities. Since protobuf does not support enum as key to the map, the key // to handshake_parameters is the integer value of HandshakeProtocol enum. - HandshakeParameters map[int32]*ServerHandshakeParameters `protobuf:"bytes,2,rep,name=handshake_parameters,json=handshakeParameters" json:"handshake_parameters,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + HandshakeParameters map[int32]*ServerHandshakeParameters `protobuf:"bytes,2,rep,name=handshake_parameters,json=handshakeParameters,proto3" json:"handshake_parameters,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` // Bytes in out_frames returned from the peer's HandshakerResp. It is possible // that the peer's out_frames are split into multiple HandshakReq messages. InBytes []byte `protobuf:"bytes,3,opt,name=in_bytes,json=inBytes,proto3" json:"in_bytes,omitempty"` // (Optional) Local endpoint information of the connection to the client, // such as local IP address, port number, and network protocol. - LocalEndpoint *Endpoint `protobuf:"bytes,4,opt,name=local_endpoint,json=localEndpoint" json:"local_endpoint,omitempty"` + LocalEndpoint *Endpoint `protobuf:"bytes,4,opt,name=local_endpoint,json=localEndpoint,proto3" json:"local_endpoint,omitempty"` // (Optional) Endpoint information of the remote client, such as IP address, // port number, and network protocol. - RemoteEndpoint *Endpoint `protobuf:"bytes,5,opt,name=remote_endpoint,json=remoteEndpoint" json:"remote_endpoint,omitempty"` + RemoteEndpoint *Endpoint `protobuf:"bytes,5,opt,name=remote_endpoint,json=remoteEndpoint,proto3" json:"remote_endpoint,omitempty"` // (Optional) RPC protocol versions supported by the server. - RpcVersions *RpcProtocolVersions `protobuf:"bytes,6,opt,name=rpc_versions,json=rpcVersions" json:"rpc_versions,omitempty"` + RpcVersions *RpcProtocolVersions `protobuf:"bytes,6,opt,name=rpc_versions,json=rpcVersions,proto3" json:"rpc_versions,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StartServerHandshakeReq) Reset() { *m = StartServerHandshakeReq{} } +func (m *StartServerHandshakeReq) String() string { return proto.CompactTextString(m) } +func (*StartServerHandshakeReq) ProtoMessage() {} +func (*StartServerHandshakeReq) Descriptor() ([]byte, []int) { + return fileDescriptor_handshaker_b28e45bdd1661054, []int{4} +} +func (m *StartServerHandshakeReq) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_StartServerHandshakeReq.Unmarshal(m, b) +} +func (m *StartServerHandshakeReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_StartServerHandshakeReq.Marshal(b, m, deterministic) +} +func (dst *StartServerHandshakeReq) XXX_Merge(src proto.Message) { + xxx_messageInfo_StartServerHandshakeReq.Merge(dst, src) +} +func (m *StartServerHandshakeReq) XXX_Size() int { + return xxx_messageInfo_StartServerHandshakeReq.Size(m) +} +func (m *StartServerHandshakeReq) XXX_DiscardUnknown() { + xxx_messageInfo_StartServerHandshakeReq.DiscardUnknown(m) } -func (m *StartServerHandshakeReq) Reset() { *m = StartServerHandshakeReq{} } -func (m *StartServerHandshakeReq) String() string { return proto.CompactTextString(m) } -func (*StartServerHandshakeReq) ProtoMessage() {} -func (*StartServerHandshakeReq) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{4} } +var xxx_messageInfo_StartServerHandshakeReq proto.InternalMessageInfo func (m *StartServerHandshakeReq) GetApplicationProtocols() []string { if m != nil { @@ -417,13 +537,35 @@ type NextHandshakeMessageReq struct { // Bytes in out_frames returned from the peer's HandshakerResp. It is possible // that the peer's out_frames are split into multiple NextHandshakerMessageReq // messages. - InBytes []byte `protobuf:"bytes,1,opt,name=in_bytes,json=inBytes,proto3" json:"in_bytes,omitempty"` + InBytes []byte `protobuf:"bytes,1,opt,name=in_bytes,json=inBytes,proto3" json:"in_bytes,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *NextHandshakeMessageReq) Reset() { *m = NextHandshakeMessageReq{} } -func (m *NextHandshakeMessageReq) String() string { return proto.CompactTextString(m) } -func (*NextHandshakeMessageReq) ProtoMessage() {} -func (*NextHandshakeMessageReq) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{5} } +func (m *NextHandshakeMessageReq) Reset() { *m = NextHandshakeMessageReq{} } +func (m *NextHandshakeMessageReq) String() string { return proto.CompactTextString(m) } +func (*NextHandshakeMessageReq) ProtoMessage() {} +func (*NextHandshakeMessageReq) Descriptor() ([]byte, []int) { + return fileDescriptor_handshaker_b28e45bdd1661054, []int{5} +} +func (m *NextHandshakeMessageReq) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_NextHandshakeMessageReq.Unmarshal(m, b) +} +func (m *NextHandshakeMessageReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_NextHandshakeMessageReq.Marshal(b, m, deterministic) +} +func (dst *NextHandshakeMessageReq) XXX_Merge(src proto.Message) { + xxx_messageInfo_NextHandshakeMessageReq.Merge(dst, src) +} +func (m *NextHandshakeMessageReq) XXX_Size() int { + return xxx_messageInfo_NextHandshakeMessageReq.Size(m) +} +func (m *NextHandshakeMessageReq) XXX_DiscardUnknown() { + xxx_messageInfo_NextHandshakeMessageReq.DiscardUnknown(m) +} + +var xxx_messageInfo_NextHandshakeMessageReq proto.InternalMessageInfo func (m *NextHandshakeMessageReq) GetInBytes() []byte { if m != nil { @@ -437,26 +579,48 @@ type HandshakerReq struct { // *HandshakerReq_ClientStart // *HandshakerReq_ServerStart // *HandshakerReq_Next - ReqOneof isHandshakerReq_ReqOneof `protobuf_oneof:"req_oneof"` + ReqOneof isHandshakerReq_ReqOneof `protobuf_oneof:"req_oneof"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HandshakerReq) Reset() { *m = HandshakerReq{} } +func (m *HandshakerReq) String() string { return proto.CompactTextString(m) } +func (*HandshakerReq) ProtoMessage() {} +func (*HandshakerReq) Descriptor() ([]byte, []int) { + return fileDescriptor_handshaker_b28e45bdd1661054, []int{6} +} +func (m *HandshakerReq) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_HandshakerReq.Unmarshal(m, b) +} +func (m *HandshakerReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_HandshakerReq.Marshal(b, m, deterministic) +} +func (dst *HandshakerReq) XXX_Merge(src proto.Message) { + xxx_messageInfo_HandshakerReq.Merge(dst, src) +} +func (m *HandshakerReq) XXX_Size() int { + return xxx_messageInfo_HandshakerReq.Size(m) +} +func (m *HandshakerReq) XXX_DiscardUnknown() { + xxx_messageInfo_HandshakerReq.DiscardUnknown(m) } -func (m *HandshakerReq) Reset() { *m = HandshakerReq{} } -func (m *HandshakerReq) String() string { return proto.CompactTextString(m) } -func (*HandshakerReq) ProtoMessage() {} -func (*HandshakerReq) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{6} } +var xxx_messageInfo_HandshakerReq proto.InternalMessageInfo type isHandshakerReq_ReqOneof interface { isHandshakerReq_ReqOneof() } type HandshakerReq_ClientStart struct { - ClientStart *StartClientHandshakeReq `protobuf:"bytes,1,opt,name=client_start,json=clientStart,oneof"` + ClientStart *StartClientHandshakeReq `protobuf:"bytes,1,opt,name=client_start,json=clientStart,proto3,oneof"` } type HandshakerReq_ServerStart struct { - ServerStart *StartServerHandshakeReq `protobuf:"bytes,2,opt,name=server_start,json=serverStart,oneof"` + ServerStart *StartServerHandshakeReq `protobuf:"bytes,2,opt,name=server_start,json=serverStart,proto3,oneof"` } type HandshakerReq_Next struct { - Next *NextHandshakeMessageReq `protobuf:"bytes,3,opt,name=next,oneof"` + Next *NextHandshakeMessageReq `protobuf:"bytes,3,opt,name=next,proto3,oneof"` } func (*HandshakerReq_ClientStart) isHandshakerReq_ReqOneof() {} @@ -564,17 +728,17 @@ func _HandshakerReq_OneofSizer(msg proto.Message) (n int) { switch x := m.ReqOneof.(type) { case *HandshakerReq_ClientStart: s := proto.Size(x.ClientStart) - n += proto.SizeVarint(1<<3 | proto.WireBytes) + n += 1 // tag and wire n += proto.SizeVarint(uint64(s)) n += s case *HandshakerReq_ServerStart: s := proto.Size(x.ServerStart) - n += proto.SizeVarint(2<<3 | proto.WireBytes) + n += 1 // tag and wire n += proto.SizeVarint(uint64(s)) n += s case *HandshakerReq_Next: s := proto.Size(x.Next) - n += proto.SizeVarint(3<<3 | proto.WireBytes) + n += 1 // tag and wire n += proto.SizeVarint(uint64(s)) n += s case nil: @@ -586,29 +750,51 @@ func _HandshakerReq_OneofSizer(msg proto.Message) (n int) { type HandshakerResult struct { // The application protocol negotiated for this connection. - ApplicationProtocol string `protobuf:"bytes,1,opt,name=application_protocol,json=applicationProtocol" json:"application_protocol,omitempty"` + ApplicationProtocol string `protobuf:"bytes,1,opt,name=application_protocol,json=applicationProtocol,proto3" json:"application_protocol,omitempty"` // The record protocol negotiated for this connection. - RecordProtocol string `protobuf:"bytes,2,opt,name=record_protocol,json=recordProtocol" json:"record_protocol,omitempty"` + RecordProtocol string `protobuf:"bytes,2,opt,name=record_protocol,json=recordProtocol,proto3" json:"record_protocol,omitempty"` // Cryptographic key data. The key data may be more than the key length // required for the record protocol, thus the client of the handshaker // service needs to truncate the key data into the right key length. KeyData []byte `protobuf:"bytes,3,opt,name=key_data,json=keyData,proto3" json:"key_data,omitempty"` // The authenticated identity of the peer. - PeerIdentity *Identity `protobuf:"bytes,4,opt,name=peer_identity,json=peerIdentity" json:"peer_identity,omitempty"` + PeerIdentity *Identity `protobuf:"bytes,4,opt,name=peer_identity,json=peerIdentity,proto3" json:"peer_identity,omitempty"` // The local identity used in the handshake. - LocalIdentity *Identity `protobuf:"bytes,5,opt,name=local_identity,json=localIdentity" json:"local_identity,omitempty"` + LocalIdentity *Identity `protobuf:"bytes,5,opt,name=local_identity,json=localIdentity,proto3" json:"local_identity,omitempty"` // Indicate whether the handshaker service client should keep the channel // between the handshaker service open, e.g., in order to handle // post-handshake messages in the future. - KeepChannelOpen bool `protobuf:"varint,6,opt,name=keep_channel_open,json=keepChannelOpen" json:"keep_channel_open,omitempty"` + KeepChannelOpen bool `protobuf:"varint,6,opt,name=keep_channel_open,json=keepChannelOpen,proto3" json:"keep_channel_open,omitempty"` // The RPC protocol versions supported by the peer. - PeerRpcVersions *RpcProtocolVersions `protobuf:"bytes,7,opt,name=peer_rpc_versions,json=peerRpcVersions" json:"peer_rpc_versions,omitempty"` + PeerRpcVersions *RpcProtocolVersions `protobuf:"bytes,7,opt,name=peer_rpc_versions,json=peerRpcVersions,proto3" json:"peer_rpc_versions,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HandshakerResult) Reset() { *m = HandshakerResult{} } +func (m *HandshakerResult) String() string { return proto.CompactTextString(m) } +func (*HandshakerResult) ProtoMessage() {} +func (*HandshakerResult) Descriptor() ([]byte, []int) { + return fileDescriptor_handshaker_b28e45bdd1661054, []int{7} +} +func (m *HandshakerResult) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_HandshakerResult.Unmarshal(m, b) +} +func (m *HandshakerResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_HandshakerResult.Marshal(b, m, deterministic) +} +func (dst *HandshakerResult) XXX_Merge(src proto.Message) { + xxx_messageInfo_HandshakerResult.Merge(dst, src) +} +func (m *HandshakerResult) XXX_Size() int { + return xxx_messageInfo_HandshakerResult.Size(m) +} +func (m *HandshakerResult) XXX_DiscardUnknown() { + xxx_messageInfo_HandshakerResult.DiscardUnknown(m) } -func (m *HandshakerResult) Reset() { *m = HandshakerResult{} } -func (m *HandshakerResult) String() string { return proto.CompactTextString(m) } -func (*HandshakerResult) ProtoMessage() {} -func (*HandshakerResult) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{7} } +var xxx_messageInfo_HandshakerResult proto.InternalMessageInfo func (m *HandshakerResult) GetApplicationProtocol() string { if m != nil { @@ -661,15 +847,37 @@ func (m *HandshakerResult) GetPeerRpcVersions() *RpcProtocolVersions { type HandshakerStatus struct { // The status code. This could be the gRPC status code. - Code uint32 `protobuf:"varint,1,opt,name=code" json:"code,omitempty"` + Code uint32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"` // The status details. - Details string `protobuf:"bytes,2,opt,name=details" json:"details,omitempty"` + Details string `protobuf:"bytes,2,opt,name=details,proto3" json:"details,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *HandshakerStatus) Reset() { *m = HandshakerStatus{} } -func (m *HandshakerStatus) String() string { return proto.CompactTextString(m) } -func (*HandshakerStatus) ProtoMessage() {} -func (*HandshakerStatus) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{8} } +func (m *HandshakerStatus) Reset() { *m = HandshakerStatus{} } +func (m *HandshakerStatus) String() string { return proto.CompactTextString(m) } +func (*HandshakerStatus) ProtoMessage() {} +func (*HandshakerStatus) Descriptor() ([]byte, []int) { + return fileDescriptor_handshaker_b28e45bdd1661054, []int{8} +} +func (m *HandshakerStatus) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_HandshakerStatus.Unmarshal(m, b) +} +func (m *HandshakerStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_HandshakerStatus.Marshal(b, m, deterministic) +} +func (dst *HandshakerStatus) XXX_Merge(src proto.Message) { + xxx_messageInfo_HandshakerStatus.Merge(dst, src) +} +func (m *HandshakerStatus) XXX_Size() int { + return xxx_messageInfo_HandshakerStatus.Size(m) +} +func (m *HandshakerStatus) XXX_DiscardUnknown() { + xxx_messageInfo_HandshakerStatus.DiscardUnknown(m) +} + +var xxx_messageInfo_HandshakerStatus proto.InternalMessageInfo func (m *HandshakerStatus) GetCode() uint32 { if m != nil { @@ -695,18 +903,40 @@ type HandshakerResp struct { // Number of bytes in the in_bytes consumed by the handshaker. It is possible // that part of in_bytes in HandshakerReq was unrelated to the handshake // process. - BytesConsumed uint32 `protobuf:"varint,2,opt,name=bytes_consumed,json=bytesConsumed" json:"bytes_consumed,omitempty"` + BytesConsumed uint32 `protobuf:"varint,2,opt,name=bytes_consumed,json=bytesConsumed,proto3" json:"bytes_consumed,omitempty"` // This is set iff the handshake was successful. out_frames may still be set // to frames that needs to be forwarded to the peer. - Result *HandshakerResult `protobuf:"bytes,3,opt,name=result" json:"result,omitempty"` + Result *HandshakerResult `protobuf:"bytes,3,opt,name=result,proto3" json:"result,omitempty"` // Status of the handshaker. - Status *HandshakerStatus `protobuf:"bytes,4,opt,name=status" json:"status,omitempty"` + Status *HandshakerStatus `protobuf:"bytes,4,opt,name=status,proto3" json:"status,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *HandshakerResp) Reset() { *m = HandshakerResp{} } -func (m *HandshakerResp) String() string { return proto.CompactTextString(m) } -func (*HandshakerResp) ProtoMessage() {} -func (*HandshakerResp) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{9} } +func (m *HandshakerResp) Reset() { *m = HandshakerResp{} } +func (m *HandshakerResp) String() string { return proto.CompactTextString(m) } +func (*HandshakerResp) ProtoMessage() {} +func (*HandshakerResp) Descriptor() ([]byte, []int) { + return fileDescriptor_handshaker_b28e45bdd1661054, []int{9} +} +func (m *HandshakerResp) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_HandshakerResp.Unmarshal(m, b) +} +func (m *HandshakerResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_HandshakerResp.Marshal(b, m, deterministic) +} +func (dst *HandshakerResp) XXX_Merge(src proto.Message) { + xxx_messageInfo_HandshakerResp.Merge(dst, src) +} +func (m *HandshakerResp) XXX_Size() int { + return xxx_messageInfo_HandshakerResp.Size(m) +} +func (m *HandshakerResp) XXX_DiscardUnknown() { + xxx_messageInfo_HandshakerResp.DiscardUnknown(m) +} + +var xxx_messageInfo_HandshakerResp proto.InternalMessageInfo func (m *HandshakerResp) GetOutFrames() []byte { if m != nil { @@ -742,6 +972,7 @@ func init() { proto.RegisterType((*StartClientHandshakeReq)(nil), "grpc.gcp.StartClientHandshakeReq") proto.RegisterType((*ServerHandshakeParameters)(nil), "grpc.gcp.ServerHandshakeParameters") proto.RegisterType((*StartServerHandshakeReq)(nil), "grpc.gcp.StartServerHandshakeReq") + proto.RegisterMapType((map[int32]*ServerHandshakeParameters)(nil), "grpc.gcp.StartServerHandshakeReq.HandshakeParametersEntry") proto.RegisterType((*NextHandshakeMessageReq)(nil), "grpc.gcp.NextHandshakeMessageReq") proto.RegisterType((*HandshakerReq)(nil), "grpc.gcp.HandshakerReq") proto.RegisterType((*HandshakerResult)(nil), "grpc.gcp.HandshakerResult") @@ -759,8 +990,9 @@ var _ grpc.ClientConn // is compatible with the grpc package it is being compiled against. const _ = grpc.SupportPackageIsVersion4 -// Client API for HandshakerService service - +// HandshakerServiceClient is the client API for HandshakerService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type HandshakerServiceClient interface { // Handshaker service accepts a stream of handshaker request, returning a // stream of handshaker response. Client is expected to send exactly one @@ -780,7 +1012,7 @@ func NewHandshakerServiceClient(cc *grpc.ClientConn) HandshakerServiceClient { } func (c *handshakerServiceClient) DoHandshake(ctx context.Context, opts ...grpc.CallOption) (HandshakerService_DoHandshakeClient, error) { - stream, err := grpc.NewClientStream(ctx, &_HandshakerService_serviceDesc.Streams[0], c.cc, "/grpc.gcp.HandshakerService/DoHandshake", opts...) + stream, err := c.cc.NewStream(ctx, &_HandshakerService_serviceDesc.Streams[0], "/grpc.gcp.HandshakerService/DoHandshake", opts...) if err != nil { return nil, err } @@ -810,8 +1042,7 @@ func (x *handshakerServiceDoHandshakeClient) Recv() (*HandshakerResp, error) { return m, nil } -// Server API for HandshakerService service - +// HandshakerServiceServer is the server API for HandshakerService service. type HandshakerServiceServer interface { // Handshaker service accepts a stream of handshaker request, returning a // stream of handshaker response. Client is expected to send exactly one @@ -864,79 +1095,84 @@ var _HandshakerService_serviceDesc = grpc.ServiceDesc{ ClientStreams: true, }, }, - Metadata: "handshaker.proto", -} - -func init() { proto.RegisterFile("handshaker.proto", fileDescriptor1) } - -var fileDescriptor1 = []byte{ - // 1073 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0xdd, 0x6e, 0x1a, 0x47, - 0x14, 0xf6, 0x02, 0xb6, 0xe1, 0x60, 0x60, 0x3d, 0x49, 0x64, 0xec, 0x24, 0x0d, 0xa5, 0xaa, 0x4a, - 0x72, 0x81, 0x5a, 0xd2, 0x2a, 0x4d, 0xaa, 0xaa, 0xb1, 0x31, 0x16, 0x6e, 0x5c, 0x6c, 0x0d, 0x4e, - 0x7b, 0x91, 0x8b, 0xd5, 0x64, 0x39, 0xb1, 0x57, 0xc0, 0xcc, 0x7a, 0x66, 0x70, 0xc3, 0x03, 0xf4, - 0x71, 0xfa, 0x0a, 0x7d, 0x9b, 0xbe, 0x41, 0xef, 0x5b, 0xed, 0xec, 0x1f, 0xc6, 0x4b, 0x94, 0xa8, - 0x77, 0xbb, 0x67, 0xbf, 0xef, 0xec, 0x9c, 0xef, 0x7c, 0x73, 0x66, 0xc0, 0xbe, 0x64, 0x7c, 0xa4, - 0x2e, 0xd9, 0x18, 0x65, 0xdb, 0x97, 0x42, 0x0b, 0x52, 0xbc, 0x90, 0xbe, 0xdb, 0xbe, 0x70, 0xfd, - 0xbd, 0x47, 0x5a, 0x32, 0xae, 0x7c, 0x21, 0xb5, 0xa3, 0xd0, 0x9d, 0x49, 0x4f, 0xcf, 0x1d, 0x57, - 0x4c, 0xa7, 0x82, 0x87, 0xd0, 0xa6, 0x86, 0x62, 0x8f, 0x8f, 0x7c, 0xe1, 0x71, 0x4d, 0x1e, 0x02, - 0x78, 0xbe, 0xc3, 0x46, 0x23, 0x89, 0x4a, 0xd5, 0xad, 0x86, 0xd5, 0x2a, 0xd1, 0x92, 0xe7, 0xef, - 0x87, 0x01, 0x42, 0xa0, 0x10, 0x24, 0xaa, 0xe7, 0x1a, 0x56, 0x6b, 0x9d, 0x9a, 0x67, 0xf2, 0x1d, - 0x14, 0x4d, 0x1e, 0x57, 0x4c, 0xea, 0xf9, 0x86, 0xd5, 0xaa, 0x76, 0x76, 0xdb, 0xf1, 0xcf, 0xdb, - 0x03, 0xd4, 0xbf, 0x0b, 0x39, 0x3e, 0x8b, 0x00, 0x34, 0x81, 0x36, 0x11, 0x8a, 0xc7, 0x23, 0xe4, - 0xda, 0xd3, 0x73, 0xf2, 0x18, 0x6a, 0x0a, 0xe5, 0xb5, 0xe7, 0xa2, 0xc3, 0x5c, 0x57, 0xcc, 0xb8, - 0x0e, 0x7f, 0xdd, 0x5f, 0xa3, 0xd5, 0xe8, 0xc3, 0x7e, 0x18, 0x27, 0x0f, 0xa0, 0x78, 0x29, 0x94, - 0xe6, 0x6c, 0x8a, 0x66, 0x15, 0x01, 0x26, 0x89, 0x1c, 0xd8, 0x50, 0xf5, 0xa2, 0xa4, 0x8e, 0xe0, - 0x28, 0xde, 0x35, 0xff, 0x2c, 0xc0, 0xce, 0x50, 0x33, 0xa9, 0xbb, 0x13, 0x0f, 0xb9, 0xee, 0xc7, - 0x3a, 0x51, 0xbc, 0x22, 0x6f, 0xe0, 0x7e, 0xa2, 0x5b, 0xaa, 0x4d, 0x52, 0x8c, 0x65, 0x8a, 0xb9, - 0x9f, 0x16, 0x93, 0x90, 0x93, 0x72, 0x76, 0x13, 0xfe, 0x30, 0xa2, 0xc7, 0x9f, 0xc8, 0x53, 0xb8, - 0xc7, 0x7c, 0x7f, 0xe2, 0xb9, 0x4c, 0x7b, 0x82, 0x27, 0x59, 0x55, 0x3d, 0xd7, 0xc8, 0xb7, 0x4a, - 0xf4, 0xee, 0xc2, 0xc7, 0x98, 0xa3, 0xc8, 0x63, 0xb0, 0x25, 0xba, 0x42, 0x8e, 0x16, 0xf0, 0x79, - 0x83, 0xaf, 0x85, 0xf1, 0x14, 0xfa, 0x13, 0x6c, 0x6b, 0x26, 0x2f, 0x50, 0x3b, 0x51, 0xc5, 0x1e, - 0xaa, 0x7a, 0xa1, 0x91, 0x6f, 0x95, 0x3b, 0x24, 0x5d, 0x72, 0x2c, 0x31, 0xb5, 0x43, 0xf0, 0x71, - 0x82, 0x25, 0xcf, 0xa1, 0x3a, 0x11, 0x2e, 0x9b, 0xc4, 0xfc, 0x79, 0x7d, 0xbd, 0x61, 0xad, 0x60, - 0x57, 0x0c, 0x32, 0xe9, 0x57, 0x42, 0xc5, 0xc8, 0x37, 0xf5, 0x8d, 0x65, 0x6a, 0xec, 0xa8, 0x88, - 0x9a, 0x18, 0xec, 0x07, 0xa8, 0x49, 0x9c, 0x0a, 0x8d, 0x29, 0x77, 0x73, 0x25, 0xb7, 0x1a, 0x42, - 0x13, 0xf2, 0x23, 0x28, 0x47, 0x35, 0x9b, 0xfe, 0x17, 0x8d, 0x3d, 0x21, 0x0c, 0x0d, 0xd8, 0x14, - 0xc9, 0x4b, 0xd8, 0x92, 0xbe, 0xeb, 0x5c, 0xa3, 0x54, 0x9e, 0xe0, 0xaa, 0x5e, 0x32, 0xa9, 0x1f, - 0xa6, 0xa9, 0xa9, 0xef, 0xc6, 0x12, 0xfe, 0x1a, 0x81, 0x68, 0x59, 0xfa, 0x6e, 0xfc, 0xd2, 0xfc, - 0xc3, 0x82, 0xdd, 0x21, 0xca, 0x6b, 0x94, 0x69, 0xb7, 0x99, 0x64, 0x53, 0xd4, 0x28, 0xb3, 0xfb, - 0x63, 0x65, 0xf7, 0xe7, 0x47, 0xb0, 0x6f, 0xc8, 0x1b, 0xb4, 0x27, 0xb7, 0xb2, 0x3d, 0xb5, 0x45, - 0x81, 0x3d, 0x54, 0xcd, 0x7f, 0xf3, 0x91, 0x6f, 0x97, 0x16, 0x13, 0xf8, 0x76, 0xa5, 0xb5, 0xac, - 0x0f, 0x58, 0x6b, 0x0a, 0x77, 0x53, 0xb3, 0xfb, 0x49, 0x49, 0xd1, 0x9a, 0x5e, 0xa4, 0x6b, 0x5a, - 0xf1, 0xd7, 0x76, 0x86, 0x1e, 0x3d, 0xae, 0xe5, 0x9c, 0xde, 0xb9, 0xcc, 0x50, 0x6a, 0x17, 0x8a, - 0x1e, 0x77, 0xde, 0xce, 0x35, 0x2a, 0x33, 0x15, 0xb6, 0xe8, 0xa6, 0xc7, 0x0f, 0x82, 0xd7, 0x0c, - 0xf7, 0x14, 0xfe, 0x87, 0x7b, 0xd6, 0x3f, 0xda, 0x3d, 0xcb, 0xe6, 0xd8, 0xf8, 0x54, 0x73, 0xec, - 0x8d, 0xa1, 0xbe, 0x4a, 0x05, 0x62, 0x43, 0x7e, 0x8c, 0x73, 0x33, 0x34, 0xd6, 0x69, 0xf0, 0x48, - 0x9e, 0xc3, 0xfa, 0x35, 0x9b, 0xcc, 0xc2, 0x39, 0x55, 0xee, 0x7c, 0xb1, 0x20, 0xf1, 0x2a, 0x83, - 0xd1, 0x90, 0xf1, 0x22, 0xf7, 0xbd, 0xd5, 0xfc, 0x16, 0x76, 0x06, 0xf8, 0x3e, 0x9d, 0x58, 0xbf, - 0xa0, 0x52, 0xec, 0xc2, 0x18, 0x60, 0x51, 0x5c, 0xeb, 0x86, 0xb8, 0xcd, 0xbf, 0x2d, 0xa8, 0x24, - 0x14, 0x19, 0x80, 0x8f, 0x60, 0xcb, 0x35, 0xb3, 0xcf, 0x51, 0x41, 0x67, 0x0d, 0xa1, 0xdc, 0xf9, - 0x7c, 0xa9, 0xe1, 0xb7, 0xc7, 0x63, 0x7f, 0x8d, 0x96, 0x43, 0xa2, 0x01, 0x04, 0x79, 0x94, 0x59, - 0x77, 0x94, 0x27, 0x97, 0x99, 0xe7, 0xb6, 0x71, 0x82, 0x3c, 0x21, 0x31, 0xcc, 0xf3, 0x0c, 0x0a, - 0x1c, 0xdf, 0x6b, 0xe3, 0x8a, 0x1b, 0xfc, 0x15, 0xd5, 0xf6, 0xd7, 0xa8, 0x21, 0x1c, 0x94, 0xa1, - 0x24, 0xf1, 0x2a, 0x9a, 0xeb, 0xff, 0xe4, 0xc0, 0x5e, 0xac, 0x53, 0xcd, 0x26, 0x9a, 0x7c, 0x03, - 0x77, 0xb3, 0x36, 0x46, 0x74, 0x8e, 0xdd, 0xc9, 0xd8, 0x17, 0xe4, 0x2b, 0xa8, 0x2d, 0xed, 0xe8, - 0xf0, 0x58, 0x09, 0xdc, 0xb3, 0xb8, 0xa1, 0x03, 0xcd, 0xc7, 0x38, 0x77, 0x46, 0x4c, 0xb3, 0xd8, - 0xd0, 0x63, 0x9c, 0x1f, 0x32, 0xcd, 0xc8, 0x33, 0xa8, 0xf8, 0x88, 0x32, 0x1d, 0xa4, 0x85, 0x95, - 0x83, 0x74, 0x2b, 0x00, 0xde, 0x9e, 0xa3, 0x9f, 0x3e, 0x82, 0x9f, 0xc0, 0xf6, 0x18, 0xd1, 0x77, - 0xdc, 0x4b, 0xc6, 0x39, 0x4e, 0x1c, 0xe1, 0x23, 0x37, 0x8e, 0x2e, 0xd2, 0x5a, 0xf0, 0xa1, 0x1b, - 0xc6, 0x4f, 0x7d, 0xe4, 0xe4, 0x18, 0xb6, 0xcd, 0xfa, 0x6e, 0xb8, 0x7f, 0xf3, 0x63, 0xdc, 0x5f, - 0x0b, 0x78, 0x74, 0x61, 0x3c, 0xbe, 0x5c, 0x54, 0x7d, 0xa8, 0x99, 0x9e, 0x99, 0x4b, 0x81, 0x2b, - 0x46, 0x68, 0x54, 0xae, 0x50, 0xf3, 0x4c, 0xea, 0xb0, 0x39, 0x42, 0xcd, 0x3c, 0x73, 0xde, 0x05, - 0x72, 0xc6, 0xaf, 0xcd, 0xbf, 0x2c, 0xa8, 0xde, 0x68, 0x9c, 0x1f, 0x5c, 0x3a, 0xc4, 0x4c, 0x3b, - 0xef, 0x82, 0x5d, 0x10, 0x1b, 0xba, 0x24, 0x66, 0xfa, 0xc8, 0x04, 0xc8, 0x97, 0x50, 0x35, 0x56, - 0x77, 0x5c, 0xc1, 0xd5, 0x6c, 0x8a, 0x23, 0x93, 0xb2, 0x42, 0x2b, 0x26, 0xda, 0x8d, 0x82, 0xa4, - 0x03, 0x1b, 0xd2, 0xd8, 0x20, 0x72, 0xd6, 0x5e, 0xc6, 0xc1, 0x1d, 0x19, 0x85, 0x46, 0xc8, 0x80, - 0xa3, 0x4c, 0x11, 0x51, 0xcb, 0x32, 0x39, 0x61, 0x99, 0x34, 0x42, 0x3e, 0xf9, 0x19, 0xb6, 0x6f, - 0x5d, 0x04, 0x48, 0x13, 0x3e, 0xeb, 0xef, 0x0f, 0x0e, 0x87, 0xfd, 0xfd, 0x57, 0x3d, 0xe7, 0x8c, - 0x9e, 0x9e, 0x9f, 0x76, 0x4f, 0x4f, 0x9c, 0xd7, 0x83, 0xe1, 0x59, 0xaf, 0x7b, 0x7c, 0x74, 0xdc, - 0x3b, 0xb4, 0xd7, 0xc8, 0x26, 0xe4, 0xcf, 0x4f, 0x86, 0xb6, 0x45, 0x8a, 0x50, 0xd8, 0x3f, 0x39, - 0x1f, 0xda, 0xb9, 0x27, 0x3d, 0xa8, 0x2d, 0xdd, 0x90, 0x48, 0x03, 0x1e, 0x0c, 0x7a, 0xe7, 0xbf, - 0x9d, 0xd2, 0x57, 0x1f, 0xca, 0xd3, 0x3d, 0xb3, 0xad, 0xe0, 0xe1, 0xf5, 0xe1, 0x99, 0x9d, 0xeb, - 0xbc, 0x59, 0x58, 0x92, 0x1c, 0x86, 0x17, 0x26, 0x72, 0x04, 0xe5, 0x43, 0x91, 0x84, 0xc9, 0x4e, - 0xb6, 0x1c, 0x57, 0x7b, 0xf5, 0x15, 0x3a, 0xf9, 0xcd, 0xb5, 0x96, 0xf5, 0xb5, 0x75, 0xb0, 0x03, - 0xf7, 0x3c, 0x11, 0x62, 0xd8, 0x44, 0xab, 0xb6, 0xc7, 0x35, 0x4a, 0xce, 0x26, 0x6f, 0x37, 0xcc, - 0x8e, 0x79, 0xfa, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x76, 0x65, 0x6f, 0x3a, 0x7d, 0x0a, 0x00, - 0x00, + Metadata: "grpc/gcp/handshaker.proto", +} + +func init() { + proto.RegisterFile("grpc/gcp/handshaker.proto", fileDescriptor_handshaker_b28e45bdd1661054) +} + +var fileDescriptor_handshaker_b28e45bdd1661054 = []byte{ + // 1128 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0xdf, 0x6e, 0x1a, 0xc7, + 0x17, 0xf6, 0x02, 0xb6, 0xe1, 0x60, 0xfe, 0x78, 0x92, 0x28, 0xd8, 0x49, 0x7e, 0x3f, 0x4a, 0x55, + 0x95, 0xf8, 0x02, 0x5a, 0xd2, 0x2a, 0x4d, 0xa2, 0xaa, 0xb1, 0x31, 0x16, 0x6e, 0x5c, 0x8c, 0x16, + 0xa7, 0x95, 0x9a, 0x8b, 0xd5, 0x64, 0x39, 0x59, 0xaf, 0x58, 0x66, 0xd6, 0x33, 0x83, 0x1b, 0x1e, + 0xa0, 0x8f, 0xd3, 0x57, 0xe8, 0xdb, 0xf4, 0x0d, 0x7a, 0xdf, 0x6a, 0x67, 0xff, 0x61, 0x0c, 0x51, + 0xa2, 0xde, 0xed, 0xce, 0x7c, 0xdf, 0xd9, 0x73, 0xbe, 0xf3, 0xcd, 0xd9, 0x81, 0x3d, 0x47, 0xf8, + 0x76, 0xdb, 0xb1, 0xfd, 0xf6, 0x25, 0x65, 0x63, 0x79, 0x49, 0x27, 0x28, 0x5a, 0xbe, 0xe0, 0x8a, + 0x93, 0x7c, 0xb0, 0xd5, 0x72, 0x6c, 0x7f, 0xbf, 0x99, 0x80, 0x94, 0xa0, 0x4c, 0xfa, 0x5c, 0x28, + 0x4b, 0xa2, 0x3d, 0x13, 0xae, 0x9a, 0x5b, 0x36, 0x9f, 0x4e, 0x39, 0x0b, 0x39, 0x0d, 0x05, 0xf9, + 0x1e, 0x1b, 0xfb, 0xdc, 0x65, 0x8a, 0x3c, 0x02, 0x70, 0x7d, 0x8b, 0x8e, 0xc7, 0x02, 0xa5, 0xac, + 0x19, 0x75, 0xa3, 0x59, 0x30, 0x0b, 0xae, 0x7f, 0x18, 0x2e, 0x10, 0x02, 0xb9, 0x20, 0x50, 0x2d, + 0x53, 0x37, 0x9a, 0x9b, 0xa6, 0x7e, 0x26, 0xdf, 0x42, 0x5e, 0xc7, 0xb1, 0xb9, 0x57, 0xcb, 0xd6, + 0x8d, 0x66, 0xb9, 0xb3, 0xd7, 0x8a, 0xb3, 0x68, 0x0d, 0x50, 0xfd, 0xc6, 0xc5, 0x64, 0x18, 0x01, + 0xcc, 0x04, 0xda, 0x40, 0xc8, 0x9f, 0x8e, 0x91, 0x29, 0x57, 0xcd, 0xc9, 0x63, 0xa8, 0x48, 0x14, + 0xd7, 0xae, 0x8d, 0x16, 0xb5, 0x6d, 0x3e, 0x63, 0x2a, 0xfc, 0x74, 0x7f, 0xc3, 0x2c, 0x47, 0x1b, + 0x87, 0xe1, 0x3a, 0x79, 0x08, 0xf9, 0x4b, 0x2e, 0x15, 0xa3, 0x53, 0xd4, 0x59, 0x04, 0x98, 0x64, + 0xe5, 0xa8, 0x0a, 0x65, 0x37, 0x0a, 0x6a, 0x71, 0x86, 0xfc, 0x5d, 0xe3, 0x8f, 0x1c, 0xdc, 0x1f, + 0x29, 0x2a, 0x54, 0xd7, 0x73, 0x91, 0xa9, 0x7e, 0x2c, 0x98, 0x89, 0x57, 0xe4, 0x0d, 0x3c, 0x48, + 0x04, 0x4c, 0xb5, 0x49, 0x8a, 0x31, 0x74, 0x31, 0x0f, 0xd2, 0x62, 0x12, 0x72, 0x52, 0xce, 0x5e, + 0xc2, 0x1f, 0x45, 0xf4, 0x78, 0x8b, 0x3c, 0x81, 0x7b, 0xd4, 0xf7, 0x3d, 0xd7, 0xa6, 0xca, 0xe5, + 0x2c, 0x89, 0x2a, 0x6b, 0x99, 0x7a, 0xb6, 0x59, 0x30, 0xef, 0x2e, 0x6c, 0xc6, 0x1c, 0x49, 0x1e, + 0x43, 0x55, 0xa0, 0xcd, 0xc5, 0x78, 0x01, 0x9f, 0xd5, 0xf8, 0x4a, 0xb8, 0x9e, 0x42, 0x7f, 0x80, + 0x5d, 0x45, 0x85, 0x83, 0xca, 0x8a, 0x2a, 0x76, 0x51, 0xd6, 0x72, 0xf5, 0x6c, 0xb3, 0xd8, 0x21, + 0x69, 0xca, 0xb1, 0xc4, 0x66, 0x35, 0x04, 0x9f, 0x26, 0x58, 0xf2, 0x0c, 0xca, 0x1e, 0xb7, 0xa9, + 0x17, 0xf3, 0xe7, 0xb5, 0xcd, 0xba, 0xb1, 0x86, 0x5d, 0xd2, 0xc8, 0xa4, 0x5f, 0x09, 0x15, 0x23, + 0xdf, 0xd4, 0xb6, 0x96, 0xa9, 0xb1, 0xa3, 0x22, 0x6a, 0x62, 0xb0, 0x17, 0x50, 0x11, 0x38, 0xe5, + 0x0a, 0x53, 0xee, 0xf6, 0x5a, 0x6e, 0x39, 0x84, 0x26, 0xe4, 0xff, 0x43, 0x31, 0xaa, 0x59, 0xf7, + 0x3f, 0xaf, 0xed, 0x09, 0xe1, 0xd2, 0x80, 0x4e, 0x91, 0xbc, 0x84, 0x1d, 0xe1, 0xdb, 0xd6, 0x35, + 0x0a, 0xe9, 0x72, 0x26, 0x6b, 0x05, 0x1d, 0xfa, 0x51, 0x1a, 0xda, 0xf4, 0xed, 0x58, 0xc2, 0x9f, + 0x23, 0x90, 0x59, 0x14, 0xbe, 0x1d, 0xbf, 0x34, 0x7e, 0x37, 0x60, 0x6f, 0x84, 0xe2, 0x1a, 0x45, + 0xda, 0x6d, 0x2a, 0xe8, 0x14, 0x15, 0x8a, 0xd5, 0xfd, 0x31, 0x56, 0xf7, 0xe7, 0x7b, 0xa8, 0xde, + 0x90, 0x37, 0x68, 0x4f, 0x66, 0x6d, 0x7b, 0x2a, 0x8b, 0x02, 0xbb, 0x28, 0x1b, 0xff, 0x64, 0x23, + 0xdf, 0x2e, 0x25, 0x13, 0xf8, 0x76, 0xad, 0xb5, 0x8c, 0x0f, 0x58, 0x6b, 0x0a, 0x77, 0x53, 0xb3, + 0xfb, 0x49, 0x49, 0x51, 0x4e, 0xcf, 0xd3, 0x9c, 0xd6, 0x7c, 0xb5, 0xb5, 0x42, 0x8f, 0x1e, 0x53, + 0x62, 0x6e, 0xde, 0xb9, 0x5c, 0xa1, 0xd4, 0x1e, 0xe4, 0x5d, 0x66, 0xbd, 0x9d, 0x2b, 0x94, 0x7a, + 0x2a, 0xec, 0x98, 0xdb, 0x2e, 0x3b, 0x0a, 0x5e, 0x57, 0xb8, 0x27, 0xf7, 0x1f, 0xdc, 0xb3, 0xf9, + 0xd1, 0xee, 0x59, 0x36, 0xc7, 0xd6, 0xa7, 0x9a, 0x63, 0x7f, 0x02, 0xb5, 0x75, 0x2a, 0x90, 0x2a, + 0x64, 0x27, 0x38, 0xd7, 0x43, 0x63, 0xd3, 0x0c, 0x1e, 0xc9, 0x33, 0xd8, 0xbc, 0xa6, 0xde, 0x2c, + 0x9c, 0x53, 0xc5, 0xce, 0xe7, 0x0b, 0x12, 0xaf, 0x33, 0x98, 0x19, 0x32, 0x9e, 0x67, 0xbe, 0x33, + 0x1a, 0xdf, 0xc0, 0xfd, 0x01, 0xbe, 0x4f, 0x27, 0xd6, 0x4f, 0x28, 0x25, 0x75, 0xb4, 0x01, 0x16, + 0xc5, 0x35, 0x6e, 0x88, 0xdb, 0xf8, 0xcb, 0x80, 0x52, 0x42, 0x11, 0x01, 0xf8, 0x04, 0x76, 0x6c, + 0x3d, 0xfb, 0x2c, 0x19, 0x74, 0x56, 0x13, 0x8a, 0x9d, 0xcf, 0x96, 0x1a, 0x7e, 0x7b, 0x3c, 0xf6, + 0x37, 0xcc, 0x62, 0x48, 0xd4, 0x80, 0x20, 0x8e, 0xd4, 0x79, 0x47, 0x71, 0x32, 0x2b, 0xe3, 0xdc, + 0x36, 0x4e, 0x10, 0x27, 0x24, 0x86, 0x71, 0x9e, 0x42, 0x8e, 0xe1, 0x7b, 0xa5, 0x5d, 0x71, 0x83, + 0xbf, 0xa6, 0xda, 0xfe, 0x86, 0xa9, 0x09, 0x47, 0x45, 0x28, 0x08, 0xbc, 0x8a, 0xe6, 0xfa, 0xdf, + 0x19, 0xa8, 0x2e, 0xd6, 0x29, 0x67, 0x9e, 0x22, 0x5f, 0xc3, 0xdd, 0x55, 0x07, 0x23, 0xfa, 0x8f, + 0xdd, 0x59, 0x71, 0x2e, 0xc8, 0x97, 0x50, 0x59, 0x3a, 0xd1, 0xe1, 0x6f, 0x25, 0x70, 0xcf, 0xe2, + 0x81, 0x0e, 0x34, 0x9f, 0xe0, 0xdc, 0x1a, 0x53, 0x45, 0x63, 0x43, 0x4f, 0x70, 0x7e, 0x4c, 0x15, + 0x25, 0x4f, 0xa1, 0xe4, 0x23, 0x8a, 0x74, 0x90, 0xe6, 0xd6, 0x0e, 0xd2, 0x9d, 0x00, 0x78, 0x7b, + 0x8e, 0x7e, 0xfa, 0x08, 0x3e, 0x80, 0xdd, 0x09, 0xa2, 0x6f, 0xd9, 0x97, 0x94, 0x31, 0xf4, 0x2c, + 0xee, 0x23, 0xd3, 0x8e, 0xce, 0x9b, 0x95, 0x60, 0xa3, 0x1b, 0xae, 0x9f, 0xfb, 0xc8, 0xc8, 0x29, + 0xec, 0xea, 0xfc, 0x6e, 0xb8, 0x7f, 0xfb, 0x63, 0xdc, 0x5f, 0x09, 0x78, 0xe6, 0xc2, 0x78, 0x7c, + 0xb9, 0xa8, 0xfa, 0x48, 0x51, 0x35, 0xd3, 0x97, 0x02, 0x9b, 0x8f, 0x51, 0xab, 0x5c, 0x32, 0xf5, + 0x33, 0xa9, 0xc1, 0xf6, 0x18, 0x15, 0x75, 0xf5, 0xff, 0x2e, 0x90, 0x33, 0x7e, 0x6d, 0xfc, 0x69, + 0x40, 0xf9, 0x46, 0xe3, 0xfc, 0xe0, 0xd2, 0xc1, 0x67, 0xca, 0x7a, 0x17, 0x9c, 0x82, 0xd8, 0xd0, + 0x05, 0x3e, 0x53, 0x27, 0x7a, 0x81, 0x7c, 0x01, 0x65, 0x6d, 0x75, 0xcb, 0xe6, 0x4c, 0xce, 0xa6, + 0x38, 0xd6, 0x21, 0x4b, 0x66, 0x49, 0xaf, 0x76, 0xa3, 0x45, 0xd2, 0x81, 0x2d, 0xa1, 0x6d, 0x10, + 0x39, 0x6b, 0x7f, 0xc5, 0x8f, 0x3b, 0x32, 0x8a, 0x19, 0x21, 0x03, 0x8e, 0xd4, 0x45, 0x44, 0x2d, + 0x5b, 0xc9, 0x09, 0xcb, 0x34, 0x23, 0xe4, 0xc1, 0x8f, 0xb0, 0x7b, 0xeb, 0x22, 0x40, 0x1a, 0xf0, + 0xbf, 0xfe, 0xe1, 0xe0, 0x78, 0xd4, 0x3f, 0x7c, 0xd5, 0xb3, 0x86, 0xe6, 0xf9, 0xc5, 0x79, 0xf7, + 0xfc, 0xcc, 0x7a, 0x3d, 0x18, 0x0d, 0x7b, 0xdd, 0xd3, 0x93, 0xd3, 0xde, 0x71, 0x75, 0x83, 0x6c, + 0x43, 0xf6, 0xe2, 0x6c, 0x54, 0x35, 0x48, 0x1e, 0x72, 0x87, 0x67, 0x17, 0xa3, 0x6a, 0xe6, 0xa0, + 0x07, 0x95, 0xa5, 0x1b, 0x12, 0xa9, 0xc3, 0xc3, 0x41, 0xef, 0xe2, 0x97, 0x73, 0xf3, 0xd5, 0x87, + 0xe2, 0x74, 0x87, 0x55, 0x23, 0x78, 0x78, 0x7d, 0x3c, 0xac, 0x66, 0x3a, 0x6f, 0x16, 0x52, 0x12, + 0xa3, 0xf0, 0xc2, 0x44, 0x4e, 0xa0, 0x78, 0xcc, 0x93, 0x65, 0x72, 0x7f, 0xb5, 0x1c, 0x57, 0xfb, + 0xb5, 0x35, 0x3a, 0xf9, 0x8d, 0x8d, 0xa6, 0xf1, 0x95, 0x71, 0xe4, 0xc0, 0x3d, 0x97, 0x87, 0x18, + 0xea, 0x29, 0xd9, 0x72, 0x99, 0x42, 0xc1, 0xa8, 0x77, 0x54, 0x49, 0xe1, 0x3a, 0xfb, 0xa1, 0xf1, + 0xeb, 0x0b, 0x87, 0x73, 0xc7, 0xc3, 0x96, 0xc3, 0x3d, 0xca, 0x9c, 0x16, 0x17, 0x4e, 0x5b, 0x5f, + 0x43, 0x6d, 0x81, 0xda, 0xb8, 0xd4, 0x93, 0xed, 0x20, 0x48, 0xdb, 0xe6, 0x02, 0xdb, 0xfa, 0xc4, + 0x69, 0x80, 0xe5, 0xd8, 0xfe, 0xdb, 0x2d, 0xfd, 0xfe, 0xe4, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, + 0xfa, 0xd2, 0x42, 0x7f, 0xdf, 0x0a, 0x00, 0x00, } diff --git a/vendor/google.golang.org/grpc/credentials/alts/core/proto/grpc_gcp/handshaker.proto b/vendor/google.golang.org/grpc/credentials/alts/core/proto/grpc_gcp/handshaker.proto deleted file mode 100644 index 84a4153b7..000000000 --- a/vendor/google.golang.org/grpc/credentials/alts/core/proto/grpc_gcp/handshaker.proto +++ /dev/null @@ -1,224 +0,0 @@ -// Copyright 2018 gRPC authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -import "transport_security_common.proto"; - -package grpc.gcp; - -option java_package = "io.grpc.alts.internal"; - -enum HandshakeProtocol { - // Default value. - HANDSHAKE_PROTOCOL_UNSPECIFIED = 0; - - // TLS handshake protocol. - TLS = 1; - - // Application Layer Transport Security handshake protocol. - ALTS = 2; -} - -enum NetworkProtocol { - NETWORK_PROTOCOL_UNSPECIFIED = 0; - TCP = 1; - UDP = 2; -} - -message Endpoint { - // IP address. It should contain an IPv4 or IPv6 string literal, e.g. - // "192.168.0.1" or "2001:db8::1". - string ip_address = 1; - - // Port number. - int32 port = 2; - - // Network protocol (e.g., TCP, UDP) associated with this endpoint. - NetworkProtocol protocol = 3; -} - -message Identity { - oneof identity_oneof { - // Service account of a connection endpoint. - string service_account = 1; - - // Hostname of a connection endpoint. - string hostname = 2; - } -} - -message StartClientHandshakeReq { - // Handshake security protocol requested by the client. - HandshakeProtocol handshake_security_protocol = 1; - - // The application protocols supported by the client, e.g., "h2" (for http2), - // "grpc". - repeated string application_protocols = 2; - - // The record protocols supported by the client, e.g., - // "ALTSRP_GCM_AES128". - repeated string record_protocols = 3; - - // (Optional) Describes which server identities are acceptable by the client. - // If target identities are provided and none of them matches the peer - // identity of the server, handshake will fail. - repeated Identity target_identities = 4; - - // (Optional) Application may specify a local identity. Otherwise, the - // handshaker chooses a default local identity. - Identity local_identity = 5; - - // (Optional) Local endpoint information of the connection to the server, - // such as local IP address, port number, and network protocol. - Endpoint local_endpoint = 6; - - // (Optional) Endpoint information of the remote server, such as IP address, - // port number, and network protocol. - Endpoint remote_endpoint = 7; - - // (Optional) If target name is provided, a secure naming check is performed - // to verify that the peer authenticated identity is indeed authorized to run - // the target name. - string target_name = 8; - - // (Optional) RPC protocol versions supported by the client. - RpcProtocolVersions rpc_versions = 9; -} - -message ServerHandshakeParameters { - // The record protocols supported by the server, e.g., - // "ALTSRP_GCM_AES128". - repeated string record_protocols = 1; - - // (Optional) A list of local identities supported by the server, if - // specified. Otherwise, the handshaker chooses a default local identity. - repeated Identity local_identities = 2; -} - -message StartServerHandshakeReq { - // The application protocols supported by the server, e.g., "h2" (for http2), - // "grpc". - repeated string application_protocols = 1; - - // Handshake parameters (record protocols and local identities supported by - // the server) mapped by the handshake protocol. Each handshake security - // protocol (e.g., TLS or ALTS) has its own set of record protocols and local - // identities. Since protobuf does not support enum as key to the map, the key - // to handshake_parameters is the integer value of HandshakeProtocol enum. - map handshake_parameters = 2; - - // Bytes in out_frames returned from the peer's HandshakerResp. It is possible - // that the peer's out_frames are split into multiple HandshakReq messages. - bytes in_bytes = 3; - - // (Optional) Local endpoint information of the connection to the client, - // such as local IP address, port number, and network protocol. - Endpoint local_endpoint = 4; - - // (Optional) Endpoint information of the remote client, such as IP address, - // port number, and network protocol. - Endpoint remote_endpoint = 5; - - // (Optional) RPC protocol versions supported by the server. - RpcProtocolVersions rpc_versions = 6; -} - -message NextHandshakeMessageReq { - // Bytes in out_frames returned from the peer's HandshakerResp. It is possible - // that the peer's out_frames are split into multiple NextHandshakerMessageReq - // messages. - bytes in_bytes = 1; -} - -message HandshakerReq { - oneof req_oneof { - // The start client handshake request message. - StartClientHandshakeReq client_start = 1; - - // The start server handshake request message. - StartServerHandshakeReq server_start = 2; - - // The next handshake request message. - NextHandshakeMessageReq next = 3; - } -} - -message HandshakerResult { - // The application protocol negotiated for this connection. - string application_protocol = 1; - - // The record protocol negotiated for this connection. - string record_protocol = 2; - - // Cryptographic key data. The key data may be more than the key length - // required for the record protocol, thus the client of the handshaker - // service needs to truncate the key data into the right key length. - bytes key_data = 3; - - // The authenticated identity of the peer. - Identity peer_identity = 4; - - // The local identity used in the handshake. - Identity local_identity = 5; - - // Indicate whether the handshaker service client should keep the channel - // between the handshaker service open, e.g., in order to handle - // post-handshake messages in the future. - bool keep_channel_open = 6; - - // The RPC protocol versions supported by the peer. - RpcProtocolVersions peer_rpc_versions = 7; -} - -message HandshakerStatus { - // The status code. This could be the gRPC status code. - uint32 code = 1; - - // The status details. - string details = 2; -} - -message HandshakerResp { - // Frames to be given to the peer for the NextHandshakeMessageReq. May be - // empty if no out_frames have to be sent to the peer or if in_bytes in the - // HandshakerReq are incomplete. All the non-empty out frames must be sent to - // the peer even if the handshaker status is not OK as these frames may - // contain the alert frames. - bytes out_frames = 1; - - // Number of bytes in the in_bytes consumed by the handshaker. It is possible - // that part of in_bytes in HandshakerReq was unrelated to the handshake - // process. - uint32 bytes_consumed = 2; - - // This is set iff the handshake was successful. out_frames may still be set - // to frames that needs to be forwarded to the peer. - HandshakerResult result = 3; - - // Status of the handshaker. - HandshakerStatus status = 4; -} - -service HandshakerService { - // Handshaker service accepts a stream of handshaker request, returning a - // stream of handshaker response. Client is expected to send exactly one - // message with either client_start or server_start followed by one or more - // messages with next. Each time client sends a request, the handshaker - // service expects to respond. Client does not have to wait for service's - // response before sending next request. - rpc DoHandshake(stream HandshakerReq) - returns (stream HandshakerResp) { - } -} diff --git a/vendor/google.golang.org/grpc/credentials/alts/core/proto/grpc_gcp/transport_security_common.pb.go b/vendor/google.golang.org/grpc/credentials/alts/core/proto/grpc_gcp/transport_security_common.pb.go index 4e5f2e1b9..120700eaa 100644 --- a/vendor/google.golang.org/grpc/credentials/alts/core/proto/grpc_gcp/transport_security_common.pb.go +++ b/vendor/google.golang.org/grpc/credentials/alts/core/proto/grpc_gcp/transport_security_common.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. -// source: transport_security_common.proto +// source: grpc/gcp/transport_security_common.proto -package grpc_gcp +package grpc_gcp // import "google.golang.org/grpc/credentials/alts/core/proto/grpc_gcp" import proto "github.com/golang/protobuf/proto" import fmt "fmt" @@ -12,6 +12,12 @@ var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + // The security level of the created channel. The list is sorted in increasing // level of security. This order must always be maintained. type SecurityLevel int32 @@ -36,20 +42,44 @@ var SecurityLevel_value = map[string]int32{ func (x SecurityLevel) String() string { return proto.EnumName(SecurityLevel_name, int32(x)) } -func (SecurityLevel) EnumDescriptor() ([]byte, []int) { return fileDescriptor2, []int{0} } +func (SecurityLevel) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_transport_security_common_6489ab913bf26255, []int{0} +} // Max and min supported RPC protocol versions. type RpcProtocolVersions struct { // Maximum supported RPC version. - MaxRpcVersion *RpcProtocolVersions_Version `protobuf:"bytes,1,opt,name=max_rpc_version,json=maxRpcVersion" json:"max_rpc_version,omitempty"` + MaxRpcVersion *RpcProtocolVersions_Version `protobuf:"bytes,1,opt,name=max_rpc_version,json=maxRpcVersion,proto3" json:"max_rpc_version,omitempty"` // Minimum supported RPC version. - MinRpcVersion *RpcProtocolVersions_Version `protobuf:"bytes,2,opt,name=min_rpc_version,json=minRpcVersion" json:"min_rpc_version,omitempty"` + MinRpcVersion *RpcProtocolVersions_Version `protobuf:"bytes,2,opt,name=min_rpc_version,json=minRpcVersion,proto3" json:"min_rpc_version,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RpcProtocolVersions) Reset() { *m = RpcProtocolVersions{} } +func (m *RpcProtocolVersions) String() string { return proto.CompactTextString(m) } +func (*RpcProtocolVersions) ProtoMessage() {} +func (*RpcProtocolVersions) Descriptor() ([]byte, []int) { + return fileDescriptor_transport_security_common_6489ab913bf26255, []int{0} +} +func (m *RpcProtocolVersions) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_RpcProtocolVersions.Unmarshal(m, b) +} +func (m *RpcProtocolVersions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_RpcProtocolVersions.Marshal(b, m, deterministic) +} +func (dst *RpcProtocolVersions) XXX_Merge(src proto.Message) { + xxx_messageInfo_RpcProtocolVersions.Merge(dst, src) +} +func (m *RpcProtocolVersions) XXX_Size() int { + return xxx_messageInfo_RpcProtocolVersions.Size(m) +} +func (m *RpcProtocolVersions) XXX_DiscardUnknown() { + xxx_messageInfo_RpcProtocolVersions.DiscardUnknown(m) } -func (m *RpcProtocolVersions) Reset() { *m = RpcProtocolVersions{} } -func (m *RpcProtocolVersions) String() string { return proto.CompactTextString(m) } -func (*RpcProtocolVersions) ProtoMessage() {} -func (*RpcProtocolVersions) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{0} } +var xxx_messageInfo_RpcProtocolVersions proto.InternalMessageInfo func (m *RpcProtocolVersions) GetMaxRpcVersion() *RpcProtocolVersions_Version { if m != nil { @@ -67,14 +97,36 @@ func (m *RpcProtocolVersions) GetMinRpcVersion() *RpcProtocolVersions_Version { // RPC version contains a major version and a minor version. type RpcProtocolVersions_Version struct { - Major uint32 `protobuf:"varint,1,opt,name=major" json:"major,omitempty"` - Minor uint32 `protobuf:"varint,2,opt,name=minor" json:"minor,omitempty"` + Major uint32 `protobuf:"varint,1,opt,name=major,proto3" json:"major,omitempty"` + Minor uint32 `protobuf:"varint,2,opt,name=minor,proto3" json:"minor,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *RpcProtocolVersions_Version) Reset() { *m = RpcProtocolVersions_Version{} } -func (m *RpcProtocolVersions_Version) String() string { return proto.CompactTextString(m) } -func (*RpcProtocolVersions_Version) ProtoMessage() {} -func (*RpcProtocolVersions_Version) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{0, 0} } +func (m *RpcProtocolVersions_Version) Reset() { *m = RpcProtocolVersions_Version{} } +func (m *RpcProtocolVersions_Version) String() string { return proto.CompactTextString(m) } +func (*RpcProtocolVersions_Version) ProtoMessage() {} +func (*RpcProtocolVersions_Version) Descriptor() ([]byte, []int) { + return fileDescriptor_transport_security_common_6489ab913bf26255, []int{0, 0} +} +func (m *RpcProtocolVersions_Version) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_RpcProtocolVersions_Version.Unmarshal(m, b) +} +func (m *RpcProtocolVersions_Version) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_RpcProtocolVersions_Version.Marshal(b, m, deterministic) +} +func (dst *RpcProtocolVersions_Version) XXX_Merge(src proto.Message) { + xxx_messageInfo_RpcProtocolVersions_Version.Merge(dst, src) +} +func (m *RpcProtocolVersions_Version) XXX_Size() int { + return xxx_messageInfo_RpcProtocolVersions_Version.Size(m) +} +func (m *RpcProtocolVersions_Version) XXX_DiscardUnknown() { + xxx_messageInfo_RpcProtocolVersions_Version.DiscardUnknown(m) +} + +var xxx_messageInfo_RpcProtocolVersions_Version proto.InternalMessageInfo func (m *RpcProtocolVersions_Version) GetMajor() uint32 { if m != nil { @@ -96,25 +148,31 @@ func init() { proto.RegisterEnum("grpc.gcp.SecurityLevel", SecurityLevel_name, SecurityLevel_value) } -func init() { proto.RegisterFile("transport_security_common.proto", fileDescriptor2) } - -var fileDescriptor2 = []byte{ - // 269 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x90, 0xdf, 0x4a, 0xf3, 0x30, - 0x18, 0xc6, 0xbf, 0x0e, 0x3e, 0x95, 0x48, 0xb5, 0x46, 0x87, 0x7f, 0x4e, 0x14, 0x41, 0x10, 0x0f, - 0x72, 0xa0, 0x78, 0x01, 0x73, 0x16, 0x29, 0xcc, 0x6e, 0x66, 0x73, 0xd0, 0xa3, 0x10, 0x43, 0x19, - 0x91, 0x36, 0x6f, 0x78, 0x13, 0xc7, 0xbc, 0x65, 0xaf, 0x42, 0x9a, 0x76, 0x0c, 0xc1, 0x13, 0xcf, - 0xf2, 0xfc, 0xe0, 0xf9, 0x25, 0x79, 0xc8, 0xb9, 0x47, 0x69, 0x9c, 0x05, 0xf4, 0xc2, 0x95, 0xea, - 0x03, 0xb5, 0xff, 0x14, 0x0a, 0xea, 0x1a, 0x0c, 0xb3, 0x08, 0x1e, 0xe8, 0xce, 0x02, 0xad, 0x62, - 0x0b, 0x65, 0x2f, 0xbf, 0x22, 0x72, 0xc8, 0xad, 0x9a, 0x34, 0x58, 0x41, 0x35, 0x2f, 0xd1, 0x69, - 0x30, 0x8e, 0x3e, 0x93, 0xfd, 0x5a, 0xae, 0x04, 0x5a, 0x25, 0x96, 0x2d, 0x3b, 0x89, 0x2e, 0xa2, - 0xeb, 0xdd, 0xdb, 0x2b, 0xb6, 0xee, 0xb2, 0x5f, 0x7a, 0xac, 0x3b, 0xf0, 0xb8, 0x96, 0x2b, 0x6e, - 0x55, 0x17, 0x83, 0x4e, 0x9b, 0x1f, 0xba, 0xde, 0xdf, 0x74, 0xda, 0x6c, 0x74, 0x67, 0xf7, 0x64, - 0x7b, 0x6d, 0x3e, 0x22, 0xff, 0x6b, 0xf9, 0x0e, 0x18, 0x9e, 0x17, 0xf3, 0x36, 0x04, 0xaa, 0x0d, - 0x60, 0xb8, 0xa5, 0xa1, 0x4d, 0xb8, 0x79, 0x21, 0xf1, 0xb4, 0xdb, 0x63, 0x54, 0x2e, 0xcb, 0x8a, - 0x1e, 0x90, 0x78, 0x9a, 0x0e, 0x5f, 0x79, 0x36, 0x2b, 0x44, 0x3e, 0xce, 0xd3, 0xe4, 0x1f, 0xa5, - 0x64, 0x2f, 0xcb, 0x67, 0xe9, 0x53, 0x60, 0xe3, 0x7c, 0x54, 0x24, 0x11, 0x3d, 0x25, 0xfd, 0x0d, - 0x1b, 0xe4, 0x8f, 0x62, 0xc2, 0xb3, 0xf9, 0x60, 0x58, 0x24, 0xbd, 0x87, 0x63, 0xd2, 0xd7, 0xd0, - 0xfe, 0x41, 0x56, 0xde, 0x31, 0x6d, 0x7c, 0x89, 0x46, 0x56, 0x6f, 0x5b, 0x61, 0xe9, 0xbb, 0xef, - 0x00, 0x00, 0x00, 0xff, 0xff, 0x1f, 0x4d, 0xc2, 0xf0, 0x8c, 0x01, 0x00, 0x00, +func init() { + proto.RegisterFile("grpc/gcp/transport_security_common.proto", fileDescriptor_transport_security_common_6489ab913bf26255) +} + +var fileDescriptor_transport_security_common_6489ab913bf26255 = []byte{ + // 324 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x91, 0x41, 0x4b, 0x3b, 0x31, + 0x10, 0xc5, 0xff, 0x5b, 0xf8, 0xab, 0x44, 0x56, 0xeb, 0x6a, 0x41, 0xc5, 0x83, 0x08, 0x42, 0xf1, + 0x90, 0x05, 0xc5, 0x93, 0xa7, 0xb6, 0x16, 0x29, 0xd4, 0x6d, 0xdd, 0xd6, 0x42, 0xbd, 0x84, 0x18, + 0x43, 0x88, 0x64, 0x33, 0x61, 0x36, 0x96, 0xfa, 0x95, 0xfd, 0x14, 0xb2, 0x69, 0x97, 0x22, 0x78, + 0xf1, 0x96, 0xf7, 0x98, 0xf9, 0x4d, 0x66, 0x1e, 0x69, 0x2b, 0x74, 0x22, 0x55, 0xc2, 0xa5, 0x1e, + 0xb9, 0x2d, 0x1d, 0xa0, 0x67, 0xa5, 0x14, 0x1f, 0xa8, 0xfd, 0x27, 0x13, 0x50, 0x14, 0x60, 0xa9, + 0x43, 0xf0, 0x90, 0xec, 0x54, 0x95, 0x54, 0x09, 0x77, 0xf1, 0x15, 0x91, 0xc3, 0xdc, 0x89, 0x71, + 0x65, 0x0b, 0x30, 0x33, 0x89, 0xa5, 0x06, 0x5b, 0x26, 0x8f, 0x64, 0xbf, 0xe0, 0x4b, 0x86, 0x4e, + 0xb0, 0xc5, 0xca, 0x3b, 0x8e, 0xce, 0xa3, 0xf6, 0xee, 0xf5, 0x25, 0xad, 0x7b, 0xe9, 0x2f, 0x7d, + 0x74, 0xfd, 0xc8, 0xe3, 0x82, 0x2f, 0x73, 0x27, 0xd6, 0x32, 0xe0, 0xb4, 0xfd, 0x81, 0x6b, 0xfc, + 0x0d, 0xa7, 0xed, 0x06, 0x77, 0x7a, 0x4b, 0xb6, 0x6b, 0xf2, 0x11, 0xf9, 0x5f, 0xf0, 0x77, 0xc0, + 0xf0, 0xbd, 0x38, 0x5f, 0x89, 0xe0, 0x6a, 0x0b, 0x18, 0xa6, 0x54, 0x6e, 0x25, 0xae, 0x9e, 0x48, + 0x3c, 0x59, 0xdf, 0x63, 0x28, 0x17, 0xd2, 0x24, 0x07, 0x24, 0x9e, 0xf4, 0x7b, 0xcf, 0xf9, 0x60, + 0x3a, 0x67, 0xd9, 0x28, 0xeb, 0x37, 0xff, 0x25, 0x09, 0xd9, 0x1b, 0x64, 0xd3, 0xfe, 0x43, 0xf0, + 0x46, 0xd9, 0x70, 0xde, 0x8c, 0x92, 0x13, 0xd2, 0xda, 0x78, 0x9d, 0xec, 0x9e, 0x8d, 0xf3, 0xc1, + 0xac, 0xd3, 0x9b, 0x37, 0x1b, 0x5d, 0x4f, 0x5a, 0x1a, 0x56, 0x3b, 0x70, 0xe3, 0x4b, 0xaa, 0xad, + 0x97, 0x68, 0xb9, 0xe9, 0x9e, 0x4d, 0xeb, 0x0c, 0xea, 0x91, 0xbd, 0x90, 0x40, 0x58, 0x71, 0x1c, + 0xbd, 0xdc, 0x29, 0x00, 0x65, 0x24, 0x55, 0x60, 0xb8, 0x55, 0x14, 0x50, 0xa5, 0x21, 0x3e, 0x81, + 0xf2, 0x4d, 0x5a, 0xaf, 0xb9, 0x29, 0xd3, 0x8a, 0x98, 0x0a, 0x40, 0x99, 0x86, 0xd8, 0x42, 0x01, + 0x53, 0xc2, 0xbd, 0x6e, 0x05, 0x7d, 0xf3, 0x1d, 0x00, 0x00, 0xff, 0xff, 0xa8, 0xc8, 0x38, 0x9d, + 0xf2, 0x01, 0x00, 0x00, } diff --git a/vendor/google.golang.org/grpc/credentials/alts/core/proto/grpc_gcp/transport_security_common.proto b/vendor/google.golang.org/grpc/credentials/alts/core/proto/grpc_gcp/transport_security_common.proto deleted file mode 100644 index d0f861e64..000000000 --- a/vendor/google.golang.org/grpc/credentials/alts/core/proto/grpc_gcp/transport_security_common.proto +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2018 gRPC authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package grpc.gcp; - -option java_package = "io.grpc.alts.internal"; - -// The security level of the created channel. The list is sorted in increasing -// level of security. This order must always be maintained. -enum SecurityLevel { - SECURITY_NONE = 0; - INTEGRITY_ONLY = 1; - INTEGRITY_AND_PRIVACY = 2; -} - -// Max and min supported RPC protocol versions. -message RpcProtocolVersions { - // RPC version contains a major version and a minor version. - message Version { - uint32 major = 1; - uint32 minor = 2; - } - // Maximum supported RPC version. - Version max_rpc_version = 1; - // Minimum supported RPC version. - Version min_rpc_version = 2; -} diff --git a/vendor/google.golang.org/grpc/credentials/alts/core/regenerate.sh b/vendor/google.golang.org/grpc/credentials/alts/core/regenerate.sh new file mode 100755 index 000000000..a79c4201b --- /dev/null +++ b/vendor/google.golang.org/grpc/credentials/alts/core/regenerate.sh @@ -0,0 +1,35 @@ +#!/bin/bash +# Copyright 2018 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -eux -o pipefail + +TMP=$(mktemp -d) + +function finish { + rm -rf "$TMP" +} +trap finish EXIT + +pushd "$TMP" +mkdir -p grpc/gcp +curl https://raw.githubusercontent.com/grpc/grpc-proto/master/grpc/gcp/altscontext.proto > grpc/gcp/altscontext.proto +curl https://raw.githubusercontent.com/grpc/grpc-proto/master/grpc/gcp/handshaker.proto > grpc/gcp/handshaker.proto +curl https://raw.githubusercontent.com/grpc/grpc-proto/master/grpc/gcp/transport_security_common.proto > grpc/gcp/transport_security_common.proto + +protoc --go_out=plugins=grpc,paths=source_relative:. -I. grpc/gcp/*.proto +popd +rm -f proto/grpc_gcp/*.pb.go +cp "$TMP"/grpc/gcp/*.pb.go proto/grpc_gcp/ + diff --git a/vendor/google.golang.org/grpc/credentials/alts/utils.go b/vendor/google.golang.org/grpc/credentials/alts/utils.go index 86d0a2137..9f92eb1dd 100644 --- a/vendor/google.golang.org/grpc/credentials/alts/utils.go +++ b/vendor/google.golang.org/grpc/credentials/alts/utils.go @@ -30,6 +30,9 @@ import ( "runtime" "strings" "time" + + "golang.org/x/net/context" + "google.golang.org/grpc/peer" ) const ( @@ -115,3 +118,19 @@ func readManufacturer() ([]byte, error) { } return manufacturer, nil } + +// AuthInfoFromContext extracts the alts.AuthInfo object from the given context, +// if it exists. This API should be used by gRPC server RPC handlers to get +// information about the communicating peer. For client-side, use grpc.Peer() +// CallOption. +func AuthInfoFromContext(ctx context.Context) (AuthInfo, error) { + peer, ok := peer.FromContext(ctx) + if !ok { + return nil, errors.New("no Peer found in Context") + } + altsAuthInfo, ok := peer.AuthInfo.(AuthInfo) + if !ok { + return nil, errors.New("no alts.AuthInfo found in Context") + } + return altsAuthInfo, nil +} diff --git a/vendor/google.golang.org/grpc/credentials/credentials.go b/vendor/google.golang.org/grpc/credentials/credentials.go index 3351bf0ee..1dae57ab1 100644 --- a/vendor/google.golang.org/grpc/credentials/credentials.go +++ b/vendor/google.golang.org/grpc/credentials/credentials.go @@ -31,6 +31,7 @@ import ( "net" "strings" + "github.com/golang/protobuf/proto" "golang.org/x/net/context" ) @@ -118,6 +119,18 @@ func (t TLSInfo) AuthType() string { return "tls" } +// GetChannelzSecurityValue returns security info requested by channelz. +func (t TLSInfo) GetChannelzSecurityValue() ChannelzSecurityValue { + v := &TLSChannelzSecurityValue{ + StandardName: cipherSuiteLookup[t.State.CipherSuite], + } + // Currently there's no way to get LocalCertificate info from tls package. + if len(t.State.PeerCertificates) > 0 { + v.RemoteCertificate = t.State.PeerCertificates[0].Raw + } + return v +} + // tlsCreds is the credentials required for authenticating a connection using TLS. type tlsCreds struct { // TLS configuration @@ -155,7 +168,7 @@ func (c *tlsCreds) ClientHandshake(ctx context.Context, authority string, rawCon case <-ctx.Done(): return nil, nil, ctx.Err() } - return conn, TLSInfo{conn.ConnectionState()}, nil + return tlsConn{Conn: conn, rawConn: rawConn}, TLSInfo{conn.ConnectionState()}, nil } func (c *tlsCreds) ServerHandshake(rawConn net.Conn) (net.Conn, AuthInfo, error) { @@ -163,7 +176,7 @@ func (c *tlsCreds) ServerHandshake(rawConn net.Conn) (net.Conn, AuthInfo, error) if err := conn.Handshake(); err != nil { return nil, nil, err } - return conn, TLSInfo{conn.ConnectionState()}, nil + return tlsConn{Conn: conn, rawConn: rawConn}, TLSInfo{conn.ConnectionState()}, nil } func (c *tlsCreds) Clone() TransportCredentials { @@ -218,3 +231,63 @@ func NewServerTLSFromFile(certFile, keyFile string) (TransportCredentials, error } return NewTLS(&tls.Config{Certificates: []tls.Certificate{cert}}), nil } + +// ChannelzSecurityInfo defines the interface that security protocols should implement +// in order to provide security info to channelz. +type ChannelzSecurityInfo interface { + GetSecurityValue() ChannelzSecurityValue +} + +// ChannelzSecurityValue defines the interface that GetSecurityValue() return value +// should satisfy. This interface should only be satisfied by *TLSChannelzSecurityValue +// and *OtherChannelzSecurityValue. +type ChannelzSecurityValue interface { + isChannelzSecurityValue() +} + +// TLSChannelzSecurityValue defines the struct that TLS protocol should return +// from GetSecurityValue(), containing security info like cipher and certificate used. +type TLSChannelzSecurityValue struct { + StandardName string + LocalCertificate []byte + RemoteCertificate []byte +} + +func (*TLSChannelzSecurityValue) isChannelzSecurityValue() {} + +// OtherChannelzSecurityValue defines the struct that non-TLS protocol should return +// from GetSecurityValue(), which contains protocol specific security info. Note +// the Value field will be sent to users of channelz requesting channel info, and +// thus sensitive info should better be avoided. +type OtherChannelzSecurityValue struct { + Name string + Value proto.Message +} + +func (*OtherChannelzSecurityValue) isChannelzSecurityValue() {} + +type tlsConn struct { + *tls.Conn + rawConn net.Conn +} + +var cipherSuiteLookup = map[uint16]string{ + tls.TLS_RSA_WITH_RC4_128_SHA: "TLS_RSA_WITH_RC4_128_SHA", + tls.TLS_RSA_WITH_3DES_EDE_CBC_SHA: "TLS_RSA_WITH_3DES_EDE_CBC_SHA", + tls.TLS_RSA_WITH_AES_128_CBC_SHA: "TLS_RSA_WITH_AES_128_CBC_SHA", + tls.TLS_RSA_WITH_AES_256_CBC_SHA: "TLS_RSA_WITH_AES_256_CBC_SHA", + tls.TLS_RSA_WITH_AES_128_GCM_SHA256: "TLS_RSA_WITH_AES_128_GCM_SHA256", + tls.TLS_RSA_WITH_AES_256_GCM_SHA384: "TLS_RSA_WITH_AES_256_GCM_SHA384", + tls.TLS_ECDHE_ECDSA_WITH_RC4_128_SHA: "TLS_ECDHE_ECDSA_WITH_RC4_128_SHA", + tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA: "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA", + tls.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA: "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA", + tls.TLS_ECDHE_RSA_WITH_RC4_128_SHA: "TLS_ECDHE_RSA_WITH_RC4_128_SHA", + tls.TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA: "TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA", + tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA: "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA", + tls.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA: "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA", + tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256: "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", + tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256: "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256", + tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384: "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384", + tls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384: "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384", + tls.TLS_FALLBACK_SCSV: "TLS_FALLBACK_SCSV", +} diff --git a/vendor/google.golang.org/grpc/credentials/credentials_util_pre_go17.go b/vendor/google.golang.org/grpc/credentials/go16.go similarity index 100% rename from vendor/google.golang.org/grpc/credentials/credentials_util_pre_go17.go rename to vendor/google.golang.org/grpc/credentials/go16.go diff --git a/vendor/google.golang.org/grpc/credentials/credentials_util_go17.go b/vendor/google.golang.org/grpc/credentials/go17.go similarity index 98% rename from vendor/google.golang.org/grpc/credentials/credentials_util_go17.go rename to vendor/google.golang.org/grpc/credentials/go17.go index 60409aac0..fbd500002 100644 --- a/vendor/google.golang.org/grpc/credentials/credentials_util_go17.go +++ b/vendor/google.golang.org/grpc/credentials/go17.go @@ -1,5 +1,4 @@ -// +build go1.7 -// +build !go1.8 +// +build go1.7,!go1.8 /* * diff --git a/vendor/google.golang.org/grpc/credentials/credentials_util_go18.go b/vendor/google.golang.org/grpc/credentials/go18.go similarity index 65% rename from vendor/google.golang.org/grpc/credentials/credentials_util_go18.go rename to vendor/google.golang.org/grpc/credentials/go18.go index 93f0e1d8d..db30d46cc 100644 --- a/vendor/google.golang.org/grpc/credentials/credentials_util_go18.go +++ b/vendor/google.golang.org/grpc/credentials/go18.go @@ -24,6 +24,14 @@ import ( "crypto/tls" ) +func init() { + cipherSuiteLookup[tls.TLS_RSA_WITH_AES_128_CBC_SHA256] = "TLS_RSA_WITH_AES_128_CBC_SHA256" + cipherSuiteLookup[tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256] = "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256" + cipherSuiteLookup[tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256] = "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256" + cipherSuiteLookup[tls.TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305] = "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305" + cipherSuiteLookup[tls.TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305] = "TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305" +} + // cloneTLSConfig returns a shallow clone of the exported // fields of cfg, ignoring the unexported sync.Once, which // contains a mutex and must not be copied. diff --git a/vendor/google.golang.org/grpc/credentials/go19.go b/vendor/google.golang.org/grpc/credentials/go19.go new file mode 100644 index 000000000..2a4ca1a57 --- /dev/null +++ b/vendor/google.golang.org/grpc/credentials/go19.go @@ -0,0 +1,35 @@ +// +build go1.9,!appengine + +/* + * + * Copyright 2018 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package credentials + +import ( + "errors" + "syscall" +) + +// implements the syscall.Conn interface +func (c tlsConn) SyscallConn() (syscall.RawConn, error) { + conn, ok := c.rawConn.(syscall.Conn) + if !ok { + return nil, errors.New("RawConn does not implement syscall.Conn") + } + return conn.SyscallConn() +} diff --git a/vendor/google.golang.org/grpc/examples/helloworld/helloworld/helloworld.pb.go b/vendor/google.golang.org/grpc/examples/helloworld/helloworld/helloworld.pb.go index 64bd1ef3c..11383d740 100644 --- a/vendor/google.golang.org/grpc/examples/helloworld/helloworld/helloworld.pb.go +++ b/vendor/google.golang.org/grpc/examples/helloworld/helloworld/helloworld.pb.go @@ -1,16 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // source: helloworld.proto -/* -Package helloworld is a generated protocol buffer package. - -It is generated from these files: - helloworld.proto - -It has these top-level messages: - HelloRequest - HelloReply -*/ package helloworld import proto "github.com/golang/protobuf/proto" @@ -35,13 +25,35 @@ const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package // The request message containing the user's name. type HelloRequest struct { - Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HelloRequest) Reset() { *m = HelloRequest{} } +func (m *HelloRequest) String() string { return proto.CompactTextString(m) } +func (*HelloRequest) ProtoMessage() {} +func (*HelloRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_helloworld_71e208cbdc16936b, []int{0} +} +func (m *HelloRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_HelloRequest.Unmarshal(m, b) +} +func (m *HelloRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_HelloRequest.Marshal(b, m, deterministic) +} +func (dst *HelloRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_HelloRequest.Merge(dst, src) +} +func (m *HelloRequest) XXX_Size() int { + return xxx_messageInfo_HelloRequest.Size(m) +} +func (m *HelloRequest) XXX_DiscardUnknown() { + xxx_messageInfo_HelloRequest.DiscardUnknown(m) } -func (m *HelloRequest) Reset() { *m = HelloRequest{} } -func (m *HelloRequest) String() string { return proto.CompactTextString(m) } -func (*HelloRequest) ProtoMessage() {} -func (*HelloRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } +var xxx_messageInfo_HelloRequest proto.InternalMessageInfo func (m *HelloRequest) GetName() string { if m != nil { @@ -52,13 +64,35 @@ func (m *HelloRequest) GetName() string { // The response message containing the greetings type HelloReply struct { - Message string `protobuf:"bytes,1,opt,name=message" json:"message,omitempty"` + Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *HelloReply) Reset() { *m = HelloReply{} } -func (m *HelloReply) String() string { return proto.CompactTextString(m) } -func (*HelloReply) ProtoMessage() {} -func (*HelloReply) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } +func (m *HelloReply) Reset() { *m = HelloReply{} } +func (m *HelloReply) String() string { return proto.CompactTextString(m) } +func (*HelloReply) ProtoMessage() {} +func (*HelloReply) Descriptor() ([]byte, []int) { + return fileDescriptor_helloworld_71e208cbdc16936b, []int{1} +} +func (m *HelloReply) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_HelloReply.Unmarshal(m, b) +} +func (m *HelloReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_HelloReply.Marshal(b, m, deterministic) +} +func (dst *HelloReply) XXX_Merge(src proto.Message) { + xxx_messageInfo_HelloReply.Merge(dst, src) +} +func (m *HelloReply) XXX_Size() int { + return xxx_messageInfo_HelloReply.Size(m) +} +func (m *HelloReply) XXX_DiscardUnknown() { + xxx_messageInfo_HelloReply.DiscardUnknown(m) +} + +var xxx_messageInfo_HelloReply proto.InternalMessageInfo func (m *HelloReply) GetMessage() string { if m != nil { @@ -80,8 +114,9 @@ var _ grpc.ClientConn // is compatible with the grpc package it is being compiled against. const _ = grpc.SupportPackageIsVersion4 -// Client API for Greeter service - +// GreeterClient is the client API for Greeter service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type GreeterClient interface { // Sends a greeting SayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloReply, error) @@ -97,15 +132,14 @@ func NewGreeterClient(cc *grpc.ClientConn) GreeterClient { func (c *greeterClient) SayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloReply, error) { out := new(HelloReply) - err := grpc.Invoke(ctx, "/helloworld.Greeter/SayHello", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/helloworld.Greeter/SayHello", in, out, opts...) if err != nil { return nil, err } return out, nil } -// Server API for Greeter service - +// GreeterServer is the server API for Greeter service. type GreeterServer interface { // Sends a greeting SayHello(context.Context, *HelloRequest) (*HelloReply, error) @@ -146,9 +180,9 @@ var _Greeter_serviceDesc = grpc.ServiceDesc{ Metadata: "helloworld.proto", } -func init() { proto.RegisterFile("helloworld.proto", fileDescriptor0) } +func init() { proto.RegisterFile("helloworld.proto", fileDescriptor_helloworld_71e208cbdc16936b) } -var fileDescriptor0 = []byte{ +var fileDescriptor_helloworld_71e208cbdc16936b = []byte{ // 175 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xc8, 0x48, 0xcd, 0xc9, 0xc9, 0x2f, 0xcf, 0x2f, 0xca, 0x49, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x42, 0x88, diff --git a/vendor/google.golang.org/grpc/examples/route_guide/routeguide/route_guide.pb.go b/vendor/google.golang.org/grpc/examples/route_guide/routeguide/route_guide.pb.go index cf7f3937e..199a2ee05 100644 --- a/vendor/google.golang.org/grpc/examples/route_guide/routeguide/route_guide.pb.go +++ b/vendor/google.golang.org/grpc/examples/route_guide/routeguide/route_guide.pb.go @@ -1,19 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // source: route_guide.proto -/* -Package routeguide is a generated protocol buffer package. - -It is generated from these files: - route_guide.proto - -It has these top-level messages: - Point - Rectangle - Feature - RouteNote - RouteSummary -*/ package routeguide import proto "github.com/golang/protobuf/proto" @@ -41,14 +28,36 @@ const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package // Latitudes should be in the range +/- 90 degrees and longitude should be in // the range +/- 180 degrees (inclusive). type Point struct { - Latitude int32 `protobuf:"varint,1,opt,name=latitude" json:"latitude,omitempty"` - Longitude int32 `protobuf:"varint,2,opt,name=longitude" json:"longitude,omitempty"` + Latitude int32 `protobuf:"varint,1,opt,name=latitude,proto3" json:"latitude,omitempty"` + Longitude int32 `protobuf:"varint,2,opt,name=longitude,proto3" json:"longitude,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *Point) Reset() { *m = Point{} } -func (m *Point) String() string { return proto.CompactTextString(m) } -func (*Point) ProtoMessage() {} -func (*Point) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } +func (m *Point) Reset() { *m = Point{} } +func (m *Point) String() string { return proto.CompactTextString(m) } +func (*Point) ProtoMessage() {} +func (*Point) Descriptor() ([]byte, []int) { + return fileDescriptor_route_guide_dc79de2de4c66c19, []int{0} +} +func (m *Point) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Point.Unmarshal(m, b) +} +func (m *Point) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Point.Marshal(b, m, deterministic) +} +func (dst *Point) XXX_Merge(src proto.Message) { + xxx_messageInfo_Point.Merge(dst, src) +} +func (m *Point) XXX_Size() int { + return xxx_messageInfo_Point.Size(m) +} +func (m *Point) XXX_DiscardUnknown() { + xxx_messageInfo_Point.DiscardUnknown(m) +} + +var xxx_messageInfo_Point proto.InternalMessageInfo func (m *Point) GetLatitude() int32 { if m != nil { @@ -68,15 +77,37 @@ func (m *Point) GetLongitude() int32 { // points "lo" and "hi". type Rectangle struct { // One corner of the rectangle. - Lo *Point `protobuf:"bytes,1,opt,name=lo" json:"lo,omitempty"` + Lo *Point `protobuf:"bytes,1,opt,name=lo,proto3" json:"lo,omitempty"` // The other corner of the rectangle. - Hi *Point `protobuf:"bytes,2,opt,name=hi" json:"hi,omitempty"` + Hi *Point `protobuf:"bytes,2,opt,name=hi,proto3" json:"hi,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *Rectangle) Reset() { *m = Rectangle{} } -func (m *Rectangle) String() string { return proto.CompactTextString(m) } -func (*Rectangle) ProtoMessage() {} -func (*Rectangle) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } +func (m *Rectangle) Reset() { *m = Rectangle{} } +func (m *Rectangle) String() string { return proto.CompactTextString(m) } +func (*Rectangle) ProtoMessage() {} +func (*Rectangle) Descriptor() ([]byte, []int) { + return fileDescriptor_route_guide_dc79de2de4c66c19, []int{1} +} +func (m *Rectangle) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Rectangle.Unmarshal(m, b) +} +func (m *Rectangle) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Rectangle.Marshal(b, m, deterministic) +} +func (dst *Rectangle) XXX_Merge(src proto.Message) { + xxx_messageInfo_Rectangle.Merge(dst, src) +} +func (m *Rectangle) XXX_Size() int { + return xxx_messageInfo_Rectangle.Size(m) +} +func (m *Rectangle) XXX_DiscardUnknown() { + xxx_messageInfo_Rectangle.DiscardUnknown(m) +} + +var xxx_messageInfo_Rectangle proto.InternalMessageInfo func (m *Rectangle) GetLo() *Point { if m != nil { @@ -97,15 +128,37 @@ func (m *Rectangle) GetHi() *Point { // If a feature could not be named, the name is empty. type Feature struct { // The name of the feature. - Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // The point where the feature is detected. - Location *Point `protobuf:"bytes,2,opt,name=location" json:"location,omitempty"` + Location *Point `protobuf:"bytes,2,opt,name=location,proto3" json:"location,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Feature) Reset() { *m = Feature{} } +func (m *Feature) String() string { return proto.CompactTextString(m) } +func (*Feature) ProtoMessage() {} +func (*Feature) Descriptor() ([]byte, []int) { + return fileDescriptor_route_guide_dc79de2de4c66c19, []int{2} +} +func (m *Feature) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Feature.Unmarshal(m, b) +} +func (m *Feature) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Feature.Marshal(b, m, deterministic) +} +func (dst *Feature) XXX_Merge(src proto.Message) { + xxx_messageInfo_Feature.Merge(dst, src) +} +func (m *Feature) XXX_Size() int { + return xxx_messageInfo_Feature.Size(m) +} +func (m *Feature) XXX_DiscardUnknown() { + xxx_messageInfo_Feature.DiscardUnknown(m) } -func (m *Feature) Reset() { *m = Feature{} } -func (m *Feature) String() string { return proto.CompactTextString(m) } -func (*Feature) ProtoMessage() {} -func (*Feature) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } +var xxx_messageInfo_Feature proto.InternalMessageInfo func (m *Feature) GetName() string { if m != nil { @@ -124,15 +177,37 @@ func (m *Feature) GetLocation() *Point { // A RouteNote is a message sent while at a given point. type RouteNote struct { // The location from which the message is sent. - Location *Point `protobuf:"bytes,1,opt,name=location" json:"location,omitempty"` + Location *Point `protobuf:"bytes,1,opt,name=location,proto3" json:"location,omitempty"` // The message to be sent. - Message string `protobuf:"bytes,2,opt,name=message" json:"message,omitempty"` + Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RouteNote) Reset() { *m = RouteNote{} } +func (m *RouteNote) String() string { return proto.CompactTextString(m) } +func (*RouteNote) ProtoMessage() {} +func (*RouteNote) Descriptor() ([]byte, []int) { + return fileDescriptor_route_guide_dc79de2de4c66c19, []int{3} +} +func (m *RouteNote) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_RouteNote.Unmarshal(m, b) +} +func (m *RouteNote) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_RouteNote.Marshal(b, m, deterministic) +} +func (dst *RouteNote) XXX_Merge(src proto.Message) { + xxx_messageInfo_RouteNote.Merge(dst, src) +} +func (m *RouteNote) XXX_Size() int { + return xxx_messageInfo_RouteNote.Size(m) +} +func (m *RouteNote) XXX_DiscardUnknown() { + xxx_messageInfo_RouteNote.DiscardUnknown(m) } -func (m *RouteNote) Reset() { *m = RouteNote{} } -func (m *RouteNote) String() string { return proto.CompactTextString(m) } -func (*RouteNote) ProtoMessage() {} -func (*RouteNote) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } +var xxx_messageInfo_RouteNote proto.InternalMessageInfo func (m *RouteNote) GetLocation() *Point { if m != nil { @@ -155,19 +230,41 @@ func (m *RouteNote) GetMessage() string { // the distance between each point. type RouteSummary struct { // The number of points received. - PointCount int32 `protobuf:"varint,1,opt,name=point_count,json=pointCount" json:"point_count,omitempty"` + PointCount int32 `protobuf:"varint,1,opt,name=point_count,json=pointCount,proto3" json:"point_count,omitempty"` // The number of known features passed while traversing the route. - FeatureCount int32 `protobuf:"varint,2,opt,name=feature_count,json=featureCount" json:"feature_count,omitempty"` + FeatureCount int32 `protobuf:"varint,2,opt,name=feature_count,json=featureCount,proto3" json:"feature_count,omitempty"` // The distance covered in metres. - Distance int32 `protobuf:"varint,3,opt,name=distance" json:"distance,omitempty"` + Distance int32 `protobuf:"varint,3,opt,name=distance,proto3" json:"distance,omitempty"` // The duration of the traversal in seconds. - ElapsedTime int32 `protobuf:"varint,4,opt,name=elapsed_time,json=elapsedTime" json:"elapsed_time,omitempty"` + ElapsedTime int32 `protobuf:"varint,4,opt,name=elapsed_time,json=elapsedTime,proto3" json:"elapsed_time,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *RouteSummary) Reset() { *m = RouteSummary{} } -func (m *RouteSummary) String() string { return proto.CompactTextString(m) } -func (*RouteSummary) ProtoMessage() {} -func (*RouteSummary) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} } +func (m *RouteSummary) Reset() { *m = RouteSummary{} } +func (m *RouteSummary) String() string { return proto.CompactTextString(m) } +func (*RouteSummary) ProtoMessage() {} +func (*RouteSummary) Descriptor() ([]byte, []int) { + return fileDescriptor_route_guide_dc79de2de4c66c19, []int{4} +} +func (m *RouteSummary) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_RouteSummary.Unmarshal(m, b) +} +func (m *RouteSummary) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_RouteSummary.Marshal(b, m, deterministic) +} +func (dst *RouteSummary) XXX_Merge(src proto.Message) { + xxx_messageInfo_RouteSummary.Merge(dst, src) +} +func (m *RouteSummary) XXX_Size() int { + return xxx_messageInfo_RouteSummary.Size(m) +} +func (m *RouteSummary) XXX_DiscardUnknown() { + xxx_messageInfo_RouteSummary.DiscardUnknown(m) +} + +var xxx_messageInfo_RouteSummary proto.InternalMessageInfo func (m *RouteSummary) GetPointCount() int32 { if m != nil { @@ -213,8 +310,9 @@ var _ grpc.ClientConn // is compatible with the grpc package it is being compiled against. const _ = grpc.SupportPackageIsVersion4 -// Client API for RouteGuide service - +// RouteGuideClient is the client API for RouteGuide service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type RouteGuideClient interface { // A simple RPC. // @@ -252,7 +350,7 @@ func NewRouteGuideClient(cc *grpc.ClientConn) RouteGuideClient { func (c *routeGuideClient) GetFeature(ctx context.Context, in *Point, opts ...grpc.CallOption) (*Feature, error) { out := new(Feature) - err := grpc.Invoke(ctx, "/routeguide.RouteGuide/GetFeature", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/routeguide.RouteGuide/GetFeature", in, out, opts...) if err != nil { return nil, err } @@ -260,7 +358,7 @@ func (c *routeGuideClient) GetFeature(ctx context.Context, in *Point, opts ...gr } func (c *routeGuideClient) ListFeatures(ctx context.Context, in *Rectangle, opts ...grpc.CallOption) (RouteGuide_ListFeaturesClient, error) { - stream, err := grpc.NewClientStream(ctx, &_RouteGuide_serviceDesc.Streams[0], c.cc, "/routeguide.RouteGuide/ListFeatures", opts...) + stream, err := c.cc.NewStream(ctx, &_RouteGuide_serviceDesc.Streams[0], "/routeguide.RouteGuide/ListFeatures", opts...) if err != nil { return nil, err } @@ -292,7 +390,7 @@ func (x *routeGuideListFeaturesClient) Recv() (*Feature, error) { } func (c *routeGuideClient) RecordRoute(ctx context.Context, opts ...grpc.CallOption) (RouteGuide_RecordRouteClient, error) { - stream, err := grpc.NewClientStream(ctx, &_RouteGuide_serviceDesc.Streams[1], c.cc, "/routeguide.RouteGuide/RecordRoute", opts...) + stream, err := c.cc.NewStream(ctx, &_RouteGuide_serviceDesc.Streams[1], "/routeguide.RouteGuide/RecordRoute", opts...) if err != nil { return nil, err } @@ -326,7 +424,7 @@ func (x *routeGuideRecordRouteClient) CloseAndRecv() (*RouteSummary, error) { } func (c *routeGuideClient) RouteChat(ctx context.Context, opts ...grpc.CallOption) (RouteGuide_RouteChatClient, error) { - stream, err := grpc.NewClientStream(ctx, &_RouteGuide_serviceDesc.Streams[2], c.cc, "/routeguide.RouteGuide/RouteChat", opts...) + stream, err := c.cc.NewStream(ctx, &_RouteGuide_serviceDesc.Streams[2], "/routeguide.RouteGuide/RouteChat", opts...) if err != nil { return nil, err } @@ -356,8 +454,7 @@ func (x *routeGuideRouteChatClient) Recv() (*RouteNote, error) { return m, nil } -// Server API for RouteGuide service - +// RouteGuideServer is the server API for RouteGuide service. type RouteGuideServer interface { // A simple RPC. // @@ -510,9 +607,9 @@ var _RouteGuide_serviceDesc = grpc.ServiceDesc{ Metadata: "route_guide.proto", } -func init() { proto.RegisterFile("route_guide.proto", fileDescriptor0) } +func init() { proto.RegisterFile("route_guide.proto", fileDescriptor_route_guide_dc79de2de4c66c19) } -var fileDescriptor0 = []byte{ +var fileDescriptor_route_guide_dc79de2de4c66c19 = []byte{ // 404 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x53, 0xdd, 0xca, 0xd3, 0x40, 0x10, 0xfd, 0x36, 0x7e, 0x9f, 0x6d, 0x26, 0x11, 0xe9, 0x88, 0x10, 0xa2, 0xa0, 0x8d, 0x37, 0xbd, diff --git a/vendor/google.golang.org/grpc/grpclb/grpc_lb_v1/messages/messages.pb.go b/vendor/google.golang.org/grpc/grpclb/grpc_lb_v1/messages/messages.pb.go deleted file mode 100644 index f4a27125a..000000000 --- a/vendor/google.golang.org/grpc/grpclb/grpc_lb_v1/messages/messages.pb.go +++ /dev/null @@ -1,615 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: grpc_lb_v1/messages/messages.proto - -/* -Package messages is a generated protocol buffer package. - -It is generated from these files: - grpc_lb_v1/messages/messages.proto - -It has these top-level messages: - Duration - Timestamp - LoadBalanceRequest - InitialLoadBalanceRequest - ClientStats - LoadBalanceResponse - InitialLoadBalanceResponse - ServerList - Server -*/ -package messages - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package - -type Duration struct { - // Signed seconds of the span of time. Must be from -315,576,000,000 - // to +315,576,000,000 inclusive. - Seconds int64 `protobuf:"varint,1,opt,name=seconds" json:"seconds,omitempty"` - // Signed fractions of a second at nanosecond resolution of the span - // of time. Durations less than one second are represented with a 0 - // `seconds` field and a positive or negative `nanos` field. For durations - // of one second or more, a non-zero value for the `nanos` field must be - // of the same sign as the `seconds` field. Must be from -999,999,999 - // to +999,999,999 inclusive. - Nanos int32 `protobuf:"varint,2,opt,name=nanos" json:"nanos,omitempty"` -} - -func (m *Duration) Reset() { *m = Duration{} } -func (m *Duration) String() string { return proto.CompactTextString(m) } -func (*Duration) ProtoMessage() {} -func (*Duration) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } - -func (m *Duration) GetSeconds() int64 { - if m != nil { - return m.Seconds - } - return 0 -} - -func (m *Duration) GetNanos() int32 { - if m != nil { - return m.Nanos - } - return 0 -} - -type Timestamp struct { - // Represents seconds of UTC time since Unix epoch - // 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to - // 9999-12-31T23:59:59Z inclusive. - Seconds int64 `protobuf:"varint,1,opt,name=seconds" json:"seconds,omitempty"` - // Non-negative fractions of a second at nanosecond resolution. Negative - // second values with fractions must still have non-negative nanos values - // that count forward in time. Must be from 0 to 999,999,999 - // inclusive. - Nanos int32 `protobuf:"varint,2,opt,name=nanos" json:"nanos,omitempty"` -} - -func (m *Timestamp) Reset() { *m = Timestamp{} } -func (m *Timestamp) String() string { return proto.CompactTextString(m) } -func (*Timestamp) ProtoMessage() {} -func (*Timestamp) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } - -func (m *Timestamp) GetSeconds() int64 { - if m != nil { - return m.Seconds - } - return 0 -} - -func (m *Timestamp) GetNanos() int32 { - if m != nil { - return m.Nanos - } - return 0 -} - -type LoadBalanceRequest struct { - // Types that are valid to be assigned to LoadBalanceRequestType: - // *LoadBalanceRequest_InitialRequest - // *LoadBalanceRequest_ClientStats - LoadBalanceRequestType isLoadBalanceRequest_LoadBalanceRequestType `protobuf_oneof:"load_balance_request_type"` -} - -func (m *LoadBalanceRequest) Reset() { *m = LoadBalanceRequest{} } -func (m *LoadBalanceRequest) String() string { return proto.CompactTextString(m) } -func (*LoadBalanceRequest) ProtoMessage() {} -func (*LoadBalanceRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } - -type isLoadBalanceRequest_LoadBalanceRequestType interface { - isLoadBalanceRequest_LoadBalanceRequestType() -} - -type LoadBalanceRequest_InitialRequest struct { - InitialRequest *InitialLoadBalanceRequest `protobuf:"bytes,1,opt,name=initial_request,json=initialRequest,oneof"` -} -type LoadBalanceRequest_ClientStats struct { - ClientStats *ClientStats `protobuf:"bytes,2,opt,name=client_stats,json=clientStats,oneof"` -} - -func (*LoadBalanceRequest_InitialRequest) isLoadBalanceRequest_LoadBalanceRequestType() {} -func (*LoadBalanceRequest_ClientStats) isLoadBalanceRequest_LoadBalanceRequestType() {} - -func (m *LoadBalanceRequest) GetLoadBalanceRequestType() isLoadBalanceRequest_LoadBalanceRequestType { - if m != nil { - return m.LoadBalanceRequestType - } - return nil -} - -func (m *LoadBalanceRequest) GetInitialRequest() *InitialLoadBalanceRequest { - if x, ok := m.GetLoadBalanceRequestType().(*LoadBalanceRequest_InitialRequest); ok { - return x.InitialRequest - } - return nil -} - -func (m *LoadBalanceRequest) GetClientStats() *ClientStats { - if x, ok := m.GetLoadBalanceRequestType().(*LoadBalanceRequest_ClientStats); ok { - return x.ClientStats - } - return nil -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*LoadBalanceRequest) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _LoadBalanceRequest_OneofMarshaler, _LoadBalanceRequest_OneofUnmarshaler, _LoadBalanceRequest_OneofSizer, []interface{}{ - (*LoadBalanceRequest_InitialRequest)(nil), - (*LoadBalanceRequest_ClientStats)(nil), - } -} - -func _LoadBalanceRequest_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*LoadBalanceRequest) - // load_balance_request_type - switch x := m.LoadBalanceRequestType.(type) { - case *LoadBalanceRequest_InitialRequest: - b.EncodeVarint(1<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.InitialRequest); err != nil { - return err - } - case *LoadBalanceRequest_ClientStats: - b.EncodeVarint(2<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.ClientStats); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("LoadBalanceRequest.LoadBalanceRequestType has unexpected type %T", x) - } - return nil -} - -func _LoadBalanceRequest_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*LoadBalanceRequest) - switch tag { - case 1: // load_balance_request_type.initial_request - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(InitialLoadBalanceRequest) - err := b.DecodeMessage(msg) - m.LoadBalanceRequestType = &LoadBalanceRequest_InitialRequest{msg} - return true, err - case 2: // load_balance_request_type.client_stats - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ClientStats) - err := b.DecodeMessage(msg) - m.LoadBalanceRequestType = &LoadBalanceRequest_ClientStats{msg} - return true, err - default: - return false, nil - } -} - -func _LoadBalanceRequest_OneofSizer(msg proto.Message) (n int) { - m := msg.(*LoadBalanceRequest) - // load_balance_request_type - switch x := m.LoadBalanceRequestType.(type) { - case *LoadBalanceRequest_InitialRequest: - s := proto.Size(x.InitialRequest) - n += proto.SizeVarint(1<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(s)) - n += s - case *LoadBalanceRequest_ClientStats: - s := proto.Size(x.ClientStats) - n += proto.SizeVarint(2<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -type InitialLoadBalanceRequest struct { - // Name of load balanced service (IE, balancer.service.com) - // length should be less than 256 bytes. - Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` -} - -func (m *InitialLoadBalanceRequest) Reset() { *m = InitialLoadBalanceRequest{} } -func (m *InitialLoadBalanceRequest) String() string { return proto.CompactTextString(m) } -func (*InitialLoadBalanceRequest) ProtoMessage() {} -func (*InitialLoadBalanceRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } - -func (m *InitialLoadBalanceRequest) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -// Contains client level statistics that are useful to load balancing. Each -// count except the timestamp should be reset to zero after reporting the stats. -type ClientStats struct { - // The timestamp of generating the report. - Timestamp *Timestamp `protobuf:"bytes,1,opt,name=timestamp" json:"timestamp,omitempty"` - // The total number of RPCs that started. - NumCallsStarted int64 `protobuf:"varint,2,opt,name=num_calls_started,json=numCallsStarted" json:"num_calls_started,omitempty"` - // The total number of RPCs that finished. - NumCallsFinished int64 `protobuf:"varint,3,opt,name=num_calls_finished,json=numCallsFinished" json:"num_calls_finished,omitempty"` - // The total number of RPCs that were dropped by the client because of rate - // limiting. - NumCallsFinishedWithDropForRateLimiting int64 `protobuf:"varint,4,opt,name=num_calls_finished_with_drop_for_rate_limiting,json=numCallsFinishedWithDropForRateLimiting" json:"num_calls_finished_with_drop_for_rate_limiting,omitempty"` - // The total number of RPCs that were dropped by the client because of load - // balancing. - NumCallsFinishedWithDropForLoadBalancing int64 `protobuf:"varint,5,opt,name=num_calls_finished_with_drop_for_load_balancing,json=numCallsFinishedWithDropForLoadBalancing" json:"num_calls_finished_with_drop_for_load_balancing,omitempty"` - // The total number of RPCs that failed to reach a server except dropped RPCs. - NumCallsFinishedWithClientFailedToSend int64 `protobuf:"varint,6,opt,name=num_calls_finished_with_client_failed_to_send,json=numCallsFinishedWithClientFailedToSend" json:"num_calls_finished_with_client_failed_to_send,omitempty"` - // The total number of RPCs that finished and are known to have been received - // by a server. - NumCallsFinishedKnownReceived int64 `protobuf:"varint,7,opt,name=num_calls_finished_known_received,json=numCallsFinishedKnownReceived" json:"num_calls_finished_known_received,omitempty"` -} - -func (m *ClientStats) Reset() { *m = ClientStats{} } -func (m *ClientStats) String() string { return proto.CompactTextString(m) } -func (*ClientStats) ProtoMessage() {} -func (*ClientStats) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} } - -func (m *ClientStats) GetTimestamp() *Timestamp { - if m != nil { - return m.Timestamp - } - return nil -} - -func (m *ClientStats) GetNumCallsStarted() int64 { - if m != nil { - return m.NumCallsStarted - } - return 0 -} - -func (m *ClientStats) GetNumCallsFinished() int64 { - if m != nil { - return m.NumCallsFinished - } - return 0 -} - -func (m *ClientStats) GetNumCallsFinishedWithDropForRateLimiting() int64 { - if m != nil { - return m.NumCallsFinishedWithDropForRateLimiting - } - return 0 -} - -func (m *ClientStats) GetNumCallsFinishedWithDropForLoadBalancing() int64 { - if m != nil { - return m.NumCallsFinishedWithDropForLoadBalancing - } - return 0 -} - -func (m *ClientStats) GetNumCallsFinishedWithClientFailedToSend() int64 { - if m != nil { - return m.NumCallsFinishedWithClientFailedToSend - } - return 0 -} - -func (m *ClientStats) GetNumCallsFinishedKnownReceived() int64 { - if m != nil { - return m.NumCallsFinishedKnownReceived - } - return 0 -} - -type LoadBalanceResponse struct { - // Types that are valid to be assigned to LoadBalanceResponseType: - // *LoadBalanceResponse_InitialResponse - // *LoadBalanceResponse_ServerList - LoadBalanceResponseType isLoadBalanceResponse_LoadBalanceResponseType `protobuf_oneof:"load_balance_response_type"` -} - -func (m *LoadBalanceResponse) Reset() { *m = LoadBalanceResponse{} } -func (m *LoadBalanceResponse) String() string { return proto.CompactTextString(m) } -func (*LoadBalanceResponse) ProtoMessage() {} -func (*LoadBalanceResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} } - -type isLoadBalanceResponse_LoadBalanceResponseType interface { - isLoadBalanceResponse_LoadBalanceResponseType() -} - -type LoadBalanceResponse_InitialResponse struct { - InitialResponse *InitialLoadBalanceResponse `protobuf:"bytes,1,opt,name=initial_response,json=initialResponse,oneof"` -} -type LoadBalanceResponse_ServerList struct { - ServerList *ServerList `protobuf:"bytes,2,opt,name=server_list,json=serverList,oneof"` -} - -func (*LoadBalanceResponse_InitialResponse) isLoadBalanceResponse_LoadBalanceResponseType() {} -func (*LoadBalanceResponse_ServerList) isLoadBalanceResponse_LoadBalanceResponseType() {} - -func (m *LoadBalanceResponse) GetLoadBalanceResponseType() isLoadBalanceResponse_LoadBalanceResponseType { - if m != nil { - return m.LoadBalanceResponseType - } - return nil -} - -func (m *LoadBalanceResponse) GetInitialResponse() *InitialLoadBalanceResponse { - if x, ok := m.GetLoadBalanceResponseType().(*LoadBalanceResponse_InitialResponse); ok { - return x.InitialResponse - } - return nil -} - -func (m *LoadBalanceResponse) GetServerList() *ServerList { - if x, ok := m.GetLoadBalanceResponseType().(*LoadBalanceResponse_ServerList); ok { - return x.ServerList - } - return nil -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*LoadBalanceResponse) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _LoadBalanceResponse_OneofMarshaler, _LoadBalanceResponse_OneofUnmarshaler, _LoadBalanceResponse_OneofSizer, []interface{}{ - (*LoadBalanceResponse_InitialResponse)(nil), - (*LoadBalanceResponse_ServerList)(nil), - } -} - -func _LoadBalanceResponse_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*LoadBalanceResponse) - // load_balance_response_type - switch x := m.LoadBalanceResponseType.(type) { - case *LoadBalanceResponse_InitialResponse: - b.EncodeVarint(1<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.InitialResponse); err != nil { - return err - } - case *LoadBalanceResponse_ServerList: - b.EncodeVarint(2<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.ServerList); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("LoadBalanceResponse.LoadBalanceResponseType has unexpected type %T", x) - } - return nil -} - -func _LoadBalanceResponse_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*LoadBalanceResponse) - switch tag { - case 1: // load_balance_response_type.initial_response - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(InitialLoadBalanceResponse) - err := b.DecodeMessage(msg) - m.LoadBalanceResponseType = &LoadBalanceResponse_InitialResponse{msg} - return true, err - case 2: // load_balance_response_type.server_list - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ServerList) - err := b.DecodeMessage(msg) - m.LoadBalanceResponseType = &LoadBalanceResponse_ServerList{msg} - return true, err - default: - return false, nil - } -} - -func _LoadBalanceResponse_OneofSizer(msg proto.Message) (n int) { - m := msg.(*LoadBalanceResponse) - // load_balance_response_type - switch x := m.LoadBalanceResponseType.(type) { - case *LoadBalanceResponse_InitialResponse: - s := proto.Size(x.InitialResponse) - n += proto.SizeVarint(1<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(s)) - n += s - case *LoadBalanceResponse_ServerList: - s := proto.Size(x.ServerList) - n += proto.SizeVarint(2<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -type InitialLoadBalanceResponse struct { - // This is an application layer redirect that indicates the client should use - // the specified server for load balancing. When this field is non-empty in - // the response, the client should open a separate connection to the - // load_balancer_delegate and call the BalanceLoad method. Its length should - // be less than 64 bytes. - LoadBalancerDelegate string `protobuf:"bytes,1,opt,name=load_balancer_delegate,json=loadBalancerDelegate" json:"load_balancer_delegate,omitempty"` - // This interval defines how often the client should send the client stats - // to the load balancer. Stats should only be reported when the duration is - // positive. - ClientStatsReportInterval *Duration `protobuf:"bytes,2,opt,name=client_stats_report_interval,json=clientStatsReportInterval" json:"client_stats_report_interval,omitempty"` -} - -func (m *InitialLoadBalanceResponse) Reset() { *m = InitialLoadBalanceResponse{} } -func (m *InitialLoadBalanceResponse) String() string { return proto.CompactTextString(m) } -func (*InitialLoadBalanceResponse) ProtoMessage() {} -func (*InitialLoadBalanceResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} } - -func (m *InitialLoadBalanceResponse) GetLoadBalancerDelegate() string { - if m != nil { - return m.LoadBalancerDelegate - } - return "" -} - -func (m *InitialLoadBalanceResponse) GetClientStatsReportInterval() *Duration { - if m != nil { - return m.ClientStatsReportInterval - } - return nil -} - -type ServerList struct { - // Contains a list of servers selected by the load balancer. The list will - // be updated when server resolutions change or as needed to balance load - // across more servers. The client should consume the server list in order - // unless instructed otherwise via the client_config. - Servers []*Server `protobuf:"bytes,1,rep,name=servers" json:"servers,omitempty"` -} - -func (m *ServerList) Reset() { *m = ServerList{} } -func (m *ServerList) String() string { return proto.CompactTextString(m) } -func (*ServerList) ProtoMessage() {} -func (*ServerList) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} } - -func (m *ServerList) GetServers() []*Server { - if m != nil { - return m.Servers - } - return nil -} - -// Contains server information. When none of the [drop_for_*] fields are true, -// use the other fields. When drop_for_rate_limiting is true, ignore all other -// fields. Use drop_for_load_balancing only when it is true and -// drop_for_rate_limiting is false. -type Server struct { - // A resolved address for the server, serialized in network-byte-order. It may - // either be an IPv4 or IPv6 address. - IpAddress []byte `protobuf:"bytes,1,opt,name=ip_address,json=ipAddress,proto3" json:"ip_address,omitempty"` - // A resolved port number for the server. - Port int32 `protobuf:"varint,2,opt,name=port" json:"port,omitempty"` - // An opaque but printable token given to the frontend for each pick. All - // frontend requests for that pick must include the token in its initial - // metadata. The token is used by the backend to verify the request and to - // allow the backend to report load to the gRPC LB system. - // - // Its length is variable but less than 50 bytes. - LoadBalanceToken string `protobuf:"bytes,3,opt,name=load_balance_token,json=loadBalanceToken" json:"load_balance_token,omitempty"` - // Indicates whether this particular request should be dropped by the client - // for rate limiting. - DropForRateLimiting bool `protobuf:"varint,4,opt,name=drop_for_rate_limiting,json=dropForRateLimiting" json:"drop_for_rate_limiting,omitempty"` - // Indicates whether this particular request should be dropped by the client - // for load balancing. - DropForLoadBalancing bool `protobuf:"varint,5,opt,name=drop_for_load_balancing,json=dropForLoadBalancing" json:"drop_for_load_balancing,omitempty"` -} - -func (m *Server) Reset() { *m = Server{} } -func (m *Server) String() string { return proto.CompactTextString(m) } -func (*Server) ProtoMessage() {} -func (*Server) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} } - -func (m *Server) GetIpAddress() []byte { - if m != nil { - return m.IpAddress - } - return nil -} - -func (m *Server) GetPort() int32 { - if m != nil { - return m.Port - } - return 0 -} - -func (m *Server) GetLoadBalanceToken() string { - if m != nil { - return m.LoadBalanceToken - } - return "" -} - -func (m *Server) GetDropForRateLimiting() bool { - if m != nil { - return m.DropForRateLimiting - } - return false -} - -func (m *Server) GetDropForLoadBalancing() bool { - if m != nil { - return m.DropForLoadBalancing - } - return false -} - -func init() { - proto.RegisterType((*Duration)(nil), "grpc.lb.v1.Duration") - proto.RegisterType((*Timestamp)(nil), "grpc.lb.v1.Timestamp") - proto.RegisterType((*LoadBalanceRequest)(nil), "grpc.lb.v1.LoadBalanceRequest") - proto.RegisterType((*InitialLoadBalanceRequest)(nil), "grpc.lb.v1.InitialLoadBalanceRequest") - proto.RegisterType((*ClientStats)(nil), "grpc.lb.v1.ClientStats") - proto.RegisterType((*LoadBalanceResponse)(nil), "grpc.lb.v1.LoadBalanceResponse") - proto.RegisterType((*InitialLoadBalanceResponse)(nil), "grpc.lb.v1.InitialLoadBalanceResponse") - proto.RegisterType((*ServerList)(nil), "grpc.lb.v1.ServerList") - proto.RegisterType((*Server)(nil), "grpc.lb.v1.Server") -} - -func init() { proto.RegisterFile("grpc_lb_v1/messages/messages.proto", fileDescriptor0) } - -var fileDescriptor0 = []byte{ - // 709 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x55, 0xdd, 0x4e, 0x1b, 0x3b, - 0x10, 0x26, 0x27, 0x01, 0x92, 0x09, 0x3a, 0xe4, 0x98, 0x1c, 0x08, 0x14, 0x24, 0xba, 0x52, 0x69, - 0x54, 0xd1, 0x20, 0xa0, 0xbd, 0xe8, 0xcf, 0x45, 0x1b, 0x10, 0x0a, 0x2d, 0x17, 0x95, 0x43, 0x55, - 0xa9, 0x52, 0x65, 0x39, 0xd9, 0x21, 0x58, 0x6c, 0xec, 0xad, 0xed, 0x04, 0xf5, 0x11, 0xfa, 0x28, - 0x7d, 0x8c, 0xaa, 0xcf, 0xd0, 0xf7, 0xa9, 0xd6, 0xbb, 0x9b, 0x5d, 0x20, 0x80, 0x7a, 0x67, 0x8f, - 0xbf, 0xf9, 0xbe, 0xf1, 0xac, 0xbf, 0x59, 0xf0, 0x06, 0x3a, 0xec, 0xb3, 0xa0, 0xc7, 0xc6, 0xbb, - 0x3b, 0x43, 0x34, 0x86, 0x0f, 0xd0, 0x4c, 0x16, 0xad, 0x50, 0x2b, 0xab, 0x08, 0x44, 0x98, 0x56, - 0xd0, 0x6b, 0x8d, 0x77, 0xbd, 0x97, 0x50, 0x3e, 0x1c, 0x69, 0x6e, 0x85, 0x92, 0xa4, 0x01, 0xf3, - 0x06, 0xfb, 0x4a, 0xfa, 0xa6, 0x51, 0xd8, 0x2c, 0x34, 0x8b, 0x34, 0xdd, 0x92, 0x3a, 0xcc, 0x4a, - 0x2e, 0x95, 0x69, 0xfc, 0xb3, 0x59, 0x68, 0xce, 0xd2, 0x78, 0xe3, 0xbd, 0x82, 0xca, 0xa9, 0x18, - 0xa2, 0xb1, 0x7c, 0x18, 0xfe, 0x75, 0xf2, 0xcf, 0x02, 0x90, 0x13, 0xc5, 0xfd, 0x36, 0x0f, 0xb8, - 0xec, 0x23, 0xc5, 0xaf, 0x23, 0x34, 0x96, 0x7c, 0x80, 0x45, 0x21, 0x85, 0x15, 0x3c, 0x60, 0x3a, - 0x0e, 0x39, 0xba, 0xea, 0xde, 0xa3, 0x56, 0x56, 0x75, 0xeb, 0x38, 0x86, 0xdc, 0xcc, 0xef, 0xcc, - 0xd0, 0x7f, 0x93, 0xfc, 0x94, 0xf1, 0x35, 0x2c, 0xf4, 0x03, 0x81, 0xd2, 0x32, 0x63, 0xb9, 0x8d, - 0xab, 0xa8, 0xee, 0xad, 0xe4, 0xe9, 0x0e, 0xdc, 0x79, 0x37, 0x3a, 0xee, 0xcc, 0xd0, 0x6a, 0x3f, - 0xdb, 0xb6, 0x1f, 0xc0, 0x6a, 0xa0, 0xb8, 0xcf, 0x7a, 0xb1, 0x4c, 0x5a, 0x14, 0xb3, 0xdf, 0x42, - 0xf4, 0x76, 0x60, 0xf5, 0xd6, 0x4a, 0x08, 0x81, 0x92, 0xe4, 0x43, 0x74, 0xe5, 0x57, 0xa8, 0x5b, - 0x7b, 0xdf, 0x4b, 0x50, 0xcd, 0x89, 0x91, 0x7d, 0xa8, 0xd8, 0xb4, 0x83, 0xc9, 0x3d, 0xff, 0xcf, - 0x17, 0x36, 0x69, 0x2f, 0xcd, 0x70, 0xe4, 0x09, 0xfc, 0x27, 0x47, 0x43, 0xd6, 0xe7, 0x41, 0x60, - 0xa2, 0x3b, 0x69, 0x8b, 0xbe, 0xbb, 0x55, 0x91, 0x2e, 0xca, 0xd1, 0xf0, 0x20, 0x8a, 0x77, 0xe3, - 0x30, 0xd9, 0x06, 0x92, 0x61, 0xcf, 0x84, 0x14, 0xe6, 0x1c, 0xfd, 0x46, 0xd1, 0x81, 0x6b, 0x29, - 0xf8, 0x28, 0x89, 0x13, 0x06, 0xad, 0x9b, 0x68, 0x76, 0x29, 0xec, 0x39, 0xf3, 0xb5, 0x0a, 0xd9, - 0x99, 0xd2, 0x4c, 0x73, 0x8b, 0x2c, 0x10, 0x43, 0x61, 0x85, 0x1c, 0x34, 0x4a, 0x8e, 0xe9, 0xf1, - 0x75, 0xa6, 0x4f, 0xc2, 0x9e, 0x1f, 0x6a, 0x15, 0x1e, 0x29, 0x4d, 0xb9, 0xc5, 0x93, 0x04, 0x4e, - 0x38, 0xec, 0xdc, 0x2b, 0x90, 0x6b, 0x77, 0xa4, 0x30, 0xeb, 0x14, 0x9a, 0x77, 0x28, 0x64, 0xbd, - 0x8f, 0x24, 0xbe, 0xc0, 0xd3, 0xdb, 0x24, 0x92, 0x67, 0x70, 0xc6, 0x45, 0x80, 0x3e, 0xb3, 0x8a, - 0x19, 0x94, 0x7e, 0x63, 0xce, 0x09, 0x6c, 0x4d, 0x13, 0x88, 0x3f, 0xd5, 0x91, 0xc3, 0x9f, 0xaa, - 0x2e, 0x4a, 0x9f, 0x74, 0xe0, 0xe1, 0x14, 0xfa, 0x0b, 0xa9, 0x2e, 0x25, 0xd3, 0xd8, 0x47, 0x31, - 0x46, 0xbf, 0x31, 0xef, 0x28, 0x37, 0xae, 0x53, 0xbe, 0x8f, 0x50, 0x34, 0x01, 0x79, 0xbf, 0x0a, - 0xb0, 0x74, 0xe5, 0xd9, 0x98, 0x50, 0x49, 0x83, 0xa4, 0x0b, 0xb5, 0xcc, 0x01, 0x71, 0x2c, 0x79, - 0x1a, 0x5b, 0xf7, 0x59, 0x20, 0x46, 0x77, 0x66, 0xe8, 0xe2, 0xc4, 0x03, 0x09, 0xe9, 0x0b, 0xa8, - 0x1a, 0xd4, 0x63, 0xd4, 0x2c, 0x10, 0xc6, 0x26, 0x1e, 0x58, 0xce, 0xf3, 0x75, 0xdd, 0xf1, 0x89, - 0x70, 0x1e, 0x02, 0x33, 0xd9, 0xb5, 0xd7, 0x61, 0xed, 0x9a, 0x03, 0x62, 0xce, 0xd8, 0x02, 0x3f, - 0x0a, 0xb0, 0x76, 0x7b, 0x29, 0xe4, 0x19, 0x2c, 0xe7, 0x93, 0x35, 0xf3, 0x31, 0xc0, 0x01, 0xb7, - 0xa9, 0x2d, 0xea, 0x41, 0x96, 0xa4, 0x0f, 0x93, 0x33, 0xf2, 0x11, 0xd6, 0xf3, 0x96, 0x65, 0x1a, - 0x43, 0xa5, 0x2d, 0x13, 0xd2, 0xa2, 0x1e, 0xf3, 0x20, 0x29, 0xbf, 0x9e, 0x2f, 0x3f, 0x1d, 0x62, - 0x74, 0x35, 0xe7, 0x5e, 0xea, 0xf2, 0x8e, 0x93, 0x34, 0xef, 0x0d, 0x40, 0x76, 0x4b, 0xb2, 0x1d, - 0x0d, 0xac, 0x68, 0x17, 0x0d, 0xac, 0x62, 0xb3, 0xba, 0x47, 0x6e, 0xb6, 0x83, 0xa6, 0x90, 0x77, - 0xa5, 0x72, 0xb1, 0x56, 0xf2, 0x7e, 0x17, 0x60, 0x2e, 0x3e, 0x21, 0x1b, 0x00, 0x22, 0x64, 0xdc, - 0xf7, 0x35, 0x9a, 0x78, 0xe4, 0x2d, 0xd0, 0x8a, 0x08, 0xdf, 0xc6, 0x81, 0xc8, 0xfd, 0x91, 0x76, - 0x32, 0xf3, 0xdc, 0x3a, 0x32, 0xe3, 0x95, 0x4e, 0x5a, 0x75, 0x81, 0xd2, 0x99, 0xb1, 0x42, 0x6b, - 0xb9, 0x46, 0x9c, 0x46, 0x71, 0xb2, 0x0f, 0xcb, 0x77, 0x98, 0xae, 0x4c, 0x97, 0xfc, 0x29, 0x06, - 0x7b, 0x0e, 0x2b, 0x77, 0x19, 0xa9, 0x4c, 0xeb, 0xfe, 0x14, 0xd3, 0xb4, 0xe1, 0x73, 0x39, 0xfd, - 0x47, 0xf4, 0xe6, 0xdc, 0x4f, 0x62, 0xff, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xa3, 0x36, 0x86, - 0xa6, 0x4a, 0x06, 0x00, 0x00, -} diff --git a/vendor/google.golang.org/grpc/grpclb/grpc_lb_v1/messages/messages.proto b/vendor/google.golang.org/grpc/grpclb/grpc_lb_v1/messages/messages.proto deleted file mode 100644 index 42d99c109..000000000 --- a/vendor/google.golang.org/grpc/grpclb/grpc_lb_v1/messages/messages.proto +++ /dev/null @@ -1,155 +0,0 @@ -// Copyright 2016 gRPC authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package grpc.lb.v1; -option go_package = "google.golang.org/grpc/grpclb/grpc_lb_v1/messages"; - -message Duration { - // Signed seconds of the span of time. Must be from -315,576,000,000 - // to +315,576,000,000 inclusive. - int64 seconds = 1; - - // Signed fractions of a second at nanosecond resolution of the span - // of time. Durations less than one second are represented with a 0 - // `seconds` field and a positive or negative `nanos` field. For durations - // of one second or more, a non-zero value for the `nanos` field must be - // of the same sign as the `seconds` field. Must be from -999,999,999 - // to +999,999,999 inclusive. - int32 nanos = 2; -} - -message Timestamp { - // Represents seconds of UTC time since Unix epoch - // 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to - // 9999-12-31T23:59:59Z inclusive. - int64 seconds = 1; - - // Non-negative fractions of a second at nanosecond resolution. Negative - // second values with fractions must still have non-negative nanos values - // that count forward in time. Must be from 0 to 999,999,999 - // inclusive. - int32 nanos = 2; -} - -message LoadBalanceRequest { - oneof load_balance_request_type { - // This message should be sent on the first request to the load balancer. - InitialLoadBalanceRequest initial_request = 1; - - // The client stats should be periodically reported to the load balancer - // based on the duration defined in the InitialLoadBalanceResponse. - ClientStats client_stats = 2; - } -} - -message InitialLoadBalanceRequest { - // Name of load balanced service (IE, balancer.service.com) - // length should be less than 256 bytes. - string name = 1; -} - -// Contains client level statistics that are useful to load balancing. Each -// count except the timestamp should be reset to zero after reporting the stats. -message ClientStats { - // The timestamp of generating the report. - Timestamp timestamp = 1; - - // The total number of RPCs that started. - int64 num_calls_started = 2; - - // The total number of RPCs that finished. - int64 num_calls_finished = 3; - - // The total number of RPCs that were dropped by the client because of rate - // limiting. - int64 num_calls_finished_with_drop_for_rate_limiting = 4; - - // The total number of RPCs that were dropped by the client because of load - // balancing. - int64 num_calls_finished_with_drop_for_load_balancing = 5; - - // The total number of RPCs that failed to reach a server except dropped RPCs. - int64 num_calls_finished_with_client_failed_to_send = 6; - - // The total number of RPCs that finished and are known to have been received - // by a server. - int64 num_calls_finished_known_received = 7; -} - -message LoadBalanceResponse { - oneof load_balance_response_type { - // This message should be sent on the first response to the client. - InitialLoadBalanceResponse initial_response = 1; - - // Contains the list of servers selected by the load balancer. The client - // should send requests to these servers in the specified order. - ServerList server_list = 2; - } -} - -message InitialLoadBalanceResponse { - // This is an application layer redirect that indicates the client should use - // the specified server for load balancing. When this field is non-empty in - // the response, the client should open a separate connection to the - // load_balancer_delegate and call the BalanceLoad method. Its length should - // be less than 64 bytes. - string load_balancer_delegate = 1; - - // This interval defines how often the client should send the client stats - // to the load balancer. Stats should only be reported when the duration is - // positive. - Duration client_stats_report_interval = 2; -} - -message ServerList { - // Contains a list of servers selected by the load balancer. The list will - // be updated when server resolutions change or as needed to balance load - // across more servers. The client should consume the server list in order - // unless instructed otherwise via the client_config. - repeated Server servers = 1; - - // Was google.protobuf.Duration expiration_interval. - reserved 3; -} - -// Contains server information. When none of the [drop_for_*] fields are true, -// use the other fields. When drop_for_rate_limiting is true, ignore all other -// fields. Use drop_for_load_balancing only when it is true and -// drop_for_rate_limiting is false. -message Server { - // A resolved address for the server, serialized in network-byte-order. It may - // either be an IPv4 or IPv6 address. - bytes ip_address = 1; - - // A resolved port number for the server. - int32 port = 2; - - // An opaque but printable token given to the frontend for each pick. All - // frontend requests for that pick must include the token in its initial - // metadata. The token is used by the backend to verify the request and to - // allow the backend to report load to the gRPC LB system. - // - // Its length is variable but less than 50 bytes. - string load_balance_token = 3; - - // Indicates whether this particular request should be dropped by the client - // for rate limiting. - bool drop_for_rate_limiting = 4; - - // Indicates whether this particular request should be dropped by the client - // for load balancing. - bool drop_for_load_balancing = 5; -} diff --git a/vendor/google.golang.org/grpc/grpclb/grpc_lb_v1/service/service.pb.go b/vendor/google.golang.org/grpc/grpclb/grpc_lb_v1/service/service.pb.go deleted file mode 100644 index ebcbe56d8..000000000 --- a/vendor/google.golang.org/grpc/grpclb/grpc_lb_v1/service/service.pb.go +++ /dev/null @@ -1,154 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: grpc_lb_v1/service/service.proto - -/* -Package service is a generated protocol buffer package. - -It is generated from these files: - grpc_lb_v1/service/service.proto - -It has these top-level messages: -*/ -package service - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" -import grpc_lb_v1 "google.golang.org/grpc/grpclb/grpc_lb_v1/messages" - -import ( - context "golang.org/x/net/context" - grpc "google.golang.org/grpc" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// Client API for LoadBalancer service - -type LoadBalancerClient interface { - // Bidirectional rpc to get a list of servers. - BalanceLoad(ctx context.Context, opts ...grpc.CallOption) (LoadBalancer_BalanceLoadClient, error) -} - -type loadBalancerClient struct { - cc *grpc.ClientConn -} - -func NewLoadBalancerClient(cc *grpc.ClientConn) LoadBalancerClient { - return &loadBalancerClient{cc} -} - -func (c *loadBalancerClient) BalanceLoad(ctx context.Context, opts ...grpc.CallOption) (LoadBalancer_BalanceLoadClient, error) { - stream, err := grpc.NewClientStream(ctx, &_LoadBalancer_serviceDesc.Streams[0], c.cc, "/grpc.lb.v1.LoadBalancer/BalanceLoad", opts...) - if err != nil { - return nil, err - } - x := &loadBalancerBalanceLoadClient{stream} - return x, nil -} - -type LoadBalancer_BalanceLoadClient interface { - Send(*grpc_lb_v1.LoadBalanceRequest) error - Recv() (*grpc_lb_v1.LoadBalanceResponse, error) - grpc.ClientStream -} - -type loadBalancerBalanceLoadClient struct { - grpc.ClientStream -} - -func (x *loadBalancerBalanceLoadClient) Send(m *grpc_lb_v1.LoadBalanceRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *loadBalancerBalanceLoadClient) Recv() (*grpc_lb_v1.LoadBalanceResponse, error) { - m := new(grpc_lb_v1.LoadBalanceResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -// Server API for LoadBalancer service - -type LoadBalancerServer interface { - // Bidirectional rpc to get a list of servers. - BalanceLoad(LoadBalancer_BalanceLoadServer) error -} - -func RegisterLoadBalancerServer(s *grpc.Server, srv LoadBalancerServer) { - s.RegisterService(&_LoadBalancer_serviceDesc, srv) -} - -func _LoadBalancer_BalanceLoad_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(LoadBalancerServer).BalanceLoad(&loadBalancerBalanceLoadServer{stream}) -} - -type LoadBalancer_BalanceLoadServer interface { - Send(*grpc_lb_v1.LoadBalanceResponse) error - Recv() (*grpc_lb_v1.LoadBalanceRequest, error) - grpc.ServerStream -} - -type loadBalancerBalanceLoadServer struct { - grpc.ServerStream -} - -func (x *loadBalancerBalanceLoadServer) Send(m *grpc_lb_v1.LoadBalanceResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *loadBalancerBalanceLoadServer) Recv() (*grpc_lb_v1.LoadBalanceRequest, error) { - m := new(grpc_lb_v1.LoadBalanceRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -var _LoadBalancer_serviceDesc = grpc.ServiceDesc{ - ServiceName: "grpc.lb.v1.LoadBalancer", - HandlerType: (*LoadBalancerServer)(nil), - Methods: []grpc.MethodDesc{}, - Streams: []grpc.StreamDesc{ - { - StreamName: "BalanceLoad", - Handler: _LoadBalancer_BalanceLoad_Handler, - ServerStreams: true, - ClientStreams: true, - }, - }, - Metadata: "grpc_lb_v1/service/service.proto", -} - -func init() { proto.RegisterFile("grpc_lb_v1/service/service.proto", fileDescriptor0) } - -var fileDescriptor0 = []byte{ - // 142 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x48, 0x2f, 0x2a, 0x48, - 0x8e, 0xcf, 0x49, 0x8a, 0x2f, 0x33, 0xd4, 0x2f, 0x4e, 0x2d, 0x2a, 0xcb, 0x4c, 0x4e, 0x85, 0xd1, - 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, 0x5c, 0x20, 0x15, 0x7a, 0x39, 0x49, 0x7a, 0x65, 0x86, - 0x52, 0x4a, 0x48, 0xaa, 0x73, 0x53, 0x8b, 0x8b, 0x13, 0xd3, 0x53, 0x8b, 0xe1, 0x0c, 0x88, 0x7a, - 0xa3, 0x24, 0x2e, 0x1e, 0x9f, 0xfc, 0xc4, 0x14, 0xa7, 0xc4, 0x9c, 0xc4, 0xbc, 0xe4, 0xd4, 0x22, - 0xa1, 0x20, 0x2e, 0x6e, 0x28, 0x1b, 0x24, 0x2c, 0x24, 0xa7, 0x87, 0x30, 0x4f, 0x0f, 0x49, 0x61, - 0x50, 0x6a, 0x61, 0x69, 0x6a, 0x71, 0x89, 0x94, 0x3c, 0x4e, 0xf9, 0xe2, 0x82, 0xfc, 0xbc, 0xe2, - 0x54, 0x0d, 0x46, 0x03, 0x46, 0x27, 0xce, 0x28, 0x76, 0xa8, 0x23, 0x93, 0xd8, 0xc0, 0xb6, 0x1a, - 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x39, 0x4e, 0xb0, 0xf8, 0xc9, 0x00, 0x00, 0x00, -} diff --git a/vendor/google.golang.org/grpc/grpclb/grpc_lb_v1/service/service.proto b/vendor/google.golang.org/grpc/grpclb/grpc_lb_v1/service/service.proto deleted file mode 100644 index 6971fdba5..000000000 --- a/vendor/google.golang.org/grpc/grpclb/grpc_lb_v1/service/service.proto +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2016 gRPC authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package grpc.lb.v1; -option go_package = "google.golang.org/grpc/grpclb/grpc_lb_v1/service"; - -import "grpc_lb_v1/messages/messages.proto"; - -service LoadBalancer { - // Bidirectional rpc to get a list of servers. - rpc BalanceLoad(stream LoadBalanceRequest) - returns (stream LoadBalanceResponse); -} diff --git a/vendor/google.golang.org/grpc/grpclog/grpclog.go b/vendor/google.golang.org/grpc/grpclog/grpclog.go index 16a7d8886..1fabb11e1 100644 --- a/vendor/google.golang.org/grpc/grpclog/grpclog.go +++ b/vendor/google.golang.org/grpc/grpclog/grpclog.go @@ -105,18 +105,21 @@ func Fatalln(args ...interface{}) { } // Print prints to the logger. Arguments are handled in the manner of fmt.Print. +// // Deprecated: use Info. func Print(args ...interface{}) { logger.Info(args...) } // Printf prints to the logger. Arguments are handled in the manner of fmt.Printf. +// // Deprecated: use Infof. func Printf(format string, args ...interface{}) { logger.Infof(format, args...) } // Println prints to the logger. Arguments are handled in the manner of fmt.Println. +// // Deprecated: use Infoln. func Println(args ...interface{}) { logger.Infoln(args...) diff --git a/vendor/google.golang.org/grpc/grpclog/logger.go b/vendor/google.golang.org/grpc/grpclog/logger.go index d03b2397b..097494f71 100644 --- a/vendor/google.golang.org/grpc/grpclog/logger.go +++ b/vendor/google.golang.org/grpc/grpclog/logger.go @@ -19,6 +19,7 @@ package grpclog // Logger mimics golang's standard Logger as an interface. +// // Deprecated: use LoggerV2. type Logger interface { Fatal(args ...interface{}) @@ -31,6 +32,7 @@ type Logger interface { // SetLogger sets the logger that is used in grpc. Call only from // init() functions. +// // Deprecated: use SetLoggerV2. func SetLogger(l Logger) { logger = &loggerWrapper{Logger: l} diff --git a/vendor/google.golang.org/grpc/health/grpc_health_v1/health.pb.go b/vendor/google.golang.org/grpc/health/grpc_health_v1/health.pb.go index fdcbb9e0b..a1fda2801 100644 --- a/vendor/google.golang.org/grpc/health/grpc_health_v1/health.pb.go +++ b/vendor/google.golang.org/grpc/health/grpc_health_v1/health.pb.go @@ -1,17 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. -// source: grpc_health_v1/health.proto +// source: grpc/health/v1/health.proto -/* -Package grpc_health_v1 is a generated protocol buffer package. - -It is generated from these files: - grpc_health_v1/health.proto - -It has these top-level messages: - HealthCheckRequest - HealthCheckResponse -*/ -package grpc_health_v1 +package grpc_health_v1 // import "google.golang.org/grpc/health/grpc_health_v1" import proto "github.com/golang/protobuf/proto" import fmt "fmt" @@ -56,17 +46,39 @@ func (x HealthCheckResponse_ServingStatus) String() string { return proto.EnumName(HealthCheckResponse_ServingStatus_name, int32(x)) } func (HealthCheckResponse_ServingStatus) EnumDescriptor() ([]byte, []int) { - return fileDescriptor0, []int{1, 0} + return fileDescriptor_health_85731b6c49265086, []int{1, 0} } type HealthCheckRequest struct { - Service string `protobuf:"bytes,1,opt,name=service" json:"service,omitempty"` + Service string `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HealthCheckRequest) Reset() { *m = HealthCheckRequest{} } +func (m *HealthCheckRequest) String() string { return proto.CompactTextString(m) } +func (*HealthCheckRequest) ProtoMessage() {} +func (*HealthCheckRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_health_85731b6c49265086, []int{0} +} +func (m *HealthCheckRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_HealthCheckRequest.Unmarshal(m, b) +} +func (m *HealthCheckRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_HealthCheckRequest.Marshal(b, m, deterministic) +} +func (dst *HealthCheckRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_HealthCheckRequest.Merge(dst, src) +} +func (m *HealthCheckRequest) XXX_Size() int { + return xxx_messageInfo_HealthCheckRequest.Size(m) +} +func (m *HealthCheckRequest) XXX_DiscardUnknown() { + xxx_messageInfo_HealthCheckRequest.DiscardUnknown(m) } -func (m *HealthCheckRequest) Reset() { *m = HealthCheckRequest{} } -func (m *HealthCheckRequest) String() string { return proto.CompactTextString(m) } -func (*HealthCheckRequest) ProtoMessage() {} -func (*HealthCheckRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } +var xxx_messageInfo_HealthCheckRequest proto.InternalMessageInfo func (m *HealthCheckRequest) GetService() string { if m != nil { @@ -76,13 +88,35 @@ func (m *HealthCheckRequest) GetService() string { } type HealthCheckResponse struct { - Status HealthCheckResponse_ServingStatus `protobuf:"varint,1,opt,name=status,enum=grpc.health.v1.HealthCheckResponse_ServingStatus" json:"status,omitempty"` + Status HealthCheckResponse_ServingStatus `protobuf:"varint,1,opt,name=status,proto3,enum=grpc.health.v1.HealthCheckResponse_ServingStatus" json:"status,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *HealthCheckResponse) Reset() { *m = HealthCheckResponse{} } -func (m *HealthCheckResponse) String() string { return proto.CompactTextString(m) } -func (*HealthCheckResponse) ProtoMessage() {} -func (*HealthCheckResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } +func (m *HealthCheckResponse) Reset() { *m = HealthCheckResponse{} } +func (m *HealthCheckResponse) String() string { return proto.CompactTextString(m) } +func (*HealthCheckResponse) ProtoMessage() {} +func (*HealthCheckResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_health_85731b6c49265086, []int{1} +} +func (m *HealthCheckResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_HealthCheckResponse.Unmarshal(m, b) +} +func (m *HealthCheckResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_HealthCheckResponse.Marshal(b, m, deterministic) +} +func (dst *HealthCheckResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_HealthCheckResponse.Merge(dst, src) +} +func (m *HealthCheckResponse) XXX_Size() int { + return xxx_messageInfo_HealthCheckResponse.Size(m) +} +func (m *HealthCheckResponse) XXX_DiscardUnknown() { + xxx_messageInfo_HealthCheckResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_HealthCheckResponse proto.InternalMessageInfo func (m *HealthCheckResponse) GetStatus() HealthCheckResponse_ServingStatus { if m != nil { @@ -105,8 +139,9 @@ var _ grpc.ClientConn // is compatible with the grpc package it is being compiled against. const _ = grpc.SupportPackageIsVersion4 -// Client API for Health service - +// HealthClient is the client API for Health service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type HealthClient interface { Check(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (*HealthCheckResponse, error) } @@ -121,15 +156,14 @@ func NewHealthClient(cc *grpc.ClientConn) HealthClient { func (c *healthClient) Check(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (*HealthCheckResponse, error) { out := new(HealthCheckResponse) - err := grpc.Invoke(ctx, "/grpc.health.v1.Health/Check", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/grpc.health.v1.Health/Check", in, out, opts...) if err != nil { return nil, err } return out, nil } -// Server API for Health service - +// HealthServer is the server API for Health service. type HealthServer interface { Check(context.Context, *HealthCheckRequest) (*HealthCheckResponse, error) } @@ -166,25 +200,28 @@ var _Health_serviceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "grpc_health_v1/health.proto", + Metadata: "grpc/health/v1/health.proto", } -func init() { proto.RegisterFile("grpc_health_v1/health.proto", fileDescriptor0) } +func init() { proto.RegisterFile("grpc/health/v1/health.proto", fileDescriptor_health_85731b6c49265086) } -var fileDescriptor0 = []byte{ - // 213 bytes of a gzipped FileDescriptorProto +var fileDescriptor_health_85731b6c49265086 = []byte{ + // 271 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4e, 0x2f, 0x2a, 0x48, - 0x8e, 0xcf, 0x48, 0x4d, 0xcc, 0x29, 0xc9, 0x88, 0x2f, 0x33, 0xd4, 0x87, 0xb0, 0xf4, 0x0a, 0x8a, - 0xf2, 0x4b, 0xf2, 0x85, 0xf8, 0x40, 0x92, 0x7a, 0x50, 0xa1, 0x32, 0x43, 0x25, 0x3d, 0x2e, 0x21, - 0x0f, 0x30, 0xc7, 0x39, 0x23, 0x35, 0x39, 0x3b, 0x28, 0xb5, 0xb0, 0x34, 0xb5, 0xb8, 0x44, 0x48, - 0x82, 0x8b, 0xbd, 0x38, 0xb5, 0xa8, 0x2c, 0x33, 0x39, 0x55, 0x82, 0x51, 0x81, 0x51, 0x83, 0x33, - 0x08, 0xc6, 0x55, 0x9a, 0xc3, 0xc8, 0x25, 0x8c, 0xa2, 0xa1, 0xb8, 0x20, 0x3f, 0xaf, 0x38, 0x55, - 0xc8, 0x93, 0x8b, 0xad, 0xb8, 0x24, 0xb1, 0xa4, 0xb4, 0x18, 0xac, 0x81, 0xcf, 0xc8, 0x50, 0x0f, - 0xd5, 0x22, 0x3d, 0x2c, 0x9a, 0xf4, 0x82, 0x41, 0x86, 0xe6, 0xa5, 0x07, 0x83, 0x35, 0x06, 0x41, - 0x0d, 0x50, 0xb2, 0xe2, 0xe2, 0x45, 0x91, 0x10, 0xe2, 0xe6, 0x62, 0x0f, 0xf5, 0xf3, 0xf6, 0xf3, - 0x0f, 0xf7, 0x13, 0x60, 0x00, 0x71, 0x82, 0x5d, 0x83, 0xc2, 0x3c, 0xfd, 0xdc, 0x05, 0x18, 0x85, - 0xf8, 0xb9, 0xb8, 0xfd, 0xfc, 0x43, 0xe2, 0x61, 0x02, 0x4c, 0x46, 0x51, 0x5c, 0x6c, 0x10, 0x8b, - 0x84, 0x02, 0xb8, 0x58, 0xc1, 0x96, 0x09, 0x29, 0xe1, 0x75, 0x09, 0xd8, 0xbf, 0x52, 0xca, 0x44, - 0xb8, 0x36, 0x89, 0x0d, 0x1c, 0x82, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x53, 0x2b, 0x65, - 0x20, 0x60, 0x01, 0x00, 0x00, + 0xd6, 0xcf, 0x48, 0x4d, 0xcc, 0x29, 0xc9, 0xd0, 0x2f, 0x33, 0x84, 0xb2, 0xf4, 0x0a, 0x8a, 0xf2, + 0x4b, 0xf2, 0x85, 0xf8, 0x40, 0x92, 0x7a, 0x50, 0xa1, 0x32, 0x43, 0x25, 0x3d, 0x2e, 0x21, 0x0f, + 0x30, 0xc7, 0x39, 0x23, 0x35, 0x39, 0x3b, 0x28, 0xb5, 0xb0, 0x34, 0xb5, 0xb8, 0x44, 0x48, 0x82, + 0x8b, 0xbd, 0x38, 0xb5, 0xa8, 0x2c, 0x33, 0x39, 0x55, 0x82, 0x51, 0x81, 0x51, 0x83, 0x33, 0x08, + 0xc6, 0x55, 0x9a, 0xc3, 0xc8, 0x25, 0x8c, 0xa2, 0xa1, 0xb8, 0x20, 0x3f, 0xaf, 0x38, 0x55, 0xc8, + 0x93, 0x8b, 0xad, 0xb8, 0x24, 0xb1, 0xa4, 0xb4, 0x18, 0xac, 0x81, 0xcf, 0xc8, 0x50, 0x0f, 0xd5, + 0x22, 0x3d, 0x2c, 0x9a, 0xf4, 0x82, 0x41, 0x86, 0xe6, 0xa5, 0x07, 0x83, 0x35, 0x06, 0x41, 0x0d, + 0x50, 0xb2, 0xe2, 0xe2, 0x45, 0x91, 0x10, 0xe2, 0xe6, 0x62, 0x0f, 0xf5, 0xf3, 0xf6, 0xf3, 0x0f, + 0xf7, 0x13, 0x60, 0x00, 0x71, 0x82, 0x5d, 0x83, 0xc2, 0x3c, 0xfd, 0xdc, 0x05, 0x18, 0x85, 0xf8, + 0xb9, 0xb8, 0xfd, 0xfc, 0x43, 0xe2, 0x61, 0x02, 0x4c, 0x46, 0x51, 0x5c, 0x6c, 0x10, 0x8b, 0x84, + 0x02, 0xb8, 0x58, 0xc1, 0x96, 0x09, 0x29, 0xe1, 0x75, 0x09, 0xd8, 0xbf, 0x52, 0xca, 0x44, 0xb8, + 0xd6, 0x29, 0x91, 0x4b, 0x30, 0x33, 0x1f, 0x4d, 0xa1, 0x13, 0x37, 0x44, 0x65, 0x00, 0x28, 0x70, + 0x03, 0x18, 0xa3, 0x74, 0xd2, 0xf3, 0xf3, 0xd3, 0x73, 0x52, 0xf5, 0xd2, 0xf3, 0x73, 0x12, 0xf3, + 0xd2, 0xf5, 0xf2, 0x8b, 0xd2, 0xf5, 0x91, 0x63, 0x03, 0xc4, 0x8e, 0x87, 0xb0, 0xe3, 0xcb, 0x0c, + 0x57, 0x31, 0xf1, 0xb9, 0x83, 0x4c, 0x83, 0x18, 0xa1, 0x17, 0x66, 0x98, 0xc4, 0x06, 0x8e, 0x24, + 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0xec, 0x66, 0x81, 0xcb, 0xc3, 0x01, 0x00, 0x00, } diff --git a/vendor/google.golang.org/grpc/health/grpc_health_v1/health.proto b/vendor/google.golang.org/grpc/health/grpc_health_v1/health.proto deleted file mode 100644 index 6072fdc3b..000000000 --- a/vendor/google.golang.org/grpc/health/grpc_health_v1/health.proto +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2017 gRPC authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package grpc.health.v1; - -message HealthCheckRequest { - string service = 1; -} - -message HealthCheckResponse { - enum ServingStatus { - UNKNOWN = 0; - SERVING = 1; - NOT_SERVING = 2; - } - ServingStatus status = 1; -} - -service Health{ - rpc Check(HealthCheckRequest) returns (HealthCheckResponse); -} diff --git a/vendor/google.golang.org/grpc/health/health.go b/vendor/google.golang.org/grpc/health/health.go index 30a78667e..c2588867e 100644 --- a/vendor/google.golang.org/grpc/health/health.go +++ b/vendor/google.golang.org/grpc/health/health.go @@ -16,7 +16,7 @@ * */ -//go:generate protoc --go_out=plugins=grpc:. grpc_health_v1/health.proto +//go:generate ./regenerate.sh // Package health provides some utility functions to health-check a server. The implementation // is based on protobuf. Users need to write their own implementations if other IDLs are used. diff --git a/vendor/google.golang.org/grpc/health/regenerate.sh b/vendor/google.golang.org/grpc/health/regenerate.sh new file mode 100755 index 000000000..b11eccb29 --- /dev/null +++ b/vendor/google.golang.org/grpc/health/regenerate.sh @@ -0,0 +1,33 @@ +#!/bin/bash +# Copyright 2018 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -eux -o pipefail + +TMP=$(mktemp -d) + +function finish { + rm -rf "$TMP" +} +trap finish EXIT + +pushd "$TMP" +mkdir -p grpc/health/v1 +curl https://raw.githubusercontent.com/grpc/grpc-proto/master/grpc/health/v1/health.proto > grpc/health/v1/health.proto + +protoc --go_out=plugins=grpc,paths=source_relative:. -I. grpc/health/v1/*.proto +popd +rm -f grpc_health_v1/*.pb.go +cp "$TMP"/grpc/health/v1/*.pb.go grpc_health_v1/ + diff --git a/vendor/google.golang.org/grpc/install_gae.sh b/vendor/google.golang.org/grpc/install_gae.sh new file mode 100755 index 000000000..d4236f3b8 --- /dev/null +++ b/vendor/google.golang.org/grpc/install_gae.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +TMP=$(mktemp -d /tmp/sdk.XXX) \ +&& curl -o $TMP.zip "https://storage.googleapis.com/appengine-sdks/featured/go_appengine_sdk_linux_amd64-1.9.64.zip" \ +&& unzip -q $TMP.zip -d $TMP \ +&& export PATH="$PATH:$TMP/go_appengine" diff --git a/vendor/google.golang.org/grpc/internal/backoff/backoff.go b/vendor/google.golang.org/grpc/internal/backoff/backoff.go new file mode 100644 index 000000000..1bd0cce5a --- /dev/null +++ b/vendor/google.golang.org/grpc/internal/backoff/backoff.go @@ -0,0 +1,78 @@ +/* + * + * Copyright 2017 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// Package backoff implement the backoff strategy for gRPC. +// +// This is kept in internal until the gRPC project decides whether or not to +// allow alternative backoff strategies. +package backoff + +import ( + "time" + + "google.golang.org/grpc/internal/grpcrand" +) + +// Strategy defines the methodology for backing off after a grpc connection +// failure. +// +type Strategy interface { + // Backoff returns the amount of time to wait before the next retry given + // the number of consecutive failures. + Backoff(retries int) time.Duration +} + +const ( + // baseDelay is the amount of time to wait before retrying after the first + // failure. + baseDelay = 1.0 * time.Second + // factor is applied to the backoff after each retry. + factor = 1.6 + // jitter provides a range to randomize backoff delays. + jitter = 0.2 +) + +// Exponential implements exponential backoff algorithm as defined in +// https://github.com/grpc/grpc/blob/master/doc/connection-backoff.md. +type Exponential struct { + // MaxDelay is the upper bound of backoff delay. + MaxDelay time.Duration +} + +// Backoff returns the amount of time to wait before the next retry given the +// number of retries. +func (bc Exponential) Backoff(retries int) time.Duration { + if retries == 0 { + return baseDelay + } + backoff, max := float64(baseDelay), float64(bc.MaxDelay) + for backoff < max && retries > 0 { + backoff *= factor + retries-- + } + if backoff > max { + backoff = max + } + // Randomize backoff delays so that if a cluster of requests start at + // the same time, they won't operate in lockstep. + backoff *= 1 + jitter*(grpcrand.Float64()*2-1) + if backoff < 0 { + return 0 + } + return time.Duration(backoff) +} diff --git a/vendor/google.golang.org/grpc/channelz/funcs.go b/vendor/google.golang.org/grpc/internal/channelz/funcs.go similarity index 100% rename from vendor/google.golang.org/grpc/channelz/funcs.go rename to vendor/google.golang.org/grpc/internal/channelz/funcs.go diff --git a/vendor/google.golang.org/grpc/channelz/types.go b/vendor/google.golang.org/grpc/internal/channelz/types.go similarity index 98% rename from vendor/google.golang.org/grpc/channelz/types.go rename to vendor/google.golang.org/grpc/internal/channelz/types.go index 153d75340..6fd6bb388 100644 --- a/vendor/google.golang.org/grpc/channelz/types.go +++ b/vendor/google.golang.org/grpc/internal/channelz/types.go @@ -23,6 +23,7 @@ import ( "time" "google.golang.org/grpc/connectivity" + "google.golang.org/grpc/credentials" "google.golang.org/grpc/grpclog" ) @@ -281,9 +282,9 @@ type SocketInternalMetric struct { RemoteAddr net.Addr // Optional, represents the name of the remote endpoint, if different than // the original target name. - RemoteName string - //TODO: socket options - //TODO: Security + RemoteName string + SocketOptions *SocketOptionData + Security credentials.ChannelzSecurityValue } // Socket is the interface that should be satisfied in order to be tracked by diff --git a/vendor/google.golang.org/grpc/internal/channelz/types_linux.go b/vendor/google.golang.org/grpc/internal/channelz/types_linux.go new file mode 100644 index 000000000..132b77027 --- /dev/null +++ b/vendor/google.golang.org/grpc/internal/channelz/types_linux.go @@ -0,0 +1,54 @@ +// +build !appengine + +/* + * + * Copyright 2018 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package channelz + +import ( + "syscall" + + "golang.org/x/sys/unix" +) + +// SocketOptionData defines the struct to hold socket option data, and related +// getter function to obtain info from fd. +type SocketOptionData struct { + Linger *unix.Linger + RecvTimeout *unix.Timeval + SendTimeout *unix.Timeval + TCPInfo *unix.TCPInfo +} + +// Getsockopt defines the function to get socket options requested by channelz. +// It is to be passed to syscall.RawConn.Control(). +func (s *SocketOptionData) Getsockopt(fd uintptr) { + if v, err := unix.GetsockoptLinger(int(fd), syscall.SOL_SOCKET, syscall.SO_LINGER); err == nil { + s.Linger = v + } + if v, err := unix.GetsockoptTimeval(int(fd), syscall.SOL_SOCKET, syscall.SO_RCVTIMEO); err == nil { + s.RecvTimeout = v + } + if v, err := unix.GetsockoptTimeval(int(fd), syscall.SOL_SOCKET, syscall.SO_SNDTIMEO); err == nil { + s.SendTimeout = v + } + if v, err := unix.GetsockoptTCPInfo(int(fd), syscall.SOL_TCP, syscall.TCP_INFO); err == nil { + s.TCPInfo = v + } + return +} diff --git a/vendor/google.golang.org/grpc/internal/channelz/types_nonlinux.go b/vendor/google.golang.org/grpc/internal/channelz/types_nonlinux.go new file mode 100644 index 000000000..c4e7949c7 --- /dev/null +++ b/vendor/google.golang.org/grpc/internal/channelz/types_nonlinux.go @@ -0,0 +1,38 @@ +// +build !linux appengine + +/* + * + * Copyright 2018 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package channelz + +import "google.golang.org/grpc/grpclog" + +func init() { + grpclog.Infof("Channelz: socket options are not supported on non-linux os and appengine.") +} + +// SocketOptionData defines the struct to hold socket option data, and related +// getter function to obtain info from fd. +// Windows OS doesn't support Socket Option +type SocketOptionData struct { +} + +// Getsockopt defines the function to get socket options requested by channelz. +// It is to be passed to syscall.RawConn.Control(). +// Windows OS doesn't support Socket Option +func (s *SocketOptionData) Getsockopt(fd uintptr) {} diff --git a/vendor/google.golang.org/grpc/internal/channelz/util_linux_go19.go b/vendor/google.golang.org/grpc/internal/channelz/util_linux_go19.go new file mode 100644 index 000000000..e1e9e32d7 --- /dev/null +++ b/vendor/google.golang.org/grpc/internal/channelz/util_linux_go19.go @@ -0,0 +1,39 @@ +// +build linux,go1.9,!appengine + +/* + * + * Copyright 2018 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package channelz + +import ( + "syscall" +) + +// GetSocketOption gets the socket option info of the conn. +func GetSocketOption(socket interface{}) *SocketOptionData { + c, ok := socket.(syscall.Conn) + if !ok { + return nil + } + data := &SocketOptionData{} + if rawConn, err := c.SyscallConn(); err == nil { + rawConn.Control(data.Getsockopt) + return data + } + return nil +} diff --git a/vendor/google.golang.org/grpc/internal/channelz/util_nonlinux_pre_go19.go b/vendor/google.golang.org/grpc/internal/channelz/util_nonlinux_pre_go19.go new file mode 100644 index 000000000..1d4da952d --- /dev/null +++ b/vendor/google.golang.org/grpc/internal/channelz/util_nonlinux_pre_go19.go @@ -0,0 +1,26 @@ +// +build !linux !go1.9 appengine + +/* + * + * Copyright 2018 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package channelz + +// GetSocketOption gets the socket option info of the conn. +func GetSocketOption(c interface{}) *SocketOptionData { + return nil +} diff --git a/vendor/google.golang.org/grpc/envconfig.go b/vendor/google.golang.org/grpc/internal/envconfig/envconfig.go similarity index 70% rename from vendor/google.golang.org/grpc/envconfig.go rename to vendor/google.golang.org/grpc/internal/envconfig/envconfig.go index d50178e51..3ee8740f1 100644 --- a/vendor/google.golang.org/grpc/envconfig.go +++ b/vendor/google.golang.org/grpc/internal/envconfig/envconfig.go @@ -16,7 +16,8 @@ * */ -package grpc +// Package envconfig contains grpc settings configured by environment variables. +package envconfig import ( "os" @@ -24,14 +25,11 @@ import ( ) const ( - envConfigPrefix = "GRPC_GO_" - envConfigStickinessStr = envConfigPrefix + "STICKINESS" + prefix = "GRPC_GO_" + retryStr = prefix + "RETRY" ) var ( - envConfigStickinessOn bool + // Retry is set if retry is explicitly enabled via "GRPC_GO_RETRY=on". + Retry = strings.EqualFold(os.Getenv(retryStr), "on") ) - -func init() { - envConfigStickinessOn = strings.EqualFold(os.Getenv(envConfigStickinessStr), "on") -} diff --git a/vendor/google.golang.org/grpc/internal/grpcrand/grpcrand.go b/vendor/google.golang.org/grpc/internal/grpcrand/grpcrand.go new file mode 100644 index 000000000..200b115ca --- /dev/null +++ b/vendor/google.golang.org/grpc/internal/grpcrand/grpcrand.go @@ -0,0 +1,56 @@ +/* + * + * Copyright 2018 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// Package grpcrand implements math/rand functions in a concurrent-safe way +// with a global random source, independent of math/rand's global source. +package grpcrand + +import ( + "math/rand" + "sync" + "time" +) + +var ( + r = rand.New(rand.NewSource(time.Now().UnixNano())) + mu sync.Mutex +) + +// Int63n implements rand.Int63n on the grpcrand global source. +func Int63n(n int64) int64 { + mu.Lock() + res := r.Int63n(n) + mu.Unlock() + return res +} + +// Intn implements rand.Intn on the grpcrand global source. +func Intn(n int) int { + mu.Lock() + res := r.Intn(n) + mu.Unlock() + return res +} + +// Float64 implements rand.Float64 on the grpcrand global source. +func Float64() float64 { + mu.Lock() + res := r.Float64() + mu.Unlock() + return res +} diff --git a/vendor/google.golang.org/grpc/internal/internal.go b/vendor/google.golang.org/grpc/internal/internal.go index 53f177520..cd34267f7 100644 --- a/vendor/google.golang.org/grpc/internal/internal.go +++ b/vendor/google.golang.org/grpc/internal/internal.go @@ -15,13 +15,22 @@ * */ -// Package internal contains gRPC-internal code for testing, to avoid polluting -// the godoc of the top-level grpc package. +// Package internal contains gRPC-internal code, to avoid polluting +// the godoc of the top-level grpc package. It must not import any grpc +// symbols to avoid circular dependencies. package internal -// TestingUseHandlerImpl enables the http.Handler-based server implementation. -// It must be called before Serve and requires TLS credentials. -// -// The provided grpcServer must be of type *grpc.Server. It is untyped -// for circular dependency reasons. -var TestingUseHandlerImpl func(grpcServer interface{}) +var ( + + // TestingUseHandlerImpl enables the http.Handler-based server implementation. + // It must be called before Serve and requires TLS credentials. + // + // The provided grpcServer must be of type *grpc.Server. It is untyped + // for circular dependency reasons. + TestingUseHandlerImpl func(grpcServer interface{}) + + // WithContextDialer is exported by clientconn.go + WithContextDialer interface{} // func(context.Context, string) (net.Conn, error) grpc.DialOption + // WithResolverBuilder is exported by clientconn.go + WithResolverBuilder interface{} // func (resolver.Builder) grpc.DialOption +) diff --git a/vendor/google.golang.org/grpc/test/leakcheck/leakcheck.go b/vendor/google.golang.org/grpc/internal/leakcheck/leakcheck.go similarity index 100% rename from vendor/google.golang.org/grpc/test/leakcheck/leakcheck.go rename to vendor/google.golang.org/grpc/internal/leakcheck/leakcheck.go diff --git a/vendor/google.golang.org/grpc/interop/client/client.go b/vendor/google.golang.org/grpc/interop/client/client.go index 510525304..07d1f48c2 100644 --- a/vendor/google.golang.org/grpc/interop/client/client.go +++ b/vendor/google.golang.org/grpc/interop/client/client.go @@ -24,12 +24,14 @@ import ( "strconv" "google.golang.org/grpc" + _ "google.golang.org/grpc/balancer/grpclb" "google.golang.org/grpc/credentials" "google.golang.org/grpc/credentials/alts" "google.golang.org/grpc/credentials/oauth" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/interop" testpb "google.golang.org/grpc/interop/grpc_testing" + "google.golang.org/grpc/resolver" "google.golang.org/grpc/testdata" ) @@ -69,6 +71,7 @@ var ( func main() { flag.Parse() + resolver.SetDefaultScheme("dns") if *useTLS && *useALTS { grpclog.Fatalf("use_tls and use_alts cannot be both set to true") } @@ -93,6 +96,17 @@ func main() { creds = credentials.NewClientTLSFromCert(nil, sn) } opts = append(opts, grpc.WithTransportCredentials(creds)) + } else if *useALTS { + altsOpts := alts.DefaultClientOptions() + if *altsHSAddr != "" { + altsOpts.HandshakerServiceAddress = *altsHSAddr + } + altsTC := alts.NewClientCreds(altsOpts) + opts = append(opts, grpc.WithTransportCredentials(altsTC)) + } else { + opts = append(opts, grpc.WithInsecure()) + } + if *useTLS || *useALTS { if *testCase == "compute_engine_creds" { opts = append(opts, grpc.WithPerRPCCredentials(oauth.NewComputeEngine())) } else if *testCase == "service_account_creds" { @@ -110,15 +124,6 @@ func main() { } else if *testCase == "oauth2_auth_token" { opts = append(opts, grpc.WithPerRPCCredentials(oauth.NewOauthAccess(interop.GetToken(*serviceAccountKeyFile, *oauthScope)))) } - } else if *useALTS { - altsOpts := alts.DefaultClientOptions() - if *altsHSAddr != "" { - altsOpts.HandshakerServiceAddress = *altsHSAddr - } - altsTC := alts.NewClientCreds(altsOpts) - opts = append(opts, grpc.WithTransportCredentials(altsTC)) - } else { - opts = append(opts, grpc.WithInsecure()) } opts = append(opts, grpc.WithBlock()) conn, err := grpc.Dial(serverAddr, opts...) @@ -130,73 +135,73 @@ func main() { switch *testCase { case "empty_unary": interop.DoEmptyUnaryCall(tc) - grpclog.Println("EmptyUnaryCall done") + grpclog.Infoln("EmptyUnaryCall done") case "large_unary": interop.DoLargeUnaryCall(tc) - grpclog.Println("LargeUnaryCall done") + grpclog.Infoln("LargeUnaryCall done") case "client_streaming": interop.DoClientStreaming(tc) - grpclog.Println("ClientStreaming done") + grpclog.Infoln("ClientStreaming done") case "server_streaming": interop.DoServerStreaming(tc) - grpclog.Println("ServerStreaming done") + grpclog.Infoln("ServerStreaming done") case "ping_pong": interop.DoPingPong(tc) - grpclog.Println("Pingpong done") + grpclog.Infoln("Pingpong done") case "empty_stream": interop.DoEmptyStream(tc) - grpclog.Println("Emptystream done") + grpclog.Infoln("Emptystream done") case "timeout_on_sleeping_server": interop.DoTimeoutOnSleepingServer(tc) - grpclog.Println("TimeoutOnSleepingServer done") + grpclog.Infoln("TimeoutOnSleepingServer done") case "compute_engine_creds": if !*useTLS { grpclog.Fatalf("TLS is not enabled. TLS is required to execute compute_engine_creds test case.") } interop.DoComputeEngineCreds(tc, *defaultServiceAccount, *oauthScope) - grpclog.Println("ComputeEngineCreds done") + grpclog.Infoln("ComputeEngineCreds done") case "service_account_creds": if !*useTLS { grpclog.Fatalf("TLS is not enabled. TLS is required to execute service_account_creds test case.") } interop.DoServiceAccountCreds(tc, *serviceAccountKeyFile, *oauthScope) - grpclog.Println("ServiceAccountCreds done") + grpclog.Infoln("ServiceAccountCreds done") case "jwt_token_creds": if !*useTLS { grpclog.Fatalf("TLS is not enabled. TLS is required to execute jwt_token_creds test case.") } interop.DoJWTTokenCreds(tc, *serviceAccountKeyFile) - grpclog.Println("JWTtokenCreds done") + grpclog.Infoln("JWTtokenCreds done") case "per_rpc_creds": if !*useTLS { grpclog.Fatalf("TLS is not enabled. TLS is required to execute per_rpc_creds test case.") } interop.DoPerRPCCreds(tc, *serviceAccountKeyFile, *oauthScope) - grpclog.Println("PerRPCCreds done") + grpclog.Infoln("PerRPCCreds done") case "oauth2_auth_token": if !*useTLS { grpclog.Fatalf("TLS is not enabled. TLS is required to execute oauth2_auth_token test case.") } interop.DoOauth2TokenCreds(tc, *serviceAccountKeyFile, *oauthScope) - grpclog.Println("Oauth2TokenCreds done") + grpclog.Infoln("Oauth2TokenCreds done") case "cancel_after_begin": interop.DoCancelAfterBegin(tc) - grpclog.Println("CancelAfterBegin done") + grpclog.Infoln("CancelAfterBegin done") case "cancel_after_first_response": interop.DoCancelAfterFirstResponse(tc) - grpclog.Println("CancelAfterFirstResponse done") + grpclog.Infoln("CancelAfterFirstResponse done") case "status_code_and_message": interop.DoStatusCodeAndMessage(tc) - grpclog.Println("StatusCodeAndMessage done") + grpclog.Infoln("StatusCodeAndMessage done") case "custom_metadata": interop.DoCustomMetadata(tc) - grpclog.Println("CustomMetadata done") + grpclog.Infoln("CustomMetadata done") case "unimplemented_method": interop.DoUnimplementedMethod(conn) - grpclog.Println("UnimplementedMethod done") + grpclog.Infoln("UnimplementedMethod done") case "unimplemented_service": interop.DoUnimplementedService(testpb.NewUnimplementedServiceClient(conn)) - grpclog.Println("UnimplementedService done") + grpclog.Infoln("UnimplementedService done") default: grpclog.Fatal("Unsupported test case: ", *testCase) } diff --git a/vendor/google.golang.org/grpc/interop/grpc_testing/test.pb.go b/vendor/google.golang.org/grpc/interop/grpc_testing/test.pb.go index 1e7a9abdf..bb5e2eeb3 100644 --- a/vendor/google.golang.org/grpc/interop/grpc_testing/test.pb.go +++ b/vendor/google.golang.org/grpc/interop/grpc_testing/test.pb.go @@ -1,24 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // source: grpc_testing/test.proto -/* -Package grpc_testing is a generated protocol buffer package. - -It is generated from these files: - grpc_testing/test.proto - -It has these top-level messages: - Empty - Payload - EchoStatus - SimpleRequest - SimpleResponse - StreamingInputCallRequest - StreamingInputCallResponse - ResponseParameters - StreamingOutputCallRequest - StreamingOutputCallResponse -*/ package grpc_testing import proto "github.com/golang/protobuf/proto" @@ -67,28 +49,74 @@ var PayloadType_value = map[string]int32{ func (x PayloadType) String() string { return proto.EnumName(PayloadType_name, int32(x)) } -func (PayloadType) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } +func (PayloadType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_test_4001f755b984bb27, []int{0} +} type Empty struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Empty) Reset() { *m = Empty{} } +func (m *Empty) String() string { return proto.CompactTextString(m) } +func (*Empty) ProtoMessage() {} +func (*Empty) Descriptor() ([]byte, []int) { + return fileDescriptor_test_4001f755b984bb27, []int{0} +} +func (m *Empty) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Empty.Unmarshal(m, b) +} +func (m *Empty) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Empty.Marshal(b, m, deterministic) +} +func (dst *Empty) XXX_Merge(src proto.Message) { + xxx_messageInfo_Empty.Merge(dst, src) +} +func (m *Empty) XXX_Size() int { + return xxx_messageInfo_Empty.Size(m) +} +func (m *Empty) XXX_DiscardUnknown() { + xxx_messageInfo_Empty.DiscardUnknown(m) } -func (m *Empty) Reset() { *m = Empty{} } -func (m *Empty) String() string { return proto.CompactTextString(m) } -func (*Empty) ProtoMessage() {} -func (*Empty) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } +var xxx_messageInfo_Empty proto.InternalMessageInfo // A block of data, to simply increase gRPC message size. type Payload struct { // The type of data in body. - Type PayloadType `protobuf:"varint,1,opt,name=type,enum=grpc.testing.PayloadType" json:"type,omitempty"` + Type PayloadType `protobuf:"varint,1,opt,name=type,proto3,enum=grpc.testing.PayloadType" json:"type,omitempty"` // Primary contents of payload. - Body []byte `protobuf:"bytes,2,opt,name=body,proto3" json:"body,omitempty"` + Body []byte `protobuf:"bytes,2,opt,name=body,proto3" json:"body,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *Payload) Reset() { *m = Payload{} } -func (m *Payload) String() string { return proto.CompactTextString(m) } -func (*Payload) ProtoMessage() {} -func (*Payload) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } +func (m *Payload) Reset() { *m = Payload{} } +func (m *Payload) String() string { return proto.CompactTextString(m) } +func (*Payload) ProtoMessage() {} +func (*Payload) Descriptor() ([]byte, []int) { + return fileDescriptor_test_4001f755b984bb27, []int{1} +} +func (m *Payload) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Payload.Unmarshal(m, b) +} +func (m *Payload) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Payload.Marshal(b, m, deterministic) +} +func (dst *Payload) XXX_Merge(src proto.Message) { + xxx_messageInfo_Payload.Merge(dst, src) +} +func (m *Payload) XXX_Size() int { + return xxx_messageInfo_Payload.Size(m) +} +func (m *Payload) XXX_DiscardUnknown() { + xxx_messageInfo_Payload.DiscardUnknown(m) +} + +var xxx_messageInfo_Payload proto.InternalMessageInfo func (m *Payload) GetType() PayloadType { if m != nil { @@ -107,14 +135,36 @@ func (m *Payload) GetBody() []byte { // A protobuf representation for grpc status. This is used by test // clients to specify a status that the server should attempt to return. type EchoStatus struct { - Code int32 `protobuf:"varint,1,opt,name=code" json:"code,omitempty"` - Message string `protobuf:"bytes,2,opt,name=message" json:"message,omitempty"` + Code int32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"` + Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *EchoStatus) Reset() { *m = EchoStatus{} } +func (m *EchoStatus) String() string { return proto.CompactTextString(m) } +func (*EchoStatus) ProtoMessage() {} +func (*EchoStatus) Descriptor() ([]byte, []int) { + return fileDescriptor_test_4001f755b984bb27, []int{2} +} +func (m *EchoStatus) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_EchoStatus.Unmarshal(m, b) +} +func (m *EchoStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_EchoStatus.Marshal(b, m, deterministic) +} +func (dst *EchoStatus) XXX_Merge(src proto.Message) { + xxx_messageInfo_EchoStatus.Merge(dst, src) +} +func (m *EchoStatus) XXX_Size() int { + return xxx_messageInfo_EchoStatus.Size(m) +} +func (m *EchoStatus) XXX_DiscardUnknown() { + xxx_messageInfo_EchoStatus.DiscardUnknown(m) } -func (m *EchoStatus) Reset() { *m = EchoStatus{} } -func (m *EchoStatus) String() string { return proto.CompactTextString(m) } -func (*EchoStatus) ProtoMessage() {} -func (*EchoStatus) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } +var xxx_messageInfo_EchoStatus proto.InternalMessageInfo func (m *EchoStatus) GetCode() int32 { if m != nil { @@ -134,24 +184,46 @@ func (m *EchoStatus) GetMessage() string { type SimpleRequest struct { // Desired payload type in the response from the server. // If response_type is RANDOM, server randomly chooses one from other formats. - ResponseType PayloadType `protobuf:"varint,1,opt,name=response_type,json=responseType,enum=grpc.testing.PayloadType" json:"response_type,omitempty"` + ResponseType PayloadType `protobuf:"varint,1,opt,name=response_type,json=responseType,proto3,enum=grpc.testing.PayloadType" json:"response_type,omitempty"` // Desired payload size in the response from the server. // If response_type is COMPRESSABLE, this denotes the size before compression. - ResponseSize int32 `protobuf:"varint,2,opt,name=response_size,json=responseSize" json:"response_size,omitempty"` + ResponseSize int32 `protobuf:"varint,2,opt,name=response_size,json=responseSize,proto3" json:"response_size,omitempty"` // Optional input payload sent along with the request. - Payload *Payload `protobuf:"bytes,3,opt,name=payload" json:"payload,omitempty"` + Payload *Payload `protobuf:"bytes,3,opt,name=payload,proto3" json:"payload,omitempty"` // Whether SimpleResponse should include username. - FillUsername bool `protobuf:"varint,4,opt,name=fill_username,json=fillUsername" json:"fill_username,omitempty"` + FillUsername bool `protobuf:"varint,4,opt,name=fill_username,json=fillUsername,proto3" json:"fill_username,omitempty"` // Whether SimpleResponse should include OAuth scope. - FillOauthScope bool `protobuf:"varint,5,opt,name=fill_oauth_scope,json=fillOauthScope" json:"fill_oauth_scope,omitempty"` + FillOauthScope bool `protobuf:"varint,5,opt,name=fill_oauth_scope,json=fillOauthScope,proto3" json:"fill_oauth_scope,omitempty"` // Whether server should return a given status - ResponseStatus *EchoStatus `protobuf:"bytes,7,opt,name=response_status,json=responseStatus" json:"response_status,omitempty"` + ResponseStatus *EchoStatus `protobuf:"bytes,7,opt,name=response_status,json=responseStatus,proto3" json:"response_status,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SimpleRequest) Reset() { *m = SimpleRequest{} } +func (m *SimpleRequest) String() string { return proto.CompactTextString(m) } +func (*SimpleRequest) ProtoMessage() {} +func (*SimpleRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_test_4001f755b984bb27, []int{3} +} +func (m *SimpleRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SimpleRequest.Unmarshal(m, b) +} +func (m *SimpleRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SimpleRequest.Marshal(b, m, deterministic) +} +func (dst *SimpleRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_SimpleRequest.Merge(dst, src) +} +func (m *SimpleRequest) XXX_Size() int { + return xxx_messageInfo_SimpleRequest.Size(m) +} +func (m *SimpleRequest) XXX_DiscardUnknown() { + xxx_messageInfo_SimpleRequest.DiscardUnknown(m) } -func (m *SimpleRequest) Reset() { *m = SimpleRequest{} } -func (m *SimpleRequest) String() string { return proto.CompactTextString(m) } -func (*SimpleRequest) ProtoMessage() {} -func (*SimpleRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } +var xxx_messageInfo_SimpleRequest proto.InternalMessageInfo func (m *SimpleRequest) GetResponseType() PayloadType { if m != nil { @@ -198,18 +270,40 @@ func (m *SimpleRequest) GetResponseStatus() *EchoStatus { // Unary response, as configured by the request. type SimpleResponse struct { // Payload to increase message size. - Payload *Payload `protobuf:"bytes,1,opt,name=payload" json:"payload,omitempty"` + Payload *Payload `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"` // The user the request came from, for verifying authentication was // successful when the client expected it. - Username string `protobuf:"bytes,2,opt,name=username" json:"username,omitempty"` + Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"` // OAuth scope. - OauthScope string `protobuf:"bytes,3,opt,name=oauth_scope,json=oauthScope" json:"oauth_scope,omitempty"` + OauthScope string `protobuf:"bytes,3,opt,name=oauth_scope,json=oauthScope,proto3" json:"oauth_scope,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *SimpleResponse) Reset() { *m = SimpleResponse{} } -func (m *SimpleResponse) String() string { return proto.CompactTextString(m) } -func (*SimpleResponse) ProtoMessage() {} -func (*SimpleResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} } +func (m *SimpleResponse) Reset() { *m = SimpleResponse{} } +func (m *SimpleResponse) String() string { return proto.CompactTextString(m) } +func (*SimpleResponse) ProtoMessage() {} +func (*SimpleResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_test_4001f755b984bb27, []int{4} +} +func (m *SimpleResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SimpleResponse.Unmarshal(m, b) +} +func (m *SimpleResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SimpleResponse.Marshal(b, m, deterministic) +} +func (dst *SimpleResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_SimpleResponse.Merge(dst, src) +} +func (m *SimpleResponse) XXX_Size() int { + return xxx_messageInfo_SimpleResponse.Size(m) +} +func (m *SimpleResponse) XXX_DiscardUnknown() { + xxx_messageInfo_SimpleResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_SimpleResponse proto.InternalMessageInfo func (m *SimpleResponse) GetPayload() *Payload { if m != nil { @@ -235,13 +329,35 @@ func (m *SimpleResponse) GetOauthScope() string { // Client-streaming request. type StreamingInputCallRequest struct { // Optional input payload sent along with the request. - Payload *Payload `protobuf:"bytes,1,opt,name=payload" json:"payload,omitempty"` + Payload *Payload `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *StreamingInputCallRequest) Reset() { *m = StreamingInputCallRequest{} } -func (m *StreamingInputCallRequest) String() string { return proto.CompactTextString(m) } -func (*StreamingInputCallRequest) ProtoMessage() {} -func (*StreamingInputCallRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} } +func (m *StreamingInputCallRequest) Reset() { *m = StreamingInputCallRequest{} } +func (m *StreamingInputCallRequest) String() string { return proto.CompactTextString(m) } +func (*StreamingInputCallRequest) ProtoMessage() {} +func (*StreamingInputCallRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_test_4001f755b984bb27, []int{5} +} +func (m *StreamingInputCallRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_StreamingInputCallRequest.Unmarshal(m, b) +} +func (m *StreamingInputCallRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_StreamingInputCallRequest.Marshal(b, m, deterministic) +} +func (dst *StreamingInputCallRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_StreamingInputCallRequest.Merge(dst, src) +} +func (m *StreamingInputCallRequest) XXX_Size() int { + return xxx_messageInfo_StreamingInputCallRequest.Size(m) +} +func (m *StreamingInputCallRequest) XXX_DiscardUnknown() { + xxx_messageInfo_StreamingInputCallRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_StreamingInputCallRequest proto.InternalMessageInfo func (m *StreamingInputCallRequest) GetPayload() *Payload { if m != nil { @@ -253,13 +369,35 @@ func (m *StreamingInputCallRequest) GetPayload() *Payload { // Client-streaming response. type StreamingInputCallResponse struct { // Aggregated size of payloads received from the client. - AggregatedPayloadSize int32 `protobuf:"varint,1,opt,name=aggregated_payload_size,json=aggregatedPayloadSize" json:"aggregated_payload_size,omitempty"` + AggregatedPayloadSize int32 `protobuf:"varint,1,opt,name=aggregated_payload_size,json=aggregatedPayloadSize,proto3" json:"aggregated_payload_size,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *StreamingInputCallResponse) Reset() { *m = StreamingInputCallResponse{} } -func (m *StreamingInputCallResponse) String() string { return proto.CompactTextString(m) } -func (*StreamingInputCallResponse) ProtoMessage() {} -func (*StreamingInputCallResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} } +func (m *StreamingInputCallResponse) Reset() { *m = StreamingInputCallResponse{} } +func (m *StreamingInputCallResponse) String() string { return proto.CompactTextString(m) } +func (*StreamingInputCallResponse) ProtoMessage() {} +func (*StreamingInputCallResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_test_4001f755b984bb27, []int{6} +} +func (m *StreamingInputCallResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_StreamingInputCallResponse.Unmarshal(m, b) +} +func (m *StreamingInputCallResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_StreamingInputCallResponse.Marshal(b, m, deterministic) +} +func (dst *StreamingInputCallResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_StreamingInputCallResponse.Merge(dst, src) +} +func (m *StreamingInputCallResponse) XXX_Size() int { + return xxx_messageInfo_StreamingInputCallResponse.Size(m) +} +func (m *StreamingInputCallResponse) XXX_DiscardUnknown() { + xxx_messageInfo_StreamingInputCallResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_StreamingInputCallResponse proto.InternalMessageInfo func (m *StreamingInputCallResponse) GetAggregatedPayloadSize() int32 { if m != nil { @@ -272,16 +410,38 @@ func (m *StreamingInputCallResponse) GetAggregatedPayloadSize() int32 { type ResponseParameters struct { // Desired payload sizes in responses from the server. // If response_type is COMPRESSABLE, this denotes the size before compression. - Size int32 `protobuf:"varint,1,opt,name=size" json:"size,omitempty"` + Size int32 `protobuf:"varint,1,opt,name=size,proto3" json:"size,omitempty"` // Desired interval between consecutive responses in the response stream in // microseconds. - IntervalUs int32 `protobuf:"varint,2,opt,name=interval_us,json=intervalUs" json:"interval_us,omitempty"` + IntervalUs int32 `protobuf:"varint,2,opt,name=interval_us,json=intervalUs,proto3" json:"interval_us,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ResponseParameters) Reset() { *m = ResponseParameters{} } +func (m *ResponseParameters) String() string { return proto.CompactTextString(m) } +func (*ResponseParameters) ProtoMessage() {} +func (*ResponseParameters) Descriptor() ([]byte, []int) { + return fileDescriptor_test_4001f755b984bb27, []int{7} +} +func (m *ResponseParameters) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ResponseParameters.Unmarshal(m, b) +} +func (m *ResponseParameters) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ResponseParameters.Marshal(b, m, deterministic) +} +func (dst *ResponseParameters) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResponseParameters.Merge(dst, src) +} +func (m *ResponseParameters) XXX_Size() int { + return xxx_messageInfo_ResponseParameters.Size(m) +} +func (m *ResponseParameters) XXX_DiscardUnknown() { + xxx_messageInfo_ResponseParameters.DiscardUnknown(m) } -func (m *ResponseParameters) Reset() { *m = ResponseParameters{} } -func (m *ResponseParameters) String() string { return proto.CompactTextString(m) } -func (*ResponseParameters) ProtoMessage() {} -func (*ResponseParameters) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} } +var xxx_messageInfo_ResponseParameters proto.InternalMessageInfo func (m *ResponseParameters) GetSize() int32 { if m != nil { @@ -303,19 +463,41 @@ type StreamingOutputCallRequest struct { // If response_type is RANDOM, the payload from each response in the stream // might be of different types. This is to simulate a mixed type of payload // stream. - ResponseType PayloadType `protobuf:"varint,1,opt,name=response_type,json=responseType,enum=grpc.testing.PayloadType" json:"response_type,omitempty"` + ResponseType PayloadType `protobuf:"varint,1,opt,name=response_type,json=responseType,proto3,enum=grpc.testing.PayloadType" json:"response_type,omitempty"` // Configuration for each expected response message. - ResponseParameters []*ResponseParameters `protobuf:"bytes,2,rep,name=response_parameters,json=responseParameters" json:"response_parameters,omitempty"` + ResponseParameters []*ResponseParameters `protobuf:"bytes,2,rep,name=response_parameters,json=responseParameters,proto3" json:"response_parameters,omitempty"` // Optional input payload sent along with the request. - Payload *Payload `protobuf:"bytes,3,opt,name=payload" json:"payload,omitempty"` + Payload *Payload `protobuf:"bytes,3,opt,name=payload,proto3" json:"payload,omitempty"` // Whether server should return a given status - ResponseStatus *EchoStatus `protobuf:"bytes,7,opt,name=response_status,json=responseStatus" json:"response_status,omitempty"` + ResponseStatus *EchoStatus `protobuf:"bytes,7,opt,name=response_status,json=responseStatus,proto3" json:"response_status,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *StreamingOutputCallRequest) Reset() { *m = StreamingOutputCallRequest{} } -func (m *StreamingOutputCallRequest) String() string { return proto.CompactTextString(m) } -func (*StreamingOutputCallRequest) ProtoMessage() {} -func (*StreamingOutputCallRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} } +func (m *StreamingOutputCallRequest) Reset() { *m = StreamingOutputCallRequest{} } +func (m *StreamingOutputCallRequest) String() string { return proto.CompactTextString(m) } +func (*StreamingOutputCallRequest) ProtoMessage() {} +func (*StreamingOutputCallRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_test_4001f755b984bb27, []int{8} +} +func (m *StreamingOutputCallRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_StreamingOutputCallRequest.Unmarshal(m, b) +} +func (m *StreamingOutputCallRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_StreamingOutputCallRequest.Marshal(b, m, deterministic) +} +func (dst *StreamingOutputCallRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_StreamingOutputCallRequest.Merge(dst, src) +} +func (m *StreamingOutputCallRequest) XXX_Size() int { + return xxx_messageInfo_StreamingOutputCallRequest.Size(m) +} +func (m *StreamingOutputCallRequest) XXX_DiscardUnknown() { + xxx_messageInfo_StreamingOutputCallRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_StreamingOutputCallRequest proto.InternalMessageInfo func (m *StreamingOutputCallRequest) GetResponseType() PayloadType { if m != nil { @@ -348,13 +530,35 @@ func (m *StreamingOutputCallRequest) GetResponseStatus() *EchoStatus { // Server-streaming response, as configured by the request and parameters. type StreamingOutputCallResponse struct { // Payload to increase response size. - Payload *Payload `protobuf:"bytes,1,opt,name=payload" json:"payload,omitempty"` + Payload *Payload `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StreamingOutputCallResponse) Reset() { *m = StreamingOutputCallResponse{} } +func (m *StreamingOutputCallResponse) String() string { return proto.CompactTextString(m) } +func (*StreamingOutputCallResponse) ProtoMessage() {} +func (*StreamingOutputCallResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_test_4001f755b984bb27, []int{9} +} +func (m *StreamingOutputCallResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_StreamingOutputCallResponse.Unmarshal(m, b) +} +func (m *StreamingOutputCallResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_StreamingOutputCallResponse.Marshal(b, m, deterministic) +} +func (dst *StreamingOutputCallResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_StreamingOutputCallResponse.Merge(dst, src) +} +func (m *StreamingOutputCallResponse) XXX_Size() int { + return xxx_messageInfo_StreamingOutputCallResponse.Size(m) +} +func (m *StreamingOutputCallResponse) XXX_DiscardUnknown() { + xxx_messageInfo_StreamingOutputCallResponse.DiscardUnknown(m) } -func (m *StreamingOutputCallResponse) Reset() { *m = StreamingOutputCallResponse{} } -func (m *StreamingOutputCallResponse) String() string { return proto.CompactTextString(m) } -func (*StreamingOutputCallResponse) ProtoMessage() {} -func (*StreamingOutputCallResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} } +var xxx_messageInfo_StreamingOutputCallResponse proto.InternalMessageInfo func (m *StreamingOutputCallResponse) GetPayload() *Payload { if m != nil { @@ -385,8 +589,9 @@ var _ grpc.ClientConn // is compatible with the grpc package it is being compiled against. const _ = grpc.SupportPackageIsVersion4 -// Client API for TestService service - +// TestServiceClient is the client API for TestService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type TestServiceClient interface { // One empty request followed by one empty response. EmptyCall(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Empty, error) @@ -420,7 +625,7 @@ func NewTestServiceClient(cc *grpc.ClientConn) TestServiceClient { func (c *testServiceClient) EmptyCall(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Empty, error) { out := new(Empty) - err := grpc.Invoke(ctx, "/grpc.testing.TestService/EmptyCall", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/grpc.testing.TestService/EmptyCall", in, out, opts...) if err != nil { return nil, err } @@ -429,7 +634,7 @@ func (c *testServiceClient) EmptyCall(ctx context.Context, in *Empty, opts ...gr func (c *testServiceClient) UnaryCall(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (*SimpleResponse, error) { out := new(SimpleResponse) - err := grpc.Invoke(ctx, "/grpc.testing.TestService/UnaryCall", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/grpc.testing.TestService/UnaryCall", in, out, opts...) if err != nil { return nil, err } @@ -437,7 +642,7 @@ func (c *testServiceClient) UnaryCall(ctx context.Context, in *SimpleRequest, op } func (c *testServiceClient) StreamingOutputCall(ctx context.Context, in *StreamingOutputCallRequest, opts ...grpc.CallOption) (TestService_StreamingOutputCallClient, error) { - stream, err := grpc.NewClientStream(ctx, &_TestService_serviceDesc.Streams[0], c.cc, "/grpc.testing.TestService/StreamingOutputCall", opts...) + stream, err := c.cc.NewStream(ctx, &_TestService_serviceDesc.Streams[0], "/grpc.testing.TestService/StreamingOutputCall", opts...) if err != nil { return nil, err } @@ -469,7 +674,7 @@ func (x *testServiceStreamingOutputCallClient) Recv() (*StreamingOutputCallRespo } func (c *testServiceClient) StreamingInputCall(ctx context.Context, opts ...grpc.CallOption) (TestService_StreamingInputCallClient, error) { - stream, err := grpc.NewClientStream(ctx, &_TestService_serviceDesc.Streams[1], c.cc, "/grpc.testing.TestService/StreamingInputCall", opts...) + stream, err := c.cc.NewStream(ctx, &_TestService_serviceDesc.Streams[1], "/grpc.testing.TestService/StreamingInputCall", opts...) if err != nil { return nil, err } @@ -503,7 +708,7 @@ func (x *testServiceStreamingInputCallClient) CloseAndRecv() (*StreamingInputCal } func (c *testServiceClient) FullDuplexCall(ctx context.Context, opts ...grpc.CallOption) (TestService_FullDuplexCallClient, error) { - stream, err := grpc.NewClientStream(ctx, &_TestService_serviceDesc.Streams[2], c.cc, "/grpc.testing.TestService/FullDuplexCall", opts...) + stream, err := c.cc.NewStream(ctx, &_TestService_serviceDesc.Streams[2], "/grpc.testing.TestService/FullDuplexCall", opts...) if err != nil { return nil, err } @@ -534,7 +739,7 @@ func (x *testServiceFullDuplexCallClient) Recv() (*StreamingOutputCallResponse, } func (c *testServiceClient) HalfDuplexCall(ctx context.Context, opts ...grpc.CallOption) (TestService_HalfDuplexCallClient, error) { - stream, err := grpc.NewClientStream(ctx, &_TestService_serviceDesc.Streams[3], c.cc, "/grpc.testing.TestService/HalfDuplexCall", opts...) + stream, err := c.cc.NewStream(ctx, &_TestService_serviceDesc.Streams[3], "/grpc.testing.TestService/HalfDuplexCall", opts...) if err != nil { return nil, err } @@ -564,8 +769,7 @@ func (x *testServiceHalfDuplexCallClient) Recv() (*StreamingOutputCallResponse, return m, nil } -// Server API for TestService service - +// TestServiceServer is the server API for TestService service. type TestServiceServer interface { // One empty request followed by one empty response. EmptyCall(context.Context, *Empty) (*Empty, error) @@ -768,8 +972,9 @@ var _TestService_serviceDesc = grpc.ServiceDesc{ Metadata: "grpc_testing/test.proto", } -// Client API for UnimplementedService service - +// UnimplementedServiceClient is the client API for UnimplementedService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type UnimplementedServiceClient interface { // A call that no server should implement UnimplementedCall(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Empty, error) @@ -785,15 +990,14 @@ func NewUnimplementedServiceClient(cc *grpc.ClientConn) UnimplementedServiceClie func (c *unimplementedServiceClient) UnimplementedCall(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Empty, error) { out := new(Empty) - err := grpc.Invoke(ctx, "/grpc.testing.UnimplementedService/UnimplementedCall", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/grpc.testing.UnimplementedService/UnimplementedCall", in, out, opts...) if err != nil { return nil, err } return out, nil } -// Server API for UnimplementedService service - +// UnimplementedServiceServer is the server API for UnimplementedService service. type UnimplementedServiceServer interface { // A call that no server should implement UnimplementedCall(context.Context, *Empty) (*Empty, error) @@ -834,9 +1038,9 @@ var _UnimplementedService_serviceDesc = grpc.ServiceDesc{ Metadata: "grpc_testing/test.proto", } -func init() { proto.RegisterFile("grpc_testing/test.proto", fileDescriptor0) } +func init() { proto.RegisterFile("grpc_testing/test.proto", fileDescriptor_test_4001f755b984bb27) } -var fileDescriptor0 = []byte{ +var fileDescriptor_test_4001f755b984bb27 = []byte{ // 664 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x55, 0xdd, 0x6e, 0xd3, 0x4c, 0x10, 0xfd, 0x9c, 0x26, 0x4d, 0x3b, 0x49, 0xfd, 0x85, 0x2d, 0x55, 0xdd, 0x14, 0x89, 0xc8, 0x5c, diff --git a/vendor/google.golang.org/grpc/interop/http2/negative_http2_client.go b/vendor/google.golang.org/grpc/interop/http2/negative_http2_client.go index 1806d4651..7658a6342 100644 --- a/vendor/google.golang.org/grpc/interop/http2/negative_http2_client.go +++ b/vendor/google.golang.org/grpc/interop/http2/negative_http2_client.go @@ -137,22 +137,22 @@ func main() { switch *testCase { case "goaway": goaway(tc) - grpclog.Println("goaway done") + grpclog.Infoln("goaway done") case "rst_after_header": rstAfterHeader(tc) - grpclog.Println("rst_after_header done") + grpclog.Infoln("rst_after_header done") case "rst_during_data": rstDuringData(tc) - grpclog.Println("rst_during_data done") + grpclog.Infoln("rst_during_data done") case "rst_after_data": rstAfterData(tc) - grpclog.Println("rst_after_data done") + grpclog.Infoln("rst_after_data done") case "ping": ping(tc) - grpclog.Println("ping done") + grpclog.Infoln("ping done") case "max_streams": maxStreams(tc) - grpclog.Println("max_streams done") + grpclog.Infoln("max_streams done") default: grpclog.Fatal("Unsupported test case: ", *testCase) } diff --git a/vendor/google.golang.org/grpc/interop/test_utils.go b/vendor/google.golang.org/grpc/interop/test_utils.go index 9c5b7209d..cbc7756d0 100644 --- a/vendor/google.golang.org/grpc/interop/test_utils.go +++ b/vendor/google.golang.org/grpc/interop/test_utils.go @@ -574,8 +574,8 @@ func DoUnimplementedService(tc testpb.UnimplementedServiceClient) { // DoUnimplementedMethod attempts to call an unimplemented method. func DoUnimplementedMethod(cc *grpc.ClientConn) { var req, reply proto.Message - if err := grpc.Invoke(context.Background(), "/grpc.testing.TestService/UnimplementedCall", req, reply, cc); err == nil || status.Code(err) != codes.Unimplemented { - grpclog.Fatalf("grpc.Invoke(_, _, _, _, _) = %v, want error code %s", err, codes.Unimplemented) + if err := cc.Invoke(context.Background(), "/grpc.testing.TestService/UnimplementedCall", req, reply); err == nil || status.Code(err) != codes.Unimplemented { + grpclog.Fatalf("ClientConn.Invoke(_, _, _, _, _) = %v, want error code %s", err, codes.Unimplemented) } } diff --git a/vendor/google.golang.org/grpc/metadata/metadata.go b/vendor/google.golang.org/grpc/metadata/metadata.go index c590dc35d..bd2eaf408 100644 --- a/vendor/google.golang.org/grpc/metadata/metadata.go +++ b/vendor/google.golang.org/grpc/metadata/metadata.go @@ -28,7 +28,9 @@ import ( "golang.org/x/net/context" ) -// DecodeKeyValue returns k, v, nil. It is deprecated and should not be used. +// DecodeKeyValue returns k, v, nil. +// +// Deprecated: use k and v directly instead. func DecodeKeyValue(k, v string) (string, string, error) { return k, v, nil } diff --git a/vendor/google.golang.org/grpc/picker_wrapper.go b/vendor/google.golang.org/grpc/picker_wrapper.go index 0a984e6c8..46b95ad5c 100644 --- a/vendor/google.golang.org/grpc/picker_wrapper.go +++ b/vendor/google.golang.org/grpc/picker_wrapper.go @@ -21,15 +21,12 @@ package grpc import ( "io" "sync" - "sync/atomic" "golang.org/x/net/context" "google.golang.org/grpc/balancer" - "google.golang.org/grpc/channelz" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/metadata" - "google.golang.org/grpc/resolver" + "google.golang.org/grpc/internal/channelz" "google.golang.org/grpc/status" "google.golang.org/grpc/transport" ) @@ -45,16 +42,10 @@ type pickerWrapper struct { // The latest connection happened. connErrMu sync.Mutex connErr error - - stickinessMDKey atomic.Value - stickiness *stickyStore } func newPickerWrapper() *pickerWrapper { - bp := &pickerWrapper{ - blockingCh: make(chan struct{}), - stickiness: newStickyStore(), - } + bp := &pickerWrapper{blockingCh: make(chan struct{})} return bp } @@ -71,27 +62,6 @@ func (bp *pickerWrapper) connectionError() error { return err } -func (bp *pickerWrapper) updateStickinessMDKey(newKey string) { - // No need to check ok because mdKey == "" if ok == false. - if oldKey, _ := bp.stickinessMDKey.Load().(string); oldKey != newKey { - bp.stickinessMDKey.Store(newKey) - bp.stickiness.reset(newKey) - } -} - -func (bp *pickerWrapper) getStickinessMDKey() string { - // No need to check ok because mdKey == "" if ok == false. - mdKey, _ := bp.stickinessMDKey.Load().(string) - return mdKey -} - -func (bp *pickerWrapper) clearStickinessState() { - if oldKey := bp.getStickinessMDKey(); oldKey != "" { - // There's no need to reset store if mdKey was "". - bp.stickiness.reset(oldKey) - } -} - // updatePicker is called by UpdateBalancerState. It unblocks all blocked pick. func (bp *pickerWrapper) updatePicker(p balancer.Picker) { bp.mu.Lock() @@ -131,27 +101,6 @@ func doneChannelzWrapper(acw *acBalancerWrapper, done func(balancer.DoneInfo)) f // - the subConn returned by the current picker is not READY // When one of these situations happens, pick blocks until the picker gets updated. func (bp *pickerWrapper) pick(ctx context.Context, failfast bool, opts balancer.PickOptions) (transport.ClientTransport, func(balancer.DoneInfo), error) { - - mdKey := bp.getStickinessMDKey() - stickyKey, isSticky := stickyKeyFromContext(ctx, mdKey) - - // Potential race here: if stickinessMDKey is updated after the above two - // lines, and this pick is a sticky pick, the following put could add an - // entry to sticky store with an outdated sticky key. - // - // The solution: keep the current md key in sticky store, and at the - // beginning of each get/put, check the mdkey against store.curMDKey. - // - Cons: one more string comparing for each get/put. - // - Pros: the string matching happens inside get/put, so the overhead for - // non-sticky RPCs will be minimal. - - if isSticky { - if t, ok := bp.stickiness.get(mdKey, stickyKey); ok { - // Done function returned is always nil. - return t, nil, nil - } - } - var ( p balancer.Picker ch chan struct{} @@ -207,9 +156,6 @@ func (bp *pickerWrapper) pick(ctx context.Context, failfast bool, opts balancer. continue } if t, ok := acw.getAddrConn().getReadyTransport(); ok { - if isSticky { - bp.stickiness.put(mdKey, stickyKey, acw) - } if channelz.IsOn() { return t, doneChannelzWrapper(acw, done), nil } @@ -232,100 +178,3 @@ func (bp *pickerWrapper) close() { bp.done = true close(bp.blockingCh) } - -type stickyStoreEntry struct { - acw *acBalancerWrapper - addr resolver.Address -} - -type stickyStore struct { - mu sync.Mutex - // curMDKey is check before every get/put to avoid races. The operation will - // abort immediately when the given mdKey is different from the curMDKey. - curMDKey string - store map[string]*stickyStoreEntry -} - -func newStickyStore() *stickyStore { - return &stickyStore{ - store: make(map[string]*stickyStoreEntry), - } -} - -// reset clears the map in stickyStore, and set the currentMDKey to newMDKey. -func (ss *stickyStore) reset(newMDKey string) { - ss.mu.Lock() - ss.curMDKey = newMDKey - ss.store = make(map[string]*stickyStoreEntry) - ss.mu.Unlock() -} - -// stickyKey is the key to look up in store. mdKey will be checked against -// curMDKey to avoid races. -func (ss *stickyStore) put(mdKey, stickyKey string, acw *acBalancerWrapper) { - ss.mu.Lock() - defer ss.mu.Unlock() - if mdKey != ss.curMDKey { - return - } - // TODO(stickiness): limit the total number of entries. - ss.store[stickyKey] = &stickyStoreEntry{ - acw: acw, - addr: acw.getAddrConn().getCurAddr(), - } -} - -// stickyKey is the key to look up in store. mdKey will be checked against -// curMDKey to avoid races. -func (ss *stickyStore) get(mdKey, stickyKey string) (transport.ClientTransport, bool) { - ss.mu.Lock() - defer ss.mu.Unlock() - if mdKey != ss.curMDKey { - return nil, false - } - entry, ok := ss.store[stickyKey] - if !ok { - return nil, false - } - ac := entry.acw.getAddrConn() - if ac.getCurAddr() != entry.addr { - delete(ss.store, stickyKey) - return nil, false - } - t, ok := ac.getReadyTransport() - if !ok { - delete(ss.store, stickyKey) - return nil, false - } - return t, true -} - -// Get one value from metadata in ctx with key stickinessMDKey. -// -// It returns "", false if stickinessMDKey is an empty string. -func stickyKeyFromContext(ctx context.Context, stickinessMDKey string) (string, bool) { - if stickinessMDKey == "" { - return "", false - } - - md, added, ok := metadata.FromOutgoingContextRaw(ctx) - if !ok { - return "", false - } - - if vv, ok := md[stickinessMDKey]; ok { - if len(vv) > 0 { - return vv[0], true - } - } - - for _, ss := range added { - for i := 0; i < len(ss)-1; i += 2 { - if ss[i] == stickinessMDKey { - return ss[i+1], true - } - } - } - - return "", false -} diff --git a/vendor/google.golang.org/grpc/reflection/grpc_reflection_v1alpha/reflection.pb.go b/vendor/google.golang.org/grpc/reflection/grpc_reflection_v1alpha/reflection.pb.go index fcf4d241c..4bc5404ae 100644 --- a/vendor/google.golang.org/grpc/reflection/grpc_reflection_v1alpha/reflection.pb.go +++ b/vendor/google.golang.org/grpc/reflection/grpc_reflection_v1alpha/reflection.pb.go @@ -1,22 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // source: grpc_reflection_v1alpha/reflection.proto -/* -Package grpc_reflection_v1alpha is a generated protocol buffer package. - -It is generated from these files: - grpc_reflection_v1alpha/reflection.proto - -It has these top-level messages: - ServerReflectionRequest - ExtensionRequest - ServerReflectionResponse - FileDescriptorResponse - ExtensionNumberResponse - ListServiceResponse - ServiceResponse - ErrorResponse -*/ package grpc_reflection_v1alpha import proto "github.com/golang/protobuf/proto" @@ -41,7 +25,7 @@ const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package // The message sent by the client when calling ServerReflectionInfo method. type ServerReflectionRequest struct { - Host string `protobuf:"bytes,1,opt,name=host" json:"host,omitempty"` + Host string `protobuf:"bytes,1,opt,name=host,proto3" json:"host,omitempty"` // To use reflection service, the client should set one of the following // fields in message_request. The server distinguishes requests by their // defined field and then handles them using corresponding methods. @@ -52,32 +36,54 @@ type ServerReflectionRequest struct { // *ServerReflectionRequest_FileContainingExtension // *ServerReflectionRequest_AllExtensionNumbersOfType // *ServerReflectionRequest_ListServices - MessageRequest isServerReflectionRequest_MessageRequest `protobuf_oneof:"message_request"` + MessageRequest isServerReflectionRequest_MessageRequest `protobuf_oneof:"message_request"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *ServerReflectionRequest) Reset() { *m = ServerReflectionRequest{} } -func (m *ServerReflectionRequest) String() string { return proto.CompactTextString(m) } -func (*ServerReflectionRequest) ProtoMessage() {} -func (*ServerReflectionRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } +func (m *ServerReflectionRequest) Reset() { *m = ServerReflectionRequest{} } +func (m *ServerReflectionRequest) String() string { return proto.CompactTextString(m) } +func (*ServerReflectionRequest) ProtoMessage() {} +func (*ServerReflectionRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_reflection_178bd1e101bf8b63, []int{0} +} +func (m *ServerReflectionRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ServerReflectionRequest.Unmarshal(m, b) +} +func (m *ServerReflectionRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ServerReflectionRequest.Marshal(b, m, deterministic) +} +func (dst *ServerReflectionRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ServerReflectionRequest.Merge(dst, src) +} +func (m *ServerReflectionRequest) XXX_Size() int { + return xxx_messageInfo_ServerReflectionRequest.Size(m) +} +func (m *ServerReflectionRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ServerReflectionRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ServerReflectionRequest proto.InternalMessageInfo type isServerReflectionRequest_MessageRequest interface { isServerReflectionRequest_MessageRequest() } type ServerReflectionRequest_FileByFilename struct { - FileByFilename string `protobuf:"bytes,3,opt,name=file_by_filename,json=fileByFilename,oneof"` + FileByFilename string `protobuf:"bytes,3,opt,name=file_by_filename,json=fileByFilename,proto3,oneof"` } type ServerReflectionRequest_FileContainingSymbol struct { - FileContainingSymbol string `protobuf:"bytes,4,opt,name=file_containing_symbol,json=fileContainingSymbol,oneof"` + FileContainingSymbol string `protobuf:"bytes,4,opt,name=file_containing_symbol,json=fileContainingSymbol,proto3,oneof"` } type ServerReflectionRequest_FileContainingExtension struct { - FileContainingExtension *ExtensionRequest `protobuf:"bytes,5,opt,name=file_containing_extension,json=fileContainingExtension,oneof"` + FileContainingExtension *ExtensionRequest `protobuf:"bytes,5,opt,name=file_containing_extension,json=fileContainingExtension,proto3,oneof"` } type ServerReflectionRequest_AllExtensionNumbersOfType struct { - AllExtensionNumbersOfType string `protobuf:"bytes,6,opt,name=all_extension_numbers_of_type,json=allExtensionNumbersOfType,oneof"` + AllExtensionNumbersOfType string `protobuf:"bytes,6,opt,name=all_extension_numbers_of_type,json=allExtensionNumbersOfType,proto3,oneof"` } type ServerReflectionRequest_ListServices struct { - ListServices string `protobuf:"bytes,7,opt,name=list_services,json=listServices,oneof"` + ListServices string `protobuf:"bytes,7,opt,name=list_services,json=listServices,proto3,oneof"` } func (*ServerReflectionRequest_FileByFilename) isServerReflectionRequest_MessageRequest() {} @@ -223,24 +229,24 @@ func _ServerReflectionRequest_OneofSizer(msg proto.Message) (n int) { // message_request switch x := m.MessageRequest.(type) { case *ServerReflectionRequest_FileByFilename: - n += proto.SizeVarint(3<<3 | proto.WireBytes) + n += 1 // tag and wire n += proto.SizeVarint(uint64(len(x.FileByFilename))) n += len(x.FileByFilename) case *ServerReflectionRequest_FileContainingSymbol: - n += proto.SizeVarint(4<<3 | proto.WireBytes) + n += 1 // tag and wire n += proto.SizeVarint(uint64(len(x.FileContainingSymbol))) n += len(x.FileContainingSymbol) case *ServerReflectionRequest_FileContainingExtension: s := proto.Size(x.FileContainingExtension) - n += proto.SizeVarint(5<<3 | proto.WireBytes) + n += 1 // tag and wire n += proto.SizeVarint(uint64(s)) n += s case *ServerReflectionRequest_AllExtensionNumbersOfType: - n += proto.SizeVarint(6<<3 | proto.WireBytes) + n += 1 // tag and wire n += proto.SizeVarint(uint64(len(x.AllExtensionNumbersOfType))) n += len(x.AllExtensionNumbersOfType) case *ServerReflectionRequest_ListServices: - n += proto.SizeVarint(7<<3 | proto.WireBytes) + n += 1 // tag and wire n += proto.SizeVarint(uint64(len(x.ListServices))) n += len(x.ListServices) case nil: @@ -254,14 +260,36 @@ func _ServerReflectionRequest_OneofSizer(msg proto.Message) (n int) { // file_containing_extension. type ExtensionRequest struct { // Fully-qualified type name. The format should be . - ContainingType string `protobuf:"bytes,1,opt,name=containing_type,json=containingType" json:"containing_type,omitempty"` - ExtensionNumber int32 `protobuf:"varint,2,opt,name=extension_number,json=extensionNumber" json:"extension_number,omitempty"` + ContainingType string `protobuf:"bytes,1,opt,name=containing_type,json=containingType,proto3" json:"containing_type,omitempty"` + ExtensionNumber int32 `protobuf:"varint,2,opt,name=extension_number,json=extensionNumber,proto3" json:"extension_number,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *ExtensionRequest) Reset() { *m = ExtensionRequest{} } -func (m *ExtensionRequest) String() string { return proto.CompactTextString(m) } -func (*ExtensionRequest) ProtoMessage() {} -func (*ExtensionRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } +func (m *ExtensionRequest) Reset() { *m = ExtensionRequest{} } +func (m *ExtensionRequest) String() string { return proto.CompactTextString(m) } +func (*ExtensionRequest) ProtoMessage() {} +func (*ExtensionRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_reflection_178bd1e101bf8b63, []int{1} +} +func (m *ExtensionRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ExtensionRequest.Unmarshal(m, b) +} +func (m *ExtensionRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ExtensionRequest.Marshal(b, m, deterministic) +} +func (dst *ExtensionRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ExtensionRequest.Merge(dst, src) +} +func (m *ExtensionRequest) XXX_Size() int { + return xxx_messageInfo_ExtensionRequest.Size(m) +} +func (m *ExtensionRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ExtensionRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ExtensionRequest proto.InternalMessageInfo func (m *ExtensionRequest) GetContainingType() string { if m != nil { @@ -279,8 +307,8 @@ func (m *ExtensionRequest) GetExtensionNumber() int32 { // The message sent by the server to answer ServerReflectionInfo method. type ServerReflectionResponse struct { - ValidHost string `protobuf:"bytes,1,opt,name=valid_host,json=validHost" json:"valid_host,omitempty"` - OriginalRequest *ServerReflectionRequest `protobuf:"bytes,2,opt,name=original_request,json=originalRequest" json:"original_request,omitempty"` + ValidHost string `protobuf:"bytes,1,opt,name=valid_host,json=validHost,proto3" json:"valid_host,omitempty"` + OriginalRequest *ServerReflectionRequest `protobuf:"bytes,2,opt,name=original_request,json=originalRequest,proto3" json:"original_request,omitempty"` // The server sets one of the following fields according to the // message_request in the request. // @@ -289,29 +317,51 @@ type ServerReflectionResponse struct { // *ServerReflectionResponse_AllExtensionNumbersResponse // *ServerReflectionResponse_ListServicesResponse // *ServerReflectionResponse_ErrorResponse - MessageResponse isServerReflectionResponse_MessageResponse `protobuf_oneof:"message_response"` + MessageResponse isServerReflectionResponse_MessageResponse `protobuf_oneof:"message_response"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ServerReflectionResponse) Reset() { *m = ServerReflectionResponse{} } +func (m *ServerReflectionResponse) String() string { return proto.CompactTextString(m) } +func (*ServerReflectionResponse) ProtoMessage() {} +func (*ServerReflectionResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_reflection_178bd1e101bf8b63, []int{2} +} +func (m *ServerReflectionResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ServerReflectionResponse.Unmarshal(m, b) +} +func (m *ServerReflectionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ServerReflectionResponse.Marshal(b, m, deterministic) +} +func (dst *ServerReflectionResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ServerReflectionResponse.Merge(dst, src) +} +func (m *ServerReflectionResponse) XXX_Size() int { + return xxx_messageInfo_ServerReflectionResponse.Size(m) +} +func (m *ServerReflectionResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ServerReflectionResponse.DiscardUnknown(m) } -func (m *ServerReflectionResponse) Reset() { *m = ServerReflectionResponse{} } -func (m *ServerReflectionResponse) String() string { return proto.CompactTextString(m) } -func (*ServerReflectionResponse) ProtoMessage() {} -func (*ServerReflectionResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } +var xxx_messageInfo_ServerReflectionResponse proto.InternalMessageInfo type isServerReflectionResponse_MessageResponse interface { isServerReflectionResponse_MessageResponse() } type ServerReflectionResponse_FileDescriptorResponse struct { - FileDescriptorResponse *FileDescriptorResponse `protobuf:"bytes,4,opt,name=file_descriptor_response,json=fileDescriptorResponse,oneof"` + FileDescriptorResponse *FileDescriptorResponse `protobuf:"bytes,4,opt,name=file_descriptor_response,json=fileDescriptorResponse,proto3,oneof"` } type ServerReflectionResponse_AllExtensionNumbersResponse struct { - AllExtensionNumbersResponse *ExtensionNumberResponse `protobuf:"bytes,5,opt,name=all_extension_numbers_response,json=allExtensionNumbersResponse,oneof"` + AllExtensionNumbersResponse *ExtensionNumberResponse `protobuf:"bytes,5,opt,name=all_extension_numbers_response,json=allExtensionNumbersResponse,proto3,oneof"` } type ServerReflectionResponse_ListServicesResponse struct { - ListServicesResponse *ListServiceResponse `protobuf:"bytes,6,opt,name=list_services_response,json=listServicesResponse,oneof"` + ListServicesResponse *ListServiceResponse `protobuf:"bytes,6,opt,name=list_services_response,json=listServicesResponse,proto3,oneof"` } type ServerReflectionResponse_ErrorResponse struct { - ErrorResponse *ErrorResponse `protobuf:"bytes,7,opt,name=error_response,json=errorResponse,oneof"` + ErrorResponse *ErrorResponse `protobuf:"bytes,7,opt,name=error_response,json=errorResponse,proto3,oneof"` } func (*ServerReflectionResponse_FileDescriptorResponse) isServerReflectionResponse_MessageResponse() {} @@ -456,22 +506,22 @@ func _ServerReflectionResponse_OneofSizer(msg proto.Message) (n int) { switch x := m.MessageResponse.(type) { case *ServerReflectionResponse_FileDescriptorResponse: s := proto.Size(x.FileDescriptorResponse) - n += proto.SizeVarint(4<<3 | proto.WireBytes) + n += 1 // tag and wire n += proto.SizeVarint(uint64(s)) n += s case *ServerReflectionResponse_AllExtensionNumbersResponse: s := proto.Size(x.AllExtensionNumbersResponse) - n += proto.SizeVarint(5<<3 | proto.WireBytes) + n += 1 // tag and wire n += proto.SizeVarint(uint64(s)) n += s case *ServerReflectionResponse_ListServicesResponse: s := proto.Size(x.ListServicesResponse) - n += proto.SizeVarint(6<<3 | proto.WireBytes) + n += 1 // tag and wire n += proto.SizeVarint(uint64(s)) n += s case *ServerReflectionResponse_ErrorResponse: s := proto.Size(x.ErrorResponse) - n += proto.SizeVarint(7<<3 | proto.WireBytes) + n += 1 // tag and wire n += proto.SizeVarint(uint64(s)) n += s case nil: @@ -488,13 +538,35 @@ type FileDescriptorResponse struct { // Serialized FileDescriptorProto messages. We avoid taking a dependency on // descriptor.proto, which uses proto2 only features, by making them opaque // bytes instead. - FileDescriptorProto [][]byte `protobuf:"bytes,1,rep,name=file_descriptor_proto,json=fileDescriptorProto,proto3" json:"file_descriptor_proto,omitempty"` + FileDescriptorProto [][]byte `protobuf:"bytes,1,rep,name=file_descriptor_proto,json=fileDescriptorProto,proto3" json:"file_descriptor_proto,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *FileDescriptorResponse) Reset() { *m = FileDescriptorResponse{} } -func (m *FileDescriptorResponse) String() string { return proto.CompactTextString(m) } -func (*FileDescriptorResponse) ProtoMessage() {} -func (*FileDescriptorResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } +func (m *FileDescriptorResponse) Reset() { *m = FileDescriptorResponse{} } +func (m *FileDescriptorResponse) String() string { return proto.CompactTextString(m) } +func (*FileDescriptorResponse) ProtoMessage() {} +func (*FileDescriptorResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_reflection_178bd1e101bf8b63, []int{3} +} +func (m *FileDescriptorResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_FileDescriptorResponse.Unmarshal(m, b) +} +func (m *FileDescriptorResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_FileDescriptorResponse.Marshal(b, m, deterministic) +} +func (dst *FileDescriptorResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_FileDescriptorResponse.Merge(dst, src) +} +func (m *FileDescriptorResponse) XXX_Size() int { + return xxx_messageInfo_FileDescriptorResponse.Size(m) +} +func (m *FileDescriptorResponse) XXX_DiscardUnknown() { + xxx_messageInfo_FileDescriptorResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_FileDescriptorResponse proto.InternalMessageInfo func (m *FileDescriptorResponse) GetFileDescriptorProto() [][]byte { if m != nil { @@ -508,14 +580,36 @@ func (m *FileDescriptorResponse) GetFileDescriptorProto() [][]byte { type ExtensionNumberResponse struct { // Full name of the base type, including the package name. The format // is . - BaseTypeName string `protobuf:"bytes,1,opt,name=base_type_name,json=baseTypeName" json:"base_type_name,omitempty"` - ExtensionNumber []int32 `protobuf:"varint,2,rep,packed,name=extension_number,json=extensionNumber" json:"extension_number,omitempty"` + BaseTypeName string `protobuf:"bytes,1,opt,name=base_type_name,json=baseTypeName,proto3" json:"base_type_name,omitempty"` + ExtensionNumber []int32 `protobuf:"varint,2,rep,packed,name=extension_number,json=extensionNumber,proto3" json:"extension_number,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ExtensionNumberResponse) Reset() { *m = ExtensionNumberResponse{} } +func (m *ExtensionNumberResponse) String() string { return proto.CompactTextString(m) } +func (*ExtensionNumberResponse) ProtoMessage() {} +func (*ExtensionNumberResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_reflection_178bd1e101bf8b63, []int{4} +} +func (m *ExtensionNumberResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ExtensionNumberResponse.Unmarshal(m, b) +} +func (m *ExtensionNumberResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ExtensionNumberResponse.Marshal(b, m, deterministic) +} +func (dst *ExtensionNumberResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ExtensionNumberResponse.Merge(dst, src) +} +func (m *ExtensionNumberResponse) XXX_Size() int { + return xxx_messageInfo_ExtensionNumberResponse.Size(m) +} +func (m *ExtensionNumberResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ExtensionNumberResponse.DiscardUnknown(m) } -func (m *ExtensionNumberResponse) Reset() { *m = ExtensionNumberResponse{} } -func (m *ExtensionNumberResponse) String() string { return proto.CompactTextString(m) } -func (*ExtensionNumberResponse) ProtoMessage() {} -func (*ExtensionNumberResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} } +var xxx_messageInfo_ExtensionNumberResponse proto.InternalMessageInfo func (m *ExtensionNumberResponse) GetBaseTypeName() string { if m != nil { @@ -535,13 +629,35 @@ func (m *ExtensionNumberResponse) GetExtensionNumber() []int32 { type ListServiceResponse struct { // The information of each service may be expanded in the future, so we use // ServiceResponse message to encapsulate it. - Service []*ServiceResponse `protobuf:"bytes,1,rep,name=service" json:"service,omitempty"` + Service []*ServiceResponse `protobuf:"bytes,1,rep,name=service,proto3" json:"service,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *ListServiceResponse) Reset() { *m = ListServiceResponse{} } -func (m *ListServiceResponse) String() string { return proto.CompactTextString(m) } -func (*ListServiceResponse) ProtoMessage() {} -func (*ListServiceResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} } +func (m *ListServiceResponse) Reset() { *m = ListServiceResponse{} } +func (m *ListServiceResponse) String() string { return proto.CompactTextString(m) } +func (*ListServiceResponse) ProtoMessage() {} +func (*ListServiceResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_reflection_178bd1e101bf8b63, []int{5} +} +func (m *ListServiceResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ListServiceResponse.Unmarshal(m, b) +} +func (m *ListServiceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ListServiceResponse.Marshal(b, m, deterministic) +} +func (dst *ListServiceResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ListServiceResponse.Merge(dst, src) +} +func (m *ListServiceResponse) XXX_Size() int { + return xxx_messageInfo_ListServiceResponse.Size(m) +} +func (m *ListServiceResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ListServiceResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_ListServiceResponse proto.InternalMessageInfo func (m *ListServiceResponse) GetService() []*ServiceResponse { if m != nil { @@ -555,13 +671,35 @@ func (m *ListServiceResponse) GetService() []*ServiceResponse { type ServiceResponse struct { // Full name of a registered service, including its package name. The format // is . - Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ServiceResponse) Reset() { *m = ServiceResponse{} } +func (m *ServiceResponse) String() string { return proto.CompactTextString(m) } +func (*ServiceResponse) ProtoMessage() {} +func (*ServiceResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_reflection_178bd1e101bf8b63, []int{6} +} +func (m *ServiceResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ServiceResponse.Unmarshal(m, b) +} +func (m *ServiceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ServiceResponse.Marshal(b, m, deterministic) +} +func (dst *ServiceResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ServiceResponse.Merge(dst, src) +} +func (m *ServiceResponse) XXX_Size() int { + return xxx_messageInfo_ServiceResponse.Size(m) +} +func (m *ServiceResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ServiceResponse.DiscardUnknown(m) } -func (m *ServiceResponse) Reset() { *m = ServiceResponse{} } -func (m *ServiceResponse) String() string { return proto.CompactTextString(m) } -func (*ServiceResponse) ProtoMessage() {} -func (*ServiceResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} } +var xxx_messageInfo_ServiceResponse proto.InternalMessageInfo func (m *ServiceResponse) GetName() string { if m != nil { @@ -573,14 +711,36 @@ func (m *ServiceResponse) GetName() string { // The error code and error message sent by the server when an error occurs. type ErrorResponse struct { // This field uses the error codes defined in grpc::StatusCode. - ErrorCode int32 `protobuf:"varint,1,opt,name=error_code,json=errorCode" json:"error_code,omitempty"` - ErrorMessage string `protobuf:"bytes,2,opt,name=error_message,json=errorMessage" json:"error_message,omitempty"` + ErrorCode int32 `protobuf:"varint,1,opt,name=error_code,json=errorCode,proto3" json:"error_code,omitempty"` + ErrorMessage string `protobuf:"bytes,2,opt,name=error_message,json=errorMessage,proto3" json:"error_message,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *ErrorResponse) Reset() { *m = ErrorResponse{} } -func (m *ErrorResponse) String() string { return proto.CompactTextString(m) } -func (*ErrorResponse) ProtoMessage() {} -func (*ErrorResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} } +func (m *ErrorResponse) Reset() { *m = ErrorResponse{} } +func (m *ErrorResponse) String() string { return proto.CompactTextString(m) } +func (*ErrorResponse) ProtoMessage() {} +func (*ErrorResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_reflection_178bd1e101bf8b63, []int{7} +} +func (m *ErrorResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ErrorResponse.Unmarshal(m, b) +} +func (m *ErrorResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ErrorResponse.Marshal(b, m, deterministic) +} +func (dst *ErrorResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ErrorResponse.Merge(dst, src) +} +func (m *ErrorResponse) XXX_Size() int { + return xxx_messageInfo_ErrorResponse.Size(m) +} +func (m *ErrorResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ErrorResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_ErrorResponse proto.InternalMessageInfo func (m *ErrorResponse) GetErrorCode() int32 { if m != nil { @@ -615,8 +775,9 @@ var _ grpc.ClientConn // is compatible with the grpc package it is being compiled against. const _ = grpc.SupportPackageIsVersion4 -// Client API for ServerReflection service - +// ServerReflectionClient is the client API for ServerReflection service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type ServerReflectionClient interface { // The reflection service is structured as a bidirectional stream, ensuring // all related requests go to a single server. @@ -632,7 +793,7 @@ func NewServerReflectionClient(cc *grpc.ClientConn) ServerReflectionClient { } func (c *serverReflectionClient) ServerReflectionInfo(ctx context.Context, opts ...grpc.CallOption) (ServerReflection_ServerReflectionInfoClient, error) { - stream, err := grpc.NewClientStream(ctx, &_ServerReflection_serviceDesc.Streams[0], c.cc, "/grpc.reflection.v1alpha.ServerReflection/ServerReflectionInfo", opts...) + stream, err := c.cc.NewStream(ctx, &_ServerReflection_serviceDesc.Streams[0], "/grpc.reflection.v1alpha.ServerReflection/ServerReflectionInfo", opts...) if err != nil { return nil, err } @@ -662,8 +823,7 @@ func (x *serverReflectionServerReflectionInfoClient) Recv() (*ServerReflectionRe return m, nil } -// Server API for ServerReflection service - +// ServerReflectionServer is the server API for ServerReflection service. type ServerReflectionServer interface { // The reflection service is structured as a bidirectional stream, ensuring // all related requests go to a single server. @@ -715,9 +875,11 @@ var _ServerReflection_serviceDesc = grpc.ServiceDesc{ Metadata: "grpc_reflection_v1alpha/reflection.proto", } -func init() { proto.RegisterFile("grpc_reflection_v1alpha/reflection.proto", fileDescriptor0) } +func init() { + proto.RegisterFile("grpc_reflection_v1alpha/reflection.proto", fileDescriptor_reflection_178bd1e101bf8b63) +} -var fileDescriptor0 = []byte{ +var fileDescriptor_reflection_178bd1e101bf8b63 = []byte{ // 656 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0x51, 0x73, 0xd2, 0x40, 0x10, 0x6e, 0x5a, 0x68, 0x87, 0x85, 0x02, 0x5e, 0x2b, 0xa4, 0x3a, 0x75, 0x98, 0x68, 0x35, 0x75, diff --git a/vendor/google.golang.org/grpc/reflection/grpc_testing/proto2.pb.go b/vendor/google.golang.org/grpc/reflection/grpc_testing/proto2.pb.go index 5b0161885..4a95d9beb 100644 --- a/vendor/google.golang.org/grpc/reflection/grpc_testing/proto2.pb.go +++ b/vendor/google.golang.org/grpc/reflection/grpc_testing/proto2.pb.go @@ -1,22 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // source: proto2.proto -/* -Package grpc_testing is a generated protocol buffer package. - -It is generated from these files: - proto2.proto - proto2_ext.proto - proto2_ext2.proto - test.proto - -It has these top-level messages: - ToBeExtended - Extension - AnotherExtension - SearchResponse - SearchRequest -*/ package grpc_testing import proto "github.com/golang/protobuf/proto" @@ -35,23 +19,44 @@ var _ = math.Inf const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package type ToBeExtended struct { - Foo *int32 `protobuf:"varint,1,req,name=foo" json:"foo,omitempty"` + Foo *int32 `protobuf:"varint,1,req,name=foo" json:"foo,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` proto.XXX_InternalExtensions `json:"-"` XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *ToBeExtended) Reset() { *m = ToBeExtended{} } -func (m *ToBeExtended) String() string { return proto.CompactTextString(m) } -func (*ToBeExtended) ProtoMessage() {} -func (*ToBeExtended) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } +func (m *ToBeExtended) Reset() { *m = ToBeExtended{} } +func (m *ToBeExtended) String() string { return proto.CompactTextString(m) } +func (*ToBeExtended) ProtoMessage() {} +func (*ToBeExtended) Descriptor() ([]byte, []int) { + return fileDescriptor_proto2_b16f7a513d0acdc0, []int{0} +} var extRange_ToBeExtended = []proto.ExtensionRange{ - {10, 30}, + {Start: 10, End: 30}, } func (*ToBeExtended) ExtensionRangeArray() []proto.ExtensionRange { return extRange_ToBeExtended } +func (m *ToBeExtended) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ToBeExtended.Unmarshal(m, b) +} +func (m *ToBeExtended) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ToBeExtended.Marshal(b, m, deterministic) +} +func (dst *ToBeExtended) XXX_Merge(src proto.Message) { + xxx_messageInfo_ToBeExtended.Merge(dst, src) +} +func (m *ToBeExtended) XXX_Size() int { + return xxx_messageInfo_ToBeExtended.Size(m) +} +func (m *ToBeExtended) XXX_DiscardUnknown() { + xxx_messageInfo_ToBeExtended.DiscardUnknown(m) +} + +var xxx_messageInfo_ToBeExtended proto.InternalMessageInfo func (m *ToBeExtended) GetFoo() int32 { if m != nil && m.Foo != nil { @@ -64,9 +69,9 @@ func init() { proto.RegisterType((*ToBeExtended)(nil), "grpc.testing.ToBeExtended") } -func init() { proto.RegisterFile("proto2.proto", fileDescriptor0) } +func init() { proto.RegisterFile("proto2.proto", fileDescriptor_proto2_b16f7a513d0acdc0) } -var fileDescriptor0 = []byte{ +var fileDescriptor_proto2_b16f7a513d0acdc0 = []byte{ // 86 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x29, 0x28, 0xca, 0x2f, 0xc9, 0x37, 0xd2, 0x03, 0x53, 0x42, 0x3c, 0xe9, 0x45, 0x05, 0xc9, 0x7a, 0x25, 0xa9, 0xc5, 0x25, diff --git a/vendor/google.golang.org/grpc/reflection/grpc_testing/proto2_ext.pb.go b/vendor/google.golang.org/grpc/reflection/grpc_testing/proto2_ext.pb.go index 9ae4f07af..25baa1a00 100644 --- a/vendor/google.golang.org/grpc/reflection/grpc_testing/proto2_ext.pb.go +++ b/vendor/google.golang.org/grpc/reflection/grpc_testing/proto2_ext.pb.go @@ -12,15 +12,42 @@ var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + type Extension struct { - Whatzit *int32 `protobuf:"varint,1,opt,name=whatzit" json:"whatzit,omitempty"` - XXX_unrecognized []byte `json:"-"` + Whatzit *int32 `protobuf:"varint,1,opt,name=whatzit" json:"whatzit,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Extension) Reset() { *m = Extension{} } +func (m *Extension) String() string { return proto.CompactTextString(m) } +func (*Extension) ProtoMessage() {} +func (*Extension) Descriptor() ([]byte, []int) { + return fileDescriptor_proto2_ext_4437118420d604f2, []int{0} +} +func (m *Extension) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Extension.Unmarshal(m, b) +} +func (m *Extension) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Extension.Marshal(b, m, deterministic) +} +func (dst *Extension) XXX_Merge(src proto.Message) { + xxx_messageInfo_Extension.Merge(dst, src) +} +func (m *Extension) XXX_Size() int { + return xxx_messageInfo_Extension.Size(m) +} +func (m *Extension) XXX_DiscardUnknown() { + xxx_messageInfo_Extension.DiscardUnknown(m) } -func (m *Extension) Reset() { *m = Extension{} } -func (m *Extension) String() string { return proto.CompactTextString(m) } -func (*Extension) ProtoMessage() {} -func (*Extension) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{0} } +var xxx_messageInfo_Extension proto.InternalMessageInfo func (m *Extension) GetWhatzit() int32 { if m != nil && m.Whatzit != nil { @@ -63,9 +90,9 @@ func init() { proto.RegisterExtension(E_Baz) } -func init() { proto.RegisterFile("proto2_ext.proto", fileDescriptor1) } +func init() { proto.RegisterFile("proto2_ext.proto", fileDescriptor_proto2_ext_4437118420d604f2) } -var fileDescriptor1 = []byte{ +var fileDescriptor_proto2_ext_4437118420d604f2 = []byte{ // 179 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x28, 0x28, 0xca, 0x2f, 0xc9, 0x37, 0x8a, 0x4f, 0xad, 0x28, 0xd1, 0x03, 0x33, 0x85, 0x78, 0xd2, 0x8b, 0x0a, 0x92, 0xf5, diff --git a/vendor/google.golang.org/grpc/reflection/grpc_testing/proto2_ext2.pb.go b/vendor/google.golang.org/grpc/reflection/grpc_testing/proto2_ext2.pb.go index 26ec982aa..869a6baf8 100644 --- a/vendor/google.golang.org/grpc/reflection/grpc_testing/proto2_ext2.pb.go +++ b/vendor/google.golang.org/grpc/reflection/grpc_testing/proto2_ext2.pb.go @@ -12,15 +12,42 @@ var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + type AnotherExtension struct { - Whatchamacallit *int32 `protobuf:"varint,1,opt,name=whatchamacallit" json:"whatchamacallit,omitempty"` - XXX_unrecognized []byte `json:"-"` + Whatchamacallit *int32 `protobuf:"varint,1,opt,name=whatchamacallit" json:"whatchamacallit,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AnotherExtension) Reset() { *m = AnotherExtension{} } +func (m *AnotherExtension) String() string { return proto.CompactTextString(m) } +func (*AnotherExtension) ProtoMessage() {} +func (*AnotherExtension) Descriptor() ([]byte, []int) { + return fileDescriptor_proto2_ext2_039d342873655470, []int{0} +} +func (m *AnotherExtension) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_AnotherExtension.Unmarshal(m, b) +} +func (m *AnotherExtension) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_AnotherExtension.Marshal(b, m, deterministic) +} +func (dst *AnotherExtension) XXX_Merge(src proto.Message) { + xxx_messageInfo_AnotherExtension.Merge(dst, src) +} +func (m *AnotherExtension) XXX_Size() int { + return xxx_messageInfo_AnotherExtension.Size(m) +} +func (m *AnotherExtension) XXX_DiscardUnknown() { + xxx_messageInfo_AnotherExtension.DiscardUnknown(m) } -func (m *AnotherExtension) Reset() { *m = AnotherExtension{} } -func (m *AnotherExtension) String() string { return proto.CompactTextString(m) } -func (*AnotherExtension) ProtoMessage() {} -func (*AnotherExtension) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{0} } +var xxx_messageInfo_AnotherExtension proto.InternalMessageInfo func (m *AnotherExtension) GetWhatchamacallit() int32 { if m != nil && m.Whatchamacallit != nil { @@ -53,9 +80,9 @@ func init() { proto.RegisterExtension(E_Nitz) } -func init() { proto.RegisterFile("proto2_ext2.proto", fileDescriptor2) } +func init() { proto.RegisterFile("proto2_ext2.proto", fileDescriptor_proto2_ext2_039d342873655470) } -var fileDescriptor2 = []byte{ +var fileDescriptor_proto2_ext2_039d342873655470 = []byte{ // 165 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2c, 0x28, 0xca, 0x2f, 0xc9, 0x37, 0x8a, 0x4f, 0xad, 0x28, 0x31, 0xd2, 0x03, 0xb3, 0x85, 0x78, 0xd2, 0x8b, 0x0a, 0x92, diff --git a/vendor/google.golang.org/grpc/reflection/grpc_testing/test.pb.go b/vendor/google.golang.org/grpc/reflection/grpc_testing/test.pb.go index 62f71ff15..2566a49f9 100644 --- a/vendor/google.golang.org/grpc/reflection/grpc_testing/test.pb.go +++ b/vendor/google.golang.org/grpc/reflection/grpc_testing/test.pb.go @@ -17,14 +17,42 @@ var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + type SearchResponse struct { - Results []*SearchResponse_Result `protobuf:"bytes,1,rep,name=results" json:"results,omitempty"` + Results []*SearchResponse_Result `protobuf:"bytes,1,rep,name=results,proto3" json:"results,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *SearchResponse) Reset() { *m = SearchResponse{} } -func (m *SearchResponse) String() string { return proto.CompactTextString(m) } -func (*SearchResponse) ProtoMessage() {} -func (*SearchResponse) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{0} } +func (m *SearchResponse) Reset() { *m = SearchResponse{} } +func (m *SearchResponse) String() string { return proto.CompactTextString(m) } +func (*SearchResponse) ProtoMessage() {} +func (*SearchResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_test_a0c753075da50dd4, []int{0} +} +func (m *SearchResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SearchResponse.Unmarshal(m, b) +} +func (m *SearchResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SearchResponse.Marshal(b, m, deterministic) +} +func (dst *SearchResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_SearchResponse.Merge(dst, src) +} +func (m *SearchResponse) XXX_Size() int { + return xxx_messageInfo_SearchResponse.Size(m) +} +func (m *SearchResponse) XXX_DiscardUnknown() { + xxx_messageInfo_SearchResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_SearchResponse proto.InternalMessageInfo func (m *SearchResponse) GetResults() []*SearchResponse_Result { if m != nil { @@ -34,15 +62,37 @@ func (m *SearchResponse) GetResults() []*SearchResponse_Result { } type SearchResponse_Result struct { - Url string `protobuf:"bytes,1,opt,name=url" json:"url,omitempty"` - Title string `protobuf:"bytes,2,opt,name=title" json:"title,omitempty"` - Snippets []string `protobuf:"bytes,3,rep,name=snippets" json:"snippets,omitempty"` + Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"` + Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"` + Snippets []string `protobuf:"bytes,3,rep,name=snippets,proto3" json:"snippets,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *SearchResponse_Result) Reset() { *m = SearchResponse_Result{} } -func (m *SearchResponse_Result) String() string { return proto.CompactTextString(m) } -func (*SearchResponse_Result) ProtoMessage() {} -func (*SearchResponse_Result) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{0, 0} } +func (m *SearchResponse_Result) Reset() { *m = SearchResponse_Result{} } +func (m *SearchResponse_Result) String() string { return proto.CompactTextString(m) } +func (*SearchResponse_Result) ProtoMessage() {} +func (*SearchResponse_Result) Descriptor() ([]byte, []int) { + return fileDescriptor_test_a0c753075da50dd4, []int{0, 0} +} +func (m *SearchResponse_Result) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SearchResponse_Result.Unmarshal(m, b) +} +func (m *SearchResponse_Result) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SearchResponse_Result.Marshal(b, m, deterministic) +} +func (dst *SearchResponse_Result) XXX_Merge(src proto.Message) { + xxx_messageInfo_SearchResponse_Result.Merge(dst, src) +} +func (m *SearchResponse_Result) XXX_Size() int { + return xxx_messageInfo_SearchResponse_Result.Size(m) +} +func (m *SearchResponse_Result) XXX_DiscardUnknown() { + xxx_messageInfo_SearchResponse_Result.DiscardUnknown(m) +} + +var xxx_messageInfo_SearchResponse_Result proto.InternalMessageInfo func (m *SearchResponse_Result) GetUrl() string { if m != nil { @@ -66,13 +116,35 @@ func (m *SearchResponse_Result) GetSnippets() []string { } type SearchRequest struct { - Query string `protobuf:"bytes,1,opt,name=query" json:"query,omitempty"` + Query string `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SearchRequest) Reset() { *m = SearchRequest{} } +func (m *SearchRequest) String() string { return proto.CompactTextString(m) } +func (*SearchRequest) ProtoMessage() {} +func (*SearchRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_test_a0c753075da50dd4, []int{1} +} +func (m *SearchRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SearchRequest.Unmarshal(m, b) +} +func (m *SearchRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SearchRequest.Marshal(b, m, deterministic) +} +func (dst *SearchRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_SearchRequest.Merge(dst, src) +} +func (m *SearchRequest) XXX_Size() int { + return xxx_messageInfo_SearchRequest.Size(m) +} +func (m *SearchRequest) XXX_DiscardUnknown() { + xxx_messageInfo_SearchRequest.DiscardUnknown(m) } -func (m *SearchRequest) Reset() { *m = SearchRequest{} } -func (m *SearchRequest) String() string { return proto.CompactTextString(m) } -func (*SearchRequest) ProtoMessage() {} -func (*SearchRequest) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{1} } +var xxx_messageInfo_SearchRequest proto.InternalMessageInfo func (m *SearchRequest) GetQuery() string { if m != nil { @@ -95,8 +167,9 @@ var _ grpc.ClientConn // is compatible with the grpc package it is being compiled against. const _ = grpc.SupportPackageIsVersion4 -// Client API for SearchService service - +// SearchServiceClient is the client API for SearchService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type SearchServiceClient interface { Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (*SearchResponse, error) StreamingSearch(ctx context.Context, opts ...grpc.CallOption) (SearchService_StreamingSearchClient, error) @@ -112,7 +185,7 @@ func NewSearchServiceClient(cc *grpc.ClientConn) SearchServiceClient { func (c *searchServiceClient) Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (*SearchResponse, error) { out := new(SearchResponse) - err := grpc.Invoke(ctx, "/grpc.testing.SearchService/Search", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/grpc.testing.SearchService/Search", in, out, opts...) if err != nil { return nil, err } @@ -120,7 +193,7 @@ func (c *searchServiceClient) Search(ctx context.Context, in *SearchRequest, opt } func (c *searchServiceClient) StreamingSearch(ctx context.Context, opts ...grpc.CallOption) (SearchService_StreamingSearchClient, error) { - stream, err := grpc.NewClientStream(ctx, &_SearchService_serviceDesc.Streams[0], c.cc, "/grpc.testing.SearchService/StreamingSearch", opts...) + stream, err := c.cc.NewStream(ctx, &_SearchService_serviceDesc.Streams[0], "/grpc.testing.SearchService/StreamingSearch", opts...) if err != nil { return nil, err } @@ -150,8 +223,7 @@ func (x *searchServiceStreamingSearchClient) Recv() (*SearchResponse, error) { return m, nil } -// Server API for SearchService service - +// SearchServiceServer is the server API for SearchService service. type SearchServiceServer interface { Search(context.Context, *SearchRequest) (*SearchResponse, error) StreamingSearch(SearchService_StreamingSearchServer) error @@ -225,9 +297,9 @@ var _SearchService_serviceDesc = grpc.ServiceDesc{ Metadata: "test.proto", } -func init() { proto.RegisterFile("test.proto", fileDescriptor3) } +func init() { proto.RegisterFile("test.proto", fileDescriptor_test_a0c753075da50dd4) } -var fileDescriptor3 = []byte{ +var fileDescriptor_test_a0c753075da50dd4 = []byte{ // 231 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x91, 0xbd, 0x4a, 0xc5, 0x40, 0x10, 0x85, 0x59, 0x83, 0xd1, 0x3b, 0xfe, 0x32, 0x58, 0x84, 0x68, 0x11, 0xae, 0x08, 0xa9, 0x16, diff --git a/vendor/google.golang.org/grpc/resolver/dns/dns_resolver.go b/vendor/google.golang.org/grpc/resolver/dns/dns_resolver.go index 8ab6e2888..c0e85488c 100644 --- a/vendor/google.golang.org/grpc/resolver/dns/dns_resolver.go +++ b/vendor/google.golang.org/grpc/resolver/dns/dns_resolver.go @@ -24,7 +24,6 @@ import ( "encoding/json" "errors" "fmt" - "math/rand" "net" "os" "strconv" @@ -34,6 +33,7 @@ import ( "golang.org/x/net/context" "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/internal/grpcrand" "google.golang.org/grpc/resolver" ) @@ -51,8 +51,13 @@ const ( ) var ( - errMissingAddr = errors.New("missing address") - randomGen = rand.New(rand.NewSource(time.Now().UnixNano())) + errMissingAddr = errors.New("dns resolver: missing address") + + // Addresses ending with a colon that is supposed to be the separator + // between host and port is not allowed. E.g. "::" is a valid address as + // it is an IPv6 address (host only) and "[::]:" is invalid as it ends with + // a colon as the host and port separator + errEndsWithColon = errors.New("dns resolver: missing port after port-separator colon") ) // NewBuilder creates a dnsBuilder which is used to factory DNS resolvers. @@ -67,6 +72,9 @@ type dnsBuilder struct { // Build creates and starts a DNS resolver that watches the name resolution of the target. func (b *dnsBuilder) Build(target resolver.Target, cc resolver.ClientConn, opts resolver.BuildOption) (resolver.Resolver, error) { + if target.Authority != "" { + return nil, fmt.Errorf("Default DNS resolver does not support custom DNS server") + } host, port, err := parseTarget(target.Endpoint) if err != nil { return nil, err @@ -90,14 +98,15 @@ func (b *dnsBuilder) Build(target resolver.Target, cc resolver.ClientConn, opts // DNS address (non-IP). ctx, cancel := context.WithCancel(context.Background()) d := &dnsResolver{ - freq: b.freq, - host: host, - port: port, - ctx: ctx, - cancel: cancel, - cc: cc, - t: time.NewTimer(0), - rn: make(chan struct{}, 1), + freq: b.freq, + host: host, + port: port, + ctx: ctx, + cancel: cancel, + cc: cc, + t: time.NewTimer(0), + rn: make(chan struct{}, 1), + disableServiceConfig: opts.DisableServiceConfig, } d.wg.Add(1) @@ -160,7 +169,8 @@ type dnsResolver struct { // If Close() doesn't wait for watcher() goroutine finishes, race detector sometimes // will warns lookup (READ the lookup function pointers) inside watcher() goroutine // has data race with replaceNetFunc (WRITE the lookup function pointers). - wg sync.WaitGroup + wg sync.WaitGroup + disableServiceConfig bool } // ResolveNow invoke an immediate resolution of the target that this dnsResolver watches. @@ -205,7 +215,7 @@ func (d *dnsResolver) lookupSRV() []resolver.Address { for _, s := range srvs { lbAddrs, err := lookupHost(d.ctx, s.Target) if err != nil { - grpclog.Warningf("grpc: failed load balancer address dns lookup due to %v.\n", err) + grpclog.Infof("grpc: failed load balancer address dns lookup due to %v.\n", err) continue } for _, a := range lbAddrs { @@ -224,7 +234,7 @@ func (d *dnsResolver) lookupSRV() []resolver.Address { func (d *dnsResolver) lookupTXT() string { ss, err := lookupTXT(d.ctx, d.host) if err != nil { - grpclog.Warningf("grpc: failed dns TXT record lookup due to %v.\n", err) + grpclog.Infof("grpc: failed dns TXT record lookup due to %v.\n", err) return "" } var res string @@ -263,6 +273,9 @@ func (d *dnsResolver) lookup() ([]resolver.Address, string) { newAddrs := d.lookupSRV() // Support fallback to non-balancer address. newAddrs = append(newAddrs, d.lookupHost()...) + if d.disableServiceConfig { + return newAddrs, "" + } sc := d.lookupTXT() return newAddrs, canaryingSC(sc) } @@ -290,7 +303,6 @@ func formatIP(addr string) (addrIP string, ok bool) { // target: "ipv4-host:80" returns host: "ipv4-host", port: "80" // target: "[ipv6-host]" returns host: "ipv6-host", port: "443" // target: ":80" returns host: "localhost", port: "80" -// target: ":" returns host: "localhost", port: "443" func parseTarget(target string) (host, port string, err error) { if target == "" { return "", "", errMissingAddr @@ -300,15 +312,15 @@ func parseTarget(target string) (host, port string, err error) { return target, defaultPort, nil } if host, port, err = net.SplitHostPort(target); err == nil { + if port == "" { + // If the port field is empty (target ends with colon), e.g. "[::1]:", this is an error. + return "", "", errEndsWithColon + } // target has port, i.e ipv4-host:port, [ipv6-host]:port, host-name:port if host == "" { // Keep consistent with net.Dial(): If the host is empty, as in ":80", the local system is assumed. host = "localhost" } - if port == "" { - // If the port field is empty(target ends with colon), e.g. "[::1]:", defaultPort is used. - port = defaultPort - } return host, port, nil } if host, port, err = net.SplitHostPort(target + ":" + defaultPort); err == nil { @@ -341,7 +353,7 @@ func chosenByPercentage(a *int) bool { if a == nil { return true } - return randomGen.Intn(100)+1 <= *a + return grpcrand.Intn(100)+1 <= *a } func canaryingSC(js string) string { diff --git a/vendor/google.golang.org/grpc/resolver/resolver.go b/vendor/google.golang.org/grpc/resolver/resolver.go index 6b90dbab5..506afac88 100644 --- a/vendor/google.golang.org/grpc/resolver/resolver.go +++ b/vendor/google.golang.org/grpc/resolver/resolver.go @@ -90,6 +90,8 @@ type Address struct { // BuildOption includes additional information for the builder to create // the resolver. type BuildOption struct { + // DisableServiceConfig indicates whether resolver should fetch service config data. + DisableServiceConfig bool } // ClientConn contains the callbacks for resolver to notify any updates diff --git a/vendor/google.golang.org/grpc/resolver_conn_wrapper.go b/vendor/google.golang.org/grpc/resolver_conn_wrapper.go index 2c91b038c..494d6931e 100644 --- a/vendor/google.golang.org/grpc/resolver_conn_wrapper.go +++ b/vendor/google.golang.org/grpc/resolver_conn_wrapper.go @@ -65,8 +65,8 @@ func parseTarget(target string) (ret resolver.Target) { } // newCCResolverWrapper parses cc.target for scheme and gets the resolver -// builder for this scheme. It then builds the resolver and starts the -// monitoring goroutine for it. +// builder for this scheme and builds the resolver. The monitoring goroutine +// for it is not started yet and can be created by calling start(). // // If withResolverBuilder dial option is set, the specified resolver will be // used instead. @@ -84,7 +84,7 @@ func newCCResolverWrapper(cc *ClientConn) (*ccResolverWrapper, error) { } var err error - ccr.resolver, err = rb.Build(cc.parsedTarget, ccr, resolver.BuildOption{}) + ccr.resolver, err = rb.Build(cc.parsedTarget, ccr, resolver.BuildOption{DisableServiceConfig: cc.dopts.disableServiceConfig}) if err != nil { return nil, err } @@ -148,7 +148,7 @@ func (ccr *ccResolverWrapper) NewAddress(addrs []resolver.Address) { } // NewServiceConfig is called by the resolver implemenetion to send service -// configs to gPRC. +// configs to gRPC. func (ccr *ccResolverWrapper) NewServiceConfig(sc string) { select { case <-ccr.scCh: diff --git a/vendor/google.golang.org/grpc/rpc_util.go b/vendor/google.golang.org/grpc/rpc_util.go index f08e646f8..836944f5e 100644 --- a/vendor/google.golang.org/grpc/rpc_util.go +++ b/vendor/google.golang.org/grpc/rpc_util.go @@ -162,10 +162,15 @@ type callInfo struct { creds credentials.PerRPCCredentials contentSubtype string codec baseCodec + disableRetry bool + maxRetryRPCBufferSize int } func defaultCallInfo() *callInfo { - return &callInfo{failFast: true} + return &callInfo{ + failFast: true, + maxRetryRPCBufferSize: 256 * 1024, // 256KB + } } // CallOption configures a Call before it starts or extracts information from @@ -415,12 +420,33 @@ func (o CustomCodecCallOption) before(c *callInfo) error { } func (o CustomCodecCallOption) after(c *callInfo) {} +// MaxRetryRPCBufferSize returns a CallOption that limits the amount of memory +// used for buffering this RPC's requests for retry purposes. +// +// This API is EXPERIMENTAL. +func MaxRetryRPCBufferSize(bytes int) CallOption { + return MaxRetryRPCBufferSizeCallOption{bytes} +} + +// MaxRetryRPCBufferSizeCallOption is a CallOption indicating the amount of +// memory to be used for caching this RPC for retry purposes. +// This is an EXPERIMENTAL API. +type MaxRetryRPCBufferSizeCallOption struct { + MaxRetryRPCBufferSize int +} + +func (o MaxRetryRPCBufferSizeCallOption) before(c *callInfo) error { + c.maxRetryRPCBufferSize = o.MaxRetryRPCBufferSize + return nil +} +func (o MaxRetryRPCBufferSizeCallOption) after(c *callInfo) {} + // The format of the payload: compressed or not? type payloadFormat uint8 const ( - compressionNone payloadFormat = iota // no compression - compressionMade + compressionNone payloadFormat = 0 // no compression + compressionMade payloadFormat = 1 // compressed ) // parser reads complete gRPC messages from the underlying reader. @@ -477,65 +503,82 @@ func (p *parser) recvMsg(maxReceiveMessageSize int) (pf payloadFormat, msg []byt return pf, msg, nil } -// encode serializes msg and returns a buffer of message header and a buffer of msg. -// If msg is nil, it generates the message header and an empty msg buffer. -// TODO(ddyihai): eliminate extra Compressor parameter. -func encode(c baseCodec, msg interface{}, cp Compressor, outPayload *stats.OutPayload, compressor encoding.Compressor) ([]byte, []byte, error) { - var ( - b []byte - cbuf *bytes.Buffer - ) - const ( - payloadLen = 1 - sizeLen = 4 - ) - if msg != nil { - var err error - b, err = c.Marshal(msg) - if err != nil { - return nil, nil, status.Errorf(codes.Internal, "grpc: error while marshaling: %v", err.Error()) +// encode serializes msg and returns a buffer containing the message, or an +// error if it is too large to be transmitted by grpc. If msg is nil, it +// generates an empty message. +func encode(c baseCodec, msg interface{}) ([]byte, error) { + if msg == nil { // NOTE: typed nils will not be caught by this check + return nil, nil + } + b, err := c.Marshal(msg) + if err != nil { + return nil, status.Errorf(codes.Internal, "grpc: error while marshaling: %v", err.Error()) + } + if uint(len(b)) > math.MaxUint32 { + return nil, status.Errorf(codes.ResourceExhausted, "grpc: message too large (%d bytes)", len(b)) + } + return b, nil +} + +// compress returns the input bytes compressed by compressor or cp. If both +// compressors are nil, returns nil. +// +// TODO(dfawley): eliminate cp parameter by wrapping Compressor in an encoding.Compressor. +func compress(in []byte, cp Compressor, compressor encoding.Compressor) ([]byte, error) { + if compressor == nil && cp == nil { + return nil, nil + } + wrapErr := func(err error) error { + return status.Errorf(codes.Internal, "grpc: error while compressing: %v", err.Error()) + } + cbuf := &bytes.Buffer{} + if compressor != nil { + z, _ := compressor.Compress(cbuf) + if _, err := z.Write(in); err != nil { + return nil, wrapErr(err) } - if outPayload != nil { - outPayload.Payload = msg - // TODO truncate large payload. - outPayload.Data = b - outPayload.Length = len(b) + if err := z.Close(); err != nil { + return nil, wrapErr(err) } - if compressor != nil || cp != nil { - cbuf = new(bytes.Buffer) - // Has compressor, check Compressor is set by UseCompressor first. - if compressor != nil { - z, _ := compressor.Compress(cbuf) - if _, err := z.Write(b); err != nil { - return nil, nil, status.Errorf(codes.Internal, "grpc: error while compressing: %v", err.Error()) - } - z.Close() - } else { - // If Compressor is not set by UseCompressor, use default Compressor - if err := cp.Do(cbuf, b); err != nil { - return nil, nil, status.Errorf(codes.Internal, "grpc: error while compressing: %v", err.Error()) - } - } - b = cbuf.Bytes() + } else { + if err := cp.Do(cbuf, in); err != nil { + return nil, wrapErr(err) } } - if uint(len(b)) > math.MaxUint32 { - return nil, nil, status.Errorf(codes.ResourceExhausted, "grpc: message too large (%d bytes)", len(b)) - } + return cbuf.Bytes(), nil +} + +const ( + payloadLen = 1 + sizeLen = 4 + headerLen = payloadLen + sizeLen +) - bufHeader := make([]byte, payloadLen+sizeLen) - if compressor != nil || cp != nil { - bufHeader[0] = byte(compressionMade) +// msgHeader returns a 5-byte header for the message being transmitted and the +// payload, which is compData if non-nil or data otherwise. +func msgHeader(data, compData []byte) (hdr []byte, payload []byte) { + hdr = make([]byte, headerLen) + if compData != nil { + hdr[0] = byte(compressionMade) + data = compData } else { - bufHeader[0] = byte(compressionNone) + hdr[0] = byte(compressionNone) } - // Write length of b into buf - binary.BigEndian.PutUint32(bufHeader[payloadLen:], uint32(len(b))) - if outPayload != nil { - outPayload.WireLength = payloadLen + sizeLen + len(b) + // Write length of payload into buf + binary.BigEndian.PutUint32(hdr[payloadLen:], uint32(len(data))) + return hdr, data +} + +func outPayload(client bool, msg interface{}, data, payload []byte, t time.Time) *stats.OutPayload { + return &stats.OutPayload{ + Client: client, + Payload: msg, + Data: data, + Length: len(data), + WireLength: len(payload) + headerLen, + SentTime: t, } - return bufHeader, b, nil } func checkRecvPayload(pf payloadFormat, recvCompress string, haveCompressor bool) *status.Status { @@ -721,7 +764,4 @@ const ( SupportPackageIsVersion5 = true ) -// Version is the current grpc version. -const Version = "1.12.0-dev" - const grpcUA = "grpc-go/" + Version diff --git a/vendor/google.golang.org/grpc/server.go b/vendor/google.golang.org/grpc/server.go index a7ef6cc25..e29bd2c49 100644 --- a/vendor/google.golang.org/grpc/server.go +++ b/vendor/google.golang.org/grpc/server.go @@ -38,13 +38,13 @@ import ( "golang.org/x/net/http2" "golang.org/x/net/trace" - "google.golang.org/grpc/channelz" "google.golang.org/grpc/codes" "google.golang.org/grpc/credentials" "google.golang.org/grpc/encoding" "google.golang.org/grpc/encoding/proto" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/internal" + "google.golang.org/grpc/internal/channelz" "google.golang.org/grpc/keepalive" "google.golang.org/grpc/metadata" "google.golang.org/grpc/stats" @@ -141,13 +141,18 @@ var defaultServerOptions = options{ maxReceiveMessageSize: defaultServerMaxReceiveMessageSize, maxSendMessageSize: defaultServerMaxSendMessageSize, connectionTimeout: 120 * time.Second, + writeBufferSize: defaultWriteBufSize, + readBufferSize: defaultReadBufSize, } // A ServerOption sets options such as credentials, codec and keepalive parameters, etc. type ServerOption func(*options) -// WriteBufferSize lets you set the size of write buffer, this determines how much data can be batched -// before doing a write on the wire. +// WriteBufferSize determines how much data can be batched before doing a write on the wire. +// The corresponding memory allocation for this buffer will be twice the size to keep syscalls low. +// The default value for this buffer is 32KB. +// Zero will disable the write buffer such that each write will be on underlying connection. +// Note: A Send call may not directly translate to a write. func WriteBufferSize(s int) ServerOption { return func(o *options) { o.writeBufferSize = s @@ -156,6 +161,9 @@ func WriteBufferSize(s int) ServerOption { // ReadBufferSize lets you set the size of read buffer, this determines how much data can be read at most // for one read syscall. +// The default value for this buffer is 32KB. +// Zero will disable read buffer for a connection so data framer can access the underlying +// conn directly. func ReadBufferSize(s int) ServerOption { return func(o *options) { o.readBufferSize = s @@ -226,7 +234,9 @@ func RPCDecompressor(dc Decompressor) ServerOption { } // MaxMsgSize returns a ServerOption to set the max message size in bytes the server can receive. -// If this is not set, gRPC uses the default limit. Deprecated: use MaxRecvMsgSize instead. +// If this is not set, gRPC uses the default limit. +// +// Deprecated: use MaxRecvMsgSize instead. func MaxMsgSize(m int) ServerOption { return MaxRecvMsgSize(m) } @@ -479,7 +489,8 @@ type listenSocket struct { func (l *listenSocket) ChannelzMetric() *channelz.SocketInternalMetric { return &channelz.SocketInternalMetric{ - LocalAddr: l.Listener.Addr(), + SocketOptions: channelz.GetSocketOption(l.Listener), + LocalAddr: l.Listener.Addr(), } } @@ -825,24 +836,24 @@ func (s *Server) incrCallsFailed() { } func (s *Server) sendResponse(t transport.ServerTransport, stream *transport.Stream, msg interface{}, cp Compressor, opts *transport.Options, comp encoding.Compressor) error { - var ( - outPayload *stats.OutPayload - ) - if s.opts.statsHandler != nil { - outPayload = &stats.OutPayload{} - } - hdr, data, err := encode(s.getCodec(stream.ContentSubtype()), msg, cp, outPayload, comp) + data, err := encode(s.getCodec(stream.ContentSubtype()), msg) if err != nil { grpclog.Errorln("grpc: server failed to encode response: ", err) return err } - if len(data) > s.opts.maxSendMessageSize { - return status.Errorf(codes.ResourceExhausted, "grpc: trying to send message larger than max (%d vs. %d)", len(data), s.opts.maxSendMessageSize) + compData, err := compress(data, cp, comp) + if err != nil { + grpclog.Errorln("grpc: server failed to compress response: ", err) + return err + } + hdr, payload := msgHeader(data, compData) + // TODO(dfawley): should we be checking len(data) instead? + if len(payload) > s.opts.maxSendMessageSize { + return status.Errorf(codes.ResourceExhausted, "grpc: trying to send message larger than max (%d vs. %d)", len(payload), s.opts.maxSendMessageSize) } - err = t.Write(stream, hdr, data, opts) - if err == nil && outPayload != nil { - outPayload.SentTime = time.Now() - s.opts.statsHandler.HandleRPC(stream.Context(), outPayload) + err = t.Write(stream, hdr, payload, opts) + if err == nil && s.opts.statsHandler != nil { + s.opts.statsHandler.HandleRPC(stream.Context(), outPayload(false, msg, data, payload, time.Now())) } return err } diff --git a/vendor/google.golang.org/grpc/service_config.go b/vendor/google.golang.org/grpc/service_config.go index 3a1b57c59..e0d735265 100644 --- a/vendor/google.golang.org/grpc/service_config.go +++ b/vendor/google.golang.org/grpc/service_config.go @@ -25,6 +25,7 @@ import ( "strings" "time" + "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" ) @@ -32,7 +33,8 @@ const maxInt = int(^uint(0) >> 1) // MethodConfig defines the configuration recommended by the service providers for a // particular method. -// DEPRECATED: Users should not use this struct. Service config should be received +// +// Deprecated: Users should not use this struct. Service config should be received // through name resolver, as specified here // https://github.com/grpc/grpc/blob/master/doc/service_config.md type MethodConfig struct { @@ -55,24 +57,98 @@ type MethodConfig struct { // MaxRespSize is the maximum allowed payload size for an individual response in a // stream (server->client) in bytes. MaxRespSize *int + // RetryPolicy configures retry options for the method. + retryPolicy *retryPolicy } // ServiceConfig is provided by the service provider and contains parameters for how // clients that connect to the service should behave. -// DEPRECATED: Users should not use this struct. Service config should be received +// +// Deprecated: Users should not use this struct. Service config should be received // through name resolver, as specified here // https://github.com/grpc/grpc/blob/master/doc/service_config.md type ServiceConfig struct { // LB is the load balancer the service providers recommends. The balancer specified // via grpc.WithBalancer will override this. LB *string - // Methods contains a map for the methods in this service. - // If there is an exact match for a method (i.e. /service/method) in the map, use the corresponding MethodConfig. - // If there's no exact match, look for the default config for the service (/service/) and use the corresponding MethodConfig if it exists. - // Otherwise, the method has no MethodConfig to use. + + // Methods contains a map for the methods in this service. If there is an + // exact match for a method (i.e. /service/method) in the map, use the + // corresponding MethodConfig. If there's no exact match, look for the + // default config for the service (/service/) and use the corresponding + // MethodConfig if it exists. Otherwise, the method has no MethodConfig to + // use. Methods map[string]MethodConfig - stickinessMetadataKey *string + // If a retryThrottlingPolicy is provided, gRPC will automatically throttle + // retry attempts and hedged RPCs when the client’s ratio of failures to + // successes exceeds a threshold. + // + // For each server name, the gRPC client will maintain a token_count which is + // initially set to maxTokens, and can take values between 0 and maxTokens. + // + // Every outgoing RPC (regardless of service or method invoked) will change + // token_count as follows: + // + // - Every failed RPC will decrement the token_count by 1. + // - Every successful RPC will increment the token_count by tokenRatio. + // + // If token_count is less than or equal to maxTokens / 2, then RPCs will not + // be retried and hedged RPCs will not be sent. + retryThrottling *retryThrottlingPolicy +} + +// retryPolicy defines the go-native version of the retry policy defined by the +// service config here: +// https://github.com/grpc/proposal/blob/master/A6-client-retries.md#integration-with-service-config +type retryPolicy struct { + // MaxAttempts is the maximum number of attempts, including the original RPC. + // + // This field is required and must be two or greater. + maxAttempts int + + // Exponential backoff parameters. The initial retry attempt will occur at + // random(0, initialBackoffMS). In general, the nth attempt will occur at + // random(0, + // min(initialBackoffMS*backoffMultiplier**(n-1), maxBackoffMS)). + // + // These fields are required and must be greater than zero. + initialBackoff time.Duration + maxBackoff time.Duration + backoffMultiplier float64 + + // The set of status codes which may be retried. + // + // Status codes are specified as strings, e.g., "UNAVAILABLE". + // + // This field is required and must be non-empty. + // Note: a set is used to store this for easy lookup. + retryableStatusCodes map[codes.Code]bool +} + +type jsonRetryPolicy struct { + MaxAttempts int + InitialBackoff string + MaxBackoff string + BackoffMultiplier float64 + RetryableStatusCodes []codes.Code +} + +// retryThrottlingPolicy defines the go-native version of the retry throttling +// policy defined by the service config here: +// https://github.com/grpc/proposal/blob/master/A6-client-retries.md#integration-with-service-config +type retryThrottlingPolicy struct { + // The number of tokens starts at maxTokens. The token_count will always be + // between 0 and maxTokens. + // + // This field is required and must be greater than zero. + MaxTokens float64 + // The amount of tokens to add on each successful RPC. Typically this will + // be some number between 0 and 1, e.g., 0.1. + // + // This field is required and must be greater than zero. Up to 3 decimal + // places are supported. + TokenRatio float64 } func parseDuration(s *string) (*time.Duration, error) { @@ -142,13 +218,14 @@ type jsonMC struct { Timeout *string MaxRequestMessageBytes *int64 MaxResponseMessageBytes *int64 + RetryPolicy *jsonRetryPolicy } // TODO(lyuxuan): delete this struct after cleaning up old service config implementation. type jsonSC struct { - LoadBalancingPolicy *string - StickinessMetadataKey *string - MethodConfig *[]jsonMC + LoadBalancingPolicy *string + MethodConfig *[]jsonMC + RetryThrottling *retryThrottlingPolicy } func parseServiceConfig(js string) (ServiceConfig, error) { @@ -159,10 +236,9 @@ func parseServiceConfig(js string) (ServiceConfig, error) { return ServiceConfig{}, err } sc := ServiceConfig{ - LB: rsc.LoadBalancingPolicy, - Methods: make(map[string]MethodConfig), - - stickinessMetadataKey: rsc.StickinessMetadataKey, + LB: rsc.LoadBalancingPolicy, + Methods: make(map[string]MethodConfig), + retryThrottling: rsc.RetryThrottling, } if rsc.MethodConfig == nil { return sc, nil @@ -182,6 +258,10 @@ func parseServiceConfig(js string) (ServiceConfig, error) { WaitForReady: m.WaitForReady, Timeout: d, } + if mc.retryPolicy, err = convertRetryPolicy(m.RetryPolicy); err != nil { + grpclog.Warningf("grpc: parseServiceConfig error unmarshaling %s due to %v", js, err) + return ServiceConfig{}, err + } if m.MaxRequestMessageBytes != nil { if *m.MaxRequestMessageBytes > int64(maxInt) { mc.MaxReqSize = newInt(maxInt) @@ -203,9 +283,56 @@ func parseServiceConfig(js string) (ServiceConfig, error) { } } + if sc.retryThrottling != nil { + if sc.retryThrottling.MaxTokens <= 0 || + sc.retryThrottling.MaxTokens >= 1000 || + sc.retryThrottling.TokenRatio <= 0 { + // Illegal throttling config; disable throttling. + sc.retryThrottling = nil + } + } return sc, nil } +func convertRetryPolicy(jrp *jsonRetryPolicy) (p *retryPolicy, err error) { + if jrp == nil { + return nil, nil + } + ib, err := parseDuration(&jrp.InitialBackoff) + if err != nil { + return nil, err + } + mb, err := parseDuration(&jrp.MaxBackoff) + if err != nil { + return nil, err + } + + if jrp.MaxAttempts <= 1 || + *ib <= 0 || + *mb <= 0 || + jrp.BackoffMultiplier <= 0 || + len(jrp.RetryableStatusCodes) == 0 { + grpclog.Warningf("grpc: ignoring retry policy %v due to illegal configuration", jrp) + return nil, nil + } + + rp := &retryPolicy{ + maxAttempts: jrp.MaxAttempts, + initialBackoff: *ib, + maxBackoff: *mb, + backoffMultiplier: jrp.BackoffMultiplier, + retryableStatusCodes: make(map[codes.Code]bool), + } + if rp.maxAttempts > 5 { + // TODO(retry): Make the max maxAttempts configurable. + rp.maxAttempts = 5 + } + for _, code := range jrp.RetryableStatusCodes { + rp.retryableStatusCodes[code] = true + } + return rp, nil +} + func min(a, b *int) *int { if *a < *b { return a diff --git a/vendor/google.golang.org/grpc/stats/grpc_testing/test.pb.go b/vendor/google.golang.org/grpc/stats/grpc_testing/test.pb.go index c0c14a24b..9db10f815 100644 --- a/vendor/google.golang.org/grpc/stats/grpc_testing/test.pb.go +++ b/vendor/google.golang.org/grpc/stats/grpc_testing/test.pb.go @@ -1,16 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // source: grpc_testing/test.proto -/* -Package grpc_testing is a generated protocol buffer package. - -It is generated from these files: - grpc_testing/test.proto - -It has these top-level messages: - SimpleRequest - SimpleResponse -*/ package grpc_testing import proto "github.com/golang/protobuf/proto" @@ -34,13 +24,35 @@ var _ = math.Inf const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package type SimpleRequest struct { - Id int32 `protobuf:"varint,2,opt,name=id" json:"id,omitempty"` + Id int32 `protobuf:"varint,2,opt,name=id,proto3" json:"id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SimpleRequest) Reset() { *m = SimpleRequest{} } +func (m *SimpleRequest) String() string { return proto.CompactTextString(m) } +func (*SimpleRequest) ProtoMessage() {} +func (*SimpleRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_test_dd7ffeaa75513a0a, []int{0} +} +func (m *SimpleRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SimpleRequest.Unmarshal(m, b) +} +func (m *SimpleRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SimpleRequest.Marshal(b, m, deterministic) +} +func (dst *SimpleRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_SimpleRequest.Merge(dst, src) +} +func (m *SimpleRequest) XXX_Size() int { + return xxx_messageInfo_SimpleRequest.Size(m) +} +func (m *SimpleRequest) XXX_DiscardUnknown() { + xxx_messageInfo_SimpleRequest.DiscardUnknown(m) } -func (m *SimpleRequest) Reset() { *m = SimpleRequest{} } -func (m *SimpleRequest) String() string { return proto.CompactTextString(m) } -func (*SimpleRequest) ProtoMessage() {} -func (*SimpleRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } +var xxx_messageInfo_SimpleRequest proto.InternalMessageInfo func (m *SimpleRequest) GetId() int32 { if m != nil { @@ -50,13 +62,35 @@ func (m *SimpleRequest) GetId() int32 { } type SimpleResponse struct { - Id int32 `protobuf:"varint,3,opt,name=id" json:"id,omitempty"` + Id int32 `protobuf:"varint,3,opt,name=id,proto3" json:"id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *SimpleResponse) Reset() { *m = SimpleResponse{} } -func (m *SimpleResponse) String() string { return proto.CompactTextString(m) } -func (*SimpleResponse) ProtoMessage() {} -func (*SimpleResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } +func (m *SimpleResponse) Reset() { *m = SimpleResponse{} } +func (m *SimpleResponse) String() string { return proto.CompactTextString(m) } +func (*SimpleResponse) ProtoMessage() {} +func (*SimpleResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_test_dd7ffeaa75513a0a, []int{1} +} +func (m *SimpleResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SimpleResponse.Unmarshal(m, b) +} +func (m *SimpleResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SimpleResponse.Marshal(b, m, deterministic) +} +func (dst *SimpleResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_SimpleResponse.Merge(dst, src) +} +func (m *SimpleResponse) XXX_Size() int { + return xxx_messageInfo_SimpleResponse.Size(m) +} +func (m *SimpleResponse) XXX_DiscardUnknown() { + xxx_messageInfo_SimpleResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_SimpleResponse proto.InternalMessageInfo func (m *SimpleResponse) GetId() int32 { if m != nil { @@ -78,8 +112,9 @@ var _ grpc.ClientConn // is compatible with the grpc package it is being compiled against. const _ = grpc.SupportPackageIsVersion4 -// Client API for TestService service - +// TestServiceClient is the client API for TestService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type TestServiceClient interface { // One request followed by one response. // The server returns the client id as-is. @@ -104,7 +139,7 @@ func NewTestServiceClient(cc *grpc.ClientConn) TestServiceClient { func (c *testServiceClient) UnaryCall(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (*SimpleResponse, error) { out := new(SimpleResponse) - err := grpc.Invoke(ctx, "/grpc.testing.TestService/UnaryCall", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/grpc.testing.TestService/UnaryCall", in, out, opts...) if err != nil { return nil, err } @@ -112,7 +147,7 @@ func (c *testServiceClient) UnaryCall(ctx context.Context, in *SimpleRequest, op } func (c *testServiceClient) FullDuplexCall(ctx context.Context, opts ...grpc.CallOption) (TestService_FullDuplexCallClient, error) { - stream, err := grpc.NewClientStream(ctx, &_TestService_serviceDesc.Streams[0], c.cc, "/grpc.testing.TestService/FullDuplexCall", opts...) + stream, err := c.cc.NewStream(ctx, &_TestService_serviceDesc.Streams[0], "/grpc.testing.TestService/FullDuplexCall", opts...) if err != nil { return nil, err } @@ -143,7 +178,7 @@ func (x *testServiceFullDuplexCallClient) Recv() (*SimpleResponse, error) { } func (c *testServiceClient) ClientStreamCall(ctx context.Context, opts ...grpc.CallOption) (TestService_ClientStreamCallClient, error) { - stream, err := grpc.NewClientStream(ctx, &_TestService_serviceDesc.Streams[1], c.cc, "/grpc.testing.TestService/ClientStreamCall", opts...) + stream, err := c.cc.NewStream(ctx, &_TestService_serviceDesc.Streams[1], "/grpc.testing.TestService/ClientStreamCall", opts...) if err != nil { return nil, err } @@ -177,7 +212,7 @@ func (x *testServiceClientStreamCallClient) CloseAndRecv() (*SimpleResponse, err } func (c *testServiceClient) ServerStreamCall(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (TestService_ServerStreamCallClient, error) { - stream, err := grpc.NewClientStream(ctx, &_TestService_serviceDesc.Streams[2], c.cc, "/grpc.testing.TestService/ServerStreamCall", opts...) + stream, err := c.cc.NewStream(ctx, &_TestService_serviceDesc.Streams[2], "/grpc.testing.TestService/ServerStreamCall", opts...) if err != nil { return nil, err } @@ -208,8 +243,7 @@ func (x *testServiceServerStreamCallClient) Recv() (*SimpleResponse, error) { return m, nil } -// Server API for TestService service - +// TestServiceServer is the server API for TestService service. type TestServiceServer interface { // One request followed by one response. // The server returns the client id as-is. @@ -349,9 +383,9 @@ var _TestService_serviceDesc = grpc.ServiceDesc{ Metadata: "grpc_testing/test.proto", } -func init() { proto.RegisterFile("grpc_testing/test.proto", fileDescriptor0) } +func init() { proto.RegisterFile("grpc_testing/test.proto", fileDescriptor_test_dd7ffeaa75513a0a) } -var fileDescriptor0 = []byte{ +var fileDescriptor_test_dd7ffeaa75513a0a = []byte{ // 202 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4f, 0x2f, 0x2a, 0x48, 0x8e, 0x2f, 0x49, 0x2d, 0x2e, 0xc9, 0xcc, 0x4b, 0xd7, 0x07, 0xd1, 0x7a, 0x05, 0x45, 0xf9, 0x25, diff --git a/vendor/google.golang.org/grpc/status/go16.go b/vendor/google.golang.org/grpc/status/go16.go new file mode 100644 index 000000000..e59b53e82 --- /dev/null +++ b/vendor/google.golang.org/grpc/status/go16.go @@ -0,0 +1,42 @@ +// +build go1.6,!go1.7 + +/* + * + * Copyright 2018 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package status + +import ( + "golang.org/x/net/context" + "google.golang.org/grpc/codes" +) + +// FromContextError converts a context error into a Status. It returns a +// Status with codes.OK if err is nil, or a Status with codes.Unknown if err is +// non-nil and not a context error. +func FromContextError(err error) *Status { + switch err { + case nil: + return New(codes.OK, "") + case context.DeadlineExceeded: + return New(codes.DeadlineExceeded, err.Error()) + case context.Canceled: + return New(codes.Canceled, err.Error()) + default: + return New(codes.Unknown, err.Error()) + } +} diff --git a/vendor/google.golang.org/grpc/status/go17.go b/vendor/google.golang.org/grpc/status/go17.go new file mode 100644 index 000000000..090215149 --- /dev/null +++ b/vendor/google.golang.org/grpc/status/go17.go @@ -0,0 +1,44 @@ +// +build go1.7 + +/* + * + * Copyright 2018 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package status + +import ( + "context" + + netctx "golang.org/x/net/context" + "google.golang.org/grpc/codes" +) + +// FromContextError converts a context error into a Status. It returns a +// Status with codes.OK if err is nil, or a Status with codes.Unknown if err is +// non-nil and not a context error. +func FromContextError(err error) *Status { + switch err { + case nil: + return New(codes.OK, "") + case context.DeadlineExceeded, netctx.DeadlineExceeded: + return New(codes.DeadlineExceeded, err.Error()) + case context.Canceled, netctx.Canceled: + return New(codes.Canceled, err.Error()) + default: + return New(codes.Unknown, err.Error()) + } +} diff --git a/vendor/google.golang.org/grpc/stream.go b/vendor/google.golang.org/grpc/stream.go index 82921a15a..da478938f 100644 --- a/vendor/google.golang.org/grpc/stream.go +++ b/vendor/google.golang.org/grpc/stream.go @@ -21,15 +21,19 @@ package grpc import ( "errors" "io" + "math" + "strconv" "sync" "time" "golang.org/x/net/context" "golang.org/x/net/trace" "google.golang.org/grpc/balancer" - "google.golang.org/grpc/channelz" "google.golang.org/grpc/codes" "google.golang.org/grpc/encoding" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/internal/channelz" + "google.golang.org/grpc/internal/grpcrand" "google.golang.org/grpc/metadata" "google.golang.org/grpc/stats" "google.golang.org/grpc/status" @@ -57,17 +61,29 @@ type StreamDesc struct { // // All errors returned from Stream are compatible with the status package. type Stream interface { - // Context returns the context for this stream. + // Context returns the context for this stream. If called from the client, + // Should be done after Header or RecvMsg. Otherwise, retries may not be + // possible to perform. Context() context.Context - // SendMsg blocks until it sends m, the stream is done or the stream - // breaks. - // On error, it aborts the stream and returns an RPC status on client - // side. On server side, it simply returns the error to the caller. - // SendMsg is called by generated code. Also Users can call SendMsg - // directly when it is really needed in their use cases. - // It's safe to have a goroutine calling SendMsg and another goroutine calling - // recvMsg on the same stream at the same time. - // But it is not safe to call SendMsg on the same stream in different goroutines. + // SendMsg is generally called by generated code. On error, SendMsg aborts + // the stream and returns an RPC status on the client side. On the server + // side, it simply returns the error to the caller. + // + // SendMsg blocks until: + // - It schedules m with the transport, or + // - The stream is done, or + // - The stream breaks. + // + // SendMsg does not wait for an ack. An untimely stream closure + // can result in any buffered messages along the way (including + // those in the client-side buffer that comes with gRPC by default) + // being lost. To ensure delivery, users must call RecvMsg until + // receiving an EOF before closing the stream. + // + // It's safe to have a goroutine calling SendMsg and another + // goroutine calling RecvMsg on the same stream at the same + // time. It is not safe to call SendMsg on the same stream + // in different goroutines. SendMsg(m interface{}) error // RecvMsg blocks until it receives a message or the stream is // done. On client side, it returns io.EOF when the stream is done. On @@ -101,7 +117,21 @@ type ClientStream interface { } // NewStream creates a new Stream for the client side. This is typically -// called by generated code. +// called by generated code. ctx is used for the lifetime of the stream. +// +// To ensure resources are not leaked due to the stream returned, one of the following +// actions must be performed: +// +// 1. Call Close on the ClientConn. +// 2. Cancel the context provided. +// 3. Call RecvMsg until a non-nil error is returned. A protobuf-generated +// client-streaming RPC, for instance, might use the helper function +// CloseAndRecv (note that CloseSend does not Recv, therefore is not +// guaranteed to release all resources). +// 4. Receive a non-nil, non-io.EOF error from Header or SendMsg. +// +// If none of the above happen, a goroutine and a context will be leaked, and grpc +// will not call the optionally-configured stats handler with a stats.End message. func (cc *ClientConn) NewStream(ctx context.Context, desc *StreamDesc, method string, opts ...CallOption) (ClientStream, error) { // allow interceptor to see all applicable call options, which means those // configured as defaults from dial option as well as per-call options @@ -113,8 +143,7 @@ func (cc *ClientConn) NewStream(ctx context.Context, desc *StreamDesc, method st return newClientStream(ctx, desc, cc, method, opts...) } -// NewClientStream creates a new Stream for the client side. This is typically -// called by generated code. +// NewClientStream is a wrapper for ClientConn.NewStream. // // DEPRECATED: Use ClientConn.NewStream instead. func NewClientStream(ctx context.Context, desc *StreamDesc, cc *ClientConn, method string, opts ...CallOption) (ClientStream, error) { @@ -205,15 +234,6 @@ func newClientStream(ctx context.Context, desc *StreamDesc, cc *ClientConn, meth } trInfo.tr.LazyLog(&trInfo.firstLine, false) ctx = trace.NewContext(ctx, trInfo.tr) - defer func() { - if err != nil { - // Need to call tr.finish() if error is returned. - // Because tr will not be returned to caller. - trInfo.tr.LazyPrintf("RPC: [%v]", err) - trInfo.tr.SetError() - trInfo.tr.Finish() - } - }() } ctx = newContextWithRPCInfo(ctx, c.failFast) sh := cc.dopts.copts.StatsHandler @@ -227,80 +247,41 @@ func newClientStream(ctx context.Context, desc *StreamDesc, cc *ClientConn, meth FailFast: c.failFast, } sh.HandleRPC(ctx, begin) - defer func() { - if err != nil { - // Only handle end stats if err != nil. - end := &stats.End{ - Client: true, - Error: err, - BeginTime: beginTime, - EndTime: time.Now(), - } - sh.HandleRPC(ctx, end) - } - }() } - var ( - t transport.ClientTransport - s *transport.Stream - done func(balancer.DoneInfo) - ) - for { - // Check to make sure the context has expired. This will prevent us from - // looping forever if an error occurs for wait-for-ready RPCs where no data - // is sent on the wire. - select { - case <-ctx.Done(): - return nil, toRPCErr(ctx.Err()) - default: - } - - t, done, err = cc.getTransport(ctx, c.failFast) - if err != nil { - return nil, err - } + cs := &clientStream{ + callHdr: callHdr, + ctx: ctx, + methodConfig: &mc, + opts: opts, + callInfo: c, + cc: cc, + desc: desc, + codec: c.codec, + cp: cp, + comp: comp, + cancel: cancel, + beginTime: beginTime, + firstAttempt: true, + } + if !cc.dopts.disableRetry { + cs.retryThrottler = cc.retryThrottler.Load().(*retryThrottler) + } + + cs.callInfo.stream = cs + // Only this initial attempt has stats/tracing. + // TODO(dfawley): move to newAttempt when per-attempt stats are implemented. + if err := cs.newAttemptLocked(sh, trInfo); err != nil { + cs.finish(err) + return nil, err + } - s, err = t.NewStream(ctx, callHdr) - if err != nil { - if done != nil { - done(balancer.DoneInfo{Err: err}) - done = nil - } - // In the event of any error from NewStream, we never attempted to write - // anything to the wire, so we can retry indefinitely for non-fail-fast - // RPCs. - if !c.failFast { - continue - } - return nil, toRPCErr(err) - } - break + op := func(a *csAttempt) error { return a.newStream() } + if err := cs.withRetry(op, func() { cs.bufferForRetryLocked(0, op) }); err != nil { + cs.finish(err) + return nil, err } - cs := &clientStream{ - opts: opts, - c: c, - cc: cc, - desc: desc, - codec: c.codec, - cp: cp, - comp: comp, - cancel: cancel, - attempt: &csAttempt{ - t: t, - s: s, - p: &parser{r: s}, - done: done, - dc: cc.dopts.dc, - ctx: ctx, - trInfo: trInfo, - statsHandler: sh, - beginTime: beginTime, - }, - } - cs.c.stream = cs - cs.attempt.cs = cs if desc != unaryStreamDesc { // Listen on cc and stream contexts to cleanup when the user closes the // ClientConn or cancels the stream context. In all other cases, an error @@ -319,12 +300,45 @@ func newClientStream(ctx context.Context, desc *StreamDesc, cc *ClientConn, meth return cs, nil } +func (cs *clientStream) newAttemptLocked(sh stats.Handler, trInfo traceInfo) error { + cs.attempt = &csAttempt{ + cs: cs, + dc: cs.cc.dopts.dc, + statsHandler: sh, + trInfo: trInfo, + } + + if err := cs.ctx.Err(); err != nil { + return toRPCErr(err) + } + t, done, err := cs.cc.getTransport(cs.ctx, cs.callInfo.failFast) + if err != nil { + return err + } + cs.attempt.t = t + cs.attempt.done = done + return nil +} + +func (a *csAttempt) newStream() error { + cs := a.cs + cs.callHdr.PreviousAttempts = cs.numRetries + s, err := a.t.NewStream(cs.ctx, cs.callHdr) + if err != nil { + return toRPCErr(err) + } + cs.attempt.s = s + cs.attempt.p = &parser{r: s} + return nil +} + // clientStream implements a client side Stream. type clientStream struct { - opts []CallOption - c *callInfo - cc *ClientConn - desc *StreamDesc + callHdr *transport.CallHdr + opts []CallOption + callInfo *callInfo + cc *ClientConn + desc *StreamDesc codec baseCodec cp Compressor @@ -332,13 +346,25 @@ type clientStream struct { cancel context.CancelFunc // cancels all attempts - sentLast bool // sent an end stream + sentLast bool // sent an end stream + beginTime time.Time - mu sync.Mutex // guards finished - finished bool // TODO: replace with atomic cmpxchg or sync.Once? + methodConfig *MethodConfig + + ctx context.Context // the application's context, wrapped by stats/tracing - attempt *csAttempt // the active client stream attempt + retryThrottler *retryThrottler // The throttler active when the RPC began. + + mu sync.Mutex + firstAttempt bool // if true, transparent retry is valid + numRetries int // exclusive of transparent retry attempt(s) + numRetriesSincePushback int // retries since pushback; to reset backoff + finished bool // TODO: replace with atomic cmpxchg or sync.Once? + attempt *csAttempt // the active client stream attempt // TODO(hedging): hedging will have multiple attempts simultaneously. + committed bool // active attempt committed for retry? + buffer []func(a *csAttempt) error // operations to replay on retry + bufferSize int // current size of buffer } // csAttempt implements a single transport stream attempt within a @@ -350,53 +376,298 @@ type csAttempt struct { p *parser done func(balancer.DoneInfo) + finished bool dc Decompressor decomp encoding.Compressor decompSet bool - ctx context.Context // the application's context, wrapped by stats/tracing - mu sync.Mutex // guards trInfo.tr // trInfo.tr is set when created (if EnableTracing is true), // and cleared when the finish method is called. trInfo traceInfo statsHandler stats.Handler - beginTime time.Time +} + +func (cs *clientStream) commitAttemptLocked() { + cs.committed = true + cs.buffer = nil +} + +func (cs *clientStream) commitAttempt() { + cs.mu.Lock() + cs.commitAttemptLocked() + cs.mu.Unlock() +} + +// shouldRetry returns nil if the RPC should be retried; otherwise it returns +// the error that should be returned by the operation. +func (cs *clientStream) shouldRetry(err error) error { + if cs.attempt.s == nil && !cs.callInfo.failFast { + // In the event of any error from NewStream (attempt.s == nil), we + // never attempted to write anything to the wire, so we can retry + // indefinitely for non-fail-fast RPCs. + return nil + } + if cs.finished || cs.committed { + // RPC is finished or committed; cannot retry. + return err + } + // Wait for the trailers. + if cs.attempt.s != nil { + <-cs.attempt.s.Done() + } + if cs.firstAttempt && !cs.callInfo.failFast && (cs.attempt.s == nil || cs.attempt.s.Unprocessed()) { + // First attempt, wait-for-ready, stream unprocessed: transparently retry. + cs.firstAttempt = false + return nil + } + cs.firstAttempt = false + if cs.cc.dopts.disableRetry { + return err + } + + pushback := 0 + hasPushback := false + if cs.attempt.s != nil { + if to, toErr := cs.attempt.s.TrailersOnly(); toErr != nil { + // Context error; stop now. + return toErr + } else if !to { + return err + } + + // TODO(retry): Move down if the spec changes to not check server pushback + // before considering this a failure for throttling. + sps := cs.attempt.s.Trailer()["grpc-retry-pushback-ms"] + if len(sps) == 1 { + var e error + if pushback, e = strconv.Atoi(sps[0]); e != nil || pushback < 0 { + grpclog.Infof("Server retry pushback specified to abort (%q).", sps[0]) + cs.retryThrottler.throttle() // This counts as a failure for throttling. + return err + } + hasPushback = true + } else if len(sps) > 1 { + grpclog.Warningf("Server retry pushback specified multiple values (%q); not retrying.", sps) + cs.retryThrottler.throttle() // This counts as a failure for throttling. + return err + } + } + + var code codes.Code + if cs.attempt.s != nil { + code = cs.attempt.s.Status().Code() + } else { + code = status.Convert(err).Code() + } + + rp := cs.methodConfig.retryPolicy + if rp == nil || !rp.retryableStatusCodes[code] { + return err + } + + // Note: the ordering here is important; we count this as a failure + // only if the code matched a retryable code. + if cs.retryThrottler.throttle() { + return err + } + if cs.numRetries+1 >= rp.maxAttempts { + return err + } + + var dur time.Duration + if hasPushback { + dur = time.Millisecond * time.Duration(pushback) + cs.numRetriesSincePushback = 0 + } else { + fact := math.Pow(rp.backoffMultiplier, float64(cs.numRetriesSincePushback)) + cur := float64(rp.initialBackoff) * fact + if max := float64(rp.maxBackoff); cur > max { + cur = max + } + dur = time.Duration(grpcrand.Int63n(int64(cur))) + cs.numRetriesSincePushback++ + } + + // TODO(dfawley): we could eagerly fail here if dur puts us past the + // deadline, but unsure if it is worth doing. + t := time.NewTimer(dur) + select { + case <-t.C: + cs.numRetries++ + return nil + case <-cs.ctx.Done(): + t.Stop() + return status.FromContextError(cs.ctx.Err()).Err() + } +} + +// Returns nil if a retry was performed and succeeded; error otherwise. +func (cs *clientStream) retryLocked(lastErr error) error { + for { + cs.attempt.finish(lastErr) + if err := cs.shouldRetry(lastErr); err != nil { + cs.commitAttemptLocked() + return err + } + if err := cs.newAttemptLocked(nil, traceInfo{}); err != nil { + return err + } + if lastErr = cs.replayBufferLocked(); lastErr == nil { + return nil + } + } } func (cs *clientStream) Context() context.Context { - // TODO(retry): commit the current attempt (the context has peer-aware data). - return cs.attempt.context() + cs.commitAttempt() + // No need to lock before using attempt, since we know it is committed and + // cannot change. + return cs.attempt.s.Context() +} + +func (cs *clientStream) withRetry(op func(a *csAttempt) error, onSuccess func()) error { + cs.mu.Lock() + for { + if cs.committed { + cs.mu.Unlock() + return op(cs.attempt) + } + a := cs.attempt + cs.mu.Unlock() + err := op(a) + cs.mu.Lock() + if a != cs.attempt { + // We started another attempt already. + continue + } + if err == io.EOF { + <-a.s.Done() + } + if err == nil || (err == io.EOF && a.s.Status().Code() == codes.OK) { + onSuccess() + cs.mu.Unlock() + return err + } + if err := cs.retryLocked(err); err != nil { + cs.mu.Unlock() + return err + } + } } func (cs *clientStream) Header() (metadata.MD, error) { - m, err := cs.attempt.header() + var m metadata.MD + err := cs.withRetry(func(a *csAttempt) error { + var err error + m, err = a.s.Header() + return toRPCErr(err) + }, cs.commitAttemptLocked) if err != nil { - // TODO(retry): maybe retry on error or commit attempt on success. - err = toRPCErr(err) cs.finish(err) } return m, err } func (cs *clientStream) Trailer() metadata.MD { - // TODO(retry): on error, maybe retry (trailers-only). - return cs.attempt.trailer() + // On RPC failure, we never need to retry, because usage requires that + // RecvMsg() returned a non-nil error before calling this function is valid. + // We would have retried earlier if necessary. + // + // Commit the attempt anyway, just in case users are not following those + // directions -- it will prevent races and should not meaningfully impact + // performance. + cs.commitAttempt() + if cs.attempt.s == nil { + return nil + } + return cs.attempt.s.Trailer() +} + +func (cs *clientStream) replayBufferLocked() error { + a := cs.attempt + for _, f := range cs.buffer { + if err := f(a); err != nil { + return err + } + } + return nil +} + +func (cs *clientStream) bufferForRetryLocked(sz int, op func(a *csAttempt) error) { + // Note: we still will buffer if retry is disabled (for transparent retries). + if cs.committed { + return + } + cs.bufferSize += sz + if cs.bufferSize > cs.callInfo.maxRetryRPCBufferSize { + cs.commitAttemptLocked() + return + } + cs.buffer = append(cs.buffer, op) } func (cs *clientStream) SendMsg(m interface{}) (err error) { - // TODO(retry): buffer message for replaying if not committed. - return cs.attempt.sendMsg(m) + defer func() { + if err != nil && err != io.EOF { + // Call finish on the client stream for errors generated by this SendMsg + // call, as these indicate problems created by this client. (Transport + // errors are converted to an io.EOF error in csAttempt.sendMsg; the real + // error will be returned from RecvMsg eventually in that case, or be + // retried.) + cs.finish(err) + } + }() + if cs.sentLast { + return status.Errorf(codes.Internal, "SendMsg called after CloseSend") + } + if !cs.desc.ClientStreams { + cs.sentLast = true + } + data, err := encode(cs.codec, m) + if err != nil { + return err + } + compData, err := compress(data, cs.cp, cs.comp) + if err != nil { + return err + } + hdr, payload := msgHeader(data, compData) + // TODO(dfawley): should we be checking len(data) instead? + if len(payload) > *cs.callInfo.maxSendMessageSize { + return status.Errorf(codes.ResourceExhausted, "trying to send message larger than max (%d vs. %d)", len(payload), *cs.callInfo.maxSendMessageSize) + } + op := func(a *csAttempt) error { + err := a.sendMsg(m, hdr, payload, data) + // nil out the message and uncomp when replaying; they are only needed for + // stats which is disabled for subsequent attempts. + m, data = nil, nil + return err + } + return cs.withRetry(op, func() { cs.bufferForRetryLocked(len(hdr)+len(payload), op) }) } -func (cs *clientStream) RecvMsg(m interface{}) (err error) { - // TODO(retry): maybe retry on error or commit attempt on success. - return cs.attempt.recvMsg(m) +func (cs *clientStream) RecvMsg(m interface{}) error { + err := cs.withRetry(func(a *csAttempt) error { + return a.recvMsg(m) + }, cs.commitAttemptLocked) + if err != nil || !cs.desc.ServerStreams { + // err != nil or non-server-streaming indicates end of stream. + cs.finish(err) + } + return err } func (cs *clientStream) CloseSend() error { - cs.attempt.closeSend() + if cs.sentLast { + // TODO: return an error and finish the stream instead, due to API misuse? + return nil + } + cs.sentLast = true + op := func(a *csAttempt) error { return a.t.Write(a.s, nil, nil, &transport.Options{Last: true}) } + cs.withRetry(op, func() { cs.bufferForRetryLocked(0, op) }) + // We never returned an error here for reasons. return nil } @@ -411,7 +682,11 @@ func (cs *clientStream) finish(err error) { return } cs.finished = true + cs.commitAttemptLocked() cs.mu.Unlock() + if err == nil { + cs.retryThrottler.successfulRPC() + } if channelz.IsOn() { if err != nil { cs.cc.incrCallsFailed() @@ -419,46 +694,20 @@ func (cs *clientStream) finish(err error) { cs.cc.incrCallsSucceeded() } } - // TODO(retry): commit current attempt if necessary. - cs.attempt.finish(err) - for _, o := range cs.opts { - o.after(cs.c) + if cs.attempt != nil { + cs.attempt.finish(err) + } + // after functions all rely upon having a stream. + if cs.attempt.s != nil { + for _, o := range cs.opts { + o.after(cs.callInfo) + } } cs.cancel() } -func (a *csAttempt) context() context.Context { - return a.s.Context() -} - -func (a *csAttempt) header() (metadata.MD, error) { - return a.s.Header() -} - -func (a *csAttempt) trailer() metadata.MD { - return a.s.Trailer() -} - -func (a *csAttempt) sendMsg(m interface{}) (err error) { - // TODO Investigate how to signal the stats handling party. - // generate error stats if err != nil && err != io.EOF? +func (a *csAttempt) sendMsg(m interface{}, hdr, payld, data []byte) error { cs := a.cs - defer func() { - // For non-client-streaming RPCs, we return nil instead of EOF on success - // because the generated code requires it. finish is not called; RecvMsg() - // will call it with the stream's status independently. - if err == io.EOF && !cs.desc.ClientStreams { - err = nil - } - if err != nil && err != io.EOF { - // Call finish on the client stream for errors generated by this SendMsg - // call, as these indicate problems created by this client. (Transport - // errors are converted to an io.EOF error below; the real error will be - // returned from RecvMsg eventually in that case, or be retried.) - cs.finish(err) - } - }() - // TODO: Check cs.sentLast and error if we already ended the stream. if EnableTracing { a.mu.Lock() if a.trInfo.tr != nil { @@ -466,44 +715,26 @@ func (a *csAttempt) sendMsg(m interface{}) (err error) { } a.mu.Unlock() } - var outPayload *stats.OutPayload - if a.statsHandler != nil { - outPayload = &stats.OutPayload{ - Client: true, + if err := a.t.Write(a.s, hdr, payld, &transport.Options{Last: !cs.desc.ClientStreams}); err != nil { + if !cs.desc.ClientStreams { + // For non-client-streaming RPCs, we return nil instead of EOF on error + // because the generated code requires it. finish is not called; RecvMsg() + // will call it with the stream's status independently. + return nil } + return io.EOF } - hdr, data, err := encode(cs.codec, m, cs.cp, outPayload, cs.comp) - if err != nil { - return err - } - if len(data) > *cs.c.maxSendMessageSize { - return status.Errorf(codes.ResourceExhausted, "trying to send message larger than max (%d vs. %d)", len(data), *cs.c.maxSendMessageSize) - } - if !cs.desc.ClientStreams { - cs.sentLast = true + if a.statsHandler != nil { + a.statsHandler.HandleRPC(cs.ctx, outPayload(true, m, data, payld, time.Now())) } - err = a.t.Write(a.s, hdr, data, &transport.Options{Last: !cs.desc.ClientStreams}) - if err == nil { - if outPayload != nil { - outPayload.SentTime = time.Now() - a.statsHandler.HandleRPC(a.ctx, outPayload) - } - if channelz.IsOn() { - a.t.IncrMsgSent() - } - return nil + if channelz.IsOn() { + a.t.IncrMsgSent() } - return io.EOF + return nil } func (a *csAttempt) recvMsg(m interface{}) (err error) { cs := a.cs - defer func() { - if err != nil || !cs.desc.ServerStreams { - // err != nil or non-server-streaming indicates end of stream. - cs.finish(err) - } - }() var inPayload *stats.InPayload if a.statsHandler != nil { inPayload = &stats.InPayload{ @@ -526,7 +757,7 @@ func (a *csAttempt) recvMsg(m interface{}) (err error) { // Only initialize this state once per stream. a.decompSet = true } - err = recv(a.p, cs.codec, a.s, a.dc, m, *cs.c.maxReceiveMessageSize, inPayload, a.decomp) + err = recv(a.p, cs.codec, a.s, a.dc, m, *cs.callInfo.maxReceiveMessageSize, inPayload, a.decomp) if err != nil { if err == io.EOF { if statusErr := a.s.Status().Err(); statusErr != nil { @@ -544,7 +775,7 @@ func (a *csAttempt) recvMsg(m interface{}) (err error) { a.mu.Unlock() } if inPayload != nil { - a.statsHandler.HandleRPC(a.ctx, inPayload) + a.statsHandler.HandleRPC(cs.ctx, inPayload) } if channelz.IsOn() { a.t.IncrMsgRecv() @@ -556,7 +787,7 @@ func (a *csAttempt) recvMsg(m interface{}) (err error) { // Special handling for non-server-stream rpcs. // This recv expects EOF or errors, so we don't collect inPayload. - err = recv(a.p, cs.codec, a.s, a.dc, m, *cs.c.maxReceiveMessageSize, nil, a.decomp) + err = recv(a.p, cs.codec, a.s, a.dc, m, *cs.callInfo.maxReceiveMessageSize, nil, a.decomp) if err == nil { return toRPCErr(errors.New("grpc: client streaming protocol violation: get , want ")) } @@ -566,37 +797,40 @@ func (a *csAttempt) recvMsg(m interface{}) (err error) { return toRPCErr(err) } -func (a *csAttempt) closeSend() { - cs := a.cs - if cs.sentLast { - return - } - cs.sentLast = true - cs.attempt.t.Write(cs.attempt.s, nil, nil, &transport.Options{Last: true}) - // We ignore errors from Write. Any error it would return would also be - // returned by a subsequent RecvMsg call, and the user is supposed to always - // finish the stream by calling RecvMsg until it returns err != nil. -} - func (a *csAttempt) finish(err error) { a.mu.Lock() - a.t.CloseStream(a.s, err) + if a.finished { + a.mu.Unlock() + return + } + a.finished = true + if err == io.EOF { + // Ending a stream with EOF indicates a success. + err = nil + } + if a.s != nil { + a.t.CloseStream(a.s, err) + } if a.done != nil { + br := false + if a.s != nil { + br = a.s.BytesReceived() + } a.done(balancer.DoneInfo{ Err: err, - BytesSent: true, - BytesReceived: a.s.BytesReceived(), + BytesSent: a.s != nil, + BytesReceived: br, }) } if a.statsHandler != nil { end := &stats.End{ Client: true, - BeginTime: a.beginTime, + BeginTime: a.cs.beginTime, EndTime: time.Now(), Error: err, } - a.statsHandler.HandleRPC(a.ctx, end) + a.statsHandler.HandleRPC(a.cs.ctx, end) } if a.trInfo.tr != nil { if err == nil { @@ -696,23 +930,24 @@ func (ss *serverStream) SendMsg(m interface{}) (err error) { ss.t.IncrMsgSent() } }() - var outPayload *stats.OutPayload - if ss.statsHandler != nil { - outPayload = &stats.OutPayload{} + data, err := encode(ss.codec, m) + if err != nil { + return err } - hdr, data, err := encode(ss.codec, m, ss.cp, outPayload, ss.comp) + compData, err := compress(data, ss.cp, ss.comp) if err != nil { return err } - if len(data) > ss.maxSendMessageSize { - return status.Errorf(codes.ResourceExhausted, "trying to send message larger than max (%d vs. %d)", len(data), ss.maxSendMessageSize) + hdr, payload := msgHeader(data, compData) + // TODO(dfawley): should we be checking len(data) instead? + if len(payload) > ss.maxSendMessageSize { + return status.Errorf(codes.ResourceExhausted, "trying to send message larger than max (%d vs. %d)", len(payload), ss.maxSendMessageSize) } - if err := ss.t.Write(ss.s, hdr, data, &transport.Options{Last: false}); err != nil { + if err := ss.t.Write(ss.s, hdr, payload, &transport.Options{Last: false}); err != nil { return toRPCErr(err) } - if outPayload != nil { - outPayload.SentTime = time.Now() - ss.statsHandler.HandleRPC(ss.s.Context(), outPayload) + if ss.statsHandler != nil { + ss.statsHandler.HandleRPC(ss.s.Context(), outPayload(false, m, data, payload, time.Now())) } return nil } diff --git a/vendor/google.golang.org/grpc/stress/client/main.go b/vendor/google.golang.org/grpc/stress/client/main.go index 6e7e733c8..dab8a9d74 100644 --- a/vendor/google.golang.org/grpc/stress/client/main.go +++ b/vendor/google.golang.org/grpc/stress/client/main.go @@ -249,23 +249,23 @@ func performRPCs(gauge *gauge, conn *grpc.ClientConn, selector *weightedRandomTe } func logParameterInfo(addresses []string, tests []testCaseWithWeight) { - grpclog.Printf("server_addresses: %s", *serverAddresses) - grpclog.Printf("test_cases: %s", *testCases) - grpclog.Printf("test_duration_secs: %d", *testDurationSecs) - grpclog.Printf("num_channels_per_server: %d", *numChannelsPerServer) - grpclog.Printf("num_stubs_per_channel: %d", *numStubsPerChannel) - grpclog.Printf("metrics_port: %d", *metricsPort) - grpclog.Printf("use_tls: %t", *useTLS) - grpclog.Printf("use_test_ca: %t", *testCA) - grpclog.Printf("server_host_override: %s", *tlsServerName) - - grpclog.Println("addresses:") + grpclog.Infof("server_addresses: %s", *serverAddresses) + grpclog.Infof("test_cases: %s", *testCases) + grpclog.Infof("test_duration_secs: %d", *testDurationSecs) + grpclog.Infof("num_channels_per_server: %d", *numChannelsPerServer) + grpclog.Infof("num_stubs_per_channel: %d", *numStubsPerChannel) + grpclog.Infof("metrics_port: %d", *metricsPort) + grpclog.Infof("use_tls: %t", *useTLS) + grpclog.Infof("use_test_ca: %t", *testCA) + grpclog.Infof("server_host_override: %s", *tlsServerName) + + grpclog.Infoln("addresses:") for i, addr := range addresses { - grpclog.Printf("%d. %s\n", i+1, addr) + grpclog.Infof("%d. %s\n", i+1, addr) } - grpclog.Println("tests:") + grpclog.Infoln("tests:") for i, test := range tests { - grpclog.Printf("%d. %v\n", i+1, test) + grpclog.Infof("%d. %v\n", i+1, test) } } @@ -332,6 +332,6 @@ func main() { close(stop) } wg.Wait() - grpclog.Printf(" ===== ALL DONE ===== ") + grpclog.Infof(" ===== ALL DONE ===== ") } diff --git a/vendor/google.golang.org/grpc/stress/grpc_testing/metrics.pb.go b/vendor/google.golang.org/grpc/stress/grpc_testing/metrics.pb.go index 466668a4d..31e95d2b8 100644 --- a/vendor/google.golang.org/grpc/stress/grpc_testing/metrics.pb.go +++ b/vendor/google.golang.org/grpc/stress/grpc_testing/metrics.pb.go @@ -1,17 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // source: metrics.proto -/* -Package grpc_testing is a generated protocol buffer package. - -It is generated from these files: - metrics.proto - -It has these top-level messages: - GaugeResponse - GaugeRequest - EmptyMessage -*/ package grpc_testing import proto "github.com/golang/protobuf/proto" @@ -36,31 +25,53 @@ const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package // Response message containing the gauge name and value type GaugeResponse struct { - Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // Types that are valid to be assigned to Value: // *GaugeResponse_LongValue // *GaugeResponse_DoubleValue // *GaugeResponse_StringValue - Value isGaugeResponse_Value `protobuf_oneof:"value"` + Value isGaugeResponse_Value `protobuf_oneof:"value"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *GaugeResponse) Reset() { *m = GaugeResponse{} } -func (m *GaugeResponse) String() string { return proto.CompactTextString(m) } -func (*GaugeResponse) ProtoMessage() {} -func (*GaugeResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } +func (m *GaugeResponse) Reset() { *m = GaugeResponse{} } +func (m *GaugeResponse) String() string { return proto.CompactTextString(m) } +func (*GaugeResponse) ProtoMessage() {} +func (*GaugeResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_metrics_c9a45afc44ac5637, []int{0} +} +func (m *GaugeResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GaugeResponse.Unmarshal(m, b) +} +func (m *GaugeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GaugeResponse.Marshal(b, m, deterministic) +} +func (dst *GaugeResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GaugeResponse.Merge(dst, src) +} +func (m *GaugeResponse) XXX_Size() int { + return xxx_messageInfo_GaugeResponse.Size(m) +} +func (m *GaugeResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GaugeResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GaugeResponse proto.InternalMessageInfo type isGaugeResponse_Value interface { isGaugeResponse_Value() } type GaugeResponse_LongValue struct { - LongValue int64 `protobuf:"varint,2,opt,name=long_value,json=longValue,oneof"` + LongValue int64 `protobuf:"varint,2,opt,name=long_value,json=longValue,proto3,oneof"` } type GaugeResponse_DoubleValue struct { - DoubleValue float64 `protobuf:"fixed64,3,opt,name=double_value,json=doubleValue,oneof"` + DoubleValue float64 `protobuf:"fixed64,3,opt,name=double_value,json=doubleValue,proto3,oneof"` } type GaugeResponse_StringValue struct { - StringValue string `protobuf:"bytes,4,opt,name=string_value,json=stringValue,oneof"` + StringValue string `protobuf:"bytes,4,opt,name=string_value,json=stringValue,proto3,oneof"` } func (*GaugeResponse_LongValue) isGaugeResponse_Value() {} @@ -165,13 +176,13 @@ func _GaugeResponse_OneofSizer(msg proto.Message) (n int) { // value switch x := m.Value.(type) { case *GaugeResponse_LongValue: - n += proto.SizeVarint(2<<3 | proto.WireVarint) + n += 1 // tag and wire n += proto.SizeVarint(uint64(x.LongValue)) case *GaugeResponse_DoubleValue: - n += proto.SizeVarint(3<<3 | proto.WireFixed64) + n += 1 // tag and wire n += 8 case *GaugeResponse_StringValue: - n += proto.SizeVarint(4<<3 | proto.WireBytes) + n += 1 // tag and wire n += proto.SizeVarint(uint64(len(x.StringValue))) n += len(x.StringValue) case nil: @@ -183,13 +194,35 @@ func _GaugeResponse_OneofSizer(msg proto.Message) (n int) { // Request message containing the gauge name type GaugeRequest struct { - Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *GaugeRequest) Reset() { *m = GaugeRequest{} } -func (m *GaugeRequest) String() string { return proto.CompactTextString(m) } -func (*GaugeRequest) ProtoMessage() {} -func (*GaugeRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } +func (m *GaugeRequest) Reset() { *m = GaugeRequest{} } +func (m *GaugeRequest) String() string { return proto.CompactTextString(m) } +func (*GaugeRequest) ProtoMessage() {} +func (*GaugeRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_metrics_c9a45afc44ac5637, []int{1} +} +func (m *GaugeRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GaugeRequest.Unmarshal(m, b) +} +func (m *GaugeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GaugeRequest.Marshal(b, m, deterministic) +} +func (dst *GaugeRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GaugeRequest.Merge(dst, src) +} +func (m *GaugeRequest) XXX_Size() int { + return xxx_messageInfo_GaugeRequest.Size(m) +} +func (m *GaugeRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GaugeRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GaugeRequest proto.InternalMessageInfo func (m *GaugeRequest) GetName() string { if m != nil { @@ -199,12 +232,34 @@ func (m *GaugeRequest) GetName() string { } type EmptyMessage struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *EmptyMessage) Reset() { *m = EmptyMessage{} } +func (m *EmptyMessage) String() string { return proto.CompactTextString(m) } +func (*EmptyMessage) ProtoMessage() {} +func (*EmptyMessage) Descriptor() ([]byte, []int) { + return fileDescriptor_metrics_c9a45afc44ac5637, []int{2} +} +func (m *EmptyMessage) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_EmptyMessage.Unmarshal(m, b) +} +func (m *EmptyMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_EmptyMessage.Marshal(b, m, deterministic) +} +func (dst *EmptyMessage) XXX_Merge(src proto.Message) { + xxx_messageInfo_EmptyMessage.Merge(dst, src) +} +func (m *EmptyMessage) XXX_Size() int { + return xxx_messageInfo_EmptyMessage.Size(m) +} +func (m *EmptyMessage) XXX_DiscardUnknown() { + xxx_messageInfo_EmptyMessage.DiscardUnknown(m) } -func (m *EmptyMessage) Reset() { *m = EmptyMessage{} } -func (m *EmptyMessage) String() string { return proto.CompactTextString(m) } -func (*EmptyMessage) ProtoMessage() {} -func (*EmptyMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } +var xxx_messageInfo_EmptyMessage proto.InternalMessageInfo func init() { proto.RegisterType((*GaugeResponse)(nil), "grpc.testing.GaugeResponse") @@ -220,8 +275,9 @@ var _ grpc.ClientConn // is compatible with the grpc package it is being compiled against. const _ = grpc.SupportPackageIsVersion4 -// Client API for MetricsService service - +// MetricsServiceClient is the client API for MetricsService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type MetricsServiceClient interface { // Returns the values of all the gauges that are currently being maintained by // the service @@ -239,7 +295,7 @@ func NewMetricsServiceClient(cc *grpc.ClientConn) MetricsServiceClient { } func (c *metricsServiceClient) GetAllGauges(ctx context.Context, in *EmptyMessage, opts ...grpc.CallOption) (MetricsService_GetAllGaugesClient, error) { - stream, err := grpc.NewClientStream(ctx, &_MetricsService_serviceDesc.Streams[0], c.cc, "/grpc.testing.MetricsService/GetAllGauges", opts...) + stream, err := c.cc.NewStream(ctx, &_MetricsService_serviceDesc.Streams[0], "/grpc.testing.MetricsService/GetAllGauges", opts...) if err != nil { return nil, err } @@ -272,15 +328,14 @@ func (x *metricsServiceGetAllGaugesClient) Recv() (*GaugeResponse, error) { func (c *metricsServiceClient) GetGauge(ctx context.Context, in *GaugeRequest, opts ...grpc.CallOption) (*GaugeResponse, error) { out := new(GaugeResponse) - err := grpc.Invoke(ctx, "/grpc.testing.MetricsService/GetGauge", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/grpc.testing.MetricsService/GetGauge", in, out, opts...) if err != nil { return nil, err } return out, nil } -// Server API for MetricsService service - +// MetricsServiceServer is the server API for MetricsService service. type MetricsServiceServer interface { // Returns the values of all the gauges that are currently being maintained by // the service @@ -351,9 +406,9 @@ var _MetricsService_serviceDesc = grpc.ServiceDesc{ Metadata: "metrics.proto", } -func init() { proto.RegisterFile("metrics.proto", fileDescriptor0) } +func init() { proto.RegisterFile("metrics.proto", fileDescriptor_metrics_c9a45afc44ac5637) } -var fileDescriptor0 = []byte{ +var fileDescriptor_metrics_c9a45afc44ac5637 = []byte{ // 256 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x91, 0x3f, 0x4f, 0xc3, 0x30, 0x10, 0xc5, 0x6b, 0x5a, 0xfe, 0xf4, 0x70, 0x3b, 0x78, 0xaa, 0xca, 0x40, 0x14, 0x96, 0x4c, 0x11, diff --git a/vendor/google.golang.org/grpc/stress/metrics_client/main.go b/vendor/google.golang.org/grpc/stress/metrics_client/main.go index 6405ec85e..70b024b63 100644 --- a/vendor/google.golang.org/grpc/stress/metrics_client/main.go +++ b/vendor/google.golang.org/grpc/stress/metrics_client/main.go @@ -55,14 +55,14 @@ func printMetrics(client metricspb.MetricsServiceClient, totalOnly bool) { } v := gaugeResponse.GetLongValue() if !totalOnly { - grpclog.Printf("%s: %d", gaugeResponse.Name, v) + grpclog.Infof("%s: %d", gaugeResponse.Name, v) } overallQPS += v } if rpcStatus != io.EOF { grpclog.Fatalf("failed to finish server streaming: %v", rpcStatus) } - grpclog.Printf("overall qps: %d", overallQPS) + grpclog.Infof("overall qps: %d", overallQPS) } func main() { diff --git a/vendor/google.golang.org/grpc/test/codec_perf/perf.pb.go b/vendor/google.golang.org/grpc/test/codec_perf/perf.pb.go index fb6fc5d99..6bcbc3fda 100644 --- a/vendor/google.golang.org/grpc/test/codec_perf/perf.pb.go +++ b/vendor/google.golang.org/grpc/test/codec_perf/perf.pb.go @@ -1,15 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // source: codec_perf/perf.proto -/* -Package codec_perf is a generated protocol buffer package. - -It is generated from these files: - codec_perf/perf.proto - -It has these top-level messages: - Buffer -*/ package codec_perf import proto "github.com/golang/protobuf/proto" @@ -30,13 +21,35 @@ const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package // Buffer is a message that contains a body of bytes that is used to exercise // encoding and decoding overheads. type Buffer struct { - Body []byte `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + Body []byte `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Buffer) Reset() { *m = Buffer{} } +func (m *Buffer) String() string { return proto.CompactTextString(m) } +func (*Buffer) ProtoMessage() {} +func (*Buffer) Descriptor() ([]byte, []int) { + return fileDescriptor_perf_6cc81a33b24d08e7, []int{0} +} +func (m *Buffer) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Buffer.Unmarshal(m, b) +} +func (m *Buffer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Buffer.Marshal(b, m, deterministic) +} +func (dst *Buffer) XXX_Merge(src proto.Message) { + xxx_messageInfo_Buffer.Merge(dst, src) +} +func (m *Buffer) XXX_Size() int { + return xxx_messageInfo_Buffer.Size(m) +} +func (m *Buffer) XXX_DiscardUnknown() { + xxx_messageInfo_Buffer.DiscardUnknown(m) } -func (m *Buffer) Reset() { *m = Buffer{} } -func (m *Buffer) String() string { return proto.CompactTextString(m) } -func (*Buffer) ProtoMessage() {} -func (*Buffer) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } +var xxx_messageInfo_Buffer proto.InternalMessageInfo func (m *Buffer) GetBody() []byte { if m != nil { @@ -49,9 +62,9 @@ func init() { proto.RegisterType((*Buffer)(nil), "codec.perf.Buffer") } -func init() { proto.RegisterFile("codec_perf/perf.proto", fileDescriptor0) } +func init() { proto.RegisterFile("codec_perf/perf.proto", fileDescriptor_perf_6cc81a33b24d08e7) } -var fileDescriptor0 = []byte{ +var fileDescriptor_perf_6cc81a33b24d08e7 = []byte{ // 83 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4d, 0xce, 0x4f, 0x49, 0x4d, 0x8e, 0x2f, 0x48, 0x2d, 0x4a, 0xd3, 0x07, 0x11, 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, diff --git a/vendor/google.golang.org/grpc/test/grpc_testing/test.pb.go b/vendor/google.golang.org/grpc/test/grpc_testing/test.pb.go index ab48a1524..871f7cc98 100644 --- a/vendor/google.golang.org/grpc/test/grpc_testing/test.pb.go +++ b/vendor/google.golang.org/grpc/test/grpc_testing/test.pb.go @@ -1,23 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // source: grpc_testing/test.proto -/* -Package grpc_testing is a generated protocol buffer package. - -It is generated from these files: - grpc_testing/test.proto - -It has these top-level messages: - Empty - Payload - SimpleRequest - SimpleResponse - StreamingInputCallRequest - StreamingInputCallResponse - ResponseParameters - StreamingOutputCallRequest - StreamingOutputCallResponse -*/ package grpc_testing import proto "github.com/golang/protobuf/proto" @@ -66,28 +49,74 @@ var PayloadType_value = map[string]int32{ func (x PayloadType) String() string { return proto.EnumName(PayloadType_name, int32(x)) } -func (PayloadType) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } +func (PayloadType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_test_c9f6c5af4267cb88, []int{0} +} type Empty struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *Empty) Reset() { *m = Empty{} } -func (m *Empty) String() string { return proto.CompactTextString(m) } -func (*Empty) ProtoMessage() {} -func (*Empty) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } +func (m *Empty) Reset() { *m = Empty{} } +func (m *Empty) String() string { return proto.CompactTextString(m) } +func (*Empty) ProtoMessage() {} +func (*Empty) Descriptor() ([]byte, []int) { + return fileDescriptor_test_c9f6c5af4267cb88, []int{0} +} +func (m *Empty) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Empty.Unmarshal(m, b) +} +func (m *Empty) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Empty.Marshal(b, m, deterministic) +} +func (dst *Empty) XXX_Merge(src proto.Message) { + xxx_messageInfo_Empty.Merge(dst, src) +} +func (m *Empty) XXX_Size() int { + return xxx_messageInfo_Empty.Size(m) +} +func (m *Empty) XXX_DiscardUnknown() { + xxx_messageInfo_Empty.DiscardUnknown(m) +} + +var xxx_messageInfo_Empty proto.InternalMessageInfo // A block of data, to simply increase gRPC message size. type Payload struct { // The type of data in body. - Type PayloadType `protobuf:"varint,1,opt,name=type,enum=grpc.testing.PayloadType" json:"type,omitempty"` + Type PayloadType `protobuf:"varint,1,opt,name=type,proto3,enum=grpc.testing.PayloadType" json:"type,omitempty"` // Primary contents of payload. - Body []byte `protobuf:"bytes,2,opt,name=body,proto3" json:"body,omitempty"` + Body []byte `protobuf:"bytes,2,opt,name=body,proto3" json:"body,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *Payload) Reset() { *m = Payload{} } -func (m *Payload) String() string { return proto.CompactTextString(m) } -func (*Payload) ProtoMessage() {} -func (*Payload) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } +func (m *Payload) Reset() { *m = Payload{} } +func (m *Payload) String() string { return proto.CompactTextString(m) } +func (*Payload) ProtoMessage() {} +func (*Payload) Descriptor() ([]byte, []int) { + return fileDescriptor_test_c9f6c5af4267cb88, []int{1} +} +func (m *Payload) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Payload.Unmarshal(m, b) +} +func (m *Payload) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Payload.Marshal(b, m, deterministic) +} +func (dst *Payload) XXX_Merge(src proto.Message) { + xxx_messageInfo_Payload.Merge(dst, src) +} +func (m *Payload) XXX_Size() int { + return xxx_messageInfo_Payload.Size(m) +} +func (m *Payload) XXX_DiscardUnknown() { + xxx_messageInfo_Payload.DiscardUnknown(m) +} + +var xxx_messageInfo_Payload proto.InternalMessageInfo func (m *Payload) GetType() PayloadType { if m != nil { @@ -107,22 +136,44 @@ func (m *Payload) GetBody() []byte { type SimpleRequest struct { // Desired payload type in the response from the server. // If response_type is RANDOM, server randomly chooses one from other formats. - ResponseType PayloadType `protobuf:"varint,1,opt,name=response_type,json=responseType,enum=grpc.testing.PayloadType" json:"response_type,omitempty"` + ResponseType PayloadType `protobuf:"varint,1,opt,name=response_type,json=responseType,proto3,enum=grpc.testing.PayloadType" json:"response_type,omitempty"` // Desired payload size in the response from the server. // If response_type is COMPRESSABLE, this denotes the size before compression. - ResponseSize int32 `protobuf:"varint,2,opt,name=response_size,json=responseSize" json:"response_size,omitempty"` + ResponseSize int32 `protobuf:"varint,2,opt,name=response_size,json=responseSize,proto3" json:"response_size,omitempty"` // Optional input payload sent along with the request. - Payload *Payload `protobuf:"bytes,3,opt,name=payload" json:"payload,omitempty"` + Payload *Payload `protobuf:"bytes,3,opt,name=payload,proto3" json:"payload,omitempty"` // Whether SimpleResponse should include username. - FillUsername bool `protobuf:"varint,4,opt,name=fill_username,json=fillUsername" json:"fill_username,omitempty"` + FillUsername bool `protobuf:"varint,4,opt,name=fill_username,json=fillUsername,proto3" json:"fill_username,omitempty"` // Whether SimpleResponse should include OAuth scope. - FillOauthScope bool `protobuf:"varint,5,opt,name=fill_oauth_scope,json=fillOauthScope" json:"fill_oauth_scope,omitempty"` + FillOauthScope bool `protobuf:"varint,5,opt,name=fill_oauth_scope,json=fillOauthScope,proto3" json:"fill_oauth_scope,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *SimpleRequest) Reset() { *m = SimpleRequest{} } -func (m *SimpleRequest) String() string { return proto.CompactTextString(m) } -func (*SimpleRequest) ProtoMessage() {} -func (*SimpleRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } +func (m *SimpleRequest) Reset() { *m = SimpleRequest{} } +func (m *SimpleRequest) String() string { return proto.CompactTextString(m) } +func (*SimpleRequest) ProtoMessage() {} +func (*SimpleRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_test_c9f6c5af4267cb88, []int{2} +} +func (m *SimpleRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SimpleRequest.Unmarshal(m, b) +} +func (m *SimpleRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SimpleRequest.Marshal(b, m, deterministic) +} +func (dst *SimpleRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_SimpleRequest.Merge(dst, src) +} +func (m *SimpleRequest) XXX_Size() int { + return xxx_messageInfo_SimpleRequest.Size(m) +} +func (m *SimpleRequest) XXX_DiscardUnknown() { + xxx_messageInfo_SimpleRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_SimpleRequest proto.InternalMessageInfo func (m *SimpleRequest) GetResponseType() PayloadType { if m != nil { @@ -162,18 +213,40 @@ func (m *SimpleRequest) GetFillOauthScope() bool { // Unary response, as configured by the request. type SimpleResponse struct { // Payload to increase message size. - Payload *Payload `protobuf:"bytes,1,opt,name=payload" json:"payload,omitempty"` + Payload *Payload `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"` // The user the request came from, for verifying authentication was // successful when the client expected it. - Username string `protobuf:"bytes,2,opt,name=username" json:"username,omitempty"` + Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"` // OAuth scope. - OauthScope string `protobuf:"bytes,3,opt,name=oauth_scope,json=oauthScope" json:"oauth_scope,omitempty"` + OauthScope string `protobuf:"bytes,3,opt,name=oauth_scope,json=oauthScope,proto3" json:"oauth_scope,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SimpleResponse) Reset() { *m = SimpleResponse{} } +func (m *SimpleResponse) String() string { return proto.CompactTextString(m) } +func (*SimpleResponse) ProtoMessage() {} +func (*SimpleResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_test_c9f6c5af4267cb88, []int{3} +} +func (m *SimpleResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SimpleResponse.Unmarshal(m, b) +} +func (m *SimpleResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SimpleResponse.Marshal(b, m, deterministic) +} +func (dst *SimpleResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_SimpleResponse.Merge(dst, src) +} +func (m *SimpleResponse) XXX_Size() int { + return xxx_messageInfo_SimpleResponse.Size(m) +} +func (m *SimpleResponse) XXX_DiscardUnknown() { + xxx_messageInfo_SimpleResponse.DiscardUnknown(m) } -func (m *SimpleResponse) Reset() { *m = SimpleResponse{} } -func (m *SimpleResponse) String() string { return proto.CompactTextString(m) } -func (*SimpleResponse) ProtoMessage() {} -func (*SimpleResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } +var xxx_messageInfo_SimpleResponse proto.InternalMessageInfo func (m *SimpleResponse) GetPayload() *Payload { if m != nil { @@ -199,13 +272,35 @@ func (m *SimpleResponse) GetOauthScope() string { // Client-streaming request. type StreamingInputCallRequest struct { // Optional input payload sent along with the request. - Payload *Payload `protobuf:"bytes,1,opt,name=payload" json:"payload,omitempty"` + Payload *Payload `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StreamingInputCallRequest) Reset() { *m = StreamingInputCallRequest{} } +func (m *StreamingInputCallRequest) String() string { return proto.CompactTextString(m) } +func (*StreamingInputCallRequest) ProtoMessage() {} +func (*StreamingInputCallRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_test_c9f6c5af4267cb88, []int{4} +} +func (m *StreamingInputCallRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_StreamingInputCallRequest.Unmarshal(m, b) +} +func (m *StreamingInputCallRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_StreamingInputCallRequest.Marshal(b, m, deterministic) +} +func (dst *StreamingInputCallRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_StreamingInputCallRequest.Merge(dst, src) +} +func (m *StreamingInputCallRequest) XXX_Size() int { + return xxx_messageInfo_StreamingInputCallRequest.Size(m) +} +func (m *StreamingInputCallRequest) XXX_DiscardUnknown() { + xxx_messageInfo_StreamingInputCallRequest.DiscardUnknown(m) } -func (m *StreamingInputCallRequest) Reset() { *m = StreamingInputCallRequest{} } -func (m *StreamingInputCallRequest) String() string { return proto.CompactTextString(m) } -func (*StreamingInputCallRequest) ProtoMessage() {} -func (*StreamingInputCallRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} } +var xxx_messageInfo_StreamingInputCallRequest proto.InternalMessageInfo func (m *StreamingInputCallRequest) GetPayload() *Payload { if m != nil { @@ -217,13 +312,35 @@ func (m *StreamingInputCallRequest) GetPayload() *Payload { // Client-streaming response. type StreamingInputCallResponse struct { // Aggregated size of payloads received from the client. - AggregatedPayloadSize int32 `protobuf:"varint,1,opt,name=aggregated_payload_size,json=aggregatedPayloadSize" json:"aggregated_payload_size,omitempty"` + AggregatedPayloadSize int32 `protobuf:"varint,1,opt,name=aggregated_payload_size,json=aggregatedPayloadSize,proto3" json:"aggregated_payload_size,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *StreamingInputCallResponse) Reset() { *m = StreamingInputCallResponse{} } -func (m *StreamingInputCallResponse) String() string { return proto.CompactTextString(m) } -func (*StreamingInputCallResponse) ProtoMessage() {} -func (*StreamingInputCallResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} } +func (m *StreamingInputCallResponse) Reset() { *m = StreamingInputCallResponse{} } +func (m *StreamingInputCallResponse) String() string { return proto.CompactTextString(m) } +func (*StreamingInputCallResponse) ProtoMessage() {} +func (*StreamingInputCallResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_test_c9f6c5af4267cb88, []int{5} +} +func (m *StreamingInputCallResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_StreamingInputCallResponse.Unmarshal(m, b) +} +func (m *StreamingInputCallResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_StreamingInputCallResponse.Marshal(b, m, deterministic) +} +func (dst *StreamingInputCallResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_StreamingInputCallResponse.Merge(dst, src) +} +func (m *StreamingInputCallResponse) XXX_Size() int { + return xxx_messageInfo_StreamingInputCallResponse.Size(m) +} +func (m *StreamingInputCallResponse) XXX_DiscardUnknown() { + xxx_messageInfo_StreamingInputCallResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_StreamingInputCallResponse proto.InternalMessageInfo func (m *StreamingInputCallResponse) GetAggregatedPayloadSize() int32 { if m != nil { @@ -236,16 +353,38 @@ func (m *StreamingInputCallResponse) GetAggregatedPayloadSize() int32 { type ResponseParameters struct { // Desired payload sizes in responses from the server. // If response_type is COMPRESSABLE, this denotes the size before compression. - Size int32 `protobuf:"varint,1,opt,name=size" json:"size,omitempty"` + Size int32 `protobuf:"varint,1,opt,name=size,proto3" json:"size,omitempty"` // Desired interval between consecutive responses in the response stream in // microseconds. - IntervalUs int32 `protobuf:"varint,2,opt,name=interval_us,json=intervalUs" json:"interval_us,omitempty"` + IntervalUs int32 `protobuf:"varint,2,opt,name=interval_us,json=intervalUs,proto3" json:"interval_us,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ResponseParameters) Reset() { *m = ResponseParameters{} } +func (m *ResponseParameters) String() string { return proto.CompactTextString(m) } +func (*ResponseParameters) ProtoMessage() {} +func (*ResponseParameters) Descriptor() ([]byte, []int) { + return fileDescriptor_test_c9f6c5af4267cb88, []int{6} +} +func (m *ResponseParameters) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ResponseParameters.Unmarshal(m, b) +} +func (m *ResponseParameters) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ResponseParameters.Marshal(b, m, deterministic) +} +func (dst *ResponseParameters) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResponseParameters.Merge(dst, src) +} +func (m *ResponseParameters) XXX_Size() int { + return xxx_messageInfo_ResponseParameters.Size(m) +} +func (m *ResponseParameters) XXX_DiscardUnknown() { + xxx_messageInfo_ResponseParameters.DiscardUnknown(m) } -func (m *ResponseParameters) Reset() { *m = ResponseParameters{} } -func (m *ResponseParameters) String() string { return proto.CompactTextString(m) } -func (*ResponseParameters) ProtoMessage() {} -func (*ResponseParameters) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} } +var xxx_messageInfo_ResponseParameters proto.InternalMessageInfo func (m *ResponseParameters) GetSize() int32 { if m != nil { @@ -267,17 +406,39 @@ type StreamingOutputCallRequest struct { // If response_type is RANDOM, the payload from each response in the stream // might be of different types. This is to simulate a mixed type of payload // stream. - ResponseType PayloadType `protobuf:"varint,1,opt,name=response_type,json=responseType,enum=grpc.testing.PayloadType" json:"response_type,omitempty"` + ResponseType PayloadType `protobuf:"varint,1,opt,name=response_type,json=responseType,proto3,enum=grpc.testing.PayloadType" json:"response_type,omitempty"` // Configuration for each expected response message. - ResponseParameters []*ResponseParameters `protobuf:"bytes,2,rep,name=response_parameters,json=responseParameters" json:"response_parameters,omitempty"` + ResponseParameters []*ResponseParameters `protobuf:"bytes,2,rep,name=response_parameters,json=responseParameters,proto3" json:"response_parameters,omitempty"` // Optional input payload sent along with the request. - Payload *Payload `protobuf:"bytes,3,opt,name=payload" json:"payload,omitempty"` + Payload *Payload `protobuf:"bytes,3,opt,name=payload,proto3" json:"payload,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *StreamingOutputCallRequest) Reset() { *m = StreamingOutputCallRequest{} } -func (m *StreamingOutputCallRequest) String() string { return proto.CompactTextString(m) } -func (*StreamingOutputCallRequest) ProtoMessage() {} -func (*StreamingOutputCallRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} } +func (m *StreamingOutputCallRequest) Reset() { *m = StreamingOutputCallRequest{} } +func (m *StreamingOutputCallRequest) String() string { return proto.CompactTextString(m) } +func (*StreamingOutputCallRequest) ProtoMessage() {} +func (*StreamingOutputCallRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_test_c9f6c5af4267cb88, []int{7} +} +func (m *StreamingOutputCallRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_StreamingOutputCallRequest.Unmarshal(m, b) +} +func (m *StreamingOutputCallRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_StreamingOutputCallRequest.Marshal(b, m, deterministic) +} +func (dst *StreamingOutputCallRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_StreamingOutputCallRequest.Merge(dst, src) +} +func (m *StreamingOutputCallRequest) XXX_Size() int { + return xxx_messageInfo_StreamingOutputCallRequest.Size(m) +} +func (m *StreamingOutputCallRequest) XXX_DiscardUnknown() { + xxx_messageInfo_StreamingOutputCallRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_StreamingOutputCallRequest proto.InternalMessageInfo func (m *StreamingOutputCallRequest) GetResponseType() PayloadType { if m != nil { @@ -303,13 +464,35 @@ func (m *StreamingOutputCallRequest) GetPayload() *Payload { // Server-streaming response, as configured by the request and parameters. type StreamingOutputCallResponse struct { // Payload to increase response size. - Payload *Payload `protobuf:"bytes,1,opt,name=payload" json:"payload,omitempty"` + Payload *Payload `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StreamingOutputCallResponse) Reset() { *m = StreamingOutputCallResponse{} } +func (m *StreamingOutputCallResponse) String() string { return proto.CompactTextString(m) } +func (*StreamingOutputCallResponse) ProtoMessage() {} +func (*StreamingOutputCallResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_test_c9f6c5af4267cb88, []int{8} +} +func (m *StreamingOutputCallResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_StreamingOutputCallResponse.Unmarshal(m, b) +} +func (m *StreamingOutputCallResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_StreamingOutputCallResponse.Marshal(b, m, deterministic) +} +func (dst *StreamingOutputCallResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_StreamingOutputCallResponse.Merge(dst, src) +} +func (m *StreamingOutputCallResponse) XXX_Size() int { + return xxx_messageInfo_StreamingOutputCallResponse.Size(m) +} +func (m *StreamingOutputCallResponse) XXX_DiscardUnknown() { + xxx_messageInfo_StreamingOutputCallResponse.DiscardUnknown(m) } -func (m *StreamingOutputCallResponse) Reset() { *m = StreamingOutputCallResponse{} } -func (m *StreamingOutputCallResponse) String() string { return proto.CompactTextString(m) } -func (*StreamingOutputCallResponse) ProtoMessage() {} -func (*StreamingOutputCallResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} } +var xxx_messageInfo_StreamingOutputCallResponse proto.InternalMessageInfo func (m *StreamingOutputCallResponse) GetPayload() *Payload { if m != nil { @@ -339,8 +522,9 @@ var _ grpc.ClientConn // is compatible with the grpc package it is being compiled against. const _ = grpc.SupportPackageIsVersion4 -// Client API for TestService service - +// TestServiceClient is the client API for TestService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type TestServiceClient interface { // One empty request followed by one empty response. EmptyCall(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Empty, error) @@ -374,7 +558,7 @@ func NewTestServiceClient(cc *grpc.ClientConn) TestServiceClient { func (c *testServiceClient) EmptyCall(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Empty, error) { out := new(Empty) - err := grpc.Invoke(ctx, "/grpc.testing.TestService/EmptyCall", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/grpc.testing.TestService/EmptyCall", in, out, opts...) if err != nil { return nil, err } @@ -383,7 +567,7 @@ func (c *testServiceClient) EmptyCall(ctx context.Context, in *Empty, opts ...gr func (c *testServiceClient) UnaryCall(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (*SimpleResponse, error) { out := new(SimpleResponse) - err := grpc.Invoke(ctx, "/grpc.testing.TestService/UnaryCall", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/grpc.testing.TestService/UnaryCall", in, out, opts...) if err != nil { return nil, err } @@ -391,7 +575,7 @@ func (c *testServiceClient) UnaryCall(ctx context.Context, in *SimpleRequest, op } func (c *testServiceClient) StreamingOutputCall(ctx context.Context, in *StreamingOutputCallRequest, opts ...grpc.CallOption) (TestService_StreamingOutputCallClient, error) { - stream, err := grpc.NewClientStream(ctx, &_TestService_serviceDesc.Streams[0], c.cc, "/grpc.testing.TestService/StreamingOutputCall", opts...) + stream, err := c.cc.NewStream(ctx, &_TestService_serviceDesc.Streams[0], "/grpc.testing.TestService/StreamingOutputCall", opts...) if err != nil { return nil, err } @@ -423,7 +607,7 @@ func (x *testServiceStreamingOutputCallClient) Recv() (*StreamingOutputCallRespo } func (c *testServiceClient) StreamingInputCall(ctx context.Context, opts ...grpc.CallOption) (TestService_StreamingInputCallClient, error) { - stream, err := grpc.NewClientStream(ctx, &_TestService_serviceDesc.Streams[1], c.cc, "/grpc.testing.TestService/StreamingInputCall", opts...) + stream, err := c.cc.NewStream(ctx, &_TestService_serviceDesc.Streams[1], "/grpc.testing.TestService/StreamingInputCall", opts...) if err != nil { return nil, err } @@ -457,7 +641,7 @@ func (x *testServiceStreamingInputCallClient) CloseAndRecv() (*StreamingInputCal } func (c *testServiceClient) FullDuplexCall(ctx context.Context, opts ...grpc.CallOption) (TestService_FullDuplexCallClient, error) { - stream, err := grpc.NewClientStream(ctx, &_TestService_serviceDesc.Streams[2], c.cc, "/grpc.testing.TestService/FullDuplexCall", opts...) + stream, err := c.cc.NewStream(ctx, &_TestService_serviceDesc.Streams[2], "/grpc.testing.TestService/FullDuplexCall", opts...) if err != nil { return nil, err } @@ -488,7 +672,7 @@ func (x *testServiceFullDuplexCallClient) Recv() (*StreamingOutputCallResponse, } func (c *testServiceClient) HalfDuplexCall(ctx context.Context, opts ...grpc.CallOption) (TestService_HalfDuplexCallClient, error) { - stream, err := grpc.NewClientStream(ctx, &_TestService_serviceDesc.Streams[3], c.cc, "/grpc.testing.TestService/HalfDuplexCall", opts...) + stream, err := c.cc.NewStream(ctx, &_TestService_serviceDesc.Streams[3], "/grpc.testing.TestService/HalfDuplexCall", opts...) if err != nil { return nil, err } @@ -518,8 +702,7 @@ func (x *testServiceHalfDuplexCallClient) Recv() (*StreamingOutputCallResponse, return m, nil } -// Server API for TestService service - +// TestServiceServer is the server API for TestService service. type TestServiceServer interface { // One empty request followed by one empty response. EmptyCall(context.Context, *Empty) (*Empty, error) @@ -722,9 +905,9 @@ var _TestService_serviceDesc = grpc.ServiceDesc{ Metadata: "grpc_testing/test.proto", } -func init() { proto.RegisterFile("grpc_testing/test.proto", fileDescriptor0) } +func init() { proto.RegisterFile("grpc_testing/test.proto", fileDescriptor_test_c9f6c5af4267cb88) } -var fileDescriptor0 = []byte{ +var fileDescriptor_test_c9f6c5af4267cb88 = []byte{ // 587 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x55, 0xdb, 0x6e, 0xd3, 0x40, 0x10, 0x65, 0xdb, 0xf4, 0x36, 0x49, 0xad, 0x68, 0xab, 0xaa, 0xae, 0x8b, 0x84, 0x65, 0x1e, 0x30, diff --git a/vendor/google.golang.org/grpc/transport/controlbuf.go b/vendor/google.golang.org/grpc/transport/controlbuf.go index e147cd51b..853d9ef32 100644 --- a/vendor/google.golang.org/grpc/transport/controlbuf.go +++ b/vendor/google.golang.org/grpc/transport/controlbuf.go @@ -28,6 +28,10 @@ import ( "golang.org/x/net/http2/hpack" ) +var updateHeaderTblSize = func(e *hpack.Encoder, v uint32) { + e.SetMaxDynamicTableSizeLimit(v) +} + type itemNode struct { it interface{} next *itemNode @@ -80,6 +84,13 @@ func (il *itemList) isEmpty() bool { // the control buffer of transport. They represent different aspects of // control tasks, e.g., flow control, settings, streaming resetting, etc. +// registerStream is used to register an incoming stream with loopy writer. +type registerStream struct { + streamID uint32 + wq *writeQuota +} + +// headerFrame is also used to register stream on the client-side. type headerFrame struct { streamID uint32 hf []hpack.HeaderField @@ -218,6 +229,12 @@ func (l *outStreamList) dequeue() *outStream { return b } +// controlBuffer is a way to pass information to loopy. +// Information is passed as specific struct types called control frames. +// A control frame not only represents data, messages or headers to be sent out +// but can also be used to instruct loopy to update its internal state. +// It shouldn't be confused with an HTTP2 frame, although some of the control frames +// like dataFrame and headerFrame do go out on wire as HTTP2 frames. type controlBuffer struct { ch chan struct{} done <-chan struct{} @@ -324,13 +341,29 @@ const ( serverSide ) +// Loopy receives frames from the control buffer. +// Each frame is handled individually; most of the work done by loopy goes +// into handling data frames. Loopy maintains a queue of active streams, and each +// stream maintains a queue of data frames; as loopy receives data frames +// it gets added to the queue of the relevant stream. +// Loopy goes over this list of active streams by processing one node every iteration, +// thereby closely resemebling to a round-robin scheduling over all streams. While +// processing a stream, loopy writes out data bytes from this stream capped by the min +// of http2MaxFrameLen, connection-level flow control and stream-level flow control. type loopyWriter struct { - side side - cbuf *controlBuffer - sendQuota uint32 - oiws uint32 // outbound initial window size. - estdStreams map[uint32]*outStream // Established streams. - activeStreams *outStreamList // Streams that are sending data. + side side + cbuf *controlBuffer + sendQuota uint32 + oiws uint32 // outbound initial window size. + // estdStreams is map of all established streams that are not cleaned-up yet. + // On client-side, this is all streams whose headers were sent out. + // On server-side, this is all streams whose headers were received. + estdStreams map[uint32]*outStream // Established streams. + // activeStreams is a linked-list of all streams that have data to send and some + // stream-level flow control quota. + // Each of these streams internally have a list of data items(and perhaps trailers + // on the server-side) to be sent out. + activeStreams *outStreamList framer *framer hBuf *bytes.Buffer // The buffer for HPACK encoding. hEnc *hpack.Encoder // HPACK encoder. @@ -361,44 +394,62 @@ func newLoopyWriter(s side, fr *framer, cbuf *controlBuffer, bdpEst *bdpEstimato const minBatchSize = 1000 // run should be run in a separate goroutine. -func (l *loopyWriter) run() { - var ( - it interface{} - err error - isEmpty bool - ) +// It reads control frames from controlBuf and processes them by: +// 1. Updating loopy's internal state, or/and +// 2. Writing out HTTP2 frames on the wire. +// +// Loopy keeps all active streams with data to send in a linked-list. +// All streams in the activeStreams linked-list must have both: +// 1. Data to send, and +// 2. Stream level flow control quota available. +// +// In each iteration of run loop, other than processing the incoming control +// frame, loopy calls processData, which processes one node from the activeStreams linked-list. +// This results in writing of HTTP2 frames into an underlying write buffer. +// When there's no more control frames to read from controlBuf, loopy flushes the write buffer. +// As an optimization, to increase the batch size for each flush, loopy yields the processor, once +// if the batch size is too low to give stream goroutines a chance to fill it up. +func (l *loopyWriter) run() (err error) { defer func() { - errorf("transport: loopyWriter.run returning. Err: %v", err) + if err == ErrConnClosing { + // Don't log ErrConnClosing as error since it happens + // 1. When the connection is closed by some other known issue. + // 2. User closed the connection. + // 3. A graceful close of connection. + infof("transport: loopyWriter.run returning. %v", err) + err = nil + } }() for { - it, err = l.cbuf.get(true) + it, err := l.cbuf.get(true) if err != nil { - return + return err } if err = l.handle(it); err != nil { - return + return err } if _, err = l.processData(); err != nil { - return + return err } gosched := true hasdata: for { - it, err = l.cbuf.get(false) + it, err := l.cbuf.get(false) if err != nil { - return + return err } if it != nil { if err = l.handle(it); err != nil { - return + return err } if _, err = l.processData(); err != nil { - return + return err } continue hasdata } - if isEmpty, err = l.processData(); err != nil { - return + isEmpty, err := l.processData() + if err != nil { + return err } if !isEmpty { continue hasdata @@ -450,30 +501,39 @@ func (l *loopyWriter) incomingSettingsHandler(s *incomingSettings) error { return l.framer.fr.WriteSettingsAck() } +func (l *loopyWriter) registerStreamHandler(h *registerStream) error { + str := &outStream{ + id: h.streamID, + state: empty, + itl: &itemList{}, + wq: h.wq, + } + l.estdStreams[h.streamID] = str + return nil +} + func (l *loopyWriter) headerHandler(h *headerFrame) error { if l.side == serverSide { - if h.endStream { // Case 1.A: Server wants to close stream. - // Make sure it's not a trailers only response. - if str, ok := l.estdStreams[h.streamID]; ok { - if str.state != empty { // either active or waiting on stream quota. - // add it str's list of items. - str.itl.enqueue(h) - return nil - } - } - if err := l.writeHeader(h.streamID, h.endStream, h.hf, h.onWrite); err != nil { - return err - } - return l.cleanupStreamHandler(h.cleanup) + str, ok := l.estdStreams[h.streamID] + if !ok { + warningf("transport: loopy doesn't recognize the stream: %d", h.streamID) + return nil + } + // Case 1.A: Server is responding back with headers. + if !h.endStream { + return l.writeHeader(h.streamID, h.endStream, h.hf, h.onWrite) } - // Case 1.B: Server is responding back with headers. - str := &outStream{ - state: empty, - itl: &itemList{}, - wq: h.wq, + // else: Case 1.B: Server wants to close stream. + + if str.state != empty { // either active or waiting on stream quota. + // add it str's list of items. + str.itl.enqueue(h) + return nil } - l.estdStreams[h.streamID] = str - return l.writeHeader(h.streamID, h.endStream, h.hf, h.onWrite) + if err := l.writeHeader(h.streamID, h.endStream, h.hf, h.onWrite); err != nil { + return err + } + return l.cleanupStreamHandler(h.cleanup) } // Case 2: Client wants to originate stream. str := &outStream{ @@ -632,6 +692,8 @@ func (l *loopyWriter) handle(i interface{}) error { return l.outgoingSettingsHandler(i) case *headerFrame: return l.headerHandler(i) + case *registerStream: + return l.registerStreamHandler(i) case *cleanupStream: return l.cleanupStreamHandler(i) case *incomingGoAway: @@ -664,26 +726,37 @@ func (l *loopyWriter) applySettings(ss []http2.Setting) error { } } } + case http2.SettingHeaderTableSize: + updateHeaderTblSize(l.hEnc, s.Val) } } return nil } +// processData removes the first stream from active streams, writes out at most 16KB +// of its data and then puts it at the end of activeStreams if there's still more data +// to be sent and stream has some stream-level flow control. func (l *loopyWriter) processData() (bool, error) { if l.sendQuota == 0 { return true, nil } - str := l.activeStreams.dequeue() + str := l.activeStreams.dequeue() // Remove the first stream. if str == nil { return true, nil } - dataItem := str.itl.peek().(*dataFrame) - if len(dataItem.h) == 0 && len(dataItem.d) == 0 { + dataItem := str.itl.peek().(*dataFrame) // Peek at the first data item this stream. + // A data item is represented by a dataFrame, since it later translates into + // multiple HTTP2 data frames. + // Every dataFrame has two buffers; h that keeps grpc-message header and d that is acutal data. + // As an optimization to keep wire traffic low, data from d is copied to h to make as big as the + // maximum possilbe HTTP2 frame size. + + if len(dataItem.h) == 0 && len(dataItem.d) == 0 { // Empty data frame // Client sends out empty data frame with endStream = true if err := l.framer.fr.WriteData(dataItem.streamID, dataItem.endStream, nil); err != nil { return false, err } - str.itl.dequeue() + str.itl.dequeue() // remove the empty data item from stream if str.itl.isEmpty() { str.state = empty } else if trailer, ok := str.itl.peek().(*headerFrame); ok { // the next item is trailers. @@ -712,21 +785,20 @@ func (l *loopyWriter) processData() (bool, error) { if len(buf) < size { size = len(buf) } - if strQuota := int(l.oiws) - str.bytesOutStanding; strQuota <= 0 { + if strQuota := int(l.oiws) - str.bytesOutStanding; strQuota <= 0 { // stream-level flow control. str.state = waitingOnStreamQuota return false, nil } else if strQuota < size { size = strQuota } - if l.sendQuota < uint32(size) { + if l.sendQuota < uint32(size) { // connection-level flow control. size = int(l.sendQuota) } // Now that outgoing flow controls are checked we can replenish str's write quota str.wq.replenish(size) var endStream bool - // This last data message on this stream and all - // of it can be written in this go. + // If this is the last data message on this stream and all of it can be written in this iteration. if dataItem.endStream && size == len(buf) { // buf contains either data or it contains header but data is empty. if idx == 1 || len(dataItem.d) == 0 { diff --git a/vendor/google.golang.org/grpc/transport/flowcontrol.go b/vendor/google.golang.org/grpc/transport/flowcontrol.go index 378f5c450..bbf98b6f5 100644 --- a/vendor/google.golang.org/grpc/transport/flowcontrol.go +++ b/vendor/google.golang.org/grpc/transport/flowcontrol.go @@ -58,14 +58,20 @@ type writeQuota struct { ch chan struct{} // done is triggered in error case. done <-chan struct{} + // replenish is called by loopyWriter to give quota back to. + // It is implemented as a field so that it can be updated + // by tests. + replenish func(n int) } func newWriteQuota(sz int32, done <-chan struct{}) *writeQuota { - return &writeQuota{ + w := &writeQuota{ quota: sz, ch: make(chan struct{}, 1), done: done, } + w.replenish = w.realReplenish + return w } func (w *writeQuota) get(sz int32) error { @@ -83,7 +89,7 @@ func (w *writeQuota) get(sz int32) error { } } -func (w *writeQuota) replenish(n int) { +func (w *writeQuota) realReplenish(n int) { sz := int32(n) a := atomic.AddInt32(&w.quota, sz) b := a - sz diff --git a/vendor/google.golang.org/grpc/transport/go16.go b/vendor/google.golang.org/grpc/transport/go16.go index 5babcf9b8..e0d00115d 100644 --- a/vendor/google.golang.org/grpc/transport/go16.go +++ b/vendor/google.golang.org/grpc/transport/go16.go @@ -25,6 +25,7 @@ import ( "net/http" "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" "golang.org/x/net/context" ) @@ -34,15 +35,15 @@ func dialContext(ctx context.Context, network, address string) (net.Conn, error) return (&net.Dialer{Cancel: ctx.Done()}).Dial(network, address) } -// ContextErr converts the error from context package into a StreamError. -func ContextErr(err error) StreamError { +// ContextErr converts the error from context package into a status error. +func ContextErr(err error) error { switch err { case context.DeadlineExceeded: - return streamErrorf(codes.DeadlineExceeded, "%v", err) + return status.Error(codes.DeadlineExceeded, err.Error()) case context.Canceled: - return streamErrorf(codes.Canceled, "%v", err) + return status.Error(codes.Canceled, err.Error()) } - return streamErrorf(codes.Internal, "Unexpected error from context packet: %v", err) + return status.Errorf(codes.Internal, "Unexpected error from context packet: %v", err) } // contextFromRequest returns a background context. diff --git a/vendor/google.golang.org/grpc/transport/go17.go b/vendor/google.golang.org/grpc/transport/go17.go index b7fa6bdb9..4d515b00d 100644 --- a/vendor/google.golang.org/grpc/transport/go17.go +++ b/vendor/google.golang.org/grpc/transport/go17.go @@ -26,6 +26,7 @@ import ( "net/http" "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" netctx "golang.org/x/net/context" ) @@ -35,15 +36,15 @@ func dialContext(ctx context.Context, network, address string) (net.Conn, error) return (&net.Dialer{}).DialContext(ctx, network, address) } -// ContextErr converts the error from context package into a StreamError. -func ContextErr(err error) StreamError { +// ContextErr converts the error from context package into a status error. +func ContextErr(err error) error { switch err { case context.DeadlineExceeded, netctx.DeadlineExceeded: - return streamErrorf(codes.DeadlineExceeded, "%v", err) + return status.Error(codes.DeadlineExceeded, err.Error()) case context.Canceled, netctx.Canceled: - return streamErrorf(codes.Canceled, "%v", err) + return status.Error(codes.Canceled, err.Error()) } - return streamErrorf(codes.Internal, "Unexpected error from context packet: %v", err) + return status.Errorf(codes.Internal, "Unexpected error from context packet: %v", err) } // contextFromRequest returns a context from the HTTP Request. diff --git a/vendor/google.golang.org/grpc/transport/handler_server.go b/vendor/google.golang.org/grpc/transport/handler_server.go index a75338009..f71b74821 100644 --- a/vendor/google.golang.org/grpc/transport/handler_server.go +++ b/vendor/google.golang.org/grpc/transport/handler_server.go @@ -92,7 +92,7 @@ func NewServerHandlerTransport(w http.ResponseWriter, r *http.Request, stats sta } for k, vv := range r.Header { k = strings.ToLower(k) - if isReservedHeader(k) && !isWhitelistedPseudoHeader(k) { + if isReservedHeader(k) && !isWhitelistedHeader(k) { continue } for _, v := range vv { diff --git a/vendor/google.golang.org/grpc/transport/http2_client.go b/vendor/google.golang.org/grpc/transport/http2_client.go index ab97cb571..528efcd49 100644 --- a/vendor/google.golang.org/grpc/transport/http2_client.go +++ b/vendor/google.golang.org/grpc/transport/http2_client.go @@ -22,6 +22,7 @@ import ( "io" "math" "net" + "strconv" "strings" "sync" "sync/atomic" @@ -31,9 +32,9 @@ import ( "golang.org/x/net/http2" "golang.org/x/net/http2/hpack" - "google.golang.org/grpc/channelz" "google.golang.org/grpc/codes" "google.golang.org/grpc/credentials" + "google.golang.org/grpc/internal/channelz" "google.golang.org/grpc/keepalive" "google.golang.org/grpc/metadata" "google.golang.org/grpc/peer" @@ -76,8 +77,9 @@ type http2Client struct { // Boolean to keep track of reading activity on transport. // 1 is true and 0 is false. - activity uint32 // Accessed atomically. - kp keepalive.ClientParameters + activity uint32 // Accessed atomically. + kp keepalive.ClientParameters + keepaliveEnabled bool statsHandler stats.Handler @@ -195,14 +197,8 @@ func newHTTP2Client(connectCtx, ctx context.Context, addr TargetInfo, opts Conne icwz = opts.InitialConnWindowSize dynamicWindow = false } - writeBufSize := defaultWriteBufSize - if opts.WriteBufferSize > 0 { - writeBufSize = opts.WriteBufferSize - } - readBufSize := defaultReadBufSize - if opts.ReadBufferSize > 0 { - readBufSize = opts.ReadBufferSize - } + writeBufSize := opts.WriteBufferSize + readBufSize := opts.ReadBufferSize t := &http2Client{ ctx: ctx, ctxDone: ctx.Done(), // Cache Done chan. @@ -259,6 +255,10 @@ func newHTTP2Client(connectCtx, ctx context.Context, addr TargetInfo, opts Conne if channelz.IsOn() { t.channelzID = channelz.RegisterNormalSocket(t, opts.ChannelzParentID, "") } + if t.kp.Time != infinity { + t.keepaliveEnabled = true + go t.keepalive() + } // Start the reader goroutine for incoming message. Each transport has // a dedicated goroutine which reads HTTP2 frame from network. Then it // dispatches the frame to the corresponding stream entity. @@ -295,13 +295,17 @@ func newHTTP2Client(connectCtx, ctx context.Context, addr TargetInfo, opts Conne t.framer.writer.Flush() go func() { t.loopy = newLoopyWriter(clientSide, t.framer, t.controlBuf, t.bdpEst) - t.loopy.run() - t.conn.Close() + err := t.loopy.run() + if err != nil { + errorf("transport: loopyWriter.run returning. Err: %v", err) + } + // If it's a connection error, let reader goroutine handle it + // since there might be data in the buffers. + if _, ok := err.(net.Error); !ok { + t.conn.Close() + } close(t.writerDone) }() - if t.kp.Time != infinity { - go t.keepalive() - } return t, nil } @@ -370,6 +374,9 @@ func (t *http2Client) createHeaderFields(ctx context.Context, callHdr *CallHdr) headerFields = append(headerFields, hpack.HeaderField{Name: "content-type", Value: contentType(callHdr.ContentSubtype)}) headerFields = append(headerFields, hpack.HeaderField{Name: "user-agent", Value: t.userAgent}) headerFields = append(headerFields, hpack.HeaderField{Name: "te", Value: "trailers"}) + if callHdr.PreviousAttempts > 0 { + headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-previous-rpc-attempts", Value: strconv.Itoa(callHdr.PreviousAttempts)}) + } if callHdr.SendCompress != "" { headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-encoding", Value: callHdr.SendCompress}) @@ -537,7 +544,7 @@ func (t *http2Client) NewStream(ctx context.Context, callHdr *CallHdr) (_ *Strea var sendPing bool // If the number of active streams change from 0 to 1, then check if keepalive // has gone dormant. If so, wake it up. - if len(t.activeStreams) == 1 { + if len(t.activeStreams) == 1 && t.keepaliveEnabled { select { case t.awakenKeepalive <- struct{}{}: sendPing = true @@ -624,7 +631,7 @@ func (t *http2Client) CloseStream(s *Stream, err error) { rst = true rstCode = http2.ErrCodeCancel } - t.closeStream(s, err, rst, rstCode, nil, nil, false) + t.closeStream(s, err, rst, rstCode, status.Convert(err), nil, false) } func (t *http2Client) closeStream(s *Stream, err error, rst bool, rstCode http2.ErrCode, st *status.Status, mdata map[string][]string, eosReceived bool) { @@ -648,6 +655,7 @@ func (t *http2Client) closeStream(s *Stream, err error, rst bool, rstCode http2. close(s.done) // If headerChan isn't closed, then close it. if atomic.SwapUint32(&s.headerDone, 1) == 0 { + s.noHeaders = true close(s.headerChan) } cleanup := &cleanupStream{ @@ -706,7 +714,7 @@ func (t *http2Client) Close() error { } // Notify all active streams. for _, s := range streams { - t.closeStream(s, ErrConnClosing, false, http2.ErrCodeNo, nil, nil, false) + t.closeStream(s, ErrConnClosing, false, http2.ErrCodeNo, status.New(codes.Unavailable, ErrConnClosing.Desc), nil, false) } if t.statsHandler != nil { connEnd := &stats.ConnEnd{ @@ -735,6 +743,7 @@ func (t *http2Client) GracefulClose() error { if active == 0 { return t.Close() } + t.controlBuf.put(&incomingGoAway{}) return nil } @@ -1050,8 +1059,7 @@ func (t *http2Client) operateHeaders(frame *http2.MetaHeadersFrame) { atomic.StoreUint32(&s.bytesReceived, 1) var state decodeState if err := state.decodeResponseHeader(frame); err != nil { - // TODO(mmukhi, dfawley): Perhaps send a reset stream. - t.closeStream(s, err, false, http2.ErrCodeNo, nil, nil, false) + t.closeStream(s, err, true, http2.ErrCodeProtocol, status.New(codes.Internal, err.Error()), nil, false) // Something wrong. Stops reading even when there is remaining. return } @@ -1087,6 +1095,8 @@ func (t *http2Client) operateHeaders(frame *http2.MetaHeadersFrame) { if len(state.mdata) > 0 { s.header = state.mdata } + } else { + s.noHeaders = true } close(s.headerChan) } @@ -1110,7 +1120,9 @@ func (t *http2Client) reader() { t.Close() return } - atomic.CompareAndSwapUint32(&t.activity, 0, 1) + if t.keepaliveEnabled { + atomic.CompareAndSwapUint32(&t.activity, 0, 1) + } sf, ok := frame.(*http2.SettingsFrame) if !ok { t.Close() @@ -1122,7 +1134,9 @@ func (t *http2Client) reader() { // loop to keep reading incoming messages on this transport. for { frame, err := t.framer.fr.ReadFrame() - atomic.CompareAndSwapUint32(&t.activity, 0, 1) + if t.keepaliveEnabled { + atomic.CompareAndSwapUint32(&t.activity, 0, 1) + } if err != nil { // Abort an active stream if the http2.Framer returns a // http2.StreamError. This can happen only if the server's response @@ -1133,8 +1147,9 @@ func (t *http2Client) reader() { t.mu.Unlock() if s != nil { // use error detail to provide better err message - // TODO(mmukhi, dfawley): Perhaps send a RST_STREAM to the server. - t.closeStream(s, streamErrorf(http2ErrConvTab[se.Code], "%v", t.framer.fr.ErrorDetail()), false, http2.ErrCodeNo, nil, nil, false) + code := http2ErrConvTab[se.Code] + msg := t.framer.fr.ErrorDetail().Error() + t.closeStream(s, streamError(code, msg), true, http2.ErrCodeProtocol, status.New(code, msg), nil, false) } continue } else { @@ -1245,12 +1260,14 @@ func (t *http2Client) ChannelzMetric() *channelz.SocketInternalMetric { LastMessageSentTimestamp: t.lastMsgSent, LastMessageReceivedTimestamp: t.lastMsgRecv, LocalFlowControlWindow: int64(t.fc.getSize()), - //socket options - LocalAddr: t.localAddr, - RemoteAddr: t.remoteAddr, - // Security + SocketOptions: channelz.GetSocketOption(t.conn), + LocalAddr: t.localAddr, + RemoteAddr: t.remoteAddr, // RemoteName : } + if au, ok := t.authInfo.(credentials.ChannelzSecurityInfo); ok { + s.Security = au.GetSecurityValue() + } t.czmu.RUnlock() s.RemoteFlowControlWindow = t.getOutFlowWindow() return &s diff --git a/vendor/google.golang.org/grpc/transport/http2_server.go b/vendor/google.golang.org/grpc/transport/http2_server.go index 8b93e222e..6b1ceabe1 100644 --- a/vendor/google.golang.org/grpc/transport/http2_server.go +++ b/vendor/google.golang.org/grpc/transport/http2_server.go @@ -24,7 +24,6 @@ import ( "fmt" "io" "math" - "math/rand" "net" "strconv" "sync" @@ -36,9 +35,11 @@ import ( "golang.org/x/net/http2" "golang.org/x/net/http2/hpack" - "google.golang.org/grpc/channelz" "google.golang.org/grpc/codes" "google.golang.org/grpc/credentials" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/internal/channelz" + "google.golang.org/grpc/internal/grpcrand" "google.golang.org/grpc/keepalive" "google.golang.org/grpc/metadata" "google.golang.org/grpc/peer" @@ -129,14 +130,8 @@ type http2Server struct { // newHTTP2Server constructs a ServerTransport based on HTTP2. ConnectionError is // returned if something goes wrong. func newHTTP2Server(conn net.Conn, config *ServerConfig) (_ ServerTransport, err error) { - writeBufSize := defaultWriteBufSize - if config.WriteBufferSize > 0 { - writeBufSize = config.WriteBufferSize - } - readBufSize := defaultReadBufSize - if config.ReadBufferSize > 0 { - readBufSize = config.ReadBufferSize - } + writeBufSize := config.WriteBufferSize + readBufSize := config.ReadBufferSize framer := newFramer(conn, writeBufSize, readBufSize) // Send initial settings as connection preface to client. var isettings []http2.Setting @@ -273,7 +268,9 @@ func newHTTP2Server(conn net.Conn, config *ServerConfig) (_ ServerTransport, err go func() { t.loopy = newLoopyWriter(serverSide, t.framer, t.controlBuf, t.bdpEst) t.loopy.ssGoAwayHandler = t.outgoingGoAwayHandler - t.loopy.run() + if err := t.loopy.run(); err != nil { + errorf("transport: loopyWriter.run returning. Err: %v", err) + } t.conn.Close() close(t.writerDone) }() @@ -413,6 +410,11 @@ func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func( t.updateWindow(s, uint32(n)) }, } + // Register the stream with loopy. + t.controlBuf.put(®isterStream{ + streamID: s.id, + wq: s.wq, + }) handle(s) return } @@ -682,12 +684,25 @@ func (t *http2Server) handleWindowUpdate(f *http2.WindowUpdateFrame) { }) } +func appendHeaderFieldsFromMD(headerFields []hpack.HeaderField, md metadata.MD) []hpack.HeaderField { + for k, vv := range md { + if isReservedHeader(k) { + // Clients don't tolerate reading restricted headers after some non restricted ones were sent. + continue + } + for _, v := range vv { + headerFields = append(headerFields, hpack.HeaderField{Name: k, Value: encodeMetadataHeader(k, v)}) + } + } + return headerFields +} + // WriteHeader sends the header metedata md back to the client. func (t *http2Server) WriteHeader(s *Stream, md metadata.MD) error { - if s.headerOk || s.getState() == streamDone { + if s.updateHeaderSent() || s.getState() == streamDone { return ErrIllegalHeaderWrite } - s.headerOk = true + s.hdrMu.Lock() if md.Len() > 0 { if s.header.Len() > 0 { s.header = metadata.Join(s.header, md) @@ -695,7 +710,12 @@ func (t *http2Server) WriteHeader(s *Stream, md metadata.MD) error { s.header = md } } - md = s.header + t.writeHeaderLocked(s) + s.hdrMu.Unlock() + return nil +} + +func (t *http2Server) writeHeaderLocked(s *Stream) { // TODO(mmukhi): Benchmark if the performance gets better if count the metadata and other header fields // first and create a slice of that exact size. headerFields := make([]hpack.HeaderField, 0, 2) // at least :status, content-type will be there if none else. @@ -704,15 +724,7 @@ func (t *http2Server) WriteHeader(s *Stream, md metadata.MD) error { if s.sendCompress != "" { headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-encoding", Value: s.sendCompress}) } - for k, vv := range md { - if isReservedHeader(k) { - // Clients don't tolerate reading restricted headers after some non restricted ones were sent. - continue - } - for _, v := range vv { - headerFields = append(headerFields, hpack.HeaderField{Name: k, Value: encodeMetadataHeader(k, v)}) - } - } + headerFields = appendHeaderFieldsFromMD(headerFields, s.header) t.controlBuf.put(&headerFrame{ streamID: s.id, hf: headerFields, @@ -720,7 +732,6 @@ func (t *http2Server) WriteHeader(s *Stream, md metadata.MD) error { onWrite: func() { atomic.StoreUint32(&t.resetPingStrikes, 1) }, - wq: s.wq, }) if t.stats != nil { // Note: WireLength is not set in outHeader. @@ -728,7 +739,6 @@ func (t *http2Server) WriteHeader(s *Stream, md metadata.MD) error { outHeader := &stats.OutHeader{} t.stats.HandleRPC(s.Context(), outHeader) } - return nil } // WriteStatus sends stream status to the client and terminates the stream. @@ -736,21 +746,20 @@ func (t *http2Server) WriteHeader(s *Stream, md metadata.MD) error { // TODO(zhaoq): Now it indicates the end of entire stream. Revisit if early // OK is adopted. func (t *http2Server) WriteStatus(s *Stream, st *status.Status) error { - if !s.headerOk && s.header.Len() > 0 { - if err := t.WriteHeader(s, nil); err != nil { - return err - } - } else { - if s.getState() == streamDone { - return nil - } + if s.getState() == streamDone { + return nil } + s.hdrMu.Lock() // TODO(mmukhi): Benchmark if the performance gets better if count the metadata and other header fields // first and create a slice of that exact size. headerFields := make([]hpack.HeaderField, 0, 2) // grpc-status and grpc-message will be there if none else. - if !s.headerOk { - headerFields = append(headerFields, hpack.HeaderField{Name: ":status", Value: "200"}) - headerFields = append(headerFields, hpack.HeaderField{Name: "content-type", Value: contentType(s.contentSubtype)}) + if !s.updateHeaderSent() { // No headers have been sent. + if len(s.header) > 0 { // Send a separate header frame. + t.writeHeaderLocked(s) + } else { // Send a trailer only response. + headerFields = append(headerFields, hpack.HeaderField{Name: ":status", Value: "200"}) + headerFields = append(headerFields, hpack.HeaderField{Name: "content-type", Value: contentType(s.contentSubtype)}) + } } headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-status", Value: strconv.Itoa(int(st.Code()))}) headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-message", Value: encodeGrpcMessage(st.Message())}) @@ -759,23 +768,15 @@ func (t *http2Server) WriteStatus(s *Stream, st *status.Status) error { stBytes, err := proto.Marshal(p) if err != nil { // TODO: return error instead, when callers are able to handle it. - panic(err) + grpclog.Errorf("transport: failed to marshal rpc status: %v, error: %v", p, err) + } else { + headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-status-details-bin", Value: encodeBinHeader(stBytes)}) } - - headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-status-details-bin", Value: encodeBinHeader(stBytes)}) } // Attach the trailer metadata. - for k, vv := range s.trailer { - // Clients don't tolerate reading restricted headers after some non restricted ones were sent. - if isReservedHeader(k) { - continue - } - for _, v := range vv { - headerFields = append(headerFields, hpack.HeaderField{Name: k, Value: encodeMetadataHeader(k, v)}) - } - } - trailer := &headerFrame{ + headerFields = appendHeaderFieldsFromMD(headerFields, s.trailer) + trailingHeader := &headerFrame{ streamID: s.id, hf: headerFields, endStream: true, @@ -783,7 +784,8 @@ func (t *http2Server) WriteStatus(s *Stream, st *status.Status) error { atomic.StoreUint32(&t.resetPingStrikes, 1) }, } - t.closeStream(s, false, 0, trailer, true) + s.hdrMu.Unlock() + t.closeStream(s, false, 0, trailingHeader, true) if t.stats != nil { t.stats.HandleRPC(s.Context(), &stats.OutTrailer{}) } @@ -793,7 +795,7 @@ func (t *http2Server) WriteStatus(s *Stream, st *status.Status) error { // Write converts the data into HTTP2 data frame and sends it out. Non-nil error // is returns if it fails (e.g., framing error, transport error). func (t *http2Server) Write(s *Stream, hdr []byte, data []byte, opts *Options) error { - if !s.headerOk { // Headers haven't been written yet. + if !s.isHeaderSent() { // Headers haven't been written yet. if err := t.WriteHeader(s, nil); err != nil { // TODO(mmukhi, dfawley): Make sure this is the right code to return. return streamErrorf(codes.Internal, "transport: %v", err) @@ -1083,12 +1085,14 @@ func (t *http2Server) ChannelzMetric() *channelz.SocketInternalMetric { LastMessageSentTimestamp: t.lastMsgSent, LastMessageReceivedTimestamp: t.lastMsgRecv, LocalFlowControlWindow: int64(t.fc.getSize()), - //socket options - LocalAddr: t.localAddr, - RemoteAddr: t.remoteAddr, - // Security + SocketOptions: channelz.GetSocketOption(t.conn), + LocalAddr: t.localAddr, + RemoteAddr: t.remoteAddr, // RemoteName : } + if au, ok := t.authInfo.(credentials.ChannelzSecurityInfo); ok { + s.Security = au.GetSecurityValue() + } t.czmu.RUnlock() s.RemoteFlowControlWindow = t.getOutFlowWindow() return &s @@ -1123,14 +1127,12 @@ func (t *http2Server) getOutFlowWindow() int64 { } } -var rgen = rand.New(rand.NewSource(time.Now().UnixNano())) - func getJitter(v time.Duration) time.Duration { if v == infinity { return 0 } // Generate a jitter between +/- 10% of the value. r := int64(v / 10) - j := rgen.Int63n(2*r) - r + j := grpcrand.Int63n(2*r) - r return time.Duration(j) } diff --git a/vendor/google.golang.org/grpc/transport/http_util.go b/vendor/google.golang.org/grpc/transport/http_util.go index c9091a329..0c1b2b1c1 100644 --- a/vendor/google.golang.org/grpc/transport/http_util.go +++ b/vendor/google.golang.org/grpc/transport/http_util.go @@ -23,11 +23,13 @@ import ( "bytes" "encoding/base64" "fmt" + "io" "net" "net/http" "strconv" "strings" "time" + "unicode/utf8" "github.com/golang/protobuf/proto" "golang.org/x/net/http2" @@ -42,9 +44,6 @@ const ( http2MaxFrameLen = 16384 // 16KB frame // http://http2.github.io/http2-spec/#SettingValues http2InitHeaderTableSize = 4096 - // http2IOBufSize specifies the buffer size for sending frames. - defaultWriteBufSize = 32 * 1024 - defaultReadBufSize = 32 * 1024 // baseContentType is the base content-type for gRPC. This is a valid // content-type on it's own, but can also include a content-subtype such as // "proto" as a suffix after "+" or ";". See @@ -131,12 +130,16 @@ func isReservedHeader(hdr string) bool { } switch hdr { case "content-type", + "user-agent", "grpc-message-type", "grpc-encoding", "grpc-message", "grpc-status", "grpc-timeout", "grpc-status-details-bin", + // Intentionally exclude grpc-previous-rpc-attempts and + // grpc-retry-pushback-ms, which are "reserved", but their API + // intentionally works via metadata. "te": return true default: @@ -144,11 +147,11 @@ func isReservedHeader(hdr string) bool { } } -// isWhitelistedPseudoHeader checks whether hdr belongs to HTTP2 pseudoheaders -// that should be propagated into metadata visible to users. -func isWhitelistedPseudoHeader(hdr string) bool { +// isWhitelistedHeader checks whether hdr should be propagated into metadata +// visible to users, even though it is classified as "reserved", above. +func isWhitelistedHeader(hdr string) bool { switch hdr { - case ":authority": + case ":authority", "user-agent": return true default: return false @@ -339,7 +342,7 @@ func (d *decodeState) processHeaderField(f hpack.HeaderField) error { d.statsTrace = v d.addMetadata(f.Name, string(v)) default: - if isReservedHeader(f.Name) && !isWhitelistedPseudoHeader(f.Name) { + if isReservedHeader(f.Name) && !isWhitelistedHeader(f.Name) { break } v, err := decodeMetadataHeader(f.Name, f.Value) @@ -436,16 +439,17 @@ func decodeTimeout(s string) (time.Duration, error) { const ( spaceByte = ' ' - tildaByte = '~' + tildeByte = '~' percentByte = '%' ) // encodeGrpcMessage is used to encode status code in header field -// "grpc-message". -// It checks to see if each individual byte in msg is an -// allowable byte, and then either percent encoding or passing it through. -// When percent encoding, the byte is converted into hexadecimal notation -// with a '%' prepended. +// "grpc-message". It does percent encoding and also replaces invalid utf-8 +// characters with Unicode replacement character. +// +// It checks to see if each individual byte in msg is an allowable byte, and +// then either percent encoding or passing it through. When percent encoding, +// the byte is converted into hexadecimal notation with a '%' prepended. func encodeGrpcMessage(msg string) string { if msg == "" { return "" @@ -453,7 +457,7 @@ func encodeGrpcMessage(msg string) string { lenMsg := len(msg) for i := 0; i < lenMsg; i++ { c := msg[i] - if !(c >= spaceByte && c < tildaByte && c != percentByte) { + if !(c >= spaceByte && c <= tildeByte && c != percentByte) { return encodeGrpcMessageUnchecked(msg) } } @@ -462,14 +466,26 @@ func encodeGrpcMessage(msg string) string { func encodeGrpcMessageUnchecked(msg string) string { var buf bytes.Buffer - lenMsg := len(msg) - for i := 0; i < lenMsg; i++ { - c := msg[i] - if c >= spaceByte && c < tildaByte && c != percentByte { - buf.WriteByte(c) - } else { - buf.WriteString(fmt.Sprintf("%%%02X", c)) + for len(msg) > 0 { + r, size := utf8.DecodeRuneInString(msg) + for _, b := range []byte(string(r)) { + if size > 1 { + // If size > 1, r is not ascii. Always do percent encoding. + buf.WriteString(fmt.Sprintf("%%%02X", b)) + continue + } + + // The for loop is necessary even if size == 1. r could be + // utf8.RuneError. + // + // fmt.Sprintf("%%%02X", utf8.RuneError) gives "%FFFD". + if b >= spaceByte && b <= tildeByte && b != percentByte { + buf.WriteByte(b) + } else { + buf.WriteString(fmt.Sprintf("%%%02X", b)) + } } + msg = msg[size:] } return buf.String() } @@ -530,10 +546,17 @@ func (w *bufWriter) Write(b []byte) (n int, err error) { if w.err != nil { return 0, w.err } - n = copy(w.buf[w.offset:], b) - w.offset += n - if w.offset >= w.batchSize { - err = w.Flush() + if w.batchSize == 0 { // Buffer has been disabled. + return w.conn.Write(b) + } + for len(b) > 0 { + nn := copy(w.buf[w.offset:], b) + b = b[nn:] + w.offset += nn + n += nn + if w.offset >= w.batchSize { + err = w.Flush() + } } return n, err } @@ -559,7 +582,13 @@ type framer struct { } func newFramer(conn net.Conn, writeBufferSize, readBufferSize int) *framer { - r := bufio.NewReaderSize(conn, readBufferSize) + if writeBufferSize < 0 { + writeBufferSize = 0 + } + var r io.Reader = conn + if readBufferSize > 0 { + r = bufio.NewReaderSize(r, readBufferSize) + } w := newBufWriter(conn, writeBufferSize) f := &framer{ writer: w, diff --git a/vendor/google.golang.org/grpc/transport/transport.go b/vendor/google.golang.org/grpc/transport/transport.go index 2f643a3d0..62d6e6bbd 100644 --- a/vendor/google.golang.org/grpc/transport/transport.go +++ b/vendor/google.golang.org/grpc/transport/transport.go @@ -185,13 +185,22 @@ type Stream struct { headerChan chan struct{} // closed to indicate the end of header metadata. headerDone uint32 // set when headerChan is closed. Used to avoid closing headerChan multiple times. - header metadata.MD // the received header metadata. - trailer metadata.MD // the key-value map of trailer metadata. - headerOk bool // becomes true from the first header is about to send - state streamState + // hdrMu protects header and trailer metadata on the server-side. + hdrMu sync.Mutex + header metadata.MD // the received header metadata. + trailer metadata.MD // the key-value map of trailer metadata. - status *status.Status // the status error received from the server + noHeaders bool // set if the client never received headers (set only after the stream is done). + + // On the server-side, headerSent is atomically set to 1 when the headers are sent out. + headerSent uint32 + + state streamState + + // On client-side it is the status error received from the server. + // On server-side it is unused. + status *status.Status bytesReceived uint32 // indicates whether any bytes have been received on this stream unprocessed uint32 // set if the server sends a refused stream or GOAWAY including this stream @@ -201,6 +210,17 @@ type Stream struct { contentSubtype string } +// isHeaderSent is only valid on the server-side. +func (s *Stream) isHeaderSent() bool { + return atomic.LoadUint32(&s.headerSent) == 1 +} + +// updateHeaderSent updates headerSent and returns true +// if it was alreay set. It is valid only on server-side. +func (s *Stream) updateHeaderSent() bool { + return atomic.SwapUint32(&s.headerSent, 1) == 1 +} + func (s *Stream) swapState(st streamState) streamState { return streamState(atomic.SwapUint32((*uint32)(&s.state), uint32(st))) } @@ -264,6 +284,19 @@ func (s *Stream) Header() (metadata.MD, error) { return nil, err } +// TrailersOnly blocks until a header or trailers-only frame is received and +// then returns true if the stream was trailers-only. If the stream ends +// before headers are received, returns true, nil. If a context error happens +// first, returns it as a status error. Client-side only. +func (s *Stream) TrailersOnly() (bool, error) { + err := s.waitOnHeader() + if err != nil { + return false, err + } + // if !headerDone, some other connection error occurred. + return s.noHeaders && atomic.LoadUint32(&s.headerDone) == 1, nil +} + // Trailer returns the cached trailer metedata. Note that if it is not called // after the entire stream is done, it could return an empty MD. Client // side only. @@ -301,7 +334,7 @@ func (s *Stream) Method() string { // Status returns the status received from the server. // Status can be read safely only after the stream has ended, -// that is, read or write has returned io.EOF. +// that is, after Done() is closed. func (s *Stream) Status() *status.Status { return s.status } @@ -313,10 +346,12 @@ func (s *Stream) SetHeader(md metadata.MD) error { if md.Len() == 0 { return nil } - if s.headerOk || atomic.LoadUint32((*uint32)(&s.state)) == uint32(streamDone) { + if s.isHeaderSent() || s.getState() == streamDone { return ErrIllegalHeaderWrite } + s.hdrMu.Lock() s.header = metadata.Join(s.header, md) + s.hdrMu.Unlock() return nil } @@ -335,7 +370,12 @@ func (s *Stream) SetTrailer(md metadata.MD) error { if md.Len() == 0 { return nil } + if s.getState() == streamDone { + return ErrIllegalHeaderWrite + } + s.hdrMu.Lock() s.trailer = metadata.Join(s.trailer, md) + s.hdrMu.Unlock() return nil } @@ -509,6 +549,8 @@ type CallHdr struct { // https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md#requests // for more details. ContentSubtype string + + PreviousAttempts int // value of grpc-previous-rpc-attempts header to set } // ClientTransport is the common interface for all gRPC client-side transport @@ -605,6 +647,11 @@ func streamErrorf(c codes.Code, format string, a ...interface{}) StreamError { } } +// streamError creates an StreamError with the specified error code and description. +func streamError(c codes.Code, desc string) StreamError { + return StreamError{Code: c, Desc: desc} +} + // connectionErrorf creates an ConnectionError with the specified error description. func connectionErrorf(temp bool, e error, format string, a ...interface{}) ConnectionError { return ConnectionError{ diff --git a/vendor/google.golang.org/grpc/version.go b/vendor/google.golang.org/grpc/version.go new file mode 100644 index 000000000..9e85edf76 --- /dev/null +++ b/vendor/google.golang.org/grpc/version.go @@ -0,0 +1,22 @@ +/* + * + * Copyright 2018 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package grpc + +// Version is the current grpc version. +const Version = "1.14.0-dev" diff --git a/vendor/google.golang.org/grpc/vet.sh b/vendor/google.golang.org/grpc/vet.sh index da8211063..079bc2896 100755 --- a/vendor/google.golang.org/grpc/vet.sh +++ b/vendor/google.golang.org/grpc/vet.sh @@ -1,5 +1,10 @@ #!/bin/bash +if [[ `uname -a` = *"Darwin"* ]]; then + echo "It seems you are running on Mac. This script does not work on Mac. See https://github.com/grpc/grpc-go/issues/2047" + exit 1 +fi + set -ex # Exit on error; debugging enabled. set -o pipefail # Fail a pipe if any sub-command fails. @@ -49,7 +54,8 @@ if git status --porcelain | read; then fi git ls-files "*.go" | xargs grep -L "\(Copyright [0-9]\{4,\} gRPC authors\)\|DO NOT EDIT" 2>&1 | tee /dev/stderr | (! read) -git ls-files "*.go" | xargs grep -l "\"unsafe\"" 2>&1 | (! grep -v '_test.go') | tee /dev/stderr | (! read) +git ls-files "*.go" | xargs grep -l '"unsafe"' 2>&1 | (! grep -v '_test.go') | tee /dev/stderr | (! read) +git ls-files "*.go" | xargs grep -l '"math/rand"' 2>&1 | (! grep -v '^examples\|^stress\|grpcrand') | tee /dev/stderr | (! read) gofmt -s -d -l . 2>&1 | tee /dev/stderr | (! read) goimports -l . 2>&1 | tee /dev/stderr | (! read) golint ./... 2>&1 | (grep -vE "(_mock|\.pb)\.go:" || true) | tee /dev/stderr | (! read) diff --git a/vendor/k8s.io/kube-openapi/.travis.yml b/vendor/k8s.io/kube-openapi/.travis.yml index 996a4df0e..6c770ec12 100644 --- a/vendor/k8s.io/kube-openapi/.travis.yml +++ b/vendor/k8s.io/kube-openapi/.travis.yml @@ -1,4 +1,4 @@ language: go go_import_path: k8s.io/kube-openapi -script: go test ./pkg/... +script: go test ./pkg/... ./test/... diff --git a/vendor/k8s.io/kube-openapi/Godeps/Godeps.json b/vendor/k8s.io/kube-openapi/Godeps/Godeps.json index 38032f652..0fdade70b 100644 --- a/vendor/k8s.io/kube-openapi/Godeps/Godeps.json +++ b/vendor/k8s.io/kube-openapi/Godeps/Godeps.json @@ -377,6 +377,10 @@ "ImportPath": "gopkg.in/yaml.v2", "Rev": "53feefa2559fb8dfa8d81baad31be332c97d6c77" }, + { + "ImportPath": "k8s.io/apimachinery/pkg/util/sets", + "Rev": "ed135c5b96450fd24e5e981c708114fbbd950697" + }, { "ImportPath": "k8s.io/gengo/args", "Rev": "75356185a9af8f0464efa792e2e9508d5b4be83c" diff --git a/vendor/k8s.io/kube-openapi/OWNERS b/vendor/k8s.io/kube-openapi/OWNERS index 7c8ad60c5..e8c62bfa2 100755 --- a/vendor/k8s.io/kube-openapi/OWNERS +++ b/vendor/k8s.io/kube-openapi/OWNERS @@ -3,5 +3,9 @@ reviewers: - gmarek - mbohlool - philips +- seans3 +- apelisse approvers: - mbohlool +- lavalamp +- seans3 diff --git a/vendor/k8s.io/kube-openapi/cmd/openapi-gen/args/args.go b/vendor/k8s.io/kube-openapi/cmd/openapi-gen/args/args.go new file mode 100644 index 000000000..f555bddaf --- /dev/null +++ b/vendor/k8s.io/kube-openapi/cmd/openapi-gen/args/args.go @@ -0,0 +1,73 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package args + +import ( + "fmt" + + "github.com/spf13/pflag" + "k8s.io/gengo/args" +) + +// CustomArgs is used by the gengo framework to pass args specific to this generator. +type CustomArgs struct { + // ReportFilename is added to CustomArgs for specifying name of report file used + // by API linter. If specified, API rule violations will be printed to report file. + // Otherwise default value "-" will be used which indicates stdout. + ReportFilename string +} + +// NewDefaults returns default arguments for the generator. Returning the arguments instead +// of using default flag parsing allows registering custom arguments afterwards +func NewDefaults() (*args.GeneratorArgs, *CustomArgs) { + // Default() sets a couple of flag default values for example the boilerplate. + // WithoutDefaultFlagParsing() disables implicit addition of command line flags and parsing, + // which allows registering custom arguments afterwards + genericArgs := args.Default().WithoutDefaultFlagParsing() + customArgs := &CustomArgs{} + genericArgs.CustomArgs = customArgs + + // Default value for report filename is "-", which stands for stdout + customArgs.ReportFilename = "-" + // Default value for output file base name + genericArgs.OutputFileBaseName = "openapi_generated" + + return genericArgs, customArgs +} + +// AddFlags add the generator flags to the flag set. +func (c *CustomArgs) AddFlags(fs *pflag.FlagSet) { + fs.StringVarP(&c.ReportFilename, "report-filename", "r", c.ReportFilename, "Name of report file used by API linter to print API violations. Default \"-\" stands for standard output. NOTE that if valid filename other than \"-\" is specified, API linter won't return error on detected API violations. This allows further check of existing API violations without stopping the OpenAPI generation toolchain.") +} + +// Validate checks the given arguments. +func Validate(genericArgs *args.GeneratorArgs) error { + c, ok := genericArgs.CustomArgs.(*CustomArgs) + if !ok { + return fmt.Errorf("input arguments don't contain valid custom arguments") + } + if len(c.ReportFilename) == 0 { + return fmt.Errorf("report filename cannot be empty. specify a valid filename or use \"-\" for stdout") + } + if len(genericArgs.OutputFileBaseName) == 0 { + return fmt.Errorf("output file base name cannot be empty") + } + if len(genericArgs.OutputPackagePath) == 0 { + return fmt.Errorf("output package cannot be empty") + } + return nil +} diff --git a/vendor/k8s.io/kube-openapi/example/openapi-gen/main.go b/vendor/k8s.io/kube-openapi/cmd/openapi-gen/openapi-gen.go similarity index 60% rename from vendor/k8s.io/kube-openapi/example/openapi-gen/main.go rename to vendor/k8s.io/kube-openapi/cmd/openapi-gen/openapi-gen.go index f08ca0c9a..0f7563b10 100644 --- a/vendor/k8s.io/kube-openapi/example/openapi-gen/main.go +++ b/vendor/k8s.io/kube-openapi/cmd/openapi-gen/openapi-gen.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors. +Copyright 2018 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,31 +17,39 @@ limitations under the License. // This package generates openAPI definition file to be used in open API spec generation on API servers. To generate // definition for a specific type or package add "+k8s:openapi-gen=true" tag to the type/package comment lines. To // exclude a type from a tagged package, add "+k8s:openapi-gen=false" tag to the type comment lines. + package main import ( - "path/filepath" + "flag" + "log" - "k8s.io/gengo/args" + generatorargs "k8s.io/kube-openapi/cmd/openapi-gen/args" "k8s.io/kube-openapi/pkg/generators" - "github.com/golang/glog" + "github.com/spf13/pflag" ) func main() { - arguments := args.Default() + genericArgs, customArgs := generatorargs.NewDefaults() + + genericArgs.AddFlags(pflag.CommandLine) + customArgs.AddFlags(pflag.CommandLine) + flag.Set("logtostderr", "true") + pflag.CommandLine.AddGoFlagSet(flag.CommandLine) + pflag.Parse() - // Override defaults. - arguments.OutputFileBaseName = "openapi_generated" - arguments.GoHeaderFilePath = filepath.Join(args.DefaultSourceTree(), "k8s.io/kubernetes/hack/boilerplate/boilerplate.go.txt") + if err := generatorargs.Validate(genericArgs); err != nil { + log.Fatalf("Arguments validation error: %v", err) + } - // Run it. - if err := arguments.Execute( + // Generates the code for the OpenAPIDefinitions. + if err := genericArgs.Execute( generators.NameSystems(), generators.DefaultNameSystem(), generators.Packages, ); err != nil { - glog.Fatalf("Error: %v", err) + log.Fatalf("OpenAPI code generation error: %v", err) } - glog.V(2).Info("Completed successfully.") -} \ No newline at end of file + log.Println("Code for OpenAPI definitions generated") +} diff --git a/vendor/k8s.io/kube-openapi/pkg/aggregator/aggregator.go b/vendor/k8s.io/kube-openapi/pkg/aggregator/aggregator.go index 7c980babc..f05b50172 100644 --- a/vendor/k8s.io/kube-openapi/pkg/aggregator/aggregator.go +++ b/vendor/k8s.io/kube-openapi/pkg/aggregator/aggregator.go @@ -61,6 +61,10 @@ func (s *referenceWalker) walkRef(ref spec.Ref) spec.Ref { k := refStr[len(definitionPrefix):] def := s.root.Definitions[k] s.walkSchema(&def) + // Make sure we don't assign to nil map + if s.root.Definitions == nil { + s.root.Definitions = spec.Definitions{} + } s.root.Definitions[k] = def } return s.walkRefCallback(ref) @@ -147,6 +151,9 @@ func (s *referenceWalker) walkOperation(op *spec.Operation) { } func (s *referenceWalker) Start() { + if s.root.Paths == nil { + return + } for _, pathItem := range s.root.Paths.Paths { s.walkParams(pathItem.Parameters) s.walkOperation(pathItem.Delete) @@ -220,6 +227,10 @@ func renameDefinition(s *spec.Swagger, old, new string) { } return ref }, s) + // Make sure we don't assign to nil map + if s.Definitions == nil { + s.Definitions = spec.Definitions{} + } s.Definitions[new] = s.Definitions[old] delete(s.Definitions, old) } @@ -244,6 +255,13 @@ func MergeSpecs(dest, source *spec.Swagger) error { func mergeSpecs(dest, source *spec.Swagger, renameModelConflicts, ignorePathConflicts bool) (err error) { specCloned := false + // Paths may be empty, due to [ACL constraints](http://goo.gl/8us55a#securityFiltering). + if source.Paths == nil { + source.Paths = &spec.Paths{} + } + if dest.Paths == nil { + dest.Paths = &spec.Paths{} + } if ignorePathConflicts { keepPaths := []string{} hasConflictingPath := false @@ -335,6 +353,9 @@ func mergeSpecs(dest, source *spec.Swagger, renameModelConflicts, ignorePathConf } for k, v := range source.Definitions { if _, found := dest.Definitions[k]; !found { + if dest.Definitions == nil { + dest.Definitions = spec.Definitions{} + } dest.Definitions[k] = v } } @@ -343,6 +364,10 @@ func mergeSpecs(dest, source *spec.Swagger, renameModelConflicts, ignorePathConf if _, found := dest.Paths.Paths[k]; found { return fmt.Errorf("unable to merge: duplicated path %s", k) } + // PathItem may be empty, due to [ACL constraints](http://goo.gl/8us55a#securityFiltering). + if dest.Paths.Paths == nil { + dest.Paths.Paths = map[string]spec.PathItem{} + } dest.Paths.Paths[k] = v } return nil diff --git a/vendor/k8s.io/kube-openapi/pkg/builder/openapi.go b/vendor/k8s.io/kube-openapi/pkg/builder/openapi.go index 78714e8b2..f48700d54 100644 --- a/vendor/k8s.io/kube-openapi/pkg/builder/openapi.go +++ b/vendor/k8s.io/kube-openapi/pkg/builder/openapi.go @@ -45,6 +45,47 @@ type openAPI struct { // BuildOpenAPISpec builds OpenAPI spec given a list of webservices (containing routes) and common.Config to customize it. func BuildOpenAPISpec(webServices []*restful.WebService, config *common.Config) (*spec.Swagger, error) { + o := newOpenAPI(config) + err := o.buildPaths(webServices) + if err != nil { + return nil, err + } + return o.finalizeSwagger() +} + +// BuildOpenAPIDefinitionsForResource builds a partial OpenAPI spec given a sample object and common.Config to customize it. +func BuildOpenAPIDefinitionsForResource(model interface{}, config *common.Config) (*spec.Definitions, error) { + o := newOpenAPI(config) + // We can discard the return value of toSchema because all we care about is the side effect of calling it. + // All the models created for this resource get added to o.swagger.Definitions + _, err := o.toSchema(getCanonicalTypeName(model)) + if err != nil { + return nil, err + } + swagger, err := o.finalizeSwagger() + if err != nil { + return nil, err + } + return &swagger.Definitions, nil +} + +// BuildOpenAPIDefinitionsForResources returns the OpenAPI spec which includes the definitions for the +// passed type names. +func BuildOpenAPIDefinitionsForResources(config *common.Config, names ...string) (*spec.Swagger, error) { + o := newOpenAPI(config) + // We can discard the return value of toSchema because all we care about is the side effect of calling it. + // All the models created for this resource get added to o.swagger.Definitions + for _, name := range names { + _, err := o.toSchema(name) + if err != nil { + return nil, err + } + } + return o.finalizeSwagger() +} + +// newOpenAPI sets up the openAPI object so we can build the spec. +func newOpenAPI(config *common.Config) openAPI { o := openAPI{ config: config, swagger: &spec.Swagger{ @@ -56,16 +97,6 @@ func BuildOpenAPISpec(webServices []*restful.WebService, config *common.Config) }, }, } - - err := o.init(webServices) - if err != nil { - return nil, err - } - - return o.swagger, nil -} - -func (o *openAPI) init(webServices []*restful.WebService) error { if o.config.GetOperationIDAndTags == nil { o.config.GetOperationIDAndTags = func(r *restful.Route) (string, []string, error) { return r.Operation, nil, nil @@ -83,25 +114,32 @@ func (o *openAPI) init(webServices []*restful.WebService) error { if o.config.CommonResponses == nil { o.config.CommonResponses = map[int]spec.Response{} } - err := o.buildPaths(webServices) - if err != nil { - return err - } + return o +} + +// finalizeSwagger is called after the spec is built and returns the final spec. +// NOTE: finalizeSwagger also make changes to the final spec, as specified in the config. +func (o *openAPI) finalizeSwagger() (*spec.Swagger, error) { if o.config.SecurityDefinitions != nil { o.swagger.SecurityDefinitions = *o.config.SecurityDefinitions o.swagger.Security = o.config.DefaultSecurity } if o.config.PostProcessSpec != nil { + var err error o.swagger, err = o.config.PostProcessSpec(o.swagger) if err != nil { - return err + return nil, err } } - return nil + return o.swagger, nil } -func getCanonicalizeTypeName(t reflect.Type) string { +func getCanonicalTypeName(model interface{}) string { + t := reflect.TypeOf(model) + if t.Kind() == reflect.Ptr { + t = t.Elem() + } if t.PkgPath() == "" { return t.Name() } @@ -146,12 +184,7 @@ func (o *openAPI) buildDefinitionRecursively(name string) error { // buildDefinitionForType build a definition for a given type and return a referable name to its definition. // This is the main function that keep track of definitions used in this spec and is depend on code generated // by k8s.io/kubernetes/cmd/libs/go2idl/openapi-gen. -func (o *openAPI) buildDefinitionForType(sample interface{}) (string, error) { - t := reflect.TypeOf(sample) - if t.Kind() == reflect.Ptr { - t = t.Elem() - } - name := getCanonicalizeTypeName(t) +func (o *openAPI) buildDefinitionForType(name string) (string, error) { if err := o.buildDefinitionRecursively(name); err != nil { return "", err } @@ -302,7 +335,7 @@ func (o *openAPI) buildOperations(route restful.Route, inPathCommonParamsMap map } func (o *openAPI) buildResponse(model interface{}, description string) (spec.Response, error) { - schema, err := o.toSchema(model) + schema, err := o.toSchema(getCanonicalTypeName(model)) if err != nil { return spec.Response{}, err } @@ -347,8 +380,8 @@ func (o *openAPI) findCommonParameters(routes []restful.Route) (map[interface{}] return commonParamsMap, nil } -func (o *openAPI) toSchema(model interface{}) (_ *spec.Schema, err error) { - if openAPIType, openAPIFormat := common.GetOpenAPITypeFormat(getCanonicalizeTypeName(reflect.TypeOf(model))); openAPIType != "" { +func (o *openAPI) toSchema(name string) (_ *spec.Schema, err error) { + if openAPIType, openAPIFormat := common.GetOpenAPITypeFormat(name); openAPIType != "" { return &spec.Schema{ SchemaProps: spec.SchemaProps{ Type: []string{openAPIType}, @@ -356,7 +389,7 @@ func (o *openAPI) toSchema(model interface{}) (_ *spec.Schema, err error) { }, }, nil } else { - ref, err := o.buildDefinitionForType(model) + ref, err := o.buildDefinitionForType(name) if err != nil { return nil, err } @@ -380,7 +413,7 @@ func (o *openAPI) buildParameter(restParam restful.ParameterData, bodySample int case restful.BodyParameterKind: if bodySample != nil { ret.In = "body" - ret.Schema, err = o.toSchema(bodySample) + ret.Schema, err = o.toSchema(getCanonicalTypeName(bodySample)) return ret, err } else { // There is not enough information in the body parameter to build the definition. diff --git a/vendor/k8s.io/kube-openapi/pkg/generators/api_linter.go b/vendor/k8s.io/kube-openapi/pkg/generators/api_linter.go new file mode 100644 index 000000000..9270d2632 --- /dev/null +++ b/vendor/k8s.io/kube-openapi/pkg/generators/api_linter.go @@ -0,0 +1,100 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package generators + +import ( + "fmt" + "io" + + "k8s.io/kube-openapi/pkg/generators/rules" + + "github.com/golang/glog" + "k8s.io/gengo/types" +) + +// apiLinter is the framework hosting mutliple API rules and recording API rule +// violations +type apiLinter struct { + // API rules that implement APIRule interface and output API rule violations + rules []APIRule + violations []apiViolation +} + +// newAPILinter creates an apiLinter object with API rules in package rules. Please +// add APIRule here when new API rule is implemented. +func newAPILinter() *apiLinter { + return &apiLinter{ + rules: []APIRule{ + &rules.NamesMatch{}, + }, + } +} + +// apiViolation uniquely identifies single API rule violation +type apiViolation struct { + // Name of rule from APIRule.Name() + rule string + + packageName string + typeName string + + // Optional: name of field that violates API rule. Empty fieldName implies that + // the entire type violates the rule. + field string +} + +// APIRule is the interface for validating API rule on Go types +type APIRule interface { + // Validate evaluates API rule on type t and returns a list of field names in + // the type that violate the rule. Empty field name [""] implies the entire + // type violates the rule. + Validate(t *types.Type) ([]string, error) + + // Name returns the name of APIRule + Name() string +} + +// validate runs all API rules on type t and records any API rule violation +func (l *apiLinter) validate(t *types.Type) error { + for _, r := range l.rules { + glog.V(5).Infof("validating API rule %v for type %v", r.Name(), t) + fields, err := r.Validate(t) + if err != nil { + return err + } + for _, field := range fields { + l.violations = append(l.violations, apiViolation{ + rule: r.Name(), + packageName: t.Name.Package, + typeName: t.Name.Name, + field: field, + }) + } + } + return nil +} + +// report prints any API rule violation to writer w and returns error if violation exists +func (l *apiLinter) report(w io.Writer) error { + for _, v := range l.violations { + fmt.Fprintf(w, "API rule violation: %s,%s,%s,%s\n", v.rule, v.packageName, v.typeName, v.field) + } + if len(l.violations) > 0 { + return fmt.Errorf("API rule violations exist") + } + return nil +} diff --git a/vendor/k8s.io/kube-openapi/pkg/generators/extension.go b/vendor/k8s.io/kube-openapi/pkg/generators/extension.go index 7f3602408..befe38db2 100644 --- a/vendor/k8s.io/kube-openapi/pkg/generators/extension.go +++ b/vendor/k8s.io/kube-openapi/pkg/generators/extension.go @@ -27,18 +27,33 @@ import ( const extensionPrefix = "x-kubernetes-" -// Extension tag to openapi extension -var tagToExtension = map[string]string{ - "patchMergeKey": "x-kubernetes-patch-merge-key", - "patchStrategy": "x-kubernetes-patch-strategy", - "listType": "x-kubernetes-list-type", - "listMapKey": "x-kubernetes-list-map-keys", +// extensionAttributes encapsulates common traits for particular extensions. +type extensionAttributes struct { + xName string + kind types.Kind + allowedValues sets.String } -// Enum values per extension -var allowedExtensionValues = map[string]sets.String{ - "x-kubernetes-patch-strategy": sets.NewString("merge", "retainKeys"), - "x-kubernetes-list-type": sets.NewString("atomic", "set", "map"), +// Extension tag to openapi extension attributes +var tagToExtension = map[string]extensionAttributes{ + "patchMergeKey": extensionAttributes{ + xName: "x-kubernetes-patch-merge-key", + kind: types.Slice, + }, + "patchStrategy": extensionAttributes{ + xName: "x-kubernetes-patch-strategy", + kind: types.Slice, + allowedValues: sets.NewString("merge", "retainKeys"), + }, + "listMapKey": extensionAttributes{ + xName: "x-kubernetes-list-map-keys", + kind: types.Slice, + }, + "listType": extensionAttributes{ + xName: "x-kubernetes-list-type", + kind: types.Slice, + allowedValues: sets.NewString("atomic", "set", "map"), + }, } // Extension encapsulates information necessary to generate an OpenAPI extension. @@ -48,10 +63,25 @@ type extension struct { values []string // Example: [atomic] } +func (e extension) hasAllowedValues() bool { + return tagToExtension[e.idlTag].allowedValues.Len() > 0 +} + +func (e extension) allowedValues() sets.String { + return tagToExtension[e.idlTag].allowedValues +} + +func (e extension) hasKind() bool { + return len(tagToExtension[e.idlTag].kind) > 0 +} + +func (e extension) kind() types.Kind { + return tagToExtension[e.idlTag].kind +} + func (e extension) validateAllowedValues() error { // allowedValues not set means no restrictions on values. - allowedValues, exists := allowedExtensionValues[e.xName] - if !exists { + if !e.hasAllowedValues() { return nil } // Check for missing value. @@ -59,6 +89,7 @@ func (e extension) validateAllowedValues() error { return fmt.Errorf("%s needs a value, none given.", e.idlTag) } // For each extension value, validate that it is allowed. + allowedValues := e.allowedValues() if !allowedValues.HasAll(e.values...) { return fmt.Errorf("%v not allowed for %s. Allowed values: %v", e.values, e.idlTag, allowedValues.List()) @@ -66,6 +97,18 @@ func (e extension) validateAllowedValues() error { return nil } +func (e extension) validateType(kind types.Kind) error { + // If this extension class has no kind, then don't validate the type. + if !e.hasKind() { + return nil + } + if kind != e.kind() { + return fmt.Errorf("tag %s on type %v; only allowed on type %v", + e.idlTag, kind, e.kind()) + } + return nil +} + func (e extension) hasMultipleValues() bool { return len(e.values) > 1 } @@ -82,7 +125,9 @@ func sortedMapKeys(m map[string][]string) []string { return keys } -// Parses comments to return openapi extensions. +// Parses comments to return openapi extensions. Returns a list of +// extensions which parsed correctly, as well as a list of the +// parse errors. Validating extensions is performed separately. // NOTE: Non-empty errors does not mean extensions is empty. func parseExtensions(comments []string) ([]extension, []error) { extensions := []extension{} @@ -108,21 +153,30 @@ func parseExtensions(comments []string) ([]extension, []error) { // Next, generate extensions from "idlTags" (e.g. +listType) tagValues := types.ExtractCommentTags("+", comments) for _, idlTag := range sortedMapKeys(tagValues) { - xName, exists := tagToExtension[idlTag] + xAttrs, exists := tagToExtension[idlTag] if !exists { continue } values := tagValues[idlTag] e := extension{ - idlTag: idlTag, // listType - xName: xName, // x-kubernetes-list-type - values: values, // [atomic] + idlTag: idlTag, // listType + xName: xAttrs.xName, // x-kubernetes-list-type + values: values, // [atomic] } + extensions = append(extensions, e) + } + return extensions, errors +} + +func validateMemberExtensions(extensions []extension, m *types.Member) []error { + errors := []error{} + for _, e := range extensions { if err := e.validateAllowedValues(); err != nil { - // For now, only log the extension validation errors. errors = append(errors, err) } - extensions = append(extensions, e) + if err := e.validateType(m.Type.Kind); err != nil { + errors = append(errors, err) + } } - return extensions, errors + return errors } diff --git a/vendor/k8s.io/kube-openapi/pkg/generators/openapi.go b/vendor/k8s.io/kube-openapi/pkg/generators/openapi.go index deeac7571..d6c6275a7 100644 --- a/vendor/k8s.io/kube-openapi/pkg/generators/openapi.go +++ b/vendor/k8s.io/kube-openapi/pkg/generators/openapi.go @@ -20,6 +20,7 @@ import ( "bytes" "fmt" "io" + "os" "path/filepath" "reflect" "sort" @@ -29,6 +30,7 @@ import ( "k8s.io/gengo/generator" "k8s.io/gengo/namer" "k8s.io/gengo/types" + generatorargs "k8s.io/kube-openapi/cmd/openapi-gen/args" openapi "k8s.io/kube-openapi/pkg/common" "github.com/golang/glog" @@ -120,13 +122,18 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat `)...) + reportFilename := "-" + if customArgs, ok := arguments.CustomArgs.(*generatorargs.CustomArgs); ok { + reportFilename = customArgs.ReportFilename + } + return generator.Packages{ &generator.DefaultPackage{ PackageName: filepath.Base(arguments.OutputPackagePath), PackagePath: arguments.OutputPackagePath, HeaderText: header, GeneratorFunc: func(c *generator.Context) (generators []generator.Generator) { - return []generator.Generator{NewOpenAPIGen(arguments.OutputFileBaseName, arguments.OutputPackagePath, context)} + return []generator.Generator{NewOpenAPIGen(arguments.OutputFileBaseName, arguments.OutputPackagePath, context, newAPILinter(), reportFilename)} }, FilterFunc: func(c *generator.Context, t *types.Type) bool { // There is a conflict between this codegen and codecgen, we should avoid types generated for codecgen @@ -155,20 +162,24 @@ const ( type openAPIGen struct { generator.DefaultGen // TargetPackage is the package that will get GetOpenAPIDefinitions function returns all open API definitions. - targetPackage string - imports namer.ImportTracker - types []*types.Type - context *generator.Context + targetPackage string + imports namer.ImportTracker + types []*types.Type + context *generator.Context + linter *apiLinter + reportFilename string } -func NewOpenAPIGen(sanitizedName string, targetPackage string, context *generator.Context) generator.Generator { +func NewOpenAPIGen(sanitizedName string, targetPackage string, context *generator.Context, linter *apiLinter, reportFilename string) generator.Generator { return &openAPIGen{ DefaultGen: generator.DefaultGen{ OptionalName: sanitizedName, }, - imports: generator.NewImportTracker(), - targetPackage: targetPackage, - context: context, + imports: generator.NewImportTracker(), + targetPackage: targetPackage, + context: context, + linter: linter, + reportFilename: reportFilename, } } @@ -242,6 +253,10 @@ func (g *openAPIGen) Init(c *generator.Context, w io.Writer) error { } func (g *openAPIGen) GenerateType(c *generator.Context, t *types.Type, w io.Writer) error { + glog.V(5).Infof("validating API rules for type %v", t) + if err := g.linter.validate(t); err != nil { + return err + } glog.V(5).Infof("generating for type %v", t) sw := generator.NewSnippetWriter(w, c, "$", "$") err := newOpenAPITypeWriter(sw).generate(t) @@ -383,8 +398,9 @@ func (g openAPITypeWriter) generate(t *types.Type) error { if hasOpenAPIDefinitionMethods(t) { g.Do("return $.OpenAPIDefinition|raw${\n"+ "Schema: spec.Schema{\n"+ - "SchemaProps: spec.SchemaProps{\n"+ - "Type:$.type|raw${}.OpenAPISchemaType(),\n"+ + "SchemaProps: spec.SchemaProps{\n", args) + g.generateDescription(t.CommentLines) + g.Do("Type:$.type|raw${}.OpenAPISchemaType(),\n"+ "Format:$.type|raw${}.OpenAPISchemaFormat(),\n"+ "},\n"+ "},\n"+ @@ -432,7 +448,7 @@ func (g openAPITypeWriter) generateStructExtensions(t *types.Type) error { extensions, errors := parseExtensions(t.CommentLines) // Initially, we will only log struct extension errors. if len(errors) > 0 { - for e := range errors { + for _, e := range errors { glog.V(2).Infof("[%s]: %s\n", t.String(), e) } } @@ -442,17 +458,16 @@ func (g openAPITypeWriter) generateStructExtensions(t *types.Type) error { } func (g openAPITypeWriter) generateMemberExtensions(m *types.Member, parent *types.Type) error { - extensions, errors := parseExtensions(m.CommentLines) + extensions, parseErrors := parseExtensions(m.CommentLines) + validationErrors := validateMemberExtensions(extensions, m) + errors := append(parseErrors, validationErrors...) // Initially, we will only log member extension errors. if len(errors) > 0 { errorPrefix := fmt.Sprintf("[%s] %s:", parent.String(), m.String()) - for e := range errors { + for _, e := range errors { glog.V(2).Infof("%s %s\n", errorPrefix, e) } } - // TODO(seans3): Validate member extensions here. - // Example: listType extension is only on a Slice. - // Example: cross-extension validation - listMapKey only makes sense with listType=map g.emitExtensions(extensions) return nil } @@ -663,3 +678,27 @@ func (g openAPITypeWriter) generateSliceProperty(t *types.Type) error { g.Do("},\n},\n},\n", nil) return nil } + +// Finalize prints the API rule violations to report file (if specified from arguments) or stdout (default) +func (g *openAPIGen) Finalize(c *generator.Context, w io.Writer) error { + // If report file isn't specified, return error to force user to choose either stdout ("-") or a file name + if len(g.reportFilename) == 0 { + return fmt.Errorf("empty report file name: please provide a valid file name or use the default \"-\" (stdout)") + } + // If stdout is specified, print violations and return error + if g.reportFilename == "-" { + return g.linter.report(os.Stdout) + } + // Otherwise, print violations to report file and return nil + f, err := os.Create(g.reportFilename) + if err != nil { + return err + } + defer f.Close() + g.linter.report(f) + // NOTE: we don't return error here because we assume that the report file will + // get evaluated afterwards to determine if error should be raised. For example, + // you can have make rules that compare the report file with existing known + // violations (whitelist) and determine no error if no change is detected. + return nil +} diff --git a/vendor/k8s.io/kube-openapi/pkg/generators/rules/doc.go b/vendor/k8s.io/kube-openapi/pkg/generators/rules/doc.go new file mode 100644 index 000000000..384a44dca --- /dev/null +++ b/vendor/k8s.io/kube-openapi/pkg/generators/rules/doc.go @@ -0,0 +1,23 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package rules contains API rules that are enforced in OpenAPI spec generation +// as part of the machinery. Files under this package implement APIRule interface +// which evaluates Go type and produces list of API rule violations. +// +// Implementations of APIRule should be added to API linter under openAPIGen code- +// generator to get integrated in the generation process. +package rules diff --git a/vendor/k8s.io/kube-openapi/pkg/generators/rules/names_match.go b/vendor/k8s.io/kube-openapi/pkg/generators/rules/names_match.go new file mode 100644 index 000000000..edd3b5e89 --- /dev/null +++ b/vendor/k8s.io/kube-openapi/pkg/generators/rules/names_match.go @@ -0,0 +1,171 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package rules + +import ( + "reflect" + "strings" + + "k8s.io/apimachinery/pkg/util/sets" + "k8s.io/gengo/types" +) + +var ( + // Blacklist of JSON tags that should skip match evaluation + jsonTagBlacklist = sets.NewString( + // Omitted field is ignored by the package + "-", + ) + + // Blacklist of JSON names that should skip match evaluation + jsonNameBlacklist = sets.NewString( + // Empty name is used for inline struct field (e.g. metav1.TypeMeta) + "", + // Special case for object and list meta + "metadata", + ) + + // List of substrings that aren't allowed in Go name and JSON name + disallowedNameSubstrings = sets.NewString( + // Underscore is not allowed in either name + "_", + // Dash is not allowed in either name. Note that since dash is a valid JSON tag, this should be checked + // after JSON tag blacklist check. + "-", + ) +) + +/* +NamesMatch implements APIRule interface. +Go field names must be CamelCase. JSON field names must be camelCase. Other than capitalization of the +initial letter, the two should almost always match. No underscores nor dashes in either. +This rule verifies the convention "Other than capitalization of the initial letter, the two should almost always match." +Examples (also in unit test): + Go name | JSON name | match + podSpec false + PodSpec podSpec true + PodSpec PodSpec false + podSpec podSpec false + PodSpec spec false + Spec podSpec false + JSONSpec jsonSpec true + JSONSpec jsonspec false + HTTPJSONSpec httpJSONSpec true +NOTE: this validator cannot tell two sequential all-capital words from one word, therefore the case below +is also considered matched. + HTTPJSONSpec httpjsonSpec true +NOTE: JSON names in jsonNameBlacklist should skip evaluation + true + podSpec true + podSpec - true + podSpec metadata true +*/ +type NamesMatch struct{} + +// Name returns the name of APIRule +func (n *NamesMatch) Name() string { + return "names_match" +} + +// Validate evaluates API rule on type t and returns a list of field names in +// the type that violate the rule. Empty field name [""] implies the entire +// type violates the rule. +func (n *NamesMatch) Validate(t *types.Type) ([]string, error) { + fields := make([]string, 0) + + // Only validate struct type and ignore the rest + switch t.Kind { + case types.Struct: + for _, m := range t.Members { + goName := m.Name + jsonTag, ok := reflect.StructTag(m.Tags).Lookup("json") + // Distinguish empty JSON tag and missing JSON tag. Empty JSON tag / name is + // allowed (in JSON name blacklist) but missing JSON tag is invalid. + if !ok { + fields = append(fields, goName) + continue + } + if jsonTagBlacklist.Has(jsonTag) { + continue + } + jsonName := strings.Split(jsonTag, ",")[0] + if !namesMatch(goName, jsonName) { + fields = append(fields, goName) + } + } + } + return fields, nil +} + +// namesMatch evaluates if goName and jsonName match the API rule +// TODO: Use an off-the-shelf CamelCase solution instead of implementing this logic. The following existing +// packages have been tried out: +// github.com/markbates/inflect +// github.com/segmentio/go-camelcase +// github.com/iancoleman/strcase +// github.com/fatih/camelcase +// Please see https://github.com/kubernetes/kube-openapi/pull/83#issuecomment-400842314 for more details +// about why they don't satisfy our need. What we need can be a function that detects an acronym at the +// beginning of a string. +func namesMatch(goName, jsonName string) bool { + if jsonNameBlacklist.Has(jsonName) { + return true + } + if !isAllowedName(goName) || !isAllowedName(jsonName) { + return false + } + if strings.ToLower(goName) != strings.ToLower(jsonName) { + return false + } + // Go field names must be CamelCase. JSON field names must be camelCase. + if !isCapital(goName[0]) || isCapital(jsonName[0]) { + return false + } + for i := 0; i < len(goName); i++ { + if goName[i] == jsonName[i] { + // goName[0:i-1] is uppercase and jsonName[0:i-1] is lowercase, goName[i:] + // and jsonName[i:] should match; + // goName[i] should be lowercase if i is equal to 1, e.g.: + // goName | jsonName + // PodSpec podSpec + // or uppercase if i is greater than 1, e.g.: + // goname | jsonName + // JSONSpec jsonSpec + // This is to rule out cases like: + // goname | jsonName + // JSONSpec jsonspec + return goName[i:] == jsonName[i:] && (i == 1 || isCapital(goName[i])) + } + } + return true +} + +// isCaptical returns true if one character is capital +func isCapital(b byte) bool { + return b >= 'A' && b <= 'Z' +} + +// isAllowedName checks the list of disallowedNameSubstrings and returns true if name doesn't contain +// any disallowed substring. +func isAllowedName(name string) bool { + for _, substr := range disallowedNameSubstrings.UnsortedList() { + if strings.Contains(name, substr) { + return false + } + } + return true +} diff --git a/vendor/k8s.io/kube-openapi/pkg/handler/handler.go b/vendor/k8s.io/kube-openapi/pkg/handler/handler.go index 63c6f825b..c4bbc0bff 100644 --- a/vendor/k8s.io/kube-openapi/pkg/handler/handler.go +++ b/vendor/k8s.io/kube-openapi/pkg/handler/handler.go @@ -58,7 +58,6 @@ type OpenAPIService struct { // rwMutex protects All members of this service. rwMutex sync.RWMutex - orgSpec *spec.Swagger lastModified time.Time specBytes []byte @@ -161,7 +160,6 @@ func (o *OpenAPIService) getSwaggerPbGzBytes() ([]byte, string, time.Time) { } func (o *OpenAPIService) UpdateSpec(openapiSpec *spec.Swagger) (err error) { - orgSpec := openapiSpec specBytes, err := json.MarshalIndent(openapiSpec, " ", " ") if err != nil { return err @@ -181,7 +179,6 @@ func (o *OpenAPIService) UpdateSpec(openapiSpec *spec.Swagger) (err error) { o.rwMutex.Lock() defer o.rwMutex.Unlock() - o.orgSpec = orgSpec o.specBytes = specBytes o.specPb = specPb o.specPbGz = specPbGz diff --git a/vendor/k8s.io/kube-openapi/pkg/util/proto/document.go b/vendor/k8s.io/kube-openapi/pkg/util/proto/document.go index 61dbf4fc0..a57dcd363 100644 --- a/vendor/k8s.io/kube-openapi/pkg/util/proto/document.go +++ b/vendor/k8s.io/kube-openapi/pkg/util/proto/document.go @@ -21,8 +21,8 @@ import ( "sort" "strings" - openapi_v2 "github.com/googleapis/gnostic/OpenAPIv2" - yaml "gopkg.in/yaml.v2" + "github.com/googleapis/gnostic/OpenAPIv2" + "gopkg.in/yaml.v2" ) func newSchemaError(path *Path, format string, a ...interface{}) error { @@ -126,12 +126,17 @@ func (d *Definitions) parseMap(s *openapi_v2.Schema, path *Path) (Schema, error) if len(s.GetType().GetValue()) != 0 && s.GetType().GetValue()[0] != object { return nil, newSchemaError(path, "invalid object type") } + var sub Schema if s.GetAdditionalProperties().GetSchema() == nil { - return nil, newSchemaError(path, "invalid object doesn't have additional properties") - } - sub, err := d.ParseSchema(s.GetAdditionalProperties().GetSchema(), path) - if err != nil { - return nil, err + sub = &Arbitrary{ + BaseSchema: d.parseBaseSchema(s, path), + } + } else { + var err error + sub, err = d.ParseSchema(s.GetAdditionalProperties().GetSchema(), path) + if err != nil { + return nil, err + } } return &Map{ BaseSchema: d.parseBaseSchema(s, path), @@ -148,12 +153,10 @@ func (d *Definitions) parsePrimitive(s *openapi_v2.Schema, path *Path) (Schema, t = s.GetType().GetValue()[0] } switch t { - case String: - case Number: - case Integer: - case Boolean: - case "": // Some models are completely empty, and can be safely ignored. - // Do nothing + case String: // do nothing + case Number: // do nothing + case Integer: // do nothing + case Boolean: // do nothing default: return nil, newSchemaError(path, "Unknown primitive type: %q", t) } @@ -219,27 +222,38 @@ func (d *Definitions) parseArbitrary(s *openapi_v2.Schema, path *Path) (Schema, // ParseSchema creates a walkable Schema from an openapi schema. While // this function is public, it doesn't leak through the interface. func (d *Definitions) ParseSchema(s *openapi_v2.Schema, path *Path) (Schema, error) { + if s.GetXRef() != "" { + return d.parseReference(s, path) + } objectTypes := s.GetType().GetValue() - if len(objectTypes) == 1 { + switch len(objectTypes) { + case 0: + // in the OpenAPI schema served by older k8s versions, object definitions created from structs did not include + // the type:object property (they only included the "properties" property), so we need to handle this case + if s.GetProperties() != nil { + return d.parseKind(s, path) + } else { + // Definition has no type and no properties. Treat it as an arbitrary value + // TODO: what if it has additionalProperties or patternProperties? + return d.parseArbitrary(s, path) + } + case 1: t := objectTypes[0] switch t { case object: - return d.parseMap(s, path) + if s.GetProperties() != nil { + return d.parseKind(s, path) + } else { + return d.parseMap(s, path) + } case array: return d.parseArray(s, path) } - - } - if s.GetXRef() != "" { - return d.parseReference(s, path) - } - if s.GetProperties() != nil { - return d.parseKind(s, path) - } - if len(objectTypes) == 0 || (len(objectTypes) == 1 && objectTypes[0] == "") { - return d.parseArbitrary(s, path) + return d.parsePrimitive(s, path) + default: + // the OpenAPI generator never generates (nor it ever did in the past) OpenAPI type definitions with multiple types + return nil, newSchemaError(path, "definitions with multiple types aren't supported") } - return d.parsePrimitive(s, path) } // LookupModel is public through the interface of Models. It diff --git a/vendor/k8s.io/kube-openapi/pkg/util/proto/openapi.go b/vendor/k8s.io/kube-openapi/pkg/util/proto/openapi.go index b48e62c3b..f26b5ef88 100644 --- a/vendor/k8s.io/kube-openapi/pkg/util/proto/openapi.go +++ b/vendor/k8s.io/kube-openapi/pkg/util/proto/openapi.go @@ -59,7 +59,7 @@ type SchemaVisitor interface { } // SchemaVisitorArbitrary is an additional visitor interface which handles -// arbitrary types. For backwards compatability, it's a separate interface +// arbitrary types. For backwards compatibility, it's a separate interface // which is checked for at runtime. type SchemaVisitorArbitrary interface { SchemaVisitor diff --git a/vendor/k8s.io/kube-openapi/pkg/util/proto/testing/swagger.json b/vendor/k8s.io/kube-openapi/pkg/util/proto/testdata/swagger.json similarity index 99% rename from vendor/k8s.io/kube-openapi/pkg/util/proto/testing/swagger.json rename to vendor/k8s.io/kube-openapi/pkg/util/proto/testdata/swagger.json index 05d16e9be..0e15f86b8 100644 --- a/vendor/k8s.io/kube-openapi/pkg/util/proto/testing/swagger.json +++ b/vendor/k8s.io/kube-openapi/pkg/util/proto/testdata/swagger.json @@ -1112,7 +1112,7 @@ "type": "string" }, "kind": { - "description": "Expected values Shared: mulitple blob disks per storage account Dedicated: single blob disk per storage account Managed: azure managed data disk (only in managed availability set). defaults to shared", + "description": "Expected values Shared: multiple blob disks per storage account Dedicated: single blob disk per storage account Managed: azure managed data disk (only in managed availability set). defaults to shared", "type": "string" }, "readOnly": { diff --git a/vendor/k8s.io/kube-openapi/pkg/util/proto/testdata/swagger_next.json b/vendor/k8s.io/kube-openapi/pkg/util/proto/testdata/swagger_next.json new file mode 100644 index 000000000..f2dc451f9 --- /dev/null +++ b/vendor/k8s.io/kube-openapi/pkg/util/proto/testdata/swagger_next.json @@ -0,0 +1,6574 @@ +{ + "swagger": "2.0", + "info": { + "title": "Kubernetes", + "version": "v1.8.0" + }, + "paths": {}, + "definitions": { + "io.k8s.api.apps.v1beta1.ControllerRevision": { + "description": "ControllerRevision implements an immutable snapshot of state data. Clients are responsible for serializing and deserializing the objects that contain their internal state. Once a ControllerRevision has been successfully created, it can not be updated. The API Server will fail validation of all requests that attempt to mutate the Data field. ControllerRevisions may, however, be deleted. Note that, due to its use by both the DaemonSet and StatefulSet controllers for update and rollback, this object is beta. However, it may be subject to name and representation changes in future releases, and clients should not depend on its stability. It is primarily for internal use by controllers.", + "type": "object", + "required": [ + "revision" + ], + "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", + "type": "string" + }, + "data": { + "description": "Data is the serialized representation of the state.", + "type": "object" + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "description": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta" + }, + "revision": { + "description": "Revision indicates the revision of the state represented by Data.", + "type": "integer", + "format": "int64" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "apps", + "kind": "ControllerRevision", + "version": "v1beta1" + } + ] + }, + "io.k8s.api.apps.v1beta1.ControllerRevisionList": { + "description": "ControllerRevisionList is a resource containing a list of ControllerRevision objects.", + "type": "object", + "required": [ + "items" + ], + "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", + "type": "string" + }, + "items": { + "description": "Items is the list of ControllerRevisions", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.apps.v1beta1.ControllerRevision" + } + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "description": "More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ListMeta" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "apps", + "kind": "ControllerRevisionList", + "version": "v1beta1" + } + ] + }, + "io.k8s.api.apps.v1beta1.Deployment": { + "description": "Deployment enables declarative updates for Pods and ReplicaSets.", + "type": "object", + "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", + "type": "string" + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "description": "Standard object metadata.", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta" + }, + "spec": { + "description": "Specification of the desired behavior of the Deployment.", + "$ref": "#/definitions/io.k8s.api.apps.v1beta1.DeploymentSpec" + }, + "status": { + "description": "Most recently observed status of the Deployment.", + "$ref": "#/definitions/io.k8s.api.apps.v1beta1.DeploymentStatus" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "apps", + "kind": "Deployment", + "version": "v1beta1" + } + ] + }, + "io.k8s.api.apps.v1beta1.DeploymentCondition": { + "description": "DeploymentCondition describes the state of a deployment at a certain point.", + "type": "object", + "required": [ + "type", + "status" + ], + "properties": { + "lastTransitionTime": { + "description": "Last time the condition transitioned from one status to another.", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.Time" + }, + "lastUpdateTime": { + "description": "The last time this condition was updated.", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.Time" + }, + "message": { + "description": "A human readable message indicating details about the transition.", + "type": "string" + }, + "reason": { + "description": "The reason for the condition's last transition.", + "type": "string" + }, + "status": { + "description": "Status of the condition, one of True, False, Unknown.", + "type": "string" + }, + "type": { + "description": "Type of deployment condition.", + "type": "string" + } + } + }, + "io.k8s.api.apps.v1beta1.DeploymentList": { + "description": "DeploymentList is a list of Deployments.", + "type": "object", + "required": [ + "items" + ], + "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", + "type": "string" + }, + "items": { + "description": "Items is the list of Deployments.", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.apps.v1beta1.Deployment" + } + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "description": "Standard list metadata.", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ListMeta" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "apps", + "kind": "DeploymentList", + "version": "v1beta1" + } + ] + }, + "io.k8s.api.apps.v1beta1.DeploymentRollback": { + "description": "DEPRECATED. DeploymentRollback stores the information required to rollback a deployment.", + "type": "object", + "required": [ + "name", + "rollbackTo" + ], + "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", + "type": "string" + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "type": "string" + }, + "name": { + "description": "Required: This must match the Name of a deployment.", + "type": "string" + }, + "rollbackTo": { + "description": "The config of this deployment rollback.", + "$ref": "#/definitions/io.k8s.api.apps.v1beta1.RollbackConfig" + }, + "updatedAnnotations": { + "description": "The annotations to be updated to a deployment", + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "apps", + "kind": "DeploymentRollback", + "version": "v1beta1" + } + ] + }, + "io.k8s.api.apps.v1beta1.DeploymentSpec": { + "description": "DeploymentSpec is the specification of the desired behavior of the Deployment.", + "type": "object", + "required": [ + "template" + ], + "properties": { + "minReadySeconds": { + "description": "Minimum number of seconds for which a newly created pod should be ready without any of its container crashing, for it to be considered available. Defaults to 0 (pod will be considered available as soon as it is ready)", + "type": "integer", + "format": "int32" + }, + "paused": { + "description": "Indicates that the deployment is paused.", + "type": "boolean" + }, + "progressDeadlineSeconds": { + "description": "The maximum time in seconds for a deployment to make progress before it is considered to be failed. The deployment controller will continue to process failed deployments and a condition with a ProgressDeadlineExceeded reason will be surfaced in the deployment status. Once autoRollback is implemented, the deployment controller will automatically rollback failed deployments. Note that progress will not be estimated during the time a deployment is paused. Defaults to 600s.", + "type": "integer", + "format": "int32" + }, + "replicas": { + "description": "Number of desired pods. This is a pointer to distinguish between explicit zero and not specified. Defaults to 1.", + "type": "integer", + "format": "int32" + }, + "revisionHistoryLimit": { + "description": "The number of old ReplicaSets to retain to allow rollback. This is a pointer to distinguish between explicit zero and not specified. Defaults to 2.", + "type": "integer", + "format": "int32" + }, + "rollbackTo": { + "description": "DEPRECATED. The config this deployment is rolling back to. Will be cleared after rollback is done.", + "$ref": "#/definitions/io.k8s.api.apps.v1beta1.RollbackConfig" + }, + "selector": { + "description": "Label selector for pods. Existing ReplicaSets whose pods are selected by this will be the ones affected by this deployment.", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector" + }, + "strategy": { + "description": "The deployment strategy to use to replace existing pods with new ones.", + "$ref": "#/definitions/io.k8s.api.apps.v1beta1.DeploymentStrategy" + }, + "template": { + "description": "Template describes the pods that will be created.", + "$ref": "#/definitions/io.k8s.api.core.v1.PodTemplateSpec" + } + } + }, + "io.k8s.api.apps.v1beta1.DeploymentStatus": { + "description": "DeploymentStatus is the most recently observed status of the Deployment.", + "type": "object", + "properties": { + "availableReplicas": { + "description": "Total number of available pods (ready for at least minReadySeconds) targeted by this deployment.", + "type": "integer", + "format": "int32" + }, + "collisionCount": { + "description": "Count of hash collisions for the Deployment. The Deployment controller uses this field as a collision avoidance mechanism when it needs to create the name for the newest ReplicaSet.", + "type": "integer", + "format": "int32" + }, + "conditions": { + "description": "Represents the latest available observations of a deployment's current state.", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.apps.v1beta1.DeploymentCondition" + }, + "x-kubernetes-patch-merge-key": "type", + "x-kubernetes-patch-strategy": "merge" + }, + "observedGeneration": { + "description": "The generation observed by the deployment controller.", + "type": "integer", + "format": "int64" + }, + "readyReplicas": { + "description": "Total number of ready pods targeted by this deployment.", + "type": "integer", + "format": "int32" + }, + "replicas": { + "description": "Total number of non-terminated pods targeted by this deployment (their labels match the selector).", + "type": "integer", + "format": "int32" + }, + "unavailableReplicas": { + "description": "Total number of unavailable pods targeted by this deployment.", + "type": "integer", + "format": "int32" + }, + "updatedReplicas": { + "description": "Total number of non-terminated pods targeted by this deployment that have the desired template spec.", + "type": "integer", + "format": "int32" + } + } + }, + "io.k8s.api.apps.v1beta1.DeploymentStrategy": { + "description": "DeploymentStrategy describes how to replace existing pods with new ones.", + "type": "object", + "properties": { + "rollingUpdate": { + "description": "Rolling update config params. Present only if DeploymentStrategyType = RollingUpdate.", + "$ref": "#/definitions/io.k8s.api.apps.v1beta1.RollingUpdateDeployment" + }, + "type": { + "description": "Type of deployment. Can be \"Recreate\" or \"RollingUpdate\". Default is RollingUpdate.", + "type": "string" + } + } + }, + "io.k8s.api.apps.v1beta1.RollbackConfig": { + "description": "DEPRECATED.", + "type": "object", + "properties": { + "revision": { + "description": "The revision to rollback to. If set to 0, rollback to the last revision.", + "type": "integer", + "format": "int64" + } + } + }, + "io.k8s.api.apps.v1beta1.RollingUpdateDeployment": { + "description": "Spec to control the desired behavior of rolling update.", + "type": "object", + "properties": { + "maxSurge": { + "description": "The maximum number of pods that can be scheduled above the desired number of pods. Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%). This can not be 0 if MaxUnavailable is 0. Absolute number is calculated from percentage by rounding up. Defaults to 25%. Example: when this is set to 30%, the new RC can be scaled up immediately when the rolling update starts, such that the total number of old and new pods do not exceed 130% of desired pods. Once old pods have been killed, new RC can be scaled up further, ensuring that total number of pods running at any time during the update is atmost 130% of desired pods.", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.util.intstr.IntOrString" + }, + "maxUnavailable": { + "description": "The maximum number of pods that can be unavailable during the update. Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%). Absolute number is calculated from percentage by rounding down. This can not be 0 if MaxSurge is 0. Defaults to 25%. Example: when this is set to 30%, the old RC can be scaled down to 70% of desired pods immediately when the rolling update starts. Once new pods are ready, old RC can be scaled down further, followed by scaling up the new RC, ensuring that the total number of pods available at all times during the update is at least 70% of desired pods.", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.util.intstr.IntOrString" + } + } + }, + "io.k8s.api.apps.v1beta1.RollingUpdateStatefulSetStrategy": { + "description": "RollingUpdateStatefulSetStrategy is used to communicate parameter for RollingUpdateStatefulSetStrategyType.", + "type": "object", + "properties": { + "partition": { + "description": "Partition indicates the ordinal at which the StatefulSet should be partitioned.", + "type": "integer", + "format": "int32" + } + } + }, + "io.k8s.api.apps.v1beta1.Scale": { + "description": "Scale represents a scaling request for a resource.", + "type": "object", + "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", + "type": "string" + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "description": "Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata.", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta" + }, + "spec": { + "description": "defines the behavior of the scale. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status.", + "$ref": "#/definitions/io.k8s.api.apps.v1beta1.ScaleSpec" + }, + "status": { + "description": "current status of the scale. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status. Read-only.", + "$ref": "#/definitions/io.k8s.api.apps.v1beta1.ScaleStatus" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "apps", + "kind": "Scale", + "version": "v1beta1" + } + ] + }, + "io.k8s.api.apps.v1beta1.ScaleSpec": { + "description": "ScaleSpec describes the attributes of a scale subresource", + "type": "object", + "properties": { + "replicas": { + "description": "desired number of instances for the scaled object.", + "type": "integer", + "format": "int32" + } + } + }, + "io.k8s.api.apps.v1beta1.ScaleStatus": { + "description": "ScaleStatus represents the current status of a scale subresource.", + "type": "object", + "required": [ + "replicas" + ], + "properties": { + "replicas": { + "description": "actual number of observed instances of the scaled object.", + "type": "integer", + "format": "int32" + }, + "selector": { + "description": "label query over pods that should match the replicas count. More info: http://kubernetes.io/docs/user-guide/labels#label-selectors", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "targetSelector": { + "description": "label selector for pods that should match the replicas count. This is a serializated version of both map-based and more expressive set-based selectors. This is done to avoid introspection in the clients. The string will be in the same format as the query-param syntax. If the target type only supports map-based selectors, both this field and map-based selector field are populated. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors", + "type": "string" + } + } + }, + "io.k8s.api.apps.v1beta1.StatefulSet": { + "description": "StatefulSet represents a set of pods with consistent identities. Identities are defined as:\n - Network: A single stable DNS and hostname.\n - Storage: As many VolumeClaims as requested.\nThe StatefulSet guarantees that a given network identity will always map to the same storage identity.", + "type": "object", + "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", + "type": "string" + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta" + }, + "spec": { + "description": "Spec defines the desired identities of pods in this set.", + "$ref": "#/definitions/io.k8s.api.apps.v1beta1.StatefulSetSpec" + }, + "status": { + "description": "Status is the current status of Pods in this StatefulSet. This data may be out of date by some window of time.", + "$ref": "#/definitions/io.k8s.api.apps.v1beta1.StatefulSetStatus" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "apps", + "kind": "StatefulSet", + "version": "v1beta1" + } + ] + }, + "io.k8s.api.apps.v1beta1.StatefulSetList": { + "description": "StatefulSetList is a collection of StatefulSets.", + "type": "object", + "required": [ + "items" + ], + "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", + "type": "string" + }, + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.apps.v1beta1.StatefulSet" + } + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ListMeta" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "apps", + "kind": "StatefulSetList", + "version": "v1beta1" + } + ] + }, + "io.k8s.api.apps.v1beta1.StatefulSetSpec": { + "description": "A StatefulSetSpec is the specification of a StatefulSet.", + "type": "object", + "required": [ + "template", + "serviceName" + ], + "properties": { + "podManagementPolicy": { + "description": "podManagementPolicy controls how pods are created during initial scale up, when replacing pods on nodes, or when scaling down. The default policy is `OrderedReady`, where pods are created in increasing order (pod-0, then pod-1, etc) and the controller will wait until each pod is ready before continuing. When scaling down, the pods are removed in the opposite order. The alternative policy is `Parallel` which will create pods in parallel to match the desired scale without waiting, and on scale down will delete all pods at once.", + "type": "string" + }, + "replicas": { + "description": "replicas is the desired number of replicas of the given Template. These are replicas in the sense that they are instantiations of the same Template, but individual replicas also have a consistent identity. If unspecified, defaults to 1.", + "type": "integer", + "format": "int32" + }, + "revisionHistoryLimit": { + "description": "revisionHistoryLimit is the maximum number of revisions that will be maintained in the StatefulSet's revision history. The revision history consists of all revisions not represented by a currently applied StatefulSetSpec version. The default value is 10.", + "type": "integer", + "format": "int32" + }, + "selector": { + "description": "selector is a label query over pods that should match the replica count. If empty, defaulted to labels on the pod template. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector" + }, + "serviceName": { + "description": "serviceName is the name of the service that governs this StatefulSet. This service must exist before the StatefulSet, and is responsible for the network identity of the set. Pods get DNS/hostnames that follow the pattern: pod-specific-string.serviceName.default.svc.cluster.local where \"pod-specific-string\" is managed by the StatefulSet controller.", + "type": "string" + }, + "template": { + "description": "template is the object that describes the pod that will be created if insufficient replicas are detected. Each pod stamped out by the StatefulSet will fulfill this Template, but have a unique identity from the rest of the StatefulSet.", + "$ref": "#/definitions/io.k8s.api.core.v1.PodTemplateSpec" + }, + "updateStrategy": { + "description": "updateStrategy indicates the StatefulSetUpdateStrategy that will be employed to update Pods in the StatefulSet when a revision is made to Template.", + "$ref": "#/definitions/io.k8s.api.apps.v1beta1.StatefulSetUpdateStrategy" + }, + "volumeClaimTemplates": { + "description": "volumeClaimTemplates is a list of claims that pods are allowed to reference. The StatefulSet controller is responsible for mapping network identities to claims in a way that maintains the identity of a pod. Every claim in this list must have at least one matching (by name) volumeMount in one container in the template. A claim in this list takes precedence over any volumes in the template, with the same name.", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.core.v1.PersistentVolumeClaim" + } + } + } + }, + "io.k8s.api.apps.v1beta1.StatefulSetStatus": { + "description": "StatefulSetStatus represents the current state of a StatefulSet.", + "type": "object", + "required": [ + "replicas" + ], + "properties": { + "collisionCount": { + "description": "collisionCount is the count of hash collisions for the StatefulSet. The StatefulSet controller uses this field as a collision avoidance mechanism when it needs to create the name for the newest ControllerRevision.", + "type": "integer", + "format": "int32" + }, + "currentReplicas": { + "description": "currentReplicas is the number of Pods created by the StatefulSet controller from the StatefulSet version indicated by currentRevision.", + "type": "integer", + "format": "int32" + }, + "currentRevision": { + "description": "currentRevision, if not empty, indicates the version of the StatefulSet used to generate Pods in the sequence [0,currentReplicas).", + "type": "string" + }, + "observedGeneration": { + "description": "observedGeneration is the most recent generation observed for this StatefulSet. It corresponds to the StatefulSet's generation, which is updated on mutation by the API Server.", + "type": "integer", + "format": "int64" + }, + "readyReplicas": { + "description": "readyReplicas is the number of Pods created by the StatefulSet controller that have a Ready Condition.", + "type": "integer", + "format": "int32" + }, + "replicas": { + "description": "replicas is the number of Pods created by the StatefulSet controller.", + "type": "integer", + "format": "int32" + }, + "updateRevision": { + "description": "updateRevision, if not empty, indicates the version of the StatefulSet used to generate Pods in the sequence [replicas-updatedReplicas,replicas)", + "type": "string" + }, + "updatedReplicas": { + "description": "updatedReplicas is the number of Pods created by the StatefulSet controller from the StatefulSet version indicated by updateRevision.", + "type": "integer", + "format": "int32" + } + } + }, + "io.k8s.api.apps.v1beta1.StatefulSetUpdateStrategy": { + "description": "StatefulSetUpdateStrategy indicates the strategy that the StatefulSet controller will use to perform updates. It includes any additional parameters necessary to perform the update for the indicated strategy.", + "type": "object", + "properties": { + "rollingUpdate": { + "description": "RollingUpdate is used to communicate parameters when Type is RollingUpdateStatefulSetStrategyType.", + "$ref": "#/definitions/io.k8s.api.apps.v1beta1.RollingUpdateStatefulSetStrategy" + }, + "type": { + "description": "Type indicates the type of the StatefulSetUpdateStrategy.", + "type": "string" + } + } + }, + "io.k8s.api.authorization.v1.LocalSubjectAccessReview": { + "description": "LocalSubjectAccessReview checks whether or not a user or group can perform an action in a given namespace. Having a namespace scoped resource makes it much easier to grant namespace scoped policy that includes permissions checking.", + "type": "object", + "required": [ + "spec" + ], + "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", + "type": "string" + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta" + }, + "spec": { + "description": "Spec holds information about the request being evaluated. spec.namespace must be equal to the namespace you made the request against. If empty, it is defaulted.", + "$ref": "#/definitions/io.k8s.api.authorization.v1.SubjectAccessReviewSpec" + }, + "status": { + "description": "Status is filled in by the server and indicates whether the request is allowed or not", + "$ref": "#/definitions/io.k8s.api.authorization.v1.SubjectAccessReviewStatus" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "authorization.k8s.io", + "kind": "LocalSubjectAccessReview", + "version": "v1" + } + ] + }, + "io.k8s.api.authorization.v1.NonResourceAttributes": { + "description": "NonResourceAttributes includes the authorization attributes available for non-resource requests to the Authorizer interface", + "type": "object", + "properties": { + "path": { + "description": "Path is the URL path of the request", + "type": "string" + }, + "verb": { + "description": "Verb is the standard HTTP verb", + "type": "string" + } + } + }, + "io.k8s.api.authorization.v1.ResourceAttributes": { + "description": "ResourceAttributes includes the authorization attributes available for resource requests to the Authorizer interface", + "type": "object", + "properties": { + "group": { + "description": "Group is the API Group of the Resource. \"*\" means all.", + "type": "string" + }, + "name": { + "description": "Name is the name of the resource being requested for a \"get\" or deleted for a \"delete\". \"\" (empty) means all.", + "type": "string" + }, + "namespace": { + "description": "Namespace is the namespace of the action being requested. Currently, there is no distinction between no namespace and all namespaces \"\" (empty) is defaulted for LocalSubjectAccessReviews \"\" (empty) is empty for cluster-scoped resources \"\" (empty) means \"all\" for namespace scoped resources from a SubjectAccessReview or SelfSubjectAccessReview", + "type": "string" + }, + "resource": { + "description": "Resource is one of the existing resource types. \"*\" means all.", + "type": "string" + }, + "subresource": { + "description": "Subresource is one of the existing resource types. \"\" means none.", + "type": "string" + }, + "verb": { + "description": "Verb is a kubernetes resource API verb, like: get, list, watch, create, update, delete, proxy. \"*\" means all.", + "type": "string" + }, + "version": { + "description": "Version is the API Version of the Resource. \"*\" means all.", + "type": "string" + } + } + }, + "io.k8s.api.authorization.v1.SelfSubjectAccessReview": { + "description": "SelfSubjectAccessReview checks whether or the current user can perform an action. Not filling in a spec.namespace means \"in all namespaces\". Self is a special case, because users should always be able to check whether they can perform an action", + "type": "object", + "required": [ + "spec" + ], + "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", + "type": "string" + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta" + }, + "spec": { + "description": "Spec holds information about the request being evaluated. user and groups must be empty", + "$ref": "#/definitions/io.k8s.api.authorization.v1.SelfSubjectAccessReviewSpec" + }, + "status": { + "description": "Status is filled in by the server and indicates whether the request is allowed or not", + "$ref": "#/definitions/io.k8s.api.authorization.v1.SubjectAccessReviewStatus" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "authorization.k8s.io", + "kind": "SelfSubjectAccessReview", + "version": "v1" + } + ] + }, + "io.k8s.api.authorization.v1.SelfSubjectAccessReviewSpec": { + "description": "SelfSubjectAccessReviewSpec is a description of the access request. Exactly one of ResourceAuthorizationAttributes and NonResourceAuthorizationAttributes must be set", + "type": "object", + "properties": { + "nonResourceAttributes": { + "description": "NonResourceAttributes describes information for a non-resource access request", + "$ref": "#/definitions/io.k8s.api.authorization.v1.NonResourceAttributes" + }, + "resourceAttributes": { + "description": "ResourceAuthorizationAttributes describes information for a resource access request", + "$ref": "#/definitions/io.k8s.api.authorization.v1.ResourceAttributes" + } + } + }, + "io.k8s.api.authorization.v1.SubjectAccessReview": { + "description": "SubjectAccessReview checks whether or not a user or group can perform an action.", + "type": "object", + "required": [ + "spec" + ], + "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", + "type": "string" + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta" + }, + "spec": { + "description": "Spec holds information about the request being evaluated", + "$ref": "#/definitions/io.k8s.api.authorization.v1.SubjectAccessReviewSpec" + }, + "status": { + "description": "Status is filled in by the server and indicates whether the request is allowed or not", + "$ref": "#/definitions/io.k8s.api.authorization.v1.SubjectAccessReviewStatus" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "authorization.k8s.io", + "kind": "SubjectAccessReview", + "version": "v1" + } + ] + }, + "io.k8s.api.authorization.v1.SubjectAccessReviewSpec": { + "description": "SubjectAccessReviewSpec is a description of the access request. Exactly one of ResourceAuthorizationAttributes and NonResourceAuthorizationAttributes must be set", + "type": "object", + "properties": { + "extra": { + "description": "Extra corresponds to the user.Info.GetExtra() method from the authenticator. Since that is input to the authorizer it needs a reflection here.", + "type": "object", + "additionalProperties": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "groups": { + "description": "Groups is the groups you're testing for.", + "type": "array", + "items": { + "type": "string" + } + }, + "nonResourceAttributes": { + "description": "NonResourceAttributes describes information for a non-resource access request", + "$ref": "#/definitions/io.k8s.api.authorization.v1.NonResourceAttributes" + }, + "resourceAttributes": { + "description": "ResourceAuthorizationAttributes describes information for a resource access request", + "$ref": "#/definitions/io.k8s.api.authorization.v1.ResourceAttributes" + }, + "uid": { + "description": "UID information about the requesting user.", + "type": "string" + }, + "user": { + "description": "User is the user you're testing for. If you specify \"User\" but not \"Groups\", then is it interpreted as \"What if User were not a member of any groups", + "type": "string" + } + } + }, + "io.k8s.api.authorization.v1.SubjectAccessReviewStatus": { + "description": "SubjectAccessReviewStatus", + "type": "object", + "required": [ + "allowed" + ], + "properties": { + "allowed": { + "description": "Allowed is required. True if the action would be allowed, false otherwise.", + "type": "boolean" + }, + "evaluationError": { + "description": "EvaluationError is an indication that some error occurred during the authorization check. It is entirely possible to get an error and be able to continue determine authorization status in spite of it. For instance, RBAC can be missing a role, but enough roles are still present and bound to reason about the request.", + "type": "string" + }, + "reason": { + "description": "Reason is optional. It indicates why a request was allowed or denied.", + "type": "string" + } + } + }, + "io.k8s.api.authorization.v1beta1.LocalSubjectAccessReview": { + "description": "LocalSubjectAccessReview checks whether or not a user or group can perform an action in a given namespace. Having a namespace scoped resource makes it much easier to grant namespace scoped policy that includes permissions checking.", + "type": "object", + "required": [ + "spec" + ], + "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", + "type": "string" + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta" + }, + "spec": { + "description": "Spec holds information about the request being evaluated. spec.namespace must be equal to the namespace you made the request against. If empty, it is defaulted.", + "$ref": "#/definitions/io.k8s.api.authorization.v1beta1.SubjectAccessReviewSpec" + }, + "status": { + "description": "Status is filled in by the server and indicates whether the request is allowed or not", + "$ref": "#/definitions/io.k8s.api.authorization.v1beta1.SubjectAccessReviewStatus" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "authorization.k8s.io", + "kind": "LocalSubjectAccessReview", + "version": "v1beta1" + } + ] + }, + "io.k8s.api.authorization.v1beta1.NonResourceAttributes": { + "description": "NonResourceAttributes includes the authorization attributes available for non-resource requests to the Authorizer interface", + "type": "object", + "properties": { + "path": { + "description": "Path is the URL path of the request", + "type": "string" + }, + "verb": { + "description": "Verb is the standard HTTP verb", + "type": "string" + } + } + }, + "io.k8s.api.authorization.v1beta1.ResourceAttributes": { + "description": "ResourceAttributes includes the authorization attributes available for resource requests to the Authorizer interface", + "type": "object", + "properties": { + "group": { + "description": "Group is the API Group of the Resource. \"*\" means all.", + "type": "string" + }, + "name": { + "description": "Name is the name of the resource being requested for a \"get\" or deleted for a \"delete\". \"\" (empty) means all.", + "type": "string" + }, + "namespace": { + "description": "Namespace is the namespace of the action being requested. Currently, there is no distinction between no namespace and all namespaces \"\" (empty) is defaulted for LocalSubjectAccessReviews \"\" (empty) is empty for cluster-scoped resources \"\" (empty) means \"all\" for namespace scoped resources from a SubjectAccessReview or SelfSubjectAccessReview", + "type": "string" + }, + "resource": { + "description": "Resource is one of the existing resource types. \"*\" means all.", + "type": "string" + }, + "subresource": { + "description": "Subresource is one of the existing resource types. \"\" means none.", + "type": "string" + }, + "verb": { + "description": "Verb is a kubernetes resource API verb, like: get, list, watch, create, update, delete, proxy. \"*\" means all.", + "type": "string" + }, + "version": { + "description": "Version is the API Version of the Resource. \"*\" means all.", + "type": "string" + } + } + }, + "io.k8s.api.authorization.v1beta1.SelfSubjectAccessReview": { + "description": "SelfSubjectAccessReview checks whether or the current user can perform an action. Not filling in a spec.namespace means \"in all namespaces\". Self is a special case, because users should always be able to check whether they can perform an action", + "type": "object", + "required": [ + "spec" + ], + "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", + "type": "string" + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta" + }, + "spec": { + "description": "Spec holds information about the request being evaluated. user and groups must be empty", + "$ref": "#/definitions/io.k8s.api.authorization.v1beta1.SelfSubjectAccessReviewSpec" + }, + "status": { + "description": "Status is filled in by the server and indicates whether the request is allowed or not", + "$ref": "#/definitions/io.k8s.api.authorization.v1beta1.SubjectAccessReviewStatus" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "authorization.k8s.io", + "kind": "SelfSubjectAccessReview", + "version": "v1beta1" + } + ] + }, + "io.k8s.api.authorization.v1beta1.SelfSubjectAccessReviewSpec": { + "description": "SelfSubjectAccessReviewSpec is a description of the access request. Exactly one of ResourceAuthorizationAttributes and NonResourceAuthorizationAttributes must be set", + "type": "object", + "properties": { + "nonResourceAttributes": { + "description": "NonResourceAttributes describes information for a non-resource access request", + "$ref": "#/definitions/io.k8s.api.authorization.v1beta1.NonResourceAttributes" + }, + "resourceAttributes": { + "description": "ResourceAuthorizationAttributes describes information for a resource access request", + "$ref": "#/definitions/io.k8s.api.authorization.v1beta1.ResourceAttributes" + } + } + }, + "io.k8s.api.authorization.v1beta1.SubjectAccessReview": { + "description": "SubjectAccessReview checks whether or not a user or group can perform an action.", + "type": "object", + "required": [ + "spec" + ], + "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", + "type": "string" + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta" + }, + "spec": { + "description": "Spec holds information about the request being evaluated", + "$ref": "#/definitions/io.k8s.api.authorization.v1beta1.SubjectAccessReviewSpec" + }, + "status": { + "description": "Status is filled in by the server and indicates whether the request is allowed or not", + "$ref": "#/definitions/io.k8s.api.authorization.v1beta1.SubjectAccessReviewStatus" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "authorization.k8s.io", + "kind": "SubjectAccessReview", + "version": "v1beta1" + } + ] + }, + "io.k8s.api.authorization.v1beta1.SubjectAccessReviewSpec": { + "description": "SubjectAccessReviewSpec is a description of the access request. Exactly one of ResourceAuthorizationAttributes and NonResourceAuthorizationAttributes must be set", + "type": "object", + "properties": { + "extra": { + "description": "Extra corresponds to the user.Info.GetExtra() method from the authenticator. Since that is input to the authorizer it needs a reflection here.", + "type": "object", + "additionalProperties": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "group": { + "description": "Groups is the groups you're testing for.", + "type": "array", + "items": { + "type": "string" + } + }, + "nonResourceAttributes": { + "description": "NonResourceAttributes describes information for a non-resource access request", + "$ref": "#/definitions/io.k8s.api.authorization.v1beta1.NonResourceAttributes" + }, + "resourceAttributes": { + "description": "ResourceAuthorizationAttributes describes information for a resource access request", + "$ref": "#/definitions/io.k8s.api.authorization.v1beta1.ResourceAttributes" + }, + "uid": { + "description": "UID information about the requesting user.", + "type": "string" + }, + "user": { + "description": "User is the user you're testing for. If you specify \"User\" but not \"Group\", then is it interpreted as \"What if User were not a member of any groups", + "type": "string" + } + } + }, + "io.k8s.api.authorization.v1beta1.SubjectAccessReviewStatus": { + "description": "SubjectAccessReviewStatus", + "type": "object", + "required": [ + "allowed" + ], + "properties": { + "allowed": { + "description": "Allowed is required. True if the action would be allowed, false otherwise.", + "type": "boolean" + }, + "evaluationError": { + "description": "EvaluationError is an indication that some error occurred during the authorization check. It is entirely possible to get an error and be able to continue determine authorization status in spite of it. For instance, RBAC can be missing a role, but enough roles are still present and bound to reason about the request.", + "type": "string" + }, + "reason": { + "description": "Reason is optional. It indicates why a request was allowed or denied.", + "type": "string" + } + } + }, + "io.k8s.api.core.v1.AWSElasticBlockStoreVolumeSource": { + "description": "Represents a Persistent Disk resource in AWS.\n\nAn AWS EBS disk must exist before mounting to a container. The disk must also be in the same AWS zone as the kubelet. An AWS EBS disk can only be mounted as read/write once. AWS EBS volumes support ownership management and SELinux relabeling.", + "type": "object", + "required": [ + "volumeID" + ], + "properties": { + "fsType": { + "description": "Filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore", + "type": "string" + }, + "partition": { + "description": "The partition in the volume that you want to mount. If omitted, the default is to mount by volume name. Examples: For volume /dev/sda1, you specify the partition as \"1\". Similarly, the volume partition for /dev/sda is \"0\" (or you can leave the property empty).", + "type": "integer", + "format": "int32" + }, + "readOnly": { + "description": "Specify \"true\" to force and set the ReadOnly property in VolumeMounts to \"true\". If omitted, the default is \"false\". More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore", + "type": "boolean" + }, + "volumeID": { + "description": "Unique ID of the persistent disk resource in AWS (Amazon EBS volume). More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore", + "type": "string" + } + } + }, + "io.k8s.api.core.v1.Affinity": { + "description": "Affinity is a group of affinity scheduling rules.", + "type": "object", + "properties": { + "nodeAffinity": { + "description": "Describes node affinity scheduling rules for the pod.", + "$ref": "#/definitions/io.k8s.api.core.v1.NodeAffinity" + }, + "podAffinity": { + "description": "Describes pod affinity scheduling rules (e.g. co-locate this pod in the same node, zone, etc. as some other pod(s)).", + "$ref": "#/definitions/io.k8s.api.core.v1.PodAffinity" + }, + "podAntiAffinity": { + "description": "Describes pod anti-affinity scheduling rules (e.g. avoid putting this pod in the same node, zone, etc. as some other pod(s)).", + "$ref": "#/definitions/io.k8s.api.core.v1.PodAntiAffinity" + } + } + }, + "io.k8s.api.core.v1.AttachedVolume": { + "description": "AttachedVolume describes a volume attached to a node", + "type": "object", + "required": [ + "name", + "devicePath" + ], + "properties": { + "devicePath": { + "description": "DevicePath represents the device path where the volume should be available", + "type": "string" + }, + "name": { + "description": "Name of the attached volume", + "type": "string" + } + } + }, + "io.k8s.api.core.v1.AzureDiskVolumeSource": { + "description": "AzureDisk represents an Azure Data Disk mount on the host and bind mount to the pod.", + "type": "object", + "required": [ + "diskName", + "diskURI" + ], + "properties": { + "cachingMode": { + "description": "Host Caching mode: None, Read Only, Read Write.", + "type": "string" + }, + "diskName": { + "description": "The Name of the data disk in the blob storage", + "type": "string" + }, + "diskURI": { + "description": "The URI the data disk in the blob storage", + "type": "string" + }, + "fsType": { + "description": "Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified.", + "type": "string" + }, + "kind": { + "description": "Expected values Shared: mulitple blob disks per storage account Dedicated: single blob disk per storage account Managed: azure managed data disk (only in managed availability set). defaults to shared", + "type": "string" + }, + "readOnly": { + "description": "Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.", + "type": "boolean" + } + } + }, + "io.k8s.api.core.v1.AzureFilePersistentVolumeSource": { + "description": "AzureFile represents an Azure File Service mount on the host and bind mount to the pod.", + "type": "object", + "required": [ + "secretName", + "shareName" + ], + "properties": { + "readOnly": { + "description": "Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.", + "type": "boolean" + }, + "secretName": { + "description": "the name of secret that contains Azure Storage Account Name and Key", + "type": "string" + }, + "secretNamespace": { + "description": "the namespace of the secret that contains Azure Storage Account Name and Key default is the same as the Pod", + "type": "string" + }, + "shareName": { + "description": "Share Name", + "type": "string" + } + } + }, + "io.k8s.api.core.v1.AzureFileVolumeSource": { + "description": "AzureFile represents an Azure File Service mount on the host and bind mount to the pod.", + "type": "object", + "required": [ + "secretName", + "shareName" + ], + "properties": { + "readOnly": { + "description": "Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.", + "type": "boolean" + }, + "secretName": { + "description": "the name of secret that contains Azure Storage Account Name and Key", + "type": "string" + }, + "shareName": { + "description": "Share Name", + "type": "string" + } + } + }, + "io.k8s.api.core.v1.Binding": { + "description": "Binding ties one object to another; for example, a pod is bound to a node by a scheduler. Deprecated in 1.7, please use the bindings subresource of pods instead.", + "type": "object", + "required": [ + "target" + ], + "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", + "type": "string" + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "description": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta" + }, + "target": { + "description": "The target object that you want to bind to the standard object.", + "$ref": "#/definitions/io.k8s.api.core.v1.ObjectReference" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "", + "kind": "Binding", + "version": "v1" + } + ] + }, + "io.k8s.api.core.v1.Capabilities": { + "description": "Adds and removes POSIX capabilities from running containers.", + "type": "object", + "properties": { + "add": { + "description": "Added capabilities", + "type": "array", + "items": { + "type": "string" + } + }, + "drop": { + "description": "Removed capabilities", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "io.k8s.api.core.v1.CephFSPersistentVolumeSource": { + "description": "Represents a Ceph Filesystem mount that lasts the lifetime of a pod Cephfs volumes do not support ownership management or SELinux relabeling.", + "type": "object", + "required": [ + "monitors" + ], + "properties": { + "monitors": { + "description": "Required: Monitors is a collection of Ceph monitors More info: https://releases.k8s.io/HEAD/examples/volumes/cephfs/README.md#how-to-use-it", + "type": "array", + "items": { + "type": "string" + } + }, + "path": { + "description": "Optional: Used as the mounted root, rather than the full Ceph tree, default is /", + "type": "string" + }, + "readOnly": { + "description": "Optional: Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts. More info: https://releases.k8s.io/HEAD/examples/volumes/cephfs/README.md#how-to-use-it", + "type": "boolean" + }, + "secretFile": { + "description": "Optional: SecretFile is the path to key ring for User, default is /etc/ceph/user.secret More info: https://releases.k8s.io/HEAD/examples/volumes/cephfs/README.md#how-to-use-it", + "type": "string" + }, + "secretRef": { + "description": "Optional: SecretRef is reference to the authentication secret for User, default is empty. More info: https://releases.k8s.io/HEAD/examples/volumes/cephfs/README.md#how-to-use-it", + "$ref": "#/definitions/io.k8s.api.core.v1.SecretReference" + }, + "user": { + "description": "Optional: User is the rados user name, default is admin More info: https://releases.k8s.io/HEAD/examples/volumes/cephfs/README.md#how-to-use-it", + "type": "string" + } + } + }, + "io.k8s.api.core.v1.CephFSVolumeSource": { + "description": "Represents a Ceph Filesystem mount that lasts the lifetime of a pod Cephfs volumes do not support ownership management or SELinux relabeling.", + "type": "object", + "required": [ + "monitors" + ], + "properties": { + "monitors": { + "description": "Required: Monitors is a collection of Ceph monitors More info: https://releases.k8s.io/HEAD/examples/volumes/cephfs/README.md#how-to-use-it", + "type": "array", + "items": { + "type": "string" + } + }, + "path": { + "description": "Optional: Used as the mounted root, rather than the full Ceph tree, default is /", + "type": "string" + }, + "readOnly": { + "description": "Optional: Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts. More info: https://releases.k8s.io/HEAD/examples/volumes/cephfs/README.md#how-to-use-it", + "type": "boolean" + }, + "secretFile": { + "description": "Optional: SecretFile is the path to key ring for User, default is /etc/ceph/user.secret More info: https://releases.k8s.io/HEAD/examples/volumes/cephfs/README.md#how-to-use-it", + "type": "string" + }, + "secretRef": { + "description": "Optional: SecretRef is reference to the authentication secret for User, default is empty. More info: https://releases.k8s.io/HEAD/examples/volumes/cephfs/README.md#how-to-use-it", + "$ref": "#/definitions/io.k8s.api.core.v1.LocalObjectReference" + }, + "user": { + "description": "Optional: User is the rados user name, default is admin More info: https://releases.k8s.io/HEAD/examples/volumes/cephfs/README.md#how-to-use-it", + "type": "string" + } + } + }, + "io.k8s.api.core.v1.CinderVolumeSource": { + "description": "Represents a cinder volume resource in Openstack. A Cinder volume must exist before mounting to a container. The volume must also be in the same region as the kubelet. Cinder volumes support ownership management and SELinux relabeling.", + "type": "object", + "required": [ + "volumeID" + ], + "properties": { + "fsType": { + "description": "Filesystem type to mount. Must be a filesystem type supported by the host operating system. Examples: \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified. More info: https://releases.k8s.io/HEAD/examples/mysql-cinder-pd/README.md", + "type": "string" + }, + "readOnly": { + "description": "Optional: Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts. More info: https://releases.k8s.io/HEAD/examples/mysql-cinder-pd/README.md", + "type": "boolean" + }, + "volumeID": { + "description": "volume id used to identify the volume in cinder More info: https://releases.k8s.io/HEAD/examples/mysql-cinder-pd/README.md", + "type": "string" + } + } + }, + "io.k8s.api.core.v1.ClientIPConfig": { + "description": "ClientIPConfig represents the configurations of Client IP based session affinity.", + "type": "object", + "properties": { + "timeoutSeconds": { + "description": "timeoutSeconds specifies the seconds of ClientIP type session sticky time. The value must be \u003e0 \u0026\u0026 \u003c=86400(for 1 day) if ServiceAffinity == \"ClientIP\". Default value is 10800(for 3 hours).", + "type": "integer", + "format": "int32" + } + } + }, + "io.k8s.api.core.v1.ComponentCondition": { + "description": "Information about the condition of a component.", + "type": "object", + "required": [ + "type", + "status" + ], + "properties": { + "error": { + "description": "Condition error code for a component. For example, a health check error code.", + "type": "string" + }, + "message": { + "description": "Message about the condition for a component. For example, information about a health check.", + "type": "string" + }, + "status": { + "description": "Status of the condition for a component. Valid values for \"Healthy\": \"True\", \"False\", or \"Unknown\".", + "type": "string" + }, + "type": { + "description": "Type of condition for a component. Valid value: \"Healthy\"", + "type": "string" + } + } + }, + "io.k8s.api.core.v1.ComponentStatus": { + "description": "ComponentStatus (and ComponentStatusList) holds the cluster validation info.", + "type": "object", + "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", + "type": "string" + }, + "conditions": { + "description": "List of component conditions observed", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.core.v1.ComponentCondition" + }, + "x-kubernetes-patch-merge-key": "type", + "x-kubernetes-patch-strategy": "merge" + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "description": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "", + "kind": "ComponentStatus", + "version": "v1" + } + ] + }, + "io.k8s.api.core.v1.ComponentStatusList": { + "description": "Status of all the conditions for the component as a list of ComponentStatus objects.", + "type": "object", + "required": [ + "items" + ], + "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", + "type": "string" + }, + "items": { + "description": "List of ComponentStatus objects.", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.core.v1.ComponentStatus" + } + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "description": "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ListMeta" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "", + "kind": "ComponentStatusList", + "version": "v1" + } + ] + }, + "io.k8s.api.core.v1.ConfigMap": { + "description": "ConfigMap holds configuration data for pods to consume.", + "type": "object", + "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", + "type": "string" + }, + "data": { + "description": "Data contains the configuration data. Each key must consist of alphanumeric characters, '-', '_' or '.'.", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "description": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "", + "kind": "ConfigMap", + "version": "v1" + } + ] + }, + "io.k8s.api.core.v1.ConfigMapEnvSource": { + "description": "ConfigMapEnvSource selects a ConfigMap to populate the environment variables with.\n\nThe contents of the target ConfigMap's Data field will represent the key-value pairs as environment variables.", + "type": "object", + "properties": { + "name": { + "description": "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", + "type": "string" + }, + "optional": { + "description": "Specify whether the ConfigMap must be defined", + "type": "boolean" + } + } + }, + "io.k8s.api.core.v1.ConfigMapKeySelector": { + "description": "Selects a key from a ConfigMap.", + "type": "object", + "required": [ + "key" + ], + "properties": { + "key": { + "description": "The key to select.", + "type": "string" + }, + "name": { + "description": "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", + "type": "string" + }, + "optional": { + "description": "Specify whether the ConfigMap or it's key must be defined", + "type": "boolean" + } + } + }, + "io.k8s.api.core.v1.ConfigMapList": { + "description": "ConfigMapList is a resource containing a list of ConfigMap objects.", + "type": "object", + "required": [ + "items" + ], + "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", + "type": "string" + }, + "items": { + "description": "Items is the list of ConfigMaps.", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.core.v1.ConfigMap" + } + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "description": "More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ListMeta" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "", + "kind": "ConfigMapList", + "version": "v1" + } + ] + }, + "io.k8s.api.core.v1.ConfigMapProjection": { + "description": "Adapts a ConfigMap into a projected volume.\n\nThe contents of the target ConfigMap's Data field will be presented in a projected volume as files using the keys in the Data field as the file names, unless the items element is populated with specific mappings of keys to paths. Note that this is identical to a configmap volume source without the default mode.", + "type": "object", + "properties": { + "items": { + "description": "If unspecified, each key-value pair in the Data field of the referenced ConfigMap will be projected into the volume as a file whose name is the key and content is the value. If specified, the listed keys will be projected into the specified paths, and unlisted keys will not be present. If a key is specified which is not present in the ConfigMap, the volume setup will error unless it is marked optional. Paths must be relative and may not contain the '..' path or start with '..'.", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.core.v1.KeyToPath" + } + }, + "name": { + "description": "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", + "type": "string" + }, + "optional": { + "description": "Specify whether the ConfigMap or it's keys must be defined", + "type": "boolean" + } + } + }, + "io.k8s.api.core.v1.ConfigMapVolumeSource": { + "description": "Adapts a ConfigMap into a volume.\n\nThe contents of the target ConfigMap's Data field will be presented in a volume as files using the keys in the Data field as the file names, unless the items element is populated with specific mappings of keys to paths. ConfigMap volumes support ownership management and SELinux relabeling.", + "type": "object", + "properties": { + "defaultMode": { + "description": "Optional: mode bits to use on created files by default. Must be a value between 0 and 0777. Defaults to 0644. Directories within the path are not affected by this setting. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.", + "type": "integer", + "format": "int32" + }, + "items": { + "description": "If unspecified, each key-value pair in the Data field of the referenced ConfigMap will be projected into the volume as a file whose name is the key and content is the value. If specified, the listed keys will be projected into the specified paths, and unlisted keys will not be present. If a key is specified which is not present in the ConfigMap, the volume setup will error unless it is marked optional. Paths must be relative and may not contain the '..' path or start with '..'.", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.core.v1.KeyToPath" + } + }, + "name": { + "description": "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", + "type": "string" + }, + "optional": { + "description": "Specify whether the ConfigMap or it's keys must be defined", + "type": "boolean" + } + } + }, + "io.k8s.api.core.v1.Container": { + "description": "A single application container that you want to run within a pod.", + "type": "object", + "required": [ + "name", + "image" + ], + "properties": { + "args": { + "description": "Arguments to the entrypoint. The docker image's CMD is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell", + "type": "array", + "items": { + "type": "string" + } + }, + "command": { + "description": "Entrypoint array. Not executed within a shell. The docker image's ENTRYPOINT is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell", + "type": "array", + "items": { + "type": "string" + } + }, + "env": { + "description": "List of environment variables to set in the container. Cannot be updated.", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.core.v1.EnvVar" + }, + "x-kubernetes-patch-merge-key": "name", + "x-kubernetes-patch-strategy": "merge" + }, + "envFrom": { + "description": "List of sources to populate environment variables in the container. The keys defined within a source must be a C_IDENTIFIER. All invalid keys will be reported as an event when the container is starting. When a key exists in multiple sources, the value associated with the last source will take precedence. Values defined by an Env with a duplicate key will take precedence. Cannot be updated.", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.core.v1.EnvFromSource" + } + }, + "image": { + "description": "Docker image name. More info: https://kubernetes.io/docs/concepts/containers/images", + "type": "string" + }, + "imagePullPolicy": { + "description": "Image pull policy. One of Always, Never, IfNotPresent. Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. Cannot be updated. More info: https://kubernetes.io/docs/concepts/containers/images#updating-images", + "type": "string" + }, + "lifecycle": { + "description": "Actions that the management system should take in response to container lifecycle events. Cannot be updated.", + "$ref": "#/definitions/io.k8s.api.core.v1.Lifecycle" + }, + "livenessProbe": { + "description": "Periodic probe of container liveness. Container will be restarted if the probe fails. Cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes", + "$ref": "#/definitions/io.k8s.api.core.v1.Probe" + }, + "name": { + "description": "Name of the container specified as a DNS_LABEL. Each container in a pod must have a unique name (DNS_LABEL). Cannot be updated.", + "type": "string" + }, + "ports": { + "description": "List of ports to expose from the container. Exposing a port here gives the system additional information about the network connections a container uses, but is primarily informational. Not specifying a port here DOES NOT prevent that port from being exposed. Any port which is listening on the default \"0.0.0.0\" address inside a container will be accessible from the network. Cannot be updated.", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.core.v1.ContainerPort" + }, + "x-kubernetes-patch-merge-key": "containerPort", + "x-kubernetes-patch-strategy": "merge" + }, + "readinessProbe": { + "description": "Periodic probe of container service readiness. Container will be removed from service endpoints if the probe fails. Cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes", + "$ref": "#/definitions/io.k8s.api.core.v1.Probe" + }, + "resources": { + "description": "Compute Resources required by this container. Cannot be updated. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources", + "$ref": "#/definitions/io.k8s.api.core.v1.ResourceRequirements" + }, + "securityContext": { + "description": "Security options the pod should run with. More info: https://kubernetes.io/docs/concepts/policy/security-context/ More info: https://git.k8s.io/community/contributors/design-proposals/security_context.md", + "$ref": "#/definitions/io.k8s.api.core.v1.SecurityContext" + }, + "stdin": { + "description": "Whether this container should allocate a buffer for stdin in the container runtime. If this is not set, reads from stdin in the container will always result in EOF. Default is false.", + "type": "boolean" + }, + "stdinOnce": { + "description": "Whether the container runtime should close the stdin channel after it has been opened by a single attach. When stdin is true the stdin stream will remain open across multiple attach sessions. If stdinOnce is set to true, stdin is opened on container start, is empty until the first client attaches to stdin, and then remains open and accepts data until the client disconnects, at which time stdin is closed and remains closed until the container is restarted. If this flag is false, a container processes that reads from stdin will never receive an EOF. Default is false", + "type": "boolean" + }, + "terminationMessagePath": { + "description": "Optional: Path at which the file to which the container's termination message will be written is mounted into the container's filesystem. Message written is intended to be brief final status, such as an assertion failure message. Will be truncated by the node if greater than 4096 bytes. The total message length across all containers will be limited to 12kb. Defaults to /dev/termination-log. Cannot be updated.", + "type": "string" + }, + "terminationMessagePolicy": { + "description": "Indicate how the termination message should be populated. File will use the contents of terminationMessagePath to populate the container status message on both success and failure. FallbackToLogsOnError will use the last chunk of container log output if the termination message file is empty and the container exited with an error. The log output is limited to 2048 bytes or 80 lines, whichever is smaller. Defaults to File. Cannot be updated.", + "type": "string" + }, + "tty": { + "description": "Whether this container should allocate a TTY for itself, also requires 'stdin' to be true. Default is false.", + "type": "boolean" + }, + "volumeMounts": { + "description": "Pod volumes to mount into the container's filesystem. Cannot be updated.", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.core.v1.VolumeMount" + }, + "x-kubernetes-patch-merge-key": "mountPath", + "x-kubernetes-patch-strategy": "merge" + }, + "workingDir": { + "description": "Container's working directory. If not specified, the container runtime's default will be used, which might be configured in the container image. Cannot be updated.", + "type": "string" + } + } + }, + "io.k8s.api.core.v1.ContainerImage": { + "description": "Describe a container image", + "type": "object", + "required": [ + "names" + ], + "properties": { + "names": { + "description": "Names by which this image is known. e.g. [\"gcr.io/google_containers/hyperkube:v1.0.7\", \"dockerhub.io/google_containers/hyperkube:v1.0.7\"]", + "type": "array", + "items": { + "type": "string" + } + }, + "sizeBytes": { + "description": "The size of the image in bytes.", + "type": "integer", + "format": "int64" + } + } + }, + "io.k8s.api.core.v1.ContainerPort": { + "description": "ContainerPort represents a network port in a single container.", + "type": "object", + "required": [ + "containerPort" + ], + "properties": { + "containerPort": { + "description": "Number of port to expose on the pod's IP address. This must be a valid port number, 0 \u003c x \u003c 65536.", + "type": "integer", + "format": "int32" + }, + "hostIP": { + "description": "What host IP to bind the external port to.", + "type": "string" + }, + "hostPort": { + "description": "Number of port to expose on the host. If specified, this must be a valid port number, 0 \u003c x \u003c 65536. If HostNetwork is specified, this must match ContainerPort. Most containers do not need this.", + "type": "integer", + "format": "int32" + }, + "name": { + "description": "If specified, this must be an IANA_SVC_NAME and unique within the pod. Each named port in a pod must have a unique name. Name for the port that can be referred to by services.", + "type": "string" + }, + "protocol": { + "description": "Protocol for port. Must be UDP or TCP. Defaults to \"TCP\".", + "type": "string" + } + } + }, + "io.k8s.api.core.v1.ContainerState": { + "description": "ContainerState holds a possible state of container. Only one of its members may be specified. If none of them is specified, the default one is ContainerStateWaiting.", + "type": "object", + "properties": { + "running": { + "description": "Details about a running container", + "$ref": "#/definitions/io.k8s.api.core.v1.ContainerStateRunning" + }, + "terminated": { + "description": "Details about a terminated container", + "$ref": "#/definitions/io.k8s.api.core.v1.ContainerStateTerminated" + }, + "waiting": { + "description": "Details about a waiting container", + "$ref": "#/definitions/io.k8s.api.core.v1.ContainerStateWaiting" + } + } + }, + "io.k8s.api.core.v1.ContainerStateRunning": { + "description": "ContainerStateRunning is a running state of a container.", + "type": "object", + "properties": { + "startedAt": { + "description": "Time at which the container was last (re-)started", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.Time" + } + } + }, + "io.k8s.api.core.v1.ContainerStateTerminated": { + "description": "ContainerStateTerminated is a terminated state of a container.", + "type": "object", + "required": [ + "exitCode" + ], + "properties": { + "containerID": { + "description": "Container's ID in the format 'docker://\u003ccontainer_id\u003e'", + "type": "string" + }, + "exitCode": { + "description": "Exit status from the last termination of the container", + "type": "integer", + "format": "int32" + }, + "finishedAt": { + "description": "Time at which the container last terminated", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.Time" + }, + "message": { + "description": "Message regarding the last termination of the container", + "type": "string" + }, + "reason": { + "description": "(brief) reason from the last termination of the container", + "type": "string" + }, + "signal": { + "description": "Signal from the last termination of the container", + "type": "integer", + "format": "int32" + }, + "startedAt": { + "description": "Time at which previous execution of the container started", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.Time" + } + } + }, + "io.k8s.api.core.v1.ContainerStateWaiting": { + "description": "ContainerStateWaiting is a waiting state of a container.", + "type": "object", + "properties": { + "message": { + "description": "Message regarding why the container is not yet running.", + "type": "string" + }, + "reason": { + "description": "(brief) reason the container is not yet running.", + "type": "string" + } + } + }, + "io.k8s.api.core.v1.ContainerStatus": { + "description": "ContainerStatus contains details for the current status of this container.", + "type": "object", + "required": [ + "name", + "ready", + "restartCount", + "image", + "imageID" + ], + "properties": { + "containerID": { + "description": "Container's ID in the format 'docker://\u003ccontainer_id\u003e'.", + "type": "string" + }, + "image": { + "description": "The image the container is running. More info: https://kubernetes.io/docs/concepts/containers/images", + "type": "string" + }, + "imageID": { + "description": "ImageID of the container's image.", + "type": "string" + }, + "lastState": { + "description": "Details about the container's last termination condition.", + "$ref": "#/definitions/io.k8s.api.core.v1.ContainerState" + }, + "name": { + "description": "This must be a DNS_LABEL. Each container in a pod must have a unique name. Cannot be updated.", + "type": "string" + }, + "ready": { + "description": "Specifies whether the container has passed its readiness probe.", + "type": "boolean" + }, + "restartCount": { + "description": "The number of times the container has been restarted, currently based on the number of dead containers that have not yet been removed. Note that this is calculated from dead containers. But those containers are subject to garbage collection. This value will get capped at 5 by GC.", + "type": "integer", + "format": "int32" + }, + "state": { + "description": "Details about the container's current condition.", + "$ref": "#/definitions/io.k8s.api.core.v1.ContainerState" + } + } + }, + "io.k8s.api.core.v1.DaemonEndpoint": { + "description": "DaemonEndpoint contains information about a single Daemon endpoint.", + "type": "object", + "required": [ + "Port" + ], + "properties": { + "Port": { + "description": "Port number of the given endpoint.", + "type": "integer", + "format": "int32" + } + } + }, + "io.k8s.api.core.v1.DownwardAPIProjection": { + "description": "Represents downward API info for projecting into a projected volume. Note that this is identical to a downwardAPI volume source without the default mode.", + "type": "object", + "properties": { + "items": { + "description": "Items is a list of DownwardAPIVolume file", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.core.v1.DownwardAPIVolumeFile" + } + } + } + }, + "io.k8s.api.core.v1.DownwardAPIVolumeFile": { + "description": "DownwardAPIVolumeFile represents information to create the file containing the pod field", + "type": "object", + "required": [ + "path" + ], + "properties": { + "fieldRef": { + "description": "Required: Selects a field of the pod: only annotations, labels, name and namespace are supported.", + "$ref": "#/definitions/io.k8s.api.core.v1.ObjectFieldSelector" + }, + "mode": { + "description": "Optional: mode bits to use on this file, must be a value between 0 and 0777. If not specified, the volume defaultMode will be used. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.", + "type": "integer", + "format": "int32" + }, + "path": { + "description": "Required: Path is the relative path name of the file to be created. Must not be absolute or contain the '..' path. Must be utf-8 encoded. The first item of the relative path must not start with '..'", + "type": "string" + }, + "resourceFieldRef": { + "description": "Selects a resource of the container: only resources limits and requests (limits.cpu, limits.memory, requests.cpu and requests.memory) are currently supported.", + "$ref": "#/definitions/io.k8s.api.core.v1.ResourceFieldSelector" + } + } + }, + "io.k8s.api.core.v1.DownwardAPIVolumeSource": { + "description": "DownwardAPIVolumeSource represents a volume containing downward API info. Downward API volumes support ownership management and SELinux relabeling.", + "type": "object", + "properties": { + "defaultMode": { + "description": "Optional: mode bits to use on created files by default. Must be a value between 0 and 0777. Defaults to 0644. Directories within the path are not affected by this setting. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.", + "type": "integer", + "format": "int32" + }, + "items": { + "description": "Items is a list of downward API volume file", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.core.v1.DownwardAPIVolumeFile" + } + } + } + }, + "io.k8s.api.core.v1.EmptyDirVolumeSource": { + "description": "Represents an empty directory for a pod. Empty directory volumes support ownership management and SELinux relabeling.", + "type": "object", + "properties": { + "medium": { + "description": "What type of storage medium should back this directory. The default is \"\" which means to use the node's default medium. Must be an empty string (default) or Memory. More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir", + "type": "string" + }, + "sizeLimit": { + "description": "Total amount of local storage required for this EmptyDir volume. The size limit is also applicable for memory medium. The maximum usage on memory medium EmptyDir would be the minimum value between the SizeLimit specified here and the sum of memory limits of all containers in a pod. The default is nil which means that the limit is undefined. More info: http://kubernetes.io/docs/user-guide/volumes#emptydir", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.api.resource.Quantity" + } + } + }, + "io.k8s.api.core.v1.EndpointAddress": { + "description": "EndpointAddress is a tuple that describes single IP address.", + "type": "object", + "required": [ + "ip" + ], + "properties": { + "hostname": { + "description": "The Hostname of this endpoint", + "type": "string" + }, + "ip": { + "description": "The IP of this endpoint. May not be loopback (127.0.0.0/8), link-local (169.254.0.0/16), or link-local multicast ((224.0.0.0/24). IPv6 is also accepted but not fully supported on all platforms. Also, certain kubernetes components, like kube-proxy, are not IPv6 ready.", + "type": "string" + }, + "nodeName": { + "description": "Optional: Node hosting this endpoint. This can be used to determine endpoints local to a node.", + "type": "string" + }, + "targetRef": { + "description": "Reference to object providing the endpoint.", + "$ref": "#/definitions/io.k8s.api.core.v1.ObjectReference" + } + } + }, + "io.k8s.api.core.v1.EndpointPort": { + "description": "EndpointPort is a tuple that describes a single port.", + "type": "object", + "required": [ + "port" + ], + "properties": { + "name": { + "description": "The name of this port (corresponds to ServicePort.Name). Must be a DNS_LABEL. Optional only if one port is defined.", + "type": "string" + }, + "port": { + "description": "The port number of the endpoint.", + "type": "integer", + "format": "int32" + }, + "protocol": { + "description": "The IP protocol for this port. Must be UDP or TCP. Default is TCP.", + "type": "string" + } + } + }, + "io.k8s.api.core.v1.EndpointSubset": { + "description": "EndpointSubset is a group of addresses with a common set of ports. The expanded set of endpoints is the Cartesian product of Addresses x Ports. For example, given:\n {\n Addresses: [{\"ip\": \"10.10.1.1\"}, {\"ip\": \"10.10.2.2\"}],\n Ports: [{\"name\": \"a\", \"port\": 8675}, {\"name\": \"b\", \"port\": 309}]\n }\nThe resulting set of endpoints can be viewed as:\n a: [ 10.10.1.1:8675, 10.10.2.2:8675 ],\n b: [ 10.10.1.1:309, 10.10.2.2:309 ]", + "type": "object", + "properties": { + "addresses": { + "description": "IP addresses which offer the related ports that are marked as ready. These endpoints should be considered safe for load balancers and clients to utilize.", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.core.v1.EndpointAddress" + } + }, + "notReadyAddresses": { + "description": "IP addresses which offer the related ports but are not currently marked as ready because they have not yet finished starting, have recently failed a readiness check, or have recently failed a liveness check.", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.core.v1.EndpointAddress" + } + }, + "ports": { + "description": "Port numbers available on the related IP addresses.", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.core.v1.EndpointPort" + } + } + } + }, + "io.k8s.api.core.v1.Endpoints": { + "description": "Endpoints is a collection of endpoints that implement the actual service. Example:\n Name: \"mysvc\",\n Subsets: [\n {\n Addresses: [{\"ip\": \"10.10.1.1\"}, {\"ip\": \"10.10.2.2\"}],\n Ports: [{\"name\": \"a\", \"port\": 8675}, {\"name\": \"b\", \"port\": 309}]\n },\n {\n Addresses: [{\"ip\": \"10.10.3.3\"}],\n Ports: [{\"name\": \"a\", \"port\": 93}, {\"name\": \"b\", \"port\": 76}]\n },\n ]", + "type": "object", + "required": [ + "subsets" + ], + "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", + "type": "string" + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "description": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta" + }, + "subsets": { + "description": "The set of all endpoints is the union of all subsets. Addresses are placed into subsets according to the IPs they share. A single address with multiple ports, some of which are ready and some of which are not (because they come from different containers) will result in the address being displayed in different subsets for the different ports. No address will appear in both Addresses and NotReadyAddresses in the same subset. Sets of addresses and ports that comprise a service.", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.core.v1.EndpointSubset" + } + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "", + "kind": "Endpoints", + "version": "v1" + } + ] + }, + "io.k8s.api.core.v1.EndpointsList": { + "description": "EndpointsList is a list of endpoints.", + "type": "object", + "required": [ + "items" + ], + "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", + "type": "string" + }, + "items": { + "description": "List of endpoints.", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.core.v1.Endpoints" + } + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "description": "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ListMeta" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "", + "kind": "EndpointsList", + "version": "v1" + } + ] + }, + "io.k8s.api.core.v1.EnvFromSource": { + "description": "EnvFromSource represents the source of a set of ConfigMaps", + "type": "object", + "properties": { + "configMapRef": { + "description": "The ConfigMap to select from", + "$ref": "#/definitions/io.k8s.api.core.v1.ConfigMapEnvSource" + }, + "prefix": { + "description": "An optional identifer to prepend to each key in the ConfigMap. Must be a C_IDENTIFIER.", + "type": "string" + }, + "secretRef": { + "description": "The Secret to select from", + "$ref": "#/definitions/io.k8s.api.core.v1.SecretEnvSource" + } + } + }, + "io.k8s.api.core.v1.EnvVar": { + "description": "EnvVar represents an environment variable present in a Container.", + "type": "object", + "required": [ + "name" + ], + "properties": { + "name": { + "description": "Name of the environment variable. Must be a C_IDENTIFIER.", + "type": "string" + }, + "value": { + "description": "Variable references $(VAR_NAME) are expanded using the previous defined environment variables in the container and any service environment variables. If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. Defaults to \"\".", + "type": "string" + }, + "valueFrom": { + "description": "Source for the environment variable's value. Cannot be used if value is not empty.", + "$ref": "#/definitions/io.k8s.api.core.v1.EnvVarSource" + } + } + }, + "io.k8s.api.core.v1.EnvVarSource": { + "description": "EnvVarSource represents a source for the value of an EnvVar.", + "type": "object", + "properties": { + "configMapKeyRef": { + "description": "Selects a key of a ConfigMap.", + "$ref": "#/definitions/io.k8s.api.core.v1.ConfigMapKeySelector" + }, + "fieldRef": { + "description": "Selects a field of the pod: supports metadata.name, metadata.namespace, metadata.labels, metadata.annotations, spec.nodeName, spec.serviceAccountName, status.hostIP, status.podIP.", + "$ref": "#/definitions/io.k8s.api.core.v1.ObjectFieldSelector" + }, + "resourceFieldRef": { + "description": "Selects a resource of the container: only resources limits and requests (limits.cpu, limits.memory, limits.ephemeral-storage, requests.cpu, requests.memory and requests.ephemeral-storage) are currently supported.", + "$ref": "#/definitions/io.k8s.api.core.v1.ResourceFieldSelector" + }, + "secretKeyRef": { + "description": "Selects a key of a secret in the pod's namespace", + "$ref": "#/definitions/io.k8s.api.core.v1.SecretKeySelector" + } + } + }, + "io.k8s.api.core.v1.Event": { + "description": "Event is a report of an event somewhere in the cluster.", + "type": "object", + "required": [ + "metadata", + "involvedObject" + ], + "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", + "type": "string" + }, + "count": { + "description": "The number of times this event has occurred.", + "type": "integer", + "format": "int32" + }, + "firstTimestamp": { + "description": "The time at which the event was first recorded. (Time of server receipt is in TypeMeta.)", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.Time" + }, + "involvedObject": { + "description": "The object that this event is about.", + "$ref": "#/definitions/io.k8s.api.core.v1.ObjectReference" + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "type": "string" + }, + "lastTimestamp": { + "description": "The time at which the most recent occurrence of this event was recorded.", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.Time" + }, + "message": { + "description": "A human-readable description of the status of this operation.", + "type": "string" + }, + "metadata": { + "description": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta" + }, + "reason": { + "description": "This should be a short, machine understandable string that gives the reason for the transition into the object's current status.", + "type": "string" + }, + "source": { + "description": "The component reporting this event. Should be a short machine understandable string.", + "$ref": "#/definitions/io.k8s.api.core.v1.EventSource" + }, + "type": { + "description": "Type of this event (Normal, Warning), new types could be added in the future", + "type": "string" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "", + "kind": "Event", + "version": "v1" + } + ] + }, + "io.k8s.api.core.v1.EventList": { + "description": "EventList is a list of events.", + "type": "object", + "required": [ + "items" + ], + "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", + "type": "string" + }, + "items": { + "description": "List of events", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.core.v1.Event" + } + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "description": "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ListMeta" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "", + "kind": "EventList", + "version": "v1" + } + ] + }, + "io.k8s.api.core.v1.EventSource": { + "description": "EventSource contains information for an event.", + "type": "object", + "properties": { + "component": { + "description": "Component from which the event is generated.", + "type": "string" + }, + "host": { + "description": "Node name on which the event is generated.", + "type": "string" + } + } + }, + "io.k8s.api.core.v1.ExecAction": { + "description": "ExecAction describes a \"run in container\" action.", + "type": "object", + "properties": { + "command": { + "description": "Command is the command line to execute inside the container, the working directory for the command is root ('/') in the container's filesystem. The command is simply exec'd, it is not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and non-zero is unhealthy.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "io.k8s.api.core.v1.FCVolumeSource": { + "description": "Represents a Fibre Channel volume. Fibre Channel volumes can only be mounted as read/write once. Fibre Channel volumes support ownership management and SELinux relabeling.", + "type": "object", + "properties": { + "fsType": { + "description": "Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified.", + "type": "string" + }, + "lun": { + "description": "Optional: FC target lun number", + "type": "integer", + "format": "int32" + }, + "readOnly": { + "description": "Optional: Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.", + "type": "boolean" + }, + "targetWWNs": { + "description": "Optional: FC target worldwide names (WWNs)", + "type": "array", + "items": { + "type": "string" + } + }, + "wwids": { + "description": "Optional: FC volume world wide identifiers (wwids) Either wwids or combination of targetWWNs and lun must be set, but not both simultaneously.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "io.k8s.api.core.v1.FlexVolumeSource": { + "description": "FlexVolume represents a generic volume resource that is provisioned/attached using an exec based plugin. This is an alpha feature and may change in future.", + "type": "object", + "required": [ + "driver" + ], + "properties": { + "driver": { + "description": "Driver is the name of the driver to use for this volume.", + "type": "string" + }, + "fsType": { + "description": "Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". The default filesystem depends on FlexVolume script.", + "type": "string" + }, + "options": { + "description": "Optional: Extra command options if any.", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "readOnly": { + "description": "Optional: Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.", + "type": "boolean" + }, + "secretRef": { + "description": "Optional: SecretRef is reference to the secret object containing sensitive information to pass to the plugin scripts. This may be empty if no secret object is specified. If the secret object contains more than one secret, all secrets are passed to the plugin scripts.", + "$ref": "#/definitions/io.k8s.api.core.v1.LocalObjectReference" + } + } + }, + "io.k8s.api.core.v1.FlockerVolumeSource": { + "description": "Represents a Flocker volume mounted by the Flocker agent. One and only one of datasetName and datasetUUID should be set. Flocker volumes do not support ownership management or SELinux relabeling.", + "type": "object", + "properties": { + "datasetName": { + "description": "Name of the dataset stored as metadata -\u003e name on the dataset for Flocker should be considered as deprecated", + "type": "string" + }, + "datasetUUID": { + "description": "UUID of the dataset. This is unique identifier of a Flocker dataset", + "type": "string" + } + } + }, + "io.k8s.api.core.v1.GCEPersistentDiskVolumeSource": { + "description": "Represents a Persistent Disk resource in Google Compute Engine.\n\nA GCE PD must exist before mounting to a container. The disk must also be in the same GCE project and zone as the kubelet. A GCE PD can only be mounted as read/write once or read-only many times. GCE PDs support ownership management and SELinux relabeling.", + "type": "object", + "required": [ + "pdName" + ], + "properties": { + "fsType": { + "description": "Filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk", + "type": "string" + }, + "partition": { + "description": "The partition in the volume that you want to mount. If omitted, the default is to mount by volume name. Examples: For volume /dev/sda1, you specify the partition as \"1\". Similarly, the volume partition for /dev/sda is \"0\" (or you can leave the property empty). More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk", + "type": "integer", + "format": "int32" + }, + "pdName": { + "description": "Unique name of the PD resource in GCE. Used to identify the disk in GCE. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk", + "type": "string" + }, + "readOnly": { + "description": "ReadOnly here will force the ReadOnly setting in VolumeMounts. Defaults to false. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk", + "type": "boolean" + } + } + }, + "io.k8s.api.core.v1.GitRepoVolumeSource": { + "description": "Represents a volume that is populated with the contents of a git repository. Git repo volumes do not support ownership management. Git repo volumes support SELinux relabeling.", + "type": "object", + "required": [ + "repository" + ], + "properties": { + "directory": { + "description": "Target directory name. Must not contain or start with '..'. If '.' is supplied, the volume directory will be the git repository. Otherwise, if specified, the volume will contain the git repository in the subdirectory with the given name.", + "type": "string" + }, + "repository": { + "description": "Repository URL", + "type": "string" + }, + "revision": { + "description": "Commit hash for the specified revision.", + "type": "string" + } + } + }, + "io.k8s.api.core.v1.GlusterfsVolumeSource": { + "description": "Represents a Glusterfs mount that lasts the lifetime of a pod. Glusterfs volumes do not support ownership management or SELinux relabeling.", + "type": "object", + "required": [ + "endpoints", + "path" + ], + "properties": { + "endpoints": { + "description": "EndpointsName is the endpoint name that details Glusterfs topology. More info: https://releases.k8s.io/HEAD/examples/volumes/glusterfs/README.md#create-a-pod", + "type": "string" + }, + "path": { + "description": "Path is the Glusterfs volume path. More info: https://releases.k8s.io/HEAD/examples/volumes/glusterfs/README.md#create-a-pod", + "type": "string" + }, + "readOnly": { + "description": "ReadOnly here will force the Glusterfs volume to be mounted with read-only permissions. Defaults to false. More info: https://releases.k8s.io/HEAD/examples/volumes/glusterfs/README.md#create-a-pod", + "type": "boolean" + } + } + }, + "io.k8s.api.core.v1.HTTPGetAction": { + "description": "HTTPGetAction describes an action based on HTTP Get requests.", + "type": "object", + "required": [ + "port" + ], + "properties": { + "host": { + "description": "Host name to connect to, defaults to the pod IP. You probably want to set \"Host\" in httpHeaders instead.", + "type": "string" + }, + "httpHeaders": { + "description": "Custom headers to set in the request. HTTP allows repeated headers.", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.core.v1.HTTPHeader" + } + }, + "path": { + "description": "Path to access on the HTTP server.", + "type": "string" + }, + "port": { + "description": "Name or number of the port to access on the container. Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME.", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.util.intstr.IntOrString" + }, + "scheme": { + "description": "Scheme to use for connecting to the host. Defaults to HTTP.", + "type": "string" + } + } + }, + "io.k8s.api.core.v1.HTTPHeader": { + "description": "HTTPHeader describes a custom header to be used in HTTP probes", + "type": "object", + "required": [ + "name", + "value" + ], + "properties": { + "name": { + "description": "The header field name", + "type": "string" + }, + "value": { + "description": "The header field value", + "type": "string" + } + } + }, + "io.k8s.api.core.v1.Handler": { + "description": "Handler defines a specific action that should be taken", + "type": "object", + "properties": { + "exec": { + "description": "One and only one of the following should be specified. Exec specifies the action to take.", + "$ref": "#/definitions/io.k8s.api.core.v1.ExecAction" + }, + "httpGet": { + "description": "HTTPGet specifies the http request to perform.", + "$ref": "#/definitions/io.k8s.api.core.v1.HTTPGetAction" + }, + "tcpSocket": { + "description": "TCPSocket specifies an action involving a TCP port. TCP hooks not yet supported", + "$ref": "#/definitions/io.k8s.api.core.v1.TCPSocketAction" + } + } + }, + "io.k8s.api.core.v1.HostAlias": { + "description": "HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the pod's hosts file.", + "type": "object", + "properties": { + "hostnames": { + "description": "Hostnames for the above IP address.", + "type": "array", + "items": { + "type": "string" + } + }, + "ip": { + "description": "IP address of the host file entry.", + "type": "string" + } + } + }, + "io.k8s.api.core.v1.HostPathVolumeSource": { + "description": "Represents a host path mapped into a pod. Host path volumes do not support ownership management or SELinux relabeling.", + "type": "object", + "required": [ + "path" + ], + "properties": { + "path": { + "description": "Path of the directory on the host. If the path is a symlink, it will follow the link to the real path. More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath", + "type": "string" + }, + "type": { + "description": "Type for HostPath Volume Defaults to \"\" More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath", + "type": "string" + } + } + }, + "io.k8s.api.core.v1.ISCSIVolumeSource": { + "description": "Represents an ISCSI disk. ISCSI volumes can only be mounted as read/write once. ISCSI volumes support ownership management and SELinux relabeling.", + "type": "object", + "required": [ + "targetPortal", + "iqn", + "lun" + ], + "properties": { + "chapAuthDiscovery": { + "description": "whether support iSCSI Discovery CHAP authentication", + "type": "boolean" + }, + "chapAuthSession": { + "description": "whether support iSCSI Session CHAP authentication", + "type": "boolean" + }, + "fsType": { + "description": "Filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#iscsi", + "type": "string" + }, + "initiatorName": { + "description": "Custom iSCSI initiator name. If initiatorName is specified with iscsiInterface simultaneously, new iSCSI interface \u003ctarget portal\u003e:\u003cvolume name\u003e will be created for the connection.", + "type": "string" + }, + "iqn": { + "description": "Target iSCSI Qualified Name.", + "type": "string" + }, + "iscsiInterface": { + "description": "Optional: Defaults to 'default' (tcp). iSCSI interface name that uses an iSCSI transport.", + "type": "string" + }, + "lun": { + "description": "iSCSI target lun number.", + "type": "integer", + "format": "int32" + }, + "portals": { + "description": "iSCSI target portal List. The portal is either an IP or ip_addr:port if the port is other than default (typically TCP ports 860 and 3260).", + "type": "array", + "items": { + "type": "string" + } + }, + "readOnly": { + "description": "ReadOnly here will force the ReadOnly setting in VolumeMounts. Defaults to false.", + "type": "boolean" + }, + "secretRef": { + "description": "CHAP secret for iSCSI target and initiator authentication", + "$ref": "#/definitions/io.k8s.api.core.v1.LocalObjectReference" + }, + "targetPortal": { + "description": "iSCSI target portal. The portal is either an IP or ip_addr:port if the port is other than default (typically TCP ports 860 and 3260).", + "type": "string" + } + } + }, + "io.k8s.api.core.v1.KeyToPath": { + "description": "Maps a string key to a path within a volume.", + "type": "object", + "required": [ + "key", + "path" + ], + "properties": { + "key": { + "description": "The key to project.", + "type": "string" + }, + "mode": { + "description": "Optional: mode bits to use on this file, must be a value between 0 and 0777. If not specified, the volume defaultMode will be used. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.", + "type": "integer", + "format": "int32" + }, + "path": { + "description": "The relative path of the file to map the key to. May not be an absolute path. May not contain the path element '..'. May not start with the string '..'.", + "type": "string" + } + } + }, + "io.k8s.api.core.v1.Lifecycle": { + "description": "Lifecycle describes actions that the management system should take in response to container lifecycle events. For the PostStart and PreStop lifecycle handlers, management of the container blocks until the action is complete, unless the container process fails, in which case the handler is aborted.", + "type": "object", + "properties": { + "postStart": { + "description": "PostStart is called immediately after a container is created. If the handler fails, the container is terminated and restarted according to its restart policy. Other management of the container blocks until the hook completes. More info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks", + "$ref": "#/definitions/io.k8s.api.core.v1.Handler" + }, + "preStop": { + "description": "PreStop is called immediately before a container is terminated. The container is terminated after the handler completes. The reason for termination is passed to the handler. Regardless of the outcome of the handler, the container is eventually terminated. Other management of the container blocks until the hook completes. More info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks", + "$ref": "#/definitions/io.k8s.api.core.v1.Handler" + } + } + }, + "io.k8s.api.core.v1.LimitRange": { + "description": "LimitRange sets resource usage limits for each kind of resource in a Namespace.", + "type": "object", + "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", + "type": "string" + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "description": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta" + }, + "spec": { + "description": "Spec defines the limits enforced. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status", + "$ref": "#/definitions/io.k8s.api.core.v1.LimitRangeSpec" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "", + "kind": "LimitRange", + "version": "v1" + } + ] + }, + "io.k8s.api.core.v1.LimitRangeItem": { + "description": "LimitRangeItem defines a min/max usage limit for any resource that matches on kind.", + "type": "object", + "properties": { + "default": { + "description": "Default resource requirement limit value by resource name if resource limit is omitted.", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/io.k8s.apimachinery.pkg.api.resource.Quantity" + } + }, + "defaultRequest": { + "description": "DefaultRequest is the default resource requirement request value by resource name if resource request is omitted.", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/io.k8s.apimachinery.pkg.api.resource.Quantity" + } + }, + "max": { + "description": "Max usage constraints on this kind by resource name.", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/io.k8s.apimachinery.pkg.api.resource.Quantity" + } + }, + "maxLimitRequestRatio": { + "description": "MaxLimitRequestRatio if specified, the named resource must have a request and limit that are both non-zero where limit divided by request is less than or equal to the enumerated value; this represents the max burst for the named resource.", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/io.k8s.apimachinery.pkg.api.resource.Quantity" + } + }, + "min": { + "description": "Min usage constraints on this kind by resource name.", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/io.k8s.apimachinery.pkg.api.resource.Quantity" + } + }, + "type": { + "description": "Type of resource that this limit applies to.", + "type": "string" + } + } + }, + "io.k8s.api.core.v1.LimitRangeList": { + "description": "LimitRangeList is a list of LimitRange items.", + "type": "object", + "required": [ + "items" + ], + "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", + "type": "string" + }, + "items": { + "description": "Items is a list of LimitRange objects. More info: https://git.k8s.io/community/contributors/design-proposals/admission_control_limit_range.md", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.core.v1.LimitRange" + } + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "description": "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ListMeta" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "", + "kind": "LimitRangeList", + "version": "v1" + } + ] + }, + "io.k8s.api.core.v1.LimitRangeSpec": { + "description": "LimitRangeSpec defines a min/max usage limit for resources that match on kind.", + "type": "object", + "required": [ + "limits" + ], + "properties": { + "limits": { + "description": "Limits is the list of LimitRangeItem objects that are enforced.", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.core.v1.LimitRangeItem" + } + } + } + }, + "io.k8s.api.core.v1.LoadBalancerIngress": { + "description": "LoadBalancerIngress represents the status of a load-balancer ingress point: traffic intended for the service should be sent to an ingress point.", + "type": "object", + "properties": { + "hostname": { + "description": "Hostname is set for load-balancer ingress points that are DNS based (typically AWS load-balancers)", + "type": "string" + }, + "ip": { + "description": "IP is set for load-balancer ingress points that are IP based (typically GCE or OpenStack load-balancers)", + "type": "string" + } + } + }, + "io.k8s.api.core.v1.LoadBalancerStatus": { + "description": "LoadBalancerStatus represents the status of a load-balancer.", + "type": "object", + "properties": { + "ingress": { + "description": "Ingress is a list containing ingress points for the load-balancer. Traffic intended for the service should be sent to these ingress points.", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.core.v1.LoadBalancerIngress" + } + } + } + }, + "io.k8s.api.core.v1.LocalObjectReference": { + "description": "LocalObjectReference contains enough information to let you locate the referenced object inside the same namespace.", + "type": "object", + "properties": { + "name": { + "description": "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", + "type": "string" + } + } + }, + "io.k8s.api.core.v1.LocalVolumeSource": { + "description": "Local represents directly-attached storage with node affinity", + "type": "object", + "required": [ + "path" + ], + "properties": { + "path": { + "description": "The full path to the volume on the node For alpha, this path must be a directory Once block as a source is supported, then this path can point to a block device", + "type": "string" + } + } + }, + "io.k8s.api.core.v1.NFSVolumeSource": { + "description": "Represents an NFS mount that lasts the lifetime of a pod. NFS volumes do not support ownership management or SELinux relabeling.", + "type": "object", + "required": [ + "server", + "path" + ], + "properties": { + "path": { + "description": "Path that is exported by the NFS server. More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs", + "type": "string" + }, + "readOnly": { + "description": "ReadOnly here will force the NFS export to be mounted with read-only permissions. Defaults to false. More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs", + "type": "boolean" + }, + "server": { + "description": "Server is the hostname or IP address of the NFS server. More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs", + "type": "string" + } + } + }, + "io.k8s.api.core.v1.Namespace": { + "description": "Namespace provides a scope for Names. Use of multiple namespaces is optional.", + "type": "object", + "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", + "type": "string" + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "description": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta" + }, + "spec": { + "description": "Spec defines the behavior of the Namespace. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status", + "$ref": "#/definitions/io.k8s.api.core.v1.NamespaceSpec" + }, + "status": { + "description": "Status describes the current status of a Namespace. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status", + "$ref": "#/definitions/io.k8s.api.core.v1.NamespaceStatus" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "", + "kind": "Namespace", + "version": "v1" + } + ] + }, + "io.k8s.api.core.v1.NamespaceList": { + "description": "NamespaceList is a list of Namespaces.", + "type": "object", + "required": [ + "items" + ], + "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", + "type": "string" + }, + "items": { + "description": "Items is the list of Namespace objects in the list. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.core.v1.Namespace" + } + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "description": "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ListMeta" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "", + "kind": "NamespaceList", + "version": "v1" + } + ] + }, + "io.k8s.api.core.v1.NamespaceSpec": { + "description": "NamespaceSpec describes the attributes on a Namespace.", + "type": "object", + "properties": { + "finalizers": { + "description": "Finalizers is an opaque list of values that must be empty to permanently remove object from storage. More info: https://git.k8s.io/community/contributors/design-proposals/namespaces.md#finalizers", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "io.k8s.api.core.v1.NamespaceStatus": { + "description": "NamespaceStatus is information about the current status of a Namespace.", + "type": "object", + "properties": { + "phase": { + "description": "Phase is the current lifecycle phase of the namespace. More info: https://git.k8s.io/community/contributors/design-proposals/namespaces.md#phases", + "type": "string" + } + } + }, + "io.k8s.api.core.v1.Node": { + "description": "Node is a worker node in Kubernetes. Each node will have a unique identifier in the cache (i.e. in etcd).", + "type": "object", + "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", + "type": "string" + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "description": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta" + }, + "spec": { + "description": "Spec defines the behavior of a node. https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status", + "$ref": "#/definitions/io.k8s.api.core.v1.NodeSpec" + }, + "status": { + "description": "Most recently observed status of the node. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status", + "$ref": "#/definitions/io.k8s.api.core.v1.NodeStatus" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "", + "kind": "Node", + "version": "v1" + } + ] + }, + "io.k8s.api.core.v1.NodeAddress": { + "description": "NodeAddress contains information for the node's address.", + "type": "object", + "required": [ + "type", + "address" + ], + "properties": { + "address": { + "description": "The node address.", + "type": "string" + }, + "type": { + "description": "Node address type, one of Hostname, ExternalIP or InternalIP.", + "type": "string" + } + } + }, + "io.k8s.api.core.v1.NodeAffinity": { + "description": "Node affinity is a group of node affinity scheduling rules.", + "type": "object", + "properties": { + "preferredDuringSchedulingIgnoredDuringExecution": { + "description": "The scheduler will prefer to schedule pods to nodes that satisfy the affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding \"weight\" to the sum if the node matches the corresponding matchExpressions; the node(s) with the highest sum are the most preferred.", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.core.v1.PreferredSchedulingTerm" + } + }, + "requiredDuringSchedulingIgnoredDuringExecution": { + "description": "If the affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to an update), the system may or may not try to eventually evict the pod from its node.", + "$ref": "#/definitions/io.k8s.api.core.v1.NodeSelector" + } + } + }, + "io.k8s.api.core.v1.NodeCondition": { + "description": "NodeCondition contains condition information for a node.", + "type": "object", + "required": [ + "type", + "status" + ], + "properties": { + "lastHeartbeatTime": { + "description": "Last time we got an update on a given condition.", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.Time" + }, + "lastTransitionTime": { + "description": "Last time the condition transit from one status to another.", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.Time" + }, + "message": { + "description": "Human readable message indicating details about last transition.", + "type": "string" + }, + "reason": { + "description": "(brief) reason for the condition's last transition.", + "type": "string" + }, + "status": { + "description": "Status of the condition, one of True, False, Unknown.", + "type": "string" + }, + "type": { + "description": "Type of node condition.", + "type": "string" + } + } + }, + "io.k8s.api.core.v1.NodeConfigSource": { + "description": "NodeConfigSource specifies a source of node configuration. Exactly one subfield (excluding metadata) must be non-nil.", + "type": "object", + "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", + "type": "string" + }, + "configMapRef": { + "$ref": "#/definitions/io.k8s.api.core.v1.ObjectReference" + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "type": "string" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "", + "kind": "NodeConfigSource", + "version": "v1" + } + ] + }, + "io.k8s.api.core.v1.NodeDaemonEndpoints": { + "description": "NodeDaemonEndpoints lists ports opened by daemons running on the Node.", + "type": "object", + "properties": { + "kubeletEndpoint": { + "description": "Endpoint on which Kubelet is listening.", + "$ref": "#/definitions/io.k8s.api.core.v1.DaemonEndpoint" + } + } + }, + "io.k8s.api.core.v1.NodeList": { + "description": "NodeList is the whole list of all Nodes which have been registered with master.", + "type": "object", + "required": [ + "items" + ], + "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", + "type": "string" + }, + "items": { + "description": "List of nodes", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.core.v1.Node" + } + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "description": "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ListMeta" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "", + "kind": "NodeList", + "version": "v1" + } + ] + }, + "io.k8s.api.core.v1.NodeSelector": { + "description": "A node selector represents the union of the results of one or more label queries over a set of nodes; that is, it represents the OR of the selectors represented by the node selector terms.", + "type": "object", + "required": [ + "nodeSelectorTerms" + ], + "properties": { + "nodeSelectorTerms": { + "description": "Required. A list of node selector terms. The terms are ORed.", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.core.v1.NodeSelectorTerm" + } + } + } + }, + "io.k8s.api.core.v1.NodeSelectorRequirement": { + "description": "A node selector requirement is a selector that contains values, a key, and an operator that relates the key and values.", + "type": "object", + "required": [ + "key", + "operator" + ], + "properties": { + "key": { + "description": "The label key that the selector applies to.", + "type": "string" + }, + "operator": { + "description": "Represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt.", + "type": "string" + }, + "values": { + "description": "An array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. If the operator is Gt or Lt, the values array must have a single element, which will be interpreted as an integer. This array is replaced during a strategic merge patch.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "io.k8s.api.core.v1.NodeSelectorTerm": { + "description": "A null or empty node selector term matches no objects.", + "type": "object", + "required": [ + "matchExpressions" + ], + "properties": { + "matchExpressions": { + "description": "Required. A list of node selector requirements. The requirements are ANDed.", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.core.v1.NodeSelectorRequirement" + } + } + } + }, + "io.k8s.api.core.v1.NodeSpec": { + "description": "NodeSpec describes the attributes that a node is created with.", + "type": "object", + "properties": { + "configSource": { + "description": "If specified, the source to get node configuration from The DynamicKubeletConfig feature gate must be enabled for the Kubelet to use this field", + "$ref": "#/definitions/io.k8s.api.core.v1.NodeConfigSource" + }, + "externalID": { + "description": "External ID of the node assigned by some machine database (e.g. a cloud provider). Deprecated.", + "type": "string" + }, + "podCIDR": { + "description": "PodCIDR represents the pod IP range assigned to the node.", + "type": "string" + }, + "providerID": { + "description": "ID of the node assigned by the cloud provider in the format: \u003cProviderName\u003e://\u003cProviderSpecificNodeID\u003e", + "type": "string" + }, + "taints": { + "description": "If specified, the node's taints.", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.core.v1.Taint" + } + }, + "unschedulable": { + "description": "Unschedulable controls node schedulability of new pods. By default, node is schedulable. More info: https://kubernetes.io/docs/concepts/nodes/node/#manual-node-administration", + "type": "boolean" + } + } + }, + "io.k8s.api.core.v1.NodeStatus": { + "description": "NodeStatus is information about the current status of a node.", + "type": "object", + "properties": { + "addresses": { + "description": "List of addresses reachable to the node. Queried from cloud provider, if available. More info: https://kubernetes.io/docs/concepts/nodes/node/#addresses", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.core.v1.NodeAddress" + }, + "x-kubernetes-patch-merge-key": "type", + "x-kubernetes-patch-strategy": "merge" + }, + "allocatable": { + "description": "Allocatable represents the resources of a node that are available for scheduling. Defaults to Capacity.", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/io.k8s.apimachinery.pkg.api.resource.Quantity" + } + }, + "capacity": { + "description": "Capacity represents the total resources of a node. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#capacity", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/io.k8s.apimachinery.pkg.api.resource.Quantity" + } + }, + "conditions": { + "description": "Conditions is an array of current observed node conditions. More info: https://kubernetes.io/docs/concepts/nodes/node/#condition", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.core.v1.NodeCondition" + }, + "x-kubernetes-patch-merge-key": "type", + "x-kubernetes-patch-strategy": "merge" + }, + "daemonEndpoints": { + "description": "Endpoints of daemons running on the Node.", + "$ref": "#/definitions/io.k8s.api.core.v1.NodeDaemonEndpoints" + }, + "images": { + "description": "List of container images on this node", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.core.v1.ContainerImage" + } + }, + "nodeInfo": { + "description": "Set of ids/uuids to uniquely identify the node. More info: https://kubernetes.io/docs/concepts/nodes/node/#info", + "$ref": "#/definitions/io.k8s.api.core.v1.NodeSystemInfo" + }, + "phase": { + "description": "NodePhase is the recently observed lifecycle phase of the node. More info: https://kubernetes.io/docs/concepts/nodes/node/#phase The field is never populated, and now is deprecated.", + "type": "string" + }, + "volumesAttached": { + "description": "List of volumes that are attached to the node.", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.core.v1.AttachedVolume" + } + }, + "volumesInUse": { + "description": "List of attachable volumes in use (mounted) by the node.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "io.k8s.api.core.v1.NodeSystemInfo": { + "description": "NodeSystemInfo is a set of ids/uuids to uniquely identify the node.", + "type": "object", + "required": [ + "machineID", + "systemUUID", + "bootID", + "kernelVersion", + "osImage", + "containerRuntimeVersion", + "kubeletVersion", + "kubeProxyVersion", + "operatingSystem", + "architecture" + ], + "properties": { + "architecture": { + "description": "The Architecture reported by the node", + "type": "string" + }, + "bootID": { + "description": "Boot ID reported by the node.", + "type": "string" + }, + "containerRuntimeVersion": { + "description": "ContainerRuntime Version reported by the node through runtime remote API (e.g. docker://1.5.0).", + "type": "string" + }, + "kernelVersion": { + "description": "Kernel Version reported by the node from 'uname -r' (e.g. 3.16.0-0.bpo.4-amd64).", + "type": "string" + }, + "kubeProxyVersion": { + "description": "KubeProxy Version reported by the node.", + "type": "string" + }, + "kubeletVersion": { + "description": "Kubelet Version reported by the node.", + "type": "string" + }, + "machineID": { + "description": "MachineID reported by the node. For unique machine identification in the cluster this field is preferred. Learn more from man(5) machine-id: http://man7.org/linux/man-pages/man5/machine-id.5.html", + "type": "string" + }, + "operatingSystem": { + "description": "The Operating System reported by the node", + "type": "string" + }, + "osImage": { + "description": "OS Image reported by the node from /etc/os-release (e.g. Debian GNU/Linux 7 (wheezy)).", + "type": "string" + }, + "systemUUID": { + "description": "SystemUUID reported by the node. For unique machine identification MachineID is preferred. This field is specific to Red Hat hosts https://access.redhat.com/documentation/en-US/Red_Hat_Subscription_Management/1/html/RHSM/getting-system-uuid.html", + "type": "string" + } + } + }, + "io.k8s.api.core.v1.ObjectFieldSelector": { + "description": "ObjectFieldSelector selects an APIVersioned field of an object.", + "type": "object", + "required": [ + "fieldPath" + ], + "properties": { + "apiVersion": { + "description": "Version of the schema the FieldPath is written in terms of, defaults to \"v1\".", + "type": "string" + }, + "fieldPath": { + "description": "Path of the field to select in the specified API version.", + "type": "string" + } + } + }, + "io.k8s.api.core.v1.ObjectReference": { + "description": "ObjectReference contains enough information to let you inspect or modify the referred object.", + "type": "object", + "properties": { + "apiVersion": { + "description": "API version of the referent.", + "type": "string" + }, + "fieldPath": { + "description": "If referring to a piece of an object instead of an entire object, this string should contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2]. For example, if the object reference is to a container within a pod, this would take on a value like: \"spec.containers{name}\" (where \"name\" refers to the name of the container that triggered the event) or if no container name is specified \"spec.containers[2]\" (container with index 2 in this pod). This syntax is chosen only to have some well-defined way of referencing a part of an object.", + "type": "string" + }, + "kind": { + "description": "Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "type": "string" + }, + "name": { + "description": "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", + "type": "string" + }, + "namespace": { + "description": "Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/", + "type": "string" + }, + "resourceVersion": { + "description": "Specific resourceVersion to which this reference is made, if any. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#concurrency-control-and-consistency", + "type": "string" + }, + "uid": { + "description": "UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids", + "type": "string" + } + } + }, + "io.k8s.api.core.v1.PersistentVolume": { + "description": "PersistentVolume (PV) is a storage resource provisioned by an administrator. It is analogous to a node. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes", + "type": "object", + "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", + "type": "string" + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "description": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta" + }, + "spec": { + "description": "Spec defines a specification of a persistent volume owned by the cluster. Provisioned by an administrator. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistent-volumes", + "$ref": "#/definitions/io.k8s.api.core.v1.PersistentVolumeSpec" + }, + "status": { + "description": "Status represents the current information/status for the persistent volume. Populated by the system. Read-only. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistent-volumes", + "$ref": "#/definitions/io.k8s.api.core.v1.PersistentVolumeStatus" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "", + "kind": "PersistentVolume", + "version": "v1" + } + ] + }, + "io.k8s.api.core.v1.PersistentVolumeClaim": { + "description": "PersistentVolumeClaim is a user's request for and claim to a persistent volume", + "type": "object", + "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", + "type": "string" + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "description": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta" + }, + "spec": { + "description": "Spec defines the desired characteristics of a volume requested by a pod author. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims", + "$ref": "#/definitions/io.k8s.api.core.v1.PersistentVolumeClaimSpec" + }, + "status": { + "description": "Status represents the current information/status of a persistent volume claim. Read-only. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims", + "$ref": "#/definitions/io.k8s.api.core.v1.PersistentVolumeClaimStatus" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "", + "kind": "PersistentVolumeClaim", + "version": "v1" + } + ] + }, + "io.k8s.api.core.v1.PersistentVolumeClaimList": { + "description": "PersistentVolumeClaimList is a list of PersistentVolumeClaim items.", + "type": "object", + "required": [ + "items" + ], + "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", + "type": "string" + }, + "items": { + "description": "A list of persistent volume claims. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.core.v1.PersistentVolumeClaim" + } + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "description": "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ListMeta" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "", + "kind": "PersistentVolumeClaimList", + "version": "v1" + } + ] + }, + "io.k8s.api.core.v1.PersistentVolumeClaimSpec": { + "description": "PersistentVolumeClaimSpec describes the common attributes of storage devices and allows a Source for provider-specific attributes", + "type": "object", + "properties": { + "accessModes": { + "description": "AccessModes contains the desired access modes the volume should have. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1", + "type": "array", + "items": { + "type": "string" + } + }, + "resources": { + "description": "Resources represents the minimum resources the volume should have. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources", + "$ref": "#/definitions/io.k8s.api.core.v1.ResourceRequirements" + }, + "selector": { + "description": "A label query over volumes to consider for binding.", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector" + }, + "storageClassName": { + "description": "Name of the StorageClass required by the claim. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1", + "type": "string" + }, + "volumeName": { + "description": "VolumeName is the binding reference to the PersistentVolume backing this claim.", + "type": "string" + } + } + }, + "io.k8s.api.core.v1.PersistentVolumeClaimStatus": { + "description": "PersistentVolumeClaimStatus is the current status of a persistent volume claim.", + "type": "object", + "properties": { + "accessModes": { + "description": "AccessModes contains the actual access modes the volume backing the PVC has. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1", + "type": "array", + "items": { + "type": "string" + } + }, + "capacity": { + "description": "Represents the actual resources of the underlying volume.", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/io.k8s.apimachinery.pkg.api.resource.Quantity" + } + }, + "phase": { + "description": "Phase represents the current phase of PersistentVolumeClaim.", + "type": "string" + } + } + }, + "io.k8s.api.core.v1.PersistentVolumeClaimVolumeSource": { + "description": "PersistentVolumeClaimVolumeSource references the user's PVC in the same namespace. This volume finds the bound PV and mounts that volume for the pod. A PersistentVolumeClaimVolumeSource is, essentially, a wrapper around another type of volume that is owned by someone else (the system).", + "type": "object", + "required": [ + "claimName" + ], + "properties": { + "claimName": { + "description": "ClaimName is the name of a PersistentVolumeClaim in the same namespace as the pod using this volume. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims", + "type": "string" + }, + "readOnly": { + "description": "Will force the ReadOnly setting in VolumeMounts. Default false.", + "type": "boolean" + } + } + }, + "io.k8s.api.core.v1.PersistentVolumeList": { + "description": "PersistentVolumeList is a list of PersistentVolume items.", + "type": "object", + "required": [ + "items" + ], + "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", + "type": "string" + }, + "items": { + "description": "List of persistent volumes. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.core.v1.PersistentVolume" + } + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "description": "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ListMeta" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "", + "kind": "PersistentVolumeList", + "version": "v1" + } + ] + }, + "io.k8s.api.core.v1.PersistentVolumeSpec": { + "description": "PersistentVolumeSpec is the specification of a persistent volume.", + "type": "object", + "properties": { + "accessModes": { + "description": "AccessModes contains all ways the volume can be mounted. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes", + "type": "array", + "items": { + "type": "string" + } + }, + "awsElasticBlockStore": { + "description": "AWSElasticBlockStore represents an AWS Disk resource that is attached to a kubelet's host machine and then exposed to the pod. More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore", + "$ref": "#/definitions/io.k8s.api.core.v1.AWSElasticBlockStoreVolumeSource" + }, + "azureDisk": { + "description": "AzureDisk represents an Azure Data Disk mount on the host and bind mount to the pod.", + "$ref": "#/definitions/io.k8s.api.core.v1.AzureDiskVolumeSource" + }, + "azureFile": { + "description": "AzureFile represents an Azure File Service mount on the host and bind mount to the pod.", + "$ref": "#/definitions/io.k8s.api.core.v1.AzureFilePersistentVolumeSource" + }, + "capacity": { + "description": "A description of the persistent volume's resources and capacity. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#capacity", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/io.k8s.apimachinery.pkg.api.resource.Quantity" + } + }, + "cephfs": { + "description": "CephFS represents a Ceph FS mount on the host that shares a pod's lifetime", + "$ref": "#/definitions/io.k8s.api.core.v1.CephFSPersistentVolumeSource" + }, + "cinder": { + "description": "Cinder represents a cinder volume attached and mounted on kubelets host machine More info: https://releases.k8s.io/HEAD/examples/mysql-cinder-pd/README.md", + "$ref": "#/definitions/io.k8s.api.core.v1.CinderVolumeSource" + }, + "claimRef": { + "description": "ClaimRef is part of a bi-directional binding between PersistentVolume and PersistentVolumeClaim. Expected to be non-nil when bound. claim.VolumeName is the authoritative bind between PV and PVC. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#binding", + "$ref": "#/definitions/io.k8s.api.core.v1.ObjectReference" + }, + "fc": { + "description": "FC represents a Fibre Channel resource that is attached to a kubelet's host machine and then exposed to the pod.", + "$ref": "#/definitions/io.k8s.api.core.v1.FCVolumeSource" + }, + "flexVolume": { + "description": "FlexVolume represents a generic volume resource that is provisioned/attached using an exec based plugin. This is an alpha feature and may change in future.", + "$ref": "#/definitions/io.k8s.api.core.v1.FlexVolumeSource" + }, + "flocker": { + "description": "Flocker represents a Flocker volume attached to a kubelet's host machine and exposed to the pod for its usage. This depends on the Flocker control service being running", + "$ref": "#/definitions/io.k8s.api.core.v1.FlockerVolumeSource" + }, + "gcePersistentDisk": { + "description": "GCEPersistentDisk represents a GCE Disk resource that is attached to a kubelet's host machine and then exposed to the pod. Provisioned by an admin. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk", + "$ref": "#/definitions/io.k8s.api.core.v1.GCEPersistentDiskVolumeSource" + }, + "glusterfs": { + "description": "Glusterfs represents a Glusterfs volume that is attached to a host and exposed to the pod. Provisioned by an admin. More info: https://releases.k8s.io/HEAD/examples/volumes/glusterfs/README.md", + "$ref": "#/definitions/io.k8s.api.core.v1.GlusterfsVolumeSource" + }, + "hostPath": { + "description": "HostPath represents a directory on the host. Provisioned by a developer or tester. This is useful for single-node development and testing only! On-host storage is not supported in any way and WILL NOT WORK in a multi-node cluster. More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath", + "$ref": "#/definitions/io.k8s.api.core.v1.HostPathVolumeSource" + }, + "iscsi": { + "description": "ISCSI represents an ISCSI Disk resource that is attached to a kubelet's host machine and then exposed to the pod. Provisioned by an admin.", + "$ref": "#/definitions/io.k8s.api.core.v1.ISCSIVolumeSource" + }, + "local": { + "description": "Local represents directly-attached storage with node affinity", + "$ref": "#/definitions/io.k8s.api.core.v1.LocalVolumeSource" + }, + "mountOptions": { + "description": "A list of mount options, e.g. [\"ro\", \"soft\"]. Not validated - mount will simply fail if one is invalid. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes/#mount-options", + "type": "array", + "items": { + "type": "string" + } + }, + "nfs": { + "description": "NFS represents an NFS mount on the host. Provisioned by an admin. More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs", + "$ref": "#/definitions/io.k8s.api.core.v1.NFSVolumeSource" + }, + "persistentVolumeReclaimPolicy": { + "description": "What happens to a persistent volume when released from its claim. Valid options are Retain (default) and Recycle. Recycling must be supported by the volume plugin underlying this persistent volume. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#reclaiming", + "type": "string" + }, + "photonPersistentDisk": { + "description": "PhotonPersistentDisk represents a PhotonController persistent disk attached and mounted on kubelets host machine", + "$ref": "#/definitions/io.k8s.api.core.v1.PhotonPersistentDiskVolumeSource" + }, + "portworxVolume": { + "description": "PortworxVolume represents a portworx volume attached and mounted on kubelets host machine", + "$ref": "#/definitions/io.k8s.api.core.v1.PortworxVolumeSource" + }, + "quobyte": { + "description": "Quobyte represents a Quobyte mount on the host that shares a pod's lifetime", + "$ref": "#/definitions/io.k8s.api.core.v1.QuobyteVolumeSource" + }, + "rbd": { + "description": "RBD represents a Rados Block Device mount on the host that shares a pod's lifetime. More info: https://releases.k8s.io/HEAD/examples/volumes/rbd/README.md", + "$ref": "#/definitions/io.k8s.api.core.v1.RBDVolumeSource" + }, + "scaleIO": { + "description": "ScaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes.", + "$ref": "#/definitions/io.k8s.api.core.v1.ScaleIOVolumeSource" + }, + "storageClassName": { + "description": "Name of StorageClass to which this persistent volume belongs. Empty value means that this volume does not belong to any StorageClass.", + "type": "string" + }, + "storageos": { + "description": "StorageOS represents a StorageOS volume that is attached to the kubelet's host machine and mounted into the pod More info: https://releases.k8s.io/HEAD/examples/volumes/storageos/README.md", + "$ref": "#/definitions/io.k8s.api.core.v1.StorageOSPersistentVolumeSource" + }, + "vsphereVolume": { + "description": "VsphereVolume represents a vSphere volume attached and mounted on kubelets host machine", + "$ref": "#/definitions/io.k8s.api.core.v1.VsphereVirtualDiskVolumeSource" + } + } + }, + "io.k8s.api.core.v1.PersistentVolumeStatus": { + "description": "PersistentVolumeStatus is the current status of a persistent volume.", + "type": "object", + "properties": { + "message": { + "description": "A human-readable message indicating details about why the volume is in this state.", + "type": "string" + }, + "phase": { + "description": "Phase indicates if a volume is available, bound to a claim, or released by a claim. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#phase", + "type": "string" + }, + "reason": { + "description": "Reason is a brief CamelCase string that describes any failure and is meant for machine parsing and tidy display in the CLI.", + "type": "string" + } + } + }, + "io.k8s.api.core.v1.PhotonPersistentDiskVolumeSource": { + "description": "Represents a Photon Controller persistent disk resource.", + "type": "object", + "required": [ + "pdID" + ], + "properties": { + "fsType": { + "description": "Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified.", + "type": "string" + }, + "pdID": { + "description": "ID that identifies Photon Controller persistent disk", + "type": "string" + } + } + }, + "io.k8s.api.core.v1.Pod": { + "description": "Pod is a collection of containers that can run on a host. This resource is created by clients and scheduled onto hosts.", + "type": "object", + "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", + "type": "string" + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "description": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta" + }, + "spec": { + "description": "Specification of the desired behavior of the pod. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status", + "$ref": "#/definitions/io.k8s.api.core.v1.PodSpec" + }, + "status": { + "description": "Most recently observed status of the pod. This data may not be up to date. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status", + "$ref": "#/definitions/io.k8s.api.core.v1.PodStatus" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "", + "kind": "Pod", + "version": "v1" + } + ] + }, + "io.k8s.api.core.v1.PodAffinity": { + "description": "Pod affinity is a group of inter pod affinity scheduling rules.", + "type": "object", + "properties": { + "preferredDuringSchedulingIgnoredDuringExecution": { + "description": "The scheduler will prefer to schedule pods to nodes that satisfy the affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding \"weight\" to the sum if the node has pods which matches the corresponding podAffinityTerm; the node(s) with the highest sum are the most preferred.", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.core.v1.WeightedPodAffinityTerm" + } + }, + "requiredDuringSchedulingIgnoredDuringExecution": { + "description": "If the affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to a pod label update), the system may or may not try to eventually evict the pod from its node. When there are multiple elements, the lists of nodes corresponding to each podAffinityTerm are intersected, i.e. all terms must be satisfied.", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.core.v1.PodAffinityTerm" + } + } + } + }, + "io.k8s.api.core.v1.PodAffinityTerm": { + "description": "Defines a set of pods (namely those matching the labelSelector relative to the given namespace(s)) that this pod should be co-located (affinity) or not co-located (anti-affinity) with, where co-located is defined as running on a node whose value of the label with key \u003ctopologyKey\u003e tches that of any node on which a pod of the set of pods is running", + "type": "object", + "properties": { + "labelSelector": { + "description": "A label query over a set of resources, in this case pods.", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector" + }, + "namespaces": { + "description": "namespaces specifies which namespaces the labelSelector applies to (matches against); null or empty list means \"this pod's namespace\"", + "type": "array", + "items": { + "type": "string" + } + }, + "topologyKey": { + "description": "This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching the labelSelector in the specified namespaces, where co-located is defined as running on a node whose value of the label with key topologyKey matches that of any node on which any of the selected pods is running. For PreferredDuringScheduling pod anti-affinity, empty topologyKey is interpreted as \"all topologies\" (\"all topologies\" here means all the topologyKeys indicated by scheduler command-line argument --failure-domains); for affinity and for RequiredDuringScheduling pod anti-affinity, empty topologyKey is not allowed.", + "type": "string" + } + } + }, + "io.k8s.api.core.v1.PodAntiAffinity": { + "description": "Pod anti affinity is a group of inter pod anti affinity scheduling rules.", + "type": "object", + "properties": { + "preferredDuringSchedulingIgnoredDuringExecution": { + "description": "The scheduler will prefer to schedule pods to nodes that satisfy the anti-affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling anti-affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding \"weight\" to the sum if the node has pods which matches the corresponding podAffinityTerm; the node(s) with the highest sum are the most preferred.", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.core.v1.WeightedPodAffinityTerm" + } + }, + "requiredDuringSchedulingIgnoredDuringExecution": { + "description": "If the anti-affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the anti-affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to a pod label update), the system may or may not try to eventually evict the pod from its node. When there are multiple elements, the lists of nodes corresponding to each podAffinityTerm are intersected, i.e. all terms must be satisfied.", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.core.v1.PodAffinityTerm" + } + } + } + }, + "io.k8s.api.core.v1.PodCondition": { + "description": "PodCondition contains details for the current condition of this pod.", + "type": "object", + "required": [ + "type", + "status" + ], + "properties": { + "lastProbeTime": { + "description": "Last time we probed the condition.", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.Time" + }, + "lastTransitionTime": { + "description": "Last time the condition transitioned from one status to another.", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.Time" + }, + "message": { + "description": "Human-readable message indicating details about last transition.", + "type": "string" + }, + "reason": { + "description": "Unique, one-word, CamelCase reason for the condition's last transition.", + "type": "string" + }, + "status": { + "description": "Status is the status of the condition. Can be True, False, Unknown. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-conditions", + "type": "string" + }, + "type": { + "description": "Type is the type of the condition. Currently only Ready. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-conditions", + "type": "string" + } + } + }, + "io.k8s.api.core.v1.PodList": { + "description": "PodList is a list of Pods.", + "type": "object", + "required": [ + "items" + ], + "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", + "type": "string" + }, + "items": { + "description": "List of pods. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.core.v1.Pod" + } + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "description": "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ListMeta" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "", + "kind": "PodList", + "version": "v1" + } + ] + }, + "io.k8s.api.core.v1.PodSecurityContext": { + "description": "PodSecurityContext holds pod-level security attributes and common container settings. Some fields are also present in container.securityContext. Field values of container.securityContext take precedence over field values of PodSecurityContext.", + "type": "object", + "properties": { + "fsGroup": { + "description": "A special supplemental group that applies to all containers in a pod. Some volume types allow the Kubelet to change the ownership of that volume to be owned by the pod:\n\n1. The owning GID will be the FSGroup 2. The setgid bit is set (new files created in the volume will be owned by FSGroup) 3. The permission bits are OR'd with rw-rw----\n\nIf unset, the Kubelet will not modify the ownership and permissions of any volume.", + "type": "integer", + "format": "int64" + }, + "runAsNonRoot": { + "description": "Indicates that the container must run as a non-root user. If true, the Kubelet will validate the image at runtime to ensure that it does not run as UID 0 (root) and fail to start the container if it does. If unset or false, no such validation will be performed. May also be set in SecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence.", + "type": "boolean" + }, + "runAsUser": { + "description": "The UID to run the entrypoint of the container process. Defaults to user specified in image metadata if unspecified. May also be set in SecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence for that container.", + "type": "integer", + "format": "int64" + }, + "seLinuxOptions": { + "description": "The SELinux context to be applied to all containers. If unspecified, the container runtime will allocate a random SELinux context for each container. May also be set in SecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence for that container.", + "$ref": "#/definitions/io.k8s.api.core.v1.SELinuxOptions" + }, + "supplementalGroups": { + "description": "A list of groups applied to the first process run in each container, in addition to the container's primary GID. If unspecified, no groups will be added to any container.", + "type": "array", + "items": { + "type": "integer", + "format": "int64" + } + } + } + }, + "io.k8s.api.core.v1.PodSpec": { + "description": "PodSpec is a description of a pod.", + "type": "object", + "required": [ + "containers" + ], + "properties": { + "activeDeadlineSeconds": { + "description": "Optional duration in seconds the pod may be active on the node relative to StartTime before the system will actively try to mark it failed and kill associated containers. Value must be a positive integer.", + "type": "integer", + "format": "int64" + }, + "affinity": { + "description": "If specified, the pod's scheduling constraints", + "$ref": "#/definitions/io.k8s.api.core.v1.Affinity" + }, + "automountServiceAccountToken": { + "description": "AutomountServiceAccountToken indicates whether a service account token should be automatically mounted.", + "type": "boolean" + }, + "containers": { + "description": "List of containers belonging to the pod. Containers cannot currently be added or removed. There must be at least one container in a Pod. Cannot be updated.", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.core.v1.Container" + }, + "x-kubernetes-patch-merge-key": "name", + "x-kubernetes-patch-strategy": "merge" + }, + "dnsPolicy": { + "description": "Set DNS policy for containers within the pod. One of 'ClusterFirstWithHostNet', 'ClusterFirst' or 'Default'. Defaults to \"ClusterFirst\". To have DNS options set along with hostNetwork, you have to specify DNS policy explicitly to 'ClusterFirstWithHostNet'.", + "type": "string" + }, + "hostAliases": { + "description": "HostAliases is an optional list of hosts and IPs that will be injected into the pod's hosts file if specified. This is only valid for non-hostNetwork pods.", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.core.v1.HostAlias" + }, + "x-kubernetes-patch-merge-key": "ip", + "x-kubernetes-patch-strategy": "merge" + }, + "hostIPC": { + "description": "Use the host's ipc namespace. Optional: Default to false.", + "type": "boolean" + }, + "hostNetwork": { + "description": "Host networking requested for this pod. Use the host's network namespace. If this option is set, the ports that will be used must be specified. Default to false.", + "type": "boolean" + }, + "hostPID": { + "description": "Use the host's pid namespace. Optional: Default to false.", + "type": "boolean" + }, + "hostname": { + "description": "Specifies the hostname of the Pod If not specified, the pod's hostname will be set to a system-defined value.", + "type": "string" + }, + "imagePullSecrets": { + "description": "ImagePullSecrets is an optional list of references to secrets in the same namespace to use for pulling any of the images used by this PodSpec. If specified, these secrets will be passed to individual puller implementations for them to use. For example, in the case of docker, only DockerConfig type secrets are honored. More info: https://kubernetes.io/docs/concepts/containers/images#specifying-imagepullsecrets-on-a-pod", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.core.v1.LocalObjectReference" + }, + "x-kubernetes-patch-merge-key": "name", + "x-kubernetes-patch-strategy": "merge" + }, + "initContainers": { + "description": "List of initialization containers belonging to the pod. Init containers are executed in order prior to containers being started. If any init container fails, the pod is considered to have failed and is handled according to its restartPolicy. The name for an init container or normal container must be unique among all containers. Init containers may not have Lifecycle actions, Readiness probes, or Liveness probes. The resourceRequirements of an init container are taken into account during scheduling by finding the highest request/limit for each resource type, and then using the max of of that value or the sum of the normal containers. Limits are applied to init containers in a similar fashion. Init containers cannot currently be added or removed. Cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.core.v1.Container" + }, + "x-kubernetes-patch-merge-key": "name", + "x-kubernetes-patch-strategy": "merge" + }, + "nodeName": { + "description": "NodeName is a request to schedule this pod onto a specific node. If it is non-empty, the scheduler simply schedules this pod onto that node, assuming that it fits resource requirements.", + "type": "string" + }, + "nodeSelector": { + "description": "NodeSelector is a selector which must be true for the pod to fit on a node. Selector which must match a node's labels for the pod to be scheduled on that node. More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "priority": { + "description": "The priority value. Various system components use this field to find the priority of the pod. When Priority Admission Controller is enabled, it prevents users from setting this field. The admission controller populates this field from PriorityClassName. The higher the value, the higher the priority.", + "type": "integer", + "format": "int32" + }, + "priorityClassName": { + "description": "If specified, indicates the pod's priority. \"SYSTEM\" is a special keyword which indicates the highest priority. Any other name must be defined by creating a PriorityClass object with that name. If not specified, the pod priority will be default or zero if there is no default.", + "type": "string" + }, + "restartPolicy": { + "description": "Restart policy for all containers within the pod. One of Always, OnFailure, Never. Default to Always. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy", + "type": "string" + }, + "schedulerName": { + "description": "If specified, the pod will be dispatched by specified scheduler. If not specified, the pod will be dispatched by default scheduler.", + "type": "string" + }, + "securityContext": { + "description": "SecurityContext holds pod-level security attributes and common container settings. Optional: Defaults to empty. See type description for default values of each field.", + "$ref": "#/definitions/io.k8s.api.core.v1.PodSecurityContext" + }, + "serviceAccount": { + "description": "DeprecatedServiceAccount is a depreciated alias for ServiceAccountName. Deprecated: Use serviceAccountName instead.", + "type": "string" + }, + "serviceAccountName": { + "description": "ServiceAccountName is the name of the ServiceAccount to use to run this pod. More info: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/", + "type": "string" + }, + "subdomain": { + "description": "If specified, the fully qualified Pod hostname will be \"\u003chostname\u003e.\u003csubdomain\u003e.\u003cpod namespace\u003e.svc.\u003ccluster domain\u003e\". If not specified, the pod will not have a domainname at all.", + "type": "string" + }, + "terminationGracePeriodSeconds": { + "description": "Optional duration in seconds the pod needs to terminate gracefully. May be decreased in delete request. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period will be used instead. The grace period is the duration in seconds after the processes running in the pod are sent a termination signal and the time when the processes are forcibly halted with a kill signal. Set this value longer than the expected cleanup time for your process. Defaults to 30 seconds.", + "type": "integer", + "format": "int64" + }, + "tolerations": { + "description": "If specified, the pod's tolerations.", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.core.v1.Toleration" + } + }, + "volumes": { + "description": "List of volumes that can be mounted by containers belonging to the pod. More info: https://kubernetes.io/docs/concepts/storage/volumes", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.core.v1.Volume" + }, + "x-kubernetes-patch-merge-key": "name", + "x-kubernetes-patch-strategy": "merge,retainKeys" + } + } + }, + "io.k8s.api.core.v1.PodStatus": { + "description": "PodStatus represents information about the status of a pod. Status may trail the actual state of a system.", + "type": "object", + "properties": { + "conditions": { + "description": "Current service state of pod. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-conditions", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.core.v1.PodCondition" + }, + "x-kubernetes-patch-merge-key": "type", + "x-kubernetes-patch-strategy": "merge" + }, + "containerStatuses": { + "description": "The list has one entry per container in the manifest. Each entry is currently the output of `docker inspect`. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-and-container-status", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.core.v1.ContainerStatus" + } + }, + "hostIP": { + "description": "IP address of the host to which the pod is assigned. Empty if not yet scheduled.", + "type": "string" + }, + "initContainerStatuses": { + "description": "The list has one entry per init container in the manifest. The most recent successful init container will have ready = true, the most recently started container will have startTime set. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-and-container-status", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.core.v1.ContainerStatus" + } + }, + "message": { + "description": "A human readable message indicating details about why the pod is in this condition.", + "type": "string" + }, + "phase": { + "description": "Current condition of the pod. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-phase", + "type": "string" + }, + "podIP": { + "description": "IP address allocated to the pod. Routable at least within the cluster. Empty if not yet allocated.", + "type": "string" + }, + "qosClass": { + "description": "The Quality of Service (QOS) classification assigned to the pod based on resource requirements See PodQOSClass type for available QOS classes More info: https://github.com/kubernetes/kubernetes/blob/master/docs/design/resource-qos.md", + "type": "string" + }, + "reason": { + "description": "A brief CamelCase message indicating details about why the pod is in this state. e.g. 'Evicted'", + "type": "string" + }, + "startTime": { + "description": "RFC 3339 date and time at which the object was acknowledged by the Kubelet. This is before the Kubelet pulled the container image(s) for the pod.", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.Time" + } + } + }, + "io.k8s.api.core.v1.PodTemplate": { + "description": "PodTemplate describes a template for creating copies of a predefined pod.", + "type": "object", + "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", + "type": "string" + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "description": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta" + }, + "template": { + "description": "Template defines the pods that will be created from this pod template. https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status", + "$ref": "#/definitions/io.k8s.api.core.v1.PodTemplateSpec" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "", + "kind": "PodTemplate", + "version": "v1" + } + ] + }, + "io.k8s.api.core.v1.PodTemplateList": { + "description": "PodTemplateList is a list of PodTemplates.", + "type": "object", + "required": [ + "items" + ], + "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", + "type": "string" + }, + "items": { + "description": "List of pod templates", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.core.v1.PodTemplate" + } + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "description": "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ListMeta" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "", + "kind": "PodTemplateList", + "version": "v1" + } + ] + }, + "io.k8s.api.core.v1.PodTemplateSpec": { + "description": "PodTemplateSpec describes the data a pod should have when created from a template", + "type": "object", + "properties": { + "metadata": { + "description": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta" + }, + "spec": { + "description": "Specification of the desired behavior of the pod. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status", + "$ref": "#/definitions/io.k8s.api.core.v1.PodSpec" + } + } + }, + "io.k8s.api.core.v1.PortworxVolumeSource": { + "description": "PortworxVolumeSource represents a Portworx volume resource.", + "type": "object", + "required": [ + "volumeID" + ], + "properties": { + "fsType": { + "description": "FSType represents the filesystem type to mount Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\". Implicitly inferred to be \"ext4\" if unspecified.", + "type": "string" + }, + "readOnly": { + "description": "Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.", + "type": "boolean" + }, + "volumeID": { + "description": "VolumeID uniquely identifies a Portworx volume", + "type": "string" + } + } + }, + "io.k8s.api.core.v1.PreferredSchedulingTerm": { + "description": "An empty preferred scheduling term matches all objects with implicit weight 0 (i.e. it's a no-op). A null preferred scheduling term matches no objects (i.e. is also a no-op).", + "type": "object", + "required": [ + "weight", + "preference" + ], + "properties": { + "preference": { + "description": "A node selector term, associated with the corresponding weight.", + "$ref": "#/definitions/io.k8s.api.core.v1.NodeSelectorTerm" + }, + "weight": { + "description": "Weight associated with matching the corresponding nodeSelectorTerm, in the range 1-100.", + "type": "integer", + "format": "int32" + } + } + }, + "io.k8s.api.core.v1.Probe": { + "description": "Probe describes a health check to be performed against a container to determine whether it is alive or ready to receive traffic.", + "type": "object", + "properties": { + "exec": { + "description": "One and only one of the following should be specified. Exec specifies the action to take.", + "$ref": "#/definitions/io.k8s.api.core.v1.ExecAction" + }, + "failureThreshold": { + "description": "Minimum consecutive failures for the probe to be considered failed after having succeeded. Defaults to 3. Minimum value is 1.", + "type": "integer", + "format": "int32" + }, + "httpGet": { + "description": "HTTPGet specifies the http request to perform.", + "$ref": "#/definitions/io.k8s.api.core.v1.HTTPGetAction" + }, + "initialDelaySeconds": { + "description": "Number of seconds after the container has started before liveness probes are initiated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes", + "type": "integer", + "format": "int32" + }, + "periodSeconds": { + "description": "How often (in seconds) to perform the probe. Default to 10 seconds. Minimum value is 1.", + "type": "integer", + "format": "int32" + }, + "successThreshold": { + "description": "Minimum consecutive successes for the probe to be considered successful after having failed. Defaults to 1. Must be 1 for liveness. Minimum value is 1.", + "type": "integer", + "format": "int32" + }, + "tcpSocket": { + "description": "TCPSocket specifies an action involving a TCP port. TCP hooks not yet supported", + "$ref": "#/definitions/io.k8s.api.core.v1.TCPSocketAction" + }, + "timeoutSeconds": { + "description": "Number of seconds after which the probe times out. Defaults to 1 second. Minimum value is 1. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes", + "type": "integer", + "format": "int32" + } + } + }, + "io.k8s.api.core.v1.ProjectedVolumeSource": { + "description": "Represents a projected volume source", + "type": "object", + "required": [ + "sources" + ], + "properties": { + "defaultMode": { + "description": "Mode bits to use on created files by default. Must be a value between 0 and 0777. Directories within the path are not affected by this setting. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.", + "type": "integer", + "format": "int32" + }, + "sources": { + "description": "list of volume projections", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.core.v1.VolumeProjection" + } + } + } + }, + "io.k8s.api.core.v1.QuobyteVolumeSource": { + "description": "Represents a Quobyte mount that lasts the lifetime of a pod. Quobyte volumes do not support ownership management or SELinux relabeling.", + "type": "object", + "required": [ + "registry", + "volume" + ], + "properties": { + "group": { + "description": "Group to map volume access to Default is no group", + "type": "string" + }, + "readOnly": { + "description": "ReadOnly here will force the Quobyte volume to be mounted with read-only permissions. Defaults to false.", + "type": "boolean" + }, + "registry": { + "description": "Registry represents a single or multiple Quobyte Registry services specified as a string as host:port pair (multiple entries are separated with commas) which acts as the central registry for volumes", + "type": "string" + }, + "user": { + "description": "User to map volume access to Defaults to serivceaccount user", + "type": "string" + }, + "volume": { + "description": "Volume is a string that references an already created Quobyte volume by name.", + "type": "string" + } + } + }, + "io.k8s.api.core.v1.RBDVolumeSource": { + "description": "Represents a Rados Block Device mount that lasts the lifetime of a pod. RBD volumes support ownership management and SELinux relabeling.", + "type": "object", + "required": [ + "monitors", + "image" + ], + "properties": { + "fsType": { + "description": "Filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#rbd", + "type": "string" + }, + "image": { + "description": "The rados image name. More info: https://releases.k8s.io/HEAD/examples/volumes/rbd/README.md#how-to-use-it", + "type": "string" + }, + "keyring": { + "description": "Keyring is the path to key ring for RBDUser. Default is /etc/ceph/keyring. More info: https://releases.k8s.io/HEAD/examples/volumes/rbd/README.md#how-to-use-it", + "type": "string" + }, + "monitors": { + "description": "A collection of Ceph monitors. More info: https://releases.k8s.io/HEAD/examples/volumes/rbd/README.md#how-to-use-it", + "type": "array", + "items": { + "type": "string" + } + }, + "pool": { + "description": "The rados pool name. Default is rbd. More info: https://releases.k8s.io/HEAD/examples/volumes/rbd/README.md#how-to-use-it", + "type": "string" + }, + "readOnly": { + "description": "ReadOnly here will force the ReadOnly setting in VolumeMounts. Defaults to false. More info: https://releases.k8s.io/HEAD/examples/volumes/rbd/README.md#how-to-use-it", + "type": "boolean" + }, + "secretRef": { + "description": "SecretRef is name of the authentication secret for RBDUser. If provided overrides keyring. Default is nil. More info: https://releases.k8s.io/HEAD/examples/volumes/rbd/README.md#how-to-use-it", + "$ref": "#/definitions/io.k8s.api.core.v1.LocalObjectReference" + }, + "user": { + "description": "The rados user name. Default is admin. More info: https://releases.k8s.io/HEAD/examples/volumes/rbd/README.md#how-to-use-it", + "type": "string" + } + } + }, + "io.k8s.api.core.v1.ReplicationController": { + "description": "ReplicationController represents the configuration of a replication controller.", + "type": "object", + "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", + "type": "string" + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "description": "If the Labels of a ReplicationController are empty, they are defaulted to be the same as the Pod(s) that the replication controller manages. Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta" + }, + "spec": { + "description": "Spec defines the specification of the desired behavior of the replication controller. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status", + "$ref": "#/definitions/io.k8s.api.core.v1.ReplicationControllerSpec" + }, + "status": { + "description": "Status is the most recently observed status of the replication controller. This data may be out of date by some window of time. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status", + "$ref": "#/definitions/io.k8s.api.core.v1.ReplicationControllerStatus" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "", + "kind": "ReplicationController", + "version": "v1" + } + ] + }, + "io.k8s.api.core.v1.ReplicationControllerCondition": { + "description": "ReplicationControllerCondition describes the state of a replication controller at a certain point.", + "type": "object", + "required": [ + "type", + "status" + ], + "properties": { + "lastTransitionTime": { + "description": "The last time the condition transitioned from one status to another.", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.Time" + }, + "message": { + "description": "A human readable message indicating details about the transition.", + "type": "string" + }, + "reason": { + "description": "The reason for the condition's last transition.", + "type": "string" + }, + "status": { + "description": "Status of the condition, one of True, False, Unknown.", + "type": "string" + }, + "type": { + "description": "Type of replication controller condition.", + "type": "string" + } + } + }, + "io.k8s.api.core.v1.ReplicationControllerList": { + "description": "ReplicationControllerList is a collection of replication controllers.", + "type": "object", + "required": [ + "items" + ], + "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", + "type": "string" + }, + "items": { + "description": "List of replication controllers. More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.core.v1.ReplicationController" + } + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "description": "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ListMeta" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "", + "kind": "ReplicationControllerList", + "version": "v1" + } + ] + }, + "io.k8s.api.core.v1.ReplicationControllerSpec": { + "description": "ReplicationControllerSpec is the specification of a replication controller.", + "type": "object", + "properties": { + "minReadySeconds": { + "description": "Minimum number of seconds for which a newly created pod should be ready without any of its container crashing, for it to be considered available. Defaults to 0 (pod will be considered available as soon as it is ready)", + "type": "integer", + "format": "int32" + }, + "replicas": { + "description": "Replicas is the number of desired replicas. This is a pointer to distinguish between explicit zero and unspecified. Defaults to 1. More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#what-is-a-replicationcontroller", + "type": "integer", + "format": "int32" + }, + "selector": { + "description": "Selector is a label query over pods that should match the Replicas count. If Selector is empty, it is defaulted to the labels present on the Pod template. Label keys and values that must match in order to be controlled by this replication controller, if empty defaulted to labels on Pod template. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "template": { + "description": "Template is the object that describes the pod that will be created if insufficient replicas are detected. This takes precedence over a TemplateRef. More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#pod-template", + "$ref": "#/definitions/io.k8s.api.core.v1.PodTemplateSpec" + } + } + }, + "io.k8s.api.core.v1.ReplicationControllerStatus": { + "description": "ReplicationControllerStatus represents the current status of a replication controller.", + "type": "object", + "required": [ + "replicas" + ], + "properties": { + "availableReplicas": { + "description": "The number of available replicas (ready for at least minReadySeconds) for this replication controller.", + "type": "integer", + "format": "int32" + }, + "conditions": { + "description": "Represents the latest available observations of a replication controller's current state.", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.core.v1.ReplicationControllerCondition" + }, + "x-kubernetes-patch-merge-key": "type", + "x-kubernetes-patch-strategy": "merge" + }, + "fullyLabeledReplicas": { + "description": "The number of pods that have labels matching the labels of the pod template of the replication controller.", + "type": "integer", + "format": "int32" + }, + "observedGeneration": { + "description": "ObservedGeneration reflects the generation of the most recently observed replication controller.", + "type": "integer", + "format": "int64" + }, + "readyReplicas": { + "description": "The number of ready replicas for this replication controller.", + "type": "integer", + "format": "int32" + }, + "replicas": { + "description": "Replicas is the most recently oberved number of replicas. More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#what-is-a-replicationcontroller", + "type": "integer", + "format": "int32" + } + } + }, + "io.k8s.api.core.v1.ResourceFieldSelector": { + "description": "ResourceFieldSelector represents container resources (cpu, memory) and their output format", + "type": "object", + "required": [ + "resource" + ], + "properties": { + "containerName": { + "description": "Container name: required for volumes, optional for env vars", + "type": "string" + }, + "divisor": { + "description": "Specifies the output format of the exposed resources, defaults to \"1\"", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.api.resource.Quantity" + }, + "resource": { + "description": "Required: resource to select", + "type": "string" + } + } + }, + "io.k8s.api.core.v1.ResourceQuota": { + "description": "ResourceQuota sets aggregate quota restrictions enforced per namespace", + "type": "object", + "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", + "type": "string" + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "description": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta" + }, + "spec": { + "description": "Spec defines the desired quota. https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status", + "$ref": "#/definitions/io.k8s.api.core.v1.ResourceQuotaSpec" + }, + "status": { + "description": "Status defines the actual enforced quota and its current usage. https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status", + "$ref": "#/definitions/io.k8s.api.core.v1.ResourceQuotaStatus" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "", + "kind": "ResourceQuota", + "version": "v1" + } + ] + }, + "io.k8s.api.core.v1.ResourceQuotaList": { + "description": "ResourceQuotaList is a list of ResourceQuota items.", + "type": "object", + "required": [ + "items" + ], + "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", + "type": "string" + }, + "items": { + "description": "Items is a list of ResourceQuota objects. More info: https://git.k8s.io/community/contributors/design-proposals/admission_control_resource_quota.md", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.core.v1.ResourceQuota" + } + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "description": "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ListMeta" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "", + "kind": "ResourceQuotaList", + "version": "v1" + } + ] + }, + "io.k8s.api.core.v1.ResourceQuotaSpec": { + "description": "ResourceQuotaSpec defines the desired hard limits to enforce for Quota.", + "type": "object", + "properties": { + "hard": { + "description": "Hard is the set of desired hard limits for each named resource. More info: https://git.k8s.io/community/contributors/design-proposals/admission_control_resource_quota.md", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/io.k8s.apimachinery.pkg.api.resource.Quantity" + } + }, + "scopes": { + "description": "A collection of filters that must match each object tracked by a quota. If not specified, the quota matches all objects.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "io.k8s.api.core.v1.ResourceQuotaStatus": { + "description": "ResourceQuotaStatus defines the enforced hard limits and observed use.", + "type": "object", + "properties": { + "hard": { + "description": "Hard is the set of enforced hard limits for each named resource. More info: https://git.k8s.io/community/contributors/design-proposals/admission_control_resource_quota.md", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/io.k8s.apimachinery.pkg.api.resource.Quantity" + } + }, + "used": { + "description": "Used is the current observed total usage of the resource in the namespace.", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/io.k8s.apimachinery.pkg.api.resource.Quantity" + } + } + } + }, + "io.k8s.api.core.v1.ResourceRequirements": { + "description": "ResourceRequirements describes the compute resource requirements.", + "type": "object", + "properties": { + "limits": { + "description": "Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/io.k8s.apimachinery.pkg.api.resource.Quantity" + } + }, + "requests": { + "description": "Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/io.k8s.apimachinery.pkg.api.resource.Quantity" + } + } + } + }, + "io.k8s.api.core.v1.SELinuxOptions": { + "description": "SELinuxOptions are the labels to be applied to the container", + "type": "object", + "properties": { + "level": { + "description": "Level is SELinux level label that applies to the container.", + "type": "string" + }, + "role": { + "description": "Role is a SELinux role label that applies to the container.", + "type": "string" + }, + "type": { + "description": "Type is a SELinux type label that applies to the container.", + "type": "string" + }, + "user": { + "description": "User is a SELinux user label that applies to the container.", + "type": "string" + } + } + }, + "io.k8s.api.core.v1.ScaleIOVolumeSource": { + "description": "ScaleIOVolumeSource represents a persistent ScaleIO volume", + "type": "object", + "required": [ + "gateway", + "system", + "secretRef" + ], + "properties": { + "fsType": { + "description": "Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified.", + "type": "string" + }, + "gateway": { + "description": "The host address of the ScaleIO API Gateway.", + "type": "string" + }, + "protectionDomain": { + "description": "The name of the Protection Domain for the configured storage (defaults to \"default\").", + "type": "string" + }, + "readOnly": { + "description": "Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.", + "type": "boolean" + }, + "secretRef": { + "description": "SecretRef references to the secret for ScaleIO user and other sensitive information. If this is not provided, Login operation will fail.", + "$ref": "#/definitions/io.k8s.api.core.v1.LocalObjectReference" + }, + "sslEnabled": { + "description": "Flag to enable/disable SSL communication with Gateway, default false", + "type": "boolean" + }, + "storageMode": { + "description": "Indicates whether the storage for a volume should be thick or thin (defaults to \"thin\").", + "type": "string" + }, + "storagePool": { + "description": "The Storage Pool associated with the protection domain (defaults to \"default\").", + "type": "string" + }, + "system": { + "description": "The name of the storage system as configured in ScaleIO.", + "type": "string" + }, + "volumeName": { + "description": "The name of a volume already created in the ScaleIO system that is associated with this volume source.", + "type": "string" + } + } + }, + "io.k8s.api.core.v1.Secret": { + "description": "Secret holds secret data of a certain type. The total bytes of the values in the Data field must be less than MaxSecretSize bytes.", + "type": "object", + "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", + "type": "string" + }, + "data": { + "description": "Data contains the secret data. Each key must consist of alphanumeric characters, '-', '_' or '.'. The serialized form of the secret data is a base64 encoded string, representing the arbitrary (possibly non-string) data value here. Described in https://tools.ietf.org/html/rfc4648#section-4", + "type": "object", + "additionalProperties": { + "type": "string", + "format": "byte" + } + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "description": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta" + }, + "stringData": { + "description": "stringData allows specifying non-binary secret data in string form. It is provided as a write-only convenience method. All keys and values are merged into the data field on write, overwriting any existing values. It is never output when reading from the API.", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "type": { + "description": "Used to facilitate programmatic handling of secret data.", + "type": "string" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "", + "kind": "Secret", + "version": "v1" + } + ] + }, + "io.k8s.api.core.v1.SecretEnvSource": { + "description": "SecretEnvSource selects a Secret to populate the environment variables with.\n\nThe contents of the target Secret's Data field will represent the key-value pairs as environment variables.", + "type": "object", + "properties": { + "name": { + "description": "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", + "type": "string" + }, + "optional": { + "description": "Specify whether the Secret must be defined", + "type": "boolean" + } + } + }, + "io.k8s.api.core.v1.SecretKeySelector": { + "description": "SecretKeySelector selects a key of a Secret.", + "type": "object", + "required": [ + "key" + ], + "properties": { + "key": { + "description": "The key of the secret to select from. Must be a valid secret key.", + "type": "string" + }, + "name": { + "description": "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", + "type": "string" + }, + "optional": { + "description": "Specify whether the Secret or it's key must be defined", + "type": "boolean" + } + } + }, + "io.k8s.api.core.v1.SecretList": { + "description": "SecretList is a list of Secret.", + "type": "object", + "required": [ + "items" + ], + "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", + "type": "string" + }, + "items": { + "description": "Items is a list of secret objects. More info: https://kubernetes.io/docs/concepts/configuration/secret", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.core.v1.Secret" + } + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "description": "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ListMeta" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "", + "kind": "SecretList", + "version": "v1" + } + ] + }, + "io.k8s.api.core.v1.SecretProjection": { + "description": "Adapts a secret into a projected volume.\n\nThe contents of the target Secret's Data field will be presented in a projected volume as files using the keys in the Data field as the file names. Note that this is identical to a secret volume source without the default mode.", + "type": "object", + "properties": { + "items": { + "description": "If unspecified, each key-value pair in the Data field of the referenced Secret will be projected into the volume as a file whose name is the key and content is the value. If specified, the listed keys will be projected into the specified paths, and unlisted keys will not be present. If a key is specified which is not present in the Secret, the volume setup will error unless it is marked optional. Paths must be relative and may not contain the '..' path or start with '..'.", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.core.v1.KeyToPath" + } + }, + "name": { + "description": "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", + "type": "string" + }, + "optional": { + "description": "Specify whether the Secret or its key must be defined", + "type": "boolean" + } + } + }, + "io.k8s.api.core.v1.SecretReference": { + "description": "SecretReference represents a Secret Reference. It has enough information to retrieve secret in any namespace", + "type": "object", + "properties": { + "name": { + "description": "Name is unique within a namespace to reference a secret resource.", + "type": "string" + }, + "namespace": { + "description": "Namespace defines the space within which the secret name must be unique.", + "type": "string" + } + } + }, + "io.k8s.api.core.v1.SecretVolumeSource": { + "description": "Adapts a Secret into a volume.\n\nThe contents of the target Secret's Data field will be presented in a volume as files using the keys in the Data field as the file names. Secret volumes support ownership management and SELinux relabeling.", + "type": "object", + "properties": { + "defaultMode": { + "description": "Optional: mode bits to use on created files by default. Must be a value between 0 and 0777. Defaults to 0644. Directories within the path are not affected by this setting. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.", + "type": "integer", + "format": "int32" + }, + "items": { + "description": "If unspecified, each key-value pair in the Data field of the referenced Secret will be projected into the volume as a file whose name is the key and content is the value. If specified, the listed keys will be projected into the specified paths, and unlisted keys will not be present. If a key is specified which is not present in the Secret, the volume setup will error unless it is marked optional. Paths must be relative and may not contain the '..' path or start with '..'.", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.core.v1.KeyToPath" + } + }, + "optional": { + "description": "Specify whether the Secret or it's keys must be defined", + "type": "boolean" + }, + "secretName": { + "description": "Name of the secret in the pod's namespace to use. More info: https://kubernetes.io/docs/concepts/storage/volumes#secret", + "type": "string" + } + } + }, + "io.k8s.api.core.v1.SecurityContext": { + "description": "SecurityContext holds security configuration that will be applied to a container. Some fields are present in both SecurityContext and PodSecurityContext. When both are set, the values in SecurityContext take precedence.", + "type": "object", + "properties": { + "allowPrivilegeEscalation": { + "description": "AllowPrivilegeEscalation controls whether a process can gain more privileges than it's parent process. This bool directly controls if the no_new_privs flag will be set on the container process. AllowPrivilegeEscalation is true always when the container is: 1) run as Privileged 2) has CAP_SYS_ADMIN", + "type": "boolean" + }, + "capabilities": { + "description": "The capabilities to add/drop when running containers. Defaults to the default set of capabilities granted by the container runtime.", + "$ref": "#/definitions/io.k8s.api.core.v1.Capabilities" + }, + "privileged": { + "description": "Run container in privileged mode. Processes in privileged containers are essentially equivalent to root on the host. Defaults to false.", + "type": "boolean" + }, + "readOnlyRootFilesystem": { + "description": "Whether this container has a read-only root filesystem. Default is false.", + "type": "boolean" + }, + "runAsNonRoot": { + "description": "Indicates that the container must run as a non-root user. If true, the Kubelet will validate the image at runtime to ensure that it does not run as UID 0 (root) and fail to start the container if it does. If unset or false, no such validation will be performed. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence.", + "type": "boolean" + }, + "runAsUser": { + "description": "The UID to run the entrypoint of the container process. Defaults to user specified in image metadata if unspecified. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence.", + "type": "integer", + "format": "int64" + }, + "seLinuxOptions": { + "description": "The SELinux context to be applied to the container. If unspecified, the container runtime will allocate a random SELinux context for each container. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence.", + "$ref": "#/definitions/io.k8s.api.core.v1.SELinuxOptions" + } + } + }, + "io.k8s.api.core.v1.Service": { + "description": "Service is a named abstraction of software service (for example, mysql) consisting of local port (for example 3306) that the proxy listens on, and the selector that determines which pods will answer requests sent through the proxy.", + "type": "object", + "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", + "type": "string" + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "description": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta" + }, + "spec": { + "description": "Spec defines the behavior of a service. https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status", + "$ref": "#/definitions/io.k8s.api.core.v1.ServiceSpec" + }, + "status": { + "description": "Most recently observed status of the service. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status", + "$ref": "#/definitions/io.k8s.api.core.v1.ServiceStatus" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "", + "kind": "Service", + "version": "v1" + } + ] + }, + "io.k8s.api.core.v1.ServiceAccount": { + "description": "ServiceAccount binds together: * a name, understood by users, and perhaps by peripheral systems, for an identity * a principal that can be authenticated and authorized * a set of secrets", + "type": "object", + "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", + "type": "string" + }, + "automountServiceAccountToken": { + "description": "AutomountServiceAccountToken indicates whether pods running as this service account should have an API token automatically mounted. Can be overridden at the pod level.", + "type": "boolean" + }, + "imagePullSecrets": { + "description": "ImagePullSecrets is a list of references to secrets in the same namespace to use for pulling any images in pods that reference this ServiceAccount. ImagePullSecrets are distinct from Secrets because Secrets can be mounted in the pod, but ImagePullSecrets are only accessed by the kubelet. More info: https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.core.v1.LocalObjectReference" + } + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "description": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta" + }, + "secrets": { + "description": "Secrets is the list of secrets allowed to be used by pods running using this ServiceAccount. More info: https://kubernetes.io/docs/concepts/configuration/secret", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.core.v1.ObjectReference" + }, + "x-kubernetes-patch-merge-key": "name", + "x-kubernetes-patch-strategy": "merge" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "", + "kind": "ServiceAccount", + "version": "v1" + } + ] + }, + "io.k8s.api.core.v1.ServiceAccountList": { + "description": "ServiceAccountList is a list of ServiceAccount objects", + "type": "object", + "required": [ + "items" + ], + "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", + "type": "string" + }, + "items": { + "description": "List of ServiceAccounts. More info: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.core.v1.ServiceAccount" + } + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "description": "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ListMeta" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "", + "kind": "ServiceAccountList", + "version": "v1" + } + ] + }, + "io.k8s.api.core.v1.ServiceList": { + "description": "ServiceList holds a list of services.", + "type": "object", + "required": [ + "items" + ], + "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", + "type": "string" + }, + "items": { + "description": "List of services", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.core.v1.Service" + } + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "description": "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ListMeta" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "", + "kind": "ServiceList", + "version": "v1" + } + ] + }, + "io.k8s.api.core.v1.ServicePort": { + "description": "ServicePort contains information on service's port.", + "type": "object", + "required": [ + "port" + ], + "properties": { + "name": { + "description": "The name of this port within the service. This must be a DNS_LABEL. All ports within a ServiceSpec must have unique names. This maps to the 'Name' field in EndpointPort objects. Optional if only one ServicePort is defined on this service.", + "type": "string" + }, + "nodePort": { + "description": "The port on each node on which this service is exposed when type=NodePort or LoadBalancer. Usually assigned by the system. If specified, it will be allocated to the service if unused or else creation of the service will fail. Default is to auto-allocate a port if the ServiceType of this Service requires one. More info: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport", + "type": "integer", + "format": "int32" + }, + "port": { + "description": "The port that will be exposed by this service.", + "type": "integer", + "format": "int32" + }, + "protocol": { + "description": "The IP protocol for this port. Supports \"TCP\" and \"UDP\". Default is TCP.", + "type": "string" + }, + "targetPort": { + "description": "Number or name of the port to access on the pods targeted by the service. Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. If this is a string, it will be looked up as a named port in the target Pod's container ports. If this is not specified, the value of the 'port' field is used (an identity map). This field is ignored for services with clusterIP=None, and should be omitted or set equal to the 'port' field. More info: https://kubernetes.io/docs/concepts/services-networking/service/#defining-a-service", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.util.intstr.IntOrString" + } + } + }, + "io.k8s.api.core.v1.ServiceSpec": { + "description": "ServiceSpec describes the attributes that a user creates on a service.", + "type": "object", + "properties": { + "clusterIP": { + "description": "clusterIP is the IP address of the service and is usually assigned randomly by the master. If an address is specified manually and is not in use by others, it will be allocated to the service; otherwise, creation of the service will fail. This field can not be changed through updates. Valid values are \"None\", empty string (\"\"), or a valid IP address. \"None\" can be specified for headless services when proxying is not required. Only applies to types ClusterIP, NodePort, and LoadBalancer. Ignored if type is ExternalName. More info: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies", + "type": "string" + }, + "externalIPs": { + "description": "externalIPs is a list of IP addresses for which nodes in the cluster will also accept traffic for this service. These IPs are not managed by Kubernetes. The user is responsible for ensuring that traffic arrives at a node with this IP. A common example is external load-balancers that are not part of the Kubernetes system.", + "type": "array", + "items": { + "type": "string" + } + }, + "externalName": { + "description": "externalName is the external reference that kubedns or equivalent will return as a CNAME record for this service. No proxying will be involved. Must be a valid DNS name and requires Type to be ExternalName.", + "type": "string" + }, + "externalTrafficPolicy": { + "description": "externalTrafficPolicy denotes if this Service desires to route external traffic to node-local or cluster-wide endpoints. \"Local\" preserves the client source IP and avoids a second hop for LoadBalancer and Nodeport type services, but risks potentially imbalanced traffic spreading. \"Cluster\" obscures the client source IP and may cause a second hop to another node, but should have good overall load-spreading.", + "type": "string" + }, + "healthCheckNodePort": { + "description": "healthCheckNodePort specifies the healthcheck nodePort for the service. If not specified, HealthCheckNodePort is created by the service api backend with the allocated nodePort. Will use user-specified nodePort value if specified by the client. Only effects when Type is set to LoadBalancer and ExternalTrafficPolicy is set to Local.", + "type": "integer", + "format": "int32" + }, + "loadBalancerIP": { + "description": "Only applies to Service Type: LoadBalancer LoadBalancer will get created with the IP specified in this field. This feature depends on whether the underlying cloud-provider supports specifying the loadBalancerIP when a load balancer is created. This field will be ignored if the cloud-provider does not support the feature.", + "type": "string" + }, + "loadBalancerSourceRanges": { + "description": "If specified and supported by the platform, this will restrict traffic through the cloud-provider load-balancer will be restricted to the specified client IPs. This field will be ignored if the cloud-provider does not support the feature.\" More info: https://kubernetes.io/docs/tasks/access-application-cluster/configure-cloud-provider-firewall/", + "type": "array", + "items": { + "type": "string" + } + }, + "ports": { + "description": "The list of ports that are exposed by this service. More info: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.api.core.v1.ServicePort" + }, + "x-kubernetes-patch-merge-key": "port", + "x-kubernetes-patch-strategy": "merge" + }, + "publishNotReadyAddresses": { + "description": "publishNotReadyAddresses, when set to true, indicates that DNS implementations must publish the notReadyAddresses of subsets for the Endpoints associated with the Service. The default value is false. The primary use case for setting this field is to use a StatefulSet's Headless Service to propagate SRV records for its Pods without respect to their readiness for purpose of peer discovery. This field will replace the service.alpha.kubernetes.io/tolerate-unready-endpoints when that annotation is deprecated and all clients have been converted to use this field.", + "type": "boolean" + }, + "selector": { + "description": "Route service traffic to pods with label keys and values matching this selector. If empty or not present, the service is assumed to have an external process managing its endpoints, which Kubernetes will not modify. Only applies to types ClusterIP, NodePort, and LoadBalancer. Ignored if type is ExternalName. More info: https://kubernetes.io/docs/concepts/services-networking/service/", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "sessionAffinity": { + "description": "Supports \"ClientIP\" and \"None\". Used to maintain session affinity. Enable client IP based session affinity. Must be ClientIP or None. Defaults to None. More info: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies", + "type": "string" + }, + "sessionAffinityConfig": { + "description": "sessionAffinityConfig contains the configurations of session affinity.", + "$ref": "#/definitions/io.k8s.api.core.v1.SessionAffinityConfig" + }, + "type": { + "description": "type determines how the Service is exposed. Defaults to ClusterIP. Valid options are ExternalName, ClusterIP, NodePort, and LoadBalancer. \"ExternalName\" maps to the specified externalName. \"ClusterIP\" allocates a cluster-internal IP address for load-balancing to endpoints. Endpoints are determined by the selector or if that is not specified, by manual construction of an Endpoints object. If clusterIP is \"None\", no virtual IP is allocated and the endpoints are published as a set of endpoints rather than a stable IP. \"NodePort\" builds on ClusterIP and allocates a port on every node which routes to the clusterIP. \"LoadBalancer\" builds on NodePort and creates an external load-balancer (if supported in the current cloud) which routes to the clusterIP. More info: https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services---service-types", + "type": "string" + } + } + }, + "io.k8s.api.core.v1.ServiceStatus": { + "description": "ServiceStatus represents the current status of a service.", + "type": "object", + "properties": { + "loadBalancer": { + "description": "LoadBalancer contains the current status of the load-balancer, if one is present.", + "$ref": "#/definitions/io.k8s.api.core.v1.LoadBalancerStatus" + } + } + }, + "io.k8s.api.core.v1.SessionAffinityConfig": { + "description": "SessionAffinityConfig represents the configurations of session affinity.", + "type": "object", + "properties": { + "clientIP": { + "description": "clientIP contains the configurations of Client IP based session affinity.", + "$ref": "#/definitions/io.k8s.api.core.v1.ClientIPConfig" + } + } + }, + "io.k8s.api.core.v1.StorageOSPersistentVolumeSource": { + "description": "Represents a StorageOS persistent volume resource.", + "type": "object", + "properties": { + "fsType": { + "description": "Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified.", + "type": "string" + }, + "readOnly": { + "description": "Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.", + "type": "boolean" + }, + "secretRef": { + "description": "SecretRef specifies the secret to use for obtaining the StorageOS API credentials. If not specified, default values will be attempted.", + "$ref": "#/definitions/io.k8s.api.core.v1.ObjectReference" + }, + "volumeName": { + "description": "VolumeName is the human-readable name of the StorageOS volume. Volume names are only unique within a namespace.", + "type": "string" + }, + "volumeNamespace": { + "description": "VolumeNamespace specifies the scope of the volume within StorageOS. If no namespace is specified then the Pod's namespace will be used. This allows the Kubernetes name scoping to be mirrored within StorageOS for tighter integration. Set VolumeName to any name to override the default behaviour. Set to \"default\" if you are not using namespaces within StorageOS. Namespaces that do not pre-exist within StorageOS will be created.", + "type": "string" + } + } + }, + "io.k8s.api.core.v1.StorageOSVolumeSource": { + "description": "Represents a StorageOS persistent volume resource.", + "type": "object", + "properties": { + "fsType": { + "description": "Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified.", + "type": "string" + }, + "readOnly": { + "description": "Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.", + "type": "boolean" + }, + "secretRef": { + "description": "SecretRef specifies the secret to use for obtaining the StorageOS API credentials. If not specified, default values will be attempted.", + "$ref": "#/definitions/io.k8s.api.core.v1.LocalObjectReference" + }, + "volumeName": { + "description": "VolumeName is the human-readable name of the StorageOS volume. Volume names are only unique within a namespace.", + "type": "string" + }, + "volumeNamespace": { + "description": "VolumeNamespace specifies the scope of the volume within StorageOS. If no namespace is specified then the Pod's namespace will be used. This allows the Kubernetes name scoping to be mirrored within StorageOS for tighter integration. Set VolumeName to any name to override the default behaviour. Set to \"default\" if you are not using namespaces within StorageOS. Namespaces that do not pre-exist within StorageOS will be created.", + "type": "string" + } + } + }, + "io.k8s.api.core.v1.TCPSocketAction": { + "description": "TCPSocketAction describes an action based on opening a socket", + "type": "object", + "required": [ + "port" + ], + "properties": { + "host": { + "description": "Optional: Host name to connect to, defaults to the pod IP.", + "type": "string" + }, + "port": { + "description": "Number or name of the port to access on the container. Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME.", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.util.intstr.IntOrString" + } + } + }, + "io.k8s.api.core.v1.Taint": { + "description": "The node this Taint is attached to has the \"effect\" on any pod that does not tolerate the Taint.", + "type": "object", + "required": [ + "key", + "effect" + ], + "properties": { + "effect": { + "description": "Required. The effect of the taint on pods that do not tolerate the taint. Valid effects are NoSchedule, PreferNoSchedule and NoExecute.", + "type": "string" + }, + "key": { + "description": "Required. The taint key to be applied to a node.", + "type": "string" + }, + "timeAdded": { + "description": "TimeAdded represents the time at which the taint was added. It is only written for NoExecute taints.", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.Time" + }, + "value": { + "description": "Required. The taint value corresponding to the taint key.", + "type": "string" + } + } + }, + "io.k8s.api.core.v1.Toleration": { + "description": "The pod this Toleration is attached to tolerates any taint that matches the triple \u003ckey,value,effect\u003e using the matching operator \u003coperator\u003e.", + "type": "object", + "properties": { + "effect": { + "description": "Effect indicates the taint effect to match. Empty means match all taint effects. When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute.", + "type": "string" + }, + "key": { + "description": "Key is the taint key that the toleration applies to. Empty means match all taint keys. If the key is empty, operator must be Exists; this combination means to match all values and all keys.", + "type": "string" + }, + "operator": { + "description": "Operator represents a key's relationship to the value. Valid operators are Exists and Equal. Defaults to Equal. Exists is equivalent to wildcard for value, so that a pod can tolerate all taints of a particular category.", + "type": "string" + }, + "tolerationSeconds": { + "description": "TolerationSeconds represents the period of time the toleration (which must be of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default, it is not set, which means tolerate the taint forever (do not evict). Zero and negative values will be treated as 0 (evict immediately) by the system.", + "type": "integer", + "format": "int64" + }, + "value": { + "description": "Value is the taint value the toleration matches to. If the operator is Exists, the value should be empty, otherwise just a regular string.", + "type": "string" + } + } + }, + "io.k8s.api.core.v1.Volume": { + "description": "Volume represents a named volume in a pod that may be accessed by any container in the pod.", + "type": "object", + "required": [ + "name" + ], + "properties": { + "awsElasticBlockStore": { + "description": "AWSElasticBlockStore represents an AWS Disk resource that is attached to a kubelet's host machine and then exposed to the pod. More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore", + "$ref": "#/definitions/io.k8s.api.core.v1.AWSElasticBlockStoreVolumeSource" + }, + "azureDisk": { + "description": "AzureDisk represents an Azure Data Disk mount on the host and bind mount to the pod.", + "$ref": "#/definitions/io.k8s.api.core.v1.AzureDiskVolumeSource" + }, + "azureFile": { + "description": "AzureFile represents an Azure File Service mount on the host and bind mount to the pod.", + "$ref": "#/definitions/io.k8s.api.core.v1.AzureFileVolumeSource" + }, + "cephfs": { + "description": "CephFS represents a Ceph FS mount on the host that shares a pod's lifetime", + "$ref": "#/definitions/io.k8s.api.core.v1.CephFSVolumeSource" + }, + "cinder": { + "description": "Cinder represents a cinder volume attached and mounted on kubelets host machine More info: https://releases.k8s.io/HEAD/examples/mysql-cinder-pd/README.md", + "$ref": "#/definitions/io.k8s.api.core.v1.CinderVolumeSource" + }, + "configMap": { + "description": "ConfigMap represents a configMap that should populate this volume", + "$ref": "#/definitions/io.k8s.api.core.v1.ConfigMapVolumeSource" + }, + "downwardAPI": { + "description": "DownwardAPI represents downward API about the pod that should populate this volume", + "$ref": "#/definitions/io.k8s.api.core.v1.DownwardAPIVolumeSource" + }, + "emptyDir": { + "description": "EmptyDir represents a temporary directory that shares a pod's lifetime. More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir", + "$ref": "#/definitions/io.k8s.api.core.v1.EmptyDirVolumeSource" + }, + "fc": { + "description": "FC represents a Fibre Channel resource that is attached to a kubelet's host machine and then exposed to the pod.", + "$ref": "#/definitions/io.k8s.api.core.v1.FCVolumeSource" + }, + "flexVolume": { + "description": "FlexVolume represents a generic volume resource that is provisioned/attached using an exec based plugin. This is an alpha feature and may change in future.", + "$ref": "#/definitions/io.k8s.api.core.v1.FlexVolumeSource" + }, + "flocker": { + "description": "Flocker represents a Flocker volume attached to a kubelet's host machine. This depends on the Flocker control service being running", + "$ref": "#/definitions/io.k8s.api.core.v1.FlockerVolumeSource" + }, + "gcePersistentDisk": { + "description": "GCEPersistentDisk represents a GCE Disk resource that is attached to a kubelet's host machine and then exposed to the pod. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk", + "$ref": "#/definitions/io.k8s.api.core.v1.GCEPersistentDiskVolumeSource" + }, + "gitRepo": { + "description": "GitRepo represents a git repository at a particular revision.", + "$ref": "#/definitions/io.k8s.api.core.v1.GitRepoVolumeSource" + }, + "glusterfs": { + "description": "Glusterfs represents a Glusterfs mount on the host that shares a pod's lifetime. More info: https://releases.k8s.io/HEAD/examples/volumes/glusterfs/README.md", + "$ref": "#/definitions/io.k8s.api.core.v1.GlusterfsVolumeSource" + }, + "hostPath": { + "description": "HostPath represents a pre-existing file or directory on the host machine that is directly exposed to the container. This is generally used for system agents or other privileged things that are allowed to see the host machine. Most containers will NOT need this. More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath", + "$ref": "#/definitions/io.k8s.api.core.v1.HostPathVolumeSource" + }, + "iscsi": { + "description": "ISCSI represents an ISCSI Disk resource that is attached to a kubelet's host machine and then exposed to the pod. More info: https://releases.k8s.io/HEAD/examples/volumes/iscsi/README.md", + "$ref": "#/definitions/io.k8s.api.core.v1.ISCSIVolumeSource" + }, + "name": { + "description": "Volume's name. Must be a DNS_LABEL and unique within the pod. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", + "type": "string" + }, + "nfs": { + "description": "NFS represents an NFS mount on the host that shares a pod's lifetime More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs", + "$ref": "#/definitions/io.k8s.api.core.v1.NFSVolumeSource" + }, + "persistentVolumeClaim": { + "description": "PersistentVolumeClaimVolumeSource represents a reference to a PersistentVolumeClaim in the same namespace. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims", + "$ref": "#/definitions/io.k8s.api.core.v1.PersistentVolumeClaimVolumeSource" + }, + "photonPersistentDisk": { + "description": "PhotonPersistentDisk represents a PhotonController persistent disk attached and mounted on kubelets host machine", + "$ref": "#/definitions/io.k8s.api.core.v1.PhotonPersistentDiskVolumeSource" + }, + "portworxVolume": { + "description": "PortworxVolume represents a portworx volume attached and mounted on kubelets host machine", + "$ref": "#/definitions/io.k8s.api.core.v1.PortworxVolumeSource" + }, + "projected": { + "description": "Items for all in one resources secrets, configmaps, and downward API", + "$ref": "#/definitions/io.k8s.api.core.v1.ProjectedVolumeSource" + }, + "quobyte": { + "description": "Quobyte represents a Quobyte mount on the host that shares a pod's lifetime", + "$ref": "#/definitions/io.k8s.api.core.v1.QuobyteVolumeSource" + }, + "rbd": { + "description": "RBD represents a Rados Block Device mount on the host that shares a pod's lifetime. More info: https://releases.k8s.io/HEAD/examples/volumes/rbd/README.md", + "$ref": "#/definitions/io.k8s.api.core.v1.RBDVolumeSource" + }, + "scaleIO": { + "description": "ScaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes.", + "$ref": "#/definitions/io.k8s.api.core.v1.ScaleIOVolumeSource" + }, + "secret": { + "description": "Secret represents a secret that should populate this volume. More info: https://kubernetes.io/docs/concepts/storage/volumes#secret", + "$ref": "#/definitions/io.k8s.api.core.v1.SecretVolumeSource" + }, + "storageos": { + "description": "StorageOS represents a StorageOS volume attached and mounted on Kubernetes nodes.", + "$ref": "#/definitions/io.k8s.api.core.v1.StorageOSVolumeSource" + }, + "vsphereVolume": { + "description": "VsphereVolume represents a vSphere volume attached and mounted on kubelets host machine", + "$ref": "#/definitions/io.k8s.api.core.v1.VsphereVirtualDiskVolumeSource" + } + } + }, + "io.k8s.api.core.v1.VolumeMount": { + "description": "VolumeMount describes a mounting of a Volume within a container.", + "required": [ + "name", + "mountPath" + ], + "properties": { + "mountPath": { + "description": "Path within the container at which the volume should be mounted. Must not contain ':'.", + "type": "string" + }, + "name": { + "description": "This must match the Name of a Volume.", + "type": "string" + }, + "readOnly": { + "description": "Mounted read-only if true, read-write otherwise (false or unspecified). Defaults to false.", + "type": "boolean" + }, + "subPath": { + "description": "Path within the volume from which the container's volume should be mounted. Defaults to \"\" (volume's root).", + "type": "string" + } + } + }, + "io.k8s.api.core.v1.VolumeProjection": { + "description": "Projection that may be projected along with other supported volume types", + "type": "object", + "properties": { + "configMap": { + "description": "information about the configMap data to project", + "$ref": "#/definitions/io.k8s.api.core.v1.ConfigMapProjection" + }, + "downwardAPI": { + "description": "information about the downwardAPI data to project", + "$ref": "#/definitions/io.k8s.api.core.v1.DownwardAPIProjection" + }, + "secret": { + "description": "information about the secret data to project", + "$ref": "#/definitions/io.k8s.api.core.v1.SecretProjection" + } + } + }, + "io.k8s.api.core.v1.VsphereVirtualDiskVolumeSource": { + "description": "Represents a vSphere volume resource.", + "type": "object", + "required": [ + "volumePath" + ], + "properties": { + "fsType": { + "description": "Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified.", + "type": "string" + }, + "storagePolicyID": { + "description": "Storage Policy Based Management (SPBM) profile ID associated with the StoragePolicyName.", + "type": "string" + }, + "storagePolicyName": { + "description": "Storage Policy Based Management (SPBM) profile name.", + "type": "string" + }, + "volumePath": { + "description": "Path that identifies vSphere volume vmdk", + "type": "string" + } + } + }, + "io.k8s.api.core.v1.WeightedPodAffinityTerm": { + "description": "The weights of all of the matched WeightedPodAffinityTerm fields are added per-node to find the most preferred node(s)", + "type": "object", + "required": [ + "weight", + "podAffinityTerm" + ], + "properties": { + "podAffinityTerm": { + "description": "Required. A pod affinity term, associated with the corresponding weight.", + "$ref": "#/definitions/io.k8s.api.core.v1.PodAffinityTerm" + }, + "weight": { + "description": "weight associated with matching the corresponding podAffinityTerm, in the range 1-100.", + "type": "integer", + "format": "int32" + } + } + }, + "io.k8s.apimachinery.pkg.api.resource.Quantity": { + "type": "string" + }, + "io.k8s.apimachinery.pkg.apis.meta.v1.APIGroup": { + "description": "APIGroup contains the name, the supported versions, and the preferred version of a group.", + "type": "object", + "required": [ + "name", + "versions", + "serverAddressByClientCIDRs" + ], + "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", + "type": "string" + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "type": "string" + }, + "name": { + "description": "name is the name of the group.", + "type": "string" + }, + "preferredVersion": { + "description": "preferredVersion is the version preferred by the API server, which probably is the storage version.", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.GroupVersionForDiscovery" + }, + "serverAddressByClientCIDRs": { + "description": "a map of client CIDR to server address that is serving this group. This is to help clients reach servers in the most network-efficient way possible. Clients can use the appropriate server address as per the CIDR that they match. In case of multiple matches, clients should use the longest matching CIDR. The server returns only those CIDRs that it thinks that the client can match. For example: the master will return an internal IP CIDR only, if the client reaches the server using an internal IP. Server looks at X-Forwarded-For header or X-Real-Ip header or request.RemoteAddr (in that order) to get the client IP.", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ServerAddressByClientCIDR" + } + }, + "versions": { + "description": "versions are the versions supported in this group.", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.GroupVersionForDiscovery" + } + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "", + "kind": "APIGroup", + "version": "v1" + } + ] + }, + "io.k8s.apimachinery.pkg.apis.meta.v1.APIGroupList": { + "description": "APIGroupList is a list of APIGroup, to allow clients to discover the API at /apis.", + "type": "object", + "required": [ + "groups" + ], + "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", + "type": "string" + }, + "groups": { + "description": "groups is a list of APIGroup.", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.APIGroup" + } + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "type": "string" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "", + "kind": "APIGroupList", + "version": "v1" + } + ] + }, + "io.k8s.apimachinery.pkg.apis.meta.v1.APIResource": { + "description": "APIResource specifies the name of a resource and whether it is namespaced.", + "type": "object", + "required": [ + "name", + "singularName", + "namespaced", + "kind", + "verbs" + ], + "properties": { + "categories": { + "description": "categories is a list of the grouped resources this resource belongs to (e.g. 'all')", + "type": "array", + "items": { + "type": "string" + } + }, + "kind": { + "description": "kind is the kind for the resource (e.g. 'Foo' is the kind for a resource 'foo')", + "type": "string" + }, + "name": { + "description": "name is the plural name of the resource.", + "type": "string" + }, + "namespaced": { + "description": "namespaced indicates if a resource is namespaced or not.", + "type": "boolean" + }, + "shortNames": { + "description": "shortNames is a list of suggested short names of the resource.", + "type": "array", + "items": { + "type": "string" + } + }, + "singularName": { + "description": "singularName is the singular name of the resource. This allows clients to handle plural and singular opaquely. The singularName is more correct for reporting status on a single item and both singular and plural are allowed from the kubectl CLI interface.", + "type": "string" + }, + "verbs": { + "description": "verbs is a list of supported kube verbs (this includes get, list, watch, create, update, patch, delete, deletecollection, and proxy)", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "io.k8s.apimachinery.pkg.apis.meta.v1.APIResourceList": { + "description": "APIResourceList is a list of APIResource, it is used to expose the name of the resources supported in a specific group and version, and if the resource is namespaced.", + "type": "object", + "required": [ + "groupVersion", + "resources" + ], + "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", + "type": "string" + }, + "groupVersion": { + "description": "groupVersion is the group and version this APIResourceList is for.", + "type": "string" + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "type": "string" + }, + "resources": { + "description": "resources contains the name of the resources and if they are namespaced.", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.APIResource" + } + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "", + "kind": "APIResourceList", + "version": "v1" + } + ] + }, + "io.k8s.apimachinery.pkg.apis.meta.v1.APIVersions": { + "description": "APIVersions lists the versions that are available, to allow clients to discover the API at /api, which is the root path of the legacy v1 API.", + "type": "object", + "required": [ + "versions", + "serverAddressByClientCIDRs" + ], + "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", + "type": "string" + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "type": "string" + }, + "serverAddressByClientCIDRs": { + "description": "a map of client CIDR to server address that is serving this group. This is to help clients reach servers in the most network-efficient way possible. Clients can use the appropriate server address as per the CIDR that they match. In case of multiple matches, clients should use the longest matching CIDR. The server returns only those CIDRs that it thinks that the client can match. For example: the master will return an internal IP CIDR only, if the client reaches the server using an internal IP. Server looks at X-Forwarded-For header or X-Real-Ip header or request.RemoteAddr (in that order) to get the client IP.", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ServerAddressByClientCIDR" + } + }, + "versions": { + "description": "versions are the api versions that are available.", + "type": "array", + "items": { + "type": "string" + } + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "", + "kind": "APIVersions", + "version": "v1" + } + ] + }, + "io.k8s.apimachinery.pkg.apis.meta.v1.DeleteOptions": { + "description": "DeleteOptions may be provided when deleting an API object.", + "type": "object", + "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", + "type": "string" + }, + "gracePeriodSeconds": { + "description": "The duration in seconds before the object should be deleted. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately.", + "type": "integer", + "format": "int64" + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "type": "string" + }, + "orphanDependents": { + "description": "Deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the \"orphan\" finalizer will be added to/removed from the object's finalizers list. Either this field or PropagationPolicy may be set, but not both.", + "type": "boolean" + }, + "preconditions": { + "description": "Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned.", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.Preconditions" + }, + "propagationPolicy": { + "description": "Whether and how garbage collection will be performed. Either this field or OrphanDependents may be set, but not both. The default policy is decided by the existing finalizer set in the metadata.finalizers and the resource-specific default policy.", + "type": "string" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "", + "kind": "DeleteOptions", + "version": "v1" + }, + { + "group": "admission.k8s.io", + "kind": "DeleteOptions", + "version": "v1alpha1" + }, + { + "group": "admissionregistration.k8s.io", + "kind": "DeleteOptions", + "version": "v1alpha1" + }, + { + "group": "apps", + "kind": "DeleteOptions", + "version": "v1beta1" + }, + { + "group": "apps", + "kind": "DeleteOptions", + "version": "v1beta2" + }, + { + "group": "authentication.k8s.io", + "kind": "DeleteOptions", + "version": "v1" + }, + { + "group": "authentication.k8s.io", + "kind": "DeleteOptions", + "version": "v1beta1" + }, + { + "group": "authorization.k8s.io", + "kind": "DeleteOptions", + "version": "v1" + }, + { + "group": "authorization.k8s.io", + "kind": "DeleteOptions", + "version": "v1beta1" + }, + { + "group": "autoscaling", + "kind": "DeleteOptions", + "version": "v1" + }, + { + "group": "autoscaling", + "kind": "DeleteOptions", + "version": "v2alpha1" + }, + { + "group": "batch", + "kind": "DeleteOptions", + "version": "v1" + }, + { + "group": "batch", + "kind": "DeleteOptions", + "version": "v1beta1" + }, + { + "group": "batch", + "kind": "DeleteOptions", + "version": "v2alpha1" + }, + { + "group": "certificates.k8s.io", + "kind": "DeleteOptions", + "version": "v1beta1" + }, + { + "group": "extensions", + "kind": "DeleteOptions", + "version": "v1beta1" + }, + { + "group": "federation", + "kind": "DeleteOptions", + "version": "v1beta1" + }, + { + "group": "imagepolicy.k8s.io", + "kind": "DeleteOptions", + "version": "v1alpha1" + }, + { + "group": "networking.k8s.io", + "kind": "DeleteOptions", + "version": "v1" + }, + { + "group": "policy", + "kind": "DeleteOptions", + "version": "v1beta1" + }, + { + "group": "rbac.authorization.k8s.io", + "kind": "DeleteOptions", + "version": "v1" + }, + { + "group": "rbac.authorization.k8s.io", + "kind": "DeleteOptions", + "version": "v1alpha1" + }, + { + "group": "rbac.authorization.k8s.io", + "kind": "DeleteOptions", + "version": "v1beta1" + }, + { + "group": "scheduling.k8s.io", + "kind": "DeleteOptions", + "version": "v1alpha1" + }, + { + "group": "settings.k8s.io", + "kind": "DeleteOptions", + "version": "v1alpha1" + }, + { + "group": "storage.k8s.io", + "kind": "DeleteOptions", + "version": "v1" + }, + { + "group": "storage.k8s.io", + "kind": "DeleteOptions", + "version": "v1beta1" + } + ] + }, + "io.k8s.apimachinery.pkg.apis.meta.v1.GroupVersionForDiscovery": { + "description": "GroupVersion contains the \"group/version\" and \"version\" string of a version. It is made a struct to keep extensibility.", + "type": "object", + "required": [ + "groupVersion", + "version" + ], + "properties": { + "groupVersion": { + "description": "groupVersion specifies the API group and version in the form \"group/version\"", + "type": "string" + }, + "version": { + "description": "version specifies the version in the form of \"version\". This is to save the clients the trouble of splitting the GroupVersion.", + "type": "string" + } + } + }, + "io.k8s.apimachinery.pkg.apis.meta.v1.Initializer": { + "description": "Initializer is information about an initializer that has not yet completed.", + "type": "object", + "required": [ + "name" + ], + "properties": { + "name": { + "description": "name of the process that is responsible for initializing this object.", + "type": "string" + } + } + }, + "io.k8s.apimachinery.pkg.apis.meta.v1.Initializers": { + "description": "Initializers tracks the progress of initialization.", + "type": "object", + "required": [ + "pending" + ], + "properties": { + "pending": { + "description": "Pending is a list of initializers that must execute in order before this object is visible. When the last pending initializer is removed, and no failing result is set, the initializers struct will be set to nil and the object is considered as initialized and visible to all clients.", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.Initializer" + }, + "x-kubernetes-patch-merge-key": "name", + "x-kubernetes-patch-strategy": "merge" + }, + "result": { + "description": "If result is set with the Failure field, the object will be persisted to storage and then deleted, ensuring that other clients can observe the deletion.", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.Status" + } + } + }, + "io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector": { + "description": "A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.", + "type": "object", + "properties": { + "matchExpressions": { + "description": "matchExpressions is a list of label selector requirements. The requirements are ANDed.", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelectorRequirement" + } + }, + "matchLabels": { + "description": "matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.", + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + }, + "io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelectorRequirement": { + "description": "A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.", + "type": "object", + "required": [ + "key", + "operator" + ], + "properties": { + "key": { + "description": "key is the label key that the selector applies to.", + "type": "string", + "x-kubernetes-patch-merge-key": "key", + "x-kubernetes-patch-strategy": "merge" + }, + "operator": { + "description": "operator represents a key's relationship to a set of values. Valid operators ard In, NotIn, Exists and DoesNotExist.", + "type": "string" + }, + "values": { + "description": "values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "io.k8s.apimachinery.pkg.apis.meta.v1.ListMeta": { + "description": "ListMeta describes metadata that synthetic resources must have, including lists and various status objects. A resource may have only one of {ObjectMeta, ListMeta}.", + "type": "object", + "properties": { + "resourceVersion": { + "description": "String that identifies the server's internal version of this object that can be used by clients to determine when objects have changed. Value must be treated as opaque by clients and passed unmodified back to the server. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#concurrency-control-and-consistency", + "type": "string" + }, + "selfLink": { + "description": "SelfLink is a URL representing this object. Populated by the system. Read-only.", + "type": "string" + } + } + }, + "io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta": { + "description": "ObjectMeta is metadata that all persisted resources must have, which includes all objects users must create.", + "type": "object", + "properties": { + "annotations": { + "description": "Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects. More info: http://kubernetes.io/docs/user-guide/annotations", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "clusterName": { + "description": "The name of the cluster which the object belongs to. This is used to distinguish resources with same name and namespace in different clusters. This field is not set anywhere right now and apiserver is going to ignore it if set in create or update request.", + "type": "string" + }, + "creationTimestamp": { + "description": "CreationTimestamp is a timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC.\n\nPopulated by the system. Read-only. Null for lists. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.Time" + }, + "deletionGracePeriodSeconds": { + "description": "Number of seconds allowed for this object to gracefully terminate before it will be removed from the system. Only set when deletionTimestamp is also set. May only be shortened. Read-only.", + "type": "integer", + "format": "int64" + }, + "deletionTimestamp": { + "description": "DeletionTimestamp is RFC 3339 date and time at which this resource will be deleted. This field is set by the server when a graceful deletion is requested by the user, and is not directly settable by a client. The resource is expected to be deleted (no longer visible from resource lists, and not reachable by name) after the time in this field. Once set, this value may not be unset or be set further into the future, although it may be shortened or the resource may be deleted prior to this time. For example, a user may request that a pod is deleted in 30 seconds. The Kubelet will react by sending a graceful termination signal to the containers in the pod. After that 30 seconds, the Kubelet will send a hard termination signal (SIGKILL) to the container and after cleanup, remove the pod from the API. In the presence of network partitions, this object may still exist after this timestamp, until an administrator or automated process can determine the resource is fully terminated. If not set, graceful deletion of the object has not been requested.\n\nPopulated by the system when a graceful deletion is requested. Read-only. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.Time" + }, + "finalizers": { + "description": "Must be empty before the object is deleted from the registry. Each entry is an identifier for the responsible component that will remove the entry from the list. If the deletionTimestamp of the object is non-nil, entries in this list can only be removed.", + "type": "array", + "items": { + "type": "string" + }, + "x-kubernetes-patch-strategy": "merge" + }, + "generateName": { + "description": "GenerateName is an optional prefix, used by the server, to generate a unique name ONLY IF the Name field has not been provided. If this field is used, the name returned to the client will be different than the name passed. This value will also be combined with a unique suffix. The provided value has the same validation rules as the Name field, and may be truncated by the length of the suffix required to make the value unique on the server.\n\nIf this field is specified and the generated name exists, the server will NOT return a 409 - instead, it will either return 201 Created or 500 with Reason ServerTimeout indicating a unique name could not be found in the time allotted, and the client should retry (optionally after the time indicated in the Retry-After header).\n\nApplied only if Name is not specified. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#idempotency", + "type": "string" + }, + "generation": { + "description": "A sequence number representing a specific generation of the desired state. Populated by the system. Read-only.", + "type": "integer", + "format": "int64" + }, + "initializers": { + "description": "An initializer is a controller which enforces some system invariant at object creation time. This field is a list of initializers that have not yet acted on this object. If nil or empty, this object has been completely initialized. Otherwise, the object is considered uninitialized and is hidden (in list/watch and get calls) from clients that haven't explicitly asked to observe uninitialized objects.\n\nWhen an object is created, the system will populate this list with the current set of initializers. Only privileged users may set or modify this list. Once it is empty, it may not be modified further by any user.", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.Initializers" + }, + "labels": { + "description": "Map of string keys and values that can be used to organize and categorize (scope and select) objects. May match selectors of replication controllers and services. More info: http://kubernetes.io/docs/user-guide/labels", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "name": { + "description": "Name must be unique within a namespace. Is required when creating resources, although some resources may allow a client to request the generation of an appropriate name automatically. Name is primarily intended for creation idempotence and configuration definition. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/identifiers#names", + "type": "string" + }, + "namespace": { + "description": "Namespace defines the space within each name must be unique. An empty namespace is equivalent to the \"default\" namespace, but \"default\" is the canonical representation. Not all objects are required to be scoped to a namespace - the value of this field for those objects will be empty.\n\nMust be a DNS_LABEL. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/namespaces", + "type": "string" + }, + "ownerReferences": { + "description": "List of objects depended by this object. If ALL objects in the list have been deleted, this object will be garbage collected. If this object is managed by a controller, then an entry in this list will point to this controller, with the controller field set to true. There cannot be more than one managing controller.", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.OwnerReference" + }, + "x-kubernetes-patch-merge-key": "uid", + "x-kubernetes-patch-strategy": "merge" + }, + "resourceVersion": { + "description": "An opaque value that represents the internal version of this object that can be used by clients to determine when objects have changed. May be used for optimistic concurrency, change detection, and the watch operation on a resource or set of resources. Clients must treat these values as opaque and passed unmodified back to the server. They may only be valid for a particular resource or set of resources.\n\nPopulated by the system. Read-only. Value must be treated as opaque by clients and . More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#concurrency-control-and-consistency", + "type": "string" + }, + "selfLink": { + "description": "SelfLink is a URL representing this object. Populated by the system. Read-only.", + "type": "string" + }, + "uid": { + "description": "UID is the unique in time and space value for this object. It is typically generated by the server on successful creation of a resource and is not allowed to change on PUT operations.\n\nPopulated by the system. Read-only. More info: http://kubernetes.io/docs/user-guide/identifiers#uids", + "type": "string" + } + } + }, + "io.k8s.apimachinery.pkg.apis.meta.v1.OwnerReference": { + "description": "OwnerReference contains enough information to let you identify an owning object. Currently, an owning object must be in the same namespace, so there is no namespace field.", + "type": "object", + "required": [ + "apiVersion", + "kind", + "name", + "uid" + ], + "properties": { + "apiVersion": { + "description": "API version of the referent.", + "type": "string" + }, + "blockOwnerDeletion": { + "description": "If true, AND if the owner has the \"foregroundDeletion\" finalizer, then the owner cannot be deleted from the key-value store until this reference is removed. Defaults to false. To set this field, a user needs \"delete\" permission of the owner, otherwise 422 (Unprocessable Entity) will be returned.", + "type": "boolean" + }, + "controller": { + "description": "If true, this reference points to the managing controller.", + "type": "boolean" + }, + "kind": { + "description": "Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "type": "string" + }, + "name": { + "description": "Name of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#names", + "type": "string" + }, + "uid": { + "description": "UID of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#uids", + "type": "string" + } + } + }, + "io.k8s.apimachinery.pkg.apis.meta.v1.Patch": { + "description": "Patch is provided to give a concrete name and type to the Kubernetes PATCH request body.", + "type": "object" + }, + "io.k8s.apimachinery.pkg.apis.meta.v1.Preconditions": { + "description": "Preconditions must be fulfilled before an operation (update, delete, etc.) is carried out.", + "type": "object", + "properties": { + "uid": { + "description": "Specifies the target UID.", + "type": "string" + } + } + }, + "io.k8s.apimachinery.pkg.apis.meta.v1.ServerAddressByClientCIDR": { + "description": "ServerAddressByClientCIDR helps the client to determine the server address that they should use, depending on the clientCIDR that they match.", + "type": "object", + "required": [ + "clientCIDR", + "serverAddress" + ], + "properties": { + "clientCIDR": { + "description": "The CIDR with which clients can match their IP to figure out the server address that they should use.", + "type": "string" + }, + "serverAddress": { + "description": "Address of this server, suitable for a client that matches the above CIDR. This can be a hostname, hostname:port, IP or IP:port.", + "type": "string" + } + } + }, + "io.k8s.apimachinery.pkg.apis.meta.v1.Status": { + "description": "Status is a return value for calls that don't return other objects.", + "type": "object", + "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", + "type": "string" + }, + "code": { + "description": "Suggested HTTP return code for this status, 0 if not set.", + "type": "integer", + "format": "int32" + }, + "details": { + "description": "Extended data associated with the reason. Each reason may define its own extended details. This field is optional and the data returned is not guaranteed to conform to any schema except that defined by the reason type.", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.StatusDetails" + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "type": "string" + }, + "message": { + "description": "A human-readable description of the status of this operation.", + "type": "string" + }, + "metadata": { + "description": "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ListMeta" + }, + "reason": { + "description": "A machine-readable description of why this operation is in the \"Failure\" status. If this value is empty there is no information available. A Reason clarifies an HTTP status code but does not override it.", + "type": "string" + }, + "status": { + "description": "Status of the operation. One of: \"Success\" or \"Failure\". More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status", + "type": "string" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "", + "kind": "Status", + "version": "v1" + } + ] + }, + "io.k8s.apimachinery.pkg.apis.meta.v1.StatusCause": { + "description": "StatusCause provides more information about an api.Status failure, including cases when multiple errors are encountered.", + "type": "object", + "properties": { + "field": { + "description": "The field of the resource that has caused this error, as named by its JSON serialization. May include dot and postfix notation for nested attributes. Arrays are zero-indexed. Fields may appear more than once in an array of causes due to fields having multiple errors. Optional.\n\nExamples:\n \"name\" - the field \"name\" on the current resource\n \"items[0].name\" - the field \"name\" on the first array entry in \"items\"", + "type": "string" + }, + "message": { + "description": "A human-readable description of the cause of the error. This field may be presented as-is to a reader.", + "type": "string" + }, + "reason": { + "description": "A machine-readable description of the cause of the error. If this value is empty there is no information available.", + "type": "string" + } + } + }, + "io.k8s.apimachinery.pkg.apis.meta.v1.StatusDetails": { + "description": "StatusDetails is a set of additional properties that MAY be set by the server to provide additional information about a response. The Reason field of a Status object defines what attributes will be set. Clients must ignore fields that do not match the defined type of each attribute, and should assume that any attribute may be empty, invalid, or under defined.", + "type": "object", + "properties": { + "causes": { + "description": "The Causes array includes more details associated with the StatusReason failure. Not all StatusReasons may provide detailed causes.", + "type": "array", + "items": { + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.StatusCause" + } + }, + "group": { + "description": "The group attribute of the resource associated with the status StatusReason.", + "type": "string" + }, + "kind": { + "description": "The kind attribute of the resource associated with the status StatusReason. On some operations may differ from the requested resource Kind. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "type": "string" + }, + "name": { + "description": "The name attribute of the resource associated with the status StatusReason (when there is a single name which can be described).", + "type": "string" + }, + "retryAfterSeconds": { + "description": "If specified, the time in seconds before the operation should be retried. Some errors may indicate the client must take an alternate action - for those errors this field may indicate how long to wait before taking the alternate action.", + "type": "integer", + "format": "int32" + }, + "uid": { + "description": "UID of the resource. (when there is a single resource which can be described). More info: http://kubernetes.io/docs/user-guide/identifiers#uids", + "type": "string" + } + } + }, + "io.k8s.apimachinery.pkg.apis.meta.v1.Time": { + "type": "string", + "format": "date-time" + }, + "io.k8s.apimachinery.pkg.apis.meta.v1.WatchEvent": { + "description": "Event represents a single event to a watched resource.", + "type": "object", + "required": [ + "type", + "object" + ], + "properties": { + "object": { + "description": "Object is:\n * If Type is Added or Modified: the new state of the object.\n * If Type is Deleted: the state of the object immediately before deletion.\n * If Type is Error: *Status is recommended; other types may make sense\n depending on context.", + "type": "object" + }, + "type": { + "type": "string" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "", + "kind": "WatchEvent", + "version": "v1" + }, + { + "group": "admission.k8s.io", + "kind": "WatchEvent", + "version": "v1alpha1" + }, + { + "group": "admissionregistration.k8s.io", + "kind": "WatchEvent", + "version": "v1alpha1" + }, + { + "group": "apps", + "kind": "WatchEvent", + "version": "v1beta1" + }, + { + "group": "apps", + "kind": "WatchEvent", + "version": "v1beta2" + }, + { + "group": "authentication.k8s.io", + "kind": "WatchEvent", + "version": "v1" + }, + { + "group": "authentication.k8s.io", + "kind": "WatchEvent", + "version": "v1beta1" + }, + { + "group": "authorization.k8s.io", + "kind": "WatchEvent", + "version": "v1" + }, + { + "group": "authorization.k8s.io", + "kind": "WatchEvent", + "version": "v1beta1" + }, + { + "group": "autoscaling", + "kind": "WatchEvent", + "version": "v1" + }, + { + "group": "autoscaling", + "kind": "WatchEvent", + "version": "v2alpha1" + }, + { + "group": "batch", + "kind": "WatchEvent", + "version": "v1" + }, + { + "group": "batch", + "kind": "WatchEvent", + "version": "v1beta1" + }, + { + "group": "batch", + "kind": "WatchEvent", + "version": "v2alpha1" + }, + { + "group": "certificates.k8s.io", + "kind": "WatchEvent", + "version": "v1beta1" + }, + { + "group": "extensions", + "kind": "WatchEvent", + "version": "v1beta1" + }, + { + "group": "federation", + "kind": "WatchEvent", + "version": "v1beta1" + }, + { + "group": "imagepolicy.k8s.io", + "kind": "WatchEvent", + "version": "v1alpha1" + }, + { + "group": "networking.k8s.io", + "kind": "WatchEvent", + "version": "v1" + }, + { + "group": "policy", + "kind": "WatchEvent", + "version": "v1beta1" + }, + { + "group": "rbac.authorization.k8s.io", + "kind": "WatchEvent", + "version": "v1" + }, + { + "group": "rbac.authorization.k8s.io", + "kind": "WatchEvent", + "version": "v1alpha1" + }, + { + "group": "rbac.authorization.k8s.io", + "kind": "WatchEvent", + "version": "v1beta1" + }, + { + "group": "scheduling.k8s.io", + "kind": "WatchEvent", + "version": "v1alpha1" + }, + { + "group": "settings.k8s.io", + "kind": "WatchEvent", + "version": "v1alpha1" + }, + { + "group": "storage.k8s.io", + "kind": "WatchEvent", + "version": "v1" + }, + { + "group": "storage.k8s.io", + "kind": "WatchEvent", + "version": "v1beta1" + } + ] + }, + "io.k8s.apimachinery.pkg.util.intstr.IntOrString": { + "type": "string", + "format": "int-or-string" + }, + "io.k8s.apimachinery.pkg.version.Info": { + "description": "Info contains versioning information. how we'll want to distribute that information.", + "type": "object", + "required": [ + "major", + "minor", + "gitVersion", + "gitCommit", + "gitTreeState", + "buildDate", + "goVersion", + "compiler", + "platform" + ], + "properties": { + "buildDate": { + "type": "string" + }, + "compiler": { + "type": "string" + }, + "gitCommit": { + "type": "string" + }, + "gitTreeState": { + "type": "string" + }, + "gitVersion": { + "type": "string" + }, + "goVersion": { + "type": "string" + }, + "major": { + "type": "string" + }, + "minor": { + "type": "string" + }, + "platform": { + "type": "string" + } + } + } + }, + "securityDefinitions": { + "BearerToken": { + "description": "Bearer Token authentication", + "type": "apiKey", + "name": "authorization", + "in": "header" + } + }, + "security": [ + { + "BearerToken": [] + } + ] +} diff --git a/vendor/k8s.io/kube-openapi/pkg/util/proto/testing/openapi.go b/vendor/k8s.io/kube-openapi/pkg/util/proto/testing/openapi.go index 4aee2f107..bc280a198 100644 --- a/vendor/k8s.io/kube-openapi/pkg/util/proto/testing/openapi.go +++ b/vendor/k8s.io/kube-openapi/pkg/util/proto/testing/openapi.go @@ -60,3 +60,9 @@ func (f *Fake) OpenAPISchema() (*openapi_v2.Document, error) { }) return f.document, f.err } + +type Empty struct{} + +func (Empty) OpenAPISchema() (*openapi_v2.Document, error) { + return nil, nil +} diff --git a/vendor/k8s.io/kube-openapi/test/integration/README.md b/vendor/k8s.io/kube-openapi/test/integration/README.md new file mode 100644 index 000000000..5ddff91a3 --- /dev/null +++ b/vendor/k8s.io/kube-openapi/test/integration/README.md @@ -0,0 +1,28 @@ +# Kube OpenAPI Integration Tests + +## Running the integration tests + +Within the current directory: + +```bash +$ go test -v . +``` + +## Generating the golden Swagger definition file + +First, run the generator to create `openapi_generated.go` file which specifies +the `OpenAPIDefinition` for each type. + +```bash +$ go run ../../cmd/openapi-gen/openapi-gen.go "./testdata/listtype" +``` +The generated file `pkg/generaged/openapi_generated.go` should have been created. + +Next, run the OpenAPI builder to create the Swagger file which includes +the definitions. The output file named `golden.json` will be output in +the current directory. + +```bash +$ go run builder/main.go golden.json +``` + diff --git a/vendor/k8s.io/kube-openapi/test/integration/builder/main.go b/vendor/k8s.io/kube-openapi/test/integration/builder/main.go new file mode 100644 index 000000000..7008c574c --- /dev/null +++ b/vendor/k8s.io/kube-openapi/test/integration/builder/main.go @@ -0,0 +1,85 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "encoding/json" + "fmt" + "io/ioutil" + "log" + "os" + + "github.com/go-openapi/spec" + "k8s.io/kube-openapi/pkg/builder" + "k8s.io/kube-openapi/pkg/common" + "k8s.io/kube-openapi/test/integration/pkg/generated" +) + +// TODO: Change this to output the generated swagger to stdout. +const defaultSwaggerFile = "generated.json" + +func main() { + // Get the name of the generated swagger file from the args + // if it exists; otherwise use the default file name. + swaggerFilename := defaultSwaggerFile + if len(os.Args) > 1 { + swaggerFilename = os.Args[1] + } + + // Generate the definition names from the map keys returned + // from GetOpenAPIDefinitions. Anonymous function returning empty + // Ref is not used. + var defNames []string + for name, _ := range generated.GetOpenAPIDefinitions(func(name string) spec.Ref { + return spec.Ref{} + }) { + defNames = append(defNames, name) + } + + // Create a minimal builder config, then call the builder with the definition names. + config := createOpenAPIBuilderConfig() + config.GetDefinitions = generated.GetOpenAPIDefinitions + swagger, serr := builder.BuildOpenAPIDefinitionsForResources(config, defNames...) + if serr != nil { + log.Fatalf("ERROR: %s", serr.Error()) + } + + // Marshal the swagger spec into JSON, then write it out. + specBytes, err := json.MarshalIndent(swagger, " ", " ") + if err != nil { + panic(fmt.Sprintf("json marshal error: %s", err.Error())) + } + err = ioutil.WriteFile(swaggerFilename, specBytes, 0644) + if err != nil { + log.Fatalf("stdout write error: %s", err.Error()) + } +} + +// CreateOpenAPIBuilderConfig hard-codes some values in the API builder +// config for testing. +func createOpenAPIBuilderConfig() *common.Config { + return &common.Config{ + ProtocolList: []string{"https"}, + IgnorePrefixes: []string{"/swaggerapi"}, + Info: &spec.Info{ + InfoProps: spec.InfoProps{ + Title: "Integration Test", + Version: "1.0", + }, + }, + } +} diff --git a/vendor/k8s.io/kube-openapi/test/integration/pkg/generated/openapi_generated.go b/vendor/k8s.io/kube-openapi/test/integration/pkg/generated/openapi_generated.go new file mode 100644 index 000000000..43705ccec --- /dev/null +++ b/vendor/k8s.io/kube-openapi/test/integration/pkg/generated/openapi_generated.go @@ -0,0 +1,25 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package generated + +import ( + common "k8s.io/kube-openapi/pkg/common" +) + +func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition { + return map[string]common.OpenAPIDefinition{} +} diff --git a/vendor/k8s.io/kube-openapi/test/integration/testdata/golden.json b/vendor/k8s.io/kube-openapi/test/integration/testdata/golden.json new file mode 100644 index 000000000..0eb907804 --- /dev/null +++ b/vendor/k8s.io/kube-openapi/test/integration/testdata/golden.json @@ -0,0 +1,68 @@ +{ + "swagger": "2.0", + "info": { + "title": "Integration Test", + "version": "1.0" + }, + "paths": {}, + "definitions": { + "listtype.AtomicList": { + "required": [ + "Field" + ], + "properties": { + "Field": { + "type": "array", + "items": { + "type": "string" + }, + "x-kubernetes-list-type": "atomic" + } + } + }, + "listtype.Item": { + "required": [ + "Port", + "Protocol" + ], + "properties": { + "Port": { + "type": "integer", + "format": "int32" + }, + "Protocol": { + "type": "string" + } + } + }, + "listtype.MapList": { + "required": [ + "Field" + ], + "properties": { + "Field": { + "type": "array", + "items": { + "$ref": "#/definitions/listtype.Item" + }, + "x-kubernetes-list-map-keys": "port", + "x-kubernetes-list-type": "map" + } + } + }, + "listtype.SetList": { + "required": [ + "Field" + ], + "properties": { + "Field": { + "type": "array", + "items": { + "type": "string" + }, + "x-kubernetes-list-type": "set" + } + } + } + } + } \ No newline at end of file diff --git a/vendor/k8s.io/kube-openapi/test/integration/testdata/listtype/atomic-list.go b/vendor/k8s.io/kube-openapi/test/integration/testdata/listtype/atomic-list.go new file mode 100644 index 000000000..9029ece01 --- /dev/null +++ b/vendor/k8s.io/kube-openapi/test/integration/testdata/listtype/atomic-list.go @@ -0,0 +1,7 @@ +package listtype + +// +k8s:openapi-gen=true +type AtomicList struct { + // +listType=atomic + Field []string +} diff --git a/vendor/k8s.io/kube-openapi/test/integration/testdata/listtype/map-list.go b/vendor/k8s.io/kube-openapi/test/integration/testdata/listtype/map-list.go new file mode 100644 index 000000000..bb1f693d1 --- /dev/null +++ b/vendor/k8s.io/kube-openapi/test/integration/testdata/listtype/map-list.go @@ -0,0 +1,14 @@ +package listtype + +// +k8s:openapi-gen=true +type Item struct { + Port int + Protocol string +} + +// +k8s:openapi-gen=true +type MapList struct { + // +listType=map + // +listMapKey=port + Field []Item +} diff --git a/vendor/k8s.io/kube-openapi/test/integration/testdata/listtype/set-list.go b/vendor/k8s.io/kube-openapi/test/integration/testdata/listtype/set-list.go new file mode 100644 index 000000000..bf7b27c53 --- /dev/null +++ b/vendor/k8s.io/kube-openapi/test/integration/testdata/listtype/set-list.go @@ -0,0 +1,7 @@ +package listtype + +// +k8s:openapi-gen=true +type SetList struct { + // +listType=set + Field []string +} diff --git a/vendor/kubevirt.io/kubevirt/.gitattributes b/vendor/kubevirt.io/kubevirt/.gitattributes new file mode 100644 index 000000000..62a62e56c --- /dev/null +++ b/vendor/kubevirt.io/kubevirt/.gitattributes @@ -0,0 +1 @@ +vendor/* linguist-vendored diff --git a/vendor/kubevirt.io/kubevirt/.github/ISSUE_TEMPLATE.md b/vendor/kubevirt.io/kubevirt/.github/ISSUE_TEMPLATE.md new file mode 100644 index 000000000..064b871b3 --- /dev/null +++ b/vendor/kubevirt.io/kubevirt/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,30 @@ + + +**Is this a BUG REPORT or FEATURE REQUEST?**: + +> Uncomment only one, leave it on its own line: +> +> /kind bug +> /kind enhancement + + +**What happened**: + +**What you expected to happen**: + +**How to reproduce it (as minimally and precisely as possible)**: + + +**Anything else we need to know?**: + +**Environment**: +- KubeVirt version (use `virtctl version`): +- Kubernetes version (use `kubectl version`): +- VM or VMI specifications: +- Cloud provider or hardware configuration: +- OS (e.g. from /etc/os-release): +- Kernel (e.g. `uname -a`): +- Install tools: +- Others: diff --git a/vendor/kubevirt.io/kubevirt/.github/PULL_REQUEST_TEMPLATE.md b/vendor/kubevirt.io/kubevirt/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 000000000..8542cfeb2 --- /dev/null +++ b/vendor/kubevirt.io/kubevirt/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,19 @@ + + +**What this PR does / why we need it**: + +**Which issue(s) this PR fixes** *(optional, in `fixes #(, fixes #, ...)` format, will close the issue(s) when PR gets merged)*: +Fixes # + +**Special notes for your reviewer**: + +**Release note**: + +```release-note + +``` diff --git a/vendor/kubevirt.io/kubevirt/.gitignore b/vendor/kubevirt.io/kubevirt/.gitignore index 85f674427..78f6a1d30 100644 --- a/vendor/kubevirt.io/kubevirt/.gitignore +++ b/vendor/kubevirt.io/kubevirt/.gitignore @@ -19,12 +19,13 @@ hack/gen-swagger-doc/*.adoc hack/gen-swagger-doc/*.md hack/gen-swagger-doc/html5 cluster/local/certs -**.swp -**.pem -**.crt -**.csr +*.swp +*.pem +*.crt +*.csr _out vendor/**/*_test.go **/polarion.xml tools/manifest-templator/manifest-templator tools/vms-generator/vms-generator +.coverprofile diff --git a/vendor/kubevirt.io/kubevirt/.mailmap b/vendor/kubevirt.io/kubevirt/.mailmap index 21f3d9add..d273b0e90 100644 --- a/vendor/kubevirt.io/kubevirt/.mailmap +++ b/vendor/kubevirt.io/kubevirt/.mailmap @@ -9,3 +9,7 @@ David Vossel Artyom Lukianov Petr Kotas Karim Boumedhel +Yuval Lifshitz +Marc Sluiter +Sebastian Scheinkman +Ihar Hrachyshka diff --git a/vendor/kubevirt.io/kubevirt/.travis.yml b/vendor/kubevirt.io/kubevirt/.travis.yml index f117a0606..117ad0dc7 100644 --- a/vendor/kubevirt.io/kubevirt/.travis.yml +++ b/vendor/kubevirt.io/kubevirt/.travis.yml @@ -40,14 +40,16 @@ deploy: - provider: releases skip_cleanup: true api_key: - secure: dy3AlSki7p9sRjItOiWoPv4s28+hZ9wMcuvtZv0bWHbEZ7y/EvzXcwWmn+/Tjjk4Np59LImUjJw1E5Yv2Q16ViuNwKbX7TA7fu+wAcTz4DF4wFLIrJBcCRetiud4175aJ1ylOvmtHOuWHfo6Wx5HRxRT0fLcMFdSoagpe4Dh7BJYfI4Sgu/jghMMJ4wcDsMLZqi6RRM6jywFXQXMmBY87E57/ZLlXZ5Nud5RoWXJxfFfc/vTn/frCBu7r+JW8ayGeGVPEkEMtWX1huWnIvVjNu1twuZnL3zWmLNmpFXfk3j/gLbdIwLn3jgtariNz/Rvigqaj18F0Fa/QNL6VcruqgXd6ryWxmGm9sD6MYC3kk0HoqwSI7WBf88tlfz27FR+cHFZtjTBXnZHBtM5skuzUpT4kUKhLkwcfgA5PmoW/7NcmnN0eKvOQuQYq/8pREwdmYAvYsGPWJZjNYHBCv9KRT1lDRN5jRLMi5wn7NWFMR1p+mbdHyd7i43zM8gnumqvGF/chZ9PEH38hnm835RZAwnzdJ3EQ4YFAaOE2AaUBe9Yw1FP6f22MOC8+N9CY+a1AlGQBmovPjaf+x4f+Jx6y9jjxahJpoXxEKgeFvfSVUoKbkMPMOHxMAb0UL9Rqq3BhlLnPQIjcwdCZU/+wTcV/sFHdcnIqdl9/wb/L+mMjOs= + secure: KD1d1EkvX5iY5pvKQbi6Aj6y49XXnQBxBMok9x2d9LVMbmzBQIHoTqUQz2Dv2TSpANshkIrLmR1eT/brCK382cIUVvA6kG8JB2yqAAE2hzJ8u49+CI4iyqpBWw1HCuH/4xPWZUPVBW0Yl9WsW0vencAeKK6cTDm4Z9K3esJf+iZMpJh7ZpK2ESn9d2RZsrpOKJpxYrvt14Wox+8YfqPRCTJoO/Q8vdXbyOrRVpK6daSe11HsmTZZpFzgLWGojpjH05wcENUaokpCIp8Hgx3rJmO9z5iReNG+2QuPCw0QyEIKGAvzlA5KbYFWBUurxz0XsnaovbJ7BKI070arxQKjKRnjSNE3kEValOwMIE8dA835A1nChm85NILQdWvlbexSxPpz0z62SGPjFthUj9VBx/RnUrd1itxWOi6ZW5k6PnWDUoKPr63+fYSAkp6bXO9ELexA19wUfQCicGRBEO3mJ6QvKKbiDAFKWcABlavxlNtFgw1mMPxxWEhKkW0PrCqOVu9fDDzJ48DCD5XHRT8HUVHDeKcscMTW675rlzo3SxTJdqnZSybpbMSmKbxNs0rM8kPXf1RQLsGDg4CC6Daxz255PV5Y/+p0AhZ2hWtfC3c/Ff8wOdDSdCaEcg5tGa/e1kJWAKuIATUGdZsFZUri8ePQcgcXzM4ihANn7gP8Cl4= file_glob: true file: - _out/cmd/virtctl/virtctl-* - _out/manifests/release/kubevirt.yaml + - _out/templates/manifests/release/kubevirt.yaml.j2 - _out/manifests/release/demo-content.yaml prerelease: true overwrite: true + name: $TRAVIS_TAG on: tags: true repo: kubevirt/kubevirt diff --git a/vendor/kubevirt.io/kubevirt/CODE_OF_CONDUCT b/vendor/kubevirt.io/kubevirt/CODE_OF_CONDUCT.md similarity index 100% rename from vendor/kubevirt.io/kubevirt/CODE_OF_CONDUCT rename to vendor/kubevirt.io/kubevirt/CODE_OF_CONDUCT.md diff --git a/vendor/kubevirt.io/kubevirt/Makefile b/vendor/kubevirt.io/kubevirt/Makefile index bf346efe5..bab3553c9 100644 --- a/vendor/kubevirt.io/kubevirt/Makefile +++ b/vendor/kubevirt.io/kubevirt/Makefile @@ -1,6 +1,7 @@ export GO15VENDOREXPERIMENT := 1 -all: build manifests +all: + hack/dockerized "./hack/check.sh && KUBEVIRT_VERSION=${KUBEVIRT_VERSION} ./hack/build-go.sh install ${WHAT} && ./hack/build-copy-artifacts.sh ${WHAT} && DOCKER_PREFIX=${DOCKER_PREFIX} DOCKER_TAG=${DOCKER_TAG} ./hack/build-manifests.sh" generate: hack/dockerized "./hack/generate.sh" @@ -12,7 +13,7 @@ client-python: hack/dockerized "./hack/generate.sh && TRAVIS_TAG=${TRAVIS_TAG} ./hack/gen-client-python/generate.sh" build: - hack/dockerized "./hack/check.sh && KUBEVIRT_VERSION=${KUBEVIRT_VERSION} ./hack/build-go.sh install ${WHAT}" + hack/dockerized "./hack/check.sh && KUBEVIRT_VERSION=${KUBEVIRT_VERSION} ./hack/build-go.sh install ${WHAT}" && ./hack/build-copy-artifacts.sh ${WHAT} goveralls: SYNC_OUT=false hack/dockerized "./hack/check.sh && TRAVIS_JOB_ID=${TRAVIS_JOB_ID} TRAVIS_PULL_REQUEST=${TRAVIS_PULL_REQUEST} TRAVIS_BRANCH=${TRAVIS_BRANCH} ./hack/goveralls.sh" @@ -43,9 +44,15 @@ deps-update: docker: build hack/build-docker.sh build ${WHAT} -publish: docker +push: docker hack/build-docker.sh push ${WHAT} +publish: docker verify-build + hack/build-docker.sh push ${WHAT} + +verify-build: + hack/verify-build.sh + manifests: hack/dockerized "DOCKER_PREFIX=${DOCKER_PREFIX} DOCKER_TAG=${DOCKER_TAG} ./hack/build-manifests.sh" diff --git a/vendor/kubevirt.io/kubevirt/README.md b/vendor/kubevirt.io/kubevirt/README.md index 1a5586389..9972336d4 100644 --- a/vendor/kubevirt.io/kubevirt/README.md +++ b/vendor/kubevirt.io/kubevirt/README.md @@ -43,27 +43,25 @@ Example: [![asciicast](https://asciinema.org/a/96275.png)](https://asciinema.org/a/96275) -# Getting Started +# To start using KubeVirt -**Demo** To try out our demo run -```bash -$ curl run.kubevirt.io/demo.sh | bash -``` -on a recent Fedora or Ubuntu and follow [these steps](https://github.com/kubevirt/demo). +Try our quickstart at [kubevirt.io](http://kubevirt.io/get_kubevirt/). -**Developer** To set up a development environment please read our -[Getting Started Guide](docs/getting-started.md). To learn how to contribute, please read our [contribution guide](https://github.com/kubevirt/kubevirt/blob/master/CONTRIBUTING.md). +See our user documentation at [docs.kubevirt.io](http://docs.kubevirt.io/). +# To start developing KubeVirt -## Documentation +To set up a development environment please read our +[Getting Started Guide](docs/getting-started.md). To learn how to contribute, please read our [contribution guide](https://github.com/kubevirt/kubevirt/blob/master/CONTRIBUTING.md). You can learn more about how KubeVirt is designed (and why it is that way), and learn more about the major components by taking a look at -[our documentation](docs/): +[our developer documentation](docs/): * [Glossary](docs/glossary.md) - Explaining the most important terms * [Architecture](docs/architecture.md) - High-level view on the architecture * [Components](docs/components.md) - Detailed look at all components + * [API Reference](https://www.kubevirt.io/api-reference/) # Community @@ -82,6 +80,7 @@ of options: * [Kubernetes][k8s] * [Libvirt][libvirt] * [Cockpit][cockpit] + * [Kubevirt-ansible][kubevirt-ansible] ## Submitting patches @@ -122,3 +121,4 @@ KubeVirt is distributed under the [ovirt]: https://www.ovirt.org [cockpit]: https://cockpit-project.org/ [libvirt]: https://www.libvirt.org + [kubevirt-ansible]: https://github.com/kubevirt/kubevirt-ansible diff --git a/vendor/kubevirt.io/kubevirt/Vagrantfile b/vendor/kubevirt.io/kubevirt/Vagrantfile deleted file mode 100644 index a0d1f8f9b..000000000 --- a/vendor/kubevirt.io/kubevirt/Vagrantfile +++ /dev/null @@ -1,120 +0,0 @@ -# -*- mode: ruby -*- -# vi: set ft=ruby : - -if ARGV.first == "up" && ENV['USING_KUBE_SCRIPTS'] != 'true' - raise Vagrant::Errors::VagrantError.new, < 'random' # give ovirt-engine some random data for SSO - end - if $vagrant_pool then - domain.storage_pool_name = $vagrant_pool - end - domain.default_prefix = $libvirt_prefix - end - - if $use_nfs then - config.vm.synced_folder "./", "/vagrant", type: "nfs" - else - # Vagrant seems to insist on using NFS sometimes even when explicitly - # configured to use `rsync`, this prevents that - config.nfs.functional = false - config.vm.synced_folder "./", "/vagrant", type: "rsync", - rsync__exclude: [ - "cluster/vagrant/.kubectl", "cluster/vagrant/.kubeconfig", ".vagrant", - "vendor", ".git" - ], - rsync__args: ["--archive", "--delete"] - end - - config.vm.provision "shell", inline: $common_setup - - config.vm.define "master" do |master| - master.vm.hostname = "master" - master.vm.network "private_network", ip: "#{$master_ip}", libvirt__network_name: $libvirt_prefix + "0" - master.vm.provider :libvirt do |domain| - domain.memory = 3000 - if $cache_docker then - domain.storage :file, :size => '10G', :path => $libvirt_prefix.to_s + '_master_docker.img', :allow_existing => true - end - end - - master.vm.provision "shell" do |s| - s.path = "cluster/#{$provider}/setup_master.sh" - s.args = ["#{$master_ip}", "#{$nodes}", "#{$network_provider}"] - end - end - - (0..($nodes-1)).each do |suffix| - config.vm.define "node" + suffix.to_s do |node| - node.vm.hostname = "node" + suffix.to_s - node_ip = $master_ip[0..-2] + ($master_ip[-1].to_i + 1 + suffix).to_s - node.vm.network "private_network", ip: node_ip, libvirt__network_name: $libvirt_prefix + "0" - - node.vm.provider :libvirt do |domain| - domain.memory = 2048 - if $cache_docker then - domain.storage :file, :size => '10G', :path => $libvirt_prefix.to_s + '_node_docker' + suffix.to_s + '.img', :allow_existing => true - end - end - - node.vm.provision "shell" do |s| - s.path = "cluster/#{$provider}/setup_node.sh" - s.args = ["#{$master_ip}", "#{$nodes}"] - end - end - end -end diff --git a/vendor/kubevirt.io/kubevirt/api/openapi-spec/swagger.json b/vendor/kubevirt.io/kubevirt/api/openapi-spec/swagger.json index 7b568c891..0b6c89759 100644 --- a/vendor/kubevirt.io/kubevirt/api/openapi-spec/swagger.json +++ b/vendor/kubevirt.io/kubevirt/api/openapi-spec/swagger.json @@ -66,7 +66,7 @@ } } }, - "/apis/kubevirt.io/v1alpha1": { + "/apis/kubevirt.io/v1alpha2": { "get": { "produces": [ "application/json" @@ -92,7 +92,7 @@ } } }, - "/apis/kubevirt.io/v1alpha1/healthz": { + "/apis/kubevirt.io/v1alpha2/healthz": { "get": { "consumes": [ "application/json" @@ -115,15 +115,15 @@ } } }, - "/apis/kubevirt.io/v1alpha1/namespaces/{namespace}/offlinevirtualmachines": { + "/apis/kubevirt.io/v1alpha2/namespaces/{namespace}/virtualmachineinstancepresets": { "get": { "produces": [ "application/json", "application/yaml", "application/json;stream=watch" ], - "summary": "Get a list of OfflineVirtualMachine objects.", - "operationId": "listNamespacedOfflineVirtualMachine", + "summary": "Get a list of VirtualMachineInstancePreset objects.", + "operationId": "listNamespacedVirtualMachineInstancePreset", "parameters": [ { "pattern": "[a-z0-9][a-z0-9\\-]*", @@ -186,7 +186,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/v1.OfflineVirtualMachineList" + "$ref": "#/definitions/v1.VirtualMachineInstancePresetList" } }, "401": { @@ -195,7 +195,7 @@ "default": { "description": "OK", "schema": { - "$ref": "#/definitions/v1.OfflineVirtualMachineList" + "$ref": "#/definitions/v1.VirtualMachineInstancePresetList" } } } @@ -209,15 +209,15 @@ "application/json", "application/yaml" ], - "summary": "Create a OfflineVirtualMachine object.", - "operationId": "createNamespacedOfflineVirtualMachine", + "summary": "Create a VirtualMachineInstancePreset object.", + "operationId": "createNamespacedVirtualMachineInstancePreset", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/v1.OfflineVirtualMachine" + "$ref": "#/definitions/v1.VirtualMachineInstancePreset" } }, { @@ -233,19 +233,19 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/v1.OfflineVirtualMachine" + "$ref": "#/definitions/v1.VirtualMachineInstancePreset" } }, "201": { "description": "Created", "schema": { - "$ref": "#/definitions/v1.OfflineVirtualMachine" + "$ref": "#/definitions/v1.VirtualMachineInstancePreset" } }, "202": { "description": "Accepted", "schema": { - "$ref": "#/definitions/v1.OfflineVirtualMachine" + "$ref": "#/definitions/v1.VirtualMachineInstancePreset" } }, "401": { @@ -254,7 +254,7 @@ "default": { "description": "OK", "schema": { - "$ref": "#/definitions/v1.OfflineVirtualMachine" + "$ref": "#/definitions/v1.VirtualMachineInstancePreset" } } } @@ -264,8 +264,8 @@ "application/json", "application/yaml" ], - "summary": "Delete a collection of OfflineVirtualMachine objects.", - "operationId": "deleteCollectionNamespacedOfflineVirtualMachine", + "summary": "Delete a collection of VirtualMachineInstancePreset objects.", + "operationId": "deleteCollectionNamespacedVirtualMachineInstancePreset", "parameters": [ { "type": "string", @@ -335,15 +335,15 @@ } } }, - "/apis/kubevirt.io/v1alpha1/namespaces/{namespace}/offlinevirtualmachines/{name}": { + "/apis/kubevirt.io/v1alpha2/namespaces/{namespace}/virtualmachineinstancepresets/{name}": { "get": { "produces": [ "application/json", "application/yaml", "application/json;stream=watch" ], - "summary": "Get a OfflineVirtualMachine object.", - "operationId": "readNamespacedOfflineVirtualMachine", + "summary": "Get a VirtualMachineInstancePreset object.", + "operationId": "readNamespacedVirtualMachineInstancePreset", "parameters": [ { "pattern": "[a-z0-9][a-z0-9\\-]*", @@ -378,7 +378,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/v1.OfflineVirtualMachine" + "$ref": "#/definitions/v1.VirtualMachineInstancePreset" } }, "401": { @@ -387,7 +387,7 @@ "default": { "description": "OK", "schema": { - "$ref": "#/definitions/v1.OfflineVirtualMachine" + "$ref": "#/definitions/v1.VirtualMachineInstancePreset" } } } @@ -401,15 +401,15 @@ "application/json", "application/yaml" ], - "summary": "Update a OfflineVirtualMachine object.", - "operationId": "replaceNamespacedOfflineVirtualMachine", + "summary": "Update a VirtualMachineInstancePreset object.", + "operationId": "replaceNamespacedVirtualMachineInstancePreset", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/v1.OfflineVirtualMachine" + "$ref": "#/definitions/v1.VirtualMachineInstancePreset" } }, { @@ -433,13 +433,13 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/v1.OfflineVirtualMachine" + "$ref": "#/definitions/v1.VirtualMachineInstancePreset" } }, "201": { "description": "Create", "schema": { - "$ref": "#/definitions/v1.OfflineVirtualMachine" + "$ref": "#/definitions/v1.VirtualMachineInstancePreset" } }, "401": { @@ -448,7 +448,7 @@ "default": { "description": "OK", "schema": { - "$ref": "#/definitions/v1.OfflineVirtualMachine" + "$ref": "#/definitions/v1.VirtualMachineInstancePreset" } } } @@ -462,8 +462,8 @@ "application/json", "application/yaml" ], - "summary": "Delete a OfflineVirtualMachine object.", - "operationId": "deleteNamespacedOfflineVirtualMachine", + "summary": "Delete a VirtualMachineInstancePreset object.", + "operationId": "deleteNamespacedVirtualMachineInstancePreset", "parameters": [ { "name": "body", @@ -534,8 +534,8 @@ "produces": [ "application/json" ], - "summary": "Patch a OfflineVirtualMachine object.", - "operationId": "patchNamespacedOfflineVirtualMachine", + "summary": "Patch a VirtualMachineInstancePreset object.", + "operationId": "patchNamespacedVirtualMachineInstancePreset", "parameters": [ { "name": "body", @@ -544,13 +544,29 @@ "schema": { "$ref": "#/definitions/v1.Patch" } + }, + { + "pattern": "[a-z0-9][a-z0-9\\-]*", + "type": "string", + "description": "Object name and auth scope, such as for teams and projects", + "name": "namespace", + "in": "path", + "required": true + }, + { + "pattern": "[a-z0-9][a-z0-9\\-]*", + "type": "string", + "description": "Name of the resource", + "name": "name", + "in": "path", + "required": true } ], "responses": { "200": { "description": "OK", "schema": { - "$ref": "#/definitions/v1.OfflineVirtualMachine" + "$ref": "#/definitions/v1.VirtualMachineInstancePreset" } }, "401": { @@ -559,21 +575,21 @@ "default": { "description": "OK", "schema": { - "$ref": "#/definitions/v1.OfflineVirtualMachine" + "$ref": "#/definitions/v1.VirtualMachineInstancePreset" } } } } }, - "/apis/kubevirt.io/v1alpha1/namespaces/{namespace}/virtualmachinepresets": { + "/apis/kubevirt.io/v1alpha2/namespaces/{namespace}/virtualmachineinstancereplicasets": { "get": { "produces": [ "application/json", "application/yaml", "application/json;stream=watch" ], - "summary": "Get a list of VirtualMachine objects.", - "operationId": "listNamespacedVirtualMachine", + "summary": "Get a list of VirtualMachineInstanceReplicaSet objects.", + "operationId": "listNamespacedVirtualMachineInstanceReplicaSet", "parameters": [ { "pattern": "[a-z0-9][a-z0-9\\-]*", @@ -636,7 +652,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/v1.VirtualMachinePresetList" + "$ref": "#/definitions/v1.VirtualMachineInstanceReplicaSetList" } }, "401": { @@ -645,7 +661,7 @@ "default": { "description": "OK", "schema": { - "$ref": "#/definitions/v1.VirtualMachinePresetList" + "$ref": "#/definitions/v1.VirtualMachineInstanceReplicaSetList" } } } @@ -659,15 +675,15 @@ "application/json", "application/yaml" ], - "summary": "Create a VirtualMachine object.", - "operationId": "createNamespacedVirtualMachine", + "summary": "Create a VirtualMachineInstanceReplicaSet object.", + "operationId": "createNamespacedVirtualMachineInstanceReplicaSet", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/v1.VirtualMachinePreset" + "$ref": "#/definitions/v1.VirtualMachineInstanceReplicaSet" } }, { @@ -683,19 +699,19 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/v1.VirtualMachinePreset" + "$ref": "#/definitions/v1.VirtualMachineInstanceReplicaSet" } }, "201": { "description": "Created", "schema": { - "$ref": "#/definitions/v1.VirtualMachinePreset" + "$ref": "#/definitions/v1.VirtualMachineInstanceReplicaSet" } }, "202": { "description": "Accepted", "schema": { - "$ref": "#/definitions/v1.VirtualMachinePreset" + "$ref": "#/definitions/v1.VirtualMachineInstanceReplicaSet" } }, "401": { @@ -704,7 +720,7 @@ "default": { "description": "OK", "schema": { - "$ref": "#/definitions/v1.VirtualMachinePreset" + "$ref": "#/definitions/v1.VirtualMachineInstanceReplicaSet" } } } @@ -714,8 +730,8 @@ "application/json", "application/yaml" ], - "summary": "Delete a collection of VirtualMachine objects.", - "operationId": "deleteCollectionNamespacedVirtualMachine", + "summary": "Delete a collection of VirtualMachineInstanceReplicaSet objects.", + "operationId": "deleteCollectionNamespacedVirtualMachineInstanceReplicaSet", "parameters": [ { "type": "string", @@ -785,15 +801,15 @@ } } }, - "/apis/kubevirt.io/v1alpha1/namespaces/{namespace}/virtualmachinepresets/{name}": { + "/apis/kubevirt.io/v1alpha2/namespaces/{namespace}/virtualmachineinstancereplicasets/{name}": { "get": { "produces": [ "application/json", "application/yaml", "application/json;stream=watch" ], - "summary": "Get a VirtualMachine object.", - "operationId": "readNamespacedVirtualMachine", + "summary": "Get a VirtualMachineInstanceReplicaSet object.", + "operationId": "readNamespacedVirtualMachineInstanceReplicaSet", "parameters": [ { "pattern": "[a-z0-9][a-z0-9\\-]*", @@ -828,7 +844,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/v1.VirtualMachinePreset" + "$ref": "#/definitions/v1.VirtualMachineInstanceReplicaSet" } }, "401": { @@ -837,7 +853,7 @@ "default": { "description": "OK", "schema": { - "$ref": "#/definitions/v1.VirtualMachinePreset" + "$ref": "#/definitions/v1.VirtualMachineInstanceReplicaSet" } } } @@ -851,15 +867,15 @@ "application/json", "application/yaml" ], - "summary": "Update a VirtualMachine object.", - "operationId": "replaceNamespacedVirtualMachine", + "summary": "Update a VirtualMachineInstanceReplicaSet object.", + "operationId": "replaceNamespacedVirtualMachineInstanceReplicaSet", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/v1.VirtualMachinePreset" + "$ref": "#/definitions/v1.VirtualMachineInstanceReplicaSet" } }, { @@ -883,13 +899,13 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/v1.VirtualMachinePreset" + "$ref": "#/definitions/v1.VirtualMachineInstanceReplicaSet" } }, "201": { "description": "Create", "schema": { - "$ref": "#/definitions/v1.VirtualMachinePreset" + "$ref": "#/definitions/v1.VirtualMachineInstanceReplicaSet" } }, "401": { @@ -898,7 +914,7 @@ "default": { "description": "OK", "schema": { - "$ref": "#/definitions/v1.VirtualMachinePreset" + "$ref": "#/definitions/v1.VirtualMachineInstanceReplicaSet" } } } @@ -912,8 +928,8 @@ "application/json", "application/yaml" ], - "summary": "Delete a VirtualMachine object.", - "operationId": "deleteNamespacedVirtualMachine", + "summary": "Delete a VirtualMachineInstanceReplicaSet object.", + "operationId": "deleteNamespacedVirtualMachineInstanceReplicaSet", "parameters": [ { "name": "body", @@ -984,8 +1000,8 @@ "produces": [ "application/json" ], - "summary": "Patch a VirtualMachine object.", - "operationId": "patchNamespacedVirtualMachine", + "summary": "Patch a VirtualMachineInstanceReplicaSet object.", + "operationId": "patchNamespacedVirtualMachineInstanceReplicaSet", "parameters": [ { "name": "body", @@ -994,13 +1010,29 @@ "schema": { "$ref": "#/definitions/v1.Patch" } + }, + { + "pattern": "[a-z0-9][a-z0-9\\-]*", + "type": "string", + "description": "Object name and auth scope, such as for teams and projects", + "name": "namespace", + "in": "path", + "required": true + }, + { + "pattern": "[a-z0-9][a-z0-9\\-]*", + "type": "string", + "description": "Name of the resource", + "name": "name", + "in": "path", + "required": true } ], "responses": { "200": { "description": "OK", "schema": { - "$ref": "#/definitions/v1.VirtualMachinePreset" + "$ref": "#/definitions/v1.VirtualMachineInstanceReplicaSet" } }, "401": { @@ -1009,21 +1041,21 @@ "default": { "description": "OK", "schema": { - "$ref": "#/definitions/v1.VirtualMachinePreset" + "$ref": "#/definitions/v1.VirtualMachineInstanceReplicaSet" } } } } }, - "/apis/kubevirt.io/v1alpha1/namespaces/{namespace}/virtualmachinereplicasets": { + "/apis/kubevirt.io/v1alpha2/namespaces/{namespace}/virtualmachineinstances": { "get": { "produces": [ "application/json", "application/yaml", "application/json;stream=watch" ], - "summary": "Get a list of VirtualMachineReplicaSet objects.", - "operationId": "listNamespacedVirtualMachineReplicaSet", + "summary": "Get a list of VirtualMachineInstance objects.", + "operationId": "listNamespacedVirtualMachineInstance", "parameters": [ { "pattern": "[a-z0-9][a-z0-9\\-]*", @@ -1086,7 +1118,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/v1.VirtualMachineReplicaSetList" + "$ref": "#/definitions/v1.VirtualMachineInstanceList" } }, "401": { @@ -1095,7 +1127,7 @@ "default": { "description": "OK", "schema": { - "$ref": "#/definitions/v1.VirtualMachineReplicaSetList" + "$ref": "#/definitions/v1.VirtualMachineInstanceList" } } } @@ -1109,15 +1141,15 @@ "application/json", "application/yaml" ], - "summary": "Create a VirtualMachineReplicaSet object.", - "operationId": "createNamespacedVirtualMachineReplicaSet", + "summary": "Create a VirtualMachineInstance object.", + "operationId": "createNamespacedVirtualMachineInstance", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/v1.VirtualMachineReplicaSet" + "$ref": "#/definitions/v1.VirtualMachineInstance" } }, { @@ -1133,19 +1165,19 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/v1.VirtualMachineReplicaSet" + "$ref": "#/definitions/v1.VirtualMachineInstance" } }, "201": { "description": "Created", "schema": { - "$ref": "#/definitions/v1.VirtualMachineReplicaSet" + "$ref": "#/definitions/v1.VirtualMachineInstance" } }, "202": { "description": "Accepted", "schema": { - "$ref": "#/definitions/v1.VirtualMachineReplicaSet" + "$ref": "#/definitions/v1.VirtualMachineInstance" } }, "401": { @@ -1154,7 +1186,7 @@ "default": { "description": "OK", "schema": { - "$ref": "#/definitions/v1.VirtualMachineReplicaSet" + "$ref": "#/definitions/v1.VirtualMachineInstance" } } } @@ -1164,8 +1196,8 @@ "application/json", "application/yaml" ], - "summary": "Delete a collection of VirtualMachineReplicaSet objects.", - "operationId": "deleteCollectionNamespacedVirtualMachineReplicaSet", + "summary": "Delete a collection of VirtualMachineInstance objects.", + "operationId": "deleteCollectionNamespacedVirtualMachineInstance", "parameters": [ { "type": "string", @@ -1235,15 +1267,15 @@ } } }, - "/apis/kubevirt.io/v1alpha1/namespaces/{namespace}/virtualmachinereplicasets/{name}": { + "/apis/kubevirt.io/v1alpha2/namespaces/{namespace}/virtualmachineinstances/{name}": { "get": { "produces": [ "application/json", "application/yaml", "application/json;stream=watch" ], - "summary": "Get a VirtualMachineReplicaSet object.", - "operationId": "readNamespacedVirtualMachineReplicaSet", + "summary": "Get a VirtualMachineInstance object.", + "operationId": "readNamespacedVirtualMachineInstance", "parameters": [ { "pattern": "[a-z0-9][a-z0-9\\-]*", @@ -1278,7 +1310,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/v1.VirtualMachineReplicaSet" + "$ref": "#/definitions/v1.VirtualMachineInstance" } }, "401": { @@ -1287,7 +1319,7 @@ "default": { "description": "OK", "schema": { - "$ref": "#/definitions/v1.VirtualMachineReplicaSet" + "$ref": "#/definitions/v1.VirtualMachineInstance" } } } @@ -1301,15 +1333,15 @@ "application/json", "application/yaml" ], - "summary": "Update a VirtualMachineReplicaSet object.", - "operationId": "replaceNamespacedVirtualMachineReplicaSet", + "summary": "Update a VirtualMachineInstance object.", + "operationId": "replaceNamespacedVirtualMachineInstance", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/v1.VirtualMachineReplicaSet" + "$ref": "#/definitions/v1.VirtualMachineInstance" } }, { @@ -1333,13 +1365,13 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/v1.VirtualMachineReplicaSet" + "$ref": "#/definitions/v1.VirtualMachineInstance" } }, "201": { "description": "Create", "schema": { - "$ref": "#/definitions/v1.VirtualMachineReplicaSet" + "$ref": "#/definitions/v1.VirtualMachineInstance" } }, "401": { @@ -1348,7 +1380,7 @@ "default": { "description": "OK", "schema": { - "$ref": "#/definitions/v1.VirtualMachineReplicaSet" + "$ref": "#/definitions/v1.VirtualMachineInstance" } } } @@ -1362,8 +1394,8 @@ "application/json", "application/yaml" ], - "summary": "Delete a VirtualMachineReplicaSet object.", - "operationId": "deleteNamespacedVirtualMachineReplicaSet", + "summary": "Delete a VirtualMachineInstance object.", + "operationId": "deleteNamespacedVirtualMachineInstance", "parameters": [ { "name": "body", @@ -1434,8 +1466,8 @@ "produces": [ "application/json" ], - "summary": "Patch a VirtualMachineReplicaSet object.", - "operationId": "patchNamespacedVirtualMachineReplicaSet", + "summary": "Patch a VirtualMachineInstance object.", + "operationId": "patchNamespacedVirtualMachineInstance", "parameters": [ { "name": "body", @@ -1444,13 +1476,29 @@ "schema": { "$ref": "#/definitions/v1.Patch" } + }, + { + "pattern": "[a-z0-9][a-z0-9\\-]*", + "type": "string", + "description": "Object name and auth scope, such as for teams and projects", + "name": "namespace", + "in": "path", + "required": true + }, + { + "pattern": "[a-z0-9][a-z0-9\\-]*", + "type": "string", + "description": "Name of the resource", + "name": "name", + "in": "path", + "required": true } ], "responses": { "200": { "description": "OK", "schema": { - "$ref": "#/definitions/v1.VirtualMachineReplicaSet" + "$ref": "#/definitions/v1.VirtualMachineInstance" } }, "401": { @@ -1459,13 +1507,13 @@ "default": { "description": "OK", "schema": { - "$ref": "#/definitions/v1.VirtualMachineReplicaSet" + "$ref": "#/definitions/v1.VirtualMachineInstance" } } } } }, - "/apis/kubevirt.io/v1alpha1/namespaces/{namespace}/virtualmachines": { + "/apis/kubevirt.io/v1alpha2/namespaces/{namespace}/virtualmachines": { "get": { "produces": [ "application/json", @@ -1685,7 +1733,7 @@ } } }, - "/apis/kubevirt.io/v1alpha1/namespaces/{namespace}/virtualmachines/{name}": { + "/apis/kubevirt.io/v1alpha2/namespaces/{namespace}/virtualmachines/{name}": { "get": { "produces": [ "application/json", @@ -1894,6 +1942,22 @@ "schema": { "$ref": "#/definitions/v1.Patch" } + }, + { + "pattern": "[a-z0-9][a-z0-9\\-]*", + "type": "string", + "description": "Object name and auth scope, such as for teams and projects", + "name": "namespace", + "in": "path", + "required": true + }, + { + "pattern": "[a-z0-9][a-z0-9\\-]*", + "type": "string", + "description": "Name of the resource", + "name": "name", + "in": "path", + "required": true } ], "responses": { @@ -1915,15 +1979,15 @@ } } }, - "/apis/kubevirt.io/v1alpha1/offlinevirtualmachines": { + "/apis/kubevirt.io/v1alpha2/virtualmachineinstancepresets": { "get": { "produces": [ "application/json", "application/yaml", "application/json;stream=watch" ], - "summary": "Get a list of all OfflineVirtualMachine objects.", - "operationId": "listOfflineVirtualMachineForAllNamespaces", + "summary": "Get a list of all VirtualMachineInstancePreset objects.", + "operationId": "listVirtualMachineInstancePresetForAllNamespaces", "parameters": [ { "type": "string", @@ -1978,7 +2042,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/v1.OfflineVirtualMachineList" + "$ref": "#/definitions/v1.VirtualMachineInstancePresetList" } }, "401": { @@ -1987,21 +2051,21 @@ "default": { "description": "OK", "schema": { - "$ref": "#/definitions/v1.OfflineVirtualMachineList" + "$ref": "#/definitions/v1.VirtualMachineInstancePresetList" } } } } }, - "/apis/kubevirt.io/v1alpha1/virtualmachinepresets": { + "/apis/kubevirt.io/v1alpha2/virtualmachineinstancereplicasets": { "get": { "produces": [ "application/json", "application/yaml", "application/json;stream=watch" ], - "summary": "Get a list of all VirtualMachine objects.", - "operationId": "listVirtualMachineForAllNamespaces", + "summary": "Get a list of all VirtualMachineInstanceReplicaSet objects.", + "operationId": "listVirtualMachineInstanceReplicaSetForAllNamespaces", "parameters": [ { "type": "string", @@ -2056,7 +2120,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/v1.VirtualMachinePresetList" + "$ref": "#/definitions/v1.VirtualMachineInstanceReplicaSetList" } }, "401": { @@ -2065,21 +2129,21 @@ "default": { "description": "OK", "schema": { - "$ref": "#/definitions/v1.VirtualMachinePresetList" + "$ref": "#/definitions/v1.VirtualMachineInstanceReplicaSetList" } } } } }, - "/apis/kubevirt.io/v1alpha1/virtualmachinereplicasets": { + "/apis/kubevirt.io/v1alpha2/virtualmachineinstances": { "get": { "produces": [ "application/json", "application/yaml", "application/json;stream=watch" ], - "summary": "Get a list of all VirtualMachineReplicaSet objects.", - "operationId": "listVirtualMachineReplicaSetForAllNamespaces", + "summary": "Get a list of all VirtualMachineInstance objects.", + "operationId": "listVirtualMachineInstanceForAllNamespaces", "parameters": [ { "type": "string", @@ -2134,7 +2198,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/v1.VirtualMachineReplicaSetList" + "$ref": "#/definitions/v1.VirtualMachineInstanceList" } }, "401": { @@ -2143,13 +2207,13 @@ "default": { "description": "OK", "schema": { - "$ref": "#/definitions/v1.VirtualMachineReplicaSetList" + "$ref": "#/definitions/v1.VirtualMachineInstanceList" } } } } }, - "/apis/kubevirt.io/v1alpha1/virtualmachines": { + "/apis/kubevirt.io/v1alpha2/virtualmachines": { "get": { "produces": [ "application/json", @@ -2227,13 +2291,13 @@ } } }, - "/apis/kubevirt.io/v1alpha1/watch/namespaces/{namespace}/offlinevirtualmachines": { + "/apis/kubevirt.io/v1alpha2/watch/namespaces/{namespace}/virtualmachineinstancepresets": { "get": { "produces": [ "application/json" ], - "summary": "Watch a OfflineVirtualMachine object.", - "operationId": "watchNamespacedOfflineVirtualMachine", + "summary": "Watch a VirtualMachineInstancePreset object.", + "operationId": "watchNamespacedVirtualMachineInstancePreset", "parameters": [ { "pattern": "[a-z0-9][a-z0-9\\-]*", @@ -2311,13 +2375,13 @@ } } }, - "/apis/kubevirt.io/v1alpha1/watch/namespaces/{namespace}/virtualmachinepresets": { + "/apis/kubevirt.io/v1alpha2/watch/namespaces/{namespace}/virtualmachineinstancereplicasets": { "get": { "produces": [ "application/json" ], - "summary": "Watch a VirtualMachine object.", - "operationId": "watchNamespacedVirtualMachine", + "summary": "Watch a VirtualMachineInstanceReplicaSet object.", + "operationId": "watchNamespacedVirtualMachineInstanceReplicaSet", "parameters": [ { "pattern": "[a-z0-9][a-z0-9\\-]*", @@ -2395,13 +2459,13 @@ } } }, - "/apis/kubevirt.io/v1alpha1/watch/namespaces/{namespace}/virtualmachinereplicasets": { + "/apis/kubevirt.io/v1alpha2/watch/namespaces/{namespace}/virtualmachineinstances": { "get": { "produces": [ "application/json" ], - "summary": "Watch a VirtualMachineReplicaSet object.", - "operationId": "watchNamespacedVirtualMachineReplicaSet", + "summary": "Watch a VirtualMachineInstance object.", + "operationId": "watchNamespacedVirtualMachineInstance", "parameters": [ { "pattern": "[a-z0-9][a-z0-9\\-]*", @@ -2479,7 +2543,7 @@ } } }, - "/apis/kubevirt.io/v1alpha1/watch/namespaces/{namespace}/virtualmachines": { + "/apis/kubevirt.io/v1alpha2/watch/namespaces/{namespace}/virtualmachines": { "get": { "produces": [ "application/json" @@ -2563,13 +2627,13 @@ } } }, - "/apis/kubevirt.io/v1alpha1/watch/offlinevirtualmachines": { + "/apis/kubevirt.io/v1alpha2/watch/virtualmachineinstancepresets": { "get": { "produces": [ "application/json" ], - "summary": "Watch a OfflineVirtualMachineList object.", - "operationId": "watchOfflineVirtualMachineListForAllNamespaces", + "summary": "Watch a VirtualMachineInstancePresetList object.", + "operationId": "watchVirtualMachineInstancePresetListForAllNamespaces", "parameters": [ { "type": "string", @@ -2639,13 +2703,13 @@ } } }, - "/apis/kubevirt.io/v1alpha1/watch/virtualmachinepresets": { + "/apis/kubevirt.io/v1alpha2/watch/virtualmachineinstancereplicasets": { "get": { "produces": [ "application/json" ], - "summary": "Watch a VirtualMachineList object.", - "operationId": "watchVirtualMachineListForAllNamespaces", + "summary": "Watch a VirtualMachineInstanceReplicaSetList object.", + "operationId": "watchVirtualMachineInstanceReplicaSetListForAllNamespaces", "parameters": [ { "type": "string", @@ -2715,13 +2779,13 @@ } } }, - "/apis/kubevirt.io/v1alpha1/watch/virtualmachinereplicasets": { + "/apis/kubevirt.io/v1alpha2/watch/virtualmachineinstances": { "get": { "produces": [ "application/json" ], - "summary": "Watch a VirtualMachineReplicaSetList object.", - "operationId": "watchVirtualMachineReplicaSetListForAllNamespaces", + "summary": "Watch a VirtualMachineInstanceList object.", + "operationId": "watchVirtualMachineInstanceListForAllNamespaces", "parameters": [ { "type": "string", @@ -2791,7 +2855,7 @@ } } }, - "/apis/kubevirt.io/v1alpha1/watch/virtualmachines": { + "/apis/kubevirt.io/v1alpha2/watch/virtualmachines": { "get": { "produces": [ "application/json" @@ -2893,7 +2957,7 @@ } } }, - "/apis/subresources.kubevirt.io/v1alpha1": { + "/apis/subresources.kubevirt.io/v1alpha2": { "get": { "produces": [ "application/json" @@ -2919,9 +2983,9 @@ } } }, - "/apis/subresources.kubevirt.io/v1alpha1/namespaces/{namespace}/virtualmachines/{name}/console": { + "/apis/subresources.kubevirt.io/v1alpha2/namespaces/{namespace}/virtualmachineinstances/{name}/console": { "get": { - "summary": "Open a websocket connection to a serial console on the specified VM.", + "summary": "Open a websocket connection to a serial console on the specified VirtualMachineInstance.", "operationId": "console", "parameters": [ { @@ -2948,7 +3012,7 @@ } } }, - "/apis/subresources.kubevirt.io/v1alpha1/namespaces/{namespace}/virtualmachines/{name}/test": { + "/apis/subresources.kubevirt.io/v1alpha2/namespaces/{namespace}/virtualmachineinstances/{name}/test": { "get": { "summary": "Test endpoint verifying apiserver connectivity.", "operationId": "test", @@ -2977,9 +3041,9 @@ } } }, - "/apis/subresources.kubevirt.io/v1alpha1/namespaces/{namespace}/virtualmachines/{name}/vnc": { + "/apis/subresources.kubevirt.io/v1alpha2/namespaces/{namespace}/virtualmachineinstances/{name}/vnc": { "get": { - "summary": "Open a websocket connection to connect to VNC on the specified VM.", + "summary": "Open a websocket connection to connect to VNC on the specified VirtualMachineInstance.", "operationId": "vnc", "parameters": [ { @@ -3005,9 +3069,101 @@ } } } + }, + "/apis/subresources.kubevirt.io/v1alpha2/version": { + "get": { + "produces": [ + "application/json" + ], + "operationId": "version", + "responses": { + "200": { + "description": "OK" + } + } + } } }, "definitions": { + "big.Int": { + "required": [ + "neg", + "abs" + ], + "properties": { + "abs": { + "type": "array", + "items": { + "$ref": "#/definitions/big.Word" + } + }, + "neg": { + "type": "boolean" + } + } + }, + "big.Word": {}, + "inf.Dec": { + "required": [ + "unscaled", + "scale" + ], + "properties": { + "scale": { + "$ref": "#/definitions/inf.Scale" + }, + "unscaled": { + "$ref": "#/definitions/big.Int" + } + } + }, + "resource.Quantity": { + "required": [ + "i", + "d", + "s", + "Format" + ], + "properties": { + "Format": { + "type": "string" + }, + "d": { + "$ref": "#/definitions/resource.infDecAmount" + }, + "i": { + "$ref": "#/definitions/resource.int64Amount" + }, + "s": { + "type": "string" + } + } + }, + "resource.infDecAmount": { + "required": [ + "Dec" + ], + "properties": { + "Dec": { + "$ref": "#/definitions/inf.Dec" + } + } + }, + "resource.int64Amount": { + "required": [ + "value", + "scale" + ], + "properties": { + "scale": { + "$ref": "#/definitions/resource.Scale" + }, + "value": { + "type": "integer", + "format": "int64" + } + } + }, "types.UID": {}, "v1.APIGroup": { "description": "APIGroup contains the name, the supported versions, and the preferred version of a group.", @@ -3158,51 +3314,63 @@ } }, "v1.Affinity": { - "description": "Affinity groups all the affinity rules related to a VM", + "description": "Affinity groups all the affinity rules related to a VirtualMachineInstance", "properties": { "nodeAffinity": { "description": "Node affinity support", "$ref": "#/definitions/v1.NodeAffinity" + }, + "podAffinity": { + "description": "Pod affinity support", + "$ref": "#/definitions/v1.PodAffinity" + }, + "podAntiAffinity": { + "description": "Pod anti-affinity support", + "$ref": "#/definitions/v1.PodAntiAffinity" } } }, "v1.CDRomTarget": { "properties": { "bus": { - "description": "Bus indicates the type of disk device to emulate.\nsupported values: virtio, sata, scsi, ide", + "description": "Bus indicates the type of disk device to emulate.\nsupported values: virtio, sata, scsi, ide.", "type": "string" }, "readonly": { - "description": "ReadOnly\nDefaults to true", + "description": "ReadOnly.\nDefaults to true.", "type": "boolean" }, "tray": { - "description": "Tray indicates if the tray of the device is open or closed.\nAllowed values are \"open\" and \"closed\"\nDefaults to closed\n+optional", + "description": "Tray indicates if the tray of the device is open or closed.\nAllowed values are \"open\" and \"closed\".\nDefaults to closed.\n+optional", "type": "string" } } }, "v1.CPU": { - "description": "CPU allow specifying the CPU topology", + "description": "CPU allows specifying the CPU topology.", "properties": { "cores": { - "description": "Cores specifies the number of cores inside the vm.\nMust be a value greater or equal 1.", + "description": "Cores specifies the number of cores inside the vmi.\nMust be a value greater or equal 1.", "type": "integer" + }, + "model": { + "description": "Model specifies the CPU model inside the VMI.\nList of available models https://github.com/libvirt/libvirt/blob/master/src/cpu/cpu_map.xml.\n+optional", + "type": "string" } } }, "v1.Clock": { - "description": "Represents the clock and timers of a vm", + "description": "Represents the clock and timers of a vmi.", "required": [ "timer" ], "properties": { "timer": { - "description": "Timer specifies whih timers are attached to the vm", + "description": "Timer specifies whih timers are attached to the vmi.", "$ref": "#/definitions/v1.Timer" }, "timezone": { - "description": "Timezone sets the guest clock to the specified timezone.\nZone name follows the TZ environment variable format (e.g. 'America/New_York')", + "description": "Timezone sets the guest clock to the specified timezone.\nZone name follows the TZ environment variable format (e.g. 'America/New_York').", "$ref": "#/definitions/v1.ClockOffsetTimezone" }, "utc": { @@ -3223,18 +3391,18 @@ } }, "v1.CloudInitNoCloudSource": { - "description": "Represents a cloud-init nocloud user data source\nMore info: http://cloudinit.readthedocs.io/en/latest/topics/datasources/nocloud.html", + "description": "Represents a cloud-init nocloud user data source.\nMore info: http://cloudinit.readthedocs.io/en/latest/topics/datasources/nocloud.html", "properties": { "secretRef": { - "description": "UserDataSecretRef references a k8s secret that contains NoCloud userdata\n+ optional", + "description": "UserDataSecretRef references a k8s secret that contains NoCloud userdata.\n+ optional", "$ref": "#/definitions/v1.LocalObjectReference" }, "userData": { - "description": "UserData contains NoCloud inline cloud-init userdata\n+ optional", + "description": "UserData contains NoCloud inline cloud-init userdata.\n+ optional", "type": "string" }, "userDataBase64": { - "description": "UserDataBase64 contains NoCloud cloud-init userdata as a base64 encoded string\n+ optional", + "description": "UserDataBase64 contains NoCloud cloud-init userdata as a base64 encoded string.\n+ optional", "type": "string" } } @@ -3273,14 +3441,21 @@ "v1.Devices": { "properties": { "disks": { - "description": "Disks describes disks, cdroms, floppy and luns which are connected to the vm", + "description": "Disks describes disks, cdroms, floppy and luns which are connected to the vmi.", "type": "array", "items": { "$ref": "#/definitions/v1.Disk" } }, + "interfaces": { + "description": "Interfaces describe network interfaces which are added to the vm.", + "type": "array", + "items": { + "$ref": "#/definitions/v1.Interface" + } + }, "watchdog": { - "description": "Watchdog describes a watchdog device which can be added to the vm", + "description": "Watchdog describes a watchdog device which can be added to the vmi.", "$ref": "#/definitions/v1.Watchdog" } } @@ -3291,28 +3466,37 @@ "volumeName" ], "properties": { + "bootOrder": { + "description": "BootOrder is an integer value \u003e 0, used to determine ordering of boot devices.\nLower values take precedence.\nDisks without a boot order are not tried if a disk with a boot order exists.\n+optional", + "type": "integer", + "format": "integer" + }, "cdrom": { - "description": "Attach a volume as a cdrom to the vm", + "description": "Attach a volume as a cdrom to the vmi.", "$ref": "#/definitions/v1.CDRomTarget" }, "disk": { - "description": "Attach a volume as a disk to the vm", + "description": "Attach a volume as a disk to the vmi.", "$ref": "#/definitions/v1.DiskTarget" }, "floppy": { - "description": "Attach a volume as a floppy to the vm", + "description": "Attach a volume as a floppy to the vmi.", "$ref": "#/definitions/v1.FloppyTarget" }, "lun": { - "description": "Attach a volume as a LUN to the vm", + "description": "Attach a volume as a LUN to the vmi.", "$ref": "#/definitions/v1.LunTarget" }, "name": { "description": "Name is the device name", "type": "string" }, + "serial": { + "description": "Serial provides the ability to specify a serial number for the disk device.\n+optional", + "type": "string" + }, "volumeName": { - "description": "Name of the volume which is referenced\nMust match the Name of a Volume.", + "description": "Name of the volume which is referenced.\nMust match the Name of a Volume.", "type": "string" } } @@ -3320,26 +3504,62 @@ "v1.DiskTarget": { "properties": { "bus": { - "description": "Bus indicates the type of disk device to emulate.\nsupported values: virtio, sata, scsi, ide", + "description": "Bus indicates the type of disk device to emulate.\nsupported values: virtio, sata, scsi, ide.", "type": "string" }, "readonly": { - "description": "ReadOnly\nDefaults to false", + "description": "ReadOnly.\nDefaults to false.", "type": "boolean" } } }, + "v1.DomainPresetSpec": { + "properties": { + "clock": { + "description": "Clock sets the clock and timers of the vmi.\n+optional", + "$ref": "#/definitions/v1.Clock" + }, + "cpu": { + "description": "CPU allow specified the detailed CPU topology inside the vmi.\n+optional", + "$ref": "#/definitions/v1.CPU" + }, + "devices": { + "description": "Devices allows adding disks, network interfaces, ...\n+optional", + "$ref": "#/definitions/v1.Devices" + }, + "features": { + "description": "Features like acpi, apic, hyperv.\n+optional", + "$ref": "#/definitions/v1.Features" + }, + "firmware": { + "description": "Firmware.\n+optional", + "$ref": "#/definitions/v1.Firmware" + }, + "machine": { + "description": "Machine type.\n+optional", + "$ref": "#/definitions/v1.Machine" + }, + "memory": { + "description": "Memory allow specifying the VMI memory features.\n+optional", + "$ref": "#/definitions/v1.Memory" + }, + "resources": { + "description": "Resources describes the Compute Resources required by this vmi.", + "$ref": "#/definitions/v1.ResourceRequirements" + } + } + }, "v1.DomainSpec": { "required": [ "devices" ], "properties": { "clock": { - "description": "Clock sets the clock and timers of the vm.\n+optional", + "description": "Clock sets the clock and timers of the vmi.\n+optional", "$ref": "#/definitions/v1.Clock" }, "cpu": { - "description": "CPU allow specified the detailed CPU topology inside the vm.\n+optional", + "description": "CPU allow specified the detailed CPU topology inside the vmi.\n+optional", "$ref": "#/definitions/v1.CPU" }, "devices": { @@ -3347,25 +3567,29 @@ "$ref": "#/definitions/v1.Devices" }, "features": { - "description": "Features like acpi, apic, hyperv\n+optional", + "description": "Features like acpi, apic, hyperv.\n+optional", "$ref": "#/definitions/v1.Features" }, "firmware": { - "description": "Firmware\n+optional", + "description": "Firmware.\n+optional", "$ref": "#/definitions/v1.Firmware" }, "machine": { - "description": "Machine type\n+optional", + "description": "Machine type.\n+optional", "$ref": "#/definitions/v1.Machine" }, + "memory": { + "description": "Memory allow specifying the VMI memory features.\n+optional", + "$ref": "#/definitions/v1.Memory" + }, "resources": { - "description": "Resources describes the Compute Resources required by this vm.", + "description": "Resources describes the Compute Resources required by this vmi.", "$ref": "#/definitions/v1.ResourceRequirements" } } }, "v1.EmptyDiskSource": { - "description": "EmptyDisk represents a temporary disk which shares the vms lifecycle", + "description": "EmptyDisk represents a temporary disk which shares the vmis lifecycle.", "required": [ "capacity" ], @@ -3379,7 +3603,7 @@ "v1.EphemeralVolumeSource": { "properties": { "persistentVolumeClaim": { - "description": "PersistentVolumeClaimVolumeSource represents a reference to a PersistentVolumeClaim in the same namespace.\nDirectly attached to the vm via qemu.\nMore info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims\n+optional", + "description": "PersistentVolumeClaimVolumeSource represents a reference to a PersistentVolumeClaim in the same namespace.\nDirectly attached to the vmi via qemu.\nMore info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims\n+optional", "$ref": "#/definitions/v1.PersistentVolumeClaimVolumeSource" } } @@ -3387,52 +3611,52 @@ "v1.FeatureAPIC": { "properties": { "enabled": { - "description": "Enabled determines if the feature should be enabled or disabled on the guest\nDefaults to true\n+optional", + "description": "Enabled determines if the feature should be enabled or disabled on the guest.\nDefaults to true.\n+optional", "type": "boolean" }, "endOfInterrupt": { - "description": "EndOfInterrupt enables the end of interrupt notification in the guest\nDefaults to false\n+optional", + "description": "EndOfInterrupt enables the end of interrupt notification in the guest.\nDefaults to false.\n+optional", "type": "boolean" } } }, "v1.FeatureHyperv": { - "description": "Hyperv specific features", + "description": "Hyperv specific features.", "properties": { "relaxed": { - "description": "Relaxed relaxes constraints on timer\nDefaults to the machine type setting\n+optional", + "description": "Relaxed relaxes constraints on timer.\nDefaults to the machine type setting.\n+optional", "$ref": "#/definitions/v1.FeatureState" }, "reset": { - "description": "Reset enables Hyperv reboot/reset for the vm\nDefaults to the machine type setting\n+optional", + "description": "Reset enables Hyperv reboot/reset for the vmi.\nDefaults to the machine type setting.\n+optional", "$ref": "#/definitions/v1.FeatureState" }, "runtime": { - "description": "Runtime\nDefaults to the machine type setting\n+optional", + "description": "Runtime.\nDefaults to the machine type setting.\n+optional", "$ref": "#/definitions/v1.FeatureState" }, "spinlocks": { - "description": "Spinlocks indicates if spinlocks should be made available to the guest\n+optional", + "description": "Spinlocks indicates if spinlocks should be made available to the guest.\n+optional", "$ref": "#/definitions/v1.FeatureSpinlocks" }, "synic": { - "description": "SyNIC enable Synthetic Interrupt Controller\nDefaults to the machine type setting\n+optional", + "description": "SyNIC enable Synthetic Interrupt Controller.\nDefaults to the machine type setting.\n+optional", "$ref": "#/definitions/v1.FeatureState" }, "synictimer": { - "description": "SyNICTimer enable Synthetic Interrupt Controller timer\nDefaults to the machine type setting\n+optional", + "description": "SyNICTimer enable Synthetic Interrupt Controller timer.\nDefaults to the machine type setting.\n+optional", "$ref": "#/definitions/v1.FeatureState" }, "vapic": { - "description": "VAPIC indicates whether virtual APIC is enabled\nDefaults to the machine type setting\n+optional", + "description": "VAPIC indicates whether virtual APIC is enabled.\nDefaults to the machine type setting.\n+optional", "$ref": "#/definitions/v1.FeatureState" }, "vendorid": { - "description": "VendorID allows setting the hypervisor vendor id\nDefaults to the machine type setting\n+optional", + "description": "VendorID allows setting the hypervisor vendor id.\nDefaults to the machine type setting.\n+optional", "$ref": "#/definitions/v1.FeatureVendorID" }, "vpindex": { - "description": "VPIndex enables the Virtual Processor Index to help windows identifying virtual processors\nDefaults to the machine type setting\n+optional", + "description": "VPIndex enables the Virtual Processor Index to help windows identifying virtual processors.\nDefaults to the machine type setting.\n+optional", "$ref": "#/definitions/v1.FeatureState" } } @@ -3440,20 +3664,20 @@ "v1.FeatureSpinlocks": { "properties": { "enabled": { - "description": "Enabled determines if the feature should be enabled or disabled on the guest\nDefaults to true\n+optional", + "description": "Enabled determines if the feature should be enabled or disabled on the guest.\nDefaults to true.\n+optional", "type": "boolean" }, "spinlocks": { - "description": "Retries indicates the number of retries\nMust be a value greater or equal 4096\nDefaults to 4096\n+optional", + "description": "Retries indicates the number of retries.\nMust be a value greater or equal 4096.\nDefaults to 4096.\n+optional", "type": "integer" } } }, "v1.FeatureState": { - "description": "Represents if a feature is enabled or disabled", + "description": "Represents if a feature is enabled or disabled.", "properties": { "enabled": { - "description": "Enabled determines if the feature should be enabled or disabled on the guest\nDefaults to true\n+optional", + "description": "Enabled determines if the feature should be enabled or disabled on the guest.\nDefaults to true.\n+optional", "type": "boolean" } } @@ -3461,11 +3685,11 @@ "v1.FeatureVendorID": { "properties": { "enabled": { - "description": "Enabled determines if the feature should be enabled or disabled on the guest\nDefaults to true\n+optional", + "description": "Enabled determines if the feature should be enabled or disabled on the guest.\nDefaults to true.\n+optional", "type": "boolean" }, "vendorid": { - "description": "VendorID sets the hypervisor vendor id, visible to the vm\nString up to twelve characters", + "description": "VendorID sets the hypervisor vendor id, visible to the vmi.\nString up to twelve characters.", "type": "string" } } @@ -3473,15 +3697,15 @@ "v1.Features": { "properties": { "acpi": { - "description": "ACPI enables/disables ACPI insidejsondata guest\nDefaults to enabled\n+optional", + "description": "ACPI enables/disables ACPI insidejsondata guest.\nDefaults to enabled.\n+optional", "$ref": "#/definitions/v1.FeatureState" }, "apic": { - "description": "Defaults to the machine type setting\n+optional", + "description": "Defaults to the machine type setting.\n+optional", "$ref": "#/definitions/v1.FeatureAPIC" }, "hyperv": { - "description": "Defaults to the machine type setting\n+optional", + "description": "Defaults to the machine type setting.\n+optional", "$ref": "#/definitions/v1.FeatureHyperv" } } @@ -3489,7 +3713,7 @@ "v1.Firmware": { "properties": { "uuid": { - "description": "UUID reported by the vm bios\nDefaults to a random generated uid", + "description": "UUID reported by the vmi bios.\nDefaults to a random generated uid.", "type": "string" } } @@ -3497,11 +3721,11 @@ "v1.FloppyTarget": { "properties": { "readonly": { - "description": "ReadOnly\nDefaults to false", + "description": "ReadOnly.\nDefaults to false.", "type": "boolean" }, "tray": { - "description": "Tray indicates if the tray of the device is open or closed.\nAllowed values are \"open\" and \"closed\"\nDefaults to closed\n+optional", + "description": "Tray indicates if the tray of the device is open or closed.\nAllowed values are \"open\" and \"closed\".\nDefaults to closed.\n+optional", "type": "string" } } @@ -3526,11 +3750,20 @@ "v1.HPETTimer": { "properties": { "present": { - "description": "Enabled set to false makes sure that the machine type or a preset can't add the timer.\nDefaults to true\n+optional", + "description": "Enabled set to false makes sure that the machine type or a preset can't add the timer.\nDefaults to true.\n+optional", "type": "boolean" }, "tickPolicy": { - "description": "TickPolicy determines what happens when QEMU misses a deadline for injecting a tick to the guest\nOne of \"delay\", \"catchup\", \"merge\", \"discard\"", + "description": "TickPolicy determines what happens when QEMU misses a deadline for injecting a tick to the guest.\nOne of \"delay\", \"catchup\", \"merge\", \"discard\".", + "type": "string" + } + } + }, + "v1.Hugepages": { + "description": "Hugepages allow to use hugepages for the VirtualMachineInstance instead of regular memory.", + "properties": { + "pageSize": { + "description": "PageSize specifies the hugepage size, for x86_64 architecture valid values are 1Gi and 2Mi.", "type": "string" } } @@ -3538,16 +3771,16 @@ "v1.HypervTimer": { "properties": { "present": { - "description": "Enabled set to false makes sure that the machine type or a preset can't add the timer.\nDefaults to true\n+optional", + "description": "Enabled set to false makes sure that the machine type or a preset can't add the timer.\nDefaults to true.\n+optional", "type": "boolean" } } }, "v1.I6300ESBWatchdog": { - "description": "i6300esb watchdog device", + "description": "i6300esb watchdog device.", "properties": { "action": { - "description": "The action to take. Valid values are poweroff, reset, shutdown.\nDefaults to reset", + "description": "The action to take. Valid values are poweroff, reset, shutdown.\nDefaults to reset.", "type": "string" } } @@ -3583,10 +3816,44 @@ } } }, + "v1.Interface": { + "required": [ + "name" + ], + "properties": { + "bridge": { + "$ref": "#/definitions/v1.InterfaceBridge" + }, + "macAddress": { + "description": "Interface MAC address. For example: de:ad:00:00:be:af or DE-AD-00-00-BE-AF.", + "type": "string" + }, + "model": { + "description": "Interface model.\nOne of: e1000, e1000e, ne2k_pci, pcnet, rtl8139, virtio.\nDefaults to virtio.", + "type": "string" + }, + "name": { + "description": "Logical name of the interface as well as a reference to the associated networks.\nMust match the Name of a Network.", + "type": "string" + }, + "ports": { + "description": "List of ports to be forwarded to the virtual machine.", + "type": "array", + "items": { + "$ref": "#/definitions/v1.Port" + } + }, + "slirp": { + "$ref": "#/definitions/v1.InterfaceSlirp" + } + } + }, + "v1.InterfaceBridge": {}, + "v1.InterfaceSlirp": {}, "v1.KVMTimer": { "properties": { "present": { - "description": "Enabled set to false makes sure that the machine type or a preset can't add the timer.\nDefaults to true\n+optional", + "description": "Enabled set to false makes sure that the machine type or a preset can't add the timer.\nDefaults to true.\n+optional", "type": "boolean" } } @@ -3603,7 +3870,10 @@ }, "matchLabels": { "description": "matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.", - "type": "object" + "type": "object", + "additionalProperties": { + "type": "string" + } } } }, @@ -3660,11 +3930,11 @@ "v1.LunTarget": { "properties": { "bus": { - "description": "Bus indicates the type of disk device to emulate.\nsupported values: virtio, sata, scsi, ide", + "description": "Bus indicates the type of disk device to emulate.\nsupported values: virtio, sata, scsi, ide.", "type": "string" }, "readonly": { - "description": "ReadOnly\nDefaults to false", + "description": "ReadOnly.\nDefaults to false.", "type": "boolean" } } @@ -3675,8 +3945,32 @@ ], "properties": { "type": { - "description": "QEMU machine type is the actual chipset of the VM.", + "description": "QEMU machine type is the actual chipset of the VirtualMachineInstance.", + "type": "string" + } + } + }, + "v1.Memory": { + "description": "Memory allows specifying the VirtualMachineInstance memory features.", + "properties": { + "hugepages": { + "description": "Hugepages allow to use hugepages for the VirtualMachineInstance instead of regular memory.\n+optional", + "$ref": "#/definitions/v1.Hugepages" + } + } + }, + "v1.Network": { + "description": "Network represents a network type and a resource that should be connected to the vm.", + "required": [ + "name" + ], + "properties": { + "name": { + "description": "Network name.\nMust be a DNS_LABEL and unique within the vm.\nMore info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", "type": "string" + }, + "pod": { + "$ref": "#/definitions/v1.PodNetwork" } } }, @@ -3755,7 +4049,10 @@ "properties": { "annotations": { "description": "Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects. More info: http://kubernetes.io/docs/user-guide/annotations", - "type": "object" + "type": "object", + "additionalProperties": { + "type": "string" + } }, "clusterName": { "description": "The name of the cluster which the object belongs to. This is used to distinguish resources with same name and namespace in different clusters. This field is not set anywhere right now and apiserver is going to ignore it if set in create or update request.", @@ -3796,7 +4093,10 @@ }, "labels": { "description": "Map of string keys and values that can be used to organize and categorize (scope and select) objects. May match selectors of replication controllers and services. More info: http://kubernetes.io/docs/user-guide/labels", - "type": "object" + "type": "object", + "additionalProperties": { + "type": "string" + } }, "name": { "description": "Name must be unique within a namespace. Is required when creating resources, although some resources may allow a client to request the generation of an appropriate name automatically. Name is primarily intended for creation idempotence and configuration definition. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/identifiers#names", @@ -3827,176 +4127,160 @@ } } }, - "v1.OfflineVirtualMachine": { - "description": "OfflineVirtualMachine handles the VirtualMachines that are not running\nor are in a stopped state\nThe OfflineVirtualMachine contains the template to create the\nVirtualMachine. It also mirrors the running state of the created\nVirtualMachine in its status.", + "v1.OwnerReference": { + "description": "OwnerReference contains enough information to let you identify an owning object. Currently, an owning object must be in the same namespace, so there is no namespace field.", + "required": [ + "apiVersion", + "kind", + "name", + "uid" + ], "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", + "description": "API version of the referent.", "type": "string" }, + "blockOwnerDeletion": { + "description": "If true, AND if the owner has the \"foregroundDeletion\" finalizer, then the owner cannot be deleted from the key-value store until this reference is removed. Defaults to false. To set this field, a user needs \"delete\" permission of the owner, otherwise 422 (Unprocessable Entity) will be returned.", + "type": "boolean" + }, + "controller": { + "description": "If true, this reference points to the managing controller.", + "type": "boolean" + }, "kind": { - "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "description": "Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", "type": "string" }, - "metadata": { - "$ref": "#/definitions/v1.ObjectMeta" - }, - "spec": { - "description": "Spec contains the specification of VirtualMachine created", - "$ref": "#/definitions/v1.OfflineVirtualMachineSpec" + "name": { + "description": "Name of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#names", + "type": "string" }, - "status": { - "description": "Status holds the current state of the controller and brief information\nabout its associated VirtualMachine", - "$ref": "#/definitions/v1.OfflineVirtualMachineStatus" + "uid": { + "description": "UID of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#uids", + "type": "string" } } }, - "v1.OfflineVirtualMachineCondition": { - "description": "OfflineVirtualMachineCondition represents the state of OfflineVirtualMachine", - "required": [ - "type", - "status" - ], + "v1.PITTimer": { "properties": { - "lastProbeTime": { - "type": "string" - }, - "lastTransitionTime": { - "type": "string" - }, - "message": { - "type": "string" - }, - "reason": { - "type": "string" - }, - "status": { - "type": "string" + "present": { + "description": "Enabled set to false makes sure that the machine type or a preset can't add the timer.\nDefaults to true.\n+optional", + "type": "boolean" }, - "type": { + "tickPolicy": { + "description": "TickPolicy determines what happens when QEMU misses a deadline for injecting a tick to the guest.\nOne of \"delay\", \"catchup\", \"discard\".", "type": "string" } } }, - "v1.OfflineVirtualMachineList": { - "description": "OfflineVirtualMachineList is a list of offlinevirtualmachines", + "v1.Patch": { + "description": "Patch is provided to give a concrete name and type to the Kubernetes PATCH request body." + }, + "v1.PersistentVolumeClaimVolumeSource": { + "description": "PersistentVolumeClaimVolumeSource references the user's PVC in the same namespace. This volume finds the bound PV and mounts that volume for the pod. A PersistentVolumeClaimVolumeSource is, essentially, a wrapper around another type of volume that is owned by someone else (the system).", "required": [ - "metadata", - "items" + "claimName" ], "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", + "claimName": { + "description": "ClaimName is the name of a PersistentVolumeClaim in the same namespace as the pod using this volume. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims", "type": "string" }, - "items": { - "description": "Items is a list of OfflineVirtualMachines", + "readOnly": { + "description": "Will force the ReadOnly setting in VolumeMounts. Default false.", + "type": "boolean" + } + } + }, + "v1.PodAffinity": { + "description": "Pod affinity is a group of inter pod affinity scheduling rules.", + "properties": { + "preferredDuringSchedulingIgnoredDuringExecution": { + "description": "The scheduler will prefer to schedule pods to nodes that satisfy the affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding \"weight\" to the sum if the node has pods which matches the corresponding podAffinityTerm; the node(s) with the highest sum are the most preferred.", "type": "array", "items": { - "$ref": "#/definitions/v1.OfflineVirtualMachine" + "$ref": "#/definitions/v1.WeightedPodAffinityTerm" } }, - "kind": { - "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", - "type": "string" - }, - "metadata": { - "$ref": "#/definitions/v1.ListMeta" + "requiredDuringSchedulingIgnoredDuringExecution": { + "description": "If the affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to a pod label update), the system may or may not try to eventually evict the pod from its node. When there are multiple elements, the lists of nodes corresponding to each podAffinityTerm are intersected, i.e. all terms must be satisfied.", + "type": "array", + "items": { + "$ref": "#/definitions/v1.PodAffinityTerm" + } } } }, - "v1.OfflineVirtualMachineSpec": { - "description": "OfflineVirtualMachineSpec describes how the proper OfflineVirtualMachine\nshould look like", + "v1.PodAffinityTerm": { + "description": "Defines a set of pods (namely those matching the labelSelector relative to the given namespace(s)) that this pod should be co-located (affinity) or not co-located (anti-affinity) with, where co-located is defined as running on a node whose value of the label with key \u003ctopologyKey\u003e matches that of any node on which a pod of the set of pods is running", "required": [ - "running", - "template" + "topologyKey" ], "properties": { - "running": { - "description": "Running controlls whether the associatied VirtualMachine is created or not", - "type": "boolean" + "labelSelector": { + "description": "A label query over a set of resources, in this case pods.", + "$ref": "#/definitions/v1.LabelSelector" }, - "template": { - "description": "Template is the direct specification of VirtualMachine", - "$ref": "#/definitions/v1.VMTemplateSpec" - } - } - }, - "v1.OfflineVirtualMachineStatus": { - "description": "OfflineVirtualMachineStatus represents the status returned by the\ncontroller to describe how the OfflineVirtualMachine is doing", - "properties": { - "conditions": { - "description": "Hold the state information of the OfflineVirtualMachine and its VirtualMachine", + "namespaces": { + "description": "namespaces specifies which namespaces the labelSelector applies to (matches against); null or empty list means \"this pod's namespace\"", "type": "array", "items": { - "$ref": "#/definitions/v1.OfflineVirtualMachineCondition" + "type": "string" } + }, + "topologyKey": { + "description": "This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching the labelSelector in the specified namespaces, where co-located is defined as running on a node whose value of the label with key topologyKey matches that of any node on which any of the selected pods is running. Empty topologyKey is not allowed.", + "type": "string" } } }, - "v1.OwnerReference": { - "description": "OwnerReference contains enough information to let you identify an owning object. Currently, an owning object must be in the same namespace, so there is no namespace field.", - "required": [ - "apiVersion", - "kind", - "name", - "uid" - ], + "v1.PodAntiAffinity": { + "description": "Pod anti affinity is a group of inter pod anti affinity scheduling rules.", "properties": { - "apiVersion": { - "description": "API version of the referent.", - "type": "string" - }, - "blockOwnerDeletion": { - "description": "If true, AND if the owner has the \"foregroundDeletion\" finalizer, then the owner cannot be deleted from the key-value store until this reference is removed. Defaults to false. To set this field, a user needs \"delete\" permission of the owner, otherwise 422 (Unprocessable Entity) will be returned.", - "type": "boolean" - }, - "controller": { - "description": "If true, this reference points to the managing controller.", - "type": "boolean" - }, - "kind": { - "description": "Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", - "type": "string" - }, - "name": { - "description": "Name of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#names", - "type": "string" + "preferredDuringSchedulingIgnoredDuringExecution": { + "description": "The scheduler will prefer to schedule pods to nodes that satisfy the anti-affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling anti-affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding \"weight\" to the sum if the node has pods which matches the corresponding podAffinityTerm; the node(s) with the highest sum are the most preferred.", + "type": "array", + "items": { + "$ref": "#/definitions/v1.WeightedPodAffinityTerm" + } }, - "uid": { - "description": "UID of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#uids", - "type": "string" + "requiredDuringSchedulingIgnoredDuringExecution": { + "description": "If the anti-affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the anti-affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to a pod label update), the system may or may not try to eventually evict the pod from its node. When there are multiple elements, the lists of nodes corresponding to each podAffinityTerm are intersected, i.e. all terms must be satisfied.", + "type": "array", + "items": { + "$ref": "#/definitions/v1.PodAffinityTerm" + } } } }, - "v1.PITTimer": { + "v1.PodNetwork": { + "description": "Represents the stock pod network interface.", "properties": { - "present": { - "description": "Enabled set to false makes sure that the machine type or a preset can't add the timer.\nDefaults to true\n+optional", - "type": "boolean" - }, - "tickPolicy": { - "description": "TickPolicy determines what happens when QEMU misses a deadline for injecting a tick to the guest\nOne of \"delay\", \"catchup\", \"discard\"", + "vmNetworkCIDR": { + "description": "CIDR for vm network.\nDefault 10.0.2.0/24 if not specified.", "type": "string" } } }, - "v1.Patch": { - "description": "Patch is provided to give a concrete name and type to the Kubernetes PATCH request body." - }, - "v1.PersistentVolumeClaimVolumeSource": { - "description": "PersistentVolumeClaimVolumeSource references the user's PVC in the same namespace. This volume finds the bound PV and mounts that volume for the pod. A PersistentVolumeClaimVolumeSource is, essentially, a wrapper around another type of volume that is owned by someone else (the system).", + "v1.Port": { + "description": "Port repesents a port to expose from the virtual machine.\nDefault protocol TCP.\nThe port field is mandatory", "required": [ - "claimName" + "port" ], "properties": { - "claimName": { - "description": "ClaimName is the name of a PersistentVolumeClaim in the same namespace as the pod using this volume. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims", + "name": { + "description": "If specified, this must be an IANA_SVC_NAME and unique within the pod. Each\nnamed port in a pod must have a unique name. Name for the port that can be\nreferred to by services.\n+optional", "type": "string" }, - "readOnly": { - "description": "Will force the ReadOnly setting in VolumeMounts. Default false.", - "type": "boolean" + "port": { + "description": "Number of port to expose for the virtual machine.\nThis must be a valid port number, 0 \u003c x \u003c 65536.", + "type": "integer", + "format": "int32" + }, + "protocol": { + "description": "Protocol for port. Must be UDP or TCP.\nDefaults to \"TCP\".\n+optional", + "type": "string" } } }, @@ -4030,27 +4314,27 @@ "v1.RTCTimer": { "properties": { "present": { - "description": "Enabled set to false makes sure that the machine type or a preset can't add the timer.\nDefaults to true\n+optional", + "description": "Enabled set to false makes sure that the machine type or a preset can't add the timer.\nDefaults to true.\n+optional", "type": "boolean" }, "tickPolicy": { - "description": "TickPolicy determines what happens when QEMU misses a deadline for injecting a tick to the guest\nOne of \"delay\", \"catchup\"", + "description": "TickPolicy determines what happens when QEMU misses a deadline for injecting a tick to the guest.\nOne of \"delay\", \"catchup\".", "type": "string" }, "track": { - "description": "Track the guest or the wall clock", + "description": "Track the guest or the wall clock.", "type": "string" } } }, "v1.RegistryDiskSource": { - "description": "Represents a docker image with an embedded disk", + "description": "Represents a docker image with an embedded disk.", "required": [ "image" ], "properties": { "image": { - "description": "Image is the name of the image with the embedded disk", + "description": "Image is the name of the image with the embedded disk.", "type": "string" }, "imagePullSecret": { @@ -4063,11 +4347,17 @@ "properties": { "limits": { "description": "Limits describes the maximum amount of compute resources allowed.\nValid resource keys are \"memory\" and \"cpu\".\n+optional", - "type": "object" + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/resource.Quantity" + } }, "requests": { - "description": "Requests is a description of the initial vm resources.\nValid resource keys are \"memory\" and \"cpu\".\n+optional", - "type": "object" + "description": "Requests is a description of the initial vmi resources.\nValid resource keys are \"memory\" and \"cpu\".\n+optional", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/resource.Quantity" + } } } }, @@ -4177,7 +4467,7 @@ } }, "v1.Timer": { - "description": "Represents all available timers in a vm", + "description": "Represents all available timers in a vmi.", "properties": { "hpet": { "description": "HPET (High Precision Event Timer) - multiple timers with periodic interrupts.", @@ -4201,7 +4491,32 @@ } } }, - "v1.VMReplicaSetCondition": { + "v1.VirtualMachine": { + "description": "VirtualMachine handles the VirtualMachines that are not running\nor are in a stopped state\nThe VirtualMachine contains the template to create the\nVirtualMachineInstance. It also mirrors the running state of the created\nVirtualMachineInstance in its 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", + "type": "string" + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "$ref": "#/definitions/v1.ObjectMeta" + }, + "spec": { + "description": "Spec contains the specification of VirtualMachineInstance created", + "$ref": "#/definitions/v1.VirtualMachineSpec" + }, + "status": { + "description": "Status holds the current state of the controller and brief information\nabout its associated VirtualMachineInstance", + "$ref": "#/definitions/v1.VirtualMachineStatus" + } + } + }, + "v1.VirtualMachineCondition": { + "description": "VirtualMachineCondition represents the state of VirtualMachine", "required": [ "type", "status" @@ -4227,63 +4542,8 @@ } } }, - "v1.VMReplicaSetSpec": { - "required": [ - "template" - ], - "properties": { - "paused": { - "description": "Indicates that the replica set is paused.\n+optional", - "type": "boolean" - }, - "replicas": { - "description": "Number of desired pods. This is a pointer to distinguish between explicit\nzero and not specified. Defaults to 1.\n+optional", - "type": "integer", - "format": "int32" - }, - "selector": { - "description": "Label selector for pods. Existing ReplicaSets whose pods are\nselected by this will be the ones affected by this deployment.\n+optional", - "$ref": "#/definitions/v1.LabelSelector" - }, - "template": { - "description": "Template describes the pods that will be created.", - "$ref": "#/definitions/v1.VMTemplateSpec" - } - } - }, - "v1.VMReplicaSetStatus": { - "properties": { - "conditions": { - "type": "array", - "items": { - "$ref": "#/definitions/v1.VMReplicaSetCondition" - } - }, - "readyReplicas": { - "description": "The number of ready replicas for this replica set.\n+optional", - "type": "integer", - "format": "int32" - }, - "replicas": { - "description": "Total number of non-terminated pods targeted by this deployment (their labels match the selector).\n+optional", - "type": "integer", - "format": "int32" - } - } - }, - "v1.VMTemplateSpec": { - "properties": { - "metadata": { - "$ref": "#/definitions/v1.ObjectMeta" - }, - "spec": { - "description": "VM Spec contains the VM specification.", - "$ref": "#/definitions/v1.VirtualMachineSpec" - } - } - }, - "v1.VirtualMachine": { - "description": "VirtualMachine is *the* VM Definition. It represents a virtual machine in the runtime environment of kubernetes.", + "v1.VirtualMachineInstance": { + "description": "VirtualMachineInstance is *the* VirtualMachineInstance Definition. It represents a virtual machine in the runtime environment of kubernetes.", "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", @@ -4297,16 +4557,16 @@ "$ref": "#/definitions/v1.ObjectMeta" }, "spec": { - "description": "VM Spec contains the VM specification.", - "$ref": "#/definitions/v1.VirtualMachineSpec" + "description": "VirtualMachineInstance Spec contains the VirtualMachineInstance specification.", + "$ref": "#/definitions/v1.VirtualMachineInstanceSpec" }, "status": { - "description": "Status is the high level overview of how the VM is doing. It contains information available to controllers and users.", - "$ref": "#/definitions/v1.VirtualMachineStatus" + "description": "Status is the high level overview of how the VirtualMachineInstance is doing. It contains information available to controllers and users.", + "$ref": "#/definitions/v1.VirtualMachineInstanceStatus" } } }, - "v1.VirtualMachineCondition": { + "v1.VirtualMachineInstanceCondition": { "required": [ "type", "status" @@ -4332,8 +4592,8 @@ } } }, - "v1.VirtualMachineList": { - "description": "VirtualMachineList is a list of VirtualMachines", + "v1.VirtualMachineInstanceList": { + "description": "VirtualMachineInstanceList is a list of VirtualMachines", "required": [ "items" ], @@ -4345,7 +4605,7 @@ "items": { "type": "array", "items": { - "$ref": "#/definitions/v1.VirtualMachine" + "$ref": "#/definitions/v1.VirtualMachineInstance" } }, "kind": { @@ -4357,7 +4617,7 @@ } } }, - "v1.VirtualMachineNetworkInterface": { + "v1.VirtualMachineInstanceNetworkInterface": { "properties": { "ipAddress": { "description": "IP address of a Virtual Machine interface", @@ -4369,7 +4629,7 @@ } } }, - "v1.VirtualMachinePreset": { + "v1.VirtualMachineInstancePreset": { "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", @@ -4383,13 +4643,13 @@ "$ref": "#/definitions/v1.ObjectMeta" }, "spec": { - "description": "VM Spec contains the VM specification.", - "$ref": "#/definitions/v1.VirtualMachinePresetSpec" + "description": "VirtualMachineInstance Spec contains the VirtualMachineInstance specification.", + "$ref": "#/definitions/v1.VirtualMachineInstancePresetSpec" } } }, - "v1.VirtualMachinePresetList": { - "description": "VirtualMachinePresetList is a list of VirtualMachinePresets", + "v1.VirtualMachineInstancePresetList": { + "description": "VirtualMachineInstancePresetList is a list of VirtualMachinePresets", "required": [ "items" ], @@ -4401,7 +4661,7 @@ "items": { "type": "array", "items": { - "$ref": "#/definitions/v1.VirtualMachinePreset" + "$ref": "#/definitions/v1.VirtualMachineInstancePreset" } }, "kind": { @@ -4413,23 +4673,23 @@ } } }, - "v1.VirtualMachinePresetSpec": { + "v1.VirtualMachineInstancePresetSpec": { "required": [ "selector" ], "properties": { "domain": { - "description": "Domain is the same object type as contained in VirtualMachineSpec", - "$ref": "#/definitions/v1.DomainSpec" + "description": "Domain is the same object type as contained in VirtualMachineInstanceSpec", + "$ref": "#/definitions/v1.DomainPresetSpec" }, "selector": { - "description": "Selector is a label query over a set of VMs.\nRequired.", + "description": "Selector is a label query over a set of VMIs.\nRequired.", "$ref": "#/definitions/v1.LabelSelector" } } }, - "v1.VirtualMachineReplicaSet": { - "description": "VM is *the* VM Definition. It represents a virtual machine in the runtime environment of kubernetes.", + "v1.VirtualMachineInstanceReplicaSet": { + "description": "VirtualMachineInstance is *the* VirtualMachineInstance Definition. It represents a virtual machine in the runtime environment of kubernetes.", "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", @@ -4443,17 +4703,43 @@ "$ref": "#/definitions/v1.ObjectMeta" }, "spec": { - "description": "VM Spec contains the VM specification.", - "$ref": "#/definitions/v1.VMReplicaSetSpec" + "description": "VirtualMachineInstance Spec contains the VirtualMachineInstance specification.", + "$ref": "#/definitions/v1.VirtualMachineInstanceReplicaSetSpec" }, "status": { - "description": "Status is the high level overview of how the VM is doing. It contains information available to controllers and users.", - "$ref": "#/definitions/v1.VMReplicaSetStatus" + "description": "Status is the high level overview of how the VirtualMachineInstance is doing. It contains information available to controllers and users.", + "$ref": "#/definitions/v1.VirtualMachineInstanceReplicaSetStatus" } } }, - "v1.VirtualMachineReplicaSetList": { - "description": "VMList is a list of VMs", + "v1.VirtualMachineInstanceReplicaSetCondition": { + "required": [ + "type", + "status" + ], + "properties": { + "lastProbeTime": { + "type": "string" + }, + "lastTransitionTime": { + "type": "string" + }, + "message": { + "type": "string" + }, + "reason": { + "type": "string" + }, + "status": { + "type": "string" + }, + "type": { + "type": "string" + } + } + }, + "v1.VirtualMachineInstanceReplicaSetList": { + "description": "VMIList is a list of VMIs", "required": [ "items" ], @@ -4465,7 +4751,7 @@ "items": { "type": "array", "items": { - "$ref": "#/definitions/v1.VirtualMachineReplicaSet" + "$ref": "#/definitions/v1.VirtualMachineInstanceReplicaSet" } }, "kind": { @@ -4477,8 +4763,53 @@ } } }, - "v1.VirtualMachineSpec": { - "description": "VirtualMachineSpec is a description of a VirtualMachine.", + "v1.VirtualMachineInstanceReplicaSetSpec": { + "required": [ + "selector", + "template" + ], + "properties": { + "paused": { + "description": "Indicates that the replica set is paused.\n+optional", + "type": "boolean" + }, + "replicas": { + "description": "Number of desired pods. This is a pointer to distinguish between explicit\nzero and not specified. Defaults to 1.\n+optional", + "type": "integer", + "format": "int32" + }, + "selector": { + "description": "Label selector for pods. Existing ReplicaSets whose pods are\nselected by this will be the ones affected by this deployment.", + "$ref": "#/definitions/v1.LabelSelector" + }, + "template": { + "description": "Template describes the pods that will be created.", + "$ref": "#/definitions/v1.VirtualMachineInstanceTemplateSpec" + } + } + }, + "v1.VirtualMachineInstanceReplicaSetStatus": { + "properties": { + "conditions": { + "type": "array", + "items": { + "$ref": "#/definitions/v1.VirtualMachineInstanceReplicaSetCondition" + } + }, + "readyReplicas": { + "description": "The number of ready replicas for this replica set.\n+optional", + "type": "integer", + "format": "int32" + }, + "replicas": { + "description": "Total number of non-terminated pods targeted by this deployment (their labels match the selector).\n+optional", + "type": "integer", + "format": "int32" + } + } + }, + "v1.VirtualMachineInstanceSpec": { + "description": "VirtualMachineInstanceSpec is a description of a VirtualMachineInstance.", "required": [ "domain" ], @@ -4488,20 +4819,38 @@ "$ref": "#/definitions/v1.Affinity" }, "domain": { - "description": "Specification of the desired behavior of the VirtualMachine on the host.", + "description": "Specification of the desired behavior of the VirtualMachineInstance on the host.", "$ref": "#/definitions/v1.DomainSpec" }, + "hostname": { + "description": "Specifies the hostname of the vmi\nIf not specified, the hostname will be set to the name of the vmi, if dhcp or cloud-init is configured properly.\n+optional", + "type": "string" + }, + "networks": { + "description": "List of networks that can be attached to a vm's virtual interface.", + "type": "array", + "items": { + "$ref": "#/definitions/v1.Network" + } + }, "nodeSelector": { - "description": "NodeSelector is a selector which must be true for the vm to fit on a node.\nSelector which must match a node's labels for the vm to be scheduled on that node.\nMore info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/\n+optional", - "type": "object" + "description": "NodeSelector is a selector which must be true for the vmi to fit on a node.\nSelector which must match a node's labels for the vmi to be scheduled on that node.\nMore info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/\n+optional", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "subdomain": { + "description": "If specified, the fully qualified vmi hostname will be \"\u003chostname\u003e.\u003csubdomain\u003e.\u003cpod namespace\u003e.svc.\u003ccluster domain\u003e\".\nIf not specified, the vmi will not have a domainname at all. The DNS entry will resolve to the vmi,\nno matter if the vmi itself can pick up a hostname.\n+optional", + "type": "string" }, "terminationGracePeriodSeconds": { - "description": "Grace period observed after signalling a VM to stop after which the VM is force terminated.", + "description": "Grace period observed after signalling a VirtualMachineInstance to stop after which the VirtualMachineInstance is force terminated.", "type": "integer", "format": "int64" }, "volumes": { - "description": "List of volumes that can be mounted by disks belonging to the vm.", + "description": "List of volumes that can be mounted by disks belonging to the vmi.", "type": "array", "items": { "$ref": "#/definitions/v1.Volume" @@ -4509,45 +4858,120 @@ } } }, - "v1.VirtualMachineStatus": { - "description": "VirtualMachineStatus represents information about the status of a VM. Status may trail the actual\nstate of a system.", + "v1.VirtualMachineInstanceStatus": { + "description": "VirtualMachineInstanceStatus represents information about the status of a VirtualMachineInstance. Status may trail the actual\nstate of a system.", "properties": { "conditions": { - "description": "Conditions are specific points in VM's pod runtime.", + "description": "Conditions are specific points in VirtualMachineInstance's pod runtime.", "type": "array", "items": { - "$ref": "#/definitions/v1.VirtualMachineCondition" + "$ref": "#/definitions/v1.VirtualMachineInstanceCondition" } }, "interfaces": { "description": "Interfaces represent the details of available network interfaces.", "type": "array", "items": { - "$ref": "#/definitions/v1.VirtualMachineNetworkInterface" + "$ref": "#/definitions/v1.VirtualMachineInstanceNetworkInterface" } }, "nodeName": { - "description": "NodeName is the name where the VM is currently running.", + "description": "NodeName is the name where the VirtualMachineInstance is currently running.", "type": "string" }, "phase": { - "description": "Phase is the status of the VM in kubernetes world. It is not the VM status, but partially correlates to it.", + "description": "Phase is the status of the VirtualMachineInstance in kubernetes world. It is not the VirtualMachineInstance status, but partially correlates to it.", + "type": "string" + } + } + }, + "v1.VirtualMachineInstanceTemplateSpec": { + "properties": { + "metadata": { + "$ref": "#/definitions/v1.ObjectMeta" + }, + "spec": { + "description": "VirtualMachineInstance Spec contains the VirtualMachineInstance specification.", + "$ref": "#/definitions/v1.VirtualMachineInstanceSpec" + } + } + }, + "v1.VirtualMachineList": { + "description": "VirtualMachineList is a list of virtualmachines", + "required": [ + "metadata", + "items" + ], + "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", "type": "string" + }, + "items": { + "description": "Items is a list of VirtualMachines", + "type": "array", + "items": { + "$ref": "#/definitions/v1.VirtualMachine" + } + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "$ref": "#/definitions/v1.ListMeta" + } + } + }, + "v1.VirtualMachineSpec": { + "description": "VirtualMachineSpec describes how the proper VirtualMachine\nshould look like", + "required": [ + "running", + "template" + ], + "properties": { + "running": { + "description": "Running controls whether the associatied VirtualMachineInstance is created or not", + "type": "boolean" + }, + "template": { + "description": "Template is the direct specification of VirtualMachineInstance", + "$ref": "#/definitions/v1.VirtualMachineInstanceTemplateSpec" + } + } + }, + "v1.VirtualMachineStatus": { + "description": "VirtualMachineStatus represents the status returned by the\ncontroller to describe how the VirtualMachine is doing", + "properties": { + "conditions": { + "description": "Hold the state information of the VirtualMachine and its VirtualMachineInstance", + "type": "array", + "items": { + "$ref": "#/definitions/v1.VirtualMachineCondition" + } + }, + "created": { + "description": "Created indicates if the virtual machine is created in the cluster", + "type": "boolean" + }, + "ready": { + "description": "Ready indicates if the virtual machine is running and ready", + "type": "boolean" } } }, "v1.Volume": { - "description": "Volume represents a named volume in a vm.", + "description": "Volume represents a named volume in a vmi.", "required": [ "name" ], "properties": { "cloudInitNoCloud": { - "description": "CloudInitNoCloud represents a cloud-init NoCloud user-data source.\nThe NoCloud data will be added as a disk to the vm. A proper cloud-init installation is required inside the guest.\nMore info: http://cloudinit.readthedocs.io/en/latest/topics/datasources/nocloud.html\n+optional", + "description": "CloudInitNoCloud represents a cloud-init NoCloud user-data source.\nThe NoCloud data will be added as a disk to the vmi. A proper cloud-init installation is required inside the guest.\nMore info: http://cloudinit.readthedocs.io/en/latest/topics/datasources/nocloud.html\n+optional", "$ref": "#/definitions/v1.CloudInitNoCloudSource" }, "emptyDisk": { - "description": "EmptyDisk represents a temporary disk which shares the vms lifecycle\nMore info: https://kubevirt.gitbooks.io/user-guide/disks-and-volumes.html\n+optional", + "description": "EmptyDisk represents a temporary disk which shares the vmis lifecycle.\nMore info: https://kubevirt.gitbooks.io/user-guide/disks-and-volumes.html\n+optional", "$ref": "#/definitions/v1.EmptyDiskSource" }, "ephemeral": { @@ -4555,15 +4979,15 @@ "$ref": "#/definitions/v1.EphemeralVolumeSource" }, "name": { - "description": "Volume's name.\nMust be a DNS_LABEL and unique within the vm.\nMore info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", + "description": "Volume's name.\nMust be a DNS_LABEL and unique within the vmi.\nMore info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", "type": "string" }, "persistentVolumeClaim": { - "description": "PersistentVolumeClaimVolumeSource represents a reference to a PersistentVolumeClaim in the same namespace.\nDirectly attached to the vm via qemu.\nMore info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims\n+optional", + "description": "PersistentVolumeClaimVolumeSource represents a reference to a PersistentVolumeClaim in the same namespace.\nDirectly attached to the vmi via qemu.\nMore info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims\n+optional", "$ref": "#/definitions/v1.PersistentVolumeClaimVolumeSource" }, "registryDisk": { - "description": "RegistryDisk references a docker image, embedding a qcow or raw disk\nMore info: https://kubevirt.gitbooks.io/user-guide/registry-disk.html\n+optional", + "description": "RegistryDisk references a docker image, embedding a qcow or raw disk.\nMore info: https://kubevirt.gitbooks.io/user-guide/registry-disk.html\n+optional", "$ref": "#/definitions/v1.RegistryDiskSource" } } @@ -4583,20 +5007,51 @@ } }, "v1.Watchdog": { - "description": "Named watchdog device", + "description": "Named watchdog device.", "required": [ "name" ], "properties": { "i6300esb": { - "description": "i6300esb watchdog device\n+optional", + "description": "i6300esb watchdog device.\n+optional", "$ref": "#/definitions/v1.I6300ESBWatchdog" }, "name": { - "description": "Name of the watchdog", + "description": "Name of the watchdog.", "type": "string" } } + }, + "v1.WeightedPodAffinityTerm": { + "description": "The weights of all of the matched WeightedPodAffinityTerm fields are added per-node to find the most preferred node(s)", + "required": [ + "weight", + "podAffinityTerm" + ], + "properties": { + "podAffinityTerm": { + "description": "Required. A pod affinity term, associated with the corresponding weight.", + "$ref": "#/definitions/v1.PodAffinityTerm" + }, + "weight": { + "description": "weight associated with matching the corresponding podAffinityTerm, in the range 1-100.", + "type": "integer", + "format": "int32" + } + } + } + }, + "securityDefinitions": { + "BearerToken": { + "description": "Bearer Token authentication", + "type": "apiKey", + "name": "authorization", + "in": "header" + } + }, + "security": [ + { + "BearerToken": [] } - } + ] } \ No newline at end of file diff --git a/vendor/kubevirt.io/kubevirt/automation/check-patch.sh b/vendor/kubevirt.io/kubevirt/automation/check-patch.sh index 238b368e3..94bb6943c 100755 --- a/vendor/kubevirt.io/kubevirt/automation/check-patch.sh +++ b/vendor/kubevirt.io/kubevirt/automation/check-patch.sh @@ -64,7 +64,7 @@ setup_vagrant_env() { export VAGRANT_USE_NFS=false export VAGRANT_CACHE_RPM=true export VAGRANT_CACHE_DOCKER=true - export VAGRANT_NUM_NODES=1 + export KUBEVIRT_NUM_NODES=1 } setup_go_dirs() { diff --git a/vendor/kubevirt.io/kubevirt/automation/test.sh b/vendor/kubevirt.io/kubevirt/automation/test.sh index 1e06101d9..4735ae8be 100755 --- a/vendor/kubevirt.io/kubevirt/automation/test.sh +++ b/vendor/kubevirt.io/kubevirt/automation/test.sh @@ -31,12 +31,18 @@ set -ex export WORKSPACE="${WORKSPACE:-$PWD}" if [[ $TARGET =~ openshift-.* ]]; then - export PROVIDER="os-3.9.0" + if [[ $TARGET =~ .*-crio-.* ]]; then + export KUBEVIRT_PROVIDER="os-3.9.0-crio" + else + export KUBEVIRT_PROVIDER="os-3.10.0" + fi +elif [[ $TARGET =~ .*-1.9.3-.* ]]; then + export KUBEVIRT_PROVIDER="k8s-1.9.3" else - export PROVIDER="k8s-1.9.3" + export KUBEVIRT_PROVIDER="k8s-1.10.3" fi -export VAGRANT_NUM_NODES=1 +export KUBEVIRT_NUM_NODES=2 export NFS_WINDOWS_DIR=${NFS_WINDOWS_DIR:-/home/nfs/images/windows2016} kubectl() { cluster/kubectl.sh "$@"; } @@ -44,51 +50,73 @@ kubectl() { cluster/kubectl.sh "$@"; } export NAMESPACE="${NAMESPACE:-kube-system}" # Make sure that the VM is properly shut down on exit -trap '{ make cluster-down; }' EXIT +trap '{ make cluster-down; }' EXIT SIGINT SIGTERM SIGSTOP make cluster-down make cluster-up # Wait for nodes to become ready -while [ -n "$(kubectl get nodes --no-headers | grep -v Ready)" ]; do - echo "Waiting for all nodes to become ready ..." - kubectl get nodes --no-headers | >&2 grep -v Ready || true - sleep 10 +set +e +kubectl get nodes --no-headers +kubectl_rc=$? +while [ $kubectl_rc -ne 0 ] || [ -n "$(kubectl get nodes --no-headers | grep NotReady)" ]; do + echo "Waiting for all nodes to become ready ..." + kubectl get nodes --no-headers + kubectl_rc=$? + sleep 10 done +set -e + echo "Nodes are ready:" kubectl get nodes make cluster-sync -# Wait until kubevirt pods are running -while [ -n "$(kubectl get pods -n ${NAMESPACE} --no-headers | grep -v Running)" ]; do - echo "Waiting for kubevirt pods to enter the Running state ..." - kubectl get pods -n ${NAMESPACE} --no-headers | >&2 grep -v Running || true - sleep 10 -done +# OpenShift is running important containers under default namespace +namespaces=(kube-system default) +if [[ $NAMESPACE != "kube-system" ]]; then + namespaces+=($NAMESPACE) +fi -# Make sure all containers except virt-controller are ready -while [ -n "$(kubectl get pods -n ${NAMESPACE} -o'custom-columns=status:status.containerStatuses[*].ready,metadata:metadata.name' --no-headers | awk '!/virt-controller/ && /false/')" ]; do - echo "Waiting for KubeVirt containers to become ready ..." - kubectl get pods -n ${NAMESPACE} -o'custom-columns=status:status.containerStatuses[*].ready,metadata:metadata.name' --no-headers | awk '!/virt-controller/ && /false/' || true - sleep 10 -done +timeout=300 +sample=30 -# Make sure that at least one virt-controller container is ready -while [ "$(kubectl get pods -n ${NAMESPACE} -o'custom-columns=status:status.containerStatuses[*].ready,metadata:metadata.name' --no-headers | awk '/virt-controller/ && /true/' | wc -l)" -lt "1" ]; do - echo "Waiting for KubeVirt virt-controller container to become ready ..." - kubectl get pods -n ${NAMESPACE} -o'custom-columns=status:status.containerStatuses[*].ready,metadata:metadata.name' --no-headers | awk '/virt-controller/ && /true/' | wc -l - sleep 10 +for i in ${namespaces[@]}; do + # Wait until kubevirt pods are running + current_time=0 + while [ -n "$(kubectl get pods -n $i --no-headers | grep -v Running)" ]; do + echo "Waiting for kubevirt pods to enter the Running state ..." + kubectl get pods -n $i --no-headers | >&2 grep -v Running || true + sleep $sample + + current_time=$((current_time + sample)) + if [ $current_time -gt $timeout ]; then + exit 1 + fi + done + + # Make sure all containers are ready + current_time=0 + while [ -n "$(kubectl get pods -n $i -o'custom-columns=status:status.containerStatuses[*].ready' --no-headers | grep false)" ]; do + echo "Waiting for KubeVirt containers to become ready ..." + kubectl get pods -n $i -o'custom-columns=status:status.containerStatuses[*].ready' --no-headers | grep false || true + sleep $sample + + current_time=$((current_time + sample)) + if [ $current_time -gt $timeout ]; then + exit 1 + fi + done + kubectl get pods -n $i done -kubectl get pods -n ${NAMESPACE} kubectl version ginko_params="--ginkgo.noColor --junit-output=$WORKSPACE/junit.xml" # Prepare PV for windows testing -if [[ -d $NFS_WINDOWS_DIR ]] && [[ $TARGET == windows ]]; then - kubectl create -f - <hack/config-provider-$PROVIDER.sh <hack/config-provider-$KUBEVIRT_PROVIDER.sh < 5s v1.10.3 +``` + +## Bringing the cluster down + +```bash +export KUBEVIRT_PROVIDER=k8s-1.10.3 +make cluster-down +``` + +This destroys the whole cluster. Recreating the cluster is fast, since k8s is +already pre-deployed. The only state which is kept is the state of the local +docker registry. + +## Destroying the docker registry state + +The docker registry survives a `make cluster-down`. It's state is stored in a +docker volume called `kubevirt_registry`. If the volume gets too big or the +volume contains corrupt data, it can be deleted with + +```bash +docker volume rm kubevirt_registry +``` diff --git a/vendor/kubevirt.io/kubevirt/cluster/k8s-1.10.3/provider.sh b/vendor/kubevirt.io/kubevirt/cluster/k8s-1.10.3/provider.sh new file mode 100644 index 000000000..5faac6496 --- /dev/null +++ b/vendor/kubevirt.io/kubevirt/cluster/k8s-1.10.3/provider.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +set -e + +image="k8s-1.10.3@sha256:d6290260e7e6b84419984f12719cf592ccbe327373b8df76aa0481f8ec01d357" + +source cluster/ephemeral-provider-common.sh + +function up() { + ${_cli} run $(_add_common_params) + + # Copy k8s config and kubectl + ${_cli} scp --prefix $provider_prefix /usr/bin/kubectl - >${KUBEVIRT_PATH}cluster/$KUBEVIRT_PROVIDER/.kubectl + chmod u+x ${KUBEVIRT_PATH}cluster/$KUBEVIRT_PROVIDER/.kubectl + ${_cli} scp --prefix $provider_prefix /etc/kubernetes/admin.conf - >${KUBEVIRT_PATH}cluster/$KUBEVIRT_PROVIDER/.kubeconfig + + # Set server and disable tls check + export KUBECONFIG=${KUBEVIRT_PATH}cluster/$KUBEVIRT_PROVIDER/.kubeconfig + ${KUBEVIRT_PATH}cluster/$KUBEVIRT_PROVIDER/.kubectl config set-cluster kubernetes --server=https://$(_main_ip):$(_port k8s) + ${KUBEVIRT_PATH}cluster/$KUBEVIRT_PROVIDER/.kubectl config set-cluster kubernetes --insecure-skip-tls-verify=true + + # Make sure that local config is correct + prepare_config +} diff --git a/vendor/kubevirt.io/kubevirt/cluster/k8s-1.10.4/README.md b/vendor/kubevirt.io/kubevirt/cluster/k8s-1.10.4/README.md new file mode 100644 index 000000000..adfca4bd1 --- /dev/null +++ b/vendor/kubevirt.io/kubevirt/cluster/k8s-1.10.4/README.md @@ -0,0 +1,45 @@ +# Kubernetes 1.10.4 in ephemeral containers + +Provides a pre-deployed Kubernetes with version 1.10.4 purely in docker +containers with qemu. The provided VMs are completely ephemeral and are +recreated on every cluster restart. The KubeVirt containers are built on the +local machine and are the pushed to a registry which is exposed at +`localhost:5000`. + +## Bringing the cluster up + +```bash +export KUBEVIRT_PROVIDER=k8s-1.10.4 +export KUBEVIRT_NUM_NODES=2 # master + one nodes +make cluster-up +``` + +The cluster can be accessed as usual: + +```bash +$ cluster/kubectl.sh get nodes +NAME STATUS ROLES AGE VERSION +node01 NotReady master 31s v1.10.4 +node02 NotReady 5s v1.10.4 +``` + +## Bringing the cluster down + +```bash +export KUBEVIRT_PROVIDER=k8s-1.10.4 +make cluster-down +``` + +This destroys the whole cluster. Recreating the cluster is fast, since k8s is +already pre-deployed. The only state which is kept is the state of the local +docker registry. + +## Destroying the docker registry state + +The docker registry survives a `make cluster-down`. It's state is stored in a +docker volume called `kubevirt_registry`. If the volume gets too big or the +volume contains corrupt data, it can be deleted with + +```bash +docker volume rm kubevirt_registry +``` diff --git a/vendor/kubevirt.io/kubevirt/cluster/k8s-1.10.4/provider.sh b/vendor/kubevirt.io/kubevirt/cluster/k8s-1.10.4/provider.sh new file mode 100644 index 000000000..4f444348b --- /dev/null +++ b/vendor/kubevirt.io/kubevirt/cluster/k8s-1.10.4/provider.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +set -e + +image="k8s-1.10.4@sha256:09ac918cc16f13a5d0af51d4c98e3e25cbf4f97b7b32fe18ec61b32f04ca1009" + +source cluster/ephemeral-provider-common.sh + +function up() { + ${_cli} run $(_add_common_params) + + # Copy k8s config and kubectl + ${_cli} scp --prefix $provider_prefix /usr/bin/kubectl - >${KUBEVIRT_PATH}cluster/$KUBEVIRT_PROVIDER/.kubectl + chmod u+x ${KUBEVIRT_PATH}cluster/$KUBEVIRT_PROVIDER/.kubectl + ${_cli} scp --prefix $provider_prefix /etc/kubernetes/admin.conf - >${KUBEVIRT_PATH}cluster/$KUBEVIRT_PROVIDER/.kubeconfig + + # Set server and disable tls check + export KUBECONFIG=${KUBEVIRT_PATH}cluster/$KUBEVIRT_PROVIDER/.kubeconfig + ${KUBEVIRT_PATH}cluster/$KUBEVIRT_PROVIDER/.kubectl config set-cluster kubernetes --server=https://$(_main_ip):$(_port k8s) + ${KUBEVIRT_PATH}cluster/$KUBEVIRT_PROVIDER/.kubectl config set-cluster kubernetes --insecure-skip-tls-verify=true + + # Make sure that local config is correct + prepare_config +} diff --git a/vendor/kubevirt.io/kubevirt/cluster/k8s-1.9.3/README.md b/vendor/kubevirt.io/kubevirt/cluster/k8s-1.9.3/README.md index f135c7560..359e6b876 100644 --- a/vendor/kubevirt.io/kubevirt/cluster/k8s-1.9.3/README.md +++ b/vendor/kubevirt.io/kubevirt/cluster/k8s-1.9.3/README.md @@ -9,8 +9,8 @@ local machine and are the pushed to a registry which is exposed at ## Bringing the cluster up ```bash -export PROVIDER=k8s-1.9.3 -export VAGRANT_NUM_NODES=1 # master + one nodes +export KUBEVIRT_PROVIDER=k8s-1.9.3 +export KUBEVIRT_NUM_NODES=2 # master + one nodes make cluster-up ``` @@ -26,7 +26,7 @@ node02 NotReady 5s v1.9.3 ## Bringing the cluster down ```bash -export PROVIDER=k8s-1.9.3 +export KUBEVIRT_PROVIDER=k8s-1.9.3 make cluster-down ``` diff --git a/vendor/kubevirt.io/kubevirt/cluster/k8s-1.9.3/provider.sh b/vendor/kubevirt.io/kubevirt/cluster/k8s-1.9.3/provider.sh index efbfcf0d6..991551345 100644 --- a/vendor/kubevirt.io/kubevirt/cluster/k8s-1.9.3/provider.sh +++ b/vendor/kubevirt.io/kubevirt/cluster/k8s-1.9.3/provider.sh @@ -2,26 +2,22 @@ set -e -image="k8s-1.9.3@sha256:2ea1e772b13067617a7fc14f14105cfec5f97dd6e55db1827c3e877ba293fa8d" +image="k8s-1.9.3@sha256:f6ffb23261fb8aa15ed45b8d17e1299e284ea75e1d2814ee6b4ec24ecea6f24b" source cluster/ephemeral-provider-common.sh function up() { ${_cli} run $(_add_common_params) - ${_cli} ssh --prefix $provider_prefix node01 sudo chown vagrant:vagrant /etc/kubernetes/admin.conf - - chmod 0600 ${KUBEVIRT_PATH}cluster/vagrant.key - OPTIONS="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i ${KUBEVIRT_PATH}cluster/vagrant.key -P $(_port ssh)" # Copy k8s config and kubectl - scp ${OPTIONS} vagrant@$(_main_ip):/usr/bin/kubectl ${KUBEVIRT_PATH}cluster/$PROVIDER/.kubectl - chmod u+x ${KUBEVIRT_PATH}cluster/$PROVIDER/.kubectl - scp ${OPTIONS} vagrant@$(_main_ip):/etc/kubernetes/admin.conf ${KUBEVIRT_PATH}cluster/$PROVIDER/.kubeconfig + ${_cli} scp --prefix $provider_prefix /usr/bin/kubectl - >${KUBEVIRT_PATH}cluster/$KUBEVIRT_PROVIDER/.kubectl + chmod u+x ${KUBEVIRT_PATH}cluster/$KUBEVIRT_PROVIDER/.kubectl + ${_cli} scp --prefix $provider_prefix /etc/kubernetes/admin.conf - >${KUBEVIRT_PATH}cluster/$KUBEVIRT_PROVIDER/.kubeconfig # Set server and disable tls check - export KUBECONFIG=${KUBEVIRT_PATH}cluster/$PROVIDER/.kubeconfig - ${KUBEVIRT_PATH}cluster/$PROVIDER/.kubectl config set-cluster kubernetes --server=https://$(_main_ip):$(_port k8s) - ${KUBEVIRT_PATH}cluster/$PROVIDER/.kubectl config set-cluster kubernetes --insecure-skip-tls-verify=true + export KUBECONFIG=${KUBEVIRT_PATH}cluster/$KUBEVIRT_PROVIDER/.kubeconfig + ${KUBEVIRT_PATH}cluster/$KUBEVIRT_PROVIDER/.kubectl config set-cluster kubernetes --server=https://$(_main_ip):$(_port k8s) + ${KUBEVIRT_PATH}cluster/$KUBEVIRT_PROVIDER/.kubectl config set-cluster kubernetes --insecure-skip-tls-verify=true # Make sure that local config is correct prepare_config diff --git a/vendor/kubevirt.io/kubevirt/cluster/kubectl.sh b/vendor/kubevirt.io/kubevirt/cluster/kubectl.sh index dfa713166..83ab2c196 100755 --- a/vendor/kubevirt.io/kubevirt/cluster/kubectl.sh +++ b/vendor/kubevirt.io/kubevirt/cluster/kubectl.sh @@ -21,7 +21,7 @@ set -e source $(dirname "$0")/../hack/common.sh -source ${KUBEVIRT_DIR}/cluster/$PROVIDER/provider.sh +source ${KUBEVIRT_DIR}/cluster/$KUBEVIRT_PROVIDER/provider.sh source ${KUBEVIRT_DIR}/hack/config.sh if [ "$1" == "console" ] || [ "$1" == "vnc" ]; then diff --git a/vendor/kubevirt.io/kubevirt/cluster/os-3.10.0/README.md b/vendor/kubevirt.io/kubevirt/cluster/os-3.10.0/README.md new file mode 100644 index 000000000..d565bcc3e --- /dev/null +++ b/vendor/kubevirt.io/kubevirt/cluster/os-3.10.0/README.md @@ -0,0 +1,58 @@ +# OpenShift 3.10.0 in ephemeral containers + +Provides a pre-deployed OpenShift Origin with version 3.10.0 purely in docker +containers with qemu. The provided VMs are completely ephemeral and are +recreated on every cluster restart. The KubeVirt containers are built on the +local machine and are the pushed to a registry which is exposed at +`localhost:5000`. + +## Bringing the cluster up + +```bash +export KUBEVIRT_PROVIDER=os-3.10.0 +export KUBEVIRT_NUM_NODES=2 # master + one nodes +make cluster-up +``` + +The cluster can be accessed as usual: + +```bash +$ cluster/kubectl.sh get nodes +NAME STATUS ROLES AGE VERSION +node01 Ready compute,infra,master 22m v1.10.0+b81c8f8 +node02 Ready compute 19m v1.10.0+b81c8f8 +``` + +## OpenShift Web Console + +If you want to get access to OpenShift web console you will need to add one line to `/etc/hosts` +```bash +echo "127.0.0.1 node01" >> /etc/hosts +``` + +The background is that the openshift webconsole will always try to redirect to +an authenticator listening at `https://node01:8443`. If this exact url is not +reachable from web-console redirects, then the authentication will always fail. + +Use the default user `admin:admin` to log in. + +## Bringing the cluster down + +```bash +export KUBEVIRT_PROVIDER=os-3.10.0 +make cluster-down +``` + +This destroys the whole cluster. Recreating the cluster is fast, since OpenShift +is already pre-deployed. The only state which is kept is the state of the local +docker registry. + +## Destroying the docker registry state + +The docker registry survives a `make cluster-down`. It's state is stored in a +docker volume called `kubevirt_registry`. If the volume gets too big or the +volume contains corrupt data, it can be deleted with + +```bash +docker volume rm kubevirt_registry +``` diff --git a/vendor/kubevirt.io/kubevirt/cluster/os-3.10.0/provider.sh b/vendor/kubevirt.io/kubevirt/cluster/os-3.10.0/provider.sh new file mode 100644 index 000000000..bcc6b7ea0 --- /dev/null +++ b/vendor/kubevirt.io/kubevirt/cluster/os-3.10.0/provider.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +set -e + +image="os-3.10.0@sha256:0977f1c716862710c8324798b95802e11a149f4532e33be20dd70877fe8f5332" + +source cluster/ephemeral-provider-common.sh + +function up() { + ${_cli} run --reverse $(_add_common_params) + ${_cli} ssh --prefix $provider_prefix node01 -- sudo cp /etc/origin/master/admin.kubeconfig ~vagrant/ + ${_cli} ssh --prefix $provider_prefix node01 -- sudo chown vagrant:vagrant ~vagrant/admin.kubeconfig + + # Copy oc tool and configuration file + ${_cli} scp --prefix $provider_prefix /usr/bin/oc - >${KUBEVIRT_PATH}cluster/$KUBEVIRT_PROVIDER/.kubectl + chmod u+x ${KUBEVIRT_PATH}cluster/$KUBEVIRT_PROVIDER/.kubectl + ${_cli} scp --prefix $provider_prefix /etc/origin/master/admin.kubeconfig - >${KUBEVIRT_PATH}cluster/$KUBEVIRT_PROVIDER/.kubeconfig + + # Update Kube config to support unsecured connection + export KUBECONFIG=${KUBEVIRT_PATH}cluster/$KUBEVIRT_PROVIDER/.kubeconfig + ${KUBEVIRT_PATH}cluster/$KUBEVIRT_PROVIDER/.kubectl config set-cluster node01:8443 --server=https://$(_main_ip):$(_port ocp) + ${KUBEVIRT_PATH}cluster/$KUBEVIRT_PROVIDER/.kubectl config set-cluster node01:8443 --insecure-skip-tls-verify=true + + # Make sure that local config is correct + prepare_config +} diff --git a/vendor/kubevirt.io/kubevirt/cluster/os-3.9.0/README.md b/vendor/kubevirt.io/kubevirt/cluster/os-3.9.0-crio/README.md similarity index 85% rename from vendor/kubevirt.io/kubevirt/cluster/os-3.9.0/README.md rename to vendor/kubevirt.io/kubevirt/cluster/os-3.9.0-crio/README.md index 3bf111abc..e8606c1e9 100644 --- a/vendor/kubevirt.io/kubevirt/cluster/os-3.9.0/README.md +++ b/vendor/kubevirt.io/kubevirt/cluster/os-3.9.0-crio/README.md @@ -1,6 +1,6 @@ -# OpenShift 3.9.0-alpha.4 in ephemeral containers +# OpenShift 3.9.0 with CRI-O in ephemeral containers -Provides a pre-deployed OpenShift Origin with version 3.9.0-alpha.4 purely in docker +Provides a pre-deployed OpenShift Origin with version 3.9.0 with CRI-O support purely in docker containers with qemu. The provided VMs are completely ephemeral and are recreated on every cluster restart. The KubeVirt containers are built on the local machine and are the pushed to a registry which is exposed at @@ -9,7 +9,7 @@ local machine and are the pushed to a registry which is exposed at ## Bringing the cluster up ```bash -export PROVIDER=os-3.9.0 +export PROVIDER=os-3.9.0-crio export VAGRANT_NUM_NODES=1 # master + one nodes make cluster-up ``` @@ -31,7 +31,7 @@ node02 Ready 46s v1.9.1+a0ce1bc657 ## Bringing the cluster down ```bash -export PROVIDER=os-3.9.0 +export PROVIDER=os-3.9.0-crio make cluster-down ``` diff --git a/vendor/kubevirt.io/kubevirt/cluster/os-3.9.0-crio/provider.sh b/vendor/kubevirt.io/kubevirt/cluster/os-3.9.0-crio/provider.sh new file mode 100644 index 000000000..08aa17bec --- /dev/null +++ b/vendor/kubevirt.io/kubevirt/cluster/os-3.9.0-crio/provider.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +set -e + +source cluster/os-3.9.0/provider.sh + +image="os-3.9.0-crio@sha256:107d03dad4da6957e28774b121a45e177f31d7b4ad43c6eab7b24d467e59e213" diff --git a/vendor/kubevirt.io/kubevirt/cluster/os-3.9.0/provider.sh b/vendor/kubevirt.io/kubevirt/cluster/os-3.9.0/provider.sh deleted file mode 100644 index 7b9eb79bc..000000000 --- a/vendor/kubevirt.io/kubevirt/cluster/os-3.9.0/provider.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -set -e - -image="os-3.9.0@sha256:507263b67ddad581b086418d443c4fd1b2a30954e8fddff12254e0061a529410" - -source cluster/ephemeral-provider-common.sh - -function up() { - ${_cli} run --reverse $(_add_common_params) - ${_cli} ssh --prefix $provider_prefix node01 sudo cp /etc/origin/master/admin.kubeconfig ~vagrant/ - ${_cli} ssh --prefix $provider_prefix node01 sudo chown vagrant:vagrant ~vagrant/admin.kubeconfig - - chmod 0600 ${KUBEVIRT_PATH}cluster/vagrant.key - OPTIONS="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i ${KUBEVIRT_PATH}cluster/vagrant.key -P $(_port ssh)" - - # Copy oc tool and configuration file - scp ${OPTIONS} vagrant@$(_main_ip):/usr/bin/oc ${KUBEVIRT_PATH}cluster/$PROVIDER/.kubectl - chmod u+x ${KUBEVIRT_PATH}cluster/$PROVIDER/.kubectl - scp ${OPTIONS} vagrant@$(_main_ip):~vagrant/admin.kubeconfig ${KUBEVIRT_PATH}cluster/$PROVIDER/.kubeconfig - - # Update Kube config to support unsecured connection - export KUBECONFIG=${KUBEVIRT_PATH}cluster/$PROVIDER/.kubeconfig - ${KUBEVIRT_PATH}cluster/$PROVIDER/.kubectl config set-cluster node01:8443 --server=https://$(_main_ip):$(_port osp) - ${KUBEVIRT_PATH}cluster/$PROVIDER/.kubectl config set-cluster node01:8443 --insecure-skip-tls-verify=true - - # Make sure that local config is correct - prepare_config -} diff --git a/vendor/kubevirt.io/kubevirt/cluster/up.sh b/vendor/kubevirt.io/kubevirt/cluster/up.sh index dde0a9fec..8993daf0e 100755 --- a/vendor/kubevirt.io/kubevirt/cluster/up.sh +++ b/vendor/kubevirt.io/kubevirt/cluster/up.sh @@ -1,5 +1,5 @@ #!/bin/bash source hack/common.sh -source cluster/$PROVIDER/provider.sh +source cluster/$KUBEVIRT_PROVIDER/provider.sh up diff --git a/vendor/kubevirt.io/kubevirt/cluster/vagrant-kubernetes/README.md b/vendor/kubevirt.io/kubevirt/cluster/vagrant-kubernetes/README.md deleted file mode 100644 index 756336419..000000000 --- a/vendor/kubevirt.io/kubevirt/cluster/vagrant-kubernetes/README.md +++ /dev/null @@ -1,30 +0,0 @@ -# Kubernetes 1.9.3 in vagrant VM - -Start vagrant VM and deploy k8s with version 1.9.3 on it. -It will deploy k8s only first time when you start a VM. - -## Bringing the cluster up - -```bash -export PROVIDER=vagrant-kubernetes -export VAGRANT_NUM_NODES=1 -make cluster-up -``` - -The cluster can be accessed as usual: - -```bash -$ cluster/kubectl.sh get nodes -NAME STATUS ROLES AGE VERSION -master NotReady master 31s v1.9.3 -node0 NotReady 5s v1.9.3 -``` - -## Bringing the cluster down - -```bash -export PROVIDER=vagrant-kubernetes -make cluster-down -``` - -It will shutdown vagrant VM without destroy it. diff --git a/vendor/kubevirt.io/kubevirt/cluster/vagrant-kubernetes/provider.sh b/vendor/kubevirt.io/kubevirt/cluster/vagrant-kubernetes/provider.sh deleted file mode 100644 index afa430f85..000000000 --- a/vendor/kubevirt.io/kubevirt/cluster/vagrant-kubernetes/provider.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/bash - -set -e - -function _main_ip() { - echo 192.168.200.2 -} - -function up() { - export USING_KUBE_SCRIPTS=true - # Make sure that the vagrant environment is up and running - vagrant up --provider=libvirt - # Synchronize kubectl config - vagrant ssh-config master 2>&1 | grep "not yet ready for SSH" >/dev/null && - { - echo "Master node is not up" - exit 1 - } - - OPTIONS=$(vagrant ssh-config master | grep -v '^Host ' | awk -v ORS=' ' 'NF{print "-o " $1 "=" $2}') - - scp $OPTIONS master:/usr/bin/kubectl ${KUBEVIRT_PATH}cluster/vagrant-kubernetes/.kubectl - chmod u+x cluster/vagrant-kubernetes/.kubectl - - vagrant ssh master -c "sudo cat /etc/kubernetes/admin.conf" >${KUBEVIRT_PATH}cluster/vagrant-kubernetes/.kubeconfig - - # Make sure that local config is correct - prepare_config -} - -function prepare_config() { - BASE_PATH=${KUBEVIRT_PATH:-$PWD} - cat >hack/config-provider-vagrant-kubernetes.sh <> /etc/fstab - mkdir -p /etc/systemd/system/docker.service.d/ - cat >/etc/systemd/system/docker.service.d/mount.conf </etc/yum.repos.d/kubernetes.repo -[kubernetes] -name=Kubernetes -baseurl=http://yum.kubernetes.io/repos/kubernetes-el7-x86_64 -enabled=1 -gpgcheck=1 -repo_gpgcheck=1 -gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg - https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg -EOF -yum install -y docker - -# Log to json files instead of journald -sed -i 's/--log-driver=journald //g' /etc/sysconfig/docker - -# Omit pgp checks until https://github.com/kubernetes/kubeadm/issues/643 is resolved. -yum install --nogpgcheck -y \ - kubeadm \ - kubelet \ - kubectl \ - kubernetes-cni - -# Latest docker on CentOS uses systemd for cgroup management -cat <>/etc/systemd/system/kubelet.service.d/09-kubeadm.conf -[Service] -Environment="KUBELET_EXTRA_ARGS=--cgroup-driver=systemd --runtime-cgroups=/systemd/system.slice --kubelet-cgroups=/systemd/system.slice" -EOT -systemctl daemon-reload - -systemctl enable docker && systemctl start docker -systemctl enable kubelet && systemctl start kubelet - -# Needed for kubernetes service routing and dns -# https://github.com/kubernetes/kubernetes/issues/33798#issuecomment-250962627 -modprobe bridge -sysctl -w net.bridge.bridge-nf-call-iptables=1 -sysctl -w net.bridge.bridge-nf-call-ip6tables=1 diff --git a/vendor/kubevirt.io/kubevirt/cluster/vagrant-kubernetes/setup_master.sh b/vendor/kubevirt.io/kubevirt/cluster/vagrant-kubernetes/setup_master.sh deleted file mode 100755 index 0f06eb4d0..000000000 --- a/vendor/kubevirt.io/kubevirt/cluster/vagrant-kubernetes/setup_master.sh +++ /dev/null @@ -1,97 +0,0 @@ -#/bin/bash -xe -# -# This file is part of the KubeVirt project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Copyright 2017 Red Hat, Inc. -# -master_ip=$1 -network_provider=$3 - -wait_for_kubernetes() { - local timeout="$1" - local start_time=$(date +%s) - local time_left=$timeout - local current_time - - while [[ $time_left -gt 0 ]]; do - kubectl version && return 0 - sleep 60 - current_time=$(date +%s) - time_left=$((timeout - (current_time - start_time))) - echo \ - "Waiting for Kubernetes cluster to become functional," \ - "$time_left seconds left..." - done - - echo "Failed to create Kubernetes cluster in $timeout seconds, aborting" - - return 1 -} - -export KUBERNETES_MASTER=true -bash /vagrant/cluster/vagrant-kubernetes/setup_common.sh - -# Cockpit with kubernetes plugin -yum install -y cockpit cockpit-kubernetes -systemctl enable cockpit.socket && systemctl start cockpit.socket - -# W/A for https://github.com/kubernetes/kubernetes/issues/53356 -rm -rf /var/lib/kubelet - -# Create the master -cat >/etc/kubernetes/kubeadm.conf </etc/exports - -systemctl enable nfs-server && systemctl start nfs-server - -echo -e "\033[0;32m Deployment was successful!" -echo -e "Cockpit is accessible at https://$master_ip:9090." -echo -e "Credentials for Cockpit are 'root:vagrant'.\033[0m" diff --git a/vendor/kubevirt.io/kubevirt/cluster/vagrant-kubernetes/setup_node.sh b/vendor/kubevirt.io/kubevirt/cluster/vagrant-kubernetes/setup_node.sh deleted file mode 100755 index 8d90a0399..000000000 --- a/vendor/kubevirt.io/kubevirt/cluster/vagrant-kubernetes/setup_node.sh +++ /dev/null @@ -1,36 +0,0 @@ -#/bin/bash -xe -# -# This file is part of the KubeVirt project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Copyright 2017 Red Hat, Inc. -# -master_ip=$1 - -bash /vagrant/cluster/vagrant-kubernetes/setup_common.sh - -ADVERTISED_MASTER_IP=$(sshpass -p vagrant ssh -oStrictHostKeyChecking=no vagrant@$master_ip hostname -I | cut -d " " -f1) -set +e - -echo 'Trying to register myself...' -# Skipping preflight checks because of https://github.com/kubernetes/kubeadm/issues/6 -kubeadm join --token abcdef.1234567890123456 $ADVERTISED_MASTER_IP:6443 --ignore-preflight-errors=all --discovery-token-unsafe-skip-ca-verification=true -while [ $? -ne 0 ]; do - sleep 30 - echo 'Trying to register myself...' - # Skipping preflight checks because of https://github.com/kubernetes/kubeadm/issues/6 - kubeadm join --token abcdef.1234567890123456 $ADVERTISED_MASTER_IP:6443 --ignore-preflight-errors=all --discovery-token-unsafe-skip-ca-verification=true -done - -echo -e "\033[0;32m Deployment was successful!\033[0m" diff --git a/vendor/kubevirt.io/kubevirt/cluster/vagrant-openshift/README.md b/vendor/kubevirt.io/kubevirt/cluster/vagrant-openshift/README.md deleted file mode 100644 index 2ec7a0996..000000000 --- a/vendor/kubevirt.io/kubevirt/cluster/vagrant-openshift/README.md +++ /dev/null @@ -1,35 +0,0 @@ -# OpenShift 3.9.0-alpha.4 in vagrant VM - -Start vagrant VM and deploy OpenShift Origin with version 3.9.0-alpha.4 on it. -It will deploy OpenShift only first time when you start a VM. - -## Bringing the cluster up - -```bash -export PROVIDER=vagrant-openshift -export VAGRANT_NUM_NODES=1 -make cluster-up -``` - -If you want to get access to OpenShift web console you will need to add line to `/etc/hosts` -```bash -echo "127.0.0.1 node01" >> /etc/hosts -``` - -The cluster can be accessed as usual: - -```bash -$ cluster/kubectl.sh get nodes -NAME STATUS ROLES AGE VERSION -master Ready master 8m v1.9.1+a0ce1bc657 -node0 Ready 6m v1.9.1+a0ce1bc657 -``` - -## Bringing the cluster down - -```bash -export PROVIDER=vagrant-openshift -make cluster-down -``` - -It will shutdown vagrant VM without destroy it. diff --git a/vendor/kubevirt.io/kubevirt/cluster/vagrant-openshift/provider.sh b/vendor/kubevirt.io/kubevirt/cluster/vagrant-openshift/provider.sh deleted file mode 100644 index 3957fdfa0..000000000 --- a/vendor/kubevirt.io/kubevirt/cluster/vagrant-openshift/provider.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/bash - -function _main_ip() { - echo 192.168.200.2 -} - -function up() { - export USING_KUBE_SCRIPTS=true - # Make sure that the vagrant environment is up and running - vagrant up --provider=libvirt - # Synchronize kubectl config - vagrant ssh-config master 2>&1 | grep "not yet ready for SSH" >/dev/null && - { - echo "Master node is not up" - exit 1 - } - - OPTIONS=$(vagrant ssh-config master | grep -v '^Host ' | awk -v ORS=' ' 'NF{print "-o " $1 "=" $2}') - - scp $OPTIONS master:/usr/local/bin/oc ${KUBEVIRT_PATH}cluster/$PROVIDER/.kubectl - chmod u+x cluster/$PROVIDER/.kubectl - - vagrant ssh master -c "sudo cat /etc/origin/master/openshift-master.kubeconfig" >${KUBEVIRT_PATH}cluster/$PROVIDER/.kubeconfig - - # Update Kube config to support unsecured connection - export KUBECONFIG=${KUBEVIRT_PATH}cluster/$PROVIDER/.kubeconfig - ${KUBEVIRT_PATH}cluster/$PROVIDER/.kubectl config set-cluster master:8443 --server=https://$(_main_ip):8443 - ${KUBEVIRT_PATH}cluster/$PROVIDER/.kubectl config set-cluster master:8443 --insecure-skip-tls-verify=true - - # Make sure that local config is correct - prepare_config -} - -function prepare_config() { - BASE_PATH=${KUBEVIRT_PATH:-$PWD} - cat >hack/config-provider-$PROVIDER.sh <>/etc/hosts -IFS=. read ip1 ip2 ip3 ip4 <<<"$1" -for node in $(seq 0 $(($2 - 1))); do - node_hostname="node$node" - node_ip="$ip1.$ip2.$ip3.$(($ip4 + node + 1))" - grep $node_hostname /etc/hosts || echo "$node_ip $node_hostname" >>/etc/hosts -done - -# Install storage requirements for iscsi and cluster -yum -y install centos-release-gluster -yum -y install --nogpgcheck -y glusterfs-fuse -yum -y install iscsi-initiator-utils - -# Install OpenShift packages -yum install -y centos-release-openshift-origin -yum install -y yum-utils ansible wget git net-tools bind-utils iptables-services bridge-utils bash-completion kexec-tools sos psacct docker -systemctl start docker -systemctl enable docker diff --git a/vendor/kubevirt.io/kubevirt/cluster/vagrant-openshift/setup_master.sh b/vendor/kubevirt.io/kubevirt/cluster/vagrant-openshift/setup_master.sh deleted file mode 100644 index 244797697..000000000 --- a/vendor/kubevirt.io/kubevirt/cluster/vagrant-openshift/setup_master.sh +++ /dev/null @@ -1,87 +0,0 @@ -#/bin/bash -xe -# -# This file is part of the KubeVirt project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Copyright 2017 Red Hat, Inc. -# - -master_ip=$1 -nodes=$2 - -bash /vagrant/cluster/vagrant-openshift/setup_common.sh $master_ip $nodes - -# Disable host key checking under ansible.cfg file -sed -i '/host_key_checking/s/^#//g' /etc/ansible/ansible.cfg - -# Save nodes to add it under ansible inventory file -inv_nodes="" -IFS=. read ip1 ip2 ip3 ip4 <<<"$master_ip" -for node in $(seq 0 $(($nodes - 1))); do - node_ip="$ip1.$ip2.$ip3.$(($ip4 + node + 1))" - node_hostname="node$node openshift_node_labels=\"{'region': 'infra','zone': 'default'}\" openshift_ip=$node_ip" - inv_nodes="$inv_nodes$node_hostname\n" -done - -openshift_ansible_dir="/root/openshift-ansible" -inventory_file="/root/inventory" - -mkdir -p /root/openshift-ansible -# Checkout to the specific version as W/A for https://github.com/openshift/openshift-ansible/issues/6756 -git clone https://github.com/openshift/openshift-ansible.git $openshift_ansible_dir -b openshift-ansible-3.9.0-0.40.0 - -# Create ansible inventory file -cat >$inventory_file < Dockerfile @@ -25,44 +25,44 @@ docker build -t vmdisks/fedora25:latest . docker push vmdisks/fedora25:latest ``` -## Assigning Ephemeral Disks to VMs +## Assigning Ephemeral Disks to VMIs Assign an ephemeral disk backed by an image in the container registry by -adding a RegistryDisk:v1alpha disk to the VM definition and supplying +adding a RegistryDisk:v1alpha disk to the VMI definition and supplying the container image as the disk's source name. -Example: Create a KubeVirt VM definition with container backed ephemeral disk. +Example: Create a KubeVirt VMI definition with container backed ephemeral disk. ``` cat << END > vm.yaml -metadata: - name: testvm-ephemeral -apiVersion: kubevirt.io/v1alpha1 +apiVersion: kubevirt.io/v1alpha2 kind: VirtualMachine +metadata: + creationTimestamp: null + name: vm-ephemeral spec: domain: devices: disks: - - type: RegistryDisk:v1alpha - source: - name: vmdisks/fedora25:devel - target: - dev: vda - interfaces: - - source: - network: default - type: network - memory: - unit: MB - value: 64 - os: - type: - os: hvm - type: qemu + - disk: + bus: virtio + name: registrydisk + volumeName: registryvolume + machine: + type: "" + resources: + requests: + memory: 64M + terminationGracePeriodSeconds: 0 + volumes: + - name: registryvolume + registryDisk: + image: kubevirt/cirros-registry-disk-demo:devel +status: {} END ``` -After creating the VM definition, starting the VM is as simple starting a pod. +After creating the VMI definition, starting the VMI is as simple starting a pod. ``` kubectl create -f vm.yaml diff --git a/vendor/kubevirt.io/kubevirt/cmd/subresource-access-test/subresource-access-test.go b/vendor/kubevirt.io/kubevirt/cmd/subresource-access-test/subresource-access-test.go index 4a07d1b1a..4019d3cc9 100644 --- a/vendor/kubevirt.io/kubevirt/cmd/subresource-access-test/subresource-access-test.go +++ b/vendor/kubevirt.io/kubevirt/cmd/subresource-access-test/subresource-access-test.go @@ -22,6 +22,9 @@ package main import ( "flag" "fmt" + "os" + + "k8s.io/client-go/rest" "kubevirt.io/kubevirt/pkg/kubecli" ) @@ -37,8 +40,13 @@ func main() { } restClient := client.RestClient() + var result rest.Result - result := restClient.Get().Resource("virtualmachines").Namespace("default").Name("fake").SubResource("test").Do() + if os.Args[1] == "version" { + result = restClient.Get().Resource("version").Do() + } else { + result = restClient.Get().Resource("virtualmachineinstances").Namespace("default").Name("fake").SubResource("test").Do() + } err = result.Error() if err != nil { diff --git a/vendor/kubevirt.io/kubevirt/cmd/virt-api/Dockerfile b/vendor/kubevirt.io/kubevirt/cmd/virt-api/Dockerfile index 86d270236..59ec18390 100644 --- a/vendor/kubevirt.io/kubevirt/cmd/virt-api/Dockerfile +++ b/vendor/kubevirt.io/kubevirt/cmd/virt-api/Dockerfile @@ -25,6 +25,6 @@ RUN useradd -u 1001 --create-home -s /bin/bash virt-api WORKDIR /home/virt-api USER 1001 -COPY virt-api /virt-api +COPY virt-api /usr/bin/virt-api -ENTRYPOINT [ "/virt-api" ] +ENTRYPOINT [ "/usr/bin/virt-api" ] diff --git a/vendor/kubevirt.io/kubevirt/cmd/virt-api/virt-api.go b/vendor/kubevirt.io/kubevirt/cmd/virt-api/virt-api.go index 04bfb5336..ba2ac857a 100644 --- a/vendor/kubevirt.io/kubevirt/cmd/virt-api/virt-api.go +++ b/vendor/kubevirt.io/kubevirt/cmd/virt-api/virt-api.go @@ -30,7 +30,5 @@ func main() { app := virt_api.NewVirtApi() service.Setup(app) - app.Compose() - app.ConfigureOpenAPIService() - app.Run() + app.Execute() } diff --git a/vendor/kubevirt.io/kubevirt/cmd/virt-controller/Dockerfile b/vendor/kubevirt.io/kubevirt/cmd/virt-controller/Dockerfile index 710fa4345..201478abe 100644 --- a/vendor/kubevirt.io/kubevirt/cmd/virt-controller/Dockerfile +++ b/vendor/kubevirt.io/kubevirt/cmd/virt-controller/Dockerfile @@ -24,6 +24,6 @@ MAINTAINER "The KubeVirt Project" RUN useradd -u 1001 --create-home -s /bin/bash virt-controller WORKDIR /home/virt-controller USER 1001 -COPY virt-controller /virt-controller +COPY virt-controller /usr/bin/virt-controller -ENTRYPOINT [ "/virt-controller" ] +ENTRYPOINT [ "/usr/bin/virt-controller" ] diff --git a/vendor/kubevirt.io/kubevirt/cmd/virt-handler/Dockerfile b/vendor/kubevirt.io/kubevirt/cmd/virt-handler/Dockerfile index f4f7a93ff..b84c9d721 100644 --- a/vendor/kubevirt.io/kubevirt/cmd/virt-handler/Dockerfile +++ b/vendor/kubevirt.io/kubevirt/cmd/virt-handler/Dockerfile @@ -20,6 +20,6 @@ FROM fedora:27 MAINTAINER "The KubeVirt Project" -COPY virt-handler /virt-handler +COPY virt-handler /usr/bin/virt-handler -ENTRYPOINT [ "/virt-handler" ] +ENTRYPOINT [ "/usr/bin/virt-handler" ] diff --git a/vendor/kubevirt.io/kubevirt/cmd/virt-handler/virt-handler.go b/vendor/kubevirt.io/kubevirt/cmd/virt-handler/virt-handler.go index cb3e55207..0d3b426c2 100644 --- a/vendor/kubevirt.io/kubevirt/cmd/virt-handler/virt-handler.go +++ b/vendor/kubevirt.io/kubevirt/cmd/virt-handler/virt-handler.go @@ -58,6 +58,9 @@ const ( hostOverride = "" virtShareDir = "/var/run/kubevirt" + + // This value is derived from default MaxPods in Kubelet Config + maxDevices = 110 ) type virtHandlerApp struct { @@ -65,6 +68,7 @@ type virtHandlerApp struct { HostOverride string VirtShareDir string WatchdogTimeoutDuration time.Duration + MaxDevices int } var _ service.Service = &virtHandlerApp{} @@ -89,7 +93,7 @@ func (app *virtHandlerApp) Run() { } broadcaster := record.NewBroadcaster() broadcaster.StartRecordingToSink(&k8coresv1.EventSinkImpl{Interface: virtCli.CoreV1().Events(k8sv1.NamespaceAll)}) - // Scheme is used to create an ObjectReference from an Object (e.g. VM) during Event creation + // Scheme is used to create an ObjectReference from an Object (e.g. VirtualMachineInstance) during Event creation recorder := broadcaster.NewRecorder(scheme.Scheme, k8sv1.EventSource{Component: "virt-handler", Host: app.HostOverride}) if err != nil { @@ -101,7 +105,7 @@ func (app *virtHandlerApp) Run() { panic(err) } - // Wire VM controller + // Wire VirtualMachineInstance controller // Wire Domain controller domainSharedInformer, err := virtcache.NewSharedInformer(app.VirtShareDir, int(app.WatchdogTimeoutDuration.Seconds())) @@ -110,8 +114,8 @@ func (app *virtHandlerApp) Run() { } vmSharedInformer := cache.NewSharedIndexInformer( - controller.NewListWatchFromClient(virtCli.RestClient(), "virtualmachines", k8sv1.NamespaceAll, fields.Everything(), l), - &v1.VirtualMachine{}, + controller.NewListWatchFromClient(virtCli.RestClient(), "virtualmachineinstances", k8sv1.NamespaceAll, fields.Everything(), l), + &v1.VirtualMachineInstance{}, 0, cache.Indexers{}, ) @@ -133,6 +137,8 @@ func (app *virtHandlerApp) Run() { vmSharedInformer, domainSharedInformer, gracefulShutdownInformer, + int(app.WatchdogTimeoutDuration.Seconds()), + maxDevices, ) // Bootstrapping. From here on the startup order matters @@ -151,13 +157,19 @@ func (app *virtHandlerApp) AddFlags() { app.AddCommonFlags() flag.StringVar(&app.HostOverride, "hostname-override", hostOverride, - "Name under which the node is registered in kubernetes, where this virt-handler instance is running on") + "Name under which the node is registered in Kubernetes, where this virt-handler instance is running on") flag.StringVar(&app.VirtShareDir, "kubevirt-share-dir", virtShareDir, "Shared directory between virt-handler and virt-launcher") flag.DurationVar(&app.WatchdogTimeoutDuration, "watchdog-timeout", defaultWatchdogTimeout, "Watchdog file timeout") + + // TODO: the Device Plugin API does not allow for infinitely available (shared) devices + // so the current approach is to register an arbitrary number. + // This should be deprecated if the API allows for shared resources in the future + flag.IntVar(&app.MaxDevices, "max-devices", maxDevices, + "Number of devices to register with Kubernetes device plugin framework") } func main() { diff --git a/vendor/kubevirt.io/kubevirt/cmd/virt-launcher/Dockerfile b/vendor/kubevirt.io/kubevirt/cmd/virt-launcher/Dockerfile index 883f74a4b..b028e291d 100644 --- a/vendor/kubevirt.io/kubevirt/cmd/virt-launcher/Dockerfile +++ b/vendor/kubevirt.io/kubevirt/cmd/virt-launcher/Dockerfile @@ -26,21 +26,18 @@ RUN dnf -y install \ util-linux \ libcgroup-tools \ ethtool \ + net-tools \ sudo && dnf -y clean all && \ test $(id -u qemu) = 107 # make sure that the qemu user really is 107 -COPY sock-connector /sock-connector -COPY sh.sh /sh.sh -COPY virt-launcher /virt-launcher - +COPY virt-launcher /usr/bin/virt-launcher COPY kubevirt-sudo /etc/sudoers.d/kubevirt -RUN chmod 0640 /etc/sudoers.d/kubevirt -# libvirtd.sh in this image differs from upstream -RUN rm -f /libvirtd.sh -COPY libvirtd.sh /libvirtd.sh -RUN chmod a+x /libvirtd.sh +# Allow qemu to bind privileged ports +RUN setcap CAP_NET_BIND_SERVICE=+eip /usr/bin/qemu-system-x86_64 -COPY entrypoint.sh /entrypoint.sh +# libvirtd.sh in this image differs from upstream +RUN mkdir -p /usr/share/kubevirt/virt-launcher +COPY entrypoint.sh libvirtd.sh sock-connector /usr/share/kubevirt/virt-launcher/ -ENTRYPOINT [ "/entrypoint.sh" ] +ENTRYPOINT [ "/usr/share/kubevirt/virt-launcher/entrypoint.sh" ] diff --git a/vendor/kubevirt.io/kubevirt/cmd/virt-launcher/entrypoint.sh b/vendor/kubevirt.io/kubevirt/cmd/virt-launcher/entrypoint.sh index fe59d89ee..673bac11f 100755 --- a/vendor/kubevirt.io/kubevirt/cmd/virt-launcher/entrypoint.sh +++ b/vendor/kubevirt.io/kubevirt/cmd/virt-launcher/entrypoint.sh @@ -8,21 +8,12 @@ _term() { trap _term SIGTERM SIGINT SIGQUIT -# HACK -# Try to create /dev/kvm if not present -if [ ! -e /dev/kvm ]; then - mknod /dev/kvm c 10 $(grep '\' /proc/misc | cut -f 1 -d' ') -fi - +# FIXME: The plugin framework doesn't appear to (currently) have a means +# to specify device ownership. This needs to be re-visited if that changes chown :qemu /dev/kvm chmod 660 /dev/kvm -# Cockpit/OCP hack to all shoing the vm terminal -mv /usr/bin/sh /usr/bin/sh.orig -mv /sh.sh /usr/bin/sh -chmod +x /usr/bin/sh - -./virt-launcher $@ & +virt-launcher $@ & virt_launcher_pid=$! while true; do if ! [ -d /proc/$virt_launcher_pid ]; then diff --git a/vendor/kubevirt.io/kubevirt/cmd/virt-launcher/libvirtd.sh b/vendor/kubevirt.io/kubevirt/cmd/virt-launcher/libvirtd.sh index c03e02246..c12df7990 100755 --- a/vendor/kubevirt.io/kubevirt/cmd/virt-launcher/libvirtd.sh +++ b/vendor/kubevirt.io/kubevirt/cmd/virt-launcher/libvirtd.sh @@ -48,4 +48,9 @@ fi echo "cgroup_controllers = [ ]" >>/etc/libvirt/qemu.conf -/usr/sbin/libvirtd +# Be sure that libvirt always will be look the same directory for hugepages mount +if [ -d "/dev/hugepages" ]; then + echo 'hugetlbfs_mount = "/dev/hugepages"' >>/etc/libvirt/qemu.conf +fi + +/usr/sbin/libvirtd \ No newline at end of file diff --git a/vendor/kubevirt.io/kubevirt/cmd/virt-launcher/sh.sh b/vendor/kubevirt.io/kubevirt/cmd/virt-launcher/sh.sh deleted file mode 100644 index f08e6b9f1..000000000 --- a/vendor/kubevirt.io/kubevirt/cmd/virt-launcher/sh.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/sh.orig - -args="$@" -if [ "$args" = "-i -c TERM=xterm /bin/sh" ] ; then - namespace="$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace)" - name="$(ls /var/run/kubevirt-private/${namespace}/)" - exec /usr/bin/sh.orig -c "/sock-connector /var/run/kubevirt-private/${namespace}/${name}/virt-serial0" -else - exec /usr/bin/sh.orig "$@" -fi diff --git a/vendor/kubevirt.io/kubevirt/cmd/virt-launcher/virt-launcher.go b/vendor/kubevirt.io/kubevirt/cmd/virt-launcher/virt-launcher.go index 6d8a48dd8..691c9e93e 100644 --- a/vendor/kubevirt.io/kubevirt/cmd/virt-launcher/virt-launcher.go +++ b/vendor/kubevirt.io/kubevirt/cmd/virt-launcher/virt-launcher.go @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * Copyright 2017 Red Hat, Inc. + * Copyright 2017, 2018 Red Hat, Inc. * */ @@ -29,6 +29,7 @@ import ( "github.com/libvirt/libvirt-go" "github.com/spf13/pflag" + utilwait "k8s.io/apimachinery/pkg/util/wait" "k8s.io/apimachinery/pkg/watch" "kubevirt.io/kubevirt/pkg/api/v1" @@ -60,7 +61,8 @@ func markReady(readinessFile string) { func startCmdServer(socketPath string, domainManager virtwrap.DomainManager, - stopChan chan struct{}) { + stopChan chan struct{}, + options *cmdserver.ServerOptions) { err := os.RemoveAll(socketPath) if err != nil { @@ -74,12 +76,32 @@ func startCmdServer(socketPath string, panic(err) } - err = cmdserver.RunServer(socketPath, domainManager, stopChan) + err = cmdserver.RunServer(socketPath, domainManager, stopChan, options) if err != nil { log.Log.Reason(err).Error("Failed to start virt-launcher cmd server") panic(err) } + // ensure the cmdserver is responsive before continuing + // PollImmediate breaks the poll loop when bool or err are returned OR if timeout occurs. + // + // Timing out causes an error to be returned + err = utilwait.PollImmediate(1*time.Second, 15*time.Second, func() (bool, error) { + client, err := cmdclient.GetClient(socketPath) + if err != nil { + return false, nil + } + + err = client.Ping() + if err != nil { + return false, nil + } + return true, nil + }) + + if err != nil { + panic(fmt.Errorf("failed to connect to cmd server: %v", err)) + } } func createLibvirtConnection() virtcli.Connection { @@ -172,16 +194,41 @@ func initializeDirs(virtShareDir string, } } +func waitForDomainUUID(timeout time.Duration, domainManager virtwrap.DomainManager) string { + start := time.Now() + + for time.Since(start) < timeout { + time.Sleep(time.Second) + list, err := domainManager.ListAllDomains() + if err != nil { + log.Log.Reason(err).Error("failed to retrieve domains from libvirt") + continue + } + + if len(list) == 0 { + continue + } + + domain := list[0] + if domain.Spec.UUID != "" { + log.Log.Infof("Detected domain with UUID %s", domain.Spec.UUID) + return domain.Spec.UUID + } + } + + panic(fmt.Errorf("timed out waiting for domain to be defined")) +} + func waitForFinalNotify(deleteNotificationSent chan watch.Event, domainManager virtwrap.DomainManager, - vm *v1.VirtualMachine) { + vm *v1.VirtualMachineInstance) { // There are many conditions that can cause the qemu pid to exit that - // don't involve the VM's domain from being deleted from libvirt. + // don't involve the VirtualMachineInstance's domain from being deleted from libvirt. // - // KillVM is idempotent. Making a call to KillVM here ensures that the deletion - // occurs regardless if the VM crashed unexpectidly or if virt-handler requested + // KillVMI is idempotent. Making a call to KillVMI here ensures that the deletion + // occurs regardless if the VirtualMachineInstance crashed unexpectedly or if virt-handler requested // a graceful shutdown. - domainManager.KillVM(vm) + domainManager.KillVMI(vm) log.Log.Info("Waiting on final notifications to be sent to virt-handler.") @@ -201,17 +248,22 @@ func main() { qemuTimeout := flag.Duration("qemu-timeout", defaultStartTimeout, "Amount of time to wait for qemu") virtShareDir := flag.String("kubevirt-share-dir", "/var/run/kubevirt", "Shared directory between virt-handler and virt-launcher") ephemeralDiskDir := flag.String("ephemeral-disk-dir", "/var/run/libvirt/kubevirt-ephemeral-disk", "Base directory for ephemeral disk data") - name := flag.String("name", "", "Name of the VM") - namespace := flag.String("namespace", "", "Namespace of the VM") + name := flag.String("name", "", "Name of the VirtualMachineInstance") + namespace := flag.String("namespace", "", "Namespace of the VirtualMachineInstance") watchdogInterval := flag.Duration("watchdog-update-interval", defaultWatchdogInterval, "Interval at which watchdog file should be updated") - readinessFile := flag.String("readiness-file", "/tmp/health", "Pod looks for tihs file to determine when virt-launcher is initialized") - gracePeriodSeconds := flag.Int("grace-period-seconds", 30, "Grace period to observe before sending SIGTERM to vm process.") + readinessFile := flag.String("readiness-file", "/tmp/health", "Pod looks for this file to determine when virt-launcher is initialized") + gracePeriodSeconds := flag.Int("grace-period-seconds", 30, "Grace period to observe before sending SIGTERM to vm process") + useEmulation := flag.Bool("use-emulation", false, "Use software emulation") + + // set new default verbosity, was set to 0 by glog + flag.Set("v", "2") + pflag.CommandLine.AddGoFlagSet(flag.CommandLine) pflag.Parse() log.InitializeLogging("virt-launcher") - vm := v1.NewVMReferenceFromNameWithNS(*namespace, *name) + vm := v1.NewVMIReferenceFromNameWithNS(*namespace, *name) // Initialize local and shared directories initializeDirs(*virtShareDir, *ephemeralDiskDir, *namespace, *name) @@ -234,8 +286,9 @@ func main() { // Start the virt-launcher command service. // Clients can use this service to tell virt-launcher // to start/stop virtual machines + options := cmdserver.NewServerOptions(*useEmulation) socketPath := cmdclient.SocketFromNamespaceName(*virtShareDir, *namespace, *name) - startCmdServer(socketPath, domainManager, stopChan) + startCmdServer(socketPath, domainManager, stopChan, options) watchdogFile := watchdog.WatchdogFileFromNamespaceName(*virtShareDir, *namespace, @@ -252,16 +305,12 @@ func main() { } shutdownCallback := func(pid int) { - err := domainManager.KillVM(vm) + err := domainManager.KillVMI(vm) if err != nil { log.Log.Reason(err).Errorf("Unable to stop qemu with libvirt, falling back to SIGTERM") syscall.Kill(pid, syscall.SIGTERM) } } - mon := virtlauncher.NewProcessMonitor("qemu", - gracefulShutdownTriggerFile, - *gracePeriodSeconds, - shutdownCallback) deleteNotificationSent := make(chan watch.Event, 10) // Send domain notifications to virt-handler @@ -272,6 +321,12 @@ func main() { // managing virtual machines. markReady(*readinessFile) + domainUUID := waitForDomainUUID(*qemuTimeout, domainManager) + mon := virtlauncher.NewProcessMonitor(domainUUID, + gracefulShutdownTriggerFile, + *gracePeriodSeconds, + shutdownCallback) + // This is a wait loop that monitors the qemu pid. When the pid // exits, the wait loop breaks. mon.RunForever(*qemuTimeout) diff --git a/vendor/kubevirt.io/kubevirt/docs/README.md b/vendor/kubevirt.io/kubevirt/docs/README.md index 4914b0302..834ded304 100644 --- a/vendor/kubevirt.io/kubevirt/docs/README.md +++ b/vendor/kubevirt.io/kubevirt/docs/README.md @@ -1,49 +1,39 @@ ## Technical Overview -Kubernetes allows for extensions to its architecture in the form of 3rd party -resources: . -KubeVirt represents virtual machines as 3rd party resources and manages changes +Kubernetes allows for extensions to its architecture in the form of custom +resources: . +KubeVirt represents virtual machines as custom resources and manages changes to libvirt domains based on the state of those resources. -This project provides a Vagrant setup with the requisite components already -installed. To boot a vanilla kubernetes environment as base for kubevirt, -simply type `vagrant up` from the root directory of the git tree, which can be -found here: - - - -Once the Vagrant provisioning script has completed, run `./cluster/sync.sh` to -build and deploy KubeVirt specific components to the Vagrant nodes. - -Note: KubeVirt is built in go. A properly configured go environment is -therefore required. For best results, use this path: -`$GOPATH/src/kubevirt.io/kubevirt/` - ### Project Components * virt-api: This component provides a HTTP RESTful entrypoint to manage the virtual machines within the cluster. - * virt-controller: This component manages the state of each VM within the + * virt-controller: This component manages the state of each VMI within the Kubernetes cluster. * virt-handler: This is a daemon that runs on each Kubernetes node. It is - responsible for monitoring the state of VMs according to Kubernetes and + responsible for monitoring the state of VMIs according to Kubernetes and ensuring the corresponding libvirt domain is booted or halted accordingly. - * virt-launcher: This component is a place-holder, one per running VM. Its - job is to remain running as long as the VM is defined. This simply prevents a - crash-loop state. - * ha-proxy: This daemon proxies connections from 192.168.200.2 to the running - master node--making it possible to establish connections in a consistent - manner. + * virt-launcher: This component is a place-holder, one per running VMI. It + contains the running VMI and remains running as long as the VMI is defined. ### Scripts - * `cluster/sync.sh`: After deploying a fresh vagrant environment, or after - making changes to code in this tree, this script will sync the Pods and - DaemonSets in the running KubeVirt environment with the state of this tree. - * `cluster/kubectl.sh`: This is a wrapper around Kubernete's kubectl command so + * `cluster/kubectl.sh`: This is a wrapper around Kubernetes' kubectl command so that it can be run directly from this checkout without logging into a node. - * `cluster/sync_config.sh`: This script will contact the master node and - collect its config and kubectl. It is called by sync.sh so does not generally - need to be run separately. - * `cluster/vm-isolation-check.sh`: This script will run a series of tests to ensure - the system is set up correctly. + * `cluster/virtctl.sh` is a wrapper around `virtctl`. `virtctl` brings all + virtual machine specific commands with it. It is supplement to `kubectl`. + e.g. `cluster/virtctl.sh console testvm`. + * `cluster/cli.sh` helps you creating ephemeral kubernetes and openshift + clusters for testing. This is helpful when direct management or access to + cluster nodes is necessary. e.g. `cluster/cli.sh ssh node01`. + +### Makefile Commands + + * `make cluster-up`: This will deploy a fresh environment, the contents of + `KUBE_PROVIDER` will be used to determine which provider from the `cluster` + directory will be deployed. + * `make cluster-sync`: After deploying a fresh environment, or after making + changes to code in this tree, this command will sync the Pods and DaemonSets + in the running KubeVirt environment with the state of this tree. + * `make cluster-down`: This will tear down a running KubeVirt enviornment. diff --git a/vendor/kubevirt.io/kubevirt/docs/architecture.md b/vendor/kubevirt.io/kubevirt/docs/architecture.md index 45345f57f..3a85a9c74 100644 --- a/vendor/kubevirt.io/kubevirt/docs/architecture.md +++ b/vendor/kubevirt.io/kubevirt/docs/architecture.md @@ -24,7 +24,7 @@ pattern. Users requiring virtualization services are speaking to the Virtualization API (see below) which in turn is speaking to the Kubernetes cluster to schedule -requested VMs. Scheduling, networking, and storage are all delegated to +requested VMIs. Scheduling, networking, and storage are all delegated to Kubernetes, while KubeVirt provides the virtualization functionality. @@ -53,17 +53,17 @@ to provide the new functionality: Once all three steps have been completed, you are able to -- create new objects of these new types in Kubernetes (VMs in our +- create new objects of these new types in Kubernetes (VMIs in our case) -- and the new controllers take care to get the VMs scheduled on some host, +- and the new controllers take care to get the VMIs scheduled on some host, - and a daemon - the `virt-handler` - is taking care on a host - alongside the - `kubelet` - to launch the VM and configure it until it matches the required + `kubelet` - to launch the VMI and configure it until it matches the required state. One a final note it is to say that both, the controllers and daemons are running as Pods (or similar) _on top of_ the Kubernetes cluster, and are not installed alongside of it. The type is - as said before - even defined inside the -Kubernetes API server. This allows users to speak to Kubernetes, but modify VMs. +Kubernetes API server. This allows users to speak to Kubernetes, but modify VMIs. The following diagram illustrates how the additional controllers and daemons communicate with Kubernetes and where the additional types are stored: @@ -80,12 +80,12 @@ communicate with Kubernetes and where the additional types are stored: * libvirtd * … * KubeVirt Managed Pods - * VM Foo - * VM Bar + * VMI Foo + * VMI Bar * … ## Native Workloads KubeVirt is deployed on top of a Kubernetes cluster. This means that you can continue to run your Kubernetes-native workloads next -to the VMs managed through KubeVirt. +to the VMIs managed through KubeVirt. diff --git a/vendor/kubevirt.io/kubevirt/docs/architecture.svg b/vendor/kubevirt.io/kubevirt/docs/architecture.svg index c6a4db6a3..44fe224e9 100644 --- a/vendor/kubevirt.io/kubevirt/docs/architecture.svg +++ b/vendor/kubevirt.io/kubevirt/docs/architecture.svg @@ -468,7 +468,7 @@ id="tspan4353" x="312.57471" y="259.2937" - style="fill:#000000;stroke-width:0.26458332px">VM + style="fill:#000000;stroke-width:0.26458332px">VMI Pod (per VM) + sodipodi:role="line">Pod (per VMI) validate | | - create ---> VM ---> observe --------------> observe + create ---> VMI ---> observe --------------> observe | | v v - validate <--------- POST /pods defineVM + validate <--------- POST /pods defineVMI create | | | | | | | schedPod ---------> observe | | | v | validate <--------- PUT /virtualmachines | - update ---> VM ---------------------------> observe - | | | launchVM + update ---> VMI ---------------------------> observe + | | | launchVMI | | | | : : : : | | | | DELETE /virtualmachines -> validate | | | delete ----> * ---------------------------> observe - | | shutdownVM + | | shutdownVMI | | | : : : ``` @@ -61,21 +61,21 @@ DELETE /virtualmachines -> validate | | | there are _temporary workarounds_ in place to avoid bugs and address some other stuff. -1. A client posts a new VM definition to the K8s API Server. -2. The K8s API Server validates the input and creates a `VM` custom resource +1. A client posts a new VMI definition to the K8s API Server. +2. The K8s API Server validates the input and creates a `VMI` custom resource definition (CRD) object. -3. The `virt-controller` observes the creation of the new `VM` object +3. The `virt-controller` observes the creation of the new `VMI` object and creates a corrsponding pod. 4. Kubernetes is scheduling the pod on a host. -5. The `virt-controller` observes that a pod for the `VM` got started and - updates the `nodeName` field in the`VM` object. +5. The `virt-controller` observes that a pod for the `VMI` got started and + updates the `nodeName` field in the`VMI` object. Now that the `nodeName` is set, the responsibility transitions to the `virt-handler` for any further action. -6. The `virt-handler` (_DaemonSet_) observes that a `VM` got assigned to the +6. The `virt-handler` (_DaemonSet_) observes that a `VMI` got assigned to the host where it is running on. -6. The `virt-handler` is using the _VM Specification_ and signals the creation - of the corresponding domain using a `libvirtd` instance in the VM's pod. -7. A client deletes the `VM` object through the `virt-api-server`. +6. The `virt-handler` is using the _VMI Specification_ and signals the creation + of the corresponding domain using a `libvirtd` instance in the VMI's pod. +7. A client deletes the `VMI` object through the `virt-api-server`. 8. The `virt-handler` observes the deletion and turns off the domain. ## `virt-api-server` @@ -86,14 +86,14 @@ flows. The API Server is taking care to update the virtualization related custom resource definition (see below). -As the main entrypoint to KubeVirt it is responsible for defaulting and validation of the provided VM CRDs. +As the main entrypoint to KubeVirt it is responsible for defaulting and validation of the provided VMI CRDs. -## `VM` (CRD) +## `VMI` (CRD) -VM definitions are kept as custom resource definitions inside the Kubernetes API +VMI definitions are kept as custom resource definitions inside the Kubernetes API server. -The VM definition is defining all properties of the Virtual machine itself, +The VMI definition is defining all properties of the Virtual machine itself, for example * Machine type @@ -107,34 +107,34 @@ for example From a high-level perspective the virt-controller has all the _cluster wide_ virtualization functionality. -This controller is responsible for monitoring the VM (CRDs) and managing the +This controller is responsible for monitoring the VMI (CRDs) and managing the associated pods. Currently the controller will make sure to create and manage -the life-cycle of the pods associated to the VM objects. +the life-cycle of the pods associated to the VMI objects. -A VM object will always be associated to a pod during it's life-time, however, -due to i.e. migration of a VM the pod instance might change over time. +A VMI object will always be associated to a pod during it's life-time, however, +due to i.e. migration of a VMI the pod instance might change over time. ## `virt-launcher` -For every VM object one pod is created. This pod's primary container runs the +For every VMI object one pod is created. This pod's primary container runs the `virt-launcher` KubeVirt component. -Kubernetes or the kubelet is not running the VMs itself. Instead a daemon on -every host in the cluster will take care to launch a VM process for every -pod which is associated to a VM object whenever it is getting scheduled on a +Kubernetes or the kubelet is not running the VMIs itself. Instead a daemon on +every host in the cluster will take care to launch a VMI process for every +pod which is associated to a VMI object whenever it is getting scheduled on a host. The main purpose of the `virt-launcher` Pod is to provide the cgroups and -namespaces, which will be used to host the VM process. +namespaces, which will be used to host the VMI process. -`virt-handler` signals `virt-launcher` to start a VM by passing the VM's CRD object +`virt-handler` signals `virt-launcher` to start a VMI by passing the VMI's CRD object to `virt-launcher`. `virt-launcher` then uses a local libvirtd instance within its -container to start the VM. From there `virt-launcher` monitors the VM process and -terminates once the VM has exited. +container to start the VMI. From there `virt-launcher` monitors the VMI process and +terminates once the VMI has exited. If the Kubernetes runtime attempts to shutdown the `virt-launcher` pod before the -VM has exited, `virt-launcher` forwards signals from Kubernetes to the VM -process and attempts to hold off the termination of the pod until the VM has +VMI has exited, `virt-launcher` forwards signals from Kubernetes to the VMI +process and attempts to hold off the termination of the pod until the VMI has shutdown successfully. ## `virt-handler` @@ -142,23 +142,23 @@ shutdown successfully. Every host needs a single instance of `virt-handler`. It can be delivered as a DaemonSet. Like the `virt-controller`, the `virt-handler` is also reactive and is watching for -changes of the VM object, once detected it will perform all necessary -operations to change a VM to meet the required state. +changes of the VMI object, once detected it will perform all necessary +operations to change a VMI to meet the required state. This behavior is similar to the choreography between the Kubernetes API Server and the kubelet. The main areas which `virt-handler` has to cover are: -1. Keep a cluster-level VM spec in sync with a corresponding libvirt domain. +1. Keep a cluster-level VMI spec in sync with a corresponding libvirt domain. 2. Report domain state and spec changes to the cluster. -3. Invoke node-centric plugins which can fulfill networking and storage requirements defined in VM specs. +3. Invoke node-centric plugins which can fulfill networking and storage requirements defined in VMI specs. ## `libvirtd` -An instance of `libvirtd` is present in every VM pod. `virt-launcher` uses libvirtd -to manage the life-cycle of the VM process. +An instance of `libvirtd` is present in every VMI pod. `virt-launcher` uses libvirtd +to manage the life-cycle of the VMI process. # Additional components @@ -172,7 +172,7 @@ functionality is not provided by kubernetes itself. ## Storage -We will try to leverage as much of Kubernetes regarding to mounting and preparing images for VM. +We will try to leverage as much of Kubernetes regarding to mounting and preparing images for VMI. However, `virt-handler` may provide a plugin mechanism to allow storage mounting and setup from the host, if the KubeVirt requirements do not fit into the Kubernetes storage scenarios. Since host side preparation of storage may not be enough, a cluster-wide [Storage Controller](###storage-controller) can be used to prepare storage. diff --git a/vendor/kubevirt.io/kubevirt/docs/config-and-instances.md b/vendor/kubevirt.io/kubevirt/docs/config-and-instances.md index fa36c43f6..68e2cf40e 100644 --- a/vendor/kubevirt.io/kubevirt/docs/config-and-instances.md +++ b/vendor/kubevirt.io/kubevirt/docs/config-and-instances.md @@ -2,16 +2,16 @@ ## Motivation -So far KubeVirt provides a pod-like interface when managing VMs. This seems to +So far KubeVirt provides a pod-like interface when managing VMIs. This seems to be a good building block. On the other hand this might not be sufficient for usual virtualization -management UIs, which do expect to manage the complete life-cycle of a VM, -including shut down VMs (which is currently not intended by the core runtime). +management UIs, which do expect to manage the complete life-cycle of a VMI, +including shut down VMIs (which is currently not intended by the core runtime). -The purpose of this document is to describe a design that allows creating a VM -configurations and how these can be used to create a VM instances. This -document specifically focuses on how the non-running and running VM definitions +The purpose of this document is to describe a design that allows creating a VMI +configurations and how these can be used to create a VMI instances. This +document specifically focuses on how the non-running and running VMI definitions relate to each other. Already known but not yet designed requirements were considered for this @@ -19,10 +19,10 @@ design. ## Requirements -* Running and non-running VMs are handled through the same API -* Creating a VM must be separate from launching a VM -* Support expanding sparse VM definitions -* Support detailed VM definitions +* Running and non-running VMIs are handled through the same API +* Creating a VMI must be separate from launching a VMI +* Support expanding sparse VMI definitions +* Support detailed VMI definitions ## Additional context @@ -40,18 +40,18 @@ The design of these items is out of scope of this document. ## API -In addition to the existing `VM` type, a new `VirtualMachineConfig` type is +In addition to the existing `VMI` type, a new `VirtualMachineInstanceConfig` type is getting introduced. -In contrast to the `VM` object which represents a running VM, the -`VirtualMachineConfig` object represents a static VM configuration. -A `VirtualMachineConfig` object is used to create one or more `VM` instances. +In contrast to the `VMI` object which represents a running VMI, the +`VirtualMachineInstanceConfig` object represents a static VMI configuration. +A `VirtualMachineInstanceConfig` object is used to create one or more `VMI` instances. ### Kinds -**VirtualMachineConfig** +**VirtualMachineInstanceConfig** ```yaml -Kind: VirtualMachineConfig +Kind: VirtualMachineInstanceConfig Spec: Template: Metadata: @@ -63,11 +63,11 @@ Spec: **Instance** -The instance object `VM` is equal to the already present entity in the core +The instance object `VMI` is equal to the already present entity in the core KubeVirt runtime. ```yaml -Kind: VM +Kind: VMI Metadata: ownerReferences: [{$config}] Spec: @@ -79,10 +79,10 @@ State: … ``` -The new `ownerReferences` field is pointing back to the `VirtualMachineConfig` -object which was used to create this `VM` object. +The new `ownerReferences` field is pointing back to the `VirtualMachineInstanceConfig` +object which was used to create this `VMI` object. It will be added to the metadata by the controller owning the -`VirtualMachineConfig` type. +`VirtualMachineInstanceConfig` type. The scheme can look similar to the `ownerReferences` field of a ReplicaSet if it got created by a Deployment. @@ -91,30 +91,30 @@ if it got created by a Deployment. ## Flow -The general concept is that the `VirtualMachineConfig` contains a static VM +The general concept is that the `VirtualMachineInstanceConfig` contains a static VMI configuration. Static refers to the fact that no runtime information is kept in such objects. -The runtime information of a VM is kept in the `VM` object, i.e. it's state +The runtime information of a VMI is kept in the `VMI` object, i.e. it's state or computed values like bus addresses. ## Creation -To create a VM definition, a user needs to `POST` a `VirtualMachineConfig`. +To create a VMI definition, a user needs to `POST` a `VirtualMachineInstanceConfig`. -## Starting a VM, the `/start` sub-resource -To create an instance from a `VirtualMachineConfig` a user must `GET` the `start` -sub-resource of a `VirtualMachineConfig` instance. +## Starting a VMI, the `/start` sub-resource +To create an instance from a `VirtualMachineInstanceConfig` a user must `GET` the `start` +sub-resource of a `VirtualMachineInstanceConfig` instance. -## Stopping a VM, the `/stop` sub-resource -To stop a VM, a user must `GET` the `stop` sub-resource of the associated -`VirtualMachineConfig` object. +## Stopping a VMI, the `/stop` sub-resource +To stop a VMI, a user must `GET` the `stop` sub-resource of the associated +`VirtualMachineInstanceConfig` object. -**Note:** The semantics of a `DELETE` on the `VM` object of a -`VirtualMachineConfig` still need to be defined. +**Note:** The semantics of a `DELETE` on the `VMI` object of a +`VirtualMachineInstanceConfig` still need to be defined. -## Changing a `VirtualMachineConfig` -Changes to a `VirtualMachineConfig` instance can be performed through the usual -`PATH` calls. Changing a `VirtualMachineConfig` does not lead to an automatic +## Changing a `VirtualMachineInstanceConfig` +Changes to a `VirtualMachineInstanceConfig` instance can be performed through the usual +`PATH` calls. Changing a `VirtualMachineInstanceConfig` does not lead to an automatic propagation of the changes to the instances. However, in future there could be a specific metadata or action to trigger such propagation automatically. @@ -139,45 +139,45 @@ In other words: 1. A new config is created by a user `POST` $c1 config -2. A new VM is created based on the config +2. A new VMI is created based on the config `GET` $c1/start → creates instance `POST` $i1 -3. The VM instance is getting stopped +3. The VMI instance is getting stopped `GET` $c1/stop → `DELETE` $i1 4. The config is getting updated `PATCH` $c3 -5. A new VM instance is getting started +5. A new VMI instance is getting started `GET` $c1/start → creates instance `POST` $i2 -6. The new VM instance is getting stopped +6. The new VMI instance is getting stopped `GET` $c1/stop → deletes instance `DELETE` $i2 -In this example, the user defines a `VirtualMachineConfig`, then starts it and -a `VM` instance is created. Once the user stops it, the instance is removed. -After changing the `VirtualMachineConfig` (in step 4), he starts and stops the -VM again. +In this example, the user defines a `VirtualMachineInstanceConfig`, then starts it and +a `VMI` instance is created. Once the user stops it, the instance is removed. +After changing the `VirtualMachineInstanceConfig` (in step 4), he starts and stops the +VMI again. ### Review Does this design meet the requirements? -* _Running and non-running VMs are handled through the same API_ is given. -* _Creating a VM must be separate from launching a VM_ is also given by having +* _Running and non-running VMIs are handled through the same API_ is given. +* _Creating a VMI must be separate from launching a VMI_ is also given by having the separate objects. -* _Support expanding sparse VM definitions_ can happen at several stages. -* _Support detailed VM definitions_ is also given, if needed a fully fledged - definition can be specified in the VirtualMachineConfig +* _Support expanding sparse VMI definitions_ can happen at several stages. +* _Support detailed VMI definitions_ is also given, if needed a fully fledged + definition can be specified in the VirtualMachineInstanceConfig Does the design obviously prevent any other use-case we already aware of? * _"Flavour", "Instance Type", or "Template" like functionality_ it looks like - the static `VirtualMachineConfig` object provides enough flexibility. + the static `VirtualMachineInstanceConfig` object provides enough flexibility. * _Hot-(un-)plugging_ does not seem to be conflicting -* _Representation of dynamic instance specific data_ VM instance is well suited +* _Representation of dynamic instance specific data_ VMI instance is well suited for this. * _Defaulting (to support OS compatibility)_ can also happen at multiple stages * _Sub-resources for actions_ can be used @@ -189,6 +189,6 @@ Does the design obviously prevent any other use-case we already aware of? The implementation for the current feature scope should be pretty straight -forward, as the flow is currently uni-directional, from `VirtualMachineConfig` -to `VM`. +forward, as the flow is currently uni-directional, from `VirtualMachineInstanceConfig` +to `VMI`. Thus a new simple controller can be used to handle this new type. diff --git a/vendor/kubevirt.io/kubevirt/docs/container-empty-disks.md b/vendor/kubevirt.io/kubevirt/docs/container-empty-disks.md index b4a5b2bc1..d368366f9 100644 --- a/vendor/kubevirt.io/kubevirt/docs/container-empty-disks.md +++ b/vendor/kubevirt.io/kubevirt/docs/container-empty-disks.md @@ -3,7 +3,7 @@ ## Motivation KubeVirt in combination with use-cases like the cluster-autoscaler can be used -to scale and provision vm pools. With the VirtualMachineReplicaSet and +to scale and provision vm pools. With the VirtualMachineInstanceReplicaSet and cloud-init stateless pools can be instantiated and provisioned. Many of the used cloud images for these use-cases are bootet with small disks with no additional free space, and/or run in read-only mode. A common pattern @@ -11,7 +11,7 @@ to store temporary data which should survive restarts or temporary data which is too big to fit in memory on temporary disks. The `emptyDir` in k8s provides a similar functionality. -To provide a similar functionality for our `VirtualMachines` an `emptyDisk` +To provide a similar functionality for our `VirtualMachineInstances` an `emptyDisk` volume type will be introduced. ## Implementation @@ -35,8 +35,8 @@ type EmptyDiskSource struct { A usage example: ```yaml -apiVersion: kubevirt.io/v1alpha1 -kind: VirtualMachine +apiVersion: kubevirt.io/v1alpha2 +kind: VirtualMachineInstance metadata: name: testvm spec: diff --git a/vendor/kubevirt.io/kubevirt/docs/container-register-disks.md b/vendor/kubevirt.io/kubevirt/docs/container-register-disks.md index 6da2f61b0..028716df9 100644 --- a/vendor/kubevirt.io/kubevirt/docs/container-register-disks.md +++ b/vendor/kubevirt.io/kubevirt/docs/container-register-disks.md @@ -1,62 +1,62 @@ -# Storing VM Disks in the Container Registry +# Storing VMI Disks in the Container Registry ## Motivation -KubeVirt is a drop in solution for running VMs on an existing kubernetes +KubeVirt is a drop in solution for running VMIs on an existing kubernetes cluster. One of our goals in doing this is to leverage the tools and workflows kubernetes has established for containers and apply them to virtualized workloads. -For example, with KubeVirt VMs are managed like pods. Users post VMs to -kubernetes like pods and the VMs will soon have the option to integrate into +For example, with KubeVirt VMIs are managed like pods. Users post VMIs to +kubernetes like pods and the VMIs will soon have the option to integrate into the kubernetes overlay network like pods. -To continue down the path of allowing users to introduce VM workloads into +To continue down the path of allowing users to introduce VMI workloads into an existing kubernetes cluster with as little friction as possible, the next -hurdle for us to overcome is tying VM disk distribution into the same +hurdle for us to overcome is tying VMI disk distribution into the same mechanism used by pods. To do this, KubeVirt must have a way of storing and -accessing VM disks using a container registry. +accessing VMI disks using a container registry. ## Requirements -* Users must have a workflow for pushing VM disks into a container registry. -* KubeVirt runtime must be able to consume VM disks stored in the container - registry and attach those disks to VMs. +* Users must have a workflow for pushing VMI disks into a container registry. +* KubeVirt runtime must be able to consume VMI disks stored in the container + registry and attach those disks to VMIs. ## Local Ephemeral Disk Use Cases -### Immutable VMs booting from ephemeral disk +### Immutable VMIs booting from ephemeral disk -Users want to launch VM workloads backed by local ephemeral storage. The VM -workload does not need to remain persistent across VM restarts and the workload +Users want to launch VMI workloads backed by local ephemeral storage. The VMI +workload does not need to remain persistent across VMI restarts and the workload does not require live migration support. -### Immutable VM Replication booting from ephemeral local disks. +### Immutable VMI Replication booting from ephemeral local disks. -Users want to horizontally scale VM workloads backed by local ephemeral -storage. *Pending introduction and implementation of VMGroup object* +Users want to horizontally scale VMI workloads backed by local ephemeral +storage. *Pending introduction and implementation of VMIGroup object* ## Ephemeral Non Bootable local disk storage -Users want to attach a non-bootable disk to a VM preloaded with data. This data +Users want to attach a non-bootable disk to a VMI preloaded with data. This data could consist of anything. It could be configuration data, rpms, or anything -else a user might want to distribute with their VMs. +else a user might want to distribute with their VMIs. ## Implementation ### High Level Design -**Standardised KubeVirt VM disk Wrapper** +**Standardised KubeVirt VMI disk Wrapper** KubeVirt provides a standardized base wrapper container image that serves up a -user provided VM disk as a local file consumable by Libvirt. This base -container image does not have a VM disk inside of it, it merely contains -everything necessary for serving up a VM disk in a way Libvirt can consume. +user provided VMI disk as a local file consumable by Libvirt. This base +container image does not have a VMI disk inside of it, it merely contains +everything necessary for serving up a VMI disk in a way Libvirt can consume. **User Workflow** -Users push VM Images into the container registry using the KubeVirt base +Users push VMI Images into the container registry using the KubeVirt base wrapper container image. By default, the base wrapper container KubeVirt -provides will serve up any VM disk placed in the /disk directory as a block +provides will serve up any VMI disk placed in the /disk directory as a block device consumable by libvirt. Example: @@ -68,13 +68,13 @@ END docker build -t vmdisks/fedora25:latest . docker push vmdisks/fedora25:latest ``` -Users start a VM using a "container registry backed VM disk" by referencing the -image name they pushed to the registry. Any number of VMs can be started +Users start a VMI using a "container registry backed VMI disk" by referencing the +image name they pushed to the registry. Any number of VMIs can be started anywhere in the cluster referencing the same image. Example: ``` -kind: VirtualMachine +kind: VirtualMachineInstance spec: domain: devices: @@ -88,19 +88,19 @@ spec: **KubeVirt Runtime Implementation** -When virt-controller sees a VM object with a disk type of +When virt-controller sees a VMI object with a disk type of **RegistryDisk:v1alpha**, virt-controller places the image wrapper container -in the virt-launcher pod along with the container that monitors the VM process. +in the virt-launcher pod along with the container that monitors the VMI process. -When the virt-launcher pod starts, the wrapper container copies the user's VM +When the virt-launcher pod starts, the wrapper container copies the user's VMI image as file on a shared host directory. -When virt-handler sees a VM is placed on the local node with the +When virt-handler sees a VMI is placed on the local node with the **RegistryDisk:v1alpha** disk type defined, virt-handler injects the necessary configuration into the domain xml required to add the disk backed by a local file. The **v1** part of the RegistryDisk disk type represents the standard used during the virt-handler disk conversion process. As we gain more -experience with this feature, we may want to adopt a new standard for how VM +experience with this feature, we may want to adopt a new standard for how VMI images are wrapped by a container while maintaining backwards compatibility. diff --git a/vendor/kubevirt.io/kubevirt/docs/debugging.md b/vendor/kubevirt.io/kubevirt/docs/debugging.md index 55180f45f..9d8205ba2 100644 --- a/vendor/kubevirt.io/kubevirt/docs/debugging.md +++ b/vendor/kubevirt.io/kubevirt/docs/debugging.md @@ -36,7 +36,7 @@ Both, Kubernetes and KubeVirt are creating events, which can be viewed via cluster/kubectl.sh get events --all-namespaces --watch ``` -This way it is pretty easy to detect if a Pod or a VM got started. +This way it is pretty easy to detect if a Pod or a VMI got started. ## Entering Containers diff --git a/vendor/kubevirt.io/kubevirt/docs/devel/hostpath-provisioner.yaml b/vendor/kubevirt.io/kubevirt/docs/devel/hostpath-provisioner.yaml new file mode 100644 index 000000000..89cb0c371 --- /dev/null +++ b/vendor/kubevirt.io/kubevirt/docs/devel/hostpath-provisioner.yaml @@ -0,0 +1,86 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: hostpath-provisioner + labels: + app: hostpath-provisioner +spec: + selector: + matchLabels: + app: hostpath-provisioner + replicas: 1 + revisionHistoryLimit: 0 + template: + metadata: + labels: + app: hostpath-provisioner + spec: + serviceAccount: hostpath-sa + serviceAccountName: hostpath-sa + containers: + - name: hostpath-provisioner + image: kubevirtdevelstorage/hostpath-provisioner:latest + env: + - name: NODE_NAME + valueFrom: + fieldRef: + fieldPath: spec.nodeName + - name: PV_DIR + value: /var/run/kubevirt/hostpath + volumeMounts: + - name: pv-volume + mountPath: /var/run/kubevirt/hostpath + volumes: + - name: pv-volume + hostPath: + path: /var/run/kubevirt/hostpath + +--- +kind: ServiceAccount +apiVersion: v1 +metadata: + name: hostpath-sa +--- +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: hostpath-provisioner +rules: + - apiGroups: [""] + resources: ["persistentvolumes"] + verbs: ["get", "list", "watch", "create", "delete"] + + - apiGroups: [""] + resources: ["persistentvolumeclaims"] + verbs: ["get", "list", "watch", "update"] + + - apiGroups: ["storage.k8s.io"] + resources: ["storageclasses"] + verbs: ["get", "list", "watch"] + + - apiGroups: [""] + resources: ["events"] + verbs: ["list", "watch", "create", "update", "patch"] + +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: hostpath-provisioner +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: hostpath-provisioner +subjects: +- kind: ServiceAccount + name: hostpath-sa + namespace: default +--- +kind: StorageClass +apiVersion: storage.k8s.io/v1 +metadata: + name: kubevirt + annotations: + storageclass.kubernetes.io/is-default-class: "true" +provisioner: hostpath + diff --git a/vendor/kubevirt.io/kubevirt/docs/devel/networking.md b/vendor/kubevirt.io/kubevirt/docs/devel/networking.md index 7900ff0bd..de32b37f0 100644 --- a/vendor/kubevirt.io/kubevirt/docs/devel/networking.md +++ b/vendor/kubevirt.io/kubevirt/docs/devel/networking.md @@ -1,3 +1,3 @@ -# VM Networking +# VMI Networking TODO diff --git a/vendor/kubevirt.io/kubevirt/docs/devel/scheduling.md b/vendor/kubevirt.io/kubevirt/docs/devel/scheduling.md index 37ef30aba..7c1ba412f 100644 --- a/vendor/kubevirt.io/kubevirt/docs/devel/scheduling.md +++ b/vendor/kubevirt.io/kubevirt/docs/devel/scheduling.md @@ -1,3 +1,3 @@ -# VM scheduling in KubeVirt +# VMI scheduling in KubeVirt TODO diff --git a/vendor/kubevirt.io/kubevirt/docs/devel/storage.md b/vendor/kubevirt.io/kubevirt/docs/devel/storage.md index f33f449de..7032b6440 100644 --- a/vendor/kubevirt.io/kubevirt/docs/devel/storage.md +++ b/vendor/kubevirt.io/kubevirt/docs/devel/storage.md @@ -1,3 +1,105 @@ -# Storage +# Getting started with storage -TODO +This document assumes you have a working [development environment](https://github.com/kubevirt/kubevirt/blob/master/docs/getting-started.md). + + +**We are using hostPath PVs, which are NOT suitable for a production environment, this document assumes you are setting up a SINGLE node development environment.** + +In order to use disk images one must configure an appropriate storage. In this document we will be using hostPath Persistent Volumes (PVs) and making Persistent Volume Claims against that PV. If you have some other mechanism to get PVCs you can skip the 'deploy hostPath PVC provisioner' section of this document. Throughout the entire document, I am assuming we are deploying into the 'default' namespace. You can also deploy into a different namespace if you want. + +## Create hostpath directory on node. +The hostPath provisioner needs to write to a directory on the node, we will need to create this directory before installing the hostPath provisioner + +```bash +cluster/cli.sh ssh node01 -- sudo mkdir /var/run/kubevirt/hostpath +``` + +## Deploy hostPath PVC provisioner + +We are using the hostPath provisioner from [here](https://github.com/MaZderMind/hostpath-provisioner). Simply run from : + +```bash +cluster/kubectl.sh apply -f docs/devel/hostpath-provisioner.yaml +``` + +This will create +- hostpath-provisioner Service Account +- hostpath-provisioner Cluster Role +- hostpath-provisioner Cluster Role Binding +- hostpath-provisioner Deployment +- Create hostpath Storage Class, set as the default, so any Persistent Volume Claims (PVCs) will be serviced by this storage class + +After a few moments the hostpath-provisioner pod should be running, we are now ready to create PVCs against it. Any requested PVCs will be stored in `/var/run/kubevirt/hostpath/-`. The PV retention policy will be `delete`, which means that when you delete the PVC, the matching PV is also removed and the directory created on the host is removed as well. + +## Deploy CDI controller + +The Containerized Data Importer controller is a controller that watches for PVCs with a specific annotation. If that annotation is detected, it will use the 'storage.image.endpoint' URL to download the image, convert it if needed and write it to the requested PVC. One can then use the PVC to start a VM using the image in it. To deploy the CDI controller run this: + +```bash +cluster/kubectl.sh apply -f https://raw.githubusercontent.com/kubevirt/containerized-data-importer/master/manifests/controller/cdi-controller-deployment.yaml +``` + +This will create +- cdi-sa Service Account +- cdi Cluster Role +- cdi-sa Cluster Role Binding +- cdi-deploy Deployment + +After a few moments the cdi-deployment pod should be running, we are now ready to import images using a PVC annotation. + +## Create a PVC with annotation + +Now that we can request PVCs and we have the CDI controller running, we are ready to import an image. An example yaml file looks like this: +```YAML +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: "image-pvc" + labels: + app: containerized-data-importer + annotations: + kubevirt.io/storage.import.endpoint: "https://download.cirros-cloud.net/0.4.0/cirros-0.4.0-x86_64-disk.img" # Required. Format: (http||s3)://www.myUrl.com/path/of/data + kubevirt.io/storage.import.secretName: "" # Optional. The name of the secret containing credentials for the data source +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 20Mi +``` + +As you can see we are creating a PVC named 'image-pvc' with 2 annotations. In this case we are requesting the cirros image because it's a small image, but any http or s3 end point will do. If you need to provide a secret the second annotation can be used to provide it. In our example we don't need a secret. + +The CDI controller will see the annotation and spawn an 'importer' pod that does the actual work. Once the pod is finished there will be a disk.img in the PVC. + +## Create a VM using the image + +Now that we have a populated PVC, we can create a VM using the disk image. For instance using this yaml: +```YAML +apiVersion: kubevirt.io/v1alpha1 +kind: VirtualMachine +metadata: + creationTimestamp: null + name: vm-pvc-cirrus +spec: + domain: + devices: + disks: + - disk: + bus: virtio + name: pvcdisk + volumeName: pvcvolume + machine: + type: "" + resources: + requests: + memory: 64M + terminationGracePeriodSeconds: 0 + volumes: + - name: pvcvolume + persistentVolumeClaim: + claimName: image-pvc +status: {} +``` + +You can now use the steps described in the [development getting started guide](https://github.com/kubevirt/kubevirt/blob/master/docs/getting-started.md) to connect a VNC console to it. diff --git a/vendor/kubevirt.io/kubevirt/docs/devel/offline-virtual-machine.md b/vendor/kubevirt.io/kubevirt/docs/devel/virtual-machine.md similarity index 52% rename from vendor/kubevirt.io/kubevirt/docs/devel/offline-virtual-machine.md rename to vendor/kubevirt.io/kubevirt/docs/devel/virtual-machine.md index cabe30df1..6e010bd26 100644 --- a/vendor/kubevirt.io/kubevirt/docs/devel/offline-virtual-machine.md +++ b/vendor/kubevirt.io/kubevirt/docs/devel/virtual-machine.md @@ -1,35 +1,35 @@ -# Offline Virtual Machine developer documentation +# Virtual Machine developer documentation -This document introduces the OfflineVirtualMachine kind and provides a +This document introduces the VirtualMachine kind and provides a guide how to use it and build upon it. -## What is Offline Virtual Machine +## What is a Virtual Machine -Almost all virtual machine (VM) management systems allow you to manage both running +Almost all virtual machine management systems allow you to manage both running and stopped virtual machines. Such system allows you to edit configuration of -both types of VMs and show its statuses. +both types of VMIs and show its statuses. -To allow building such VM management systems on top of the KubeVirt, the -OfflineVirtualMachine is introduced to provide the access to the stopped +To allow building such VMI management systems on top of the KubeVirt, the +VirtualMachine is introduced to provide the access to the stopped virtual machines. When working with running virtual machines, please see the [VirtualMachine] object documentation. The Virtual Machine object is -designed to work in tandem with the OfflineVirtualMachine and provides the +designed to work in tandem with the VirtualMachine and provides the configuration and status for running virtual machines. -OfflineVirtualMachine is a Kubernetes [custom resource definition](https://kubernetes.io/docs/concepts/api-extension/custom-resources/), which +VirtualMachine is a Kubernetes [custom resource definition](https://kubernetes.io/docs/concepts/api-extension/custom-resources/), which allows for using the Kubernetes machanisms for storing the objects and exposing it through the API. ## What it does and how to use it -The OfflineVirtualMachine provides the functionality to: +The VirtualMachine provides the functionality to: -* Store OfflineVirtualMachine, -* Manipulate the OfflineVirtualMachine through the kubectl, -* Manipulate the OfflineVirtualMachine through the Kubernetes API, -* Watch for changes in the OfflineVirtualMachine and react to them: - * Convert the OfflineVirtualMachine to VirtualMachine and thus launch it - * Stop VirtualMachine and update status of OfflineVirtualMachine accordingly +* Store VirtualMachineInstances as a template, +* Manipulate the VirtualMachineInstance through the kubectl, +* Manipulate the VirtualMachineInstance through the Kubernetes API, +* Watch for changes in the VirtualMachineInstance and react to them: + * Convert the VirtualMachineInstance template to a VirtualMachineInstance and thus launch it + * Stop VirtualMachineInstance and update status of VirtualMachine accordingly ### Kubectl interface @@ -37,35 +37,35 @@ The kubectl allows you to manipulate the Kubernetes objects imperatively. You can create, delete, update and query objects in the API. More details on how to use kubectl and what it can do are in the [Kubernetes documentation](https://kubernetes.io/docs/reference/kubectl/overview/). -Following are the examples of working with OfflineVirtualMachine and kubectl: +Following are the examples of working with VirtualMachine and kubectl: ```bash -# Define an OfflineVirtualMachine: -kubectl create -f myofflinevm.yaml +# Define an VirtualMachine: +kubectl create -f myvm.yaml -# Start an OfflineVirtualMachine: -kubectl patch offlinevirtualmachine myvm --type=merge -p \ +# Start an VirtualMachine: +kubectl patch virtualmachine myvm --type=merge -p \ '{"spec":{"running": true}}' -# Look at OfflineVirtualMachine status and associated events: -kubectl describe offlinevirtualmachine myvm +# Look at VirtualMachine status and associated events: +kubectl describe virtualmachine myvm -# Look at the now created VirtualMachine status and associated events: +# Look at the now created VirtualMachineInstance status and associated events: kubectl describe virtualmachine myvm -# Stop an OfflineVirtualMachine: -kubectl patch offlinevirtualmachine myvm --type=merge -p \ +# Stop an VirtualMachine: +kubectl patch virtualmachine myvm --type=merge -p \ '{"spec":{"running": false}}' -# Implicit cascade delete (first deletes the vm and then the ovm) -kubectl delete offlinevirtualmachine myvm +# Implicit cascade delete (first deletes the vm and then the vm) +kubectl delete virtualmachine myvm -# Explicit cascade delete (first deletes the vm and then the ovm) -kubectl delete offlinevirtualmachine myvm --cascade=true +# Explicit cascade delete (first deletes the vm and then the vm) +kubectl delete virtualmachine myvm --cascade=true # Orphan delete (The running vm is only detached, not deleted) -# Recreating the ovm would lead to the adoption of the vm -kubectl delete offlinevirtualmachine myvm --cascade=false +# Recreating the vm would lead to the adoption of the vm +kubectl delete virtualmachine myvm --cascade=false ``` ### The REST API @@ -76,29 +76,29 @@ needs to access the cluster programaticaly, it is better to have a API endpoint. Thats where the Kubernetes REST API endpoint comes right in. Kubernetes provides for its users the native REST API, which is easily extendable and in one place. -The OfflineVirtualMachine object is a CRD, which implies that Kubernetes +The VirtualMachine object is a CRD, which implies that Kubernetes provides the API automatically. The API is located at the path ```text -/apis/kubevirt.io/v1alpha/offlinevirtualmachine/ +/apis/kubevirt.io/v1alpha2/virtualmachine/ ``` and you can do typical REST manipulation, you would expect. All CRUD is supported, as shown in following example. ```text -POST /apis/kubevirt.io/v1alpha1/namespaces/{namespace}/offlinevirtualmachine -GET /apis/kubevirt.io/v1alpha1/namespaces/{namespace}/offlinevirtualmachine -GET /apis/kubevirt.io/v1alpha1/namespaces/{namespace}/offlinevirtualmachine/{name} -DELETE /apis/kubevirt.io/v1alpha1/namespaces/{namespace}/offlinevirtualmachine/{name} -PUT /apis/kubevirt.io/v1alpha1/namespaces/{namespace}/offlinevirtualmachine/{name} -PATCH /apis/kubevirt.io/v1alpha1/namespaces/{namespace}/offlinevirtualmachine/{name} +POST /apis/kubevirt.io/v1alpha2/namespaces/{namespace}/virtualmachine +GET /apis/kubevirt.io/v1alpha2/namespaces/{namespace}/virtualmachine +GET /apis/kubevirt.io/v1alpha2/namespaces/{namespace}/virtualmachine/{name} +DELETE /apis/kubevirt.io/v1alpha2/namespaces/{namespace}/virtualmachine/{name} +PUT /apis/kubevirt.io/v1alpha2/namespaces/{namespace}/virtualmachine/{name} +PATCH /apis/kubevirt.io/v1alpha2/namespaces/{namespace}/virtualmachine/{name} ``` By **POST** you can store new object in the etcd. With **GET** you either -get the list of all OfflineVirtualMachines or get the concrete one. **DELETE** +get the list of all VirtualMachines or get the concrete one. **DELETE** removes the object from etcd and all its resources. If you want to update the -existing OfflineVirtualMachine object use **PUT** and if you want to change +existing VirtualMachine object use **PUT** and if you want to change an item inside the object use **PATCH**. More details on the API are in the [documentation](https://kubevirt.github.io/api-reference/master/operations.html). @@ -106,15 +106,15 @@ To data format used when communicating with the API is the JSON. The format is set up the usual way by setting the Content-Type header to 'application/json'. The 'application/yaml' can also be used. -## OfflineVirtualMachine object content +## VirtualMachine object content -Now its time to discuss the content of the OfflineVirtualMachine object. +Now its time to discuss the content of the VirtualMachine object. The object is defined in the same way as any other Kubernetes object. You can use YAML or JSON format to specify the content. The example structure is bellow: ```yaml -apiVersion: kubevirt.io/v1alpha1 -kind: OfflineVirtualMachine +apiVersion: kubevirt.io/v1alpha2 +kind: VirtualMachine metadata: name: myvm spec: @@ -143,26 +143,26 @@ with the Kubevirt release cycle. In the metadata section, there is a *required* field, the **name**. Then following the spec section, there are two important parts. The **running**, which -indicates the current state of the VirtualMachine attached to this VirtualMachine. -Second is the **template**, which is the VirtualMachine template. +indicates the current state of the VirtualMachineInstance attached to this VirtualMachineInstance. +Second is the **template**, which is the VirtualMachineInstance template. Let us go over each of these fields. ### Name -The `metadata.name` is important for the OfflineVirtualMachine, it is used to find +The `metadata.name` is important for the VirtualMachine, it is used to find created VirtualMachine. The VirtualMachine name is directly derived from -the OfflineVirtualMachine. This means, if OfflineVirtualMachine is names 'testvm', +the VirtualMachine. This means, if VirtualMachine is names 'testvm', the VirtualMachine is named 'testvm' too. Moreover, the pair namespace and name: `namepace/metadata.name` creates the -unique identifier for the OfflineVirtualMachine. This fact implies that two +unique identifier for the VirtualMachine. This fact implies that two identical names in the same namespace are considered as an error. ### Template -The spec.template is a VirtualMachine specification used to create an actual -VirtualMachine. Below is an example of such VirtualMachine specification. +The spec.template is a VirtualMachineInstance specification used to create an actual +VirtualMachineInstance. Below is an example of such VirtualMachineInstance specification. ```yaml metadata: @@ -181,47 +181,47 @@ spec: claimName: myclaim ``` -It is easy to see that it is exactly the same as [VirtualMachine], +It is easy to see that it is exactly the same as [VirtualMachineInstance], but it does not have a `kind` and `apiVersion`. These are implicitely added. Thus for the complete list of supported fields in the spec.template please refer -to the [VirtualMachine] documentation. +to the [VirtualMachineInstance] documentation. -## OfflineVirtualMachine behaviour +## VirtualMachine behaviour -The OfflineVirtualMachine has to be in sync with its VirtualMachine. This means -that the OfflineVirtualMachine controller has to observe both, the OfflineVirtualMachine +The VirtualMachine has to be in sync with its VirtualMachine. This means +that the VirtualMachine controller has to observe both, the VirtualMachine and created VirtualMachine. When the [link](#ownerreference) is established the config changes are translated to the VirtualMachine, and coresponding status changes are -translated back to OfflineVirtualMachine. +translated back to VirtualMachine. TBD this needs to be more specific ### Status -Shows the information about current OfflineVirtualMachine. The example status +Shows the information about current VirtualMachine. The example status is shown below. ```yaml status: observedGeneration: 124 # current observed revision virtualMachine: my-vm - running: true # is the attached VirtualMachine running + created: true # is the attached VirtualMachineInstance reated ready: true # based on http readiness check libvirt info conditions: [] # additional possible states ``` The status of the VirtualMachine is watched and is reflected in the -OfflineVirtualMachine status. The info propagated from the VirtualMachine is: +VirtualMachine status. The info propagated from the VirtualMachine is: -* running state -* readiness of the VM -* name of the VirtualMachine +* if the vm exists in the cluster +* readiness of the VMI +* name of the VirtualMachineInstance -For more information, user have to check the VirtualMachine object itself. +For more information, user have to check the VirtualMachineInstance object itself. -The conditions can show additional information about state of VirtualMachine. -One possible case would be to show how VirtualMachine was stopped, e.g.: +The conditions can show additional information about state of VirtualMachineInstance. +One possible case would be to show how VirtualMachineInstance was stopped, e.g.: ```yaml status: @@ -232,78 +232,78 @@ status: ### OwnerReference -Linking the created VirtualMachine to its parent OfflineVirtualMachine pose +Linking the created VirtualMachine to its parent VirtualMachine pose a challenge. Using the same name is only part of the solution. To find the -parent OfflineVirtualMachine programatically in the Kubernetes, the OwnerReference +parent VirtualMachine programatically in the Kubernetes, the OwnerReference is used. As described in the [design document](https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/controller-ref.md), the OwnerReference lives in the metadata section of the object and is created automaticaly. Example: ```YAML -apiVersion: kubevirt.io/v1alpha1 +apiVersion: kubevirt.io/v1alpha2 kind: VirtualMachine metadata: name: myvm ownerReferences: - controller: true uid: 1234-1234-1234-1234 - kind: OfflineVirtualMachine - version: kubevirt.io/v1alpha1 + kind: VirtualMachine + version: kubevirt.io/v1alpha2 ``` ### Update strategy For now implicit: OnDelete. Can later be extended to RollingUpdate if needed. -Spec changes have no direct effect on already running VMs, and they will not -directly be propagated to the VM. If a VM should be running (spec.running=true) -and it is powered down (VM object delete, OS shutdown, ...), -the VM will be re-created by the controller with the new spec. +Spec changes have no direct effect on already running VMIs, and they will not +directly be propagated to the VMI. If a VMI should be running (spec.running=true) +and it is powered down (VMI object delete, OS shutdown, ...), +the VMI will be re-created by the controller with the new spec. ### Delete strategy The delete has a cascade that deletes the created VirtualMachine. If a cascade is turned off the VirtualMachine is orphaned and leaved running. -When the OfflineVirtualMachine with the same name as orphaned VirtualMachine +When the VirtualMachine with the same name as orphaned VirtualMachine is created, the VirtualMachine gets adopted and OwnerReference is updated accordingly. ### Reset and Reboot -This is not covered by the OfflineVirtualMachine. This functionality shall +This is not covered by the VirtualMachine. This functionality shall be achieved by subresources for the VirtualMachine (imperative), and will not result in a recreation of the VirtualMachine object or its Pod. From the KubeVirt perspective, the VirtualMachine is running all the time. -Thus spec changes on OfflineVirtualMachine will not be propagated to +Thus spec changes on VirtualMachine will not be propagated to the VirtualMachine in that case. ## How it is implemented -The first implementation of the OfflineVirtualMachine kind has two parts: +The first implementation of the VirtualMachine kind has two parts: -1) The OfflineVirtualMachine custom resource definition, +1) The VirtualMachine custom resource definition, 2) The controller watching for the changes and updating the state. ### Custom resource definition -The OfflineVirtualMachine custom resource is straightforward and is shown bellow: +The VirtualMachine custom resource is straightforward and is shown bellow: ```yaml apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition metadata: - name: offlinevirtualmachines.kubevirt.io + name: virtualmachines.kubevirt.io spec: scope: Namespaced group: kubevirt.io - version: v1alpha1 + version: v1alpha2 names: - kind: OfflineVirtualMachine - plural: offlinevirtualmachines - singular: offlinevirtualmachine + kind: VirtualMachine + plural: virtualmachines + singular: virtualmachine shortNames: - - ovm - - ovms + - vm + - vms ``` Part of the definition of custom resource is a API specification used for @@ -312,15 +312,15 @@ autogenerating the Kubernetes resources: client, lister and watcher. ### Controller The controller is responsible for watching the change in the registered -offline virtual machines and update the state of the system. It is also -responsible for creating new VirtualMachine when the `running` is set to `true`. +virtual machines and update the state of the system. It is also +responsible for creating new VirtualMachineInstance when the `running` is set to `true`. Moreover the controller attaches the `metadata.OwnerReference` to the created -VirtualMachine. With this mechanism it can link the OfflineVirtualMachine to the -VirtualMachine and show combined status. +VirtualMachineInstance. With this mechanism it can link the VirtualMachine to the +VirtualMachineInstance and show combined status. The controller is designed to be a standalone service running in its own pod. Since the whole KubeVirt is designed to be modular, this approach allows for a more flexbility and less codebase in the core. Moreover it can be scaled up separately if the need arise. -[VirtualMachine]: https://kubevirt.github.io/api-reference/master/definitions.html#_v1_virtualmachine +[VirtualMachineInstance]: https://kubevirt.github.io/api-reference/master/definitions.html#_v1_virtualmachine diff --git a/vendor/kubevirt.io/kubevirt/docs/direct-pv-disks.md b/vendor/kubevirt.io/kubevirt/docs/direct-pv-disks.md index 8c4bf5407..245246085 100644 --- a/vendor/kubevirt.io/kubevirt/docs/direct-pv-disks.md +++ b/vendor/kubevirt.io/kubevirt/docs/direct-pv-disks.md @@ -21,13 +21,13 @@ which are backed by Persistent Volumes. ## API -This section describes how Persistent Volumes are referenced in the `VM` +This section describes how Persistent Volumes are referenced in the `VMI` Resource type. In general the referencing is aligned with how pods are consuming Persistent Volume Claims as described [here](https://kubernetes.io/docs/api-reference/v1.5/#persistentvolumeclaimvolumesource-v1) -Today the `VM.spec.domain` reflects much of [libvirt's domain xml specification](http://libvirt.org/formatdomain.html#elementsDisks). To +Today the `VMI.spec.domain` reflects much of [libvirt's domain xml specification](http://libvirt.org/formatdomain.html#elementsDisks). To communicate the new storage type through the API, an additional disk type `PersistentVolumeClaim` is accepted. In the case of a `PersistentVolumeClaim` type The `disk/source/name` attribute is used to name the claim to use. @@ -61,10 +61,10 @@ spec: release: "stable" ``` -this is used by the VM in the following way: +this is used by the VMI in the following way: ```yaml -kind: VirtualMachine +kind: VirtualMachineInstance spec: domain: devices: @@ -82,9 +82,9 @@ spec: ### Flow -1. User adds an existing `PersistentVolumeClaim` as described above to the VM +1. User adds an existing `PersistentVolumeClaim` as described above to the VMI instance. -2. The VM Pod is getting scheduled on a host, the `virt-handler` +2. The VMI Pod is getting scheduled on a host, the `virt-handler` identifies the Claim, translates it into the corresponding libvirt representation and includes it in the domain xml. @@ -93,14 +93,14 @@ instance. **Note**: In this flow, the claim is _not_ used by the pod, the claim is only used by the `virt-handler` to identify the connection details to the storage. -Because VMs only accept block storage as disks, the handler can only accept +Because VMIs only accept block storage as disks, the handler can only accept claims which are backed by block storage types. Currently only iSCSI support is implemented. ### `virt-handler` behavior -Once a VM is scheduled on a host, the `virt-handler` will transform the VM Spec +Once a VMI is scheduled on a host, the `virt-handler` will transform the VMI Spec into a libvirt domain xml. During this transformation, every disk which is of type `PersistentVolumeClaim` @@ -109,7 +109,7 @@ will be converted into an adequate/equivalent libvirt disk type. To achieve this, the `virt-handler` needs to look at volume attached to a claim, to identify the `type` and connection details. Note that the claim itself will contain the connection details if it is associated with a volume. -In the case that the claim is not associated with a volume the launch of the VM +In the case that the claim is not associated with a volume the launch of the VMI will fail. If the type is iSCSI, then it can take the connection details and transform them into the correct libvirtd representation. @@ -128,5 +128,5 @@ In the snippet above, most of the snippet is hard-coded, only the values for `disk/source/name`, `disk/host/name`, and `disk/host/port` are populated with the values from the Persistent Volume Claim. -Once the VM starts up, `qemu` will be connecting to the target to connect the +Once the VMI starts up, `qemu` will be connecting to the target to connect the disk. diff --git a/vendor/kubevirt.io/kubevirt/docs/env-providers.md b/vendor/kubevirt.io/kubevirt/docs/env-providers.md index a464c9154..5e1ffc55b 100644 --- a/vendor/kubevirt.io/kubevirt/docs/env-providers.md +++ b/vendor/kubevirt.io/kubevirt/docs/env-providers.md @@ -10,23 +10,24 @@ All following providers allow a common workflow: * `make functests` to run the functional tests against KubeVirt * `cluster/kubectl.sh` to talk to the k8s installation -It is recommended to export the `PROVIDER` vagirable as part of your `.bashrc` +It is recommended to export the `KUBEVIRT_PROVIDER` variable as part of your `.bashrc` file. -## Vagrant + +## Dockerized k8s/ocp clusters Allows provisioning k8s cluster based on kubeadm. Supports an arbitrary amount of nodes. Requires: * A working go installation - * Vagrant installation with libvirt provider * Nested virtualization enabled + * A running docker daemon Usage: ```bash -export PROVIDER=vagrant-kubernetes # choose this provider -export VAGRANT_NUM_NODES=2 # master + two nodes +export KUBEVIRT_PROVIDER=k8s-1.10.4 # choose this provider +export KUBEVIRT_NUM_NODES=3 # master + two nodes make cluster-up ``` @@ -42,13 +43,13 @@ Requires: Usage: ```bash -export PROVIDER=local # choose this provider +export KUBEVIRT_PROVIDER=local # choose this provider make cluster-up ``` ## New Providers - * Create a `cluster/$PROVIDER` directory - * Create a `cluster/$PROVIDER/provider.sh` files + * Create a `cluster/$KUBEVIRT_PROVIDER` directory + * Create a `cluster/$KUBEVIRT_PROVIDER/provider.sh` files * This file has to contain the functions `up`, `build`, `down` and `_kubectl` - * Have a look at `cluster/vagrant/provider.sh` for a reference implementation + * Have a look at `cluster/k8s-1.10.4/provider.sh` for a reference implementation diff --git a/vendor/kubevirt.io/kubevirt/docs/filesystem-pv-disks.md b/vendor/kubevirt.io/kubevirt/docs/filesystem-pv-disks.md index 33d6fef5d..07dcdd2fe 100644 --- a/vendor/kubevirt.io/kubevirt/docs/filesystem-pv-disks.md +++ b/vendor/kubevirt.io/kubevirt/docs/filesystem-pv-disks.md @@ -27,7 +27,7 @@ future changes for improving usability, performance, or other characteristics. ## Use-case -The primary use-case is to allow a VM to use PVs as backend storage for their +The primary use-case is to allow a VMI to use PVs as backend storage for their virtual disks. @@ -35,7 +35,7 @@ virtual disks. The mechanism proposed in this proposal is leveraging Kubernetes to attach the remote storage as a file-system to a container, to use this file-system to -store a disk image to act as a backend storage to the VM's disk. +store a disk image to act as a backend storage to the VMI's disk. To keep the story compatability between the block and file-system storage, this proposal assumes that the file-system based storage will also just support a 1:1 @@ -57,7 +57,7 @@ required PV, this claim is then used as a disk source for a virtual disk. An example: ```yaml -kind: VM +kind: VMI spec: domain: devices: @@ -70,7 +70,7 @@ spec: ``` Here the user attaches the PersistentVolumeClaim `my-fs-claim` as a disk to a -VM. +VMI. ### Storage Type Inference diff --git a/vendor/kubevirt.io/kubevirt/docs/getting-started.md b/vendor/kubevirt.io/kubevirt/docs/getting-started.md index efad4e1a6..7481310d7 100644 --- a/vendor/kubevirt.io/kubevirt/docs/getting-started.md +++ b/vendor/kubevirt.io/kubevirt/docs/getting-started.md @@ -1,55 +1,93 @@ # Getting Started -A quick start guide to get KubeVirt up and running inside Vagrant. +A quick start guide to get KubeVirt up and running inside our container based +development cluster. ## Building The KubeVirt build system runs completely inside docker. In order to build KubeVirt you need to have `docker` and `rsync` installed. -### Dockerizied environment +**Note:** For running KubeVirt in the dockerized cluster, **nested +virtualization** must be enabled. As an alternative [software +emulation](software-emulation.md) can be allowed. Enabling nested +virtualization should be preferred. + +### Dockerized environment Runs master and nodes containers, when each one of them run virtual machine via QEMU. In additional it runs dnsmasq and docker registry containers. +### Compatibility + +The minimum compatible Kubernetes version is 1.10.0. Important features required +for scheduling and memory are missing or incompatible with previous versions. + ### Compile and run it Build all required artifacts and launch the dockerizied environment: ```bash - # Building and deploying kubevirt in Vagrant - export PROVIDER=k8s-1.9.3 - make cluster-up - make cluster-sync +# Build and deploy KubeVirt on Kubernetes 1.10.4 in our vms inside containers +export KUBEVIRT_PROVIDER=k8s-1.10.4 # this is also the default if no KUBEVIRT_PROVIDER is set +make cluster-up +make cluster-sync ``` -This will create a VM called `node01` which acts as Kubernetes master and then -deploy KubeVirt there. To create one or more nodes which will register -themselves on master, you can use the `VAGRANT_NUM_NODES` environment variable. -This would create a master and one node: +This will create a VMI called `node01` which acts as node and master. To create +more nodes which will register themselves on master, you can use the +`KUBEVIRT_NUM_NODES` environment variable. This would create a master and one +node: ```bash - export VAGRANT_NUM_NODES=1 - make cluster-up +export KUBEVIRT_NUM_NODES=2 # schedulable master + one additional node +make cluster-up ``` You could also run some build steps individually: ```bash - # To build all binaries - make +# To build all binaries +make + +# Or to build just one binary +make build WHAT=cmd/virt-controller + +# To build all kubevirt containers +make docker +``` + +To destroy the created cluster, type + +``` +make cluster-down +``` + +**Note:** Whenever you type `make cluster-down && make cluster-up`, you will +have a completely fresh cluster to play with. + +### Accessing the containerized nodes via ssh + +The containerized nodes are named starting from `node01`, `node02`, and so +forth. `node01` is always the master of the cluster. + +Every node can be accessed via its name: + +```bash +cluster/cli.sh ssh node01 +``` - # Or to build just one binary - make build WHAT=cmd/virt-controller +To execute a remote command, e.g `ls`, simply type - # To build all docker images - make docker +```bash +cluster/cli.sh ssh node01 -- ls -lh ``` ### Code generation -**Note:** This is only important if you plan to modify sources, you don't need code generators just for building +**Note:** This is only important if you plan to modify sources, you don't need +code generators just for building To invoke all code-generators and regenerate generated code, run: @@ -57,6 +95,13 @@ To invoke all code-generators and regenerate generated code, run: make generate ``` +Typical code changes where running the generators is needed: + + * When changing APIs, REST paths or their comments (gets reflected in the api documentation, clients, generated cloners, ...) + * When changing mocked interfaces (the mock generator needs to update the generated mocks then) + + We have a check in our CI system, so that you don't miss when `make generate` needs to be called. + ### Testing After a successful build you can run the *unit tests*: @@ -70,9 +115,23 @@ up dockerizied environment. Then run ```bash make cluster-sync # synchronize with your code, if necessary - make functest # run the functional tests against the Vagrant VMs + make functest # run the functional tests against the VMIs ``` +If you'd like to run specific functional tests only, you can leverage `ginkgo` +command line options as follows (run a specified suite): + +``` + FUNC_TEST_ARGS='-ginkgo.focus=vm_networking_test -ginkgo.regexScansFilePath' make functest +``` + +In addition, if you want to run a specific test or tests you can prepend any `Describe`, +`Context` and `It` statements of your test with an `F` and Ginkgo will only run items +that are marked with the prefix. Also, don't forget to remove the prefix before issuing +your pull request. + +For additional information check out the [Ginkgo focused specs documentation](http://onsi.github.io/ginkgo/#focused-specs) + ## Use Congratulations you are still with us and you have build KubeVirt. @@ -81,44 +140,44 @@ Now it's time to get hands on and give it a try. ### Create a first Virtual Machine -Finally start a VM called `vm-ephemeral`: +Finally start a VMI called `vmi-ephemeral`: ```bash - # This can be done from your GIT repo, no need to log into a vagrant VM + # This can be done from your GIT repo, no need to log into a VMI - # Create a VM - ./cluster/kubectl.sh create -f cluster/examples/vm-ephemeral.yaml + # Create a VMI + ./cluster/kubectl.sh create -f cluster/examples/vmi-ephemeral.yaml - # Sure? Let's list all created VMs + # Sure? Let's list all created VMIs ./cluster/kubectl.sh get vms # Enough, let's get rid of it - ./cluster/kubectl.sh delete -f cluster/examples/vm-ephemeral.yaml + ./cluster/kubectl.sh delete -f cluster/examples/vmi-ephemeral.yaml # You can actually use kubelet.sh to introspect the cluster in general ./cluster/kubectl.sh get pods ``` -This will start a VM on master or one of the running nodes with a macvtap and a +This will start a VMI on master or one of the running nodes with a macvtap and a tap networking device attached. #### Example ```bash -$ ./cluster/kubectl.sh create -f cluster/examples/vm-ephemeral.yaml -vm "vm-ephemeral" created +$ ./cluster/kubectl.sh create -f cluster/examples/vmi-ephemeral.yaml +vm "vmi-ephemeral" created $ ./cluster/kubectl.sh get pods NAME READY STATUS RESTARTS AGE virt-api 1/1 Running 1 10h virt-controller 1/1 Running 1 10h virt-handler-z90mp 1/1 Running 1 10h -virt-launcher-vm-ephemeral9q7es 1/1 Running 0 10s +virt-launcher-vmi-ephemeral9q7es 1/1 Running 0 10s $ ./cluster/kubectl.sh get vms NAME LABELS DATA -vm-ephemera kubevirt.io/nodeName=node01 {"apiVersion":"kubevirt.io/v1alpha1","kind":"VM","... +vmi-ephemera kubevirt.io/nodeName=node01 {"apiVersion":"kubevirt.io/v1alpha2","kind":"VMI","... $ ./cluster/kubectl.sh get vms -o json { @@ -127,17 +186,17 @@ $ ./cluster/kubectl.sh get vms -o json "metadata": {}, "items": [ { - "apiVersion": "kubevirt.io/v1alpha1", + "apiVersion": "kubevirt.io/v1alpha2", "kind": "VirtualMachine", "metadata": { "creationTimestamp": "2016-12-09T17:54:52Z", "labels": { "kubevirt.io/nodeName": "master" }, - "name": "vm-ephemeral", + "name": "vmi-ephemeral", "namespace": "default", "resourceVersion": "102534", - "selfLink": "/apis/kubevirt.io/v1alpha1/namespaces/default/virtualmachines/testvm", + "selfLink": "/apis/kubevirt.io/v1alpha2/namespaces/default/virtualmachineinstances/testvm", "uid": "7e89280a-be62-11e6-a69f-525400efd09f" }, "spec": { @@ -152,12 +211,15 @@ First make sure you have `remote-viewer` installed. On Fedora run dnf install virt-viewer ``` -Then, after you made sure that the VM `vm-ephemeral` is running, type +Then, after you made sure that the VMI `vmi-ephemeral` is running, type ``` -cluster/kubectl.sh vnc vm-ephemeral +cluster/virtctl.sh vnc vmi-ephemeral ``` to start a remote session with `remote-viewer`. -Since `kubectl` does not support TPR subresources yet, the above `cluster/kubectl.sh vnc` magic is just a wrapper. +`cluster/virtctl.sh` is a wrapper around `virtctl`. `virtctl` brings all +virtual machine specific commands with it. It is supplement to `kubectl`. + +**Note:** If accessing your cluster through ssh, be sure to forward your X11 session in order to launch `virtctl vnc`. diff --git a/vendor/kubevirt.io/kubevirt/docs/glossary.md b/vendor/kubevirt.io/kubevirt/docs/glossary.md deleted file mode 100644 index 6f0b4a890..000000000 --- a/vendor/kubevirt.io/kubevirt/docs/glossary.md +++ /dev/null @@ -1,181 +0,0 @@ -# KubeVirt Glossary - -This document exists to to give the KubeVirt community a common language to -work with when describing features and making design proposals. Some of the -terms in this document do not actually exist in the current design yet, but -are instead concepts the KubeVirt team is in the process of formalizing. As new -concepts are introduced into the community, this document should be updated to -reflect the continued evolution of our common language. - -Terms for Items the KubeVirt community are still discussing are marked with the -(WIP) tag. - -## VM Definition - -A VM Definition is the declaration of a desired state of a VM. - -Below is an example of a VM definition. A user can post this definition to the -cluster and expect the KubeVirt runtime to fulfill creating a VM matching the -posted definition. -``` -kind: VirtualMachine -metadata: - name: testvm -spec: - domain: - devices: - disks: - - type: network - snapshot: external - device: disk - driver: - name: qemu - type: raw - cache: none - source: - host: - name: iscsi-demo-target.default - port: "3260" - protocol: iscsi - name: iqn.2017-01.io.kubevirt:sn.42/2 - target: - dev: vda - memory: - unit: MB - value: 64 - os: - type: - os: hvm - type: qemu - -``` - -## VM Specification aka VM Spec - -The VM Specification is the part of the VM Definition found in the **spec** -field. The VM spec mostly contains information about devices and disks -associated with the VM. - -At VM creation time, the VM spec is transformed into Domain XML and handed off -to libvirt. - -## VM Status - -In contrast to the VM Definition, the VM Status expresses the actual state of -the VM. The status is visible when querying an active VM from the KubeVirt -runtime. - -## VM Specification Completion (WIP) - -This term represents the set of actions that are performed on a VM’s Spec -during the VM Creation Process. This includes injecting presets, libvirt -defaulting, but is not limited to only those items. Basically all kinds of VM -manipulation and validation which happen when a VM is posted is covered by that -(admission controllers, initializers, external admission controllers). After -this completion phase is done, a fully initialized and complete VM spec is -generated and persisted. - -## VirtualMachine aka VM - -A VM is a cluster object representation of a single emulated computer system -running on a cluster node. A **VM Definition** is a declaration of a desired -state of a Virtual Machine. When such a definition is posted to the KubeVirt -runtime, you want to see the described Virtual Machine running. The VM object -maps to exactly one actively running Virtual Machine instance, because of this -the VM object should be used to represent any active Virtual Machineinstance’s -specific runtime data. - -A VM Definition is posted and the KubeVirt runtime creates the VM object to -represent the active VM process running on a cluster node. - -## VirtualMachineConfig aka VMC (WIP) - -Posting a VM definition causes the KubeVirt runtime to immediately create a VM -instance in response to the POST request. When the VM definition is deleted, -this results in the VM being stopped. - -A VirtualMachineConfig is a concept that allows users to post a representation -of a VM into the cluster in a way that is de-coupled from start/stopping the VM. - -A user can post a VirtualMachineConfig and later choose to start a VM using that -config. This lets the config remain persistent between VM starts/stops. - -## VirtualMachineGroup aka VMG (WIP) - -A VirtualMachineGroup is a concept that allows users to post a representation of -a VM along with the desired number of cloned VM instances to run using that -representation. The KubeVirt runtime will manage starting and stopping -instances to match the desired number of cloned instances defined by the VMG. - -## KubeVirt Cluster Node - -The underlying hardware KubeVirt is scheduling VMs on top of. Any node KubeVirt -is capable of starting a VM on is considered a cluster node. - -## KubeVirt Runtime - -The core software components that make up KubeVirt. Runtime related code lives -in kubevirt/kubevirt. It provides controllers, specifications and definitions, -which allow users to express desired VirtualMachine states, and will try to -fulfill them. If definitions of VMs are made known to the runtime, the runtime -will immediately try to fulfill the request by instantiating and starting that -VM. - -## VirtualMachinePreset aka VMP (WIP) - -Likely, like a PodPreset. It will allow to inject specific resources into a VM. -VMP is a good candidate for injecting disks and devices into VMs during VM spec -completion. - -## RegistryDisk (WIP) - -Method of storing and distributing VM disks with KubeVirt using the container -registry. - -## Domain -Libvirt domain. `virt-handler` can derive a Domain XML out of a [VM Spec](#vm-specification-aka-vm-spec). -This is the host centric view of the cluster wide [VM Spec](#vm-specification-aka-vm-spec). - -## Domain XML - -Configuration used to define a domain in Libvirt. The VM spec is transformed -into domain xml during VM creation on a cluster node. The Domain xml is used to -communicate with Libvirt the information pertaining to how the VM should be -launched. - -## Third Party Resource aka TPR -Kubernetes has an extensible API which allows extending its REST-API. -Resources using this extension mechanism are called Third Party Resource. -See [extensible-api](https://github.com/kubernetes/kubernetes/blob/master/docs/design/extending-api.md) -for more information. - - -## Admission Controller (WIP) - -Plug-ins built into Kubernetes, which intercept requests after authentication. -They can alter or reject resources before they are persisted. - -https://kubernetes.io/docs/admin/admission-controllers/#what-are-they - -## External Webhook Admission Controller (WIP) - -Like admission controllers, but the admission controller logic can live outside -of kubernetes and is invoked via a webhook. - -https://kubernetes.io/docs/admin/extensible-admission-controllers/#what-are-external-admission-webhooks - -## Initializer (WIP) - -Another way of mutating or validating objects before a request is finished. -However, in contrast to admission controllers, initializers can perform their -logic asynchronously. First objects are marked as having the need to be -initialized by one or more initializers. An external controller can listen -on the apiserver for these uninitialized objects and try to initialize them -The advantage here is, that you can write traditional controllers with -workqueues, since the object is already persisted. - -However, for the user POSTs are blocked until the object is fully initialized -and other normal requests will not show the object until it is ready. So the -fact that this works asynchronous is hidden from the user. - -https://kubernetes.io/docs/admin/extensible-admission-controllers/#what-are-initializers diff --git a/vendor/kubevirt.io/kubevirt/docs/graceful-shutdown.md b/vendor/kubevirt.io/kubevirt/docs/graceful-shutdown.md index 0f486ddd3..3968b8e81 100644 --- a/vendor/kubevirt.io/kubevirt/docs/graceful-shutdown.md +++ b/vendor/kubevirt.io/kubevirt/docs/graceful-shutdown.md @@ -92,7 +92,7 @@ it down) or the kubernetes runtime kills the virt-launcher process with SIGKILL. A force kill of virt-launcher will result in the corresponding virtual machine exiting. -### Shutdown Notification Race (Virt-Launcher VS. VM Object Informer) +### Shutdown Notification Race (Virt-Launcher VS. VMI Object Informer) When a Virtual Machine object is removed from the cluster, that sets off a race between two sources used to notify virt-handler it should shutdown the virtual diff --git a/vendor/kubevirt.io/kubevirt/docs/iscsi-authentication.md b/vendor/kubevirt.io/kubevirt/docs/iscsi-authentication.md index 7009a2bfa..0442b2b02 100644 --- a/vendor/kubevirt.io/kubevirt/docs/iscsi-authentication.md +++ b/vendor/kubevirt.io/kubevirt/docs/iscsi-authentication.md @@ -1,4 +1,4 @@ -This document describes how to associate a k8s secret with a VM for the purpose of iscsi initiator authentication. +This document describes how to associate a k8s secret with a VMI for the purpose of iscsi initiator authentication. *NOTE: Only client authentication is supported at this time, meaning that the iscsi target with authenticate an initiator has permissions to access a device, but that a initiator can not authenticate the target.* @@ -71,5 +71,5 @@ kubectl create -f my-chap-secret.yaml kubectl create -f my-vm.yaml ``` -From there, the password and username fields in the k8s secret will automatically be mapped to a libvirt secret when the VM is scheduled to a node allowing the iscsi auth to work without any further configuration. +From there, the password and username fields in the k8s secret will automatically be mapped to a libvirt secret when the VMI is scheduled to a node allowing the iscsi auth to work without any further configuration. diff --git a/vendor/kubevirt.io/kubevirt/docs/libvirt-pod-networking.md b/vendor/kubevirt.io/kubevirt/docs/libvirt-pod-networking.md index 31542c717..da7421c58 100644 --- a/vendor/kubevirt.io/kubevirt/docs/libvirt-pod-networking.md +++ b/vendor/kubevirt.io/kubevirt/docs/libvirt-pod-networking.md @@ -5,14 +5,14 @@ Author: Fabian Deutsch \ ## Introduction Today, networking in KubeVirt is not integrated with Kubernetes. In order to -have network connectivity inside the VM, a user must create a specific VM Spec +have network connectivity inside the VMI, a user must create a specific VMI Spec that induces a particular libvirt domxml, in order to reuse a pre-exising host network interface. This is obviously suboptimal: - It is not integrated with Kubernetes -- It does not provide the VM with connectivity to pods +- It does not provide the VMI with connectivity to pods - It requires to specify host specific bits (the network device to use) The purpose of this document is to describe one approach of how we can provide @@ -24,7 +24,7 @@ to find a robust solution which works with Kubernetes today. ## Use-case -The primary use-case is to allow VM to get connected to the pod network. +The primary use-case is to allow VMI to get connected to the pod network. ## API @@ -65,36 +65,36 @@ mapped to a _new_ pod interface. To achieve this, for every vNIC a _new_ pod interface is requested through CNI. Another crucial constraint for this design is that in Kubernetes IP addresses are getting assigned to pods, not interfaces. Thus this solution needs to -achieve the same, and provide IP addresses to VMs, not just a interface. +achieve the same, and provide IP addresses to VMIs, not just a interface. -During this document we call each of these _new_ pod interfaces _VM interface_, +During this document we call each of these _new_ pod interfaces _VMI interface_, in order to differentiate them from the the originally-allocated pod interface (`eth0`). The original pod interface (`eth0`) is never modified by Kubevirt, and can be used to access libvirtd (through the libvirtd pod IP) or to provide -VM-centric services through the VM pod IP. +VMI-centric services through the VMI pod IP. The required steps to enable networking as described are: -1. Request/Create a _new_ VM interface on the libvirt pod, by using the CNI +1. Request/Create a _new_ VMI interface on the libvirt pod, by using the CNI proxy to use the hosts CNI configuration and plugins. -2. Remember the IP of the VM interface, then remove the IP from the VM +2. Remember the IP of the VMI interface, then remove the IP from the VMI interface 3. Create a libvirt network, backed by a bridge, enable DHCP, - and configure libvirt to provide the remembered IP address to the VM. + and configure libvirt to provide the remembered IP address to the VMI. Achieved by adding a DHCP host entry, which maps the vNIC MAC address to the remembered IP -4. On VM shutdown, delete all VM interfaces. They can be infered by following +4. On VMI shutdown, delete all VMI interfaces. They can be infered by following the libvirt networks associated with the vNICs -**Note:** The _new_ VM interface can not be directly attached to the VM, +**Note:** The _new_ VMI interface can not be directly attached to the VMI, because we lose the ability to provide the IP to the guest. The IP can only be provided by DHCP, which requires the use of a bridge. -This process must be repeated for every virtual NIC of every VM. -Thus N virtual NICs correspond to N VM interfaces, and in turn to N IP +This process must be repeated for every virtual NIC of every VMI. +Thus N virtual NICs correspond to N VMI interfaces, and in turn to N IP addresses. -**Note:** Creating one VM interface per virtual NIC might look like an +**Note:** Creating one VMI interface per virtual NIC might look like an overhead, but this is a Kubernetes/CNI-compatible way to request IP endpoints from the networking sub-system. @@ -103,8 +103,8 @@ from the networking sub-system. * Every virtual NIC can only use a single IP address (the one provided via DHCP) -* A new VM interface is required for every vNIC. -* Cleanup of the VM interfaces in case of an uncontrolled pod shutdown is +* A new VMI interface is required for every vNIC. +* Cleanup of the VMI interfaces in case of an uncontrolled pod shutdown is currently not handled @@ -115,7 +115,7 @@ from the networking sub-system. the host side), it is also reusing much of libvirt's network functionality. * If the CNI plugins are modified to signal if they can also provide L2 connectivity, then there is the chance, that a very similar mechanism can be - used in future to provide L2 connectivity to VMs (i.e. with the bridge or + used in future to provide L2 connectivity to VMIs (i.e. with the bridge or vxlan plugins). diff --git a/vendor/kubevirt.io/kubevirt/docs/logging.md b/vendor/kubevirt.io/kubevirt/docs/logging.md new file mode 100644 index 000000000..36882d15c --- /dev/null +++ b/vendor/kubevirt.io/kubevirt/docs/logging.md @@ -0,0 +1,33 @@ +# Logging + +For logging use the `Log` struct provided in the `log` package (see `pkg/log`). +That struct offers several functions for providing logs with different log levels, verbosity and content. + +## Log Levels and Verbosity + +The Log struct offers several functions for logging with a decent log level: `Info(msg)`, `Warning(msg)`, `Error(msg)`, `Critical(msg)`. +These functions also exist in a second flavor, where you can use a formatted string with additional arguments. + +Additionally you can set the verbosity with `V(verbosity)`, which takes effect on info level messages. + +Please check the [Kubernetes Logging Conventions](https://github.com/kubernetes/community/blob/master/contributors/devel/logging.md) for the meaning of the different log levels and verbosity. + +During runtime you will see: + +- all info logs with a verbosity equal or lower to verbosity set by the `-v` command line flag +- all warning, error and critical logs + +## Default values + +If you don't set a verbosity for your info log statements, they will use the default value of `2`. + +Also, if you don't provide a `-v` command line flag, it will use a default of `2`. + +## Enhancing logs + +You can enhance the log statements with some helper functions: + +- `Object(o)`: `o` has to be a Kubernetes resource, this will log the name, namespace, kind and uuid of the resource +- `With(...keyvals)`: logs the given key / value pairs +- `Reason(err)`: short for `With("reason", err)` +- `Key(name, kind)`: short for `With("name", name, "kind", kind)`, where given name can be in format `namespace/name` \ No newline at end of file diff --git a/vendor/kubevirt.io/kubevirt/docs/release.md b/vendor/kubevirt.io/kubevirt/docs/release.md index fee597fd3..8297d950c 100644 --- a/vendor/kubevirt.io/kubevirt/docs/release.md +++ b/vendor/kubevirt.io/kubevirt/docs/release.md @@ -89,3 +89,33 @@ The release process is mostly automatic and consists of the following steps: 5. Adjust the release details (draft, pre-release) as necessary at 6. Sent a friendly announcement email to + +Stable Branches +--------------- + +> **Note:** Before a bug is fixed in a stable branch, the same bug must be fixed +> in the `master` branch. The only exception is when a bug exists in a stable +> branch only. + +For every release a branch will be created following the pattern `release-x.y`. +For now, community members can propose pull requests to be included into a +stable branch. +Those pull requests should be limited to bug fixes and must not be +enhancements. + +Cherry picking can be used to pick a merge commit from the master branch +to a stable branch. An example: + +```bash +git checkout release-0.6 +git cherry-pick $THE_MERGE_COMMIT_ID -m 1 -sx +[release-0.6 acd756040] Merge pull request #1234 from great_person + Author: Bob Builder + Date: Thu Jun 28 17:50:05 2018 +0300 + 5 files changed, 55 insertions(+), 22 deletions(-) +git push $YOUR_REMOTE release-0.6:release-0.6-aParticularFix +``` + +After pushing the branch, you'll need to make sure to create a pull request +against the correct target branch in GitHub (in this case the target branch +is `release-0.6`). diff --git a/vendor/kubevirt.io/kubevirt/docs/replica-sets.md b/vendor/kubevirt.io/kubevirt/docs/replica-sets.md index e850f599b..6f9b15404 100644 --- a/vendor/kubevirt.io/kubevirt/docs/replica-sets.md +++ b/vendor/kubevirt.io/kubevirt/docs/replica-sets.md @@ -1,27 +1,27 @@ -# VirtualMachineReplicaSet +# VirtualMachineInstanceReplicaSet ## Overview -In order to allow scaling up or down similar VMs, add a way to specify -`VirtualMachine` templates and the amount of replicas required, to let the -runtime create these `VirtualMachine`s. +In order to allow scaling up or down similar VMIs, add a way to specify +`VirtualMachineInstance` templates and the amount of replicas required, to let the +runtime create these `VirtualMachineInstance`s. ## Use-cases -### Ephemeral VMs +### Ephemeral VMIs -Scaling ephemeral VMs which only have read-only mounts, or work with a backing -store, to keep temporary data, which can be deleted after the VM gets +Scaling ephemeral VMIs which only have read-only mounts, or work with a backing +store, to keep temporary data, which can be deleted after the VMI gets undefined. ## Implementation -A new object `VirtualMachineReplicaSet`, backed with a controller will be +A new object `VirtualMachineInstanceReplicaSet`, backed with a controller will be implemented: ```yaml -apiVersion: kubevirt.io/v1alpha1 -kind: VirtualMachineReplicaSet +apiVersion: kubevirt.io/v1alpha2 +kind: VirtualMachineInstanceReplicaSet metadata: name: myreplicaset spec: @@ -40,7 +40,7 @@ spec: [...] ``` -`spec.template` is equal to a `VirtualMachineSpec`. `spec.replicas` specifies +`spec.template` is equal to a `VirtualMachineInstanceSpec`. `spec.replicas` specifies how many instances should be created out of `spec.template`. `spec.selector` contains selectors, which need to match `spec.template.metadata.labels`. @@ -53,13 +53,13 @@ status: readyReplicas : 2 ``` In case of a scaling error, a `ReplicaFailure` condition is added to the -`status.conditions`. Further it shows the number of `VirtualMachine`s which +`status.conditions`. Further it shows the number of `VirtualMachineInstance`s which are in a non-final state and which match `spec.selector` in the `status.replicas` field. `status.readyReplicas` indicates how many of these replicas meet the ready condition. *Note* that at the moment when writing this proposal, there exist no -readiness checks for VirtualMachines in Kubevirt. Therefore a `VirtualMachine` is +readiness checks for VirtualMachineInstances in Kubevirt. Therefore a `VirtualMachineInstance` is considered to be ready, when reported by virt-handler as running or migrating. In case of a delete failure: @@ -70,7 +70,7 @@ status: - type: "ReplicaFailure" status: True reason: "FailureDelete" - message: "no permission to delete VMs" + message: "no permission to delete VMIs" lastTransmissionTime: "..." replicas: 4 readyReplicas: 3 @@ -84,7 +84,7 @@ status: - type: "ReplicaFailure" status: True reason: "FailureCreate" - message: "no permission to create VMs" + message: "no permission to create VMIs" lastTransmissionTime: "..." replicas: 2 readyReplicas: 3 @@ -92,47 +92,47 @@ status: ### Guarantees -The VirtualMachineReplicaSet does **not** guarantee that there will never be +The VirtualMachineInstanceReplicaSet does **not** guarantee that there will never be more than the wanted replicas active in the cluster. Based on readiness checks, -unknown VirtualMachine states and graceful deletes, it might decide to already +unknown VirtualMachineInstance states and graceful deletes, it might decide to already create new replicas in advance, to make sure that the amount of ready replicas stays close to the expected replica count. ### Chosen Implementation -The implementation of the VirtualMachineReplicaSet is a reimplementation of the +The implementation of the VirtualMachineInstanceReplicaSet is a reimplementation of the ReplicaSet for Pods in Kubernetes. It does not wrap around a Kubernetes ReplicaSet. There two *hard* reasons why one was chose over the other: - 1. Allow possible VirtualMachine related optimizations by implementing a + 1. Allow possible VirtualMachineInstance related optimizations by implementing a custom deletion order. When scaling down, it can make sense to take - migrating VirtualMachines into account. A possible deletion order would be: - not ready VMs, migrating VMs, ready VMs. This would be impossible to + migrating VirtualMachineInstances into account. A possible deletion order would be: + not ready VMIs, migrating VMIs, ready VMIs. This would be impossible to represent by wrapping around the ReplicaSet. - 2. Make Live Migrations an orthogonal feature for every VirtualMachine + 2. Make Live Migrations an orthogonal feature for every VirtualMachineInstance controller. If a controller does not have to care about the - VirtualMachine/Pod relationship, it does not have to care in any special + VirtualMachineInstance/Pod relationship, it does not have to care in any special way about migrations. By wrapping around existing controllers, we will always have to hide migration target Pods from the controller, until the - VirtualMachine was migrated, and then have to make it somehow visible + VirtualMachineInstance was migrated, and then have to make it somehow visible again. This solution leads to tricky synchronization problems which may not even be completely solvable. There are several *soft* reasons why one was chosen over the other: - 1. Provide a clear VirtualMachine abstraction via our VirtualMachine + 1. Provide a clear VirtualMachineInstance abstraction via our VirtualMachineInstance object. This allows domain specific modelling of controllers. - 2. Hide the whole relationship between VirtualMachines and Pods behind on + 2. Hide the whole relationship between VirtualMachineInstances and Pods behind on controller, so that others don't have to care about it. - 3. The actual business-logic of scaling the VirtualMachines is very easy to + 3. The actual business-logic of scaling the VirtualMachineInstances is very easy to understand and simple to implement. We get almost all the necessary infrastructure code from k8s libraries. The infrastructure code has a similar complexity (entity listeners, creating/deleting resources, ... ) for both implementations. For different types of controllers this - argument may not apply (e.g. DaemonSet equivalent for VirtualMachines). + argument may not apply (e.g. DaemonSet equivalent for VirtualMachineInstances). 4. Because of the simplicity of the business-logic, the equal complexity regarding to the controller infrastructure and the fact that there exists a ReplicaSet reference implementation from which we can learn/copy, it seems @@ -150,8 +150,8 @@ There are several *soft* reasons why one was chosen over the other: The basic functionality includes scaling up, down and reporting errors if scaling does not work. In this stage it is the full responsibility of the user -to attach labels to the VMs in a way, so that selectors of multiple -VirtualMachineReplicaSets don't overlap. +to attach labels to the VMIs in a way, so that selectors of multiple +VirtualMachineInstanceReplicaSets don't overlap. ### References diff --git a/vendor/kubevirt.io/kubevirt/docs/reviewer-guide.md b/vendor/kubevirt.io/kubevirt/docs/reviewer-guide.md new file mode 100644 index 000000000..25fceb001 --- /dev/null +++ b/vendor/kubevirt.io/kubevirt/docs/reviewer-guide.md @@ -0,0 +1,21 @@ +# Reviewer guide + +Some tips and tricks to obtain better reviews. + +Make a few passes over the code you want to review. + +1st pass, make sure the general design makes sense and that the code is structured in a way that's consistent with the project. + +2nd pass, detailed look. depending on the complexity of the PR, sometimes it easier check out the code and step through it in your editor. + +3rd pass, verify diffs from previous feedback rounds. + +4th pass, through the whole PR once you think that it is ready to be merged, try to put yourself in the position of someone who needs that feature desperately and play with the flow several times + +## Good to check: + +* User input validation +* Reasonable error messages +* Reasonable info messages +* Unit and functional tests to avoid regressions (the core case must be tested) +* The PR implement what is needed (changes out of the PR scope should belong to a separate one) diff --git a/vendor/kubevirt.io/kubevirt/docs/software-emulation.md b/vendor/kubevirt.io/kubevirt/docs/software-emulation.md new file mode 100644 index 000000000..1ed4bcc86 --- /dev/null +++ b/vendor/kubevirt.io/kubevirt/docs/software-emulation.md @@ -0,0 +1,43 @@ +# Software Emulation + +By default KubeVirt uses the `/dev/kvm` device to enable hardware emulation. +This is almost always desirable, however there are a few exceptions where this +approach is problematic. For instance, running KubeVirt on a cluster where the +nodes do not support hardware emulation. + +If `useEmulation` is enabled, hardware emulation via `/dev/kvm` will not be +attempted. `qemu` will be used for software emulation instead. + +# Configuration + +Enabling software emulation is a cluster-wide setting, and is activated using a +ConfigMap in the `kube-system` namespace. It can be enabled with the following +command: + +```bash +cluster/kubectl.sh --namespace kube-system create configmap kubevirt-config \ + --from-literal debug.useEmulation=true +``` + +If the `kube-system/kubevirt-config` ConfigMap already exists, the above entry +can be added using: + +```bash +cluster/kubectl.sh --namespace kube-system edit configmap kubevirt-config +``` + +In this case, add the `debug.useEmulation: "true"` setting to `data`: + +```yaml +apiVersion: v1 +kind: ConfigMap +metadata: + name: kubevirt-config + namespace: kube-system +data: + debug.useEmulation: "true" + +``` + +**NOTE**: The values of `ConfigMap.data` are **strings**. Yaml requires the use of +quotes around `"true"` to distinguish the value from a boolean. diff --git a/vendor/kubevirt.io/kubevirt/docs/vm-configuration.md b/vendor/kubevirt.io/kubevirt/docs/vm-configuration.md index 226b889f7..4ee94f016 100644 --- a/vendor/kubevirt.io/kubevirt/docs/vm-configuration.md +++ b/vendor/kubevirt.io/kubevirt/docs/vm-configuration.md @@ -42,7 +42,7 @@ disks to use, or it may require license key reactivation. Changing the backend configuration is totally transparent to the guest (aside from performance differences inherent in different backend choices). -![VM configuration diagram](vm-configuration.png "VM Configuration") +![VMI configuration diagram](vm-configuration.png "VMI Configuration") Portability issues @@ -157,10 +157,10 @@ Bearing all this in mind there can be multiple configurations associated with a single instance of a virtual machine. 1. Initial minimal tenant provided configuration - 2. Expanded configuration for inactive VM - 3. Expanded configuration for running VM reflecting desired state - 4. Expanded configuration for running VM reflecting current state - 5. Zero or many snapshots of the config for either inactive or running VM + 2. Expanded configuration for inactive VMI + 3. Expanded configuration for running VMI reflecting desired state + 4. Expanded configuration for running VMI reflecting current state + 5. Zero or many snapshots of the config for either inactive or running VMI An application may choose not to track all of these configurations explicitly. For example, by converting the minimal configuration, to the expanded inactive @@ -172,7 +172,7 @@ adapt to changes dynamically. Similarly an application tracking the inactive configuration of the guest, has a choice about how to handle updates to reflect hotplug/unplug operations. An unplug operation could be applied to the inactive configuration unconditionally, without waiting for completion on the running -VM. This would ensure that the device goes away on the next cold boot, even if +VMI. This would ensure that the device goes away on the next cold boot, even if the guest OS ignores the hotunplug. @@ -364,7 +364,7 @@ disk: Every device has a mandatory name field. Amongst other benefits, this allows easy tracking of the devices for management applications and users, simplifies -declarative hotplug and allows VirtualMachinePresets to detect conflicts based +declarative hotplug and allows VirtualMachineInstancePresets to detect conflicts based on device names. ### Specification changes @@ -375,7 +375,7 @@ libvirt on the node. A specification reflects the requirement from the user and will only be changed by the system by the apiserver on creation time or by initializers. After the VirtualMachine is accepted by the system and was processed by all initializers, controllers will ever only change `status` and -`metadata` fields. VirtualMachinePresets are an example of an initializer which +`metadata` fields. VirtualMachineInstancePresets are an example of an initializer which can manipulate the spec, before the VirtualMachine is fully accepted by the system. diff --git a/vendor/kubevirt.io/kubevirt/docs/vm-presets.md b/vendor/kubevirt.io/kubevirt/docs/vm-presets.md index 7c69f64a0..eacd6b8cd 100644 --- a/vendor/kubevirt.io/kubevirt/docs/vm-presets.md +++ b/vendor/kubevirt.io/kubevirt/docs/vm-presets.md @@ -1,73 +1,73 @@ Virtual Machine Presets ============================= -`VirtualMachinePresets` are an extension to general `VirtualMachine` +`VirtualMachineInstancePresets` are an extension to general `VirtualMachineInstance` configuration behaving much like `PodPresets` from Kubernetes. When a -`VirtualMachine` is created, any applicable `VirtualMachinePresets` -will be applied to the existing spec for the `VirtualMachine`. This allows -for re-use of common settings that should apply to multiple `VirtualMachines`. +`VirtualMachineInstance` is created, any applicable `VirtualMachineInstancePresets` +will be applied to the existing spec for the `VirtualMachineInstance`. This allows +for re-use of common settings that should apply to multiple `VirtualMachineInstances`. Implementation ------------------------ -`VirtualMachinePresets` are applied early while processing `VirtualMachine` -resources. This means the `VirtualMachine` resource is modified before it +`VirtualMachineInstancePresets` are applied early while processing `VirtualMachineInstance` +resources. This means the `VirtualMachineInstance` resource is modified before it is processed by any other component of KubeVirt. -Once a `VirtualMachinePreset` is successfully applied to a `VirtualMachine`, -the `VirtualMachine` will be marked with an annotation to indicate that it -was applied. If a conflict occurs while a `VirtualMachinePreset` is being -applied that portion of the `VirtualMachinePreset` will be skipped. +Once a `VirtualMachineInstancePreset` is successfully applied to a `VirtualMachineInstance`, +the `VirtualMachineInstance` will be marked with an annotation to indicate that it +was applied. If a conflict occurs while a `VirtualMachineInstancePreset` is being +applied that portion of the `VirtualMachineInstancePreset` will be skipped. Usage ------------------------ KubeVirt uses Kubernetes `Labels` and `Selectors` to determine which -`VirtualMachinePresets` apply to any given `VirtualMachine`, similarly to how -`PodPresets` work in Kubernetes. The `VirtualMachine` is marked with an +`VirtualMachineInstancePresets` apply to any given `VirtualMachineInstance`, similarly to how +`PodPresets` work in Kubernetes. The `VirtualMachineInstance` is marked with an Annotation upon successful completion. -Any domain structure can be listed in the `spec` of a `VirtualMachinePreset`. +Any domain structure can be listed in the `spec` of a `VirtualMachineInstancePreset`. e.g. Clock, Features, Memory, CPU, or Devices such network interfaces. All -elements of the `spec` section of a `VirtualMachinePreset` will be applied -to the `VirtualMachine`. +elements of the `spec` section of a `VirtualMachineInstancePreset` will be applied +to the `VirtualMachineInstance`. Overrides ------------------------ -`VirtualMachinePresets` use a similar conflict resolution strategy to +`VirtualMachineInstancePresets` use a similar conflict resolution strategy to Kubernetes `PodPresets`. If a portion of the domain spec is present in both a -`VirtualMachine` and a `VirtualMachinePreset` and both resources have the -identical information, then creation of the `VirtualMachine` will continue +`VirtualMachineInstance` and a `VirtualMachineInstancePreset` and both resources have the +identical information, then creation of the `VirtualMachineInstance` will continue normally. If however there is a difference between the resources, an Event will -be created indicating which `DomainSpec` element of which `VirtualMachinePreset` -was overridden. For example: If both the `VirtualMachine` and -`VirtualMachinePreset` define a `CPU`, but use a different number of `Cores`, +be created indicating which `DomainSpec` element of which `VirtualMachineInstancePreset` +was overridden. For example: If both the `VirtualMachineInstance` and +`VirtualMachineInstancePreset` define a `CPU`, but use a different number of `Cores`, KubeVirt will note the difference. -If any settings from the `VirtualMachinePreset` were successfully applied, the -`VirtualMachine` will be annotated. +If any settings from the `VirtualMachineInstancePreset` were successfully applied, the +`VirtualMachineInstance` will be annotated. -Because `VirtualMachinePresets` are implemented within the `virt-controller` pod, +Because `VirtualMachineInstancePresets` are implemented within the `virt-controller` pod, log messages associated with resource conflicts will also be reflected there. Creation and Usage ------------------------ -`VirtualMachinePresets` are namespaced resources, so should be created in the -same namespace as the `VirtualMachines` that will use them: +`VirtualMachineInstancePresets` are namespaced resources, so should be created in the +same namespace as the `VirtualMachineInstances` that will use them: `kubectl create -f .yaml [--namespace ]` -KubeVirt will determine which `VirtualMachinePresets` apply to a Particular -`VirtualMachine` by matching `Labels`. For example: +KubeVirt will determine which `VirtualMachineInstancePresets` apply to a Particular +`VirtualMachineInstance` by matching `Labels`. For example: ```yaml -kind: VirtualMachinePreset +kind: VirtualMachineInstancePreset metadata: name: example-preset spec: @@ -77,11 +77,11 @@ spec: ... ``` -would match any `VirtualMachine` in the same namespace with a `Label` of +would match any `VirtualMachineInstance` in the same namespace with a `Label` of `kubevirt.io/flavor: foo`. For example: ```yaml -kind: VirtualMachine +kind: VirtualMachineInstance version: v1 metadata: name: myvm @@ -91,16 +91,33 @@ metadata: ``` +Exclusions +------------------------ +Since `VirtualMachineInstancePresets` use `Selectors` that indicate which +`VirtualMachineInstances` their settings should apply to, there needs to exist a +mechanism by which `VirtualMachineInstances` can opt out of `VirtualMachineInstancePresets` +altogether. This is done using an annotation: + +```yaml +kind: VirtualMachineInstance +version: v1 +metadata: + name: myvm + annotations: + virtualmachinepresets.admission.kubevirt.io/exclude: "true" + ... +``` + + Examples ============================= -Simple `VirtualMachinePreset` Example +Simple `VirtualMachineInstancePreset` Example ------------------------ ```yaml -apiVersion: kubevirt.io/v1alpha1 -kind: VirtualMachinePreset -version: v1alpha1 +apiVersion: kubevirt.io/v1alpha2 +kind: VirtualMachineInstancePreset metadata: name: example-preset spec: @@ -117,8 +134,8 @@ spec: spinlocks: spinlocks: 8191 --- -apiVersion: kubevirt.io/v1alpha1 -kind: VirtualMachine +apiVersion: kubevirt.io/v1alpha2 +kind: VirtualMachineInstance version: v1 metadata: name: myvm @@ -130,24 +147,24 @@ spec: uuid: c8f99fc8-20f5-46c4-85e5-2b841c547cef ``` -Once the `VirtualMachinePreset` is applied to the `VirtualMachine`, the +Once the `VirtualMachineInstancePreset` is applied to the `VirtualMachineInstance`, the resulting resource would look like this: ```yaml apiVersion: v1 items: -- apiVersion: kubevirt.io/v1alpha1 - kind: VirtualMachine +- apiVersion: kubevirt.io/v1alpha2 + kind: VirtualMachineInstance metadata: annotations: - presets.virtualmachines.kubevirt.io/presets-applied: kubevirt.io/v1alpha1 - virtualmachinepreset.kubevirt.io/example-preset: kubevirt.io/v1alpha1 + presets.virtualmachines.kubevirt.io/presets-applied: kubevirt.io/v1alpha2 + virtualmachinepreset.kubevirt.io/example-preset: kubevirt.io/v1alpha2 labels: kubevirt.io/flavor: windows-10 name: myvm namespace: default - selfLink: /apis/kubevirt.io/v1alpha1/namespaces/default/virtualmachines/myvm + selfLink: /apis/kubevirt.io/v1alpha2/namespaces/default/virtualmachineinstances/myvm spec: domain: devices: {} @@ -182,14 +199,13 @@ metadata: Conflict Example ------------------------ -This is an example of a merge conflict. In this case both the `VirtualMachine` -and `VirtualMachinePreset` request different number of CPU's. +This is an example of a merge conflict. In this case both the `VirtualMachineInstance` +and `VirtualMachineInstancePreset` request different number of CPU's. ```yaml -apiVersion: kubevirt.io/v1alpha1 -kind: VirtualMachinePreset -version: v1alpha1 +apiVersion: kubevirt.io/v1alpha2 +kind: VirtualMachineInstancePreset metadata: name: example-preset spec: @@ -200,8 +216,8 @@ spec: cpu: cores: 4 --- -apiVersion: kubevirt.io/v1alpha1 -kind: VirtualMachine +apiVersion: kubevirt.io/v1alpha2 +kind: VirtualMachineInstance version: v1 metadata: name: myvm @@ -213,23 +229,23 @@ spec: cores: 6 ``` -In this case the `VirtualMachine` Spec will remain unmodified. Use +In this case the `VirtualMachineInstance` Spec will remain unmodified. Use `kubectl get events` to show events. ```yaml apiVersion: v1 items: -- apiVersion: kubevirt.io/v1alpha1 - kind: VirtualMachine +- apiVersion: kubevirt.io/v1alpha2 + kind: VirtualMachineInstance metadata: annotations: - presets.virtualmachines.kubevirt.io/presets-applied: kubevirt.io/v1alpha1 + presets.virtualmachines.kubevirt.io/presets-applied: kubevirt.io/v1alpha2 clusterName: "" labels: kubevirt.io/flavor: default-features name: myvm namespace: default - selfLink: /apis/kubevirt.io/v1alpha1/namespaces/default/virtualmachines/myvm + selfLink: /apis/kubevirt.io/v1alpha2/namespaces/default/virtualmachineinstances/myvm spec: domain: cpu: @@ -254,4 +270,4 @@ metadata: ``` Calling `kubectl get events` would have a line like: -2m 2m 1 myvm.1515bbb8d397f258 VirtualMachine Warning Conflict virtualmachine-preset-controller Unable to apply VirtualMachinePreset 'example-preset': spec.cpu: &{6} != &{4} +2m 2m 1 myvm.1515bbb8d397f258 VirtualMachineInstance Warning Conflict virtualmachine-preset-controller Unable to apply VirtualMachineInstancePreset 'example-preset': spec.cpu: &{6} != &{4} diff --git a/vendor/kubevirt.io/kubevirt/glide.lock b/vendor/kubevirt.io/kubevirt/glide.lock index 679ff7b92..3e50b68fe 100644 --- a/vendor/kubevirt.io/kubevirt/glide.lock +++ b/vendor/kubevirt.io/kubevirt/glide.lock @@ -1,5 +1,5 @@ -hash: 43bf5b9efcb1e998f16311fea749ec295c39564482781cdccb5724e57ecb5f24 -updated: 2018-04-20T09:53:00.832005531Z +hash: 72f3abe955ef368d170b0201cdb32729b15c0c5bc3e8523dbd6d7dc7d235fbcb +updated: 2018-05-30T17:36:13.225619211-04:00 imports: - name: cloud.google.com/go version: 3b1ae45394a234c385be014e9a488f2bb6eef821 @@ -34,7 +34,7 @@ imports: subpackages: - log - name: github.com/emicklei/go-restful-openapi - version: 60f3c22579aa3b998e4c6e902649760531ca03ca + version: 51bf251d405ad1e23511fef0a2dbe40bc70ce2c6 - name: github.com/emicklei/go-restful-swagger12 version: 7524189396c68dc4b04d53852f9edc00f816b123 - name: github.com/evanphx/json-patch @@ -62,9 +62,11 @@ imports: - name: github.com/go-stack/stack version: 259ab82a6cad3992b4e21ff5cac294ccb06474bc - name: github.com/gogo/protobuf - version: 1ef32a8b9fc3f8ec940126907cedb5998f6318e4 + version: c0656edd0d9eab7c66d1eb0c568f9039345796f7 subpackages: + - gogoproto - proto + - protoc-gen-gogo/descriptor - sortkeys - name: github.com/golang/glog version: 44145f04b68cf362d9c4df2182967c2275eaefed @@ -73,7 +75,7 @@ imports: subpackages: - lru - name: github.com/golang/mock - version: 8b2eeeb0ca5f56c78bec5efde9c4a21d9201126c + version: 22bbf0ddf08105dfa364d0a2fa619dfa71014af5 subpackages: - gomock - name: github.com/golang/protobuf @@ -91,7 +93,7 @@ imports: - name: github.com/google/gofuzz version: 44d81051d367757e1c7c6a5a86423ece9afcf63c - name: github.com/google/goterm - version: a4092ec6825782fa1703cbaaeaf24ef377d5c9c4 + version: 70e1c263818522aa1ecbdd34d7e143639d447ced subpackages: - term - name: github.com/googleapis/gnostic @@ -135,10 +137,6 @@ imports: version: 4abfceffa76a675ea43d133e49aad64c821d32bf subpackages: - conn -- name: github.com/kubevirt/qe-tools - version: 5891aede49ba383e4e53320ff46e6999dffde8c4 - subpackages: - - ginkgo-reporters - name: github.com/libvirt/libvirt-go version: 0822ea6d658d7a0deeaa2ce63ed3efd6306bee03 - name: github.com/mailru/easyjson @@ -192,7 +190,7 @@ imports: - name: github.com/PuerkitoBio/urlesc version: 5bd2802263f21d8788851d5305584c82a5c75d7e - name: github.com/spf13/cobra - version: a1f051bc3eba734da4772d60e2d677f47cf93ef4 + version: ef82de70bb3f60c65fb8eebacbb2d122ef517385 subpackages: - cobra - name: github.com/spf13/pflag @@ -227,9 +225,10 @@ imports: - idna - internal/iana - internal/socket + - internal/timeseries - ipv4 - lex/httplex - - websocket + - trace - name: golang.org/x/oauth2 version: a6bd8cefa1811bd24b86f8902872e4e8225f74c4 subpackages: @@ -268,7 +267,7 @@ imports: - unicode/norm - width - name: google.golang.org/appengine - version: 0a24098c0ec68416ec050f567f75df563d6b231e + version: b1f26356af11148e710935ed1ac8a7f5702c7612 subpackages: - internal - internal/app_identity @@ -279,19 +278,36 @@ imports: - internal/remote_api - internal/urlfetch - urlfetch +- name: google.golang.org/genproto + version: 09f6ed296fc66555a25fe4ce95173148778dfa85 + subpackages: + - googleapis/rpc/status - name: google.golang.org/grpc version: d2e1b51f33ff8c5e4a15560ff049d200e83726c5 subpackages: - codes + - credentials + - grpclb/grpc_lb_v1 + - grpclog + - internal + - keepalive + - metadata + - naming + - peer + - stats + - status + - tap + - transport - name: gopkg.in/inf.v0 version: 3887ee99ecf07df5b447e9b00d9c0b2adaa9f3e4 - name: gopkg.in/ini.v1 - version: ace140f73450505f33e8b8418216792275ae82a7 + version: 06f5f3d67269ccec1fe5fe4134ba6e982984f7f5 - name: gopkg.in/yaml.v2 version: 53feefa2559fb8dfa8d81baad31be332c97d6c77 - name: k8s.io/api version: acf347b865f29325eb61f4cd2df11e86e073a5ee subpackages: + - admission/v1beta1 - admissionregistration/v1alpha1 - admissionregistration/v1beta1 - apps/v1 @@ -310,6 +326,7 @@ imports: - core/v1 - events/v1beta1 - extensions/v1beta1 + - imagepolicy/v1alpha1 - networking/v1 - policy/v1beta1 - rbac/v1 @@ -490,6 +507,12 @@ imports: subpackages: - pkg/common - pkg/util/proto +- name: kubevirt.io/qe-tools + version: 80f4b017d28e9c45955ac462dfcdef4520e6ec1a + repo: https://github.com/kubevirt/qe-tools.git + subpackages: + - pkg/ginkgo-reporters + - pkg/polarion-xml testImports: - name: github.com/elazarl/goproxy version: 07b16b6e30fcac0ad8c0435548e743bcf2ca7e92 diff --git a/vendor/kubevirt.io/kubevirt/glide.yaml b/vendor/kubevirt.io/kubevirt/glide.yaml index 7c6f278e1..6f03e6de9 100644 --- a/vendor/kubevirt.io/kubevirt/glide.yaml +++ b/vendor/kubevirt.io/kubevirt/glide.yaml @@ -48,16 +48,23 @@ import: - package: github.com/gorilla/websocket version: 0647012449a1878977514a346b26637dd022446c - package: google.golang.org/grpc +- package: google.golang.org/genproto + version: 09f6ed296fc66555a25fe4ce95173148778dfa85 + subpackages: + - googleapis/rpc/status - package: github.com/spf13/cobra - version: ^0.0.2 + version: ^0.0.3 subpackages: - cobra +- package: github.com/spf13/pflag + version: 1.0.1 - package: k8s.io/apiextensions-apiserver version: kubernetes-1.9.7 - package: github.com/ant31/crd-validation version: eabcf70a1bd73e9296fa0c5f57de604689200a1b -- package: github.com/kubevirt/qe-tools - version: v0.1.0 +- package: kubevirt.io/qe-tools + version: v0.1.1 + repo: https://github.com/kubevirt/qe-tools.git testImport: - package: github.com/elazarl/goproxy version: 07b16b6e30fcac0ad8c0435548e743bcf2ca7e92 diff --git a/vendor/kubevirt.io/kubevirt/hack/build-copy-artifacts.sh b/vendor/kubevirt.io/kubevirt/hack/build-copy-artifacts.sh new file mode 100755 index 000000000..873b75485 --- /dev/null +++ b/vendor/kubevirt.io/kubevirt/hack/build-copy-artifacts.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# +# This file is part of the KubeVirt project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Copyright 2017 Red Hat, Inc. +# + +set -e + +source hack/common.sh +source hack/config.sh + +if [ $# -eq 0 ]; then + args=$docker_images +else + args=$@ +fi + +for arg in $args; do + BIN_NAME=$(basename $arg) + rsync -avzq --exclude "**/*.md" --exclude "**/*.go" --exclude "**/.*" $arg/ ${CMD_OUT_DIR}/${BIN_NAME}/ + # TODO the version of docker we're using in our vagrant dev environment + # does not support using ARGS in FROM field. + # https://docs.docker.com/engine/reference/builder/#understand-how-arg-and-from-interact + # Because of this we have to manipulate the Dockerfile for kubevirt containers + # that depend on other kubevirt containers. + cat $arg/Dockerfile | sed -e "s#kubevirt/registry-disk-v1alpha#${docker_prefix}/registry-disk-v1alpha\:${docker_tag}#g" >${CMD_OUT_DIR}/${BIN_NAME}/Dockerfile +done diff --git a/vendor/kubevirt.io/kubevirt/hack/build-docker.sh b/vendor/kubevirt.io/kubevirt/hack/build-docker.sh index 62d1b23ad..c05542b3f 100755 --- a/vendor/kubevirt.io/kubevirt/hack/build-docker.sh +++ b/vendor/kubevirt.io/kubevirt/hack/build-docker.sh @@ -38,13 +38,6 @@ fi for arg in $args; do BIN_NAME=$(basename $arg) if [ "${target}" = "build" ]; then - rsync -avz --exclude "**/*.md" --exclude "**/*.go" --exclude "**/.*" $arg/ ${CMD_OUT_DIR}/${BIN_NAME}/ - # TODO the version of docker we're using in our vagrant dev environment - # does not support using ARGS in FROM field. - # https://docs.docker.com/engine/reference/builder/#understand-how-arg-and-from-interact - # Because of this we have to manipulate the Dockerfile for kubevirt containers - # that depend on other kubevirt containers. - cat $arg/Dockerfile | sed -e "s#kubevirt/registry-disk-v1alpha#${docker_prefix}/registry-disk-v1alpha\:${docker_tag}#g" >${CMD_OUT_DIR}/${BIN_NAME}/Dockerfile ( cd ${CMD_OUT_DIR}/${BIN_NAME}/ docker $target -t ${docker_prefix}/${BIN_NAME}:${docker_tag} --label ${job_prefix} --label ${BIN_NAME} . diff --git a/vendor/kubevirt.io/kubevirt/hack/build-go.sh b/vendor/kubevirt.io/kubevirt/hack/build-go.sh index 2929310f7..855300a97 100755 --- a/vendor/kubevirt.io/kubevirt/hack/build-go.sh +++ b/vendor/kubevirt.io/kubevirt/hack/build-go.sh @@ -21,6 +21,7 @@ set -e source hack/common.sh source hack/config.sh +source hack/version.sh if [ -z "$1" ]; then target="install" @@ -56,10 +57,19 @@ if [ $# -eq 0 ]; then fi fi +# Return a pkgdir parameter based on os and arch +function pkg_dir() { + if [ -n "${KUBEVIRT_GO_BASE_PKGDIR}" ]; then + echo "-pkgdir ${KUBEVIRT_GO_BASE_PKGDIR}/$1-$2" + fi +} + # handle binaries if [ "${target}" = "install" ]; then - rm -rf ${CMD_OUT_DIR} + # Delete all binaries which are not present in the binaries variable to avoid branch inconsistencies + to_delete=$(comm -23 <(find ${CMD_OUT_DIR} -mindepth 1 -maxdepth 1 -type d | sort) <(echo $binaries | sed -e 's/cmd\///g' -e 's/ /\n/g' | sed -e "s#^#${CMD_OUT_DIR}/#" | sort)) + rm -rf ${to_delete} fi for arg in $args; do @@ -79,13 +89,13 @@ for arg in $args; do # always build and link the linux/amd64 binary LINUX_NAME=${ARCH_BASENAME}-linux-amd64 - GOOS=linux GOARCH=amd64 go build -o ${CMD_OUT_DIR}/${BIN_NAME}/${LINUX_NAME} + GOOS=linux GOARCH=amd64 go build -i -o ${CMD_OUT_DIR}/${BIN_NAME}/${LINUX_NAME} -ldflags "$(kubevirt::version::ldflags)" $(pkg_dir linux amd64) (cd ${CMD_OUT_DIR}/${BIN_NAME} && ln -sf ${LINUX_NAME} ${BIN_NAME}) # build virtctl also for darwin and windows if [ "${BIN_NAME}" = "virtctl" ]; then - GOOS=darwin GOARCH=amd64 go build -o ${CMD_OUT_DIR}/${BIN_NAME}/${ARCH_BASENAME}-darwin-amd64 - GOOS=windows GOARCH=amd64 go build -o ${CMD_OUT_DIR}/${BIN_NAME}/${ARCH_BASENAME}-windows-amd64.exe + GOOS=darwin GOARCH=amd64 go build -i -o ${CMD_OUT_DIR}/${BIN_NAME}/${ARCH_BASENAME}-darwin-amd64 -ldflags "$(kubevirt::version::ldflags)" $(pkg_dir darwin amd64) + GOOS=windows GOARCH=amd64 go build -i -o ${CMD_OUT_DIR}/${BIN_NAME}/${ARCH_BASENAME}-windows-amd64.exe -ldflags "$(kubevirt::version::ldflags)" $(pkg_dir windows amd64) fi ) else diff --git a/vendor/kubevirt.io/kubevirt/hack/build-manifests.sh b/vendor/kubevirt.io/kubevirt/hack/build-manifests.sh index 10f07fec3..fd4b48bb0 100755 --- a/vendor/kubevirt.io/kubevirt/hack/build-manifests.sh +++ b/vendor/kubevirt.io/kubevirt/hack/build-manifests.sh @@ -27,14 +27,18 @@ manifest_docker_prefix=${manifest_docker_prefix-${docker_prefix}} args=$(cd ${KUBEVIRT_DIR}/manifests && find * -type f -name "*.yaml.in") rm -rf ${MANIFESTS_OUT_DIR} +rm -rf ${MANIFEST_TEMPLATES_OUT_DIR} (cd ${KUBEVIRT_DIR}/tools/manifest-templator/ && go build) for arg in $args; do final_out_dir=$(dirname ${MANIFESTS_OUT_DIR}/${arg}) + final_templates_out_dir=$(dirname ${MANIFEST_TEMPLATES_OUT_DIR}/${arg}) mkdir -p ${final_out_dir} + mkdir -p ${final_templates_out_dir} manifest=$(basename -s .in ${arg}) outfile=${final_out_dir}/${manifest} + template_outfile=${final_templates_out_dir}/${manifest}.j2 ${KUBEVIRT_DIR}/tools/manifest-templator/manifest-templator \ --namespace=${namespace} \ @@ -42,4 +46,36 @@ for arg in $args; do --docker-tag=${docker_tag} \ --generated-manifests-dir=${KUBEVIRT_DIR}/manifests/generated/ \ --input-file=${KUBEVIRT_DIR}/manifests/$arg >${outfile} + + ${KUBEVIRT_DIR}/tools/manifest-templator/manifest-templator \ + --namespace="{{ namespace }}" \ + --docker-prefix="{{ docker_prefix }}" \ + --docker-tag="{{ docker_tag }}" \ + --generated-manifests-dir=${KUBEVIRT_DIR}/manifests/generated/ \ + --input-file=${KUBEVIRT_DIR}/manifests/$arg >${template_outfile} done + +# Remove empty lines at the end of files which are added by go templating +find ${MANIFESTS_OUT_DIR}/ -type f -exec sed -i {} -e '${/^$/d;}' \; +find ${MANIFEST_TEMPLATES_OUT_DIR}/ -type f -exec sed -i {} -e '${/^$/d;}' \; + +# make sure that template manifests align with release manifests +export namespace=${namespace} +export docker_tag=${docker_tag} +export docker_prefix=${manifest_docker_prefix} + +TMP_DIR=$(mktemp -d) +cleanup() { + ret=$? + rm -rf "${TMP_DIR}" + exit ${ret} +} +trap "cleanup" INT TERM EXIT + +for file in $(find ${MANIFEST_TEMPLATES_OUT_DIR}/ -type f); do + mkdir -p ${TMP_DIR}/$(dirname ${file}) + j2 ${file} | sed -e '/.$/a\' >${TMP_DIR}/${file%.j2} +done + +# If diff fails then we have an issue +diff -r ${MANIFESTS_OUT_DIR} ${TMP_DIR}/${MANIFEST_TEMPLATES_OUT_DIR} diff --git a/vendor/kubevirt.io/kubevirt/hack/common.sh b/vendor/kubevirt.io/kubevirt/hack/common.sh index d32e724ab..4bafa8ad8 100644 --- a/vendor/kubevirt.io/kubevirt/hack/common.sh +++ b/vendor/kubevirt.io/kubevirt/hack/common.sh @@ -10,6 +10,7 @@ CMD_OUT_DIR=$OUT_DIR/cmd TESTS_OUT_DIR=$OUT_DIR/tests APIDOCS_OUT_DIR=$OUT_DIR/apidocs MANIFESTS_OUT_DIR=$OUT_DIR/manifests +MANIFEST_TEMPLATES_OUT_DIR=$OUT_DIR/templates/manifests PYTHON_CLIENT_OUT_DIR=$OUT_DIR/client-python function build_func_tests() { @@ -18,10 +19,21 @@ function build_func_tests() { mv ${KUBEVIRT_DIR}/tests/tests.test ${TESTS_OUT_DIR}/ } +KUBEVIRT_PROVIDER=${KUBEVIRT_PROVIDER:-k8s-1.10.3} +KUBEVIRT_NUM_NODES=${KUBEVIRT_NUM_NODES:-1} + +# Use this environment variable to set a custom pkgdir path +# Useful for cross-compilation where the default -pkdir for cross-builds may not be writable +#KUBEVIRT_GO_BASE_PKGDIR="${GOPATH}/crossbuild-cache-root/" + +# If on a developer setup, expose ocp on 8443, so that the openshift web console can be used (the port is important because of auth redirects) +if [ -z "${JOB_NAME}" ]; then + KUBEVIRT_PROVIDER_EXTRA_ARGS="${KUBEVIRT_PROVIDER_EXTRA_ARGS} --ocp-port 8443" +fi + #If run on jenkins, let us create isolated environments based on the job and # the executor number -PROVIDER=${PROVIDER:-vagrant-kubernetes} -provider_prefix=${JOB_NAME:-${PROVIDER}}${EXECUTOR_NUMBER} +provider_prefix=${JOB_NAME:-${KUBEVIRT_PROVIDER}}${EXECUTOR_NUMBER} job_prefix=${JOB_NAME:-kubevirt}${EXECUTOR_NUMBER} # Populate an environment variable with the version info needed. diff --git a/vendor/kubevirt.io/kubevirt/hack/config-default.sh b/vendor/kubevirt.io/kubevirt/hack/config-default.sh index b804c2cbc..01e9517f3 100644 --- a/vendor/kubevirt.io/kubevirt/hack/config-default.sh +++ b/vendor/kubevirt.io/kubevirt/hack/config-default.sh @@ -1,8 +1,7 @@ binaries="cmd/virt-controller cmd/virt-launcher cmd/virt-handler cmd/virtctl cmd/fake-qemu-process cmd/virt-api cmd/subresource-access-test" -docker_images="cmd/virt-controller cmd/virt-launcher cmd/virt-handler cmd/virt-api images/iscsi-demo-target-tgtd images/vm-killer cmd/registry-disk-v1alpha images/cirros-registry-disk-demo images/fedora-cloud-registry-disk-demo images/alpine-registry-disk-demo cmd/subresource-access-test images/winrmcli" +docker_images="cmd/virt-controller cmd/virt-launcher cmd/virt-handler cmd/virt-api images/disks-images-provider images/vm-killer cmd/registry-disk-v1alpha images/cirros-registry-disk-demo images/fedora-cloud-registry-disk-demo images/alpine-registry-disk-demo cmd/subresource-access-test images/winrmcli" docker_prefix=${DOCKER_PREFIX:-kubevirt} docker_tag=${DOCKER_TAG:-latest} master_ip=192.168.200.2 network_provider=flannel -kubeconfig=cluster/vagrant/.kubeconfig namespace=kube-system diff --git a/vendor/kubevirt.io/kubevirt/hack/config.sh b/vendor/kubevirt.io/kubevirt/hack/config.sh index ab853fd50..ec82baf2f 100644 --- a/vendor/kubevirt.io/kubevirt/hack/config.sh +++ b/vendor/kubevirt.io/kubevirt/hack/config.sh @@ -1,12 +1,13 @@ unset binaries docker_images docker_prefix docker_tag manifest_templates \ master_ip network_provider kubeconfig manifest_docker_prefix namespace -PROVIDER=${PROVIDER:-vagrant-kubernetes} +KUBEVIRT_PROVIDER=${KUBEVIRT_PROVIDER:-${PROVIDER}} +KUBEVIRT_PROVIDER=${KUBEVIRT_PROVIDER:-k8s-1.10.3} -source ${KUBEVIRT_PATH}hack/config-default.sh source ${KUBEVIRT_PATH}hack/config-${PROVIDER}.sh +source ${KUBEVIRT_PATH}hack/config-default.sh source ${KUBEVIRT_PATH}hack/config-${KUBEVIRT_PROVIDER}.sh # Allow different providers to override default config values -test -f "hack/config-provider-${PROVIDER}.sh" && source hack/config-provider-${PROVIDER}.sh +test -f "hack/config-provider-${KUBEVIRT_PROVIDER}.sh" && source hack/config-provider-${KUBEVIRT_PROVIDER}.sh # Let devs override any default variables, to avoid needing # to change the version controlled config-default.sh file diff --git a/vendor/kubevirt.io/kubevirt/hack/docker-builder/Dockerfile b/vendor/kubevirt.io/kubevirt/hack/docker-builder/Dockerfile index 4d38943cf..d298261f9 100644 --- a/vendor/kubevirt.io/kubevirt/hack/docker-builder/Dockerfile +++ b/vendor/kubevirt.io/kubevirt/hack/docker-builder/Dockerfile @@ -20,6 +20,9 @@ RUN \ go get -u github.com/Masterminds/glide && \ go get golang.org/x/tools/cmd/goimports && \ go get -u mvdan.cc/sh/cmd/shfmt && \ + cd /go/src/mvdan.cc/sh/cmd/shfmt && \ + git checkout v2.3.0 && \ + go install && \ go get -u github.com/golang/mock/gomock && \ go get -u github.com/rmohr/mock/mockgen && \ go get -u github.com/rmohr/go-swagger-utils/swagger-doc && \ @@ -37,6 +40,8 @@ RUN \ git checkout release-1.9 && \ go install +RUN pip install j2cli + ADD entrypoint.sh /entrypoint.sh ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/vendor/kubevirt.io/kubevirt/hack/dockerized b/vendor/kubevirt.io/kubevirt/hack/dockerized index 2a667937b..41709c16d 100755 --- a/vendor/kubevirt.io/kubevirt/hack/dockerized +++ b/vendor/kubevirt.io/kubevirt/hack/dockerized @@ -72,6 +72,8 @@ docker run --rm -v "${BUILDER}:/root:rw,z" ${USE_TTY} -w "/root/go/src/kubevirt. # Copy the whole kubevirt data out to get generated sources and formatting changes _rsync --exclude '.glide*' --exclude 'cluster/**/.kubectl' --exclude 'cluster/**/.oc' --exclude 'cluster/**/.kubeconfig' --exclude "_out" --exclude "vendor" --exclude ".vagrant" --exclude ".git" "rsync://root@127.0.0.1:${RSYNCD_PORT}/build" ${KUBEVIRT_DIR}/ +_rsync --delete "rsync://root@127.0.0.1:${RSYNCD_PORT}/build/manifests/generated/" "${KUBEVIRT_DIR}/manifests/generated" +_rsync --delete "rsync://root@127.0.0.1:${RSYNCD_PORT}/build/cluster/examples/" "${KUBEVIRT_DIR}/cluster/examples" if [ "$SYNC_VENDOR" = "true" ]; then _rsync --delete "rsync://root@127.0.0.1:${RSYNCD_PORT}/vendor" "${VENDOR_DIR}/" fi diff --git a/vendor/kubevirt.io/kubevirt/hack/functests.sh b/vendor/kubevirt.io/kubevirt/hack/functests.sh index dd6934a5c..7fd7a5ef1 100755 --- a/vendor/kubevirt.io/kubevirt/hack/functests.sh +++ b/vendor/kubevirt.io/kubevirt/hack/functests.sh @@ -24,4 +24,8 @@ source hack/config.sh functest_docker_prefix=${manifest_docker_prefix-${docker_prefix}} -${TESTS_OUT_DIR}/tests.test -kubeconfig=${kubeconfig} -tag=${docker_tag} -prefix=${functest_docker_prefix} -kubectl-path=${kubectl} -test.timeout 60m ${FUNC_TEST_ARGS} +if [[ ${TARGET} == openshift* ]]; then + oc=${kubectl} +fi + +${TESTS_OUT_DIR}/tests.test -kubeconfig=${kubeconfig} -tag=${docker_tag} -prefix=${functest_docker_prefix} -oc-path=${oc} -kubectl-path=${kubectl} -test.timeout 90m ${FUNC_TEST_ARGS} diff --git a/vendor/kubevirt.io/kubevirt/hack/generate.sh b/vendor/kubevirt.io/kubevirt/hack/generate.sh index 8f475ee32..9f9fb1f89 100755 --- a/vendor/kubevirt.io/kubevirt/hack/generate.sh +++ b/vendor/kubevirt.io/kubevirt/hack/generate.sh @@ -15,10 +15,12 @@ goimports -w -local kubevirt.io ${KUBEVIRT_DIR}/cmd/ ${KUBEVIRT_DIR}/pkg/ ${KUBE ${KUBEVIRT_DIR}/tools/openapispec/openapispec --dump-api-spec-path ${KUBEVIRT_DIR}/api/openapi-spec/swagger.json (cd ${KUBEVIRT_DIR}/tools/crd-generator/ && go build) +rm -f ${KUBEVIRT_DIR}/manifests/generated/* +rm -f ${KUBEVIRT_DIR}/cluster/examples/* +${KUBEVIRT_DIR}/tools/crd-generator/crd-generator --crd-type=vmi >${KUBEVIRT_DIR}/manifests/generated/vmi-resource.yaml +${KUBEVIRT_DIR}/tools/crd-generator/crd-generator --crd-type=vmirs >${KUBEVIRT_DIR}/manifests/generated/vmirs-resource.yaml +${KUBEVIRT_DIR}/tools/crd-generator/crd-generator --crd-type=vmipreset >${KUBEVIRT_DIR}/manifests/generated/vmipreset-resource.yaml ${KUBEVIRT_DIR}/tools/crd-generator/crd-generator --crd-type=vm >${KUBEVIRT_DIR}/manifests/generated/vm-resource.yaml -${KUBEVIRT_DIR}/tools/crd-generator/crd-generator --crd-type=vmrs >${KUBEVIRT_DIR}/manifests/generated/vmrs-resource.yaml -${KUBEVIRT_DIR}/tools/crd-generator/crd-generator --crd-type=vmpreset >${KUBEVIRT_DIR}/manifests/generated/vmpreset-resource.yaml -${KUBEVIRT_DIR}/tools/crd-generator/crd-generator --crd-type=ovm >${KUBEVIRT_DIR}/manifests/generated/ovm-resource.yaml (cd ${KUBEVIRT_DIR}/tools/vms-generator/ && go build) -${KUBEVIRT_DIR}/tools/vms-generator/vms-generator --docker-prefix=$docker_prefix --generated-vms-dir=${KUBEVIRT_DIR}/cluster/examples +${KUBEVIRT_DIR}/tools/vms-generator/vms-generator --generated-vms-dir=${KUBEVIRT_DIR}/cluster/examples diff --git a/vendor/kubevirt.io/kubevirt/hack/goveralls.sh b/vendor/kubevirt.io/kubevirt/hack/goveralls.sh index 28af570c9..4b38c6e93 100755 --- a/vendor/kubevirt.io/kubevirt/hack/goveralls.sh +++ b/vendor/kubevirt.io/kubevirt/hack/goveralls.sh @@ -1,3 +1,5 @@ #!/bin/bash +set -e -goveralls -service=travis-ci -package=./pkg/... -ignore=$(find -regextype posix-egrep -regex ".*generated_mock.*\.go|.*swagger_generated\.go" -printf "%P\n" | paste -d, -s) -v +go test -cover -v -coverprofile=.coverprofile $(go list ./pkg/...) +goveralls -service=travis-ci -coverprofile=.coverprofile -ignore=$(find -regextype posix-egrep -regex ".*generated_mock.*\.go|.*swagger_generated\.go|.*openapi_generated\.go" -printf "%P\n" | paste -d, -s) diff --git a/vendor/kubevirt.io/kubevirt/hack/verify-build.sh b/vendor/kubevirt.io/kubevirt/hack/verify-build.sh new file mode 100755 index 000000000..17c586efe --- /dev/null +++ b/vendor/kubevirt.io/kubevirt/hack/verify-build.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +set -e + +function report_dirty_build() { + set +e + echo "Build is not clean:" + cluster/virtctl.sh version + git status + exit 1 +} + +# Check that "clean" is reported at least once +if [ -z "$(cluster/virtctl.sh version | grep clean)" ]; then + report_dirty_build +fi + +# Check that "dirty" is never reported +if [ -n "$(cluster/virtctl.sh version | grep dirty)" ]; then + report_dirty_build +fi diff --git a/vendor/kubevirt.io/kubevirt/hack/version.sh b/vendor/kubevirt.io/kubevirt/hack/version.sh new file mode 100755 index 000000000..c8cd0e6dc --- /dev/null +++ b/vendor/kubevirt.io/kubevirt/hack/version.sh @@ -0,0 +1,122 @@ +#!/bin/bash +# +# Copyright 2014 The Kubernetes Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# +# Used https://github.com/kubernetes/kubernetes/blob/master/hack/lib/version.sh as a template + +# ----------------------------------------------------------------------------- +# Version management helpers. These functions help to set, save and load the +# following variables: +# +# KUBEVIRT_GIT_COMMIT - The git commit id corresponding to this +# source code. +# KUBEVIRT_GIT_TREE_STATE - "clean" indicates no changes since the git commit id +# "dirty" indicates source code changes after the git commit id +# "archive" indicates the tree was produced by 'git archive' +# KUBEVIRT_GIT_VERSION - "vX.Y" used to indicate the last release version. +# KUBEVIRT_SOURCE_DATE_EPOCH - unix timestamp. Set to ' ' to generate using +# 'date' instead of 'git'. +# + +# Grovels through git to set a set of env variables. + +function kubevirt::version::get_version_vars() { + # If the kubernetes source was exported through git archive, then + # we likely don't have a git tree, but these magic values may be filled in. + if [[ '$Format:%%$' == "%" ]]; then + KUBE_GIT_COMMIT='$Format:%H$' + KUBE_GIT_TREE_STATE="archive" + # When a 'git archive' is exported, the '$Format:%D$' below will look + # something like 'HEAD -> release-1.8, tag: v1.8.3' where then 'tag: ' + # can be extracted from it. + if [[ '$Format:%D$' =~ tag:\ (v[^ ,]+) ]]; then + KUBE_GIT_VERSION="${BASH_REMATCH[1]}" + fi + fi + + local git=(git --work-tree "${KUBEVIRT_DIR}") + + if [[ -n ${KUBEVIRT_GIT_COMMIT-} ]] || KUBEVIRT_GIT_COMMIT=$("${git[@]}" rev-parse "HEAD^{commit}" 2>/dev/null); then + if [[ -z ${KUBEVIRT_GIT_TREE_STATE-} ]]; then + # Check if the tree is dirty. default to dirty + if git_status=$("${git[@]}" status --porcelain 2>/dev/null) && [[ -z ${git_status} ]]; then + KUBEVIRT_GIT_TREE_STATE="clean" + else + KUBEVIRT_GIT_TREE_STATE="dirty" + fi + fi + + # Use git describe to find the version based on tags. + if [[ -n ${KUBEVIRT_GIT_VERSION-} ]] || KUBEVIRT_GIT_VERSION=$("${git[@]}" describe --tags --abbrev=14 "${KUBEVIRT_GIT_COMMIT}^{commit}" 2>/dev/null); then + # This translates the "git describe" to an actual semver.org + # compatible semantic version that looks something like this: + # v1.1.0-alpha.0.6+84c76d1142ea4d + # + # TODO: We continue calling this "git version" because so many + # downstream consumers are expecting it there. + DASHES_IN_VERSION=$(echo "${KUBEVIRT_GIT_VERSION}" | sed "s/[^-]//g") + if [[ "${DASHES_IN_VERSION}" == "---" ]]; then + # We have distance to subversion (v1.1.0-subversion-1-gCommitHash) + KUBEVIRT_GIT_VERSION=$(echo "${KUBEVIRT_GIT_VERSION}" | sed "s/-\([0-9]\{1,\}\)-g\([0-9a-f]\{14\}\)$/.\1\+\2/") + elif [[ "${DASHES_IN_VERSION}" == "--" ]]; then + # We have distance to base tag (v1.1.0-1-gCommitHash) + KUBEVIRT_GIT_VERSION=$(echo "${KUBEVIRT_GIT_VERSION}" | sed "s/-g\([0-9a-f]\{14\}\)$/+\1/") + fi + if [[ "${KUBEVIRT_GIT_TREE_STATE}" == "dirty" ]]; then + # git describe --dirty only considers changes to existing files, but + # that is problematic since new untracked .go files affect the build, + # so use our idea of "dirty" from git status instead. + KUBEVIRT_GIT_VERSION+="-dirty" + fi + + # If KUBEVIRT_GIT_VERSION is not a valid Semantic Version, then refuse to build. + if ! [[ "${KUBEVIRT_GIT_VERSION}" =~ ^v([0-9]+)\.([0-9]+)(\.[0-9]+)?(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?$ ]]; then + echo "KUBEVIRT_GIT_VERSION should be a valid Semantic Version" + echo "Please see more details here: https://semver.org" + exit 1 + fi + fi + fi +} + +function kubevirt::version::ldflag() { + local key=${1} + local val=${2} + + echo "-X kubevirt.io/kubevirt/pkg/version.${key}=${val}" +} + +# Prints the value that needs to be passed to the -ldflags parameter of go build +function kubevirt::version::ldflags() { + kubevirt::version::get_version_vars + + SOURCE_DATE_EPOCH=${KUBEVIRT_SOURCE_DATE_EPOCH-$(git show -s --format=format:%ct HEAD)} + + local buildDate + [[ -z ${SOURCE_DATE_EPOCH-} ]] || buildDate="--date=@${SOURCE_DATE_EPOCH}" + local -a ldflags=($(kubevirt::version::ldflag "buildDate" "$(date ${buildDate} -u +'%Y-%m-%dT%H:%M:%SZ')")) + if [[ -n ${KUBEVIRT_GIT_COMMIT-} ]]; then + ldflags+=($(kubevirt::version::ldflag "gitCommit" "${KUBEVIRT_GIT_COMMIT}")) + ldflags+=($(kubevirt::version::ldflag "gitTreeState" "${KUBEVIRT_GIT_TREE_STATE}")) + fi + + if [[ -n ${KUBEVIRT_GIT_VERSION-} ]]; then + ldflags+=($(kubevirt::version::ldflag "gitVersion" "${KUBEVIRT_GIT_VERSION}")) + fi + + # The -ldflags parameter takes a single string, so join the output. + echo "${ldflags[*]-}" +} diff --git a/vendor/kubevirt.io/kubevirt/images/iscsi-demo-target-tgtd/Dockerfile b/vendor/kubevirt.io/kubevirt/images/disks-images-provider/Dockerfile similarity index 56% rename from vendor/kubevirt.io/kubevirt/images/iscsi-demo-target-tgtd/Dockerfile rename to vendor/kubevirt.io/kubevirt/images/disks-images-provider/Dockerfile index c5d299365..11f60dc62 100644 --- a/vendor/kubevirt.io/kubevirt/images/iscsi-demo-target-tgtd/Dockerfile +++ b/vendor/kubevirt.io/kubevirt/images/disks-images-provider/Dockerfile @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # -# Copyright 2017 Red Hat, Inc. +# Copyright 2018 Red Hat, Inc. # FROM fedora:27 @@ -21,20 +21,11 @@ FROM fedora:27 MAINTAINER "The KubeVirt Project" ENV container docker -RUN dnf -y install scsi-target-utils bzip2 e2fsprogs +# Prepare all images +RUN mkdir -p /images/custom /images/alpine \ + && truncate -s 64M /images/custom/disk.img \ + && curl http://dl-cdn.alpinelinux.org/alpine/v3.7/releases/x86_64/alpine-virt-3.7.0-x86_64.iso > /images/alpine/disk.img -RUN mkdir -p /images +ADD entrypoint.sh / -# Add alpine image -RUN curl http://dl-cdn.alpinelinux.org/alpine/v3.7/releases/x86_64/alpine-virt-3.7.0-x86_64.iso > /images/1-alpine.img - -# Cirros has been removed from the demo target for now. -# Uncomment this line if we need to add the cirros image back -# in for testing purposes. -# ADD https://download.cirros-cloud.net/0.4.0/cirros-0.4.0-x86_64-disk.img /images/2-cirros.img - -ADD run-tgt.sh / - -EXPOSE 3260 - -CMD ["/run-tgt.sh"] +CMD ["/entrypoint.sh"] diff --git a/vendor/kubevirt.io/kubevirt/cluster/vagrant-openshift/setup_node.sh b/vendor/kubevirt.io/kubevirt/images/disks-images-provider/entrypoint.sh old mode 100644 new mode 100755 similarity index 59% rename from vendor/kubevirt.io/kubevirt/cluster/vagrant-openshift/setup_node.sh rename to vendor/kubevirt.io/kubevirt/images/disks-images-provider/entrypoint.sh index fb26bf2cd..c6ae8c97f --- a/vendor/kubevirt.io/kubevirt/cluster/vagrant-openshift/setup_node.sh +++ b/vendor/kubevirt.io/kubevirt/images/disks-images-provider/entrypoint.sh @@ -1,4 +1,4 @@ -#/bin/bash -xe +#!/bin/bash # # This file is part of the KubeVirt project # @@ -14,16 +14,23 @@ # See the License for the specific language governing permissions and # limitations under the License. # -# Copyright 2017 Red Hat, Inc. +# Copyright 2018 Red Hat, Inc. # -master_ip=$1 -nodes=$2 +set -euo pipefail -bash /vagrant/cluster/vagrant-openshift/setup_common.sh $master_ip $nodes +# gracefully handle the TERM signal sent when deleting the daemonset +trap 'exit' TERM -# Set SELinux to permessive mode -setenforce 0 -sed -i "s/^SELINUX=.*/SELINUX=permissive/" /etc/selinux/config +echo "copy all images to host mount directory" +cp -R /images/* /hostImages/ -echo -e "\033[0;32m Deployment was successful!\033[0m" +# for some reason without sleep, container sometime fails to create the file +sleep 10 + +# let the monitoring script know we're done +echo "done" >/ready + +while true; do + sleep 60 +done diff --git a/vendor/kubevirt.io/kubevirt/images/iscsi-demo-target-tgtd/README.md b/vendor/kubevirt.io/kubevirt/images/iscsi-demo-target-tgtd/README.md deleted file mode 100644 index e91d213dc..000000000 --- a/vendor/kubevirt.io/kubevirt/images/iscsi-demo-target-tgtd/README.md +++ /dev/null @@ -1,117 +0,0 @@ -# Purpose - -This container can be used to expose an empty and two demo images -as LUNs of an iSCSI target. -The iSCSI target is provided by `tgtd` which is running in userspace -and is thus not relying on kernel features (like the LIO iSCSI target). - -Available LUNs: - -0. (An tgt dinternal LUN, can not be used) -1. Empty image - for your data -2. Alpine -3. CirrOS - - -# Build - -Easy: - -```bash -$ docker build -t kubevirt/iscsi-demo-target-tgtd . -``` - -The build will download (and build in) two OS images: - -- Alpine, because it's extensible -- CirrOS, because it's good for testing - - -# Usage - -Just run the container and a client: - -```bash -# Docker -$ docker run \ - -p 3260:3260 \ - -it iscsi-demo-target-tgtd - - -# To test: -# In another terminal -$ qemu-system-x86_64 \ - -snapshot \ - -drive file=iscsi://127.0.0.1/iqn.2017-01.io.kubevirt:sn.42/2 - -# Or just to discover -$ iscsiadm --mode discovery -t sendtargets --portal 127.0.0.1 -``` - -## Usage in Kubernetes - -Alongside the actual container, there is also a manifest to expose a ready to -- Create the iSCSI Demo target pod -- Expose the pod using a service -- Add named persistent volumes for each LUN -- Add persistent volume claims for each volume - -The target itself can be used by `qemu` (see example below), the claims -can also be directly used by Pods. - -Using the iSCSI target using `qemu`: - -```bash -# Build all manifests in the top-level directory -$ make manifests - -# Then create the pod, services, persistent volumes, and claims -$ kubectl create -f manifests/iscsi-demo-target.yaml -persistentvolumeclaim "disk-custom" created -persistentvolumeclaim "disk-alpine" created -persistentvolumeclaim "disk-cirros" created -persistentvolume "iscsi-disk-custom" created -persistentvolume "iscsi-disk-alpine" created -persistentvolume "iscsi-disk-cirros" created -service "iscsi-demo-target" created -pod "iscsi-demo-target-tgtd" created - -# Run a qemu instance to see if the target can be used -# Note: This is not testing the PV or PVC, just the service and target -# Use ctrl-a c quit to quit -$ kubectl run --rm -it qemu-test --image=kubevirt/libvirt -- \ - qemu-system-x86_64 \ - -snapshot \ - -drive file=iscsi://iscsi-demo-target/iqn.2017-01.io.kubevirt:sn.42/2 \ - -nographic -``` - - -## Exporting host paths as LUNs - -Sometimes OS images are large or block devices, such that you do not want -to make them part of the demo image. In that case you can set -the `EXPORT_HOST_PATHS` environment variable to directly reference a path -on the host. -For this to work you obviously also need to bind mount in the host root -(`/`) into the `/host` path inside the container. - -You can for example use `EXPORT_HOST_PATHS=/dev/sda /home/alice/beos.img` -to export `/dev/sda` and `/home/alice/beos.img` from the host. -Assuming that `/host` inside the container points to `/` on the host. - - -# Known issues - -## It's not production ready -The purpose of this image and pod is to support demo and testing use-cases. - -## Starts with LUN 1 -tgtd is used inside the image, this is delivering the first LUN as 1 (not 0). - -## Why tgtd and not targetcli/LIO? -LIO is a kernel based target, this would require privileged container. -tgt otoh is completely in user-space, and can thus be run as a regular container. - -## Some files seem to be corrupted when booting VMs off them -Just kill the pod and let the RC recreate it. This can be due to caching. diff --git a/vendor/kubevirt.io/kubevirt/images/iscsi-demo-target-tgtd/run-tgt.sh b/vendor/kubevirt.io/kubevirt/images/iscsi-demo-target-tgtd/run-tgt.sh deleted file mode 100755 index 6f919276e..000000000 --- a/vendor/kubevirt.io/kubevirt/images/iscsi-demo-target-tgtd/run-tgt.sh +++ /dev/null @@ -1,100 +0,0 @@ -#!/bin/bash -# -# This file is part of the KubeVirt project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Copyright 2017 Red Hat, Inc. -# - -# https://fedoraproject.org/wiki/Scsi-target-utils_Quickstart_Guide - -set -e - -SIZE=${SIZE:-1GB} -WWN=${WWN:-iqn.2017-01.io.kubevirt:sn.42} - -mkdir -p /volumes -mkdir -p /mnt/disk - -[[ -f /images/0-custom.img ]] || truncate -s ${SIZE} /images/0-custom.img - -echo "Starting tgtd" -tgtd -f & -sleep 5 - -# ensure tgtd is bound to port 3260 -lsof -Pan -p $(pgrep tgtd) -i | grep 3260 -q - -echo "Adding target and exposing it" -tgtadm --lld iscsi --mode target --op new --tid=1 --targetname $WWN -tgtadm --lld iscsi --mode target --op bind --tid=1 -I ALL - -if [ -n "$PASSWORD" ] && [ -n "$USERNAME" ]; then - tgtadm --lld iscsi --op new --mode account --user $USERNAME --password $PASSWORD - tgtadm --lld iscsi --op bind --mode account --tid=1 --user $USERNAME -fi - -LUNID=1 - -convert_to_filesystem() { - local FN=$1 - local DISK_NAME="/tmp/$(basename $FN)" - dd if=/dev/zero of=$DISK_NAME bs=1M count=1024 - mkfs.ext4 $DISK_NAME - sleep 10 - mount -o loop,rw,sync $DISK_NAME /mnt/disk - mv $FN /mnt/disk/disk.img - umount /mnt/disk - mv $DISK_NAME /volumes -} - -echo "Convert every file in /images to filesystem disk" -for F in $(ls -1 /images/* | sort); do - echo "- Convert file '$F'" - convert_to_filesystem $F -done - -add_lun_for_file() { - local FN=$1 - tgtadm --lld iscsi --mode logicalunit --op new --tid=1 --lun=$LUNID -b $FN - tgtadm --lld iscsi --mode logicalunit --op update --tid=1 --lun=$LUNID --params thin_provisioning=1 - LUNID=$(($LUNID + 1)) -} - -echo "Adding every file in /volume as a LUN" -for F in $(ls -1 /volumes/* | sort); do - echo "- Adding LUN ID $LUNID for file '$F'" - add_lun_for_file $F -done - -echo "Adding listed host paths ($EXPORT_HOST_PATHS)" -for P in $EXPORT_HOST_PATHS; do - F=/host/$P - echo "- Adding LUN ID $LUNID for file '$F'" - add_lun_for_file $F -done - -echo "Start monitoring" -touch /tmp/previous_state -while true; do - tgtadm --lld iscsi --mode target --op show >current_state - diff -q /tmp/previous_state current_state || ( - date - cat current_state - ) - mv -f current_state /tmp/previous_state - sleep 3 -done - -# vim: et ts=2: diff --git a/vendor/kubevirt.io/kubevirt/manifests/dev/offline-vm.yaml.in b/vendor/kubevirt.io/kubevirt/manifests/dev/offline-vm.yaml.in deleted file mode 100644 index 56d4b99bc..000000000 --- a/vendor/kubevirt.io/kubevirt/manifests/dev/offline-vm.yaml.in +++ /dev/null @@ -1 +0,0 @@ -{{index .GeneratedManifests "ovm-resource.yaml"}} diff --git a/vendor/kubevirt.io/kubevirt/manifests/dev/rbac.authorization.k8s.yaml.in b/vendor/kubevirt.io/kubevirt/manifests/dev/rbac.authorization.k8s.yaml.in index 110635c29..65dc24e77 100644 --- a/vendor/kubevirt.io/kubevirt/manifests/dev/rbac.authorization.k8s.yaml.in +++ b/vendor/kubevirt.io/kubevirt/manifests/dev/rbac.authorization.k8s.yaml.in @@ -70,14 +70,16 @@ rules: - get - list - delete - - update - - create + - update + - create - apiGroups: - '' resources: - configmaps verbs: - get + - list + - watch --- apiVersion: rbac.authorization.k8s.io/v1beta1 kind: ClusterRole @@ -119,7 +121,7 @@ rules: - apiGroups: - kubevirt.io resources: - - virtualmachines + - virtualmachineinstances verbs: - get - list @@ -141,13 +143,13 @@ rules: - list - watch - delete - - update - - create + - update + - create - apiGroups: - '' resources: - nodes - - persistentvolumeclaims + - persistentvolumeclaims verbs: - get - list @@ -155,15 +157,15 @@ rules: - apiGroups: - kubevirt.io resources: - - virtualmachines - - virtualmachinereplicasets + - virtualmachineinstances + - virtualmachineinstancereplicasets verbs: - get - list - watch - delete - - update - - create + - update + - create - deletecollection --- apiVersion: v1 @@ -229,3 +231,124 @@ subjects: - kind: ServiceAccount name: kubevirt-privileged namespace: {{.Namespace}} +--- +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: ClusterRole +metadata: + name: kubevirt.io:admin + labels: + kubevirt.io: "" + rbac.authorization.k8s.io/aggregate-to-admin: "true" +rules: + - apiGroups: + - subresources.kubevirt.io + resources: + - virtualmachineinstances/console + - virtualmachineinstances/vnc + verbs: + - get + - apiGroups: + - kubevirt.io + resources: + - virtualmachineinstances + - virtualmachines + - virtualmachineinstancepresets + - virtualmachineinstancereplicasets + verbs: + - get + - delete + - create + - update + - patch + - list + - watch + - deletecollection +--- +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: ClusterRole +metadata: + name: kubevirt.io:edit + labels: + kubevirt.io: "" + rbac.authorization.k8s.io/aggregate-to-edit: "true" +rules: + - apiGroups: + - subresources.kubevirt.io + resources: + - virtualmachineinstances/console + - virtualmachineinstances/vnc + verbs: + - get + - apiGroups: + - kubevirt.io + resources: + - virtualmachineinstances + - virtualmachines + - virtualmachineinstancepresets + - virtualmachineinstancereplicasets + verbs: + - get + - delete + - create + - update + - patch + - list + - watch +--- +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: ClusterRole +metadata: + name: kubevirt.io:view + labels: + kubevirt.io: "" + rbac.authorization.k8s.io/aggregate-to-view: "true" +rules: + - apiGroups: + - kubevirt.io + resources: + - virtualmachineinstances + - virtualmachines + - virtualmachineinstancepresets + - virtualmachineinstancereplicasets + verbs: + - get + - list + - watch +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + annotations: + rbac.authorization.kubernetes.io/autoupdate: "true" + labels: + kubevirt.io: "" + kubernetes.io/bootstrapping: rbac-defaults + name: kubevirt.io:default +rules: +- apiGroups: + - subresources.kubevirt.io + resources: + - version + verbs: + - get + - list +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + labels: + kubevirt.io: "" + annotations: + rbac.authorization.kubernetes.io/autoupdate: "true" + name: kubevirt.io:default +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: kubevirt.io:default +subjects: +- apiGroup: rbac.authorization.k8s.io + kind: Group + name: system:authenticated +- apiGroup: rbac.authorization.k8s.io + kind: Group + name: system:unauthenticated diff --git a/vendor/kubevirt.io/kubevirt/manifests/dev/replicase-resource.yaml.in b/vendor/kubevirt.io/kubevirt/manifests/dev/replicase-resource.yaml.in deleted file mode 100644 index 748e55d45..000000000 --- a/vendor/kubevirt.io/kubevirt/manifests/dev/replicase-resource.yaml.in +++ /dev/null @@ -1 +0,0 @@ -{{index .GeneratedManifests "vmrs-resource.yaml"}} diff --git a/vendor/kubevirt.io/kubevirt/manifests/dev/replicaset-resource.yaml.in b/vendor/kubevirt.io/kubevirt/manifests/dev/replicaset-resource.yaml.in new file mode 100644 index 000000000..6a52b65d0 --- /dev/null +++ b/vendor/kubevirt.io/kubevirt/manifests/dev/replicaset-resource.yaml.in @@ -0,0 +1 @@ +{{index .GeneratedManifests "vmirs-resource.yaml"}} diff --git a/vendor/kubevirt.io/kubevirt/manifests/dev/virt-api.yaml.in b/vendor/kubevirt.io/kubevirt/manifests/dev/virt-api.yaml.in index 49b015ca4..e66850f31 100644 --- a/vendor/kubevirt.io/kubevirt/manifests/dev/virt-api.yaml.in +++ b/vendor/kubevirt.io/kubevirt/manifests/dev/virt-api.yaml.in @@ -24,6 +24,15 @@ spec: replicas: 1 template: metadata: + annotations: + scheduler.alpha.kubernetes.io/critical-pod: "" + scheduler.alpha.kubernetes.io/tolerations: | + [ + { + "key": "CriticalAddonsOnly", + "operator": "Exists" + } + ] labels: kubevirt.io: virt-api spec: @@ -33,7 +42,7 @@ spec: image: {{.DockerPrefix}}/virt-api:{{.DockerTag}} imagePullPolicy: IfNotPresent command: - - "/virt-api" + - "virt-api" - "--port" - "8443" - "--subresources-only" diff --git a/vendor/kubevirt.io/kubevirt/manifests/dev/virt-controller.yaml.in b/vendor/kubevirt.io/kubevirt/manifests/dev/virt-controller.yaml.in index d47a68a2c..66ebd41e4 100644 --- a/vendor/kubevirt.io/kubevirt/manifests/dev/virt-controller.yaml.in +++ b/vendor/kubevirt.io/kubevirt/manifests/dev/virt-controller.yaml.in @@ -23,6 +23,15 @@ spec: replicas: 2 template: metadata: + annotations: + scheduler.alpha.kubernetes.io/critical-pod: "" + scheduler.alpha.kubernetes.io/tolerations: | + [ + { + "key": "CriticalAddonsOnly", + "operator": "Exists" + } + ] labels: kubevirt.io: virt-controller spec: @@ -32,7 +41,7 @@ spec: image: {{.DockerPrefix}}/virt-controller:{{.DockerTag}} imagePullPolicy: IfNotPresent command: - - "/virt-controller" + - "virt-controller" - "--launcher-image" - "{{.DockerPrefix}}/virt-launcher:{{.DockerTag}}" - "--port" diff --git a/vendor/kubevirt.io/kubevirt/manifests/dev/virt-handler.yaml.in b/vendor/kubevirt.io/kubevirt/manifests/dev/virt-handler.yaml.in index 10e20ec74..da37f7bc0 100644 --- a/vendor/kubevirt.io/kubevirt/manifests/dev/virt-handler.yaml.in +++ b/vendor/kubevirt.io/kubevirt/manifests/dev/virt-handler.yaml.in @@ -6,8 +6,19 @@ metadata: labels: kubevirt.io: "virt-handler" spec: + updateStrategy: + type: RollingUpdate template: metadata: + annotations: + scheduler.alpha.kubernetes.io/critical-pod: "" + scheduler.alpha.kubernetes.io/tolerations: | + [ + { + "key": "CriticalAddonsOnly", + "operator": "Exists" + } + ] name: virt-handler labels: kubevirt.io: virt-handler @@ -22,7 +33,7 @@ spec: image: {{.DockerPrefix}}/virt-handler:{{.DockerTag}} imagePullPolicy: IfNotPresent command: - - "/virt-handler" + - "virt-handler" - "-v" - "3" - "--hostname-override" @@ -36,6 +47,8 @@ spec: mountPath: /var/run/kubevirt - name: virt-private-dir mountPath: /var/run/kubevirt-private + - name: device-plugin + mountPath: /var/lib/kubelet/device-plugins env: - name: NODE_NAME valueFrom: @@ -51,3 +64,6 @@ spec: - name: virt-private-dir hostPath: path: /var/run/kubevirt-private + - name: device-plugin + hostPath: + path: /var/lib/kubelet/device-plugins diff --git a/vendor/kubevirt.io/kubevirt/manifests/dev/vmi-resource.yaml.in b/vendor/kubevirt.io/kubevirt/manifests/dev/vmi-resource.yaml.in new file mode 100644 index 000000000..a82d7e1f1 --- /dev/null +++ b/vendor/kubevirt.io/kubevirt/manifests/dev/vmi-resource.yaml.in @@ -0,0 +1 @@ +{{index .GeneratedManifests "vmi-resource.yaml"}} diff --git a/vendor/kubevirt.io/kubevirt/manifests/dev/vmipreset-resource.yaml.in b/vendor/kubevirt.io/kubevirt/manifests/dev/vmipreset-resource.yaml.in new file mode 100644 index 000000000..5af4f7b36 --- /dev/null +++ b/vendor/kubevirt.io/kubevirt/manifests/dev/vmipreset-resource.yaml.in @@ -0,0 +1 @@ +{{index .GeneratedManifests "vmipreset-resource.yaml"}} diff --git a/vendor/kubevirt.io/kubevirt/manifests/dev/vmpreset-resource.yaml.in b/vendor/kubevirt.io/kubevirt/manifests/dev/vmpreset-resource.yaml.in deleted file mode 100644 index f1bbd22c4..000000000 --- a/vendor/kubevirt.io/kubevirt/manifests/dev/vmpreset-resource.yaml.in +++ /dev/null @@ -1 +0,0 @@ -{{index .GeneratedManifests "vmpreset-resource.yaml"}} diff --git a/vendor/kubevirt.io/kubevirt/manifests/generated/ovm-resource.yaml b/vendor/kubevirt.io/kubevirt/manifests/generated/ovm-resource.yaml deleted file mode 100644 index a98b20f8c..000000000 --- a/vendor/kubevirt.io/kubevirt/manifests/generated/ovm-resource.yaml +++ /dev/null @@ -1,402 +0,0 @@ ---- -apiVersion: apiextensions.k8s.io/v1beta1 -kind: CustomResourceDefinition -metadata: - creationTimestamp: null - labels: - kubevirt.io: "" - name: offlinevirtualmachines.kubevirt.io -spec: - group: kubevirt.io - names: - kind: OfflineVirtualMachine - plural: offlinevirtualmachines - shortNames: - - ovm - - ovms - singular: offlinevirtualmachine - scope: Namespaced - validation: - openAPIV3Schema: - description: OfflineVirtualMachine handles the VirtualMachines that are not - running or are in a stopped state The OfflineVirtualMachine contains the template - to create the VirtualMachine. It also mirrors the running state of the created - VirtualMachine in its 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' - type: string - kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds' - type: string - metadata: {} - spec: - description: OfflineVirtualMachineSpec describes how the proper OfflineVirtualMachine - should look like - properties: - running: - description: Running controlls whether the associatied VirtualMachine - is created or not - type: boolean - template: - properties: - metadata: {} - spec: - description: VirtualMachineSpec is a description of a VirtualMachine. - properties: - affinity: - description: Affinity groups all the affinity rules related - to a VM - properties: - nodeAffinity: {} - domain: - properties: - clock: - description: Represents the clock and timers of a vm - properties: - timezone: - description: Timezone sets the guest clock to the specified - timezone. Zone name follows the TZ environment variable - format (e.g. 'America/New_York') - type: string - utc: - description: UTC sets the guest clock to UTC on each - boot. - properties: - offsetSeconds: - description: OffsetSeconds specifies an offset in - seconds, relative to UTC. If set, guest changes - to the clock will be kept during reboots and not - reset. - format: int32 - type: integer - cpu: - description: CPU allow specifying the CPU topology - properties: - cores: - description: Cores specifies the number of cores inside - the vm. Must be a value greater or equal 1. - format: int64 - type: integer - devices: - properties: - disks: - description: Disks describes disks, cdroms, floppy and - luns which are connected to the vm - items: - properties: - cdrom: - properties: - bus: - description: 'Bus indicates the type of disk - device to emulate. supported values: virtio, - sata, scsi, ide' - type: string - readonly: - description: ReadOnly Defaults to true - type: boolean - tray: - description: Tray indicates if the tray of - the device is open or closed. Allowed values - are "open" and "closed" Defaults to closed - type: string - disk: - properties: - bus: - description: 'Bus indicates the type of disk - device to emulate. supported values: virtio, - sata, scsi, ide' - type: string - readonly: - description: ReadOnly Defaults to false - type: boolean - floppy: - properties: - readonly: - description: ReadOnly Defaults to false - type: boolean - tray: - description: Tray indicates if the tray of - the device is open or closed. Allowed values - are "open" and "closed" Defaults to closed - type: string - lun: - properties: - bus: - description: 'Bus indicates the type of disk - device to emulate. supported values: virtio, - sata, scsi, ide' - type: string - readonly: - description: ReadOnly Defaults to false - type: boolean - name: - description: Name is the device name - type: string - volumeName: - description: Name of the volume which is referenced - Must match the Name of a Volume. - type: string - required: - - name - - volumeName - type: array - watchdog: - description: Named watchdog device - properties: - i6300esb: - description: i6300esb watchdog device - properties: - action: - description: The action to take. Valid values - are poweroff, reset, shutdown. Defaults to - reset - type: string - name: - description: Name of the watchdog - type: string - required: - - name - features: - properties: - acpi: - description: Represents if a feature is enabled or disabled - properties: - enabled: - description: Enabled determines if the feature should - be enabled or disabled on the guest Defaults to - true - type: boolean - apic: - properties: - enabled: - description: Enabled determines if the feature should - be enabled or disabled on the guest Defaults to - true - type: boolean - endOfInterrupt: - description: EndOfInterrupt enables the end of interrupt - notification in the guest Defaults to false - type: boolean - hyperv: - description: Hyperv specific features - properties: - relaxed: - description: Represents if a feature is enabled - or disabled - properties: - enabled: - description: Enabled determines if the feature - should be enabled or disabled on the guest - Defaults to true - type: boolean - reset: - description: Represents if a feature is enabled - or disabled - properties: - enabled: - description: Enabled determines if the feature - should be enabled or disabled on the guest - Defaults to true - type: boolean - runtime: - description: Represents if a feature is enabled - or disabled - properties: - enabled: - description: Enabled determines if the feature - should be enabled or disabled on the guest - Defaults to true - type: boolean - spinlocks: - properties: - enabled: - description: Enabled determines if the feature - should be enabled or disabled on the guest - Defaults to true - type: boolean - spinlocks: - description: Retries indicates the number of - retries Must be a value greater or equal 4096 - Defaults to 4096 - format: int64 - type: integer - synic: - description: Represents if a feature is enabled - or disabled - properties: - enabled: - description: Enabled determines if the feature - should be enabled or disabled on the guest - Defaults to true - type: boolean - synictimer: - description: Represents if a feature is enabled - or disabled - properties: - enabled: - description: Enabled determines if the feature - should be enabled or disabled on the guest - Defaults to true - type: boolean - vapic: - description: Represents if a feature is enabled - or disabled - properties: - enabled: - description: Enabled determines if the feature - should be enabled or disabled on the guest - Defaults to true - type: boolean - vendorid: - properties: - enabled: - description: Enabled determines if the feature - should be enabled or disabled on the guest - Defaults to true - type: boolean - vendorid: - description: VendorID sets the hypervisor vendor - id, visible to the vm String up to twelve - characters - type: string - vpindex: - description: Represents if a feature is enabled - or disabled - properties: - enabled: - description: Enabled determines if the feature - should be enabled or disabled on the guest - Defaults to true - type: boolean - firmware: - properties: - uuid: - description: UUID reported by the vm bios Defaults to - a random generated uid - type: string - machine: - properties: - type: - description: QEMU machine type is the actual chipset - of the VM. - type: string - required: - - type - resources: - properties: - limits: - description: Limits describes the maximum amount of - compute resources allowed. Valid resource keys are - "memory" and "cpu". - type: object - requests: - description: Requests is a description of the initial - vm resources. Valid resource keys are "memory" and - "cpu". - type: object - required: - - devices - nodeSelector: - description: 'NodeSelector is a selector which must be true - for the vm to fit on a node. Selector which must match a node''s - labels for the vm to be scheduled on that node. More info: - https://kubernetes.io/docs/concepts/configuration/assign-pod-node/' - type: object - terminationGracePeriodSeconds: - description: Grace period observed after signalling a VM to - stop after which the VM is force terminated. - format: int64 - type: integer - volumes: - description: List of volumes that can be mounted by disks belonging - to the vm. - items: - description: Volume represents a named volume in a vm. - properties: - cloudInitNoCloud: - description: 'Represents a cloud-init nocloud user data - source More info: http://cloudinit.readthedocs.io/en/latest/topics/datasources/nocloud.html' - properties: - secretRef: {} - userData: - description: UserData contains NoCloud inline cloud-init - userdata - type: string - userDataBase64: - description: UserDataBase64 contains NoCloud cloud-init - userdata as a base64 encoded string - type: string - emptyDisk: - description: EmptyDisk represents a temporary disk which - shares the vms lifecycle - properties: - capacity: {} - required: - - capacity - ephemeral: - properties: - persistentVolumeClaim: {} - name: - description: 'Volume''s name. Must be a DNS_LABEL and - unique within the vm. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' - type: string - persistentVolumeClaim: {} - registryDisk: - description: Represents a docker image with an embedded - disk - properties: - image: - description: Image is the name of the image with the - embedded disk - type: string - imagePullSecret: - description: ImagePullSecret is the name of the Docker - registry secret required to pull the image. The - secret must already exist. - type: string - required: - - image - required: - - name - type: array - required: - - domain - required: - - running - - template - status: - description: OfflineVirtualMachineStatus represents the status returned - by the controller to describe how the OfflineVirtualMachine is doing - properties: - conditions: - description: Hold the state information of the OfflineVirtualMachine - and its VirtualMachine - items: - description: OfflineVirtualMachineCondition represents the state of - OfflineVirtualMachine - properties: - lastProbeTime: {} - lastTransitionTime: {} - message: - type: string - reason: - type: string - status: - type: string - type: - type: string - required: - - type - - status - type: array - version: v1alpha1 -status: - acceptedNames: - kind: "" - plural: "" - conditions: null diff --git a/vendor/kubevirt.io/kubevirt/manifests/generated/vm-resource.yaml b/vendor/kubevirt.io/kubevirt/manifests/generated/vm-resource.yaml index fb29a9a16..243b9e8a3 100644 --- a/vendor/kubevirt.io/kubevirt/manifests/generated/vm-resource.yaml +++ b/vendor/kubevirt.io/kubevirt/manifests/generated/vm-resource.yaml @@ -18,319 +18,265 @@ spec: scope: Namespaced validation: openAPIV3Schema: - description: VirtualMachine is *the* VM Definition. It represents a virtual - machine in the runtime environment of kubernetes. 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' type: string kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds' type: string metadata: {} spec: - description: VirtualMachineSpec is a description of a VirtualMachine. properties: - affinity: - description: Affinity groups all the affinity rules related to a VM + running: + type: boolean + template: properties: - nodeAffinity: {} - domain: - properties: - clock: - description: Represents the clock and timers of a vm + metadata: {} + spec: properties: - timezone: - description: Timezone sets the guest clock to the specified - timezone. Zone name follows the TZ environment variable format - (e.g. 'America/New_York') - type: string - utc: - description: UTC sets the guest clock to UTC on each boot. + affinity: properties: - offsetSeconds: - description: OffsetSeconds specifies an offset in seconds, - relative to UTC. If set, guest changes to the clock will - be kept during reboots and not reset. - format: int32 - type: integer - cpu: - description: CPU allow specifying the CPU topology - properties: - cores: - description: Cores specifies the number of cores inside the - vm. Must be a value greater or equal 1. - format: int64 - type: integer - devices: - properties: - disks: - description: Disks describes disks, cdroms, floppy and luns - which are connected to the vm - items: - properties: - cdrom: - properties: - bus: - description: 'Bus indicates the type of disk device - to emulate. supported values: virtio, sata, scsi, - ide' - type: string - readonly: - description: ReadOnly Defaults to true - type: boolean - tray: - description: Tray indicates if the tray of the device - is open or closed. Allowed values are "open" and - "closed" Defaults to closed - type: string - disk: - properties: - bus: - description: 'Bus indicates the type of disk device - to emulate. supported values: virtio, sata, scsi, - ide' - type: string - readonly: - description: ReadOnly Defaults to false - type: boolean - floppy: - properties: - readonly: - description: ReadOnly Defaults to false - type: boolean - tray: - description: Tray indicates if the tray of the device - is open or closed. Allowed values are "open" and - "closed" Defaults to closed - type: string - lun: - properties: - bus: - description: 'Bus indicates the type of disk device - to emulate. supported values: virtio, sata, scsi, - ide' - type: string - readonly: - description: ReadOnly Defaults to false - type: boolean - name: - description: Name is the device name - type: string - volumeName: - description: Name of the volume which is referenced Must - match the Name of a Volume. - type: string - required: - - name - - volumeName - type: array - watchdog: - description: Named watchdog device + nodeAffinity: {} + podAffinity: {} + podAntiAffinity: {} + domain: properties: - i6300esb: - description: i6300esb watchdog device + clock: properties: - action: - description: The action to take. Valid values are poweroff, - reset, shutdown. Defaults to reset + timezone: type: string - name: - description: Name of the watchdog - type: string - required: - - name - features: - properties: - acpi: - description: Represents if a feature is enabled or disabled - properties: - enabled: - description: Enabled determines if the feature should be - enabled or disabled on the guest Defaults to true - type: boolean - apic: - properties: - enabled: - description: Enabled determines if the feature should be - enabled or disabled on the guest Defaults to true - type: boolean - endOfInterrupt: - description: EndOfInterrupt enables the end of interrupt - notification in the guest Defaults to false - type: boolean - hyperv: - description: Hyperv specific features - properties: - relaxed: - description: Represents if a feature is enabled or disabled - properties: - enabled: - description: Enabled determines if the feature should - be enabled or disabled on the guest Defaults to true - type: boolean - reset: - description: Represents if a feature is enabled or disabled - properties: - enabled: - description: Enabled determines if the feature should - be enabled or disabled on the guest Defaults to true - type: boolean - runtime: - description: Represents if a feature is enabled or disabled + utc: + properties: + offsetSeconds: + format: int32 + type: integer + cpu: properties: - enabled: - description: Enabled determines if the feature should - be enabled or disabled on the guest Defaults to true - type: boolean - spinlocks: - properties: - enabled: - description: Enabled determines if the feature should - be enabled or disabled on the guest Defaults to true - type: boolean - spinlocks: - description: Retries indicates the number of retries - Must be a value greater or equal 4096 Defaults to - 4096 + cores: format: int64 type: integer - synic: - description: Represents if a feature is enabled or disabled + model: + type: string + devices: properties: - enabled: - description: Enabled determines if the feature should - be enabled or disabled on the guest Defaults to true - type: boolean - synictimer: - description: Represents if a feature is enabled or disabled + disks: + items: + properties: + bootOrder: + format: int32 + type: integer + cdrom: + properties: + bus: + type: string + readonly: + type: boolean + tray: + type: string + disk: + properties: + bus: + type: string + readonly: + type: boolean + floppy: + properties: + readonly: + type: boolean + tray: + type: string + lun: + properties: + bus: + type: string + readonly: + type: boolean + name: + type: string + serial: + type: string + volumeName: + type: string + required: + - name + - volumeName + type: array + interfaces: + items: + properties: + bridge: {} + macAddress: + type: string + model: + type: string + name: + type: string + ports: + items: + properties: + name: + type: string + port: + format: int32 + type: integer + protocol: + type: string + required: + - port + type: array + slirp: {} + required: + - name + type: array + watchdog: + properties: + i6300esb: + properties: + action: + type: string + name: + type: string + required: + - name + features: properties: - enabled: - description: Enabled determines if the feature should - be enabled or disabled on the guest Defaults to true - type: boolean - vapic: - description: Represents if a feature is enabled or disabled + acpi: + properties: + enabled: + type: boolean + apic: + properties: + enabled: + type: boolean + endOfInterrupt: + type: boolean + hyperv: + properties: + relaxed: + properties: + enabled: + type: boolean + reset: + properties: + enabled: + type: boolean + runtime: + properties: + enabled: + type: boolean + spinlocks: + properties: + enabled: + type: boolean + spinlocks: + format: int64 + type: integer + synic: + properties: + enabled: + type: boolean + synictimer: + properties: + enabled: + type: boolean + vapic: + properties: + enabled: + type: boolean + vendorid: + properties: + enabled: + type: boolean + vendorid: + type: string + vpindex: + properties: + enabled: + type: boolean + firmware: properties: - enabled: - description: Enabled determines if the feature should - be enabled or disabled on the guest Defaults to true - type: boolean - vendorid: + uuid: + type: string + machine: properties: - enabled: - description: Enabled determines if the feature should - be enabled or disabled on the guest Defaults to true - type: boolean - vendorid: - description: VendorID sets the hypervisor vendor id, - visible to the vm String up to twelve characters + type: type: string - vpindex: - description: Represents if a feature is enabled or disabled + required: + - type + memory: properties: - enabled: - description: Enabled determines if the feature should - be enabled or disabled on the guest Defaults to true - type: boolean - firmware: - properties: - uuid: - description: UUID reported by the vm bios Defaults to a random - generated uid + hugepages: + properties: + pageSize: + type: string + resources: + properties: + limits: + type: object + requests: + type: object + required: + - devices + hostname: type: string - machine: - properties: - type: - description: QEMU machine type is the actual chipset of the - VM. + networks: + items: + properties: + name: + type: string + pod: + properties: + vmNetworkCIDR: + type: string + required: + - name + type: array + nodeSelector: + type: object + subdomain: type: string + terminationGracePeriodSeconds: + format: int64 + type: integer + volumes: + items: + properties: + cloudInitNoCloud: + properties: + secretRef: {} + userData: + type: string + userDataBase64: + type: string + emptyDisk: + properties: + capacity: {} + required: + - capacity + ephemeral: + properties: + persistentVolumeClaim: {} + name: + type: string + persistentVolumeClaim: {} + registryDisk: + properties: + image: + type: string + imagePullSecret: + type: string + required: + - image + required: + - name + type: array required: - - type - resources: - properties: - limits: - description: Limits describes the maximum amount of compute - resources allowed. Valid resource keys are "memory" and "cpu". - type: object - requests: - description: Requests is a description of the initial vm resources. - Valid resource keys are "memory" and "cpu". - type: object - required: - - devices - nodeSelector: - description: 'NodeSelector is a selector which must be true for the - vm to fit on a node. Selector which must match a node''s labels for - the vm to be scheduled on that node. More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/' - type: object - terminationGracePeriodSeconds: - description: Grace period observed after signalling a VM to stop after - which the VM is force terminated. - format: int64 - type: integer - volumes: - description: List of volumes that can be mounted by disks belonging - to the vm. - items: - description: Volume represents a named volume in a vm. - properties: - cloudInitNoCloud: - description: 'Represents a cloud-init nocloud user data source - More info: http://cloudinit.readthedocs.io/en/latest/topics/datasources/nocloud.html' - properties: - secretRef: {} - userData: - description: UserData contains NoCloud inline cloud-init userdata - type: string - userDataBase64: - description: UserDataBase64 contains NoCloud cloud-init userdata - as a base64 encoded string - type: string - emptyDisk: - description: EmptyDisk represents a temporary disk which shares - the vms lifecycle - properties: - capacity: {} - required: - - capacity - ephemeral: - properties: - persistentVolumeClaim: {} - name: - description: 'Volume''s name. Must be a DNS_LABEL and unique within - the vm. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' - type: string - persistentVolumeClaim: {} - registryDisk: - description: Represents a docker image with an embedded disk - properties: - image: - description: Image is the name of the image with the embedded - disk - type: string - imagePullSecret: - description: ImagePullSecret is the name of the Docker registry - secret required to pull the image. The secret must already - exist. - type: string - required: - - image - required: - - name - type: array + - domain required: - - domain + - running + - template status: - description: VirtualMachineStatus represents information about the status - of a VM. Status may trail the actual state of a system. properties: conditions: - description: Conditions are specific points in VM's pod runtime. items: properties: lastProbeTime: {} @@ -347,25 +293,11 @@ spec: - type - status type: array - interfaces: - description: Interfaces represent the details of available network interfaces. - items: - properties: - ipAddress: - description: IP address of a Virtual Machine interface - type: string - mac: - description: Hardware address of a Virtual Machine interface - type: string - type: array - nodeName: - description: NodeName is the name where the VM is currently running. - type: string - phase: - description: Phase is the status of the VM in kubernetes world. It is - not the VM status, but partially correlates to it. - type: string - version: v1alpha1 + created: + type: boolean + ready: + type: boolean + version: v1alpha2 status: acceptedNames: kind: "" diff --git a/vendor/kubevirt.io/kubevirt/manifests/generated/vmi-resource.yaml b/vendor/kubevirt.io/kubevirt/manifests/generated/vmi-resource.yaml new file mode 100644 index 000000000..d528874fe --- /dev/null +++ b/vendor/kubevirt.io/kubevirt/manifests/generated/vmi-resource.yaml @@ -0,0 +1,303 @@ +--- +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + creationTimestamp: null + labels: + kubevirt.io: "" + name: virtualmachineinstances.kubevirt.io +spec: + group: kubevirt.io + names: + kind: VirtualMachineInstance + plural: virtualmachineinstances + shortNames: + - vmi + - vmis + singular: virtualmachineinstance + scope: Namespaced + validation: + openAPIV3Schema: + properties: + apiVersion: + type: string + kind: + type: string + metadata: {} + spec: + properties: + affinity: + properties: + nodeAffinity: {} + podAffinity: {} + podAntiAffinity: {} + domain: + properties: + clock: + properties: + timezone: + type: string + utc: + properties: + offsetSeconds: + format: int32 + type: integer + cpu: + properties: + cores: + format: int64 + type: integer + model: + type: string + devices: + properties: + disks: + items: + properties: + bootOrder: + format: int32 + type: integer + cdrom: + properties: + bus: + type: string + readonly: + type: boolean + tray: + type: string + disk: + properties: + bus: + type: string + readonly: + type: boolean + floppy: + properties: + readonly: + type: boolean + tray: + type: string + lun: + properties: + bus: + type: string + readonly: + type: boolean + name: + type: string + serial: + type: string + volumeName: + type: string + required: + - name + - volumeName + type: array + interfaces: + items: + properties: + bridge: {} + macAddress: + type: string + model: + type: string + name: + type: string + ports: + items: + properties: + name: + type: string + port: + format: int32 + type: integer + protocol: + type: string + required: + - port + type: array + slirp: {} + required: + - name + type: array + watchdog: + properties: + i6300esb: + properties: + action: + type: string + name: + type: string + required: + - name + features: + properties: + acpi: + properties: + enabled: + type: boolean + apic: + properties: + enabled: + type: boolean + endOfInterrupt: + type: boolean + hyperv: + properties: + relaxed: + properties: + enabled: + type: boolean + reset: + properties: + enabled: + type: boolean + runtime: + properties: + enabled: + type: boolean + spinlocks: + properties: + enabled: + type: boolean + spinlocks: + format: int64 + type: integer + synic: + properties: + enabled: + type: boolean + synictimer: + properties: + enabled: + type: boolean + vapic: + properties: + enabled: + type: boolean + vendorid: + properties: + enabled: + type: boolean + vendorid: + type: string + vpindex: + properties: + enabled: + type: boolean + firmware: + properties: + uuid: + type: string + machine: + properties: + type: + type: string + required: + - type + memory: + properties: + hugepages: + properties: + pageSize: + type: string + resources: + properties: + limits: + type: object + requests: + type: object + required: + - devices + hostname: + type: string + networks: + items: + properties: + name: + type: string + pod: + properties: + vmNetworkCIDR: + type: string + required: + - name + type: array + nodeSelector: + type: object + subdomain: + type: string + terminationGracePeriodSeconds: + format: int64 + type: integer + volumes: + items: + properties: + cloudInitNoCloud: + properties: + secretRef: {} + userData: + type: string + userDataBase64: + type: string + emptyDisk: + properties: + capacity: {} + required: + - capacity + ephemeral: + properties: + persistentVolumeClaim: {} + name: + type: string + persistentVolumeClaim: {} + registryDisk: + properties: + image: + type: string + imagePullSecret: + type: string + required: + - image + required: + - name + type: array + required: + - domain + status: + properties: + conditions: + items: + properties: + lastProbeTime: {} + lastTransitionTime: {} + message: + type: string + reason: + type: string + status: + type: string + type: + type: string + required: + - type + - status + type: array + interfaces: + items: + properties: + ipAddress: + type: string + mac: + type: string + type: array + nodeName: + type: string + phase: + type: string + version: v1alpha2 +status: + acceptedNames: + kind: "" + plural: "" + conditions: null diff --git a/vendor/kubevirt.io/kubevirt/manifests/generated/vmipreset-resource.yaml b/vendor/kubevirt.io/kubevirt/manifests/generated/vmipreset-resource.yaml new file mode 100644 index 000000000..0e2c6d6e0 --- /dev/null +++ b/vendor/kubevirt.io/kubevirt/manifests/generated/vmipreset-resource.yaml @@ -0,0 +1,213 @@ +--- +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + creationTimestamp: null + labels: + kubevirt.io: "" + name: virtualmachineinstancepresets.kubevirt.io +spec: + group: kubevirt.io + names: + kind: VirtualMachineInstancePreset + plural: virtualmachineinstancepresets + shortNames: + - vmipreset + - vmipresets + singular: virtualmachineinstancepreset + scope: Namespaced + validation: + openAPIV3Schema: + properties: + apiVersion: + type: string + kind: + type: string + metadata: {} + spec: + properties: + domain: + properties: + clock: + properties: + timezone: + type: string + utc: + properties: + offsetSeconds: + format: int32 + type: integer + cpu: + properties: + cores: + format: int64 + type: integer + model: + type: string + devices: + properties: + disks: + items: + properties: + bootOrder: + format: int32 + type: integer + cdrom: + properties: + bus: + type: string + readonly: + type: boolean + tray: + type: string + disk: + properties: + bus: + type: string + readonly: + type: boolean + floppy: + properties: + readonly: + type: boolean + tray: + type: string + lun: + properties: + bus: + type: string + readonly: + type: boolean + name: + type: string + serial: + type: string + volumeName: + type: string + required: + - name + - volumeName + type: array + interfaces: + items: + properties: + bridge: {} + macAddress: + type: string + model: + type: string + name: + type: string + ports: + items: + properties: + name: + type: string + port: + format: int32 + type: integer + protocol: + type: string + required: + - port + type: array + slirp: {} + required: + - name + type: array + watchdog: + properties: + i6300esb: + properties: + action: + type: string + name: + type: string + required: + - name + features: + properties: + acpi: + properties: + enabled: + type: boolean + apic: + properties: + enabled: + type: boolean + endOfInterrupt: + type: boolean + hyperv: + properties: + relaxed: + properties: + enabled: + type: boolean + reset: + properties: + enabled: + type: boolean + runtime: + properties: + enabled: + type: boolean + spinlocks: + properties: + enabled: + type: boolean + spinlocks: + format: int64 + type: integer + synic: + properties: + enabled: + type: boolean + synictimer: + properties: + enabled: + type: boolean + vapic: + properties: + enabled: + type: boolean + vendorid: + properties: + enabled: + type: boolean + vendorid: + type: string + vpindex: + properties: + enabled: + type: boolean + firmware: + properties: + uuid: + type: string + machine: + properties: + type: + type: string + required: + - type + memory: + properties: + hugepages: + properties: + pageSize: + type: string + resources: + properties: + limits: + type: object + requests: + type: object + selector: {} + required: + - selector + version: v1alpha2 +status: + acceptedNames: + kind: "" + plural: "" + conditions: null diff --git a/vendor/kubevirt.io/kubevirt/manifests/generated/vmirs-resource.yaml b/vendor/kubevirt.io/kubevirt/manifests/generated/vmirs-resource.yaml new file mode 100644 index 000000000..1de87d067 --- /dev/null +++ b/vendor/kubevirt.io/kubevirt/manifests/generated/vmirs-resource.yaml @@ -0,0 +1,311 @@ +--- +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + creationTimestamp: null + labels: + kubevirt.io: "" + name: virtualmachineinstancereplicasets.kubevirt.io +spec: + group: kubevirt.io + names: + kind: VirtualMachineInstanceReplicaSet + plural: virtualmachineinstancereplicasets + shortNames: + - vmirs + - vmirss + singular: virtualmachineinstancereplicaset + scope: Namespaced + validation: + openAPIV3Schema: + properties: + apiVersion: + type: string + kind: + type: string + metadata: {} + spec: + properties: + paused: + type: boolean + replicas: + format: int32 + type: integer + selector: {} + template: + properties: + metadata: {} + spec: + properties: + affinity: + properties: + nodeAffinity: {} + podAffinity: {} + podAntiAffinity: {} + domain: + properties: + clock: + properties: + timezone: + type: string + utc: + properties: + offsetSeconds: + format: int32 + type: integer + cpu: + properties: + cores: + format: int64 + type: integer + model: + type: string + devices: + properties: + disks: + items: + properties: + bootOrder: + format: int32 + type: integer + cdrom: + properties: + bus: + type: string + readonly: + type: boolean + tray: + type: string + disk: + properties: + bus: + type: string + readonly: + type: boolean + floppy: + properties: + readonly: + type: boolean + tray: + type: string + lun: + properties: + bus: + type: string + readonly: + type: boolean + name: + type: string + serial: + type: string + volumeName: + type: string + required: + - name + - volumeName + type: array + interfaces: + items: + properties: + bridge: {} + macAddress: + type: string + model: + type: string + name: + type: string + ports: + items: + properties: + name: + type: string + port: + format: int32 + type: integer + protocol: + type: string + required: + - port + type: array + slirp: {} + required: + - name + type: array + watchdog: + properties: + i6300esb: + properties: + action: + type: string + name: + type: string + required: + - name + features: + properties: + acpi: + properties: + enabled: + type: boolean + apic: + properties: + enabled: + type: boolean + endOfInterrupt: + type: boolean + hyperv: + properties: + relaxed: + properties: + enabled: + type: boolean + reset: + properties: + enabled: + type: boolean + runtime: + properties: + enabled: + type: boolean + spinlocks: + properties: + enabled: + type: boolean + spinlocks: + format: int64 + type: integer + synic: + properties: + enabled: + type: boolean + synictimer: + properties: + enabled: + type: boolean + vapic: + properties: + enabled: + type: boolean + vendorid: + properties: + enabled: + type: boolean + vendorid: + type: string + vpindex: + properties: + enabled: + type: boolean + firmware: + properties: + uuid: + type: string + machine: + properties: + type: + type: string + required: + - type + memory: + properties: + hugepages: + properties: + pageSize: + type: string + resources: + properties: + limits: + type: object + requests: + type: object + required: + - devices + hostname: + type: string + networks: + items: + properties: + name: + type: string + pod: + properties: + vmNetworkCIDR: + type: string + required: + - name + type: array + nodeSelector: + type: object + subdomain: + type: string + terminationGracePeriodSeconds: + format: int64 + type: integer + volumes: + items: + properties: + cloudInitNoCloud: + properties: + secretRef: {} + userData: + type: string + userDataBase64: + type: string + emptyDisk: + properties: + capacity: {} + required: + - capacity + ephemeral: + properties: + persistentVolumeClaim: {} + name: + type: string + persistentVolumeClaim: {} + registryDisk: + properties: + image: + type: string + imagePullSecret: + type: string + required: + - image + required: + - name + type: array + required: + - domain + required: + - selector + - template + status: + properties: + conditions: + items: + properties: + lastProbeTime: {} + lastTransitionTime: {} + message: + type: string + reason: + type: string + status: + type: string + type: + type: string + required: + - type + - status + type: array + readyReplicas: + format: int32 + type: integer + replicas: + format: int32 + type: integer + version: v1alpha2 +status: + acceptedNames: + kind: "" + plural: "" + conditions: null diff --git a/vendor/kubevirt.io/kubevirt/manifests/generated/vmpreset-resource.yaml b/vendor/kubevirt.io/kubevirt/manifests/generated/vmpreset-resource.yaml deleted file mode 100644 index 005fe1c94..000000000 --- a/vendor/kubevirt.io/kubevirt/manifests/generated/vmpreset-resource.yaml +++ /dev/null @@ -1,267 +0,0 @@ ---- -apiVersion: apiextensions.k8s.io/v1beta1 -kind: CustomResourceDefinition -metadata: - creationTimestamp: null - labels: - kubevirt.io: "" - name: virtualmachinepresets.kubevirt.io -spec: - group: kubevirt.io - names: - kind: VirtualMachinePreset - plural: virtualmachinepresets - shortNames: - - vmpreset - - vmpresets - singular: virtualmachinepreset - scope: Namespaced - validation: - openAPIV3Schema: - 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' - type: string - kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds' - type: string - metadata: {} - spec: - properties: - domain: - properties: - clock: - description: Represents the clock and timers of a vm - properties: - timezone: - description: Timezone sets the guest clock to the specified - timezone. Zone name follows the TZ environment variable format - (e.g. 'America/New_York') - type: string - utc: - description: UTC sets the guest clock to UTC on each boot. - properties: - offsetSeconds: - description: OffsetSeconds specifies an offset in seconds, - relative to UTC. If set, guest changes to the clock will - be kept during reboots and not reset. - format: int32 - type: integer - cpu: - description: CPU allow specifying the CPU topology - properties: - cores: - description: Cores specifies the number of cores inside the - vm. Must be a value greater or equal 1. - format: int64 - type: integer - devices: - properties: - disks: - description: Disks describes disks, cdroms, floppy and luns - which are connected to the vm - items: - properties: - cdrom: - properties: - bus: - description: 'Bus indicates the type of disk device - to emulate. supported values: virtio, sata, scsi, - ide' - type: string - readonly: - description: ReadOnly Defaults to true - type: boolean - tray: - description: Tray indicates if the tray of the device - is open or closed. Allowed values are "open" and - "closed" Defaults to closed - type: string - disk: - properties: - bus: - description: 'Bus indicates the type of disk device - to emulate. supported values: virtio, sata, scsi, - ide' - type: string - readonly: - description: ReadOnly Defaults to false - type: boolean - floppy: - properties: - readonly: - description: ReadOnly Defaults to false - type: boolean - tray: - description: Tray indicates if the tray of the device - is open or closed. Allowed values are "open" and - "closed" Defaults to closed - type: string - lun: - properties: - bus: - description: 'Bus indicates the type of disk device - to emulate. supported values: virtio, sata, scsi, - ide' - type: string - readonly: - description: ReadOnly Defaults to false - type: boolean - name: - description: Name is the device name - type: string - volumeName: - description: Name of the volume which is referenced Must - match the Name of a Volume. - type: string - required: - - name - - volumeName - type: array - watchdog: - description: Named watchdog device - properties: - i6300esb: - description: i6300esb watchdog device - properties: - action: - description: The action to take. Valid values are poweroff, - reset, shutdown. Defaults to reset - type: string - name: - description: Name of the watchdog - type: string - required: - - name - features: - properties: - acpi: - description: Represents if a feature is enabled or disabled - properties: - enabled: - description: Enabled determines if the feature should be - enabled or disabled on the guest Defaults to true - type: boolean - apic: - properties: - enabled: - description: Enabled determines if the feature should be - enabled or disabled on the guest Defaults to true - type: boolean - endOfInterrupt: - description: EndOfInterrupt enables the end of interrupt - notification in the guest Defaults to false - type: boolean - hyperv: - description: Hyperv specific features - properties: - relaxed: - description: Represents if a feature is enabled or disabled - properties: - enabled: - description: Enabled determines if the feature should - be enabled or disabled on the guest Defaults to true - type: boolean - reset: - description: Represents if a feature is enabled or disabled - properties: - enabled: - description: Enabled determines if the feature should - be enabled or disabled on the guest Defaults to true - type: boolean - runtime: - description: Represents if a feature is enabled or disabled - properties: - enabled: - description: Enabled determines if the feature should - be enabled or disabled on the guest Defaults to true - type: boolean - spinlocks: - properties: - enabled: - description: Enabled determines if the feature should - be enabled or disabled on the guest Defaults to true - type: boolean - spinlocks: - description: Retries indicates the number of retries - Must be a value greater or equal 4096 Defaults to - 4096 - format: int64 - type: integer - synic: - description: Represents if a feature is enabled or disabled - properties: - enabled: - description: Enabled determines if the feature should - be enabled or disabled on the guest Defaults to true - type: boolean - synictimer: - description: Represents if a feature is enabled or disabled - properties: - enabled: - description: Enabled determines if the feature should - be enabled or disabled on the guest Defaults to true - type: boolean - vapic: - description: Represents if a feature is enabled or disabled - properties: - enabled: - description: Enabled determines if the feature should - be enabled or disabled on the guest Defaults to true - type: boolean - vendorid: - properties: - enabled: - description: Enabled determines if the feature should - be enabled or disabled on the guest Defaults to true - type: boolean - vendorid: - description: VendorID sets the hypervisor vendor id, - visible to the vm String up to twelve characters - type: string - vpindex: - description: Represents if a feature is enabled or disabled - properties: - enabled: - description: Enabled determines if the feature should - be enabled or disabled on the guest Defaults to true - type: boolean - firmware: - properties: - uuid: - description: UUID reported by the vm bios Defaults to a random - generated uid - type: string - machine: - properties: - type: - description: QEMU machine type is the actual chipset of the - VM. - type: string - required: - - type - resources: - properties: - limits: - description: Limits describes the maximum amount of compute - resources allowed. Valid resource keys are "memory" and "cpu". - type: object - requests: - description: Requests is a description of the initial vm resources. - Valid resource keys are "memory" and "cpu". - type: object - required: - - devices - selector: {} - required: - - selector - version: v1alpha1 -status: - acceptedNames: - kind: "" - plural: "" - conditions: null diff --git a/vendor/kubevirt.io/kubevirt/manifests/generated/vmrs-resource.yaml b/vendor/kubevirt.io/kubevirt/manifests/generated/vmrs-resource.yaml deleted file mode 100644 index fc0e2f5c3..000000000 --- a/vendor/kubevirt.io/kubevirt/manifests/generated/vmrs-resource.yaml +++ /dev/null @@ -1,405 +0,0 @@ ---- -apiVersion: apiextensions.k8s.io/v1beta1 -kind: CustomResourceDefinition -metadata: - creationTimestamp: null - labels: - kubevirt.io: "" - name: virtualmachinereplicasets.kubevirt.io -spec: - group: kubevirt.io - names: - kind: VirtualMachineReplicaSet - plural: virtualmachinereplicasets - shortNames: - - vmrs - - vmrss - singular: virtualmachinereplicaset - scope: Namespaced - validation: - openAPIV3Schema: - description: VM is *the* VM Definition. It represents a virtual machine in the - runtime environment of kubernetes. - 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' - type: string - kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds' - type: string - metadata: {} - spec: - properties: - paused: - description: Indicates that the replica set is paused. - type: boolean - replicas: - description: Number of desired pods. This is a pointer to distinguish - between explicit zero and not specified. Defaults to 1. - format: int32 - type: integer - selector: {} - template: - properties: - metadata: {} - spec: - description: VirtualMachineSpec is a description of a VirtualMachine. - properties: - affinity: - description: Affinity groups all the affinity rules related - to a VM - properties: - nodeAffinity: {} - domain: - properties: - clock: - description: Represents the clock and timers of a vm - properties: - timezone: - description: Timezone sets the guest clock to the specified - timezone. Zone name follows the TZ environment variable - format (e.g. 'America/New_York') - type: string - utc: - description: UTC sets the guest clock to UTC on each - boot. - properties: - offsetSeconds: - description: OffsetSeconds specifies an offset in - seconds, relative to UTC. If set, guest changes - to the clock will be kept during reboots and not - reset. - format: int32 - type: integer - cpu: - description: CPU allow specifying the CPU topology - properties: - cores: - description: Cores specifies the number of cores inside - the vm. Must be a value greater or equal 1. - format: int64 - type: integer - devices: - properties: - disks: - description: Disks describes disks, cdroms, floppy and - luns which are connected to the vm - items: - properties: - cdrom: - properties: - bus: - description: 'Bus indicates the type of disk - device to emulate. supported values: virtio, - sata, scsi, ide' - type: string - readonly: - description: ReadOnly Defaults to true - type: boolean - tray: - description: Tray indicates if the tray of - the device is open or closed. Allowed values - are "open" and "closed" Defaults to closed - type: string - disk: - properties: - bus: - description: 'Bus indicates the type of disk - device to emulate. supported values: virtio, - sata, scsi, ide' - type: string - readonly: - description: ReadOnly Defaults to false - type: boolean - floppy: - properties: - readonly: - description: ReadOnly Defaults to false - type: boolean - tray: - description: Tray indicates if the tray of - the device is open or closed. Allowed values - are "open" and "closed" Defaults to closed - type: string - lun: - properties: - bus: - description: 'Bus indicates the type of disk - device to emulate. supported values: virtio, - sata, scsi, ide' - type: string - readonly: - description: ReadOnly Defaults to false - type: boolean - name: - description: Name is the device name - type: string - volumeName: - description: Name of the volume which is referenced - Must match the Name of a Volume. - type: string - required: - - name - - volumeName - type: array - watchdog: - description: Named watchdog device - properties: - i6300esb: - description: i6300esb watchdog device - properties: - action: - description: The action to take. Valid values - are poweroff, reset, shutdown. Defaults to - reset - type: string - name: - description: Name of the watchdog - type: string - required: - - name - features: - properties: - acpi: - description: Represents if a feature is enabled or disabled - properties: - enabled: - description: Enabled determines if the feature should - be enabled or disabled on the guest Defaults to - true - type: boolean - apic: - properties: - enabled: - description: Enabled determines if the feature should - be enabled or disabled on the guest Defaults to - true - type: boolean - endOfInterrupt: - description: EndOfInterrupt enables the end of interrupt - notification in the guest Defaults to false - type: boolean - hyperv: - description: Hyperv specific features - properties: - relaxed: - description: Represents if a feature is enabled - or disabled - properties: - enabled: - description: Enabled determines if the feature - should be enabled or disabled on the guest - Defaults to true - type: boolean - reset: - description: Represents if a feature is enabled - or disabled - properties: - enabled: - description: Enabled determines if the feature - should be enabled or disabled on the guest - Defaults to true - type: boolean - runtime: - description: Represents if a feature is enabled - or disabled - properties: - enabled: - description: Enabled determines if the feature - should be enabled or disabled on the guest - Defaults to true - type: boolean - spinlocks: - properties: - enabled: - description: Enabled determines if the feature - should be enabled or disabled on the guest - Defaults to true - type: boolean - spinlocks: - description: Retries indicates the number of - retries Must be a value greater or equal 4096 - Defaults to 4096 - format: int64 - type: integer - synic: - description: Represents if a feature is enabled - or disabled - properties: - enabled: - description: Enabled determines if the feature - should be enabled or disabled on the guest - Defaults to true - type: boolean - synictimer: - description: Represents if a feature is enabled - or disabled - properties: - enabled: - description: Enabled determines if the feature - should be enabled or disabled on the guest - Defaults to true - type: boolean - vapic: - description: Represents if a feature is enabled - or disabled - properties: - enabled: - description: Enabled determines if the feature - should be enabled or disabled on the guest - Defaults to true - type: boolean - vendorid: - properties: - enabled: - description: Enabled determines if the feature - should be enabled or disabled on the guest - Defaults to true - type: boolean - vendorid: - description: VendorID sets the hypervisor vendor - id, visible to the vm String up to twelve - characters - type: string - vpindex: - description: Represents if a feature is enabled - or disabled - properties: - enabled: - description: Enabled determines if the feature - should be enabled or disabled on the guest - Defaults to true - type: boolean - firmware: - properties: - uuid: - description: UUID reported by the vm bios Defaults to - a random generated uid - type: string - machine: - properties: - type: - description: QEMU machine type is the actual chipset - of the VM. - type: string - required: - - type - resources: - properties: - limits: - description: Limits describes the maximum amount of - compute resources allowed. Valid resource keys are - "memory" and "cpu". - type: object - requests: - description: Requests is a description of the initial - vm resources. Valid resource keys are "memory" and - "cpu". - type: object - required: - - devices - nodeSelector: - description: 'NodeSelector is a selector which must be true - for the vm to fit on a node. Selector which must match a node''s - labels for the vm to be scheduled on that node. More info: - https://kubernetes.io/docs/concepts/configuration/assign-pod-node/' - type: object - terminationGracePeriodSeconds: - description: Grace period observed after signalling a VM to - stop after which the VM is force terminated. - format: int64 - type: integer - volumes: - description: List of volumes that can be mounted by disks belonging - to the vm. - items: - description: Volume represents a named volume in a vm. - properties: - cloudInitNoCloud: - description: 'Represents a cloud-init nocloud user data - source More info: http://cloudinit.readthedocs.io/en/latest/topics/datasources/nocloud.html' - properties: - secretRef: {} - userData: - description: UserData contains NoCloud inline cloud-init - userdata - type: string - userDataBase64: - description: UserDataBase64 contains NoCloud cloud-init - userdata as a base64 encoded string - type: string - emptyDisk: - description: EmptyDisk represents a temporary disk which - shares the vms lifecycle - properties: - capacity: {} - required: - - capacity - ephemeral: - properties: - persistentVolumeClaim: {} - name: - description: 'Volume''s name. Must be a DNS_LABEL and - unique within the vm. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' - type: string - persistentVolumeClaim: {} - registryDisk: - description: Represents a docker image with an embedded - disk - properties: - image: - description: Image is the name of the image with the - embedded disk - type: string - imagePullSecret: - description: ImagePullSecret is the name of the Docker - registry secret required to pull the image. The - secret must already exist. - type: string - required: - - image - required: - - name - type: array - required: - - domain - required: - - template - status: - properties: - conditions: - items: - properties: - lastProbeTime: {} - lastTransitionTime: {} - message: - type: string - reason: - type: string - status: - type: string - type: - type: string - required: - - type - - status - type: array - readyReplicas: - description: The number of ready replicas for this replica set. - format: int32 - type: integer - replicas: - description: Total number of non-terminated pods targeted by this deployment - (their labels match the selector). - format: int32 - type: integer - version: v1alpha1 -status: - acceptedNames: - kind: "" - plural: "" - conditions: null diff --git a/vendor/kubevirt.io/kubevirt/manifests/release/demo-content.yaml.in b/vendor/kubevirt.io/kubevirt/manifests/release/demo-content.yaml.in index 1238900e6..70bde1923 100644 --- a/vendor/kubevirt.io/kubevirt/manifests/release/demo-content.yaml.in +++ b/vendor/kubevirt.io/kubevirt/manifests/release/demo-content.yaml.in @@ -1,12 +1,12 @@ # Virtual Machine Presets -apiVersion: kubevirt.io/v1alpha1 -kind: VirtualMachinePreset +apiVersion: kubevirt.io/v1alpha2 +kind: VirtualMachineInstancePreset metadata: name: windows-server-2012r2 +spec: selector: matchLabels: kubevirt.io/os: win2k12r2 -spec: domain: cpu: cores: 2 diff --git a/vendor/kubevirt.io/kubevirt/manifests/release/kubevirt.yaml.in b/vendor/kubevirt.io/kubevirt/manifests/release/kubevirt.yaml.in index 1b52c5f97..6b0ce3fb7 100644 --- a/vendor/kubevirt.io/kubevirt/manifests/release/kubevirt.yaml.in +++ b/vendor/kubevirt.io/kubevirt/manifests/release/kubevirt.yaml.in @@ -1,4 +1,87 @@ # RBAC +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: ClusterRole +metadata: + name: kubevirt.io:admin + labels: + kubevirt.io: "" + rbac.authorization.k8s.io/aggregate-to-admin: "true" +rules: + - apiGroups: + - subresources.kubevirt.io + resources: + - virtualmachineinstances/console + - virtualmachineinstances/vnc + verbs: + - get + - apiGroups: + - kubevirt.io + resources: + - virtualmachineinstances + - virtualmachines + - virtualmachineinstancepresets + - virtualmachineinstancereplicasets + verbs: + - get + - delete + - create + - update + - patch + - list + - watch + - deletecollection +--- +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: ClusterRole +metadata: + name: kubevirt.io:edit + labels: + kubevirt.io: "" + rbac.authorization.k8s.io/aggregate-to-edit: "true" +rules: + - apiGroups: + - subresources.kubevirt.io + resources: + - virtualmachineinstances/console + - virtualmachineinstances/vnc + verbs: + - get + - apiGroups: + - kubevirt.io + resources: + - virtualmachineinstances + - virtualmachines + - virtualmachineinstancepresets + - virtualmachineinstancereplicasets + verbs: + - get + - delete + - create + - update + - patch + - list + - watch +--- +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: ClusterRole +metadata: + name: kubevirt.io:view + labels: + kubevirt.io: "" + rbac.authorization.k8s.io/aggregate-to-view: "true" +rules: + - apiGroups: + - kubevirt.io + resources: + - virtualmachineinstances + - virtualmachines + - virtualmachineinstancepresets + - virtualmachineinstancereplicasets + verbs: + - get + - list + - watch +--- kind: ServiceAccount apiVersion: v1 metadata: @@ -71,14 +154,16 @@ rules: - get - list - delete - - update - - create + - update + - create - apiGroups: - '' resources: - configmaps verbs: - get + - list + - watch --- apiVersion: rbac.authorization.k8s.io/v1beta1 kind: ClusterRole @@ -112,7 +197,7 @@ rules: - apiGroups: - kubevirt.io resources: - - virtualmachines + - virtualmachineinstances verbs: - get - list @@ -148,10 +233,10 @@ rules: - apiGroups: - kubevirt.io resources: + - virtualmachineinstances + - virtualmachineinstancereplicasets + - virtualmachineinstancepresets - virtualmachines - - virtualmachinereplicasets - - virtualmachinepresets - - offlinevirtualmachines verbs: - get - list @@ -225,6 +310,44 @@ subjects: name: kubevirt-privileged namespace: {{.Namespace}} --- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + annotations: + rbac.authorization.kubernetes.io/autoupdate: "true" + labels: + kubevirt.io: "" + kubernetes.io/bootstrapping: rbac-defaults + name: kubevirt.io:default +rules: +- apiGroups: + - subresources.kubevirt.io + resources: + - version + verbs: + - get + - list +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + labels: + kubevirt.io: "" + annotations: + rbac.authorization.kubernetes.io/autoupdate: "true" + name: kubevirt.io:default +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: kubevirt.io:default +subjects: +- apiGroup: rbac.authorization.k8s.io + kind: Group + name: system:authenticated +- apiGroup: rbac.authorization.k8s.io + kind: Group + name: system:unauthenticated +--- apiVersion: v1 kind: Service metadata: @@ -251,6 +374,15 @@ spec: replicas: 2 template: metadata: + annotations: + scheduler.alpha.kubernetes.io/critical-pod: "" + scheduler.alpha.kubernetes.io/tolerations: | + [ + { + "key": "CriticalAddonsOnly", + "operator": "Exists" + } + ] labels: kubevirt.io: virt-api spec: @@ -260,7 +392,7 @@ spec: image: {{.DockerPrefix}}/virt-api:{{.DockerTag}} imagePullPolicy: IfNotPresent command: - - "/virt-api" + - "virt-api" - "--port" - "8443" - "--subresources-only" @@ -288,6 +420,15 @@ spec: replicas: 2 template: metadata: + annotations: + scheduler.alpha.kubernetes.io/critical-pod: "" + scheduler.alpha.kubernetes.io/tolerations: | + [ + { + "key": "CriticalAddonsOnly", + "operator": "Exists" + } + ] labels: kubevirt.io: virt-controller spec: @@ -297,7 +438,7 @@ spec: image: {{.DockerPrefix}}/virt-controller:{{.DockerTag}} imagePullPolicy: IfNotPresent command: - - "/virt-controller" + - "virt-controller" - "--launcher-image" - "{{.DockerPrefix}}/virt-launcher:{{.DockerTag}}" - "--port" @@ -331,9 +472,20 @@ metadata: labels: kubevirt.io: "virt-handler" spec: + updateStrategy: + type: RollingUpdate template: metadata: name: virt-handler + annotations: + scheduler.alpha.kubernetes.io/critical-pod: "" + scheduler.alpha.kubernetes.io/tolerations: | + [ + { + "key": "CriticalAddonsOnly", + "operator": "Exists" + } + ] labels: kubevirt.io: virt-handler spec: @@ -347,7 +499,7 @@ spec: image: {{.DockerPrefix}}/virt-handler:{{.DockerTag}} imagePullPolicy: IfNotPresent command: - - "/virt-handler" + - "virt-handler" - "-v" - "3" - "--hostname-override" @@ -361,6 +513,8 @@ spec: mountPath: /var/run/kubevirt - name: virt-private-dir mountPath: /var/run/kubevirt-private + - name: device-plugin + mountPath: /var/lib/kubelet/device-plugins env: - name: NODE_NAME valueFrom: @@ -376,7 +530,10 @@ spec: - name: virt-private-dir hostPath: path: /var/run/kubevirt-private + - name: device-plugin + hostPath: + path: /var/lib/kubelet/device-plugins +{{index .GeneratedManifests "vmi-resource.yaml"}} +{{index .GeneratedManifests "vmirs-resource.yaml"}} +{{index .GeneratedManifests "vmipreset-resource.yaml"}} {{index .GeneratedManifests "vm-resource.yaml"}} -{{index .GeneratedManifests "vmrs-resource.yaml"}} -{{index .GeneratedManifests "vmpreset-resource.yaml"}} -{{index .GeneratedManifests "ovm-resource.yaml"}} diff --git a/vendor/kubevirt.io/kubevirt/manifests/testing/iscsi-demo-target.yaml.in b/vendor/kubevirt.io/kubevirt/manifests/testing/disks-images-provider.yaml.in similarity index 60% rename from vendor/kubevirt.io/kubevirt/manifests/testing/iscsi-demo-target.yaml.in rename to vendor/kubevirt.io/kubevirt/manifests/testing/disks-images-provider.yaml.in index d21d3f8e9..60fb31521 100644 --- a/vendor/kubevirt.io/kubevirt/manifests/testing/iscsi-demo-target.yaml.in +++ b/vendor/kubevirt.io/kubevirt/manifests/testing/disks-images-provider.yaml.in @@ -20,7 +20,7 @@ spec: apiVersion: v1 kind: PersistentVolume metadata: - name: iscsi-disk-alpine + name: host-path-disk-alpine labels: kubevirt.io: "" os: "alpine" @@ -29,10 +29,8 @@ spec: storage: 1Gi accessModes: - ReadWriteOnce - iscsi: - iqn: iqn.2017-01.io.kubevirt:sn.42 - lun: 2 - targetPortal: "127.0.0.1" + hostPath: + path: /tmp/hostImages/alpine --- apiVersion: v1 kind: PersistentVolumeClaim @@ -55,7 +53,7 @@ spec: apiVersion: v1 kind: PersistentVolume metadata: - name: iscsi-disk-custom + name: host-path-disk-custom labels: kubevirt.io: "" os: "custom" @@ -64,47 +62,42 @@ spec: storage: 1Gi accessModes: - ReadWriteOnce - iscsi: - iqn: iqn.2017-01.io.kubevirt:sn.42 - lun: 1 - targetPortal: "127.0.0.1" + hostPath: + path: /tmp/hostImages/custom --- apiVersion: extensions/v1beta1 kind: DaemonSet metadata: - name: iscsi-demo-target-tgtd + name: disks-images-provider namespace: {{.Namespace}} labels: - kubevirt.io: "iscsi-demo-target" + kubevirt.io: "disks-images-provider" spec: template: metadata: labels: - name: iscsi-demo-target-tgtd - kubevirt.io: iscsi-demo-target - name: iscsi-demo-target-tgtd + name: disks-images-provider + kubevirt.io: disks-images-provider + name: disks-images-provider spec: - hostNetwork: true serviceAccountName: kubevirt-testing containers: - name: target - image: {{.DockerPrefix}}/iscsi-demo-target-tgtd:{{.DockerTag}} + image: {{.DockerPrefix}}/disks-images-provider:{{.DockerTag}} volumeMounts: - - name: host - mountPath: /host - env: - - name: EXPORT_HOST_PATHS - value: + - name: images + mountPath: /hostImages securityContext: privileged: true - readinessProbe: - exec: - command: - - cat - - /tmp/previous_state - initialDelaySeconds: 10 + readinessProbe: + exec: + command: + - cat + - /ready + initialDelaySeconds: 10 periodSeconds: 5 volumes: - - name: host + - name: images hostPath: - path: / + path: /tmp/hostImages + type: DirectoryOrCreate diff --git a/vendor/kubevirt.io/kubevirt/pkg/api/v1/deepcopy_generated.go b/vendor/kubevirt.io/kubevirt/pkg/api/v1/deepcopy_generated.go index 75bb591e8..d6f43e48d 100644 --- a/vendor/kubevirt.io/kubevirt/pkg/api/v1/deepcopy_generated.go +++ b/vendor/kubevirt.io/kubevirt/pkg/api/v1/deepcopy_generated.go @@ -38,6 +38,24 @@ func (in *Affinity) DeepCopyInto(out *Affinity) { (*in).DeepCopyInto(*out) } } + if in.PodAffinity != nil { + in, out := &in.PodAffinity, &out.PodAffinity + if *in == nil { + *out = nil + } else { + *out = new(core_v1.PodAffinity) + (*in).DeepCopyInto(*out) + } + } + if in.PodAntiAffinity != nil { + in, out := &in.PodAntiAffinity, &out.PodAntiAffinity + if *in == nil { + *out = nil + } else { + *out = new(core_v1.PodAntiAffinity) + (*in).DeepCopyInto(*out) + } + } return } @@ -221,6 +239,13 @@ func (in *Devices) DeepCopyInto(out *Devices) { (*in).DeepCopyInto(*out) } } + if in.Interfaces != nil { + in, out := &in.Interfaces, &out.Interfaces + *out = make([]Interface, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } return } @@ -238,6 +263,15 @@ func (in *Devices) DeepCopy() *Devices { func (in *Disk) DeepCopyInto(out *Disk) { *out = *in in.DiskDevice.DeepCopyInto(&out.DiskDevice) + if in.BootOrder != nil { + in, out := &in.BootOrder, &out.BootOrder + if *in == nil { + *out = nil + } else { + *out = new(uint) + **out = **in + } + } return } @@ -319,6 +353,70 @@ func (in *DiskTarget) DeepCopy() *DiskTarget { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DomainPresetSpec) DeepCopyInto(out *DomainPresetSpec) { + *out = *in + in.Resources.DeepCopyInto(&out.Resources) + if in.CPU != nil { + in, out := &in.CPU, &out.CPU + if *in == nil { + *out = nil + } else { + *out = new(CPU) + **out = **in + } + } + if in.Memory != nil { + in, out := &in.Memory, &out.Memory + if *in == nil { + *out = nil + } else { + *out = new(Memory) + (*in).DeepCopyInto(*out) + } + } + out.Machine = in.Machine + if in.Firmware != nil { + in, out := &in.Firmware, &out.Firmware + if *in == nil { + *out = nil + } else { + *out = new(Firmware) + **out = **in + } + } + if in.Clock != nil { + in, out := &in.Clock, &out.Clock + if *in == nil { + *out = nil + } else { + *out = new(Clock) + (*in).DeepCopyInto(*out) + } + } + if in.Features != nil { + in, out := &in.Features, &out.Features + if *in == nil { + *out = nil + } else { + *out = new(Features) + (*in).DeepCopyInto(*out) + } + } + in.Devices.DeepCopyInto(&out.Devices) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DomainPresetSpec. +func (in *DomainPresetSpec) DeepCopy() *DomainPresetSpec { + if in == nil { + return nil + } + out := new(DomainPresetSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *DomainSpec) DeepCopyInto(out *DomainSpec) { *out = *in @@ -332,6 +430,15 @@ func (in *DomainSpec) DeepCopyInto(out *DomainSpec) { **out = **in } } + if in.Memory != nil { + in, out := &in.Memory, &out.Memory + if *in == nil { + *out = nil + } else { + *out = new(Memory) + (*in).DeepCopyInto(*out) + } + } out.Machine = in.Machine if in.Firmware != nil { in, out := &in.Firmware, &out.Firmware @@ -714,6 +821,22 @@ func (in *HPETTimer) DeepCopy() *HPETTimer { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Hugepages) DeepCopyInto(out *Hugepages) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Hugepages. +func (in *Hugepages) DeepCopy() *Hugepages { + if in == nil { + return nil + } + out := new(Hugepages) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *HypervTimer) DeepCopyInto(out *HypervTimer) { *out = *in @@ -755,6 +878,94 @@ func (in *I6300ESBWatchdog) DeepCopy() *I6300ESBWatchdog { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Interface) DeepCopyInto(out *Interface) { + *out = *in + in.InterfaceBindingMethod.DeepCopyInto(&out.InterfaceBindingMethod) + if in.Ports != nil { + in, out := &in.Ports, &out.Ports + *out = make([]Port, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Interface. +func (in *Interface) DeepCopy() *Interface { + if in == nil { + return nil + } + out := new(Interface) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InterfaceBindingMethod) DeepCopyInto(out *InterfaceBindingMethod) { + *out = *in + if in.Bridge != nil { + in, out := &in.Bridge, &out.Bridge + if *in == nil { + *out = nil + } else { + *out = new(InterfaceBridge) + **out = **in + } + } + if in.Slirp != nil { + in, out := &in.Slirp, &out.Slirp + if *in == nil { + *out = nil + } else { + *out = new(InterfaceSlirp) + **out = **in + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InterfaceBindingMethod. +func (in *InterfaceBindingMethod) DeepCopy() *InterfaceBindingMethod { + if in == nil { + return nil + } + out := new(InterfaceBindingMethod) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InterfaceBridge) DeepCopyInto(out *InterfaceBridge) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InterfaceBridge. +func (in *InterfaceBridge) DeepCopy() *InterfaceBridge { + if in == nil { + return nil + } + out := new(InterfaceBridge) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InterfaceSlirp) DeepCopyInto(out *InterfaceSlirp) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InterfaceSlirp. +func (in *InterfaceSlirp) DeepCopy() *InterfaceSlirp { + if in == nil { + return nil + } + out := new(InterfaceSlirp) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *KVMTimer) DeepCopyInto(out *KVMTimer) { *out = *in @@ -813,155 +1024,125 @@ func (in *Machine) DeepCopy() *Machine { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *OfflineVirtualMachine) DeepCopyInto(out *OfflineVirtualMachine) { +func (in *Memory) DeepCopyInto(out *Memory) { *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) + if in.Hugepages != nil { + in, out := &in.Hugepages, &out.Hugepages + if *in == nil { + *out = nil + } else { + *out = new(Hugepages) + **out = **in + } + } return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OfflineVirtualMachine. -func (in *OfflineVirtualMachine) DeepCopy() *OfflineVirtualMachine { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Memory. +func (in *Memory) DeepCopy() *Memory { if in == nil { return nil } - out := new(OfflineVirtualMachine) + out := new(Memory) in.DeepCopyInto(out) return out } -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *OfflineVirtualMachine) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } else { - return nil - } -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *OfflineVirtualMachineCondition) DeepCopyInto(out *OfflineVirtualMachineCondition) { +func (in *Network) DeepCopyInto(out *Network) { *out = *in - in.LastProbeTime.DeepCopyInto(&out.LastProbeTime) - in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) + in.NetworkSource.DeepCopyInto(&out.NetworkSource) return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OfflineVirtualMachineCondition. -func (in *OfflineVirtualMachineCondition) DeepCopy() *OfflineVirtualMachineCondition { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Network. +func (in *Network) DeepCopy() *Network { if in == nil { return nil } - out := new(OfflineVirtualMachineCondition) + out := new(Network) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *OfflineVirtualMachineList) DeepCopyInto(out *OfflineVirtualMachineList) { +func (in *NetworkSource) DeepCopyInto(out *NetworkSource) { *out = *in - out.TypeMeta = in.TypeMeta - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]OfflineVirtualMachine, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) + if in.Pod != nil { + in, out := &in.Pod, &out.Pod + if *in == nil { + *out = nil + } else { + *out = new(PodNetwork) + **out = **in } } return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OfflineVirtualMachineList. -func (in *OfflineVirtualMachineList) DeepCopy() *OfflineVirtualMachineList { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkSource. +func (in *NetworkSource) DeepCopy() *NetworkSource { if in == nil { return nil } - out := new(OfflineVirtualMachineList) + out := new(NetworkSource) in.DeepCopyInto(out) return out } -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *OfflineVirtualMachineList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } else { - return nil - } -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *OfflineVirtualMachineSpec) DeepCopyInto(out *OfflineVirtualMachineSpec) { +func (in *PITTimer) DeepCopyInto(out *PITTimer) { *out = *in - if in.Template != nil { - in, out := &in.Template, &out.Template + if in.Enabled != nil { + in, out := &in.Enabled, &out.Enabled if *in == nil { *out = nil } else { - *out = new(VMTemplateSpec) - (*in).DeepCopyInto(*out) + *out = new(bool) + **out = **in } } return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OfflineVirtualMachineSpec. -func (in *OfflineVirtualMachineSpec) DeepCopy() *OfflineVirtualMachineSpec { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PITTimer. +func (in *PITTimer) DeepCopy() *PITTimer { if in == nil { return nil } - out := new(OfflineVirtualMachineSpec) + out := new(PITTimer) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *OfflineVirtualMachineStatus) DeepCopyInto(out *OfflineVirtualMachineStatus) { +func (in *PodNetwork) DeepCopyInto(out *PodNetwork) { *out = *in - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make([]OfflineVirtualMachineCondition, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OfflineVirtualMachineStatus. -func (in *OfflineVirtualMachineStatus) DeepCopy() *OfflineVirtualMachineStatus { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodNetwork. +func (in *PodNetwork) DeepCopy() *PodNetwork { if in == nil { return nil } - out := new(OfflineVirtualMachineStatus) + out := new(PodNetwork) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PITTimer) DeepCopyInto(out *PITTimer) { +func (in *Port) DeepCopyInto(out *Port) { *out = *in - if in.Enabled != nil { - in, out := &in.Enabled, &out.Enabled - if *in == nil { - *out = nil - } else { - *out = new(bool) - **out = **in - } - } return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PITTimer. -func (in *PITTimer) DeepCopy() *PITTimer { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Port. +func (in *Port) DeepCopy() *Port { if in == nil { return nil } - out := new(PITTimer) + out := new(Port) in.DeepCopyInto(out) return out } @@ -1099,125 +1280,70 @@ func (in *Timer) DeepCopy() *Timer { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VMReplicaSetCondition) DeepCopyInto(out *VMReplicaSetCondition) { +func (in *VMISelector) DeepCopyInto(out *VMISelector) { *out = *in - in.LastProbeTime.DeepCopyInto(&out.LastProbeTime) - in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VMReplicaSetCondition. -func (in *VMReplicaSetCondition) DeepCopy() *VMReplicaSetCondition { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VMISelector. +func (in *VMISelector) DeepCopy() *VMISelector { if in == nil { return nil } - out := new(VMReplicaSetCondition) + out := new(VMISelector) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VMReplicaSetSpec) DeepCopyInto(out *VMReplicaSetSpec) { - *out = *in - if in.Replicas != nil { - in, out := &in.Replicas, &out.Replicas - if *in == nil { - *out = nil - } else { - *out = new(int32) - **out = **in - } - } - if in.Selector != nil { - in, out := &in.Selector, &out.Selector - if *in == nil { - *out = nil - } else { - *out = new(meta_v1.LabelSelector) - (*in).DeepCopyInto(*out) - } - } - if in.Template != nil { - in, out := &in.Template, &out.Template - if *in == nil { - *out = nil - } else { - *out = new(VMTemplateSpec) - (*in).DeepCopyInto(*out) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VMReplicaSetSpec. -func (in *VMReplicaSetSpec) DeepCopy() *VMReplicaSetSpec { - if in == nil { - return nil - } - out := new(VMReplicaSetSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VMReplicaSetStatus) DeepCopyInto(out *VMReplicaSetStatus) { +func (in *VirtualMachine) DeepCopyInto(out *VirtualMachine) { *out = *in - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make([]VMReplicaSetCondition, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VMReplicaSetStatus. -func (in *VMReplicaSetStatus) DeepCopy() *VMReplicaSetStatus { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualMachine. +func (in *VirtualMachine) DeepCopy() *VirtualMachine { if in == nil { return nil } - out := new(VMReplicaSetStatus) + out := new(VirtualMachine) in.DeepCopyInto(out) return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VMSelector) DeepCopyInto(out *VMSelector) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VMSelector. -func (in *VMSelector) DeepCopy() *VMSelector { - if in == nil { +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *VirtualMachine) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } else { return nil } - out := new(VMSelector) - in.DeepCopyInto(out) - return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VMTemplateSpec) DeepCopyInto(out *VMTemplateSpec) { +func (in *VirtualMachineCondition) DeepCopyInto(out *VirtualMachineCondition) { *out = *in - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) + in.LastProbeTime.DeepCopyInto(&out.LastProbeTime) + in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VMTemplateSpec. -func (in *VMTemplateSpec) DeepCopy() *VMTemplateSpec { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualMachineCondition. +func (in *VirtualMachineCondition) DeepCopy() *VirtualMachineCondition { if in == nil { return nil } - out := new(VMTemplateSpec) + out := new(VirtualMachineCondition) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VirtualMachine) DeepCopyInto(out *VirtualMachine) { +func (in *VirtualMachineInstance) DeepCopyInto(out *VirtualMachineInstance) { *out = *in out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) @@ -1226,18 +1352,18 @@ func (in *VirtualMachine) DeepCopyInto(out *VirtualMachine) { return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualMachine. -func (in *VirtualMachine) DeepCopy() *VirtualMachine { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualMachineInstance. +func (in *VirtualMachineInstance) DeepCopy() *VirtualMachineInstance { if in == nil { return nil } - out := new(VirtualMachine) + out := new(VirtualMachineInstance) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *VirtualMachine) DeepCopyObject() runtime.Object { +func (in *VirtualMachineInstance) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } else { @@ -1246,31 +1372,31 @@ func (in *VirtualMachine) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VirtualMachineCondition) DeepCopyInto(out *VirtualMachineCondition) { +func (in *VirtualMachineInstanceCondition) DeepCopyInto(out *VirtualMachineInstanceCondition) { *out = *in in.LastProbeTime.DeepCopyInto(&out.LastProbeTime) in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualMachineCondition. -func (in *VirtualMachineCondition) DeepCopy() *VirtualMachineCondition { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualMachineInstanceCondition. +func (in *VirtualMachineInstanceCondition) DeepCopy() *VirtualMachineInstanceCondition { if in == nil { return nil } - out := new(VirtualMachineCondition) + out := new(VirtualMachineInstanceCondition) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VirtualMachineList) DeepCopyInto(out *VirtualMachineList) { +func (in *VirtualMachineInstanceList) DeepCopyInto(out *VirtualMachineInstanceList) { *out = *in out.TypeMeta = in.TypeMeta out.ListMeta = in.ListMeta if in.Items != nil { in, out := &in.Items, &out.Items - *out = make([]VirtualMachine, len(*in)) + *out = make([]VirtualMachineInstance, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } @@ -1278,18 +1404,18 @@ func (in *VirtualMachineList) DeepCopyInto(out *VirtualMachineList) { return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualMachineList. -func (in *VirtualMachineList) DeepCopy() *VirtualMachineList { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualMachineInstanceList. +func (in *VirtualMachineInstanceList) DeepCopy() *VirtualMachineInstanceList { if in == nil { return nil } - out := new(VirtualMachineList) + out := new(VirtualMachineInstanceList) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *VirtualMachineList) DeepCopyObject() runtime.Object { +func (in *VirtualMachineInstanceList) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } else { @@ -1298,23 +1424,23 @@ func (in *VirtualMachineList) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VirtualMachineNetworkInterface) DeepCopyInto(out *VirtualMachineNetworkInterface) { +func (in *VirtualMachineInstanceNetworkInterface) DeepCopyInto(out *VirtualMachineInstanceNetworkInterface) { *out = *in return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualMachineNetworkInterface. -func (in *VirtualMachineNetworkInterface) DeepCopy() *VirtualMachineNetworkInterface { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualMachineInstanceNetworkInterface. +func (in *VirtualMachineInstanceNetworkInterface) DeepCopy() *VirtualMachineInstanceNetworkInterface { if in == nil { return nil } - out := new(VirtualMachineNetworkInterface) + out := new(VirtualMachineInstanceNetworkInterface) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VirtualMachinePreset) DeepCopyInto(out *VirtualMachinePreset) { +func (in *VirtualMachineInstancePreset) DeepCopyInto(out *VirtualMachineInstancePreset) { *out = *in out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) @@ -1322,18 +1448,18 @@ func (in *VirtualMachinePreset) DeepCopyInto(out *VirtualMachinePreset) { return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualMachinePreset. -func (in *VirtualMachinePreset) DeepCopy() *VirtualMachinePreset { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualMachineInstancePreset. +func (in *VirtualMachineInstancePreset) DeepCopy() *VirtualMachineInstancePreset { if in == nil { return nil } - out := new(VirtualMachinePreset) + out := new(VirtualMachineInstancePreset) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *VirtualMachinePreset) DeepCopyObject() runtime.Object { +func (in *VirtualMachineInstancePreset) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } else { @@ -1342,13 +1468,13 @@ func (in *VirtualMachinePreset) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VirtualMachinePresetList) DeepCopyInto(out *VirtualMachinePresetList) { +func (in *VirtualMachineInstancePresetList) DeepCopyInto(out *VirtualMachineInstancePresetList) { *out = *in out.TypeMeta = in.TypeMeta out.ListMeta = in.ListMeta if in.Items != nil { in, out := &in.Items, &out.Items - *out = make([]VirtualMachinePreset, len(*in)) + *out = make([]VirtualMachineInstancePreset, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } @@ -1356,18 +1482,18 @@ func (in *VirtualMachinePresetList) DeepCopyInto(out *VirtualMachinePresetList) return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualMachinePresetList. -func (in *VirtualMachinePresetList) DeepCopy() *VirtualMachinePresetList { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualMachineInstancePresetList. +func (in *VirtualMachineInstancePresetList) DeepCopy() *VirtualMachineInstancePresetList { if in == nil { return nil } - out := new(VirtualMachinePresetList) + out := new(VirtualMachineInstancePresetList) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *VirtualMachinePresetList) DeepCopyObject() runtime.Object { +func (in *VirtualMachineInstancePresetList) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } else { @@ -1376,7 +1502,7 @@ func (in *VirtualMachinePresetList) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VirtualMachinePresetSpec) DeepCopyInto(out *VirtualMachinePresetSpec) { +func (in *VirtualMachineInstancePresetSpec) DeepCopyInto(out *VirtualMachineInstancePresetSpec) { *out = *in in.Selector.DeepCopyInto(&out.Selector) if in.Domain != nil { @@ -1384,25 +1510,25 @@ func (in *VirtualMachinePresetSpec) DeepCopyInto(out *VirtualMachinePresetSpec) if *in == nil { *out = nil } else { - *out = new(DomainSpec) + *out = new(DomainPresetSpec) (*in).DeepCopyInto(*out) } } return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualMachinePresetSpec. -func (in *VirtualMachinePresetSpec) DeepCopy() *VirtualMachinePresetSpec { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualMachineInstancePresetSpec. +func (in *VirtualMachineInstancePresetSpec) DeepCopy() *VirtualMachineInstancePresetSpec { if in == nil { return nil } - out := new(VirtualMachinePresetSpec) + out := new(VirtualMachineInstancePresetSpec) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VirtualMachineReplicaSet) DeepCopyInto(out *VirtualMachineReplicaSet) { +func (in *VirtualMachineInstanceReplicaSet) DeepCopyInto(out *VirtualMachineInstanceReplicaSet) { *out = *in out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) @@ -1411,18 +1537,18 @@ func (in *VirtualMachineReplicaSet) DeepCopyInto(out *VirtualMachineReplicaSet) return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualMachineReplicaSet. -func (in *VirtualMachineReplicaSet) DeepCopy() *VirtualMachineReplicaSet { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualMachineInstanceReplicaSet. +func (in *VirtualMachineInstanceReplicaSet) DeepCopy() *VirtualMachineInstanceReplicaSet { if in == nil { return nil } - out := new(VirtualMachineReplicaSet) + out := new(VirtualMachineInstanceReplicaSet) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *VirtualMachineReplicaSet) DeepCopyObject() runtime.Object { +func (in *VirtualMachineInstanceReplicaSet) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } else { @@ -1431,13 +1557,31 @@ func (in *VirtualMachineReplicaSet) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VirtualMachineReplicaSetList) DeepCopyInto(out *VirtualMachineReplicaSetList) { +func (in *VirtualMachineInstanceReplicaSetCondition) DeepCopyInto(out *VirtualMachineInstanceReplicaSetCondition) { + *out = *in + in.LastProbeTime.DeepCopyInto(&out.LastProbeTime) + in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualMachineInstanceReplicaSetCondition. +func (in *VirtualMachineInstanceReplicaSetCondition) DeepCopy() *VirtualMachineInstanceReplicaSetCondition { + if in == nil { + return nil + } + out := new(VirtualMachineInstanceReplicaSetCondition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VirtualMachineInstanceReplicaSetList) DeepCopyInto(out *VirtualMachineInstanceReplicaSetList) { *out = *in out.TypeMeta = in.TypeMeta out.ListMeta = in.ListMeta if in.Items != nil { in, out := &in.Items, &out.Items - *out = make([]VirtualMachineReplicaSet, len(*in)) + *out = make([]VirtualMachineInstanceReplicaSet, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } @@ -1445,18 +1589,18 @@ func (in *VirtualMachineReplicaSetList) DeepCopyInto(out *VirtualMachineReplicaS return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualMachineReplicaSetList. -func (in *VirtualMachineReplicaSetList) DeepCopy() *VirtualMachineReplicaSetList { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualMachineInstanceReplicaSetList. +func (in *VirtualMachineInstanceReplicaSetList) DeepCopy() *VirtualMachineInstanceReplicaSetList { if in == nil { return nil } - out := new(VirtualMachineReplicaSetList) + out := new(VirtualMachineInstanceReplicaSetList) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *VirtualMachineReplicaSetList) DeepCopyObject() runtime.Object { +func (in *VirtualMachineInstanceReplicaSetList) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } else { @@ -1465,7 +1609,73 @@ func (in *VirtualMachineReplicaSetList) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VirtualMachineSpec) DeepCopyInto(out *VirtualMachineSpec) { +func (in *VirtualMachineInstanceReplicaSetSpec) DeepCopyInto(out *VirtualMachineInstanceReplicaSetSpec) { + *out = *in + if in.Replicas != nil { + in, out := &in.Replicas, &out.Replicas + if *in == nil { + *out = nil + } else { + *out = new(int32) + **out = **in + } + } + if in.Selector != nil { + in, out := &in.Selector, &out.Selector + if *in == nil { + *out = nil + } else { + *out = new(meta_v1.LabelSelector) + (*in).DeepCopyInto(*out) + } + } + if in.Template != nil { + in, out := &in.Template, &out.Template + if *in == nil { + *out = nil + } else { + *out = new(VirtualMachineInstanceTemplateSpec) + (*in).DeepCopyInto(*out) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualMachineInstanceReplicaSetSpec. +func (in *VirtualMachineInstanceReplicaSetSpec) DeepCopy() *VirtualMachineInstanceReplicaSetSpec { + if in == nil { + return nil + } + out := new(VirtualMachineInstanceReplicaSetSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VirtualMachineInstanceReplicaSetStatus) DeepCopyInto(out *VirtualMachineInstanceReplicaSetStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]VirtualMachineInstanceReplicaSetCondition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualMachineInstanceReplicaSetStatus. +func (in *VirtualMachineInstanceReplicaSetStatus) DeepCopy() *VirtualMachineInstanceReplicaSetStatus { + if in == nil { + return nil + } + out := new(VirtualMachineInstanceReplicaSetStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VirtualMachineInstanceSpec) DeepCopyInto(out *VirtualMachineInstanceSpec) { *out = *in in.Domain.DeepCopyInto(&out.Domain) if in.NodeSelector != nil { @@ -1500,6 +1710,118 @@ func (in *VirtualMachineSpec) DeepCopyInto(out *VirtualMachineSpec) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + if in.Networks != nil { + in, out := &in.Networks, &out.Networks + *out = make([]Network, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualMachineInstanceSpec. +func (in *VirtualMachineInstanceSpec) DeepCopy() *VirtualMachineInstanceSpec { + if in == nil { + return nil + } + out := new(VirtualMachineInstanceSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VirtualMachineInstanceStatus) DeepCopyInto(out *VirtualMachineInstanceStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]VirtualMachineInstanceCondition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Interfaces != nil { + in, out := &in.Interfaces, &out.Interfaces + *out = make([]VirtualMachineInstanceNetworkInterface, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualMachineInstanceStatus. +func (in *VirtualMachineInstanceStatus) DeepCopy() *VirtualMachineInstanceStatus { + if in == nil { + return nil + } + out := new(VirtualMachineInstanceStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VirtualMachineInstanceTemplateSpec) DeepCopyInto(out *VirtualMachineInstanceTemplateSpec) { + *out = *in + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualMachineInstanceTemplateSpec. +func (in *VirtualMachineInstanceTemplateSpec) DeepCopy() *VirtualMachineInstanceTemplateSpec { + if in == nil { + return nil + } + out := new(VirtualMachineInstanceTemplateSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VirtualMachineList) DeepCopyInto(out *VirtualMachineList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]VirtualMachine, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualMachineList. +func (in *VirtualMachineList) DeepCopy() *VirtualMachineList { + if in == nil { + return nil + } + out := new(VirtualMachineList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *VirtualMachineList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } else { + return nil + } +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VirtualMachineSpec) DeepCopyInto(out *VirtualMachineSpec) { + *out = *in + if in.Template != nil { + in, out := &in.Template, &out.Template + if *in == nil { + *out = nil + } else { + *out = new(VirtualMachineInstanceTemplateSpec) + (*in).DeepCopyInto(*out) + } + } return } @@ -1523,11 +1845,6 @@ func (in *VirtualMachineStatus) DeepCopyInto(out *VirtualMachineStatus) { (*in)[i].DeepCopyInto(&(*out)[i]) } } - if in.Interfaces != nil { - in, out := &in.Interfaces, &out.Interfaces - *out = make([]VirtualMachineNetworkInterface, len(*in)) - copy(*out, *in) - } return } diff --git a/vendor/kubevirt.io/kubevirt/pkg/api/v1/defaults.go b/vendor/kubevirt.io/kubevirt/pkg/api/v1/defaults.go index 9241b4be9..6a912ec1e 100644 --- a/vendor/kubevirt.io/kubevirt/pkg/api/v1/defaults.go +++ b/vendor/kubevirt.io/kubevirt/pkg/api/v1/defaults.go @@ -111,7 +111,7 @@ func SetDefaults_Firmware(obj *Firmware) { } } -func SetDefaults_VirtualMachine(obj *VirtualMachine) { +func SetDefaults_VirtualMachineInstance(obj *VirtualMachineInstance) { // FIXME we need proper validation and configurable defaulting instead of this if _, exists := obj.Spec.Domain.Resources.Requests[v1.ResourceMemory]; !exists { obj.Spec.Domain.Resources.Requests = v1.ResourceList{ @@ -129,9 +129,10 @@ func SetDefaults_VirtualMachine(obj *VirtualMachine) { obj.Spec.Domain.Machine.Type = "q35" } setDefaults_DiskFromMachineType(obj) + SetDefaults_NetworkInterface(obj) } -func setDefaults_DiskFromMachineType(obj *VirtualMachine) { +func setDefaults_DiskFromMachineType(obj *VirtualMachineInstance) { bus := diskBusFromMachine(obj.Spec.Domain.Machine.Type) for i := range obj.Spec.Domain.Devices.Disks { @@ -151,6 +152,44 @@ func setDefaults_DiskFromMachineType(obj *VirtualMachine) { } } +func SetDefaults_NetworkInterface(obj *VirtualMachineInstance) { + // Override only when nothing is specified + if len(obj.Spec.Networks) == 0 { + obj.Spec.Domain.Devices.Interfaces = []Interface{*DefaultNetworkInterface()} + obj.Spec.Networks = []Network{*DefaultPodNetwork()} + } +} + +func DefaultNetworkInterface() *Interface { + iface := &Interface{ + Name: "default", + InterfaceBindingMethod: InterfaceBindingMethod{ + Bridge: &InterfaceBridge{}, + }, + } + return iface +} + +func DefaultSlirpNetworkInterface() *Interface { + iface := &Interface{ + Name: "default", + InterfaceBindingMethod: InterfaceBindingMethod{ + Slirp: &InterfaceSlirp{}, + }, + } + return iface +} + +func DefaultPodNetwork() *Network { + defaultNet := &Network{ + Name: "default", + NetworkSource: NetworkSource{ + Pod: &PodNetwork{}, + }, + } + return defaultNet +} + func diskBusFromMachine(machine string) string { // catches: "q35", "pc-q35-*" // see /path/to/qemu-kvm -machine help diff --git a/vendor/kubevirt.io/kubevirt/pkg/api/v1/openapi_generated.go b/vendor/kubevirt.io/kubevirt/pkg/api/v1/openapi_generated.go index ed83687b4..07f7626f2 100644 --- a/vendor/kubevirt.io/kubevirt/pkg/api/v1/openapi_generated.go +++ b/vendor/kubevirt.io/kubevirt/pkg/api/v1/openapi_generated.go @@ -30,7 +30,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "kubevirt.io/kubevirt/pkg/api/v1.Affinity": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "Affinity groups all the affinity rules related to a VM", + Description: "Affinity groups all the affinity rules related to a VirtualMachineInstance", Properties: map[string]spec.Schema{ "nodeAffinity": { SchemaProps: spec.SchemaProps{ @@ -38,11 +38,23 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA Ref: ref("k8s.io/api/core/v1.NodeAffinity"), }, }, + "podAffinity": { + SchemaProps: spec.SchemaProps{ + Description: "Pod affinity support", + Ref: ref("k8s.io/api/core/v1.PodAffinity"), + }, + }, + "podAntiAffinity": { + SchemaProps: spec.SchemaProps{ + Description: "Pod anti-affinity support", + Ref: ref("k8s.io/api/core/v1.PodAntiAffinity"), + }, + }, }, }, }, Dependencies: []string{ - "k8s.io/api/core/v1.NodeAffinity"}, + "k8s.io/api/core/v1.NodeAffinity", "k8s.io/api/core/v1.PodAffinity", "k8s.io/api/core/v1.PodAntiAffinity"}, }, "kubevirt.io/kubevirt/pkg/api/v1.CDRomTarget": { Schema: spec.Schema{ @@ -50,21 +62,21 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA Properties: map[string]spec.Schema{ "bus": { SchemaProps: spec.SchemaProps{ - Description: "Bus indicates the type of disk device to emulate. supported values: virtio, sata, scsi, ide", + Description: "Bus indicates the type of disk device to emulate. supported values: virtio, sata, scsi, ide.", Type: []string{"string"}, Format: "", }, }, "readonly": { SchemaProps: spec.SchemaProps{ - Description: "ReadOnly Defaults to true", + Description: "ReadOnly. Defaults to true.", Type: []string{"boolean"}, Format: "", }, }, "tray": { SchemaProps: spec.SchemaProps{ - Description: "Tray indicates if the tray of the device is open or closed. Allowed values are \"open\" and \"closed\" Defaults to closed", + Description: "Tray indicates if the tray of the device is open or closed. Allowed values are \"open\" and \"closed\". Defaults to closed.", Type: []string{"string"}, Format: "", }, @@ -77,15 +89,22 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "kubevirt.io/kubevirt/pkg/api/v1.CPU": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "CPU allow specifying the CPU topology", + Description: "CPU allows specifying the CPU topology.", Properties: map[string]spec.Schema{ "cores": { SchemaProps: spec.SchemaProps{ - Description: "Cores specifies the number of cores inside the vm. Must be a value greater or equal 1.", + Description: "Cores specifies the number of cores inside the vmi. Must be a value greater or equal 1.", Type: []string{"integer"}, Format: "int64", }, }, + "model": { + SchemaProps: spec.SchemaProps{ + Description: "Model specifies the CPU model inside the VMI. List of available models https://github.com/libvirt/libvirt/blob/master/src/cpu/cpu_map.xml.", + Type: []string{"string"}, + Format: "", + }, + }, }, }, }, @@ -94,7 +113,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "kubevirt.io/kubevirt/pkg/api/v1.Clock": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "Represents the clock and timers of a vm", + Description: "Represents the clock and timers of a vmi.", Properties: map[string]spec.Schema{ "utc": { SchemaProps: spec.SchemaProps{ @@ -104,7 +123,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA }, "timezone": { SchemaProps: spec.SchemaProps{ - Description: "Timezone sets the guest clock to the specified timezone. Zone name follows the TZ environment variable format (e.g. 'America/New_York')", + Description: "Timezone sets the guest clock to the specified timezone. Zone name follows the TZ environment variable format (e.g. 'America/New_York').", Type: []string{"string"}, Format: "", }, @@ -128,7 +147,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA }, "timezone": { SchemaProps: spec.SchemaProps{ - Description: "Timezone sets the guest clock to the specified timezone. Zone name follows the TZ environment variable format (e.g. 'America/New_York')", + Description: "Timezone sets the guest clock to the specified timezone. Zone name follows the TZ environment variable format (e.g. 'America/New_York').", Type: []string{"string"}, Format: "", }, @@ -159,24 +178,24 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "kubevirt.io/kubevirt/pkg/api/v1.CloudInitNoCloudSource": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "Represents a cloud-init nocloud user data source More info: http://cloudinit.readthedocs.io/en/latest/topics/datasources/nocloud.html", + Description: "Represents a cloud-init nocloud user data source. More info: http://cloudinit.readthedocs.io/en/latest/topics/datasources/nocloud.html", Properties: map[string]spec.Schema{ "secretRef": { SchemaProps: spec.SchemaProps{ - Description: "UserDataSecretRef references a k8s secret that contains NoCloud userdata", + Description: "UserDataSecretRef references a k8s secret that contains NoCloud userdata.", Ref: ref("k8s.io/api/core/v1.LocalObjectReference"), }, }, "userDataBase64": { SchemaProps: spec.SchemaProps{ - Description: "UserDataBase64 contains NoCloud cloud-init userdata as a base64 encoded string", + Description: "UserDataBase64 contains NoCloud cloud-init userdata as a base64 encoded string.", Type: []string{"string"}, Format: "", }, }, "userData": { SchemaProps: spec.SchemaProps{ - Description: "UserData contains NoCloud inline cloud-init userdata", + Description: "UserData contains NoCloud inline cloud-init userdata.", Type: []string{"string"}, Format: "", }, @@ -193,7 +212,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA Properties: map[string]spec.Schema{ "disks": { SchemaProps: spec.SchemaProps{ - Description: "Disks describes disks, cdroms, floppy and luns which are connected to the vm", + Description: "Disks describes disks, cdroms, floppy and luns which are connected to the vmi.", Type: []string{"array"}, Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ @@ -206,15 +225,28 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA }, "watchdog": { SchemaProps: spec.SchemaProps{ - Description: "Watchdog describes a watchdog device which can be added to the vm", + Description: "Watchdog describes a watchdog device which can be added to the vmi.", Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.Watchdog"), }, }, + "interfaces": { + SchemaProps: spec.SchemaProps{ + Description: "Interfaces describe network interfaces which are added to the vm.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.Interface"), + }, + }, + }, + }, + }, }, }, }, Dependencies: []string{ - "kubevirt.io/kubevirt/pkg/api/v1.Disk", "kubevirt.io/kubevirt/pkg/api/v1.Watchdog"}, + "kubevirt.io/kubevirt/pkg/api/v1.Disk", "kubevirt.io/kubevirt/pkg/api/v1.Interface", "kubevirt.io/kubevirt/pkg/api/v1.Watchdog"}, }, "kubevirt.io/kubevirt/pkg/api/v1.Disk": { Schema: spec.Schema{ @@ -229,35 +261,49 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA }, "volumeName": { SchemaProps: spec.SchemaProps{ - Description: "Name of the volume which is referenced Must match the Name of a Volume.", + Description: "Name of the volume which is referenced. Must match the Name of a Volume.", Type: []string{"string"}, Format: "", }, }, "disk": { SchemaProps: spec.SchemaProps{ - Description: "Attach a volume as a disk to the vm", + Description: "Attach a volume as a disk to the vmi.", Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.DiskTarget"), }, }, "lun": { SchemaProps: spec.SchemaProps{ - Description: "Attach a volume as a LUN to the vm", + Description: "Attach a volume as a LUN to the vmi.", Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.LunTarget"), }, }, "floppy": { SchemaProps: spec.SchemaProps{ - Description: "Attach a volume as a floppy to the vm", + Description: "Attach a volume as a floppy to the vmi.", Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.FloppyTarget"), }, }, "cdrom": { SchemaProps: spec.SchemaProps{ - Description: "Attach a volume as a cdrom to the vm", + Description: "Attach a volume as a cdrom to the vmi.", Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.CDRomTarget"), }, }, + "bootOrder": { + SchemaProps: spec.SchemaProps{ + Description: "BootOrder is an integer value > 0, used to determine ordering of boot devices. Lower values take precedence. Disks without a boot order are not tried if a disk with a boot order exists.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "serial": { + SchemaProps: spec.SchemaProps{ + Description: "Serial provides the ability to specify a serial number for the disk device.", + Type: []string{"string"}, + Format: "", + }, + }, }, Required: []string{"name", "volumeName"}, }, @@ -272,25 +318,25 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA Properties: map[string]spec.Schema{ "disk": { SchemaProps: spec.SchemaProps{ - Description: "Attach a volume as a disk to the vm", + Description: "Attach a volume as a disk to the vmi.", Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.DiskTarget"), }, }, "lun": { SchemaProps: spec.SchemaProps{ - Description: "Attach a volume as a LUN to the vm", + Description: "Attach a volume as a LUN to the vmi.", Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.LunTarget"), }, }, "floppy": { SchemaProps: spec.SchemaProps{ - Description: "Attach a volume as a floppy to the vm", + Description: "Attach a volume as a floppy to the vmi.", Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.FloppyTarget"), }, }, "cdrom": { SchemaProps: spec.SchemaProps{ - Description: "Attach a volume as a cdrom to the vm", + Description: "Attach a volume as a cdrom to the vmi.", Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.CDRomTarget"), }, }, @@ -306,14 +352,14 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA Properties: map[string]spec.Schema{ "bus": { SchemaProps: spec.SchemaProps{ - Description: "Bus indicates the type of disk device to emulate. supported values: virtio, sata, scsi, ide", + Description: "Bus indicates the type of disk device to emulate. supported values: virtio, sata, scsi, ide.", Type: []string{"string"}, Format: "", }, }, "readonly": { SchemaProps: spec.SchemaProps{ - Description: "ReadOnly Defaults to false", + Description: "ReadOnly. Defaults to false.", Type: []string{"boolean"}, Format: "", }, @@ -323,43 +369,107 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA }, Dependencies: []string{}, }, + "kubevirt.io/kubevirt/pkg/api/v1.DomainPresetSpec": { + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Properties: map[string]spec.Schema{ + "resources": { + SchemaProps: spec.SchemaProps{ + Description: "Resources describes the Compute Resources required by this vmi.", + Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.ResourceRequirements"), + }, + }, + "cpu": { + SchemaProps: spec.SchemaProps{ + Description: "CPU allow specified the detailed CPU topology inside the vmi.", + Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.CPU"), + }, + }, + "memory": { + SchemaProps: spec.SchemaProps{ + Description: "Memory allow specifying the VMI memory features.", + Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.Memory"), + }, + }, + "machine": { + SchemaProps: spec.SchemaProps{ + Description: "Machine type.", + Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.Machine"), + }, + }, + "firmware": { + SchemaProps: spec.SchemaProps{ + Description: "Firmware.", + Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.Firmware"), + }, + }, + "clock": { + SchemaProps: spec.SchemaProps{ + Description: "Clock sets the clock and timers of the vmi.", + Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.Clock"), + }, + }, + "features": { + SchemaProps: spec.SchemaProps{ + Description: "Features like acpi, apic, hyperv.", + Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.Features"), + }, + }, + "devices": { + SchemaProps: spec.SchemaProps{ + Description: "Devices allows adding disks, network interfaces, ...", + Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.Devices"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "kubevirt.io/kubevirt/pkg/api/v1.CPU", "kubevirt.io/kubevirt/pkg/api/v1.Clock", "kubevirt.io/kubevirt/pkg/api/v1.Devices", "kubevirt.io/kubevirt/pkg/api/v1.Features", "kubevirt.io/kubevirt/pkg/api/v1.Firmware", "kubevirt.io/kubevirt/pkg/api/v1.Machine", "kubevirt.io/kubevirt/pkg/api/v1.Memory", "kubevirt.io/kubevirt/pkg/api/v1.ResourceRequirements"}, + }, "kubevirt.io/kubevirt/pkg/api/v1.DomainSpec": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ Properties: map[string]spec.Schema{ "resources": { SchemaProps: spec.SchemaProps{ - Description: "Resources describes the Compute Resources required by this vm.", + Description: "Resources describes the Compute Resources required by this vmi.", Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.ResourceRequirements"), }, }, "cpu": { SchemaProps: spec.SchemaProps{ - Description: "CPU allow specified the detailed CPU topology inside the vm.", + Description: "CPU allow specified the detailed CPU topology inside the vmi.", Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.CPU"), }, }, + "memory": { + SchemaProps: spec.SchemaProps{ + Description: "Memory allow specifying the VMI memory features.", + Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.Memory"), + }, + }, "machine": { SchemaProps: spec.SchemaProps{ - Description: "Machine type", + Description: "Machine type.", Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.Machine"), }, }, "firmware": { SchemaProps: spec.SchemaProps{ - Description: "Firmware", + Description: "Firmware.", Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.Firmware"), }, }, "clock": { SchemaProps: spec.SchemaProps{ - Description: "Clock sets the clock and timers of the vm.", + Description: "Clock sets the clock and timers of the vmi.", Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.Clock"), }, }, "features": { SchemaProps: spec.SchemaProps{ - Description: "Features like acpi, apic, hyperv", + Description: "Features like acpi, apic, hyperv.", Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.Features"), }, }, @@ -374,12 +484,12 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA }, }, Dependencies: []string{ - "kubevirt.io/kubevirt/pkg/api/v1.CPU", "kubevirt.io/kubevirt/pkg/api/v1.Clock", "kubevirt.io/kubevirt/pkg/api/v1.Devices", "kubevirt.io/kubevirt/pkg/api/v1.Features", "kubevirt.io/kubevirt/pkg/api/v1.Firmware", "kubevirt.io/kubevirt/pkg/api/v1.Machine", "kubevirt.io/kubevirt/pkg/api/v1.ResourceRequirements"}, + "kubevirt.io/kubevirt/pkg/api/v1.CPU", "kubevirt.io/kubevirt/pkg/api/v1.Clock", "kubevirt.io/kubevirt/pkg/api/v1.Devices", "kubevirt.io/kubevirt/pkg/api/v1.Features", "kubevirt.io/kubevirt/pkg/api/v1.Firmware", "kubevirt.io/kubevirt/pkg/api/v1.Machine", "kubevirt.io/kubevirt/pkg/api/v1.Memory", "kubevirt.io/kubevirt/pkg/api/v1.ResourceRequirements"}, }, "kubevirt.io/kubevirt/pkg/api/v1.EmptyDiskSource": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "EmptyDisk represents a temporary disk which shares the vms lifecycle", + Description: "EmptyDisk represents a temporary disk which shares the vmis lifecycle.", Properties: map[string]spec.Schema{ "capacity": { SchemaProps: spec.SchemaProps{ @@ -400,7 +510,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA Properties: map[string]spec.Schema{ "persistentVolumeClaim": { SchemaProps: spec.SchemaProps{ - Description: "PersistentVolumeClaimVolumeSource represents a reference to a PersistentVolumeClaim in the same namespace. Directly attached to the vm via qemu. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims", + Description: "PersistentVolumeClaimVolumeSource represents a reference to a PersistentVolumeClaim in the same namespace. Directly attached to the vmi via qemu. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims", Ref: ref("k8s.io/api/core/v1.PersistentVolumeClaimVolumeSource"), }, }, @@ -416,14 +526,14 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA Properties: map[string]spec.Schema{ "enabled": { SchemaProps: spec.SchemaProps{ - Description: "Enabled determines if the feature should be enabled or disabled on the guest Defaults to true", + Description: "Enabled determines if the feature should be enabled or disabled on the guest. Defaults to true.", Type: []string{"boolean"}, Format: "", }, }, "endOfInterrupt": { SchemaProps: spec.SchemaProps{ - Description: "EndOfInterrupt enables the end of interrupt notification in the guest Defaults to false", + Description: "EndOfInterrupt enables the end of interrupt notification in the guest. Defaults to false.", Type: []string{"boolean"}, Format: "", }, @@ -436,59 +546,59 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "kubevirt.io/kubevirt/pkg/api/v1.FeatureHyperv": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "Hyperv specific features", + Description: "Hyperv specific features.", Properties: map[string]spec.Schema{ "relaxed": { SchemaProps: spec.SchemaProps{ - Description: "Relaxed relaxes constraints on timer Defaults to the machine type setting", + Description: "Relaxed relaxes constraints on timer. Defaults to the machine type setting.", Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.FeatureState"), }, }, "vapic": { SchemaProps: spec.SchemaProps{ - Description: "VAPIC indicates whether virtual APIC is enabled Defaults to the machine type setting", + Description: "VAPIC indicates whether virtual APIC is enabled. Defaults to the machine type setting.", Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.FeatureState"), }, }, "spinlocks": { SchemaProps: spec.SchemaProps{ - Description: "Spinlocks indicates if spinlocks should be made available to the guest", + Description: "Spinlocks indicates if spinlocks should be made available to the guest.", Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.FeatureSpinlocks"), }, }, "vpindex": { SchemaProps: spec.SchemaProps{ - Description: "VPIndex enables the Virtual Processor Index to help windows identifying virtual processors Defaults to the machine type setting", + Description: "VPIndex enables the Virtual Processor Index to help windows identifying virtual processors. Defaults to the machine type setting.", Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.FeatureState"), }, }, "runtime": { SchemaProps: spec.SchemaProps{ - Description: "Runtime Defaults to the machine type setting", + Description: "Runtime. Defaults to the machine type setting.", Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.FeatureState"), }, }, "synic": { SchemaProps: spec.SchemaProps{ - Description: "SyNIC enable Synthetic Interrupt Controller Defaults to the machine type setting", + Description: "SyNIC enable Synthetic Interrupt Controller. Defaults to the machine type setting.", Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.FeatureState"), }, }, "synictimer": { SchemaProps: spec.SchemaProps{ - Description: "SyNICTimer enable Synthetic Interrupt Controller timer Defaults to the machine type setting", + Description: "SyNICTimer enable Synthetic Interrupt Controller timer. Defaults to the machine type setting.", Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.FeatureState"), }, }, "reset": { SchemaProps: spec.SchemaProps{ - Description: "Reset enables Hyperv reboot/reset for the vm Defaults to the machine type setting", + Description: "Reset enables Hyperv reboot/reset for the vmi. Defaults to the machine type setting.", Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.FeatureState"), }, }, "vendorid": { SchemaProps: spec.SchemaProps{ - Description: "VendorID allows setting the hypervisor vendor id Defaults to the machine type setting", + Description: "VendorID allows setting the hypervisor vendor id. Defaults to the machine type setting.", Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.FeatureVendorID"), }, }, @@ -504,14 +614,14 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA Properties: map[string]spec.Schema{ "enabled": { SchemaProps: spec.SchemaProps{ - Description: "Enabled determines if the feature should be enabled or disabled on the guest Defaults to true", + Description: "Enabled determines if the feature should be enabled or disabled on the guest. Defaults to true.", Type: []string{"boolean"}, Format: "", }, }, "spinlocks": { SchemaProps: spec.SchemaProps{ - Description: "Retries indicates the number of retries Must be a value greater or equal 4096 Defaults to 4096", + Description: "Retries indicates the number of retries. Must be a value greater or equal 4096. Defaults to 4096.", Type: []string{"integer"}, Format: "int64", }, @@ -524,11 +634,11 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "kubevirt.io/kubevirt/pkg/api/v1.FeatureState": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "Represents if a feature is enabled or disabled", + Description: "Represents if a feature is enabled or disabled.", Properties: map[string]spec.Schema{ "enabled": { SchemaProps: spec.SchemaProps{ - Description: "Enabled determines if the feature should be enabled or disabled on the guest Defaults to true", + Description: "Enabled determines if the feature should be enabled or disabled on the guest. Defaults to true.", Type: []string{"boolean"}, Format: "", }, @@ -544,14 +654,14 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA Properties: map[string]spec.Schema{ "enabled": { SchemaProps: spec.SchemaProps{ - Description: "Enabled determines if the feature should be enabled or disabled on the guest Defaults to true", + Description: "Enabled determines if the feature should be enabled or disabled on the guest. Defaults to true.", Type: []string{"boolean"}, Format: "", }, }, "vendorid": { SchemaProps: spec.SchemaProps{ - Description: "VendorID sets the hypervisor vendor id, visible to the vm String up to twelve characters", + Description: "VendorID sets the hypervisor vendor id, visible to the vmi. String up to twelve characters.", Type: []string{"string"}, Format: "", }, @@ -567,19 +677,19 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA Properties: map[string]spec.Schema{ "acpi": { SchemaProps: spec.SchemaProps{ - Description: "ACPI enables/disables ACPI insidejsondata guest Defaults to enabled", + Description: "ACPI enables/disables ACPI insidejsondata guest. Defaults to enabled.", Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.FeatureState"), }, }, "apic": { SchemaProps: spec.SchemaProps{ - Description: "Defaults to the machine type setting", + Description: "Defaults to the machine type setting.", Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.FeatureAPIC"), }, }, "hyperv": { SchemaProps: spec.SchemaProps{ - Description: "Defaults to the machine type setting", + Description: "Defaults to the machine type setting.", Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.FeatureHyperv"), }, }, @@ -595,7 +705,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA Properties: map[string]spec.Schema{ "uuid": { SchemaProps: spec.SchemaProps{ - Description: "UUID reported by the vm bios Defaults to a random generated uid", + Description: "UUID reported by the vmi bios. Defaults to a random generated uid.", Type: []string{"string"}, Format: "", }, @@ -611,14 +721,14 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA Properties: map[string]spec.Schema{ "readonly": { SchemaProps: spec.SchemaProps{ - Description: "ReadOnly Defaults to false", + Description: "ReadOnly. Defaults to false.", Type: []string{"boolean"}, Format: "", }, }, "tray": { SchemaProps: spec.SchemaProps{ - Description: "Tray indicates if the tray of the device is open or closed. Allowed values are \"open\" and \"closed\" Defaults to closed", + Description: "Tray indicates if the tray of the device is open or closed. Allowed values are \"open\" and \"closed\". Defaults to closed.", Type: []string{"string"}, Format: "", }, @@ -634,30 +744,14 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA Properties: map[string]spec.Schema{ "tickPolicy": { SchemaProps: spec.SchemaProps{ - Description: "TickPolicy determines what happens when QEMU misses a deadline for injecting a tick to the guest One of \"delay\", \"catchup\", \"merge\", \"discard\"", + Description: "TickPolicy determines what happens when QEMU misses a deadline for injecting a tick to the guest. One of \"delay\", \"catchup\", \"merge\", \"discard\".", Type: []string{"string"}, Format: "", }, }, "present": { SchemaProps: spec.SchemaProps{ - Description: "Enabled set to false makes sure that the machine type or a preset can't add the timer. Defaults to true", - Type: []string{"boolean"}, - Format: "", - }, - }, - }, - }, - }, - Dependencies: []string{}, - }, - "kubevirt.io/kubevirt/pkg/api/v1.HypervTimer": { - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Properties: map[string]spec.Schema{ - "present": { - SchemaProps: spec.SchemaProps{ - Description: "Enabled set to false makes sure that the machine type or a preset can't add the timer. Defaults to true", + Description: "Enabled set to false makes sure that the machine type or a preset can't add the timer. Defaults to true.", Type: []string{"boolean"}, Format: "", }, @@ -667,14 +761,14 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA }, Dependencies: []string{}, }, - "kubevirt.io/kubevirt/pkg/api/v1.I6300ESBWatchdog": { + "kubevirt.io/kubevirt/pkg/api/v1.Hugepages": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "i6300esb watchdog device", + Description: "Hugepages allow to use hugepages for the VirtualMachineInstance instead of regular memory.", Properties: map[string]spec.Schema{ - "action": { + "pageSize": { SchemaProps: spec.SchemaProps{ - Description: "The action to take. Valid values are poweroff, reset, shutdown. Defaults to reset", + Description: "PageSize specifies the hugepage size, for x86_64 architecture valid values are 1Gi and 2Mi.", Type: []string{"string"}, Format: "", }, @@ -684,13 +778,13 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA }, Dependencies: []string{}, }, - "kubevirt.io/kubevirt/pkg/api/v1.KVMTimer": { + "kubevirt.io/kubevirt/pkg/api/v1.HypervTimer": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ Properties: map[string]spec.Schema{ "present": { SchemaProps: spec.SchemaProps{ - Description: "Enabled set to false makes sure that the machine type or a preset can't add the timer. Defaults to true", + Description: "Enabled set to false makes sure that the machine type or a preset can't add the timer. Defaults to true.", Type: []string{"boolean"}, Format: "", }, @@ -700,226 +794,227 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA }, Dependencies: []string{}, }, - "kubevirt.io/kubevirt/pkg/api/v1.LunTarget": { + "kubevirt.io/kubevirt/pkg/api/v1.I6300ESBWatchdog": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ + Description: "i6300esb watchdog device.", Properties: map[string]spec.Schema{ - "bus": { + "action": { SchemaProps: spec.SchemaProps{ - Description: "Bus indicates the type of disk device to emulate. supported values: virtio, sata, scsi, ide", + Description: "The action to take. Valid values are poweroff, reset, shutdown. Defaults to reset.", Type: []string{"string"}, Format: "", }, }, - "readonly": { - SchemaProps: spec.SchemaProps{ - Description: "ReadOnly Defaults to false", - Type: []string{"boolean"}, - Format: "", - }, - }, }, }, }, Dependencies: []string{}, }, - "kubevirt.io/kubevirt/pkg/api/v1.Machine": { + "kubevirt.io/kubevirt/pkg/api/v1.Interface": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ Properties: map[string]spec.Schema{ - "type": { + "name": { SchemaProps: spec.SchemaProps{ - Description: "QEMU machine type is the actual chipset of the VM.", + Description: "Logical name of the interface as well as a reference to the associated networks. Must match the Name of a Network.", Type: []string{"string"}, Format: "", }, }, - }, - Required: []string{"type"}, - }, - }, - Dependencies: []string{}, - }, - "kubevirt.io/kubevirt/pkg/api/v1.OfflineVirtualMachine": { - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "OfflineVirtualMachine handles the VirtualMachines that are not running or are in a stopped state The OfflineVirtualMachine contains the template to create the VirtualMachine. It also mirrors the running state of the created VirtualMachine in its status.", - Properties: map[string]spec.Schema{ - "kind": { + "model": { SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Description: "Interface model. One of: e1000, e1000e, ne2k_pci, pcnet, rtl8139, virtio. Defaults to virtio.", Type: []string{"string"}, Format: "", }, }, - "apiVersion": { + "bridge": { SchemaProps: spec.SchemaProps{ - 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", - Type: []string{"string"}, - Format: "", + Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.InterfaceBridge"), }, }, - "metadata": { + "slirp": { SchemaProps: spec.SchemaProps{ - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.InterfaceSlirp"), }, }, - "spec": { + "ports": { SchemaProps: spec.SchemaProps{ - Description: "Spec contains the specification of VirtualMachine created", - Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.OfflineVirtualMachineSpec"), + Description: "List of ports to be forwarded to the virtual machine.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.Port"), + }, + }, + }, }, }, - "status": { + "macAddress": { SchemaProps: spec.SchemaProps{ - Description: "Status holds the current state of the controller and brief information about its associated VirtualMachine", - Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.OfflineVirtualMachineStatus"), + Description: "Interface MAC address. For example: de:ad:00:00:be:af or DE-AD-00-00-BE-AF.", + Type: []string{"string"}, + Format: "", }, }, }, + Required: []string{"name"}, }, }, Dependencies: []string{ - "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta", "kubevirt.io/kubevirt/pkg/api/v1.OfflineVirtualMachineSpec", "kubevirt.io/kubevirt/pkg/api/v1.OfflineVirtualMachineStatus"}, + "kubevirt.io/kubevirt/pkg/api/v1.InterfaceBridge", "kubevirt.io/kubevirt/pkg/api/v1.InterfaceSlirp", "kubevirt.io/kubevirt/pkg/api/v1.Port"}, }, - "kubevirt.io/kubevirt/pkg/api/v1.OfflineVirtualMachineCondition": { + "kubevirt.io/kubevirt/pkg/api/v1.InterfaceBindingMethod": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "OfflineVirtualMachineCondition represents the state of OfflineVirtualMachine", + Description: "Represents the method which will be used to connect the interface to the guest. Only one of its members may be specified.", Properties: map[string]spec.Schema{ - "type": { - SchemaProps: spec.SchemaProps{ - Type: []string{"string"}, - Format: "", - }, - }, - "status": { - SchemaProps: spec.SchemaProps{ - Type: []string{"string"}, - Format: "", - }, - }, - "lastProbeTime": { - SchemaProps: spec.SchemaProps{ - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), - }, - }, - "lastTransitionTime": { + "bridge": { SchemaProps: spec.SchemaProps{ - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), + Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.InterfaceBridge"), }, }, - "reason": { + "slirp": { SchemaProps: spec.SchemaProps{ - Type: []string{"string"}, - Format: "", + Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.InterfaceSlirp"), }, }, - "message": { + }, + }, + }, + Dependencies: []string{ + "kubevirt.io/kubevirt/pkg/api/v1.InterfaceBridge", "kubevirt.io/kubevirt/pkg/api/v1.InterfaceSlirp"}, + }, + "kubevirt.io/kubevirt/pkg/api/v1.InterfaceBridge": { + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Properties: map[string]spec.Schema{}, + }, + }, + Dependencies: []string{}, + }, + "kubevirt.io/kubevirt/pkg/api/v1.InterfaceSlirp": { + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Properties: map[string]spec.Schema{}, + }, + }, + Dependencies: []string{}, + }, + "kubevirt.io/kubevirt/pkg/api/v1.KVMTimer": { + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Properties: map[string]spec.Schema{ + "present": { SchemaProps: spec.SchemaProps{ - Type: []string{"string"}, - Format: "", + Description: "Enabled set to false makes sure that the machine type or a preset can't add the timer. Defaults to true.", + Type: []string{"boolean"}, + Format: "", }, }, }, - Required: []string{"type", "status"}, }, }, - Dependencies: []string{ - "k8s.io/apimachinery/pkg/apis/meta/v1.Time"}, + Dependencies: []string{}, }, - "kubevirt.io/kubevirt/pkg/api/v1.OfflineVirtualMachineList": { + "kubevirt.io/kubevirt/pkg/api/v1.LunTarget": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "OfflineVirtualMachineList is a list of offlinevirtualmachines", Properties: map[string]spec.Schema{ - "kind": { + "bus": { SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Description: "Bus indicates the type of disk device to emulate. supported values: virtio, sata, scsi, ide.", Type: []string{"string"}, Format: "", }, }, - "apiVersion": { + "readonly": { SchemaProps: spec.SchemaProps{ - 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", - Type: []string{"string"}, + Description: "ReadOnly. Defaults to false.", + Type: []string{"boolean"}, Format: "", }, }, - "metadata": { + }, + }, + }, + Dependencies: []string{}, + }, + "kubevirt.io/kubevirt/pkg/api/v1.Machine": { + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Properties: map[string]spec.Schema{ + "type": { SchemaProps: spec.SchemaProps{ - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + Description: "QEMU machine type is the actual chipset of the VirtualMachineInstance.", + Type: []string{"string"}, + Format: "", }, }, - "items": { + }, + Required: []string{"type"}, + }, + }, + Dependencies: []string{}, + }, + "kubevirt.io/kubevirt/pkg/api/v1.Memory": { + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Memory allows specifying the VirtualMachineInstance memory features.", + Properties: map[string]spec.Schema{ + "hugepages": { SchemaProps: spec.SchemaProps{ - Description: "Items is a list of OfflineVirtualMachines", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.OfflineVirtualMachine"), - }, - }, - }, + Description: "Hugepages allow to use hugepages for the VirtualMachineInstance instead of regular memory.", + Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.Hugepages"), }, }, }, - Required: []string{"metadata", "items"}, }, }, Dependencies: []string{ - "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta", "kubevirt.io/kubevirt/pkg/api/v1.OfflineVirtualMachine"}, + "kubevirt.io/kubevirt/pkg/api/v1.Hugepages"}, }, - "kubevirt.io/kubevirt/pkg/api/v1.OfflineVirtualMachineSpec": { + "kubevirt.io/kubevirt/pkg/api/v1.Network": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "OfflineVirtualMachineSpec describes how the proper OfflineVirtualMachine should look like", + Description: "Network represents a network type and a resource that should be connected to the vm.", Properties: map[string]spec.Schema{ - "running": { + "name": { SchemaProps: spec.SchemaProps{ - Description: "Running controlls whether the associatied VirtualMachine is created or not", - Type: []string{"boolean"}, + Description: "Network name. Must be a DNS_LABEL and unique within the vm. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", + Type: []string{"string"}, Format: "", }, }, - "template": { + "pod": { SchemaProps: spec.SchemaProps{ - Description: "Template is the direct specification of VirtualMachine", - Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.VMTemplateSpec"), + Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.PodNetwork"), }, }, }, - Required: []string{"running", "template"}, + Required: []string{"name"}, }, }, Dependencies: []string{ - "kubevirt.io/kubevirt/pkg/api/v1.VMTemplateSpec"}, + "kubevirt.io/kubevirt/pkg/api/v1.PodNetwork"}, }, - "kubevirt.io/kubevirt/pkg/api/v1.OfflineVirtualMachineStatus": { + "kubevirt.io/kubevirt/pkg/api/v1.NetworkSource": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "OfflineVirtualMachineStatus represents the status returned by the controller to describe how the OfflineVirtualMachine is doing", + Description: "Represents the source resource that will be connected to the vm. Only one of its members may be specified.", Properties: map[string]spec.Schema{ - "conditions": { + "pod": { SchemaProps: spec.SchemaProps{ - Description: "Hold the state information of the OfflineVirtualMachine and its VirtualMachine", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.OfflineVirtualMachineCondition"), - }, - }, - }, + Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.PodNetwork"), }, }, }, }, }, Dependencies: []string{ - "kubevirt.io/kubevirt/pkg/api/v1.OfflineVirtualMachineCondition"}, + "kubevirt.io/kubevirt/pkg/api/v1.PodNetwork"}, }, "kubevirt.io/kubevirt/pkg/api/v1.PITTimer": { Schema: spec.Schema{ @@ -927,14 +1022,14 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA Properties: map[string]spec.Schema{ "tickPolicy": { SchemaProps: spec.SchemaProps{ - Description: "TickPolicy determines what happens when QEMU misses a deadline for injecting a tick to the guest One of \"delay\", \"catchup\", \"discard\"", + Description: "TickPolicy determines what happens when QEMU misses a deadline for injecting a tick to the guest. One of \"delay\", \"catchup\", \"discard\".", Type: []string{"string"}, Format: "", }, }, "present": { SchemaProps: spec.SchemaProps{ - Description: "Enabled set to false makes sure that the machine type or a preset can't add the timer. Defaults to true", + Description: "Enabled set to false makes sure that the machine type or a preset can't add the timer. Defaults to true.", Type: []string{"boolean"}, Format: "", }, @@ -944,27 +1039,76 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA }, Dependencies: []string{}, }, - "kubevirt.io/kubevirt/pkg/api/v1.RTCTimer": { + "kubevirt.io/kubevirt/pkg/api/v1.PodNetwork": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ + Description: "Represents the stock pod network interface.", Properties: map[string]spec.Schema{ - "tickPolicy": { + "vmNetworkCIDR": { SchemaProps: spec.SchemaProps{ - Description: "TickPolicy determines what happens when QEMU misses a deadline for injecting a tick to the guest One of \"delay\", \"catchup\"", + Description: "CIDR for vm network. Default 10.0.2.0/24 if not specified.", Type: []string{"string"}, Format: "", }, }, - "present": { - SchemaProps: spec.SchemaProps{ - Description: "Enabled set to false makes sure that the machine type or a preset can't add the timer. Defaults to true", + }, + }, + }, + Dependencies: []string{}, + }, + "kubevirt.io/kubevirt/pkg/api/v1.Port": { + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Port repesents a port to expose from the virtual machine. Default protocol TCP. The port field is mandatory", + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "If specified, this must be an IANA_SVC_NAME and unique within the pod. Each named port in a pod must have a unique name. Name for the port that can be referred to by services.", + Type: []string{"string"}, + Format: "", + }, + }, + "protocol": { + SchemaProps: spec.SchemaProps{ + Description: "Protocol for port. Must be UDP or TCP. Defaults to \"TCP\".", + Type: []string{"string"}, + Format: "", + }, + }, + "port": { + SchemaProps: spec.SchemaProps{ + Description: "Number of port to expose for the virtual machine. This must be a valid port number, 0 < x < 65536.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + }, + Required: []string{"port"}, + }, + }, + Dependencies: []string{}, + }, + "kubevirt.io/kubevirt/pkg/api/v1.RTCTimer": { + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Properties: map[string]spec.Schema{ + "tickPolicy": { + SchemaProps: spec.SchemaProps{ + Description: "TickPolicy determines what happens when QEMU misses a deadline for injecting a tick to the guest. One of \"delay\", \"catchup\".", + Type: []string{"string"}, + Format: "", + }, + }, + "present": { + SchemaProps: spec.SchemaProps{ + Description: "Enabled set to false makes sure that the machine type or a preset can't add the timer. Defaults to true.", Type: []string{"boolean"}, Format: "", }, }, "track": { SchemaProps: spec.SchemaProps{ - Description: "Track the guest or the wall clock", + Description: "Track the guest or the wall clock.", Type: []string{"string"}, Format: "", }, @@ -977,11 +1121,11 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "kubevirt.io/kubevirt/pkg/api/v1.RegistryDiskSource": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "Represents a docker image with an embedded disk", + Description: "Represents a docker image with an embedded disk.", Properties: map[string]spec.Schema{ "image": { SchemaProps: spec.SchemaProps{ - Description: "Image is the name of the image with the embedded disk", + Description: "Image is the name of the image with the embedded disk.", Type: []string{"string"}, Format: "", }, @@ -1005,7 +1149,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA Properties: map[string]spec.Schema{ "requests": { SchemaProps: spec.SchemaProps{ - Description: "Requests is a description of the initial vm resources. Valid resource keys are \"memory\" and \"cpu\".", + Description: "Requests is a description of the initial vmi resources. Valid resource keys are \"memory\" and \"cpu\".", Type: []string{"object"}, AdditionalProperties: &spec.SchemaOrBool{ Schema: &spec.Schema{ @@ -1038,7 +1182,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "kubevirt.io/kubevirt/pkg/api/v1.Timer": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "Represents all available timers in a vm", + Description: "Represents all available timers in a vmi.", Properties: map[string]spec.Schema{ "hpet": { SchemaProps: spec.SchemaProps{ @@ -1076,149 +1220,98 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA Dependencies: []string{ "kubevirt.io/kubevirt/pkg/api/v1.HPETTimer", "kubevirt.io/kubevirt/pkg/api/v1.HypervTimer", "kubevirt.io/kubevirt/pkg/api/v1.KVMTimer", "kubevirt.io/kubevirt/pkg/api/v1.PITTimer", "kubevirt.io/kubevirt/pkg/api/v1.RTCTimer"}, }, - "kubevirt.io/kubevirt/pkg/api/v1.VMReplicaSetCondition": { + "kubevirt.io/kubevirt/pkg/api/v1.VirtualMachine": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ + Description: "VirtualMachine handles the VirtualMachines that are not running or are in a stopped state The VirtualMachine contains the template to create the VirtualMachineInstance. It also mirrors the running state of the created VirtualMachineInstance in its status.", Properties: map[string]spec.Schema{ - "type": { - SchemaProps: spec.SchemaProps{ - Type: []string{"string"}, - Format: "", - }, - }, - "status": { + "kind": { SchemaProps: spec.SchemaProps{ - Type: []string{"string"}, - Format: "", + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", }, }, - "lastProbeTime": { + "apiVersion": { SchemaProps: spec.SchemaProps{ - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), + 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", + Type: []string{"string"}, + Format: "", }, }, - "lastTransitionTime": { + "metadata": { SchemaProps: spec.SchemaProps{ - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), }, }, - "reason": { + "spec": { SchemaProps: spec.SchemaProps{ - Type: []string{"string"}, - Format: "", + Description: "Spec contains the specification of VirtualMachineInstance created", + Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineSpec"), }, }, - "message": { + "status": { SchemaProps: spec.SchemaProps{ - Type: []string{"string"}, - Format: "", + Description: "Status holds the current state of the controller and brief information about its associated VirtualMachineInstance", + Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineStatus"), }, }, }, - Required: []string{"type", "status"}, }, }, Dependencies: []string{ - "k8s.io/apimachinery/pkg/apis/meta/v1.Time"}, + "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta", "kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineSpec", "kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineStatus"}, }, - "kubevirt.io/kubevirt/pkg/api/v1.VMReplicaSetSpec": { + "kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineCondition": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ + Description: "VirtualMachineCondition represents the state of VirtualMachine", Properties: map[string]spec.Schema{ - "replicas": { - SchemaProps: spec.SchemaProps{ - Description: "Number of desired pods. This is a pointer to distinguish between explicit zero and not specified. Defaults to 1.", - Type: []string{"integer"}, - Format: "int32", - }, - }, - "selector": { - SchemaProps: spec.SchemaProps{ - Description: "Label selector for pods. Existing ReplicaSets whose pods are selected by this will be the ones affected by this deployment.", - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"), - }, - }, - "template": { - SchemaProps: spec.SchemaProps{ - Description: "Template describes the pods that will be created.", - Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.VMTemplateSpec"), - }, - }, - "paused": { + "type": { SchemaProps: spec.SchemaProps{ - Description: "Indicates that the replica set is paused.", - Type: []string{"boolean"}, - Format: "", + Type: []string{"string"}, + Format: "", }, }, - }, - Required: []string{"template"}, - }, - }, - Dependencies: []string{ - "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector", "kubevirt.io/kubevirt/pkg/api/v1.VMTemplateSpec"}, - }, - "kubevirt.io/kubevirt/pkg/api/v1.VMReplicaSetStatus": { - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Properties: map[string]spec.Schema{ - "replicas": { + "status": { SchemaProps: spec.SchemaProps{ - Description: "Total number of non-terminated pods targeted by this deployment (their labels match the selector).", - Type: []string{"integer"}, - Format: "int32", + Type: []string{"string"}, + Format: "", }, }, - "readyReplicas": { + "lastProbeTime": { SchemaProps: spec.SchemaProps{ - Description: "The number of ready replicas for this replica set.", - Type: []string{"integer"}, - Format: "int32", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), }, }, - "conditions": { + "lastTransitionTime": { SchemaProps: spec.SchemaProps{ - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.VMReplicaSetCondition"), - }, - }, - }, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), }, }, - }, - }, - }, - Dependencies: []string{ - "kubevirt.io/kubevirt/pkg/api/v1.VMReplicaSetCondition"}, - }, - "kubevirt.io/kubevirt/pkg/api/v1.VMTemplateSpec": { - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Properties: map[string]spec.Schema{ - "metadata": { + "reason": { SchemaProps: spec.SchemaProps{ - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + Type: []string{"string"}, + Format: "", }, }, - "spec": { + "message": { SchemaProps: spec.SchemaProps{ - Description: "VM Spec contains the VM specification.", - Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineSpec"), + Type: []string{"string"}, + Format: "", }, }, }, + Required: []string{"type", "status"}, }, }, Dependencies: []string{ - "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta", "kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineSpec"}, + "k8s.io/apimachinery/pkg/apis/meta/v1.Time"}, }, - "kubevirt.io/kubevirt/pkg/api/v1.VirtualMachine": { + "kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineInstance": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "VirtualMachine is *the* VM Definition. It represents a virtual machine in the runtime environment of kubernetes.", + Description: "VirtualMachineInstance is *the* VirtualMachineInstance Definition. It represents a virtual machine in the runtime environment of kubernetes.", Properties: map[string]spec.Schema{ "kind": { SchemaProps: spec.SchemaProps{ @@ -1241,23 +1334,23 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA }, "spec": { SchemaProps: spec.SchemaProps{ - Description: "VM Spec contains the VM specification.", - Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineSpec"), + Description: "VirtualMachineInstance Spec contains the VirtualMachineInstance specification.", + Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineInstanceSpec"), }, }, "status": { SchemaProps: spec.SchemaProps{ - Description: "Status is the high level overview of how the VM is doing. It contains information available to controllers and users.", - Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineStatus"), + Description: "Status is the high level overview of how the VirtualMachineInstance is doing. It contains information available to controllers and users.", + Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineInstanceStatus"), }, }, }, }, }, Dependencies: []string{ - "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta", "kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineSpec", "kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineStatus"}, + "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta", "kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineInstanceSpec", "kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineInstanceStatus"}, }, - "kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineCondition": { + "kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineInstanceCondition": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ Properties: map[string]spec.Schema{ @@ -1302,10 +1395,10 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA Dependencies: []string{ "k8s.io/apimachinery/pkg/apis/meta/v1.Time"}, }, - "kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineList": { + "kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineInstanceList": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "VirtualMachineList is a list of VirtualMachines", + Description: "VirtualMachineInstanceList is a list of VirtualMachines", Properties: map[string]spec.Schema{ "kind": { SchemaProps: spec.SchemaProps{ @@ -1332,7 +1425,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.VirtualMachine"), + Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineInstance"), }, }, }, @@ -1343,9 +1436,9 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA }, }, Dependencies: []string{ - "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta", "kubevirt.io/kubevirt/pkg/api/v1.VirtualMachine"}, + "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta", "kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineInstance"}, }, - "kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineNetworkInterface": { + "kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineInstanceNetworkInterface": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ Properties: map[string]spec.Schema{ @@ -1368,7 +1461,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA }, Dependencies: []string{}, }, - "kubevirt.io/kubevirt/pkg/api/v1.VirtualMachinePreset": { + "kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineInstancePreset": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ Properties: map[string]spec.Schema{ @@ -1393,20 +1486,20 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA }, "spec": { SchemaProps: spec.SchemaProps{ - Description: "VM Spec contains the VM specification.", - Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.VirtualMachinePresetSpec"), + Description: "VirtualMachineInstance Spec contains the VirtualMachineInstance specification.", + Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineInstancePresetSpec"), }, }, }, }, }, Dependencies: []string{ - "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta", "kubevirt.io/kubevirt/pkg/api/v1.VirtualMachinePresetSpec"}, + "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta", "kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineInstancePresetSpec"}, }, - "kubevirt.io/kubevirt/pkg/api/v1.VirtualMachinePresetList": { + "kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineInstancePresetList": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "VirtualMachinePresetList is a list of VirtualMachinePresets", + Description: "VirtualMachineInstancePresetList is a list of VirtualMachinePresets", Properties: map[string]spec.Schema{ "kind": { SchemaProps: spec.SchemaProps{ @@ -1433,7 +1526,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.VirtualMachinePreset"), + Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineInstancePreset"), }, }, }, @@ -1444,22 +1537,22 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA }, }, Dependencies: []string{ - "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta", "kubevirt.io/kubevirt/pkg/api/v1.VirtualMachinePreset"}, + "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta", "kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineInstancePreset"}, }, - "kubevirt.io/kubevirt/pkg/api/v1.VirtualMachinePresetSpec": { + "kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineInstancePresetSpec": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ Properties: map[string]spec.Schema{ "selector": { SchemaProps: spec.SchemaProps{ - Description: "Selector is a label query over a set of VMs. Required.", + Description: "Selector is a label query over a set of VMIs. Required.", Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"), }, }, "domain": { SchemaProps: spec.SchemaProps{ - Description: "Domain is the same object type as contained in VirtualMachineSpec", - Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.DomainSpec"), + Description: "Domain is the same object type as contained in VirtualMachineInstanceSpec", + Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.DomainPresetSpec"), }, }, }, @@ -1467,12 +1560,12 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA }, }, Dependencies: []string{ - "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector", "kubevirt.io/kubevirt/pkg/api/v1.DomainSpec"}, + "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector", "kubevirt.io/kubevirt/pkg/api/v1.DomainPresetSpec"}, }, - "kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineReplicaSet": { + "kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineInstanceReplicaSet": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "VM is *the* VM Definition. It represents a virtual machine in the runtime environment of kubernetes.", + Description: "VirtualMachineInstance is *the* VirtualMachineInstance Definition. It represents a virtual machine in the runtime environment of kubernetes.", Properties: map[string]spec.Schema{ "kind": { SchemaProps: spec.SchemaProps{ @@ -1495,26 +1588,71 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA }, "spec": { SchemaProps: spec.SchemaProps{ - Description: "VM Spec contains the VM specification.", - Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.VMReplicaSetSpec"), + Description: "VirtualMachineInstance Spec contains the VirtualMachineInstance specification.", + Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineInstanceReplicaSetSpec"), }, }, "status": { SchemaProps: spec.SchemaProps{ - Description: "Status is the high level overview of how the VM is doing. It contains information available to controllers and users.", - Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.VMReplicaSetStatus"), + Description: "Status is the high level overview of how the VirtualMachineInstance is doing. It contains information available to controllers and users.", + Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineInstanceReplicaSetStatus"), }, }, }, }, }, Dependencies: []string{ - "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta", "kubevirt.io/kubevirt/pkg/api/v1.VMReplicaSetSpec", "kubevirt.io/kubevirt/pkg/api/v1.VMReplicaSetStatus"}, + "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta", "kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineInstanceReplicaSetSpec", "kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineInstanceReplicaSetStatus"}, }, - "kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineReplicaSetList": { + "kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineInstanceReplicaSetCondition": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "VMList is a list of VMs", + Properties: map[string]spec.Schema{ + "type": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "lastProbeTime": { + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), + }, + }, + "lastTransitionTime": { + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), + }, + }, + "reason": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "message": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"type", "status"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.Time"}, + }, + "kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineInstanceReplicaSetList": { + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "VMIList is a list of VMIs", Properties: map[string]spec.Schema{ "kind": { SchemaProps: spec.SchemaProps{ @@ -1541,7 +1679,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineReplicaSet"), + Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineInstanceReplicaSet"), }, }, }, @@ -1552,22 +1690,95 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA }, }, Dependencies: []string{ - "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta", "kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineReplicaSet"}, + "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta", "kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineInstanceReplicaSet"}, }, - "kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineSpec": { + "kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineInstanceReplicaSetSpec": { + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Properties: map[string]spec.Schema{ + "replicas": { + SchemaProps: spec.SchemaProps{ + Description: "Number of desired pods. This is a pointer to distinguish between explicit zero and not specified. Defaults to 1.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "selector": { + SchemaProps: spec.SchemaProps{ + Description: "Label selector for pods. Existing ReplicaSets whose pods are selected by this will be the ones affected by this deployment.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"), + }, + }, + "template": { + SchemaProps: spec.SchemaProps{ + Description: "Template describes the pods that will be created.", + Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineInstanceTemplateSpec"), + }, + }, + "paused": { + SchemaProps: spec.SchemaProps{ + Description: "Indicates that the replica set is paused.", + Type: []string{"boolean"}, + Format: "", + }, + }, + }, + Required: []string{"selector", "template"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector", "kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineInstanceTemplateSpec"}, + }, + "kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineInstanceReplicaSetStatus": { + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Properties: map[string]spec.Schema{ + "replicas": { + SchemaProps: spec.SchemaProps{ + Description: "Total number of non-terminated pods targeted by this deployment (their labels match the selector).", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "readyReplicas": { + SchemaProps: spec.SchemaProps{ + Description: "The number of ready replicas for this replica set.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "conditions": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineInstanceReplicaSetCondition"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineInstanceReplicaSetCondition"}, + }, + "kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineInstanceSpec": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "VirtualMachineSpec is a description of a VirtualMachine.", + Description: "VirtualMachineInstanceSpec is a description of a VirtualMachineInstance.", Properties: map[string]spec.Schema{ "domain": { SchemaProps: spec.SchemaProps{ - Description: "Specification of the desired behavior of the VirtualMachine on the host.", + Description: "Specification of the desired behavior of the VirtualMachineInstance on the host.", Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.DomainSpec"), }, }, "nodeSelector": { SchemaProps: spec.SchemaProps{ - Description: "NodeSelector is a selector which must be true for the vm to fit on a node. Selector which must match a node's labels for the vm to be scheduled on that node. More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/", + Description: "NodeSelector is a selector which must be true for the vmi to fit on a node. Selector which must match a node's labels for the vmi to be scheduled on that node. More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/", Type: []string{"object"}, AdditionalProperties: &spec.SchemaOrBool{ Schema: &spec.Schema{ @@ -1587,14 +1798,14 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA }, "terminationGracePeriodSeconds": { SchemaProps: spec.SchemaProps{ - Description: "Grace period observed after signalling a VM to stop after which the VM is force terminated.", + Description: "Grace period observed after signalling a VirtualMachineInstance to stop after which the VirtualMachineInstance is force terminated.", Type: []string{"integer"}, Format: "int64", }, }, "volumes": { SchemaProps: spec.SchemaProps{ - Description: "List of volumes that can be mounted by disks belonging to the vm.", + Description: "List of volumes that can be mounted by disks belonging to the vmi.", Type: []string{"array"}, Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ @@ -1605,33 +1816,60 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA }, }, }, + "hostname": { + SchemaProps: spec.SchemaProps{ + Description: "Specifies the hostname of the vmi If not specified, the hostname will be set to the name of the vmi, if dhcp or cloud-init is configured properly.", + Type: []string{"string"}, + Format: "", + }, + }, + "subdomain": { + SchemaProps: spec.SchemaProps{ + Description: "If specified, the fully qualified vmi hostname will be \"...svc.\". If not specified, the vmi will not have a domainname at all. The DNS entry will resolve to the vmi, no matter if the vmi itself can pick up a hostname.", + Type: []string{"string"}, + Format: "", + }, + }, + "networks": { + SchemaProps: spec.SchemaProps{ + Description: "List of networks that can be attached to a vm's virtual interface.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.Network"), + }, + }, + }, + }, + }, }, Required: []string{"domain"}, }, }, Dependencies: []string{ - "kubevirt.io/kubevirt/pkg/api/v1.Affinity", "kubevirt.io/kubevirt/pkg/api/v1.DomainSpec", "kubevirt.io/kubevirt/pkg/api/v1.Volume"}, + "kubevirt.io/kubevirt/pkg/api/v1.Affinity", "kubevirt.io/kubevirt/pkg/api/v1.DomainSpec", "kubevirt.io/kubevirt/pkg/api/v1.Network", "kubevirt.io/kubevirt/pkg/api/v1.Volume"}, }, - "kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineStatus": { + "kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineInstanceStatus": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "VirtualMachineStatus represents information about the status of a VM. Status may trail the actual state of a system.", + Description: "VirtualMachineInstanceStatus represents information about the status of a VirtualMachineInstance. Status may trail the actual state of a system.", Properties: map[string]spec.Schema{ "nodeName": { SchemaProps: spec.SchemaProps{ - Description: "NodeName is the name where the VM is currently running.", + Description: "NodeName is the name where the VirtualMachineInstance is currently running.", Type: []string{"string"}, Format: "", }, }, "conditions": { SchemaProps: spec.SchemaProps{ - Description: "Conditions are specific points in VM's pod runtime.", + Description: "Conditions are specific points in VirtualMachineInstance's pod runtime.", Type: []string{"array"}, Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineCondition"), + Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineInstanceCondition"), }, }, }, @@ -1639,7 +1877,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA }, "phase": { SchemaProps: spec.SchemaProps{ - Description: "Phase is the status of the VM in kubernetes world. It is not the VM status, but partially correlates to it.", + Description: "Phase is the status of the VirtualMachineInstance in kubernetes world. It is not the VirtualMachineInstance status, but partially correlates to it.", Type: []string{"string"}, Format: "", }, @@ -1651,7 +1889,135 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineNetworkInterface"), + Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineInstanceNetworkInterface"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineInstanceCondition", "kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineInstanceNetworkInterface"}, + }, + "kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineInstanceTemplateSpec": { + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Properties: map[string]spec.Schema{ + "metadata": { + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Description: "VirtualMachineInstance Spec contains the VirtualMachineInstance specification.", + Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineInstanceSpec"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta", "kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineInstanceSpec"}, + }, + "kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineList": { + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "VirtualMachineList is a list of virtualmachines", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + 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", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Description: "Items is a list of VirtualMachines", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.VirtualMachine"), + }, + }, + }, + }, + }, + }, + Required: []string{"metadata", "items"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta", "kubevirt.io/kubevirt/pkg/api/v1.VirtualMachine"}, + }, + "kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineSpec": { + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "VirtualMachineSpec describes how the proper VirtualMachine should look like", + Properties: map[string]spec.Schema{ + "running": { + SchemaProps: spec.SchemaProps{ + Description: "Running controls whether the associatied VirtualMachineInstance is created or not", + Type: []string{"boolean"}, + Format: "", + }, + }, + "template": { + SchemaProps: spec.SchemaProps{ + Description: "Template is the direct specification of VirtualMachineInstance", + Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineInstanceTemplateSpec"), + }, + }, + }, + Required: []string{"running", "template"}, + }, + }, + Dependencies: []string{ + "kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineInstanceTemplateSpec"}, + }, + "kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineStatus": { + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "VirtualMachineStatus represents the status returned by the controller to describe how the VirtualMachine is doing", + Properties: map[string]spec.Schema{ + "created": { + SchemaProps: spec.SchemaProps{ + Description: "Created indicates if the virtual machine is created in the cluster", + Type: []string{"boolean"}, + Format: "", + }, + }, + "ready": { + SchemaProps: spec.SchemaProps{ + Description: "Ready indicates if the virtual machine is running and ready", + Type: []string{"boolean"}, + Format: "", + }, + }, + "conditions": { + SchemaProps: spec.SchemaProps{ + Description: "Hold the state information of the VirtualMachine and its VirtualMachineInstance", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineCondition"), }, }, }, @@ -1661,35 +2027,35 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA }, }, Dependencies: []string{ - "kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineCondition", "kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineNetworkInterface"}, + "kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineCondition"}, }, "kubevirt.io/kubevirt/pkg/api/v1.Volume": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "Volume represents a named volume in a vm.", + Description: "Volume represents a named volume in a vmi.", Properties: map[string]spec.Schema{ "name": { SchemaProps: spec.SchemaProps{ - Description: "Volume's name. Must be a DNS_LABEL and unique within the vm. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", + Description: "Volume's name. Must be a DNS_LABEL and unique within the vmi. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", Type: []string{"string"}, Format: "", }, }, "persistentVolumeClaim": { SchemaProps: spec.SchemaProps{ - Description: "PersistentVolumeClaimVolumeSource represents a reference to a PersistentVolumeClaim in the same namespace. Directly attached to the vm via qemu. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims", + Description: "PersistentVolumeClaimVolumeSource represents a reference to a PersistentVolumeClaim in the same namespace. Directly attached to the vmi via qemu. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims", Ref: ref("k8s.io/api/core/v1.PersistentVolumeClaimVolumeSource"), }, }, "cloudInitNoCloud": { SchemaProps: spec.SchemaProps{ - Description: "CloudInitNoCloud represents a cloud-init NoCloud user-data source. The NoCloud data will be added as a disk to the vm. A proper cloud-init installation is required inside the guest. More info: http://cloudinit.readthedocs.io/en/latest/topics/datasources/nocloud.html", + Description: "CloudInitNoCloud represents a cloud-init NoCloud user-data source. The NoCloud data will be added as a disk to the vmi. A proper cloud-init installation is required inside the guest. More info: http://cloudinit.readthedocs.io/en/latest/topics/datasources/nocloud.html", Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.CloudInitNoCloudSource"), }, }, "registryDisk": { SchemaProps: spec.SchemaProps{ - Description: "RegistryDisk references a docker image, embedding a qcow or raw disk More info: https://kubevirt.gitbooks.io/user-guide/registry-disk.html", + Description: "RegistryDisk references a docker image, embedding a qcow or raw disk. More info: https://kubevirt.gitbooks.io/user-guide/registry-disk.html", Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.RegistryDiskSource"), }, }, @@ -1701,7 +2067,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA }, "emptyDisk": { SchemaProps: spec.SchemaProps{ - Description: "EmptyDisk represents a temporary disk which shares the vms lifecycle More info: https://kubevirt.gitbooks.io/user-guide/disks-and-volumes.html", + Description: "EmptyDisk represents a temporary disk which shares the vmis lifecycle. More info: https://kubevirt.gitbooks.io/user-guide/disks-and-volumes.html", Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.EmptyDiskSource"), }, }, @@ -1719,19 +2085,19 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA Properties: map[string]spec.Schema{ "persistentVolumeClaim": { SchemaProps: spec.SchemaProps{ - Description: "PersistentVolumeClaimVolumeSource represents a reference to a PersistentVolumeClaim in the same namespace. Directly attached to the vm via qemu. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims", + Description: "PersistentVolumeClaimVolumeSource represents a reference to a PersistentVolumeClaim in the same namespace. Directly attached to the vmi via qemu. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims", Ref: ref("k8s.io/api/core/v1.PersistentVolumeClaimVolumeSource"), }, }, "cloudInitNoCloud": { SchemaProps: spec.SchemaProps{ - Description: "CloudInitNoCloud represents a cloud-init NoCloud user-data source. The NoCloud data will be added as a disk to the vm. A proper cloud-init installation is required inside the guest. More info: http://cloudinit.readthedocs.io/en/latest/topics/datasources/nocloud.html", + Description: "CloudInitNoCloud represents a cloud-init NoCloud user-data source. The NoCloud data will be added as a disk to the vmi. A proper cloud-init installation is required inside the guest. More info: http://cloudinit.readthedocs.io/en/latest/topics/datasources/nocloud.html", Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.CloudInitNoCloudSource"), }, }, "registryDisk": { SchemaProps: spec.SchemaProps{ - Description: "RegistryDisk references a docker image, embedding a qcow or raw disk More info: https://kubevirt.gitbooks.io/user-guide/registry-disk.html", + Description: "RegistryDisk references a docker image, embedding a qcow or raw disk. More info: https://kubevirt.gitbooks.io/user-guide/registry-disk.html", Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.RegistryDiskSource"), }, }, @@ -1743,7 +2109,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA }, "emptyDisk": { SchemaProps: spec.SchemaProps{ - Description: "EmptyDisk represents a temporary disk which shares the vms lifecycle More info: https://kubevirt.gitbooks.io/user-guide/disks-and-volumes.html", + Description: "EmptyDisk represents a temporary disk which shares the vmis lifecycle. More info: https://kubevirt.gitbooks.io/user-guide/disks-and-volumes.html", Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.EmptyDiskSource"), }, }, @@ -1756,18 +2122,18 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "kubevirt.io/kubevirt/pkg/api/v1.Watchdog": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "Named watchdog device", + Description: "Named watchdog device.", Properties: map[string]spec.Schema{ "name": { SchemaProps: spec.SchemaProps{ - Description: "Name of the watchdog", + Description: "Name of the watchdog.", Type: []string{"string"}, Format: "", }, }, "i6300esb": { SchemaProps: spec.SchemaProps{ - Description: "i6300esb watchdog device", + Description: "i6300esb watchdog device.", Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.I6300ESBWatchdog"), }, }, @@ -1781,11 +2147,11 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "kubevirt.io/kubevirt/pkg/api/v1.WatchdogDevice": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "Hardware watchdog device Exactly one of its members must be set.", + Description: "Hardware watchdog device. Exactly one of its members must be set.", Properties: map[string]spec.Schema{ "i6300esb": { SchemaProps: spec.SchemaProps{ - Description: "i6300esb watchdog device", + Description: "i6300esb watchdog device.", Ref: ref("kubevirt.io/kubevirt/pkg/api/v1.I6300ESBWatchdog"), }, }, diff --git a/vendor/kubevirt.io/kubevirt/pkg/api/v1/schema.go b/vendor/kubevirt.io/kubevirt/pkg/api/v1/schema.go index 409d8fce4..35d289699 100644 --- a/vendor/kubevirt.io/kubevirt/pkg/api/v1/schema.go +++ b/vendor/kubevirt.io/kubevirt/pkg/api/v1/schema.go @@ -32,18 +32,18 @@ import ( ATTENTION: Rerun code generators when comments on structs or fields are modified. */ -// Represents a cloud-init nocloud user data source +// Represents a cloud-init nocloud user data source. // More info: http://cloudinit.readthedocs.io/en/latest/topics/datasources/nocloud.html // --- // +k8s:openapi-gen=true type CloudInitNoCloudSource struct { - // UserDataSecretRef references a k8s secret that contains NoCloud userdata + // UserDataSecretRef references a k8s secret that contains NoCloud userdata. // + optional UserDataSecretRef *v1.LocalObjectReference `json:"secretRef,omitempty"` - // UserDataBase64 contains NoCloud cloud-init userdata as a base64 encoded string + // UserDataBase64 contains NoCloud cloud-init userdata as a base64 encoded string. // + optional UserDataBase64 string `json:"userDataBase64,omitempty"` - // UserData contains NoCloud inline cloud-init userdata + // UserData contains NoCloud inline cloud-init userdata. // + optional UserData string `json:"userData,omitempty"` } @@ -51,31 +51,62 @@ type CloudInitNoCloudSource struct { // --- // +k8s:openapi-gen=true type DomainSpec struct { - // Resources describes the Compute Resources required by this vm. + // Resources describes the Compute Resources required by this vmi. Resources ResourceRequirements `json:"resources,omitempty"` - // CPU allow specified the detailed CPU topology inside the vm. + // CPU allow specified the detailed CPU topology inside the vmi. // +optional CPU *CPU `json:"cpu,omitempty"` - // Machine type + // Memory allow specifying the VMI memory features. + // +optional + Memory *Memory `json:"memory,omitempty"` + // Machine type. // +optional Machine Machine `json:"machine,omitempty"` - // Firmware + // Firmware. // +optional Firmware *Firmware `json:"firmware,omitempty"` - // Clock sets the clock and timers of the vm. + // Clock sets the clock and timers of the vmi. // +optional Clock *Clock `json:"clock,omitempty"` - // Features like acpi, apic, hyperv + // Features like acpi, apic, hyperv. // +optional Features *Features `json:"features,omitempty"` // Devices allows adding disks, network interfaces, ... Devices Devices `json:"devices"` } +// --- +// +k8s:openapi-gen=true +type DomainPresetSpec struct { + // Resources describes the Compute Resources required by this vmi. + Resources ResourceRequirements `json:"resources,omitempty"` + // CPU allow specified the detailed CPU topology inside the vmi. + // +optional + CPU *CPU `json:"cpu,omitempty"` + // Memory allow specifying the VMI memory features. + // +optional + Memory *Memory `json:"memory,omitempty"` + // Machine type. + // +optional + Machine Machine `json:"machine,omitempty"` + // Firmware. + // +optional + Firmware *Firmware `json:"firmware,omitempty"` + // Clock sets the clock and timers of the vmi. + // +optional + Clock *Clock `json:"clock,omitempty"` + // Features like acpi, apic, hyperv. + // +optional + Features *Features `json:"features,omitempty"` + // Devices allows adding disks, network interfaces, ... + // +optional + Devices Devices `json:"devices,omitempty"` +} + // --- // +k8s:openapi-gen=true type ResourceRequirements struct { - // Requests is a description of the initial vm resources. + // Requests is a description of the initial vmi resources. // Valid resource keys are "memory" and "cpu". // +optional Requests v1.ResourceList `json:"requests,omitempty"` @@ -85,37 +116,60 @@ type ResourceRequirements struct { Limits v1.ResourceList `json:"limits,omitempty"` } -// CPU allow specifying the CPU topology +// CPU allows specifying the CPU topology. // --- // +k8s:openapi-gen=true type CPU struct { - // Cores specifies the number of cores inside the vm. + // Cores specifies the number of cores inside the vmi. // Must be a value greater or equal 1. Cores uint32 `json:"cores,omitempty"` + // Model specifies the CPU model inside the VMI. + // List of available models https://github.com/libvirt/libvirt/blob/master/src/cpu/cpu_map.xml. + // +optional + Model string `json:"model,omitempty"` +} + +// Memory allows specifying the VirtualMachineInstance memory features. +// --- +// +k8s:openapi-gen=true +type Memory struct { + // Hugepages allow to use hugepages for the VirtualMachineInstance instead of regular memory. + // +optional + Hugepages *Hugepages `json:"hugepages,omitempty"` +} + +// Hugepages allow to use hugepages for the VirtualMachineInstance instead of regular memory. +// --- +// +k8s:openapi-gen=true +type Hugepages struct { + // PageSize specifies the hugepage size, for x86_64 architecture valid values are 1Gi and 2Mi. + PageSize string `json:"pageSize,omitempty"` } // --- // +k8s:openapi-gen=true type Machine struct { - // QEMU machine type is the actual chipset of the VM. + // QEMU machine type is the actual chipset of the VirtualMachineInstance. Type string `json:"type"` } // --- // +k8s:openapi-gen=true type Firmware struct { - // UUID reported by the vm bios - // Defaults to a random generated uid + // UUID reported by the vmi bios. + // Defaults to a random generated uid. UUID types.UID `json:"uuid,omitempty"` } // --- // +k8s:openapi-gen=true type Devices struct { - // Disks describes disks, cdroms, floppy and luns which are connected to the vm + // Disks describes disks, cdroms, floppy and luns which are connected to the vmi. Disks []Disk `json:"disks,omitempty"` - // Watchdog describes a watchdog device which can be added to the vm + // Watchdog describes a watchdog device which can be added to the vmi. Watchdog *Watchdog `json:"watchdog,omitempty"` + // Interfaces describe network interfaces which are added to the vm. + Interfaces []Interface `json:"interfaces,omitempty"` } // --- @@ -123,12 +177,20 @@ type Devices struct { type Disk struct { // Name is the device name Name string `json:"name"` - // Name of the volume which is referenced + // Name of the volume which is referenced. // Must match the Name of a Volume. VolumeName string `json:"volumeName"` - // DiskDevice specifies as which device the disk should be added to the guest - // Defaults to Disk + // DiskDevice specifies as which device the disk should be added to the guest. + // Defaults to Disk. DiskDevice `json:",inline"` + // BootOrder is an integer value > 0, used to determine ordering of boot devices. + // Lower values take precedence. + // Disks without a boot order are not tried if a disk with a boot order exists. + // +optional + BootOrder *uint `json:"bootOrder,omitempty"` + // Serial provides the ability to specify a serial number for the disk device. + // +optional + Serial string `json:"serial,omitempty"` } // Represents the target of a volume to mount. @@ -136,13 +198,13 @@ type Disk struct { // --- // +k8s:openapi-gen=true type DiskDevice struct { - // Attach a volume as a disk to the vm + // Attach a volume as a disk to the vmi. Disk *DiskTarget `json:"disk,omitempty"` - // Attach a volume as a LUN to the vm + // Attach a volume as a LUN to the vmi. LUN *LunTarget `json:"lun,omitempty"` - // Attach a volume as a floppy to the vm + // Attach a volume as a floppy to the vmi. Floppy *FloppyTarget `json:"floppy,omitempty"` - // Attach a volume as a cdrom to the vm + // Attach a volume as a cdrom to the vmi. CDRom *CDRomTarget `json:"cdrom,omitempty"` } @@ -150,10 +212,10 @@ type DiskDevice struct { // +k8s:openapi-gen=true type DiskTarget struct { // Bus indicates the type of disk device to emulate. - // supported values: virtio, sata, scsi, ide + // supported values: virtio, sata, scsi, ide. Bus string `json:"bus,omitempty"` - // ReadOnly - // Defaults to false + // ReadOnly. + // Defaults to false. ReadOnly bool `json:"readonly,omitempty"` } @@ -161,35 +223,35 @@ type DiskTarget struct { // +k8s:openapi-gen=true type LunTarget struct { // Bus indicates the type of disk device to emulate. - // supported values: virtio, sata, scsi, ide + // supported values: virtio, sata, scsi, ide. Bus string `json:"bus,omitempty"` - // ReadOnly - // Defaults to false + // ReadOnly. + // Defaults to false. ReadOnly bool `json:"readonly,omitempty"` } // --- // +k8s:openapi-gen=true type FloppyTarget struct { - // ReadOnly - // Defaults to false + // ReadOnly. + // Defaults to false. ReadOnly bool `json:"readonly,omitempty"` // Tray indicates if the tray of the device is open or closed. - // Allowed values are "open" and "closed" - // Defaults to closed + // Allowed values are "open" and "closed". + // Defaults to closed. // +optional Tray TrayState `json:"tray,omitempty"` } -// TrayState indicates if a tray of a cdrom or floppy is open or closed +// TrayState indicates if a tray of a cdrom or floppy is open or closed. // --- // +k8s:openapi-gen=true type TrayState string const ( - // TrayStateOpen indicates that the tray of a cdrom or floppy is open + // TrayStateOpen indicates that the tray of a cdrom or floppy is open. TrayStateOpen TrayState = "open" - // TrayStateClosed indicates that the tray of a cdrom or floppy is closed + // TrayStateClosed indicates that the tray of a cdrom or floppy is closed. TrayStateClosed TrayState = "closed" ) @@ -197,28 +259,28 @@ const ( // +k8s:openapi-gen=true type CDRomTarget struct { // Bus indicates the type of disk device to emulate. - // supported values: virtio, sata, scsi, ide + // supported values: virtio, sata, scsi, ide. Bus string `json:"bus,omitempty"` - // ReadOnly - // Defaults to true + // ReadOnly. + // Defaults to true. ReadOnly *bool `json:"readonly,omitempty"` // Tray indicates if the tray of the device is open or closed. - // Allowed values are "open" and "closed" - // Defaults to closed + // Allowed values are "open" and "closed". + // Defaults to closed. // +optional Tray TrayState `json:"tray,omitempty"` } -// Volume represents a named volume in a vm. +// Volume represents a named volume in a vmi. // --- // +k8s:openapi-gen=true type Volume struct { // Volume's name. - // Must be a DNS_LABEL and unique within the vm. + // Must be a DNS_LABEL and unique within the vmi. // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names Name string `json:"name"` // VolumeSource represents the location and type of the mounted volume. - // Defaults to Disk, if no type is specified + // Defaults to Disk, if no type is specified. VolumeSource `json:",inline"` } @@ -228,23 +290,23 @@ type Volume struct { // +k8s:openapi-gen=true type VolumeSource struct { // PersistentVolumeClaimVolumeSource represents a reference to a PersistentVolumeClaim in the same namespace. - // Directly attached to the vm via qemu. + // Directly attached to the vmi via qemu. // More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims // +optional PersistentVolumeClaim *v1.PersistentVolumeClaimVolumeSource `json:"persistentVolumeClaim,omitempty"` // CloudInitNoCloud represents a cloud-init NoCloud user-data source. - // The NoCloud data will be added as a disk to the vm. A proper cloud-init installation is required inside the guest. + // The NoCloud data will be added as a disk to the vmi. A proper cloud-init installation is required inside the guest. // More info: http://cloudinit.readthedocs.io/en/latest/topics/datasources/nocloud.html // +optional CloudInitNoCloud *CloudInitNoCloudSource `json:"cloudInitNoCloud,omitempty"` - // RegistryDisk references a docker image, embedding a qcow or raw disk + // RegistryDisk references a docker image, embedding a qcow or raw disk. // More info: https://kubevirt.gitbooks.io/user-guide/registry-disk.html // +optional RegistryDisk *RegistryDiskSource `json:"registryDisk,omitempty"` // Ephemeral is a special volume source that "wraps" specified source and provides copy-on-write image on top of it. // +optional Ephemeral *EphemeralVolumeSource `json:"ephemeral,omitempty"` - // EmptyDisk represents a temporary disk which shares the vms lifecycle + // EmptyDisk represents a temporary disk which shares the vmis lifecycle. // More info: https://kubevirt.gitbooks.io/user-guide/disks-and-volumes.html // +optional EmptyDisk *EmptyDiskSource `json:"emptyDisk,omitempty"` @@ -254,13 +316,13 @@ type VolumeSource struct { // +k8s:openapi-gen=true type EphemeralVolumeSource struct { // PersistentVolumeClaimVolumeSource represents a reference to a PersistentVolumeClaim in the same namespace. - // Directly attached to the vm via qemu. + // Directly attached to the vmi via qemu. // More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims // +optional PersistentVolumeClaim *v1.PersistentVolumeClaimVolumeSource `json:"persistentVolumeClaim,omitempty"` } -// EmptyDisk represents a temporary disk which shares the vms lifecycle +// EmptyDisk represents a temporary disk which shares the vmis lifecycle. // --- // +k8s:openapi-gen=true type EmptyDiskSource struct { @@ -268,11 +330,11 @@ type EmptyDiskSource struct { Capacity resource.Quantity `json:"capacity"` } -// Represents a docker image with an embedded disk +// Represents a docker image with an embedded disk. // --- // +k8s:openapi-gen=true type RegistryDiskSource struct { - // Image is the name of the image with the embedded disk + // Image is the name of the image with the embedded disk. Image string `json:"image"` // ImagePullSecret is the name of the Docker registry secret required to pull the image. The secret must already exist. ImagePullSecret string `json:"imagePullSecret,omitempty"` @@ -286,7 +348,7 @@ type ClockOffset struct { // guest changes to the clock will be kept during reboots and are not reset. UTC *ClockOffsetUTC `json:"utc,omitempty"` // Timezone sets the guest clock to the specified timezone. - // Zone name follows the TZ environment variable format (e.g. 'America/New_York') + // Zone name follows the TZ environment variable format (e.g. 'America/New_York'). Timezone *ClockOffsetTimezone `json:"timezone,omitempty"` } @@ -300,22 +362,22 @@ type ClockOffsetUTC struct { } // ClockOffsetTimezone sets the guest clock to the specified timezone. -// Zone name follows the TZ environment variable format (e.g. 'America/New_York') +// Zone name follows the TZ environment variable format (e.g. 'America/New_York'). // --- // +k8s:openapi-gen=true type ClockOffsetTimezone string -// Represents the clock and timers of a vm +// Represents the clock and timers of a vmi. // --- // +k8s:openapi-gen=true type Clock struct { - // ClockOffset allows specifying the UTC offset or the timezone of the guest clock + // ClockOffset allows specifying the UTC offset or the timezone of the guest clock. ClockOffset `json:",inline"` - // Timer specifies whih timers are attached to the vm + // Timer specifies whih timers are attached to the vmi. Timer *Timer `json:"timer,inline"` } -// Represents all available timers in a vm +// Represents all available timers in a vmi. // --- // +k8s:openapi-gen=true type Timer struct { @@ -331,17 +393,17 @@ type Timer struct { Hyperv *HypervTimer `json:"hyperv,omitempty"` } -// HPETTickPolicy determines what happens when QEMU misses a deadline for injecting a tick to the guest +// HPETTickPolicy determines what happens when QEMU misses a deadline for injecting a tick to the guest. // --- // +k8s:openapi-gen=true type HPETTickPolicy string -// PITTickPolicy determines what happens when QEMU misses a deadline for injecting a tick to the guest +// PITTickPolicy determines what happens when QEMU misses a deadline for injecting a tick to the guest. // --- // +k8s:openapi-gen=true type PITTickPolicy string -// RTCTickPolicy determines what happens when QEMU misses a deadline for injecting a tick to the guest +// RTCTickPolicy determines what happens when QEMU misses a deadline for injecting a tick to the guest. // --- // +k8s:openapi-gen=true type RTCTickPolicy string @@ -355,62 +417,62 @@ const ( HPETTickPolicyCatchup HPETTickPolicy = "catchup" // HPETTickPolicyMerge merges the missed tick(s) into one tick and inject. The // guest time may be delayed, depending on how the OS reacts to the merging - // of ticks + // of ticks. HPETTickPolicyMerge HPETTickPolicy = "merge" // HPETTickPolicyDiscard discards all missed ticks. HPETTickPolicyDiscard HPETTickPolicy = "discard" // PITTickPolicyDelay delivers ticks at a constant rate. The guest time will - // be delayed due to the late tick + // be delayed due to the late tick. PITTickPolicyDelay PITTickPolicy = "delay" // PITTickPolicyCatchup Delivers ticks at a higher rate to catch up with the - // missed tick. The guest time should not be delayed once catchup is complete + // missed tick. The guest time should not be delayed once catchup is complete. PITTickPolicyCatchup PITTickPolicy = "catchup" // PITTickPolicyDiscard discards all missed ticks. PITTickPolicyDiscard PITTickPolicy = "discard" // RTCTickPolicyDelay delivers ticks at a constant rate. The guest time will - // be delayed due to the late tick + // be delayed due to the late tick. RTCTickPolicyDelay RTCTickPolicy = "delay" // RTCTickPolicyCatchup Delivers ticks at a higher rate to catch up with the - // missed tick. The guest time should not be delayed once catchup is complete + // missed tick. The guest time should not be delayed once catchup is complete. RTCTickPolicyCatchup RTCTickPolicy = "catchup" ) -// RTCTimerTrack specifies from which source to track the time +// RTCTimerTrack specifies from which source to track the time. // --- // +k8s:openapi-gen=true type RTCTimerTrack string const ( - // TrackGuest tracks the guest time + // TrackGuest tracks the guest time. TrackGuest RTCTimerTrack = "guest" - // TrackWall tracks the host time + // TrackWall tracks the host time. TrackWall RTCTimerTrack = "wall" ) // --- // +k8s:openapi-gen=true type RTCTimer struct { - // TickPolicy determines what happens when QEMU misses a deadline for injecting a tick to the guest - // One of "delay", "catchup" + // TickPolicy determines what happens when QEMU misses a deadline for injecting a tick to the guest. + // One of "delay", "catchup". TickPolicy RTCTickPolicy `json:"tickPolicy,omitempty"` // Enabled set to false makes sure that the machine type or a preset can't add the timer. - // Defaults to true + // Defaults to true. // +optional Enabled *bool `json:"present,omitempty"` - // Track the guest or the wall clock + // Track the guest or the wall clock. Track RTCTimerTrack `json:"track,omitempty"` } // --- // +k8s:openapi-gen=true type HPETTimer struct { - // TickPolicy determines what happens when QEMU misses a deadline for injecting a tick to the guest - // One of "delay", "catchup", "merge", "discard" + // TickPolicy determines what happens when QEMU misses a deadline for injecting a tick to the guest. + // One of "delay", "catchup", "merge", "discard". TickPolicy HPETTickPolicy `json:"tickPolicy,omitempty"` // Enabled set to false makes sure that the machine type or a preset can't add the timer. - // Defaults to true + // Defaults to true. // +optional Enabled *bool `json:"present,omitempty"` } @@ -418,11 +480,11 @@ type HPETTimer struct { // --- // +k8s:openapi-gen=true type PITTimer struct { - // TickPolicy determines what happens when QEMU misses a deadline for injecting a tick to the guest - // One of "delay", "catchup", "discard" + // TickPolicy determines what happens when QEMU misses a deadline for injecting a tick to the guest. + // One of "delay", "catchup", "discard". TickPolicy PITTickPolicy `json:"tickPolicy,omitempty"` // Enabled set to false makes sure that the machine type or a preset can't add the timer. - // Defaults to true + // Defaults to true. // +optional Enabled *bool `json:"present,omitempty"` } @@ -431,7 +493,7 @@ type PITTimer struct { // +k8s:openapi-gen=true type KVMTimer struct { // Enabled set to false makes sure that the machine type or a preset can't add the timer. - // Defaults to true + // Defaults to true. // +optional Enabled *bool `json:"present,omitempty"` } @@ -440,7 +502,7 @@ type KVMTimer struct { // +k8s:openapi-gen=true type HypervTimer struct { // Enabled set to false makes sure that the machine type or a preset can't add the timer. - // Defaults to true + // Defaults to true. // +optional Enabled *bool `json:"present,omitempty"` } @@ -448,24 +510,24 @@ type HypervTimer struct { // --- // +k8s:openapi-gen=true type Features struct { - // ACPI enables/disables ACPI insidejsondata guest - // Defaults to enabled + // ACPI enables/disables ACPI insidejsondata guest. + // Defaults to enabled. // +optional ACPI FeatureState `json:"acpi,omitempty"` - // Defaults to the machine type setting + // Defaults to the machine type setting. // +optional APIC *FeatureAPIC `json:"apic,omitempty"` - // Defaults to the machine type setting + // Defaults to the machine type setting. // +optional Hyperv *FeatureHyperv `json:"hyperv,omitempty"` } -// Represents if a feature is enabled or disabled +// Represents if a feature is enabled or disabled. // --- // +k8s:openapi-gen=true type FeatureState struct { - // Enabled determines if the feature should be enabled or disabled on the guest - // Defaults to true + // Enabled determines if the feature should be enabled or disabled on the guest. + // Defaults to true. // +optional Enabled *bool `json:"enabled,omitempty"` } @@ -473,12 +535,12 @@ type FeatureState struct { // --- // +k8s:openapi-gen=true type FeatureAPIC struct { - // Enabled determines if the feature should be enabled or disabled on the guest - // Defaults to true + // Enabled determines if the feature should be enabled or disabled on the guest. + // Defaults to true. // +optional Enabled *bool `json:"enabled,omitempty"` - // EndOfInterrupt enables the end of interrupt notification in the guest - // Defaults to false + // EndOfInterrupt enables the end of interrupt notification in the guest. + // Defaults to false. // +optional EndOfInterrupt bool `json:"endOfInterrupt,omitempty"` } @@ -486,13 +548,13 @@ type FeatureAPIC struct { // --- // +k8s:openapi-gen=true type FeatureSpinlocks struct { - // Enabled determines if the feature should be enabled or disabled on the guest - // Defaults to true + // Enabled determines if the feature should be enabled or disabled on the guest. + // Defaults to true. // +optional Enabled *bool `json:"enabled,omitempty"` - // Retries indicates the number of retries - // Must be a value greater or equal 4096 - // Defaults to 4096 + // Retries indicates the number of retries. + // Must be a value greater or equal 4096. + // Defaults to 4096. // +optional Retries *uint32 `json:"spinlocks,omitempty"` } @@ -500,97 +562,97 @@ type FeatureSpinlocks struct { // --- // +k8s:openapi-gen=true type FeatureVendorID struct { - // Enabled determines if the feature should be enabled or disabled on the guest - // Defaults to true + // Enabled determines if the feature should be enabled or disabled on the guest. + // Defaults to true. // +optional Enabled *bool `json:"enabled,omitempty"` - // VendorID sets the hypervisor vendor id, visible to the vm - // String up to twelve characters + // VendorID sets the hypervisor vendor id, visible to the vmi. + // String up to twelve characters. VendorID string `json:"vendorid,omitempty"` } -// Hyperv specific features +// Hyperv specific features. // --- // +k8s:openapi-gen=true type FeatureHyperv struct { - // Relaxed relaxes constraints on timer - // Defaults to the machine type setting + // Relaxed relaxes constraints on timer. + // Defaults to the machine type setting. // +optional Relaxed *FeatureState `json:"relaxed,omitempty"` - // VAPIC indicates whether virtual APIC is enabled - // Defaults to the machine type setting + // VAPIC indicates whether virtual APIC is enabled. + // Defaults to the machine type setting. // +optional VAPIC *FeatureState `json:"vapic,omitempty"` - // Spinlocks indicates if spinlocks should be made available to the guest + // Spinlocks indicates if spinlocks should be made available to the guest. // +optional Spinlocks *FeatureSpinlocks `json:"spinlocks,omitempty"` - // VPIndex enables the Virtual Processor Index to help windows identifying virtual processors - // Defaults to the machine type setting + // VPIndex enables the Virtual Processor Index to help windows identifying virtual processors. + // Defaults to the machine type setting. // +optional VPIndex *FeatureState `json:"vpindex,omitempty"` - // Runtime - // Defaults to the machine type setting + // Runtime. + // Defaults to the machine type setting. // +optional Runtime *FeatureState `json:"runtime,omitempty"` - // SyNIC enable Synthetic Interrupt Controller - // Defaults to the machine type setting + // SyNIC enable Synthetic Interrupt Controller. + // Defaults to the machine type setting. // +optional SyNIC *FeatureState `json:"synic,omitempty"` - // SyNICTimer enable Synthetic Interrupt Controller timer - // Defaults to the machine type setting + // SyNICTimer enable Synthetic Interrupt Controller timer. + // Defaults to the machine type setting. // +optional SyNICTimer *FeatureState `json:"synictimer,omitempty"` - // Reset enables Hyperv reboot/reset for the vm - // Defaults to the machine type setting + // Reset enables Hyperv reboot/reset for the vmi. + // Defaults to the machine type setting. // +optional Reset *FeatureState `json:"reset,omitempty"` - // VendorID allows setting the hypervisor vendor id - // Defaults to the machine type setting + // VendorID allows setting the hypervisor vendor id. + // Defaults to the machine type setting. // +optional VendorID *FeatureVendorID `json:"vendorid,omitempty"` } -// WatchdogAction defines the watchdog action, if a watchdog gets triggered +// WatchdogAction defines the watchdog action, if a watchdog gets triggered. // --- // +k8s:openapi-gen=true type WatchdogAction string const ( - // WatchdogActionPoweroff will poweroff the vm if the watchdog gets triggered + // WatchdogActionPoweroff will poweroff the vmi if the watchdog gets triggered. WatchdogActionPoweroff WatchdogAction = "poweroff" - // WatchdogActionReset will reset the vm if the watchdog gets triggered + // WatchdogActionReset will reset the vmi if the watchdog gets triggered. WatchdogActionReset WatchdogAction = "reset" - // WatchdogActionShutdown will shutdown the vm if the watchdog gets triggered + // WatchdogActionShutdown will shutdown the vmi if the watchdog gets triggered. WatchdogActionShutdown WatchdogAction = "shutdown" ) -// Named watchdog device +// Named watchdog device. // --- // +k8s:openapi-gen=true type Watchdog struct { - // Name of the watchdog + // Name of the watchdog. Name string `json:"name"` - // WatchdogDevice contains the watchdog type and actions - // Defaults to i6300esb + // WatchdogDevice contains the watchdog type and actions. + // Defaults to i6300esb. WatchdogDevice `json:",inline"` } -// Hardware watchdog device +// Hardware watchdog device. // Exactly one of its members must be set. // --- // +k8s:openapi-gen=true type WatchdogDevice struct { - // i6300esb watchdog device + // i6300esb watchdog device. // +optional I6300ESB *I6300ESBWatchdog `json:"i6300esb,omitempty"` } -// i6300esb watchdog device +// i6300esb watchdog device. // --- // +k8s:openapi-gen=true type I6300ESBWatchdog struct { // The action to take. Valid values are poweroff, reset, shutdown. - // Defaults to reset + // Defaults to reset. Action WatchdogAction `json:"action,omitempty"` } @@ -603,3 +665,90 @@ func NewMinimalDomainSpec() DomainSpec { } return domain } + +// --- +// +k8s:openapi-gen=true +type Interface struct { + // Logical name of the interface as well as a reference to the associated networks. + // Must match the Name of a Network. + Name string `json:"name"` + // Interface model. + // One of: e1000, e1000e, ne2k_pci, pcnet, rtl8139, virtio. + // Defaults to virtio. + // TODO:(ihar) switch to enums once opengen-api supports them. See: https://github.com/kubernetes/kube-openapi/issues/51 + Model string `json:"model,omitempty"` + // BindingMethod specifies the method which will be used to connect the interface to the guest. + // Defaults to Bridge. + InterfaceBindingMethod `json:",inline"` + // List of ports to be forwarded to the virtual machine. + Ports []Port `json:"ports,omitempty"` + // Interface MAC address. For example: de:ad:00:00:be:af or DE-AD-00-00-BE-AF. + MacAddress string `json:"macAddress,omitempty"` +} + +// Represents the method which will be used to connect the interface to the guest. +// Only one of its members may be specified. +// --- +// +k8s:openapi-gen=true +type InterfaceBindingMethod struct { + Bridge *InterfaceBridge `json:"bridge,omitempty"` + Slirp *InterfaceSlirp `json:"slirp,omitempty"` +} + +// --- +// +k8s:openapi-gen=true +type InterfaceBridge struct{} + +// --- +// +k8s:openapi-gen=true +type InterfaceSlirp struct{} + +// Port repesents a port to expose from the virtual machine. +// Default protocol TCP. +// The port field is mandatory +// --- +// +k8s:openapi-gen=true +type Port struct { + // If specified, this must be an IANA_SVC_NAME and unique within the pod. Each + // named port in a pod must have a unique name. Name for the port that can be + // referred to by services. + // +optional + Name string `json:"name,omitempty"` + // Protocol for port. Must be UDP or TCP. + // Defaults to "TCP". + // +optional + Protocol string `json:"protocol,omitempty"` + // Number of port to expose for the virtual machine. + // This must be a valid port number, 0 < x < 65536. + Port int32 `json:"port"` +} + +// Network represents a network type and a resource that should be connected to the vm. +// --- +// +k8s:openapi-gen=true +type Network struct { + // Network name. + // Must be a DNS_LABEL and unique within the vm. + // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + Name string `json:"name"` + // NetworkSource represents the network type and the source interface that should be connected to the virtual machine. + // Defaults to Pod, if no type is specified. + NetworkSource `json:",inline"` +} + +// Represents the source resource that will be connected to the vm. +// Only one of its members may be specified. +// --- +// +k8s:openapi-gen=true +type NetworkSource struct { + Pod *PodNetwork `json:"pod,omitempty"` +} + +// Represents the stock pod network interface. +// --- +// +k8s:openapi-gen=true +type PodNetwork struct { + // CIDR for vm network. + // Default 10.0.2.0/24 if not specified. + VMNetworkCIDR string `json:"vmNetworkCIDR,omitempty"` +} diff --git a/vendor/kubevirt.io/kubevirt/pkg/api/v1/schema_swagger_generated.go b/vendor/kubevirt.io/kubevirt/pkg/api/v1/schema_swagger_generated.go index 3f1fe0f25..786350eaa 100644 --- a/vendor/kubevirt.io/kubevirt/pkg/api/v1/schema_swagger_generated.go +++ b/vendor/kubevirt.io/kubevirt/pkg/api/v1/schema_swagger_generated.go @@ -4,139 +4,171 @@ package v1 func (CloudInitNoCloudSource) SwaggerDoc() map[string]string { return map[string]string{ - "": "Represents a cloud-init nocloud user data source\nMore info: http://cloudinit.readthedocs.io/en/latest/topics/datasources/nocloud.html", - "secretRef": "UserDataSecretRef references a k8s secret that contains NoCloud userdata\n+ optional", - "userDataBase64": "UserDataBase64 contains NoCloud cloud-init userdata as a base64 encoded string\n+ optional", - "userData": "UserData contains NoCloud inline cloud-init userdata\n+ optional", + "": "Represents a cloud-init nocloud user data source.\nMore info: http://cloudinit.readthedocs.io/en/latest/topics/datasources/nocloud.html", + "secretRef": "UserDataSecretRef references a k8s secret that contains NoCloud userdata.\n+ optional", + "userDataBase64": "UserDataBase64 contains NoCloud cloud-init userdata as a base64 encoded string.\n+ optional", + "userData": "UserData contains NoCloud inline cloud-init userdata.\n+ optional", } } func (DomainSpec) SwaggerDoc() map[string]string { return map[string]string{ - "resources": "Resources describes the Compute Resources required by this vm.", - "cpu": "CPU allow specified the detailed CPU topology inside the vm.\n+optional", - "machine": "Machine type\n+optional", - "firmware": "Firmware\n+optional", - "clock": "Clock sets the clock and timers of the vm.\n+optional", - "features": "Features like acpi, apic, hyperv\n+optional", + "resources": "Resources describes the Compute Resources required by this vmi.", + "cpu": "CPU allow specified the detailed CPU topology inside the vmi.\n+optional", + "memory": "Memory allow specifying the VMI memory features.\n+optional", + "machine": "Machine type.\n+optional", + "firmware": "Firmware.\n+optional", + "clock": "Clock sets the clock and timers of the vmi.\n+optional", + "features": "Features like acpi, apic, hyperv.\n+optional", "devices": "Devices allows adding disks, network interfaces, ...", } } +func (DomainPresetSpec) SwaggerDoc() map[string]string { + return map[string]string{ + "resources": "Resources describes the Compute Resources required by this vmi.", + "cpu": "CPU allow specified the detailed CPU topology inside the vmi.\n+optional", + "memory": "Memory allow specifying the VMI memory features.\n+optional", + "machine": "Machine type.\n+optional", + "firmware": "Firmware.\n+optional", + "clock": "Clock sets the clock and timers of the vmi.\n+optional", + "features": "Features like acpi, apic, hyperv.\n+optional", + "devices": "Devices allows adding disks, network interfaces, ...\n+optional", + } +} + func (ResourceRequirements) SwaggerDoc() map[string]string { return map[string]string{ - "requests": "Requests is a description of the initial vm resources.\nValid resource keys are \"memory\" and \"cpu\".\n+optional", + "requests": "Requests is a description of the initial vmi resources.\nValid resource keys are \"memory\" and \"cpu\".\n+optional", "limits": "Limits describes the maximum amount of compute resources allowed.\nValid resource keys are \"memory\" and \"cpu\".\n+optional", } } func (CPU) SwaggerDoc() map[string]string { return map[string]string{ - "": "CPU allow specifying the CPU topology", - "cores": "Cores specifies the number of cores inside the vm.\nMust be a value greater or equal 1.", + "": "CPU allows specifying the CPU topology.", + "cores": "Cores specifies the number of cores inside the vmi.\nMust be a value greater or equal 1.", + "model": "Model specifies the CPU model inside the VMI.\nList of available models https://github.com/libvirt/libvirt/blob/master/src/cpu/cpu_map.xml.\n+optional", + } +} + +func (Memory) SwaggerDoc() map[string]string { + return map[string]string{ + "": "Memory allows specifying the VirtualMachineInstance memory features.", + "hugepages": "Hugepages allow to use hugepages for the VirtualMachineInstance instead of regular memory.\n+optional", + } +} + +func (Hugepages) SwaggerDoc() map[string]string { + return map[string]string{ + "": "Hugepages allow to use hugepages for the VirtualMachineInstance instead of regular memory.", + "pageSize": "PageSize specifies the hugepage size, for x86_64 architecture valid values are 1Gi and 2Mi.", } } func (Machine) SwaggerDoc() map[string]string { return map[string]string{ - "type": "QEMU machine type is the actual chipset of the VM.", + "type": "QEMU machine type is the actual chipset of the VirtualMachineInstance.", } } func (Firmware) SwaggerDoc() map[string]string { return map[string]string{ - "uuid": "UUID reported by the vm bios\nDefaults to a random generated uid", + "uuid": "UUID reported by the vmi bios.\nDefaults to a random generated uid.", } } func (Devices) SwaggerDoc() map[string]string { return map[string]string{ - "disks": "Disks describes disks, cdroms, floppy and luns which are connected to the vm", - "watchdog": "Watchdog describes a watchdog device which can be added to the vm", + "disks": "Disks describes disks, cdroms, floppy and luns which are connected to the vmi.", + "watchdog": "Watchdog describes a watchdog device which can be added to the vmi.", + "interfaces": "Interfaces describe network interfaces which are added to the vm.", } } func (Disk) SwaggerDoc() map[string]string { return map[string]string{ "name": "Name is the device name", - "volumeName": "Name of the volume which is referenced\nMust match the Name of a Volume.", + "volumeName": "Name of the volume which is referenced.\nMust match the Name of a Volume.", + "bootOrder": "BootOrder is an integer value > 0, used to determine ordering of boot devices.\nLower values take precedence.\nDisks without a boot order are not tried if a disk with a boot order exists.\n+optional", + "serial": "Serial provides the ability to specify a serial number for the disk device.\n+optional", } } func (DiskDevice) SwaggerDoc() map[string]string { return map[string]string{ "": "Represents the target of a volume to mount.\nOnly one of its members may be specified.", - "disk": "Attach a volume as a disk to the vm", - "lun": "Attach a volume as a LUN to the vm", - "floppy": "Attach a volume as a floppy to the vm", - "cdrom": "Attach a volume as a cdrom to the vm", + "disk": "Attach a volume as a disk to the vmi.", + "lun": "Attach a volume as a LUN to the vmi.", + "floppy": "Attach a volume as a floppy to the vmi.", + "cdrom": "Attach a volume as a cdrom to the vmi.", } } func (DiskTarget) SwaggerDoc() map[string]string { return map[string]string{ - "bus": "Bus indicates the type of disk device to emulate.\nsupported values: virtio, sata, scsi, ide", - "readonly": "ReadOnly\nDefaults to false", + "bus": "Bus indicates the type of disk device to emulate.\nsupported values: virtio, sata, scsi, ide.", + "readonly": "ReadOnly.\nDefaults to false.", } } func (LunTarget) SwaggerDoc() map[string]string { return map[string]string{ - "bus": "Bus indicates the type of disk device to emulate.\nsupported values: virtio, sata, scsi, ide", - "readonly": "ReadOnly\nDefaults to false", + "bus": "Bus indicates the type of disk device to emulate.\nsupported values: virtio, sata, scsi, ide.", + "readonly": "ReadOnly.\nDefaults to false.", } } func (FloppyTarget) SwaggerDoc() map[string]string { return map[string]string{ - "readonly": "ReadOnly\nDefaults to false", - "tray": "Tray indicates if the tray of the device is open or closed.\nAllowed values are \"open\" and \"closed\"\nDefaults to closed\n+optional", + "readonly": "ReadOnly.\nDefaults to false.", + "tray": "Tray indicates if the tray of the device is open or closed.\nAllowed values are \"open\" and \"closed\".\nDefaults to closed.\n+optional", } } func (CDRomTarget) SwaggerDoc() map[string]string { return map[string]string{ - "bus": "Bus indicates the type of disk device to emulate.\nsupported values: virtio, sata, scsi, ide", - "readonly": "ReadOnly\nDefaults to true", - "tray": "Tray indicates if the tray of the device is open or closed.\nAllowed values are \"open\" and \"closed\"\nDefaults to closed\n+optional", + "bus": "Bus indicates the type of disk device to emulate.\nsupported values: virtio, sata, scsi, ide.", + "readonly": "ReadOnly.\nDefaults to true.", + "tray": "Tray indicates if the tray of the device is open or closed.\nAllowed values are \"open\" and \"closed\".\nDefaults to closed.\n+optional", } } func (Volume) SwaggerDoc() map[string]string { return map[string]string{ - "": "Volume represents a named volume in a vm.", - "name": "Volume's name.\nMust be a DNS_LABEL and unique within the vm.\nMore info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", + "": "Volume represents a named volume in a vmi.", + "name": "Volume's name.\nMust be a DNS_LABEL and unique within the vmi.\nMore info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", } } func (VolumeSource) SwaggerDoc() map[string]string { return map[string]string{ "": "Represents the source of a volume to mount.\nOnly one of its members may be specified.", - "persistentVolumeClaim": "PersistentVolumeClaimVolumeSource represents a reference to a PersistentVolumeClaim in the same namespace.\nDirectly attached to the vm via qemu.\nMore info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims\n+optional", - "cloudInitNoCloud": "CloudInitNoCloud represents a cloud-init NoCloud user-data source.\nThe NoCloud data will be added as a disk to the vm. A proper cloud-init installation is required inside the guest.\nMore info: http://cloudinit.readthedocs.io/en/latest/topics/datasources/nocloud.html\n+optional", - "registryDisk": "RegistryDisk references a docker image, embedding a qcow or raw disk\nMore info: https://kubevirt.gitbooks.io/user-guide/registry-disk.html\n+optional", + "persistentVolumeClaim": "PersistentVolumeClaimVolumeSource represents a reference to a PersistentVolumeClaim in the same namespace.\nDirectly attached to the vmi via qemu.\nMore info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims\n+optional", + "cloudInitNoCloud": "CloudInitNoCloud represents a cloud-init NoCloud user-data source.\nThe NoCloud data will be added as a disk to the vmi. A proper cloud-init installation is required inside the guest.\nMore info: http://cloudinit.readthedocs.io/en/latest/topics/datasources/nocloud.html\n+optional", + "registryDisk": "RegistryDisk references a docker image, embedding a qcow or raw disk.\nMore info: https://kubevirt.gitbooks.io/user-guide/registry-disk.html\n+optional", "ephemeral": "Ephemeral is a special volume source that \"wraps\" specified source and provides copy-on-write image on top of it.\n+optional", - "emptyDisk": "EmptyDisk represents a temporary disk which shares the vms lifecycle\nMore info: https://kubevirt.gitbooks.io/user-guide/disks-and-volumes.html\n+optional", + "emptyDisk": "EmptyDisk represents a temporary disk which shares the vmis lifecycle.\nMore info: https://kubevirt.gitbooks.io/user-guide/disks-and-volumes.html\n+optional", } } func (EphemeralVolumeSource) SwaggerDoc() map[string]string { return map[string]string{ - "persistentVolumeClaim": "PersistentVolumeClaimVolumeSource represents a reference to a PersistentVolumeClaim in the same namespace.\nDirectly attached to the vm via qemu.\nMore info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims\n+optional", + "persistentVolumeClaim": "PersistentVolumeClaimVolumeSource represents a reference to a PersistentVolumeClaim in the same namespace.\nDirectly attached to the vmi via qemu.\nMore info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims\n+optional", } } func (EmptyDiskSource) SwaggerDoc() map[string]string { return map[string]string{ - "": "EmptyDisk represents a temporary disk which shares the vms lifecycle", + "": "EmptyDisk represents a temporary disk which shares the vmis lifecycle.", "capacity": "Capacity of the sparse disk.", } } func (RegistryDiskSource) SwaggerDoc() map[string]string { return map[string]string{ - "": "Represents a docker image with an embedded disk", - "image": "Image is the name of the image with the embedded disk", + "": "Represents a docker image with an embedded disk.", + "image": "Image is the name of the image with the embedded disk.", "imagePullSecret": "ImagePullSecret is the name of the Docker registry secret required to pull the image. The secret must already exist.", } } @@ -145,7 +177,7 @@ func (ClockOffset) SwaggerDoc() map[string]string { return map[string]string{ "": "Exactly one of its members must be set.", "utc": "UTC sets the guest clock to UTC on each boot. If an offset is specified,\nguest changes to the clock will be kept during reboots and are not reset.", - "timezone": "Timezone sets the guest clock to the specified timezone.\nZone name follows the TZ environment variable format (e.g. 'America/New_York')", + "timezone": "Timezone sets the guest clock to the specified timezone.\nZone name follows the TZ environment variable format (e.g. 'America/New_York').", } } @@ -158,14 +190,14 @@ func (ClockOffsetUTC) SwaggerDoc() map[string]string { func (Clock) SwaggerDoc() map[string]string { return map[string]string{ - "": "Represents the clock and timers of a vm", - "timer": "Timer specifies whih timers are attached to the vm", + "": "Represents the clock and timers of a vmi.", + "timer": "Timer specifies whih timers are attached to the vmi.", } } func (Timer) SwaggerDoc() map[string]string { return map[string]string{ - "": "Represents all available timers in a vm", + "": "Represents all available timers in a vmi.", "hpet": "HPET (High Precision Event Timer) - multiple timers with periodic interrupts.", "kvm": "KVM \t(KVM clock) - lets guests read the host’s wall clock time (paravirtualized). For linux guests.", "pit": "PIT (Programmable Interval Timer) - a timer with periodic interrupts.", @@ -176,106 +208,158 @@ func (Timer) SwaggerDoc() map[string]string { func (RTCTimer) SwaggerDoc() map[string]string { return map[string]string{ - "tickPolicy": "TickPolicy determines what happens when QEMU misses a deadline for injecting a tick to the guest\nOne of \"delay\", \"catchup\"", - "present": "Enabled set to false makes sure that the machine type or a preset can't add the timer.\nDefaults to true\n+optional", - "track": "Track the guest or the wall clock", + "tickPolicy": "TickPolicy determines what happens when QEMU misses a deadline for injecting a tick to the guest.\nOne of \"delay\", \"catchup\".", + "present": "Enabled set to false makes sure that the machine type or a preset can't add the timer.\nDefaults to true.\n+optional", + "track": "Track the guest or the wall clock.", } } func (HPETTimer) SwaggerDoc() map[string]string { return map[string]string{ - "tickPolicy": "TickPolicy determines what happens when QEMU misses a deadline for injecting a tick to the guest\nOne of \"delay\", \"catchup\", \"merge\", \"discard\"", - "present": "Enabled set to false makes sure that the machine type or a preset can't add the timer.\nDefaults to true\n+optional", + "tickPolicy": "TickPolicy determines what happens when QEMU misses a deadline for injecting a tick to the guest.\nOne of \"delay\", \"catchup\", \"merge\", \"discard\".", + "present": "Enabled set to false makes sure that the machine type or a preset can't add the timer.\nDefaults to true.\n+optional", } } func (PITTimer) SwaggerDoc() map[string]string { return map[string]string{ - "tickPolicy": "TickPolicy determines what happens when QEMU misses a deadline for injecting a tick to the guest\nOne of \"delay\", \"catchup\", \"discard\"", - "present": "Enabled set to false makes sure that the machine type or a preset can't add the timer.\nDefaults to true\n+optional", + "tickPolicy": "TickPolicy determines what happens when QEMU misses a deadline for injecting a tick to the guest.\nOne of \"delay\", \"catchup\", \"discard\".", + "present": "Enabled set to false makes sure that the machine type or a preset can't add the timer.\nDefaults to true.\n+optional", } } func (KVMTimer) SwaggerDoc() map[string]string { return map[string]string{ - "present": "Enabled set to false makes sure that the machine type or a preset can't add the timer.\nDefaults to true\n+optional", + "present": "Enabled set to false makes sure that the machine type or a preset can't add the timer.\nDefaults to true.\n+optional", } } func (HypervTimer) SwaggerDoc() map[string]string { return map[string]string{ - "present": "Enabled set to false makes sure that the machine type or a preset can't add the timer.\nDefaults to true\n+optional", + "present": "Enabled set to false makes sure that the machine type or a preset can't add the timer.\nDefaults to true.\n+optional", } } func (Features) SwaggerDoc() map[string]string { return map[string]string{ - "acpi": "ACPI enables/disables ACPI insidejsondata guest\nDefaults to enabled\n+optional", - "apic": "Defaults to the machine type setting\n+optional", - "hyperv": "Defaults to the machine type setting\n+optional", + "acpi": "ACPI enables/disables ACPI insidejsondata guest.\nDefaults to enabled.\n+optional", + "apic": "Defaults to the machine type setting.\n+optional", + "hyperv": "Defaults to the machine type setting.\n+optional", } } func (FeatureState) SwaggerDoc() map[string]string { return map[string]string{ - "": "Represents if a feature is enabled or disabled", - "enabled": "Enabled determines if the feature should be enabled or disabled on the guest\nDefaults to true\n+optional", + "": "Represents if a feature is enabled or disabled.", + "enabled": "Enabled determines if the feature should be enabled or disabled on the guest.\nDefaults to true.\n+optional", } } func (FeatureAPIC) SwaggerDoc() map[string]string { return map[string]string{ - "enabled": "Enabled determines if the feature should be enabled or disabled on the guest\nDefaults to true\n+optional", - "endOfInterrupt": "EndOfInterrupt enables the end of interrupt notification in the guest\nDefaults to false\n+optional", + "enabled": "Enabled determines if the feature should be enabled or disabled on the guest.\nDefaults to true.\n+optional", + "endOfInterrupt": "EndOfInterrupt enables the end of interrupt notification in the guest.\nDefaults to false.\n+optional", } } func (FeatureSpinlocks) SwaggerDoc() map[string]string { return map[string]string{ - "enabled": "Enabled determines if the feature should be enabled or disabled on the guest\nDefaults to true\n+optional", - "spinlocks": "Retries indicates the number of retries\nMust be a value greater or equal 4096\nDefaults to 4096\n+optional", + "enabled": "Enabled determines if the feature should be enabled or disabled on the guest.\nDefaults to true.\n+optional", + "spinlocks": "Retries indicates the number of retries.\nMust be a value greater or equal 4096.\nDefaults to 4096.\n+optional", } } func (FeatureVendorID) SwaggerDoc() map[string]string { return map[string]string{ - "enabled": "Enabled determines if the feature should be enabled or disabled on the guest\nDefaults to true\n+optional", - "vendorid": "VendorID sets the hypervisor vendor id, visible to the vm\nString up to twelve characters", + "enabled": "Enabled determines if the feature should be enabled or disabled on the guest.\nDefaults to true.\n+optional", + "vendorid": "VendorID sets the hypervisor vendor id, visible to the vmi.\nString up to twelve characters.", } } func (FeatureHyperv) SwaggerDoc() map[string]string { return map[string]string{ - "": "Hyperv specific features", - "relaxed": "Relaxed relaxes constraints on timer\nDefaults to the machine type setting\n+optional", - "vapic": "VAPIC indicates whether virtual APIC is enabled\nDefaults to the machine type setting\n+optional", - "spinlocks": "Spinlocks indicates if spinlocks should be made available to the guest\n+optional", - "vpindex": "VPIndex enables the Virtual Processor Index to help windows identifying virtual processors\nDefaults to the machine type setting\n+optional", - "runtime": "Runtime\nDefaults to the machine type setting\n+optional", - "synic": "SyNIC enable Synthetic Interrupt Controller\nDefaults to the machine type setting\n+optional", - "synictimer": "SyNICTimer enable Synthetic Interrupt Controller timer\nDefaults to the machine type setting\n+optional", - "reset": "Reset enables Hyperv reboot/reset for the vm\nDefaults to the machine type setting\n+optional", - "vendorid": "VendorID allows setting the hypervisor vendor id\nDefaults to the machine type setting\n+optional", + "": "Hyperv specific features.", + "relaxed": "Relaxed relaxes constraints on timer.\nDefaults to the machine type setting.\n+optional", + "vapic": "VAPIC indicates whether virtual APIC is enabled.\nDefaults to the machine type setting.\n+optional", + "spinlocks": "Spinlocks indicates if spinlocks should be made available to the guest.\n+optional", + "vpindex": "VPIndex enables the Virtual Processor Index to help windows identifying virtual processors.\nDefaults to the machine type setting.\n+optional", + "runtime": "Runtime.\nDefaults to the machine type setting.\n+optional", + "synic": "SyNIC enable Synthetic Interrupt Controller.\nDefaults to the machine type setting.\n+optional", + "synictimer": "SyNICTimer enable Synthetic Interrupt Controller timer.\nDefaults to the machine type setting.\n+optional", + "reset": "Reset enables Hyperv reboot/reset for the vmi.\nDefaults to the machine type setting.\n+optional", + "vendorid": "VendorID allows setting the hypervisor vendor id.\nDefaults to the machine type setting.\n+optional", } } func (Watchdog) SwaggerDoc() map[string]string { return map[string]string{ - "": "Named watchdog device", - "name": "Name of the watchdog", + "": "Named watchdog device.", + "name": "Name of the watchdog.", } } func (WatchdogDevice) SwaggerDoc() map[string]string { return map[string]string{ - "": "Hardware watchdog device\nExactly one of its members must be set.", - "i6300esb": "i6300esb watchdog device\n+optional", + "": "Hardware watchdog device.\nExactly one of its members must be set.", + "i6300esb": "i6300esb watchdog device.\n+optional", } } func (I6300ESBWatchdog) SwaggerDoc() map[string]string { return map[string]string{ - "": "i6300esb watchdog device", - "action": "The action to take. Valid values are poweroff, reset, shutdown.\nDefaults to reset", + "": "i6300esb watchdog device.", + "action": "The action to take. Valid values are poweroff, reset, shutdown.\nDefaults to reset.", + } +} + +func (Interface) SwaggerDoc() map[string]string { + return map[string]string{ + "name": "Logical name of the interface as well as a reference to the associated networks.\nMust match the Name of a Network.", + "model": "Interface model.\nOne of: e1000, e1000e, ne2k_pci, pcnet, rtl8139, virtio.\nDefaults to virtio.", + "ports": "List of ports to be forwarded to the virtual machine.", + "macAddress": "Interface MAC address. For example: de:ad:00:00:be:af or DE-AD-00-00-BE-AF.", + } +} + +func (InterfaceBindingMethod) SwaggerDoc() map[string]string { + return map[string]string{ + "": "Represents the method which will be used to connect the interface to the guest.\nOnly one of its members may be specified.", + } +} + +func (InterfaceBridge) SwaggerDoc() map[string]string { + return map[string]string{} +} + +func (InterfaceSlirp) SwaggerDoc() map[string]string { + return map[string]string{} +} + +func (Port) SwaggerDoc() map[string]string { + return map[string]string{ + "": "Port repesents a port to expose from the virtual machine.\nDefault protocol TCP.\nThe port field is mandatory", + "name": "If specified, this must be an IANA_SVC_NAME and unique within the pod. Each\nnamed port in a pod must have a unique name. Name for the port that can be\nreferred to by services.\n+optional", + "protocol": "Protocol for port. Must be UDP or TCP.\nDefaults to \"TCP\".\n+optional", + "port": "Number of port to expose for the virtual machine.\nThis must be a valid port number, 0 < x < 65536.", + } +} + +func (Network) SwaggerDoc() map[string]string { + return map[string]string{ + "": "Network represents a network type and a resource that should be connected to the vm.", + "name": "Network name.\nMust be a DNS_LABEL and unique within the vm.\nMore info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", + } +} + +func (NetworkSource) SwaggerDoc() map[string]string { + return map[string]string{ + "": "Represents the source resource that will be connected to the vm.\nOnly one of its members may be specified.", + } +} + +func (PodNetwork) SwaggerDoc() map[string]string { + return map[string]string{ + "": "Represents the stock pod network interface.", + "vmNetworkCIDR": "CIDR for vm network.\nDefault 10.0.2.0/24 if not specified.", } } diff --git a/vendor/kubevirt.io/kubevirt/pkg/api/v1/types.go b/vendor/kubevirt.io/kubevirt/pkg/api/v1/types.go index ba4c26a33..7230bac69 100644 --- a/vendor/kubevirt.io/kubevirt/pkg/api/v1/types.go +++ b/vendor/kubevirt.io/kubevirt/pkg/api/v1/types.go @@ -52,19 +52,19 @@ const SubresourceGroupName = "subresources.kubevirt.io" const DefaultGracePeriodSeconds int64 = 30 // GroupVersion is group version used to register these objects -var GroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"} +var GroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha2"} // GroupVersion is group version used to register these objects -var SubresourceGroupVersion = schema.GroupVersion{Group: SubresourceGroupName, Version: "v1alpha1"} +var SubresourceGroupVersion = schema.GroupVersion{Group: SubresourceGroupName, Version: "v1alpha2"} // GroupVersionKind -var VirtualMachineGroupVersionKind = schema.GroupVersionKind{Group: GroupName, Version: GroupVersion.Version, Kind: "VirtualMachine"} +var VirtualMachineInstanceGroupVersionKind = schema.GroupVersionKind{Group: GroupName, Version: GroupVersion.Version, Kind: "VirtualMachineInstance"} -var VMReplicaSetGroupVersionKind = schema.GroupVersionKind{Group: GroupName, Version: GroupVersion.Version, Kind: "VirtualMachineReplicaSet"} +var VirtualMachineInstanceReplicaSetGroupVersionKind = schema.GroupVersionKind{Group: GroupName, Version: GroupVersion.Version, Kind: "VirtualMachineInstanceReplicaSet"} -var VirtualMachinePresetGroupVersionKind = schema.GroupVersionKind{Group: GroupName, Version: GroupVersion.Version, Kind: "VirtualMachinePreset"} +var VirtualMachineInstancePresetGroupVersionKind = schema.GroupVersionKind{Group: GroupName, Version: GroupVersion.Version, Kind: "VirtualMachineInstancePreset"} -var OfflineVirtualMachineGroupVersionKind = schema.GroupVersionKind{Group: GroupName, Version: GroupVersion.Version, Kind: "OfflineVirtualMachine"} +var VirtualMachineGroupVersionKind = schema.GroupVersionKind{Group: GroupName, Version: GroupVersion.Version, Kind: "VirtualMachine"} var ( groupFactoryRegistry = make(announced.APIGroupFactoryRegistry) @@ -74,17 +74,17 @@ var ( // Adds the list of known types to api.Scheme. func addKnownTypes(scheme *runtime.Scheme) error { scheme.AddKnownTypes(GroupVersion, - &VirtualMachine{}, - &VirtualMachineList{}, + &VirtualMachineInstance{}, + &VirtualMachineInstanceList{}, &metav1.ListOptions{}, &metav1.DeleteOptions{}, - &VirtualMachineReplicaSet{}, - &VirtualMachineReplicaSetList{}, - &VirtualMachinePreset{}, - &VirtualMachinePresetList{}, + &VirtualMachineInstanceReplicaSet{}, + &VirtualMachineInstanceReplicaSetList{}, + &VirtualMachineInstancePreset{}, + &VirtualMachineInstancePresetList{}, &metav1.GetOptions{}, - &OfflineVirtualMachine{}, - &OfflineVirtualMachineList{}, + &VirtualMachine{}, + &VirtualMachineList{}, ) return nil } @@ -104,213 +104,230 @@ func init() { } } -// VirtualMachine is *the* VM Definition. It represents a virtual machine in the runtime environment of kubernetes. +// VirtualMachineInstance is *the* VirtualMachineInstance Definition. It represents a virtual machine in the runtime environment of kubernetes. // --- // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +k8s:openapi-gen=true -type VirtualMachine struct { +type VirtualMachineInstance struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` - // VM Spec contains the VM specification. - Spec VirtualMachineSpec `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 VirtualMachineStatus `json:"status,omitempty"` + // VirtualMachineInstance Spec contains the VirtualMachineInstance specification. + Spec VirtualMachineInstanceSpec `json:"spec,omitempty" valid:"required"` + // Status is the high level overview of how the VirtualMachineInstance is doing. It contains information available to controllers and users. + Status VirtualMachineInstanceStatus `json:"status,omitempty"` } -// VirtualMachineList is a list of VirtualMachines +// VirtualMachineInstanceList is a list of VirtualMachines // --- // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +k8s:openapi-gen=true -type VirtualMachineList struct { +type VirtualMachineInstanceList struct { metav1.TypeMeta `json:",inline"` - ListMeta metav1.ListMeta `json:"metadata,omitempty"` - Items []VirtualMachine `json:"items"` + ListMeta metav1.ListMeta `json:"metadata,omitempty"` + Items []VirtualMachineInstance `json:"items"` } -// VirtualMachineSpec is a description of a VirtualMachine. +// VirtualMachineInstanceSpec is a description of a VirtualMachineInstance. // --- // +k8s:openapi-gen=true -type VirtualMachineSpec struct { - // Specification of the desired behavior of the VirtualMachine on the host. +type VirtualMachineInstanceSpec struct { + // Specification of the desired behavior of the VirtualMachineInstance on the host. Domain DomainSpec `json:"domain"` - // NodeSelector is a selector which must be true for the vm to fit on a node. - // Selector which must match a node's labels for the vm to be scheduled on that node. + // NodeSelector is a selector which must be true for the vmi to fit on a node. + // Selector which must match a node's labels for the vmi to be scheduled on that node. // More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/ // +optional NodeSelector map[string]string `json:"nodeSelector,omitempty"` // If affinity is specifies, obey all the affinity rules Affinity *Affinity `json:"affinity,omitempty"` - // Grace period observed after signalling a VM to stop after which the VM is force terminated. + // Grace period observed after signalling a VirtualMachineInstance to stop after which the VirtualMachineInstance is force terminated. TerminationGracePeriodSeconds *int64 `json:"terminationGracePeriodSeconds,omitempty"` - // List of volumes that can be mounted by disks belonging to the vm. + // List of volumes that can be mounted by disks belonging to the vmi. Volumes []Volume `json:"volumes,omitempty"` + // Specifies the hostname of the vmi + // If not specified, the hostname will be set to the name of the vmi, if dhcp or cloud-init is configured properly. + // +optional + Hostname string `json:"hostname,omitempty"` + // If specified, the fully qualified vmi hostname will be "...svc.". + // If not specified, the vmi will not have a domainname at all. The DNS entry will resolve to the vmi, + // no matter if the vmi itself can pick up a hostname. + // +optional + Subdomain string `json:"subdomain,omitempty"` + // List of networks that can be attached to a vm's virtual interface. + Networks []Network `json:"networks,omitempty"` } -// Affinity groups all the affinity rules related to a VM +// Affinity groups all the affinity rules related to a VirtualMachineInstance // --- // +k8s:openapi-gen=true type Affinity struct { // Node affinity support NodeAffinity *k8sv1.NodeAffinity `json:"nodeAffinity,omitempty"` + + // Pod affinity support + PodAffinity *k8sv1.PodAffinity `json:"podAffinity,omitempty"` + + // Pod anti-affinity support + PodAntiAffinity *k8sv1.PodAntiAffinity `json:"podAntiAffinity,omitempty"` } -// VirtualMachineStatus represents information about the status of a VM. Status may trail the actual +// VirtualMachineInstanceStatus represents information about the status of a VirtualMachineInstance. Status may trail the actual // state of a system. // --- // +k8s:openapi-gen=true -type VirtualMachineStatus struct { - // NodeName is the name where the VM is currently running. +type VirtualMachineInstanceStatus struct { + // NodeName is the name where the VirtualMachineInstance is currently running. NodeName string `json:"nodeName,omitempty"` - // Conditions are specific points in VM's pod runtime. - Conditions []VirtualMachineCondition `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,omitempty"` + // Conditions are specific points in VirtualMachineInstance's pod runtime. + Conditions []VirtualMachineInstanceCondition `json:"conditions,omitempty"` + // Phase is the status of the VirtualMachineInstance in kubernetes world. It is not the VirtualMachineInstance status, but partially correlates to it. + Phase VirtualMachineInstancePhase `json:"phase,omitempty"` // Interfaces represent the details of available network interfaces. - Interfaces []VirtualMachineNetworkInterface `json:"interfaces,omitempty"` + Interfaces []VirtualMachineInstanceNetworkInterface `json:"interfaces,omitempty"` } // Required to satisfy Object interface -func (v *VirtualMachine) GetObjectKind() schema.ObjectKind { +func (v *VirtualMachineInstance) GetObjectKind() schema.ObjectKind { return &v.TypeMeta } // Required to satisfy ObjectMetaAccessor interface -func (v *VirtualMachine) GetObjectMeta() metav1.Object { +func (v *VirtualMachineInstance) GetObjectMeta() metav1.Object { return &v.ObjectMeta } -func (v *VirtualMachine) IsReady() bool { +func (v *VirtualMachineInstance) IsReady() bool { // TODO once we support a ready condition, use it instead return v.IsRunning() } -func (v *VirtualMachine) IsScheduling() bool { +func (v *VirtualMachineInstance) IsScheduling() bool { return v.Status.Phase == Scheduling } -func (v *VirtualMachine) IsScheduled() bool { +func (v *VirtualMachineInstance) IsScheduled() bool { return v.Status.Phase == Scheduled } -func (v *VirtualMachine) IsRunning() bool { +func (v *VirtualMachineInstance) IsRunning() bool { return v.Status.Phase == Running } -func (v *VirtualMachine) IsFinal() bool { +func (v *VirtualMachineInstance) IsFinal() bool { return v.Status.Phase == Failed || v.Status.Phase == Succeeded } -func (v *VirtualMachine) IsUnknown() bool { +func (v *VirtualMachineInstance) IsUnknown() bool { return v.Status.Phase == Unknown } -func (v *VirtualMachine) IsUnprocessed() bool { +func (v *VirtualMachineInstance) IsUnprocessed() bool { return v.Status.Phase == Pending || v.Status.Phase == VmPhaseUnset } // Required to satisfy Object interface -func (vl *VirtualMachineList) GetObjectKind() schema.ObjectKind { +func (vl *VirtualMachineInstanceList) GetObjectKind() schema.ObjectKind { return &vl.TypeMeta } // Required to satisfy ListMetaAccessor interface -func (vl *VirtualMachineList) GetListMeta() meta.List { +func (vl *VirtualMachineInstanceList) GetListMeta() meta.List { return &vl.ListMeta } -func (v *VirtualMachine) UnmarshalJSON(data []byte) error { - type VMCopy VirtualMachine - tmp := VMCopy{} +func (v *VirtualMachineInstance) UnmarshalJSON(data []byte) error { + type VMICopy VirtualMachineInstance + tmp := VMICopy{} err := json.Unmarshal(data, &tmp) if err != nil { return err } - tmp2 := VirtualMachine(tmp) + tmp2 := VirtualMachineInstance(tmp) *v = tmp2 return nil } -func (vl *VirtualMachineList) UnmarshalJSON(data []byte) error { - type VMListCopy VirtualMachineList - tmp := VMListCopy{} +func (vl *VirtualMachineInstanceList) UnmarshalJSON(data []byte) error { + type VMIListCopy VirtualMachineInstanceList + tmp := VMIListCopy{} err := json.Unmarshal(data, &tmp) if err != nil { return err } - tmp2 := VirtualMachineList(tmp) + tmp2 := VirtualMachineInstanceList(tmp) *vl = tmp2 return nil } -func (v *VirtualMachine) MarshalBinary() (data []byte, err error) { +func (v *VirtualMachineInstance) MarshalBinary() (data []byte, err error) { return json.Marshal(*v) } -func (v *VirtualMachine) UnmarshalBinary(data []byte) error { +func (v *VirtualMachineInstance) UnmarshalBinary(data []byte) error { return v.UnmarshalJSON(data) } // --- // +k8s:openapi-gen=true -type VirtualMachineConditionType string +type VirtualMachineInstanceConditionType string -// These are valid conditions of VMs. +// These are valid conditions of VMIs. const ( - // VMReady means the pod is able to service requests and should be added to the + // VMIReady means the pod is able to service requests and should be added to the // load balancing pools of all matching services. - VirtualMachineReady VirtualMachineConditionType = "Ready" + VirtualMachineInstanceReady VirtualMachineInstanceConditionType = "Ready" - // If there happens any error while trying to synchronize the VM with the Domain, + // If there happens any error while trying to synchronize the VirtualMachineInstance with the Domain, // this is reported as false. - VirtualMachineSynchronized VirtualMachineConditionType = "Synchronized" + VirtualMachineInstanceSynchronized VirtualMachineInstanceConditionType = "Synchronized" ) // --- // +k8s:openapi-gen=true -type VirtualMachineCondition struct { - Type VirtualMachineConditionType `json:"type"` - Status k8sv1.ConditionStatus `json:"status"` - LastProbeTime metav1.Time `json:"lastProbeTime,omitempty"` - LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"` - Reason string `json:"reason,omitempty"` - Message string `json:"message,omitempty"` +type VirtualMachineInstanceCondition struct { + Type VirtualMachineInstanceConditionType `json:"type"` + Status k8sv1.ConditionStatus `json:"status"` + LastProbeTime metav1.Time `json:"lastProbeTime,omitempty"` + LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"` + Reason string `json:"reason,omitempty"` + Message string `json:"message,omitempty"` } // --- // +k8s:openapi-gen=true -type VirtualMachineNetworkInterface struct { +type VirtualMachineInstanceNetworkInterface struct { // IP address of a Virtual Machine interface IP string `json:"ipAddress,omitempty"` // Hardware address of a Virtual Machine interface MAC string `json:"mac,omitempty"` } -// VMPhase is a label for the condition of a VM at the current time. +// VirtualMachineInstancePhase is a label for the condition of a VirtualMachineInstance at the current time. // --- // +k8s:openapi-gen=true -type VMPhase string +type VirtualMachineInstancePhase string // These are the valid statuses of pods. const ( - //When a VM Object is first initialized and no phase, or Pending is present. - VmPhaseUnset VMPhase = "" - // Pending means the VM has been accepted by the system. - Pending VMPhase = "Pending" + //When a VirtualMachineInstance Object is first initialized and no phase, or Pending is present. + VmPhaseUnset VirtualMachineInstancePhase = "" + // Pending means the VirtualMachineInstance has been accepted by the system. + Pending VirtualMachineInstancePhase = "Pending" // A target Pod exists but is not yet scheduled and in running state. - Scheduling VMPhase = "Scheduling" + Scheduling VirtualMachineInstancePhase = "Scheduling" // A target pod was scheduled and the system saw that Pod in runnig state. // Here is where the responsibility of virt-controller ends and virt-handler takes over. - Scheduled VMPhase = "Scheduled" - // Running means the pod has been bound to a node and the VM is started. - Running VMPhase = "Running" - // Succeeded means that the VM stopped voluntarily, e.g. reacted to SIGTERM or shutdown was invoked from - // inside the VM. - Succeeded VMPhase = "Succeeded" - // Failed means that the vm crashed, disappeared unexpectedly or got deleted from the cluster before it was ever started. - Failed VMPhase = "Failed" - // Unknown means that for some reason the state of the VM could not be obtained, typically due - // to an error in communicating with the host of the VM. - Unknown VMPhase = "Unknown" + Scheduled VirtualMachineInstancePhase = "Scheduled" + // Running means the pod has been bound to a node and the VirtualMachineInstance is started. + Running VirtualMachineInstancePhase = "Running" + // Succeeded means that the VirtualMachineInstance stopped voluntarily, e.g. reacted to SIGTERM or shutdown was invoked from + // inside the VirtualMachineInstance. + Succeeded VirtualMachineInstancePhase = "Succeeded" + // Failed means that the vmi crashed, disappeared unexpectedly or got deleted from the cluster before it was ever started. + Failed VirtualMachineInstancePhase = "Failed" + // Unknown means that for some reason the state of the VirtualMachineInstance could not be obtained, typically due + // to an error in communicating with the host of the VirtualMachineInstance. + Unknown VirtualMachineInstancePhase = "Unknown" ) const ( @@ -322,21 +339,21 @@ const ( NodeSchedulable string = "kubevirt.io/schedulable" VirtHandlerHeartbeat string = "kubevirt.io/heartbeat" - VirtualMachineFinalizer string = "foregroundDeleteVirtualMachine" + VirtualMachineInstanceFinalizer string = "foregroundDeleteVirtualMachine" ) -func NewVM(name string, uid types.UID) *VirtualMachine { - return &VirtualMachine{ - Spec: VirtualMachineSpec{}, +func NewVMI(name string, uid types.UID) *VirtualMachineInstance { + return &VirtualMachineInstance{ + Spec: VirtualMachineInstanceSpec{}, ObjectMeta: metav1.ObjectMeta{ Name: name, UID: uid, Namespace: k8sv1.NamespaceDefault, }, - Status: VirtualMachineStatus{}, + Status: VirtualMachineInstanceStatus{}, TypeMeta: metav1.TypeMeta{ APIVersion: GroupVersion.String(), - Kind: VirtualMachineGroupVersionKind.Kind, + Kind: VirtualMachineInstanceGroupVersionKind.Kind, }, } } @@ -361,47 +378,47 @@ func (s SyncEvent) String() string { return string(s) } -func NewMinimalVM(vmName string) *VirtualMachine { - return NewMinimalVMWithNS(k8sv1.NamespaceDefault, vmName) +func NewMinimalVMI(vmiName string) *VirtualMachineInstance { + return NewMinimalVMIWithNS(k8sv1.NamespaceDefault, vmiName) } -func NewMinimalVMWithNS(namespace string, vmName string) *VirtualMachine { - precond.CheckNotEmpty(vmName) - vm := NewVMReferenceFromNameWithNS(namespace, vmName) - vm.Spec = VirtualMachineSpec{Domain: NewMinimalDomainSpec()} - vm.TypeMeta = metav1.TypeMeta{ +func NewMinimalVMIWithNS(namespace string, vmiName string) *VirtualMachineInstance { + precond.CheckNotEmpty(vmiName) + vmi := NewVMIReferenceFromNameWithNS(namespace, vmiName) + vmi.Spec = VirtualMachineInstanceSpec{Domain: NewMinimalDomainSpec()} + vmi.TypeMeta = metav1.TypeMeta{ APIVersion: GroupVersion.String(), - Kind: "VirtualMachine", + Kind: "VirtualMachineInstance", } - return vm + return vmi } // TODO Namespace could be different, also store it somewhere in the domain, so that we can report deletes on handler startup properly -func NewVMReferenceFromName(name string) *VirtualMachine { - return NewVMReferenceFromNameWithNS(k8sv1.NamespaceDefault, name) +func NewVMIReferenceFromName(name string) *VirtualMachineInstance { + return NewVMIReferenceFromNameWithNS(k8sv1.NamespaceDefault, name) } -func NewVMReferenceFromNameWithNS(namespace string, name string) *VirtualMachine { - vm := &VirtualMachine{ +func NewVMIReferenceFromNameWithNS(namespace string, name string) *VirtualMachineInstance { + vmi := &VirtualMachineInstance{ ObjectMeta: metav1.ObjectMeta{ Name: name, Namespace: namespace, - SelfLink: fmt.Sprintf("/apis/%s/namespaces/%s/virtualmachines/%s", GroupVersion.String(), namespace, name), + SelfLink: fmt.Sprintf("/apis/%s/namespaces/%s/virtualmachineinstances/%s", GroupVersion.String(), namespace, name), }, } - vm.SetGroupVersionKind(schema.GroupVersionKind{Group: GroupVersion.Group, Kind: "VM", Version: GroupVersion.Version}) - return vm + vmi.SetGroupVersionKind(schema.GroupVersionKind{Group: GroupVersion.Group, Kind: "VirtualMachineInstance", Version: GroupVersion.Version}) + return vmi } -type VMSelector struct { - // Name of the VM to migrate +type VMISelector struct { + // Name of the VirtualMachineInstance to migrate Name string `json:"name" valid:"required"` } -// Given a VM, update all NodeSelectorTerms with anti-affinity for that VM's node. +// Given a VirtualMachineInstance, update all NodeSelectorTerms with anti-affinity for that VirtualMachineInstance's node. // This is useful for the case when a migration away from a node must occur. // This method returns the full Affinity structure updated the anti affinity terms -func UpdateAntiAffinityFromVMNode(pod *k8sv1.Pod, vm *VirtualMachine) *k8sv1.Affinity { +func UpdateAntiAffinityFromVMINode(pod *k8sv1.Pod, vmi *VirtualMachineInstance) *k8sv1.Affinity { if pod.Spec.Affinity == nil { pod.Spec.Affinity = &k8sv1.Affinity{} } @@ -427,49 +444,49 @@ func UpdateAntiAffinityFromVMNode(pod *k8sv1.Pod, vm *VirtualMachine) *k8sv1.Aff term.MatchExpressions = []k8sv1.NodeSelectorRequirement{} } - term.MatchExpressions = append(term.MatchExpressions, PrepareVMNodeAntiAffinitySelectorRequirement(vm)) + term.MatchExpressions = append(term.MatchExpressions, PrepareVMINodeAntiAffinitySelectorRequirement(vmi)) selector.NodeSelectorTerms[idx] = term } return pod.Spec.Affinity } -// Given a VM, create a NodeSelectorTerm with anti-affinity for that VM's node. +// Given a VirtualMachineInstance, create a NodeSelectorTerm with anti-affinity for that VirtualMachineInstance's node. // This is useful for the case when a migration away from a node must occur. -func PrepareVMNodeAntiAffinitySelectorRequirement(vm *VirtualMachine) k8sv1.NodeSelectorRequirement { +func PrepareVMINodeAntiAffinitySelectorRequirement(vmi *VirtualMachineInstance) k8sv1.NodeSelectorRequirement { return k8sv1.NodeSelectorRequirement{ Key: "kubernetes.io/hostname", Operator: k8sv1.NodeSelectorOpNotIn, - Values: []string{vm.Status.NodeName}, + Values: []string{vmi.Status.NodeName}, } } -// VM is *the* VM Definition. It represents a virtual machine in the runtime environment of kubernetes. +// VirtualMachineInstance is *the* VirtualMachineInstance Definition. It represents a virtual machine in the runtime environment of kubernetes. // --- // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +k8s:openapi-gen=true -type VirtualMachineReplicaSet struct { +type VirtualMachineInstanceReplicaSet struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` - // 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,omitempty"` + // VirtualMachineInstance Spec contains the VirtualMachineInstance specification. + Spec VirtualMachineInstanceReplicaSetSpec `json:"spec,omitempty" valid:"required"` + // Status is the high level overview of how the VirtualMachineInstance is doing. It contains information available to controllers and users. + Status VirtualMachineInstanceReplicaSetStatus `json:"status,omitempty"` } -// VMList is a list of VMs +// VMIList is a list of VMIs // --- // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +k8s:openapi-gen=true -type VirtualMachineReplicaSetList struct { +type VirtualMachineInstanceReplicaSetList struct { metav1.TypeMeta `json:",inline"` - ListMeta metav1.ListMeta `json:"metadata,omitempty"` - Items []VirtualMachineReplicaSet `json:"items"` + ListMeta metav1.ListMeta `json:"metadata,omitempty"` + Items []VirtualMachineInstanceReplicaSet `json:"items"` } // --- // +k8s:openapi-gen=true -type VMReplicaSetSpec struct { +type VirtualMachineInstanceReplicaSetSpec struct { // Number of desired pods. This is a pointer to distinguish between explicit // zero and not specified. Defaults to 1. // +optional @@ -477,11 +494,10 @@ type VMReplicaSetSpec struct { // Label selector for pods. Existing ReplicaSets whose pods are // selected by this will be the ones affected by this deployment. - // +optional - Selector *metav1.LabelSelector `json:"selector,omitempty" valid:"required"` + Selector *metav1.LabelSelector `json:"selector" valid:"required"` // Template describes the pods that will be created. - Template *VMTemplateSpec `json:"template" valid:"required"` + Template *VirtualMachineInstanceTemplateSpec `json:"template" valid:"required"` // Indicates that the replica set is paused. // +optional @@ -490,7 +506,7 @@ type VMReplicaSetSpec struct { // --- // +k8s:openapi-gen=true -type VMReplicaSetStatus struct { +type VirtualMachineInstanceReplicaSetStatus struct { // Total number of non-terminated pods targeted by this deployment (their labels match the selector). // +optional Replicas int32 `json:"replicas,omitempty" protobuf:"varint,2,opt,name=replicas"` @@ -499,132 +515,132 @@ type VMReplicaSetStatus struct { // +optional ReadyReplicas int32 `json:"readyReplicas,omitempty" protobuf:"varint,4,opt,name=readyReplicas"` - Conditions []VMReplicaSetCondition `json:"conditions,omitempty" optional:"true"` + Conditions []VirtualMachineInstanceReplicaSetCondition `json:"conditions,omitempty" optional:"true"` } // --- // +k8s:openapi-gen=true -type VMReplicaSetCondition struct { - Type VMReplicaSetConditionType `json:"type"` - Status k8sv1.ConditionStatus `json:"status"` - LastProbeTime metav1.Time `json:"lastProbeTime,omitempty"` - LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"` - Reason string `json:"reason,omitempty"` - Message string `json:"message,omitempty"` +type VirtualMachineInstanceReplicaSetCondition struct { + Type VirtualMachineInstanceReplicaSetConditionType `json:"type"` + Status k8sv1.ConditionStatus `json:"status"` + LastProbeTime metav1.Time `json:"lastProbeTime,omitempty"` + LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"` + Reason string `json:"reason,omitempty"` + Message string `json:"message,omitempty"` } // --- // +k8s:openapi-gen=true -type VMReplicaSetConditionType string +type VirtualMachineInstanceReplicaSetConditionType string const ( - // VMReplicaSetReplicaFailure is added in a replica set when one of its vms + // VirtualMachineInstanceReplicaSetReplicaFailure is added in a replica set when one of its vmis // fails to be created due to insufficient quota, limit ranges, pod security policy, node selectors, // etc. or deleted due to kubelet being down or finalizers are failing. - VMReplicaSetReplicaFailure VMReplicaSetConditionType = "ReplicaFailure" + VirtualMachineInstanceReplicaSetReplicaFailure VirtualMachineInstanceReplicaSetConditionType = "ReplicaFailure" - // VMReplicaSetReplicaPaused is added in a replica set when the replica set got paused by the controller. - // After this condition was added, it is safe to remove or add vms by hand and adjust the replica count by hand. - VMReplicaSetReplicaPaused VMReplicaSetConditionType = "ReplicaPaused" + // VirtualMachineInstanceReplicaSetReplicaPaused is added in a replica set when the replica set got paused by the controller. + // After this condition was added, it is safe to remove or add vmis by hand and adjust the replica count by hand. + VirtualMachineInstanceReplicaSetReplicaPaused VirtualMachineInstanceReplicaSetConditionType = "ReplicaPaused" ) // --- // +k8s:openapi-gen=true -type VMTemplateSpec struct { +type VirtualMachineInstanceTemplateSpec struct { ObjectMeta metav1.ObjectMeta `json:"metadata,omitempty"` - // VM Spec contains the VM specification. - Spec VirtualMachineSpec `json:"spec,omitempty" valid:"required"` + // VirtualMachineInstance Spec contains the VirtualMachineInstance specification. + Spec VirtualMachineInstanceSpec `json:"spec,omitempty" valid:"required"` } // Required to satisfy Object interface -func (v *VirtualMachineReplicaSet) GetObjectKind() schema.ObjectKind { +func (v *VirtualMachineInstanceReplicaSet) GetObjectKind() schema.ObjectKind { return &v.TypeMeta } // Required to satisfy ObjectMetaAccessor interface -func (v *VirtualMachineReplicaSet) GetObjectMeta() metav1.Object { +func (v *VirtualMachineInstanceReplicaSet) GetObjectMeta() metav1.Object { return &v.ObjectMeta } -func (v *VirtualMachineReplicaSet) UnmarshalJSON(data []byte) error { - type VMReplicaSetCopy VirtualMachineReplicaSet - tmp := VMReplicaSetCopy{} +func (v *VirtualMachineInstanceReplicaSet) UnmarshalJSON(data []byte) error { + type VMIReplicaSetCopy VirtualMachineInstanceReplicaSet + tmp := VMIReplicaSetCopy{} err := json.Unmarshal(data, &tmp) if err != nil { return err } - tmp2 := VirtualMachineReplicaSet(tmp) + tmp2 := VirtualMachineInstanceReplicaSet(tmp) *v = tmp2 return nil } -func (vl *VirtualMachineReplicaSetList) UnmarshalJSON(data []byte) error { - type VMReplicaSetListCopy VirtualMachineReplicaSetList - tmp := VMReplicaSetListCopy{} +func (vl *VirtualMachineInstanceReplicaSetList) UnmarshalJSON(data []byte) error { + type VMIReplicaSetListCopy VirtualMachineInstanceReplicaSetList + tmp := VMIReplicaSetListCopy{} err := json.Unmarshal(data, &tmp) if err != nil { return err } - tmp2 := VirtualMachineReplicaSetList(tmp) + tmp2 := VirtualMachineInstanceReplicaSetList(tmp) *vl = tmp2 return nil } // Required to satisfy Object interface -func (vl *VirtualMachineReplicaSetList) GetObjectKind() schema.ObjectKind { +func (vl *VirtualMachineInstanceReplicaSetList) GetObjectKind() schema.ObjectKind { return &vl.TypeMeta } // Required to satisfy ListMetaAccessor interface -func (vl *VirtualMachineReplicaSetList) GetListMeta() meta.List { +func (vl *VirtualMachineInstanceReplicaSetList) GetListMeta() meta.List { return &vl.ListMeta } // --- // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +k8s:openapi-gen=true -type VirtualMachinePreset struct { +type VirtualMachineInstancePreset struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` - // VM Spec contains the VM specification. - Spec VirtualMachinePresetSpec `json:"spec,omitempty" valid:"required"` + // VirtualMachineInstance Spec contains the VirtualMachineInstance specification. + Spec VirtualMachineInstancePresetSpec `json:"spec,omitempty" valid:"required"` } // Required to satisfy Object interface -func (v *VirtualMachinePreset) GetObjectKind() schema.ObjectKind { +func (v *VirtualMachineInstancePreset) GetObjectKind() schema.ObjectKind { return &v.TypeMeta } // Required to satisfy ObjectMetaAccessor interface -func (v *VirtualMachinePreset) GetObjectMeta() metav1.Object { +func (v *VirtualMachineInstancePreset) GetObjectMeta() metav1.Object { return &v.ObjectMeta } -// VirtualMachinePresetList is a list of VirtualMachinePresets +// VirtualMachineInstancePresetList is a list of VirtualMachinePresets // --- // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +k8s:openapi-gen=true -type VirtualMachinePresetList struct { +type VirtualMachineInstancePresetList struct { metav1.TypeMeta `json:",inline"` - ListMeta metav1.ListMeta `json:"metadata,omitempty"` - Items []VirtualMachinePreset `json:"items"` + ListMeta metav1.ListMeta `json:"metadata,omitempty"` + Items []VirtualMachineInstancePreset `json:"items"` } // --- // +k8s:openapi-gen=true -type VirtualMachinePresetSpec struct { - // Selector is a label query over a set of VMs. +type VirtualMachineInstancePresetSpec struct { + // Selector is a label query over a set of VMIs. // Required. Selector metav1.LabelSelector `json:"selector"` - // Domain is the same object type as contained in VirtualMachineSpec - Domain *DomainSpec `json:"domain,omitempty"` + // Domain is the same object type as contained in VirtualMachineInstanceSpec + Domain *DomainPresetSpec `json:"domain,omitempty"` } -func NewVirtualMachinePreset(name string, selector metav1.LabelSelector) *VirtualMachinePreset { - return &VirtualMachinePreset{ - Spec: VirtualMachinePresetSpec{ +func NewVirtualMachinePreset(name string, selector metav1.LabelSelector) *VirtualMachineInstancePreset { + return &VirtualMachineInstancePreset{ + Spec: VirtualMachineInstancePresetSpec{ Selector: selector, - Domain: &DomainSpec{}, + Domain: &DomainPresetSpec{}, }, ObjectMeta: metav1.ObjectMeta{ Name: name, @@ -632,118 +648,118 @@ func NewVirtualMachinePreset(name string, selector metav1.LabelSelector) *Virtua }, TypeMeta: metav1.TypeMeta{ APIVersion: GroupVersion.String(), - Kind: VirtualMachinePresetGroupVersionKind.Kind, + Kind: VirtualMachineInstancePresetGroupVersionKind.Kind, }, } } -func (vl *VirtualMachinePresetList) UnmarshalJSON(data []byte) error { - type VirtualMachinePresetListCopy VirtualMachinePresetList +func (vl *VirtualMachineInstancePresetList) UnmarshalJSON(data []byte) error { + type VirtualMachinePresetListCopy VirtualMachineInstancePresetList tmp := VirtualMachinePresetListCopy{} err := json.Unmarshal(data, &tmp) if err != nil { return err } - tmp2 := VirtualMachinePresetList(tmp) + tmp2 := VirtualMachineInstancePresetList(tmp) *vl = tmp2 return nil } // Required to satisfy Object interface -func (vl *VirtualMachinePresetList) GetObjectKind() schema.ObjectKind { +func (vl *VirtualMachineInstancePresetList) GetObjectKind() schema.ObjectKind { return &vl.TypeMeta } // Required to satisfy ListMetaAccessor interface -func (vl *VirtualMachinePresetList) GetListMeta() meta.List { +func (vl *VirtualMachineInstancePresetList) GetListMeta() meta.List { return &vl.ListMeta } -// OfflineVirtualMachine handles the VirtualMachines that are not running +// VirtualMachine handles the VirtualMachines that are not running // or are in a stopped state -// The OfflineVirtualMachine contains the template to create the -// VirtualMachine. It also mirrors the running state of the created -// VirtualMachine in its status. +// The VirtualMachine contains the template to create the +// VirtualMachineInstance. It also mirrors the running state of the created +// VirtualMachineInstance in its status. // --- // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +k8s:openapi-gen=true -type OfflineVirtualMachine struct { +type VirtualMachine struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` - // Spec contains the specification of VirtualMachine created - Spec OfflineVirtualMachineSpec `json:"spec,omitempty"` + // Spec contains the specification of VirtualMachineInstance created + Spec VirtualMachineSpec `json:"spec,omitempty"` // Status holds the current state of the controller and brief information - // about its associated VirtualMachine - Status OfflineVirtualMachineStatus `json:"status,omitempty"` + // about its associated VirtualMachineInstance + Status VirtualMachineStatus `json:"status,omitempty"` } -// OfflineVirtualMachineList is a list of offlinevirtualmachines +// VirtualMachineList is a list of virtualmachines // --- // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +k8s:openapi-gen=true -type OfflineVirtualMachineList struct { +type VirtualMachineList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata"` - // Items is a list of OfflineVirtualMachines - Items []OfflineVirtualMachine `json:"items"` + // Items is a list of VirtualMachines + Items []VirtualMachine `json:"items"` } -// OfflineVirtualMachineSpec describes how the proper OfflineVirtualMachine +// VirtualMachineSpec describes how the proper VirtualMachine // should look like // --- // +k8s:openapi-gen=true -type OfflineVirtualMachineSpec struct { - // Running controlls whether the associatied VirtualMachine is created or not +type VirtualMachineSpec struct { + // Running controls whether the associatied VirtualMachineInstance is created or not Running bool `json:"running"` - // Template is the direct specification of VirtualMachine - Template *VMTemplateSpec `json:"template"` + // Template is the direct specification of VirtualMachineInstance + Template *VirtualMachineInstanceTemplateSpec `json:"template"` } -// OfflineVirtualMachineStatus represents the status returned by the -// controller to describe how the OfflineVirtualMachine is doing +// VirtualMachineStatus represents the status returned by the +// controller to describe how the VirtualMachine is doing // --- // +k8s:openapi-gen=true -type OfflineVirtualMachineStatus struct { - // Hold the state information of the OfflineVirtualMachine and its VirtualMachine - Conditions []OfflineVirtualMachineCondition `json:"conditions,omitempty" optional:"true"` +type VirtualMachineStatus struct { + // Created indicates if the virtual machine is created in the cluster + Created bool `json:"created,omitempty"` + // Ready indicates if the virtual machine is running and ready + Ready bool `json:"ready,omitempty"` + // Hold the state information of the VirtualMachine and its VirtualMachineInstance + Conditions []VirtualMachineCondition `json:"conditions,omitempty" optional:"true"` } // GetObjectKind is required to satisfy Object interface -func (v *OfflineVirtualMachine) GetObjectKind() schema.ObjectKind { +func (v *VirtualMachine) GetObjectKind() schema.ObjectKind { return &v.TypeMeta } // GetObjectMeta is required to satisfy ObjectMetaAccessor interface -func (v *OfflineVirtualMachine) GetObjectMeta() metav1.Object { +func (v *VirtualMachine) GetObjectMeta() metav1.Object { return &v.ObjectMeta } -// OfflineVirtualMachineCondition represents the state of OfflineVirtualMachine +// VirtualMachineCondition represents the state of VirtualMachine // --- // +k8s:openapi-gen=true -type OfflineVirtualMachineCondition struct { - Type OfflineVirtualMachineConditionType `json:"type"` - Status k8sv1.ConditionStatus `json:"status"` - LastProbeTime metav1.Time `json:"lastProbeTime,omitempty"` - LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"` - Reason string `json:"reason,omitempty"` - Message string `json:"message,omitempty"` +type VirtualMachineCondition struct { + Type VirtualMachineConditionType `json:"type"` + Status k8sv1.ConditionStatus `json:"status"` + LastProbeTime metav1.Time `json:"lastProbeTime,omitempty"` + LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"` + Reason string `json:"reason,omitempty"` + Message string `json:"message,omitempty"` } // --- // +k8s:openapi-gen=true -type OfflineVirtualMachineConditionType string +type VirtualMachineConditionType string const ( - // OfflineVirtualMachineFailure is added in a offline virtual machine when its vm + // VirtualMachineFailure is added in a offline virtual machine when its vmi // fails to be created due to insufficient quota, limit ranges, pod security policy, node selectors, // etc. or deleted due to kubelet being down or finalizers are failing. - OfflineVirtualMachineFailure OfflineVirtualMachineConditionType = "Failure" - - // OfflineVirtualMachineRunning is added in a offline virtual machine when the VM succesfully runs. - // After this condition was added, the VM is up and running. - OfflineVirtualMachineRunning OfflineVirtualMachineConditionType = "Running" + VirtualMachineFailure VirtualMachineConditionType = "Failure" ) diff --git a/vendor/kubevirt.io/kubevirt/pkg/api/v1/types_swagger_generated.go b/vendor/kubevirt.io/kubevirt/pkg/api/v1/types_swagger_generated.go index 11d812507..289cf243e 100644 --- a/vendor/kubevirt.io/kubevirt/pkg/api/v1/types_swagger_generated.go +++ b/vendor/kubevirt.io/kubevirt/pkg/api/v1/types_swagger_generated.go @@ -2,156 +2,163 @@ package v1 -func (VirtualMachine) SwaggerDoc() map[string]string { +func (VirtualMachineInstance) SwaggerDoc() map[string]string { return map[string]string{ - "": "VirtualMachine is *the* VM Definition. It represents a virtual machine in the runtime environment of kubernetes.", - "spec": "VM Spec contains the VM specification.", - "status": "Status is the high level overview of how the VM is doing. It contains information available to controllers and users.", + "": "VirtualMachineInstance is *the* VirtualMachineInstance Definition. It represents a virtual machine in the runtime environment of kubernetes.", + "spec": "VirtualMachineInstance Spec contains the VirtualMachineInstance specification.", + "status": "Status is the high level overview of how the VirtualMachineInstance is doing. It contains information available to controllers and users.", } } -func (VirtualMachineList) SwaggerDoc() map[string]string { +func (VirtualMachineInstanceList) SwaggerDoc() map[string]string { return map[string]string{ - "": "VirtualMachineList is a list of VirtualMachines", + "": "VirtualMachineInstanceList is a list of VirtualMachines", } } -func (VirtualMachineSpec) SwaggerDoc() map[string]string { +func (VirtualMachineInstanceSpec) SwaggerDoc() map[string]string { return map[string]string{ - "": "VirtualMachineSpec is a description of a VirtualMachine.", - "domain": "Specification of the desired behavior of the VirtualMachine on the host.", - "nodeSelector": "NodeSelector is a selector which must be true for the vm to fit on a node.\nSelector which must match a node's labels for the vm to be scheduled on that node.\nMore info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/\n+optional", + "": "VirtualMachineInstanceSpec is a description of a VirtualMachineInstance.", + "domain": "Specification of the desired behavior of the VirtualMachineInstance on the host.", + "nodeSelector": "NodeSelector is a selector which must be true for the vmi to fit on a node.\nSelector which must match a node's labels for the vmi to be scheduled on that node.\nMore info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/\n+optional", "affinity": "If affinity is specifies, obey all the affinity rules", - "terminationGracePeriodSeconds": "Grace period observed after signalling a VM to stop after which the VM is force terminated.", - "volumes": "List of volumes that can be mounted by disks belonging to the vm.", + "terminationGracePeriodSeconds": "Grace period observed after signalling a VirtualMachineInstance to stop after which the VirtualMachineInstance is force terminated.", + "volumes": "List of volumes that can be mounted by disks belonging to the vmi.", + "hostname": "Specifies the hostname of the vmi\nIf not specified, the hostname will be set to the name of the vmi, if dhcp or cloud-init is configured properly.\n+optional", + "subdomain": "If specified, the fully qualified vmi hostname will be \"...svc.\".\nIf not specified, the vmi will not have a domainname at all. The DNS entry will resolve to the vmi,\nno matter if the vmi itself can pick up a hostname.\n+optional", + "networks": "List of networks that can be attached to a vm's virtual interface.", } } func (Affinity) SwaggerDoc() map[string]string { return map[string]string{ - "": "Affinity groups all the affinity rules related to a VM", - "nodeAffinity": "Node affinity support", + "": "Affinity groups all the affinity rules related to a VirtualMachineInstance", + "nodeAffinity": "Node affinity support", + "podAffinity": "Pod affinity support", + "podAntiAffinity": "Pod anti-affinity support", } } -func (VirtualMachineStatus) SwaggerDoc() map[string]string { +func (VirtualMachineInstanceStatus) SwaggerDoc() map[string]string { return map[string]string{ - "": "VirtualMachineStatus represents information about the status of a VM. Status may trail the actual\nstate of a system.", - "nodeName": "NodeName is the name where the VM is currently running.", - "conditions": "Conditions are specific points in VM's pod runtime.", - "phase": "Phase is the status of the VM in kubernetes world. It is not the VM status, but partially correlates to it.", + "": "VirtualMachineInstanceStatus represents information about the status of a VirtualMachineInstance. Status may trail the actual\nstate of a system.", + "nodeName": "NodeName is the name where the VirtualMachineInstance is currently running.", + "conditions": "Conditions are specific points in VirtualMachineInstance's pod runtime.", + "phase": "Phase is the status of the VirtualMachineInstance in kubernetes world. It is not the VirtualMachineInstance status, but partially correlates to it.", "interfaces": "Interfaces represent the details of available network interfaces.", } } -func (VirtualMachineCondition) SwaggerDoc() map[string]string { +func (VirtualMachineInstanceCondition) SwaggerDoc() map[string]string { return map[string]string{} } -func (VirtualMachineNetworkInterface) SwaggerDoc() map[string]string { +func (VirtualMachineInstanceNetworkInterface) SwaggerDoc() map[string]string { return map[string]string{ "ipAddress": "IP address of a Virtual Machine interface", "mac": "Hardware address of a Virtual Machine interface", } } -func (VMSelector) SwaggerDoc() map[string]string { +func (VMISelector) SwaggerDoc() map[string]string { return map[string]string{ - "name": "Name of the VM to migrate", + "name": "Name of the VirtualMachineInstance to migrate", } } -func (VirtualMachineReplicaSet) SwaggerDoc() map[string]string { +func (VirtualMachineInstanceReplicaSet) SwaggerDoc() map[string]string { return map[string]string{ - "": "VM is *the* VM Definition. It represents a virtual machine in the runtime environment of kubernetes.", - "spec": "VM Spec contains the VM specification.", - "status": "Status is the high level overview of how the VM is doing. It contains information available to controllers and users.", + "": "VirtualMachineInstance is *the* VirtualMachineInstance Definition. It represents a virtual machine in the runtime environment of kubernetes.", + "spec": "VirtualMachineInstance Spec contains the VirtualMachineInstance specification.", + "status": "Status is the high level overview of how the VirtualMachineInstance is doing. It contains information available to controllers and users.", } } -func (VirtualMachineReplicaSetList) SwaggerDoc() map[string]string { +func (VirtualMachineInstanceReplicaSetList) SwaggerDoc() map[string]string { return map[string]string{ - "": "VMList is a list of VMs", + "": "VMIList is a list of VMIs", } } -func (VMReplicaSetSpec) SwaggerDoc() map[string]string { +func (VirtualMachineInstanceReplicaSetSpec) SwaggerDoc() map[string]string { return map[string]string{ "replicas": "Number of desired pods. This is a pointer to distinguish between explicit\nzero and not specified. Defaults to 1.\n+optional", - "selector": "Label selector for pods. Existing ReplicaSets whose pods are\nselected by this will be the ones affected by this deployment.\n+optional", + "selector": "Label selector for pods. Existing ReplicaSets whose pods are\nselected by this will be the ones affected by this deployment.", "template": "Template describes the pods that will be created.", "paused": "Indicates that the replica set is paused.\n+optional", } } -func (VMReplicaSetStatus) SwaggerDoc() map[string]string { +func (VirtualMachineInstanceReplicaSetStatus) SwaggerDoc() map[string]string { return map[string]string{ "replicas": "Total number of non-terminated pods targeted by this deployment (their labels match the selector).\n+optional", "readyReplicas": "The number of ready replicas for this replica set.\n+optional", } } -func (VMReplicaSetCondition) SwaggerDoc() map[string]string { +func (VirtualMachineInstanceReplicaSetCondition) SwaggerDoc() map[string]string { return map[string]string{} } -func (VMTemplateSpec) SwaggerDoc() map[string]string { +func (VirtualMachineInstanceTemplateSpec) SwaggerDoc() map[string]string { return map[string]string{ - "spec": "VM Spec contains the VM specification.", + "spec": "VirtualMachineInstance Spec contains the VirtualMachineInstance specification.", } } -func (VirtualMachinePreset) SwaggerDoc() map[string]string { +func (VirtualMachineInstancePreset) SwaggerDoc() map[string]string { return map[string]string{ - "spec": "VM Spec contains the VM specification.", + "spec": "VirtualMachineInstance Spec contains the VirtualMachineInstance specification.", } } -func (VirtualMachinePresetList) SwaggerDoc() map[string]string { +func (VirtualMachineInstancePresetList) SwaggerDoc() map[string]string { return map[string]string{ - "": "VirtualMachinePresetList is a list of VirtualMachinePresets", + "": "VirtualMachineInstancePresetList is a list of VirtualMachinePresets", } } -func (VirtualMachinePresetSpec) SwaggerDoc() map[string]string { +func (VirtualMachineInstancePresetSpec) SwaggerDoc() map[string]string { return map[string]string{ - "selector": "Selector is a label query over a set of VMs.\nRequired.", - "domain": "Domain is the same object type as contained in VirtualMachineSpec", + "selector": "Selector is a label query over a set of VMIs.\nRequired.", + "domain": "Domain is the same object type as contained in VirtualMachineInstanceSpec", } } -func (OfflineVirtualMachine) SwaggerDoc() map[string]string { +func (VirtualMachine) SwaggerDoc() map[string]string { return map[string]string{ - "": "OfflineVirtualMachine handles the VirtualMachines that are not running\nor are in a stopped state\nThe OfflineVirtualMachine contains the template to create the\nVirtualMachine. It also mirrors the running state of the created\nVirtualMachine in its status.", - "spec": "Spec contains the specification of VirtualMachine created", - "status": "Status holds the current state of the controller and brief information\nabout its associated VirtualMachine", + "": "VirtualMachine handles the VirtualMachines that are not running\nor are in a stopped state\nThe VirtualMachine contains the template to create the\nVirtualMachineInstance. It also mirrors the running state of the created\nVirtualMachineInstance in its status.", + "spec": "Spec contains the specification of VirtualMachineInstance created", + "status": "Status holds the current state of the controller and brief information\nabout its associated VirtualMachineInstance", } } -func (OfflineVirtualMachineList) SwaggerDoc() map[string]string { +func (VirtualMachineList) SwaggerDoc() map[string]string { return map[string]string{ - "": "OfflineVirtualMachineList is a list of offlinevirtualmachines", - "items": "Items is a list of OfflineVirtualMachines", + "": "VirtualMachineList is a list of virtualmachines", + "items": "Items is a list of VirtualMachines", } } -func (OfflineVirtualMachineSpec) SwaggerDoc() map[string]string { +func (VirtualMachineSpec) SwaggerDoc() map[string]string { return map[string]string{ - "": "OfflineVirtualMachineSpec describes how the proper OfflineVirtualMachine\nshould look like", - "running": "Running controlls whether the associatied VirtualMachine is created or not", - "template": "Template is the direct specification of VirtualMachine", + "": "VirtualMachineSpec describes how the proper VirtualMachine\nshould look like", + "running": "Running controls whether the associatied VirtualMachineInstance is created or not", + "template": "Template is the direct specification of VirtualMachineInstance", } } -func (OfflineVirtualMachineStatus) SwaggerDoc() map[string]string { +func (VirtualMachineStatus) SwaggerDoc() map[string]string { return map[string]string{ - "": "OfflineVirtualMachineStatus represents the status returned by the\ncontroller to describe how the OfflineVirtualMachine is doing", - "conditions": "Hold the state information of the OfflineVirtualMachine and its VirtualMachine", + "": "VirtualMachineStatus represents the status returned by the\ncontroller to describe how the VirtualMachine is doing", + "created": "Created indicates if the virtual machine is created in the cluster", + "ready": "Ready indicates if the virtual machine is running and ready", + "conditions": "Hold the state information of the VirtualMachine and its VirtualMachineInstance", } } -func (OfflineVirtualMachineCondition) SwaggerDoc() map[string]string { +func (VirtualMachineCondition) SwaggerDoc() map[string]string { return map[string]string{ - "": "OfflineVirtualMachineCondition represents the state of OfflineVirtualMachine", + "": "VirtualMachineCondition represents the state of VirtualMachine", } } diff --git a/vendor/kubevirt.io/kubevirt/pkg/api/v1/zz_generated.defaults.go b/vendor/kubevirt.io/kubevirt/pkg/api/v1/zz_generated.defaults.go index 51d90d714..c8ecaa5a9 100644 --- a/vendor/kubevirt.io/kubevirt/pkg/api/v1/zz_generated.defaults.go +++ b/vendor/kubevirt.io/kubevirt/pkg/api/v1/zz_generated.defaults.go @@ -28,20 +28,26 @@ import ( // Public to allow building arbitrary schemes. // All generated defaulters are covering - they call all nested defaulters. func RegisterDefaults(scheme *runtime.Scheme) error { - scheme.AddTypeDefaultingFunc(&OfflineVirtualMachine{}, func(obj interface{}) { SetObjectDefaults_OfflineVirtualMachine(obj.(*OfflineVirtualMachine)) }) - scheme.AddTypeDefaultingFunc(&OfflineVirtualMachineList{}, func(obj interface{}) { SetObjectDefaults_OfflineVirtualMachineList(obj.(*OfflineVirtualMachineList)) }) scheme.AddTypeDefaultingFunc(&VirtualMachine{}, func(obj interface{}) { SetObjectDefaults_VirtualMachine(obj.(*VirtualMachine)) }) - scheme.AddTypeDefaultingFunc(&VirtualMachineList{}, func(obj interface{}) { SetObjectDefaults_VirtualMachineList(obj.(*VirtualMachineList)) }) - scheme.AddTypeDefaultingFunc(&VirtualMachinePreset{}, func(obj interface{}) { SetObjectDefaults_VirtualMachinePreset(obj.(*VirtualMachinePreset)) }) - scheme.AddTypeDefaultingFunc(&VirtualMachinePresetList{}, func(obj interface{}) { SetObjectDefaults_VirtualMachinePresetList(obj.(*VirtualMachinePresetList)) }) - scheme.AddTypeDefaultingFunc(&VirtualMachineReplicaSet{}, func(obj interface{}) { SetObjectDefaults_VirtualMachineReplicaSet(obj.(*VirtualMachineReplicaSet)) }) - scheme.AddTypeDefaultingFunc(&VirtualMachineReplicaSetList{}, func(obj interface{}) { - SetObjectDefaults_VirtualMachineReplicaSetList(obj.(*VirtualMachineReplicaSetList)) + scheme.AddTypeDefaultingFunc(&VirtualMachineInstance{}, func(obj interface{}) { SetObjectDefaults_VirtualMachineInstance(obj.(*VirtualMachineInstance)) }) + scheme.AddTypeDefaultingFunc(&VirtualMachineInstanceList{}, func(obj interface{}) { SetObjectDefaults_VirtualMachineInstanceList(obj.(*VirtualMachineInstanceList)) }) + scheme.AddTypeDefaultingFunc(&VirtualMachineInstancePreset{}, func(obj interface{}) { + SetObjectDefaults_VirtualMachineInstancePreset(obj.(*VirtualMachineInstancePreset)) + }) + scheme.AddTypeDefaultingFunc(&VirtualMachineInstancePresetList{}, func(obj interface{}) { + SetObjectDefaults_VirtualMachineInstancePresetList(obj.(*VirtualMachineInstancePresetList)) + }) + scheme.AddTypeDefaultingFunc(&VirtualMachineInstanceReplicaSet{}, func(obj interface{}) { + SetObjectDefaults_VirtualMachineInstanceReplicaSet(obj.(*VirtualMachineInstanceReplicaSet)) }) + scheme.AddTypeDefaultingFunc(&VirtualMachineInstanceReplicaSetList{}, func(obj interface{}) { + SetObjectDefaults_VirtualMachineInstanceReplicaSetList(obj.(*VirtualMachineInstanceReplicaSetList)) + }) + scheme.AddTypeDefaultingFunc(&VirtualMachineList{}, func(obj interface{}) { SetObjectDefaults_VirtualMachineList(obj.(*VirtualMachineList)) }) return nil } -func SetObjectDefaults_OfflineVirtualMachine(in *OfflineVirtualMachine) { +func SetObjectDefaults_VirtualMachine(in *VirtualMachine) { if in.Spec.Template != nil { if in.Spec.Template.Spec.Domain.Firmware != nil { SetDefaults_Firmware(in.Spec.Template.Spec.Domain.Firmware) @@ -119,15 +125,8 @@ func SetObjectDefaults_OfflineVirtualMachine(in *OfflineVirtualMachine) { } } -func SetObjectDefaults_OfflineVirtualMachineList(in *OfflineVirtualMachineList) { - for i := range in.Items { - a := &in.Items[i] - SetObjectDefaults_OfflineVirtualMachine(a) - } -} - -func SetObjectDefaults_VirtualMachine(in *VirtualMachine) { - SetDefaults_VirtualMachine(in) +func SetObjectDefaults_VirtualMachineInstance(in *VirtualMachineInstance) { + SetDefaults_VirtualMachineInstance(in) if in.Spec.Domain.Firmware != nil { SetDefaults_Firmware(in.Spec.Domain.Firmware) } @@ -203,14 +202,14 @@ func SetObjectDefaults_VirtualMachine(in *VirtualMachine) { } } -func SetObjectDefaults_VirtualMachineList(in *VirtualMachineList) { +func SetObjectDefaults_VirtualMachineInstanceList(in *VirtualMachineInstanceList) { for i := range in.Items { a := &in.Items[i] - SetObjectDefaults_VirtualMachine(a) + SetObjectDefaults_VirtualMachineInstance(a) } } -func SetObjectDefaults_VirtualMachinePreset(in *VirtualMachinePreset) { +func SetObjectDefaults_VirtualMachineInstancePreset(in *VirtualMachineInstancePreset) { if in.Spec.Domain != nil { if in.Spec.Domain.Firmware != nil { SetDefaults_Firmware(in.Spec.Domain.Firmware) @@ -288,14 +287,14 @@ func SetObjectDefaults_VirtualMachinePreset(in *VirtualMachinePreset) { } } -func SetObjectDefaults_VirtualMachinePresetList(in *VirtualMachinePresetList) { +func SetObjectDefaults_VirtualMachineInstancePresetList(in *VirtualMachineInstancePresetList) { for i := range in.Items { a := &in.Items[i] - SetObjectDefaults_VirtualMachinePreset(a) + SetObjectDefaults_VirtualMachineInstancePreset(a) } } -func SetObjectDefaults_VirtualMachineReplicaSet(in *VirtualMachineReplicaSet) { +func SetObjectDefaults_VirtualMachineInstanceReplicaSet(in *VirtualMachineInstanceReplicaSet) { if in.Spec.Template != nil { if in.Spec.Template.Spec.Domain.Firmware != nil { SetDefaults_Firmware(in.Spec.Template.Spec.Domain.Firmware) @@ -373,9 +372,16 @@ func SetObjectDefaults_VirtualMachineReplicaSet(in *VirtualMachineReplicaSet) { } } -func SetObjectDefaults_VirtualMachineReplicaSetList(in *VirtualMachineReplicaSetList) { +func SetObjectDefaults_VirtualMachineInstanceReplicaSetList(in *VirtualMachineInstanceReplicaSetList) { + for i := range in.Items { + a := &in.Items[i] + SetObjectDefaults_VirtualMachineInstanceReplicaSet(a) + } +} + +func SetObjectDefaults_VirtualMachineList(in *VirtualMachineList) { for i := range in.Items { a := &in.Items[i] - SetObjectDefaults_VirtualMachineReplicaSet(a) + SetObjectDefaults_VirtualMachine(a) } } diff --git a/vendor/kubevirt.io/kubevirt/pkg/cloud-init/cloud-init.go b/vendor/kubevirt.io/kubevirt/pkg/cloud-init/cloud-init.go index 808405aab..ea4ea15a0 100644 --- a/vendor/kubevirt.io/kubevirt/pkg/cloud-init/cloud-init.go +++ b/vendor/kubevirt.io/kubevirt/pkg/cloud-init/cloud-init.go @@ -103,7 +103,7 @@ func SetLocalDataOwner(user string) { func SetLocalDirectory(dir string) error { err := os.MkdirAll(dir, 0755) if err != nil { - return errors.New(fmt.Sprintf("Unable to initalize cloudInit local cache directory (%s). %v", dir, err)) + return errors.New(fmt.Sprintf("Unable to initialize cloudInit local cache directory (%s). %v", dir, err)) } exists, err := diskutils.FileExists(dir) @@ -141,11 +141,11 @@ func RemoveLocalData(domain string, namespace string) error { return err } -func GetCloudInitNoCloudSource(vm *v1.VirtualMachine) *v1.CloudInitNoCloudSource { - precond.MustNotBeNil(vm) +func GetCloudInitNoCloudSource(vmi *v1.VirtualMachineInstance) *v1.CloudInitNoCloudSource { + precond.MustNotBeNil(vmi) // search various places cloud init spec may live. // at the moment, cloud init only exists on disks. - for _, volume := range vm.Spec.Volumes { + for _, volume := range vmi.Spec.Volumes { if volume.CloudInitNoCloud != nil { return volume.CloudInitNoCloud } @@ -168,23 +168,20 @@ func ResolveSecrets(source *v1.CloudInitNoCloudSource, namespace string, clients return err } - userDataBase64, ok := secret.Data["userdata"] + userData, ok := secret.Data["userdata"] if ok == false { return errors.New(fmt.Sprintf("no user-data value found in k8s secret %s %v", secretID, err)) } - userData, err := base64.StdEncoding.DecodeString(string(userDataBase64)) - if err != nil { - return err - } + source.UserData = string(userData) return nil } -func GenerateLocalData(vmName string, namespace string, source *v1.CloudInitNoCloudSource) error { - precond.MustNotBeEmpty(vmName) +func GenerateLocalData(vmiName string, hostname string, namespace string, source *v1.CloudInitNoCloudSource) error { + precond.MustNotBeEmpty(vmiName) precond.MustNotBeNil(source) - domainBasePath := GetDomainBasePath(vmName, namespace) + domainBasePath := GetDomainBasePath(vmiName, namespace) err := os.MkdirAll(domainBasePath, 0755) if err != nil { log.Log.V(2).Reason(err).Errorf("unable to create cloud-init base path %s", domainBasePath) @@ -206,7 +203,7 @@ func GenerateLocalData(vmName string, namespace string, source *v1.CloudInitNoCl } else { return errors.New(fmt.Sprintf("userDataBase64 or userData is required for no-cloud data source")) } - metaData := []byte(fmt.Sprintf("{ \"instance-id\": \"%s.%s\", \"local-hostname\": \"%s\" }\n", vmName, namespace, vmName)) + metaData := []byte(fmt.Sprintf("{ \"instance-id\": \"%s.%s\", \"local-hostname\": \"%s\" }\n", vmiName, namespace, hostname)) diskutils.RemoveFile(userFile) diskutils.RemoveFile(metaFile) @@ -258,7 +255,7 @@ func GenerateLocalData(vmName string, namespace string, source *v1.CloudInitNoCl return nil } -// Lists all vms cloud-init has local data for -func ListVmWithLocalData() ([]*v1.VirtualMachine, error) { +// Lists all vmis cloud-init has local data for +func ListVmWithLocalData() ([]*v1.VirtualMachineInstance, error) { return diskutils.ListVmWithEphemeralDisk(cloudInitLocalDir) } diff --git a/vendor/kubevirt.io/kubevirt/pkg/controller/conditions.go b/vendor/kubevirt.io/kubevirt/pkg/controller/conditions.go index 56123c6a9..68defc5e9 100644 --- a/vendor/kubevirt.io/kubevirt/pkg/controller/conditions.go +++ b/vendor/kubevirt.io/kubevirt/pkg/controller/conditions.go @@ -10,25 +10,25 @@ import ( type VirtualMachineConditionManager struct { } -func (d *VirtualMachineConditionManager) CheckFailure(vm *v1.VirtualMachine, syncErr error, reason string) (changed bool) { - if syncErr != nil && !d.HasCondition(vm, v1.VirtualMachineSynchronized) { - vm.Status.Conditions = append(vm.Status.Conditions, v1.VirtualMachineCondition{ - Type: v1.VirtualMachineSynchronized, +func (d *VirtualMachineConditionManager) CheckFailure(vmi *v1.VirtualMachineInstance, syncErr error, reason string) (changed bool) { + if syncErr != nil && !d.HasCondition(vmi, v1.VirtualMachineInstanceSynchronized) { + vmi.Status.Conditions = append(vmi.Status.Conditions, v1.VirtualMachineInstanceCondition{ + Type: v1.VirtualMachineInstanceSynchronized, Reason: reason, Message: syncErr.Error(), LastTransitionTime: metav1.Now(), Status: k8sv1.ConditionFalse, }) return true - } else if syncErr == nil && d.HasCondition(vm, v1.VirtualMachineSynchronized) { - d.RemoveCondition(vm, v1.VirtualMachineSynchronized) + } else if syncErr == nil && d.HasCondition(vmi, v1.VirtualMachineInstanceSynchronized) { + d.RemoveCondition(vmi, v1.VirtualMachineInstanceSynchronized) return true } return false } -func (d *VirtualMachineConditionManager) HasCondition(vm *v1.VirtualMachine, cond v1.VirtualMachineConditionType) bool { - for _, c := range vm.Status.Conditions { +func (d *VirtualMachineConditionManager) HasCondition(vmi *v1.VirtualMachineInstance, cond v1.VirtualMachineInstanceConditionType) bool { + for _, c := range vmi.Status.Conditions { if c.Type == cond { return true } @@ -36,17 +36,57 @@ func (d *VirtualMachineConditionManager) HasCondition(vm *v1.VirtualMachine, con return false } -func (d *VirtualMachineConditionManager) RemoveCondition(vm *v1.VirtualMachine, cond v1.VirtualMachineConditionType) { - var conds []v1.VirtualMachineCondition - for _, c := range vm.Status.Conditions { +func (d *VirtualMachineConditionManager) RemoveCondition(vmi *v1.VirtualMachineInstance, cond v1.VirtualMachineInstanceConditionType) { + var conds []v1.VirtualMachineInstanceCondition + for _, c := range vmi.Status.Conditions { if c.Type == cond { continue } conds = append(conds, c) } - vm.Status.Conditions = conds + vmi.Status.Conditions = conds } -func NewVirtualMachineConditionManager() *VirtualMachineConditionManager { +// AddPodCondition add pod condition to the VM. +func (d *VirtualMachineConditionManager) AddPodCondition(vmi *v1.VirtualMachineInstance, cond *k8sv1.PodCondition) { + if !d.HasCondition(vmi, v1.VirtualMachineInstanceConditionType(cond.Type)) { + vmi.Status.Conditions = append(vmi.Status.Conditions, v1.VirtualMachineInstanceCondition{ + LastProbeTime: cond.LastProbeTime, + LastTransitionTime: cond.LastTransitionTime, + Message: cond.Message, + Reason: cond.Reason, + Status: cond.Status, + Type: v1.VirtualMachineInstanceConditionType(cond.Type), + }) + } +} + +func (d *VirtualMachineConditionManager) PodHasCondition(pod *k8sv1.Pod, conditionType k8sv1.PodConditionType, status k8sv1.ConditionStatus) bool { + for _, cond := range pod.Status.Conditions { + if cond.Type == conditionType { + if cond.Status == status { + return true + } else { + return false + } + } + } + return false +} + +func (d *VirtualMachineConditionManager) GetPodCondition(pod *k8sv1.Pod, conditionType k8sv1.PodConditionType, status k8sv1.ConditionStatus) *k8sv1.PodCondition { + for _, cond := range pod.Status.Conditions { + if cond.Type == conditionType { + if cond.Status == status { + return &cond + } else { + return nil + } + } + } + return nil +} + +func NewVirtualMachineInstanceConditionManager() *VirtualMachineConditionManager { return &VirtualMachineConditionManager{} } diff --git a/vendor/kubevirt.io/kubevirt/pkg/controller/controller.go b/vendor/kubevirt.io/kubevirt/pkg/controller/controller.go index 3799314e6..16c74b4f2 100644 --- a/vendor/kubevirt.io/kubevirt/pkg/controller/controller.go +++ b/vendor/kubevirt.io/kubevirt/pkg/controller/controller.go @@ -113,18 +113,18 @@ func NewResourceEventHandlerFuncsForFunc(f func(interface{})) cache.ResourceEven } } -func VirtualMachineKey(vm *v1.VirtualMachine) string { - return fmt.Sprintf("%v/%v", vm.ObjectMeta.Namespace, vm.ObjectMeta.Name) +func VirtualMachineKey(vmi *v1.VirtualMachineInstance) string { + return fmt.Sprintf("%v/%v", vmi.ObjectMeta.Namespace, vmi.ObjectMeta.Name) } func PodKey(pod *k8sv1.Pod) string { return fmt.Sprintf("%v/%v", pod.Namespace, pod.Name) } -func VirtualMachineKeys(vms []*v1.VirtualMachine) []string { +func VirtualMachineKeys(vmis []*v1.VirtualMachineInstance) []string { keys := []string{} - for _, vm := range vms { - keys = append(keys, VirtualMachineKey(vm)) + for _, vmi := range vmis { + keys = append(keys, VirtualMachineKey(vmi)) } return keys } diff --git a/vendor/kubevirt.io/kubevirt/pkg/controller/controller_ref_manager.go b/vendor/kubevirt.io/kubevirt/pkg/controller/controller_ref_manager.go index f30d9e4e1..69c2d56ad 100644 --- a/vendor/kubevirt.io/kubevirt/pkg/controller/controller_ref_manager.go +++ b/vendor/kubevirt.io/kubevirt/pkg/controller/controller_ref_manager.go @@ -178,7 +178,7 @@ func NewVirtualMachineControllerRefManager( // * Adopt orphans if the selector matches. // * Release owned objects if the selector no longer matches. // -// Optional: If one or more filters are specified, a VirtualMachine will only be claimed if +// Optional: If one or more filters are specified, a VirtualMachineInstance will only be claimed if // all filters return true. // // A non-nil error is returned if some form of reconciliation was attempted and @@ -187,50 +187,50 @@ func NewVirtualMachineControllerRefManager( // // If the error is nil, either the reconciliation succeeded, or no // reconciliation was necessary. The list of VirtualMachines that you now own is returned. -func (m *VirtualMachineControllerRefManager) ClaimVirtualMachines(vms []*virtv1.VirtualMachine, filters ...func(machine *virtv1.VirtualMachine) bool) ([]*virtv1.VirtualMachine, error) { - var claimed []*virtv1.VirtualMachine +func (m *VirtualMachineControllerRefManager) ClaimVirtualMachines(vmis []*virtv1.VirtualMachineInstance, filters ...func(machine *virtv1.VirtualMachineInstance) bool) ([]*virtv1.VirtualMachineInstance, error) { + var claimed []*virtv1.VirtualMachineInstance var errlist []error match := func(obj metav1.Object) bool { - vm := obj.(*virtv1.VirtualMachine) + vmi := obj.(*virtv1.VirtualMachineInstance) // Check selector first so filters only run on potentially matching VirtualMachines. - if !m.Selector.Matches(labels.Set(vm.Labels)) { + if !m.Selector.Matches(labels.Set(vmi.Labels)) { return false } for _, filter := range filters { - if !filter(vm) { + if !filter(vmi) { return false } } return true } adopt := func(obj metav1.Object) error { - return m.AdoptVirtualMachine(obj.(*virtv1.VirtualMachine)) + return m.AdoptVirtualMachine(obj.(*virtv1.VirtualMachineInstance)) } release := func(obj metav1.Object) error { - return m.ReleaseVirtualMachine(obj.(*virtv1.VirtualMachine)) + return m.ReleaseVirtualMachine(obj.(*virtv1.VirtualMachineInstance)) } - for _, vm := range vms { - ok, err := m.ClaimObject(vm, match, adopt, release) + for _, vmi := range vmis { + ok, err := m.ClaimObject(vmi, match, adopt, release) if err != nil { errlist = append(errlist, err) continue } if ok { - claimed = append(claimed, vm) + claimed = append(claimed, vmi) } } return claimed, utilerrors.NewAggregate(errlist) } -// ClaimVirtualMachineByName tries to take ownership of a VirtualMachine. +// ClaimVirtualMachineByName tries to take ownership of a VirtualMachineInstance. // // It will reconcile the following: // * Adopt orphans if the selector matches. // * Release owned objects if the selector no longer matches. // -// Optional: If one or more filters are specified, a VirtualMachine will only be claimed if +// Optional: If one or more filters are specified, a VirtualMachineInstance will only be claimed if // all filters return true. // // A non-nil error is returned if some form of reconciliation was attempted and @@ -239,72 +239,72 @@ func (m *VirtualMachineControllerRefManager) ClaimVirtualMachines(vms []*virtv1. // // If the error is nil, either the reconciliation succeeded, or no // reconciliation was necessary. The list of VirtualMachines that you now own is returned. -func (m *VirtualMachineControllerRefManager) ClaimVirtualMachineByName(vm *virtv1.VirtualMachine, filters ...func(machine *virtv1.VirtualMachine) bool) (*virtv1.VirtualMachine, error) { +func (m *VirtualMachineControllerRefManager) ClaimVirtualMachineByName(vmi *virtv1.VirtualMachineInstance, filters ...func(machine *virtv1.VirtualMachineInstance) bool) (*virtv1.VirtualMachineInstance, error) { match := func(obj metav1.Object) bool { - vm := obj.(*virtv1.VirtualMachine) + vmi := obj.(*virtv1.VirtualMachineInstance) // Check selector first so filters only run on potentially matching VirtualMachines. - if m.Controller.GetName() != vm.Name { + if m.Controller.GetName() != vmi.Name { return false } for _, filter := range filters { - if !filter(vm) { + if !filter(vmi) { return false } } return true } adopt := func(obj metav1.Object) error { - return m.AdoptVirtualMachine(obj.(*virtv1.VirtualMachine)) + return m.AdoptVirtualMachine(obj.(*virtv1.VirtualMachineInstance)) } release := func(obj metav1.Object) error { - return m.ReleaseVirtualMachine(obj.(*virtv1.VirtualMachine)) + return m.ReleaseVirtualMachine(obj.(*virtv1.VirtualMachineInstance)) } - ok, err := m.ClaimObject(vm, match, adopt, release) + ok, err := m.ClaimObject(vmi, match, adopt, release) if err != nil { return nil, err } if ok { - return vm, nil + return vmi, nil } return nil, nil } -// AdoptVirtualMachine sends a patch to take control of the vm. It returns the error if +// AdoptVirtualMachine sends a patch to take control of the vmi. It returns the error if // the patching fails. -func (m *VirtualMachineControllerRefManager) AdoptVirtualMachine(vm *virtv1.VirtualMachine) error { +func (m *VirtualMachineControllerRefManager) AdoptVirtualMachine(vmi *virtv1.VirtualMachineInstance) error { if err := m.CanAdopt(); err != nil { - return fmt.Errorf("can't adopt VirtualMachine %v/%v (%v): %v", vm.Namespace, vm.Name, vm.UID, err) + return fmt.Errorf("can't adopt VirtualMachineInstance %v/%v (%v): %v", vmi.Namespace, vmi.Name, vmi.UID, err) } // Note that ValidateOwnerReferences() will reject this patch if another // OwnerReference exists with controller=true. addControllerPatch := fmt.Sprintf( `{"metadata":{"ownerReferences":[{"apiVersion":"%s","kind":"%s","name":"%s","uid":"%s","controller":true,"blockOwnerDeletion":true}],"uid":"%s"}}`, m.controllerKind.GroupVersion(), m.controllerKind.Kind, - m.Controller.GetName(), m.Controller.GetUID(), vm.UID) - return m.virtualMachineControl.PatchVirtualMachine(vm.Namespace, vm.Name, []byte(addControllerPatch)) + m.Controller.GetName(), m.Controller.GetUID(), vmi.UID) + return m.virtualMachineControl.PatchVirtualMachine(vmi.Namespace, vmi.Name, []byte(addControllerPatch)) } // ReleaseVirtualMachine sends a patch to free the virtual machine from the control of the controller. // It returns the error if the patching fails. 404 and 422 errors are ignored. -func (m *VirtualMachineControllerRefManager) ReleaseVirtualMachine(vm *virtv1.VirtualMachine) error { - log.Log.V(2).Object(vm).Infof("patching vm to remove its controllerRef to %s/%s:%s", +func (m *VirtualMachineControllerRefManager) ReleaseVirtualMachine(vmi *virtv1.VirtualMachineInstance) error { + log.Log.V(2).Object(vmi).Infof("patching vmi to remove its controllerRef to %s/%s:%s", m.controllerKind.GroupVersion(), m.controllerKind.Kind, m.Controller.GetName()) // TODO CRDs don't support strategic merge, therefore replace the onwerReferences list with a merge patch deleteOwnerRefPatch := fmt.Sprint(`{"metadata":{"ownerReferences":[]}}`) - err := m.virtualMachineControl.PatchVirtualMachine(vm.Namespace, vm.Name, []byte(deleteOwnerRefPatch)) + err := m.virtualMachineControl.PatchVirtualMachine(vmi.Namespace, vmi.Name, []byte(deleteOwnerRefPatch)) if err != nil { if errors.IsNotFound(err) { - // If the vm no longer exists, ignore it. + // If the vmi no longer exists, ignore it. return nil } if errors.IsInvalid(err) { - // Invalid error will be returned in two cases: 1. the vm - // has no owner reference, 2. the uid of the vm doesn't - // match, which means the vm is deleted and then recreated. + // Invalid error will be returned in two cases: 1. the vmi + // has no owner reference, 2. the uid of the vmi doesn't + // match, which means the vmi is deleted and then recreated. // In both cases, the error can be ignored. - // TODO: If the vm has owner references, but none of them + // TODO: If the vmi has owner references, but none of them // has the owner.UID, server will silently ignore the patch. // Investigate why. return nil @@ -323,7 +323,7 @@ type RealVirtualMachineControl struct { func (r RealVirtualMachineControl) PatchVirtualMachine(namespace, name string, data []byte) error { // TODO should be a strategic merge patch, but not possible until https://github.com/kubernetes/kubernetes/issues/56348 is resolved - _, err := r.Clientset.VM(namespace).Patch(name, types.MergePatchType, data) + _, err := r.Clientset.VirtualMachineInstance(namespace).Patch(name, types.MergePatchType, data) return err } diff --git a/vendor/kubevirt.io/kubevirt/pkg/controller/virtinformers.go b/vendor/kubevirt.io/kubevirt/pkg/controller/virtinformers.go index 4dbca145f..a07312ff5 100644 --- a/vendor/kubevirt.io/kubevirt/pkg/controller/virtinformers.go +++ b/vendor/kubevirt.io/kubevirt/pkg/controller/virtinformers.go @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * Copyright 2017 Red Hat, Inc. + * Copyright 2017, 2018 Red Hat, Inc. * */ @@ -36,6 +36,8 @@ import ( "kubevirt.io/kubevirt/pkg/log" ) +const systemNamespace = "kube-system" + type newSharedInformer func() cache.SharedIndexInformer type KubeInformerFactory interface { @@ -43,13 +45,13 @@ type KubeInformerFactory interface { // This function is thread safe and idempotent Start(stopCh <-chan struct{}) - // Watches for vm objects - VM() cache.SharedIndexInformer + // Watches for vmi objects + VMI() cache.SharedIndexInformer - // Watches for VirtualMachineReplicaSet objects - VMReplicaSet() cache.SharedIndexInformer + // Watches for VirtualMachineInstanceReplicaSet objects + VMIReplicaSet() cache.SharedIndexInformer - // Watches for VirtualMachinePreset objects + // Watches for VirtualMachineInstancePreset objects VirtualMachinePreset() cache.SharedIndexInformer // Watches for pods related only to kubevirt @@ -58,8 +60,11 @@ type KubeInformerFactory interface { // Watches for nodes KubeVirtNode() cache.SharedIndexInformer - // OfflineVirtualMachine handles the VMs that are stopped or not running - OfflineVirtualMachine() cache.SharedIndexInformer + // VirtualMachine handles the VMIs that are stopped or not running + VirtualMachine() cache.SharedIndexInformer + + // Watches for ConfigMap objects + ConfigMap() cache.SharedIndexInformer } type kubeInformerFactory struct { @@ -119,24 +124,24 @@ func (f *kubeInformerFactory) getInformer(key string, newFunc newSharedInformer) return informer } -func (f *kubeInformerFactory) VM() cache.SharedIndexInformer { - return f.getInformer("vmInformer", func() cache.SharedIndexInformer { - lw := cache.NewListWatchFromClient(f.restClient, "virtualmachines", k8sv1.NamespaceAll, fields.Everything()) - return cache.NewSharedIndexInformer(lw, &kubev1.VirtualMachine{}, f.defaultResync, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}) +func (f *kubeInformerFactory) VMI() cache.SharedIndexInformer { + return f.getInformer("vmiInformer", func() cache.SharedIndexInformer { + lw := cache.NewListWatchFromClient(f.restClient, "virtualmachineinstances", k8sv1.NamespaceAll, fields.Everything()) + return cache.NewSharedIndexInformer(lw, &kubev1.VirtualMachineInstance{}, f.defaultResync, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}) }) } -func (f *kubeInformerFactory) VMReplicaSet() cache.SharedIndexInformer { - return f.getInformer("vmrsInformer", func() cache.SharedIndexInformer { - lw := cache.NewListWatchFromClient(f.restClient, "virtualmachinereplicasets", k8sv1.NamespaceAll, fields.Everything()) - return cache.NewSharedIndexInformer(lw, &kubev1.VirtualMachineReplicaSet{}, f.defaultResync, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}) +func (f *kubeInformerFactory) VMIReplicaSet() cache.SharedIndexInformer { + return f.getInformer("vmirsInformer", func() cache.SharedIndexInformer { + lw := cache.NewListWatchFromClient(f.restClient, "virtualmachineinstancereplicasets", k8sv1.NamespaceAll, fields.Everything()) + return cache.NewSharedIndexInformer(lw, &kubev1.VirtualMachineInstanceReplicaSet{}, f.defaultResync, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}) }) } func (f *kubeInformerFactory) VirtualMachinePreset() cache.SharedIndexInformer { - return f.getInformer("vmPresetInformer", func() cache.SharedIndexInformer { - lw := cache.NewListWatchFromClient(f.restClient, "virtualmachinepresets", k8sv1.NamespaceAll, fields.Everything()) - return cache.NewSharedIndexInformer(lw, &kubev1.VirtualMachinePreset{}, f.defaultResync, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}) + return f.getInformer("vmiPresetInformer", func() cache.SharedIndexInformer { + lw := cache.NewListWatchFromClient(f.restClient, "virtualmachineinstancepresets", k8sv1.NamespaceAll, fields.Everything()) + return cache.NewSharedIndexInformer(lw, &kubev1.VirtualMachineInstancePreset{}, f.defaultResync, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}) }) } @@ -160,10 +165,20 @@ func (f *kubeInformerFactory) KubeVirtNode() cache.SharedIndexInformer { }) } -func (f *kubeInformerFactory) OfflineVirtualMachine() cache.SharedIndexInformer { - return f.getInformer("ovmInformer", func() cache.SharedIndexInformer { - lw := cache.NewListWatchFromClient(f.restClient, "offlinevirtualmachines", k8sv1.NamespaceAll, fields.Everything()) - return cache.NewSharedIndexInformer(lw, &kubev1.OfflineVirtualMachine{}, f.defaultResync, cache.Indexers{}) +func (f *kubeInformerFactory) VirtualMachine() cache.SharedIndexInformer { + return f.getInformer("vmInformer", func() cache.SharedIndexInformer { + lw := cache.NewListWatchFromClient(f.restClient, "virtualmachines", k8sv1.NamespaceAll, fields.Everything()) + return cache.NewSharedIndexInformer(lw, &kubev1.VirtualMachine{}, f.defaultResync, cache.Indexers{}) + }) +} + +func (f *kubeInformerFactory) ConfigMap() cache.SharedIndexInformer { + // We currently only monitor configmaps in the kube-system namespace + return f.getInformer("configMapInformer", func() cache.SharedIndexInformer { + restClient := f.clientSet.CoreV1().RESTClient() + fieldSelector := fields.OneTermEqualSelector("metadata.name", "kubevirt-config") + lw := cache.NewListWatchFromClient(restClient, "configmaps", systemNamespace, fieldSelector) + return cache.NewSharedIndexInformer(lw, &k8sv1.ConfigMap{}, f.defaultResync, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}) }) } diff --git a/vendor/kubevirt.io/kubevirt/pkg/emptydisk/emptydisk.go b/vendor/kubevirt.io/kubevirt/pkg/emptydisk/emptydisk.go index 0731f7d00..f747aa235 100644 --- a/vendor/kubevirt.io/kubevirt/pkg/emptydisk/emptydisk.go +++ b/vendor/kubevirt.io/kubevirt/pkg/emptydisk/emptydisk.go @@ -11,9 +11,9 @@ import ( var EmptyDiskBaseDir = "/var/run/libvirt/empty-disks/" -func CreateTemporaryDisks(vm *v1.VirtualMachine) error { +func CreateTemporaryDisks(vmi *v1.VirtualMachineInstance) error { - for _, volume := range vm.Spec.Volumes { + for _, volume := range vmi.Spec.Volumes { if volume.EmptyDisk != nil { // qemu-img takes the size in bytes or in Kibibytes/Mebibytes/...; lets take bytes diff --git a/vendor/kubevirt.io/kubevirt/pkg/ephemeral-disk-utils/utils.go b/vendor/kubevirt.io/kubevirt/pkg/ephemeral-disk-utils/utils.go index d5e76878a..afd185179 100644 --- a/vendor/kubevirt.io/kubevirt/pkg/ephemeral-disk-utils/utils.go +++ b/vendor/kubevirt.io/kubevirt/pkg/ephemeral-disk-utils/utils.go @@ -126,9 +126,9 @@ func FilesAreEqual(path1 string, path2 string) (bool, error) { return bytes.Equal(sum1, sum2), nil } -// Lists all vms ephemeral disk has local data for -func ListVmWithEphemeralDisk(localPath string) ([]*v1.VirtualMachine, error) { - var keys []*v1.VirtualMachine +// Lists all vmis ephemeral disk has local data for +func ListVmWithEphemeralDisk(localPath string) ([]*v1.VirtualMachineInstance, error) { + var keys []*v1.VirtualMachineInstance exists, err := FileExists(localPath) if err != nil { @@ -160,7 +160,7 @@ func ListVmWithEphemeralDisk(localPath string) ([]*v1.VirtualMachine, error) { if namespace == "" || domain == "" { return nil } - keys = append(keys, v1.NewVMReferenceFromNameWithNS(dirs[0], dirs[1])) + keys = append(keys, v1.NewVMIReferenceFromNameWithNS(dirs[0], dirs[1])) return nil }) diff --git a/vendor/kubevirt.io/kubevirt/pkg/ephemeral-disk/ephemeral-disk.go b/vendor/kubevirt.io/kubevirt/pkg/ephemeral-disk/ephemeral-disk.go index b9d176c42..2e4969f1a 100644 --- a/vendor/kubevirt.io/kubevirt/pkg/ephemeral-disk/ephemeral-disk.go +++ b/vendor/kubevirt.io/kubevirt/pkg/ephemeral-disk/ephemeral-disk.go @@ -30,7 +30,7 @@ import ( ) var mountBaseDir = "/var/run/libvirt/kubevirt-ephemeral-disk" -var pvcBaseDir = "/var/run/kubevirt-private/vm-disks" +var pvcBaseDir = "/var/run/kubevirt-private/vmi-disks" var ephemeralImageDiskOwner = "qemu" func generateBaseDir() string { @@ -77,11 +77,11 @@ func GetFilePath(volumeName string) string { return filepath.Join(volumeMountDir, "disk.qcow2") } -func CreateEphemeralImages(vm *v1.VirtualMachine) error { +func CreateEphemeralImages(vmi *v1.VirtualMachineInstance) error { // The domain is setup to use the COW image instead of the base image. What we have // to do here is only create the image where the domain expects it (GetFilePath) // for each disk that requires it. - for _, volume := range vm.Spec.Volumes { + for _, volume := range vmi.Spec.Volumes { if volume.VolumeSource.Ephemeral != nil { err := createVolumeDirectory(volume.Name) if err != nil { diff --git a/vendor/kubevirt.io/kubevirt/pkg/inotify-informer/inotify.go b/vendor/kubevirt.io/kubevirt/pkg/inotify-informer/inotify.go index 20347454e..783869376 100644 --- a/vendor/kubevirt.io/kubevirt/pkg/inotify-informer/inotify.go +++ b/vendor/kubevirt.io/kubevirt/pkg/inotify-informer/inotify.go @@ -45,7 +45,7 @@ import ( // events will be delivered exactly once. // While for many tasks this is not good enough, it is a sufficient pattern -// to use the socket creation as a secondary resource for the VM controller +// to use the socket creation as a secondary resource for the VirtualMachineInstance controller // in virt-handler // TODO: In case Watch is never called, we could leak inotify go-routines, diff --git a/vendor/kubevirt.io/kubevirt/pkg/kubecli/generated_mock_kubevirt.go b/vendor/kubevirt.io/kubevirt/pkg/kubecli/generated_mock_kubevirt.go index 5a0f2c9cf..8f7f78e76 100644 --- a/vendor/kubevirt.io/kubevirt/pkg/kubecli/generated_mock_kubevirt.go +++ b/vendor/kubevirt.io/kubevirt/pkg/kubecli/generated_mock_kubevirt.go @@ -4,8 +4,6 @@ package kubecli import ( - io "io" - gomock "github.com/golang/mock/gomock" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" @@ -64,14 +62,14 @@ func (_m *MockKubevirtClient) EXPECT() *_MockKubevirtClientRecorder { return _m.recorder } -func (_m *MockKubevirtClient) VM(namespace string) VMInterface { - ret := _m.ctrl.Call(_m, "VM", namespace) - ret0, _ := ret[0].(VMInterface) +func (_m *MockKubevirtClient) VirtualMachineInstance(namespace string) VirtualMachineInstanceInterface { + ret := _m.ctrl.Call(_m, "VirtualMachineInstance", namespace) + ret0, _ := ret[0].(VirtualMachineInstanceInterface) return ret0 } -func (_mr *_MockKubevirtClientRecorder) VM(arg0 interface{}) *gomock.Call { - return _mr.mock.ctrl.RecordCall(_mr.mock, "VM", arg0) +func (_mr *_MockKubevirtClientRecorder) VirtualMachineInstance(arg0 interface{}) *gomock.Call { + return _mr.mock.ctrl.RecordCall(_mr.mock, "VirtualMachineInstance", arg0) } func (_m *MockKubevirtClient) ReplicaSet(namespace string) ReplicaSetInterface { @@ -84,14 +82,24 @@ func (_mr *_MockKubevirtClientRecorder) ReplicaSet(arg0 interface{}) *gomock.Cal return _mr.mock.ctrl.RecordCall(_mr.mock, "ReplicaSet", arg0) } -func (_m *MockKubevirtClient) OfflineVirtualMachine(namespace string) OfflineVirtualMachineInterface { - ret := _m.ctrl.Call(_m, "OfflineVirtualMachine", namespace) - ret0, _ := ret[0].(OfflineVirtualMachineInterface) +func (_m *MockKubevirtClient) VirtualMachine(namespace string) VirtualMachineInterface { + ret := _m.ctrl.Call(_m, "VirtualMachine", namespace) + ret0, _ := ret[0].(VirtualMachineInterface) return ret0 } -func (_mr *_MockKubevirtClientRecorder) OfflineVirtualMachine(arg0 interface{}) *gomock.Call { - return _mr.mock.ctrl.RecordCall(_mr.mock, "OfflineVirtualMachine", arg0) +func (_mr *_MockKubevirtClientRecorder) VirtualMachine(arg0 interface{}) *gomock.Call { + return _mr.mock.ctrl.RecordCall(_mr.mock, "VirtualMachine", arg0) +} + +func (_m *MockKubevirtClient) ServerVersion() *ServerVersion { + ret := _m.ctrl.Call(_m, "ServerVersion") + ret0, _ := ret[0].(*ServerVersion) + return ret0 +} + +func (_mr *_MockKubevirtClientRecorder) ServerVersion() *gomock.Call { + return _mr.mock.ctrl.RecordCall(_mr.mock, "ServerVersion") } func (_m *MockKubevirtClient) RestClient() *rest.RESTClient { @@ -554,115 +562,148 @@ func (_mr *_MockKubevirtClientRecorder) StorageV1alpha1() *gomock.Call { return _mr.mock.ctrl.RecordCall(_mr.mock, "StorageV1alpha1") } -// Mock of VMInterface interface -type MockVMInterface struct { +// Mock of StreamInterface interface +type MockStreamInterface struct { + ctrl *gomock.Controller + recorder *_MockStreamInterfaceRecorder +} + +// Recorder for MockStreamInterface (not exported) +type _MockStreamInterfaceRecorder struct { + mock *MockStreamInterface +} + +func NewMockStreamInterface(ctrl *gomock.Controller) *MockStreamInterface { + mock := &MockStreamInterface{ctrl: ctrl} + mock.recorder = &_MockStreamInterfaceRecorder{mock} + return mock +} + +func (_m *MockStreamInterface) EXPECT() *_MockStreamInterfaceRecorder { + return _m.recorder +} + +func (_m *MockStreamInterface) Stream(options StreamOptions) error { + ret := _m.ctrl.Call(_m, "Stream", options) + ret0, _ := ret[0].(error) + return ret0 +} + +func (_mr *_MockStreamInterfaceRecorder) Stream(arg0 interface{}) *gomock.Call { + return _mr.mock.ctrl.RecordCall(_mr.mock, "Stream", arg0) +} + +// Mock of VirtualMachineInstanceInterface interface +type MockVirtualMachineInstanceInterface struct { ctrl *gomock.Controller - recorder *_MockVMInterfaceRecorder + recorder *_MockVirtualMachineInstanceInterfaceRecorder } -// Recorder for MockVMInterface (not exported) -type _MockVMInterfaceRecorder struct { - mock *MockVMInterface +// Recorder for MockVirtualMachineInstanceInterface (not exported) +type _MockVirtualMachineInstanceInterfaceRecorder struct { + mock *MockVirtualMachineInstanceInterface } -func NewMockVMInterface(ctrl *gomock.Controller) *MockVMInterface { - mock := &MockVMInterface{ctrl: ctrl} - mock.recorder = &_MockVMInterfaceRecorder{mock} +func NewMockVirtualMachineInstanceInterface(ctrl *gomock.Controller) *MockVirtualMachineInstanceInterface { + mock := &MockVirtualMachineInstanceInterface{ctrl: ctrl} + mock.recorder = &_MockVirtualMachineInstanceInterfaceRecorder{mock} return mock } -func (_m *MockVMInterface) EXPECT() *_MockVMInterfaceRecorder { +func (_m *MockVirtualMachineInstanceInterface) EXPECT() *_MockVirtualMachineInstanceInterfaceRecorder { return _m.recorder } -func (_m *MockVMInterface) Get(name string, options v1.GetOptions) (*v19.VirtualMachine, error) { +func (_m *MockVirtualMachineInstanceInterface) Get(name string, options *v1.GetOptions) (*v19.VirtualMachineInstance, error) { ret := _m.ctrl.Call(_m, "Get", name, options) - ret0, _ := ret[0].(*v19.VirtualMachine) + ret0, _ := ret[0].(*v19.VirtualMachineInstance) ret1, _ := ret[1].(error) return ret0, ret1 } -func (_mr *_MockVMInterfaceRecorder) Get(arg0, arg1 interface{}) *gomock.Call { +func (_mr *_MockVirtualMachineInstanceInterfaceRecorder) Get(arg0, arg1 interface{}) *gomock.Call { return _mr.mock.ctrl.RecordCall(_mr.mock, "Get", arg0, arg1) } -func (_m *MockVMInterface) List(opts v1.ListOptions) (*v19.VirtualMachineList, error) { +func (_m *MockVirtualMachineInstanceInterface) List(opts *v1.ListOptions) (*v19.VirtualMachineInstanceList, error) { ret := _m.ctrl.Call(_m, "List", opts) - ret0, _ := ret[0].(*v19.VirtualMachineList) + ret0, _ := ret[0].(*v19.VirtualMachineInstanceList) ret1, _ := ret[1].(error) return ret0, ret1 } -func (_mr *_MockVMInterfaceRecorder) List(arg0 interface{}) *gomock.Call { +func (_mr *_MockVirtualMachineInstanceInterfaceRecorder) List(arg0 interface{}) *gomock.Call { return _mr.mock.ctrl.RecordCall(_mr.mock, "List", arg0) } -func (_m *MockVMInterface) Create(_param0 *v19.VirtualMachine) (*v19.VirtualMachine, error) { - ret := _m.ctrl.Call(_m, "Create", _param0) - ret0, _ := ret[0].(*v19.VirtualMachine) +func (_m *MockVirtualMachineInstanceInterface) Create(instance *v19.VirtualMachineInstance) (*v19.VirtualMachineInstance, error) { + ret := _m.ctrl.Call(_m, "Create", instance) + ret0, _ := ret[0].(*v19.VirtualMachineInstance) ret1, _ := ret[1].(error) return ret0, ret1 } -func (_mr *_MockVMInterfaceRecorder) Create(arg0 interface{}) *gomock.Call { +func (_mr *_MockVirtualMachineInstanceInterfaceRecorder) Create(arg0 interface{}) *gomock.Call { return _mr.mock.ctrl.RecordCall(_mr.mock, "Create", arg0) } -func (_m *MockVMInterface) Update(_param0 *v19.VirtualMachine) (*v19.VirtualMachine, error) { +func (_m *MockVirtualMachineInstanceInterface) Update(_param0 *v19.VirtualMachineInstance) (*v19.VirtualMachineInstance, error) { ret := _m.ctrl.Call(_m, "Update", _param0) - ret0, _ := ret[0].(*v19.VirtualMachine) + ret0, _ := ret[0].(*v19.VirtualMachineInstance) ret1, _ := ret[1].(error) return ret0, ret1 } -func (_mr *_MockVMInterfaceRecorder) Update(arg0 interface{}) *gomock.Call { +func (_mr *_MockVirtualMachineInstanceInterfaceRecorder) Update(arg0 interface{}) *gomock.Call { return _mr.mock.ctrl.RecordCall(_mr.mock, "Update", arg0) } -func (_m *MockVMInterface) Delete(name string, options *v1.DeleteOptions) error { +func (_m *MockVirtualMachineInstanceInterface) Delete(name string, options *v1.DeleteOptions) error { ret := _m.ctrl.Call(_m, "Delete", name, options) ret0, _ := ret[0].(error) return ret0 } -func (_mr *_MockVMInterfaceRecorder) Delete(arg0, arg1 interface{}) *gomock.Call { +func (_mr *_MockVirtualMachineInstanceInterfaceRecorder) Delete(arg0, arg1 interface{}) *gomock.Call { return _mr.mock.ctrl.RecordCall(_mr.mock, "Delete", arg0, arg1) } -func (_m *MockVMInterface) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (*v19.VirtualMachine, error) { +func (_m *MockVirtualMachineInstanceInterface) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (*v19.VirtualMachineInstance, error) { _s := []interface{}{name, pt, data} for _, _x := range subresources { _s = append(_s, _x) } ret := _m.ctrl.Call(_m, "Patch", _s...) - ret0, _ := ret[0].(*v19.VirtualMachine) + ret0, _ := ret[0].(*v19.VirtualMachineInstance) ret1, _ := ret[1].(error) return ret0, ret1 } -func (_mr *_MockVMInterfaceRecorder) Patch(arg0, arg1, arg2 interface{}, arg3 ...interface{}) *gomock.Call { +func (_mr *_MockVirtualMachineInstanceInterfaceRecorder) Patch(arg0, arg1, arg2 interface{}, arg3 ...interface{}) *gomock.Call { _s := append([]interface{}{arg0, arg1, arg2}, arg3...) return _mr.mock.ctrl.RecordCall(_mr.mock, "Patch", _s...) } -func (_m *MockVMInterface) SerialConsole(name string, in io.Reader, out io.Writer) error { - ret := _m.ctrl.Call(_m, "SerialConsole", name, in, out) - ret0, _ := ret[0].(error) - return ret0 +func (_m *MockVirtualMachineInstanceInterface) SerialConsole(name string) (StreamInterface, error) { + ret := _m.ctrl.Call(_m, "SerialConsole", name) + ret0, _ := ret[0].(StreamInterface) + ret1, _ := ret[1].(error) + return ret0, ret1 } -func (_mr *_MockVMInterfaceRecorder) SerialConsole(arg0, arg1, arg2 interface{}) *gomock.Call { - return _mr.mock.ctrl.RecordCall(_mr.mock, "SerialConsole", arg0, arg1, arg2) +func (_mr *_MockVirtualMachineInstanceInterfaceRecorder) SerialConsole(arg0 interface{}) *gomock.Call { + return _mr.mock.ctrl.RecordCall(_mr.mock, "SerialConsole", arg0) } -func (_m *MockVMInterface) VNC(name string, in io.Reader, out io.Writer) error { - ret := _m.ctrl.Call(_m, "VNC", name, in, out) - ret0, _ := ret[0].(error) - return ret0 +func (_m *MockVirtualMachineInstanceInterface) VNC(name string) (StreamInterface, error) { + ret := _m.ctrl.Call(_m, "VNC", name) + ret0, _ := ret[0].(StreamInterface) + ret1, _ := ret[1].(error) + return ret0, ret1 } -func (_mr *_MockVMInterfaceRecorder) VNC(arg0, arg1, arg2 interface{}) *gomock.Call { - return _mr.mock.ctrl.RecordCall(_mr.mock, "VNC", arg0, arg1, arg2) +func (_mr *_MockVirtualMachineInstanceInterfaceRecorder) VNC(arg0 interface{}) *gomock.Call { + return _mr.mock.ctrl.RecordCall(_mr.mock, "VNC", arg0) } // Mock of ReplicaSetInterface interface @@ -686,9 +727,9 @@ func (_m *MockReplicaSetInterface) EXPECT() *_MockReplicaSetInterfaceRecorder { return _m.recorder } -func (_m *MockReplicaSetInterface) Get(name string, options v1.GetOptions) (*v19.VirtualMachineReplicaSet, error) { +func (_m *MockReplicaSetInterface) Get(name string, options v1.GetOptions) (*v19.VirtualMachineInstanceReplicaSet, error) { ret := _m.ctrl.Call(_m, "Get", name, options) - ret0, _ := ret[0].(*v19.VirtualMachineReplicaSet) + ret0, _ := ret[0].(*v19.VirtualMachineInstanceReplicaSet) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -697,9 +738,9 @@ func (_mr *_MockReplicaSetInterfaceRecorder) Get(arg0, arg1 interface{}) *gomock return _mr.mock.ctrl.RecordCall(_mr.mock, "Get", arg0, arg1) } -func (_m *MockReplicaSetInterface) List(opts v1.ListOptions) (*v19.VirtualMachineReplicaSetList, error) { +func (_m *MockReplicaSetInterface) List(opts v1.ListOptions) (*v19.VirtualMachineInstanceReplicaSetList, error) { ret := _m.ctrl.Call(_m, "List", opts) - ret0, _ := ret[0].(*v19.VirtualMachineReplicaSetList) + ret0, _ := ret[0].(*v19.VirtualMachineInstanceReplicaSetList) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -708,9 +749,9 @@ func (_mr *_MockReplicaSetInterfaceRecorder) List(arg0 interface{}) *gomock.Call return _mr.mock.ctrl.RecordCall(_mr.mock, "List", arg0) } -func (_m *MockReplicaSetInterface) Create(_param0 *v19.VirtualMachineReplicaSet) (*v19.VirtualMachineReplicaSet, error) { +func (_m *MockReplicaSetInterface) Create(_param0 *v19.VirtualMachineInstanceReplicaSet) (*v19.VirtualMachineInstanceReplicaSet, error) { ret := _m.ctrl.Call(_m, "Create", _param0) - ret0, _ := ret[0].(*v19.VirtualMachineReplicaSet) + ret0, _ := ret[0].(*v19.VirtualMachineInstanceReplicaSet) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -719,9 +760,9 @@ func (_mr *_MockReplicaSetInterfaceRecorder) Create(arg0 interface{}) *gomock.Ca return _mr.mock.ctrl.RecordCall(_mr.mock, "Create", arg0) } -func (_m *MockReplicaSetInterface) Update(_param0 *v19.VirtualMachineReplicaSet) (*v19.VirtualMachineReplicaSet, error) { +func (_m *MockReplicaSetInterface) Update(_param0 *v19.VirtualMachineInstanceReplicaSet) (*v19.VirtualMachineInstanceReplicaSet, error) { ret := _m.ctrl.Call(_m, "Update", _param0) - ret0, _ := ret[0].(*v19.VirtualMachineReplicaSet) + ret0, _ := ret[0].(*v19.VirtualMachineInstanceReplicaSet) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -740,168 +781,184 @@ func (_mr *_MockReplicaSetInterfaceRecorder) Delete(arg0, arg1 interface{}) *gom return _mr.mock.ctrl.RecordCall(_mr.mock, "Delete", arg0, arg1) } -// Mock of VMPresetInterface interface -type MockVMPresetInterface struct { +// Mock of VMIPresetInterface interface +type MockVMIPresetInterface struct { ctrl *gomock.Controller - recorder *_MockVMPresetInterfaceRecorder + recorder *_MockVMIPresetInterfaceRecorder } -// Recorder for MockVMPresetInterface (not exported) -type _MockVMPresetInterfaceRecorder struct { - mock *MockVMPresetInterface +// Recorder for MockVMIPresetInterface (not exported) +type _MockVMIPresetInterfaceRecorder struct { + mock *MockVMIPresetInterface } -func NewMockVMPresetInterface(ctrl *gomock.Controller) *MockVMPresetInterface { - mock := &MockVMPresetInterface{ctrl: ctrl} - mock.recorder = &_MockVMPresetInterfaceRecorder{mock} +func NewMockVMIPresetInterface(ctrl *gomock.Controller) *MockVMIPresetInterface { + mock := &MockVMIPresetInterface{ctrl: ctrl} + mock.recorder = &_MockVMIPresetInterfaceRecorder{mock} return mock } -func (_m *MockVMPresetInterface) EXPECT() *_MockVMPresetInterfaceRecorder { +func (_m *MockVMIPresetInterface) EXPECT() *_MockVMIPresetInterfaceRecorder { return _m.recorder } -func (_m *MockVMPresetInterface) Get(name string, options v1.GetOptions) (*v19.VirtualMachinePreset, error) { +func (_m *MockVMIPresetInterface) Get(name string, options v1.GetOptions) (*v19.VirtualMachineInstancePreset, error) { ret := _m.ctrl.Call(_m, "Get", name, options) - ret0, _ := ret[0].(*v19.VirtualMachinePreset) + ret0, _ := ret[0].(*v19.VirtualMachineInstancePreset) ret1, _ := ret[1].(error) return ret0, ret1 } -func (_mr *_MockVMPresetInterfaceRecorder) Get(arg0, arg1 interface{}) *gomock.Call { +func (_mr *_MockVMIPresetInterfaceRecorder) Get(arg0, arg1 interface{}) *gomock.Call { return _mr.mock.ctrl.RecordCall(_mr.mock, "Get", arg0, arg1) } -func (_m *MockVMPresetInterface) List(opts v1.ListOptions) (*v19.VirtualMachinePresetList, error) { +func (_m *MockVMIPresetInterface) List(opts v1.ListOptions) (*v19.VirtualMachineInstancePresetList, error) { ret := _m.ctrl.Call(_m, "List", opts) - ret0, _ := ret[0].(*v19.VirtualMachinePresetList) + ret0, _ := ret[0].(*v19.VirtualMachineInstancePresetList) ret1, _ := ret[1].(error) return ret0, ret1 } -func (_mr *_MockVMPresetInterfaceRecorder) List(arg0 interface{}) *gomock.Call { +func (_mr *_MockVMIPresetInterfaceRecorder) List(arg0 interface{}) *gomock.Call { return _mr.mock.ctrl.RecordCall(_mr.mock, "List", arg0) } -func (_m *MockVMPresetInterface) Create(_param0 *v19.VirtualMachinePreset) (*v19.VirtualMachinePreset, error) { +func (_m *MockVMIPresetInterface) Create(_param0 *v19.VirtualMachineInstancePreset) (*v19.VirtualMachineInstancePreset, error) { ret := _m.ctrl.Call(_m, "Create", _param0) - ret0, _ := ret[0].(*v19.VirtualMachinePreset) + ret0, _ := ret[0].(*v19.VirtualMachineInstancePreset) ret1, _ := ret[1].(error) return ret0, ret1 } -func (_mr *_MockVMPresetInterfaceRecorder) Create(arg0 interface{}) *gomock.Call { +func (_mr *_MockVMIPresetInterfaceRecorder) Create(arg0 interface{}) *gomock.Call { return _mr.mock.ctrl.RecordCall(_mr.mock, "Create", arg0) } -func (_m *MockVMPresetInterface) Update(_param0 *v19.VirtualMachinePreset) (*v19.VirtualMachinePreset, error) { +func (_m *MockVMIPresetInterface) Update(_param0 *v19.VirtualMachineInstancePreset) (*v19.VirtualMachineInstancePreset, error) { ret := _m.ctrl.Call(_m, "Update", _param0) - ret0, _ := ret[0].(*v19.VirtualMachinePreset) + ret0, _ := ret[0].(*v19.VirtualMachineInstancePreset) ret1, _ := ret[1].(error) return ret0, ret1 } -func (_mr *_MockVMPresetInterfaceRecorder) Update(arg0 interface{}) *gomock.Call { +func (_mr *_MockVMIPresetInterfaceRecorder) Update(arg0 interface{}) *gomock.Call { return _mr.mock.ctrl.RecordCall(_mr.mock, "Update", arg0) } -func (_m *MockVMPresetInterface) Delete(name string, options *v1.DeleteOptions) error { +func (_m *MockVMIPresetInterface) Delete(name string, options *v1.DeleteOptions) error { ret := _m.ctrl.Call(_m, "Delete", name, options) ret0, _ := ret[0].(error) return ret0 } -func (_mr *_MockVMPresetInterfaceRecorder) Delete(arg0, arg1 interface{}) *gomock.Call { +func (_mr *_MockVMIPresetInterfaceRecorder) Delete(arg0, arg1 interface{}) *gomock.Call { return _mr.mock.ctrl.RecordCall(_mr.mock, "Delete", arg0, arg1) } -func (_m *MockVMPresetInterface) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (*v19.VirtualMachinePreset, error) { +func (_m *MockVMIPresetInterface) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (*v19.VirtualMachineInstancePreset, error) { _s := []interface{}{name, pt, data} for _, _x := range subresources { _s = append(_s, _x) } ret := _m.ctrl.Call(_m, "Patch", _s...) - ret0, _ := ret[0].(*v19.VirtualMachinePreset) + ret0, _ := ret[0].(*v19.VirtualMachineInstancePreset) ret1, _ := ret[1].(error) return ret0, ret1 } -func (_mr *_MockVMPresetInterfaceRecorder) Patch(arg0, arg1, arg2 interface{}, arg3 ...interface{}) *gomock.Call { +func (_mr *_MockVMIPresetInterfaceRecorder) Patch(arg0, arg1, arg2 interface{}, arg3 ...interface{}) *gomock.Call { _s := append([]interface{}{arg0, arg1, arg2}, arg3...) return _mr.mock.ctrl.RecordCall(_mr.mock, "Patch", _s...) } -// Mock of OfflineVirtualMachineInterface interface -type MockOfflineVirtualMachineInterface struct { +// Mock of VirtualMachineInterface interface +type MockVirtualMachineInterface struct { ctrl *gomock.Controller - recorder *_MockOfflineVirtualMachineInterfaceRecorder + recorder *_MockVirtualMachineInterfaceRecorder } -// Recorder for MockOfflineVirtualMachineInterface (not exported) -type _MockOfflineVirtualMachineInterfaceRecorder struct { - mock *MockOfflineVirtualMachineInterface +// Recorder for MockVirtualMachineInterface (not exported) +type _MockVirtualMachineInterfaceRecorder struct { + mock *MockVirtualMachineInterface } -func NewMockOfflineVirtualMachineInterface(ctrl *gomock.Controller) *MockOfflineVirtualMachineInterface { - mock := &MockOfflineVirtualMachineInterface{ctrl: ctrl} - mock.recorder = &_MockOfflineVirtualMachineInterfaceRecorder{mock} +func NewMockVirtualMachineInterface(ctrl *gomock.Controller) *MockVirtualMachineInterface { + mock := &MockVirtualMachineInterface{ctrl: ctrl} + mock.recorder = &_MockVirtualMachineInterfaceRecorder{mock} return mock } -func (_m *MockOfflineVirtualMachineInterface) EXPECT() *_MockOfflineVirtualMachineInterfaceRecorder { +func (_m *MockVirtualMachineInterface) EXPECT() *_MockVirtualMachineInterfaceRecorder { return _m.recorder } -func (_m *MockOfflineVirtualMachineInterface) Get(name string, options *v1.GetOptions) (*v19.OfflineVirtualMachine, error) { +func (_m *MockVirtualMachineInterface) Get(name string, options *v1.GetOptions) (*v19.VirtualMachine, error) { ret := _m.ctrl.Call(_m, "Get", name, options) - ret0, _ := ret[0].(*v19.OfflineVirtualMachine) + ret0, _ := ret[0].(*v19.VirtualMachine) ret1, _ := ret[1].(error) return ret0, ret1 } -func (_mr *_MockOfflineVirtualMachineInterfaceRecorder) Get(arg0, arg1 interface{}) *gomock.Call { +func (_mr *_MockVirtualMachineInterfaceRecorder) Get(arg0, arg1 interface{}) *gomock.Call { return _mr.mock.ctrl.RecordCall(_mr.mock, "Get", arg0, arg1) } -func (_m *MockOfflineVirtualMachineInterface) List(opts *v1.ListOptions) (*v19.OfflineVirtualMachineList, error) { +func (_m *MockVirtualMachineInterface) List(opts *v1.ListOptions) (*v19.VirtualMachineList, error) { ret := _m.ctrl.Call(_m, "List", opts) - ret0, _ := ret[0].(*v19.OfflineVirtualMachineList) + ret0, _ := ret[0].(*v19.VirtualMachineList) ret1, _ := ret[1].(error) return ret0, ret1 } -func (_mr *_MockOfflineVirtualMachineInterfaceRecorder) List(arg0 interface{}) *gomock.Call { +func (_mr *_MockVirtualMachineInterfaceRecorder) List(arg0 interface{}) *gomock.Call { return _mr.mock.ctrl.RecordCall(_mr.mock, "List", arg0) } -func (_m *MockOfflineVirtualMachineInterface) Create(_param0 *v19.OfflineVirtualMachine) (*v19.OfflineVirtualMachine, error) { +func (_m *MockVirtualMachineInterface) Create(_param0 *v19.VirtualMachine) (*v19.VirtualMachine, error) { ret := _m.ctrl.Call(_m, "Create", _param0) - ret0, _ := ret[0].(*v19.OfflineVirtualMachine) + ret0, _ := ret[0].(*v19.VirtualMachine) ret1, _ := ret[1].(error) return ret0, ret1 } -func (_mr *_MockOfflineVirtualMachineInterfaceRecorder) Create(arg0 interface{}) *gomock.Call { +func (_mr *_MockVirtualMachineInterfaceRecorder) Create(arg0 interface{}) *gomock.Call { return _mr.mock.ctrl.RecordCall(_mr.mock, "Create", arg0) } -func (_m *MockOfflineVirtualMachineInterface) Update(_param0 *v19.OfflineVirtualMachine) (*v19.OfflineVirtualMachine, error) { +func (_m *MockVirtualMachineInterface) Update(_param0 *v19.VirtualMachine) (*v19.VirtualMachine, error) { ret := _m.ctrl.Call(_m, "Update", _param0) - ret0, _ := ret[0].(*v19.OfflineVirtualMachine) + ret0, _ := ret[0].(*v19.VirtualMachine) ret1, _ := ret[1].(error) return ret0, ret1 } -func (_mr *_MockOfflineVirtualMachineInterfaceRecorder) Update(arg0 interface{}) *gomock.Call { +func (_mr *_MockVirtualMachineInterfaceRecorder) Update(arg0 interface{}) *gomock.Call { return _mr.mock.ctrl.RecordCall(_mr.mock, "Update", arg0) } -func (_m *MockOfflineVirtualMachineInterface) Delete(name string, options *v1.DeleteOptions) error { +func (_m *MockVirtualMachineInterface) Delete(name string, options *v1.DeleteOptions) error { ret := _m.ctrl.Call(_m, "Delete", name, options) ret0, _ := ret[0].(error) return ret0 } -func (_mr *_MockOfflineVirtualMachineInterfaceRecorder) Delete(arg0, arg1 interface{}) *gomock.Call { +func (_mr *_MockVirtualMachineInterfaceRecorder) Delete(arg0, arg1 interface{}) *gomock.Call { return _mr.mock.ctrl.RecordCall(_mr.mock, "Delete", arg0, arg1) } + +func (_m *MockVirtualMachineInterface) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (*v19.VirtualMachine, error) { + _s := []interface{}{name, pt, data} + for _, _x := range subresources { + _s = append(_s, _x) + } + ret := _m.ctrl.Call(_m, "Patch", _s...) + ret0, _ := ret[0].(*v19.VirtualMachine) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +func (_mr *_MockVirtualMachineInterfaceRecorder) Patch(arg0, arg1, arg2 interface{}, arg3 ...interface{}) *gomock.Call { + _s := append([]interface{}{arg0, arg1, arg2}, arg3...) + return _mr.mock.ctrl.RecordCall(_mr.mock, "Patch", _s...) +} diff --git a/vendor/kubevirt.io/kubevirt/pkg/kubecli/handler.go b/vendor/kubevirt.io/kubevirt/pkg/kubecli/handler.go index 4bd0adce4..90ff5c92b 100644 --- a/vendor/kubevirt.io/kubevirt/pkg/kubecli/handler.go +++ b/vendor/kubevirt.io/kubevirt/pkg/kubecli/handler.go @@ -22,7 +22,7 @@ type VirtHandlerClient interface { type VirtHandlerConn interface { ConnectionDetails() (ip string, port string, err error) - ConsoleURI(vm *virtv1.VirtualMachine) (*url.URL, error) + ConsoleURI(vmi *virtv1.VirtualMachineInstance) (*url.URL, error) Pod() (pod *v1.Pod, err error) } @@ -87,13 +87,13 @@ func (v *virtHandlerConn) ConnectionDetails() (ip string, port string, err error } //TODO move the actual ws handling in here, and work with channels -func (v *virtHandlerConn) ConsoleURI(vm *virtv1.VirtualMachine) (*url.URL, error) { +func (v *virtHandlerConn) ConsoleURI(vmi *virtv1.VirtualMachineInstance) (*url.URL, error) { ip, port, err := v.ConnectionDetails() if err != nil { return nil, err } return &url.URL{ - Path: fmt.Sprintf("/api/v1/namespaces/%s/virtualmachines/%s/console", vm.ObjectMeta.Namespace, vm.ObjectMeta.Name), + Path: fmt.Sprintf("/api/v1/namespaces/%s/virtualmachineinstances/%s/console", vmi.ObjectMeta.Namespace, vmi.ObjectMeta.Name), Host: ip + ":" + port, }, nil } diff --git a/vendor/kubevirt.io/kubevirt/pkg/kubecli/kubecli.go b/vendor/kubevirt.io/kubevirt/pkg/kubecli/kubecli.go index 35437ef87..90c32a56c 100644 --- a/vendor/kubevirt.io/kubevirt/pkg/kubecli/kubecli.go +++ b/vendor/kubevirt.io/kubevirt/pkg/kubecli/kubecli.go @@ -132,7 +132,8 @@ func DefaultClientConfig(flags *pflag.FlagSet) clientcmd.ClientConfig { return clientConfig } -func GetKubevirtClientFromClientConfig(cmdConfig clientcmd.ClientConfig) (KubevirtClient, error) { +// this function is defined as a closure so iut could be overwritten by unit tests +var GetKubevirtClientFromClientConfig = func(cmdConfig clientcmd.ClientConfig) (KubevirtClient, error) { config, err := cmdConfig.ClientConfig() if err != nil { return nil, err diff --git a/vendor/kubevirt.io/kubevirt/pkg/kubecli/kubevirt.go b/vendor/kubevirt.io/kubevirt/pkg/kubecli/kubevirt.go index c3898b2de..9ff4d1726 100644 --- a/vendor/kubevirt.io/kubevirt/pkg/kubecli/kubevirt.go +++ b/vendor/kubevirt.io/kubevirt/pkg/kubecli/kubevirt.go @@ -38,9 +38,10 @@ import ( ) type KubevirtClient interface { - VM(namespace string) VMInterface + VirtualMachineInstance(namespace string) VirtualMachineInstanceInterface ReplicaSet(namespace string) ReplicaSetInterface - OfflineVirtualMachine(namespace string) OfflineVirtualMachineInterface + VirtualMachine(namespace string) VirtualMachineInterface + ServerVersion() *ServerVersion RestClient() *rest.RESTClient kubernetes.Interface } @@ -57,40 +58,50 @@ func (k kubevirt) RestClient() *rest.RESTClient { return k.restClient } -type VMInterface interface { - Get(name string, options k8smetav1.GetOptions) (*v1.VirtualMachine, error) - List(opts k8smetav1.ListOptions) (*v1.VirtualMachineList, error) - Create(*v1.VirtualMachine) (*v1.VirtualMachine, error) - Update(*v1.VirtualMachine) (*v1.VirtualMachine, error) +type StreamOptions struct { + In io.Reader + Out io.Writer +} + +type StreamInterface interface { + Stream(options StreamOptions) error +} + +type VirtualMachineInstanceInterface interface { + Get(name string, options *k8smetav1.GetOptions) (*v1.VirtualMachineInstance, error) + List(opts *k8smetav1.ListOptions) (*v1.VirtualMachineInstanceList, error) + Create(instance *v1.VirtualMachineInstance) (*v1.VirtualMachineInstance, error) + Update(*v1.VirtualMachineInstance) (*v1.VirtualMachineInstance, error) Delete(name string, options *k8smetav1.DeleteOptions) error - Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.VirtualMachine, err error) - SerialConsole(name string, in io.Reader, out io.Writer) error - VNC(name string, in io.Reader, out io.Writer) error + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.VirtualMachineInstance, err error) + SerialConsole(name string) (StreamInterface, error) + VNC(name string) (StreamInterface, error) } type ReplicaSetInterface interface { - Get(name string, options k8smetav1.GetOptions) (*v1.VirtualMachineReplicaSet, error) - List(opts k8smetav1.ListOptions) (*v1.VirtualMachineReplicaSetList, error) - Create(*v1.VirtualMachineReplicaSet) (*v1.VirtualMachineReplicaSet, error) - Update(*v1.VirtualMachineReplicaSet) (*v1.VirtualMachineReplicaSet, error) + Get(name string, options k8smetav1.GetOptions) (*v1.VirtualMachineInstanceReplicaSet, error) + List(opts k8smetav1.ListOptions) (*v1.VirtualMachineInstanceReplicaSetList, error) + Create(*v1.VirtualMachineInstanceReplicaSet) (*v1.VirtualMachineInstanceReplicaSet, error) + Update(*v1.VirtualMachineInstanceReplicaSet) (*v1.VirtualMachineInstanceReplicaSet, error) Delete(name string, options *k8smetav1.DeleteOptions) error } -type VMPresetInterface interface { - Get(name string, options k8smetav1.GetOptions) (*v1.VirtualMachinePreset, error) - List(opts k8smetav1.ListOptions) (*v1.VirtualMachinePresetList, error) - Create(*v1.VirtualMachinePreset) (*v1.VirtualMachinePreset, error) - Update(*v1.VirtualMachinePreset) (*v1.VirtualMachinePreset, error) +type VMIPresetInterface interface { + Get(name string, options k8smetav1.GetOptions) (*v1.VirtualMachineInstancePreset, error) + List(opts k8smetav1.ListOptions) (*v1.VirtualMachineInstancePresetList, error) + Create(*v1.VirtualMachineInstancePreset) (*v1.VirtualMachineInstancePreset, error) + Update(*v1.VirtualMachineInstancePreset) (*v1.VirtualMachineInstancePreset, error) Delete(name string, options *k8smetav1.DeleteOptions) error - Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.VirtualMachinePreset, err error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.VirtualMachineInstancePreset, err error) } -// OfflineVirtualMachineInterface provides convenience methods to work with +// VirtualMachineInterface provides convenience methods to work with // offline virtual machines inside the cluster -type OfflineVirtualMachineInterface interface { - Get(name string, options *k8smetav1.GetOptions) (*v1.OfflineVirtualMachine, error) - List(opts *k8smetav1.ListOptions) (*v1.OfflineVirtualMachineList, error) - Create(*v1.OfflineVirtualMachine) (*v1.OfflineVirtualMachine, error) - Update(*v1.OfflineVirtualMachine) (*v1.OfflineVirtualMachine, error) +type VirtualMachineInterface interface { + Get(name string, options *k8smetav1.GetOptions) (*v1.VirtualMachine, error) + List(opts *k8smetav1.ListOptions) (*v1.VirtualMachineList, error) + Create(*v1.VirtualMachine) (*v1.VirtualMachine, error) + Update(*v1.VirtualMachine) (*v1.VirtualMachine, error) Delete(name string, options *k8smetav1.DeleteOptions) error + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.VirtualMachine, err error) } diff --git a/vendor/kubevirt.io/kubevirt/pkg/kubecli/kubevirt_test_utils.go b/vendor/kubevirt.io/kubevirt/pkg/kubecli/kubevirt_test_utils.go new file mode 100644 index 000000000..69eec5786 --- /dev/null +++ b/vendor/kubevirt.io/kubevirt/pkg/kubecli/kubevirt_test_utils.go @@ -0,0 +1,49 @@ +package kubecli + +import ( + "errors" + + k8smetav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/clientcmd" + + "kubevirt.io/kubevirt/pkg/api/v1" +) + +// GetMockKubevirtClientFromClientConfig, MockKubevirtClientInstance are used to create a mechanism +// for overriding the actual kubevirt client access. This is useful when the unit tested code invokes GetKubevirtClientFromClientConfig() +// and therefore the unit test code cannot generate the mock client directly. In such a case following steps are needed: +// (1) Override the GetKubevirtClientFromClientConfig() closure with GetMockKubevirtClientFromClientConfig() or +// GetInvalidKubevirtClientFromClientConfig() +// (2) Then create the instance of the client, and assign into MockKubevirtClientInstance before the tests start: +// ctrl := gomock.NewController(GinkgoT()) +// kubecli.MockKubevirtClientInstance = kubecli.NewMockKubevirtClient(ctrl) +// (3) Rest of the kubevirt mocking is automatically generated in generated_mock_kubevirt.go + +// MockKubevirtClientInstance is a reference to the kubevirt client that could be manipulated by the test code +var MockKubevirtClientInstance *MockKubevirtClient + +// GetMockKubevirtClientFromClientConfig is an entry point for testing, could be used to override GetKubevirtClientFromClientConfig +func GetMockKubevirtClientFromClientConfig(cmdConfig clientcmd.ClientConfig) (KubevirtClient, error) { + return MockKubevirtClientInstance, nil +} + +// GetInvalidKubevirtClientFromClientConfig is an entry point for testing case where client should be invalid +func GetInvalidKubevirtClientFromClientConfig(cmdConfig clientcmd.ClientConfig) (KubevirtClient, error) { + return nil, errors.New("invalid fake client") +} + +func NewMinimalVM(name string) *v1.VirtualMachine { + return &v1.VirtualMachine{TypeMeta: k8smetav1.TypeMeta{APIVersion: v1.GroupVersion.String(), Kind: "VirtualMachine"}, ObjectMeta: k8smetav1.ObjectMeta{Name: name}} +} + +func NewVMList(ovms ...v1.VirtualMachine) *v1.VirtualMachineList { + return &v1.VirtualMachineList{TypeMeta: k8smetav1.TypeMeta{APIVersion: v1.GroupVersion.String(), Kind: "VirtualMachineList"}, Items: ovms} +} + +func NewVirtualMachineInstanceReplicaSetList(rss ...v1.VirtualMachineInstanceReplicaSet) *v1.VirtualMachineInstanceReplicaSetList { + return &v1.VirtualMachineInstanceReplicaSetList{TypeMeta: k8smetav1.TypeMeta{APIVersion: v1.GroupVersion.String(), Kind: "VirtualMachineInstanceReplicaSetList"}, Items: rss} +} + +func NewMinimalVirtualMachineInstanceReplicaSet(name string) *v1.VirtualMachineInstanceReplicaSet { + return &v1.VirtualMachineInstanceReplicaSet{TypeMeta: k8smetav1.TypeMeta{APIVersion: v1.GroupVersion.String(), Kind: "VirtualMachineInstanceReplicaSet"}, ObjectMeta: k8smetav1.ObjectMeta{Name: name}} +} diff --git a/vendor/kubevirt.io/kubevirt/pkg/kubecli/ovm.go b/vendor/kubevirt.io/kubevirt/pkg/kubecli/ovm.go deleted file mode 100644 index 9f3182e92..000000000 --- a/vendor/kubevirt.io/kubevirt/pkg/kubecli/ovm.go +++ /dev/null @@ -1,119 +0,0 @@ -/* - * This file is part of the KubeVirt project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Copyright 2018 Red Hat, Inc. - * - */ - -package kubecli - -import ( - k8smetav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/client-go/kubernetes/scheme" - "k8s.io/client-go/rest" - - "kubevirt.io/kubevirt/pkg/api/v1" -) - -func (k *kubevirt) OfflineVirtualMachine(namespace string) OfflineVirtualMachineInterface { - return &ovm{ - restClient: k.restClient, - namespace: namespace, - resource: "offlinevirtualmachines", - } -} - -type ovm struct { - restClient *rest.RESTClient - namespace string - resource string -} - -// Create new OfflineVirtualMachine in the cluster to specified namespace -func (o *ovm) Create(offlinevm *v1.OfflineVirtualMachine) (*v1.OfflineVirtualMachine, error) { - newOvm := &v1.OfflineVirtualMachine{} - err := o.restClient.Post(). - Resource(o.resource). - Namespace(o.namespace). - Body(offlinevm). - Do(). - Into(newOvm) - - newOvm.SetGroupVersionKind(v1.OfflineVirtualMachineGroupVersionKind) - - return newOvm, err -} - -// Get the OfflineVirtual machine from the cluster by its name and namespace -func (o *ovm) Get(name string, options *k8smetav1.GetOptions) (*v1.OfflineVirtualMachine, error) { - newOvm := &v1.OfflineVirtualMachine{} - err := o.restClient.Get(). - Resource(o.resource). - Namespace(o.namespace). - Name(name). - VersionedParams(options, scheme.ParameterCodec). - Do(). - Into(newOvm) - - newOvm.SetGroupVersionKind(v1.OfflineVirtualMachineGroupVersionKind) - - return newOvm, err -} - -// Update the OfflineVirtualMachine instance in the cluster in given namespace -func (o *ovm) Update(offlinevm *v1.OfflineVirtualMachine) (*v1.OfflineVirtualMachine, error) { - updatedOvm := &v1.OfflineVirtualMachine{} - err := o.restClient.Put(). - Resource(o.resource). - Namespace(o.namespace). - Name(offlinevm.Name). - Body(offlinevm). - Do(). - Into(updatedOvm) - - updatedOvm.SetGroupVersionKind(v1.OfflineVirtualMachineGroupVersionKind) - - return updatedOvm, err -} - -// Delete the defined OfflineVirtualMachine in the cluster in defined namespace -func (o *ovm) Delete(name string, options *k8smetav1.DeleteOptions) error { - err := o.restClient.Delete(). - Resource(o.resource). - Namespace(o.namespace). - Name(name). - Body(options). - Do(). - Error() - - return err -} - -// List all OfflineVirtualMachines in given namespace -func (o *ovm) List(options *k8smetav1.ListOptions) (*v1.OfflineVirtualMachineList, error) { - newOvmList := &v1.OfflineVirtualMachineList{} - err := o.restClient.Get(). - Resource(o.resource). - Namespace(o.namespace). - VersionedParams(options, scheme.ParameterCodec). - Do(). - Into(newOvmList) - - for _, ovm := range newOvmList.Items { - ovm.SetGroupVersionKind(v1.OfflineVirtualMachineGroupVersionKind) - } - - return newOvmList, err -} diff --git a/vendor/kubevirt.io/kubevirt/pkg/kubecli/replicaset.go b/vendor/kubevirt.io/kubevirt/pkg/kubecli/replicaset.go index 4bad0991d..b2336cbbb 100644 --- a/vendor/kubevirt.io/kubevirt/pkg/kubecli/replicaset.go +++ b/vendor/kubevirt.io/kubevirt/pkg/kubecli/replicaset.go @@ -28,7 +28,7 @@ import ( ) func (k *kubevirt) ReplicaSet(namespace string) ReplicaSetInterface { - return &rc{k.restClient, namespace, "virtualmachinereplicasets"} + return &rc{k.restClient, namespace, "virtualmachineinstancereplicasets"} } type rc struct { @@ -37,8 +37,8 @@ type rc struct { resource string } -func (v *rc) Get(name string, options k8smetav1.GetOptions) (replicaset *v1.VirtualMachineReplicaSet, err error) { - replicaset = &v1.VirtualMachineReplicaSet{} +func (v *rc) Get(name string, options k8smetav1.GetOptions) (replicaset *v1.VirtualMachineInstanceReplicaSet, err error) { + replicaset = &v1.VirtualMachineInstanceReplicaSet{} err = v.restClient.Get(). Resource(v.resource). Namespace(v.namespace). @@ -46,12 +46,12 @@ func (v *rc) Get(name string, options k8smetav1.GetOptions) (replicaset *v1.Virt VersionedParams(&options, scheme.ParameterCodec). Do(). Into(replicaset) - replicaset.SetGroupVersionKind(v1.VMReplicaSetGroupVersionKind) + replicaset.SetGroupVersionKind(v1.VirtualMachineInstanceReplicaSetGroupVersionKind) return } -func (v *rc) List(options k8smetav1.ListOptions) (replicasetList *v1.VirtualMachineReplicaSetList, err error) { - replicasetList = &v1.VirtualMachineReplicaSetList{} +func (v *rc) List(options k8smetav1.ListOptions) (replicasetList *v1.VirtualMachineInstanceReplicaSetList, err error) { + replicasetList = &v1.VirtualMachineInstanceReplicaSetList{} err = v.restClient.Get(). Resource(v.resource). Namespace(v.namespace). @@ -59,26 +59,26 @@ func (v *rc) List(options k8smetav1.ListOptions) (replicasetList *v1.VirtualMach Do(). Into(replicasetList) for _, replicaset := range replicasetList.Items { - replicaset.SetGroupVersionKind(v1.VMReplicaSetGroupVersionKind) + replicaset.SetGroupVersionKind(v1.VirtualMachineInstanceReplicaSetGroupVersionKind) } return } -func (v *rc) Create(replicaset *v1.VirtualMachineReplicaSet) (result *v1.VirtualMachineReplicaSet, err error) { - result = &v1.VirtualMachineReplicaSet{} +func (v *rc) Create(replicaset *v1.VirtualMachineInstanceReplicaSet) (result *v1.VirtualMachineInstanceReplicaSet, err error) { + result = &v1.VirtualMachineInstanceReplicaSet{} err = v.restClient.Post(). Namespace(v.namespace). Resource(v.resource). Body(replicaset). Do(). Into(result) - result.SetGroupVersionKind(v1.VMReplicaSetGroupVersionKind) + result.SetGroupVersionKind(v1.VirtualMachineInstanceReplicaSetGroupVersionKind) return } -func (v *rc) Update(replicaset *v1.VirtualMachineReplicaSet) (result *v1.VirtualMachineReplicaSet, err error) { - result = &v1.VirtualMachineReplicaSet{} +func (v *rc) Update(replicaset *v1.VirtualMachineInstanceReplicaSet) (result *v1.VirtualMachineInstanceReplicaSet, err error) { + result = &v1.VirtualMachineInstanceReplicaSet{} err = v.restClient.Put(). Name(replicaset.ObjectMeta.Name). Namespace(v.namespace). @@ -86,7 +86,7 @@ func (v *rc) Update(replicaset *v1.VirtualMachineReplicaSet) (result *v1.Virtual Body(replicaset). Do(). Into(result) - result.SetGroupVersionKind(v1.VMReplicaSetGroupVersionKind) + result.SetGroupVersionKind(v1.VirtualMachineInstanceReplicaSetGroupVersionKind) return } diff --git a/vendor/kubevirt.io/kubevirt/pkg/kubecli/version.go b/vendor/kubevirt.io/kubevirt/pkg/kubecli/version.go new file mode 100644 index 000000000..e40afcf9a --- /dev/null +++ b/vendor/kubevirt.io/kubevirt/pkg/kubecli/version.go @@ -0,0 +1,63 @@ +/* + * This file is part of the KubeVirt project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Copyright 2018 Red Hat, Inc. + * + */ + +package kubecli + +import ( + "encoding/json" + "net/url" + + "k8s.io/client-go/rest" + + "kubevirt.io/kubevirt/pkg/version" +) + +func (k *kubevirt) ServerVersion() *ServerVersion { + return &ServerVersion{ + restClient: k.restClient, + resource: "version", + } +} + +type ServerVersion struct { + restClient *rest.RESTClient + resource string +} + +func (v *ServerVersion) Get() (*version.Info, error) { + result := v.restClient.Get().RequestURI("/apis/subresources.kubevirt.io/v1alpha2/version").Do() + data, err := result.Raw() + if err != nil { + connErr, isConnectionErr := err.(*url.Error) + + if isConnectionErr { + return nil, connErr.Err + } + + return nil, err + } + + var serverInfo version.Info + json.Unmarshal(data, &serverInfo) + if err != nil { + return nil, err + } + + return &serverInfo, nil +} diff --git a/vendor/kubevirt.io/kubevirt/pkg/kubecli/vm.go b/vendor/kubevirt.io/kubevirt/pkg/kubecli/vm.go index 01fd0ade6..3e6dfb1a6 100644 --- a/vendor/kubevirt.io/kubevirt/pkg/kubecli/vm.go +++ b/vendor/kubevirt.io/kubevirt/pkg/kubecli/vm.go @@ -13,23 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * Copyright 2017 Red Hat, Inc. + * Copyright 2018 Red Hat, Inc. * */ package kubecli import ( - "bytes" - "fmt" - "io" - "net/http" - "net/url" - - "github.com/gorilla/websocket" - k8smetav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/client-go/kubernetes" "k8s.io/client-go/kubernetes/scheme" "k8s.io/client-go/rest" @@ -38,306 +29,98 @@ import ( "kubevirt.io/kubevirt/pkg/api/v1" ) -const ( - WebsocketMessageBufferSize = 10240 -) - -func (k *kubevirt) VM(namespace string) VMInterface { - return &vms{ +func (k *kubevirt) VirtualMachine(namespace string) VirtualMachineInterface { + return &vm{ restClient: k.restClient, - config: k.config, - clientSet: k.Clientset, namespace: namespace, resource: "virtualmachines", } } -type vms struct { +type vm struct { restClient *rest.RESTClient - config *rest.Config - clientSet *kubernetes.Clientset namespace string resource string - master string - kubeconfig string -} - -type BinaryReadWriter struct { - Conn *websocket.Conn } -func (s *BinaryReadWriter) Write(p []byte) (int, error) { - wsFrameHeaderSize := 2 + 8 + 4 // Fixed header + length + mask (RFC 6455) - // our websocket package has an issue where it truncates messages - // when the message+header is greater than the buffer size we allocate. - // because of this, we have to chunk messages - chunkSize := WebsocketMessageBufferSize - wsFrameHeaderSize - bytesWritten := 0 - - for i := 0; i < len(p); i += chunkSize { - w, err := s.Conn.NextWriter(websocket.BinaryMessage) - if err != nil { - return bytesWritten, s.err(err) - } - defer w.Close() - - end := i + chunkSize - if end > len(p) { - end = len(p) - } - n, err := w.Write(p[i:end]) - if err != nil { - return bytesWritten, err - } +// Create new VirtualMachine in the cluster to specified namespace +func (o *vm) Create(offlinevm *v1.VirtualMachine) (*v1.VirtualMachine, error) { + newOvmi := &v1.VirtualMachine{} + err := o.restClient.Post(). + Resource(o.resource). + Namespace(o.namespace). + Body(offlinevm). + Do(). + Into(newOvmi) - bytesWritten = n + bytesWritten - } - return bytesWritten, nil + newOvmi.SetGroupVersionKind(v1.VirtualMachineGroupVersionKind) + return newOvmi, err } -func (s *BinaryReadWriter) Read(p []byte) (int, error) { - for { - msgType, r, err := s.Conn.NextReader() - if err != nil { - return 0, s.err(err) - } - - switch msgType { - case websocket.BinaryMessage: - n, err := r.Read(p) - return n, s.err(err) +// Get the OfflineVirtual machine from the cluster by its name and namespace +func (o *vm) Get(name string, options *k8smetav1.GetOptions) (*v1.VirtualMachine, error) { + newOvm := &v1.VirtualMachine{} + err := o.restClient.Get(). + Resource(o.resource). + Namespace(o.namespace). + Name(name). + VersionedParams(options, scheme.ParameterCodec). + Do(). + Into(newOvm) - case websocket.CloseMessage: - return 0, io.EOF - } - } -} + newOvm.SetGroupVersionKind(v1.VirtualMachineGroupVersionKind) -func (s *BinaryReadWriter) err(err error) error { - if err == nil { - return nil - } - if e, ok := err.(*websocket.CloseError); ok { - if e.Code == websocket.CloseNormalClosure { - return io.EOF - } - } - return err + return newOvm, err } -type RoundTripCallback func(conn *websocket.Conn, resp *http.Response, err error) error - -type WebsocketRoundTripper struct { - Dialer *websocket.Dialer - Do RoundTripCallback -} +// Update the VirtualMachine instance in the cluster in given namespace +func (o *vm) Update(offlinevm *v1.VirtualMachine) (*v1.VirtualMachine, error) { + updatedOvmi := &v1.VirtualMachine{} + err := o.restClient.Put(). + Resource(o.resource). + Namespace(o.namespace). + Name(offlinevm.Name). + Body(offlinevm). + Do(). + Into(updatedOvmi) -func (d *WebsocketRoundTripper) RoundTrip(r *http.Request) (*http.Response, error) { - conn, resp, err := d.Dialer.Dial(r.URL.String(), r.Header) - if err == nil { - defer conn.Close() - } - return resp, d.Do(conn, resp, err) -} + updatedOvmi.SetGroupVersionKind(v1.VirtualMachineGroupVersionKind) -type wsCallbackObj struct { - in io.Reader - out io.Writer + return updatedOvmi, err } -func (obj *wsCallbackObj) WebsocketCallback(ws *websocket.Conn, resp *http.Response, err error) error { - - if err != nil { - if resp != nil && resp.StatusCode != http.StatusOK { - buf := new(bytes.Buffer) - buf.ReadFrom(resp.Body) - return fmt.Errorf("Can't connect to websocket (%d): %s\n", resp.StatusCode, buf.String()) - } - return fmt.Errorf("Can't connect to websocket: %s\n", err.Error()) - } - - wsReadWriter := &BinaryReadWriter{Conn: ws} - - copyErr := make(chan error) - - go func() { - _, err := io.Copy(wsReadWriter, obj.in) - copyErr <- err - }() - - go func() { - _, err := io.Copy(obj.out, wsReadWriter) - copyErr <- err - }() +// Delete the defined VirtualMachine in the cluster in defined namespace +func (o *vm) Delete(name string, options *k8smetav1.DeleteOptions) error { + err := o.restClient.Delete(). + Resource(o.resource). + Namespace(o.namespace). + Name(name). + Body(options). + Do(). + Error() - err = <-copyErr return err } -func roundTripperFromConfig(config *rest.Config, in io.Reader, out io.Writer) (http.RoundTripper, error) { - - // Configure TLS - tlsConfig, err := rest.TLSConfigFor(config) - if err != nil { - return nil, err - } - - // Configure the websocket dialer - dialer := &websocket.Dialer{ - Proxy: http.ProxyFromEnvironment, - TLSClientConfig: tlsConfig, - WriteBufferSize: WebsocketMessageBufferSize, - ReadBufferSize: WebsocketMessageBufferSize, - } - - obj := &wsCallbackObj{ - in: in, - out: out, - } - // Create a roundtripper which will pass in the final underlying websocket connection to a callback - rt := &WebsocketRoundTripper{ - Do: obj.WebsocketCallback, - Dialer: dialer, - } - - // Make sure we inherit all relevant security headers - return rest.HTTPWrappersForConfig(config, rt) -} - -func RequestFromConfig(config *rest.Config, vm string, namespace string, resource string) (*http.Request, error) { - - u, err := url.Parse(config.Host) - if err != nil { - return nil, err - } - - switch u.Scheme { - case "https": - u.Scheme = "wss" - case "http": - u.Scheme = "ws" - default: - return nil, fmt.Errorf("Unsupported Protocol %s", u.Scheme) - } - - u.Path = fmt.Sprintf("/apis/subresources.kubevirt.io/v1alpha1/namespaces/%s/virtualmachines/%s/%s", namespace, vm, resource) - req := &http.Request{ - Method: http.MethodGet, - URL: u, - } - - return req, nil -} - -func (v *vms) VNC(name string, in io.Reader, out io.Writer) error { - return v.subresourceHelper(name, "vnc", in, out) -} -func (v *vms) SerialConsole(name string, in io.Reader, out io.Writer) error { - return v.subresourceHelper(name, "console", in, out) -} - -func (v *vms) subresourceHelper(name string, resource string, in io.Reader, out io.Writer) error { - - // Create a round tripper with all necessary kubernetes security details - wrappedRoundTripper, err := roundTripperFromConfig(v.config, in, out) - if err != nil { - return fmt.Errorf("unable to create round tripper for remote execution: %v", err) - } - - // Create a request out of config and the query parameters - req, err := RequestFromConfig(v.config, name, v.namespace, resource) - if err != nil { - return fmt.Errorf("unable to create request for remote execution: %v", err) - } - - // Send the request and let the callback do its work - response, err := wrappedRoundTripper.RoundTrip(req) - - if err != nil { - return err - } - - if response != nil { - switch response.StatusCode { - case http.StatusOK: - return nil - case http.StatusNotFound: - return fmt.Errorf("Virtual Machine not found.") - case http.StatusInternalServerError: - return fmt.Errorf("Websocket failed due to internal server error.") - default: - return fmt.Errorf("Websocket failed with http status: %s", response.Status) - } - } else { - return fmt.Errorf("no response received") - } -} - -func (v *vms) Get(name string, options k8smetav1.GetOptions) (vm *v1.VirtualMachine, err error) { - vm = &v1.VirtualMachine{} - err = v.restClient.Get(). - Resource(v.resource). - Namespace(v.namespace). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). +// List all VirtualMachines in given namespace +func (o *vm) List(options *k8smetav1.ListOptions) (*v1.VirtualMachineList, error) { + newOvmList := &v1.VirtualMachineList{} + err := o.restClient.Get(). + Resource(o.resource). + Namespace(o.namespace). + VersionedParams(options, scheme.ParameterCodec). Do(). - Into(vm) - vm.SetGroupVersionKind(v1.VirtualMachineGroupVersionKind) - return -} + Into(newOvmList) -func (v *vms) List(options k8smetav1.ListOptions) (vmList *v1.VirtualMachineList, err error) { - vmList = &v1.VirtualMachineList{} - err = v.restClient.Get(). - Resource(v.resource). - Namespace(v.namespace). - VersionedParams(&options, scheme.ParameterCodec). - Do(). - Into(vmList) - for _, vm := range vmList.Items { + for _, vm := range newOvmList.Items { vm.SetGroupVersionKind(v1.VirtualMachineGroupVersionKind) } - return -} - -func (v *vms) Create(vm *v1.VirtualMachine) (result *v1.VirtualMachine, err error) { - result = &v1.VirtualMachine{} - err = v.restClient.Post(). - Namespace(v.namespace). - Resource(v.resource). - Body(vm). - Do(). - Into(result) - result.SetGroupVersionKind(v1.VirtualMachineGroupVersionKind) - return -} - -func (v *vms) Update(vm *v1.VirtualMachine) (result *v1.VirtualMachine, err error) { - result = &v1.VirtualMachine{} - err = v.restClient.Put(). - Name(vm.ObjectMeta.Name). - Namespace(v.namespace). - Resource(v.resource). - Body(vm). - Do(). - Into(result) - result.SetGroupVersionKind(v1.VirtualMachineGroupVersionKind) - return -} - -func (v *vms) Delete(name string, options *k8smetav1.DeleteOptions) error { - return v.restClient.Delete(). - Namespace(v.namespace). - Resource(v.resource). - Name(name). - Body(options). - Do(). - Error() + return newOvmList, err } -func (v *vms) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.VirtualMachine, err error) { +func (v *vm) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.VirtualMachine, err error) { result = &v1.VirtualMachine{} err = v.restClient.Patch(pt). Namespace(v.namespace). @@ -347,5 +130,5 @@ func (v *vms) Patch(name string, pt types.PatchType, data []byte, subresources . Body(data). Do(). Into(result) - return + return result, err } diff --git a/vendor/kubevirt.io/kubevirt/pkg/kubecli/vmi.go b/vendor/kubevirt.io/kubevirt/pkg/kubecli/vmi.go new file mode 100644 index 000000000..93907e4fb --- /dev/null +++ b/vendor/kubevirt.io/kubevirt/pkg/kubecli/vmi.go @@ -0,0 +1,384 @@ +/* + * This file is part of the KubeVirt project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Copyright 2017 Red Hat, Inc. + * + */ + +package kubecli + +import ( + "bytes" + "fmt" + "io" + "net/http" + "net/url" + + "github.com/gorilla/websocket" + + k8smetav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/kubernetes" + "k8s.io/client-go/kubernetes/scheme" + "k8s.io/client-go/rest" + + "k8s.io/apimachinery/pkg/types" + + "kubevirt.io/kubevirt/pkg/api/v1" +) + +const ( + WebsocketMessageBufferSize = 10240 +) + +func (k *kubevirt) VirtualMachineInstance(namespace string) VirtualMachineInstanceInterface { + return &vmis{ + restClient: k.restClient, + config: k.config, + clientSet: k.Clientset, + namespace: namespace, + resource: "virtualmachineinstances", + } +} + +type vmis struct { + restClient *rest.RESTClient + config *rest.Config + clientSet *kubernetes.Clientset + namespace string + resource string + master string + kubeconfig string +} + +type BinaryReadWriter struct { + Conn *websocket.Conn +} + +func (s *BinaryReadWriter) Write(p []byte) (int, error) { + wsFrameHeaderSize := 2 + 8 + 4 // Fixed header + length + mask (RFC 6455) + // our websocket package has an issue where it truncates messages + // when the message+header is greater than the buffer size we allocate. + // because of this, we have to chunk messages + chunkSize := WebsocketMessageBufferSize - wsFrameHeaderSize + bytesWritten := 0 + + for i := 0; i < len(p); i += chunkSize { + w, err := s.Conn.NextWriter(websocket.BinaryMessage) + if err != nil { + return bytesWritten, s.err(err) + } + defer w.Close() + + end := i + chunkSize + if end > len(p) { + end = len(p) + } + n, err := w.Write(p[i:end]) + if err != nil { + return bytesWritten, err + } + + bytesWritten = n + bytesWritten + } + return bytesWritten, nil + +} + +func (s *BinaryReadWriter) Read(p []byte) (int, error) { + for { + msgType, r, err := s.Conn.NextReader() + if err != nil { + return 0, s.err(err) + } + + switch msgType { + case websocket.BinaryMessage: + n, err := r.Read(p) + return n, s.err(err) + + case websocket.CloseMessage: + return 0, io.EOF + } + } +} + +func (s *BinaryReadWriter) err(err error) error { + if err == nil { + return nil + } + if e, ok := err.(*websocket.CloseError); ok { + if e.Code == websocket.CloseNormalClosure { + return io.EOF + } + } + return err +} + +type RoundTripCallback func(conn *websocket.Conn, resp *http.Response, err error) error + +type WebsocketRoundTripper struct { + Dialer *websocket.Dialer + Do RoundTripCallback +} + +func (d *WebsocketRoundTripper) RoundTrip(r *http.Request) (*http.Response, error) { + conn, resp, err := d.Dialer.Dial(r.URL.String(), r.Header) + if err == nil { + defer conn.Close() + } + return resp, d.Do(conn, resp, err) +} + +type asyncWSRoundTripper struct { + Done chan struct{} + Connection chan *websocket.Conn +} + +func (aws *asyncWSRoundTripper) WebsocketCallback(ws *websocket.Conn, resp *http.Response, err error) error { + + if err != nil { + if resp != nil && resp.StatusCode != http.StatusOK { + buf := new(bytes.Buffer) + buf.ReadFrom(resp.Body) + return fmt.Errorf("Can't connect to websocket (%d): %s\n", resp.StatusCode, buf.String()) + } + return fmt.Errorf("Can't connect to websocket: %s\n", err.Error()) + } + aws.Connection <- ws + + // Keep the roundtripper open until we are done with the stream + <-aws.Done + return nil +} + +func roundTripperFromConfig(config *rest.Config, callback RoundTripCallback) (http.RoundTripper, error) { + + // Configure TLS + tlsConfig, err := rest.TLSConfigFor(config) + if err != nil { + return nil, err + } + + // Configure the websocket dialer + dialer := &websocket.Dialer{ + Proxy: http.ProxyFromEnvironment, + TLSClientConfig: tlsConfig, + WriteBufferSize: WebsocketMessageBufferSize, + ReadBufferSize: WebsocketMessageBufferSize, + } + + // Create a roundtripper which will pass in the final underlying websocket connection to a callback + rt := &WebsocketRoundTripper{ + Do: callback, + Dialer: dialer, + } + + // Make sure we inherit all relevant security headers + return rest.HTTPWrappersForConfig(config, rt) +} + +func RequestFromConfig(config *rest.Config, vmi string, namespace string, resource string) (*http.Request, error) { + + u, err := url.Parse(config.Host) + if err != nil { + return nil, err + } + + switch u.Scheme { + case "https": + u.Scheme = "wss" + case "http": + u.Scheme = "ws" + default: + return nil, fmt.Errorf("Unsupported Protocol %s", u.Scheme) + } + + u.Path = fmt.Sprintf("/apis/subresources.kubevirt.io/v1alpha2/namespaces/%s/virtualmachineinstances/%s/%s", namespace, vmi, resource) + req := &http.Request{ + Method: http.MethodGet, + URL: u, + } + + return req, nil +} + +type wsStreamer struct { + conn *websocket.Conn + done chan struct{} +} + +func (ws *wsStreamer) streamDone() { + close(ws.done) +} + +func (ws *wsStreamer) Stream(options StreamOptions) error { + wsReadWriter := &BinaryReadWriter{Conn: ws.conn} + + copyErr := make(chan error, 1) + + go func() { + _, err := io.Copy(wsReadWriter, options.In) + copyErr <- err + }() + + go func() { + _, err := io.Copy(options.Out, wsReadWriter) + copyErr <- err + }() + + defer ws.streamDone() + return <-copyErr +} + +func (v *vmis) VNC(name string) (StreamInterface, error) { + return v.asyncSubresourceHelper(name, "vnc") +} +func (v *vmis) SerialConsole(name string) (StreamInterface, error) { + return v.asyncSubresourceHelper(name, "console") +} + +func (v *vmis) asyncSubresourceHelper(name string, resource string) (StreamInterface, error) { + + done := make(chan struct{}) + + aws := &asyncWSRoundTripper{ + Connection: make(chan *websocket.Conn), + Done: done, + } + // Create a round tripper with all necessary kubernetes security details + wrappedRoundTripper, err := roundTripperFromConfig(v.config, aws.WebsocketCallback) + if err != nil { + return nil, fmt.Errorf("unable to create round tripper for remote execution: %v", err) + } + + // Create a request out of config and the query parameters + req, err := RequestFromConfig(v.config, name, v.namespace, resource) + if err != nil { + return nil, fmt.Errorf("unable to create request for remote execution: %v", err) + } + + errChan := make(chan error, 1) + + go func() { + // Send the request and let the callback do its work + response, err := wrappedRoundTripper.RoundTrip(req) + + if err != nil { + errChan <- err + return + } + + if response != nil { + switch response.StatusCode { + case http.StatusOK: + case http.StatusNotFound: + err = fmt.Errorf("Virtual Machine not found.") + case http.StatusInternalServerError: + err = fmt.Errorf("Websocket failed due to internal server error.") + default: + err = fmt.Errorf("Websocket failed with http status: %s", response.Status) + } + } else { + err = fmt.Errorf("no response received") + } + errChan <- err + }() + + select { + case err = <-errChan: + return nil, err + case ws := <-aws.Connection: + return &wsStreamer{ + conn: ws, + done: done, + }, nil + } +} + +func (v *vmis) Get(name string, options *k8smetav1.GetOptions) (vmi *v1.VirtualMachineInstance, err error) { + vmi = &v1.VirtualMachineInstance{} + err = v.restClient.Get(). + Resource(v.resource). + Namespace(v.namespace). + Name(name). + VersionedParams(options, scheme.ParameterCodec). + Do(). + Into(vmi) + vmi.SetGroupVersionKind(v1.VirtualMachineInstanceGroupVersionKind) + return +} + +func (v *vmis) List(options *k8smetav1.ListOptions) (vmiList *v1.VirtualMachineInstanceList, err error) { + vmiList = &v1.VirtualMachineInstanceList{} + err = v.restClient.Get(). + Resource(v.resource). + Namespace(v.namespace). + VersionedParams(options, scheme.ParameterCodec). + Do(). + Into(vmiList) + for _, vmi := range vmiList.Items { + vmi.SetGroupVersionKind(v1.VirtualMachineInstanceGroupVersionKind) + } + + return +} + +func (v *vmis) Create(vmi *v1.VirtualMachineInstance) (result *v1.VirtualMachineInstance, err error) { + result = &v1.VirtualMachineInstance{} + err = v.restClient.Post(). + Namespace(v.namespace). + Resource(v.resource). + Body(vmi). + Do(). + Into(result) + result.SetGroupVersionKind(v1.VirtualMachineInstanceGroupVersionKind) + return +} + +func (v *vmis) Update(vmi *v1.VirtualMachineInstance) (result *v1.VirtualMachineInstance, err error) { + result = &v1.VirtualMachineInstance{} + err = v.restClient.Put(). + Name(vmi.ObjectMeta.Name). + Namespace(v.namespace). + Resource(v.resource). + Body(vmi). + Do(). + Into(result) + result.SetGroupVersionKind(v1.VirtualMachineInstanceGroupVersionKind) + return +} + +func (v *vmis) Delete(name string, options *k8smetav1.DeleteOptions) error { + return v.restClient.Delete(). + Namespace(v.namespace). + Resource(v.resource). + Name(name). + Body(options). + Do(). + Error() +} + +func (v *vmis) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.VirtualMachineInstance, err error) { + result = &v1.VirtualMachineInstance{} + err = v.restClient.Patch(pt). + Namespace(v.namespace). + Resource(v.resource). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/vendor/kubevirt.io/kubevirt/pkg/kubecli/vmpreset.go b/vendor/kubevirt.io/kubevirt/pkg/kubecli/vmpreset.go index a25306133..466e87e1b 100644 --- a/vendor/kubevirt.io/kubevirt/pkg/kubecli/vmpreset.go +++ b/vendor/kubevirt.io/kubevirt/pkg/kubecli/vmpreset.go @@ -29,70 +29,70 @@ import ( "kubevirt.io/kubevirt/pkg/api/v1" ) -func (k *kubevirt) VMPreset(namespace string) VMPresetInterface { - return &vmPresets{k.restClient, namespace, "virtualmachinepresets"} +func (k *kubevirt) VMIPreset(namespace string) VMIPresetInterface { + return &vmiPresets{k.restClient, namespace, "virtualmachineinstancepresets"} } -type vmPresets struct { +type vmiPresets struct { restClient *rest.RESTClient namespace string resource string } -func (v *vmPresets) Get(name string, options k8smetav1.GetOptions) (vm *v1.VirtualMachinePreset, err error) { - vm = &v1.VirtualMachinePreset{} +func (v *vmiPresets) Get(name string, options k8smetav1.GetOptions) (vmi *v1.VirtualMachineInstancePreset, err error) { + vmi = &v1.VirtualMachineInstancePreset{} err = v.restClient.Get(). Resource(v.resource). Namespace(v.namespace). Name(name). VersionedParams(&options, scheme.ParameterCodec). Do(). - Into(vm) - vm.SetGroupVersionKind(v1.VirtualMachinePresetGroupVersionKind) + Into(vmi) + vmi.SetGroupVersionKind(v1.VirtualMachineInstancePresetGroupVersionKind) return } -func (v *vmPresets) List(options k8smetav1.ListOptions) (vmList *v1.VirtualMachinePresetList, err error) { - vmList = &v1.VirtualMachinePresetList{} +func (v *vmiPresets) List(options k8smetav1.ListOptions) (vmiList *v1.VirtualMachineInstancePresetList, err error) { + vmiList = &v1.VirtualMachineInstancePresetList{} err = v.restClient.Get(). Resource(v.resource). Namespace(v.namespace). VersionedParams(&options, scheme.ParameterCodec). Do(). - Into(vmList) - for _, vm := range vmList.Items { - vm.SetGroupVersionKind(v1.VirtualMachinePresetGroupVersionKind) + Into(vmiList) + for _, vmi := range vmiList.Items { + vmi.SetGroupVersionKind(v1.VirtualMachineInstancePresetGroupVersionKind) } return } -func (v *vmPresets) Create(vm *v1.VirtualMachinePreset) (result *v1.VirtualMachinePreset, err error) { - result = &v1.VirtualMachinePreset{} +func (v *vmiPresets) Create(vmi *v1.VirtualMachineInstancePreset) (result *v1.VirtualMachineInstancePreset, err error) { + result = &v1.VirtualMachineInstancePreset{} err = v.restClient.Post(). Namespace(v.namespace). Resource(v.resource). - Body(vm). + Body(vmi). Do(). Into(result) - result.SetGroupVersionKind(v1.VirtualMachinePresetGroupVersionKind) + result.SetGroupVersionKind(v1.VirtualMachineInstancePresetGroupVersionKind) return } -func (v *vmPresets) Update(vm *v1.VirtualMachinePreset) (result *v1.VirtualMachinePreset, err error) { - result = &v1.VirtualMachinePreset{} +func (v *vmiPresets) Update(vmi *v1.VirtualMachineInstancePreset) (result *v1.VirtualMachineInstancePreset, err error) { + result = &v1.VirtualMachineInstancePreset{} err = v.restClient.Put(). - Name(vm.ObjectMeta.Name). + Name(vmi.ObjectMeta.Name). Namespace(v.namespace). Resource(v.resource). - Body(vm). + Body(vmi). Do(). Into(result) - result.SetGroupVersionKind(v1.VirtualMachinePresetGroupVersionKind) + result.SetGroupVersionKind(v1.VirtualMachineInstancePresetGroupVersionKind) return } -func (v *vmPresets) Delete(name string, options *k8smetav1.DeleteOptions) error { +func (v *vmiPresets) Delete(name string, options *k8smetav1.DeleteOptions) error { return v.restClient.Delete(). Namespace(v.namespace). Resource(v.resource). @@ -102,8 +102,8 @@ func (v *vmPresets) Delete(name string, options *k8smetav1.DeleteOptions) error Error() } -func (v *vmPresets) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.VirtualMachinePreset, err error) { - result = &v1.VirtualMachinePreset{} +func (v *vmiPresets) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.VirtualMachineInstancePreset, err error) { + result = &v1.VirtualMachineInstancePreset{} err = v.restClient.Patch(pt). Namespace(v.namespace). Resource(v.resource). diff --git a/vendor/kubevirt.io/kubevirt/pkg/log/log.go b/vendor/kubevirt.io/kubevirt/pkg/log/log.go index af4cbd330..fc83c253b 100644 --- a/vendor/kubevirt.io/kubevirt/pkg/log/log.go +++ b/vendor/kubevirt.io/kubevirt/pkg/log/log.go @@ -43,15 +43,13 @@ var lock sync.Mutex type logLevel int const ( - DEBUG logLevel = iota - INFO + INFO logLevel = iota WARNING ERROR CRITICAL ) var logLevelNames = map[logLevel]string{ - DEBUG: "debug", INFO: "info", WARNING: "warning", ERROR: "error", @@ -87,15 +85,21 @@ func MakeLogger(logger log.Logger) *FilteredLogger { if verbosityFlag := flag.Lookup("v"); verbosityFlag != nil { defaultVerbosity, _ = strconv.Atoi(verbosityFlag.Value.String()) } else { - defaultVerbosity = 0 + // "the practical default level is V(2)" + // see https://github.com/kubernetes/community/blob/master/contributors/devel/logging.md + defaultVerbosity = 2 } + + // This verbosity will be used for info logs without setting a custom verbosity level + defaultCurrentVerbosity := 2 + return &FilteredLogger{ logContext: log.NewContext(logger), component: defaultComponent, filterLevel: defaultLogLevel, currentLogLevel: defaultLogLevel, verbosityLevel: defaultVerbosity, - currentVerbosityLevel: defaultVerbosity, + currentVerbosityLevel: defaultCurrentVerbosity, } } @@ -162,12 +166,9 @@ func (l FilteredLogger) Log(params ...interface{}) error { func (l FilteredLogger) log(skipFrames int, params ...interface{}) error { // messages should be logged if any of these conditions are met: - // The log filtering level is debug // The log filtering level is info and verbosity checks match // The log message priority is warning or higher - force := (l.filterLevel == DEBUG) || (l.currentLogLevel >= WARNING) - - if force || (l.filterLevel == INFO && + if l.currentLogLevel >= WARNING || (l.filterLevel == INFO && (l.currentLogLevel == l.filterLevel) && (l.currentVerbosityLevel <= l.verbosityLevel)) { now := time.Now().UTC() @@ -236,7 +237,7 @@ func (l *FilteredLogger) WithPrefix(obj ...interface{}) *FilteredLogger { } func (l *FilteredLogger) SetLogLevel(filterLevel logLevel) error { - if (filterLevel >= DEBUG) && (filterLevel <= CRITICAL) { + if (filterLevel >= INFO) && (filterLevel <= CRITICAL) { l.filterLevel = filterLevel return nil } @@ -271,14 +272,6 @@ func (l FilteredLogger) Level(level logLevel) *FilteredLogger { return &l } -func (l FilteredLogger) Debug(msg string) { - l.Level(DEBUG).msg(msg) -} - -func (l FilteredLogger) Debugf(msg string, args ...interface{}) { - l.Level(DEBUG).msgf(msg, args...) -} - func (l FilteredLogger) Info(msg string) { l.Level(INFO).msg(msg) } diff --git a/vendor/kubevirt.io/kubevirt/pkg/middleware/middleware.go b/vendor/kubevirt.io/kubevirt/pkg/middleware/middleware.go index f78a2738d..64e81575e 100644 --- a/vendor/kubevirt.io/kubevirt/pkg/middleware/middleware.go +++ b/vendor/kubevirt.io/kubevirt/pkg/middleware/middleware.go @@ -112,7 +112,7 @@ func (k *KubernetesError) Body() []byte { // object not nil, string not empty, ...). With this middleware in place the service can throw an exception with a // precond.PreconditionError as payload. This middleware will catch that and translate it into an application // level PreconditionError. All other detected panics will be converted into an InternalServerError. In both cases it -// is most likely that there is an error withing the application or a library. Long story short, this is about +// is most likely that there is an error within the application or a library. Long story short, this is about // failing early in non recoverable situations. func InternalErrorMiddleware(logger gklog.Logger) endpoint.Middleware { return func(next endpoint.Endpoint) endpoint.Endpoint { diff --git a/vendor/kubevirt.io/kubevirt/pkg/registry-disk/registry-disk.go b/vendor/kubevirt.io/kubevirt/pkg/registry-disk/registry-disk.go index 29731e26a..ecc80942e 100644 --- a/vendor/kubevirt.io/kubevirt/pkg/registry-disk/registry-disk.go +++ b/vendor/kubevirt.io/kubevirt/pkg/registry-disk/registry-disk.go @@ -37,13 +37,13 @@ var registryDiskOwner = "qemu" var mountBaseDir = "/var/run/libvirt/kubevirt-disk-dir" -func generateVMBaseDir(vm *v1.VirtualMachine) string { - domain := precond.MustNotBeEmpty(vm.GetObjectMeta().GetName()) - namespace := precond.MustNotBeEmpty(vm.GetObjectMeta().GetNamespace()) +func generateVMIBaseDir(vmi *v1.VirtualMachineInstance) string { + domain := precond.MustNotBeEmpty(vmi.GetObjectMeta().GetName()) + namespace := precond.MustNotBeEmpty(vmi.GetObjectMeta().GetNamespace()) return fmt.Sprintf("%s/%s/%s", mountBaseDir, namespace, domain) } -func generateVolumeMountDir(vm *v1.VirtualMachine, volumeName string) string { - baseDir := generateVMBaseDir(vm) +func generateVolumeMountDir(vmi *v1.VirtualMachineInstance, volumeName string) string { + baseDir := generateVMIBaseDir(vmi) return fmt.Sprintf("%s/disk_%s", baseDir, volumeName) } @@ -57,9 +57,9 @@ func SetLocalDataOwner(user string) { registryDiskOwner = user } -func GetFilePath(vm *v1.VirtualMachine, volumeName string) (string, string, error) { +func GetFilePath(vmi *v1.VirtualMachineInstance, volumeName string) (string, string, error) { - volumeMountDir := generateVolumeMountDir(vm, volumeName) + volumeMountDir := generateVolumeMountDir(vmi, volumeName) suffixes := map[string]string{".raw": "raw", ".qcow2": "qcow2", ".raw.virt": "raw", ".qcow2.virt": "qcow2"} for k, v := range suffixes { @@ -75,10 +75,10 @@ func GetFilePath(vm *v1.VirtualMachine, volumeName string) (string, string, erro return "", "", errors.New(fmt.Sprintf("no supported file disk found in directory %s", volumeMountDir)) } -func SetFilePermissions(vm *v1.VirtualMachine) error { - for _, volume := range vm.Spec.Volumes { +func SetFilePermissions(vmi *v1.VirtualMachineInstance) error { + for _, volume := range vmi.Spec.Volumes { if volume.RegistryDisk != nil { - diskPath, _, err := GetFilePath(vm, volume.Name) + diskPath, _, err := GetFilePath(vmi, volume.Name) if err != nil { return err } @@ -95,7 +95,7 @@ func SetFilePermissions(vm *v1.VirtualMachine) error { // The controller uses this function to generate the container // specs for hosting the container registry disks. -func GenerateContainers(vm *v1.VirtualMachine, podVolumeName string, podVolumeMountDir string) []kubev1.Container { +func GenerateContainers(vmi *v1.VirtualMachineInstance, podVolumeName string, podVolumeMountDir string) []kubev1.Container { var containers []kubev1.Container initialDelaySeconds := 2 @@ -104,11 +104,11 @@ func GenerateContainers(vm *v1.VirtualMachine, podVolumeName string, podVolumeMo successThreshold := 2 failureThreshold := 5 - // Make VM Image Wrapper Containers - for _, volume := range vm.Spec.Volumes { + // Make VirtualMachineInstance Image Wrapper Containers + for _, volume := range vmi.Spec.Volumes { if volume.RegistryDisk != nil { - volumeMountDir := generateVolumeMountDir(vm, volume.Name) + volumeMountDir := generateVolumeMountDir(vmi, volume.Name) diskContainerName := fmt.Sprintf("volume%s", volume.Name) diskContainerImage := volume.RegistryDisk.Image diff --git a/vendor/kubevirt.io/kubevirt/pkg/service/service.go b/vendor/kubevirt.io/kubevirt/pkg/service/service.go index 1367875de..993c531e7 100644 --- a/vendor/kubevirt.io/kubevirt/pkg/service/service.go +++ b/vendor/kubevirt.io/kubevirt/pkg/service/service.go @@ -62,5 +62,9 @@ func (service *ServiceLibvirt) AddLibvirtFlags() { func Setup(service Service) { service.AddFlags() + + // set new default verbosity, was set to 0 by glog + flag.Set("v", "2") + flag.Parse() } diff --git a/vendor/kubevirt.io/kubevirt/pkg/testutils/matchers.go b/vendor/kubevirt.io/kubevirt/pkg/testutils/matchers.go index bd5de0309..c48195cff 100644 --- a/vendor/kubevirt.io/kubevirt/pkg/testutils/matchers.go +++ b/vendor/kubevirt.io/kubevirt/pkg/testutils/matchers.go @@ -85,7 +85,7 @@ func (matcher *representMimeTypeMatcher) Match(actual interface{}) (success bool } func (matcher *representMimeTypeMatcher) FailureMessage(actual interface{}) (message string) { - return fmt.Sprintf("Expected\n\t%#v\nto to be of type\n\t%#v", string(matcher.body), matcher.expected) + return fmt.Sprintf("Expected\n\t%#v\not to be of type\n\t%#v", string(matcher.body), matcher.expected) } func (matcher *representMimeTypeMatcher) NegatedFailureMessage(actual interface{}) (message string) { @@ -132,7 +132,7 @@ func (matcher *haveBodyEqualToMatcher) FailureMessage(actual interface{}) (messa if matcher.err != nil { return fmt.Sprintf("Deserializing the runtime object failed with %v", matcher.err) } else { - return fmt.Sprintf("Expected\n\t%#v\nto to be equal to\n\t%#v", matcher.obj, matcher.expected) + return fmt.Sprintf("Expected\n\t%#v\not to be equal to\n\t%#v", matcher.obj, matcher.expected) } } @@ -176,13 +176,25 @@ func (matcher *haveStatusCodeMatcher) Match(actual interface{}) (success bool, e } func (matcher *haveStatusCodeMatcher) FailureMessage(actual interface{}) (message string) { - return fmt.Sprintf("Expected status code \n\t%#v\nto to be\n\t%#v", matcher.statusCode, matcher.expected) + return fmt.Sprintf("Expected status code \n\t%#v\not to be\n\t%#v", matcher.statusCode, matcher.expected) } func (matcher *haveStatusCodeMatcher) NegatedFailureMessage(actual interface{}) (message string) { return fmt.Sprintf("Expected status code \n\t%#v\nnot to be\n\t%#v", matcher.statusCode, matcher.expected) } +// In case we don't care about emitted events, we simply consume all of them and return. +func IgnoreEvents(recorder *record.FakeRecorder) { +loop: + for { + select { + case <-recorder.Events: + default: + break loop + } + } +} + func ExpectEvent(recorder *record.FakeRecorder, reason string) { gomega.Expect(recorder.Events).To(gomega.Receive(gomega.ContainSubstring(reason))) } diff --git a/vendor/kubevirt.io/kubevirt/pkg/testutils/mock_queue.go b/vendor/kubevirt.io/kubevirt/pkg/testutils/mock_queue.go index a4859434e..be76e8b90 100644 --- a/vendor/kubevirt.io/kubevirt/pkg/testutils/mock_queue.go +++ b/vendor/kubevirt.io/kubevirt/pkg/testutils/mock_queue.go @@ -20,12 +20,12 @@ any RateLimitingInterface implementing queue. This allows synchronous testing of the controller. The typical pattern is: MockQueue.ExpectAdd(3) - vmSource.Add(vm) - vmSource.Add(vm1) - vmSource.Add(vm2) + vmiSource.Add(vmi) + vmiSource.Add(vmi1) + vmiSource.Add(vmi2) MockQueue.Wait() -This ensures that Source callbacks which are listening on vmSource +This ensures that Source callbacks which are listening on vmiSource enqueued three times an object. Since enqueing is typically the last action in listener callbacks, we can assume that the wanted scenario for a controller is set up, and an execution will process this scenario. @@ -72,21 +72,21 @@ type VirtualMachineFeeder struct { Source *framework.FakeControllerSource } -func (v *VirtualMachineFeeder) Add(vm *v1.VirtualMachine) { +func (v *VirtualMachineFeeder) Add(vmi *v1.VirtualMachineInstance) { v.MockQueue.ExpectAdds(1) - v.Source.Add(vm) + v.Source.Add(vmi) v.MockQueue.Wait() } -func (v *VirtualMachineFeeder) Modify(vm *v1.VirtualMachine) { +func (v *VirtualMachineFeeder) Modify(vmi *v1.VirtualMachineInstance) { v.MockQueue.ExpectAdds(1) - v.Source.Modify(vm) + v.Source.Modify(vmi) v.MockQueue.Wait() } -func (v *VirtualMachineFeeder) Delete(vm *v1.VirtualMachine) { +func (v *VirtualMachineFeeder) Delete(vmi *v1.VirtualMachineInstance) { v.MockQueue.ExpectAdds(1) - v.Source.Delete(vm) + v.Source.Delete(vmi) v.MockQueue.Wait() } @@ -132,21 +132,21 @@ type DomainFeeder struct { Source *framework.FakeControllerSource } -func (v *DomainFeeder) Add(vm *api.Domain) { +func (v *DomainFeeder) Add(vmi *api.Domain) { v.MockQueue.ExpectAdds(1) - v.Source.Add(vm) + v.Source.Add(vmi) v.MockQueue.Wait() } -func (v *DomainFeeder) Modify(vm *api.Domain) { +func (v *DomainFeeder) Modify(vmi *api.Domain) { v.MockQueue.ExpectAdds(1) - v.Source.Modify(vm) + v.Source.Modify(vmi) v.MockQueue.Wait() } -func (v *DomainFeeder) Delete(vm *api.Domain) { +func (v *DomainFeeder) Delete(vmi *api.Domain) { v.MockQueue.ExpectAdds(1) - v.Source.Delete(vm) + v.Source.Delete(vmi) v.MockQueue.Wait() } diff --git a/vendor/kubevirt.io/kubevirt/pkg/util/net/dns/sanitize.go b/vendor/kubevirt.io/kubevirt/pkg/util/net/dns/sanitize.go new file mode 100644 index 000000000..f99cf8da0 --- /dev/null +++ b/vendor/kubevirt.io/kubevirt/pkg/util/net/dns/sanitize.go @@ -0,0 +1,44 @@ +/* + * This file is part of the KubeVirt project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Copyright 2018 Red Hat, Inc. + * + */ + +package dns + +import ( + "strings" + + "k8s.io/apimachinery/pkg/util/validation" + + "kubevirt.io/kubevirt/pkg/api/v1" +) + +// Sanitize hostname according to DNS label rules +// If the hostname is taken from vmi.Spec.Hostname +// then it already passed DNS label validations. +func SanitizeHostname(vmi *v1.VirtualMachineInstance) string { + + hostName := strings.Split(vmi.Name, ".")[0] + if len(hostName) > validation.DNS1123LabelMaxLength { + hostName = hostName[:validation.DNS1123LabelMaxLength] + } + if vmi.Spec.Hostname != "" { + hostName = vmi.Spec.Hostname + } + + return hostName +} diff --git a/vendor/kubevirt.io/kubevirt/pkg/version/base.go b/vendor/kubevirt.io/kubevirt/pkg/version/base.go new file mode 100644 index 000000000..bd933defa --- /dev/null +++ b/vendor/kubevirt.io/kubevirt/pkg/version/base.go @@ -0,0 +1,28 @@ +/* + * This file is part of the KubeVirt project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Copyright 2018 Red Hat, Inc. + * + */ + +package version + +var ( + gitVersion = "v0.0.0-master+$Format:%h$" + gitCommit = "$Format:%H$" // sha1 from git, output of $(git rev-parse HEAD) + gitTreeState = "" // state of git tree, either "clean" or "dirty" + + buildDate = "1970-01-01T00:00:00Z" // build date in ISO8601 format, output of $(date -u +'%Y-%m-%dT%H:%M:%SZ') +) diff --git a/vendor/kubevirt.io/kubevirt/pkg/version/types.go b/vendor/kubevirt.io/kubevirt/pkg/version/types.go new file mode 100644 index 000000000..e90fb07d5 --- /dev/null +++ b/vendor/kubevirt.io/kubevirt/pkg/version/types.go @@ -0,0 +1,34 @@ +/* + * This file is part of the KubeVirt project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Copyright 2018 Red Hat, Inc. + * + */ +package version + +type Info struct { + GitVersion string `json:"gitVersion"` + GitCommit string `json:"gitCommit"` + GitTreeState string `json:"gitTreeState"` + BuildDate string `json:"buildDate"` + GoVersion string `json:"goVersion"` + Compiler string `json:"compiler"` + Platform string `json:"platform"` +} + +// String returns info as a human-friendly version string. +func (info Info) String() string { + return info.GitVersion +} diff --git a/vendor/kubevirt.io/kubevirt/pkg/version/version.go b/vendor/kubevirt.io/kubevirt/pkg/version/version.go new file mode 100644 index 000000000..209a302c9 --- /dev/null +++ b/vendor/kubevirt.io/kubevirt/pkg/version/version.go @@ -0,0 +1,37 @@ +/* + * This file is part of the KubeVirt project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Copyright 2018 Red Hat, Inc. + * + */ + +package version + +import ( + "fmt" + "runtime" +) + +func Get() Info { + return Info{ + GitVersion: gitVersion, + GitCommit: gitCommit, + GitTreeState: gitTreeState, + BuildDate: buildDate, + GoVersion: runtime.Version(), + Compiler: runtime.Compiler, + Platform: fmt.Sprintf("%s/%s", runtime.GOOS, runtime.GOARCH), + } +} diff --git a/vendor/kubevirt.io/kubevirt/pkg/virt-api/api.go b/vendor/kubevirt.io/kubevirt/pkg/virt-api/api.go index c63afad4e..5821a77c0 100644 --- a/vendor/kubevirt.io/kubevirt/pkg/virt-api/api.go +++ b/vendor/kubevirt.io/kubevirt/pkg/virt-api/api.go @@ -51,6 +51,7 @@ import ( "kubevirt.io/kubevirt/pkg/log" "kubevirt.io/kubevirt/pkg/rest/filter" "kubevirt.io/kubevirt/pkg/service" + "kubevirt.io/kubevirt/pkg/version" "kubevirt.io/kubevirt/pkg/virt-api/rest" "kubevirt.io/kubevirt/pkg/virt-api/validating-webhook" ) @@ -69,10 +70,10 @@ const ( virtApiServiceName = "virt-api" - vmValidatePath = "/virtualmachines-validate" - ovmValidatePath = "/offlinevirtualmachines-validate" - vmrsValidatePath = "/virtualmachinereplicaset-validate" - vmpresetValidatePath = "/vmpreset-validate" + vmiiValidatePath = "/virtualmachineinstances-validate" + vmiValidatePath = "/virtualmachines-validate" + vmirsValidatePath = "/virtualmachinereplicaset-validate" + vmipresetValidatePath = "/vmipreset-validate" certBytesValue = "cert-bytes" keyBytesValue = "key-bytes" @@ -84,6 +85,7 @@ type VirtApi interface { Run() AddFlags() ConfigureOpenAPIService() + Execute() } type virtAPIApp struct { @@ -106,7 +108,13 @@ var _ service.Service = &virtAPIApp{} func NewVirtApi() VirtApi { app := &virtAPIApp{} + app.BindAddress = defaultHost + app.Port = defaultPort + return app +} + +func (app *virtAPIApp) Execute() { virtCli, err := kubecli.GetKubevirtClient() if err != nil { panic(err) @@ -120,45 +128,45 @@ func NewVirtApi() VirtApi { app.authorizor = authorizor app.virtCli = virtCli - app.BindAddress = defaultHost - app.Port = defaultPort app.certsDirectory, err = ioutil.TempDir("", "certsdir") if err != nil { panic(err) } - return app + app.Compose() + app.ConfigureOpenAPIService() + app.Run() } func (app *virtAPIApp) composeResources(ctx context.Context) { + vmiGVR := schema.GroupVersionResource{Group: v1.GroupVersion.Group, Version: v1.GroupVersion.Version, Resource: "virtualmachineinstances"} + vmirsGVR := schema.GroupVersionResource{Group: v1.GroupVersion.Group, Version: v1.GroupVersion.Version, Resource: "virtualmachineinstancereplicasets"} + vmipGVR := schema.GroupVersionResource{Group: v1.GroupVersion.Group, Version: v1.GroupVersion.Version, Resource: "virtualmachineinstancepresets"} vmGVR := schema.GroupVersionResource{Group: v1.GroupVersion.Group, Version: v1.GroupVersion.Version, Resource: "virtualmachines"} - vmrsGVR := schema.GroupVersionResource{Group: v1.GroupVersion.Group, Version: v1.GroupVersion.Version, Resource: "virtualmachinereplicasets"} - vmpGVR := schema.GroupVersionResource{Group: v1.GroupVersion.Group, Version: v1.GroupVersion.Version, Resource: "virtualmachinepresets"} - ovmGVR := schema.GroupVersionResource{Group: v1.GroupVersion.Group, Version: v1.GroupVersion.Version, Resource: "offlinevirtualmachines"} ws, err := rest.GroupVersionProxyBase(ctx, v1.GroupVersion) if err != nil { panic(err) } - ws, err = rest.GenericResourceProxy(ws, ctx, vmGVR, &v1.VirtualMachine{}, v1.VirtualMachineGroupVersionKind.Kind, &v1.VirtualMachineList{}) + ws, err = rest.GenericResourceProxy(ws, ctx, vmiGVR, &v1.VirtualMachineInstance{}, v1.VirtualMachineInstanceGroupVersionKind.Kind, &v1.VirtualMachineInstanceList{}) if err != nil { panic(err) } - ws, err = rest.GenericResourceProxy(ws, ctx, vmrsGVR, &v1.VirtualMachineReplicaSet{}, v1.VMReplicaSetGroupVersionKind.Kind, &v1.VirtualMachineReplicaSetList{}) + ws, err = rest.GenericResourceProxy(ws, ctx, vmirsGVR, &v1.VirtualMachineInstanceReplicaSet{}, v1.VirtualMachineInstanceReplicaSetGroupVersionKind.Kind, &v1.VirtualMachineInstanceReplicaSetList{}) if err != nil { panic(err) } - ws, err = rest.GenericResourceProxy(ws, ctx, vmpGVR, &v1.VirtualMachinePreset{}, v1.VirtualMachineGroupVersionKind.Kind, &v1.VirtualMachinePresetList{}) + ws, err = rest.GenericResourceProxy(ws, ctx, vmipGVR, &v1.VirtualMachineInstancePreset{}, v1.VirtualMachineInstancePresetGroupVersionKind.Kind, &v1.VirtualMachineInstancePresetList{}) if err != nil { panic(err) } - ws, err = rest.GenericResourceProxy(ws, ctx, ovmGVR, &v1.OfflineVirtualMachine{}, v1.OfflineVirtualMachineGroupVersionKind.Kind, &v1.OfflineVirtualMachineList{}) + ws, err = rest.GenericResourceProxy(ws, ctx, vmGVR, &v1.VirtualMachine{}, v1.VirtualMachineGroupVersionKind.Kind, &v1.VirtualMachineList{}) if err != nil { panic(err) } @@ -173,7 +181,7 @@ func (app *virtAPIApp) composeResources(ctx context.Context) { Doc("Health endpoint"). Returns(http.StatusOK, "OK", nil). Returns(http.StatusInternalServerError, "Unhealthy", nil)) - ws, err = rest.ResourceProxyAutodiscovery(ctx, vmGVR) + ws, err = rest.ResourceProxyAutodiscovery(ctx, vmiGVR) if err != nil { panic(err) } @@ -203,7 +211,7 @@ func subresourceAPIGroup() metav1.APIGroup { func (app *virtAPIApp) composeSubresources(ctx context.Context) { - subresourcesvmGVR := schema.GroupVersionResource{Group: v1.SubresourceGroupVersion.Group, Version: v1.SubresourceGroupVersion.Version, Resource: "virtualmachines"} + subresourcesvmiGVR := schema.GroupVersionResource{Group: v1.SubresourceGroupVersion.Group, Version: v1.SubresourceGroupVersion.Version, Resource: "virtualmachineinstances"} subws := new(restful.WebService) subws.Doc("The KubeVirt Subresource API.") @@ -213,19 +221,19 @@ func (app *virtAPIApp) composeSubresources(ctx context.Context) { VirtCli: app.virtCli, } - subws.Route(subws.GET(rest.ResourcePath(subresourcesvmGVR) + rest.SubResourcePath("console")). + subws.Route(subws.GET(rest.ResourcePath(subresourcesvmiGVR) + rest.SubResourcePath("console")). To(subresourceApp.ConsoleRequestHandler). Param(rest.NamespaceParam(subws)).Param(rest.NameParam(subws)). Operation("console"). - Doc("Open a websocket connection to a serial console on the specified VM.")) + Doc("Open a websocket connection to a serial console on the specified VirtualMachineInstance.")) - subws.Route(subws.GET(rest.ResourcePath(subresourcesvmGVR) + rest.SubResourcePath("vnc")). + subws.Route(subws.GET(rest.ResourcePath(subresourcesvmiGVR) + rest.SubResourcePath("vnc")). To(subresourceApp.VNCRequestHandler). Param(rest.NamespaceParam(subws)).Param(rest.NameParam(subws)). Operation("vnc"). - Doc("Open a websocket connection to connect to VNC on the specified VM.")) + Doc("Open a websocket connection to connect to VNC on the specified VirtualMachineInstance.")) - subws.Route(subws.GET(rest.ResourcePath(subresourcesvmGVR) + rest.SubResourcePath("test")). + subws.Route(subws.GET(rest.ResourcePath(subresourcesvmiGVR) + rest.SubResourcePath("test")). To(func(request *restful.Request, response *restful.Response) { response.WriteHeader(http.StatusOK) }). @@ -233,6 +241,11 @@ func (app *virtAPIApp) composeSubresources(ctx context.Context) { Operation("test"). Doc("Test endpoint verifying apiserver connectivity.")) + subws.Route(subws.GET(rest.SubResourcePath("version")).Produces(restful.MIME_JSON). + To(func(request *restful.Request, response *restful.Response) { + response.WriteAsJson(version.Get()) + }).Operation("version")) + // Return empty api resource list. // K8s expects to be able to retrieve a resource list for each aggregated // app in order to discover what resources it provides. Without returning @@ -342,6 +355,18 @@ func addInfoToSwaggerObject(swo *openapispec.Swagger) { }, }, } + swo.SecurityDefinitions = openapispec.SecurityDefinitions{ + "BearerToken": &openapispec.SecurityScheme{ + SecuritySchemeProps: openapispec.SecuritySchemeProps{ + Type: "apiKey", + Name: "authorization", + In: "header", + Description: "Bearer Token authentication", + }, + }, + } + swo.Security = make([]map[string][]string, 1) + swo.Security[0] = map[string][]string{"BearerToken": {}} } func deserializeStrings(in string) ([]string, error) { @@ -486,10 +511,10 @@ func (app *virtAPIApp) getSelfSignedCert() error { func (app *virtAPIApp) createWebhook() error { namespace := getNamespace() registerWebhook := false - vmPath := vmValidatePath - ovmPath := ovmValidatePath - vmrsPath := vmrsValidatePath - vmpresetPath := vmpresetValidatePath + vmiPath := vmiiValidatePath + vmPath := vmiValidatePath + vmirsPath := vmirsValidatePath + vmipresetPath := vmipresetValidatePath webhookRegistration, err := app.virtCli.AdmissionregistrationV1beta1().ValidatingWebhookConfigurations().Get(virtWebhookValidator, metav1.GetOptions{}) if err != nil { @@ -502,39 +527,39 @@ func (app *virtAPIApp) createWebhook() error { webHooks := []admissionregistrationv1beta1.Webhook{ { - Name: "virtualmachine-validator.kubevirt.io", + Name: "virtualmachineinstances-validator.kubevirt.io", Rules: []admissionregistrationv1beta1.RuleWithOperations{{ Operations: []admissionregistrationv1beta1.OperationType{admissionregistrationv1beta1.Create}, Rule: admissionregistrationv1beta1.Rule{ APIGroups: []string{v1.GroupName}, - APIVersions: []string{v1.VirtualMachineGroupVersionKind.Version}, - Resources: []string{"virtualmachines"}, + APIVersions: []string{v1.VirtualMachineInstanceGroupVersionKind.Version}, + Resources: []string{"virtualmachineinstances"}, }, }}, ClientConfig: admissionregistrationv1beta1.WebhookClientConfig{ Service: &admissionregistrationv1beta1.ServiceReference{ Namespace: namespace, Name: virtApiServiceName, - Path: &vmPath, + Path: &vmiPath, }, CABundle: app.signingCertBytes, }, }, { - Name: "offlinevirtualmachine-validator.kubevirt.io", + Name: "virtualmachine-validator.kubevirt.io", Rules: []admissionregistrationv1beta1.RuleWithOperations{{ Operations: []admissionregistrationv1beta1.OperationType{admissionregistrationv1beta1.Create}, Rule: admissionregistrationv1beta1.Rule{ APIGroups: []string{v1.GroupName}, - APIVersions: []string{v1.OfflineVirtualMachineGroupVersionKind.Version}, - Resources: []string{"offlinevirtualmachines"}, + APIVersions: []string{v1.VirtualMachineGroupVersionKind.Version}, + Resources: []string{"virtualmachines"}, }, }}, ClientConfig: admissionregistrationv1beta1.WebhookClientConfig{ Service: &admissionregistrationv1beta1.ServiceReference{ Namespace: namespace, Name: virtApiServiceName, - Path: &ovmPath, + Path: &vmPath, }, CABundle: app.signingCertBytes, }, @@ -545,15 +570,15 @@ func (app *virtAPIApp) createWebhook() error { Operations: []admissionregistrationv1beta1.OperationType{admissionregistrationv1beta1.Create}, Rule: admissionregistrationv1beta1.Rule{ APIGroups: []string{v1.GroupName}, - APIVersions: []string{v1.VMReplicaSetGroupVersionKind.Version}, - Resources: []string{"virtualmachinereplicasets"}, + APIVersions: []string{v1.VirtualMachineInstanceReplicaSetGroupVersionKind.Version}, + Resources: []string{"virtualmachineinstancereplicasets"}, }, }}, ClientConfig: admissionregistrationv1beta1.WebhookClientConfig{ Service: &admissionregistrationv1beta1.ServiceReference{ Namespace: namespace, Name: virtApiServiceName, - Path: &vmrsPath, + Path: &vmirsPath, }, CABundle: app.signingCertBytes, }, @@ -564,15 +589,15 @@ func (app *virtAPIApp) createWebhook() error { Operations: []admissionregistrationv1beta1.OperationType{admissionregistrationv1beta1.Create}, Rule: admissionregistrationv1beta1.Rule{ APIGroups: []string{v1.GroupName}, - APIVersions: []string{v1.VirtualMachinePresetGroupVersionKind.Version}, - Resources: []string{"virtualmachinepresets"}, + APIVersions: []string{v1.VirtualMachineInstancePresetGroupVersionKind.Version}, + Resources: []string{"virtualmachineinstancepresets"}, }, }}, ClientConfig: admissionregistrationv1beta1.WebhookClientConfig{ Service: &admissionregistrationv1beta1.ServiceReference{ Namespace: namespace, Name: virtApiServiceName, - Path: &vmpresetPath, + Path: &vmipresetPath, }, CABundle: app.signingCertBytes, }, @@ -609,17 +634,17 @@ func (app *virtAPIApp) createWebhook() error { } } - http.HandleFunc(vmValidatePath, func(w http.ResponseWriter, r *http.Request) { - validating_webhook.ServeVMs(w, r) + http.HandleFunc(vmiiValidatePath, func(w http.ResponseWriter, r *http.Request) { + validating_webhook.ServeVMIs(w, r) }) - http.HandleFunc(ovmValidatePath, func(w http.ResponseWriter, r *http.Request) { - validating_webhook.ServeOVMs(w, r) + http.HandleFunc(vmiValidatePath, func(w http.ResponseWriter, r *http.Request) { + validating_webhook.ServeVMs(w, r) }) - http.HandleFunc(vmrsValidatePath, func(w http.ResponseWriter, r *http.Request) { - validating_webhook.ServeVMRS(w, r) + http.HandleFunc(vmirsValidatePath, func(w http.ResponseWriter, r *http.Request) { + validating_webhook.ServeVMIRS(w, r) }) - http.HandleFunc(vmpresetValidatePath, func(w http.ResponseWriter, r *http.Request) { - validating_webhook.ServeVMPreset(w, r) + http.HandleFunc(vmipresetValidatePath, func(w http.ResponseWriter, r *http.Request) { + validating_webhook.ServeVMIPreset(w, r) }) return nil diff --git a/vendor/kubevirt.io/kubevirt/pkg/virt-api/rest/authorizer.go b/vendor/kubevirt.io/kubevirt/pkg/virt-api/rest/authorizer.go index 21d9f8e89..6a0582210 100644 --- a/vendor/kubevirt.io/kubevirt/pkg/virt-api/rest/authorizer.go +++ b/vendor/kubevirt.io/kubevirt/pkg/virt-api/rest/authorizer.go @@ -84,7 +84,7 @@ func (a *authorizor) getUserName(header http.Header) (string, error) { func (a *authorizor) getUserExtras(header http.Header) map[string]authorization.ExtraValue { - var extras map[string]authorization.ExtraValue + extras := map[string]authorization.ExtraValue{} for _, prefix := range a.userExtraHeaderPrefixes { for k, v := range header { @@ -137,7 +137,7 @@ func (a *authorizor) generateAccessReview(req *restful.Request) (*authorization. } // URL example - // /apis/subresources.kubevirt.io/v1alpha1/namespaces/default/virtualmachines/testvm/console + // /apis/subresources.kubevirt.io/v1alpha2/namespaces/default/virtualmachineinstances/testvmi/console pathSplit := strings.Split(url.Path, "/") if len(pathSplit) != 9 { return nil, fmt.Errorf("unknown api endpoint %s", url.Path) @@ -151,7 +151,7 @@ func (a *authorizor) generateAccessReview(req *restful.Request) (*authorization. subresource := pathSplit[8] userExtras := a.getUserExtras(headers) - if resource != "virtualmachines" { + if resource != "virtualmachineinstances" { return nil, fmt.Errorf("unknown resource type %s", resource) } @@ -193,10 +193,10 @@ func isInfoEndpoint(req *restful.Request) bool { return false } // URL example - // /apis/subresources.kubevirt.io/v1alpha1/namespaces/default/virtualmachines/testvm/console + // /apis/subresources.kubevirt.io/v1alpha2/namespaces/default/virtualmachineinstances/testvmi/console // The /apis// part of the urls should be accessible without needing authorization pathSplit := strings.Split(httpRequest.URL.Path, "/") - if len(pathSplit) <= 4 { + if len(pathSplit) <= 4 || (len(pathSplit) > 4 && pathSplit[4] == "version") { return true } diff --git a/vendor/kubevirt.io/kubevirt/pkg/virt-api/rest/kubeproxy.go b/vendor/kubevirt.io/kubevirt/pkg/virt-api/rest/kubeproxy.go index 31e93b5e2..a3064b177 100644 --- a/vendor/kubevirt.io/kubevirt/pkg/virt-api/rest/kubeproxy.go +++ b/vendor/kubevirt.io/kubevirt/pkg/virt-api/rest/kubeproxy.go @@ -145,7 +145,7 @@ func GenericResourceProxy(ws *restful.WebService, ctx context.Context, gvr schem Returns(http.StatusUnauthorized, "Unauthorized", nil), ws, )) - ws.Route( + ws.Route(addPatchParams( ws.PATCH(ResourcePath(gvr)). Consumes(mime.MIME_JSON_PATCH, mime.MIME_MERGE_PATCH). Produces(mime.MIME_JSON). @@ -154,8 +154,8 @@ func GenericResourceProxy(ws *restful.WebService, ctx context.Context, gvr schem Writes(objExample).Reads(metav1.Patch{}). Doc("Patch a "+objKind+" object."). Returns(http.StatusOK, "OK", objExample). - Returns(http.StatusUnauthorized, "Unauthorized", nil), - ) + Returns(http.StatusUnauthorized, "Unauthorized", nil), ws, + )) // TODO, implement watch. For now it is here to provide swagger doc only ws.Route(addWatchGetListParams( diff --git a/vendor/kubevirt.io/kubevirt/pkg/virt-api/rest/subresource.go b/vendor/kubevirt.io/kubevirt/pkg/virt-api/rest/subresource.go index 5c3903875..0c3660138 100644 --- a/vendor/kubevirt.io/kubevirt/pkg/virt-api/rest/subresource.go +++ b/vendor/kubevirt.io/kubevirt/pkg/virt-api/rest/subresource.go @@ -49,10 +49,10 @@ type SubresourceAPIApp struct { func (app *SubresourceAPIApp) requestHandler(request *restful.Request, response *restful.Response, cmd []string) { - vmName := request.PathParameter("name") + vmiName := request.PathParameter("name") namespace := request.PathParameter("namespace") - podName, httpStatusCode, err := app.remoteExecInfo(vmName, namespace) + podName, httpStatusCode, err := app.remoteExecInfo(vmiName, namespace) if err != nil { log.Log.Reason(err).Error("Failed to gather remote exec info for subresource request.") response.WriteError(httpStatusCode, err) @@ -112,18 +112,18 @@ func (app *SubresourceAPIApp) requestHandler(request *restful.Request, response func (app *SubresourceAPIApp) VNCRequestHandler(request *restful.Request, response *restful.Response) { - vmName := request.PathParameter("name") + vmiName := request.PathParameter("name") namespace := request.PathParameter("namespace") - cmd := []string{"/sock-connector", fmt.Sprintf("/var/run/kubevirt-private/%s/%s/virt-%s", namespace, vmName, "vnc")} + cmd := []string{"/usr/share/kubevirt/virt-launcher/sock-connector", fmt.Sprintf("/var/run/kubevirt-private/%s/%s/virt-%s", namespace, vmiName, "vnc")} app.requestHandler(request, response, cmd) } func (app *SubresourceAPIApp) ConsoleRequestHandler(request *restful.Request, response *restful.Response) { - vmName := request.PathParameter("name") + vmiName := request.PathParameter("name") namespace := request.PathParameter("namespace") - cmd := []string{"/sock-connector", fmt.Sprintf("/var/run/kubevirt-private/%s/%s/virt-%s", namespace, vmName, "serial0")} + cmd := []string{"/usr/share/kubevirt/virt-launcher/sock-connector", fmt.Sprintf("/var/run/kubevirt-private/%s/%s/virt-%s", namespace, vmiName, "serial0")} app.requestHandler(request, response, cmd) } @@ -142,7 +142,7 @@ func (app *SubresourceAPIApp) findPod(namespace string, name string) (string, er } if len(podList.Items) == 0 { - return "", goerror.New("connection failed. No VM pod is running") + return "", goerror.New("connection failed. No VirtualMachineInstance pod is running") } return podList.Items[0].ObjectMeta.Name, nil } @@ -150,16 +150,16 @@ func (app *SubresourceAPIApp) findPod(namespace string, name string) (string, er func (app *SubresourceAPIApp) remoteExecInfo(name string, namespace string) (string, int, error) { podName := "" - vm, err := app.VirtCli.VM(namespace).Get(name, k8smetav1.GetOptions{}) + vmi, err := app.VirtCli.VirtualMachineInstance(namespace).Get(name, &k8smetav1.GetOptions{}) if err != nil { if errors.IsNotFound(err) { - return "", http.StatusNotFound, goerror.New(fmt.Sprintf("VM %s in namespace %s not found.", name, namespace)) + return "", http.StatusNotFound, goerror.New(fmt.Sprintf("VirtualMachineInstance %s in namespace %s not found.", name, namespace)) } return podName, http.StatusInternalServerError, err } - if vm.IsRunning() == false { - return podName, http.StatusBadRequest, goerror.New(fmt.Sprintf("Unable to connect to VM because phase is %s instead of %s", vm.Status.Phase, v1.Running)) + if vmi.IsRunning() == false { + return podName, http.StatusBadRequest, goerror.New(fmt.Sprintf("Unable to connect to VirtualMachineInstance because phase is %s instead of %s", vmi.Status.Phase, v1.Running)) } podName, err = app.findPod(namespace, name) diff --git a/vendor/kubevirt.io/kubevirt/pkg/virt-api/validating-webhook/validating-webhook.go b/vendor/kubevirt.io/kubevirt/pkg/virt-api/validating-webhook/validating-webhook.go index b6df14db1..2ddee9a0c 100644 --- a/vendor/kubevirt.io/kubevirt/pkg/virt-api/validating-webhook/validating-webhook.go +++ b/vendor/kubevirt.io/kubevirt/pkg/virt-api/validating-webhook/validating-webhook.go @@ -24,12 +24,20 @@ import ( "encoding/json" "fmt" "io/ioutil" + "net" "net/http" + "regexp" + "strings" + + "k8s.io/apimachinery/pkg/api/resource" v1beta1 "k8s.io/api/admission/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" - utilerrors "k8s.io/apimachinery/pkg/util/errors" + "k8s.io/apimachinery/pkg/util/validation" + k8sfield "k8s.io/apimachinery/pkg/util/validation/field" + + "k8s.io/apimachinery/pkg/labels" "kubevirt.io/kubevirt/pkg/api/v1" "kubevirt.io/kubevirt/pkg/log" @@ -38,8 +46,11 @@ import ( const ( cloudInitMaxLen = 2048 arrayLenMax = 256 + maxStrLen = 256 ) +var validInterfaceModels = []string{"e1000", "e1000e", "ne2k_pci", "pcnet", "rtl8139", "virtio"} + func getAdmissionReview(r *http.Request) (*v1beta1.AdmissionReview, error) { var body []byte if r.Body != nil { @@ -59,12 +70,31 @@ func getAdmissionReview(r *http.Request) (*v1beta1.AdmissionReview, error) { return ar, err } -func toAdmissionResponse(err error) *v1beta1.AdmissionResponse { - log.Log.Reason(err).Error("admitting vms") +func toAdmissionResponseError(err error) *v1beta1.AdmissionResponse { + log.Log.Reason(err).Error("admitting vmis with generic error") + return &v1beta1.AdmissionResponse{ Result: &metav1.Status{ Message: err.Error(), + Code: http.StatusBadRequest, + }, + } +} +func toAdmissionResponse(causes []metav1.StatusCause) *v1beta1.AdmissionResponse { + log.Log.Infof("rejected vmi admission") + + globalMessage := "" + for _, cause := range causes { + globalMessage = fmt.Sprintf("%s %s", globalMessage, cause.Message) + } + + return &v1beta1.AdmissionResponse{ + Result: &metav1.Status{ + Message: globalMessage, Code: http.StatusUnprocessableEntity, + Details: &metav1.StatusDetails{ + Causes: causes, + }, }, } } @@ -103,14 +133,18 @@ func serve(resp http.ResponseWriter, req *http.Request, admit admitFunc) { resp.WriteHeader(http.StatusOK) } -func validateDisks(disks []v1.Disk) []error { - errors := []error{} +func validateDisks(field *k8sfield.Path, disks []v1.Disk) []metav1.StatusCause { + var causes []metav1.StatusCause nameMap := make(map[string]int) if len(disks) > arrayLenMax { - errors = append(errors, fmt.Errorf("spec.domain.devices.disks list exceeds the %d element limit in length", arrayLenMax)) + causes = append(causes, metav1.StatusCause{ + Type: metav1.CauseTypeFieldValueInvalid, + Message: fmt.Sprintf("%s list exceeds the %d element limit in length", field.String(), arrayLenMax), + Field: field.String(), + }) // We won't process anything over the limit - return errors + return causes } for idx, disk := range disks { @@ -119,7 +153,11 @@ func validateDisks(disks []v1.Disk) []error { if !ok { nameMap[disk.Name] = idx } else { - errors = append(errors, fmt.Errorf("spec.domain.devices.disks[%d] and spec.domain.devices.disks[%d] must not have the same Name.", idx, otherIdx)) + causes = append(causes, metav1.StatusCause{ + Type: metav1.CauseTypeFieldValueInvalid, + Message: fmt.Sprintf("%s and %s must not have the same Name.", field.Index(idx).String(), field.Index(otherIdx).String()), + Field: field.Index(idx).Child("name").String(), + }) } // Verify only a single device type is set. deviceTargetSetCount := 0 @@ -139,22 +177,57 @@ func validateDisks(disks []v1.Disk) []error { // NOTE: not setting a device target is okay. We default to Disk. // However, only a single device target is allowed to be set at a time. if deviceTargetSetCount > 1 { - errors = append(errors, fmt.Errorf("spec.domain.devices.disks[%d] can only have a single target type defined", idx)) + causes = append(causes, metav1.StatusCause{ + Type: metav1.CauseTypeFieldValueInvalid, + Message: fmt.Sprintf("%s can only have a single target type defined", field.Index(idx).String()), + Field: field.Index(idx).String(), + }) + } + + // Verify boot order is greater than 0, if provided + if disk.BootOrder != nil && *disk.BootOrder < 1 { + causes = append(causes, metav1.StatusCause{ + Type: metav1.CauseTypeFieldValueInvalid, + Message: fmt.Sprintf("%s must have a boot order > 0, if supplied", field.Index(idx).String()), + Field: field.Index(idx).Child("bootorder").String(), + }) + } + + // Verify serial number is made up of valid characters for libvirt, if provided + isValid := regexp.MustCompile(`^[A-Za-z0-9_.+-]+$`).MatchString + if disk.Serial != "" && !isValid(disk.Serial) { + causes = append(causes, metav1.StatusCause{ + Type: metav1.CauseTypeFieldValueInvalid, + Message: fmt.Sprintf("%s must be made up of the following characters [A-Za-z0-9_.+-], if specified", field.Index(idx).String()), + Field: field.Index(idx).Child("serial").String(), + }) } + // Verify serial number is within valid length, if provided + if disk.Serial != "" && len([]rune(disk.Serial)) > maxStrLen { + causes = append(causes, metav1.StatusCause{ + Type: metav1.CauseTypeFieldValueInvalid, + Message: fmt.Sprintf("%s must be less than or equal to %d in length, if specified", field.Index(idx).String(), maxStrLen), + Field: field.Index(idx).Child("serial").String(), + }) + } } - return errors + return causes } -func validateVolumes(volumes []v1.Volume) []error { - errors := []error{} +func validateVolumes(field *k8sfield.Path, volumes []v1.Volume) []metav1.StatusCause { + var causes []metav1.StatusCause nameMap := make(map[string]int) if len(volumes) > arrayLenMax { - errors = append(errors, fmt.Errorf("spec.volumes list exceeds the %d element limit in length", arrayLenMax)) + causes = append(causes, metav1.StatusCause{ + Type: metav1.CauseTypeFieldValueInvalid, + Message: fmt.Sprintf("%s list exceeds the %d element limit in length", field.String(), arrayLenMax), + Field: field.String(), + }) // We won't process anything over the limit - return errors + return causes } for idx, volume := range volumes { // verify name is unique @@ -162,7 +235,11 @@ func validateVolumes(volumes []v1.Volume) []error { if !ok { nameMap[volume.Name] = idx } else { - errors = append(errors, fmt.Errorf("spec.volumes[%d] and spec.volumes[%d] must not have the same Name.", idx, otherIdx)) + causes = append(causes, metav1.StatusCause{ + Type: metav1.CauseTypeFieldValueInvalid, + Message: fmt.Sprintf("%s and %s must not have the same Name.", field.Index(idx).String(), field.Index(otherIdx).String()), + Field: field.Index(idx).Child("name").String(), + }) } // Verify exactly one source is set @@ -184,7 +261,11 @@ func validateVolumes(volumes []v1.Volume) []error { } if volumeSourceSetCount != 1 { - errors = append(errors, fmt.Errorf("spec.volumes[%d] must have exactly one source type set", idx)) + causes = append(causes, metav1.StatusCause{ + Type: metav1.CauseTypeFieldValueInvalid, + Message: fmt.Sprintf("%s must have exactly one source type set", field.Index(idx).String()), + Field: field.Index(idx).String(), + }) } // Verify cloud init data is within size limits @@ -200,7 +281,11 @@ func validateVolumes(volumes []v1.Volume) []error { userDataSourceCount++ userData, err := base64.StdEncoding.DecodeString(noCloud.UserDataBase64) if err != nil { - errors = append(errors, fmt.Errorf("spec.volumes[%d].cloudInitNoCloud.userDataBase64 is not a valid base64 value.", idx)) + causes = append(causes, metav1.StatusCause{ + Type: metav1.CauseTypeFieldValueInvalid, + Message: fmt.Sprintf("%s.cloudInitNoCloud.userDataBase64 is not a valid base64 value.", field.Index(idx).Child("cloudInitNoCloud", "userDataBase64").String()), + Field: field.Index(idx).Child("cloudInitNoCloud", "userDataBase64").String(), + }) } userDataLen = len(userData) } @@ -210,42 +295,187 @@ func validateVolumes(volumes []v1.Volume) []error { } if userDataSourceCount != 1 { - errors = append(errors, fmt.Errorf("spec.volumes[%d].cloudInitNoCloud must have one exactly one userdata source set.", idx)) + causes = append(causes, metav1.StatusCause{ + Type: metav1.CauseTypeFieldValueInvalid, + Message: fmt.Sprintf("%s must have one exactly one userdata source set.", field.Index(idx).Child("cloudInitNoCloud").String()), + Field: field.Index(idx).Child("cloudInitNoCloud").String(), + }) } if userDataLen > cloudInitMaxLen { - errors = append(errors, fmt.Errorf("spec.volumes[%d].cloudInitNoCloud userdata exceeds %d byte limit", idx, cloudInitMaxLen)) + causes = append(causes, metav1.StatusCause{ + Type: metav1.CauseTypeFieldValueInvalid, + Message: fmt.Sprintf("%s userdata exceeds %d byte limit", field.Index(idx).Child("cloudInitNoCloud").String(), cloudInitMaxLen), + Field: field.Index(idx).Child("cloudInitNoCloud").String(), + }) } } } - return errors + return causes } -func validateDevices(devices *v1.Devices) []error { - errors := []error{} - errors = append(errors, validateDisks(devices.Disks)...) - return errors +func validateDevices(field *k8sfield.Path, devices *v1.Devices) []metav1.StatusCause { + var causes []metav1.StatusCause + causes = append(causes, validateDisks(field.Child("disks"), devices.Disks)...) + return causes } -func validateDomainSpec(spec *v1.DomainSpec) []error { - errors := []error{} - errors = append(errors, validateDevices(&spec.Devices)...) - return errors +func validateDomainPresetSpec(field *k8sfield.Path, spec *v1.DomainPresetSpec) []metav1.StatusCause { + var causes []metav1.StatusCause + causes = append(causes, validateDevices(field.Child("devices"), &spec.Devices)...) + return causes } -func validateVirtualMachineSpec(spec *v1.VirtualMachineSpec) []error { - errors := []error{} +func validateDomainSpec(field *k8sfield.Path, spec *v1.DomainSpec) []metav1.StatusCause { + var causes []metav1.StatusCause + causes = append(causes, validateDevices(field.Child("devices"), &spec.Devices)...) + return causes +} + +func getNumberOfPodInterfaces(spec *v1.VirtualMachineInstanceSpec) int { + nPodInterfaces := 0 + for _, net := range spec.Networks { + if net.Pod != nil { + for _, iface := range spec.Domain.Devices.Interfaces { + if iface.Name == net.Name { + nPodInterfaces++ + break // we maintain 1-to-1 relationship between networks and interfaces + } + } + } + } + return nPodInterfaces +} + +func ValidateVirtualMachineInstanceSpec(field *k8sfield.Path, spec *v1.VirtualMachineInstanceSpec) []metav1.StatusCause { + var causes []metav1.StatusCause volumeToDiskIndexMap := make(map[string]int) volumeNameMap := make(map[string]*v1.Volume) + networkNameMap := make(map[string]*v1.Network) if len(spec.Domain.Devices.Disks) > arrayLenMax { - errors = append(errors, fmt.Errorf("spec.domain.devices.disks list exceeds the %d element limit in length", arrayLenMax)) + causes = append(causes, metav1.StatusCause{ + Type: metav1.CauseTypeFieldValueInvalid, + Message: fmt.Sprintf("%s list exceeds the %d element limit in length", field.Child("domain", "devices", "disks").String(), arrayLenMax), + Field: field.Child("domain", "devices", "disks").String(), + }) // We won't process anything over the limit - return errors + return causes } else if len(spec.Volumes) > arrayLenMax { - errors = append(errors, fmt.Errorf("spec.volumes list exceeds the %d element limit in length", arrayLenMax)) + causes = append(causes, metav1.StatusCause{ + Type: metav1.CauseTypeFieldValueInvalid, + Message: fmt.Sprintf("%s list exceeds the %d element limit in length", field.Child("volumes").String(), arrayLenMax), + Field: field.Child("volumes").String(), + }) // We won't process anything over the limit - return errors + return causes + } + // Validate hostname according to DNS label rules + if spec.Hostname != "" { + errors := validation.IsDNS1123Label(spec.Hostname) + if len(errors) != 0 { + causes = append(causes, metav1.StatusCause{ + Type: metav1.CauseTypeFieldValueInvalid, + Message: fmt.Sprintf("%s does not conform to the kubernetes DNS_LABEL rules : %s", + field.Child("hostname").String(), strings.Join(errors, ", ")), + Field: field.Child("hostname").String(), + }) + } + } + + // Validate memory size if values are not negative + if spec.Domain.Resources.Requests.Memory().Value() < 0 { + causes = append(causes, metav1.StatusCause{ + Type: metav1.CauseTypeFieldValueInvalid, + Message: fmt.Sprintf("%s '%s': must be greater than or equal to 0.", field.Child("domain", "resources", "requests", "memory").String(), + spec.Domain.Resources.Requests.Memory()), + Field: field.Child("domain", "resources", "requests", "memory").String(), + }) + } + + if spec.Domain.Resources.Limits.Memory().Value() < 0 { + causes = append(causes, metav1.StatusCause{ + Type: metav1.CauseTypeFieldValueInvalid, + Message: fmt.Sprintf("%s '%s': must be greater than or equal to 0.", field.Child("domain", "resources", "limits", "memory").String(), + spec.Domain.Resources.Limits.Memory()), + Field: field.Child("domain", "resources", "limits", "memory").String(), + }) + } + + if spec.Domain.Resources.Limits.Memory().Value() > 0 && + spec.Domain.Resources.Requests.Memory().Value() > spec.Domain.Resources.Limits.Memory().Value() { + causes = append(causes, metav1.StatusCause{ + Type: metav1.CauseTypeFieldValueInvalid, + Message: fmt.Sprintf("%s '%s' is greater than %s '%s'", field.Child("domain", "resources", "requests", "memory").String(), + spec.Domain.Resources.Requests.Memory(), + field.Child("domain", "resources", "limits", "memory").String(), + spec.Domain.Resources.Limits.Memory()), + Field: field.Child("domain", "resources", "requests", "memory").String(), + }) + } + + // Validate hugepages + if spec.Domain.Memory != nil && spec.Domain.Memory.Hugepages != nil { + hugepagesSize, err := resource.ParseQuantity(spec.Domain.Memory.Hugepages.PageSize) + if err != nil { + causes = append(causes, metav1.StatusCause{ + Type: metav1.CauseTypeFieldValueInvalid, + Message: fmt.Sprintf("%s '%s': %s", + field.Child("domain", "hugepages", "size").String(), + spec.Domain.Memory.Hugepages.PageSize, + resource.ErrFormatWrong, + ), + Field: field.Child("domain", "hugepages", "size").String(), + }) + } else { + vmMemory := spec.Domain.Resources.Requests.Memory().Value() + if vmMemory < hugepagesSize.Value() { + causes = append(causes, metav1.StatusCause{ + Type: metav1.CauseTypeFieldValueInvalid, + Message: fmt.Sprintf("%s '%s' must be equal to or larger than page size %s '%s'", + field.Child("domain", "resources", "requests", "memory").String(), + spec.Domain.Resources.Requests.Memory(), + field.Child("domain", "hugepages", "size").String(), + spec.Domain.Memory.Hugepages.PageSize, + ), + Field: field.Child("domain", "resources", "requests", "memory").String(), + }) + } else if vmMemory%hugepagesSize.Value() != 0 { + causes = append(causes, metav1.StatusCause{ + Type: metav1.CauseTypeFieldValueInvalid, + Message: fmt.Sprintf("%s '%s' is not a multiple of the page size %s '%s'", + field.Child("domain", "resources", "requests", "memory").String(), + spec.Domain.Resources.Requests.Memory(), + field.Child("domain", "hugepages", "size").String(), + spec.Domain.Memory.Hugepages.PageSize, + ), + Field: field.Child("domain", "resources", "requests", "memory").String(), + }) + } + } + } + + if len(spec.Domain.Devices.Interfaces) > arrayLenMax { + causes = append(causes, metav1.StatusCause{ + Type: metav1.CauseTypeFieldValueInvalid, + Message: fmt.Sprintf("%s list exceeds the %d element limit in length", field.Child("domain", "devices", "interfaces").String(), arrayLenMax), + Field: field.Child("domain", "devices", "interfaces").String(), + }) + return causes + } else if len(spec.Networks) > arrayLenMax { + causes = append(causes, metav1.StatusCause{ + Type: metav1.CauseTypeFieldValueInvalid, + Message: fmt.Sprintf("%s list exceeds the %d element limit in length", field.Child("networks").String(), arrayLenMax), + Field: field.Child("networks").String(), + }) + return causes + } else if getNumberOfPodInterfaces(spec) > 1 { + causes = append(causes, metav1.StatusCause{ + Type: metav1.CauseTypeFieldValueDuplicate, + Message: fmt.Sprintf("multiple pod interfaces in %s", field.Child("interfaces").String()), + Field: field.Child("interfaces").String(), + }) + return causes } for _, volume := range spec.Volumes { @@ -259,7 +489,11 @@ func validateVirtualMachineSpec(spec *v1.VirtualMachineSpec) []error { matchingVolume, volumeExists := volumeNameMap[disk.VolumeName] if !volumeExists { - errors = append(errors, fmt.Errorf("spec.domain.devices.disks[%d].volumeName '%s' not found.", idx, disk.VolumeName)) + causes = append(causes, metav1.StatusCause{ + Type: metav1.CauseTypeFieldValueInvalid, + Message: fmt.Sprintf("%s '%s' not found.", field.Child("domain", "devices", "disks").Index(idx).Child("volumeName").String(), disk.VolumeName), + Field: field.Child("domain", "devices", "disks").Index(idx).Child("volumeName").String(), + }) } // verify no other disk maps to this volume @@ -267,77 +501,236 @@ func validateVirtualMachineSpec(spec *v1.VirtualMachineSpec) []error { if !ok { volumeToDiskIndexMap[disk.VolumeName] = idx } else { - errors = append(errors, fmt.Errorf("spec.domain.devices.disks[%d] and spec.domain.devices.disks[%d] reference the same volumeName.", idx, otherIdx)) + causes = append(causes, metav1.StatusCause{ + Type: metav1.CauseTypeFieldValueInvalid, + Message: fmt.Sprintf("%s and %s reference the same volumeName.", field.Child("domain", "devices", "disks").Index(idx).String(), field.Child("domain", "devices", "disks").Index(otherIdx).String()), + Field: field.Child("domain", "devices", "disks").Index(idx).Child("volumeName").String(), + }) } // Verify Lun disks are only mapped to network/block devices. if disk.LUN != nil && volumeExists && matchingVolume.PersistentVolumeClaim == nil { - errors = append(errors, fmt.Errorf("spec.domain.devices.disks[%d].lun can only be mapped to a PersistentVolumeClaim volume.", idx)) + causes = append(causes, metav1.StatusCause{ + Type: metav1.CauseTypeFieldValueInvalid, + Message: fmt.Sprintf("%s can only be mapped to a PersistentVolumeClaim volume.", field.Child("domain", "devices", "disks").Index(idx).Child("lun").String()), + Field: field.Child("domain", "devices", "disks").Index(idx).Child("lun").String(), + }) } } - errors = append(errors, validateDomainSpec(&spec.Domain)...) - errors = append(errors, validateVolumes(spec.Volumes)...) - return errors + if len(spec.Networks) > 0 && len(spec.Domain.Devices.Interfaces) > 0 { + for idx, network := range spec.Networks { + if network.Pod == nil { + causes = append(causes, metav1.StatusCause{ + Type: metav1.CauseTypeFieldValueRequired, + Message: fmt.Sprintf("should only accept networks with a pod network source"), + Field: field.Child("networks").Index(idx).Child("pod").String(), + }) + } + networkNameMap[network.Name] = &network + } + + // Make sure the port name is unique across all the interfaces + portForwardMap := make(map[string]struct{}) + + // Validate that each interface has a matching network + for idx, iface := range spec.Domain.Devices.Interfaces { + + networkData, networkExists := networkNameMap[iface.Name] + + if !networkExists { + causes = append(causes, metav1.StatusCause{ + Type: metav1.CauseTypeFieldValueInvalid, + Message: fmt.Sprintf("%s '%s' not found.", field.Child("domain", "devices", "interfaces").Index(idx).Child("name").String(), iface.Name), + Field: field.Child("domain", "devices", "interfaces").Index(idx).Child("name").String(), + }) + } else if iface.Bridge != nil && networkData.Pod == nil { + causes = append(causes, metav1.StatusCause{ + Type: metav1.CauseTypeFieldValueInvalid, + Message: fmt.Sprintf("Bridge interface only implemented with pod network"), + Field: field.Child("domain", "devices", "interfaces").Index(idx).Child("name").String(), + }) + } else if iface.Slirp != nil && networkData.Pod == nil { + causes = append(causes, metav1.StatusCause{ + Type: metav1.CauseTypeFieldValueInvalid, + Message: fmt.Sprintf("Slirp interface only implemented with pod network"), + Field: field.Child("domain", "devices", "interfaces").Index(idx).Child("name").String(), + }) + } + + // Check only ports configured on interfaces connected to a pod network + if networkExists && networkData.Pod != nil && iface.Ports != nil { + for portIdx, forwardPort := range iface.Ports { + + if forwardPort.Port == 0 { + causes = append(causes, metav1.StatusCause{ + Type: metav1.CauseTypeFieldValueRequired, + Message: fmt.Sprintf("Port field is mandatory in every Port"), + Field: field.Child("domain", "devices", "interfaces").Index(idx).Child("ports").Index(portIdx).String(), + }) + } + + if forwardPort.Port < 0 || forwardPort.Port > 65536 { + causes = append(causes, metav1.StatusCause{ + Type: metav1.CauseTypeFieldValueInvalid, + Message: fmt.Sprintf("Port field must be in range 0 < x < 65536."), + Field: field.Child("domain", "devices", "interfaces").Index(idx).Child("ports").Index(portIdx).String(), + }) + } + + if forwardPort.Protocol != "" { + if forwardPort.Protocol != "TCP" && forwardPort.Protocol != "UDP" { + causes = append(causes, metav1.StatusCause{ + Type: metav1.CauseTypeFieldValueInvalid, + Message: fmt.Sprintf("Unknown protocol, only TCP or UDP allowed"), + Field: field.Child("domain", "devices", "interfaces").Index(idx).Child("ports").Index(portIdx).Child("protocol").String(), + }) + } + } else { + forwardPort.Protocol = "TCP" + } + + if forwardPort.Name != "" { + if _, ok := portForwardMap[forwardPort.Name]; ok { + causes = append(causes, metav1.StatusCause{ + Type: metav1.CauseTypeFieldValueDuplicate, + Message: fmt.Sprintf("Duplicate name of the port: %s", forwardPort.Name), + Field: field.Child("domain", "devices", "interfaces").Index(idx).Child("ports").Index(portIdx).Child("name").String(), + }) + } + + portForwardMap[forwardPort.Name] = struct{}{} + } + } + } + + // verify that selected model is supported + if iface.Model != "" { + isModelSupported := func(model string) bool { + for _, m := range validInterfaceModels { + if m == model { + return true + } + } + return false + } + if !isModelSupported(iface.Model) { + causes = append(causes, metav1.StatusCause{ + Type: metav1.CauseTypeFieldValueNotSupported, + Message: fmt.Sprintf("interface %s uses model %s that is not supported.", field.Child("domain", "devices", "interfaces").Index(idx).Child("name").String(), iface.Model), + Field: field.Child("domain", "devices", "interfaces").Index(idx).Child("model").String(), + }) + } + } + + // verify that selected macAddress is valid + if iface.MacAddress != "" { + mac, err := net.ParseMAC(iface.MacAddress) + if err != nil { + causes = append(causes, metav1.StatusCause{ + Type: metav1.CauseTypeFieldValueInvalid, + Message: fmt.Sprintf("interface %s has malformed MAC address (%s).", field.Child("domain", "devices", "interfaces").Index(idx).Child("name").String(), iface.MacAddress), + Field: field.Child("domain", "devices", "interfaces").Index(idx).Child("macAddress").String(), + }) + } + if len(mac) > 6 { + causes = append(causes, metav1.StatusCause{ + Type: metav1.CauseTypeFieldValueInvalid, + Message: fmt.Sprintf("interface %s has MAC address (%s) that is too long.", field.Child("domain", "devices", "interfaces").Index(idx).Child("name").String(), iface.MacAddress), + Field: field.Child("domain", "devices", "interfaces").Index(idx).Child("macAddress").String(), + }) + } + } + } + } + + causes = append(causes, validateDomainSpec(field.Child("domain"), &spec.Domain)...) + causes = append(causes, validateVolumes(field.Child("volumes"), spec.Volumes)...) + return causes } -func validateOfflineVirtualMachineSpec(spec *v1.OfflineVirtualMachineSpec) []error { - errors := []error{} +func ValidateVirtualMachineSpec(field *k8sfield.Path, spec *v1.VirtualMachineSpec) []metav1.StatusCause { + var causes []metav1.StatusCause if spec.Template == nil { - return append(errors, fmt.Errorf("missing virtual machine template.")) + return append(causes, metav1.StatusCause{ + Type: metav1.CauseTypeFieldValueRequired, + Message: fmt.Sprintf("missing virtual machine template."), + Field: field.Child("template").String(), + }) } - errors = append(errors, validateVirtualMachineSpec(&spec.Template.Spec)...) - return errors + causes = append(causes, ValidateVirtualMachineInstanceSpec(field.Child("template", "spec"), &spec.Template.Spec)...) + return causes } -func validateVMPresetSpec(spec *v1.VirtualMachinePresetSpec) []error { - errors := []error{} +func ValidateVMIPresetSpec(field *k8sfield.Path, spec *v1.VirtualMachineInstancePresetSpec) []metav1.StatusCause { + var causes []metav1.StatusCause if spec.Domain == nil { - return append(errors, fmt.Errorf("missing domain.")) + return append(causes, metav1.StatusCause{ + Type: metav1.CauseTypeFieldValueRequired, + Message: fmt.Sprintf("missing domain."), + Field: field.Child("domain").String(), + }) } - errors = append(errors, validateDomainSpec(spec.Domain)...) - return errors + causes = append(causes, validateDomainPresetSpec(field.Child("domain"), spec.Domain)...) + return causes } -func validateVMRSSpec(spec *v1.VMReplicaSetSpec) []error { - errors := []error{} + +func ValidateVMIRSSpec(field *k8sfield.Path, spec *v1.VirtualMachineInstanceReplicaSetSpec) []metav1.StatusCause { + var causes []metav1.StatusCause if spec.Template == nil { - return append(errors, fmt.Errorf("missing virtual machine template.")) + return append(causes, metav1.StatusCause{ + Type: metav1.CauseTypeFieldValueRequired, + Message: fmt.Sprintf("missing virtual machine template."), + Field: field.Child("template").String(), + }) } + causes = append(causes, ValidateVirtualMachineInstanceSpec(field.Child("template", "spec"), &spec.Template.Spec)...) - errors = append(errors, validateVirtualMachineSpec(&spec.Template.Spec)...) - return errors -} + selector, err := metav1.LabelSelectorAsSelector(spec.Selector) + if err != nil { + causes = append(causes, metav1.StatusCause{ + Type: metav1.CauseTypeFieldValueInvalid, + Message: err.Error(), + Field: field.Child("selector").String(), + }) + } else if !selector.Matches(labels.Set(spec.Template.ObjectMeta.Labels)) { + causes = append(causes, metav1.StatusCause{ + Type: metav1.CauseTypeFieldValueInvalid, + Message: fmt.Sprintf("selector does not match labels."), + Field: field.Child("selector").String(), + }) + } -func admitVMs(ar *v1beta1.AdmissionReview) *v1beta1.AdmissionResponse { - errors := []error{} + return causes +} - vmResource := metav1.GroupVersionResource{ - Group: v1.VirtualMachineGroupVersionKind.Group, - Version: v1.VirtualMachineGroupVersionKind.Version, - Resource: "virtualmachines", +func admitVMIs(ar *v1beta1.AdmissionReview) *v1beta1.AdmissionResponse { + vmiResource := metav1.GroupVersionResource{ + Group: v1.VirtualMachineInstanceGroupVersionKind.Group, + Version: v1.VirtualMachineInstanceGroupVersionKind.Version, + Resource: "virtualmachineinstances", } - if ar.Request.Resource != vmResource { - err := fmt.Errorf("expect resource to be '%s'", vmResource.Resource) - return toAdmissionResponse(err) + if ar.Request.Resource != vmiResource { + err := fmt.Errorf("expect resource to be '%s'", vmiResource.Resource) + return toAdmissionResponseError(err) } raw := ar.Request.Object.Raw - vm := v1.VirtualMachine{} + vmi := v1.VirtualMachineInstance{} - err := json.Unmarshal(raw, &vm) + err := json.Unmarshal(raw, &vmi) if err != nil { - return toAdmissionResponse(err) + return toAdmissionResponseError(err) } - errors = append(errors, validateVirtualMachineSpec(&vm.Spec)...) - if len(errors) > 0 { - err := utilerrors.NewAggregate(errors) - return toAdmissionResponse(err) + causes := ValidateVirtualMachineInstanceSpec(k8sfield.NewPath("spec"), &vmi.Spec) + if len(causes) > 0 { + return toAdmissionResponse(causes) } reviewResponse := v1beta1.AdmissionResponse{} @@ -345,35 +738,32 @@ func admitVMs(ar *v1beta1.AdmissionReview) *v1beta1.AdmissionResponse { return &reviewResponse } -func ServeVMs(resp http.ResponseWriter, req *http.Request) { - serve(resp, req, admitVMs) +func ServeVMIs(resp http.ResponseWriter, req *http.Request) { + serve(resp, req, admitVMIs) } -func admitOVMs(ar *v1beta1.AdmissionReview) *v1beta1.AdmissionResponse { - errors := []error{} - +func admitVMs(ar *v1beta1.AdmissionReview) *v1beta1.AdmissionResponse { resource := metav1.GroupVersionResource{ - Group: v1.OfflineVirtualMachineGroupVersionKind.Group, - Version: v1.OfflineVirtualMachineGroupVersionKind.Version, - Resource: "offlinevirtualmachines", + Group: v1.VirtualMachineGroupVersionKind.Group, + Version: v1.VirtualMachineGroupVersionKind.Version, + Resource: "virtualmachines", } if ar.Request.Resource != resource { err := fmt.Errorf("expect resource to be '%s'", resource.Resource) - return toAdmissionResponse(err) + return toAdmissionResponseError(err) } raw := ar.Request.Object.Raw - ovm := v1.OfflineVirtualMachine{} + vm := v1.VirtualMachine{} - err := json.Unmarshal(raw, &ovm) + err := json.Unmarshal(raw, &vm) if err != nil { - return toAdmissionResponse(err) + return toAdmissionResponseError(err) } - errors = append(errors, validateOfflineVirtualMachineSpec(&ovm.Spec)...) - if len(errors) > 0 { - err := utilerrors.NewAggregate(errors) - return toAdmissionResponse(err) + causes := ValidateVirtualMachineSpec(k8sfield.NewPath("spec"), &vm.Spec) + if len(causes) > 0 { + return toAdmissionResponse(causes) } reviewResponse := v1beta1.AdmissionResponse{} @@ -381,35 +771,32 @@ func admitOVMs(ar *v1beta1.AdmissionReview) *v1beta1.AdmissionResponse { return &reviewResponse } -func ServeOVMs(resp http.ResponseWriter, req *http.Request) { - serve(resp, req, admitOVMs) +func ServeVMs(resp http.ResponseWriter, req *http.Request) { + serve(resp, req, admitVMs) } -func admitVMRS(ar *v1beta1.AdmissionReview) *v1beta1.AdmissionResponse { - errors := []error{} - +func admitVMIRS(ar *v1beta1.AdmissionReview) *v1beta1.AdmissionResponse { resource := metav1.GroupVersionResource{ - Group: v1.VMReplicaSetGroupVersionKind.Group, - Version: v1.VMReplicaSetGroupVersionKind.Version, - Resource: "virtualmachinereplicasets", + Group: v1.VirtualMachineInstanceReplicaSetGroupVersionKind.Group, + Version: v1.VirtualMachineInstanceReplicaSetGroupVersionKind.Version, + Resource: "virtualmachineinstancereplicasets", } if ar.Request.Resource != resource { err := fmt.Errorf("expect resource to be '%s'", resource.Resource) - return toAdmissionResponse(err) + return toAdmissionResponseError(err) } raw := ar.Request.Object.Raw - vmrs := v1.VirtualMachineReplicaSet{} + vmirs := v1.VirtualMachineInstanceReplicaSet{} - err := json.Unmarshal(raw, &vmrs) + err := json.Unmarshal(raw, &vmirs) if err != nil { - return toAdmissionResponse(err) + return toAdmissionResponseError(err) } - errors = append(errors, validateVMRSSpec(&vmrs.Spec)...) - if len(errors) > 0 { - err := utilerrors.NewAggregate(errors) - return toAdmissionResponse(err) + causes := ValidateVMIRSSpec(k8sfield.NewPath("spec"), &vmirs.Spec) + if len(causes) > 0 { + return toAdmissionResponse(causes) } reviewResponse := v1beta1.AdmissionResponse{} @@ -417,34 +804,31 @@ func admitVMRS(ar *v1beta1.AdmissionReview) *v1beta1.AdmissionResponse { return &reviewResponse } -func ServeVMRS(resp http.ResponseWriter, req *http.Request) { - serve(resp, req, admitVMRS) +func ServeVMIRS(resp http.ResponseWriter, req *http.Request) { + serve(resp, req, admitVMIRS) } -func admitVMPreset(ar *v1beta1.AdmissionReview) *v1beta1.AdmissionResponse { - errors := []error{} - +func admitVMIPreset(ar *v1beta1.AdmissionReview) *v1beta1.AdmissionResponse { resource := metav1.GroupVersionResource{ - Group: v1.VMReplicaSetGroupVersionKind.Group, - Version: v1.VMReplicaSetGroupVersionKind.Version, - Resource: "virtualmachinepresets", + Group: v1.VirtualMachineInstanceReplicaSetGroupVersionKind.Group, + Version: v1.VirtualMachineInstanceReplicaSetGroupVersionKind.Version, + Resource: "virtualmachineinstancepresets", } if ar.Request.Resource != resource { err := fmt.Errorf("expect resource to be '%s'", resource.Resource) - return toAdmissionResponse(err) + return toAdmissionResponseError(err) } raw := ar.Request.Object.Raw - vmpreset := v1.VirtualMachinePreset{} + vmipreset := v1.VirtualMachineInstancePreset{} - err := json.Unmarshal(raw, &vmpreset) + err := json.Unmarshal(raw, &vmipreset) if err != nil { - return toAdmissionResponse(err) + return toAdmissionResponseError(err) } - errors = append(errors, validateVMPresetSpec(&vmpreset.Spec)...) - if len(errors) > 0 { - err := utilerrors.NewAggregate(errors) - return toAdmissionResponse(err) + causes := ValidateVMIPresetSpec(k8sfield.NewPath("spec"), &vmipreset.Spec) + if len(causes) > 0 { + return toAdmissionResponse(causes) } reviewResponse := v1beta1.AdmissionResponse{} @@ -452,6 +836,6 @@ func admitVMPreset(ar *v1beta1.AdmissionReview) *v1beta1.AdmissionResponse { return &reviewResponse } -func ServeVMPreset(resp http.ResponseWriter, req *http.Request) { - serve(resp, req, admitVMPreset) +func ServeVMIPreset(resp http.ResponseWriter, req *http.Request) { + serve(resp, req, admitVMIPreset) } diff --git a/vendor/kubevirt.io/kubevirt/pkg/virt-controller/services/template.go b/vendor/kubevirt.io/kubevirt/pkg/virt-controller/services/template.go index 8fb7e4da8..e72bc21c3 100644 --- a/vendor/kubevirt.io/kubevirt/pkg/virt-controller/services/template.go +++ b/vendor/kubevirt.io/kubevirt/pkg/virt-controller/services/template.go @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * Copyright 2017 Red Hat, Inc. + * Copyright 2017, 2018 Red Hat, Inc. * */ @@ -22,30 +22,56 @@ package services import ( "path/filepath" "strconv" + "strings" - kubev1 "k8s.io/api/core/v1" + k8sv1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/cache" "kubevirt.io/kubevirt/pkg/api/v1" "kubevirt.io/kubevirt/pkg/precond" "kubevirt.io/kubevirt/pkg/registry-disk" + "kubevirt.io/kubevirt/pkg/util/net/dns" ) +const configMapName = "kube-system/kubevirt-config" +const useEmulationKey = "debug.useEmulation" +const KvmDevice = "devices.kubevirt.io/kvm" +const TunDevice = "devices.kubevirt.io/tun" + type TemplateService interface { - RenderLaunchManifest(*v1.VirtualMachine) *kubev1.Pod + RenderLaunchManifest(*v1.VirtualMachineInstance) (*k8sv1.Pod, error) } type templateService struct { launcherImage string virtShareDir string imagePullSecret string + store cache.Store +} + +func IsEmulationAllowed(store cache.Store) (bool, error) { + obj, exists, err := store.GetByKey(configMapName) + if err != nil { + return false, err + } + if !exists { + return exists, nil + } + useEmulation := false + cm := obj.(*k8sv1.ConfigMap) + emu, ok := cm.Data[useEmulationKey] + if ok { + useEmulation = (strings.ToLower(emu) == "true") + } + return useEmulation, nil } -func (t *templateService) RenderLaunchManifest(vm *v1.VirtualMachine) *kubev1.Pod { - precond.MustNotBeNil(vm) - domain := precond.MustNotBeEmpty(vm.GetObjectMeta().GetName()) - namespace := precond.MustNotBeEmpty(vm.GetObjectMeta().GetNamespace()) +func (t *templateService) RenderLaunchManifest(vmi *v1.VirtualMachineInstance) (*k8sv1.Pod, error) { + precond.MustNotBeNil(vmi) + domain := precond.MustNotBeEmpty(vmi.GetObjectMeta().GetName()) + namespace := precond.MustNotBeEmpty(vmi.GetObjectMeta().GetNamespace()) initialDelaySeconds := 2 timeoutSeconds := 5 @@ -53,113 +79,185 @@ func (t *templateService) RenderLaunchManifest(vm *v1.VirtualMachine) *kubev1.Po successThreshold := 1 failureThreshold := 5 - var volumes []kubev1.Volume + var volumes []k8sv1.Volume var userId int64 = 0 - var privileged = true - var volumesMounts []kubev1.VolumeMount - var imagePullSecrets []kubev1.LocalObjectReference + var privileged bool = false + var volumesMounts []k8sv1.VolumeMount + var imagePullSecrets []k8sv1.LocalObjectReference gracePeriodSeconds := v1.DefaultGracePeriodSeconds - if vm.Spec.TerminationGracePeriodSeconds != nil { - gracePeriodSeconds = *vm.Spec.TerminationGracePeriodSeconds + if vmi.Spec.TerminationGracePeriodSeconds != nil { + gracePeriodSeconds = *vmi.Spec.TerminationGracePeriodSeconds } - volumesMounts = append(volumesMounts, kubev1.VolumeMount{ + volumesMounts = append(volumesMounts, k8sv1.VolumeMount{ Name: "virt-share-dir", MountPath: t.virtShareDir, }) - volumesMounts = append(volumesMounts, kubev1.VolumeMount{ + volumesMounts = append(volumesMounts, k8sv1.VolumeMount{ Name: "libvirt-runtime", MountPath: "/var/run/libvirt", }) - for _, volume := range vm.Spec.Volumes { - volumeMount := kubev1.VolumeMount{ + for _, volume := range vmi.Spec.Volumes { + volumeMount := k8sv1.VolumeMount{ Name: volume.Name, - MountPath: filepath.Join("/var/run/kubevirt-private", "vm-disks", volume.Name), + MountPath: filepath.Join("/var/run/kubevirt-private", "vmi-disks", volume.Name), } if volume.PersistentVolumeClaim != nil { volumesMounts = append(volumesMounts, volumeMount) - volumes = append(volumes, kubev1.Volume{ + volumes = append(volumes, k8sv1.Volume{ Name: volume.Name, - VolumeSource: kubev1.VolumeSource{ + VolumeSource: k8sv1.VolumeSource{ PersistentVolumeClaim: volume.PersistentVolumeClaim, }, }) } if volume.Ephemeral != nil { volumesMounts = append(volumesMounts, volumeMount) - volumes = append(volumes, kubev1.Volume{ + volumes = append(volumes, k8sv1.Volume{ Name: volume.Name, - VolumeSource: kubev1.VolumeSource{ + VolumeSource: k8sv1.VolumeSource{ PersistentVolumeClaim: volume.Ephemeral.PersistentVolumeClaim, }, }) } if volume.RegistryDisk != nil && volume.RegistryDisk.ImagePullSecret != "" { - imagePullSecrets = appendUniqueImagePullSecret(imagePullSecrets, kubev1.LocalObjectReference{ + imagePullSecrets = appendUniqueImagePullSecret(imagePullSecrets, k8sv1.LocalObjectReference{ Name: volume.RegistryDisk.ImagePullSecret, }) } } if t.imagePullSecret != "" { - imagePullSecrets = appendUniqueImagePullSecret(imagePullSecrets, kubev1.LocalObjectReference{ + imagePullSecrets = appendUniqueImagePullSecret(imagePullSecrets, k8sv1.LocalObjectReference{ Name: t.imagePullSecret, }) } // Pad the virt-launcher grace period. // Ideally we want virt-handler to handle tearing down - // the vm without virt-launcher's termination forcing - // the vm down. + // the vmi without virt-launcher's termination forcing + // the vmi down. gracePeriodSeconds = gracePeriodSeconds + int64(15) gracePeriodKillAfter := gracePeriodSeconds + int64(15) + // Get memory overhead + memoryOverhead := getMemoryOverhead(vmi.Spec.Domain) + // Consider CPU and memory requests and limits for pod scheduling - resources := kubev1.ResourceRequirements{} - vmResources := vm.Spec.Domain.Resources + resources := k8sv1.ResourceRequirements{} + vmiResources := vmi.Spec.Domain.Resources - resources.Requests = make(kubev1.ResourceList) + resources.Requests = make(k8sv1.ResourceList) - // Copy vm resources requests to a container - for key, value := range vmResources.Requests { + // Copy vmi resources requests to a container + for key, value := range vmiResources.Requests { resources.Requests[key] = value } - // Copy vm resources limits to a container - if vmResources.Limits != nil { - resources.Limits = make(kubev1.ResourceList) + // Copy vmi resources limits to a container + if vmiResources.Limits != nil { + resources.Limits = make(k8sv1.ResourceList) } - for key, value := range vmResources.Limits { + + for key, value := range vmiResources.Limits { resources.Limits[key] = value } - // Add memory overhead - setMemoryOverhead(vm.Spec.Domain, &resources) + // Consider hugepages resource for pod scheduling + if vmi.Spec.Domain.Memory != nil && vmi.Spec.Domain.Memory.Hugepages != nil { + if resources.Limits == nil { + resources.Limits = make(k8sv1.ResourceList) + } + + hugepageType := k8sv1.ResourceName(k8sv1.ResourceHugePagesPrefix + vmi.Spec.Domain.Memory.Hugepages.PageSize) + resources.Requests[hugepageType] = resources.Requests[k8sv1.ResourceMemory] + resources.Limits[hugepageType] = resources.Requests[k8sv1.ResourceMemory] + + // Configure hugepages mount on a pod + volumesMounts = append(volumesMounts, k8sv1.VolumeMount{ + Name: "hugepages", + MountPath: filepath.Join("/dev/hugepages"), + }) + volumes = append(volumes, k8sv1.Volume{ + Name: "hugepages", + VolumeSource: k8sv1.VolumeSource{ + EmptyDir: &k8sv1.EmptyDirVolumeSource{ + Medium: k8sv1.StorageMediumHugePages, + }, + }, + }) + + // Set requested memory equals to overhead memory + resources.Requests[k8sv1.ResourceMemory] = *memoryOverhead + if _, ok := resources.Limits[k8sv1.ResourceMemory]; ok { + resources.Limits[k8sv1.ResourceMemory] = *memoryOverhead + } + } else { + // Add overhead memory + memoryRequest := resources.Requests[k8sv1.ResourceMemory] + memoryRequest.Add(*memoryOverhead) + resources.Requests[k8sv1.ResourceMemory] = memoryRequest + + if memoryLimit, ok := resources.Limits[k8sv1.ResourceMemory]; ok { + memoryLimit.Add(*memoryOverhead) + resources.Limits[k8sv1.ResourceMemory] = memoryLimit + } + } + + command := []string{"/usr/share/kubevirt/virt-launcher/entrypoint.sh", + "--qemu-timeout", "5m", + "--name", domain, + "--namespace", namespace, + "--kubevirt-share-dir", t.virtShareDir, + "--readiness-file", "/tmp/healthy", + "--grace-period-seconds", strconv.Itoa(int(gracePeriodSeconds)), + } + + useEmulation, err := IsEmulationAllowed(t.store) + if err != nil { + return nil, err + } + + if resources.Limits == nil { + resources.Limits = make(k8sv1.ResourceList) + } + + // TODO: This can be hardcoded in the current model, but will need to be revisted + // once dynamic network device allocation is added + resources.Limits[TunDevice] = resource.MustParse("1") + + // FIXME: decision point: allow emulation means "it's ok to skip hw acceleration if not present" + // but if the KVM resource is not requested then it's guaranteed to be not present + // This code works for now, but the semantics are wrong. revisit this. + if useEmulation { + command = append(command, "--use-emulation") + } else { + resources.Limits[KvmDevice] = resource.MustParse("1") + } - // VM target container - container := kubev1.Container{ + // Add ports from interfaces to the pod manifest + ports := getPortsFromVMI(vmi) + + // VirtualMachineInstance target container + container := k8sv1.Container{ Name: "compute", Image: t.launcherImage, - ImagePullPolicy: kubev1.PullIfNotPresent, - // Privileged mode is required for /dev/kvm and the - // ability to create macvtap devices - SecurityContext: &kubev1.SecurityContext{ - RunAsUser: &userId, + ImagePullPolicy: k8sv1.PullIfNotPresent, + SecurityContext: &k8sv1.SecurityContext{ + RunAsUser: &userId, + // Privileged mode is disabled. Privileged: &privileged, + Capabilities: &k8sv1.Capabilities{ + // NET_ADMIN is needed to set up networking for the VM + Add: []k8sv1.Capability{"NET_ADMIN"}, + }, }, - Command: []string{"/entrypoint.sh", - "--qemu-timeout", "5m", - "--name", domain, - "--namespace", namespace, - "--kubevirt-share-dir", t.virtShareDir, - "--readiness-file", "/tmp/healthy", - "--grace-period-seconds", strconv.Itoa(int(gracePeriodSeconds)), - }, + Command: command, VolumeMounts: volumesMounts, - ReadinessProbe: &kubev1.Probe{ - Handler: kubev1.Handler{ - Exec: &kubev1.ExecAction{ + ReadinessProbe: &k8sv1.Probe{ + Handler: k8sv1.Handler{ + Exec: &k8sv1.ExecAction{ Command: []string{ "cat", "/tmp/healthy", @@ -173,27 +271,28 @@ func (t *templateService) RenderLaunchManifest(vm *v1.VirtualMachine) *kubev1.Po FailureThreshold: int32(failureThreshold), }, Resources: resources, + Ports: ports, } - containers := registrydisk.GenerateContainers(vm, "libvirt-runtime", "/var/run/libvirt") + containers := registrydisk.GenerateContainers(vmi, "libvirt-runtime", "/var/run/libvirt") - volumes = append(volumes, kubev1.Volume{ + volumes = append(volumes, k8sv1.Volume{ Name: "virt-share-dir", - VolumeSource: kubev1.VolumeSource{ - HostPath: &kubev1.HostPathVolumeSource{ + VolumeSource: k8sv1.VolumeSource{ + HostPath: &k8sv1.HostPathVolumeSource{ Path: t.virtShareDir, }, }, }) - volumes = append(volumes, kubev1.Volume{ + volumes = append(volumes, k8sv1.Volume{ Name: "libvirt-runtime", - VolumeSource: kubev1.VolumeSource{ - EmptyDir: &kubev1.EmptyDirVolumeSource{}, + VolumeSource: k8sv1.VolumeSource{ + EmptyDir: &k8sv1.EmptyDirVolumeSource{}, }, }) nodeSelector := map[string]string{} - for k, v := range vm.Spec.NodeSelector { + for k, v := range vmi.Spec.NodeSelector { nodeSelector[k] = v } @@ -201,7 +300,7 @@ func (t *templateService) RenderLaunchManifest(vm *v1.VirtualMachine) *kubev1.Po podLabels := map[string]string{} - for k, v := range vm.Labels { + for k, v := range vmi.Labels { podLabels[k] = v } podLabels[v1.AppLabel] = "virt-launcher" @@ -209,22 +308,29 @@ func (t *templateService) RenderLaunchManifest(vm *v1.VirtualMachine) *kubev1.Po containers = append(containers, container) + hostName := dns.SanitizeHostname(vmi) + // TODO use constants for podLabels - pod := kubev1.Pod{ + pod := k8sv1.Pod{ ObjectMeta: metav1.ObjectMeta{ GenerateName: "virt-launcher-" + domain + "-", Labels: podLabels, Annotations: map[string]string{ - v1.CreatedByAnnotation: string(vm.UID), + v1.CreatedByAnnotation: string(vmi.UID), v1.OwnedByAnnotation: "virt-controller", }, }, - Spec: kubev1.PodSpec{ - SecurityContext: &kubev1.PodSecurityContext{ + Spec: k8sv1.PodSpec{ + Hostname: hostName, + Subdomain: vmi.Spec.Subdomain, + SecurityContext: &k8sv1.PodSecurityContext{ RunAsUser: &userId, + SELinuxOptions: &k8sv1.SELinuxOptions{ + Type: "spc_t", + }, }, TerminationGracePeriodSeconds: &gracePeriodKillAfter, - RestartPolicy: kubev1.RestartPolicyNever, + RestartPolicy: k8sv1.RestartPolicyNever, Containers: containers, NodeSelector: nodeSelector, Volumes: volumes, @@ -232,18 +338,26 @@ func (t *templateService) RenderLaunchManifest(vm *v1.VirtualMachine) *kubev1.Po }, } - if vm.Spec.Affinity != nil { - pod.Spec.Affinity = &kubev1.Affinity{} + if vmi.Spec.Affinity != nil { + pod.Spec.Affinity = &k8sv1.Affinity{} - if vm.Spec.Affinity.NodeAffinity != nil { - pod.Spec.Affinity.NodeAffinity = vm.Spec.Affinity.NodeAffinity + if vmi.Spec.Affinity.NodeAffinity != nil { + pod.Spec.Affinity.NodeAffinity = vmi.Spec.Affinity.NodeAffinity + } + + if vmi.Spec.Affinity.PodAffinity != nil { + pod.Spec.Affinity.PodAffinity = vmi.Spec.Affinity.PodAffinity + } + + if vmi.Spec.Affinity.PodAntiAffinity != nil { + pod.Spec.Affinity.PodAntiAffinity = vmi.Spec.Affinity.PodAntiAffinity } } - return &pod + return &pod, nil } -func appendUniqueImagePullSecret(secrets []kubev1.LocalObjectReference, newsecret kubev1.LocalObjectReference) []kubev1.LocalObjectReference { +func appendUniqueImagePullSecret(secrets []k8sv1.LocalObjectReference, newsecret k8sv1.LocalObjectReference) []k8sv1.LocalObjectReference { for _, oldsecret := range secrets { if oldsecret == newsecret { return secrets @@ -252,22 +366,22 @@ func appendUniqueImagePullSecret(secrets []kubev1.LocalObjectReference, newsecre return append(secrets, newsecret) } -// setMemoryOverhead computes the estimation of total +// getMemoryOverhead computes the estimation of total // memory needed for the domain to operate properly. // This includes the memory needed for the guest and memory // for Qemu and OS overhead. // -// The return values are requested memory and limit memory quantities +// The return value is overhead memory quantity // // Note: This is the best estimation we were able to come up with // and is still not 100% accurate -func setMemoryOverhead(domain v1.DomainSpec, resources *kubev1.ResourceRequirements) error { - vmMemoryReq := domain.Resources.Requests.Memory() +func getMemoryOverhead(domain v1.DomainSpec) *resource.Quantity { + vmiMemoryReq := domain.Resources.Requests.Memory() overhead := resource.NewScaledQuantity(0, resource.Kilo) // Add the memory needed for pagetables (one bit for every 512b of RAM size) - pagetableMemory := resource.NewScaledQuantity(vmMemoryReq.ScaledValue(resource.Kilo), resource.Kilo) + pagetableMemory := resource.NewScaledQuantity(vmiMemoryReq.ScaledValue(resource.Kilo), resource.Kilo) pagetableMemory.Set(pagetableMemory.Value() / 512) overhead.Add(*pagetableMemory) @@ -289,26 +403,38 @@ func setMemoryOverhead(domain v1.DomainSpec, resources *kubev1.ResourceRequireme // Add video RAM overhead overhead.Add(resource.MustParse("16Mi")) - // Add overhead to memory request - memoryRequest := resources.Requests[kubev1.ResourceMemory] - memoryRequest.Add(*overhead) - resources.Requests[kubev1.ResourceMemory] = memoryRequest + return overhead +} + +func getPortsFromVMI(vmi *v1.VirtualMachineInstance) []k8sv1.ContainerPort { + ports := make([]k8sv1.ContainerPort, 0) + + for _, iface := range vmi.Spec.Domain.Devices.Interfaces { + if iface.Ports != nil { + for _, port := range iface.Ports { + if port.Protocol == "" { + port.Protocol = "TCP" + } + + ports = append(ports, k8sv1.ContainerPort{Protocol: k8sv1.Protocol(port.Protocol), Name: port.Name, ContainerPort: port.Port}) + } + } + } - // Add overhead to memory limits, if exists - if memoryLimit, ok := resources.Limits[kubev1.ResourceMemory]; ok { - memoryLimit.Add(*overhead) - resources.Limits[kubev1.ResourceMemory] = memoryLimit + if len(ports) == 0 { + return nil } - return nil + return ports } -func NewTemplateService(launcherImage string, virtShareDir string, imagePullSecret string) TemplateService { +func NewTemplateService(launcherImage string, virtShareDir string, imagePullSecret string, configMapCache cache.Store) TemplateService { precond.MustNotBeEmpty(launcherImage) svc := templateService{ launcherImage: launcherImage, virtShareDir: virtShareDir, imagePullSecret: imagePullSecret, + store: configMapCache, } return &svc } diff --git a/vendor/kubevirt.io/kubevirt/pkg/virt-controller/watch/application.go b/vendor/kubevirt.io/kubevirt/pkg/virt-controller/watch/application.go index cb5d489fd..945d19cd5 100644 --- a/vendor/kubevirt.io/kubevirt/pkg/virt-controller/watch/application.go +++ b/vendor/kubevirt.io/kubevirt/pkg/virt-controller/watch/application.go @@ -1,3 +1,22 @@ +/* + * This file is part of the KubeVirt project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Copyright 2017, 2018 Red Hat, Inc. + * + */ + package watch import ( @@ -60,22 +79,25 @@ type VirtControllerApp struct { nodeInformer cache.SharedIndexInformer nodeController *NodeController - vmCache cache.Store - vmController *VMController - vmInformer cache.SharedIndexInformer + vmiCache cache.Store + vmiController *VMIController + vmiInformer cache.SharedIndexInformer - vmPresetCache cache.Store - vmPresetController *VirtualMachinePresetController - vmPresetQueue workqueue.RateLimitingInterface - vmPresetInformer cache.SharedIndexInformer - vmPresetRecorder record.EventRecorder - vmRecorder record.EventRecorder + vmiPresetCache cache.Store + vmiPresetController *VirtualMachinePresetController + vmiPresetQueue workqueue.RateLimitingInterface + vmiPresetInformer cache.SharedIndexInformer + vmiPresetRecorder record.EventRecorder + vmiRecorder record.EventRecorder - rsController *VMReplicaSet + configMapCache cache.Store + configMapInformer cache.SharedIndexInformer + + rsController *VMIReplicaSet rsInformer cache.SharedIndexInformer - ovmController *OVMController - ovmInformer cache.SharedIndexInformer + vmController *VMController + vmInformer cache.SharedIndexInformer LeaderElection leaderelectionconfig.Configuration @@ -116,27 +138,30 @@ func Execute() { app.informerFactory = controller.NewKubeInformerFactory(app.restClient, app.clientSet) - app.vmInformer = app.informerFactory.VM() + app.vmiInformer = app.informerFactory.VMI() app.podInformer = app.informerFactory.KubeVirtPod() app.nodeInformer = app.informerFactory.KubeVirtNode() - app.vmCache = app.vmInformer.GetStore() - app.vmRecorder = app.getNewRecorder(k8sv1.NamespaceAll, "virtualmachine-controller") + app.vmiCache = app.vmiInformer.GetStore() + app.vmiRecorder = app.getNewRecorder(k8sv1.NamespaceAll, "virtualmachine-controller") + + app.vmiPresetQueue = workqueue.NewRateLimitingQueue(workqueue.DefaultControllerRateLimiter()) + app.vmiPresetCache = app.vmiInformer.GetStore() + app.vmiInformer.AddEventHandler(controller.NewResourceEventHandlerFuncsForWorkqueue(app.vmiPresetQueue)) - app.vmPresetQueue = workqueue.NewRateLimitingQueue(workqueue.DefaultControllerRateLimiter()) - app.vmPresetCache = app.vmInformer.GetStore() - app.vmInformer.AddEventHandler(controller.NewResourceEventHandlerFuncsForWorkqueue(app.vmPresetQueue)) + app.vmiPresetInformer = app.informerFactory.VirtualMachinePreset() - app.vmPresetInformer = app.informerFactory.VirtualMachinePreset() + app.rsInformer = app.informerFactory.VMIReplicaSet() + app.vmiPresetRecorder = app.getNewRecorder(k8sv1.NamespaceAll, "virtualmachine-preset-controller") - app.rsInformer = app.informerFactory.VMReplicaSet() - app.vmPresetRecorder = app.getNewRecorder(k8sv1.NamespaceAll, "virtualmachine-preset-controller") + app.configMapInformer = app.informerFactory.ConfigMap() + app.configMapCache = app.configMapInformer.GetStore() - app.ovmInformer = app.informerFactory.OfflineVirtualMachine() + app.vmInformer = app.informerFactory.VirtualMachine() app.initCommon() app.initReplicaSet() - app.initOfflineVirtualMachines() + app.initVirtualMachines() app.Run() } @@ -193,10 +218,10 @@ func (vca *VirtControllerApp) Run() { OnStartedLeading: func(stopCh <-chan struct{}) { vca.informerFactory.Start(stop) go vca.nodeController.Run(controllerThreads, stop) - go vca.vmController.Run(controllerThreads, stop) + go vca.vmiController.Run(controllerThreads, stop) go vca.rsController.Run(controllerThreads, stop) - go vca.vmPresetController.Run(controllerThreads, stop) - go vca.ovmController.Run(3, stop) + go vca.vmiPresetController.Run(controllerThreads, stop) + go vca.vmController.Run(controllerThreads, stop) close(vca.readyChan) }, OnStoppedLeading: func() { @@ -225,20 +250,20 @@ func (vca *VirtControllerApp) initCommon() { if err != nil { golog.Fatal(err) } - vca.templateService = services.NewTemplateService(vca.launcherImage, vca.virtShareDir, vca.imagePullSecret) - vca.vmController = NewVMController(vca.templateService, vca.vmInformer, vca.podInformer, vca.vmRecorder, vca.clientSet) - vca.vmPresetController = NewVirtualMachinePresetController(vca.vmPresetInformer, vca.vmInformer, vca.vmPresetQueue, vca.vmPresetCache, vca.clientSet, vca.vmPresetRecorder) - vca.nodeController = NewNodeController(vca.clientSet, vca.nodeInformer, vca.vmInformer, nil) + vca.templateService = services.NewTemplateService(vca.launcherImage, vca.virtShareDir, vca.imagePullSecret, vca.configMapCache) + vca.vmiController = NewVMIController(vca.templateService, vca.vmiInformer, vca.podInformer, vca.vmiRecorder, vca.clientSet, vca.configMapInformer) + vca.vmiPresetController = NewVirtualMachinePresetController(vca.vmiPresetInformer, vca.vmiInformer, vca.vmiPresetQueue, vca.vmiPresetCache, vca.clientSet, vca.vmiPresetRecorder) + vca.nodeController = NewNodeController(vca.clientSet, vca.nodeInformer, vca.vmiInformer, nil) } func (vca *VirtControllerApp) initReplicaSet() { recorder := vca.getNewRecorder(k8sv1.NamespaceAll, "virtualmachinereplicaset-controller") - vca.rsController = NewVMReplicaSet(vca.vmInformer, vca.rsInformer, recorder, vca.clientSet, controller.BurstReplicas) + vca.rsController = NewVMIReplicaSet(vca.vmiInformer, vca.rsInformer, recorder, vca.clientSet, controller.BurstReplicas) } -func (vca *VirtControllerApp) initOfflineVirtualMachines() { - recorder := vca.getNewRecorder(k8sv1.NamespaceAll, "offlinevirtualmachine-controller") - vca.ovmController = NewOVMController(vca.vmInformer, vca.ovmInformer, recorder, vca.clientSet) +func (vca *VirtControllerApp) initVirtualMachines() { + recorder := vca.getNewRecorder(k8sv1.NamespaceAll, "virtualmachine-controller") + vca.vmController = NewVMController(vca.vmiInformer, vca.vmInformer, recorder, vca.clientSet) } func (vca *VirtControllerApp) leaderProbe(_ *restful.Request, response *restful.Response) { @@ -268,7 +293,7 @@ func (vca *VirtControllerApp) AddFlags() { vca.AddCommonFlags() flag.StringVar(&vca.launcherImage, "launcher-image", launcherImage, - "Shim container for containerized VMs") + "Shim container for containerized VMIs") flag.StringVar(&vca.imagePullSecret, "image-pull-secret", imagePullSecret, "Secret to use for pulling virt-launcher and/or registry disks") diff --git a/vendor/kubevirt.io/kubevirt/pkg/virt-controller/watch/node.go b/vendor/kubevirt.io/kubevirt/pkg/virt-controller/watch/node.go index ecafa534d..788bb8af8 100644 --- a/vendor/kubevirt.io/kubevirt/pkg/virt-controller/watch/node.go +++ b/vendor/kubevirt.io/kubevirt/pkg/virt-controller/watch/node.go @@ -23,22 +23,24 @@ import ( "kubevirt.io/kubevirt/pkg/log" ) +// NodeController is the main NodeController struct. type NodeController struct { clientset kubecli.KubevirtClient Queue workqueue.RateLimitingInterface nodeInformer cache.SharedIndexInformer - vmInformer cache.SharedIndexInformer + vmiInformer cache.SharedIndexInformer recorder record.EventRecorder heartBeatTimeout time.Duration recheckInterval time.Duration } -func NewNodeController(clientset kubecli.KubevirtClient, nodeInformer cache.SharedIndexInformer, vmInformer cache.SharedIndexInformer, recorder record.EventRecorder) *NodeController { +// NewNodeController creates a new instance of the NodeController struct. +func NewNodeController(clientset kubecli.KubevirtClient, nodeInformer cache.SharedIndexInformer, vmiInformer cache.SharedIndexInformer, recorder record.EventRecorder) *NodeController { c := &NodeController{ clientset: clientset, Queue: workqueue.NewRateLimitingQueue(workqueue.DefaultControllerRateLimiter()), nodeInformer: nodeInformer, - vmInformer: vmInformer, + vmiInformer: vmiInformer, recorder: recorder, heartBeatTimeout: 5 * time.Minute, recheckInterval: 1 * time.Minute, @@ -50,7 +52,7 @@ func NewNodeController(clientset kubecli.KubevirtClient, nodeInformer cache.Shar UpdateFunc: c.updateNode, }) - c.vmInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{ + c.vmiInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{ AddFunc: c.addVirtualMachine, DeleteFunc: func(_ interface{}) {}, // nothing to do UpdateFunc: c.updateVirtualMachine, @@ -82,26 +84,27 @@ func (c *NodeController) enqueueNode(obj interface{}) { } func (c *NodeController) addVirtualMachine(obj interface{}) { - vm := obj.(*virtv1.VirtualMachine) - if vm.Status.NodeName != "" { - c.Queue.Add(vm.Status.NodeName) + vmi := obj.(*virtv1.VirtualMachineInstance) + if vmi.Status.NodeName != "" { + c.Queue.Add(vmi.Status.NodeName) } } func (c *NodeController) updateVirtualMachine(old, curr interface{}) { - currVM := curr.(*virtv1.VirtualMachine) - if currVM.Status.NodeName != "" { - c.Queue.Add(currVM.Status.NodeName) + currVMI := curr.(*virtv1.VirtualMachineInstance) + if currVMI.Status.NodeName != "" { + c.Queue.Add(currVMI.Status.NodeName) } } +// Run runs the passed in NodeController. func (c *NodeController) Run(threadiness int, stopCh chan struct{}) { defer controller.HandlePanic() defer c.Queue.ShutDown() log.Log.Info("Starting node controller.") // Wait for cache sync before we start the node controller - cache.WaitForCacheSync(stopCh, c.nodeInformer.HasSynced, c.vmInformer.HasSynced) + cache.WaitForCacheSync(stopCh, c.nodeInformer.HasSynced, c.vmiInformer.HasSynced) // Start the actual work for i := 0; i < threadiness; i++ { @@ -117,6 +120,9 @@ func (c *NodeController) runWorker() { } } +// Execute runs commands from the controller queue, if there is +// an error it requeues the command. Returns false if the queue +// is empty. func (c *NodeController) Execute() bool { key, quit := c.Queue.Get() if quit { @@ -165,11 +171,11 @@ func (c *NodeController) execute(key string) error { return fmt.Errorf("failed to mark node %s as unschedulable: %v", nodeName, err) } } - vms, err := c.virtalMachinesOnNode(nodeName) + vmis, err := c.virtalMachinesOnNode(nodeName) if err != nil { - logger.Reason(err).Error("Failed fetch vms for node") + logger.Reason(err).Error("Failed fetch vmis for node") return err - } else if len(vms) == 0 { + } else if len(vmis) == 0 { if nodeExists { c.Queue.AddAfter(key, c.recheckInterval) } @@ -180,16 +186,16 @@ func (c *NodeController) execute(key string) error { logger.Reason(err).Error("Failed fetch pods for node") return err } - vms = filterStuckVirtualMachinesWithoutPods(vms, pods) + vmis = filterStuckVirtualMachinesWithoutPods(vmis, pods) errs := []string{} // Do sequential updates, we don't want to create update storms in situations where something might already be wrong - for _, vm := range vms { - logger.V(2).Infof("Moving vm %s in namespace %s on unresponsive node to failed state", vm.Name, vm.Namespace) - _, err := c.clientset.VM(vm.Namespace).Patch(vm.Name, types.JSONPatchType, []byte(fmt.Sprintf("[{ \"op\": \"replace\", \"path\": \"/status/phase\", \"value\": \"%s\" }]", virtv1.Failed))) + for _, vmi := range vmis { + logger.V(2).Infof("Moving vmi %s in namespace %s on unresponsive node to failed state", vmi.Name, vmi.Namespace) + _, err := c.clientset.VirtualMachineInstance(vmi.Namespace).Patch(vmi.Name, types.JSONPatchType, []byte(fmt.Sprintf("[{ \"op\": \"replace\", \"path\": \"/status/phase\", \"value\": \"%s\" }]", virtv1.Failed))) if err != nil { - errs = append(errs, fmt.Sprintf("failed to move vm %s in namespace %s to final state: %v", vm.Name, vm.Namespace, err)) - logger.Reason(err).Errorf("Failed to move vm %s in namespace %s to final state", vm.Name, vm.Namespace) + errs = append(errs, fmt.Sprintf("failed to move vmi %s in namespace %s to final state: %v", vmi.Name, vmi.Namespace, err)) + logger.Reason(err).Errorf("Failed to move vmi %s in namespace %s to final state", vmi.Name, vmi.Namespace) } } @@ -203,12 +209,12 @@ func (c *NodeController) execute(key string) error { return nil } -func (c *NodeController) virtalMachinesOnNode(nodeName string) ([]*virtv1.VirtualMachine, error) { +func (c *NodeController) virtalMachinesOnNode(nodeName string) ([]*virtv1.VirtualMachineInstance, error) { labelSelector, err := labels.Parse(fmt.Sprintf("%s in (%s)", virtv1.NodeNameLabel, nodeName)) if err != nil { return nil, err } - list, err := c.clientset.VM(v1.NamespaceAll).List(metav1.ListOptions{ + list, err := c.clientset.VirtualMachineInstance(v1.NamespaceAll).List(&metav1.ListOptions{ LabelSelector: labelSelector.String(), }) @@ -216,12 +222,12 @@ func (c *NodeController) virtalMachinesOnNode(nodeName string) ([]*virtv1.Virtua return nil, err } - vms := []*virtv1.VirtualMachine{} + vmis := []*virtv1.VirtualMachineInstance{} - for i, _ := range list.Items { - vms = append(vms, &list.Items[i]) + for i := range list.Items { + vmis = append(vmis, &list.Items[i]) } - return vms, nil + return vmis, nil } func (c *NodeController) podsOnNode(nodeName string) ([]*v1.Pod, error) { @@ -234,40 +240,43 @@ func (c *NodeController) podsOnNode(nodeName string) ([]*v1.Pod, error) { LabelSelector: labelSelector.String(), FieldSelector: handlerNodeSelector.String(), }) + if err != nil { + return nil, err + } pods := []*v1.Pod{} - for i, _ := range list.Items { + for i := range list.Items { pods = append(pods, &list.Items[i]) } return pods, nil } -func filterStuckVirtualMachinesWithoutPods(vms []*virtv1.VirtualMachine, pods []*v1.Pod) []*virtv1.VirtualMachine { +func filterStuckVirtualMachinesWithoutPods(vmis []*virtv1.VirtualMachineInstance, pods []*v1.Pod) []*virtv1.VirtualMachineInstance { podsPerNamespace := map[string]map[string]*v1.Pod{} for _, pod := range pods { - podsForVM, ok := podsPerNamespace[pod.Namespace] + podsForVMI, ok := podsPerNamespace[pod.Namespace] if !ok { - podsForVM = map[string]*v1.Pod{} + podsForVMI = map[string]*v1.Pod{} } name := pod.Labels[virtv1.DomainLabel] if len(name) == 0 { continue } - podsForVM[name] = pod - podsPerNamespace[pod.Namespace] = podsForVM + podsForVMI[name] = pod + podsPerNamespace[pod.Namespace] = podsForVMI } - filtered := []*virtv1.VirtualMachine{} - for _, vm := range vms { - if vm.IsScheduled() || vm.IsRunning() { - if podsForVM, exists := podsPerNamespace[vm.Namespace]; exists { - if _, exists := podsForVM[vm.Name]; exists { + filtered := []*virtv1.VirtualMachineInstance{} + for _, vmi := range vmis { + if vmi.IsScheduled() || vmi.IsRunning() { + if podsForVMI, exists := podsPerNamespace[vmi.Namespace]; exists { + if _, exists := podsForVMI[vmi.Name]; exists { continue } } - filtered = append(filtered, vm) + filtered = append(filtered, vmi) } } return filtered diff --git a/vendor/kubevirt.io/kubevirt/pkg/virt-controller/watch/ovm.go b/vendor/kubevirt.io/kubevirt/pkg/virt-controller/watch/ovm.go deleted file mode 100644 index 8f37908a8..000000000 --- a/vendor/kubevirt.io/kubevirt/pkg/virt-controller/watch/ovm.go +++ /dev/null @@ -1,763 +0,0 @@ -/* - * This file is part of the KubeVirt project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Copyright 2017 Red Hat, Inc. - * - */ - -package watch - -import ( - "time" - - "github.com/pborman/uuid" - - "k8s.io/apimachinery/pkg/types" - "k8s.io/apimachinery/pkg/util/wait" - "k8s.io/client-go/tools/cache" - "k8s.io/client-go/tools/record" - "k8s.io/client-go/util/workqueue" - - "k8s.io/apimachinery/pkg/apis/meta/v1" - - k8score "k8s.io/api/core/v1" - - "fmt" - - "reflect" - - virtv1 "kubevirt.io/kubevirt/pkg/api/v1" - "kubevirt.io/kubevirt/pkg/controller" - "kubevirt.io/kubevirt/pkg/kubecli" - "kubevirt.io/kubevirt/pkg/log" -) - -func NewOVMController(vmInformer cache.SharedIndexInformer, vmOVMInformer cache.SharedIndexInformer, recorder record.EventRecorder, clientset kubecli.KubevirtClient) *OVMController { - - c := &OVMController{ - Queue: workqueue.NewRateLimitingQueue(workqueue.DefaultControllerRateLimiter()), - vmInformer: vmInformer, - vmOVMInformer: vmOVMInformer, - recorder: recorder, - clientset: clientset, - expectations: controller.NewUIDTrackingControllerExpectations(controller.NewControllerExpectations()), - } - - c.vmOVMInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{ - AddFunc: c.addOvm, - DeleteFunc: c.deleteOvm, - UpdateFunc: c.updateOvm, - }) - - c.vmInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{ - AddFunc: c.addVirtualMachine, - DeleteFunc: c.deleteVirtualMachine, - UpdateFunc: c.updateVirtualMachine, - }) - - return c -} - -type OVMController struct { - clientset kubecli.KubevirtClient - Queue workqueue.RateLimitingInterface - vmInformer cache.SharedIndexInformer - vmOVMInformer cache.SharedIndexInformer - recorder record.EventRecorder - expectations *controller.UIDTrackingControllerExpectations -} - -func (c *OVMController) Run(threadiness int, stopCh chan struct{}) { - defer controller.HandlePanic() - defer c.Queue.ShutDown() - log.Log.Info("Starting OfflineVirtualMachine controller.") - - // Wait for cache sync before we start the controller - cache.WaitForCacheSync(stopCh, c.vmInformer.HasSynced, c.vmOVMInformer.HasSynced) - - // Start the actual work - for i := 0; i < threadiness; i++ { - go wait.Until(c.runWorker, time.Second, stopCh) - } - - <-stopCh - log.Log.Info("Stopping OfflineVirtualMachine controller.") -} - -func (c *OVMController) runWorker() { - for c.Execute() { - } -} - -func (c *OVMController) Execute() bool { - key, quit := c.Queue.Get() - if quit { - return false - } - defer c.Queue.Done(key) - if err := c.execute(key.(string)); err != nil { - log.Log.Reason(err).Infof("re-enqueuing OfflineVirtualMachine %v", key) - c.Queue.AddRateLimited(key) - } else { - log.Log.V(4).Infof("processed OfflineVirtualMachine %v", key) - c.Queue.Forget(key) - } - return true -} - -func (c *OVMController) execute(key string) error { - - obj, exists, err := c.vmOVMInformer.GetStore().GetByKey(key) - if err != nil { - return nil - } - if !exists { - // nothing we need to do. It should always be possible to re-create this type of controller - c.expectations.DeleteExpectations(key) - return nil - } - OVM := obj.(*virtv1.OfflineVirtualMachine) - - logger := log.Log.Object(OVM) - - logger.Info("Started processing OVM") - - //TODO default rs if necessary, the aggregated apiserver will do that in the future - if OVM.Spec.Template == nil { - logger.Error("Invalid controller spec, will not re-enqueue.") - return nil - } - - needsSync := c.expectations.SatisfiedExpectations(key) - - ovmKey, err := controller.KeyFunc(OVM) - if err != nil { - return err - } - - // If any adoptions are attempted, we should first recheck for deletion with - // an uncached quorum read sometime after listing VirtualMachines (see kubernetes/kubernetes#42639). - canAdoptFunc := controller.RecheckDeletionTimestamp(func() (v1.Object, error) { - fresh, err := c.clientset.OfflineVirtualMachine(OVM.ObjectMeta.Namespace).Get(OVM.ObjectMeta.Name, &v1.GetOptions{}) - if err != nil { - return nil, err - } - if fresh.ObjectMeta.UID != OVM.ObjectMeta.UID { - return nil, fmt.Errorf("original OfflineVirtualMachine %v/%v is gone: got uid %v, wanted %v", OVM.Namespace, OVM.Name, fresh.UID, OVM.UID) - } - return fresh, nil - }) - cm := controller.NewVirtualMachineControllerRefManager(controller.RealVirtualMachineControl{Clientset: c.clientset}, OVM, nil, virtv1.OfflineVirtualMachineGroupVersionKind, canAdoptFunc) - - var vm *virtv1.VirtualMachine - vmObj, exist, err := c.vmInformer.GetStore().GetByKey(ovmKey) - if err != nil { - logger.Reason(err).Error("Failed to fetch vm for namespace from cache.") - return err - } - if !exist { - logger.Infof("VM not found in cache %s", key) - vm = nil - } else { - vm = vmObj.(*virtv1.VirtualMachine) - - vm, err = cm.ClaimVirtualMachineByName(vm) - if err != nil { - return err - } - } - - var createErr, vmError error - - // Scale up or down, if all expected creates and deletes were report by the listener - if needsSync && OVM.ObjectMeta.DeletionTimestamp == nil { - logger.Infof("Creating or the VM: %t", OVM.Spec.Running) - createErr = c.startStop(OVM, vm) - } - - // If the controller is going to be deleted and the orphan finalizer is the next one, release the VMs. Don't update the status - // TODO: Workaround for https://github.com/kubernetes/kubernetes/issues/56348, remove it once it is fixed - if OVM.ObjectMeta.DeletionTimestamp != nil && controller.HasFinalizer(OVM, v1.FinalizerOrphanDependents) { - return c.orphan(cm, vm) - } - - if createErr != nil { - logger.Reason(err).Error("Scaling the OfflineVirtualMachine failed.") - } - - err = c.updateStatus(OVM.DeepCopy(), vm, createErr, vmError) - if err != nil { - logger.Reason(err).Error("Updating the OfflineVirtualMachine status failed.") - } - - return err -} - -// orphan removes the owner reference of all VMs which are owned by the controller instance. -// Workaround for https://github.com/kubernetes/kubernetes/issues/56348 to make no-cascading deletes possible -// We don't have to remove the finalizer. This part of the gc is not affected by the mentioned bug -// TODO +pkotas unify with replicasets. This function can be the same -func (c *OVMController) orphan(cm *controller.VirtualMachineControllerRefManager, vm *virtv1.VirtualMachine) error { - if vm == nil { - return nil - } - - errChan := make(chan error, 1) - - go func(vm *virtv1.VirtualMachine) { - err := cm.ReleaseVirtualMachine(vm) - if err != nil { - errChan <- err - } - }(vm) - - select { - case err := <-errChan: - return err - default: - } - return nil -} - -func (c *OVMController) startStop(ovm *virtv1.OfflineVirtualMachine, vm *virtv1.VirtualMachine) error { - log.Log.Object(ovm).V(4).Infof("Start the VM: %t", ovm.Spec.Running) - - if ovm.Spec.Running == true { - if vm != nil { - if vm.IsFinal() { - // The VM can fail od be finished. The job of this controller - // is keep the VM running, therefore it restarts it. - // restarting VM by stopping it and letting it start in next step - err := c.stopVM(ovm, vm) - if err != nil { - log.Log.Object(ovm).Error("Cannot restart VM, the VM cannot be deleted.") - return err - } - // return to let the controller pick up the expected deletion - } - // VM is OK no need to do anything - return nil - } - - err := c.startVM(ovm) - return err - } - - if ovm.Spec.Running == false { - log.Log.Object(ovm).V(4).Info("It is false delete") - if vm == nil { - log.Log.Info("vm is nil") - // vm should not run and is not running - return nil - } - err := c.stopVM(ovm, vm) - return err - } - - return nil -} - -func (c *OVMController) startVM(ovm *virtv1.OfflineVirtualMachine) error { - // TODO add check for existence - ovmKey, err := controller.KeyFunc(ovm) - if err != nil { - log.Log.Object(ovm).Reason(err).Error("Failed to extract ovmKey from OfflineVirtualMachine.") - return nil - } - - // start it - vm := c.setupVMFromOVM(ovm) - - c.expectations.ExpectCreations(ovmKey, 1) - vm, err = c.clientset.VM(ovm.ObjectMeta.Namespace).Create(vm) - if err != nil { - log.Log.Object(ovm).Infof("Failed to create VM: %s/%s", vm.Namespace, vm.Name) - c.expectations.CreationObserved(ovmKey) - c.recorder.Eventf(ovm, k8score.EventTypeWarning, FailedCreateVirtualMachineReason, "Error creating virtual machine: %v", err) - return err - } - c.recorder.Eventf(ovm, k8score.EventTypeNormal, SuccessfulCreateVirtualMachineReason, "Created virtual machine: %v", vm.ObjectMeta.Name) - - return nil -} - -func (c *OVMController) stopVM(ovm *virtv1.OfflineVirtualMachine, vm *virtv1.VirtualMachine) error { - if vm == nil { - // nothing to do - return nil - } - - ovmKey, err := controller.KeyFunc(ovm) - if err != nil { - log.Log.Object(ovm).Reason(err).Error("Failed to extract ovmKey from OfflineVirtualMachine.") - return nil - } - - // stop it - c.expectations.ExpectDeletions(ovmKey, []string{controller.VirtualMachineKey(vm)}) - err = c.clientset.VM(ovm.ObjectMeta.Namespace).Delete(vm.ObjectMeta.Name, &v1.DeleteOptions{}) - - // Don't log an error if it is already deleted - if err != nil { - // We can't observe a delete if it was not accepted by the server - c.expectations.DeletionObserved(ovmKey, controller.VirtualMachineKey(vm)) - c.recorder.Eventf(ovm, k8score.EventTypeWarning, FailedDeleteVirtualMachineReason, "Error deleting virtual machine %s: %v", vm.ObjectMeta.Name, err) - return err - } - - c.recorder.Eventf(ovm, k8score.EventTypeNormal, SuccessfulDeleteVirtualMachineReason, "Deleted virtual machine: %v", vm.ObjectMeta.UID) - log.Log.Object(ovm).Info("Dispatching delete event") - - return nil -} - -// setupVMfromOVM creates a VirtualMachine object from one OfflineVirtualMachine object. -func (c *OVMController) setupVMFromOVM(ovm *virtv1.OfflineVirtualMachine) *virtv1.VirtualMachine { - basename := c.getVirtualMachineBaseName(ovm) - - vm := virtv1.NewVMReferenceFromNameWithNS(ovm.ObjectMeta.Namespace, "") - vm.ObjectMeta = ovm.Spec.Template.ObjectMeta - vm.ObjectMeta.Name = basename - vm.ObjectMeta.GenerateName = basename - vm.Spec = ovm.Spec.Template.Spec - - setupStableFirmwareUUID(ovm, vm) - - t := true - // TODO check if vm labels exist, and when make sure that they match. For now just override them - vm.ObjectMeta.Labels = ovm.Spec.Template.ObjectMeta.Labels - vm.ObjectMeta.OwnerReferences = []v1.OwnerReference{v1.OwnerReference{ - APIVersion: virtv1.OfflineVirtualMachineGroupVersionKind.GroupVersion().String(), - Kind: virtv1.OfflineVirtualMachineGroupVersionKind.Kind, - Name: ovm.ObjectMeta.Name, - UID: ovm.ObjectMeta.UID, - Controller: &t, - BlockOwnerDeletion: &t, - }} - - return vm -} - -// no special meaning, randomly generated on my box. -// TODO: do we want to use another constants? see examples in RFC4122 -const magicUUID = "6a1a24a1-4061-4607-8bf4-a3963d0c5895" - -var firmwareUUIDns = uuid.Parse(magicUUID) - -// setStableUUID makes sure the VM being started has a a 'stable' UUID. -// The UUID is 'stable' if doesn't change across reboots. -func setupStableFirmwareUUID(ovm *virtv1.OfflineVirtualMachine, vm *virtv1.VirtualMachine) { - - logger := log.Log.Object(ovm) - - if vm.Spec.Domain.Firmware == nil { - vm.Spec.Domain.Firmware = &virtv1.Firmware{} - } - - existingUUID := vm.Spec.Domain.Firmware.UUID - if existingUUID != "" { - logger.Debugf("Using existing UUID '%s'", existingUUID) - return - } - - vm.Spec.Domain.Firmware.UUID = types.UID(uuid.NewSHA1(firmwareUUIDns, []byte(vm.ObjectMeta.Name)).String()) - logger.Infof("Setting stabile UUID '%s' (was '%s')", vm.Spec.Domain.Firmware.UUID, existingUUID) -} - -// filterActiveVMs takes a list of VMs and returns all VMs which are not in a final state -// TODO +pkotas unify with replicaset this code is the same without dependency -func (c *OVMController) filterActiveVMs(vms []*virtv1.VirtualMachine) []*virtv1.VirtualMachine { - return filter(vms, func(vm *virtv1.VirtualMachine) bool { - return !vm.IsFinal() - }) -} - -// filterReadyVMs takes a list of VMs and returns all VMs which are in ready state. -// TODO +pkotas unify with replicaset this code is the same -func (c *OVMController) filterReadyVMs(vms []*virtv1.VirtualMachine) []*virtv1.VirtualMachine { - return filter(vms, func(vm *virtv1.VirtualMachine) bool { - return vm.IsReady() - }) -} - -// listVMsFromNamespace takes a namespace and returns all VMs from the VM cache which run in this namespace -// TODO +pkotas unify this code with replicaset -func (c *OVMController) listVMsFromNamespace(namespace string) ([]*virtv1.VirtualMachine, error) { - objs, err := c.vmInformer.GetIndexer().ByIndex(cache.NamespaceIndex, namespace) - if err != nil { - return nil, err - } - vms := []*virtv1.VirtualMachine{} - for _, obj := range objs { - vms = append(vms, obj.(*virtv1.VirtualMachine)) - } - return vms, nil -} - -// listControllerFromNamespace takes a namespace and returns all OfflineVirtualMachines -// from the OfflineVirtualMachine cache which run in this namespace -func (c *OVMController) listControllerFromNamespace(namespace string) ([]*virtv1.OfflineVirtualMachine, error) { - objs, err := c.vmOVMInformer.GetIndexer().ByIndex(cache.NamespaceIndex, namespace) - if err != nil { - return nil, err - } - ovms := []*virtv1.OfflineVirtualMachine{} - for _, obj := range objs { - ovm := obj.(*virtv1.OfflineVirtualMachine) - ovms = append(ovms, ovm) - } - return ovms, nil -} - -// getMatchingControllers returns the list of OfflineVirtualMachines which matches -// the labels of the VM from the listener cache. If there are no matching -// controllers nothing is returned -func (c *OVMController) getMatchingControllers(vm *virtv1.VirtualMachine) (ovms []*virtv1.OfflineVirtualMachine) { - controllers, err := c.listControllerFromNamespace(vm.ObjectMeta.Namespace) - if err != nil { - return nil - } - - // TODO check owner reference, if we have an existing controller which owns this one - - for _, ovm := range controllers { - if vm.Name == ovm.Name { - ovms = append(ovms, ovm) - } - } - return ovms -} - -// When a vm is created, enqueue the OfflineVirtualMachine that manages it and update its expectations. -func (c *OVMController) addVirtualMachine(obj interface{}) { - vm := obj.(*virtv1.VirtualMachine) - - log.Log.Object(vm).V(4).Info("VM added.") - - if vm.DeletionTimestamp != nil { - // on a restart of the controller manager, it's possible a new vm shows up in a state that - // is already pending deletion. Prevent the vm from being a creation observation. - c.deleteVirtualMachine(vm) - return - } - - // If it has a ControllerRef, that's all that matters. - if controllerRef := controller.GetControllerOf(vm); controllerRef != nil { - log.Log.Object(vm).Info("Looking for VM Ref") - ovm := c.resolveControllerRef(vm.Namespace, controllerRef) - if ovm == nil { - log.Log.Object(vm).Errorf("Cant find the matching OVM for VM: %s", vm.Name) - return - } - ovmKey, err := controller.KeyFunc(ovm) - if err != nil { - log.Log.Object(vm).Errorf("Cannot parse key of OVM: %s for VM: %s", ovm.Name, vm.Name) - return - } - log.Log.Object(vm).Infof("VirtualMachine created bacause %s was added.", vm.Name) - c.expectations.CreationObserved(ovmKey) - c.enqueueOvm(ovm) - return - } - - // Otherwise, it's an orphan. Get a list of all matching OfflineVirtualMachines and sync - // them to see if anyone wants to adopt it. - // DO NOT observe creation because no controller should be waiting for an - // orphan. - ovms := c.getMatchingControllers(vm) - if len(ovms) == 0 { - return - } - log.Log.V(4).Object(vm).Infof("Orphan VirtualMachine created") - for _, ovm := range ovms { - c.enqueueOvm(ovm) - } -} - -// When a vm is updated, figure out what OfflineVirtualMachine manage it and wake them -// up. If the labels of the vm have changed we need to awaken both the old -// and new OfflineVirtualMachine. old and cur must be *v1.VirtualMachine types. -func (c *OVMController) updateVirtualMachine(old, cur interface{}) { - curVM := cur.(*virtv1.VirtualMachine) - oldVM := old.(*virtv1.VirtualMachine) - if curVM.ResourceVersion == oldVM.ResourceVersion { - // Periodic resync will send update events for all known vms. - // Two different versions of the same vm will always have different RVs. - return - } - - labelChanged := !reflect.DeepEqual(curVM.Labels, oldVM.Labels) - if curVM.DeletionTimestamp != nil { - // when a vm is deleted gracefully it's deletion timestamp is first modified to reflect a grace period, - // and after such time has passed, the virt-handler actually deletes it from the store. We receive an update - // for modification of the deletion timestamp and expect an OfflineVirtualMachine to create newVM asap, not wait - // until the virt-handler actually deletes the vm. This is different from the Phase of a vm changing, because - // an rs never initiates a phase change, and so is never asleep waiting for the same. - c.deleteVirtualMachine(curVM) - if labelChanged { - // we don't need to check the oldVM.DeletionTimestamp because DeletionTimestamp cannot be unset. - c.deleteVirtualMachine(oldVM) - } - return - } - - curControllerRef := controller.GetControllerOf(curVM) - oldControllerRef := controller.GetControllerOf(oldVM) - controllerRefChanged := !reflect.DeepEqual(curControllerRef, oldControllerRef) - if controllerRefChanged && oldControllerRef != nil { - // The ControllerRef was changed. Sync the old controller, if any. - if rs := c.resolveControllerRef(oldVM.Namespace, oldControllerRef); rs != nil { - c.enqueueOvm(rs) - } - } - - // If it has a ControllerRef, that's all that matters. - if curControllerRef != nil { - rs := c.resolveControllerRef(curVM.Namespace, curControllerRef) - if rs == nil { - return - } - log.Log.V(4).Object(curVM).Infof("VirtualMachine updated") - c.enqueueOvm(rs) - // TODO: MinReadySeconds in the VM will generate an Available condition to be added in - // Update once we support the available conect on the rs - return - } - - // Otherwise, it's an orphan. If anything changed, sync matching controllers - // to see if anyone wants to adopt it now. - if labelChanged || controllerRefChanged { - rss := c.getMatchingControllers(curVM) - if len(rss) == 0 { - return - } - log.Log.V(4).Object(curVM).Infof("Orphan VirtualMachine updated") - for _, rs := range rss { - c.enqueueOvm(rs) - } - } -} - -// When a vm is deleted, enqueue the OfflineVirtualMachine that manages the vm and update its expectations. -// obj could be an *v1.VirtualMachine, or a DeletionFinalStateUnknown marker item. -func (c *OVMController) deleteVirtualMachine(obj interface{}) { - vm, ok := obj.(*virtv1.VirtualMachine) - - // When a delete is dropped, the relist will notice a vm in the store not - // in the list, leading to the insertion of a tombstone object which contains - // the deleted key/value. Note that this value might be stale. If the vm - // changed labels the new OfflineVirtualMachine will not be woken up till the periodic resync. - if !ok { - tombstone, ok := obj.(cache.DeletedFinalStateUnknown) - if !ok { - log.Log.Reason(fmt.Errorf("couldn't get object from tombstone %+v", obj)).Error("Failed to process delete notification") - return - } - vm, ok = tombstone.Obj.(*virtv1.VirtualMachine) - if !ok { - log.Log.Reason(fmt.Errorf("tombstone contained object that is not a vm %#v", obj)).Error("Failed to process delete notification") - return - } - } - - controllerRef := controller.GetControllerOf(vm) - if controllerRef == nil { - // No controller should care about orphans being deleted. - return - } - ovm := c.resolveControllerRef(vm.Namespace, controllerRef) - if ovm == nil { - return - } - ovmKey, err := controller.KeyFunc(ovm) - if err != nil { - return - } - c.expectations.DeletionObserved(ovmKey, controller.VirtualMachineKey(vm)) - c.enqueueOvm(ovm) -} - -func (c *OVMController) addOvm(obj interface{}) { - c.enqueueOvm(obj) -} - -func (c *OVMController) deleteOvm(obj interface{}) { - c.enqueueOvm(obj) -} - -func (c *OVMController) updateOvm(old, curr interface{}) { - c.enqueueOvm(curr) -} - -func (c *OVMController) enqueueOvm(obj interface{}) { - logger := log.Log - ovm := obj.(*virtv1.OfflineVirtualMachine) - key, err := controller.KeyFunc(ovm) - if err != nil { - logger.Object(ovm).Reason(err).Error("Failed to extract ovmKey from OfflineVirtualMachine.") - } - c.Queue.Add(key) -} - -func (c *OVMController) hasCondition(ovm *virtv1.OfflineVirtualMachine, cond virtv1.OfflineVirtualMachineConditionType) bool { - for _, c := range ovm.Status.Conditions { - if c.Type == cond { - return true - } - } - return false -} - -func (c *OVMController) removeCondition(ovm *virtv1.OfflineVirtualMachine, cond virtv1.OfflineVirtualMachineConditionType) { - var conds []virtv1.OfflineVirtualMachineCondition - for _, c := range ovm.Status.Conditions { - if c.Type == cond { - continue - } - conds = append(conds, c) - } - ovm.Status.Conditions = conds -} - -func (c *OVMController) updateStatus(ovm *virtv1.OfflineVirtualMachine, vm *virtv1.VirtualMachine, createErr, vmError error) error { - - // Check if it is worth updating - runningMatch := ovm.Spec.Running == c.hasCondition(ovm, virtv1.OfflineVirtualMachineRunning) - errMatch := (createErr != nil) == c.hasCondition(ovm, virtv1.OfflineVirtualMachineFailure) - - log.Log.Object(ovm).Infof("Update: shouldRun: %t; shouldHaveErr: %t", runningMatch, errMatch) - - if errMatch && runningMatch { - return nil - } - - // Add/Remove Failure condition if necessary - if !(errMatch) { - c.processFailure(ovm, vm, createErr) - } - - // update condition if the vm is running or not - if !runningMatch { - c.processRunning(ovm, vm, createErr) - } - - _, err := c.clientset.OfflineVirtualMachine(ovm.ObjectMeta.Namespace).Update(ovm) - - return err -} - -func (c *OVMController) getVirtualMachineBaseName(ovm *virtv1.OfflineVirtualMachine) string { - - // TODO defaulting should make sure that the right field is set, instead of doing this - if len(ovm.Spec.Template.ObjectMeta.Name) > 0 { - return ovm.Spec.Template.ObjectMeta.Name - } - if len(ovm.Spec.Template.ObjectMeta.GenerateName) > 0 { - return ovm.Spec.Template.ObjectMeta.GenerateName - } - return ovm.ObjectMeta.Name -} - -func (c *OVMController) processRunning(ovm *virtv1.OfflineVirtualMachine, vm *virtv1.VirtualMachine, createErr error) { - log.Log.Object(ovm).Infof("Processing running status:: shouldRun: %t; noErr: %t; noVm: %t", ovm.Spec.Running, createErr != nil, vm != nil) - if vm == nil { - c.removeCondition(ovm, virtv1.OfflineVirtualMachineRunning) - return - } - - if ovm.Spec.Running && createErr == nil && !c.hasCondition(ovm, virtv1.OfflineVirtualMachineRunning) && vm.Status.Phase == virtv1.Running { - log.Log.Object(ovm).Info("Adding running condition") - ovm.Status.Conditions = append(ovm.Status.Conditions, virtv1.OfflineVirtualMachineCondition{ - Type: virtv1.OfflineVirtualMachineRunning, - Reason: fmt.Sprintf("Created by OVM %s", ovm.ObjectMeta.Name), - Message: fmt.Sprintf("Created by OVM %s", ovm.ObjectMeta.Name), - LastTransitionTime: v1.Now(), - Status: k8score.ConditionTrue, - }) - - return - } - - c.removeCondition(ovm, virtv1.OfflineVirtualMachineRunning) -} - -func (c *OVMController) processFailure(ovm *virtv1.OfflineVirtualMachine, vm *virtv1.VirtualMachine, createErr error) { - reason := "" - message := "" - log.Log.Object(ovm).Infof("Processing failure status:: shouldRun: %t; noErr: %t; noVm: %t", ovm.Spec.Running, createErr != nil, vm != nil) - - if createErr != nil { - if ovm.Spec.Running == true { - reason = "FailedCreate" - } else { - reason = "FailedDelete" - } - message = createErr.Error() - - if !c.hasCondition(ovm, virtv1.OfflineVirtualMachineFailure) { - log.Log.Object(ovm).Infof("Reason to fail: %s", reason) - ovm.Status.Conditions = append(ovm.Status.Conditions, virtv1.OfflineVirtualMachineCondition{ - Type: virtv1.OfflineVirtualMachineFailure, - Reason: reason, - Message: message, - LastTransitionTime: v1.Now(), - Status: k8score.ConditionTrue, - }) - } - - return - } - - log.Log.Object(ovm).Info("Removing failure") - c.removeCondition(ovm, virtv1.OfflineVirtualMachineFailure) -} - -func OvmOwnerRef(ovm *virtv1.OfflineVirtualMachine) v1.OwnerReference { - t := true - gvk := virtv1.OfflineVirtualMachineGroupVersionKind - return v1.OwnerReference{ - APIVersion: gvk.GroupVersion().String(), - Kind: gvk.Kind, - Name: ovm.ObjectMeta.Name, - UID: ovm.ObjectMeta.UID, - Controller: &t, - BlockOwnerDeletion: &t, - } -} - -// resolveControllerRef returns the controller referenced by a ControllerRef, -// or nil if the ControllerRef could not be resolved to a matching controller -// of the correct Kind. -func (c *OVMController) resolveControllerRef(namespace string, controllerRef *v1.OwnerReference) *virtv1.OfflineVirtualMachine { - // We can't look up by UID, so look up by Name and then verify UID. - // Don't even try to look up by Name if it's the wrong Kind. - if controllerRef.Kind != virtv1.OfflineVirtualMachineGroupVersionKind.Kind { - return nil - } - ovm, exists, err := c.vmOVMInformer.GetStore().GetByKey(namespace + "/" + controllerRef.Name) - if err != nil { - return nil - } - if !exists { - return nil - } - - if ovm.(*virtv1.OfflineVirtualMachine).UID != controllerRef.UID { - // The controller we found with this Name is not the same one that the - // ControllerRef points to. - return nil - } - return ovm.(*virtv1.OfflineVirtualMachine) -} diff --git a/vendor/kubevirt.io/kubevirt/pkg/virt-controller/watch/preset.go b/vendor/kubevirt.io/kubevirt/pkg/virt-controller/watch/preset.go index 5b02c78e1..5d9f11c35 100644 --- a/vendor/kubevirt.io/kubevirt/pkg/virt-controller/watch/preset.go +++ b/vendor/kubevirt.io/kubevirt/pkg/virt-controller/watch/preset.go @@ -20,6 +20,7 @@ package watch import ( + "encoding/json" "fmt" "reflect" "time" @@ -41,26 +42,27 @@ import ( ) type VirtualMachinePresetController struct { - vmPresetInformer cache.SharedIndexInformer - vmInitInformer cache.SharedIndexInformer - clientset kubecli.KubevirtClient - queue workqueue.RateLimitingInterface - recorder record.EventRecorder - store cache.Store + vmiPresetInformer cache.SharedIndexInformer + vmiInitInformer cache.SharedIndexInformer + clientset kubecli.KubevirtClient + queue workqueue.RateLimitingInterface + recorder record.EventRecorder + store cache.Store } const initializerMarking = "presets.virtualmachines." + kubev1.GroupName + "/presets-applied" - -func NewVirtualMachinePresetController(vmPresetInformer cache.SharedIndexInformer, vmInitInformer cache.SharedIndexInformer, queue workqueue.RateLimitingInterface, vmInitCache cache.Store, clientset kubecli.KubevirtClient, recorder record.EventRecorder) *VirtualMachinePresetController { - vmi := VirtualMachinePresetController{ - vmPresetInformer: vmPresetInformer, - vmInitInformer: vmInitInformer, - clientset: clientset, - queue: queue, - recorder: recorder, - store: vmInitCache, - } - return &vmi +const exclusionMarking = "virtualmachineinstancepresets.admission.kubevirt.io/exclude" + +func NewVirtualMachinePresetController(vmiPresetInformer cache.SharedIndexInformer, vmiInitInformer cache.SharedIndexInformer, queue workqueue.RateLimitingInterface, vmiInitCache cache.Store, clientset kubecli.KubevirtClient, recorder record.EventRecorder) *VirtualMachinePresetController { + vmii := VirtualMachinePresetController{ + vmiPresetInformer: vmiPresetInformer, + vmiInitInformer: vmiInitInformer, + clientset: clientset, + queue: queue, + recorder: recorder, + store: vmiInitCache, + } + return &vmii } func (c *VirtualMachinePresetController) Run(threadiness int, stopCh chan struct{}) { @@ -69,7 +71,7 @@ func (c *VirtualMachinePresetController) Run(threadiness int, stopCh chan struct log.Log.Info("Starting Virtual Machine Initializer.") // Wait for cache sync before we start the pod controller - cache.WaitForCacheSync(stopCh, c.vmPresetInformer.HasSynced, c.vmInitInformer.HasSynced) + cache.WaitForCacheSync(stopCh, c.vmiPresetInformer.HasSynced, c.vmiInitInformer.HasSynced) // Start the actual work for i := 0; i < threadiness; i++ { @@ -94,10 +96,10 @@ func (c *VirtualMachinePresetController) Execute() bool { err := c.execute(key.(string)) if err != nil { - log.Log.Reason(err).Infof("reenqueuing VM %v", key) + log.Log.Reason(err).Infof("reenqueuing VirtualMachineInstance %v", key) c.queue.AddRateLimited(key) } else { - log.Log.V(4).Infof("processed VM %v", key) + log.Log.V(4).Infof("processed VirtualMachineInstance %v", key) c.queue.Forget(key) } return true @@ -105,137 +107,144 @@ func (c *VirtualMachinePresetController) Execute() bool { func (c *VirtualMachinePresetController) execute(key string) error { - // Fetch the latest VM state from cache + // Fetch the latest VirtualMachineInstance state from cache obj, exists, err := c.store.GetByKey(key) if err != nil { return err } - // If the VM isn't in the cache, it was just deleted, so shouldn't + // If the VirtualMachineInstance isn't in the cache, it was just deleted, so shouldn't // be initialized if exists { - vm := &kubev1.VirtualMachine{} - obj.(*kubev1.VirtualMachine).DeepCopyInto(vm) - // only process VM's that aren't initialized by this controller yet - if !isVirtualMachineInitialized(vm) { - return c.initializeVirtualMachine(vm) + vmi := &kubev1.VirtualMachineInstance{} + obj.(*kubev1.VirtualMachineInstance).DeepCopyInto(vmi) + // only process VirtualMachineInstance's that aren't initialized by this controller yet + if !isVirtualMachineInitialized(vmi) { + return c.initializeVirtualMachine(vmi) } } return nil } -func (c *VirtualMachinePresetController) initializeVirtualMachine(vm *kubev1.VirtualMachine) error { - // All VM's must be marked as initialized or they are held in limbo forever +func (c *VirtualMachinePresetController) initializeVirtualMachine(vmi *kubev1.VirtualMachineInstance) error { + // All VirtualMachineInstance's must be marked as initialized or they are held in limbo forever // Collect all errors and defer returning until after the update logger := log.Log var err error success := true - logger.Object(vm).Info("Initializing VirtualMachine") + if !isVmExcluded(vmi) { + logger.Object(vmi).Info("Initializing VirtualMachineInstance") - allPresets, err := listPresets(c.vmPresetInformer, vm.GetNamespace()) - if err != nil { - logger.Object(vm).Errorf("Listing VirtualMachinePresets failed: %v", err) - return err - } + allPresets, err := listPresets(c.vmiPresetInformer, vmi.GetNamespace()) + if err != nil { + logger.Object(vmi).Errorf("Listing VirtualMachinePresets failed: %v", err) + return err + } - matchingPresets := filterPresets(allPresets, vm, c.recorder) + matchingPresets := filterPresets(allPresets, vmi, c.recorder) - if len(matchingPresets) != 0 { - success = applyPresets(vm, matchingPresets, c.recorder) - } + if len(matchingPresets) != 0 { + success = applyPresets(vmi, matchingPresets, c.recorder) + } - if !success { - logger.Object(vm).Warning("Marking VM as failed") - vm.Status.Phase = kubev1.Failed + if !success { + logger.Object(vmi).Warning("Marking VirtualMachineInstance as failed") + vmi.Status.Phase = kubev1.Failed + } else { + logger.Object(vmi).V(4).Info("Setting default values on VirtualMachine") + kubev1.SetObjectDefaults_VirtualMachineInstance(vmi) + } + } else { + logger.Object(vmi).Infof("VirtualMachineInstance is excluded from VirtualMachinePresets") } - // Even failed VM's need to be marked as initialized so they're + // Even failed VirtualMachineInstance's need to be marked as initialized so they're // not re-processed by this controller - logger.Object(vm).Info("Marking VM as initialized") - addInitializedAnnotation(vm) - _, err = c.clientset.VM(vm.Namespace).Update(vm) + logger.Object(vmi).Info("Marking VirtualMachineInstance as initialized") + addInitializedAnnotation(vmi) + _, err = c.clientset.VirtualMachineInstance(vmi.Namespace).Update(vmi) if err != nil { - logger.Object(vm).Errorf("Could not update VirtualMachine: %v", err) + logger.Object(vmi).Errorf("Could not update VirtualMachineInstance: %v", err) return err } return nil } // listPresets returns all VirtualMachinePresets by namespace -func listPresets(vmPresetInformer cache.SharedIndexInformer, namespace string) ([]kubev1.VirtualMachinePreset, error) { - indexer := vmPresetInformer.GetIndexer() +func listPresets(vmiPresetInformer cache.SharedIndexInformer, namespace string) ([]kubev1.VirtualMachineInstancePreset, error) { + indexer := vmiPresetInformer.GetIndexer() selector := labels.NewSelector() - result := []kubev1.VirtualMachinePreset{} + result := []kubev1.VirtualMachineInstancePreset{} err := cache.ListAllByNamespace(indexer, namespace, selector, func(obj interface{}) { - vm := obj.(*kubev1.VirtualMachinePreset) - result = append(result, *vm) + vmi := obj.(*kubev1.VirtualMachineInstancePreset) + result = append(result, *vmi) }) return result, err } -// filterPresets returns list of VirtualMachinePresets which match given VirtualMachine. -func filterPresets(list []kubev1.VirtualMachinePreset, vm *kubev1.VirtualMachine, recorder record.EventRecorder) []kubev1.VirtualMachinePreset { - matchingPresets := []kubev1.VirtualMachinePreset{} +// filterPresets returns list of VirtualMachinePresets which match given VirtualMachineInstance. +func filterPresets(list []kubev1.VirtualMachineInstancePreset, vmi *kubev1.VirtualMachineInstance, recorder record.EventRecorder) []kubev1.VirtualMachineInstancePreset { + matchingPresets := []kubev1.VirtualMachineInstancePreset{} logger := log.Log for _, preset := range list { selector, err := k8smetav1.LabelSelectorAsSelector(&preset.Spec.Selector) if err != nil { - // Do not return an error from this function--or the VM will be + // Do not return an error from this function--or the VirtualMachineInstance will be // re-enqueued for processing again. - recorder.Event(vm, k8sv1.EventTypeWarning, kubev1.PresetFailed.String(), fmt.Sprintf("Invalid Preset '%s': %v", preset.Name, err)) + recorder.Event(vmi, k8sv1.EventTypeWarning, kubev1.PresetFailed.String(), fmt.Sprintf("Invalid Preset '%s': %v", preset.Name, err)) logger.Object(&preset).Reason(err).Errorf("label selector conversion failed: %v", err) - } else if selector.Matches(labels.Set(vm.GetLabels())) { - logger.Object(vm).Infof("VirtualMachinePreset %s matches VirtualMachine", preset.GetName()) + } else if selector.Matches(labels.Set(vmi.GetLabels())) { + logger.Object(vmi).Infof("VirtualMachineInstancePreset %s matches VirtualMachineInstance", preset.GetName()) matchingPresets = append(matchingPresets, preset) } } return matchingPresets } -func checkMergeConflicts(presetSpec *kubev1.DomainSpec, vmSpec *kubev1.DomainSpec) error { +func checkMergeConflicts(presetSpec *kubev1.DomainPresetSpec, vmiSpec *kubev1.DomainSpec) error { errors := []error{} if len(presetSpec.Resources.Requests) > 0 { for key, presetReq := range presetSpec.Resources.Requests { - if vmReq, ok := vmSpec.Resources.Requests[key]; ok { - if presetReq != vmReq { - errors = append(errors, fmt.Errorf("spec.resources.requests[%s]: %v != %v", key, presetReq, vmReq)) + if vmiReq, ok := vmiSpec.Resources.Requests[key]; ok { + if presetReq != vmiReq { + errors = append(errors, fmt.Errorf("spec.resources.requests[%s]: %v != %v", key, presetReq, vmiReq)) } } } } - if presetSpec.CPU != nil && vmSpec.CPU != nil { - if !reflect.DeepEqual(presetSpec.CPU, vmSpec.CPU) { - errors = append(errors, fmt.Errorf("spec.cpu: %v != %v", presetSpec.CPU, vmSpec.CPU)) + if presetSpec.CPU != nil && vmiSpec.CPU != nil { + if !reflect.DeepEqual(presetSpec.CPU, vmiSpec.CPU) { + errors = append(errors, fmt.Errorf("spec.cpu: %v != %v", presetSpec.CPU, vmiSpec.CPU)) } } - if presetSpec.Firmware != nil && vmSpec.Firmware != nil { - if !reflect.DeepEqual(presetSpec.Firmware, vmSpec.Firmware) { - errors = append(errors, fmt.Errorf("spec.firmware: %v != %v", presetSpec.Firmware, vmSpec.Firmware)) + if presetSpec.Firmware != nil && vmiSpec.Firmware != nil { + if !reflect.DeepEqual(presetSpec.Firmware, vmiSpec.Firmware) { + errors = append(errors, fmt.Errorf("spec.firmware: %v != %v", presetSpec.Firmware, vmiSpec.Firmware)) } } - if presetSpec.Clock != nil && vmSpec.Clock != nil { - if !reflect.DeepEqual(presetSpec.Clock.ClockOffset, vmSpec.Clock.ClockOffset) { - errors = append(errors, fmt.Errorf("spec.clock.clockoffset: %v != %v", presetSpec.Clock.ClockOffset, vmSpec.Clock.ClockOffset)) + if presetSpec.Clock != nil && vmiSpec.Clock != nil { + if !reflect.DeepEqual(presetSpec.Clock.ClockOffset, vmiSpec.Clock.ClockOffset) { + errors = append(errors, fmt.Errorf("spec.clock.clockoffset: %v != %v", presetSpec.Clock.ClockOffset, vmiSpec.Clock.ClockOffset)) } - if presetSpec.Clock.Timer != nil && vmSpec.Clock.Timer != nil { - if !reflect.DeepEqual(presetSpec.Clock.Timer, vmSpec.Clock.Timer) { - errors = append(errors, fmt.Errorf("spec.clock.timer: %v != %v", presetSpec.Clock.Timer, vmSpec.Clock.Timer)) + if presetSpec.Clock.Timer != nil && vmiSpec.Clock.Timer != nil { + if !reflect.DeepEqual(presetSpec.Clock.Timer, vmiSpec.Clock.Timer) { + errors = append(errors, fmt.Errorf("spec.clock.timer: %v != %v", presetSpec.Clock.Timer, vmiSpec.Clock.Timer)) } } } - if presetSpec.Features != nil && vmSpec.Features != nil { - if !reflect.DeepEqual(presetSpec.Features, vmSpec.Features) { - errors = append(errors, fmt.Errorf("spec.features: %v != %v", presetSpec.Features, vmSpec.Features)) + if presetSpec.Features != nil && vmiSpec.Features != nil { + if !reflect.DeepEqual(presetSpec.Features, vmiSpec.Features) { + errors = append(errors, fmt.Errorf("spec.features: %v != %v", presetSpec.Features, vmiSpec.Features)) } } - if presetSpec.Devices.Watchdog != nil && vmSpec.Devices.Watchdog != nil { - if !reflect.DeepEqual(presetSpec.Devices.Watchdog, vmSpec.Devices.Watchdog) { - errors = append(errors, fmt.Errorf("spec.devices.watchdog: %v != %v", presetSpec.Devices.Watchdog, vmSpec.Devices.Watchdog)) + if presetSpec.Devices.Watchdog != nil && vmiSpec.Devices.Watchdog != nil { + if !reflect.DeepEqual(presetSpec.Devices.Watchdog, vmiSpec.Devices.Watchdog) { + errors = append(errors, fmt.Errorf("spec.devices.watchdog: %v != %v", presetSpec.Devices.Watchdog, vmiSpec.Devices.Watchdog)) } } @@ -245,73 +254,73 @@ func checkMergeConflicts(presetSpec *kubev1.DomainSpec, vmSpec *kubev1.DomainSpe return nil } -func mergeDomainSpec(presetSpec *kubev1.DomainSpec, vmSpec *kubev1.DomainSpec) (bool, error) { - presetConflicts := checkMergeConflicts(presetSpec, vmSpec) +func mergeDomainSpec(presetSpec *kubev1.DomainPresetSpec, vmiSpec *kubev1.DomainSpec) (bool, error) { + presetConflicts := checkMergeConflicts(presetSpec, vmiSpec) applied := false if len(presetSpec.Resources.Requests) > 0 { - if vmSpec.Resources.Requests == nil { - vmSpec.Resources.Requests = k8sv1.ResourceList{} + if vmiSpec.Resources.Requests == nil { + vmiSpec.Resources.Requests = k8sv1.ResourceList{} for key, val := range presetSpec.Resources.Requests { - vmSpec.Resources.Requests[key] = val + vmiSpec.Resources.Requests[key] = val } } - if reflect.DeepEqual(vmSpec.Resources.Requests, presetSpec.Resources.Requests) { + if reflect.DeepEqual(vmiSpec.Resources.Requests, presetSpec.Resources.Requests) { applied = true } } if presetSpec.CPU != nil { - if vmSpec.CPU == nil { - vmSpec.CPU = &kubev1.CPU{} - presetSpec.CPU.DeepCopyInto(vmSpec.CPU) + if vmiSpec.CPU == nil { + vmiSpec.CPU = &kubev1.CPU{} + presetSpec.CPU.DeepCopyInto(vmiSpec.CPU) } - if reflect.DeepEqual(vmSpec.CPU, presetSpec.CPU) { + if reflect.DeepEqual(vmiSpec.CPU, presetSpec.CPU) { applied = true } } if presetSpec.Firmware != nil { - if vmSpec.Firmware == nil { - vmSpec.Firmware = &kubev1.Firmware{} - presetSpec.Firmware.DeepCopyInto(vmSpec.Firmware) + if vmiSpec.Firmware == nil { + vmiSpec.Firmware = &kubev1.Firmware{} + presetSpec.Firmware.DeepCopyInto(vmiSpec.Firmware) } - if reflect.DeepEqual(vmSpec.Firmware, presetSpec.Firmware) { + if reflect.DeepEqual(vmiSpec.Firmware, presetSpec.Firmware) { applied = true } } if presetSpec.Clock != nil { - if vmSpec.Clock == nil { - vmSpec.Clock = &kubev1.Clock{} - vmSpec.Clock.ClockOffset = presetSpec.Clock.ClockOffset + if vmiSpec.Clock == nil { + vmiSpec.Clock = &kubev1.Clock{} + vmiSpec.Clock.ClockOffset = presetSpec.Clock.ClockOffset } - if reflect.DeepEqual(vmSpec.Clock, presetSpec.Clock) { + if reflect.DeepEqual(vmiSpec.Clock, presetSpec.Clock) { applied = true } if presetSpec.Clock.Timer != nil { - if vmSpec.Clock.Timer == nil { - vmSpec.Clock.Timer = &kubev1.Timer{} - presetSpec.Clock.Timer.DeepCopyInto(vmSpec.Clock.Timer) + if vmiSpec.Clock.Timer == nil { + vmiSpec.Clock.Timer = &kubev1.Timer{} + presetSpec.Clock.Timer.DeepCopyInto(vmiSpec.Clock.Timer) } - if reflect.DeepEqual(vmSpec.Clock.Timer, presetSpec.Clock.Timer) { + if reflect.DeepEqual(vmiSpec.Clock.Timer, presetSpec.Clock.Timer) { applied = true } } } if presetSpec.Features != nil { - if vmSpec.Features == nil { - vmSpec.Features = &kubev1.Features{} - presetSpec.Features.DeepCopyInto(vmSpec.Features) + if vmiSpec.Features == nil { + vmiSpec.Features = &kubev1.Features{} + presetSpec.Features.DeepCopyInto(vmiSpec.Features) } - if reflect.DeepEqual(vmSpec.Features, presetSpec.Features) { + if reflect.DeepEqual(vmiSpec.Features, presetSpec.Features) { applied = true } } if presetSpec.Devices.Watchdog != nil { - if vmSpec.Devices.Watchdog == nil { - vmSpec.Devices.Watchdog = &kubev1.Watchdog{} - presetSpec.Devices.Watchdog.DeepCopyInto(vmSpec.Devices.Watchdog) + if vmiSpec.Devices.Watchdog == nil { + vmiSpec.Devices.Watchdog = &kubev1.Watchdog{} + presetSpec.Devices.Watchdog.DeepCopyInto(vmiSpec.Devices.Watchdog) } - if reflect.DeepEqual(vmSpec.Devices.Watchdog, presetSpec.Devices.Watchdog) { + if reflect.DeepEqual(vmiSpec.Devices.Watchdog, presetSpec.Devices.Watchdog) { applied = true } } @@ -319,12 +328,19 @@ func mergeDomainSpec(presetSpec *kubev1.DomainSpec, vmSpec *kubev1.DomainSpec) ( } // Compare the domain of every preset to ensure they can all be applied cleanly -func checkPresetConflicts(presets []kubev1.VirtualMachinePreset) error { +func checkPresetConflicts(presets []kubev1.VirtualMachineInstancePreset) error { errors := []error{} - visitedPresets := []kubev1.VirtualMachinePreset{} + visitedPresets := []kubev1.VirtualMachineInstancePreset{} for _, preset := range presets { for _, visited := range visitedPresets { - err := checkMergeConflicts(preset.Spec.Domain, visited.Spec.Domain) + visitedDomain := &kubev1.DomainSpec{} + domainByte, _ := json.Marshal(visited.Spec.Domain) + err := json.Unmarshal(domainByte, &visitedDomain) + if err != nil { + return err + } + + err = checkMergeConflicts(preset.Spec.Domain, visitedDomain) if err != nil { errors = append(errors, fmt.Errorf("presets '%s' and '%s' conflict: %v", preset.Name, visited.Name, err)) } @@ -337,57 +353,65 @@ func checkPresetConflicts(presets []kubev1.VirtualMachinePreset) error { return nil } -func applyPresets(vm *kubev1.VirtualMachine, presets []kubev1.VirtualMachinePreset, recorder record.EventRecorder) bool { +func applyPresets(vmi *kubev1.VirtualMachineInstance, presets []kubev1.VirtualMachineInstancePreset, recorder record.EventRecorder) bool { logger := log.Log err := checkPresetConflicts(presets) if err != nil { msg := fmt.Sprintf("VirtualMachinePresets cannot be applied due to conflicts: %v", err) - recorder.Event(vm, k8sv1.EventTypeWarning, kubev1.PresetFailed.String(), msg) - logger.Object(vm).Error(msg) + recorder.Event(vmi, k8sv1.EventTypeWarning, kubev1.PresetFailed.String(), msg) + logger.Object(vmi).Error(msg) return false } for _, preset := range presets { - applied, err := mergeDomainSpec(preset.Spec.Domain, &vm.Spec.Domain) + applied, err := mergeDomainSpec(preset.Spec.Domain, &vmi.Spec.Domain) if err != nil { - msg := fmt.Sprintf("Unable to apply VirtualMachinePreset '%s': %v", preset.Name, err) + msg := fmt.Sprintf("Unable to apply VirtualMachineInstancePreset '%s': %v", preset.Name, err) if applied { - msg = fmt.Sprintf("Some settings were not applied for VirtualMachinePreset '%s': %v", preset.Name, err) + msg = fmt.Sprintf("Some settings were not applied for VirtualMachineInstancePreset '%s': %v", preset.Name, err) } - recorder.Event(vm, k8sv1.EventTypeNormal, kubev1.Override.String(), msg) - logger.Object(vm).Info(msg) + recorder.Event(vmi, k8sv1.EventTypeNormal, kubev1.Override.String(), msg) + logger.Object(vmi).Info(msg) } if applied { - annotateVM(vm, preset) + annotateVMI(vmi, preset) } } return true } // isVirtualMachineInitialized checks if this module has applied presets -func isVirtualMachineInitialized(vm *kubev1.VirtualMachine) bool { - if vm.Annotations != nil { - _, found := vm.Annotations[initializerMarking] +func isVirtualMachineInitialized(vmi *kubev1.VirtualMachineInstance) bool { + if vmi.Annotations != nil { + _, found := vmi.Annotations[initializerMarking] return found } return false } -func addInitializedAnnotation(vm *kubev1.VirtualMachine) { - if vm.Annotations == nil { - vm.Annotations = map[string]string{} +func isVmExcluded(vmi *kubev1.VirtualMachineInstance) bool { + if vmi.Annotations != nil { + excluded, ok := vmi.Annotations[exclusionMarking] + return ok && (excluded == "true") + } + return false +} + +func addInitializedAnnotation(vmi *kubev1.VirtualMachineInstance) { + if vmi.Annotations == nil { + vmi.Annotations = map[string]string{} } - vm.Annotations[initializerMarking] = kubev1.GroupVersion.String() - if !controller.HasFinalizer(vm, kubev1.VirtualMachineFinalizer) { - vm.Finalizers = append(vm.Finalizers, kubev1.VirtualMachineFinalizer) + vmi.Annotations[initializerMarking] = kubev1.GroupVersion.String() + if !controller.HasFinalizer(vmi, kubev1.VirtualMachineInstanceFinalizer) { + vmi.Finalizers = append(vmi.Finalizers, kubev1.VirtualMachineInstanceFinalizer) } } -func annotateVM(vm *kubev1.VirtualMachine, preset kubev1.VirtualMachinePreset) { - if vm.Annotations == nil { - vm.Annotations = map[string]string{} +func annotateVMI(vmi *kubev1.VirtualMachineInstance, preset kubev1.VirtualMachineInstancePreset) { + if vmi.Annotations == nil { + vmi.Annotations = map[string]string{} } annotationKey := fmt.Sprintf("virtualmachinepreset.%s/%s", kubev1.GroupName, preset.Name) - vm.Annotations[annotationKey] = kubev1.GroupVersion.String() + vmi.Annotations[annotationKey] = kubev1.GroupVersion.String() } diff --git a/vendor/kubevirt.io/kubevirt/pkg/virt-controller/watch/replicaset.go b/vendor/kubevirt.io/kubevirt/pkg/virt-controller/watch/replicaset.go index 2e8cca1c4..5fe5577c1 100644 --- a/vendor/kubevirt.io/kubevirt/pkg/virt-controller/watch/replicaset.go +++ b/vendor/kubevirt.io/kubevirt/pkg/virt-controller/watch/replicaset.go @@ -68,25 +68,25 @@ const ( SuccessfulResumedReplicaSetReason = "SuccessfulResumed" ) -func NewVMReplicaSet(vmInformer cache.SharedIndexInformer, vmRSInformer cache.SharedIndexInformer, recorder record.EventRecorder, clientset kubecli.KubevirtClient, burstReplicas uint) *VMReplicaSet { +func NewVMIReplicaSet(vmiInformer cache.SharedIndexInformer, vmiRSInformer cache.SharedIndexInformer, recorder record.EventRecorder, clientset kubecli.KubevirtClient, burstReplicas uint) *VMIReplicaSet { - c := &VMReplicaSet{ + c := &VMIReplicaSet{ Queue: workqueue.NewRateLimitingQueue(workqueue.DefaultControllerRateLimiter()), - vmInformer: vmInformer, - vmRSInformer: vmRSInformer, + vmiInformer: vmiInformer, + vmiRSInformer: vmiRSInformer, recorder: recorder, clientset: clientset, expectations: controller.NewUIDTrackingControllerExpectations(controller.NewControllerExpectations()), burstReplicas: burstReplicas, } - c.vmRSInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{ + c.vmiRSInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{ AddFunc: c.addReplicaSet, DeleteFunc: c.deleteReplicaSet, UpdateFunc: c.updateReplicaSet, }) - c.vmInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{ + c.vmiInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{ AddFunc: c.addVirtualMachine, DeleteFunc: c.deleteVirtualMachine, UpdateFunc: c.updateVirtualMachine, @@ -95,23 +95,23 @@ func NewVMReplicaSet(vmInformer cache.SharedIndexInformer, vmRSInformer cache.Sh return c } -type VMReplicaSet struct { +type VMIReplicaSet struct { clientset kubecli.KubevirtClient Queue workqueue.RateLimitingInterface - vmInformer cache.SharedIndexInformer - vmRSInformer cache.SharedIndexInformer + vmiInformer cache.SharedIndexInformer + vmiRSInformer cache.SharedIndexInformer recorder record.EventRecorder expectations *controller.UIDTrackingControllerExpectations burstReplicas uint } -func (c *VMReplicaSet) Run(threadiness int, stopCh chan struct{}) { +func (c *VMIReplicaSet) Run(threadiness int, stopCh chan struct{}) { defer controller.HandlePanic() defer c.Queue.ShutDown() - log.Log.Info("Starting VirtualMachineReplicaSet controller.") + log.Log.Info("Starting VirtualMachineInstanceReplicaSet controller.") // Wait for cache sync before we start the controller - cache.WaitForCacheSync(stopCh, c.vmInformer.HasSynced, c.vmRSInformer.HasSynced) + cache.WaitForCacheSync(stopCh, c.vmiInformer.HasSynced, c.vmiRSInformer.HasSynced) // Start the actual work for i := 0; i < threadiness; i++ { @@ -119,33 +119,33 @@ func (c *VMReplicaSet) Run(threadiness int, stopCh chan struct{}) { } <-stopCh - log.Log.Info("Stopping VirtualMachineReplicaSet controller.") + log.Log.Info("Stopping VirtualMachineInstanceReplicaSet controller.") } -func (c *VMReplicaSet) runWorker() { +func (c *VMIReplicaSet) runWorker() { for c.Execute() { } } -func (c *VMReplicaSet) Execute() bool { +func (c *VMIReplicaSet) Execute() bool { key, quit := c.Queue.Get() if quit { return false } defer c.Queue.Done(key) if err := c.execute(key.(string)); err != nil { - log.Log.Reason(err).Infof("re-enqueuing VirtualMachineReplicaSet %v", key) + log.Log.Reason(err).Infof("re-enqueuing VirtualMachineInstanceReplicaSet %v", key) c.Queue.AddRateLimited(key) } else { - log.Log.V(4).Infof("processed VirtualMachineReplicaSet %v", key) + log.Log.V(4).Infof("processed VirtualMachineInstanceReplicaSet %v", key) c.Queue.Forget(key) } return true } -func (c *VMReplicaSet) execute(key string) error { +func (c *VMIReplicaSet) execute(key string) error { - obj, exists, err := c.vmRSInformer.GetStore().GetByKey(key) + obj, exists, err := c.vmiRSInformer.GetStore().GetByKey(key) if err != nil { return nil } @@ -154,7 +154,7 @@ func (c *VMReplicaSet) execute(key string) error { c.expectations.DeleteExpectations(key) return nil } - rs := obj.(*virtv1.VirtualMachineReplicaSet) + rs := obj.(*virtv1.VirtualMachineInstanceReplicaSet) logger := log.Log.Object(rs) @@ -177,16 +177,14 @@ func (c *VMReplicaSet) execute(key string) error { needsSync := c.expectations.SatisfiedExpectations(key) - // get all potentially interesting VMs from the cache - vms, err := c.listVMsFromNamespace(rs.ObjectMeta.Namespace) + // get all potentially interesting VMIs from the cache + vmis, err := c.listVMIsFromNamespace(rs.ObjectMeta.Namespace) if err != nil { - logger.Reason(err).Error("Failed to fetch vms for namespace from cache.") + logger.Reason(err).Error("Failed to fetch vmis for namespace from cache.") return err } - vms = c.filterActiveVMs(vms) - // If any adoptions are attempted, we should first recheck for deletion with // an uncached quorum read sometime after listing VirtualMachines (see kubernetes/kubernetes#42639). canAdoptFunc := controller.RecheckDeletionTimestamp(func() (v1.Object, error) { @@ -199,30 +197,35 @@ func (c *VMReplicaSet) execute(key string) error { } return fresh, nil }) - cm := controller.NewVirtualMachineControllerRefManager(controller.RealVirtualMachineControl{Clientset: c.clientset}, rs, selector, virtv1.VMReplicaSetGroupVersionKind, canAdoptFunc) - vms, err = cm.ClaimVirtualMachines(vms) + cm := controller.NewVirtualMachineControllerRefManager(controller.RealVirtualMachineControl{Clientset: c.clientset}, rs, selector, virtv1.VirtualMachineInstanceReplicaSetGroupVersionKind, canAdoptFunc) + vmis, err = cm.ClaimVirtualMachines(vmis) if err != nil { return err } + finishedVmis := c.filterFinishedVMIs(vmis) + activeVmis := c.filterActiveVMIs(vmis) + var scaleErr error // Scale up or down, if all expected creates and deletes were report by the listener if needsSync && !rs.Spec.Paused && rs.ObjectMeta.DeletionTimestamp == nil { - scaleErr = c.scale(rs, vms) + scaleErr = c.scale(rs, activeVmis) + if len(finishedVmis) > 0 && scaleErr == nil { + scaleErr = c.cleanFinishedVmis(rs, finishedVmis) + } } - - // If the controller is going to be deleted and the orphan finalizer is the next one, release the VMs. Don't update the status + // If the controller is going to be deleted and the orphan finalizer is the next one, release the VMIs. Don't update the status // TODO: Workaround for https://github.com/kubernetes/kubernetes/issues/56348, remove it once it is fixed if rs.ObjectMeta.DeletionTimestamp != nil && controller.HasFinalizer(rs, v1.FinalizerOrphanDependents) { - return c.orphan(cm, rs, vms) + return c.orphan(cm, rs, activeVmis) } if scaleErr != nil { logger.Reason(err).Error("Scaling the replicaset failed.") } - err = c.updateStatus(rs.DeepCopy(), vms, scaleErr) + err = c.updateStatus(rs.DeepCopy(), activeVmis, scaleErr) if err != nil { logger.Reason(err).Error("Updating the replicaset status failed.") } @@ -230,23 +233,23 @@ func (c *VMReplicaSet) execute(key string) error { return err } -// orphan removes the owner reference of all VMs which are owned by the controller instance. +// orphan removes the owner reference of all VMIs which are owned by the controller instance. // Workaround for https://github.com/kubernetes/kubernetes/issues/56348 to make no-cascading deletes possible // We don't have to remove the finalizer. This part of the gc is not affected by the mentioned bug -func (c *VMReplicaSet) orphan(cm *controller.VirtualMachineControllerRefManager, rs *virtv1.VirtualMachineReplicaSet, vms []*virtv1.VirtualMachine) error { +func (c *VMIReplicaSet) orphan(cm *controller.VirtualMachineControllerRefManager, rs *virtv1.VirtualMachineInstanceReplicaSet, vmis []*virtv1.VirtualMachineInstance) error { var wg sync.WaitGroup - errChan := make(chan error, len(vms)) - wg.Add(len(vms)) + errChan := make(chan error, len(vmis)) + wg.Add(len(vmis)) - for _, vm := range vms { - go func(vm *virtv1.VirtualMachine) { + for _, vmi := range vmis { + go func(vmi *virtv1.VirtualMachineInstance) { defer wg.Done() - err := cm.ReleaseVirtualMachine(vm) + err := cm.ReleaseVirtualMachine(vmi) if err != nil { errChan <- err } - }(vm) + }(vmi) } wg.Wait() select { @@ -257,9 +260,10 @@ func (c *VMReplicaSet) orphan(cm *controller.VirtualMachineControllerRefManager, return nil } -func (c *VMReplicaSet) scale(rs *virtv1.VirtualMachineReplicaSet, vms []*virtv1.VirtualMachine) error { +func (c *VMIReplicaSet) scale(rs *virtv1.VirtualMachineInstanceReplicaSet, vmis []*virtv1.VirtualMachineInstance) error { + log.Log.V(4).Object(rs).Info("Scale") + diff := c.calcDiff(rs, vmis) - diff := c.calcDiff(rs, vms) rsKey, err := controller.KeyFunc(rs) if err != nil { log.Log.Object(rs).Reason(err).Error("Failed to extract rsKey from replicaset.") @@ -280,15 +284,16 @@ func (c *VMReplicaSet) scale(rs *virtv1.VirtualMachineReplicaSet, vms []*virtv1. wg.Add(abs(diff)) if diff > 0 { - // We have to delete VMs, use a very simple selection strategy for now - // TODO: Possible deletion order: not yet running VMs < migrating VMs < other - deleteCandidates := vms[0:diff] + log.Log.V(4).Object(rs).Info("Delete excess VM's") + // We have to delete VMIs, use a very simple selection strategy for now + // TODO: Possible deletion order: not yet running VMIs < migrating VMIs < other + deleteCandidates := vmis[0:diff] c.expectations.ExpectDeletions(rsKey, controller.VirtualMachineKeys(deleteCandidates)) for i := 0; i < diff; i++ { go func(idx int) { defer wg.Done() - deleteCandidate := vms[idx] - err := c.clientset.VM(rs.ObjectMeta.Namespace).Delete(deleteCandidate.ObjectMeta.Name, &v1.DeleteOptions{}) + deleteCandidate := vmis[idx] + err := c.clientset.VirtualMachineInstance(rs.ObjectMeta.Namespace).Delete(deleteCandidate.ObjectMeta.Name, &v1.DeleteOptions{}) // Don't log an error if it is already deleted if err != nil { // We can't observe a delete if it was not accepted by the server @@ -302,28 +307,29 @@ func (c *VMReplicaSet) scale(rs *virtv1.VirtualMachineReplicaSet, vms []*virtv1. } } else if diff < 0 { - // We have to create VMs + log.Log.V(4).Object(rs).Info("Add missing VM's") + // We have to create VMIs c.expectations.ExpectCreations(rsKey, abs(diff)) basename := c.getVirtualMachineBaseName(rs) for i := diff; i < 0; i++ { go func() { defer wg.Done() - vm := virtv1.NewVMReferenceFromNameWithNS(rs.ObjectMeta.Namespace, "") - vm.ObjectMeta = rs.Spec.Template.ObjectMeta - vm.ObjectMeta.Name = "" - vm.ObjectMeta.GenerateName = basename - vm.Spec = rs.Spec.Template.Spec - // TODO check if vm labels exist, and when make sure that they match. For now just override them - vm.ObjectMeta.Labels = rs.Spec.Template.ObjectMeta.Labels - vm.ObjectMeta.OwnerReferences = []v1.OwnerReference{OwnerRef(rs)} - vm, err := c.clientset.VM(rs.ObjectMeta.Namespace).Create(vm) + vmi := virtv1.NewVMIReferenceFromNameWithNS(rs.ObjectMeta.Namespace, "") + vmi.ObjectMeta = rs.Spec.Template.ObjectMeta + vmi.ObjectMeta.Name = "" + vmi.ObjectMeta.GenerateName = basename + vmi.Spec = rs.Spec.Template.Spec + // TODO check if vmi labels exist, and when make sure that they match. For now just override them + vmi.ObjectMeta.Labels = rs.Spec.Template.ObjectMeta.Labels + vmi.ObjectMeta.OwnerReferences = []v1.OwnerReference{OwnerRef(rs)} + vmi, err := c.clientset.VirtualMachineInstance(rs.ObjectMeta.Namespace).Create(vmi) if err != nil { c.expectations.CreationObserved(rsKey) c.recorder.Eventf(rs, k8score.EventTypeWarning, FailedCreateVirtualMachineReason, "Error creating virtual machine: %v", err) errChan <- err return } - c.recorder.Eventf(rs, k8score.EventTypeNormal, SuccessfulCreateVirtualMachineReason, "Created virtual machine: %v", vm.ObjectMeta.Name) + c.recorder.Eventf(rs, k8score.EventTypeNormal, SuccessfulCreateVirtualMachineReason, "Created virtual machine: %v", vmi.ObjectMeta.Name) }() } } @@ -338,62 +344,69 @@ func (c *VMReplicaSet) scale(rs *virtv1.VirtualMachineReplicaSet, vms []*virtv1. return nil } -// filterActiveVMs takes a list of VMs and returns all VMs which are not in a final state -func (c *VMReplicaSet) filterActiveVMs(vms []*virtv1.VirtualMachine) []*virtv1.VirtualMachine { - return filter(vms, func(vm *virtv1.VirtualMachine) bool { - return !vm.IsFinal() +// filterActiveVMIs takes a list of VMIs and returns all VMIs which are not in a final state and not terminating +func (c *VMIReplicaSet) filterActiveVMIs(vmis []*virtv1.VirtualMachineInstance) []*virtv1.VirtualMachineInstance { + return filter(vmis, func(vmi *virtv1.VirtualMachineInstance) bool { + return !vmi.IsFinal() && vmi.DeletionTimestamp == nil + }) +} + +// filterReadyVMIs takes a list of VMIs and returns all VMIs which are in ready state. +func (c *VMIReplicaSet) filterReadyVMIs(vmis []*virtv1.VirtualMachineInstance) []*virtv1.VirtualMachineInstance { + return filter(vmis, func(vmi *virtv1.VirtualMachineInstance) bool { + return vmi.IsReady() }) } -// filterReadyVMs takes a list of VMs and returns all VMs which are in ready state. -func (c *VMReplicaSet) filterReadyVMs(vms []*virtv1.VirtualMachine) []*virtv1.VirtualMachine { - return filter(vms, func(vm *virtv1.VirtualMachine) bool { - return vm.IsReady() +// filterFinishedVMIs takes a list of VMIs and returns all VMIs which are in final state. +func (c *VMIReplicaSet) filterFinishedVMIs(vmis []*virtv1.VirtualMachineInstance) []*virtv1.VirtualMachineInstance { + return filter(vmis, func(vmi *virtv1.VirtualMachineInstance) bool { + return vmi.IsFinal() && vmi.DeletionTimestamp == nil }) } -func filter(vms []*virtv1.VirtualMachine, f func(vm *virtv1.VirtualMachine) bool) []*virtv1.VirtualMachine { - filtered := []*virtv1.VirtualMachine{} - for _, vm := range vms { - if f(vm) { - filtered = append(filtered, vm) +func filter(vmis []*virtv1.VirtualMachineInstance, f func(vmi *virtv1.VirtualMachineInstance) bool) []*virtv1.VirtualMachineInstance { + filtered := []*virtv1.VirtualMachineInstance{} + for _, vmi := range vmis { + if f(vmi) { + filtered = append(filtered, vmi) } } return filtered } -// listVMsFromNamespace takes a namespace and returns all VMs from the VM cache which run in this namespace -func (c *VMReplicaSet) listVMsFromNamespace(namespace string) ([]*virtv1.VirtualMachine, error) { - objs, err := c.vmInformer.GetIndexer().ByIndex(cache.NamespaceIndex, namespace) +// listVMIsFromNamespace takes a namespace and returns all VMIs from the VirtualMachineInstance cache which run in this namespace +func (c *VMIReplicaSet) listVMIsFromNamespace(namespace string) ([]*virtv1.VirtualMachineInstance, error) { + objs, err := c.vmiInformer.GetIndexer().ByIndex(cache.NamespaceIndex, namespace) if err != nil { return nil, err } - vms := []*virtv1.VirtualMachine{} + vmis := []*virtv1.VirtualMachineInstance{} for _, obj := range objs { - vms = append(vms, obj.(*virtv1.VirtualMachine)) + vmis = append(vmis, obj.(*virtv1.VirtualMachineInstance)) } - return vms, nil + return vmis, nil } -// listControllerFromNamespace takes a namespace and returns all VMReplicaSets from the ReplicaSet cache which run in this namespace -func (c *VMReplicaSet) listControllerFromNamespace(namespace string) ([]*virtv1.VirtualMachineReplicaSet, error) { - objs, err := c.vmRSInformer.GetIndexer().ByIndex(cache.NamespaceIndex, namespace) +// listControllerFromNamespace takes a namespace and returns all VMIReplicaSets from the ReplicaSet cache which run in this namespace +func (c *VMIReplicaSet) listControllerFromNamespace(namespace string) ([]*virtv1.VirtualMachineInstanceReplicaSet, error) { + objs, err := c.vmiRSInformer.GetIndexer().ByIndex(cache.NamespaceIndex, namespace) if err != nil { return nil, err } - replicaSets := []*virtv1.VirtualMachineReplicaSet{} + replicaSets := []*virtv1.VirtualMachineInstanceReplicaSet{} for _, obj := range objs { - rs := obj.(*virtv1.VirtualMachineReplicaSet) + rs := obj.(*virtv1.VirtualMachineInstanceReplicaSet) replicaSets = append(replicaSets, rs) } return replicaSets, nil } -// getMatchingController returns the first VMReplicaSet which matches the labels of the VM from the listener cache. +// getMatchingController returns the first VMIReplicaSet which matches the labels of the VirtualMachineInstance from the listener cache. // If there are no matching controllers, a NotFound error is returned. -func (c *VMReplicaSet) getMatchingControllers(vm *virtv1.VirtualMachine) (rss []*virtv1.VirtualMachineReplicaSet) { +func (c *VMIReplicaSet) getMatchingControllers(vmi *virtv1.VirtualMachineInstance) (rss []*virtv1.VirtualMachineInstanceReplicaSet) { logger := log.Log - controllers, err := c.listControllerFromNamespace(vm.ObjectMeta.Namespace) + controllers, err := c.listControllerFromNamespace(vmi.ObjectMeta.Namespace) if err != nil { return nil } @@ -407,7 +420,7 @@ func (c *VMReplicaSet) getMatchingControllers(vm *virtv1.VirtualMachine) (rss [] continue } - if selector.Matches(labels.Set(vm.ObjectMeta.Labels)) { + if selector.Matches(labels.Set(vmi.ObjectMeta.Labels)) { rss = append(rss, rs) } @@ -415,20 +428,20 @@ func (c *VMReplicaSet) getMatchingControllers(vm *virtv1.VirtualMachine) (rss [] return rss } -// When a vm is created, enqueue the replica set that manages it and update its expectations. -func (c *VMReplicaSet) addVirtualMachine(obj interface{}) { - vm := obj.(*virtv1.VirtualMachine) +// When a vmi is created, enqueue the replica set that manages it and update its expectations. +func (c *VMIReplicaSet) addVirtualMachine(obj interface{}) { + vmi := obj.(*virtv1.VirtualMachineInstance) - if vm.DeletionTimestamp != nil { - // on a restart of the controller manager, it's possible a new vm shows up in a state that - // is already pending deletion. Prevent the vm from being a creation observation. - c.deleteVirtualMachine(vm) + if vmi.DeletionTimestamp != nil { + // on a restart of the controller manager, it's possible a new vmi shows up in a state that + // is already pending deletion. Prevent the vmi from being a creation observation. + c.deleteVirtualMachine(vmi) return } // If it has a ControllerRef, that's all that matters. - if controllerRef := controller.GetControllerOf(vm); controllerRef != nil { - rs := c.resolveControllerRef(vm.Namespace, controllerRef) + if controllerRef := controller.GetControllerOf(vmi); controllerRef != nil { + rs := c.resolveControllerRef(vmi.Namespace, controllerRef) if rs == nil { return } @@ -436,7 +449,7 @@ func (c *VMReplicaSet) addVirtualMachine(obj interface{}) { if err != nil { return } - log.Log.V(4).Object(vm).Infof("VirtualMachine created") + log.Log.V(4).Object(vmi).Infof("VirtualMachineInstance created") c.expectations.CreationObserved(rsKey) c.enqueueReplicaSet(rs) return @@ -446,62 +459,62 @@ func (c *VMReplicaSet) addVirtualMachine(obj interface{}) { // them to see if anyone wants to adopt it. // DO NOT observe creation because no controller should be waiting for an // orphan. - rss := c.getMatchingControllers(vm) + rss := c.getMatchingControllers(vmi) if len(rss) == 0 { return } - log.Log.V(4).Object(vm).Infof("Orphan VirtualMachine created") + log.Log.V(4).Object(vmi).Infof("Orphan VirtualMachineInstance created") for _, rs := range rss { c.enqueueReplicaSet(rs) } } -// When a vm is updated, figure out what replica set/s manage it and wake them -// up. If the labels of the vm have changed we need to awaken both the old -// and new replica set. old and cur must be *v1.VirtualMachine types. -func (c *VMReplicaSet) updateVirtualMachine(old, cur interface{}) { - curVM := cur.(*virtv1.VirtualMachine) - oldVM := old.(*virtv1.VirtualMachine) - if curVM.ResourceVersion == oldVM.ResourceVersion { - // Periodic resync will send update events for all known vms. - // Two different versions of the same vm will always have different RVs. +// When a vmi is updated, figure out what replica set/s manage it and wake them +// up. If the labels of the vmi have changed we need to awaken both the old +// and new replica set. old and cur must be *v1.VirtualMachineInstance types. +func (c *VMIReplicaSet) updateVirtualMachine(old, cur interface{}) { + curVMI := cur.(*virtv1.VirtualMachineInstance) + oldVMI := old.(*virtv1.VirtualMachineInstance) + if curVMI.ResourceVersion == oldVMI.ResourceVersion { + // Periodic resync will send update events for all known vmis. + // Two different versions of the same vmi will always have different RVs. return } - labelChanged := !reflect.DeepEqual(curVM.Labels, oldVM.Labels) - if curVM.DeletionTimestamp != nil { - // when a vm is deleted gracefully it's deletion timestamp is first modified to reflect a grace period, + labelChanged := !reflect.DeepEqual(curVMI.Labels, oldVMI.Labels) + if curVMI.DeletionTimestamp != nil { + // when a vmi is deleted gracefully it's deletion timestamp is first modified to reflect a grace period, // and after such time has passed, the virt-handler actually deletes it from the store. We receive an update // for modification of the deletion timestamp and expect an rs to create more replicas asap, not wait - // until the virt-handler actually deletes the vm. This is different from the Phase of a vm changing, because + // until the virt-handler actually deletes the vmi. This is different from the Phase of a vmi changing, because // an rs never initiates a phase change, and so is never asleep waiting for the same. - c.deleteVirtualMachine(curVM) + c.deleteVirtualMachine(curVMI) if labelChanged { - // we don't need to check the oldVM.DeletionTimestamp because DeletionTimestamp cannot be unset. - c.deleteVirtualMachine(oldVM) + // we don't need to check the oldVMI.DeletionTimestamp because DeletionTimestamp cannot be unset. + c.deleteVirtualMachine(oldVMI) } return } - curControllerRef := controller.GetControllerOf(curVM) - oldControllerRef := controller.GetControllerOf(oldVM) + curControllerRef := controller.GetControllerOf(curVMI) + oldControllerRef := controller.GetControllerOf(oldVMI) controllerRefChanged := !reflect.DeepEqual(curControllerRef, oldControllerRef) if controllerRefChanged && oldControllerRef != nil { // The ControllerRef was changed. Sync the old controller, if any. - if rs := c.resolveControllerRef(oldVM.Namespace, oldControllerRef); rs != nil { + if rs := c.resolveControllerRef(oldVMI.Namespace, oldControllerRef); rs != nil { c.enqueueReplicaSet(rs) } } // If it has a ControllerRef, that's all that matters. if curControllerRef != nil { - rs := c.resolveControllerRef(curVM.Namespace, curControllerRef) + rs := c.resolveControllerRef(curVMI.Namespace, curControllerRef) if rs == nil { return } - log.Log.V(4).Object(curVM).Infof("VirtualMachine updated") + log.Log.V(4).Object(curVMI).Infof("VirtualMachineInstance updated") c.enqueueReplicaSet(rs) - // TODO: MinReadySeconds in the VM will generate an Available condition to be added in + // TODO: MinReadySeconds in the VirtualMachineInstance will generate an Available condition to be added in // Update once we support the available conect on the rs return } @@ -509,25 +522,25 @@ func (c *VMReplicaSet) updateVirtualMachine(old, cur interface{}) { // Otherwise, it's an orphan. If anything changed, sync matching controllers // to see if anyone wants to adopt it now. if labelChanged || controllerRefChanged { - rss := c.getMatchingControllers(curVM) + rss := c.getMatchingControllers(curVMI) if len(rss) == 0 { return } - log.Log.V(4).Object(curVM).Infof("Orphan VirtualMachine updated") + log.Log.V(4).Object(curVMI).Infof("Orphan VirtualMachineInstance updated") for _, rs := range rss { c.enqueueReplicaSet(rs) } } } -// When a vm is deleted, enqueue the replica set that manages the vm and update its expectations. -// obj could be an *v1.VirtualMachine, or a DeletionFinalStateUnknown marker item. -func (c *VMReplicaSet) deleteVirtualMachine(obj interface{}) { - vm, ok := obj.(*virtv1.VirtualMachine) +// When a vmi is deleted, enqueue the replica set that manages the vmi and update its expectations. +// obj could be an *v1.VirtualMachineInstance, or a DeletionFinalStateUnknown marker item. +func (c *VMIReplicaSet) deleteVirtualMachine(obj interface{}) { + vmi, ok := obj.(*virtv1.VirtualMachineInstance) - // When a delete is dropped, the relist will notice a vm in the store not + // When a delete is dropped, the relist will notice a vmi in the store not // in the list, leading to the insertion of a tombstone object which contains - // the deleted key/value. Note that this value might be stale. If the vm + // the deleted key/value. Note that this value might be stale. If the vmi // changed labels the new ReplicaSet will not be woken up till the periodic resync. if !ok { tombstone, ok := obj.(cache.DeletedFinalStateUnknown) @@ -535,19 +548,19 @@ func (c *VMReplicaSet) deleteVirtualMachine(obj interface{}) { log.Log.Reason(fmt.Errorf("couldn't get object from tombstone %+v", obj)).Error("Failed to process delete notification") return } - vm, ok = tombstone.Obj.(*virtv1.VirtualMachine) + vmi, ok = tombstone.Obj.(*virtv1.VirtualMachineInstance) if !ok { - log.Log.Reason(fmt.Errorf("tombstone contained object that is not a vm %#v", obj)).Error("Failed to process delete notification") + log.Log.Reason(fmt.Errorf("tombstone contained object that is not a vmi %#v", obj)).Error("Failed to process delete notification") return } } - controllerRef := controller.GetControllerOf(vm) + controllerRef := controller.GetControllerOf(vmi) if controllerRef == nil { // No controller should care about orphans being deleted. return } - rs := c.resolveControllerRef(vm.Namespace, controllerRef) + rs := c.resolveControllerRef(vmi.Namespace, controllerRef) if rs == nil { return } @@ -555,25 +568,25 @@ func (c *VMReplicaSet) deleteVirtualMachine(obj interface{}) { if err != nil { return } - c.expectations.DeletionObserved(rsKey, controller.VirtualMachineKey(vm)) + c.expectations.DeletionObserved(rsKey, controller.VirtualMachineKey(vmi)) c.enqueueReplicaSet(rs) } -func (c *VMReplicaSet) addReplicaSet(obj interface{}) { +func (c *VMIReplicaSet) addReplicaSet(obj interface{}) { c.enqueueReplicaSet(obj) } -func (c *VMReplicaSet) deleteReplicaSet(obj interface{}) { +func (c *VMIReplicaSet) deleteReplicaSet(obj interface{}) { c.enqueueReplicaSet(obj) } -func (c *VMReplicaSet) updateReplicaSet(old, curr interface{}) { +func (c *VMIReplicaSet) updateReplicaSet(old, curr interface{}) { c.enqueueReplicaSet(curr) } -func (c *VMReplicaSet) enqueueReplicaSet(obj interface{}) { +func (c *VMIReplicaSet) enqueueReplicaSet(obj interface{}) { logger := log.Log - rs := obj.(*virtv1.VirtualMachineReplicaSet) + rs := obj.(*virtv1.VirtualMachineInstanceReplicaSet) key, err := controller.KeyFunc(rs) if err != nil { logger.Object(rs).Reason(err).Error("Failed to extract rsKey from replicaset.") @@ -611,7 +624,7 @@ func limit(x int, burstReplicas uint) int { return min(x, replicas) } -func (c *VMReplicaSet) hasCondition(rs *virtv1.VirtualMachineReplicaSet, cond virtv1.VMReplicaSetConditionType) bool { +func (c *VMIReplicaSet) hasCondition(rs *virtv1.VirtualMachineInstanceReplicaSet, cond virtv1.VirtualMachineInstanceReplicaSetConditionType) bool { for _, c := range rs.Status.Conditions { if c.Type == cond { return true @@ -620,8 +633,8 @@ func (c *VMReplicaSet) hasCondition(rs *virtv1.VirtualMachineReplicaSet, cond vi return false } -func (c *VMReplicaSet) removeCondition(rs *virtv1.VirtualMachineReplicaSet, cond virtv1.VMReplicaSetConditionType) { - var conds []virtv1.VMReplicaSetCondition +func (c *VMIReplicaSet) removeCondition(rs *virtv1.VirtualMachineInstanceReplicaSet, cond virtv1.VirtualMachineInstanceReplicaSetConditionType) { + var conds []virtv1.VirtualMachineInstanceReplicaSetCondition for _, c := range rs.Status.Conditions { if c.Type == cond { continue @@ -631,27 +644,25 @@ func (c *VMReplicaSet) removeCondition(rs *virtv1.VirtualMachineReplicaSet, cond rs.Status.Conditions = conds } -func (c *VMReplicaSet) updateStatus(rs *virtv1.VirtualMachineReplicaSet, vms []*virtv1.VirtualMachine, scaleErr error) error { - - diff := c.calcDiff(rs, vms) - - readyReplicas := int32(len(c.filterReadyVMs(vms))) +func (c *VMIReplicaSet) updateStatus(rs *virtv1.VirtualMachineInstanceReplicaSet, vmis []*virtv1.VirtualMachineInstance, scaleErr error) error { + diff := c.calcDiff(rs, vmis) + readyReplicas := int32(len(c.filterReadyVMIs(vmis))) // check if we have reached the equilibrium - statesMatch := int32(len(vms)) == rs.Status.Replicas && readyReplicas == rs.Status.ReadyReplicas + statesMatch := int32(len(vmis)) == rs.Status.Replicas && readyReplicas == rs.Status.ReadyReplicas - // check if we need to update because of appeared or disappeard errors - errorsMatch := (scaleErr != nil) == c.hasCondition(rs, virtv1.VMReplicaSetReplicaFailure) + // check if we need to update because of appeared or disappeared errors + errorsMatch := (scaleErr != nil) == c.hasCondition(rs, virtv1.VirtualMachineInstanceReplicaSetReplicaFailure) // check if we need to update because pause was modified - pausedMatch := rs.Spec.Paused == c.hasCondition(rs, virtv1.VMReplicaSetReplicaPaused) + pausedMatch := rs.Spec.Paused == c.hasCondition(rs, virtv1.VirtualMachineInstanceReplicaSetReplicaPaused) // in case the replica count matches and the scaleErr and the error condition equal, don't update if statesMatch && errorsMatch && pausedMatch { return nil } - rs.Status.Replicas = int32(len(vms)) + rs.Status.Replicas = int32(len(vmis)) rs.Status.ReadyReplicas = readyReplicas // Add/Remove Paused condition @@ -677,17 +688,17 @@ func (c *VMReplicaSet) updateStatus(rs *virtv1.VirtualMachineReplicaSet, vms []* return nil } -func (c *VMReplicaSet) calcDiff(rs *virtv1.VirtualMachineReplicaSet, vms []*virtv1.VirtualMachine) int { +func (c *VMIReplicaSet) calcDiff(rs *virtv1.VirtualMachineInstanceReplicaSet, vmis []*virtv1.VirtualMachineInstance) int { // TODO default this on the aggregated api server wantedReplicas := int32(1) if rs.Spec.Replicas != nil { wantedReplicas = *rs.Spec.Replicas } - return len(vms) - int(wantedReplicas) + return len(vmis) - int(wantedReplicas) } -func (c *VMReplicaSet) getVirtualMachineBaseName(replicaset *virtv1.VirtualMachineReplicaSet) string { +func (c *VMIReplicaSet) getVirtualMachineBaseName(replicaset *virtv1.VirtualMachineInstanceReplicaSet) string { // TODO defaulting should make sure that the right field is set, instead of doing this if len(replicaset.Spec.Template.ObjectMeta.Name) > 0 { @@ -699,24 +710,24 @@ func (c *VMReplicaSet) getVirtualMachineBaseName(replicaset *virtv1.VirtualMachi return replicaset.ObjectMeta.Name } -func (c *VMReplicaSet) checkPaused(rs *virtv1.VirtualMachineReplicaSet) { +func (c *VMIReplicaSet) checkPaused(rs *virtv1.VirtualMachineInstanceReplicaSet) { - if rs.Spec.Paused == true && !c.hasCondition(rs, virtv1.VMReplicaSetReplicaPaused) { + if rs.Spec.Paused == true && !c.hasCondition(rs, virtv1.VirtualMachineInstanceReplicaSetReplicaPaused) { - rs.Status.Conditions = append(rs.Status.Conditions, virtv1.VMReplicaSetCondition{ - Type: virtv1.VMReplicaSetReplicaPaused, + rs.Status.Conditions = append(rs.Status.Conditions, virtv1.VirtualMachineInstanceReplicaSetCondition{ + Type: virtv1.VirtualMachineInstanceReplicaSetReplicaPaused, Reason: "Paused", Message: "Controller got paused", LastTransitionTime: v1.Now(), Status: k8score.ConditionTrue, }) - } else if rs.Spec.Paused == false && c.hasCondition(rs, virtv1.VMReplicaSetReplicaPaused) { - c.removeCondition(rs, virtv1.VMReplicaSetReplicaPaused) + } else if rs.Spec.Paused == false && c.hasCondition(rs, virtv1.VirtualMachineInstanceReplicaSetReplicaPaused) { + c.removeCondition(rs, virtv1.VirtualMachineInstanceReplicaSetReplicaPaused) } } -func (c *VMReplicaSet) checkFailure(rs *virtv1.VirtualMachineReplicaSet, diff int, scaleErr error) { - if scaleErr != nil && !c.hasCondition(rs, virtv1.VMReplicaSetReplicaFailure) { +func (c *VMIReplicaSet) checkFailure(rs *virtv1.VirtualMachineInstanceReplicaSet, diff int, scaleErr error) { + if scaleErr != nil && !c.hasCondition(rs, virtv1.VirtualMachineInstanceReplicaSetReplicaFailure) { var reason string if diff < 0 { reason = "FailedCreate" @@ -724,22 +735,22 @@ func (c *VMReplicaSet) checkFailure(rs *virtv1.VirtualMachineReplicaSet, diff in reason = "FailedDelete" } - rs.Status.Conditions = append(rs.Status.Conditions, virtv1.VMReplicaSetCondition{ - Type: virtv1.VMReplicaSetReplicaFailure, + rs.Status.Conditions = append(rs.Status.Conditions, virtv1.VirtualMachineInstanceReplicaSetCondition{ + Type: virtv1.VirtualMachineInstanceReplicaSetReplicaFailure, Reason: reason, Message: scaleErr.Error(), LastTransitionTime: v1.Now(), Status: k8score.ConditionTrue, }) - } else if scaleErr == nil && c.hasCondition(rs, virtv1.VMReplicaSetReplicaFailure) { - c.removeCondition(rs, virtv1.VMReplicaSetReplicaFailure) + } else if scaleErr == nil && c.hasCondition(rs, virtv1.VirtualMachineInstanceReplicaSetReplicaFailure) { + c.removeCondition(rs, virtv1.VirtualMachineInstanceReplicaSetReplicaFailure) } } -func OwnerRef(rs *virtv1.VirtualMachineReplicaSet) v1.OwnerReference { +func OwnerRef(rs *virtv1.VirtualMachineInstanceReplicaSet) v1.OwnerReference { t := true - gvk := virtv1.VMReplicaSetGroupVersionKind + gvk := virtv1.VirtualMachineInstanceReplicaSetGroupVersionKind return v1.OwnerReference{ APIVersion: gvk.GroupVersion().String(), Kind: gvk.Kind, @@ -753,13 +764,13 @@ func OwnerRef(rs *virtv1.VirtualMachineReplicaSet) v1.OwnerReference { // resolveControllerRef returns the controller referenced by a ControllerRef, // or nil if the ControllerRef could not be resolved to a matching controller // of the correct Kind. -func (c *VMReplicaSet) resolveControllerRef(namespace string, controllerRef *v1.OwnerReference) *virtv1.VirtualMachineReplicaSet { +func (c *VMIReplicaSet) resolveControllerRef(namespace string, controllerRef *v1.OwnerReference) *virtv1.VirtualMachineInstanceReplicaSet { // We can't look up by UID, so look up by Name and then verify UID. // Don't even try to look up by Name if it's the wrong Kind. - if controllerRef.Kind != virtv1.VMReplicaSetGroupVersionKind.Kind { + if controllerRef.Kind != virtv1.VirtualMachineInstanceReplicaSetGroupVersionKind.Kind { return nil } - rs, exists, err := c.vmRSInformer.GetStore().GetByKey(namespace + "/" + controllerRef.Name) + rs, exists, err := c.vmiRSInformer.GetStore().GetByKey(namespace + "/" + controllerRef.Name) if err != nil { return nil } @@ -767,10 +778,55 @@ func (c *VMReplicaSet) resolveControllerRef(namespace string, controllerRef *v1. return nil } - if rs.(*virtv1.VirtualMachineReplicaSet).UID != controllerRef.UID { + if rs.(*virtv1.VirtualMachineInstanceReplicaSet).UID != controllerRef.UID { // The controller we found with this Name is not the same one that the // ControllerRef points to. return nil } - return rs.(*virtv1.VirtualMachineReplicaSet) + return rs.(*virtv1.VirtualMachineInstanceReplicaSet) +} + +func (c *VMIReplicaSet) cleanFinishedVmis(rs *virtv1.VirtualMachineInstanceReplicaSet, vmis []*virtv1.VirtualMachineInstance) error { + rsKey, err := controller.KeyFunc(rs) + if err != nil { + log.Log.Object(rs).Reason(err).Error("Failed to extract rsKey from replicaset.") + return nil + } + + diff := limit(len(vmis), c.burstReplicas) + + // Every delete request can fail, give the channel enough room, to not block the go routines + errChan := make(chan error, abs(diff)) + + var wg sync.WaitGroup + wg.Add(abs(diff)) + + log.Log.V(4).Object(rs).Info("Delete finished VM's") + deleteCandidates := vmis[0:diff] + c.expectations.ExpectDeletions(rsKey, controller.VirtualMachineKeys(deleteCandidates)) + for i := 0; i < diff; i++ { + go func(idx int) { + defer wg.Done() + deleteCandidate := vmis[idx] + err := c.clientset.VirtualMachineInstance(rs.ObjectMeta.Namespace).Delete(deleteCandidate.ObjectMeta.Name, &v1.DeleteOptions{}) + // Don't log an error if it is already deleted + if err != nil { + // We can't observe a delete if it was not accepted by the server + c.expectations.DeletionObserved(rsKey, controller.VirtualMachineKey(deleteCandidate)) + c.recorder.Eventf(rs, k8score.EventTypeWarning, FailedDeleteVirtualMachineReason, "Error deleting finished virtual machine %s: %v", deleteCandidate.ObjectMeta.Name, err) + errChan <- err + return + } + c.recorder.Eventf(rs, k8score.EventTypeNormal, SuccessfulDeleteVirtualMachineReason, "Deleted finished virtual machine: %v", deleteCandidate.ObjectMeta.UID) + }(i) + } + wg.Wait() + + select { + case err := <-errChan: + // Only return the first error which occurred, the others will most likely be equal errors + return err + default: + } + return nil } diff --git a/vendor/kubevirt.io/kubevirt/pkg/virt-controller/watch/vm.go b/vendor/kubevirt.io/kubevirt/pkg/virt-controller/watch/vm.go index 07ed275e3..e82c88015 100644 --- a/vendor/kubevirt.io/kubevirt/pkg/virt-controller/watch/vm.go +++ b/vendor/kubevirt.io/kubevirt/pkg/virt-controller/watch/vm.go @@ -22,112 +22,70 @@ package watch import ( "time" - k8sv1 "k8s.io/api/core/v1" + "github.com/pborman/uuid" + + "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/wait" "k8s.io/client-go/tools/cache" "k8s.io/client-go/tools/record" "k8s.io/client-go/util/workqueue" - "fmt" - "reflect" - "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/apimachinery/pkg/types" + k8score "k8s.io/api/core/v1" + + "fmt" + + "reflect" virtv1 "kubevirt.io/kubevirt/pkg/api/v1" "kubevirt.io/kubevirt/pkg/controller" "kubevirt.io/kubevirt/pkg/kubecli" "kubevirt.io/kubevirt/pkg/log" - "kubevirt.io/kubevirt/pkg/virt-controller/services" ) -// Reasons for vm events -const ( - // FailedCreatePodReason is added in an event and in a vm controller condition - // when a pod for a vm controller failed to be created. - FailedCreatePodReason = "FailedCreate" - // SuccessfulCreatePodReason is added in an event when a pod for a vm controller - // is successfully created. - SuccessfulCreatePodReason = "SuccessfulCreate" - // FailedDeletePodReason is added in an event and in a vm controller condition - // when a pod for a vm controller failed to be deleted. - FailedDeletePodReason = "FailedDelete" - // SuccessfulDeletePodReason is added in an event when a pod for a vm controller - // is successfully deleted. - SuccessfulDeletePodReason = "SuccessfulDelete" - // FailedHandOverPodReason is added in an event and in a vm controller condition - // when transferring the pod ownership from the controller to virt-hander fails. - FailedHandOverPodReason = "FailedHandOver" - // SuccessfulHandOverPodReason is added in an event - // when the pod ownership transfer from the controller to virt-hander succeeds. - SuccessfulHandOverPodReason = "SuccessfulHandOver" -) +func NewVMController(vmiInformer cache.SharedIndexInformer, vmiVMInformer cache.SharedIndexInformer, recorder record.EventRecorder, clientset kubecli.KubevirtClient) *VMController { -func NewVMController(templateService services.TemplateService, vmInformer cache.SharedIndexInformer, podInformer cache.SharedIndexInformer, recorder record.EventRecorder, clientset kubecli.KubevirtClient) *VMController { c := &VMController{ - templateService: templateService, - Queue: workqueue.NewRateLimitingQueue(workqueue.DefaultControllerRateLimiter()), - vmInformer: vmInformer, - podInformer: podInformer, - recorder: recorder, - clientset: clientset, - podExpectations: controller.NewUIDTrackingControllerExpectations(controller.NewControllerExpectations()), - handoverExpectations: controller.NewUIDTrackingControllerExpectations(controller.NewControllerExpectations()), - } + Queue: workqueue.NewRateLimitingQueue(workqueue.DefaultControllerRateLimiter()), + vmiInformer: vmiInformer, + vmiVMInformer: vmiVMInformer, + recorder: recorder, + clientset: clientset, + expectations: controller.NewUIDTrackingControllerExpectations(controller.NewControllerExpectations()), + } + + c.vmiVMInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{ + AddFunc: c.addVm, + DeleteFunc: c.deleteVm, + UpdateFunc: c.updateVm, + }) - c.vmInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{ + c.vmiInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{ AddFunc: c.addVirtualMachine, DeleteFunc: c.deleteVirtualMachine, UpdateFunc: c.updateVirtualMachine, }) - c.podInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{ - AddFunc: c.addPod, - DeleteFunc: c.deletePod, - UpdateFunc: c.updatePod, - }) - return c } -type syncError interface { - error - Reason() string -} - -type syncErrorImpl struct { - err error - reason string -} - -func (e *syncErrorImpl) Error() string { - return e.err.Error() -} - -func (e *syncErrorImpl) Reason() string { - return e.reason -} - type VMController struct { - templateService services.TemplateService - clientset kubecli.KubevirtClient - Queue workqueue.RateLimitingInterface - vmInformer cache.SharedIndexInformer - podInformer cache.SharedIndexInformer - recorder record.EventRecorder - podExpectations *controller.UIDTrackingControllerExpectations - handoverExpectations *controller.UIDTrackingControllerExpectations + clientset kubecli.KubevirtClient + Queue workqueue.RateLimitingInterface + vmiInformer cache.SharedIndexInformer + vmiVMInformer cache.SharedIndexInformer + recorder record.EventRecorder + expectations *controller.UIDTrackingControllerExpectations } func (c *VMController) Run(threadiness int, stopCh chan struct{}) { defer controller.HandlePanic() defer c.Queue.ShutDown() - log.Log.Info("Starting vm controller.") + log.Log.Info("Starting VirtualMachine controller.") - // Wait for cache sync before we start the pod controller - cache.WaitForCacheSync(stopCh, c.vmInformer.HasSynced, c.podInformer.HasSynced) + // Wait for cache sync before we start the controller + cache.WaitForCacheSync(stopCh, c.vmiInformer.HasSynced, c.vmiVMInformer.HasSynced) // Start the actual work for i := 0; i < threadiness; i++ { @@ -135,7 +93,7 @@ func (c *VMController) Run(threadiness int, stopCh chan struct{}) { } <-stopCh - log.Log.Info("Stopping vm controller.") + log.Log.Info("Stopping VirtualMachine controller.") } func (c *VMController) runWorker() { @@ -149,13 +107,11 @@ func (c *VMController) Execute() bool { return false } defer c.Queue.Done(key) - err := c.execute(key.(string)) - - if err != nil { - log.Log.Reason(err).Infof("reenqueuing VM %v", key) + if err := c.execute(key.(string)); err != nil { + log.Log.Reason(err).Infof("re-enqueuing VirtualMachine %v", key) c.Queue.AddRateLimited(key) } else { - log.Log.V(4).Infof("processed VM %v", key) + log.Log.V(4).Infof("processed VirtualMachine %v", key) c.Queue.Forget(key) } return true @@ -163,307 +119,466 @@ func (c *VMController) Execute() bool { func (c *VMController) execute(key string) error { - // Fetch the latest Vm state from cache - obj, exists, err := c.vmInformer.GetStore().GetByKey(key) - + obj, exists, err := c.vmiVMInformer.GetStore().GetByKey(key) if err != nil { - return err + return nil } - - // Once all finalizers are removed the vm gets deleted and we can clean all expectations if !exists { - c.podExpectations.DeleteExpectations(key) - c.handoverExpectations.DeleteExpectations(key) + // nothing we need to do. It should always be possible to re-create this type of controller + c.expectations.DeleteExpectations(key) return nil } - vm := obj.(*virtv1.VirtualMachine) + VM := obj.(*virtv1.VirtualMachine) - // If the VM is exists still, don't process the VM until it is fully initialized. - // Initialization is handled by the initialization controller and must take place - // before the VM is acted upon. - if !isVirtualMachineInitialized(vm) { + logger := log.Log.Object(VM) + + logger.Info("Started processing VM") + + //TODO default vm if necessary, the aggregated apiserver will do that in the future + if VM.Spec.Template == nil { + logger.Error("Invalid controller spec, will not re-enqueue.") return nil } - logger := log.Log.Object(vm) - - // Get all pods from the namespace - pods, err := c.listPodsFromNamespace(vm.Namespace) + needsSync := c.expectations.SatisfiedExpectations(key) + vmKey, err := controller.KeyFunc(VM) if err != nil { - logger.Reason(err).Error("Failed to fetch pods for namespace from cache.") return err } - // Only consider pods which belong to this vm - pods, err = c.filterMatchingPods(vm, pods) + // If any adoptions are attempted, we should first recheck for deletion with + // an uncached quorum read sometime after listing VirtualMachines (see kubernetes/kubernetes#42639). + canAdoptFunc := controller.RecheckDeletionTimestamp(func() (v1.Object, error) { + fresh, err := c.clientset.VirtualMachine(VM.ObjectMeta.Namespace).Get(VM.ObjectMeta.Name, &v1.GetOptions{}) + if err != nil { + return nil, err + } + if fresh.ObjectMeta.UID != VM.ObjectMeta.UID { + return nil, fmt.Errorf("original VirtualMachine %v/%v is gone: got uid %v, wanted %v", VM.Namespace, VM.Name, fresh.UID, VM.UID) + } + return fresh, nil + }) + cm := controller.NewVirtualMachineControllerRefManager(controller.RealVirtualMachineControl{Clientset: c.clientset}, VM, nil, virtv1.VirtualMachineGroupVersionKind, canAdoptFunc) + + var vmi *virtv1.VirtualMachineInstance + vmiObj, exist, err := c.vmiInformer.GetStore().GetByKey(vmKey) if err != nil { + logger.Reason(err).Error("Failed to fetch vmi for namespace from cache.") return err } + if !exist { + logger.V(4).Infof("VirtualMachineInstance not found in cache %s", key) + vmi = nil + } else { + vmi = vmiObj.(*virtv1.VirtualMachineInstance) - if len(pods) > 1 { - logger.Reason(fmt.Errorf("More than one pod detected")).Error("That should not be possible, will not requeue") - return nil + vmi, err = cm.ClaimVirtualMachineByName(vmi) + if err != nil { + return err + } } - // If neddsSync is true (expectations fulfilled) we can make save assumptions if virt-handler or virt-controller owns the pod - needsSync := c.podExpectations.SatisfiedExpectations(key) && c.handoverExpectations.SatisfiedExpectations(key) + var createErr error - var syncErr syncError = nil - if needsSync { - syncErr = c.sync(vm, pods) + // Scale up or down, if all expected creates and deletes were report by the listener + if needsSync && VM.ObjectMeta.DeletionTimestamp == nil { + logger.Infof("Creating or the VirtualMachineInstance: %t", VM.Spec.Running) + createErr = c.startStop(VM, vmi) } - return c.updateStatus(vm, pods, syncErr) -} -func (c *VMController) updateStatus(vm *virtv1.VirtualMachine, pods []*k8sv1.Pod, syncErr syncError) error { + // If the controller is going to be deleted and the orphan finalizer is the next one, release the VMIs. Don't update the status + // TODO: Workaround for https://github.com/kubernetes/kubernetes/issues/56348, remove it once it is fixed + if VM.ObjectMeta.DeletionTimestamp != nil && controller.HasFinalizer(VM, v1.FinalizerOrphanDependents) { + return c.orphan(cm, vmi) + } - var pod *k8sv1.Pod = nil - podExists := len(pods) > 0 - if podExists { - pod = pods[0] + if createErr != nil { + logger.Reason(err).Error("Creating the VirtualMachine failed.") } - vmCopy := vm.DeepCopy() + err = c.updateStatus(VM.DeepCopy(), vmi, createErr) + if err != nil { + logger.Reason(err).Error("Updating the VirtualMachine status failed.") + return err + } - switch { + return createErr +} - case vm.IsUnprocessed(): - if podExists { - vmCopy.Status.Phase = virtv1.Scheduling - } else if vm.DeletionTimestamp != nil { - vmCopy.Status.Phase = virtv1.Failed - } else { - vmCopy.Status.Phase = virtv1.Pending +// orphan removes the owner reference of all VMIs which are owned by the controller instance. +// Workaround for https://github.com/kubernetes/kubernetes/issues/56348 to make no-cascading deletes possible +// We don't have to remove the finalizer. This part of the gc is not affected by the mentioned bug +// TODO +pkotas unify with replicasets. This function can be the same +func (c *VMController) orphan(cm *controller.VirtualMachineControllerRefManager, vmi *virtv1.VirtualMachineInstance) error { + if vmi == nil { + return nil + } + + errChan := make(chan error, 1) + + go func(vmi *virtv1.VirtualMachineInstance) { + err := cm.ReleaseVirtualMachine(vmi) + if err != nil { + errChan <- err } - case vm.IsScheduling(): - switch { - case podExists: - if isPodOwnedByHandler(pod) { - // vm is still owned by the controller but pod is already handed over, - // so let's hand over the vm too - vmCopy.Status.Interfaces = []virtv1.VirtualMachineNetworkInterface{ - { - IP: pod.Status.PodIP, - }, - } - vmCopy.Status.Phase = virtv1.Scheduled - if vmCopy.Labels == nil { - vmCopy.Labels = map[string]string{} + }(vmi) + + select { + case err := <-errChan: + return err + default: + } + return nil +} + +func (c *VMController) startStop(vm *virtv1.VirtualMachine, vmi *virtv1.VirtualMachineInstance) error { + log.Log.Object(vm).V(4).Infof("Start the VirtualMachineInstance: %t", vm.Spec.Running) + + if vm.Spec.Running == true { + if vmi != nil { + if vmi.IsFinal() { + // The VirtualMachineInstance can fail od be finished. The job of this controller + // is keep the VirtualMachineInstance running, therefore it restarts it. + // restarting VirtualMachineInstance by stopping it and letting it start in next step + err := c.stopVMI(vm, vmi) + if err != nil { + log.Log.Object(vm).Error("Cannot restart VirtualMachineInstance, the VirtualMachineInstance cannot be deleted.") + return err } - vmCopy.ObjectMeta.Labels[virtv1.NodeNameLabel] = pod.Spec.NodeName - vmCopy.Status.NodeName = pod.Spec.NodeName - } else if isPodDownOrGoingDown(pod) { - vmCopy.Status.Phase = virtv1.Failed + // return to let the controller pick up the expected deletion } - case !podExists: - // someone other than the controller deleted the pod unexpectedly - vmCopy.Status.Phase = virtv1.Failed + // VirtualMachineInstance is OK no need to do anything + return nil } - case vm.IsFinal(): - if !podExists { - controller.RemoveFinalizer(vmCopy, virtv1.VirtualMachineFinalizer) + + err := c.startVMI(vm) + return err + } + + if vm.Spec.Running == false { + log.Log.Object(vm).V(4).Info("It is false delete") + if vmi == nil { + log.Log.Info("vmi is nil") + // vmi should not run and is not running + return nil } - case vm.IsRunning() || vm.IsScheduled(): - // Don't process states where the vm is clearly owned by virt-handler - return nil - default: - return fmt.Errorf("unknown vm phase %v", vm.Status.Phase) + err := c.stopVMI(vm, vmi) + return err } - reason := "" - if syncErr != nil { - reason = syncErr.Reason() + return nil +} + +func (c *VMController) startVMI(vm *virtv1.VirtualMachine) error { + // TODO add check for existence + vmKey, err := controller.KeyFunc(vm) + if err != nil { + log.Log.Object(vm).Reason(err).Error("Failed to extract vmKey from VirtualMachine.") + return nil } - controller.NewVirtualMachineConditionManager().CheckFailure(vmCopy, syncErr, reason) + // start it + vmi := c.setupVMIFromVM(vm) - // If we detect a change on the vm we update the vm - if !reflect.DeepEqual(vm.Status, vmCopy.Status) || - !reflect.DeepEqual(vm.Finalizers, vmCopy.Finalizers) || - !reflect.DeepEqual(vm.Annotations, vmCopy.Annotations) { - _, err := c.clientset.VM(vm.Namespace).Update(vmCopy) - if err != nil { - return err - } + c.expectations.ExpectCreations(vmKey, 1) + vmi, err = c.clientset.VirtualMachineInstance(vm.ObjectMeta.Namespace).Create(vmi) + if err != nil { + log.Log.Object(vm).Infof("Failed to create VirtualMachineInstance: %s/%s", vmi.Namespace, vmi.Name) + c.expectations.CreationObserved(vmKey) + c.recorder.Eventf(vm, k8score.EventTypeWarning, FailedCreateVirtualMachineReason, "Error creating virtual machine: %v", err) + return err } + c.recorder.Eventf(vm, k8score.EventTypeNormal, SuccessfulCreateVirtualMachineReason, "Created virtual machine: %v", vmi.ObjectMeta.Name) return nil } -func isPodReady(pod *k8sv1.Pod) bool { - if isPodDownOrGoingDown(pod) { - return false +func (c *VMController) stopVMI(vm *virtv1.VirtualMachine, vmi *virtv1.VirtualMachineInstance) error { + if vmi == nil || vmi.DeletionTimestamp != nil { + // nothing to do + return nil } - for _, containerStatus := range pod.Status.ContainerStatuses { - if containerStatus.Ready == false { - return false - } + + vmKey, err := controller.KeyFunc(vm) + if err != nil { + log.Log.Object(vm).Reason(err).Error("Failed to extract vmKey from VirtualMachine.") + return nil + } + + // stop it + c.expectations.ExpectDeletions(vmKey, []string{controller.VirtualMachineKey(vmi)}) + err = c.clientset.VirtualMachineInstance(vm.ObjectMeta.Namespace).Delete(vmi.ObjectMeta.Name, &v1.DeleteOptions{}) + + // Don't log an error if it is already deleted + if err != nil { + // We can't observe a delete if it was not accepted by the server + c.expectations.DeletionObserved(vmKey, controller.VirtualMachineKey(vmi)) + c.recorder.Eventf(vm, k8score.EventTypeWarning, FailedDeleteVirtualMachineReason, "Error deleting virtual machine %s: %v", vmi.ObjectMeta.Name, err) + return err } - return pod.Status.Phase == k8sv1.PodRunning + c.recorder.Eventf(vm, k8score.EventTypeNormal, SuccessfulDeleteVirtualMachineReason, "Deleted virtual machine: %v", vmi.ObjectMeta.UID) + log.Log.Object(vm).Info("Dispatching delete event") + + return nil } -func isPodDownOrGoingDown(pod *k8sv1.Pod) bool { - return podIsDown(pod) || pod.DeletionTimestamp != nil +// setupVMIfromVM creates a VirtualMachineInstance object from one VirtualMachine object. +func (c *VMController) setupVMIFromVM(vm *virtv1.VirtualMachine) *virtv1.VirtualMachineInstance { + basename := c.getVirtualMachineBaseName(vm) + + vmi := virtv1.NewVMIReferenceFromNameWithNS(vm.ObjectMeta.Namespace, "") + vmi.ObjectMeta = vm.Spec.Template.ObjectMeta + vmi.ObjectMeta.Name = basename + vmi.ObjectMeta.GenerateName = basename + vmi.Spec = vm.Spec.Template.Spec + + setupStableFirmwareUUID(vm, vmi) + + t := true + // TODO check if vmi labels exist, and when make sure that they match. For now just override them + vmi.ObjectMeta.Labels = vm.Spec.Template.ObjectMeta.Labels + vmi.ObjectMeta.OwnerReferences = []v1.OwnerReference{{ + APIVersion: virtv1.VirtualMachineGroupVersionKind.GroupVersion().String(), + Kind: virtv1.VirtualMachineGroupVersionKind.Kind, + Name: vm.ObjectMeta.Name, + UID: vm.ObjectMeta.UID, + Controller: &t, + BlockOwnerDeletion: &t, + }} + + return vmi +} + +// no special meaning, randomly generated on my box. +// TODO: do we want to use another constants? see examples in RFC4122 +const magicUUID = "6a1a24a1-4061-4607-8bf4-a3963d0c5895" + +var firmwareUUIDns = uuid.Parse(magicUUID) + +// setStableUUID makes sure the VirtualMachineInstance being started has a a 'stable' UUID. +// The UUID is 'stable' if doesn't change across reboots. +func setupStableFirmwareUUID(vm *virtv1.VirtualMachine, vmi *virtv1.VirtualMachineInstance) { + + logger := log.Log.Object(vm) + + if vmi.Spec.Domain.Firmware == nil { + vmi.Spec.Domain.Firmware = &virtv1.Firmware{} + } + + existingUUID := vmi.Spec.Domain.Firmware.UUID + if existingUUID != "" { + logger.V(4).Infof("Using existing UUID '%s'", existingUUID) + return + } + + vmi.Spec.Domain.Firmware.UUID = types.UID(uuid.NewSHA1(firmwareUUIDns, []byte(vmi.ObjectMeta.Name)).String()) + logger.Infof("Setting stabile UUID '%s' (was '%s')", vmi.Spec.Domain.Firmware.UUID, existingUUID) } -func podIsDown(pod *k8sv1.Pod) bool { - return pod.Status.Phase == k8sv1.PodSucceeded || pod.Status.Phase == k8sv1.PodFailed +// filterActiveVMIs takes a list of VMIs and returns all VMIs which are not in a final state +// TODO +pkotas unify with replicaset this code is the same without dependency +func (c *VMController) filterActiveVMIs(vmis []*virtv1.VirtualMachineInstance) []*virtv1.VirtualMachineInstance { + return filter(vmis, func(vmi *virtv1.VirtualMachineInstance) bool { + return !vmi.IsFinal() + }) } -func (c *VMController) sync(vm *virtv1.VirtualMachine, pods []*k8sv1.Pod) (err syncError) { +// filterReadyVMIs takes a list of VMIs and returns all VMIs which are in ready state. +// TODO +pkotas unify with replicaset this code is the same +func (c *VMController) filterReadyVMIs(vmis []*virtv1.VirtualMachineInstance) []*virtv1.VirtualMachineInstance { + return filter(vmis, func(vmi *virtv1.VirtualMachineInstance) bool { + return vmi.IsReady() + }) +} - var pod *k8sv1.Pod = nil - podExists := len(pods) > 0 - if podExists { - pod = pods[0] +// listVMIsFromNamespace takes a namespace and returns all VMIs from the VirtualMachineInstance cache which run in this namespace +// TODO +pkotas unify this code with replicaset +func (c *VMController) listVMIsFromNamespace(namespace string) ([]*virtv1.VirtualMachineInstance, error) { + objs, err := c.vmiInformer.GetIndexer().ByIndex(cache.NamespaceIndex, namespace) + if err != nil { + return nil, err + } + var vmis []*virtv1.VirtualMachineInstance + for _, obj := range objs { + vmis = append(vmis, obj.(*virtv1.VirtualMachineInstance)) } + return vmis, nil +} - vmKey := controller.VirtualMachineKey(vm) +// listControllerFromNamespace takes a namespace and returns all VirtualMachines +// from the VirtualMachine cache which run in this namespace +func (c *VMController) listControllerFromNamespace(namespace string) ([]*virtv1.VirtualMachine, error) { + objs, err := c.vmiVMInformer.GetIndexer().ByIndex(cache.NamespaceIndex, namespace) + if err != nil { + return nil, err + } + var vms []*virtv1.VirtualMachine + for _, obj := range objs { + vm := obj.(*virtv1.VirtualMachine) + vms = append(vms, vm) + } + return vms, nil +} - if vm.DeletionTimestamp != nil { - if !podExists { - return nil - } else if pod.DeletionTimestamp == nil { - c.podExpectations.ExpectDeletions(vmKey, []string{controller.PodKey(pod)}) - err := c.clientset.CoreV1().Pods(vm.Namespace).Delete(pod.Name, &v1.DeleteOptions{}) - if err != nil { - c.recorder.Eventf(vm, k8sv1.EventTypeWarning, FailedDeletePodReason, "Error deleting pod: %v", err) - c.podExpectations.DeletionObserved(vmKey, controller.PodKey(pod)) - return &syncErrorImpl{fmt.Errorf("failed to delete virtual machine pod: %v", err), FailedDeletePodReason} - } - c.recorder.Eventf(vm, k8sv1.EventTypeNormal, SuccessfulDeletePodReason, "Deleted virtual machine pod %s", pod.Name) - return nil - } - return nil - } else if vm.IsFinal() { +// getMatchingControllers returns the list of VirtualMachines which matches +// the labels of the VirtualMachineInstance from the listener cache. If there are no matching +// controllers nothing is returned +func (c *VMController) getMatchingControllers(vmi *virtv1.VirtualMachineInstance) (vms []*virtv1.VirtualMachine) { + controllers, err := c.listControllerFromNamespace(vmi.ObjectMeta.Namespace) + if err != nil { return nil } - if !podExists { - // If we came ever that far to detect that we already created a pod, we don't create it again - if !vm.IsUnprocessed() { - return nil - } - c.podExpectations.ExpectCreations(vmKey, 1) - templatePod := c.templateService.RenderLaunchManifest(vm) - pod, err := c.clientset.CoreV1().Pods(vm.GetNamespace()).Create(templatePod) - if err != nil { - c.recorder.Eventf(vm, k8sv1.EventTypeWarning, FailedCreatePodReason, "Error creating pod: %v", err) - c.podExpectations.CreationObserved(vmKey) - return &syncErrorImpl{fmt.Errorf("failed to create virtual machine pod: %v", err), FailedCreatePodReason} - } - c.recorder.Eventf(vm, k8sv1.EventTypeNormal, SuccessfulCreatePodReason, "Created virtual machine pod %s", pod.Name) - return nil - } else if isPodReady(pod) && !isPodOwnedByHandler(pod) { - pod := pod.DeepCopy() - pod.Annotations[virtv1.OwnedByAnnotation] = "virt-handler" - c.handoverExpectations.ExpectCreations(controller.VirtualMachineKey(vm), 1) - _, err := c.clientset.CoreV1().Pods(vm.Namespace).Update(pod) - if err != nil { - c.handoverExpectations.CreationObserved(controller.VirtualMachineKey(vm)) - c.recorder.Eventf(vm, k8sv1.EventTypeWarning, FailedHandOverPodReason, "Error on handing over pod: %v", err) - return &syncErrorImpl{fmt.Errorf("failed to hand over pod to virt-handler: %v", err), FailedHandOverPodReason} + // TODO check owner reference, if we have an existing controller which owns this one + + for _, vm := range controllers { + if vmi.Name == vm.Name { + vms = append(vms, vm) } - c.recorder.Eventf(vm, k8sv1.EventTypeNormal, SuccessfulHandOverPodReason, "Pod owner ship transfered to the node %s", pod.Name) } - return nil + return vms } -// When a pod is created, enqueue the vm that manages it and update its podExpectations. -func (c *VMController) addPod(obj interface{}) { - pod := obj.(*k8sv1.Pod) +// When a vmi is created, enqueue the VirtualMachine that manages it and update its expectations. +func (c *VMController) addVirtualMachine(obj interface{}) { + vmi := obj.(*virtv1.VirtualMachineInstance) + + log.Log.Object(vmi).V(4).Info("VirtualMachineInstance added.") - if pod.DeletionTimestamp != nil { - // on a restart of the controller manager, it's possible a new pod shows up in a state that - // is already pending deletion. Prevent the pod from being a creation observation. - c.deletePod(pod) + if vmi.DeletionTimestamp != nil { + // on a restart of the controller manager, it's possible a new vmi shows up in a state that + // is already pending deletion. Prevent the vmi from being a creation observation. + c.deleteVirtualMachine(vmi) return } - controllerRef := c.getControllerOf(pod) - vm := c.resolveControllerRef(pod.Namespace, controllerRef) - if vm == nil { + // If it has a ControllerRef, that's all that matters. + if controllerRef := controller.GetControllerOf(vmi); controllerRef != nil { + log.Log.Object(vmi).Info("Looking for VirtualMachineInstance Ref") + vm := c.resolveControllerRef(vmi.Namespace, controllerRef) + if vm == nil { + log.Log.Object(vmi).Errorf("Cant find the matching VM for VirtualMachineInstance: %s", vmi.Name) + return + } + vmKey, err := controller.KeyFunc(vm) + if err != nil { + log.Log.Object(vmi).Errorf("Cannot parse key of VM: %s for VirtualMachineInstance: %s", vm.Name, vmi.Name) + return + } + log.Log.Object(vmi).Infof("VirtualMachineInstance created bacause %s was added.", vmi.Name) + c.expectations.CreationObserved(vmKey) + c.enqueueVm(vm) return } - vmKey, err := controller.KeyFunc(vm) - if err != nil { + + // Otherwise, it's an orphan. Get a list of all matching VirtualMachines and sync + // them to see if anyone wants to adopt it. + // DO NOT observe creation because no controller should be waiting for an + // orphan. + vms := c.getMatchingControllers(vmi) + if len(vms) == 0 { return } - log.Log.V(4).Object(pod).Infof("Pod created") - c.podExpectations.CreationObserved(vmKey) - c.enqueueVirtualMachine(vm) + log.Log.V(4).Object(vmi).Infof("Orphan VirtualMachineInstance created") + for _, vm := range vms { + c.enqueueVm(vm) + } } -// When a pod is updated, figure out what vm/s manage it and wake them -// up. If the labels of the pod have changed we need to awaken both the old -// and new vm. old and cur must be *v1.Pod types. -func (c *VMController) updatePod(old, cur interface{}) { - curPod := cur.(*k8sv1.Pod) - oldPod := old.(*k8sv1.Pod) - if curPod.ResourceVersion == oldPod.ResourceVersion { - // Periodic resync will send update events for all known pods. - // Two different versions of the same pod will always have different RVs. +// When a vmi is updated, figure out what VirtualMachine manage it and wake them +// up. If the labels of the vmi have changed we need to awaken both the old +// and new VirtualMachine. old and cur must be *v1.VirtualMachineInstance types. +func (c *VMController) updateVirtualMachine(old, cur interface{}) { + curVMI := cur.(*virtv1.VirtualMachineInstance) + oldVMI := old.(*virtv1.VirtualMachineInstance) + if curVMI.ResourceVersion == oldVMI.ResourceVersion { + // Periodic resync will send update events for all known vmis. + // Two different versions of the same vmi will always have different RVs. return } - labelChanged := !reflect.DeepEqual(curPod.Labels, oldPod.Labels) - if curPod.DeletionTimestamp != nil { - // having a pod marked for deletion is enough to count as a deletion expectation - c.deletePod(curPod) + labelChanged := !reflect.DeepEqual(curVMI.Labels, oldVMI.Labels) + if curVMI.DeletionTimestamp != nil { + // when a vmi is deleted gracefully it's deletion timestamp is first modified to reflect a grace period, + // and after such time has passed, the virt-handler actually deletes it from the store. We receive an update + // for modification of the deletion timestamp and expect an VirtualMachine to create newVMI asap, not wait + // until the virt-handler actually deletes the vmi. This is different from the Phase of a vmi changing, because + // an rs never initiates a phase change, and so is never asleep waiting for the same. + c.deleteVirtualMachine(curVMI) if labelChanged { - // we don't need to check the oldPod.DeletionTimestamp because DeletionTimestamp cannot be unset. - c.deletePod(oldPod) + // we don't need to check the oldVMI.DeletionTimestamp because DeletionTimestamp cannot be unset. + c.deleteVirtualMachine(oldVMI) } return } - curControllerRef := c.getControllerOf(curPod) - oldControllerRef := c.getControllerOf(oldPod) + curControllerRef := controller.GetControllerOf(curVMI) + oldControllerRef := controller.GetControllerOf(oldVMI) controllerRefChanged := !reflect.DeepEqual(curControllerRef, oldControllerRef) if controllerRefChanged && oldControllerRef != nil { // The ControllerRef was changed. Sync the old controller, if any. - if vm := c.resolveControllerRef(oldPod.Namespace, oldControllerRef); vm != nil { - c.checkHandOverExpectation(oldPod, vm) - c.enqueueVirtualMachine(vm) + if vm := c.resolveControllerRef(oldVMI.Namespace, oldControllerRef); vm != nil { + c.enqueueVm(vm) } } - vm := c.resolveControllerRef(curPod.Namespace, curControllerRef) - if vm == nil { + // If it has a ControllerRef, that's all that matters. + if curControllerRef != nil { + vm := c.resolveControllerRef(curVMI.Namespace, curControllerRef) + if vm == nil { + return + } + log.Log.V(4).Object(curVMI).Infof("VirtualMachineInstance updated") + c.enqueueVm(vm) + // TODO: MinReadySeconds in the VirtualMachineInstance will generate an Available condition to be added in + // Update once we support the available conect on the rs return } - log.Log.V(4).Object(curPod).Infof("Pod updated") - c.checkHandOverExpectation(curPod, vm) - c.enqueueVirtualMachine(vm) - return + + // Otherwise, it's an orphan. If anything changed, sync matching controllers + // to see if anyone wants to adopt it now. + if labelChanged || controllerRefChanged { + vms := c.getMatchingControllers(curVMI) + if len(vms) == 0 { + return + } + log.Log.V(4).Object(curVMI).Infof("Orphan VirtualMachineInstance updated") + for _, vm := range vms { + c.enqueueVm(vm) + } + } } -// When a pod is deleted, enqueue the vm that manages the pod and update its podExpectations. -// obj could be an *v1.Pod, or a DeletionFinalStateUnknown marker item. -func (c *VMController) deletePod(obj interface{}) { - pod, ok := obj.(*k8sv1.Pod) +// When a vmi is deleted, enqueue the VirtualMachine that manages the vmi and update its expectations. +// obj could be an *v1.VirtualMachineInstance, or a DeletionFinalStateUnknown marker item. +func (c *VMController) deleteVirtualMachine(obj interface{}) { + vmi, ok := obj.(*virtv1.VirtualMachineInstance) - // When a delete is dropped, the relist will notice a pod in the store not + // When a delete is dropped, the relist will notice a vmi in the store not // in the list, leading to the insertion of a tombstone object which contains - // the deleted key/value. Note that this value might be stale. If the pod - // changed labels the new vm will not be woken up till the periodic resync. + // the deleted key/value. Note that this value might be stale. If the vmi + // changed labels the new VirtualMachine will not be woken up till the periodic resync. if !ok { tombstone, ok := obj.(cache.DeletedFinalStateUnknown) if !ok { log.Log.Reason(fmt.Errorf("couldn't get object from tombstone %+v", obj)).Error("Failed to process delete notification") return } - pod, ok = tombstone.Obj.(*k8sv1.Pod) + vmi, ok = tombstone.Obj.(*virtv1.VirtualMachineInstance) if !ok { - log.Log.Reason(fmt.Errorf("tombstone contained object that is not a pod %#v", obj)).Error("Failed to process delete notification") + log.Log.Reason(fmt.Errorf("tombstone contained object that is not a vmi %#v", obj)).Error("Failed to process delete notification") return } } - controllerRef := c.getControllerOf(pod) - vm := c.resolveControllerRef(pod.Namespace, controllerRef) + controllerRef := controller.GetControllerOf(vmi) + if controllerRef == nil { + // No controller should care about orphans being deleted. + return + } + vm := c.resolveControllerRef(vmi.Namespace, controllerRef) if vm == nil { return } @@ -471,33 +586,126 @@ func (c *VMController) deletePod(obj interface{}) { if err != nil { return } - c.podExpectations.DeletionObserved(vmKey, controller.PodKey(pod)) - c.checkHandOverExpectation(pod, vm) - c.enqueueVirtualMachine(vm) + c.expectations.DeletionObserved(vmKey, controller.VirtualMachineKey(vmi)) + c.enqueueVm(vm) } -func (c *VMController) addVirtualMachine(obj interface{}) { - c.enqueueVirtualMachine(obj) +func (c *VMController) addVm(obj interface{}) { + c.enqueueVm(obj) } -func (c *VMController) deleteVirtualMachine(obj interface{}) { - c.enqueueVirtualMachine(obj) +func (c *VMController) deleteVm(obj interface{}) { + c.enqueueVm(obj) } -func (c *VMController) updateVirtualMachine(old, curr interface{}) { - c.enqueueVirtualMachine(curr) +func (c *VMController) updateVm(old, curr interface{}) { + c.enqueueVm(curr) } -func (c *VMController) enqueueVirtualMachine(obj interface{}) { +func (c *VMController) enqueueVm(obj interface{}) { logger := log.Log vm := obj.(*virtv1.VirtualMachine) key, err := controller.KeyFunc(vm) if err != nil { - logger.Object(vm).Reason(err).Error("Failed to extract key from virtualmachine.") + logger.Object(vm).Reason(err).Error("Failed to extract vmKey from VirtualMachine.") } c.Queue.Add(key) } +func (c *VMController) hasCondition(vm *virtv1.VirtualMachine, cond virtv1.VirtualMachineConditionType) bool { + for _, c := range vm.Status.Conditions { + if c.Type == cond { + return true + } + } + return false +} + +func (c *VMController) removeCondition(vm *virtv1.VirtualMachine, cond virtv1.VirtualMachineConditionType) { + var conds []virtv1.VirtualMachineCondition + for _, c := range vm.Status.Conditions { + if c.Type == cond { + continue + } + conds = append(conds, c) + } + vm.Status.Conditions = conds +} + +func (c *VMController) updateStatus(vm *virtv1.VirtualMachine, vmi *virtv1.VirtualMachineInstance, createErr error) error { + + // Check if it is worth updating + errMatch := (createErr != nil) == c.hasCondition(vm, virtv1.VirtualMachineFailure) + created := vmi != nil + createdMatch := created == vm.Status.Created + + ready := false + if created { + ready = vmi.IsReady() + } + readyMatch := ready == vm.Status.Ready + + if errMatch && createdMatch && readyMatch { + return nil + } + + // Set created and ready flags + vm.Status.Created = created + vm.Status.Ready = ready + + // Add/Remove Failure condition if necessary + if !(errMatch) { + c.processFailure(vm, vmi, createErr) + } + + _, err := c.clientset.VirtualMachine(vm.ObjectMeta.Namespace).Update(vm) + + return err +} + +func (c *VMController) getVirtualMachineBaseName(vm *virtv1.VirtualMachine) string { + + // TODO defaulting should make sure that the right field is set, instead of doing this + if len(vm.Spec.Template.ObjectMeta.Name) > 0 { + return vm.Spec.Template.ObjectMeta.Name + } + if len(vm.Spec.Template.ObjectMeta.GenerateName) > 0 { + return vm.Spec.Template.ObjectMeta.GenerateName + } + return vm.ObjectMeta.Name +} + +func (c *VMController) processFailure(vm *virtv1.VirtualMachine, vmi *virtv1.VirtualMachineInstance, createErr error) { + reason := "" + message := "" + log.Log.Object(vm).Infof("Processing failure status:: shouldRun: %t; noErr: %t; noVm: %t", vm.Spec.Running, createErr != nil, vmi != nil) + + if createErr != nil { + if vm.Spec.Running == true { + reason = "FailedCreate" + } else { + reason = "FailedDelete" + } + message = createErr.Error() + + if !c.hasCondition(vm, virtv1.VirtualMachineFailure) { + log.Log.Object(vm).Infof("Reason to fail: %s", reason) + vm.Status.Conditions = append(vm.Status.Conditions, virtv1.VirtualMachineCondition{ + Type: virtv1.VirtualMachineFailure, + Reason: reason, + Message: message, + LastTransitionTime: v1.Now(), + Status: k8score.ConditionTrue, + }) + } + + return + } + + log.Log.Object(vm).Info("Removing failure") + c.removeCondition(vm, virtv1.VirtualMachineFailure) +} + // resolveControllerRef returns the controller referenced by a ControllerRef, // or nil if the ControllerRef could not be resolved to a matching controller // of the correct Kind. @@ -507,7 +715,7 @@ func (c *VMController) resolveControllerRef(namespace string, controllerRef *v1. if controllerRef.Kind != virtv1.VirtualMachineGroupVersionKind.Kind { return nil } - vm, exists, err := c.vmInformer.GetStore().GetByKey(namespace + "/" + controllerRef.Name) + vm, exists, err := c.vmiVMInformer.GetStore().GetByKey(namespace + "/" + controllerRef.Name) if err != nil { return nil } @@ -522,57 +730,3 @@ func (c *VMController) resolveControllerRef(namespace string, controllerRef *v1. } return vm.(*virtv1.VirtualMachine) } - -// listPodsFromNamespace takes a namespace and returns all Pods from the pod cache which run in this namespace -func (c *VMController) listPodsFromNamespace(namespace string) ([]*k8sv1.Pod, error) { - objs, err := c.podInformer.GetIndexer().ByIndex(cache.NamespaceIndex, namespace) - if err != nil { - return nil, err - } - pods := []*k8sv1.Pod{} - for _, obj := range objs { - pod := obj.(*k8sv1.Pod) - pods = append(pods, pod) - } - return pods, nil -} - -func (c *VMController) filterMatchingPods(vm *virtv1.VirtualMachine, pods []*k8sv1.Pod) ([]*k8sv1.Pod, error) { - selector, err := v1.LabelSelectorAsSelector(&v1.LabelSelector{MatchLabels: map[string]string{virtv1.DomainLabel: vm.Name, virtv1.AppLabel: "virt-launcher"}}) - if err != nil { - return nil, err - } - matchingPods := []*k8sv1.Pod{} - for _, pod := range pods { - if selector.Matches(labels.Set(pod.ObjectMeta.Labels)) && pod.Annotations[virtv1.CreatedByAnnotation] == string(vm.UID) { - matchingPods = append(matchingPods, pod) - } - } - return matchingPods, nil -} - -func isPodOwnedByHandler(pod *k8sv1.Pod) bool { - if pod.Annotations != nil && pod.Annotations[virtv1.OwnedByAnnotation] == "virt-handler" { - return true - } - return false -} - -// checkHandOverExpectation checks if a pod is owned by virt-handler and marks the -// handover expectation as observed, if so. -func (c *VMController) checkHandOverExpectation(pod *k8sv1.Pod, vm *virtv1.VirtualMachine) { - if isPodOwnedByHandler(pod) { - c.handoverExpectations.CreationObserved(controller.VirtualMachineKey(vm)) - } -} - -func (c *VMController) getControllerOf(pod *k8sv1.Pod) *v1.OwnerReference { - t := true - return &v1.OwnerReference{ - Kind: virtv1.VirtualMachineGroupVersionKind.Kind, - Name: pod.Labels[virtv1.DomainLabel], - UID: types.UID(pod.Annotations[virtv1.CreatedByAnnotation]), - Controller: &t, - BlockOwnerDeletion: &t, - } -} diff --git a/vendor/kubevirt.io/kubevirt/pkg/virt-controller/watch/vmi.go b/vendor/kubevirt.io/kubevirt/pkg/virt-controller/watch/vmi.go new file mode 100644 index 000000000..ec74c85ea --- /dev/null +++ b/vendor/kubevirt.io/kubevirt/pkg/virt-controller/watch/vmi.go @@ -0,0 +1,591 @@ +/* + * This file is part of the KubeVirt project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Copyright 2017, 2018 Red Hat, Inc. + * + */ + +package watch + +import ( + "time" + + k8sv1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/util/wait" + "k8s.io/client-go/tools/cache" + "k8s.io/client-go/tools/record" + "k8s.io/client-go/util/workqueue" + + "fmt" + "reflect" + + "k8s.io/apimachinery/pkg/apis/meta/v1" + + "k8s.io/apimachinery/pkg/labels" + "k8s.io/apimachinery/pkg/types" + + virtv1 "kubevirt.io/kubevirt/pkg/api/v1" + "kubevirt.io/kubevirt/pkg/controller" + "kubevirt.io/kubevirt/pkg/kubecli" + "kubevirt.io/kubevirt/pkg/log" + "kubevirt.io/kubevirt/pkg/virt-controller/services" +) + +// Reasons for vmi events +const ( + // FailedCreatePodReason is added in an event and in a vmi controller condition + // when a pod for a vmi controller failed to be created. + FailedCreatePodReason = "FailedCreate" + // SuccessfulCreatePodReason is added in an event when a pod for a vmi controller + // is successfully created. + SuccessfulCreatePodReason = "SuccessfulCreate" + // FailedDeletePodReason is added in an event and in a vmi controller condition + // when a pod for a vmi controller failed to be deleted. + FailedDeletePodReason = "FailedDelete" + // SuccessfulDeletePodReason is added in an event when a pod for a vmi controller + // is successfully deleted. + SuccessfulDeletePodReason = "SuccessfulDelete" + // FailedHandOverPodReason is added in an event and in a vmi controller condition + // when transferring the pod ownership from the controller to virt-hander fails. + FailedHandOverPodReason = "FailedHandOver" + // SuccessfulHandOverPodReason is added in an event + // when the pod ownership transfer from the controller to virt-hander succeeds. + SuccessfulHandOverPodReason = "SuccessfulHandOver" +) + +func NewVMIController(templateService services.TemplateService, vmiInformer cache.SharedIndexInformer, podInformer cache.SharedIndexInformer, recorder record.EventRecorder, clientset kubecli.KubevirtClient, configMapInformer cache.SharedIndexInformer) *VMIController { + c := &VMIController{ + templateService: templateService, + Queue: workqueue.NewRateLimitingQueue(workqueue.DefaultControllerRateLimiter()), + vmiInformer: vmiInformer, + podInformer: podInformer, + recorder: recorder, + clientset: clientset, + podExpectations: controller.NewUIDTrackingControllerExpectations(controller.NewControllerExpectations()), + handoverExpectations: controller.NewUIDTrackingControllerExpectations(controller.NewControllerExpectations()), + configMapInformer: configMapInformer, + } + + c.vmiInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{ + AddFunc: c.addVirtualMachine, + DeleteFunc: c.deleteVirtualMachine, + UpdateFunc: c.updateVirtualMachine, + }) + + c.podInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{ + AddFunc: c.addPod, + DeleteFunc: c.deletePod, + UpdateFunc: c.updatePod, + }) + + return c +} + +type syncError interface { + error + Reason() string +} + +type syncErrorImpl struct { + err error + reason string +} + +func (e *syncErrorImpl) Error() string { + return e.err.Error() +} + +func (e *syncErrorImpl) Reason() string { + return e.reason +} + +type VMIController struct { + templateService services.TemplateService + clientset kubecli.KubevirtClient + Queue workqueue.RateLimitingInterface + vmiInformer cache.SharedIndexInformer + podInformer cache.SharedIndexInformer + recorder record.EventRecorder + podExpectations *controller.UIDTrackingControllerExpectations + handoverExpectations *controller.UIDTrackingControllerExpectations + configMapInformer cache.SharedIndexInformer +} + +func (c *VMIController) Run(threadiness int, stopCh chan struct{}) { + defer controller.HandlePanic() + defer c.Queue.ShutDown() + log.Log.Info("Starting vmi controller.") + + // Wait for cache sync before we start the pod controller + cache.WaitForCacheSync(stopCh, c.vmiInformer.HasSynced, c.podInformer.HasSynced, c.configMapInformer.HasSynced) + + // Start the actual work + for i := 0; i < threadiness; i++ { + go wait.Until(c.runWorker, time.Second, stopCh) + } + + <-stopCh + log.Log.Info("Stopping vmi controller.") +} + +func (c *VMIController) runWorker() { + for c.Execute() { + } +} + +func (c *VMIController) Execute() bool { + key, quit := c.Queue.Get() + if quit { + return false + } + defer c.Queue.Done(key) + err := c.execute(key.(string)) + + if err != nil { + log.Log.Reason(err).Infof("reenqueuing VirtualMachineInstance %v", key) + c.Queue.AddRateLimited(key) + } else { + log.Log.V(4).Infof("processed VirtualMachineInstance %v", key) + c.Queue.Forget(key) + } + return true +} + +func (c *VMIController) execute(key string) error { + + // Fetch the latest Vm state from cache + obj, exists, err := c.vmiInformer.GetStore().GetByKey(key) + + if err != nil { + return err + } + + // Once all finalizers are removed the vmi gets deleted and we can clean all expectations + if !exists { + c.podExpectations.DeleteExpectations(key) + c.handoverExpectations.DeleteExpectations(key) + return nil + } + vmi := obj.(*virtv1.VirtualMachineInstance) + + // If the VirtualMachineInstance is exists still, don't process the VirtualMachineInstance until it is fully initialized. + // Initialization is handled by the initialization controller and must take place + // before the VirtualMachineInstance is acted upon. + if !isVirtualMachineInitialized(vmi) { + return nil + } + + logger := log.Log.Object(vmi) + + // Get all pods from the namespace + pods, err := c.listPodsFromNamespace(vmi.Namespace) + + if err != nil { + logger.Reason(err).Error("Failed to fetch pods for namespace from cache.") + return err + } + + // Only consider pods which belong to this vmi + pods, err = c.filterMatchingPods(vmi, pods) + if err != nil { + return err + } + + if len(pods) > 1 { + logger.Reason(fmt.Errorf("More than one pod detected")).Error("That should not be possible, will not requeue") + return nil + } + + // If neddsSync is true (expectations fulfilled) we can make save assumptions if virt-handler or virt-controller owns the pod + needsSync := c.podExpectations.SatisfiedExpectations(key) && c.handoverExpectations.SatisfiedExpectations(key) + + var syncErr syncError = nil + if needsSync { + syncErr = c.sync(vmi, pods) + } + return c.updateStatus(vmi, pods, syncErr) +} + +func (c *VMIController) updateStatus(vmi *virtv1.VirtualMachineInstance, pods []*k8sv1.Pod, syncErr syncError) error { + + var pod *k8sv1.Pod = nil + podExists := len(pods) > 0 + if podExists { + pod = pods[0] + } + + conditionManager := controller.NewVirtualMachineInstanceConditionManager() + vmiCopy := vmi.DeepCopy() + + switch { + + case vmi.IsUnprocessed(): + if podExists { + vmiCopy.Status.Phase = virtv1.Scheduling + } else if vmi.DeletionTimestamp != nil { + vmiCopy.Status.Phase = virtv1.Failed + } else { + vmiCopy.Status.Phase = virtv1.Pending + } + case vmi.IsScheduling(): + switch { + case podExists: + // Add PodScheduled False condition to the VM + if cond := conditionManager.GetPodCondition(pod, k8sv1.PodScheduled, k8sv1.ConditionFalse); cond != nil { + conditionManager.AddPodCondition(vmiCopy, cond) + } else if conditionManager.HasCondition(vmiCopy, virtv1.VirtualMachineInstanceConditionType(k8sv1.PodScheduled)) { + // Remove PodScheduling condition from the VM + conditionManager.RemoveCondition(vmiCopy, virtv1.VirtualMachineInstanceConditionType(k8sv1.PodScheduled)) + } + if isPodOwnedByHandler(pod) { + // vmi is still owned by the controller but pod is already handed over, + // so let's hand over the vmi too + vmiCopy.Status.Interfaces = []virtv1.VirtualMachineInstanceNetworkInterface{ + { + IP: pod.Status.PodIP, + }, + } + vmiCopy.Status.Phase = virtv1.Scheduled + if vmiCopy.Labels == nil { + vmiCopy.Labels = map[string]string{} + } + vmiCopy.ObjectMeta.Labels[virtv1.NodeNameLabel] = pod.Spec.NodeName + vmiCopy.Status.NodeName = pod.Spec.NodeName + } else if isPodDownOrGoingDown(pod) { + vmiCopy.Status.Phase = virtv1.Failed + } + case !podExists: + // someone other than the controller deleted the pod unexpectedly + vmiCopy.Status.Phase = virtv1.Failed + } + case vmi.IsFinal(): + if !podExists { + controller.RemoveFinalizer(vmiCopy, virtv1.VirtualMachineInstanceFinalizer) + } + case vmi.IsRunning() || vmi.IsScheduled(): + // Don't process states where the vmi is clearly owned by virt-handler + return nil + default: + return fmt.Errorf("unknown vmi phase %v", vmi.Status.Phase) + } + + reason := "" + if syncErr != nil { + reason = syncErr.Reason() + } + + conditionManager.CheckFailure(vmiCopy, syncErr, reason) + + // If we detect a change on the vmi we update the vmi + if !reflect.DeepEqual(vmi.Status, vmiCopy.Status) || + !reflect.DeepEqual(vmi.Finalizers, vmiCopy.Finalizers) || + !reflect.DeepEqual(vmi.Annotations, vmiCopy.Annotations) { + _, err := c.clientset.VirtualMachineInstance(vmi.Namespace).Update(vmiCopy) + if err != nil { + return err + } + } + + return nil +} + +func isPodReady(pod *k8sv1.Pod) bool { + if isPodDownOrGoingDown(pod) { + return false + } + for _, containerStatus := range pod.Status.ContainerStatuses { + if containerStatus.Ready == false { + return false + } + } + + return pod.Status.Phase == k8sv1.PodRunning +} + +func isPodDownOrGoingDown(pod *k8sv1.Pod) bool { + return podIsDown(pod) || pod.DeletionTimestamp != nil +} + +func podIsDown(pod *k8sv1.Pod) bool { + return pod.Status.Phase == k8sv1.PodSucceeded || pod.Status.Phase == k8sv1.PodFailed +} + +func (c *VMIController) sync(vmi *virtv1.VirtualMachineInstance, pods []*k8sv1.Pod) (err syncError) { + + var pod *k8sv1.Pod = nil + podExists := len(pods) > 0 + if podExists { + pod = pods[0] + } + + vmiKey := controller.VirtualMachineKey(vmi) + + if vmi.DeletionTimestamp != nil { + if !podExists { + return nil + } else if pod.DeletionTimestamp == nil { + c.podExpectations.ExpectDeletions(vmiKey, []string{controller.PodKey(pod)}) + err := c.clientset.CoreV1().Pods(vmi.Namespace).Delete(pod.Name, &v1.DeleteOptions{}) + if err != nil { + c.recorder.Eventf(vmi, k8sv1.EventTypeWarning, FailedDeletePodReason, "Error deleting pod: %v", err) + c.podExpectations.DeletionObserved(vmiKey, controller.PodKey(pod)) + return &syncErrorImpl{fmt.Errorf("failed to delete virtual machine pod: %v", err), FailedDeletePodReason} + } + c.recorder.Eventf(vmi, k8sv1.EventTypeNormal, SuccessfulDeletePodReason, "Deleted virtual machine pod %s", pod.Name) + return nil + } + return nil + } else if vmi.IsFinal() { + return nil + } + + if !podExists { + // If we came ever that far to detect that we already created a pod, we don't create it again + if !vmi.IsUnprocessed() { + return nil + } + c.podExpectations.ExpectCreations(vmiKey, 1) + templatePod, err := c.templateService.RenderLaunchManifest(vmi) + if err != nil { + return &syncErrorImpl{fmt.Errorf("failed to render launch manifest: %v", err), FailedCreatePodReason} + } + pod, err := c.clientset.CoreV1().Pods(vmi.GetNamespace()).Create(templatePod) + if err != nil { + c.recorder.Eventf(vmi, k8sv1.EventTypeWarning, FailedCreatePodReason, "Error creating pod: %v", err) + c.podExpectations.CreationObserved(vmiKey) + return &syncErrorImpl{fmt.Errorf("failed to create virtual machine pod: %v", err), FailedCreatePodReason} + } + c.recorder.Eventf(vmi, k8sv1.EventTypeNormal, SuccessfulCreatePodReason, "Created virtual machine pod %s", pod.Name) + return nil + } else if isPodReady(pod) && !isPodOwnedByHandler(pod) { + pod := pod.DeepCopy() + pod.Annotations[virtv1.OwnedByAnnotation] = "virt-handler" + c.handoverExpectations.ExpectCreations(controller.VirtualMachineKey(vmi), 1) + _, err := c.clientset.CoreV1().Pods(vmi.Namespace).Update(pod) + if err != nil { + c.handoverExpectations.CreationObserved(controller.VirtualMachineKey(vmi)) + c.recorder.Eventf(vmi, k8sv1.EventTypeWarning, FailedHandOverPodReason, "Error on handing over pod: %v", err) + return &syncErrorImpl{fmt.Errorf("failed to hand over pod to virt-handler: %v", err), FailedHandOverPodReason} + } + c.recorder.Eventf(vmi, k8sv1.EventTypeNormal, SuccessfulHandOverPodReason, "Pod owner ship transferred to the node %s", pod.Name) + } + return nil +} + +// When a pod is created, enqueue the vmi that manages it and update its podExpectations. +func (c *VMIController) addPod(obj interface{}) { + pod := obj.(*k8sv1.Pod) + + if pod.DeletionTimestamp != nil { + // on a restart of the controller manager, it's possible a new pod shows up in a state that + // is already pending deletion. Prevent the pod from being a creation observation. + c.deletePod(pod) + return + } + + controllerRef := c.getControllerOf(pod) + vmi := c.resolveControllerRef(pod.Namespace, controllerRef) + if vmi == nil { + return + } + vmiKey, err := controller.KeyFunc(vmi) + if err != nil { + return + } + log.Log.V(4).Object(pod).Infof("Pod created") + c.podExpectations.CreationObserved(vmiKey) + c.enqueueVirtualMachine(vmi) +} + +// When a pod is updated, figure out what vmi/s manage it and wake them +// up. If the labels of the pod have changed we need to awaken both the old +// and new vmi. old and cur must be *v1.Pod types. +func (c *VMIController) updatePod(old, cur interface{}) { + curPod := cur.(*k8sv1.Pod) + oldPod := old.(*k8sv1.Pod) + if curPod.ResourceVersion == oldPod.ResourceVersion { + // Periodic resync will send update events for all known pods. + // Two different versions of the same pod will always have different RVs. + return + } + + labelChanged := !reflect.DeepEqual(curPod.Labels, oldPod.Labels) + if curPod.DeletionTimestamp != nil { + // having a pod marked for deletion is enough to count as a deletion expectation + c.deletePod(curPod) + if labelChanged { + // we don't need to check the oldPod.DeletionTimestamp because DeletionTimestamp cannot be unset. + c.deletePod(oldPod) + } + return + } + + curControllerRef := c.getControllerOf(curPod) + oldControllerRef := c.getControllerOf(oldPod) + controllerRefChanged := !reflect.DeepEqual(curControllerRef, oldControllerRef) + if controllerRefChanged && oldControllerRef != nil { + // The ControllerRef was changed. Sync the old controller, if any. + if vmi := c.resolveControllerRef(oldPod.Namespace, oldControllerRef); vmi != nil { + c.checkHandOverExpectation(oldPod, vmi) + c.enqueueVirtualMachine(vmi) + } + } + + vmi := c.resolveControllerRef(curPod.Namespace, curControllerRef) + if vmi == nil { + return + } + log.Log.V(4).Object(curPod).Infof("Pod updated") + c.checkHandOverExpectation(curPod, vmi) + c.enqueueVirtualMachine(vmi) + return +} + +// When a pod is deleted, enqueue the vmi that manages the pod and update its podExpectations. +// obj could be an *v1.Pod, or a DeletionFinalStateUnknown marker item. +func (c *VMIController) deletePod(obj interface{}) { + pod, ok := obj.(*k8sv1.Pod) + + // When a delete is dropped, the relist will notice a pod in the store not + // in the list, leading to the insertion of a tombstone object which contains + // the deleted key/value. Note that this value might be stale. If the pod + // changed labels the new vmi will not be woken up till the periodic resync. + if !ok { + tombstone, ok := obj.(cache.DeletedFinalStateUnknown) + if !ok { + log.Log.Reason(fmt.Errorf("couldn't get object from tombstone %+v", obj)).Error("Failed to process delete notification") + return + } + pod, ok = tombstone.Obj.(*k8sv1.Pod) + if !ok { + log.Log.Reason(fmt.Errorf("tombstone contained object that is not a pod %#v", obj)).Error("Failed to process delete notification") + return + } + } + + controllerRef := c.getControllerOf(pod) + vmi := c.resolveControllerRef(pod.Namespace, controllerRef) + if vmi == nil { + return + } + vmiKey, err := controller.KeyFunc(vmi) + if err != nil { + return + } + c.podExpectations.DeletionObserved(vmiKey, controller.PodKey(pod)) + c.checkHandOverExpectation(pod, vmi) + c.enqueueVirtualMachine(vmi) +} + +func (c *VMIController) addVirtualMachine(obj interface{}) { + c.enqueueVirtualMachine(obj) +} + +func (c *VMIController) deleteVirtualMachine(obj interface{}) { + c.enqueueVirtualMachine(obj) +} + +func (c *VMIController) updateVirtualMachine(old, curr interface{}) { + c.enqueueVirtualMachine(curr) +} + +func (c *VMIController) enqueueVirtualMachine(obj interface{}) { + logger := log.Log + vmi := obj.(*virtv1.VirtualMachineInstance) + key, err := controller.KeyFunc(vmi) + if err != nil { + logger.Object(vmi).Reason(err).Error("Failed to extract key from virtualmachine.") + } + c.Queue.Add(key) +} + +// resolveControllerRef returns the controller referenced by a ControllerRef, +// or nil if the ControllerRef could not be resolved to a matching controller +// of the correct Kind. +func (c *VMIController) resolveControllerRef(namespace string, controllerRef *v1.OwnerReference) *virtv1.VirtualMachineInstance { + // We can't look up by UID, so look up by Name and then verify UID. + // Don't even try to look up by Name if it's the wrong Kind. + if controllerRef.Kind != virtv1.VirtualMachineInstanceGroupVersionKind.Kind { + return nil + } + vmi, exists, err := c.vmiInformer.GetStore().GetByKey(namespace + "/" + controllerRef.Name) + if err != nil { + return nil + } + if !exists { + return nil + } + + if vmi.(*virtv1.VirtualMachineInstance).UID != controllerRef.UID { + // The controller we found with this Name is not the same one that the + // ControllerRef points to. + return nil + } + return vmi.(*virtv1.VirtualMachineInstance) +} + +// listPodsFromNamespace takes a namespace and returns all Pods from the pod cache which run in this namespace +func (c *VMIController) listPodsFromNamespace(namespace string) ([]*k8sv1.Pod, error) { + objs, err := c.podInformer.GetIndexer().ByIndex(cache.NamespaceIndex, namespace) + if err != nil { + return nil, err + } + pods := []*k8sv1.Pod{} + for _, obj := range objs { + pod := obj.(*k8sv1.Pod) + pods = append(pods, pod) + } + return pods, nil +} + +func (c *VMIController) filterMatchingPods(vmi *virtv1.VirtualMachineInstance, pods []*k8sv1.Pod) ([]*k8sv1.Pod, error) { + selector, err := v1.LabelSelectorAsSelector(&v1.LabelSelector{MatchLabels: map[string]string{virtv1.DomainLabel: vmi.Name, virtv1.AppLabel: "virt-launcher"}}) + if err != nil { + return nil, err + } + matchingPods := []*k8sv1.Pod{} + for _, pod := range pods { + if selector.Matches(labels.Set(pod.ObjectMeta.Labels)) && pod.Annotations[virtv1.CreatedByAnnotation] == string(vmi.UID) { + matchingPods = append(matchingPods, pod) + } + } + return matchingPods, nil +} + +func isPodOwnedByHandler(pod *k8sv1.Pod) bool { + if pod.Annotations != nil && pod.Annotations[virtv1.OwnedByAnnotation] == "virt-handler" { + return true + } + return false +} + +// checkHandOverExpectation checks if a pod is owned by virt-handler and marks the +// handover expectation as observed, if so. +func (c *VMIController) checkHandOverExpectation(pod *k8sv1.Pod, vmi *virtv1.VirtualMachineInstance) { + if isPodOwnedByHandler(pod) { + c.handoverExpectations.CreationObserved(controller.VirtualMachineKey(vmi)) + } +} + +func (c *VMIController) getControllerOf(pod *k8sv1.Pod) *v1.OwnerReference { + t := true + return &v1.OwnerReference{ + Kind: virtv1.VirtualMachineInstanceGroupVersionKind.Kind, + Name: pod.Labels[virtv1.DomainLabel], + UID: types.UID(pod.Annotations[virtv1.CreatedByAnnotation]), + Controller: &t, + BlockOwnerDeletion: &t, + } +} diff --git a/vendor/kubevirt.io/kubevirt/pkg/virt-handler/cmd-client/client.go b/vendor/kubevirt.io/kubevirt/pkg/virt-handler/cmd-client/client.go index 3f2d8e918..c31d98dbd 100644 --- a/vendor/kubevirt.io/kubevirt/pkg/virt-handler/cmd-client/client.go +++ b/vendor/kubevirt.io/kubevirt/pkg/virt-handler/cmd-client/client.go @@ -51,13 +51,13 @@ type Reply struct { type Args struct { // used for domain management - VM *v1.VirtualMachine + VMI *v1.VirtualMachineInstance } type LauncherClient interface { - SyncVirtualMachine(vm *v1.VirtualMachine) error - ShutdownVirtualMachine(vm *v1.VirtualMachine) error - KillVirtualMachine(vm *v1.VirtualMachine) error + SyncVirtualMachine(vmi *v1.VirtualMachineInstance) error + ShutdownVirtualMachine(vmi *v1.VirtualMachineInstance) error + KillVirtualMachine(vmi *v1.VirtualMachineInstance) error GetDomain() (*api.Domain, bool, error) Ping() error Close() @@ -140,22 +140,22 @@ func (c *VirtLauncherClient) genericSendCmd(args *Args, cmd string) (*Reply, err return reply, nil } -func (c *VirtLauncherClient) ShutdownVirtualMachine(vm *v1.VirtualMachine) error { +func (c *VirtLauncherClient) ShutdownVirtualMachine(vmi *v1.VirtualMachineInstance) error { cmd := "Launcher.Shutdown" args := &Args{ - VM: vm, + VMI: vmi, } _, err := c.genericSendCmd(args, cmd) return err } -func (c *VirtLauncherClient) KillVirtualMachine(vm *v1.VirtualMachine) error { +func (c *VirtLauncherClient) KillVirtualMachine(vmi *v1.VirtualMachineInstance) error { cmd := "Launcher.Kill" args := &Args{ - VM: vm, + VMI: vmi, } _, err := c.genericSendCmd(args, cmd) @@ -181,12 +181,12 @@ func (c *VirtLauncherClient) GetDomain() (*api.Domain, bool, error) { return domain, exists, nil } -func (c *VirtLauncherClient) SyncVirtualMachine(vm *v1.VirtualMachine) error { +func (c *VirtLauncherClient) SyncVirtualMachine(vmi *v1.VirtualMachineInstance) error { cmd := "Launcher.Sync" args := &Args{ - VM: vm, + VMI: vmi, } _, err := c.genericSendCmd(args, cmd) diff --git a/vendor/kubevirt.io/kubevirt/pkg/virt-handler/cmd-client/generated_mock_client.go b/vendor/kubevirt.io/kubevirt/pkg/virt-handler/cmd-client/generated_mock_client.go index dff687506..1df1e5f0b 100644 --- a/vendor/kubevirt.io/kubevirt/pkg/virt-handler/cmd-client/generated_mock_client.go +++ b/vendor/kubevirt.io/kubevirt/pkg/virt-handler/cmd-client/generated_mock_client.go @@ -31,8 +31,8 @@ func (_m *MockLauncherClient) EXPECT() *_MockLauncherClientRecorder { return _m.recorder } -func (_m *MockLauncherClient) SyncVirtualMachine(vm *v1.VirtualMachine) error { - ret := _m.ctrl.Call(_m, "SyncVirtualMachine", vm) +func (_m *MockLauncherClient) SyncVirtualMachine(vmi *v1.VirtualMachineInstance) error { + ret := _m.ctrl.Call(_m, "SyncVirtualMachine", vmi) ret0, _ := ret[0].(error) return ret0 } @@ -41,8 +41,8 @@ func (_mr *_MockLauncherClientRecorder) SyncVirtualMachine(arg0 interface{}) *go return _mr.mock.ctrl.RecordCall(_mr.mock, "SyncVirtualMachine", arg0) } -func (_m *MockLauncherClient) ShutdownVirtualMachine(vm *v1.VirtualMachine) error { - ret := _m.ctrl.Call(_m, "ShutdownVirtualMachine", vm) +func (_m *MockLauncherClient) ShutdownVirtualMachine(vmi *v1.VirtualMachineInstance) error { + ret := _m.ctrl.Call(_m, "ShutdownVirtualMachine", vmi) ret0, _ := ret[0].(error) return ret0 } @@ -51,8 +51,8 @@ func (_mr *_MockLauncherClientRecorder) ShutdownVirtualMachine(arg0 interface{}) return _mr.mock.ctrl.RecordCall(_mr.mock, "ShutdownVirtualMachine", arg0) } -func (_m *MockLauncherClient) KillVirtualMachine(vm *v1.VirtualMachine) error { - ret := _m.ctrl.Call(_m, "KillVirtualMachine", vm) +func (_m *MockLauncherClient) KillVirtualMachine(vmi *v1.VirtualMachineInstance) error { + ret := _m.ctrl.Call(_m, "KillVirtualMachine", vmi) ret0, _ := ret[0].(error) return ret0 } diff --git a/vendor/kubevirt.io/kubevirt/pkg/virt-handler/device-manager/device_controller.go b/vendor/kubevirt.io/kubevirt/pkg/virt-handler/device-manager/device_controller.go new file mode 100644 index 000000000..67d08c531 --- /dev/null +++ b/vendor/kubevirt.io/kubevirt/pkg/virt-handler/device-manager/device_controller.go @@ -0,0 +1,141 @@ +/* + * This file is part of the KubeVirt project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Copyright 2018 Red Hat, Inc. + * + */ + +package device_manager + +import ( + "fmt" + "os" + "path/filepath" + + "github.com/fsnotify/fsnotify" + + "kubevirt.io/kubevirt/pkg/log" +) + +const ( + KVMPath = "/dev/kvm" + KVMName = "kvm" + TunPath = "/dev/net/tun" + TunName = "tun" +) + +type DeviceController struct { + devicePlugins []*GenericDevicePlugin + host string + maxDevices int +} + +func NewDeviceController(host string, maxDevices int) *DeviceController { + return &DeviceController{ + devicePlugins: []*GenericDevicePlugin{ + NewGenericDevicePlugin(KVMName, KVMPath, maxDevices), + NewGenericDevicePlugin(TunName, TunPath, maxDevices), + }, + host: host, + maxDevices: maxDevices, + } +} + +func (c *DeviceController) nodeHasDevice(devicePath string) bool { + _, err := os.Stat(devicePath) + // Since this is a boolean question, any error means "no" + return (err == nil) +} + +func (c *DeviceController) waitForPath(target string, stop chan struct{}) error { + logger := log.DefaultLogger() + + _, err := os.Stat(target) + if err != nil { + if !os.IsNotExist(err) { + return err + } + } else { + // File already exists, so there's nothing to wait for + return nil + } + + watcher, err := fsnotify.NewWatcher() + if err != nil { + return err + } + defer watcher.Close() + + // Can't watch for a nonexistent file, so watch the parent directory + dirName := filepath.Dir(target) + + _, err = os.Stat(dirName) + if err != nil { + // If the parent directory doesn't exist, there's nothing to watch + return err + } + + err = watcher.Add(dirName) + if err != nil { + logger.Errorf("Error adding path to watcher: %v", err) + return err + } + + for { + select { + case event := <-watcher.Events: + if (event.Op == fsnotify.Create) && (event.Name == target) { + return nil + } + case <-stop: + return fmt.Errorf("shutting down") + } + } +} + +func (c *DeviceController) startDevicePlugin(dev *GenericDevicePlugin, stop chan struct{}) error { + logger := log.DefaultLogger() + if !c.nodeHasDevice(dev.devicePath) { + logger.Infof("%s device not found. Waiting.", dev.deviceName) + err := c.waitForPath(dev.devicePath, stop) + if err != nil { + logger.Errorf("error waiting for %s device: %v", dev.deviceName, err) + return err + } + } + + err := dev.Start(stop) + if err != nil { + logger.Errorf("Error starting %s device plugin: %v", dev.deviceName, err) + return err + } + + logger.Infof("%s device plugin started", dev.deviceName) + return nil +} + +func (c *DeviceController) Run(stop chan struct{}) error { + logger := log.DefaultLogger() + logger.Info("Starting device plugin controller") + + for _, dev := range c.devicePlugins { + c.startDevicePlugin(dev, stop) + } + + <-stop + + logger.Info("Shutting down device plugin controller") + return nil +} diff --git a/vendor/kubevirt.io/kubevirt/pkg/virt-handler/device-manager/deviceplugin/v1alpha/BUILD b/vendor/kubevirt.io/kubevirt/pkg/virt-handler/device-manager/deviceplugin/v1alpha/BUILD new file mode 100644 index 000000000..b60d55569 --- /dev/null +++ b/vendor/kubevirt.io/kubevirt/pkg/virt-handler/device-manager/deviceplugin/v1alpha/BUILD @@ -0,0 +1,41 @@ +package(default_visibility = ["//visibility:public"]) + +load( + "@io_bazel_rules_go//go:def.bzl", + "go_library", +) + +go_library( + name = "go_default_library", + srcs = [ + "api.pb.go", + "constants.go", + ], + importpath = "k8s.io/kubernetes/pkg/kubelet/apis/deviceplugin/v1alpha", + deps = [ + "//vendor/github.com/gogo/protobuf/gogoproto:go_default_library", + "//vendor/github.com/gogo/protobuf/proto:go_default_library", + "//vendor/github.com/gogo/protobuf/sortkeys:go_default_library", + "//vendor/golang.org/x/net/context:go_default_library", + "//vendor/google.golang.org/grpc:go_default_library", + ], +) + +filegroup( + name = "package-srcs", + srcs = glob(["**"]), + tags = ["automanaged"], + visibility = ["//visibility:private"], +) + +filegroup( + name = "all-srcs", + srcs = [":package-srcs"], + tags = ["automanaged"], +) + +filegroup( + name = "go_default_library_protos", + srcs = ["api.proto"], + visibility = ["//visibility:public"], +) diff --git a/vendor/kubevirt.io/kubevirt/pkg/virt-handler/device-manager/deviceplugin/v1alpha/api.pb.go b/vendor/kubevirt.io/kubevirt/pkg/virt-handler/device-manager/deviceplugin/v1alpha/api.pb.go new file mode 100644 index 000000000..75fbbfeea --- /dev/null +++ b/vendor/kubevirt.io/kubevirt/pkg/virt-handler/device-manager/deviceplugin/v1alpha/api.pb.go @@ -0,0 +1,2322 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by protoc-gen-gogo. +// source: api.proto +// DO NOT EDIT! + +/* + Package deviceplugin is a generated protocol buffer package. + + It is generated from these files: + api.proto + + It has these top-level messages: + RegisterRequest + Empty + ListAndWatchResponse + Device + AllocateRequest + AllocateResponse + Mount + DeviceSpec +*/ +package deviceplugin + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" +import _ "github.com/gogo/protobuf/gogoproto" + +import ( + context "golang.org/x/net/context" + grpc "google.golang.org/grpc" +) + +import strings "strings" +import reflect "reflect" +import github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +type RegisterRequest struct { + // Version of the API the Device Plugin was built against + Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` + // Name of the unix socket the device plugin is listening on + // PATH = path.Join(DevicePluginPath, endpoint) + Endpoint string `protobuf:"bytes,2,opt,name=endpoint,proto3" json:"endpoint,omitempty"` + // Schedulable resource name. As of now it's expected to be a DNS Label + ResourceName string `protobuf:"bytes,3,opt,name=resource_name,json=resourceName,proto3" json:"resource_name,omitempty"` +} + +func (m *RegisterRequest) Reset() { *m = RegisterRequest{} } +func (*RegisterRequest) ProtoMessage() {} +func (*RegisterRequest) Descriptor() ([]byte, []int) { return fileDescriptorApi, []int{0} } + +func (m *RegisterRequest) GetVersion() string { + if m != nil { + return m.Version + } + return "" +} + +func (m *RegisterRequest) GetEndpoint() string { + if m != nil { + return m.Endpoint + } + return "" +} + +func (m *RegisterRequest) GetResourceName() string { + if m != nil { + return m.ResourceName + } + return "" +} + +type Empty struct { +} + +func (m *Empty) Reset() { *m = Empty{} } +func (*Empty) ProtoMessage() {} +func (*Empty) Descriptor() ([]byte, []int) { return fileDescriptorApi, []int{1} } + +// ListAndWatch returns a stream of List of Devices +// Whenever a Device state changes or a Device disappears, ListAndWatch +// returns the new list +type ListAndWatchResponse struct { + Devices []*Device `protobuf:"bytes,1,rep,name=devices" json:"devices,omitempty"` +} + +func (m *ListAndWatchResponse) Reset() { *m = ListAndWatchResponse{} } +func (*ListAndWatchResponse) ProtoMessage() {} +func (*ListAndWatchResponse) Descriptor() ([]byte, []int) { return fileDescriptorApi, []int{2} } + +func (m *ListAndWatchResponse) GetDevices() []*Device { + if m != nil { + return m.Devices + } + return nil +} + +// E.g: +// struct Device { +// ID: "GPU-fef8089b-4820-abfc-e83e-94318197576e", +// State: "Healthy", +// } +type Device struct { + // A unique ID assigned by the device plugin used + // to identify devices during the communication + // Max length of this field is 63 characters + ID string `protobuf:"bytes,1,opt,name=ID,json=iD,proto3" json:"ID,omitempty"` + // Health of the device, can be healthy or unhealthy, see constants.go + Health string `protobuf:"bytes,2,opt,name=health,proto3" json:"health,omitempty"` +} + +func (m *Device) Reset() { *m = Device{} } +func (*Device) ProtoMessage() {} +func (*Device) Descriptor() ([]byte, []int) { return fileDescriptorApi, []int{3} } + +func (m *Device) GetID() string { + if m != nil { + return m.ID + } + return "" +} + +func (m *Device) GetHealth() string { + if m != nil { + return m.Health + } + return "" +} + +// - Allocate is expected to be called during pod creation since allocation +// failures for any container would result in pod startup failure. +// - Allocate allows kubelet to exposes additional artifacts in a pod's +// environment as directed by the plugin. +// - Allocate allows Device Plugin to run device specific operations on +// the Devices requested +type AllocateRequest struct { + DevicesIDs []string `protobuf:"bytes,1,rep,name=devicesIDs" json:"devicesIDs,omitempty"` +} + +func (m *AllocateRequest) Reset() { *m = AllocateRequest{} } +func (*AllocateRequest) ProtoMessage() {} +func (*AllocateRequest) Descriptor() ([]byte, []int) { return fileDescriptorApi, []int{4} } + +func (m *AllocateRequest) GetDevicesIDs() []string { + if m != nil { + return m.DevicesIDs + } + return nil +} + +// AllocateResponse includes the artifacts that needs to be injected into +// a container for accessing 'deviceIDs' that were mentioned as part of +// 'AllocateRequest'. +// Failure Handling: +// if Kubelet sends an allocation request for dev1 and dev2. +// Allocation on dev1 succeeds but allocation on dev2 fails. +// The Device plugin should send a ListAndWatch update and fail the +// Allocation request +type AllocateResponse struct { + // List of environment variable to be set in the container to access one of more devices. + Envs map[string]string `protobuf:"bytes,1,rep,name=envs" json:"envs,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + // Mounts for the container. + Mounts []*Mount `protobuf:"bytes,2,rep,name=mounts" json:"mounts,omitempty"` + // Devices for the container. + Devices []*DeviceSpec `protobuf:"bytes,3,rep,name=devices" json:"devices,omitempty"` + // Container annotations to pass to the container runtime + Annotations map[string]string `protobuf:"bytes,4,rep,name=annotations" json:"annotations,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` +} + +func (m *AllocateResponse) Reset() { *m = AllocateResponse{} } +func (*AllocateResponse) ProtoMessage() {} +func (*AllocateResponse) Descriptor() ([]byte, []int) { return fileDescriptorApi, []int{5} } + +func (m *AllocateResponse) GetEnvs() map[string]string { + if m != nil { + return m.Envs + } + return nil +} + +func (m *AllocateResponse) GetMounts() []*Mount { + if m != nil { + return m.Mounts + } + return nil +} + +func (m *AllocateResponse) GetDevices() []*DeviceSpec { + if m != nil { + return m.Devices + } + return nil +} + +func (m *AllocateResponse) GetAnnotations() map[string]string { + if m != nil { + return m.Annotations + } + return nil +} + +// Mount specifies a host volume to mount into a container. +// where device library or tools are installed on host and container +type Mount struct { + // Path of the mount within the container. + ContainerPath string `protobuf:"bytes,1,opt,name=container_path,json=containerPath,proto3" json:"container_path,omitempty"` + // Path of the mount on the host. + HostPath string `protobuf:"bytes,2,opt,name=host_path,json=hostPath,proto3" json:"host_path,omitempty"` + // If set, the mount is read-only. + ReadOnly bool `protobuf:"varint,3,opt,name=read_only,json=readOnly,proto3" json:"read_only,omitempty"` +} + +func (m *Mount) Reset() { *m = Mount{} } +func (*Mount) ProtoMessage() {} +func (*Mount) Descriptor() ([]byte, []int) { return fileDescriptorApi, []int{6} } + +func (m *Mount) GetContainerPath() string { + if m != nil { + return m.ContainerPath + } + return "" +} + +func (m *Mount) GetHostPath() string { + if m != nil { + return m.HostPath + } + return "" +} + +func (m *Mount) GetReadOnly() bool { + if m != nil { + return m.ReadOnly + } + return false +} + +// DeviceSpec specifies a host device to mount into a container. +type DeviceSpec struct { + // Path of the device within the container. + ContainerPath string `protobuf:"bytes,1,opt,name=container_path,json=containerPath,proto3" json:"container_path,omitempty"` + // Path of the device on the host. + HostPath string `protobuf:"bytes,2,opt,name=host_path,json=hostPath,proto3" json:"host_path,omitempty"` + // Cgroups permissions of the device, candidates are one or more of + // * r - allows container to read from the specified device. + // * w - allows container to write to the specified device. + // * m - allows container to create device files that do not yet exist. + Permissions string `protobuf:"bytes,3,opt,name=permissions,proto3" json:"permissions,omitempty"` +} + +func (m *DeviceSpec) Reset() { *m = DeviceSpec{} } +func (*DeviceSpec) ProtoMessage() {} +func (*DeviceSpec) Descriptor() ([]byte, []int) { return fileDescriptorApi, []int{7} } + +func (m *DeviceSpec) GetContainerPath() string { + if m != nil { + return m.ContainerPath + } + return "" +} + +func (m *DeviceSpec) GetHostPath() string { + if m != nil { + return m.HostPath + } + return "" +} + +func (m *DeviceSpec) GetPermissions() string { + if m != nil { + return m.Permissions + } + return "" +} + +func init() { + proto.RegisterType((*RegisterRequest)(nil), "deviceplugin.RegisterRequest") + proto.RegisterType((*Empty)(nil), "deviceplugin.Empty") + proto.RegisterType((*ListAndWatchResponse)(nil), "deviceplugin.ListAndWatchResponse") + proto.RegisterType((*Device)(nil), "deviceplugin.Device") + proto.RegisterType((*AllocateRequest)(nil), "deviceplugin.AllocateRequest") + proto.RegisterType((*AllocateResponse)(nil), "deviceplugin.AllocateResponse") + proto.RegisterType((*Mount)(nil), "deviceplugin.Mount") + proto.RegisterType((*DeviceSpec)(nil), "deviceplugin.DeviceSpec") +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// Client API for Registration service + +type RegistrationClient interface { + Register(ctx context.Context, in *RegisterRequest, opts ...grpc.CallOption) (*Empty, error) +} + +type registrationClient struct { + cc *grpc.ClientConn +} + +func NewRegistrationClient(cc *grpc.ClientConn) RegistrationClient { + return ®istrationClient{cc} +} + +func (c *registrationClient) Register(ctx context.Context, in *RegisterRequest, opts ...grpc.CallOption) (*Empty, error) { + out := new(Empty) + err := grpc.Invoke(ctx, "/deviceplugin.Registration/Register", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Server API for Registration service + +type RegistrationServer interface { + Register(context.Context, *RegisterRequest) (*Empty, error) +} + +func RegisterRegistrationServer(s *grpc.Server, srv RegistrationServer) { + s.RegisterService(&_Registration_serviceDesc, srv) +} + +func _Registration_Register_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RegisterRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RegistrationServer).Register(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/deviceplugin.Registration/Register", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RegistrationServer).Register(ctx, req.(*RegisterRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Registration_serviceDesc = grpc.ServiceDesc{ + ServiceName: "deviceplugin.Registration", + HandlerType: (*RegistrationServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Register", + Handler: _Registration_Register_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "api.proto", +} + +// Client API for DevicePlugin service + +type DevicePluginClient interface { + // ListAndWatch returns a stream of List of Devices + // Whenever a Device state changes or a Device disappears, ListAndWatch + // returns the new list + ListAndWatch(ctx context.Context, in *Empty, opts ...grpc.CallOption) (DevicePlugin_ListAndWatchClient, error) + // Allocate is called during container creation so that the Device + // Plugin can run device specific operations and instruct Kubelet + // of the steps to make the Device available in the container + Allocate(ctx context.Context, in *AllocateRequest, opts ...grpc.CallOption) (*AllocateResponse, error) +} + +type devicePluginClient struct { + cc *grpc.ClientConn +} + +func NewDevicePluginClient(cc *grpc.ClientConn) DevicePluginClient { + return &devicePluginClient{cc} +} + +func (c *devicePluginClient) ListAndWatch(ctx context.Context, in *Empty, opts ...grpc.CallOption) (DevicePlugin_ListAndWatchClient, error) { + stream, err := grpc.NewClientStream(ctx, &_DevicePlugin_serviceDesc.Streams[0], c.cc, "/deviceplugin.DevicePlugin/ListAndWatch", opts...) + if err != nil { + return nil, err + } + x := &devicePluginListAndWatchClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type DevicePlugin_ListAndWatchClient interface { + Recv() (*ListAndWatchResponse, error) + grpc.ClientStream +} + +type devicePluginListAndWatchClient struct { + grpc.ClientStream +} + +func (x *devicePluginListAndWatchClient) Recv() (*ListAndWatchResponse, error) { + m := new(ListAndWatchResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *devicePluginClient) Allocate(ctx context.Context, in *AllocateRequest, opts ...grpc.CallOption) (*AllocateResponse, error) { + out := new(AllocateResponse) + err := grpc.Invoke(ctx, "/deviceplugin.DevicePlugin/Allocate", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Server API for DevicePlugin service + +type DevicePluginServer interface { + // ListAndWatch returns a stream of List of Devices + // Whenever a Device state changes or a Device disappears, ListAndWatch + // returns the new list + ListAndWatch(*Empty, DevicePlugin_ListAndWatchServer) error + // Allocate is called during container creation so that the Device + // Plugin can run device specific operations and instruct Kubelet + // of the steps to make the Device available in the container + Allocate(context.Context, *AllocateRequest) (*AllocateResponse, error) +} + +func RegisterDevicePluginServer(s *grpc.Server, srv DevicePluginServer) { + s.RegisterService(&_DevicePlugin_serviceDesc, srv) +} + +func _DevicePlugin_ListAndWatch_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(Empty) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(DevicePluginServer).ListAndWatch(m, &devicePluginListAndWatchServer{stream}) +} + +type DevicePlugin_ListAndWatchServer interface { + Send(*ListAndWatchResponse) error + grpc.ServerStream +} + +type devicePluginListAndWatchServer struct { + grpc.ServerStream +} + +func (x *devicePluginListAndWatchServer) Send(m *ListAndWatchResponse) error { + return x.ServerStream.SendMsg(m) +} + +func _DevicePlugin_Allocate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AllocateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DevicePluginServer).Allocate(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/deviceplugin.DevicePlugin/Allocate", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DevicePluginServer).Allocate(ctx, req.(*AllocateRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _DevicePlugin_serviceDesc = grpc.ServiceDesc{ + ServiceName: "deviceplugin.DevicePlugin", + HandlerType: (*DevicePluginServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Allocate", + Handler: _DevicePlugin_Allocate_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "ListAndWatch", + Handler: _DevicePlugin_ListAndWatch_Handler, + ServerStreams: true, + }, + }, + Metadata: "api.proto", +} + +func (m *RegisterRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RegisterRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Version) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintApi(dAtA, i, uint64(len(m.Version))) + i += copy(dAtA[i:], m.Version) + } + if len(m.Endpoint) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintApi(dAtA, i, uint64(len(m.Endpoint))) + i += copy(dAtA[i:], m.Endpoint) + } + if len(m.ResourceName) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintApi(dAtA, i, uint64(len(m.ResourceName))) + i += copy(dAtA[i:], m.ResourceName) + } + return i, nil +} + +func (m *Empty) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Empty) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + return i, nil +} + +func (m *ListAndWatchResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ListAndWatchResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Devices) > 0 { + for _, msg := range m.Devices { + dAtA[i] = 0xa + i++ + i = encodeVarintApi(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + return i, nil +} + +func (m *Device) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Device) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.ID) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintApi(dAtA, i, uint64(len(m.ID))) + i += copy(dAtA[i:], m.ID) + } + if len(m.Health) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintApi(dAtA, i, uint64(len(m.Health))) + i += copy(dAtA[i:], m.Health) + } + return i, nil +} + +func (m *AllocateRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *AllocateRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.DevicesIDs) > 0 { + for _, s := range m.DevicesIDs { + dAtA[i] = 0xa + i++ + l = len(s) + for l >= 1<<7 { + dAtA[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + dAtA[i] = uint8(l) + i++ + i += copy(dAtA[i:], s) + } + } + return i, nil +} + +func (m *AllocateResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *AllocateResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Envs) > 0 { + for k := range m.Envs { + dAtA[i] = 0xa + i++ + v := m.Envs[k] + mapSize := 1 + len(k) + sovApi(uint64(len(k))) + 1 + len(v) + sovApi(uint64(len(v))) + i = encodeVarintApi(dAtA, i, uint64(mapSize)) + dAtA[i] = 0xa + i++ + i = encodeVarintApi(dAtA, i, uint64(len(k))) + i += copy(dAtA[i:], k) + dAtA[i] = 0x12 + i++ + i = encodeVarintApi(dAtA, i, uint64(len(v))) + i += copy(dAtA[i:], v) + } + } + if len(m.Mounts) > 0 { + for _, msg := range m.Mounts { + dAtA[i] = 0x12 + i++ + i = encodeVarintApi(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if len(m.Devices) > 0 { + for _, msg := range m.Devices { + dAtA[i] = 0x1a + i++ + i = encodeVarintApi(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if len(m.Annotations) > 0 { + for k := range m.Annotations { + dAtA[i] = 0x22 + i++ + v := m.Annotations[k] + mapSize := 1 + len(k) + sovApi(uint64(len(k))) + 1 + len(v) + sovApi(uint64(len(v))) + i = encodeVarintApi(dAtA, i, uint64(mapSize)) + dAtA[i] = 0xa + i++ + i = encodeVarintApi(dAtA, i, uint64(len(k))) + i += copy(dAtA[i:], k) + dAtA[i] = 0x12 + i++ + i = encodeVarintApi(dAtA, i, uint64(len(v))) + i += copy(dAtA[i:], v) + } + } + return i, nil +} + +func (m *Mount) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Mount) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.ContainerPath) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintApi(dAtA, i, uint64(len(m.ContainerPath))) + i += copy(dAtA[i:], m.ContainerPath) + } + if len(m.HostPath) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintApi(dAtA, i, uint64(len(m.HostPath))) + i += copy(dAtA[i:], m.HostPath) + } + if m.ReadOnly { + dAtA[i] = 0x18 + i++ + if m.ReadOnly { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + return i, nil +} + +func (m *DeviceSpec) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DeviceSpec) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.ContainerPath) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintApi(dAtA, i, uint64(len(m.ContainerPath))) + i += copy(dAtA[i:], m.ContainerPath) + } + if len(m.HostPath) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintApi(dAtA, i, uint64(len(m.HostPath))) + i += copy(dAtA[i:], m.HostPath) + } + if len(m.Permissions) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintApi(dAtA, i, uint64(len(m.Permissions))) + i += copy(dAtA[i:], m.Permissions) + } + return i, nil +} + +func encodeFixed64Api(dAtA []byte, offset int, v uint64) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + dAtA[offset+4] = uint8(v >> 32) + dAtA[offset+5] = uint8(v >> 40) + dAtA[offset+6] = uint8(v >> 48) + dAtA[offset+7] = uint8(v >> 56) + return offset + 8 +} +func encodeFixed32Api(dAtA []byte, offset int, v uint32) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + return offset + 4 +} +func encodeVarintApi(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *RegisterRequest) Size() (n int) { + var l int + _ = l + l = len(m.Version) + if l > 0 { + n += 1 + l + sovApi(uint64(l)) + } + l = len(m.Endpoint) + if l > 0 { + n += 1 + l + sovApi(uint64(l)) + } + l = len(m.ResourceName) + if l > 0 { + n += 1 + l + sovApi(uint64(l)) + } + return n +} + +func (m *Empty) Size() (n int) { + var l int + _ = l + return n +} + +func (m *ListAndWatchResponse) Size() (n int) { + var l int + _ = l + if len(m.Devices) > 0 { + for _, e := range m.Devices { + l = e.Size() + n += 1 + l + sovApi(uint64(l)) + } + } + return n +} + +func (m *Device) Size() (n int) { + var l int + _ = l + l = len(m.ID) + if l > 0 { + n += 1 + l + sovApi(uint64(l)) + } + l = len(m.Health) + if l > 0 { + n += 1 + l + sovApi(uint64(l)) + } + return n +} + +func (m *AllocateRequest) Size() (n int) { + var l int + _ = l + if len(m.DevicesIDs) > 0 { + for _, s := range m.DevicesIDs { + l = len(s) + n += 1 + l + sovApi(uint64(l)) + } + } + return n +} + +func (m *AllocateResponse) Size() (n int) { + var l int + _ = l + if len(m.Envs) > 0 { + for k, v := range m.Envs { + _ = k + _ = v + mapEntrySize := 1 + len(k) + sovApi(uint64(len(k))) + 1 + len(v) + sovApi(uint64(len(v))) + n += mapEntrySize + 1 + sovApi(uint64(mapEntrySize)) + } + } + if len(m.Mounts) > 0 { + for _, e := range m.Mounts { + l = e.Size() + n += 1 + l + sovApi(uint64(l)) + } + } + if len(m.Devices) > 0 { + for _, e := range m.Devices { + l = e.Size() + n += 1 + l + sovApi(uint64(l)) + } + } + if len(m.Annotations) > 0 { + for k, v := range m.Annotations { + _ = k + _ = v + mapEntrySize := 1 + len(k) + sovApi(uint64(len(k))) + 1 + len(v) + sovApi(uint64(len(v))) + n += mapEntrySize + 1 + sovApi(uint64(mapEntrySize)) + } + } + return n +} + +func (m *Mount) Size() (n int) { + var l int + _ = l + l = len(m.ContainerPath) + if l > 0 { + n += 1 + l + sovApi(uint64(l)) + } + l = len(m.HostPath) + if l > 0 { + n += 1 + l + sovApi(uint64(l)) + } + if m.ReadOnly { + n += 2 + } + return n +} + +func (m *DeviceSpec) Size() (n int) { + var l int + _ = l + l = len(m.ContainerPath) + if l > 0 { + n += 1 + l + sovApi(uint64(l)) + } + l = len(m.HostPath) + if l > 0 { + n += 1 + l + sovApi(uint64(l)) + } + l = len(m.Permissions) + if l > 0 { + n += 1 + l + sovApi(uint64(l)) + } + return n +} + +func sovApi(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozApi(x uint64) (n int) { + return sovApi(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *RegisterRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&RegisterRequest{`, + `Version:` + fmt.Sprintf("%v", this.Version) + `,`, + `Endpoint:` + fmt.Sprintf("%v", this.Endpoint) + `,`, + `ResourceName:` + fmt.Sprintf("%v", this.ResourceName) + `,`, + `}`, + }, "") + return s +} +func (this *Empty) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Empty{`, + `}`, + }, "") + return s +} +func (this *ListAndWatchResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ListAndWatchResponse{`, + `Devices:` + strings.Replace(fmt.Sprintf("%v", this.Devices), "Device", "Device", 1) + `,`, + `}`, + }, "") + return s +} +func (this *Device) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Device{`, + `ID:` + fmt.Sprintf("%v", this.ID) + `,`, + `Health:` + fmt.Sprintf("%v", this.Health) + `,`, + `}`, + }, "") + return s +} +func (this *AllocateRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&AllocateRequest{`, + `DevicesIDs:` + fmt.Sprintf("%v", this.DevicesIDs) + `,`, + `}`, + }, "") + return s +} +func (this *AllocateResponse) String() string { + if this == nil { + return "nil" + } + keysForEnvs := make([]string, 0, len(this.Envs)) + for k := range this.Envs { + keysForEnvs = append(keysForEnvs, k) + } + github_com_gogo_protobuf_sortkeys.Strings(keysForEnvs) + mapStringForEnvs := "map[string]string{" + for _, k := range keysForEnvs { + mapStringForEnvs += fmt.Sprintf("%v: %v,", k, this.Envs[k]) + } + mapStringForEnvs += "}" + keysForAnnotations := make([]string, 0, len(this.Annotations)) + for k := range this.Annotations { + keysForAnnotations = append(keysForAnnotations, k) + } + github_com_gogo_protobuf_sortkeys.Strings(keysForAnnotations) + mapStringForAnnotations := "map[string]string{" + for _, k := range keysForAnnotations { + mapStringForAnnotations += fmt.Sprintf("%v: %v,", k, this.Annotations[k]) + } + mapStringForAnnotations += "}" + s := strings.Join([]string{`&AllocateResponse{`, + `Envs:` + mapStringForEnvs + `,`, + `Mounts:` + strings.Replace(fmt.Sprintf("%v", this.Mounts), "Mount", "Mount", 1) + `,`, + `Devices:` + strings.Replace(fmt.Sprintf("%v", this.Devices), "DeviceSpec", "DeviceSpec", 1) + `,`, + `Annotations:` + mapStringForAnnotations + `,`, + `}`, + }, "") + return s +} +func (this *Mount) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Mount{`, + `ContainerPath:` + fmt.Sprintf("%v", this.ContainerPath) + `,`, + `HostPath:` + fmt.Sprintf("%v", this.HostPath) + `,`, + `ReadOnly:` + fmt.Sprintf("%v", this.ReadOnly) + `,`, + `}`, + }, "") + return s +} +func (this *DeviceSpec) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&DeviceSpec{`, + `ContainerPath:` + fmt.Sprintf("%v", this.ContainerPath) + `,`, + `HostPath:` + fmt.Sprintf("%v", this.HostPath) + `,`, + `Permissions:` + fmt.Sprintf("%v", this.Permissions) + `,`, + `}`, + }, "") + return s +} +func valueToStringApi(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *RegisterRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RegisterRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RegisterRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthApi + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Version = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Endpoint", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthApi + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Endpoint = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResourceName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthApi + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ResourceName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipApi(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthApi + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Empty) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Empty: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Empty: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipApi(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthApi + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ListAndWatchResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ListAndWatchResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ListAndWatchResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Devices", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthApi + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Devices = append(m.Devices, &Device{}) + if err := m.Devices[len(m.Devices)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipApi(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthApi + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Device) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Device: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Device: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthApi + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Health", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthApi + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Health = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipApi(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthApi + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *AllocateRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: AllocateRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AllocateRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DevicesIDs", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthApi + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DevicesIDs = append(m.DevicesIDs, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipApi(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthApi + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *AllocateResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: AllocateResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AllocateResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Envs", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthApi + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + var keykey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + keykey |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthApi + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey := string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + if m.Envs == nil { + m.Envs = make(map[string]string) + } + if iNdEx < postIndex { + var valuekey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + valuekey |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + var stringLenmapvalue uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapvalue |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapvalue := int(stringLenmapvalue) + if intStringLenmapvalue < 0 { + return ErrInvalidLengthApi + } + postStringIndexmapvalue := iNdEx + intStringLenmapvalue + if postStringIndexmapvalue > l { + return io.ErrUnexpectedEOF + } + mapvalue := string(dAtA[iNdEx:postStringIndexmapvalue]) + iNdEx = postStringIndexmapvalue + m.Envs[mapkey] = mapvalue + } else { + var mapvalue string + m.Envs[mapkey] = mapvalue + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Mounts", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthApi + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Mounts = append(m.Mounts, &Mount{}) + if err := m.Mounts[len(m.Mounts)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Devices", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthApi + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Devices = append(m.Devices, &DeviceSpec{}) + if err := m.Devices[len(m.Devices)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Annotations", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthApi + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + var keykey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + keykey |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthApi + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey := string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + if m.Annotations == nil { + m.Annotations = make(map[string]string) + } + if iNdEx < postIndex { + var valuekey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + valuekey |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + var stringLenmapvalue uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapvalue |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapvalue := int(stringLenmapvalue) + if intStringLenmapvalue < 0 { + return ErrInvalidLengthApi + } + postStringIndexmapvalue := iNdEx + intStringLenmapvalue + if postStringIndexmapvalue > l { + return io.ErrUnexpectedEOF + } + mapvalue := string(dAtA[iNdEx:postStringIndexmapvalue]) + iNdEx = postStringIndexmapvalue + m.Annotations[mapkey] = mapvalue + } else { + var mapvalue string + m.Annotations[mapkey] = mapvalue + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipApi(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthApi + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Mount) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Mount: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Mount: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContainerPath", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthApi + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ContainerPath = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field HostPath", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthApi + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.HostPath = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ReadOnly", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.ReadOnly = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipApi(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthApi + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DeviceSpec) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeviceSpec: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeviceSpec: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContainerPath", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthApi + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ContainerPath = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field HostPath", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthApi + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.HostPath = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Permissions", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthApi + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Permissions = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipApi(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthApi + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipApi(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowApi + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowApi + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowApi + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthApi + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowApi + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipApi(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthApi = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowApi = fmt.Errorf("proto: integer overflow") +) + +func init() { proto.RegisterFile("api.proto", fileDescriptorApi) } + +var fileDescriptorApi = []byte{ + // 594 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0x5d, 0x8b, 0xd3, 0x40, + 0x14, 0x6d, 0xd2, 0xdd, 0x6e, 0x7b, 0xdb, 0xdd, 0x2d, 0x63, 0x91, 0x10, 0x35, 0x94, 0x88, 0x50, + 0x10, 0xd3, 0xb5, 0x3e, 0x28, 0x22, 0x62, 0xa5, 0x15, 0x96, 0xf5, 0xa3, 0xc6, 0x07, 0x1f, 0xcb, + 0x34, 0x1d, 0x9b, 0xc1, 0x64, 0x26, 0x66, 0x26, 0x85, 0xbe, 0xf9, 0x13, 0xfc, 0x19, 0xfe, 0x94, + 0x7d, 0xf4, 0xd1, 0x47, 0xb7, 0xfe, 0x0e, 0x41, 0x3a, 0x49, 0xfa, 0x11, 0x8a, 0x22, 0xf8, 0x96, + 0x7b, 0xe6, 0x9e, 0xc9, 0xb9, 0x27, 0xf7, 0x04, 0x6a, 0x38, 0xa2, 0x4e, 0x14, 0x73, 0xc9, 0x51, + 0x63, 0x4a, 0xe6, 0xd4, 0x23, 0x51, 0x90, 0xcc, 0x28, 0x33, 0xef, 0xcd, 0xa8, 0xf4, 0x93, 0x89, + 0xe3, 0xf1, 0xb0, 0x3b, 0xe3, 0x33, 0xde, 0x55, 0x4d, 0x93, 0xe4, 0x83, 0xaa, 0x54, 0xa1, 0x9e, + 0x52, 0xb2, 0x1d, 0xc0, 0xa9, 0x4b, 0x66, 0x54, 0x48, 0x12, 0xbb, 0xe4, 0x53, 0x42, 0x84, 0x44, + 0x06, 0x1c, 0xcd, 0x49, 0x2c, 0x28, 0x67, 0x86, 0xd6, 0xd6, 0x3a, 0x35, 0x37, 0x2f, 0x91, 0x09, + 0x55, 0xc2, 0xa6, 0x11, 0xa7, 0x4c, 0x1a, 0xba, 0x3a, 0x5a, 0xd7, 0xe8, 0x36, 0x1c, 0xc7, 0x44, + 0xf0, 0x24, 0xf6, 0xc8, 0x98, 0xe1, 0x90, 0x18, 0x65, 0xd5, 0xd0, 0xc8, 0xc1, 0xd7, 0x38, 0x24, + 0xf6, 0x11, 0x1c, 0x0e, 0xc3, 0x48, 0x2e, 0xec, 0x17, 0xd0, 0x7a, 0x49, 0x85, 0xec, 0xb3, 0xe9, + 0x7b, 0x2c, 0x3d, 0xdf, 0x25, 0x22, 0xe2, 0x4c, 0x10, 0xe4, 0xc0, 0x51, 0x3a, 0x8d, 0x30, 0xb4, + 0x76, 0xb9, 0x53, 0xef, 0xb5, 0x9c, 0xed, 0xe9, 0x9c, 0x81, 0x2a, 0xdc, 0xbc, 0xc9, 0x3e, 0x83, + 0x4a, 0x0a, 0xa1, 0x13, 0xd0, 0xcf, 0x07, 0x99, 0x60, 0x9d, 0x0e, 0xd0, 0x75, 0xa8, 0xf8, 0x04, + 0x07, 0xd2, 0xcf, 0x94, 0x66, 0x95, 0x7d, 0x1f, 0x4e, 0xfb, 0x41, 0xc0, 0x3d, 0x2c, 0x49, 0x3e, + 0xb0, 0x05, 0x90, 0xdd, 0x77, 0x3e, 0x48, 0xdf, 0x5b, 0x73, 0xb7, 0x10, 0xfb, 0x97, 0x0e, 0xcd, + 0x0d, 0x27, 0x53, 0xfa, 0x04, 0x0e, 0x08, 0x9b, 0xe7, 0x32, 0x3b, 0xbb, 0x32, 0x8b, 0xdd, 0xce, + 0x90, 0xcd, 0xc5, 0x90, 0xc9, 0x78, 0xe1, 0x2a, 0x16, 0xba, 0x0b, 0x95, 0x90, 0x27, 0x4c, 0x0a, + 0x43, 0x57, 0xfc, 0x6b, 0xbb, 0xfc, 0x57, 0xab, 0x33, 0x37, 0x6b, 0x41, 0xbd, 0x8d, 0x29, 0x65, + 0xd5, 0x6d, 0xec, 0x33, 0xe5, 0x5d, 0x44, 0xbc, 0xb5, 0x31, 0xe8, 0x2d, 0xd4, 0x31, 0x63, 0x5c, + 0x62, 0x49, 0x39, 0x13, 0xc6, 0x81, 0xe2, 0x75, 0xff, 0xa2, 0xb2, 0xbf, 0x61, 0xa4, 0x62, 0xb7, + 0xef, 0x30, 0x1f, 0x42, 0x6d, 0x3d, 0x06, 0x6a, 0x42, 0xf9, 0x23, 0x59, 0x64, 0x7e, 0xaf, 0x1e, + 0x51, 0x0b, 0x0e, 0xe7, 0x38, 0x48, 0x48, 0xe6, 0x77, 0x5a, 0x3c, 0xd6, 0x1f, 0x69, 0xe6, 0x53, + 0x68, 0x16, 0x6f, 0xfe, 0x17, 0xbe, 0xed, 0xc3, 0xa1, 0x32, 0x04, 0xdd, 0x81, 0x13, 0x8f, 0x33, + 0x89, 0x29, 0x23, 0xf1, 0x38, 0xc2, 0xd2, 0xcf, 0xf8, 0xc7, 0x6b, 0x74, 0x84, 0xa5, 0x8f, 0x6e, + 0x40, 0xcd, 0xe7, 0x42, 0xa6, 0x1d, 0xd9, 0x9e, 0xae, 0x80, 0xfc, 0x30, 0x26, 0x78, 0x3a, 0xe6, + 0x2c, 0x58, 0xa8, 0x1d, 0xad, 0xba, 0xd5, 0x15, 0xf0, 0x86, 0x05, 0x0b, 0x3b, 0x06, 0xd8, 0x98, + 0xf9, 0x5f, 0x5e, 0xd7, 0x86, 0x7a, 0x44, 0xe2, 0x90, 0x0a, 0xa1, 0xbe, 0x43, 0x1a, 0x8a, 0x6d, + 0xa8, 0x37, 0x82, 0x46, 0x9a, 0xc0, 0x58, 0xf9, 0x83, 0x9e, 0x41, 0x35, 0x4f, 0x24, 0xba, 0xb5, + 0xfb, 0xc1, 0x0a, 0x49, 0x35, 0x0b, 0x5b, 0x93, 0x46, 0xab, 0xd4, 0xfb, 0xaa, 0x41, 0x23, 0x1d, + 0x63, 0xa4, 0x0e, 0xd0, 0x05, 0x34, 0xb6, 0xd3, 0x86, 0xf6, 0xf1, 0x4c, 0x7b, 0x17, 0xdc, 0x17, + 0x4f, 0xbb, 0x74, 0xa6, 0xa1, 0x0b, 0xa8, 0xe6, 0x8b, 0x53, 0xd4, 0x57, 0x08, 0x96, 0x69, 0xfd, + 0x79, 0xdf, 0xec, 0xd2, 0xf3, 0x9b, 0x97, 0x57, 0x96, 0xf6, 0xfd, 0xca, 0x2a, 0x7d, 0x5e, 0x5a, + 0xda, 0xe5, 0xd2, 0xd2, 0xbe, 0x2d, 0x2d, 0xed, 0xc7, 0xd2, 0xd2, 0xbe, 0xfc, 0xb4, 0x4a, 0x93, + 0x8a, 0xfa, 0x47, 0x3d, 0xf8, 0x1d, 0x00, 0x00, 0xff, 0xff, 0x67, 0x68, 0xfd, 0xfd, 0xed, 0x04, + 0x00, 0x00, +} diff --git a/vendor/kubevirt.io/kubevirt/pkg/virt-handler/device-manager/deviceplugin/v1alpha/api.proto b/vendor/kubevirt.io/kubevirt/pkg/virt-handler/device-manager/deviceplugin/v1alpha/api.proto new file mode 100644 index 000000000..3198a0d40 --- /dev/null +++ b/vendor/kubevirt.io/kubevirt/pkg/virt-handler/device-manager/deviceplugin/v1alpha/api.proto @@ -0,0 +1,125 @@ +// To regenerate api.pb.go run hack/update-device-plugin.sh +syntax = 'proto3'; + +package deviceplugin; + +import "github.com/gogo/protobuf/gogoproto/gogo.proto"; + +option (gogoproto.goproto_stringer_all) = false; +option (gogoproto.stringer_all) = true; +option (gogoproto.goproto_getters_all) = true; +option (gogoproto.marshaler_all) = true; +option (gogoproto.sizer_all) = true; +option (gogoproto.unmarshaler_all) = true; +option (gogoproto.goproto_unrecognized_all) = false; + + +// Registration is the service advertised by the Kubelet +// Only when Kubelet answers with a success code to a Register Request +// may Device Plugins start their service +// Registration may fail when device plugin version is not supported by +// Kubelet or the registered resourceName is already taken by another +// active device plugin. Device plugin is expected to terminate upon registration failure +service Registration { + rpc Register(RegisterRequest) returns (Empty) {} +} + +message RegisterRequest { + // Version of the API the Device Plugin was built against + string version = 1; + // Name of the unix socket the device plugin is listening on + // PATH = path.Join(DevicePluginPath, endpoint) + string endpoint = 2; + // Schedulable resource name. As of now it's expected to be a DNS Label + string resource_name = 3; +} + +message Empty { +} + +// DevicePlugin is the service advertised by Device Plugins +service DevicePlugin { + // ListAndWatch returns a stream of List of Devices + // Whenever a Device state changes or a Device disappears, ListAndWatch + // returns the new list + rpc ListAndWatch(Empty) returns (stream ListAndWatchResponse) {} + + // Allocate is called during container creation so that the Device + // Plugin can run device specific operations and instruct Kubelet + // of the steps to make the Device available in the container + rpc Allocate(AllocateRequest) returns (AllocateResponse) {} +} + +// ListAndWatch returns a stream of List of Devices +// Whenever a Device state changes or a Device disappears, ListAndWatch +// returns the new list +message ListAndWatchResponse { + repeated Device devices = 1; +} + +/* E.g: +* struct Device { +* ID: "GPU-fef8089b-4820-abfc-e83e-94318197576e", +* State: "Healthy", +*} */ +message Device { + // A unique ID assigned by the device plugin used + // to identify devices during the communication + // Max length of this field is 63 characters + string ID = 1; + // Health of the device, can be healthy or unhealthy, see constants.go + string health = 2; +} + +// - Allocate is expected to be called during pod creation since allocation +// failures for any container would result in pod startup failure. +// - Allocate allows kubelet to exposes additional artifacts in a pod's +// environment as directed by the plugin. +// - Allocate allows Device Plugin to run device specific operations on +// the Devices requested +message AllocateRequest { + repeated string devicesIDs = 1; +} + +// AllocateResponse includes the artifacts that needs to be injected into +// a container for accessing 'deviceIDs' that were mentioned as part of +// 'AllocateRequest'. +// Failure Handling: +// if Kubelet sends an allocation request for dev1 and dev2. +// Allocation on dev1 succeeds but allocation on dev2 fails. +// The Device plugin should send a ListAndWatch update and fail the +// Allocation request +message AllocateResponse { + // List of environment variable to be set in the container to access one of more devices. + map envs = 1; + // Mounts for the container. + repeated Mount mounts = 2; + // Devices for the container. + repeated DeviceSpec devices = 3; + // Container annotations to pass to the container runtime + map annotations = 4; +} + +// Mount specifies a host volume to mount into a container. +// where device library or tools are installed on host and container +message Mount { + // Path of the mount within the container. + string container_path = 1; + // Path of the mount on the host. + string host_path = 2; + // If set, the mount is read-only. + bool read_only = 3; +} + +// DeviceSpec specifies a host device to mount into a container. +message DeviceSpec { + // Path of the device within the container. + string container_path = 1; + // Path of the device on the host. + string host_path = 2; + // Cgroups permissions of the device, candidates are one or more of + // * r - allows container to read from the specified device. + // * w - allows container to write to the specified device. + // * m - allows container to create device files that do not yet exist. + string permissions = 3; +} diff --git a/vendor/kubevirt.io/kubevirt/pkg/virt-handler/device-manager/deviceplugin/v1alpha/constants.go b/vendor/kubevirt.io/kubevirt/pkg/virt-handler/device-manager/deviceplugin/v1alpha/constants.go new file mode 100644 index 000000000..34e8847fa --- /dev/null +++ b/vendor/kubevirt.io/kubevirt/pkg/virt-handler/device-manager/deviceplugin/v1alpha/constants.go @@ -0,0 +1,33 @@ +/* +Copyright 2017 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package deviceplugin + +const ( + // Healthy means that the device is healthy + Healthy = "Healthy" + // Unhealthy means that the device is unhealthy + Unhealthy = "Unhealthy" + + // Current version of the API supported by kubelet + Version = "v1alpha2" + // DevicePluginPath is the folder the Device Plugin is expecting sockets to be on + // Only privileged pods have access to this path + // Note: Placeholder until we find a "standard path" + DevicePluginPath = "/var/lib/kubelet/device-plugins/" + // KubeletSocket is the path of the Kubelet registry socket + KubeletSocket = DevicePluginPath + "kubelet.sock" +) diff --git a/vendor/kubevirt.io/kubevirt/pkg/virt-handler/device-manager/deviceplugin/v1beta1/BUILD b/vendor/kubevirt.io/kubevirt/pkg/virt-handler/device-manager/deviceplugin/v1beta1/BUILD new file mode 100644 index 000000000..82a6bdd91 --- /dev/null +++ b/vendor/kubevirt.io/kubevirt/pkg/virt-handler/device-manager/deviceplugin/v1beta1/BUILD @@ -0,0 +1,40 @@ +package(default_visibility = ["//visibility:public"]) + +load( + "@io_bazel_rules_go//go:def.bzl", + "go_library", +) + +go_library( + name = "go_default_library", + srcs = [ + "api.pb.go", + "constants.go", + ], + importpath = "k8s.io/kubernetes/pkg/kubelet/apis/deviceplugin/v1beta1", + deps = [ + "//vendor/github.com/gogo/protobuf/gogoproto:go_default_library", + "//vendor/github.com/gogo/protobuf/proto:go_default_library", + "//vendor/github.com/gogo/protobuf/sortkeys:go_default_library", + "//vendor/golang.org/x/net/context:go_default_library", + "//vendor/google.golang.org/grpc:go_default_library", + ], +) + +filegroup( + name = "package-srcs", + srcs = glob(["**"]), + tags = ["automanaged"], + visibility = ["//visibility:private"], +) + +filegroup( + name = "all-srcs", + srcs = [":package-srcs"], + tags = ["automanaged"], +) + +filegroup( + name = "go_default_library_protos", + srcs = ["api.proto"], +) diff --git a/vendor/kubevirt.io/kubevirt/pkg/virt-handler/device-manager/deviceplugin/v1beta1/api.pb.go b/vendor/kubevirt.io/kubevirt/pkg/virt-handler/device-manager/deviceplugin/v1beta1/api.pb.go new file mode 100644 index 000000000..2aeb99f3b --- /dev/null +++ b/vendor/kubevirt.io/kubevirt/pkg/virt-handler/device-manager/deviceplugin/v1beta1/api.pb.go @@ -0,0 +1,3148 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by protoc-gen-gogo. +// source: api.proto +// DO NOT EDIT! + +/* + Package v1beta1 is a generated protocol buffer package. + + It is generated from these files: + api.proto + + It has these top-level messages: + DevicePluginOptions + RegisterRequest + Empty + ListAndWatchResponse + Device + PreStartContainerRequest + PreStartContainerResponse + AllocateRequest + ContainerAllocateRequest + AllocateResponse + ContainerAllocateResponse + Mount + DeviceSpec +*/ +package v1beta1 + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" +import _ "github.com/gogo/protobuf/gogoproto" + +import ( + context "golang.org/x/net/context" + grpc "google.golang.org/grpc" +) + +import strings "strings" +import reflect "reflect" +import github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +type DevicePluginOptions struct { + // Indicates if PreStartContainer call is required before each container start + PreStartRequired bool `protobuf:"varint,1,opt,name=pre_start_required,json=preStartRequired,proto3" json:"pre_start_required,omitempty"` +} + +func (m *DevicePluginOptions) Reset() { *m = DevicePluginOptions{} } +func (*DevicePluginOptions) ProtoMessage() {} +func (*DevicePluginOptions) Descriptor() ([]byte, []int) { return fileDescriptorApi, []int{0} } + +func (m *DevicePluginOptions) GetPreStartRequired() bool { + if m != nil { + return m.PreStartRequired + } + return false +} + +type RegisterRequest struct { + // Version of the API the Device Plugin was built against + Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` + // Name of the unix socket the device plugin is listening on + // PATH = path.Join(DevicePluginPath, endpoint) + Endpoint string `protobuf:"bytes,2,opt,name=endpoint,proto3" json:"endpoint,omitempty"` + // Schedulable resource name. As of now it's expected to be a DNS Label + ResourceName string `protobuf:"bytes,3,opt,name=resource_name,json=resourceName,proto3" json:"resource_name,omitempty"` + // Options to be communicated with Device Manager + Options *DevicePluginOptions `protobuf:"bytes,4,opt,name=options" json:"options,omitempty"` +} + +func (m *RegisterRequest) Reset() { *m = RegisterRequest{} } +func (*RegisterRequest) ProtoMessage() {} +func (*RegisterRequest) Descriptor() ([]byte, []int) { return fileDescriptorApi, []int{1} } + +func (m *RegisterRequest) GetVersion() string { + if m != nil { + return m.Version + } + return "" +} + +func (m *RegisterRequest) GetEndpoint() string { + if m != nil { + return m.Endpoint + } + return "" +} + +func (m *RegisterRequest) GetResourceName() string { + if m != nil { + return m.ResourceName + } + return "" +} + +func (m *RegisterRequest) GetOptions() *DevicePluginOptions { + if m != nil { + return m.Options + } + return nil +} + +type Empty struct { +} + +func (m *Empty) Reset() { *m = Empty{} } +func (*Empty) ProtoMessage() {} +func (*Empty) Descriptor() ([]byte, []int) { return fileDescriptorApi, []int{2} } + +// ListAndWatch returns a stream of List of Devices +// Whenever a Device state change or a Device disapears, ListAndWatch +// returns the new list +type ListAndWatchResponse struct { + Devices []*Device `protobuf:"bytes,1,rep,name=devices" json:"devices,omitempty"` +} + +func (m *ListAndWatchResponse) Reset() { *m = ListAndWatchResponse{} } +func (*ListAndWatchResponse) ProtoMessage() {} +func (*ListAndWatchResponse) Descriptor() ([]byte, []int) { return fileDescriptorApi, []int{3} } + +func (m *ListAndWatchResponse) GetDevices() []*Device { + if m != nil { + return m.Devices + } + return nil +} + +// E.g: +// struct Device { +// ID: "GPU-fef8089b-4820-abfc-e83e-94318197576e", +// State: "Healthy", +// } +type Device struct { + // A unique ID assigned by the device plugin used + // to identify devices during the communication + // Max length of this field is 63 characters + ID string `protobuf:"bytes,1,opt,name=ID,json=iD,proto3" json:"ID,omitempty"` + // Health of the device, can be healthy or unhealthy, see constants.go + Health string `protobuf:"bytes,2,opt,name=health,proto3" json:"health,omitempty"` +} + +func (m *Device) Reset() { *m = Device{} } +func (*Device) ProtoMessage() {} +func (*Device) Descriptor() ([]byte, []int) { return fileDescriptorApi, []int{4} } + +func (m *Device) GetID() string { + if m != nil { + return m.ID + } + return "" +} + +func (m *Device) GetHealth() string { + if m != nil { + return m.Health + } + return "" +} + +// - PreStartContainer is expected to be called before each container start if indicated by plugin during registration phase. +// - PreStartContainer allows kubelet to pass reinitialized devices to containers. +// - PreStartContainer allows Device Plugin to run device specific operations on +// the Devices requested +type PreStartContainerRequest struct { + DevicesIDs []string `protobuf:"bytes,1,rep,name=devicesIDs" json:"devicesIDs,omitempty"` +} + +func (m *PreStartContainerRequest) Reset() { *m = PreStartContainerRequest{} } +func (*PreStartContainerRequest) ProtoMessage() {} +func (*PreStartContainerRequest) Descriptor() ([]byte, []int) { return fileDescriptorApi, []int{5} } + +func (m *PreStartContainerRequest) GetDevicesIDs() []string { + if m != nil { + return m.DevicesIDs + } + return nil +} + +// PreStartContainerResponse will be send by plugin in response to PreStartContainerRequest +type PreStartContainerResponse struct { +} + +func (m *PreStartContainerResponse) Reset() { *m = PreStartContainerResponse{} } +func (*PreStartContainerResponse) ProtoMessage() {} +func (*PreStartContainerResponse) Descriptor() ([]byte, []int) { return fileDescriptorApi, []int{6} } + +// - Allocate is expected to be called during pod creation since allocation +// failures for any container would result in pod startup failure. +// - Allocate allows kubelet to exposes additional artifacts in a pod's +// environment as directed by the plugin. +// - Allocate allows Device Plugin to run device specific operations on +// the Devices requested +type AllocateRequest struct { + ContainerRequests []*ContainerAllocateRequest `protobuf:"bytes,1,rep,name=container_requests,json=containerRequests" json:"container_requests,omitempty"` +} + +func (m *AllocateRequest) Reset() { *m = AllocateRequest{} } +func (*AllocateRequest) ProtoMessage() {} +func (*AllocateRequest) Descriptor() ([]byte, []int) { return fileDescriptorApi, []int{7} } + +func (m *AllocateRequest) GetContainerRequests() []*ContainerAllocateRequest { + if m != nil { + return m.ContainerRequests + } + return nil +} + +type ContainerAllocateRequest struct { + DevicesIDs []string `protobuf:"bytes,1,rep,name=devicesIDs" json:"devicesIDs,omitempty"` +} + +func (m *ContainerAllocateRequest) Reset() { *m = ContainerAllocateRequest{} } +func (*ContainerAllocateRequest) ProtoMessage() {} +func (*ContainerAllocateRequest) Descriptor() ([]byte, []int) { return fileDescriptorApi, []int{8} } + +func (m *ContainerAllocateRequest) GetDevicesIDs() []string { + if m != nil { + return m.DevicesIDs + } + return nil +} + +// AllocateResponse includes the artifacts that needs to be injected into +// a container for accessing 'deviceIDs' that were mentioned as part of +// 'AllocateRequest'. +// Failure Handling: +// if Kubelet sends an allocation request for dev1 and dev2. +// Allocation on dev1 succeeds but allocation on dev2 fails. +// The Device plugin should send a ListAndWatch update and fail the +// Allocation request +type AllocateResponse struct { + ContainerResponses []*ContainerAllocateResponse `protobuf:"bytes,1,rep,name=container_responses,json=containerResponses" json:"container_responses,omitempty"` +} + +func (m *AllocateResponse) Reset() { *m = AllocateResponse{} } +func (*AllocateResponse) ProtoMessage() {} +func (*AllocateResponse) Descriptor() ([]byte, []int) { return fileDescriptorApi, []int{9} } + +func (m *AllocateResponse) GetContainerResponses() []*ContainerAllocateResponse { + if m != nil { + return m.ContainerResponses + } + return nil +} + +type ContainerAllocateResponse struct { + // List of environment variable to be set in the container to access one of more devices. + Envs map[string]string `protobuf:"bytes,1,rep,name=envs" json:"envs,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + // Mounts for the container. + Mounts []*Mount `protobuf:"bytes,2,rep,name=mounts" json:"mounts,omitempty"` + // Devices for the container. + Devices []*DeviceSpec `protobuf:"bytes,3,rep,name=devices" json:"devices,omitempty"` + // Container annotations to pass to the container runtime + Annotations map[string]string `protobuf:"bytes,4,rep,name=annotations" json:"annotations,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` +} + +func (m *ContainerAllocateResponse) Reset() { *m = ContainerAllocateResponse{} } +func (*ContainerAllocateResponse) ProtoMessage() {} +func (*ContainerAllocateResponse) Descriptor() ([]byte, []int) { return fileDescriptorApi, []int{10} } + +func (m *ContainerAllocateResponse) GetEnvs() map[string]string { + if m != nil { + return m.Envs + } + return nil +} + +func (m *ContainerAllocateResponse) GetMounts() []*Mount { + if m != nil { + return m.Mounts + } + return nil +} + +func (m *ContainerAllocateResponse) GetDevices() []*DeviceSpec { + if m != nil { + return m.Devices + } + return nil +} + +func (m *ContainerAllocateResponse) GetAnnotations() map[string]string { + if m != nil { + return m.Annotations + } + return nil +} + +// Mount specifies a host volume to mount into a container. +// where device library or tools are installed on host and container +type Mount struct { + // Path of the mount within the container. + ContainerPath string `protobuf:"bytes,1,opt,name=container_path,json=containerPath,proto3" json:"container_path,omitempty"` + // Path of the mount on the host. + HostPath string `protobuf:"bytes,2,opt,name=host_path,json=hostPath,proto3" json:"host_path,omitempty"` + // If set, the mount is read-only. + ReadOnly bool `protobuf:"varint,3,opt,name=read_only,json=readOnly,proto3" json:"read_only,omitempty"` +} + +func (m *Mount) Reset() { *m = Mount{} } +func (*Mount) ProtoMessage() {} +func (*Mount) Descriptor() ([]byte, []int) { return fileDescriptorApi, []int{11} } + +func (m *Mount) GetContainerPath() string { + if m != nil { + return m.ContainerPath + } + return "" +} + +func (m *Mount) GetHostPath() string { + if m != nil { + return m.HostPath + } + return "" +} + +func (m *Mount) GetReadOnly() bool { + if m != nil { + return m.ReadOnly + } + return false +} + +// DeviceSpec specifies a host device to mount into a container. +type DeviceSpec struct { + // Path of the device within the container. + ContainerPath string `protobuf:"bytes,1,opt,name=container_path,json=containerPath,proto3" json:"container_path,omitempty"` + // Path of the device on the host. + HostPath string `protobuf:"bytes,2,opt,name=host_path,json=hostPath,proto3" json:"host_path,omitempty"` + // Cgroups permissions of the device, candidates are one or more of + // * r - allows container to read from the specified device. + // * w - allows container to write to the specified device. + // * m - allows container to create device files that do not yet exist. + Permissions string `protobuf:"bytes,3,opt,name=permissions,proto3" json:"permissions,omitempty"` +} + +func (m *DeviceSpec) Reset() { *m = DeviceSpec{} } +func (*DeviceSpec) ProtoMessage() {} +func (*DeviceSpec) Descriptor() ([]byte, []int) { return fileDescriptorApi, []int{12} } + +func (m *DeviceSpec) GetContainerPath() string { + if m != nil { + return m.ContainerPath + } + return "" +} + +func (m *DeviceSpec) GetHostPath() string { + if m != nil { + return m.HostPath + } + return "" +} + +func (m *DeviceSpec) GetPermissions() string { + if m != nil { + return m.Permissions + } + return "" +} + +func init() { + proto.RegisterType((*DevicePluginOptions)(nil), "v1beta1.DevicePluginOptions") + proto.RegisterType((*RegisterRequest)(nil), "v1beta1.RegisterRequest") + proto.RegisterType((*Empty)(nil), "v1beta1.Empty") + proto.RegisterType((*ListAndWatchResponse)(nil), "v1beta1.ListAndWatchResponse") + proto.RegisterType((*Device)(nil), "v1beta1.Device") + proto.RegisterType((*PreStartContainerRequest)(nil), "v1beta1.PreStartContainerRequest") + proto.RegisterType((*PreStartContainerResponse)(nil), "v1beta1.PreStartContainerResponse") + proto.RegisterType((*AllocateRequest)(nil), "v1beta1.AllocateRequest") + proto.RegisterType((*ContainerAllocateRequest)(nil), "v1beta1.ContainerAllocateRequest") + proto.RegisterType((*AllocateResponse)(nil), "v1beta1.AllocateResponse") + proto.RegisterType((*ContainerAllocateResponse)(nil), "v1beta1.ContainerAllocateResponse") + proto.RegisterType((*Mount)(nil), "v1beta1.Mount") + proto.RegisterType((*DeviceSpec)(nil), "v1beta1.DeviceSpec") +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// Client API for Registration service + +type RegistrationClient interface { + Register(ctx context.Context, in *RegisterRequest, opts ...grpc.CallOption) (*Empty, error) +} + +type registrationClient struct { + cc *grpc.ClientConn +} + +func NewRegistrationClient(cc *grpc.ClientConn) RegistrationClient { + return ®istrationClient{cc} +} + +func (c *registrationClient) Register(ctx context.Context, in *RegisterRequest, opts ...grpc.CallOption) (*Empty, error) { + out := new(Empty) + err := grpc.Invoke(ctx, "/v1beta1.Registration/Register", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Server API for Registration service + +type RegistrationServer interface { + Register(context.Context, *RegisterRequest) (*Empty, error) +} + +func RegisterRegistrationServer(s *grpc.Server, srv RegistrationServer) { + s.RegisterService(&_Registration_serviceDesc, srv) +} + +func _Registration_Register_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RegisterRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RegistrationServer).Register(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/v1beta1.Registration/Register", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RegistrationServer).Register(ctx, req.(*RegisterRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Registration_serviceDesc = grpc.ServiceDesc{ + ServiceName: "v1beta1.Registration", + HandlerType: (*RegistrationServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Register", + Handler: _Registration_Register_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "api.proto", +} + +// Client API for DevicePlugin service + +type DevicePluginClient interface { + // GetDevicePluginOptions returns options to be communicated with Device + // Manager + GetDevicePluginOptions(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*DevicePluginOptions, error) + // ListAndWatch returns a stream of List of Devices + // Whenever a Device state change or a Device disapears, ListAndWatch + // returns the new list + ListAndWatch(ctx context.Context, in *Empty, opts ...grpc.CallOption) (DevicePlugin_ListAndWatchClient, error) + // Allocate is called during container creation so that the Device + // Plugin can run device specific operations and instruct Kubelet + // of the steps to make the Device available in the container + Allocate(ctx context.Context, in *AllocateRequest, opts ...grpc.CallOption) (*AllocateResponse, error) + // PreStartContainer is called, if indicated by Device Plugin during registeration phase, + // before each container start. Device plugin can run device specific operations + // such as reseting the device before making devices available to the container + PreStartContainer(ctx context.Context, in *PreStartContainerRequest, opts ...grpc.CallOption) (*PreStartContainerResponse, error) +} + +type devicePluginClient struct { + cc *grpc.ClientConn +} + +func NewDevicePluginClient(cc *grpc.ClientConn) DevicePluginClient { + return &devicePluginClient{cc} +} + +func (c *devicePluginClient) GetDevicePluginOptions(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*DevicePluginOptions, error) { + out := new(DevicePluginOptions) + err := grpc.Invoke(ctx, "/v1beta1.DevicePlugin/GetDevicePluginOptions", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *devicePluginClient) ListAndWatch(ctx context.Context, in *Empty, opts ...grpc.CallOption) (DevicePlugin_ListAndWatchClient, error) { + stream, err := grpc.NewClientStream(ctx, &_DevicePlugin_serviceDesc.Streams[0], c.cc, "/v1beta1.DevicePlugin/ListAndWatch", opts...) + if err != nil { + return nil, err + } + x := &devicePluginListAndWatchClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type DevicePlugin_ListAndWatchClient interface { + Recv() (*ListAndWatchResponse, error) + grpc.ClientStream +} + +type devicePluginListAndWatchClient struct { + grpc.ClientStream +} + +func (x *devicePluginListAndWatchClient) Recv() (*ListAndWatchResponse, error) { + m := new(ListAndWatchResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *devicePluginClient) Allocate(ctx context.Context, in *AllocateRequest, opts ...grpc.CallOption) (*AllocateResponse, error) { + out := new(AllocateResponse) + err := grpc.Invoke(ctx, "/v1beta1.DevicePlugin/Allocate", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *devicePluginClient) PreStartContainer(ctx context.Context, in *PreStartContainerRequest, opts ...grpc.CallOption) (*PreStartContainerResponse, error) { + out := new(PreStartContainerResponse) + err := grpc.Invoke(ctx, "/v1beta1.DevicePlugin/PreStartContainer", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Server API for DevicePlugin service + +type DevicePluginServer interface { + // GetDevicePluginOptions returns options to be communicated with Device + // Manager + GetDevicePluginOptions(context.Context, *Empty) (*DevicePluginOptions, error) + // ListAndWatch returns a stream of List of Devices + // Whenever a Device state change or a Device disapears, ListAndWatch + // returns the new list + ListAndWatch(*Empty, DevicePlugin_ListAndWatchServer) error + // Allocate is called during container creation so that the Device + // Plugin can run device specific operations and instruct Kubelet + // of the steps to make the Device available in the container + Allocate(context.Context, *AllocateRequest) (*AllocateResponse, error) + // PreStartContainer is called, if indicated by Device Plugin during registeration phase, + // before each container start. Device plugin can run device specific operations + // such as reseting the device before making devices available to the container + PreStartContainer(context.Context, *PreStartContainerRequest) (*PreStartContainerResponse, error) +} + +func RegisterDevicePluginServer(s *grpc.Server, srv DevicePluginServer) { + s.RegisterService(&_DevicePlugin_serviceDesc, srv) +} + +func _DevicePlugin_GetDevicePluginOptions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(Empty) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DevicePluginServer).GetDevicePluginOptions(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/v1beta1.DevicePlugin/GetDevicePluginOptions", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DevicePluginServer).GetDevicePluginOptions(ctx, req.(*Empty)) + } + return interceptor(ctx, in, info, handler) +} + +func _DevicePlugin_ListAndWatch_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(Empty) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(DevicePluginServer).ListAndWatch(m, &devicePluginListAndWatchServer{stream}) +} + +type DevicePlugin_ListAndWatchServer interface { + Send(*ListAndWatchResponse) error + grpc.ServerStream +} + +type devicePluginListAndWatchServer struct { + grpc.ServerStream +} + +func (x *devicePluginListAndWatchServer) Send(m *ListAndWatchResponse) error { + return x.ServerStream.SendMsg(m) +} + +func _DevicePlugin_Allocate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AllocateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DevicePluginServer).Allocate(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/v1beta1.DevicePlugin/Allocate", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DevicePluginServer).Allocate(ctx, req.(*AllocateRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _DevicePlugin_PreStartContainer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PreStartContainerRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DevicePluginServer).PreStartContainer(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/v1beta1.DevicePlugin/PreStartContainer", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DevicePluginServer).PreStartContainer(ctx, req.(*PreStartContainerRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _DevicePlugin_serviceDesc = grpc.ServiceDesc{ + ServiceName: "v1beta1.DevicePlugin", + HandlerType: (*DevicePluginServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetDevicePluginOptions", + Handler: _DevicePlugin_GetDevicePluginOptions_Handler, + }, + { + MethodName: "Allocate", + Handler: _DevicePlugin_Allocate_Handler, + }, + { + MethodName: "PreStartContainer", + Handler: _DevicePlugin_PreStartContainer_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "ListAndWatch", + Handler: _DevicePlugin_ListAndWatch_Handler, + ServerStreams: true, + }, + }, + Metadata: "api.proto", +} + +func (m *DevicePluginOptions) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DevicePluginOptions) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.PreStartRequired { + dAtA[i] = 0x8 + i++ + if m.PreStartRequired { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + return i, nil +} + +func (m *RegisterRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RegisterRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Version) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintApi(dAtA, i, uint64(len(m.Version))) + i += copy(dAtA[i:], m.Version) + } + if len(m.Endpoint) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintApi(dAtA, i, uint64(len(m.Endpoint))) + i += copy(dAtA[i:], m.Endpoint) + } + if len(m.ResourceName) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintApi(dAtA, i, uint64(len(m.ResourceName))) + i += copy(dAtA[i:], m.ResourceName) + } + if m.Options != nil { + dAtA[i] = 0x22 + i++ + i = encodeVarintApi(dAtA, i, uint64(m.Options.Size())) + n1, err := m.Options.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n1 + } + return i, nil +} + +func (m *Empty) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Empty) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + return i, nil +} + +func (m *ListAndWatchResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ListAndWatchResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Devices) > 0 { + for _, msg := range m.Devices { + dAtA[i] = 0xa + i++ + i = encodeVarintApi(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + return i, nil +} + +func (m *Device) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Device) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.ID) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintApi(dAtA, i, uint64(len(m.ID))) + i += copy(dAtA[i:], m.ID) + } + if len(m.Health) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintApi(dAtA, i, uint64(len(m.Health))) + i += copy(dAtA[i:], m.Health) + } + return i, nil +} + +func (m *PreStartContainerRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PreStartContainerRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.DevicesIDs) > 0 { + for _, s := range m.DevicesIDs { + dAtA[i] = 0xa + i++ + l = len(s) + for l >= 1<<7 { + dAtA[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + dAtA[i] = uint8(l) + i++ + i += copy(dAtA[i:], s) + } + } + return i, nil +} + +func (m *PreStartContainerResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PreStartContainerResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + return i, nil +} + +func (m *AllocateRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *AllocateRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.ContainerRequests) > 0 { + for _, msg := range m.ContainerRequests { + dAtA[i] = 0xa + i++ + i = encodeVarintApi(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + return i, nil +} + +func (m *ContainerAllocateRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ContainerAllocateRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.DevicesIDs) > 0 { + for _, s := range m.DevicesIDs { + dAtA[i] = 0xa + i++ + l = len(s) + for l >= 1<<7 { + dAtA[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + dAtA[i] = uint8(l) + i++ + i += copy(dAtA[i:], s) + } + } + return i, nil +} + +func (m *AllocateResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *AllocateResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.ContainerResponses) > 0 { + for _, msg := range m.ContainerResponses { + dAtA[i] = 0xa + i++ + i = encodeVarintApi(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + return i, nil +} + +func (m *ContainerAllocateResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ContainerAllocateResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Envs) > 0 { + for k := range m.Envs { + dAtA[i] = 0xa + i++ + v := m.Envs[k] + mapSize := 1 + len(k) + sovApi(uint64(len(k))) + 1 + len(v) + sovApi(uint64(len(v))) + i = encodeVarintApi(dAtA, i, uint64(mapSize)) + dAtA[i] = 0xa + i++ + i = encodeVarintApi(dAtA, i, uint64(len(k))) + i += copy(dAtA[i:], k) + dAtA[i] = 0x12 + i++ + i = encodeVarintApi(dAtA, i, uint64(len(v))) + i += copy(dAtA[i:], v) + } + } + if len(m.Mounts) > 0 { + for _, msg := range m.Mounts { + dAtA[i] = 0x12 + i++ + i = encodeVarintApi(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if len(m.Devices) > 0 { + for _, msg := range m.Devices { + dAtA[i] = 0x1a + i++ + i = encodeVarintApi(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if len(m.Annotations) > 0 { + for k := range m.Annotations { + dAtA[i] = 0x22 + i++ + v := m.Annotations[k] + mapSize := 1 + len(k) + sovApi(uint64(len(k))) + 1 + len(v) + sovApi(uint64(len(v))) + i = encodeVarintApi(dAtA, i, uint64(mapSize)) + dAtA[i] = 0xa + i++ + i = encodeVarintApi(dAtA, i, uint64(len(k))) + i += copy(dAtA[i:], k) + dAtA[i] = 0x12 + i++ + i = encodeVarintApi(dAtA, i, uint64(len(v))) + i += copy(dAtA[i:], v) + } + } + return i, nil +} + +func (m *Mount) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Mount) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.ContainerPath) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintApi(dAtA, i, uint64(len(m.ContainerPath))) + i += copy(dAtA[i:], m.ContainerPath) + } + if len(m.HostPath) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintApi(dAtA, i, uint64(len(m.HostPath))) + i += copy(dAtA[i:], m.HostPath) + } + if m.ReadOnly { + dAtA[i] = 0x18 + i++ + if m.ReadOnly { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + return i, nil +} + +func (m *DeviceSpec) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DeviceSpec) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.ContainerPath) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintApi(dAtA, i, uint64(len(m.ContainerPath))) + i += copy(dAtA[i:], m.ContainerPath) + } + if len(m.HostPath) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintApi(dAtA, i, uint64(len(m.HostPath))) + i += copy(dAtA[i:], m.HostPath) + } + if len(m.Permissions) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintApi(dAtA, i, uint64(len(m.Permissions))) + i += copy(dAtA[i:], m.Permissions) + } + return i, nil +} + +func encodeFixed64Api(dAtA []byte, offset int, v uint64) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + dAtA[offset+4] = uint8(v >> 32) + dAtA[offset+5] = uint8(v >> 40) + dAtA[offset+6] = uint8(v >> 48) + dAtA[offset+7] = uint8(v >> 56) + return offset + 8 +} +func encodeFixed32Api(dAtA []byte, offset int, v uint32) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + return offset + 4 +} +func encodeVarintApi(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *DevicePluginOptions) Size() (n int) { + var l int + _ = l + if m.PreStartRequired { + n += 2 + } + return n +} + +func (m *RegisterRequest) Size() (n int) { + var l int + _ = l + l = len(m.Version) + if l > 0 { + n += 1 + l + sovApi(uint64(l)) + } + l = len(m.Endpoint) + if l > 0 { + n += 1 + l + sovApi(uint64(l)) + } + l = len(m.ResourceName) + if l > 0 { + n += 1 + l + sovApi(uint64(l)) + } + if m.Options != nil { + l = m.Options.Size() + n += 1 + l + sovApi(uint64(l)) + } + return n +} + +func (m *Empty) Size() (n int) { + var l int + _ = l + return n +} + +func (m *ListAndWatchResponse) Size() (n int) { + var l int + _ = l + if len(m.Devices) > 0 { + for _, e := range m.Devices { + l = e.Size() + n += 1 + l + sovApi(uint64(l)) + } + } + return n +} + +func (m *Device) Size() (n int) { + var l int + _ = l + l = len(m.ID) + if l > 0 { + n += 1 + l + sovApi(uint64(l)) + } + l = len(m.Health) + if l > 0 { + n += 1 + l + sovApi(uint64(l)) + } + return n +} + +func (m *PreStartContainerRequest) Size() (n int) { + var l int + _ = l + if len(m.DevicesIDs) > 0 { + for _, s := range m.DevicesIDs { + l = len(s) + n += 1 + l + sovApi(uint64(l)) + } + } + return n +} + +func (m *PreStartContainerResponse) Size() (n int) { + var l int + _ = l + return n +} + +func (m *AllocateRequest) Size() (n int) { + var l int + _ = l + if len(m.ContainerRequests) > 0 { + for _, e := range m.ContainerRequests { + l = e.Size() + n += 1 + l + sovApi(uint64(l)) + } + } + return n +} + +func (m *ContainerAllocateRequest) Size() (n int) { + var l int + _ = l + if len(m.DevicesIDs) > 0 { + for _, s := range m.DevicesIDs { + l = len(s) + n += 1 + l + sovApi(uint64(l)) + } + } + return n +} + +func (m *AllocateResponse) Size() (n int) { + var l int + _ = l + if len(m.ContainerResponses) > 0 { + for _, e := range m.ContainerResponses { + l = e.Size() + n += 1 + l + sovApi(uint64(l)) + } + } + return n +} + +func (m *ContainerAllocateResponse) Size() (n int) { + var l int + _ = l + if len(m.Envs) > 0 { + for k, v := range m.Envs { + _ = k + _ = v + mapEntrySize := 1 + len(k) + sovApi(uint64(len(k))) + 1 + len(v) + sovApi(uint64(len(v))) + n += mapEntrySize + 1 + sovApi(uint64(mapEntrySize)) + } + } + if len(m.Mounts) > 0 { + for _, e := range m.Mounts { + l = e.Size() + n += 1 + l + sovApi(uint64(l)) + } + } + if len(m.Devices) > 0 { + for _, e := range m.Devices { + l = e.Size() + n += 1 + l + sovApi(uint64(l)) + } + } + if len(m.Annotations) > 0 { + for k, v := range m.Annotations { + _ = k + _ = v + mapEntrySize := 1 + len(k) + sovApi(uint64(len(k))) + 1 + len(v) + sovApi(uint64(len(v))) + n += mapEntrySize + 1 + sovApi(uint64(mapEntrySize)) + } + } + return n +} + +func (m *Mount) Size() (n int) { + var l int + _ = l + l = len(m.ContainerPath) + if l > 0 { + n += 1 + l + sovApi(uint64(l)) + } + l = len(m.HostPath) + if l > 0 { + n += 1 + l + sovApi(uint64(l)) + } + if m.ReadOnly { + n += 2 + } + return n +} + +func (m *DeviceSpec) Size() (n int) { + var l int + _ = l + l = len(m.ContainerPath) + if l > 0 { + n += 1 + l + sovApi(uint64(l)) + } + l = len(m.HostPath) + if l > 0 { + n += 1 + l + sovApi(uint64(l)) + } + l = len(m.Permissions) + if l > 0 { + n += 1 + l + sovApi(uint64(l)) + } + return n +} + +func sovApi(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozApi(x uint64) (n int) { + return sovApi(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *DevicePluginOptions) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&DevicePluginOptions{`, + `PreStartRequired:` + fmt.Sprintf("%v", this.PreStartRequired) + `,`, + `}`, + }, "") + return s +} +func (this *RegisterRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&RegisterRequest{`, + `Version:` + fmt.Sprintf("%v", this.Version) + `,`, + `Endpoint:` + fmt.Sprintf("%v", this.Endpoint) + `,`, + `ResourceName:` + fmt.Sprintf("%v", this.ResourceName) + `,`, + `Options:` + strings.Replace(fmt.Sprintf("%v", this.Options), "DevicePluginOptions", "DevicePluginOptions", 1) + `,`, + `}`, + }, "") + return s +} +func (this *Empty) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Empty{`, + `}`, + }, "") + return s +} +func (this *ListAndWatchResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ListAndWatchResponse{`, + `Devices:` + strings.Replace(fmt.Sprintf("%v", this.Devices), "Device", "Device", 1) + `,`, + `}`, + }, "") + return s +} +func (this *Device) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Device{`, + `ID:` + fmt.Sprintf("%v", this.ID) + `,`, + `Health:` + fmt.Sprintf("%v", this.Health) + `,`, + `}`, + }, "") + return s +} +func (this *PreStartContainerRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&PreStartContainerRequest{`, + `DevicesIDs:` + fmt.Sprintf("%v", this.DevicesIDs) + `,`, + `}`, + }, "") + return s +} +func (this *PreStartContainerResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&PreStartContainerResponse{`, + `}`, + }, "") + return s +} +func (this *AllocateRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&AllocateRequest{`, + `ContainerRequests:` + strings.Replace(fmt.Sprintf("%v", this.ContainerRequests), "ContainerAllocateRequest", "ContainerAllocateRequest", 1) + `,`, + `}`, + }, "") + return s +} +func (this *ContainerAllocateRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ContainerAllocateRequest{`, + `DevicesIDs:` + fmt.Sprintf("%v", this.DevicesIDs) + `,`, + `}`, + }, "") + return s +} +func (this *AllocateResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&AllocateResponse{`, + `ContainerResponses:` + strings.Replace(fmt.Sprintf("%v", this.ContainerResponses), "ContainerAllocateResponse", "ContainerAllocateResponse", 1) + `,`, + `}`, + }, "") + return s +} +func (this *ContainerAllocateResponse) String() string { + if this == nil { + return "nil" + } + keysForEnvs := make([]string, 0, len(this.Envs)) + for k := range this.Envs { + keysForEnvs = append(keysForEnvs, k) + } + github_com_gogo_protobuf_sortkeys.Strings(keysForEnvs) + mapStringForEnvs := "map[string]string{" + for _, k := range keysForEnvs { + mapStringForEnvs += fmt.Sprintf("%v: %v,", k, this.Envs[k]) + } + mapStringForEnvs += "}" + keysForAnnotations := make([]string, 0, len(this.Annotations)) + for k := range this.Annotations { + keysForAnnotations = append(keysForAnnotations, k) + } + github_com_gogo_protobuf_sortkeys.Strings(keysForAnnotations) + mapStringForAnnotations := "map[string]string{" + for _, k := range keysForAnnotations { + mapStringForAnnotations += fmt.Sprintf("%v: %v,", k, this.Annotations[k]) + } + mapStringForAnnotations += "}" + s := strings.Join([]string{`&ContainerAllocateResponse{`, + `Envs:` + mapStringForEnvs + `,`, + `Mounts:` + strings.Replace(fmt.Sprintf("%v", this.Mounts), "Mount", "Mount", 1) + `,`, + `Devices:` + strings.Replace(fmt.Sprintf("%v", this.Devices), "DeviceSpec", "DeviceSpec", 1) + `,`, + `Annotations:` + mapStringForAnnotations + `,`, + `}`, + }, "") + return s +} +func (this *Mount) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Mount{`, + `ContainerPath:` + fmt.Sprintf("%v", this.ContainerPath) + `,`, + `HostPath:` + fmt.Sprintf("%v", this.HostPath) + `,`, + `ReadOnly:` + fmt.Sprintf("%v", this.ReadOnly) + `,`, + `}`, + }, "") + return s +} +func (this *DeviceSpec) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&DeviceSpec{`, + `ContainerPath:` + fmt.Sprintf("%v", this.ContainerPath) + `,`, + `HostPath:` + fmt.Sprintf("%v", this.HostPath) + `,`, + `Permissions:` + fmt.Sprintf("%v", this.Permissions) + `,`, + `}`, + }, "") + return s +} +func valueToStringApi(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *DevicePluginOptions) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DevicePluginOptions: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DevicePluginOptions: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PreStartRequired", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.PreStartRequired = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipApi(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthApi + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RegisterRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RegisterRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RegisterRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthApi + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Version = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Endpoint", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthApi + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Endpoint = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResourceName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthApi + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ResourceName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Options", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthApi + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Options == nil { + m.Options = &DevicePluginOptions{} + } + if err := m.Options.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipApi(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthApi + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Empty) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Empty: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Empty: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipApi(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthApi + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ListAndWatchResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ListAndWatchResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ListAndWatchResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Devices", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthApi + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Devices = append(m.Devices, &Device{}) + if err := m.Devices[len(m.Devices)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipApi(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthApi + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Device) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Device: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Device: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthApi + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Health", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthApi + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Health = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipApi(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthApi + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PreStartContainerRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PreStartContainerRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PreStartContainerRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DevicesIDs", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthApi + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DevicesIDs = append(m.DevicesIDs, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipApi(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthApi + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PreStartContainerResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PreStartContainerResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PreStartContainerResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipApi(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthApi + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *AllocateRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: AllocateRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AllocateRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContainerRequests", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthApi + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ContainerRequests = append(m.ContainerRequests, &ContainerAllocateRequest{}) + if err := m.ContainerRequests[len(m.ContainerRequests)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipApi(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthApi + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ContainerAllocateRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ContainerAllocateRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ContainerAllocateRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DevicesIDs", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthApi + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DevicesIDs = append(m.DevicesIDs, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipApi(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthApi + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *AllocateResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: AllocateResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AllocateResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContainerResponses", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthApi + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ContainerResponses = append(m.ContainerResponses, &ContainerAllocateResponse{}) + if err := m.ContainerResponses[len(m.ContainerResponses)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipApi(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthApi + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ContainerAllocateResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ContainerAllocateResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ContainerAllocateResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Envs", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthApi + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + var keykey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + keykey |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthApi + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey := string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + if m.Envs == nil { + m.Envs = make(map[string]string) + } + if iNdEx < postIndex { + var valuekey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + valuekey |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + var stringLenmapvalue uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapvalue |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapvalue := int(stringLenmapvalue) + if intStringLenmapvalue < 0 { + return ErrInvalidLengthApi + } + postStringIndexmapvalue := iNdEx + intStringLenmapvalue + if postStringIndexmapvalue > l { + return io.ErrUnexpectedEOF + } + mapvalue := string(dAtA[iNdEx:postStringIndexmapvalue]) + iNdEx = postStringIndexmapvalue + m.Envs[mapkey] = mapvalue + } else { + var mapvalue string + m.Envs[mapkey] = mapvalue + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Mounts", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthApi + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Mounts = append(m.Mounts, &Mount{}) + if err := m.Mounts[len(m.Mounts)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Devices", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthApi + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Devices = append(m.Devices, &DeviceSpec{}) + if err := m.Devices[len(m.Devices)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Annotations", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthApi + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + var keykey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + keykey |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthApi + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey := string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + if m.Annotations == nil { + m.Annotations = make(map[string]string) + } + if iNdEx < postIndex { + var valuekey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + valuekey |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + var stringLenmapvalue uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapvalue |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapvalue := int(stringLenmapvalue) + if intStringLenmapvalue < 0 { + return ErrInvalidLengthApi + } + postStringIndexmapvalue := iNdEx + intStringLenmapvalue + if postStringIndexmapvalue > l { + return io.ErrUnexpectedEOF + } + mapvalue := string(dAtA[iNdEx:postStringIndexmapvalue]) + iNdEx = postStringIndexmapvalue + m.Annotations[mapkey] = mapvalue + } else { + var mapvalue string + m.Annotations[mapkey] = mapvalue + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipApi(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthApi + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Mount) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Mount: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Mount: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContainerPath", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthApi + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ContainerPath = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field HostPath", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthApi + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.HostPath = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ReadOnly", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.ReadOnly = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipApi(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthApi + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DeviceSpec) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeviceSpec: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeviceSpec: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContainerPath", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthApi + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ContainerPath = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field HostPath", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthApi + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.HostPath = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Permissions", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthApi + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Permissions = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipApi(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthApi + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipApi(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowApi + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowApi + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowApi + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthApi + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowApi + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipApi(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthApi = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowApi = fmt.Errorf("proto: integer overflow") +) + +func init() { proto.RegisterFile("api.proto", fileDescriptorApi) } + +var fileDescriptorApi = []byte{ + // 760 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0xcd, 0x4e, 0xdb, 0x4a, + 0x14, 0x8e, 0x13, 0xc8, 0xcf, 0x49, 0x80, 0x30, 0x20, 0x64, 0x0c, 0xd7, 0xca, 0xf5, 0xd5, 0xbd, + 0xe2, 0x4a, 0x10, 0x20, 0x48, 0xdc, 0x2b, 0x16, 0x55, 0x53, 0x42, 0x5b, 0xa4, 0xb6, 0x44, 0x46, + 0x55, 0x37, 0x95, 0x22, 0xc7, 0x99, 0xc6, 0x56, 0x93, 0x19, 0xd7, 0x33, 0x89, 0x94, 0x5d, 0x17, + 0x7d, 0x80, 0x3e, 0x44, 0x1f, 0xa3, 0x0f, 0xc0, 0xb2, 0xcb, 0x2e, 0x4b, 0xfa, 0x22, 0x95, 0xc7, + 0x1e, 0x3b, 0x32, 0x01, 0x5a, 0xa9, 0x3b, 0xcf, 0x77, 0xce, 0xf7, 0xcd, 0x39, 0x67, 0x4e, 0xbe, + 0x40, 0xc9, 0xf2, 0xdc, 0xba, 0xe7, 0x53, 0x4e, 0x51, 0x61, 0x7c, 0xd8, 0xc5, 0xdc, 0x3a, 0xd4, + 0xf6, 0xfa, 0x2e, 0x77, 0x46, 0xdd, 0xba, 0x4d, 0x87, 0xfb, 0x7d, 0xda, 0xa7, 0xfb, 0x22, 0xde, + 0x1d, 0xbd, 0x11, 0x27, 0x71, 0x10, 0x5f, 0x21, 0xcf, 0x38, 0x85, 0xb5, 0x16, 0x1e, 0xbb, 0x36, + 0x6e, 0x0f, 0x46, 0x7d, 0x97, 0x5c, 0x78, 0xdc, 0xa5, 0x84, 0xa1, 0x5d, 0x40, 0x9e, 0x8f, 0x3b, + 0x8c, 0x5b, 0x3e, 0xef, 0xf8, 0xf8, 0xdd, 0xc8, 0xf5, 0x71, 0x4f, 0x55, 0x6a, 0xca, 0x4e, 0xd1, + 0xac, 0x7a, 0x3e, 0xbe, 0x0c, 0x02, 0x66, 0x84, 0x1b, 0x9f, 0x14, 0x58, 0x31, 0x71, 0xdf, 0x65, + 0x1c, 0xfb, 0x01, 0x88, 0x19, 0x47, 0x2a, 0x14, 0xc6, 0xd8, 0x67, 0x2e, 0x25, 0x82, 0x56, 0x32, + 0xe5, 0x11, 0x69, 0x50, 0xc4, 0xa4, 0xe7, 0x51, 0x97, 0x70, 0x35, 0x2b, 0x42, 0xf1, 0x19, 0xfd, + 0x05, 0x4b, 0x3e, 0x66, 0x74, 0xe4, 0xdb, 0xb8, 0x43, 0xac, 0x21, 0x56, 0x73, 0x22, 0xa1, 0x22, + 0xc1, 0x17, 0xd6, 0x10, 0xa3, 0x63, 0x28, 0xd0, 0xb0, 0x4e, 0x75, 0xa1, 0xa6, 0xec, 0x94, 0x1b, + 0xdb, 0xf5, 0xa8, 0xfb, 0xfa, 0x9c, 0x5e, 0x4c, 0x99, 0x6c, 0x14, 0x60, 0xf1, 0x6c, 0xe8, 0xf1, + 0x89, 0xd1, 0x84, 0xf5, 0x67, 0x2e, 0xe3, 0x4d, 0xd2, 0x7b, 0x65, 0x71, 0xdb, 0x31, 0x31, 0xf3, + 0x28, 0x61, 0x18, 0xfd, 0x0b, 0x85, 0x9e, 0x10, 0x60, 0xaa, 0x52, 0xcb, 0xed, 0x94, 0x1b, 0x2b, + 0x29, 0x61, 0x53, 0xc6, 0x8d, 0x03, 0xc8, 0x87, 0x10, 0x5a, 0x86, 0xec, 0x79, 0x2b, 0xea, 0x31, + 0xeb, 0xb6, 0xd0, 0x06, 0xe4, 0x1d, 0x6c, 0x0d, 0xb8, 0x13, 0x35, 0x17, 0x9d, 0x8c, 0x13, 0x50, + 0xdb, 0xd1, 0xe0, 0x4e, 0x29, 0xe1, 0x96, 0x4b, 0x92, 0x61, 0xe9, 0x00, 0x91, 0xf0, 0x79, 0x2b, + 0xbc, 0xbb, 0x64, 0xce, 0x20, 0xc6, 0x16, 0x6c, 0xce, 0xe1, 0x86, 0x55, 0x1b, 0x36, 0xac, 0x34, + 0x07, 0x03, 0x6a, 0x5b, 0x1c, 0x4b, 0xbd, 0x36, 0x20, 0x5b, 0xe6, 0x89, 0xe7, 0xc3, 0x8c, 0xcb, + 0x9e, 0xfe, 0x8c, 0x7b, 0x8a, 0xa5, 0x52, 0x74, 0x73, 0xd5, 0x4e, 0x15, 0xc8, 0x82, 0xea, 0x6f, + 0x4b, 0xbf, 0xb7, 0xfa, 0x3e, 0x54, 0x13, 0x4a, 0x34, 0xea, 0x4b, 0x58, 0x9b, 0xad, 0x30, 0x44, + 0x65, 0x89, 0xc6, 0x5d, 0x25, 0x86, 0xa9, 0x26, 0xb2, 0xd3, 0x83, 0x60, 0xc6, 0x87, 0x1c, 0x6c, + 0xde, 0xca, 0x40, 0x0f, 0x61, 0x01, 0x93, 0xb1, 0xbc, 0x63, 0xf7, 0xfe, 0x3b, 0xea, 0x67, 0x64, + 0xcc, 0xce, 0x08, 0xf7, 0x27, 0xa6, 0x60, 0xa2, 0x7f, 0x20, 0x3f, 0xa4, 0x23, 0xc2, 0x99, 0x9a, + 0x15, 0x1a, 0xcb, 0xb1, 0xc6, 0xf3, 0x00, 0x36, 0xa3, 0x28, 0xda, 0x4b, 0xf6, 0x28, 0x27, 0x12, + 0xd7, 0x52, 0x7b, 0x74, 0xe9, 0x61, 0x3b, 0xde, 0x25, 0xf4, 0x12, 0xca, 0x16, 0x21, 0x94, 0x5b, + 0x72, 0xa7, 0x03, 0xca, 0xd1, 0x4f, 0xd4, 0xd7, 0x4c, 0x58, 0x61, 0x99, 0xb3, 0x3a, 0xda, 0x7f, + 0x50, 0x8a, 0x1b, 0x40, 0x55, 0xc8, 0xbd, 0xc5, 0x93, 0x68, 0x4d, 0x83, 0x4f, 0xb4, 0x0e, 0x8b, + 0x63, 0x6b, 0x30, 0xc2, 0xd1, 0x9a, 0x86, 0x87, 0x93, 0xec, 0xff, 0x8a, 0xf6, 0x00, 0xaa, 0x69, + 0xe5, 0x5f, 0xe1, 0x1b, 0x0e, 0x2c, 0x8a, 0x79, 0xa0, 0xbf, 0x61, 0x39, 0x79, 0x64, 0xcf, 0xe2, + 0x4e, 0xc4, 0x5f, 0x8a, 0xd1, 0xb6, 0xc5, 0x1d, 0xb4, 0x05, 0x25, 0x87, 0x32, 0x1e, 0x66, 0x44, + 0x8e, 0x10, 0x00, 0x32, 0xe8, 0x63, 0xab, 0xd7, 0xa1, 0x64, 0x30, 0x11, 0x6e, 0x50, 0x34, 0x8b, + 0x01, 0x70, 0x41, 0x06, 0x13, 0xc3, 0x07, 0x48, 0x06, 0xfa, 0x5b, 0xae, 0xab, 0x41, 0xd9, 0xc3, + 0xfe, 0xd0, 0x65, 0x4c, 0xbc, 0x45, 0x68, 0x3f, 0xb3, 0x50, 0xe3, 0x31, 0x54, 0x42, 0xaf, 0xf3, + 0xc5, 0x7c, 0xd0, 0x31, 0x14, 0xa5, 0xf7, 0x21, 0x35, 0x7e, 0xb4, 0x94, 0x1d, 0x6a, 0xc9, 0xaa, + 0x84, 0x16, 0x94, 0x69, 0x7c, 0xce, 0x42, 0x65, 0xd6, 0xae, 0xd0, 0x53, 0xd8, 0x78, 0x82, 0xf9, + 0x3c, 0x37, 0x4e, 0x91, 0xb5, 0x3b, 0xfd, 0xce, 0xc8, 0xa0, 0x26, 0x54, 0x66, 0xfd, 0xed, 0x06, + 0xff, 0x8f, 0xf8, 0x3c, 0xcf, 0x06, 0x8d, 0xcc, 0x81, 0x82, 0x9a, 0x50, 0x94, 0xeb, 0x36, 0xd3, + 0x55, 0xea, 0x97, 0xaf, 0x6d, 0xce, 0x89, 0x48, 0x11, 0xf4, 0x1a, 0x56, 0x6f, 0x98, 0x16, 0x4a, + 0xdc, 0xe7, 0x36, 0x33, 0xd4, 0x8c, 0xbb, 0x52, 0xa4, 0xfa, 0xa3, 0xed, 0xab, 0x6b, 0x5d, 0xf9, + 0x7a, 0xad, 0x67, 0xde, 0x4f, 0x75, 0xe5, 0x6a, 0xaa, 0x2b, 0x5f, 0xa6, 0xba, 0xf2, 0x6d, 0xaa, + 0x2b, 0x1f, 0xbf, 0xeb, 0x99, 0x6e, 0x5e, 0xfc, 0xbb, 0x1d, 0xfd, 0x08, 0x00, 0x00, 0xff, 0xff, + 0xb9, 0xc2, 0x87, 0x92, 0x22, 0x07, 0x00, 0x00, +} diff --git a/vendor/kubevirt.io/kubevirt/pkg/virt-handler/device-manager/deviceplugin/v1beta1/api.proto b/vendor/kubevirt.io/kubevirt/pkg/virt-handler/device-manager/deviceplugin/v1beta1/api.proto new file mode 100644 index 000000000..efbd72c13 --- /dev/null +++ b/vendor/kubevirt.io/kubevirt/pkg/virt-handler/device-manager/deviceplugin/v1beta1/api.proto @@ -0,0 +1,161 @@ +// To regenerate api.pb.go run hack/update-device-plugin.sh +syntax = 'proto3'; + +package v1beta1; + +import "github.com/gogo/protobuf/gogoproto/gogo.proto"; + +option (gogoproto.goproto_stringer_all) = false; +option (gogoproto.stringer_all) = true; +option (gogoproto.goproto_getters_all) = true; +option (gogoproto.marshaler_all) = true; +option (gogoproto.sizer_all) = true; +option (gogoproto.unmarshaler_all) = true; +option (gogoproto.goproto_unrecognized_all) = false; + + +// Registration is the service advertised by the Kubelet +// Only when Kubelet answers with a success code to a Register Request +// may Device Plugins start their service +// Registration may fail when device plugin version is not supported by +// Kubelet or the registered resourceName is already taken by another +// active device plugin. Device plugin is expected to terminate upon registration failure +service Registration { + rpc Register(RegisterRequest) returns (Empty) {} +} + +message DevicePluginOptions { + // Indicates if PreStartContainer call is required before each container start + bool pre_start_required = 1; +} + +message RegisterRequest { + // Version of the API the Device Plugin was built against + string version = 1; + // Name of the unix socket the device plugin is listening on + // PATH = path.Join(DevicePluginPath, endpoint) + string endpoint = 2; + // Schedulable resource name. As of now it's expected to be a DNS Label + string resource_name = 3; + // Options to be communicated with Device Manager + DevicePluginOptions options = 4; +} + +message Empty { +} + +// DevicePlugin is the service advertised by Device Plugins +service DevicePlugin { + // GetDevicePluginOptions returns options to be communicated with Device + // Manager + rpc GetDevicePluginOptions(Empty) returns (DevicePluginOptions) {} + + // ListAndWatch returns a stream of List of Devices + // Whenever a Device state change or a Device disapears, ListAndWatch + // returns the new list + rpc ListAndWatch(Empty) returns (stream ListAndWatchResponse) {} + + // Allocate is called during container creation so that the Device + // Plugin can run device specific operations and instruct Kubelet + // of the steps to make the Device available in the container + rpc Allocate(AllocateRequest) returns (AllocateResponse) {} + + // PreStartContainer is called, if indicated by Device Plugin during registeration phase, + // before each container start. Device plugin can run device specific operations + // such as reseting the device before making devices available to the container + rpc PreStartContainer(PreStartContainerRequest) returns (PreStartContainerResponse) {} +} + +// ListAndWatch returns a stream of List of Devices +// Whenever a Device state change or a Device disapears, ListAndWatch +// returns the new list +message ListAndWatchResponse { + repeated Device devices = 1; +} + +/* E.g: +* struct Device { +* ID: "GPU-fef8089b-4820-abfc-e83e-94318197576e", +* State: "Healthy", +*} */ +message Device { + // A unique ID assigned by the device plugin used + // to identify devices during the communication + // Max length of this field is 63 characters + string ID = 1; + // Health of the device, can be healthy or unhealthy, see constants.go + string health = 2; +} + +// - PreStartContainer is expected to be called before each container start if indicated by plugin during registration phase. +// - PreStartContainer allows kubelet to pass reinitialized devices to containers. +// - PreStartContainer allows Device Plugin to run device specific operations on +// the Devices requested +message PreStartContainerRequest { + repeated string devicesIDs = 1; +} + +// PreStartContainerResponse will be send by plugin in response to PreStartContainerRequest +message PreStartContainerResponse { +} + +// - Allocate is expected to be called during pod creation since allocation +// failures for any container would result in pod startup failure. +// - Allocate allows kubelet to exposes additional artifacts in a pod's +// environment as directed by the plugin. +// - Allocate allows Device Plugin to run device specific operations on +// the Devices requested +message AllocateRequest { + repeated ContainerAllocateRequest container_requests = 1; +} + +message ContainerAllocateRequest { + repeated string devicesIDs = 1; +} + +// AllocateResponse includes the artifacts that needs to be injected into +// a container for accessing 'deviceIDs' that were mentioned as part of +// 'AllocateRequest'. +// Failure Handling: +// if Kubelet sends an allocation request for dev1 and dev2. +// Allocation on dev1 succeeds but allocation on dev2 fails. +// The Device plugin should send a ListAndWatch update and fail the +// Allocation request +message AllocateResponse { + repeated ContainerAllocateResponse container_responses = 1; +} + +message ContainerAllocateResponse { + // List of environment variable to be set in the container to access one of more devices. + map envs = 1; + // Mounts for the container. + repeated Mount mounts = 2; + // Devices for the container. + repeated DeviceSpec devices = 3; + // Container annotations to pass to the container runtime + map annotations = 4; +} + +// Mount specifies a host volume to mount into a container. +// where device library or tools are installed on host and container +message Mount { + // Path of the mount within the container. + string container_path = 1; + // Path of the mount on the host. + string host_path = 2; + // If set, the mount is read-only. + bool read_only = 3; +} + +// DeviceSpec specifies a host device to mount into a container. +message DeviceSpec { + // Path of the device within the container. + string container_path = 1; + // Path of the device on the host. + string host_path = 2; + // Cgroups permissions of the device, candidates are one or more of + // * r - allows container to read from the specified device. + // * w - allows container to write to the specified device. + // * m - allows container to create device files that do not yet exist. + string permissions = 3; +} diff --git a/vendor/kubevirt.io/kubevirt/pkg/virt-handler/device-manager/deviceplugin/v1beta1/constants.go b/vendor/kubevirt.io/kubevirt/pkg/virt-handler/device-manager/deviceplugin/v1beta1/constants.go new file mode 100644 index 000000000..13c9bdd10 --- /dev/null +++ b/vendor/kubevirt.io/kubevirt/pkg/virt-handler/device-manager/deviceplugin/v1beta1/constants.go @@ -0,0 +1,37 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1 + +const ( + // Healthy means that the device is healty + Healthy = "Healthy" + // UnHealthy means that the device is unhealthy + Unhealthy = "Unhealthy" + + // Current version of the API supported by kubelet + Version = "v1beta1" + // DevicePluginPath is the folder the Device Plugin is expecting sockets to be on + // Only privileged pods have access to this path + // Note: Placeholder until we find a "standard path" + DevicePluginPath = "/var/lib/kubelet/device-plugins/" + // KubeletSocket is the path of the Kubelet registry socket + KubeletSocket = DevicePluginPath + "kubelet.sock" + // Timeout duration in secs for PreStartContainer RPC + KubeletPreStartContainerRPCTimeoutInSecs = 30 +) + +var SupportedVersions = [...]string{"v1beta1"} diff --git a/vendor/kubevirt.io/kubevirt/pkg/virt-handler/device-manager/generic_device.go b/vendor/kubevirt.io/kubevirt/pkg/virt-handler/device-manager/generic_device.go new file mode 100644 index 000000000..49157bd99 --- /dev/null +++ b/vendor/kubevirt.io/kubevirt/pkg/virt-handler/device-manager/generic_device.go @@ -0,0 +1,279 @@ +/* + * This file is part of the KubeVirt project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Copyright 2018 Red Hat, Inc. + * + */ + +package device_manager + +import ( + "fmt" + "net" + "os" + "path" + "path/filepath" + "strconv" + "time" + + "github.com/fsnotify/fsnotify" + "golang.org/x/net/context" + "google.golang.org/grpc" + + "kubevirt.io/kubevirt/pkg/log" + pluginapi "kubevirt.io/kubevirt/pkg/virt-handler/device-manager/deviceplugin/v1beta1" +) + +const ( + DeviceNamespace = "devices.kubevirt.io" + connectionTimeout = 5 * time.Second +) + +type GenericDevicePlugin struct { + counter int + devs []*pluginapi.Device + server *grpc.Server + socketPath string + stop chan struct{} + health chan string + devicePath string + deviceName string +} + +func NewGenericDevicePlugin(deviceName string, devicePath string, maxDevices int) *GenericDevicePlugin { + serverSock := fmt.Sprintf(pluginapi.DevicePluginPath+"kubevirt-%s.sock", deviceName) + dpi := &GenericDevicePlugin{ + counter: 0, + devs: []*pluginapi.Device{}, + socketPath: serverSock, + health: make(chan string), + deviceName: deviceName, + devicePath: devicePath, + } + for i := 0; i < maxDevices; i++ { + dpi.addNewGenericDevice() + } + + return dpi +} + +func waitForGrpcServer(socketPath string, timeout time.Duration) error { + conn, err := connect(socketPath, timeout) + if err != nil { + return err + } + conn.Close() + return nil +} + +// dial establishes the gRPC communication with the registered device plugin. +func connect(socketPath string, timeout time.Duration) (*grpc.ClientConn, error) { + c, err := grpc.Dial(socketPath, + grpc.WithInsecure(), + grpc.WithBlock(), + grpc.WithTimeout(timeout), + grpc.WithDialer(func(addr string, timeout time.Duration) (net.Conn, error) { + return net.DialTimeout("unix", addr, timeout) + }), + ) + + if err != nil { + return nil, err + } + + return c, nil +} + +// Start starts the gRPC server of the device plugin +func (dpi *GenericDevicePlugin) Start(stop chan struct{}) error { + if dpi.server != nil { + return fmt.Errorf("gRPC server already started") + } + + dpi.stop = stop + + err := dpi.cleanup() + if err != nil { + return err + } + + sock, err := net.Listen("unix", dpi.socketPath) + if err != nil { + return err + } + + dpi.server = grpc.NewServer([]grpc.ServerOption{}...) + pluginapi.RegisterDevicePluginServer(dpi.server, dpi) + + dpi.Register() + + go dpi.server.Serve(sock) + + err = waitForGrpcServer(dpi.socketPath, connectionTimeout) + + go dpi.healthCheck() + + return err +} + +// Stop stops the gRPC server +func (dpi *GenericDevicePlugin) Stop() error { + if dpi.server == nil { + return nil + } + + dpi.server.Stop() + dpi.server = nil + + return dpi.cleanup() +} + +// Register registers the device plugin for the given resourceName with Kubelet. +func (dpi *GenericDevicePlugin) Register() error { + conn, err := connect(pluginapi.KubeletSocket, connectionTimeout) + if err != nil { + return err + } + defer conn.Close() + + client := pluginapi.NewRegistrationClient(conn) + reqt := &pluginapi.RegisterRequest{ + Version: pluginapi.Version, + Endpoint: path.Base(dpi.socketPath), + ResourceName: fmt.Sprintf("%s/%s", DeviceNamespace, dpi.deviceName), + } + + _, err = client.Register(context.Background(), reqt) + if err != nil { + return err + } + return nil +} + +func (dpi *GenericDevicePlugin) addNewGenericDevice() { + deviceId := dpi.deviceName + strconv.Itoa(dpi.counter) + dpi.devs = append(dpi.devs, &pluginapi.Device{ + ID: deviceId, + Health: pluginapi.Healthy, + }) + + dpi.counter += 1 +} + +func (dpi *GenericDevicePlugin) ListAndWatch(e *pluginapi.Empty, s pluginapi.DevicePlugin_ListAndWatchServer) error { + // FIXME: sending an empty list up front should not be needed. This is a workaround for: + // https://github.com/kubevirt/kubevirt/issues/1196 + // This can safely be removed once supported upstream Kubernetes is 1.10.3 or higher. + emptyList := []*pluginapi.Device{} + s.Send(&pluginapi.ListAndWatchResponse{Devices: emptyList}) + + s.Send(&pluginapi.ListAndWatchResponse{Devices: dpi.devs}) + + for { + select { + case health := <-dpi.health: + // There's only one shared generic device + // so update each plugin device to reflect overall device health + for _, dev := range dpi.devs { + dev.Health = health + } + s.Send(&pluginapi.ListAndWatchResponse{Devices: dpi.devs}) + case <-dpi.stop: + return nil + } + } +} + +func (dpi *GenericDevicePlugin) Allocate(ctx context.Context, r *pluginapi.AllocateRequest) (*pluginapi.AllocateResponse, error) { + response := pluginapi.AllocateResponse{} + containerResponse := new(pluginapi.ContainerAllocateResponse) + + dev := new(pluginapi.DeviceSpec) + dev.HostPath = dpi.devicePath + dev.ContainerPath = dpi.devicePath + dev.Permissions = "rw" + containerResponse.Devices = []*pluginapi.DeviceSpec{dev} + + response.ContainerResponses = []*pluginapi.ContainerAllocateResponse{containerResponse} + + return &response, nil +} + +func (dpi *GenericDevicePlugin) cleanup() error { + if err := os.Remove(dpi.socketPath); err != nil && !os.IsNotExist(err) { + return err + } + + return nil +} + +func (dpi *GenericDevicePlugin) GetDevicePluginOptions(ctx context.Context, e *pluginapi.Empty) (*pluginapi.DevicePluginOptions, error) { + options := &pluginapi.DevicePluginOptions{ + PreStartRequired: false, + } + return options, nil +} + +func (dpi *GenericDevicePlugin) PreStartContainer(ctx context.Context, in *pluginapi.PreStartContainerRequest) (*pluginapi.PreStartContainerResponse, error) { + res := &pluginapi.PreStartContainerResponse{} + return res, nil +} + +func (dpi *GenericDevicePlugin) healthCheck() error { + logger := log.DefaultLogger() + watcher, err := fsnotify.NewWatcher() + if err != nil { + logger.Errorf("Unable to create fsnotify watcher: %v", err) + return nil + } + defer watcher.Close() + + healthy := pluginapi.Healthy + _, err = os.Stat(dpi.devicePath) + if err != nil { + if !os.IsNotExist(err) { + logger.Errorf("Unable to stat device: %v", err) + return err + } + healthy = pluginapi.Unhealthy + } + + dirName := filepath.Dir(dpi.devicePath) + + err = watcher.Add(dirName) + if err != nil { + logger.Errorf("Unable to add path to fsnotify watcher: %v", err) + return err + } + + for { + select { + case <-dpi.stop: + return nil + case event := <-watcher.Events: + logger.Infof("health Event: %v", event) + logger.Infof("health Event Name: %s", event.Name) + if event.Name == dpi.devicePath { + // Health in this case is if the device path actually exists + if event.Op == fsnotify.Create { + healthy = pluginapi.Healthy + } else if (event.Op == fsnotify.Remove) || (event.Op == fsnotify.Rename) { + healthy = pluginapi.Unhealthy + } + dpi.health <- healthy + } + } + } +} diff --git a/vendor/kubevirt.io/kubevirt/pkg/virt-handler/vm.go b/vendor/kubevirt.io/kubevirt/pkg/virt-handler/vm.go index 6bc3e492a..f1721e1a5 100644 --- a/vendor/kubevirt.io/kubevirt/pkg/virt-handler/vm.go +++ b/vendor/kubevirt.io/kubevirt/pkg/virt-handler/vm.go @@ -46,6 +46,7 @@ import ( "kubevirt.io/kubevirt/pkg/log" "kubevirt.io/kubevirt/pkg/precond" "kubevirt.io/kubevirt/pkg/virt-handler/cmd-client" + "kubevirt.io/kubevirt/pkg/virt-handler/device-manager" "kubevirt.io/kubevirt/pkg/virt-launcher" "kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/api" "kubevirt.io/kubevirt/pkg/watchdog" @@ -56,9 +57,11 @@ func NewController( clientset kubecli.KubevirtClient, host string, virtShareDir string, - vmInformer cache.SharedIndexInformer, + vmiInformer cache.SharedIndexInformer, domainInformer cache.SharedInformer, gracefulShutdownInformer cache.SharedIndexInformer, + watchdogTimeoutSeconds int, + maxDevices int, ) *VirtualMachineController { queue := workqueue.NewRateLimitingQueue(workqueue.DefaultControllerRateLimiter()) @@ -69,13 +72,14 @@ func NewController( clientset: clientset, host: host, virtShareDir: virtShareDir, - vmInformer: vmInformer, + vmiInformer: vmiInformer, domainInformer: domainInformer, gracefulShutdownInformer: gracefulShutdownInformer, heartBeatInterval: 1 * time.Minute, + watchdogTimeoutSeconds: watchdogTimeoutSeconds, } - vmInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{ + vmiInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{ AddFunc: c.addFunc, DeleteFunc: c.deleteFunc, UpdateFunc: c.updateFunc, @@ -95,6 +99,8 @@ func NewController( c.launcherClients = make(map[string]cmdclient.LauncherClient) + c.kvmController = device_manager.NewDeviceController(c.host, maxDevices) + return c } @@ -104,12 +110,14 @@ type VirtualMachineController struct { host string virtShareDir string Queue workqueue.RateLimitingInterface - vmInformer cache.SharedIndexInformer + vmiInformer cache.SharedIndexInformer domainInformer cache.SharedInformer gracefulShutdownInformer cache.SharedIndexInformer launcherClients map[string]cmdclient.LauncherClient launcherClientLock sync.Mutex heartBeatInterval time.Duration + watchdogTimeoutSeconds int + kvmController *device_manager.DeviceController } // Determines if a domain's grace period has expired during shutdown. @@ -159,35 +167,38 @@ func (d *VirtualMachineController) hasGracePeriodExpired(dom *api.Domain) (hasEx return } -func (d *VirtualMachineController) updateVMStatus(vm *v1.VirtualMachine, domain *api.Domain, syncError error) (err error) { +func (d *VirtualMachineController) updateVMIStatus(vmi *v1.VirtualMachineInstance, domain *api.Domain, syncError error) (err error) { - // Don't update the VM if it is already in a final state - if vm.IsFinal() { + // Don't update the VirtualMachineInstance if it is already in a final state + if vmi.IsFinal() { return nil } - oldStatus := vm.DeepCopy().Status + oldStatus := vmi.DeepCopy().Status - // Calculate the new VM state based on what libvirt reported - d.setVmPhaseForStatusReason(domain, vm) + // Calculate the new VirtualMachineInstance state based on what libvirt reported + err = d.setVmPhaseForStatusReason(domain, vmi) + if err != nil { + return err + } - controller.NewVirtualMachineConditionManager().CheckFailure(vm, syncError, "Synchronizing with the Domain failed.") + controller.NewVirtualMachineInstanceConditionManager().CheckFailure(vmi, syncError, "Synchronizing with the Domain failed.") - if !reflect.DeepEqual(oldStatus, vm.Status) { - _, err = d.clientset.VM(vm.ObjectMeta.Namespace).Update(vm) + if !reflect.DeepEqual(oldStatus, vmi.Status) { + _, err = d.clientset.VirtualMachineInstance(vmi.ObjectMeta.Namespace).Update(vmi) if err != nil { return err } } - if oldStatus.Phase != vm.Status.Phase { - switch vm.Status.Phase { + if oldStatus.Phase != vmi.Status.Phase { + switch vmi.Status.Phase { case v1.Running: - d.recorder.Event(vm, k8sv1.EventTypeNormal, v1.Started.String(), "VM started.") + d.recorder.Event(vmi, k8sv1.EventTypeNormal, v1.Started.String(), "VirtualMachineInstance started.") case v1.Succeeded: - d.recorder.Event(vm, k8sv1.EventTypeNormal, v1.Stopped.String(), "The VM was shut down.") + d.recorder.Event(vmi, k8sv1.EventTypeNormal, v1.Stopped.String(), "The VirtualMachineInstance was shut down.") case v1.Failed: - d.recorder.Event(vm, k8sv1.EventTypeWarning, v1.Stopped.String(), "The VM crashed.") + d.recorder.Event(vmi, k8sv1.EventTypeWarning, v1.Stopped.String(), "The VirtualMachineInstance crashed.") } } @@ -202,15 +213,17 @@ func (c *VirtualMachineController) Run(threadiness int, stopCh chan struct{}) { go c.domainInformer.Run(stopCh) cache.WaitForCacheSync(stopCh, c.domainInformer.HasSynced) - // Poplulate the VM store with known Domains on the host, to get deletes since the last run + go c.kvmController.Run(stopCh) + + // Poplulate the VirtualMachineInstance store with known Domains on the host, to get deletes since the last run for _, domain := range c.domainInformer.GetStore().List() { d := domain.(*api.Domain) - c.vmInformer.GetStore().Add(v1.NewVMReferenceFromNameWithNS(d.ObjectMeta.Namespace, d.ObjectMeta.Name)) + c.vmiInformer.GetStore().Add(v1.NewVMIReferenceFromNameWithNS(d.ObjectMeta.Namespace, d.ObjectMeta.Name)) } - go c.vmInformer.Run(stopCh) + go c.vmiInformer.Run(stopCh) go c.gracefulShutdownInformer.Run(stopCh) - cache.WaitForCacheSync(stopCh, c.domainInformer.HasSynced, c.vmInformer.HasSynced, c.gracefulShutdownInformer.HasSynced) + cache.WaitForCacheSync(stopCh, c.domainInformer.HasSynced, c.vmiInformer.HasSynced, c.gracefulShutdownInformer.HasSynced) go c.heartBeat(c.heartBeatInterval, stopCh) @@ -235,36 +248,36 @@ func (c *VirtualMachineController) Execute() bool { } defer c.Queue.Done(key) if err := c.execute(key.(string)); err != nil { - log.Log.Reason(err).Infof("re-enqueuing VirtualMachine %v", key) + log.Log.Reason(err).Infof("re-enqueuing VirtualMachineInstance %v", key) c.Queue.AddRateLimited(key) } else { - log.Log.V(4).Infof("processed VirtualMachine %v", key) + log.Log.V(4).Infof("processed VirtualMachineInstance %v", key) c.Queue.Forget(key) } return true } -func (d *VirtualMachineController) getVMFromCache(key string) (vm *v1.VirtualMachine, exists bool, err error) { +func (d *VirtualMachineController) getVMIFromCache(key string) (vmi *v1.VirtualMachineInstance, exists bool, err error) { // Fetch the latest Vm state from cache - obj, exists, err := d.vmInformer.GetStore().GetByKey(key) + obj, exists, err := d.vmiInformer.GetStore().GetByKey(key) if err != nil { return nil, false, err } - // Retrieve the VM + // Retrieve the VirtualMachineInstance if !exists { namespace, name, err := cache.SplitMetaNamespaceKey(key) if err != nil { // TODO log and don't retry return nil, false, err } - vm = v1.NewVMReferenceFromNameWithNS(namespace, name) + vmi = v1.NewVMIReferenceFromNameWithNS(namespace, name) } else { - vm = obj.(*v1.VirtualMachine) + vmi = obj.(*v1.VirtualMachineInstance) } - return vm, exists, nil + return vmi, exists, nil } func (d *VirtualMachineController) getDomainFromCache(key string) (domain *api.Domain, exists bool, err error) { @@ -287,10 +300,10 @@ func (d *VirtualMachineController) execute(key string) error { shouldShutdownAndDelete := false // optimization. set to true when processing already deleted domain. shouldCleanUp := false - // set to true when VM is active or about to become active. + // set to true when VirtualMachineInstance is active or about to become active. shouldUpdate := false - vm, vmExists, err := d.getVMFromCache(key) + vmi, vmiExists, err := d.getVMIFromCache(key) if err != nil { return err } @@ -301,90 +314,94 @@ func (d *VirtualMachineController) execute(key string) error { } // Determine if gracefulShutdown has been triggered by virt-launcher - gracefulShutdown, err := virtlauncher.VmHasGracefulShutdownTrigger(d.virtShareDir, vm) + gracefulShutdown, err := virtlauncher.VmHasGracefulShutdownTrigger(d.virtShareDir, vmi) if err != nil { return err - } else if gracefulShutdown && vm.IsRunning() { - log.Log.Object(vm).V(3).Info("Shutting down due to graceful shutdown signal.") + } else if gracefulShutdown && vmi.IsRunning() { + log.Log.Object(vmi).V(3).Info("Shutting down due to graceful shutdown signal.") shouldShutdownAndDelete = true } - // Determine removal of VM from cache should result in deletion. - if !vmExists { + // Determine removal of VirtualMachineInstance from cache should result in deletion. + if !vmiExists { if domainExists { - // The VM is deleted on the cluster, + // The VirtualMachineInstance is deleted on the cluster, // then continue with processing the deletion on the host. - log.Log.Object(vm).V(3).Info("Shutting down domain for deleted VM object.") + log.Log.Object(vmi).V(3).Info("Shutting down domain for deleted VirtualMachineInstance object.") shouldShutdownAndDelete = true } else { - // If neither the domain nor the vm object exist locally, + // If neither the domain nor the vmi object exist locally, // then ensure any remaining local ephemeral data is cleaned up. shouldCleanUp = true } } - // Determine if VM is being deleted. - if vmExists && vm.ObjectMeta.DeletionTimestamp != nil { - if vm.IsRunning() || domainExists { - log.Log.Object(vm).V(3).Info("Shutting down domain for VM with deletion timestamp.") + // Determine if VirtualMachineInstance is being deleted. + if vmiExists && vmi.ObjectMeta.DeletionTimestamp != nil { + if vmi.IsRunning() || domainExists { + log.Log.Object(vmi).V(3).Info("Shutting down domain for VirtualMachineInstance with deletion timestamp.") shouldShutdownAndDelete = true } else { shouldCleanUp = true } } - // Determine if domain needs to be deleted as a result of VM + // Determine if domain needs to be deleted as a result of VirtualMachineInstance // shutting down naturally (guest internal invoked shutdown) - if domainExists && vmExists && vm.IsFinal() { - log.Log.Object(vm).V(3).Info("Removing domain and ephemeral data for finalized vm.") + if domainExists && vmiExists && vmi.IsFinal() { + log.Log.Object(vmi).V(3).Info("Removing domain and ephemeral data for finalized vmi.") shouldShutdownAndDelete = true } - // Determine if an active (or about to be active) VM should be updated. - if vmExists && !vm.IsFinal() { - // requiring the phase of the domain and VM to be in sync is an - // optimization that prevents unnecessary re-processing VMs during the start flow. - if vm.Status.Phase == d.calculateVmPhaseForStatusReason(domain, vm) { + // Determine if an active (or about to be active) VirtualMachineInstance should be updated. + if vmiExists && !vmi.IsFinal() { + // requiring the phase of the domain and VirtualMachineInstance to be in sync is an + // optimization that prevents unnecessary re-processing VMIs during the start flow. + phase, err := d.calculateVmPhaseForStatusReason(domain, vmi) + if err != nil { + return err + } + if vmi.Status.Phase == phase { shouldUpdate = true } } - // If for instance an orphan delete was performed on a vm, a pod can still be in terminating state, + // If for instance an orphan delete was performed on a vmi, a pod can still be in terminating state, // make sure that we don't perform an update and instead try to make sure that the pod goes definitely away - if vmExists && domainExists && domain.Spec.Metadata.KubeVirt.UID != vm.UID { - log.Log.Object(vm).Errorf("Libvirt domain seems to be from a wrong VirtualMachine instance. That should never happen. Manual intervention required.") + if vmiExists && domainExists && domain.Spec.Metadata.KubeVirt.UID != vmi.UID { + log.Log.Object(vmi).Errorf("Libvirt domain seems to be from a wrong VirtualMachineInstance instance. That should never happen. Manual intervention required.") return nil } var syncErr error - // Process the VM update in this order. - // * Shutdown and Deletion due to VM deletion, process stopping, graceful shutdown trigger, etc... - // * Cleanup of already shutdown and Deleted VMs + // Process the VirtualMachineInstance update in this order. + // * Shutdown and Deletion due to VirtualMachineInstance deletion, process stopping, graceful shutdown trigger, etc... + // * Cleanup of already shutdown and Deleted VMIs // * Update due to spec change and initial start flow. if shouldShutdownAndDelete { - log.Log.Object(vm).V(3).Info("Processing shutdown.") - syncErr = d.processVmShutdown(vm, domain) + log.Log.Object(vmi).V(3).Info("Processing shutdown.") + syncErr = d.processVmShutdown(vmi, domain) } else if shouldCleanUp { - log.Log.Object(vm).V(3).Info("Processing local ephemeral data cleanup for shutdown domain.") - syncErr = d.processVmCleanup(vm) + log.Log.Object(vmi).V(3).Info("Processing local ephemeral data cleanup for shutdown domain.") + syncErr = d.processVmCleanup(vmi) } else if shouldUpdate { - log.Log.Object(vm).V(3).Info("Processing vm update") - syncErr = d.processVmUpdate(vm) + log.Log.Object(vmi).V(3).Info("Processing vmi update") + syncErr = d.processVmUpdate(vmi) } else { - log.Log.Object(vm).V(3).Info("No update processing required") + log.Log.Object(vmi).V(3).Info("No update processing required") } if syncErr != nil { - d.recorder.Event(vm, k8sv1.EventTypeWarning, v1.SyncFailed.String(), syncErr.Error()) - log.Log.Object(vm).Reason(syncErr).Error("Synchronizing the VM failed.") + d.recorder.Event(vmi, k8sv1.EventTypeWarning, v1.SyncFailed.String(), syncErr.Error()) + log.Log.Object(vmi).Reason(syncErr).Error("Synchronizing the VirtualMachineInstance failed.") } - // Update the VM status, if the VM exists - if vmExists { - err = d.updateVMStatus(vm.DeepCopy(), domain, syncErr) + // Update the VirtualMachineInstance status, if the VirtualMachineInstance exists + if vmiExists { + err = d.updateVMIStatus(vmi.DeepCopy(), domain, syncErr) if err != nil { - log.Log.Object(vm).Reason(err).Error("Updating the VM status failed.") + log.Log.Object(vmi).Reason(err).Error("Updating the VirtualMachineInstance status failed.") return err } } @@ -393,16 +410,16 @@ func (d *VirtualMachineController) execute(key string) error { return syncErr } - log.Log.Object(vm).V(3).Info("Synchronization loop succeeded.") + log.Log.Object(vmi).V(3).Info("Synchronization loop succeeded.") return nil } -func (d *VirtualMachineController) injectCloudInitSecrets(vm *v1.VirtualMachine) error { - cloudInitSpec := cloudinit.GetCloudInitNoCloudSource(vm) +func (d *VirtualMachineController) injectCloudInitSecrets(vmi *v1.VirtualMachineInstance) error { + cloudInitSpec := cloudinit.GetCloudInitNoCloudSource(vmi) if cloudInitSpec == nil { return nil } - namespace := precond.MustNotBeEmpty(vm.GetObjectMeta().GetNamespace()) + namespace := precond.MustNotBeEmpty(vmi.GetObjectMeta().GetNamespace()) err := cloudinit.ResolveSecrets(cloudInitSpec, namespace, d.clientset) if err != nil { @@ -411,28 +428,28 @@ func (d *VirtualMachineController) injectCloudInitSecrets(vm *v1.VirtualMachine) return nil } -func (d *VirtualMachineController) processVmCleanup(vm *v1.VirtualMachine) error { - err := watchdog.WatchdogFileRemove(d.virtShareDir, vm) +func (d *VirtualMachineController) processVmCleanup(vmi *v1.VirtualMachineInstance) error { + err := watchdog.WatchdogFileRemove(d.virtShareDir, vmi) if err != nil { return err } - err = virtlauncher.VmGracefulShutdownTriggerClear(d.virtShareDir, vm) + err = virtlauncher.VmGracefulShutdownTriggerClear(d.virtShareDir, vmi) if err != nil { return err } - d.closeLauncherClient(vm) + d.closeLauncherClient(vmi) return nil } -func (d *VirtualMachineController) closeLauncherClient(vm *v1.VirtualMachine) { +func (d *VirtualMachineController) closeLauncherClient(vmi *v1.VirtualMachineInstance) { // maps require locks for concurrent access d.launcherClientLock.Lock() defer d.launcherClientLock.Unlock() - namespace := vm.ObjectMeta.Namespace - name := vm.ObjectMeta.Name + namespace := vmi.ObjectMeta.Namespace + name := vmi.ObjectMeta.Name sockFile := cmdclient.SocketFromNamespaceName(d.virtShareDir, namespace, name) client, ok := d.launcherClients[sockFile] @@ -457,13 +474,13 @@ func (d *VirtualMachineController) addLauncherClient(client cmdclient.LauncherCl return nil } -func (d *VirtualMachineController) getLauncherClient(vm *v1.VirtualMachine) (cmdclient.LauncherClient, error) { +func (d *VirtualMachineController) getLauncherClient(vmi *v1.VirtualMachineInstance) (cmdclient.LauncherClient, error) { // maps require locks for concurrent access d.launcherClientLock.Lock() defer d.launcherClientLock.Unlock() - namespace := vm.ObjectMeta.Namespace - name := vm.ObjectMeta.Name + namespace := vmi.ObjectMeta.Namespace + name := vmi.ObjectMeta.Name sockFile := cmdclient.SocketFromNamespaceName(d.virtShareDir, namespace, name) client, ok := d.launcherClients[sockFile] @@ -481,17 +498,17 @@ func (d *VirtualMachineController) getLauncherClient(vm *v1.VirtualMachine) (cmd return client, nil } -func (d *VirtualMachineController) processVmShutdown(vm *v1.VirtualMachine, domain *api.Domain) error { +func (d *VirtualMachineController) processVmShutdown(vmi *v1.VirtualMachineInstance, domain *api.Domain) error { clientDisconnected := false - client, err := d.getLauncherClient(vm) + client, err := d.getLauncherClient(vmi) if err != nil { clientDisconnected = true } // verify connectivity before processing shutdown. - // It's possible the pod has already been torn down along with the VM. + // It's possible the pod has already been torn down along with the VirtualMachineInstance. if clientDisconnected == false { err := client.Ping() if cmdclient.IsDisconnected(err) { @@ -503,99 +520,117 @@ func (d *VirtualMachineController) processVmShutdown(vm *v1.VirtualMachine, doma // Only attempt to gracefully terminate if we still have a // connection established with the pod. - // If the pod has been torn down, we know the VM has been destroyed. + // If the pod has been torn down, we know the VirtualMachineInstance has been destroyed. if clientDisconnected == false { expired, timeLeft := d.hasGracePeriodExpired(domain) if expired == false { - err = client.ShutdownVirtualMachine(vm) + err = client.ShutdownVirtualMachine(vmi) if err != nil && !cmdclient.IsDisconnected(err) { // Only report err if it wasn't the result of a disconnect. return err } - log.Log.Object(vm).Infof("Signaled graceful shutdown for %s", vm.GetObjectMeta().GetName()) + log.Log.Object(vmi).Infof("Signaled graceful shutdown for %s", vmi.GetObjectMeta().GetName()) // pending graceful shutdown. - d.Queue.AddAfter(controller.VirtualMachineKey(vm), time.Duration(timeLeft)*time.Second) - d.recorder.Event(vm, k8sv1.EventTypeNormal, v1.ShuttingDown.String(), "Signaled Graceful Shutdown") + d.Queue.AddAfter(controller.VirtualMachineKey(vmi), time.Duration(timeLeft)*time.Second) + d.recorder.Event(vmi, k8sv1.EventTypeNormal, v1.ShuttingDown.String(), "Signaled Graceful Shutdown") return nil } - log.Log.Object(vm).Infof("grace period expired, killing deleted VM %s", vm.GetObjectMeta().GetName()) + log.Log.Object(vmi).Infof("grace period expired, killing deleted VirtualMachineInstance %s", vmi.GetObjectMeta().GetName()) - err = client.KillVirtualMachine(vm) + err = client.KillVirtualMachine(vmi) if err != nil && !cmdclient.IsDisconnected(err) { // Only report err if it wasn't the result of a disconnect. // // Both virt-launcher and virt-handler are trying to destroy - // the VM at the same time. It's possible the client may get + // the VirtualMachineInstance at the same time. It's possible the client may get // disconnected during the kill request, which shouldn't be // considered an error. return err } } - d.recorder.Event(vm, k8sv1.EventTypeNormal, v1.Deleted.String(), "VM stopping") + d.recorder.Event(vmi, k8sv1.EventTypeNormal, v1.Deleted.String(), "VirtualMachineInstance stopping") - return d.processVmCleanup(vm) + return d.processVmCleanup(vmi) } -func (d *VirtualMachineController) processVmUpdate(vm *v1.VirtualMachine) error { +func (d *VirtualMachineController) processVmUpdate(origVMI *v1.VirtualMachineInstance) error { + + vmi := origVMI.DeepCopy() + + isExpired, err := watchdog.WatchdogFileIsExpired(d.watchdogTimeoutSeconds, d.virtShareDir, vmi) - hasWatchdog, err := watchdog.WatchdogFileExists(d.virtShareDir, vm) if err != nil { - log.Log.Object(vm).Reason(err).Error("Error accessing virt-launcher watchdog file.") return err - } - if hasWatchdog == false { - log.Log.Object(vm).Reason(err).Error("Could not detect virt-launcher watchdog file.") - return goerror.New(fmt.Sprintf("No watchdog file found for vm")) + } else if isExpired { + return goerror.New(fmt.Sprintf("Can not update a VirtualMachineInstance with expired watchdog.")) } - err = d.injectCloudInitSecrets(vm) + err = d.injectCloudInitSecrets(vmi) if err != nil { return err } - client, err := d.getLauncherClient(vm) + client, err := d.getLauncherClient(vmi) if err != nil { return err } - err = client.SyncVirtualMachine(vm) + err = client.SyncVirtualMachine(vmi) if err != nil { return err } - d.recorder.Event(vm, k8sv1.EventTypeNormal, v1.Created.String(), "VM defined.") + d.recorder.Event(vmi, k8sv1.EventTypeNormal, v1.Created.String(), "VirtualMachineInstance defined.") return err } -func (d *VirtualMachineController) setVmPhaseForStatusReason(domain *api.Domain, vm *v1.VirtualMachine) { - vm.Status.Phase = d.calculateVmPhaseForStatusReason(domain, vm) +func (d *VirtualMachineController) setVmPhaseForStatusReason(domain *api.Domain, vmi *v1.VirtualMachineInstance) error { + phase, err := d.calculateVmPhaseForStatusReason(domain, vmi) + if err != nil { + return err + } + vmi.Status.Phase = phase + return nil } -func (d *VirtualMachineController) calculateVmPhaseForStatusReason(domain *api.Domain, vm *v1.VirtualMachine) v1.VMPhase { +func (d *VirtualMachineController) calculateVmPhaseForStatusReason(domain *api.Domain, vmi *v1.VirtualMachineInstance) (v1.VirtualMachineInstancePhase, error) { if domain == nil { - if !vm.IsRunning() && !vm.IsFinal() { - return v1.Scheduled - } else if !vm.IsFinal() { - // That is unexpected. We should not be able to delete a VM before we stop it. + if vmi.IsScheduled() { + isExpired, err := watchdog.WatchdogFileIsExpired(d.watchdogTimeoutSeconds, d.virtShareDir, vmi) + + if err != nil { + return vmi.Status.Phase, err + } + + if isExpired { + // virt-launcher is gone and VirtualMachineInstance never transitioned + // from scheduled to Running. + return v1.Failed, nil + } + return v1.Scheduled, nil + } else if !vmi.IsRunning() && !vmi.IsFinal() { + return v1.Scheduled, nil + } else if !vmi.IsFinal() { + // That is unexpected. We should not be able to delete a VirtualMachineInstance before we stop it. // However, if someone directly interacts with libvirt it is possible - return v1.Failed + return v1.Failed, nil } } else { switch domain.Status.Status { case api.Shutoff, api.Crashed: switch domain.Status.Reason { case api.ReasonCrashed, api.ReasonPanicked: - return v1.Failed + return v1.Failed, nil case api.ReasonShutdown, api.ReasonDestroyed, api.ReasonSaved, api.ReasonFromSnapshot: - return v1.Succeeded + return v1.Succeeded, nil } case api.Running, api.Paused, api.Blocked, api.PMSuspended: - return v1.Running + return v1.Running, nil } } - return vm.Status.Phase + return vmi.Status.Phase, nil } func (d *VirtualMachineController) addFunc(obj interface{}) { diff --git a/vendor/kubevirt.io/kubevirt/pkg/virt-launcher/monitor.go b/vendor/kubevirt.io/kubevirt/pkg/virt-launcher/monitor.go index 840450a4a..e5de1cb71 100644 --- a/vendor/kubevirt.io/kubevirt/pkg/virt-launcher/monitor.go +++ b/vendor/kubevirt.io/kubevirt/pkg/virt-launcher/monitor.go @@ -43,7 +43,7 @@ type OnShutdownCallback func(pid int) type monitor struct { timeout time.Duration pid int - commandPrefix string + cmdlineMatchStr string start time.Time isDone bool gracePeriod int @@ -65,9 +65,9 @@ func GracefulShutdownTriggerFromNamespaceName(baseDir string, namespace string, return filepath.Join(baseDir, "graceful-shutdown-trigger", triggerFile) } -func VmGracefulShutdownTriggerClear(baseDir string, vm *v1.VirtualMachine) error { - namespace := precond.MustNotBeEmpty(vm.GetObjectMeta().GetNamespace()) - domain := precond.MustNotBeEmpty(vm.GetObjectMeta().GetName()) +func VmGracefulShutdownTriggerClear(baseDir string, vmi *v1.VirtualMachineInstance) error { + namespace := precond.MustNotBeEmpty(vmi.GetObjectMeta().GetNamespace()) + domain := precond.MustNotBeEmpty(vmi.GetObjectMeta().GetName()) triggerFile := GracefulShutdownTriggerFromNamespaceName(baseDir, namespace, domain) @@ -78,9 +78,9 @@ func GracefulShutdownTriggerClear(triggerFile string) error { return diskutils.RemoveFile(triggerFile) } -func VmHasGracefulShutdownTrigger(baseDir string, vm *v1.VirtualMachine) (bool, error) { - namespace := precond.MustNotBeEmpty(vm.GetObjectMeta().GetNamespace()) - domain := precond.MustNotBeEmpty(vm.GetObjectMeta().GetName()) +func VmHasGracefulShutdownTrigger(baseDir string, vmi *v1.VirtualMachineInstance) (bool, error) { + namespace := precond.MustNotBeEmpty(vmi.GetObjectMeta().GetNamespace()) + domain := precond.MustNotBeEmpty(vmi.GetObjectMeta().GetName()) return hasGracefulShutdownTrigger(baseDir, namespace, domain) } @@ -167,12 +167,12 @@ func InitializeSharedDirectories(baseDir string) error { return nil } -func NewProcessMonitor(commandPrefix string, +func NewProcessMonitor(cmdlineMatchStr string, gracefulShutdownTriggerFile string, gracePeriod int, shutdownCallback OnShutdownCallback) ProcessMonitor { return &monitor{ - commandPrefix: commandPrefix, + cmdlineMatchStr: cmdlineMatchStr, gracePeriod: gracePeriod, gracefulShutdownTriggerFile: gracefulShutdownTriggerFile, shutdownCallback: shutdownCallback, @@ -195,7 +195,7 @@ func (mon *monitor) refresh() { return } - log.Log.Debugf("Refreshing. CommandPrefix %s pid %d", mon.commandPrefix, mon.pid) + log.Log.V(4).Infof("Refreshing. CommandPrefix %s pid %d", mon.cmdlineMatchStr, mon.pid) expired := mon.isGracePeriodExpired() @@ -203,23 +203,23 @@ func (mon *monitor) refresh() { if mon.pid == 0 { var err error - mon.pid, err = findPid(mon.commandPrefix) + mon.pid, err = findPid(mon.cmdlineMatchStr) if err != nil { - log.Log.Infof("Still missing PID for %s, %v", mon.commandPrefix, err) + log.Log.Infof("Still missing PID for %s, %v", mon.cmdlineMatchStr, err) // check to see if we've timed out looking for the process elapsed := time.Since(mon.start) if mon.timeout > 0 && elapsed >= mon.timeout { - log.Log.Infof("%s not found after timeout", mon.commandPrefix) + log.Log.Infof("%s not found after timeout", mon.cmdlineMatchStr) mon.isDone = true } else if expired { - log.Log.Infof("%s not found after grace period expired", mon.commandPrefix) + log.Log.Infof("%s not found after grace period expired", mon.cmdlineMatchStr) mon.isDone = true } return } - log.Log.Infof("Found PID for %s: %d", mon.commandPrefix, mon.pid) + log.Log.Infof("Found PID for %s: %d", mon.cmdlineMatchStr, mon.pid) } exists, err := pidExists(mon.pid) @@ -228,7 +228,7 @@ func (mon *monitor) refresh() { return } if exists == false { - log.Log.Infof("Process %s and pid %d is gone!", mon.commandPrefix, mon.pid) + log.Log.Infof("Process %s and pid %d is gone!", mon.cmdlineMatchStr, mon.pid) mon.pid = 0 mon.isDone = true return @@ -271,7 +271,7 @@ func (mon *monitor) monitorLoop(startTimeout time.Duration, signalChan chan os.S err := GracefulShutdownTriggerInitiate(mon.gracefulShutdownTriggerFile) if err != nil { - log.Log.Reason(err).Errorf("Error detected attempting to initalize graceful shutdown using trigger file %s.", mon.gracefulShutdownTriggerFile) + log.Log.Reason(err).Errorf("Error detected attempting to initialize graceful shutdown using trigger file %s.", mon.gracefulShutdownTriggerFile) } mon.gracePeriodStartTime = time.Now().UTC().Unix() } @@ -322,14 +322,12 @@ func findPid(commandNamePrefix string) (int, error) { } for _, entry := range entries { - argv, err := readProcCmdline(entry) + content, err := ioutil.ReadFile(entry) if err != nil { return 0, err } - match, _ := filepath.Match(fmt.Sprintf("%s*", commandNamePrefix), filepath.Base(argv[0])) - // command prefix does not match - if !match { + if !strings.Contains(string(content), commandNamePrefix) { continue } diff --git a/vendor/kubevirt.io/kubevirt/pkg/virt-launcher/notify-client/client.go b/vendor/kubevirt.io/kubevirt/pkg/virt-launcher/notify-client/client.go index d0d81f7c7..b3dce4deb 100644 --- a/vendor/kubevirt.io/kubevirt/pkg/virt-launcher/notify-client/client.go +++ b/vendor/kubevirt.io/kubevirt/pkg/virt-launcher/notify-client/client.go @@ -92,7 +92,7 @@ func libvirtEventCallback(d cli.VirDomain, event *libvirt.DomainEventLifecycle, // No matter which event, try to fetch the domain xml // and the state. If we get a IsNotFound error, that - // means that the VM was removed. + // means that the VirtualMachineInstance was removed. spec, err := util.GetDomainSpec(d) if err != nil { if !domainerrors.IsNotFound(err) { diff --git a/vendor/kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/api/converter.go b/vendor/kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/api/converter.go index 7e2a8a958..a4ed34975 100644 --- a/vendor/kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/api/converter.go +++ b/vendor/kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/api/converter.go @@ -1,15 +1,39 @@ +/* + * This file is part of the KubeVirt project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Copyright 2017, 2018 Red Hat, Inc. + * + */ + package api import ( + "bufio" + "bytes" "fmt" + "io/ioutil" + "net" + "os" "path/filepath" + "regexp" k8sv1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" "strconv" - - "os" + "strings" "kubevirt.io/kubevirt/pkg/api/v1" "kubevirt.io/kubevirt/pkg/cloud-init" @@ -21,8 +45,9 @@ import ( ) type ConverterContext struct { + UseEmulation bool Secrets map[string]*k8sv1.Secret - VirtualMachine *v1.VirtualMachine + VirtualMachine *v1.VirtualMachineInstance } func Convert_v1_Disk_To_api_Disk(diskDevice *v1.Disk, disk *Disk, devicePerBus map[string]int) error { @@ -48,12 +73,20 @@ func Convert_v1_Disk_To_api_Disk(diskDevice *v1.Disk, disk *Disk, devicePerBus m disk.Target.Tray = string(diskDevice.CDRom.Tray) disk.Target.Bus = diskDevice.CDRom.Bus disk.Target.Device = makeDeviceName(diskDevice.CDRom.Bus, devicePerBus) - disk.ReadOnly = toApiReadOnly(*diskDevice.CDRom.ReadOnly) + if diskDevice.CDRom.ReadOnly != nil { + disk.ReadOnly = toApiReadOnly(*diskDevice.CDRom.ReadOnly) + } else { + disk.ReadOnly = toApiReadOnly(true) + } } disk.Driver = &DiskDriver{ Name: "qemu", } disk.Alias = &Alias{Name: diskDevice.Name} + if diskDevice.BootOrder != nil { + disk.BootOrder = &BootOrder{Order: *diskDevice.BootOrder} + } + return nil } @@ -127,7 +160,7 @@ func Covert_v1_FilesystemVolumeSource_To_api_Disk(volumeName string, disk *Disk, disk.Driver.Type = "raw" disk.Source.File = filepath.Join( "/var/run/kubevirt-private", - "vm-disks", + "vmi-disks", volumeName, "disk.img") return nil @@ -306,50 +339,62 @@ func Convert_v1_FeatureHyperv_To_api_FeatureHyperv(source *v1.FeatureHyperv, hyp return nil } -func Convert_v1_VirtualMachine_To_api_Domain(vm *v1.VirtualMachine, domain *Domain, c *ConverterContext) (err error) { - precond.MustNotBeNil(vm) +func Convert_v1_VirtualMachine_To_api_Domain(vmi *v1.VirtualMachineInstance, domain *Domain, c *ConverterContext) (err error) { + precond.MustNotBeNil(vmi) precond.MustNotBeNil(domain) precond.MustNotBeNil(c) - domain.Spec.Name = VMNamespaceKeyFunc(vm) - domain.ObjectMeta.Name = vm.ObjectMeta.Name - domain.ObjectMeta.Namespace = vm.ObjectMeta.Namespace + domain.Spec.Name = VMINamespaceKeyFunc(vmi) + domain.ObjectMeta.Name = vmi.ObjectMeta.Name + domain.ObjectMeta.Namespace = vmi.ObjectMeta.Namespace - // XXX Fix me properly we don't want automatic fallback to qemu - // We will solve this properly in https://github.com/kubevirt/kubevirt/pull/804 if _, err := os.Stat("/dev/kvm"); os.IsNotExist(err) { - domain.Spec.Type = "qemu" + if c.UseEmulation { + logger := log.DefaultLogger() + logger.Infof("Hardware emulation device '/dev/kvm' not present. Using software emulation.") + domain.Spec.Type = "qemu" + } else { + return fmt.Errorf("hardware emulation device '/dev/kvm' not present") + } } else if err != nil { return err } // Spec metadata - domain.Spec.Metadata.KubeVirt.UID = vm.UID - if vm.Spec.TerminationGracePeriodSeconds != nil { - domain.Spec.Metadata.KubeVirt.GracePeriod.DeletionGracePeriodSeconds = *vm.Spec.TerminationGracePeriodSeconds + domain.Spec.Metadata.KubeVirt.UID = vmi.UID + if vmi.Spec.TerminationGracePeriodSeconds != nil { + domain.Spec.Metadata.KubeVirt.GracePeriod.DeletionGracePeriodSeconds = *vmi.Spec.TerminationGracePeriodSeconds } domain.Spec.SysInfo = &SysInfo{} - if vm.Spec.Domain.Firmware != nil { + if vmi.Spec.Domain.Firmware != nil { domain.Spec.SysInfo.System = []Entry{ { Name: "uuid", - Value: string(vm.Spec.Domain.Firmware.UUID), + Value: string(vmi.Spec.Domain.Firmware.UUID), }, } } - if v, ok := vm.Spec.Domain.Resources.Requests[k8sv1.ResourceMemory]; ok { - domain.Spec.Memory = QuantityToMegaByte(v) + if v, ok := vmi.Spec.Domain.Resources.Requests[k8sv1.ResourceMemory]; ok { + if domain.Spec.Memory, err = QuantityToByte(v); err != nil { + return err + } + } + + if vmi.Spec.Domain.Memory != nil && vmi.Spec.Domain.Memory.Hugepages != nil { + domain.Spec.MemoryBacking = &MemoryBacking{ + HugePages: &HugePages{}, + } } volumes := map[string]*v1.Volume{} - for _, volume := range vm.Spec.Volumes { + for _, volume := range vmi.Spec.Volumes { volumes[volume.Name] = volume.DeepCopy() } devicePerBus := make(map[string]int) - for _, disk := range vm.Spec.Domain.Devices.Disks { + for _, disk := range vmi.Spec.Domain.Devices.Disks { newDisk := Disk{} err := Convert_v1_Disk_To_api_Disk(&disk, &newDisk, devicePerBus) @@ -367,17 +412,17 @@ func Convert_v1_VirtualMachine_To_api_Domain(vm *v1.VirtualMachine, domain *Doma domain.Spec.Devices.Disks = append(domain.Spec.Devices.Disks, newDisk) } - if vm.Spec.Domain.Devices.Watchdog != nil { + if vmi.Spec.Domain.Devices.Watchdog != nil { newWatchdog := &Watchdog{} - err := Convert_v1_Watchdog_To_api_Watchdog(vm.Spec.Domain.Devices.Watchdog, newWatchdog, c) + err := Convert_v1_Watchdog_To_api_Watchdog(vmi.Spec.Domain.Devices.Watchdog, newWatchdog, c) if err != nil { return err } domain.Spec.Devices.Watchdog = newWatchdog } - if vm.Spec.Domain.Clock != nil { - clock := vm.Spec.Domain.Clock + if vmi.Spec.Domain.Clock != nil { + clock := vmi.Spec.Domain.Clock newClock := &Clock{} err := Convert_v1_Clock_To_api_Clock(clock, newClock, c) if err != nil { @@ -386,31 +431,44 @@ func Convert_v1_VirtualMachine_To_api_Domain(vm *v1.VirtualMachine, domain *Doma domain.Spec.Clock = newClock } - if vm.Spec.Domain.Features != nil { + if vmi.Spec.Domain.Features != nil { domain.Spec.Features = &Features{} - err := Convert_v1_Features_To_api_Features(vm.Spec.Domain.Features, domain.Spec.Features, c) + err := Convert_v1_Features_To_api_Features(vmi.Spec.Domain.Features, domain.Spec.Features, c) if err != nil { return err } } - apiOst := &vm.Spec.Domain.Machine + apiOst := &vmi.Spec.Domain.Machine err = Convert_v1_Machine_To_api_OSType(apiOst, &domain.Spec.OS.Type, c) if err != nil { return err } - if vm.Spec.Domain.CPU != nil { - domain.Spec.CPU.Topology = &CPUTopology{ - Sockets: 1, - Cores: vm.Spec.Domain.CPU.Cores, - Threads: 1, + if vmi.Spec.Domain.CPU != nil { + // Set VM CPU cores + if vmi.Spec.Domain.CPU.Cores != 0 { + domain.Spec.CPU.Topology = &CPUTopology{ + Sockets: 1, + Cores: vmi.Spec.Domain.CPU.Cores, + Threads: 1, + } + domain.Spec.VCPU = &VCPU{ + Placement: "static", + CPUs: vmi.Spec.Domain.CPU.Cores, + } } - domain.Spec.VCPU = &VCPU{ - Placement: "static", - CPUs: vm.Spec.Domain.CPU.Cores, + + // Set VM CPU model and vendor + if vmi.Spec.Domain.CPU.Model != "" { + domain.Spec.CPU.Mode = "custom" + domain.Spec.CPU.Model = vmi.Spec.Domain.CPU.Model } } + if vmi.Spec.Domain.CPU == nil || vmi.Spec.Domain.CPU.Model == "" { + domain.Spec.CPU.Mode = "host-model" + } + // Add mandatory console device var serialPort uint = 0 var serialType string = "serial" @@ -432,7 +490,7 @@ func Convert_v1_VirtualMachine_To_api_Domain(vm *v1.VirtualMachine, domain *Doma }, Source: &SerialSource{ Mode: "bind", - Path: fmt.Sprintf("/var/run/kubevirt-private/%s/%s/virt-serial%d", vm.ObjectMeta.Namespace, vm.ObjectMeta.Name, serialPort), + Path: fmt.Sprintf("/var/run/kubevirt-private/%s/%s/virt-serial%d", vmi.ObjectMeta.Namespace, vmi.ObjectMeta.Name, serialPort), }, }, } @@ -442,24 +500,185 @@ func Convert_v1_VirtualMachine_To_api_Domain(vm *v1.VirtualMachine, domain *Doma { Listen: &GraphicsListen{ Type: "socket", - Socket: fmt.Sprintf("/var/run/kubevirt-private/%s/%s/virt-vnc", vm.ObjectMeta.Namespace, vm.ObjectMeta.Name), + Socket: fmt.Sprintf("/var/run/kubevirt-private/%s/%s/virt-vnc", vmi.ObjectMeta.Namespace, vmi.ObjectMeta.Name), }, Type: "vnc", }, } + getInterfaceType := func(iface *v1.Interface) string { + if iface.Slirp != nil { + // Slirp configuration works only with e1000 or rtl8139 + if iface.Model != "e1000" && iface.Model != "rtl8139" { + log.Log.Infof("The network interface type of %s was changed to e1000 due to unsupported interface type by qemu slirp network", iface.Name) + return "e1000" + } + return iface.Model + } + if iface.Model != "" { + return iface.Model + } + return "virtio" + } + + networks := map[string]*v1.Network{} + for _, network := range vmi.Spec.Networks { + networks[network.Name] = network.DeepCopy() + } + + for _, iface := range vmi.Spec.Domain.Devices.Interfaces { + net, isExist := networks[iface.Name] + if !isExist { + return fmt.Errorf("failed to find network %s", iface.Name) + } + + if net.Pod == nil { + return fmt.Errorf("network interface type not supported for %s", iface.Name) + } + + if iface.Bridge != nil { + // TODO:(ihar) consider abstracting interface type conversion / + // detection into drivers + domainIface := Interface{ + Model: &Model{ + Type: getInterfaceType(&iface), + }, + Type: "bridge", + Source: InterfaceSource{ + Bridge: DefaultBridgeName, + }, + Alias: &Alias{ + Name: iface.Name, + }, + } + domain.Spec.Devices.Interfaces = append(domain.Spec.Devices.Interfaces, domainIface) + } else if iface.Slirp != nil { + domainIface := Interface{ + Model: &Model{ + Type: getInterfaceType(&iface), + }, + Type: "user", + Alias: &Alias{ + Name: iface.Name, + }, + } + domain.Spec.Devices.Interfaces = append(domain.Spec.Devices.Interfaces, domainIface) + + // Create network interface + if domain.Spec.QEMUCmd == nil { + domain.Spec.QEMUCmd = &Commandline{} + } + + if domain.Spec.QEMUCmd.QEMUArg == nil { + domain.Spec.QEMUCmd.QEMUArg = make([]Arg, 0) + } + + // TODO: (seba) Need to change this if multiple interface can be connected to the same network + // append the ports from all the interfaces connected to the same network + err := createSlirpNetwork(iface, *net, domain) + if err != nil { + return err + } + } + } + return nil } -func SecretToLibvirtSecret(vm *v1.VirtualMachine, secretName string) string { - return fmt.Sprintf("%s-%s-%s---", secretName, vm.Namespace, vm.Name) +func createSlirpNetwork(iface v1.Interface, network v1.Network, domain *Domain) error { + qemuArg := Arg{Value: fmt.Sprintf("user,id=%s", iface.Name)} + + err := configVMCIDR(&qemuArg, iface, network) + if err != nil { + return err + } + + err = configDNSSearchName(&qemuArg) + if err != nil { + return err + } + + err = configPortForward(&qemuArg, iface) + if err != nil { + return err + } + + domain.Spec.QEMUCmd.QEMUArg = append(domain.Spec.QEMUCmd.QEMUArg, Arg{Value: "-netdev"}) + domain.Spec.QEMUCmd.QEMUArg = append(domain.Spec.QEMUCmd.QEMUArg, qemuArg) + + return nil } -func QuantityToMegaByte(quantity resource.Quantity) Memory { - return Memory{ - Value: uint(quantity.ToDec().ScaledValue(6)), - Unit: "MB", +func configPortForward(qemuArg *Arg, iface v1.Interface) error { + if iface.Ports == nil { + return nil + } + + // Can't be duplicated ports forward or the qemu process will crash + configuredPorts := make(map[string]struct{}, 0) + for _, forwardPort := range iface.Ports { + + if forwardPort.Port == 0 { + return fmt.Errorf("Port must be configured") + } + + if forwardPort.Protocol == "" { + forwardPort.Protocol = DefaultProtocol + } + + portConfig := fmt.Sprintf("%s-%d", forwardPort.Protocol, forwardPort.Port) + if _, ok := configuredPorts[portConfig]; !ok { + qemuArg.Value += fmt.Sprintf(",hostfwd=%s::%d-:%d", strings.ToLower(forwardPort.Protocol), forwardPort.Port, forwardPort.Port) + configuredPorts[portConfig] = struct{}{} + } } + + return nil +} + +func configVMCIDR(qemuArg *Arg, iface v1.Interface, network v1.Network) error { + vmNetworkCIDR := "" + if network.Pod.VMNetworkCIDR != "" { + _, _, err := net.ParseCIDR(network.Pod.VMNetworkCIDR) + if err != nil { + return fmt.Errorf("Failed parsing CIDR %s", network.Pod.VMNetworkCIDR) + } + vmNetworkCIDR = network.Pod.VMNetworkCIDR + } else { + vmNetworkCIDR = DefaultVMCIDR + } + + // Insert configuration to qemu commandline + qemuArg.Value += fmt.Sprintf(",net=%s", vmNetworkCIDR) + + return nil +} + +func configDNSSearchName(qemuArg *Arg) error { + _, dnsDoms, err := GetResolvConfDetailsFromPod() + if err != nil { + return err + } + + for _, dom := range dnsDoms { + qemuArg.Value += fmt.Sprintf(",dnssearch=%s", dom) + } + return nil +} + +func SecretToLibvirtSecret(vmi *v1.VirtualMachineInstance, secretName string) string { + return fmt.Sprintf("%s-%s-%s---", secretName, vmi.Namespace, vmi.Name) +} + +func QuantityToByte(quantity resource.Quantity) (Memory, error) { + memorySize, _ := quantity.AsInt64() + if memorySize < 0 { + return Memory{Unit: "B"}, fmt.Errorf("Memory size '%s' must be greater than or equal to 0", quantity.String()) + } + return Memory{ + Value: uint64(memorySize), + Unit: "B", + }, nil } func boolToOnOff(value *bool, defaultOn bool) string { @@ -489,3 +708,84 @@ func boolToYesNo(value *bool, defaultYes bool) string { } return "no" } + +// returns nameservers [][]byte, searchdomains []string, error +func GetResolvConfDetailsFromPod() ([][]byte, []string, error) { + b, err := ioutil.ReadFile(resolvConf) + if err != nil { + return nil, nil, err + } + + nameservers, err := ParseNameservers(string(b)) + if err != nil { + return nil, nil, err + } + + searchDomains, err := ParseSearchDomains(string(b)) + if err != nil { + return nil, nil, err + } + + log.Log.Reason(err).Infof("Found nameservers in %s: %s", resolvConf, bytes.Join(nameservers, []byte{' '})) + log.Log.Reason(err).Infof("Found search domains in %s: %s", resolvConf, strings.Join(searchDomains, " ")) + + return nameservers, searchDomains, err +} + +func ParseNameservers(content string) ([][]byte, error) { + var nameservers [][]byte + + re, err := regexp.Compile("([0-9]{1,3}.?){4}") + if err != nil { + return nameservers, err + } + + scanner := bufio.NewScanner(strings.NewReader(content)) + + for scanner.Scan() { + line := scanner.Text() + if strings.HasPrefix(line, nameserverPrefix) { + nameserver := re.FindString(line) + if nameserver != "" { + nameservers = append(nameservers, net.ParseIP(nameserver).To4()) + } + } + } + + if err = scanner.Err(); err != nil { + return nameservers, err + } + + // apply a default DNS if none found from pod + if len(nameservers) == 0 { + nameservers = append(nameservers, net.ParseIP(defaultDNS).To4()) + } + + return nameservers, nil +} + +func ParseSearchDomains(content string) ([]string, error) { + var searchDomains []string + + scanner := bufio.NewScanner(strings.NewReader(content)) + + for scanner.Scan() { + line := scanner.Text() + if strings.HasPrefix(line, domainSearchPrefix) { + doms := strings.Fields(strings.TrimPrefix(line, domainSearchPrefix)) + for _, dom := range doms { + searchDomains = append(searchDomains, dom) + } + } + } + + if err := scanner.Err(); err != nil { + return nil, err + } + + if len(searchDomains) == 0 { + searchDomains = append(searchDomains, defaultSearchDomain) + } + + return searchDomains, nil +} diff --git a/vendor/kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/api/deepcopy_generated.go b/vendor/kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/api/deepcopy_generated.go index efae4bc4b..5d538922e 100644 --- a/vendor/kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/api/deepcopy_generated.go +++ b/vendor/kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/api/deepcopy_generated.go @@ -60,6 +60,22 @@ func (in *Alias) DeepCopy() *Alias { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Arg) DeepCopyInto(out *Arg) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Arg. +func (in *Arg) DeepCopy() *Arg { + if in == nil { + return nil + } + out := new(Arg) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *BIOS) DeepCopyInto(out *BIOS) { *out = *in @@ -335,6 +351,11 @@ func (in *Commandline) DeepCopyInto(out *Commandline) { *out = make([]Env, len(*in)) copy(*out, *in) } + if in.QEMUArg != nil { + in, out := &in.QEMUArg, &out.QEMUArg + *out = make([]Arg, len(*in)) + copy(*out, *in) + } return } @@ -461,7 +482,7 @@ func (in *ConverterContext) DeepCopyInto(out *ConverterContext) { if *in == nil { *out = nil } else { - *out = new(api_v1.VirtualMachine) + *out = new(api_v1.VirtualMachineInstance) (*in).DeepCopyInto(*out) } } @@ -611,6 +632,15 @@ func (in *Disk) DeepCopyInto(out *Disk) { (*in).DeepCopyInto(*out) } } + if in.BootOrder != nil { + in, out := &in.BootOrder, &out.BootOrder + if *in == nil { + *out = nil + } else { + *out = new(BootOrder) + **out = **in + } + } return } @@ -806,6 +836,15 @@ func (in *DomainSpec) DeepCopyInto(out *DomainSpec) { *out = *in out.XMLName = in.XMLName out.Memory = in.Memory + if in.MemoryBacking != nil { + in, out := &in.MemoryBacking, &out.MemoryBacking + if *in == nil { + *out = nil + } else { + *out = new(MemoryBacking) + (*in).DeepCopyInto(*out) + } + } in.OS.DeepCopyInto(&out.OS) if in.SysInfo != nil { in, out := &in.SysInfo, &out.SysInfo @@ -1220,6 +1259,43 @@ func (in *GraphicsListen) DeepCopy() *GraphicsListen { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HugePage) DeepCopyInto(out *HugePage) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HugePage. +func (in *HugePage) DeepCopy() *HugePage { + if in == nil { + return nil + } + out := new(HugePage) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HugePages) DeepCopyInto(out *HugePages) { + *out = *in + if in.HugePage != nil { + in, out := &in.HugePage, &out.HugePage + *out = make([]HugePage, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HugePages. +func (in *HugePages) DeepCopy() *HugePages { + if in == nil { + return nil + } + out := new(HugePages) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Interface) DeepCopyInto(out *Interface) { *out = *in @@ -1431,6 +1507,31 @@ func (in *Memory) DeepCopy() *Memory { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MemoryBacking) DeepCopyInto(out *MemoryBacking) { + *out = *in + if in.HugePages != nil { + in, out := &in.HugePages, &out.HugePages + if *in == nil { + *out = nil + } else { + *out = new(HugePages) + (*in).DeepCopyInto(*out) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MemoryBacking. +func (in *MemoryBacking) DeepCopy() *MemoryBacking { + if in == nil { + return nil + } + out := new(MemoryBacking) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Metadata) DeepCopyInto(out *Metadata) { *out = *in diff --git a/vendor/kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/api/defaults.go b/vendor/kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/api/defaults.go index 2150319fc..bb1b243db 100644 --- a/vendor/kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/api/defaults.go +++ b/vendor/kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/api/defaults.go @@ -1,6 +1,15 @@ package api -const DefaultBridgeName = "br1" +const ( + defaultDNS = "8.8.8.8" + resolvConf = "/etc/resolv.conf" + defaultSearchDomain = "cluster.local" + domainSearchPrefix = "search" + nameserverPrefix = "nameserver" + DefaultProtocol = "TCP" + DefaultVMCIDR = "10.0.2.0/24" + DefaultBridgeName = "br1" +) func SetDefaults_Devices(devices *Devices) { // Use vga as video device, since it is better than cirrus @@ -17,16 +26,6 @@ func SetDefaults_Devices(devices *Devices) { }, } - // For now connect every virtual machine to the default network - devices.Interfaces = []Interface{{ - Model: &Model{ - Type: "e1000", - }, - Type: "bridge", - Source: InterfaceSource{ - Bridge: DefaultBridgeName, - }}, - } } func SetDefaults_OSType(ostype *OSType) { diff --git a/vendor/kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/api/schema.go b/vendor/kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/api/schema.go index 87bc13659..200ed43e0 100644 --- a/vendor/kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/api/schema.go +++ b/vendor/kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/api/schema.go @@ -95,22 +95,23 @@ type DomainList struct { // tagged, and they must correspond to the libvirt domain as described in // https://libvirt.org/formatdomain.html. type DomainSpec struct { - XMLName xml.Name `xml:"domain"` - Type string `xml:"type,attr"` - XmlNS string `xml:"xmlns:qemu,attr,omitempty"` - Name string `xml:"name"` - UUID string `xml:"uuid,omitempty"` - Memory Memory `xml:"memory"` - OS OS `xml:"os"` - SysInfo *SysInfo `xml:"sysinfo,omitempty"` - Devices Devices `xml:"devices"` - Clock *Clock `xml:"clock,omitempty"` - Resource *Resource `xml:"resource,omitempty"` - QEMUCmd *Commandline `xml:"qemu:commandline,omitempty"` - Metadata Metadata `xml:"metadata,omitempty"` - Features *Features `xml:"features,omitempty"` - CPU CPU `xml:"cpu"` - VCPU *VCPU `xml:"vcpu"` + XMLName xml.Name `xml:"domain"` + Type string `xml:"type,attr"` + XmlNS string `xml:"xmlns:qemu,attr,omitempty"` + Name string `xml:"name"` + UUID string `xml:"uuid,omitempty"` + Memory Memory `xml:"memory"` + MemoryBacking *MemoryBacking `xml:"memoryBacking,omitempty"` + OS OS `xml:"os"` + SysInfo *SysInfo `xml:"sysinfo,omitempty"` + Devices Devices `xml:"devices"` + Clock *Clock `xml:"clock,omitempty"` + Resource *Resource `xml:"resource,omitempty"` + QEMUCmd *Commandline `xml:"qemu:commandline,omitempty"` + Metadata Metadata `xml:"metadata,omitempty"` + Features *Features `xml:"features,omitempty"` + CPU CPU `xml:"cpu"` + VCPU *VCPU `xml:"vcpu"` } type VCPU struct { @@ -120,6 +121,7 @@ type VCPU struct { type CPU struct { Mode string `xml:"mode,attr,omitempty"` + Model string `xml:"model,omitempty"` Topology *CPUTopology `xml:"topology"` } @@ -182,6 +184,7 @@ type GracePeriodMetadata struct { type Commandline struct { QEMUEnv []Env `xml:"qemu:env,omitempty"` + QEMUArg []Arg `xml:"qemu:arg,omitempty"` } type Env struct { @@ -189,15 +192,35 @@ type Env struct { Value string `xml:"value,attr"` } +type Arg struct { + Value string `xml:"value,attr"` +} + type Resource struct { Partition string `xml:"partition"` } type Memory struct { - Value uint `xml:",chardata"` + Value uint64 `xml:",chardata"` Unit string `xml:"unit,attr"` } +// MemoryBacking mirroring libvirt XML under https://libvirt.org/formatdomain.html#elementsMemoryBacking +type MemoryBacking struct { + HugePages *HugePages `xml:"hugepages,omitempty"` +} + +// HugePages mirroring libvirt XML under memoryBacking +type HugePages struct { + HugePage []HugePage `xml:"page,omitempty"` +} + +// HugePage mirroring libvirt XML under hugepages +type HugePage struct { + Size string `xml:"size,attr"` + Unit string `xml:"unit,attr"` +} + type Devices struct { Emulator string `xml:"emulator,omitempty"` Interfaces []Interface `xml:"interface"` @@ -225,6 +248,7 @@ type Disk struct { Auth *DiskAuth `xml:"auth,omitempty"` Alias *Alias `xml:"alias,omitempty"` BackingStore *BackingStore `xml:"backingStore,omitempty"` + BootOrder *BootOrder `xml:"boot,omitempty"` } type DiskAuth struct { @@ -545,15 +569,12 @@ type SecretSpec struct { Usage SecretUsage `xml:"usage,omitempty"` } -func NewMinimalDomainSpec(vmName string) *DomainSpec { - precond.MustNotBeEmpty(vmName) +func NewMinimalDomainSpec(vmiName string) *DomainSpec { + precond.MustNotBeEmpty(vmiName) domain := &DomainSpec{} - domain.Name = vmName + domain.Name = vmiName domain.Memory = Memory{Unit: "MB", Value: 9} domain.Devices = Devices{} - domain.Devices.Interfaces = []Interface{ - {Type: "network", Source: InterfaceSource{Network: "default"}}, - } return domain } @@ -607,9 +628,9 @@ func (dl *DomainList) GetListMeta() meta.List { return &dl.ListMeta } -// VMNamespaceKeyFunc constructs the domain name with a namespace prefix i.g. +// VMINamespaceKeyFunc constructs the domain name with a namespace prefix i.g. // namespace_name. -func VMNamespaceKeyFunc(vm *v1.VirtualMachine) string { - domName := fmt.Sprintf("%s_%s", vm.Namespace, vm.Name) +func VMINamespaceKeyFunc(vmi *v1.VirtualMachineInstance) string { + domName := fmt.Sprintf("%s_%s", vmi.Namespace, vmi.Name) return domName } diff --git a/vendor/kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/cmd-server/server.go b/vendor/kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/cmd-server/server.go index 40922fce0..98553a35c 100644 --- a/vendor/kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/cmd-server/server.go +++ b/vendor/kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/cmd-server/server.go @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * Copyright 2017 Red Hat, Inc. + * Copyright 2017, 2018 Red Hat, Inc. * */ @@ -33,80 +33,89 @@ import ( "kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap" ) +type ServerOptions struct { + useEmulation bool +} + +func NewServerOptions(useEmulation bool) *ServerOptions { + return &ServerOptions{useEmulation: useEmulation} +} + type Launcher struct { domainManager virtwrap.DomainManager + useEmulation bool } -func getVmfromClientArgs(args *cmdclient.Args) (*v1.VirtualMachine, error) { - if args.VM == nil { - return nil, goerror.New(fmt.Sprintf("vm object not present in command server args")) +func getVmfromClientArgs(args *cmdclient.Args) (*v1.VirtualMachineInstance, error) { + if args.VMI == nil { + return nil, goerror.New(fmt.Sprintf("vmi object not present in command server args")) } - return args.VM, nil + return args.VMI, nil } func (s *Launcher) Sync(args *cmdclient.Args, reply *cmdclient.Reply) error { reply.Success = true - vm, err := getVmfromClientArgs(args) + vmi, err := getVmfromClientArgs(args) if err != nil { reply.Success = false reply.Message = err.Error() return nil } - _, err = s.domainManager.SyncVM(vm) + _, err = s.domainManager.SyncVMI(vmi, s.useEmulation) if err != nil { - log.Log.Object(vm).Reason(err).Errorf("Failed to sync vm") + log.Log.Object(vmi).Reason(err).Errorf("Failed to sync vmi") reply.Success = false reply.Message = err.Error() return nil } - log.Log.Object(vm).Info("Synced vm") + log.Log.Object(vmi).Info("Synced vmi") return nil } func (s *Launcher) Kill(args *cmdclient.Args, reply *cmdclient.Reply) error { reply.Success = true - vm, err := getVmfromClientArgs(args) + vmi, err := getVmfromClientArgs(args) if err != nil { reply.Success = false reply.Message = err.Error() return nil } - err = s.domainManager.KillVM(vm) + err = s.domainManager.KillVMI(vmi) if err != nil { - log.Log.Object(vm).Reason(err).Errorf("Failed to kill vm") + log.Log.Object(vmi).Reason(err).Errorf("Failed to kill vmi") reply.Success = false reply.Message = err.Error() return nil } - log.Log.Object(vm).Info("Signaled vm kill") + log.Log.Object(vmi).Info("Signaled vmi kill") return nil } func (s *Launcher) Shutdown(args *cmdclient.Args, reply *cmdclient.Reply) error { reply.Success = true - vm, err := getVmfromClientArgs(args) + vmi, err := getVmfromClientArgs(args) if err != nil { reply.Success = false reply.Message = err.Error() return nil } - err = s.domainManager.SignalShutdownVM(vm) + err = s.domainManager.SignalShutdownVMI(vmi) if err != nil { - log.Log.Object(vm).Reason(err).Errorf("Failed to signal shutdown for vm") + log.Log.Object(vmi).Reason(err).Errorf("Failed to signal shutdown for vmi") reply.Success = false reply.Message = err.Error() return nil } - log.Log.Object(vm).Info("Signaled vm shutdown") + log.Log.Object(vmi).Info("Signaled vmi shutdown") return nil } @@ -150,11 +159,17 @@ func createSocket(socketPath string) (net.Listener, error) { func RunServer(socketPath string, domainManager virtwrap.DomainManager, - stopChan chan struct{}) error { + stopChan chan struct{}, + options *ServerOptions) error { + useEmulation := false + if options != nil { + useEmulation = options.useEmulation + } rpcServer := rpc.NewServer() server := &Launcher{ domainManager: domainManager, + useEmulation: useEmulation, } rpcServer.Register(server) sock, err := createSocket(socketPath) diff --git a/vendor/kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/generated_mock_manager.go b/vendor/kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/generated_mock_manager.go index b02a39135..32e93a85e 100644 --- a/vendor/kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/generated_mock_manager.go +++ b/vendor/kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/generated_mock_manager.go @@ -31,35 +31,35 @@ func (_m *MockDomainManager) EXPECT() *_MockDomainManagerRecorder { return _m.recorder } -func (_m *MockDomainManager) SyncVM(_param0 *v1.VirtualMachine) (*api.DomainSpec, error) { - ret := _m.ctrl.Call(_m, "SyncVM", _param0) +func (_m *MockDomainManager) SyncVMI(_param0 *v1.VirtualMachineInstance, _param1 bool) (*api.DomainSpec, error) { + ret := _m.ctrl.Call(_m, "SyncVMI", _param0, _param1) ret0, _ := ret[0].(*api.DomainSpec) ret1, _ := ret[1].(error) return ret0, ret1 } -func (_mr *_MockDomainManagerRecorder) SyncVM(arg0 interface{}) *gomock.Call { - return _mr.mock.ctrl.RecordCall(_mr.mock, "SyncVM", arg0) +func (_mr *_MockDomainManagerRecorder) SyncVMI(arg0, arg1 interface{}) *gomock.Call { + return _mr.mock.ctrl.RecordCall(_mr.mock, "SyncVMI", arg0, arg1) } -func (_m *MockDomainManager) KillVM(_param0 *v1.VirtualMachine) error { - ret := _m.ctrl.Call(_m, "KillVM", _param0) +func (_m *MockDomainManager) KillVMI(_param0 *v1.VirtualMachineInstance) error { + ret := _m.ctrl.Call(_m, "KillVMI", _param0) ret0, _ := ret[0].(error) return ret0 } -func (_mr *_MockDomainManagerRecorder) KillVM(arg0 interface{}) *gomock.Call { - return _mr.mock.ctrl.RecordCall(_mr.mock, "KillVM", arg0) +func (_mr *_MockDomainManagerRecorder) KillVMI(arg0 interface{}) *gomock.Call { + return _mr.mock.ctrl.RecordCall(_mr.mock, "KillVMI", arg0) } -func (_m *MockDomainManager) SignalShutdownVM(_param0 *v1.VirtualMachine) error { - ret := _m.ctrl.Call(_m, "SignalShutdownVM", _param0) +func (_m *MockDomainManager) SignalShutdownVMI(_param0 *v1.VirtualMachineInstance) error { + ret := _m.ctrl.Call(_m, "SignalShutdownVMI", _param0) ret0, _ := ret[0].(error) return ret0 } -func (_mr *_MockDomainManagerRecorder) SignalShutdownVM(arg0 interface{}) *gomock.Call { - return _mr.mock.ctrl.RecordCall(_mr.mock, "SignalShutdownVM", arg0) +func (_mr *_MockDomainManagerRecorder) SignalShutdownVMI(arg0 interface{}) *gomock.Call { + return _mr.mock.ctrl.RecordCall(_mr.mock, "SignalShutdownVMI", arg0) } func (_m *MockDomainManager) ListAllDomains() ([]*api.Domain, error) { diff --git a/vendor/kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/manager.go b/vendor/kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/manager.go index ddbc153fe..e17cff8e0 100644 --- a/vendor/kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/manager.go +++ b/vendor/kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/manager.go @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * Copyright 2017 Red Hat, Inc. + * Copyright 2017, 2018 Red Hat, Inc. * */ @@ -39,6 +39,7 @@ import ( "kubevirt.io/kubevirt/pkg/ephemeral-disk" "kubevirt.io/kubevirt/pkg/log" "kubevirt.io/kubevirt/pkg/registry-disk" + "kubevirt.io/kubevirt/pkg/util/net/dns" "kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/api" "kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/cli" domainerrors "kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/errors" @@ -47,9 +48,9 @@ import ( ) type DomainManager interface { - SyncVM(*v1.VirtualMachine) (*api.DomainSpec, error) - KillVM(*v1.VirtualMachine) error - SignalShutdownVM(*v1.VirtualMachine) error + SyncVMI(*v1.VirtualMachineInstance, bool) (*api.DomainSpec, error) + KillVMI(*v1.VirtualMachineInstance) error + SignalShutdownVMI(*v1.VirtualMachineInstance) error ListAllDomains() ([]*api.Domain, error) } @@ -65,7 +66,7 @@ func NewLibvirtDomainManager(connection cli.Connection) (DomainManager, error) { return &manager, nil } -// All local environment setup that needs to occur before VM starts +// All local environment setup that needs to occur before VirtualMachineInstance starts // can be done in this function. This includes things like... // // - storage prep @@ -74,57 +75,60 @@ func NewLibvirtDomainManager(connection cli.Connection) (DomainManager, error) { // // The Domain.Spec can be alterned in this function and any changes // made to the domain will get set in libvirt after this function exits. -func (l *LibvirtDomainManager) preStartHook(vm *v1.VirtualMachine, domain *api.Domain) (*api.Domain, error) { +func (l *LibvirtDomainManager) preStartHook(vmi *v1.VirtualMachineInstance, domain *api.Domain) (*api.Domain, error) { // ensure registry disk files have correct ownership privileges - err := registrydisk.SetFilePermissions(vm) + err := registrydisk.SetFilePermissions(vmi) if err != nil { return domain, err } // generate cloud-init data - cloudInitData := cloudinit.GetCloudInitNoCloudSource(vm) + cloudInitData := cloudinit.GetCloudInitNoCloudSource(vmi) if cloudInitData != nil { - err := cloudinit.GenerateLocalData(vm.Name, vm.Namespace, cloudInitData) + hostname := dns.SanitizeHostname(vmi) + + err := cloudinit.GenerateLocalData(vmi.Name, hostname, vmi.Namespace, cloudInitData) if err != nil { return domain, err } } // setup networking - err = network.SetupPodNetwork(domain) + err = network.SetupPodNetwork(vmi, domain) if err != nil { return domain, err } // Create images for volumes that are marked ephemeral. - err = ephemeraldisk.CreateEphemeralImages(vm) + err = ephemeraldisk.CreateEphemeralImages(vmi) if err != nil { return domain, err } // create empty disks if they exist - if err := emptydisk.CreateTemporaryDisks(vm); err != nil { + if err := emptydisk.CreateTemporaryDisks(vmi); err != nil { return domain, fmt.Errorf("creating empty disks failed: %v", err) } return domain, err } -func (l *LibvirtDomainManager) SyncVM(vm *v1.VirtualMachine) (*api.DomainSpec, error) { - logger := log.Log.Object(vm) +func (l *LibvirtDomainManager) SyncVMI(vmi *v1.VirtualMachineInstance, useEmulation bool) (*api.DomainSpec, error) { + logger := log.Log.Object(vmi) domain := &api.Domain{} - // Map the VirtualMachine to the Domain + // Map the VirtualMachineInstance to the Domain c := &api.ConverterContext{ - VirtualMachine: vm, + VirtualMachine: vmi, + UseEmulation: useEmulation, } - if err := api.Convert_v1_VirtualMachine_To_api_Domain(vm, domain, c); err != nil { + if err := api.Convert_v1_VirtualMachine_To_api_Domain(vmi, domain, c); err != nil { logger.Error("Conversion failed.") return nil, err } - // Set defaults which are not comming from the cluster + // Set defaults which are not coming from the cluster api.SetObjectDefaults_Domain(domain) dom, err := l.virConn.LookupDomainByName(domain.Spec.Name) @@ -133,12 +137,12 @@ func (l *LibvirtDomainManager) SyncVM(vm *v1.VirtualMachine) (*api.DomainSpec, e // We need the domain but it does not exist, so create it if domainerrors.IsNotFound(err) { newDomain = true - domain, err = l.preStartHook(vm, domain) + domain, err = l.preStartHook(vmi, domain) if err != nil { - logger.Reason(err).Error("pre start setup for VM failed.") + logger.Reason(err).Error("pre start setup for VirtualMachineInstance failed.") return nil, err } - dom, err = util.SetDomainSpec(l.virConn, vm, domain.Spec) + dom, err = util.SetDomainSpec(l.virConn, vmi, domain.Spec) if err != nil { return nil, err } @@ -156,9 +160,9 @@ func (l *LibvirtDomainManager) SyncVM(vm *v1.VirtualMachine) (*api.DomainSpec, e } // To make sure, that we set the right qemu wrapper arguments, - // we update the domain XML whenever a VM was already defined but not running + // we update the domain XML whenever a VirtualMachineInstance was already defined but not running if !newDomain && cli.IsDown(domState) { - dom, err = util.SetDomainSpec(l.virConn, vm, domain.Spec) + dom, err = util.SetDomainSpec(l.virConn, vmi, domain.Spec) if err != nil { return nil, err } @@ -170,7 +174,7 @@ func (l *LibvirtDomainManager) SyncVM(vm *v1.VirtualMachine) (*api.DomainSpec, e if cli.IsDown(domState) { err = dom.Create() if err != nil { - logger.Reason(err).Error("Starting the VM failed.") + logger.Reason(err).Error("Starting the VirtualMachineInstance failed.") return nil, err } logger.Info("Domain started.") @@ -178,7 +182,7 @@ func (l *LibvirtDomainManager) SyncVM(vm *v1.VirtualMachine) (*api.DomainSpec, e // TODO: if state change reason indicates a system error, we could try something smarter err := dom.Resume() if err != nil { - logger.Reason(err).Error("Resuming the VM failed.") + logger.Reason(err).Error("Resuming the VirtualMachineInstance failed.") return nil, err } logger.Info("Domain resumed.") @@ -198,7 +202,7 @@ func (l *LibvirtDomainManager) SyncVM(vm *v1.VirtualMachine) (*api.DomainSpec, e return nil, err } - // TODO: check if VM Spec and Domain Spec are equal or if we have to sync + // TODO: check if VirtualMachineInstance Spec and Domain Spec are equal or if we have to sync return &newSpec, nil } @@ -206,15 +210,15 @@ func (l *LibvirtDomainManager) getDomainSpec(dom cli.VirDomain) (*api.DomainSpec return util.GetDomainSpec(dom) } -func (l *LibvirtDomainManager) SignalShutdownVM(vm *v1.VirtualMachine) error { - domName := util.VMNamespaceKeyFunc(vm) +func (l *LibvirtDomainManager) SignalShutdownVMI(vmi *v1.VirtualMachineInstance) error { + domName := util.VMINamespaceKeyFunc(vmi) dom, err := l.virConn.LookupDomainByName(domName) if err != nil { - // If the VM does not exist, we are done + // If the VirtualMachineInstance does not exist, we are done if domainerrors.IsNotFound(err) { return nil } else { - log.Log.Object(vm).Reason(err).Error("Getting the domain failed during graceful shutdown.") + log.Log.Object(vmi).Reason(err).Error("Getting the domain failed during graceful shutdown.") return err } } @@ -222,30 +226,30 @@ func (l *LibvirtDomainManager) SignalShutdownVM(vm *v1.VirtualMachine) error { domState, _, err := dom.GetState() if err != nil { - log.Log.Object(vm).Reason(err).Error("Getting the domain state failed.") + log.Log.Object(vmi).Reason(err).Error("Getting the domain state failed.") return err } if domState == libvirt.DOMAIN_RUNNING || domState == libvirt.DOMAIN_PAUSED { domSpec, err := l.getDomainSpec(dom) if err != nil { - log.Log.Object(vm).Reason(err).Error("Unable to retrieve domain xml") + log.Log.Object(vmi).Reason(err).Error("Unable to retrieve domain xml") return err } if domSpec.Metadata.KubeVirt.GracePeriod.DeletionTimestamp == nil { err = dom.Shutdown() if err != nil { - log.Log.Object(vm).Reason(err).Error("Signalling graceful shutdown failed.") + log.Log.Object(vmi).Reason(err).Error("Signalling graceful shutdown failed.") return err } - log.Log.Object(vm).Infof("Signaled graceful shutdown for %s", vm.GetObjectMeta().GetName()) + log.Log.Object(vmi).Infof("Signaled graceful shutdown for %s", vmi.GetObjectMeta().GetName()) now := k8sv1.Now() domSpec.Metadata.KubeVirt.GracePeriod.DeletionTimestamp = &now - _, err = util.SetDomainSpec(l.virConn, vm, *domSpec) + _, err = util.SetDomainSpec(l.virConn, vmi, *domSpec) if err != nil { - log.Log.Object(vm).Reason(err).Error("Unable to update grace period start time on domain xml") + log.Log.Object(vmi).Reason(err).Error("Unable to update grace period start time on domain xml") return err } } @@ -254,15 +258,15 @@ func (l *LibvirtDomainManager) SignalShutdownVM(vm *v1.VirtualMachine) error { return nil } -func (l *LibvirtDomainManager) KillVM(vm *v1.VirtualMachine) error { - domName := api.VMNamespaceKeyFunc(vm) +func (l *LibvirtDomainManager) KillVMI(vmi *v1.VirtualMachineInstance) error { + domName := api.VMINamespaceKeyFunc(vmi) dom, err := l.virConn.LookupDomainByName(domName) if err != nil { - // If the VM does not exist, we are done + // If the VirtualMachineInstance does not exist, we are done if domainerrors.IsNotFound(err) { return nil } else { - log.Log.Object(vm).Reason(err).Error("Getting the domain failed.") + log.Log.Object(vmi).Reason(err).Error("Getting the domain failed.") return err } } @@ -273,7 +277,7 @@ func (l *LibvirtDomainManager) KillVM(vm *v1.VirtualMachine) error { if domainerrors.IsNotFound(err) { return nil } - log.Log.Object(vm).Reason(err).Error("Getting the domain state failed.") + log.Log.Object(vmi).Reason(err).Error("Getting the domain state failed.") return err } @@ -283,10 +287,10 @@ func (l *LibvirtDomainManager) KillVM(vm *v1.VirtualMachine) error { if domainerrors.IsNotFound(err) { return nil } - log.Log.Object(vm).Reason(err).Error("Destroying the domain state failed.") + log.Log.Object(vmi).Reason(err).Error("Destroying the domain state failed.") return err } - log.Log.Object(vm).Info("Domain stopped.") + log.Log.Object(vmi).Info("Domain stopped.") } err = dom.Undefine() @@ -294,10 +298,10 @@ func (l *LibvirtDomainManager) KillVM(vm *v1.VirtualMachine) error { if domainerrors.IsNotFound(err) { return nil } - log.Log.Object(vm).Reason(err).Error("Undefining the domain state failed.") + log.Log.Object(vmi).Reason(err).Error("Undefining the domain state failed.") return err } - log.Log.Object(vm).Info("Domain undefined.") + log.Log.Object(vmi).Info("Domain undefined.") return nil } diff --git a/vendor/kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/network/common.go b/vendor/kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/network/common.go new file mode 100644 index 000000000..c9566e506 --- /dev/null +++ b/vendor/kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/network/common.go @@ -0,0 +1,222 @@ +/* + * This file is part of the KubeVirt project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Copyright 2018 Red Hat, Inc. + * + */ + +//go:generate mockgen -source $GOFILE -package=$GOPACKAGE -destination=generated_mock_$GOFILE + +package network + +import ( + "encoding/json" + "fmt" + "io/ioutil" + "net" + "os" + + "github.com/vishvananda/netlink" + + "kubevirt.io/kubevirt/pkg/log" + "kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/api" + "kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/network/dhcp" + + lmf "github.com/subgraph/libmacouflage" +) + +type VIF struct { + Name string + IP netlink.Addr + MAC net.HardwareAddr + Gateway net.IP + Routes *[]netlink.Route + Mtu uint16 +} + +type NetworkHandler interface { + LinkByName(name string) (netlink.Link, error) + AddrList(link netlink.Link, family int) ([]netlink.Addr, error) + RouteList(link netlink.Link, family int) ([]netlink.Route, error) + AddrDel(link netlink.Link, addr *netlink.Addr) error + AddrAdd(link netlink.Link, addr *netlink.Addr) error + LinkSetDown(link netlink.Link) error + LinkSetUp(link netlink.Link) error + LinkAdd(link netlink.Link) error + ParseAddr(s string) (*netlink.Addr, error) + SetRandomMac(iface string) (net.HardwareAddr, error) + GetMacDetails(iface string) (net.HardwareAddr, error) + StartDHCP(nic *VIF, serverAddr *netlink.Addr) +} + +type NetworkUtilsHandler struct{} + +var Handler NetworkHandler + +func (h *NetworkUtilsHandler) LinkByName(name string) (netlink.Link, error) { + return netlink.LinkByName(name) +} +func (h *NetworkUtilsHandler) AddrList(link netlink.Link, family int) ([]netlink.Addr, error) { + return netlink.AddrList(link, family) +} +func (h *NetworkUtilsHandler) RouteList(link netlink.Link, family int) ([]netlink.Route, error) { + return netlink.RouteList(link, family) +} +func (h *NetworkUtilsHandler) AddrDel(link netlink.Link, addr *netlink.Addr) error { + return netlink.AddrDel(link, addr) +} +func (h *NetworkUtilsHandler) LinkSetDown(link netlink.Link) error { + return netlink.LinkSetDown(link) +} +func (h *NetworkUtilsHandler) LinkSetUp(link netlink.Link) error { + return netlink.LinkSetUp(link) +} +func (h *NetworkUtilsHandler) LinkAdd(link netlink.Link) error { + return netlink.LinkAdd(link) +} +func (h *NetworkUtilsHandler) ParseAddr(s string) (*netlink.Addr, error) { + return netlink.ParseAddr(s) +} +func (h *NetworkUtilsHandler) AddrAdd(link netlink.Link, addr *netlink.Addr) error { + return netlink.AddrAdd(link, addr) +} + +// GetMacDetails from an interface +func (h *NetworkUtilsHandler) GetMacDetails(iface string) (net.HardwareAddr, error) { + currentMac, err := lmf.GetCurrentMac(iface) + if err != nil { + log.Log.Reason(err).Errorf("failed to get mac information for interface: %s", iface) + return nil, err + } + return currentMac, nil +} + +// SetRandomMac changes the MAC address for a agiven interface to a randomly generated, preserving the vendor prefix +func (h *NetworkUtilsHandler) SetRandomMac(iface string) (net.HardwareAddr, error) { + var mac net.HardwareAddr + + currentMac, err := Handler.GetMacDetails(iface) + if err != nil { + return nil, err + } + + changed, err := lmf.SpoofMacSameVendor(iface, false) + if err != nil { + log.Log.Reason(err).Errorf("failed to spoof MAC for an interface: %s", iface) + return nil, err + } + + if changed { + mac, err = Handler.GetMacDetails(iface) + if err != nil { + return nil, err + } + log.Log.Reason(err).Errorf("updated MAC for interface: %s - %s", iface, mac) + } + return currentMac, nil +} + +func (h *NetworkUtilsHandler) StartDHCP(nic *VIF, serverAddr *netlink.Addr) { + nameservers, searchDomains, err := api.GetResolvConfDetailsFromPod() + if err != nil { + log.Log.Errorf("Failed to get DNS servers from resolv.conf: %v", err) + panic(err) + } + + // panic in case the DHCP server failed during the vm creation + // but ignore dhcp errors when the vm is destroyed or shutting down + go func() { + if err = DHCPServer( + nic.MAC, + nic.IP.IP, + nic.IP.Mask, + api.DefaultBridgeName, + serverAddr.IP, + nic.Gateway, + nameservers, + nic.Routes, + searchDomains, + nic.Mtu, + ); err != nil { + log.Log.Errorf("failed to run DHCP: %v", err) + panic(err) + } + }() +} + +// Allow mocking for tests +var SetupPodNetwork = SetupNetworkInterfaces +var DHCPServer = dhcp.SingleClientDHCPServer + +func initHandler() { + if Handler == nil { + Handler = &NetworkUtilsHandler{} + } +} + +func writeToCachedFile(inter interface{}, fileName, name string) error { + buf, err := json.MarshalIndent(&inter, "", " ") + if err != nil { + return fmt.Errorf("error marshaling cached object: %v", err) + } + err = ioutil.WriteFile(getInterfaceCacheFile(fileName, name), buf, 0644) + if err != nil { + return fmt.Errorf("error writing cached object: %v", err) + } + return nil +} + +func readFromCachedFile(name, fileName string, inter interface{}) (bool, error) { + buf, err := ioutil.ReadFile(getInterfaceCacheFile(fileName, name)) + if err != nil { + if os.IsNotExist(err) { + return false, nil + } + return false, err + } + + err = json.Unmarshal(buf, &inter) + if err != nil { + return false, fmt.Errorf("error unmarshaling cached object: %v", err) + } + return true, nil +} + +func getInterfaceCacheFile(filePath, name string) string { + return fmt.Sprintf(filePath, name) +} + +// filter out irrelevant routes +func filterPodNetworkRoutes(routes []netlink.Route, nic *VIF) (filteredRoutes []netlink.Route) { + for _, route := range routes { + // don't create empty static routes + if route.Dst == nil && route.Src.Equal(nil) && route.Gw.Equal(nil) { + continue + } + + // don't create static route for src == nic + if route.Src != nil && route.Src.Equal(nic.IP.IP) { + continue + } + + filteredRoutes = append(filteredRoutes, route) + } + return +} + +// only used by unit test suite +func setInterfaceCacheFile(path string) { + interfaceCacheFile = path +} diff --git a/vendor/kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/network/dhcp/dhcp.go b/vendor/kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/network/dhcp/dhcp.go index b5cbb48b8..d5f0f57fa 100644 --- a/vendor/kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/network/dhcp/dhcp.go +++ b/vendor/kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/network/dhcp/dhcp.go @@ -21,6 +21,7 @@ package dhcp import ( "bytes" + "encoding/binary" "fmt" "net" "regexp" @@ -31,6 +32,8 @@ import ( dhcpConn "github.com/krolaw/dhcp4/conn" "github.com/vishvananda/netlink" + "os" + "kubevirt.io/kubevirt/pkg/log" ) @@ -53,14 +56,19 @@ func SingleClientDHCPServer( routerIP net.IP, dnsIPs [][]byte, routes *[]netlink.Route, - searchDomains []string) error { + searchDomains []string, + mtu uint16) error { log.Log.Info("Starting SingleClientDHCPServer") + mtuArray := make([]byte, 2) + binary.BigEndian.PutUint16(mtuArray, mtu) + dhcpOptions := dhcp.Options{ dhcp.OptionSubnetMask: []byte(clientMask), dhcp.OptionRouter: []byte(routerIP), dhcp.OptionDomainNameServer: bytes.Join(dnsIPs, nil), + dhcp.OptionInterfaceMTU: mtuArray, } netRoutes := formClasslessRoutes(routes) @@ -77,6 +85,12 @@ func SingleClientDHCPServer( dhcpOptions[dhcp.OptionDomainSearch] = searchDomainBytes } + hostname, err := os.Hostname() + if err != nil { + return fmt.Errorf("reading the pods hostname failed: %v", err) + } + dhcpOptions[dhcp.OptionHostName] = []byte(hostname) + handler := &DHCPHandler{ clientIP: clientIP, clientMAC: clientMAC, @@ -106,26 +120,26 @@ type DHCPHandler struct { } func (h *DHCPHandler) ServeDHCP(p dhcp.Packet, msgType dhcp.MessageType, options dhcp.Options) (d dhcp.Packet) { - log.Log.Debug("Serving a new request") + log.Log.V(4).Info("Serving a new request") if mac := p.CHAddr(); !bytes.Equal(mac, h.clientMAC) { - log.Log.Debug("The request is not from our client") + log.Log.V(4).Info("The request is not from our client") return nil // Is not our client } switch msgType { case dhcp.Discover: - log.Log.Debug("The request has message type DISCOVER") + log.Log.V(4).Info("The request has message type DISCOVER") return dhcp.ReplyPacket(p, dhcp.Offer, h.serverIP, h.clientIP, h.leaseDuration, h.options.SelectOrderOrAll(options[dhcp.OptionParameterRequestList])) case dhcp.Request: - log.Log.Debug("The request has message type REQUEST") + log.Log.V(4).Info("The request has message type REQUEST") return dhcp.ReplyPacket(p, dhcp.ACK, h.serverIP, h.clientIP, h.leaseDuration, h.options.SelectOrderOrAll(options[dhcp.OptionParameterRequestList])) default: - log.Log.Debug("The request has unhandled message type") + log.Log.V(4).Info("The request has unhandled message type") return nil // Ignored message type } diff --git a/vendor/kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/network/generated_mock_common.go b/vendor/kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/network/generated_mock_common.go new file mode 100644 index 000000000..c10263585 --- /dev/null +++ b/vendor/kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/network/generated_mock_common.go @@ -0,0 +1,156 @@ +// Automatically generated by MockGen. DO NOT EDIT! +// Source: common.go + +package network + +import ( + net "net" + + gomock "github.com/golang/mock/gomock" + netlink "github.com/vishvananda/netlink" +) + +// Mock of NetworkHandler interface +type MockNetworkHandler struct { + ctrl *gomock.Controller + recorder *_MockNetworkHandlerRecorder +} + +// Recorder for MockNetworkHandler (not exported) +type _MockNetworkHandlerRecorder struct { + mock *MockNetworkHandler +} + +func NewMockNetworkHandler(ctrl *gomock.Controller) *MockNetworkHandler { + mock := &MockNetworkHandler{ctrl: ctrl} + mock.recorder = &_MockNetworkHandlerRecorder{mock} + return mock +} + +func (_m *MockNetworkHandler) EXPECT() *_MockNetworkHandlerRecorder { + return _m.recorder +} + +func (_m *MockNetworkHandler) LinkByName(name string) (netlink.Link, error) { + ret := _m.ctrl.Call(_m, "LinkByName", name) + ret0, _ := ret[0].(netlink.Link) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +func (_mr *_MockNetworkHandlerRecorder) LinkByName(arg0 interface{}) *gomock.Call { + return _mr.mock.ctrl.RecordCall(_mr.mock, "LinkByName", arg0) +} + +func (_m *MockNetworkHandler) AddrList(link netlink.Link, family int) ([]netlink.Addr, error) { + ret := _m.ctrl.Call(_m, "AddrList", link, family) + ret0, _ := ret[0].([]netlink.Addr) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +func (_mr *_MockNetworkHandlerRecorder) AddrList(arg0, arg1 interface{}) *gomock.Call { + return _mr.mock.ctrl.RecordCall(_mr.mock, "AddrList", arg0, arg1) +} + +func (_m *MockNetworkHandler) RouteList(link netlink.Link, family int) ([]netlink.Route, error) { + ret := _m.ctrl.Call(_m, "RouteList", link, family) + ret0, _ := ret[0].([]netlink.Route) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +func (_mr *_MockNetworkHandlerRecorder) RouteList(arg0, arg1 interface{}) *gomock.Call { + return _mr.mock.ctrl.RecordCall(_mr.mock, "RouteList", arg0, arg1) +} + +func (_m *MockNetworkHandler) AddrDel(link netlink.Link, addr *netlink.Addr) error { + ret := _m.ctrl.Call(_m, "AddrDel", link, addr) + ret0, _ := ret[0].(error) + return ret0 +} + +func (_mr *_MockNetworkHandlerRecorder) AddrDel(arg0, arg1 interface{}) *gomock.Call { + return _mr.mock.ctrl.RecordCall(_mr.mock, "AddrDel", arg0, arg1) +} + +func (_m *MockNetworkHandler) AddrAdd(link netlink.Link, addr *netlink.Addr) error { + ret := _m.ctrl.Call(_m, "AddrAdd", link, addr) + ret0, _ := ret[0].(error) + return ret0 +} + +func (_mr *_MockNetworkHandlerRecorder) AddrAdd(arg0, arg1 interface{}) *gomock.Call { + return _mr.mock.ctrl.RecordCall(_mr.mock, "AddrAdd", arg0, arg1) +} + +func (_m *MockNetworkHandler) LinkSetDown(link netlink.Link) error { + ret := _m.ctrl.Call(_m, "LinkSetDown", link) + ret0, _ := ret[0].(error) + return ret0 +} + +func (_mr *_MockNetworkHandlerRecorder) LinkSetDown(arg0 interface{}) *gomock.Call { + return _mr.mock.ctrl.RecordCall(_mr.mock, "LinkSetDown", arg0) +} + +func (_m *MockNetworkHandler) LinkSetUp(link netlink.Link) error { + ret := _m.ctrl.Call(_m, "LinkSetUp", link) + ret0, _ := ret[0].(error) + return ret0 +} + +func (_mr *_MockNetworkHandlerRecorder) LinkSetUp(arg0 interface{}) *gomock.Call { + return _mr.mock.ctrl.RecordCall(_mr.mock, "LinkSetUp", arg0) +} + +func (_m *MockNetworkHandler) LinkAdd(link netlink.Link) error { + ret := _m.ctrl.Call(_m, "LinkAdd", link) + ret0, _ := ret[0].(error) + return ret0 +} + +func (_mr *_MockNetworkHandlerRecorder) LinkAdd(arg0 interface{}) *gomock.Call { + return _mr.mock.ctrl.RecordCall(_mr.mock, "LinkAdd", arg0) +} + +func (_m *MockNetworkHandler) ParseAddr(s string) (*netlink.Addr, error) { + ret := _m.ctrl.Call(_m, "ParseAddr", s) + ret0, _ := ret[0].(*netlink.Addr) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +func (_mr *_MockNetworkHandlerRecorder) ParseAddr(arg0 interface{}) *gomock.Call { + return _mr.mock.ctrl.RecordCall(_mr.mock, "ParseAddr", arg0) +} + +func (_m *MockNetworkHandler) SetRandomMac(iface string) (net.HardwareAddr, error) { + ret := _m.ctrl.Call(_m, "SetRandomMac", iface) + ret0, _ := ret[0].(net.HardwareAddr) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +func (_mr *_MockNetworkHandlerRecorder) SetRandomMac(arg0 interface{}) *gomock.Call { + return _mr.mock.ctrl.RecordCall(_mr.mock, "SetRandomMac", arg0) +} + +func (_m *MockNetworkHandler) GetMacDetails(iface string) (net.HardwareAddr, error) { + ret := _m.ctrl.Call(_m, "GetMacDetails", iface) + ret0, _ := ret[0].(net.HardwareAddr) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +func (_mr *_MockNetworkHandlerRecorder) GetMacDetails(arg0 interface{}) *gomock.Call { + return _mr.mock.ctrl.RecordCall(_mr.mock, "GetMacDetails", arg0) +} + +func (_m *MockNetworkHandler) StartDHCP(nic *VIF, serverAddr *netlink.Addr) { + _m.ctrl.Call(_m, "StartDHCP", nic, serverAddr) +} + +func (_mr *_MockNetworkHandlerRecorder) StartDHCP(arg0, arg1 interface{}) *gomock.Call { + return _mr.mock.ctrl.RecordCall(_mr.mock, "StartDHCP", arg0, arg1) +} diff --git a/vendor/kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/network/generated_mock_network.go b/vendor/kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/network/generated_mock_network.go index 208b8e4bc..cbb3f6862 100644 --- a/vendor/kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/network/generated_mock_network.go +++ b/vendor/kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/network/generated_mock_network.go @@ -4,153 +4,47 @@ package network import ( - net "net" - gomock "github.com/golang/mock/gomock" - netlink "github.com/vishvananda/netlink" + + v1 "kubevirt.io/kubevirt/pkg/api/v1" + api "kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/api" ) -// Mock of NetworkHandler interface -type MockNetworkHandler struct { +// Mock of NetworkInterface interface +type MockNetworkInterface struct { ctrl *gomock.Controller - recorder *_MockNetworkHandlerRecorder + recorder *_MockNetworkInterfaceRecorder } -// Recorder for MockNetworkHandler (not exported) -type _MockNetworkHandlerRecorder struct { - mock *MockNetworkHandler +// Recorder for MockNetworkInterface (not exported) +type _MockNetworkInterfaceRecorder struct { + mock *MockNetworkInterface } -func NewMockNetworkHandler(ctrl *gomock.Controller) *MockNetworkHandler { - mock := &MockNetworkHandler{ctrl: ctrl} - mock.recorder = &_MockNetworkHandlerRecorder{mock} +func NewMockNetworkInterface(ctrl *gomock.Controller) *MockNetworkInterface { + mock := &MockNetworkInterface{ctrl: ctrl} + mock.recorder = &_MockNetworkInterfaceRecorder{mock} return mock } -func (_m *MockNetworkHandler) EXPECT() *_MockNetworkHandlerRecorder { +func (_m *MockNetworkInterface) EXPECT() *_MockNetworkInterfaceRecorder { return _m.recorder } -func (_m *MockNetworkHandler) LinkByName(name string) (netlink.Link, error) { - ret := _m.ctrl.Call(_m, "LinkByName", name) - ret0, _ := ret[0].(netlink.Link) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -func (_mr *_MockNetworkHandlerRecorder) LinkByName(arg0 interface{}) *gomock.Call { - return _mr.mock.ctrl.RecordCall(_mr.mock, "LinkByName", arg0) -} - -func (_m *MockNetworkHandler) AddrList(link netlink.Link, family int) ([]netlink.Addr, error) { - ret := _m.ctrl.Call(_m, "AddrList", link, family) - ret0, _ := ret[0].([]netlink.Addr) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -func (_mr *_MockNetworkHandlerRecorder) AddrList(arg0, arg1 interface{}) *gomock.Call { - return _mr.mock.ctrl.RecordCall(_mr.mock, "AddrList", arg0, arg1) -} - -func (_m *MockNetworkHandler) RouteList(link netlink.Link, family int) ([]netlink.Route, error) { - ret := _m.ctrl.Call(_m, "RouteList", link, family) - ret0, _ := ret[0].([]netlink.Route) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -func (_mr *_MockNetworkHandlerRecorder) RouteList(arg0, arg1 interface{}) *gomock.Call { - return _mr.mock.ctrl.RecordCall(_mr.mock, "RouteList", arg0, arg1) -} - -func (_m *MockNetworkHandler) AddrDel(link netlink.Link, addr *netlink.Addr) error { - ret := _m.ctrl.Call(_m, "AddrDel", link, addr) - ret0, _ := ret[0].(error) - return ret0 -} - -func (_mr *_MockNetworkHandlerRecorder) AddrDel(arg0, arg1 interface{}) *gomock.Call { - return _mr.mock.ctrl.RecordCall(_mr.mock, "AddrDel", arg0, arg1) -} - -func (_m *MockNetworkHandler) AddrAdd(link netlink.Link, addr *netlink.Addr) error { - ret := _m.ctrl.Call(_m, "AddrAdd", link, addr) - ret0, _ := ret[0].(error) - return ret0 -} - -func (_mr *_MockNetworkHandlerRecorder) AddrAdd(arg0, arg1 interface{}) *gomock.Call { - return _mr.mock.ctrl.RecordCall(_mr.mock, "AddrAdd", arg0, arg1) -} - -func (_m *MockNetworkHandler) LinkSetDown(link netlink.Link) error { - ret := _m.ctrl.Call(_m, "LinkSetDown", link) - ret0, _ := ret[0].(error) - return ret0 -} - -func (_mr *_MockNetworkHandlerRecorder) LinkSetDown(arg0 interface{}) *gomock.Call { - return _mr.mock.ctrl.RecordCall(_mr.mock, "LinkSetDown", arg0) -} - -func (_m *MockNetworkHandler) LinkSetUp(link netlink.Link) error { - ret := _m.ctrl.Call(_m, "LinkSetUp", link) - ret0, _ := ret[0].(error) - return ret0 -} - -func (_mr *_MockNetworkHandlerRecorder) LinkSetUp(arg0 interface{}) *gomock.Call { - return _mr.mock.ctrl.RecordCall(_mr.mock, "LinkSetUp", arg0) -} - -func (_m *MockNetworkHandler) LinkAdd(link netlink.Link) error { - ret := _m.ctrl.Call(_m, "LinkAdd", link) +func (_m *MockNetworkInterface) Plug(iface *v1.Interface, network *v1.Network, domain *api.Domain) error { + ret := _m.ctrl.Call(_m, "Plug", iface, network, domain) ret0, _ := ret[0].(error) return ret0 } -func (_mr *_MockNetworkHandlerRecorder) LinkAdd(arg0 interface{}) *gomock.Call { - return _mr.mock.ctrl.RecordCall(_mr.mock, "LinkAdd", arg0) -} - -func (_m *MockNetworkHandler) ParseAddr(s string) (*netlink.Addr, error) { - ret := _m.ctrl.Call(_m, "ParseAddr", s) - ret0, _ := ret[0].(*netlink.Addr) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -func (_mr *_MockNetworkHandlerRecorder) ParseAddr(arg0 interface{}) *gomock.Call { - return _mr.mock.ctrl.RecordCall(_mr.mock, "ParseAddr", arg0) -} - -func (_m *MockNetworkHandler) ChangeMacAddr(iface string) (net.HardwareAddr, error) { - ret := _m.ctrl.Call(_m, "ChangeMacAddr", iface) - ret0, _ := ret[0].(net.HardwareAddr) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -func (_mr *_MockNetworkHandlerRecorder) ChangeMacAddr(arg0 interface{}) *gomock.Call { - return _mr.mock.ctrl.RecordCall(_mr.mock, "ChangeMacAddr", arg0) -} - -func (_m *MockNetworkHandler) GetMacDetails(iface string) (net.HardwareAddr, error) { - ret := _m.ctrl.Call(_m, "GetMacDetails", iface) - ret0, _ := ret[0].(net.HardwareAddr) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -func (_mr *_MockNetworkHandlerRecorder) GetMacDetails(arg0 interface{}) *gomock.Call { - return _mr.mock.ctrl.RecordCall(_mr.mock, "GetMacDetails", arg0) +func (_mr *_MockNetworkInterfaceRecorder) Plug(arg0, arg1, arg2 interface{}) *gomock.Call { + return _mr.mock.ctrl.RecordCall(_mr.mock, "Plug", arg0, arg1, arg2) } -func (_m *MockNetworkHandler) StartDHCP(nic *VIF, serverAddr *netlink.Addr) { - _m.ctrl.Call(_m, "StartDHCP", nic, serverAddr) +func (_m *MockNetworkInterface) Unplug() { + _m.ctrl.Call(_m, "Unplug") } -func (_mr *_MockNetworkHandlerRecorder) StartDHCP(arg0, arg1 interface{}) *gomock.Call { - return _mr.mock.ctrl.RecordCall(_mr.mock, "StartDHCP", arg0, arg1) +func (_mr *_MockNetworkInterfaceRecorder) Unplug() *gomock.Call { + return _mr.mock.ctrl.RecordCall(_mr.mock, "Unplug") } diff --git a/vendor/kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/network/generated_mock_podinterface.go b/vendor/kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/network/generated_mock_podinterface.go new file mode 100644 index 000000000..c04e365fb --- /dev/null +++ b/vendor/kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/network/generated_mock_podinterface.go @@ -0,0 +1,80 @@ +// Automatically generated by MockGen. DO NOT EDIT! +// Source: podinterface.go + +package network + +import ( + gomock "github.com/golang/mock/gomock" +) + +// Mock of BindMechanism interface +type MockBindMechanism struct { + ctrl *gomock.Controller + recorder *_MockBindMechanismRecorder +} + +// Recorder for MockBindMechanism (not exported) +type _MockBindMechanismRecorder struct { + mock *MockBindMechanism +} + +func NewMockBindMechanism(ctrl *gomock.Controller) *MockBindMechanism { + mock := &MockBindMechanism{ctrl: ctrl} + mock.recorder = &_MockBindMechanismRecorder{mock} + return mock +} + +func (_m *MockBindMechanism) EXPECT() *_MockBindMechanismRecorder { + return _m.recorder +} + +func (_m *MockBindMechanism) discoverPodNetworkInterface() error { + ret := _m.ctrl.Call(_m, "discoverPodNetworkInterface") + ret0, _ := ret[0].(error) + return ret0 +} + +func (_mr *_MockBindMechanismRecorder) discoverPodNetworkInterface() *gomock.Call { + return _mr.mock.ctrl.RecordCall(_mr.mock, "discoverPodNetworkInterface") +} + +func (_m *MockBindMechanism) preparePodNetworkInterfaces() error { + ret := _m.ctrl.Call(_m, "preparePodNetworkInterfaces") + ret0, _ := ret[0].(error) + return ret0 +} + +func (_mr *_MockBindMechanismRecorder) preparePodNetworkInterfaces() *gomock.Call { + return _mr.mock.ctrl.RecordCall(_mr.mock, "preparePodNetworkInterfaces") +} + +func (_m *MockBindMechanism) decorateConfig() error { + ret := _m.ctrl.Call(_m, "decorateConfig") + ret0, _ := ret[0].(error) + return ret0 +} + +func (_mr *_MockBindMechanismRecorder) decorateConfig() *gomock.Call { + return _mr.mock.ctrl.RecordCall(_mr.mock, "decorateConfig") +} + +func (_m *MockBindMechanism) loadCachedInterface(name string) (bool, error) { + ret := _m.ctrl.Call(_m, "loadCachedInterface", name) + ret0, _ := ret[0].(bool) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +func (_mr *_MockBindMechanismRecorder) loadCachedInterface(arg0 interface{}) *gomock.Call { + return _mr.mock.ctrl.RecordCall(_mr.mock, "loadCachedInterface", arg0) +} + +func (_m *MockBindMechanism) setCachedInterface(name string) error { + ret := _m.ctrl.Call(_m, "setCachedInterface", name) + ret0, _ := ret[0].(error) + return ret0 +} + +func (_mr *_MockBindMechanismRecorder) setCachedInterface(arg0 interface{}) *gomock.Call { + return _mr.mock.ctrl.RecordCall(_mr.mock, "setCachedInterface", arg0) +} diff --git a/vendor/kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/network/network.go b/vendor/kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/network/network.go index 3c87e8c33..70178c8ef 100644 --- a/vendor/kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/network/network.go +++ b/vendor/kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/network/network.go @@ -26,453 +26,57 @@ package network */ import ( - "bufio" - "bytes" - "encoding/json" "fmt" - "io/ioutil" - "net" - "os" - "regexp" - "strings" - "github.com/vishvananda/netlink" - - "kubevirt.io/kubevirt/pkg/log" - "kubevirt.io/kubevirt/pkg/precond" + "kubevirt.io/kubevirt/pkg/api/v1" "kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/api" - "kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/network/dhcp" - - lmf "github.com/subgraph/libmacouflage" ) -const ( - podInterface = "eth0" - defaultDNS = "8.8.8.8" - resolvConf = "/etc/resolv.conf" - defaultSearchDomain = "cluster.local" - domainSearchPrefix = "search" - nameserverPrefix = "nameserver" -) +const podInterface = "eth0" -var interfaceCacheFile = "/var/run/kubevirt-private/interface-cache.json" -var bridgeFakeIP = "169.254.75.86/32" - -// only used by unit test suite -func setInterfaceCacheFile(path string) { - interfaceCacheFile = path -} +var interfaceCacheFile = "/var/run/kubevirt-private/interface-cache-%s.json" +var qemuArgCacheFile = "/var/run/kubevirt-private/qemu-arg-%s.json" +var NetworkInterfaceFactory = getNetworkClass -type VIF struct { - Name string - IP netlink.Addr - MAC net.HardwareAddr - Gateway net.IP - Routes *[]netlink.Route +type NetworkInterface interface { + Plug(iface *v1.Interface, network *v1.Network, domain *api.Domain) error + Unplug() } -type NetworkHandler interface { - LinkByName(name string) (netlink.Link, error) - AddrList(link netlink.Link, family int) ([]netlink.Addr, error) - RouteList(link netlink.Link, family int) ([]netlink.Route, error) - AddrDel(link netlink.Link, addr *netlink.Addr) error - AddrAdd(link netlink.Link, addr *netlink.Addr) error - LinkSetDown(link netlink.Link) error - LinkSetUp(link netlink.Link) error - LinkAdd(link netlink.Link) error - ParseAddr(s string) (*netlink.Addr, error) - ChangeMacAddr(iface string) (net.HardwareAddr, error) - GetMacDetails(iface string) (net.HardwareAddr, error) - StartDHCP(nic *VIF, serverAddr *netlink.Addr) -} - -type NetworkUtilsHandler struct{} - -var Handler NetworkHandler - -func (h *NetworkUtilsHandler) LinkByName(name string) (netlink.Link, error) { - return netlink.LinkByName(name) -} -func (h *NetworkUtilsHandler) AddrList(link netlink.Link, family int) ([]netlink.Addr, error) { - return netlink.AddrList(link, family) -} -func (h *NetworkUtilsHandler) RouteList(link netlink.Link, family int) ([]netlink.Route, error) { - return netlink.RouteList(link, family) -} -func (h *NetworkUtilsHandler) AddrDel(link netlink.Link, addr *netlink.Addr) error { - return netlink.AddrDel(link, addr) -} -func (h *NetworkUtilsHandler) LinkSetDown(link netlink.Link) error { - return netlink.LinkSetDown(link) -} -func (h *NetworkUtilsHandler) LinkSetUp(link netlink.Link) error { - return netlink.LinkSetUp(link) -} -func (h *NetworkUtilsHandler) LinkAdd(link netlink.Link) error { - return netlink.LinkAdd(link) -} -func (h *NetworkUtilsHandler) ParseAddr(s string) (*netlink.Addr, error) { - return netlink.ParseAddr(s) -} -func (h *NetworkUtilsHandler) AddrAdd(link netlink.Link, addr *netlink.Addr) error { - return netlink.AddrAdd(link, addr) -} - -// GetMacDetails from an interface -func (h *NetworkUtilsHandler) GetMacDetails(iface string) (net.HardwareAddr, error) { - currentMac, err := lmf.GetCurrentMac(iface) - if err != nil { - log.Log.Reason(err).Errorf("failed to get mac information for interface: %s", iface) - return nil, err +func SetupNetworkInterfaces(vmi *v1.VirtualMachineInstance, domain *api.Domain) error { + // prepare networks map + networks := map[string]*v1.Network{} + for _, network := range vmi.Spec.Networks { + networks[network.Name] = network.DeepCopy() } - return currentMac, nil -} - -// ChangeMacAddr changes the MAC address for a agiven interface -func (h *NetworkUtilsHandler) ChangeMacAddr(iface string) (net.HardwareAddr, error) { - var mac net.HardwareAddr - currentMac, err := Handler.GetMacDetails(iface) - if err != nil { - return nil, err + if len(networks) == 0 { + return fmt.Errorf("no networks were specified on a vm spec") } - changed, err := lmf.SpoofMacRandom(iface, false) - if err != nil { - log.Log.Reason(err).Errorf("failed to spoof MAC for iface: %s", iface) - return nil, err - } + for _, iface := range vmi.Spec.Domain.Devices.Interfaces { - if changed { - mac, err = Handler.GetMacDetails(iface) - if err != nil { - return nil, err + network, ok := networks[iface.Name] + if !ok { + return fmt.Errorf("failed to find a network %s", iface.Name) } - log.Log.Reason(err).Errorf("Updated Mac for iface: %s - %s", iface, mac) - } - return currentMac, nil -} - -func (h *NetworkUtilsHandler) StartDHCP(nic *VIF, serverAddr *netlink.Addr) { - nameservers, searchDomains, err := getResolvConfDetailsFromPod() - if err != nil { - log.Log.Errorf("Failed to get DNS servers from resolv.conf: %v", err) - panic(err) - } - - // panic in case the DHCP server failed during the vm creation - // but ignore dhcp errors when the vm is destroyed or shutting down - if err = DHCPServer( - nic.MAC, - nic.IP.IP, - nic.IP.Mask, - api.DefaultBridgeName, - serverAddr.IP, - nic.Gateway, - nameservers, - nic.Routes, - searchDomains, - ); err != nil { - log.Log.Errorf("failed to run DHCP: %v", err) - panic(err) - } -} - -// returns nameservers [][]byte, searchdomains []string, error -func getResolvConfDetailsFromPod() ([][]byte, []string, error) { - b, err := ioutil.ReadFile(resolvConf) - if err != nil { - return nil, nil, err - } - - nameservers, err := ParseNameservers(string(b)) - if err != nil { - return nil, nil, err - } - - searchDomains, err := ParseSearchDomains(string(b)) - if err != nil { - return nil, nil, err - } - - log.Log.Reason(err).Infof("Found nameservers in %s: %s", resolvConf, bytes.Join(nameservers, []byte{' '})) - log.Log.Reason(err).Infof("Found search domains in %s: %s", resolvConf, strings.Join(searchDomains, " ")) - - return nameservers, searchDomains, err -} - -func ParseNameservers(content string) ([][]byte, error) { - var nameservers [][]byte - - re, err := regexp.Compile("([0-9]{1,3}.?){4}") - if err != nil { - return nameservers, err - } - - scanner := bufio.NewScanner(strings.NewReader(content)) - - for scanner.Scan() { - line := scanner.Text() - if strings.HasPrefix(line, nameserverPrefix) { - nameserver := re.FindString(line) - if nameserver != "" { - nameservers = append(nameservers, net.ParseIP(nameserver).To4()) - } - } - } - - if err = scanner.Err(); err != nil { - return nameservers, err - } - - // apply a default DNS if none found from pod - if len(nameservers) == 0 { - nameservers = append(nameservers, net.ParseIP(defaultDNS).To4()) - } - - return nameservers, nil -} - -func ParseSearchDomains(content string) ([]string, error) { - var searchDomains []string - - scanner := bufio.NewScanner(strings.NewReader(content)) - - for scanner.Scan() { - line := scanner.Text() - if strings.HasPrefix(line, domainSearchPrefix) { - doms := strings.Fields(strings.TrimPrefix(line, domainSearchPrefix)) - for _, dom := range doms { - searchDomains = append(searchDomains, dom) - } - } - } - - if err := scanner.Err(); err != nil { - return nil, err - } - - if len(searchDomains) == 0 { - searchDomains = append(searchDomains, defaultSearchDomain) - } - - return searchDomains, nil -} - -// Allow mocking for tests -var SetupPodNetwork = SetupDefaultPodNetwork -var DHCPServer = dhcp.SingleClientDHCPServer - -func initHandler() { - if Handler == nil { - Handler = &NetworkUtilsHandler{} - } -} - -// SetupDefaultPodNetwork will prepare the pod management network to be used by a virtual machine -// which will own the pod network IP and MAC. Pods MAC address will be changed to a -// random address and IP will be deleted. This will also create a macvlan device with a fake IP. -// DHCP server will be started and bounded to the macvlan interface to server the original pod ip -// to the guest OS -func SetupDefaultPodNetwork(domain *api.Domain) error { - precond.MustNotBeNil(domain) - initHandler() - - // There should alway be a pre-configured interface for the default pod interface. - defaultIconf := domain.Spec.Devices.Interfaces[0] - - ifconf, err := getCachedInterface() - if err != nil { - return err - } - - if ifconf == nil { - vif := &VIF{Name: podInterface} - podNicLink, err := discoverPodNetworkInterface(vif) + vif, err := NetworkInterfaceFactory(network) if err != nil { return err } - if err := preparePodNetworkInterfaces(vif, podNicLink); err != nil { - log.Log.Reason(err).Critical("failed to prepared pod networking") - panic(err) - } - - // Start DHCP Server - fakeServerAddr, _ := netlink.ParseAddr(bridgeFakeIP) - go Handler.StartDHCP(vif, fakeServerAddr) - - // After the network is configured, cache the result - // in case this function is called again. - decorateInterfaceConfig(vif, &defaultIconf) - err = setCachedInterface(&defaultIconf) + err = vif.Plug(&iface, network, domain) if err != nil { - panic(err) + return err } } - - // TODO:(vladikr) Currently we support only one interface per vm. - // Improve this once we'll start supporting more. - if len(domain.Spec.Devices.Interfaces) == 0 { - domain.Spec.Devices.Interfaces = append(domain.Spec.Devices.Interfaces, defaultIconf) - } else { - domain.Spec.Devices.Interfaces[0] = defaultIconf - } - - return nil -} - -func setCachedInterface(ifconf *api.Interface) error { - buf, err := json.MarshalIndent(&ifconf, "", " ") - if err != nil { - return fmt.Errorf("error marshaling interface cache: %v", err) - } - err = ioutil.WriteFile(interfaceCacheFile, buf, 0644) - if err != nil { - return fmt.Errorf("error writing interface cache %v", err) - } return nil } -func getCachedInterface() (*api.Interface, error) { - buf, err := ioutil.ReadFile(interfaceCacheFile) - if err != nil { - if os.IsNotExist(err) { - return nil, nil - } - return nil, err - } - ifconf := api.Interface{} - err = json.Unmarshal(buf, &ifconf) - if err != nil { - return nil, fmt.Errorf("error unmarshaling interface: %v", err) - } - return &ifconf, nil -} - -func discoverPodNetworkInterface(nic *VIF) (netlink.Link, error) { - nicLink, err := Handler.LinkByName(podInterface) - if err != nil { - log.Log.Reason(err).Errorf("failed to get a link for interface: %s", podInterface) - return nil, err - } - - // get IP address - addrList, err := Handler.AddrList(nicLink, netlink.FAMILY_V4) - if err != nil { - log.Log.Reason(err).Errorf("failed to get an ip address for %s", podInterface) - return nil, err - } - if len(addrList) == 0 { - return nil, fmt.Errorf("No IP address found on %s", podInterface) - } - nic.IP = addrList[0] - - // Get interface gateway - routes, err := Handler.RouteList(nicLink, netlink.FAMILY_V4) - if err != nil { - log.Log.Reason(err).Errorf("failed to get routes for %s", podInterface) - return nil, err - } - if len(routes) == 0 { - return nil, fmt.Errorf("No gateway address found in routes for %s", podInterface) - } - nic.Gateway = routes[0].Gw - if len(routes) > 1 { - dhcpRoutes := filterPodNetworkRoutes(routes, nic) - nic.Routes = &dhcpRoutes - } - - // Get interface MAC address - mac, err := Handler.GetMacDetails(podInterface) - if err != nil { - log.Log.Reason(err).Errorf("failed to get MAC for %s", podInterface) - return nil, err - } - nic.MAC = mac - return nicLink, nil -} - -// filter out irrelevant routes -func filterPodNetworkRoutes(routes []netlink.Route, nic *VIF) (filteredRoutes []netlink.Route) { - for _, route := range routes { - // don't create empty static routes - if route.Dst == nil && route.Src.Equal(nil) && route.Gw.Equal(nil) { - continue - } - - // don't create static route for src == nic - if route.Src != nil && route.Src.Equal(nic.IP.IP) { - continue - } - - filteredRoutes = append(filteredRoutes, route) - } - return -} - -func preparePodNetworkInterfaces(nic *VIF, nicLink netlink.Link) error { - // Remove IP from POD interface - err := Handler.AddrDel(nicLink, &nic.IP) - - if err != nil { - log.Log.Reason(err).Errorf("failed to delete link for interface: %s", podInterface) - return err - } - - // Set interface link to down to change its MAC address - err = Handler.LinkSetDown(nicLink) - if err != nil { - log.Log.Reason(err).Errorf("failed to bring link down for interface: %s", podInterface) - return err - } - - _, err = Handler.ChangeMacAddr(podInterface) - if err != nil { - return err +// a factory to get suitable network interface +func getNetworkClass(network *v1.Network) (NetworkInterface, error) { + if network.Pod != nil { + return new(PodInterface), nil } - - err = Handler.LinkSetUp(nicLink) - if err != nil { - log.Log.Reason(err).Errorf("failed to bring link up for interface: %s", podInterface) - return err - } - - // Create a bridge - bridge := &netlink.Bridge{ - LinkAttrs: netlink.LinkAttrs{ - Name: api.DefaultBridgeName, - }, - } - err = Handler.LinkAdd(bridge) - if err != nil { - log.Log.Reason(err).Errorf("failed to create a bridge") - return err - } - netlink.LinkSetMaster(nicLink, bridge) - - err = Handler.LinkSetUp(bridge) - if err != nil { - log.Log.Reason(err).Errorf("failed to bring link up for interface: %s", api.DefaultBridgeName) - return err - } - - // set fake ip on a bridge - fakeaddr, err := Handler.ParseAddr(bridgeFakeIP) - if err != nil { - log.Log.Reason(err).Errorf("failed to bring link up for interface: %s", api.DefaultBridgeName) - return err - } - - if err := Handler.AddrAdd(bridge, fakeaddr); err != nil { - log.Log.Reason(err).Errorf("failed to set macvlan IP") - return err - } - - return nil -} - -func decorateInterfaceConfig(vif *VIF, ifconf *api.Interface) { - - ifconf.MAC = &api.MAC{MAC: vif.MAC.String()} + return nil, fmt.Errorf("Network not implemented") } diff --git a/vendor/kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/network/podinterface.go b/vendor/kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/network/podinterface.go new file mode 100644 index 000000000..e1f5d9713 --- /dev/null +++ b/vendor/kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/network/podinterface.go @@ -0,0 +1,360 @@ +/* + * This file is part of the KubeVirt project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Copyright 2018 Red Hat, Inc. + * + */ + +//go:generate mockgen -source $GOFILE -package=$GOPACKAGE -destination=generated_mock_$GOFILE + +package network + +import ( + "fmt" + "net" + + "github.com/vishvananda/netlink" + + "kubevirt.io/kubevirt/pkg/api/v1" + "kubevirt.io/kubevirt/pkg/log" + "kubevirt.io/kubevirt/pkg/precond" + "kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/api" +) + +var bridgeFakeIP = "169.254.75.86/32" + +// DefaultProtocol is the default port protocol +const DefaultProtocol string = "TCP" + +// DefaultVMCIDR is the default CIDR for vm network +const DefaultVMCIDR = "10.0.2.0/24" + +type BindMechanism interface { + discoverPodNetworkInterface() error + preparePodNetworkInterfaces() error + decorateConfig() error + loadCachedInterface(name string) (bool, error) + setCachedInterface(name string) error +} + +type PodInterface struct{} + +func (l *PodInterface) Unplug() {} + +func findInterfaceByName(ifaces []api.Interface, name string) (int, error) { + for i, iface := range ifaces { + if iface.Alias.Name == name { + return i, nil + } + } + return 0, fmt.Errorf("failed to find interface with alias set to %s", name) +} + +// Plug connect a Pod network device to the virtual machine +func (l *PodInterface) Plug(iface *v1.Interface, network *v1.Network, domain *api.Domain) error { + precond.MustNotBeNil(domain) + initHandler() + + driver, err := getBinding(iface, domain) + if err != nil { + return err + } + + isExist, err := driver.loadCachedInterface(iface.Name) + if err != nil { + return err + } + + if !isExist { + err := driver.discoverPodNetworkInterface() + if err != nil { + return err + } + + if err := driver.preparePodNetworkInterfaces(); err != nil { + log.Log.Reason(err).Critical("failed to prepared pod networking") + panic(err) + } + + // After the network is configured, cache the result + // in case this function is called again. + err = driver.decorateConfig() + if err != nil { + log.Log.Reason(err).Critical("failed to create libvirt configuration") + panic(err) + } + + err = driver.setCachedInterface(iface.Name) + if err != nil { + log.Log.Reason(err).Critical("failed to save interface configuration") + panic(err) + } + } + + return nil +} + +func getBinding(iface *v1.Interface, domain *api.Domain) (BindMechanism, error) { + podInterfaceNum, err := findInterfaceByName(domain.Spec.Devices.Interfaces, iface.Name) + if err != nil { + return nil, err + } + + populateMacAddress := func(vif *VIF, iface *v1.Interface) error { + if iface.MacAddress != "" { + macAddress, err := net.ParseMAC(iface.MacAddress) + if err != nil { + return err + } + vif.MAC = macAddress + } + return nil + } + + if iface.Bridge != nil { + vif := &VIF{Name: podInterface} + populateMacAddress(vif, iface) + return &BridgePodInterface{iface: iface, vif: vif, domain: domain, podInterfaceNum: podInterfaceNum}, nil + } + if iface.Slirp != nil { + return &SlirpPodInterface{iface: iface, domain: domain, podInterfaceNum: podInterfaceNum}, nil + } + return nil, fmt.Errorf("Not implemented") +} + +type BridgePodInterface struct { + vif *VIF + iface *v1.Interface + podNicLink netlink.Link + domain *api.Domain + podInterfaceNum int +} + +func (b *BridgePodInterface) discoverPodNetworkInterface() error { + link, err := Handler.LinkByName(podInterface) + if err != nil { + log.Log.Reason(err).Errorf("failed to get a link for interface: %s", podInterface) + return err + } + b.podNicLink = link + + // get IP address + addrList, err := Handler.AddrList(b.podNicLink, netlink.FAMILY_V4) + if err != nil { + log.Log.Reason(err).Errorf("failed to get an ip address for %s", podInterface) + return err + } + if len(addrList) == 0 { + return fmt.Errorf("No IP address found on %s", podInterface) + } + b.vif.IP = addrList[0] + + // Handle interface routes + if err := b.setInterfaceRoutes(); err != nil { + return err + } + + if len(b.vif.MAC) == 0 { + // Get interface MAC address + mac, err := Handler.GetMacDetails(podInterface) + if err != nil { + log.Log.Reason(err).Errorf("failed to get MAC for %s", podInterface) + return err + } + b.vif.MAC = mac + } + + // Get interface MTU + b.vif.Mtu = uint16(b.podNicLink.Attrs().MTU) + return nil +} + +func (b *BridgePodInterface) preparePodNetworkInterfaces() error { + // Remove IP from POD interface + err := Handler.AddrDel(b.podNicLink, &b.vif.IP) + + if err != nil { + log.Log.Reason(err).Errorf("failed to delete link for interface: %s", podInterface) + return err + } + + // Set interface link to down to change its MAC address + err = Handler.LinkSetDown(b.podNicLink) + if err != nil { + log.Log.Reason(err).Errorf("failed to bring link down for interface: %s", podInterface) + return err + } + + _, err = Handler.SetRandomMac(podInterface) + if err != nil { + return err + } + + err = Handler.LinkSetUp(b.podNicLink) + if err != nil { + log.Log.Reason(err).Errorf("failed to bring link up for interface: %s", podInterface) + return err + } + + if err := b.createDefaultBridge(); err != nil { + return err + } + + b.startDHCPServer() + + return nil +} + +func (b *BridgePodInterface) startDHCPServer() { + // Start DHCP Server + fakeServerAddr, _ := netlink.ParseAddr(bridgeFakeIP) + Handler.StartDHCP(b.vif, fakeServerAddr) +} + +func (b *BridgePodInterface) decorateConfig() error { + b.domain.Spec.Devices.Interfaces[b.podInterfaceNum].MAC = &api.MAC{MAC: b.vif.MAC.String()} + + return nil +} + +func (b *BridgePodInterface) loadCachedInterface(name string) (bool, error) { + var ifaceConfig api.Interface + + isExist, err := readFromCachedFile(name, interfaceCacheFile, &ifaceConfig) + if err != nil { + return false, err + } + + if isExist { + b.domain.Spec.Devices.Interfaces[b.podInterfaceNum] = ifaceConfig + return true, nil + } + + return false, nil +} + +func (b *BridgePodInterface) setCachedInterface(name string) error { + err := writeToCachedFile(&b.domain.Spec.Devices.Interfaces[b.podInterfaceNum], interfaceCacheFile, name) + return err +} + +func (b *BridgePodInterface) setInterfaceRoutes() error { + routes, err := Handler.RouteList(b.podNicLink, netlink.FAMILY_V4) + if err != nil { + log.Log.Reason(err).Errorf("failed to get routes for %s", podInterface) + return err + } + if len(routes) == 0 { + return fmt.Errorf("No gateway address found in routes for %s", podInterface) + } + b.vif.Gateway = routes[0].Gw + if len(routes) > 1 { + dhcpRoutes := filterPodNetworkRoutes(routes, b.vif) + b.vif.Routes = &dhcpRoutes + } + return nil +} + +func (b *BridgePodInterface) createDefaultBridge() error { + // Create a bridge + bridge := &netlink.Bridge{ + LinkAttrs: netlink.LinkAttrs{ + Name: api.DefaultBridgeName, + }, + } + err := Handler.LinkAdd(bridge) + if err != nil { + log.Log.Reason(err).Errorf("failed to create a bridge") + return err + } + netlink.LinkSetMaster(b.podNicLink, bridge) + + err = Handler.LinkSetUp(bridge) + if err != nil { + log.Log.Reason(err).Errorf("failed to bring link up for interface: %s", api.DefaultBridgeName) + return err + } + + // set fake ip on a bridge + fakeaddr, err := Handler.ParseAddr(bridgeFakeIP) + if err != nil { + log.Log.Reason(err).Errorf("failed to bring link up for interface: %s", api.DefaultBridgeName) + return err + } + + if err := Handler.AddrAdd(bridge, fakeaddr); err != nil { + log.Log.Reason(err).Errorf("failed to set bridge IP") + return err + } + + return nil +} + +type SlirpPodInterface struct { + iface *v1.Interface + domain *api.Domain + podInterfaceNum int +} + +func (s *SlirpPodInterface) discoverPodNetworkInterface() error { + s.domain.Spec.QEMUCmd.QEMUArg = append(s.domain.Spec.QEMUCmd.QEMUArg, api.Arg{Value: "-device"}) + return nil +} + +func (s *SlirpPodInterface) preparePodNetworkInterfaces() error { + interfaces := s.domain.Spec.Devices.Interfaces + domainInterface := interfaces[s.podInterfaceNum] + s.domain.Spec.QEMUCmd.QEMUArg = append(s.domain.Spec.QEMUCmd.QEMUArg, api.Arg{Value: fmt.Sprintf("%s,netdev=%s", domainInterface.Model.Type, s.iface.Name)}) + + s.domain.Spec.Devices.Interfaces = append(interfaces[:s.podInterfaceNum], interfaces[s.podInterfaceNum+1:]...) + s.podInterfaceNum = len(s.domain.Spec.QEMUCmd.QEMUArg) - 1 + + return nil +} + +func (s *SlirpPodInterface) decorateConfig() error { + s.domain.Spec.QEMUCmd.QEMUArg[s.podInterfaceNum].Value += fmt.Sprintf(",id=%s", s.iface.Name) + if s.iface.MacAddress != "" { + // We assume address was already validated in API layer so just pass it to libvirt as-is. + s.domain.Spec.QEMUCmd.QEMUArg[s.podInterfaceNum].Value += fmt.Sprintf(",mac=%s", s.iface.MacAddress) + } + return nil +} + +func (s *SlirpPodInterface) loadCachedInterface(name string) (bool, error) { + var qemuArg api.Arg + interfaces := s.domain.Spec.Devices.Interfaces + + isExist, err := readFromCachedFile(name, qemuArgCacheFile, &qemuArg) + if err != nil { + return false, err + } + + if isExist { + // remove slirp interface from domain spec devices interfaces + interfaces = append(interfaces[:s.podInterfaceNum], interfaces[s.podInterfaceNum+1:]...) + + // Add interface configuration to qemuArgs + s.domain.Spec.QEMUCmd.QEMUArg = append(s.domain.Spec.QEMUCmd.QEMUArg, qemuArg) + return true, nil + } + + return false, nil +} + +func (s *SlirpPodInterface) setCachedInterface(name string) error { + err := writeToCachedFile(&s.domain.Spec.QEMUCmd.QEMUArg[s.podInterfaceNum], qemuArgCacheFile, name) + return err +} diff --git a/vendor/kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/util/libvirt_helper.go b/vendor/kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/util/libvirt_helper.go index fb45eabb9..76595ec7b 100644 --- a/vendor/kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/util/libvirt_helper.go +++ b/vendor/kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/util/libvirt_helper.go @@ -66,16 +66,16 @@ func ConvReason(status libvirt.DomainState, reason int) api.StateChangeReason { } } -func SetDomainSpec(virConn cli.Connection, vm *v1.VirtualMachine, wantedSpec api.DomainSpec) (cli.VirDomain, error) { +func SetDomainSpec(virConn cli.Connection, vmi *v1.VirtualMachineInstance, wantedSpec api.DomainSpec) (cli.VirDomain, error) { xmlStr, err := xml.Marshal(&wantedSpec) if err != nil { - log.Log.Object(vm).Reason(err).Error("Generating the domain XML failed.") + log.Log.Object(vmi).Reason(err).Error("Generating the domain XML failed.") return nil, err } - log.Log.Object(vm).V(3).With("xml", string(xmlStr)).Info("Domain XML generated.") + log.Log.Object(vmi).V(3).With("xml", string(xmlStr)).Info("Domain XML generated.") dom, err := virConn.DomainDefineXML(string(xmlStr)) if err != nil { - log.Log.Object(vm).Reason(err).Error("Defining the VM failed.") + log.Log.Object(vmi).Reason(err).Error("Defining the VirtualMachineInstance failed.") return nil, err } return dom, nil @@ -125,7 +125,7 @@ func StartLibvirt(stopChan chan struct{}) { go func() { for { exitChan := make(chan struct{}) - cmd := exec.Command("/libvirtd.sh") + cmd := exec.Command("/usr/share/kubevirt/virt-launcher/libvirtd.sh") err := cmd.Start() if err != nil { @@ -191,7 +191,7 @@ func StartVirtlog(stopChan chan struct{}) { // returns the namespace and name that is encoded in the // domain name. -func SplitVMNamespaceKey(domainName string) (namespace, name string) { +func SplitVMINamespaceKey(domainName string) (namespace, name string) { splitName := strings.SplitN(domainName, "_", 2) if len(splitName) == 1 { return k8sv1.NamespaceDefault, splitName[0] @@ -199,10 +199,10 @@ func SplitVMNamespaceKey(domainName string) (namespace, name string) { return splitName[0], splitName[1] } -// VMNamespaceKeyFunc constructs the domain name with a namespace prefix i.g. +// VMINamespaceKeyFunc constructs the domain name with a namespace prefix i.g. // namespace_name. -func VMNamespaceKeyFunc(vm *v1.VirtualMachine) string { - domName := fmt.Sprintf("%s_%s", vm.GetObjectMeta().GetNamespace(), vm.GetObjectMeta().GetName()) +func VMINamespaceKeyFunc(vmi *v1.VirtualMachineInstance) string { + domName := fmt.Sprintf("%s_%s", vmi.GetObjectMeta().GetNamespace(), vmi.GetObjectMeta().GetName()) return domName } @@ -212,7 +212,7 @@ func NewDomain(dom cli.VirDomain) (*api.Domain, error) { if err != nil { return nil, err } - namespace, name := SplitVMNamespaceKey(name) + namespace, name := SplitVMINamespaceKey(name) domain := api.NewDomainReferenceFromName(namespace, name) domain.GetObjectMeta().SetUID(domain.Spec.Metadata.KubeVirt.UID) diff --git a/vendor/kubevirt.io/kubevirt/pkg/virtctl/console/console.go b/vendor/kubevirt.io/kubevirt/pkg/virtctl/console/console.go index 43c0dcc6d..6e169ce50 100644 --- a/vendor/kubevirt.io/kubevirt/pkg/virtctl/console/console.go +++ b/vendor/kubevirt.io/kubevirt/pkg/virtctl/console/console.go @@ -37,7 +37,7 @@ import ( func NewCommand(clientConfig clientcmd.ClientConfig) *cobra.Command { cmd := &cobra.Command{ - Use: "console (vm)", + Use: "console (vmi)", Short: "Connect to a console of a virtual machine.", Example: usage(), Args: cobra.ExactArgs(1), @@ -55,8 +55,8 @@ type Console struct { } func usage() string { - usage := "# Connect to the console on VM 'myvm':\n" - usage += "virtctl console myvm" + usage := "# Connect to the console on VirtualMachineInstance 'myvmi':\n" + usage += "virtctl console myvmi" return usage } @@ -66,7 +66,7 @@ func (c *Console) Run(cmd *cobra.Command, args []string) error { return err } - vm := args[0] + vmi := args[0] virtCli, err := kubecli.GetKubevirtClientFromClientConfig(c.clientConfig) if err != nil { @@ -94,8 +94,16 @@ func (c *Console) Run(cmd *cobra.Command, args []string) error { readStop := make(chan error) go func() { - err := virtCli.VM(namespace).SerialConsole(vm, stdinReader, stdoutWriter) - resChan <- err + con, err := virtCli.VirtualMachineInstance(namespace).SerialConsole(vmi) + if err != nil { + resChan <- err + return + } + + resChan <- con.Stream(kubecli.StreamOptions{ + In: stdinReader, + Out: stdoutWriter, + }) }() go func() { diff --git a/vendor/kubevirt.io/kubevirt/pkg/virtctl/expose/expose.go b/vendor/kubevirt.io/kubevirt/pkg/virtctl/expose/expose.go new file mode 100644 index 000000000..3532d5bda --- /dev/null +++ b/vendor/kubevirt.io/kubevirt/pkg/virtctl/expose/expose.go @@ -0,0 +1,203 @@ +package expose + +import ( + "fmt" + "strings" + + "github.com/spf13/cobra" + "k8s.io/api/core/v1" + k8smetav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/intstr" + "k8s.io/client-go/tools/clientcmd" + + "kubevirt.io/kubevirt/pkg/kubecli" + "kubevirt.io/kubevirt/pkg/virtctl/templates" +) + +const ( + COMMAND_EXPOSE = "expose" +) + +type Command struct { + clientConfig clientcmd.ClientConfig + command string +} + +// holding flag information +var serviceName string +var clusterIP string +var externalIP string +var loadBalancerIP string +var port int32 +var nodePort int32 +var strProtocol string +var intTargetPort int +var strServiceType string +var portName string +var namespace string + +// generate a new "expose" command +func NewExposeCommand(clientConfig clientcmd.ClientConfig) *cobra.Command { + cmd := &cobra.Command{ + Use: "expose TYPE NAME", + Short: "Expose a virtual machine as a new service.", + Long: `Looks up a virtual machine, offline virtual machine or virtual machine replica set by name and use its selector as the selector for a new service on the specified port. +A virtual machine replica set will be exposed as a service only if its selector is convertible to a selector that service supports, i.e. when the selector contains only the matchLabels component. +Note that if no port is specified via --port and the exposed resource has multiple ports, all will be re-used by the new service. +Also if no labels are specified, the new service will re-use the labels from the resource it exposes. + +Possible types are (case insensitive, both single and plurant forms): + +virtualmachineinstance (vmi), virtualmachine (vm), virtualmachineinstancereplicaset (vmirs)`, + Example: usage(), + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) error { + c := Command{command: COMMAND_EXPOSE, clientConfig: clientConfig} + return c.RunE(cmd, args) + }, + } + + // flags for the "expose" command + cmd.Flags().StringVar(&serviceName, "name", "", "Name of the service created for the exposure of the VM") + cmd.MarkFlagRequired("name") + cmd.Flags().StringVar(&clusterIP, "cluster-ip", "", "ClusterIP to be assigned to the service. Leave empty to auto-allocate, or set to 'None' to create a headless service.") + cmd.Flags().StringVar(&externalIP, "external-ip", "", "Additional external IP address (not managed by the cluster) to accept for the service. If this IP is routed to a node, the service can be accessed by this IP in addition to its generated service IP. Optional.") + cmd.Flags().StringVar(&loadBalancerIP, "load-balancer-ip", "", "IP to assign to the Load Balancer. If empty, an ephemeral IP will be created and used.") + cmd.Flags().Int32Var(&port, "port", 0, "The port that the service should serve on") + cmd.MarkFlagRequired("port") + cmd.Flags().StringVar(&strProtocol, "protocol", "TCP", "The network protocol for the service to be created.") + cmd.Flags().IntVar(&intTargetPort, "target-port", 0, "Name or number for the port on the VM that the service should direct traffic to. Optional.") + cmd.Flags().Int32Var(&nodePort, "node-port", 0, "Port used to expose the service on each node in a cluster.") + cmd.Flags().StringVar(&strServiceType, "type", "ClusterIP", "Type for this service: ClusterIP, NodePort, or LoadBalancer.") + cmd.Flags().StringVar(&portName, "port-name", "", "Name of the port. Optional.") + cmd.SetUsageTemplate(templates.UsageTemplate()) + + return cmd +} + +func usage() string { + usage := ` # Expose SSH to a virtual machine called 'myvm' as a node port (5555) of the cluster: + virtctl expose vm myvm --port=5555 --target-port=22 --name=myvm-ssh --type=NodePort")` + return usage +} + +// executing the "expose" command +func (o *Command) RunE(cmd *cobra.Command, args []string) error { + // first argument is type of VM: VM, offline VM or replica set VM + vmType := strings.ToLower(args[0]) + // second argument must be name of the VM + vmName := args[1] + + // these are used to convert the flag values into service spec values + var protocol v1.Protocol + var targetPort intstr.IntOrString + var serviceType v1.ServiceType + + // convert from integer to the IntOrString type + targetPort = intstr.FromInt(intTargetPort) + + // convert from string to the protocol enum + switch strProtocol { + case "TCP": + protocol = v1.ProtocolTCP + case "UDP": + protocol = v1.ProtocolUDP + default: + return fmt.Errorf("unknown protocol: %s", strProtocol) + } + + // convert from string to the service type enum + switch strServiceType { + case "ClusterIP": + serviceType = v1.ServiceTypeClusterIP + case "NodePort": + serviceType = v1.ServiceTypeNodePort + case "LoadBalancer": + serviceType = v1.ServiceTypeLoadBalancer + case "ExternalName": + return fmt.Errorf("type: %s not supported", strServiceType) + default: + return fmt.Errorf("unknown service type: %s", strServiceType) + } + + // get the namespace + namespace, _, err := o.clientConfig.Namespace() + if err != nil { + return err + } + + // get the client + virtClient, err := kubecli.GetKubevirtClientFromClientConfig(o.clientConfig) + if err != nil { + return fmt.Errorf("cannot obtain KubeVirt client: %v", err) + } + + // does a plain quorum read from the apiserver + options := k8smetav1.GetOptions{} + var serviceSelector map[string]string + + switch vmType { + case "vmi", "vmis", "virtualmachineinstance", "virtualmachineinstances": + // get the VM + vm, err := virtClient.VirtualMachineInstance(namespace).Get(vmName, &options) + if err != nil { + return fmt.Errorf("error fetching VirtualMachineInstance: %v", err) + } + serviceSelector = vm.ObjectMeta.Labels + // remove unwanted labels + delete(serviceSelector, "kubevirt.io/nodeName") + case "vm", "vms", "virtualmachine", "virtualmachines": + // get the offline VM + ovm, err := virtClient.VirtualMachine(namespace).Get(vmName, &options) + if err != nil { + return fmt.Errorf("error fetching OfflineVirtual: %v", err) + } + serviceSelector = ovm.Spec.Template.ObjectMeta.Labels + case "vmirs", "vmirss", "virtualmachineinstancereplicaset", "virtualmachineinstancereplicasets": + // get the VM replica set + vmrs, err := virtClient.ReplicaSet(namespace).Get(vmName, options) + if err != nil { + return fmt.Errorf("error fetching VirtualMachineInstance ReplicaSet: %v", err) + } + if len(vmrs.Spec.Selector.MatchExpressions) > 0 { + return fmt.Errorf("cannot expose VirtualMachineInstance ReplicaSet with match expressions") + } + serviceSelector = vmrs.Spec.Selector.MatchLabels + default: + return fmt.Errorf("unsupported resource type: %s", vmType) + } + + if len(serviceSelector) == 0 { + return fmt.Errorf("missing label information for %s: %s", vmType, vmName) + } + + // actually create the service + service := &v1.Service{ + ObjectMeta: k8smetav1.ObjectMeta{ + Name: serviceName, + Namespace: namespace, + }, + Spec: v1.ServiceSpec{ + Ports: []v1.ServicePort{ + {Name: portName, Protocol: protocol, Port: port, TargetPort: targetPort, NodePort: nodePort}, + }, + Selector: serviceSelector, + ClusterIP: clusterIP, + Type: serviceType, + LoadBalancerIP: loadBalancerIP, + }, + } + + // set external IP if provided + if len(externalIP) > 0 { + service.Spec.ExternalIPs = []string{externalIP} + } + + // try to create the service on the cluster + _, err = virtClient.CoreV1().Services(namespace).Create(service) + if err != nil { + return fmt.Errorf("service creation failed: %v", err) + } + fmt.Printf("Service %s successfully exposed for %s %s\n", serviceName, vmType, vmName) + return nil +} diff --git a/vendor/kubevirt.io/kubevirt/pkg/virtctl/root.go b/vendor/kubevirt.io/kubevirt/pkg/virtctl/root.go index 8928cf2b6..da5bf6e20 100644 --- a/vendor/kubevirt.io/kubevirt/pkg/virtctl/root.go +++ b/vendor/kubevirt.io/kubevirt/pkg/virtctl/root.go @@ -11,8 +11,10 @@ import ( "kubevirt.io/kubevirt/pkg/kubecli" "kubevirt.io/kubevirt/pkg/virtctl/console" - "kubevirt.io/kubevirt/pkg/virtctl/offlinevm" + "kubevirt.io/kubevirt/pkg/virtctl/expose" "kubevirt.io/kubevirt/pkg/virtctl/templates" + "kubevirt.io/kubevirt/pkg/virtctl/version" + "kubevirt.io/kubevirt/pkg/virtctl/vm" "kubevirt.io/kubevirt/pkg/virtctl/vnc" ) @@ -43,8 +45,10 @@ func NewVirtctlCommand() *cobra.Command { rootCmd.AddCommand( console.NewCommand(clientConfig), vnc.NewCommand(clientConfig), - offlinevm.NewStartCommand(clientConfig), - offlinevm.NewStopCommand(clientConfig), + vm.NewStartCommand(clientConfig), + vm.NewStopCommand(clientConfig), + expose.NewExposeCommand(clientConfig), + version.VersionCommand(clientConfig), optionsCmd, ) return rootCmd diff --git a/vendor/kubevirt.io/kubevirt/pkg/virtctl/version/version.go b/vendor/kubevirt.io/kubevirt/pkg/virtctl/version/version.go new file mode 100644 index 000000000..537b73c7a --- /dev/null +++ b/vendor/kubevirt.io/kubevirt/pkg/virtctl/version/version.go @@ -0,0 +1,55 @@ +package version + +import ( + "fmt" + + "github.com/spf13/cobra" + + "k8s.io/client-go/tools/clientcmd" + + "kubevirt.io/kubevirt/pkg/kubecli" + "kubevirt.io/kubevirt/pkg/version" + "kubevirt.io/kubevirt/pkg/virtctl/templates" +) + +func VersionCommand(clientConfig clientcmd.ClientConfig) *cobra.Command { + cmd := &cobra.Command{ + Use: "version", + Short: "Print the client and server version information", + Example: usage(), + Args: cobra.ExactArgs(0), + RunE: func(cmd *cobra.Command, args []string) error { + v := Version{clientConfig: clientConfig} + return v.Run(cmd, args) + }, + } + cmd.SetUsageTemplate(templates.UsageTemplate()) + return cmd +} + +func usage() string { + usage := "# Print the client and server versions for the current context \n" + usage += "virtctl version" + return usage +} + +type Version struct { + clientConfig clientcmd.ClientConfig +} + +func (v *Version) Run(cmd *cobra.Command, args []string) error { + fmt.Printf("Client Version: %s\n", fmt.Sprintf("%#v", version.Get())) + + virCli, err := kubecli.GetKubevirtClientFromClientConfig(v.clientConfig) + if err != nil { + return err + } + + serverInfo, err := virCli.ServerVersion().Get() + if err != nil { + return err + } + + fmt.Printf("Server Version: %s\n", fmt.Sprintf("%#v", serverInfo)) + return nil +} diff --git a/vendor/kubevirt.io/kubevirt/pkg/virtctl/offlinevm/offlinevm.go b/vendor/kubevirt.io/kubevirt/pkg/virtctl/vm/vm.go similarity index 77% rename from vendor/kubevirt.io/kubevirt/pkg/virtctl/offlinevm/offlinevm.go rename to vendor/kubevirt.io/kubevirt/pkg/virtctl/vm/vm.go index 75f757e8f..a8d532544 100644 --- a/vendor/kubevirt.io/kubevirt/pkg/virtctl/offlinevm/offlinevm.go +++ b/vendor/kubevirt.io/kubevirt/pkg/virtctl/vm/vm.go @@ -17,7 +17,7 @@ * */ -package offlinevm +package vm import ( "fmt" @@ -26,6 +26,8 @@ import ( k8smetav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/tools/clientcmd" + "k8s.io/apimachinery/pkg/types" + "kubevirt.io/kubevirt/pkg/kubecli" "kubevirt.io/kubevirt/pkg/virtctl/templates" ) @@ -37,7 +39,7 @@ const ( func NewStartCommand(clientConfig clientcmd.ClientConfig) *cobra.Command { cmd := &cobra.Command{ - Use: "start (vm)", + Use: "start (vmi)", Short: "Start a virtual machine which is managed by an offline virtual machine.", Example: usage(COMMAND_START), Args: cobra.ExactArgs(1), @@ -52,7 +54,7 @@ func NewStartCommand(clientConfig clientcmd.ClientConfig) *cobra.Command { func NewStopCommand(clientConfig clientcmd.ClientConfig) *cobra.Command { return &cobra.Command{ - Use: "stop (vm)", + Use: "stop (vmi)", Short: "Stop a virtual machine which is managed by an offline virtual machine.", Example: usage(COMMAND_STOP), Args: cobra.ExactArgs(1), @@ -73,20 +75,31 @@ func NewCommand(command string) *Command { } func usage(cmd string) string { - usage := "#Start a virtual machine called 'myvm':\n" - usage += fmt.Sprintf("virtctl %s myvm", cmd) + usage := "#Start a virtual machine called 'myvmi':\n" + usage += fmt.Sprintf("virtctl %s myvmi", cmd) return usage } func (o *Command) Run(cmd *cobra.Command, args []string) error { - vmName := args[0] + vmiName := args[0] namespace, _, err := o.clientConfig.Namespace() if err != nil { return err } + virtClient, err := kubecli.GetKubevirtClientFromClientConfig(o.clientConfig) + if err != nil { + return fmt.Errorf("Cannot obtain KubeVirt client: %v", err) + } + + options := k8smetav1.GetOptions{} + vm, err := virtClient.VirtualMachine(namespace).Get(vmiName, &options) + if err != nil { + return fmt.Errorf("Error fetching VirtualMachine: %v", err) + } + var running bool if o.command == COMMAND_START { running = true @@ -94,29 +107,22 @@ func (o *Command) Run(cmd *cobra.Command, args []string) error { running = false } - virtClient, err := kubecli.GetKubevirtClientFromClientConfig(o.clientConfig) - if err != nil { - return fmt.Errorf("Cannot obtain KubeVirt client: %v", err) - } + if vm.Spec.Running != running { + bodyStr := fmt.Sprintf("{\"spec\":{\"running\":%t}}", running) - options := &k8smetav1.GetOptions{} - ovm, err := virtClient.OfflineVirtualMachine(namespace).Get(vmName, options) - if err != nil { - return fmt.Errorf("Error fetching OfflineVirtualMachine: %v", err) - } + _, err := virtClient.VirtualMachine(namespace).Patch(vm.Name, types.MergePatchType, + []byte(bodyStr)) - if ovm.Spec.Running != running { - ovm.Spec.Running = running - _, err := virtClient.OfflineVirtualMachine(namespace).Update(ovm) if err != nil { - return fmt.Errorf("Error updating OfflineVirtualMachine: %v", err) + return fmt.Errorf("Error updating VirtualMachine: %v", err) } + } else { stateMsg := "stopped" if running { stateMsg = "running" } - return fmt.Errorf("Error: VirtualMachine '%s' is already %s", vmName, stateMsg) + return fmt.Errorf("Error: VirtualMachineInstance '%s' is already %s", vmiName, stateMsg) } return nil diff --git a/vendor/kubevirt.io/kubevirt/pkg/virtctl/vnc/vnc.go b/vendor/kubevirt.io/kubevirt/pkg/virtctl/vnc/vnc.go index dbf7e7b61..6259d3626 100644 --- a/vendor/kubevirt.io/kubevirt/pkg/virtctl/vnc/vnc.go +++ b/vendor/kubevirt.io/kubevirt/pkg/virtctl/vnc/vnc.go @@ -26,6 +26,7 @@ import ( "os" "os/exec" "os/signal" + "time" "github.com/golang/glog" "github.com/spf13/cobra" @@ -35,11 +36,13 @@ import ( "kubevirt.io/kubevirt/pkg/virtctl/templates" ) +const LISTEN_TIMEOUT = 60 * time.Second + const FLAG = "vnc" func NewCommand(clientConfig clientcmd.ClientConfig) *cobra.Command { cmd := &cobra.Command{ - Use: "vnc (vm)", + Use: "vnc (vmi)", Short: "Open a vnc connection to a virtual machine.", Example: usage(), Args: cobra.ExactArgs(1), @@ -62,13 +65,32 @@ func (o *VNC) Run(cmd *cobra.Command, args []string) error { return err } - vm := args[0] + vmi := args[0] virtCli, err := kubecli.GetKubevirtClientFromClientConfig(o.clientConfig) if err != nil { return err } + // setup connection with VM + vnc, err := virtCli.VirtualMachineInstance(namespace).VNC(vmi) + if err != nil { + return fmt.Errorf("Can't access VMI %s: %s", vmi, err.Error()) + } + + lnAddr, err := net.ResolveTCPAddr("tcp", "127.0.0.1:0") + if err != nil { + return fmt.Errorf("Can't resolve the address: %s", err.Error()) + } + + // The local tcp server is used to proxy the podExec websock connection to remote-viewer + ln, err := net.ListenTCP("tcp", lnAddr) + if err != nil { + return fmt.Errorf("Can't listen on unix socket: %s", err.Error()) + } + // End of pre-flight checks. Everything looks good, we can start + // the goroutines and let the data flow + // -> pipeInWriter -> pipeInReader // remote-viewer -> unix sock connection // <- pipeOutReader <- pipeOutWriter @@ -76,43 +98,75 @@ func (o *VNC) Run(cmd *cobra.Command, args []string) error { pipeOutReader, pipeOutWriter := io.Pipe() k8ResChan := make(chan error) + listenResChan := make(chan error) viewResChan := make(chan error) stopChan := make(chan struct{}, 1) + doneChan := make(chan struct{}, 1) writeStop := make(chan error) readStop := make(chan error) - // The local tcp server is used to proxy the podExec websock connection to remote-viewer - ln, err := net.Listen("tcp", "127.0.0.1:0") - if err != nil { - return fmt.Errorf("Can't listen on unix socket: %s", err.Error()) - } - - port := ln.Addr().(*net.TCPAddr).Port + go func() { + // transfer data from/to the VM + k8ResChan <- vnc.Stream(kubecli.StreamOptions{ + In: pipeInReader, + Out: pipeOutWriter, + }) + }() - // setup connection with VM + // wait for remote-viewer to connect to our local proxy server go func() { - err := virtCli.VM(namespace).VNC(vm, pipeInReader, pipeOutWriter) - k8ResChan <- err + start := time.Now() + glog.Infof("connection timeout: %v", LISTEN_TIMEOUT) + // exit early if spawning remote-viewer fails + ln.SetDeadline(time.Now().Add(LISTEN_TIMEOUT)) + + fd, err := ln.Accept() + if err != nil { + glog.V(2).Infof("Failed to accept unix sock connection. %s", err.Error()) + listenResChan <- err + } + defer fd.Close() + + glog.V(2).Infof("remote-viewer connected in %v", time.Now().Sub(start)) + + // write to FD <- pipeOutReader + go func() { + _, err := io.Copy(fd, pipeOutReader) + readStop <- err + }() + + // read from FD -> pipeInWriter + go func() { + _, err := io.Copy(pipeInWriter, fd) + writeStop <- err + }() + + // don't terminate until remote-viewer is done + <-doneChan + listenResChan <- err }() // execute remote viewer go func() { - cmnd := exec.Command("remote-viewer", fmt.Sprintf("vnc://127.0.0.1:%d", port)) - err := cmnd.Run() + port := ln.Addr().(*net.TCPAddr).Port + args := []string{fmt.Sprintf("vnc://127.0.0.1:%d", port)} + if glog.V(4) { + args = append(args, "--debug") + glog.Infof("remote-viewer commandline: %v", args) + } + + cmnd := exec.Command("remote-viewer", args...) + + output, err := cmnd.CombinedOutput() if err != nil { - glog.Errorf("remote-viewer execution encountered an error: %v", err) + glog.Errorf("remote-viewer execution failed: %v, output: %v", err, string(output)) + } else { + glog.V(2).Infof("remote-viewer output: %v", string(output)) } viewResChan <- err + close(doneChan) }() - // wait for remote-viewer to connect to our local proxy server - fd, err := ln.Accept() - if err != nil { - return fmt.Errorf("Failed to accept unix sock connection. %s", err.Error()) - } - defer fd.Close() - - glog.V(2).Infof("remote-viewer connected") go func() { interrupt := make(chan os.Signal, 1) signal.Notify(interrupt, os.Interrupt) @@ -120,24 +174,13 @@ func (o *VNC) Run(cmd *cobra.Command, args []string) error { close(stopChan) }() - // write to FD <- pipeOutReader - go func() { - _, err := io.Copy(fd, pipeOutReader) - readStop <- err - }() - - // read from FD -> pipeInWriter - go func() { - _, err := io.Copy(pipeInWriter, fd) - writeStop <- err - }() - select { case <-stopChan: case err = <-readStop: case err = <-writeStop: case err = <-k8ResChan: case err = <-viewResChan: + case err = <-listenResChan: } if err != nil { @@ -147,7 +190,7 @@ func (o *VNC) Run(cmd *cobra.Command, args []string) error { } func usage() string { - usage := "# Connect to testvm via remote-viewer:\n" - usage += "./virtctl vnc testvm" + usage := "# Connect to testvmi via remote-viewer:\n" + usage += "./virtctl vnc testvmi" return usage } diff --git a/vendor/kubevirt.io/kubevirt/pkg/watchdog/watchdog.go b/vendor/kubevirt.io/kubevirt/pkg/watchdog/watchdog.go index ad6529a7e..2fff6b1b3 100644 --- a/vendor/kubevirt.io/kubevirt/pkg/watchdog/watchdog.go +++ b/vendor/kubevirt.io/kubevirt/pkg/watchdog/watchdog.go @@ -43,9 +43,9 @@ func WatchdogFileFromNamespaceName(baseDir string, namespace string, name string return filepath.Join(baseDir, "watchdog-files", watchdogFile) } -func WatchdogFileRemove(baseDir string, vm *v1.VirtualMachine) error { - namespace := precond.MustNotBeEmpty(vm.GetObjectMeta().GetNamespace()) - domain := precond.MustNotBeEmpty(vm.GetObjectMeta().GetName()) +func WatchdogFileRemove(baseDir string, vmi *v1.VirtualMachineInstance) error { + namespace := precond.MustNotBeEmpty(vmi.GetObjectMeta().GetNamespace()) + domain := precond.MustNotBeEmpty(vmi.GetObjectMeta().GetName()) file := WatchdogFileFromNamespaceName(baseDir, namespace, domain) @@ -62,9 +62,9 @@ func WatchdogFileUpdate(watchdogFile string) error { return nil } -func WatchdogFileExists(baseDir string, vm *v1.VirtualMachine) (bool, error) { - namespace := precond.MustNotBeEmpty(vm.GetObjectMeta().GetNamespace()) - domain := precond.MustNotBeEmpty(vm.GetObjectMeta().GetName()) +func WatchdogFileExists(baseDir string, vmi *v1.VirtualMachineInstance) (bool, error) { + namespace := precond.MustNotBeEmpty(vmi.GetObjectMeta().GetNamespace()) + domain := precond.MustNotBeEmpty(vmi.GetObjectMeta().GetName()) filePath := WatchdogFileFromNamespaceName(baseDir, namespace, domain) exists, err := diskutils.FileExists(filePath) @@ -76,9 +76,9 @@ func WatchdogFileExists(baseDir string, vm *v1.VirtualMachine) (bool, error) { return exists, nil } -func WatchdogFileIsExpired(timeoutSeconds int, baseDir string, vm *v1.VirtualMachine) (bool, error) { - namespace := precond.MustNotBeEmpty(vm.GetObjectMeta().GetNamespace()) - domain := precond.MustNotBeEmpty(vm.GetObjectMeta().GetName()) +func WatchdogFileIsExpired(timeoutSeconds int, baseDir string, vmi *v1.VirtualMachineInstance) (bool, error) { + namespace := precond.MustNotBeEmpty(vmi.GetObjectMeta().GetNamespace()) + domain := precond.MustNotBeEmpty(vmi.GetObjectMeta().GetName()) filePath := WatchdogFileFromNamespaceName(baseDir, namespace, domain) diff --git a/vendor/kubevirt.io/kubevirt/tests/types.go b/vendor/kubevirt.io/kubevirt/tests/types.go new file mode 100644 index 000000000..e24859785 --- /dev/null +++ b/vendor/kubevirt.io/kubevirt/tests/types.go @@ -0,0 +1,255 @@ +/* + * This file is part of the KubeVirt project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Copyright 2018 Red Hat, Inc. + * + * This file was derived from 'pkg/template/apis/template/types.go' that is + * part of the OpenShift Origin project. It is required by tests covering + * OpenShift integration test scenarios and for generating example template + * files. You may obtain a copy of the original file at + * + * https://github.com/openshift/origin + * + */ + +package tests + +import ( + k8sv1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" +) + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// Template contains the inputs needed to produce a Config. +type Template struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + // message is an optional instructional message that will + // be displayed when this template is instantiated. + // This field should inform the user how to utilize the newly created resources. + // Parameter substitution will be performed on the message before being + // displayed so that generated credentials and other parameters can be + // included in the output. + Message string `json:"message,omitempty"` + + // parameters is an optional array of Parameters used during the + // Template to Config transformation. + Parameters []Parameter `json:"parameters"` + + // objects is an array of resources to include in this template. + // If a namespace value is hardcoded in the object, it will be removed + // during template instantiation, however if the namespace value + // is, or contains, a ${PARAMETER_REFERENCE}, the resolved + // value after parameter substitution will be respected and the object + // will be created in that namespace. + Objects []runtime.Object `json:"objects"` + + // objectLabels is an optional set of labels that are applied to every + // object during the Template to Config transformation. + ObjectLabels map[string]string `json:"labels,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// TemplateList is a list of Template objects. +type TemplateList struct { + metav1.TypeMeta + metav1.ListMeta + Items []Template +} + +// Parameter defines a name/value variable that is to be processed during +// the Template to Config transformation. +type Parameter struct { + // Required: Parameter name must be set and it can be referenced in Template + // Items using ${PARAMETER_NAME} + Name string `json:"name"` + + // Optional: The name that will show in UI instead of parameter 'Name' + DisplayName string `json:"displayName,omitempty"` + + // Optional: Parameter can have description + Description string `json:"description,omitempty"` + + // Optional: Value holds the Parameter data. If specified, the generator + // will be ignored. The value replaces all occurrences of the Parameter + // ${Name} expression during the Template to Config transformation. + Value string `json:"value,omitempty"` + + // Optional: Generate specifies the generator to be used to generate + // random string from an input value specified by From field. The result + // string is stored into Value field. If empty, no generator is being + // used, leaving the result Value untouched. + Generate string `json:"generate,omitempty"` + + // Optional: From is an input value for the generator. + From string `json:"from,omitempty"` + + // Optional: Indicates the parameter must have a value. Defaults to false. + Required bool `json:"required,omitempty"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// TemplateInstance requests and records the instantiation of a Template. +// TemplateInstance is part of an experimental API. +type TemplateInstance struct { + metav1.TypeMeta + metav1.ObjectMeta + + // Spec describes the desired state of this TemplateInstance. + Spec TemplateInstanceSpec + + // Status describes the current state of this TemplateInstance. + Status TemplateInstanceStatus +} + +// TemplateInstanceSpec describes the desired state of a TemplateInstance. +type TemplateInstanceSpec struct { + // Template is a full copy of the template for instantiation. + Template Template + + // Secret is a reference to a Secret object containing the necessary + // template parameters. + Secret *k8sv1.LocalObjectReference + + // Requester holds the identity of the agent requesting the template + // instantiation. + Requester *TemplateInstanceRequester +} + +// TemplateInstanceRequester holds the identity of an agent requesting a +// template instantiation. +type TemplateInstanceRequester struct { + // username uniquely identifies this user among all active users. + Username string + + // uid is a unique value that identifies this user across time; if this user is + // deleted and another user by the same name is added, they will have + // different UIDs. + UID string + + // groups represent the groups this user is a part of. + Groups []string + + // extra holds additional information provided by the authenticator. + Extra map[string]ExtraValue +} + +// ExtraValue masks the value so protobuf can generate +type ExtraValue []string + +// TemplateInstanceStatus describes the current state of a TemplateInstance. +type TemplateInstanceStatus struct { + // Conditions represent the latest available observations of a + // TemplateInstance's current state. + Conditions []TemplateInstanceCondition + + // Objects references the objects created by the TemplateInstance. + Objects []TemplateInstanceObject +} + +// TemplateInstanceCondition contains condition information for a +// TemplateInstance. +type TemplateInstanceCondition struct { + // Type of the condition, currently Ready or InstantiateFailure. + Type TemplateInstanceConditionType + // Status of the condition, one of True, False or Unknown. + Status k8sv1.ConditionStatus + // LastTransitionTime is the last time a condition status transitioned from + // one state to another. + LastTransitionTime metav1.Time + // Reason is a brief machine readable explanation for the condition's last + // transition. + Reason string + // Message is a human readable description of the details of the last + // transition, complementing reason. + Message string +} + +// TemplateInstanceConditionType is the type of condition pertaining to a +// TemplateInstance. +type TemplateInstanceConditionType string + +const ( + // TemplateInstanceReady indicates the readiness of the template + // instantiation. + TemplateInstanceReady TemplateInstanceConditionType = "Ready" + // TemplateInstanceInstantiateFailure indicates the failure of the template + // instantiation + TemplateInstanceInstantiateFailure TemplateInstanceConditionType = "InstantiateFailure" +) + +// TemplateInstanceObject references an object created by a TemplateInstance. +type TemplateInstanceObject struct { + // ref is a reference to the created object. + Ref k8sv1.ObjectReference +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// TemplateInstanceList is a list of TemplateInstance objects. +type TemplateInstanceList struct { + metav1.TypeMeta + metav1.ListMeta + + // Items is a list of Templateinstances + Items []TemplateInstance +} + +// +genclient +// +genclient:nonNamespaced +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// BrokerTemplateInstance holds the service broker-related state associated with +// a TemplateInstance. BrokerTemplateInstance is part of an experimental API. +type BrokerTemplateInstance struct { + metav1.TypeMeta + metav1.ObjectMeta + + // Spec describes the state of this BrokerTemplateInstance. + Spec BrokerTemplateInstanceSpec +} + +// BrokerTemplateInstanceSpec describes the state of a BrokerTemplateInstance. +type BrokerTemplateInstanceSpec struct { + // TemplateInstance is a reference to a TemplateInstance object residing + // in a namespace. + TemplateInstance k8sv1.ObjectReference + + // Secret is a reference to a Secret object residing in a namespace, + // containing the necessary template parameters. + Secret k8sv1.ObjectReference + + // BindingIDs is a list of 'binding_id's provided during successive bind + // calls to the template service broker. + BindingIDs []string +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// BrokerTemplateInstanceList is a list of BrokerTemplateInstance objects. +type BrokerTemplateInstanceList struct { + metav1.TypeMeta + metav1.ListMeta + + // Items is a list of BrokerTemplateInstances + Items []BrokerTemplateInstance +} diff --git a/vendor/kubevirt.io/kubevirt/tests/utils.go b/vendor/kubevirt.io/kubevirt/tests/utils.go index f671fe214..31e9276ce 100644 --- a/vendor/kubevirt.io/kubevirt/tests/utils.go +++ b/vendor/kubevirt.io/kubevirt/tests/utils.go @@ -30,6 +30,9 @@ import ( "os" "os/exec" "reflect" + "regexp" + "strconv" + "strings" "time" "github.com/google/goexpect" @@ -46,6 +49,7 @@ import ( "k8s.io/apimachinery/pkg/fields" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/util/rand" + k8sversion "k8s.io/apimachinery/pkg/version" "k8s.io/client-go/kubernetes/scheme" "k8s.io/client-go/tools/remotecommand" @@ -58,17 +62,23 @@ import ( "kubevirt.io/kubevirt/pkg/controller" "kubevirt.io/kubevirt/pkg/kubecli" "kubevirt.io/kubevirt/pkg/log" + "kubevirt.io/kubevirt/pkg/util/net/dns" + "kubevirt.io/kubevirt/pkg/virt-controller/services" "kubevirt.io/kubevirt/pkg/virtctl" ) var KubeVirtVersionTag = "latest" var KubeVirtRepoPrefix = "kubevirt" var KubeVirtKubectlPath = "" +var KubeVirtOcPath = "" +var KubeVirtInstallNamespace = "kube-system" func init() { flag.StringVar(&KubeVirtVersionTag, "tag", "latest", "Set the image tag or digest to use") flag.StringVar(&KubeVirtRepoPrefix, "prefix", "kubevirt", "Set the repository prefix for all images") flag.StringVar(&KubeVirtKubectlPath, "kubectl-path", "", "Set path to kubectl binary") + flag.StringVar(&KubeVirtOcPath, "oc-path", "", "Set path to oc binary") + flag.StringVar(&KubeVirtInstallNamespace, "installed-namespace", "kube-system", "Set the namespace KubeVirt is installed in") } type EventType string @@ -80,7 +90,12 @@ const ( const defaultTestGracePeriod int64 = 0 -const SubresourceServiceAccountName = "kubevirt-subresource-test-sa" +const ( + SubresourceServiceAccountName = "kubevirt-subresource-test-sa" + AdminServiceAccountName = "kubevirt-admin-test-sa" + EditServiceAccountName = "kubevirt-edit-test-sa" + ViewServiceAccountName = "kubevirt-view-test-sa" +) const SubresourceTestLabel = "subresource-access-test-pod" @@ -108,20 +123,20 @@ const ( ) const ( - osAlpineISCSI = "alpine-iscsi" - osWindows = "windows" - CustomISCSI = "custom-iscsi" + osAlpineHostPath = "alpine-host-path" + osWindows = "windows" + CustomHostPath = "custom-host-path" ) const ( - DiskAlpineISCSI = "disk-alpine-iscsi" - DiskWindows = "disk-windows" - DiskCustomISCSI = "disk-custom-iscsi" + HostPathAlpine = "/tmp/hostImages/alpine" + HostPathCustom = "/tmp/hostImages/custom" ) const ( - iscsiIqn = "iqn.2017-01.io.kubevirt:sn.42" - iscsiSecretName = "iscsi-demo-secret" + DiskAlpineHostPath = "disk-alpine-host-path" + DiskWindows = "disk-windows" + DiskCustomHostPath = "disk-custom-host-path" ) const ( @@ -129,7 +144,11 @@ const ( defaultWindowsDiskSize = "30Gi" ) -const VmResource = "virtualmachines" +const VMIResource = "virtualmachineinstances" + +const ( + SecretLabel = "kubevirt.io/secret" +) type ProcessFunc func(event *k8sv1.Event) (done bool) @@ -219,18 +238,18 @@ func (w *ObjectEventWatcher) Watch(processFunc ProcessFunc) { if w.failOnWarnings { f = func(event *k8sv1.Event) bool { if event.Type == string(WarningEvent) { - log.Log.Reason(fmt.Errorf("unexpected warning event recieved")).Error(event.Message) + log.Log.Reason(fmt.Errorf("unexpected warning event received")).Error(event.Message) } else { log.Log.Infof(event.Message) } - Expect(event.Type).NotTo(Equal(string(WarningEvent)), "Unexpected Warning event recieved.") + Expect(event.Type).NotTo(Equal(string(WarningEvent)), "Unexpected Warning event received.") return processFunc(event) } } else { f = func(event *k8sv1.Event) bool { if event.Type == string(WarningEvent) { - log.Log.Reason(fmt.Errorf("unexpected warning event recieved")).Error(event.Message) + log.Log.Reason(fmt.Errorf("unexpected warning event received")).Error(event.Message) } else { log.Log.Infof(event.Message) } @@ -290,19 +309,18 @@ func AfterTestSuitCleanup() { // Make sure that the namespaces exist, to not have to check in the cleanup code for existing namespaces createNamespaces() cleanNamespaces() - cleanupSubresourceServiceAccount() + cleanupServiceAccounts() DeletePVC(osWindows) - DeletePVC(osAlpineISCSI) - DeletePV(osAlpineISCSI) + DeletePVC(osAlpineHostPath) + DeletePV(osAlpineHostPath) removeNamespaces() } func BeforeTestCleanup() { cleanNamespaces() - createIscsiSecrets() } func BeforeTestSuitSetup() { @@ -311,13 +329,53 @@ func BeforeTestSuitSetup() { log.Log.SetIOWriter(GinkgoWriter) createNamespaces() - createSubresourceServiceAccount() - createIscsiSecrets() + createServiceAccounts() - CreatePvISCSI(osAlpineISCSI, 2) - CreatePVC(osAlpineISCSI, defaultDiskSize) + CreateHostPathPv(osAlpineHostPath, HostPathAlpine) + CreatePVC(osAlpineHostPath, defaultDiskSize) CreatePVC(osWindows, defaultWindowsDiskSize) + + EnsureKVMPresent() +} + +func EnsureKVMPresent() { + useEmulation := false + virtClient, err := kubecli.GetKubevirtClient() + PanicOnError(err) + + options := metav1.GetOptions{} + cfgMap, err := virtClient.CoreV1().ConfigMaps("kube-system").Get("kubevirt-config", options) + if err == nil { + val, ok := cfgMap.Data["debug.useEmulation"] + useEmulation = ok && (val == "true") + } else { + // If the cfgMap is missing, default to useEmulation=false + // no other error is expected + if !errors.IsNotFound(err) { + Expect(err).ToNot(HaveOccurred()) + } + } + if !useEmulation { + listOptions := metav1.ListOptions{LabelSelector: v1.AppLabel + "=virt-handler"} + virtHandlerPods, err := virtClient.CoreV1().Pods(metav1.NamespaceSystem).List(listOptions) + Expect(err).ToNot(HaveOccurred()) + + Eventually(func() bool { + ready := true + // cluster is not ready until all nodes are ready. + for _, pod := range virtHandlerPods.Items { + virtHandlerNode, err := virtClient.CoreV1().Nodes().Get(pod.Spec.NodeName, metav1.GetOptions{}) + Expect(err).ToNot(HaveOccurred()) + + allocatable, ok := virtHandlerNode.Status.Allocatable[services.KvmDevice] + ready = ready && ok + ready = ready && (allocatable.Value() > 0) + } + return ready + }, 120*time.Second, 1*time.Second).Should(BeTrue(), + "KVM devices are required for testing, but are not present on cluster nodes") + } } func CreatePVC(os string, size string) { @@ -353,23 +411,15 @@ func newPVC(os string, size string) *k8sv1.PersistentVolumeClaim { } } -func CreatePvISCSI(os string, lun int32) { +func CreateHostPathPv(os string, hostPath string) { virtCli, err := kubecli.GetKubevirtClient() PanicOnError(err) - targetIp := "127.0.0.1" // getPodIpByLabel(label) - - _, err = virtCli.CoreV1().PersistentVolumes().Create(newPvISCSI(os, targetIp, lun)) - if !errors.IsAlreadyExists(err) { - PanicOnError(err) - } -} - -func newPvISCSI(os string, targetIp string, lun int32) *k8sv1.PersistentVolume { quantity, err := resource.ParseQuantity("1Gi") PanicOnError(err) name := fmt.Sprintf("%s-disk-for-tests", os) + hostPathType := k8sv1.HostPathDirectoryOrCreate pv := &k8sv1.PersistentVolume{ ObjectMeta: metav1.ObjectMeta{ Name: name, @@ -384,15 +434,18 @@ func newPvISCSI(os string, targetIp string, lun int32) *k8sv1.PersistentVolume { }, PersistentVolumeReclaimPolicy: k8sv1.PersistentVolumeReclaimRetain, PersistentVolumeSource: k8sv1.PersistentVolumeSource{ - ISCSI: &k8sv1.ISCSIPersistentVolumeSource{ - IQN: iscsiIqn, - Lun: lun, - TargetPortal: targetIp, + HostPath: &k8sv1.HostPathVolumeSource{ + Path: hostPath, + Type: &hostPathType, }, }, }, } - return pv + + _, err = virtCli.CoreV1().PersistentVolumes().Create(pv) + if !errors.IsAlreadyExists(err) { + PanicOnError(err) + } } func cleanupSubresourceServiceAccount() { @@ -415,6 +468,66 @@ func cleanupSubresourceServiceAccount() { } } +func createServiceAccount(saName string, clusterRole string) { + virtCli, err := kubecli.GetKubevirtClient() + PanicOnError(err) + + sa := k8sv1.ServiceAccount{ + ObjectMeta: metav1.ObjectMeta{ + Name: saName, + Namespace: NamespaceTestDefault, + Labels: map[string]string{ + "kubevirt.io/test": saName, + }, + }, + } + + _, err = virtCli.CoreV1().ServiceAccounts(NamespaceTestDefault).Create(&sa) + if !errors.IsAlreadyExists(err) { + PanicOnError(err) + } + + roleBinding := rbacv1.ClusterRoleBinding{ + ObjectMeta: metav1.ObjectMeta{ + Name: saName, + Namespace: NamespaceTestDefault, + Labels: map[string]string{ + "kubevirt.io/test": saName, + }, + }, + RoleRef: rbacv1.RoleRef{ + Kind: "ClusterRole", + Name: clusterRole, + APIGroup: "rbac.authorization.k8s.io", + }, + } + roleBinding.Subjects = append(roleBinding.Subjects, rbacv1.Subject{ + Kind: "ServiceAccount", + Name: saName, + Namespace: NamespaceTestDefault, + }) + + _, err = virtCli.RbacV1().ClusterRoleBindings().Create(&roleBinding) + if !errors.IsAlreadyExists(err) { + PanicOnError(err) + } +} + +func cleanupServiceAccount(saName string) { + virtCli, err := kubecli.GetKubevirtClient() + PanicOnError(err) + + err = virtCli.RbacV1().ClusterRoleBindings().Delete(saName, nil) + if !errors.IsNotFound(err) { + PanicOnError(err) + } + + err = virtCli.CoreV1().ServiceAccounts(NamespaceTestDefault).Delete(saName, nil) + if !errors.IsNotFound(err) { + PanicOnError(err) + } +} + func createSubresourceServiceAccount() { virtCli, err := kubecli.GetKubevirtClient() PanicOnError(err) @@ -446,7 +559,7 @@ func createSubresourceServiceAccount() { } role.Rules = append(role.Rules, rbacv1.PolicyRule{ APIGroups: []string{"subresources.kubevirt.io"}, - Resources: []string{"virtualmachines/test"}, + Resources: []string{"virtualmachineinstances/test"}, Verbs: []string{"get"}, }) @@ -481,6 +594,22 @@ func createSubresourceServiceAccount() { } } +func createServiceAccounts() { + createSubresourceServiceAccount() + + createServiceAccount(AdminServiceAccountName, "kubevirt.io:admin") + createServiceAccount(ViewServiceAccountName, "kubevirt.io:view") + createServiceAccount(EditServiceAccountName, "kubevirt.io:edit") +} + +func cleanupServiceAccounts() { + cleanupSubresourceServiceAccount() + + cleanupServiceAccount(AdminServiceAccountName) + cleanupServiceAccount(ViewServiceAccountName) + cleanupServiceAccount(EditServiceAccountName) +} + func DeletePVC(os string) { virtCli, err := kubecli.GetKubevirtClient() PanicOnError(err) @@ -549,31 +678,38 @@ func cleanNamespaces() { continue } - // Remove all OfflineVirtualMachines - PanicOnError(virtCli.RestClient().Delete().Namespace(namespace).Resource("offlinevirtualmachines").Do().Error()) + // Remove all VirtualMachines + PanicOnError(virtCli.RestClient().Delete().Namespace(namespace).Resource("virtualmachines").Do().Error()) // Remove all VirtualMachineReplicaSets - PanicOnError(virtCli.RestClient().Delete().Namespace(namespace).Resource("virtualmachinereplicasets").Do().Error()) + PanicOnError(virtCli.RestClient().Delete().Namespace(namespace).Resource("virtualmachineinstancereplicasets").Do().Error()) - // Remove all VMs - PanicOnError(virtCli.RestClient().Delete().Namespace(namespace).Resource("virtualmachines").Do().Error()) - vms, err := virtCli.VM(namespace).List(metav1.ListOptions{}) + // Remove all VMIs + PanicOnError(virtCli.RestClient().Delete().Namespace(namespace).Resource("virtualmachineinstances").Do().Error()) + vmis, err := virtCli.VirtualMachineInstance(namespace).List(&metav1.ListOptions{}) PanicOnError(err) - for _, vm := range vms.Items { - if controller.HasFinalizer(&vm, v1.VirtualMachineFinalizer) { - _, err := virtCli.VM(vm.Namespace).Patch(vm.Name, types.JSONPatchType, []byte("[{ \"op\": \"remove\", \"path\": \"/metadata/finalizers\" }]")) - PanicOnError(err) + for _, vmi := range vmis.Items { + if controller.HasFinalizer(&vmi, v1.VirtualMachineInstanceFinalizer) { + _, err := virtCli.VirtualMachineInstance(vmi.Namespace).Patch(vmi.Name, types.JSONPatchType, []byte("[{ \"op\": \"remove\", \"path\": \"/metadata/finalizers\" }]")) + if !errors.IsNotFound(err) { + PanicOnError(err) + } } } // Remove all Pods PanicOnError(virtCli.CoreV1().RESTClient().Delete().Namespace(namespace).Resource("pods").Do().Error()) - // Remove all VM Secrets - PanicOnError(virtCli.CoreV1().RESTClient().Delete().Namespace(namespace).Resource("secrets").Do().Error()) + // Remove all VirtualMachineInstance Secrets + labelSelector := fmt.Sprintf("%s", SecretLabel) + PanicOnError( + virtCli.CoreV1().Secrets(namespace).DeleteCollection( + &metav1.DeleteOptions{}, metav1.ListOptions{LabelSelector: labelSelector}, + ), + ) - // Remove all VM Presets - PanicOnError(virtCli.RestClient().Delete().Namespace(namespace).Resource("virtualmachinepresets").Do().Error()) + // Remove all VirtualMachineInstance Presets + PanicOnError(virtCli.RestClient().Delete().Namespace(namespace).Resource("virtualmachineinstancepresets").Do().Error()) } } @@ -598,30 +734,6 @@ func removeNamespaces() { } } -func createIscsiSecrets() { - virtCli, err := kubecli.GetKubevirtClient() - PanicOnError(err) - - // Create a Test Namespaces - for _, namespace := range testNamespaces { - secret := k8sv1.Secret{ - ObjectMeta: metav1.ObjectMeta{ - Name: iscsiSecretName, - }, - Type: "kubernetes.io/iscsi-chap", - Data: map[string][]byte{ - "node.session.auth.password": []byte("demopassword"), - "node.session.auth.username": []byte("demouser"), - }, - } - - _, err := virtCli.CoreV1().Secrets(namespace).Create(&secret) - if !errors.IsAlreadyExists(err) { - PanicOnError(err) - } - } -} - func createNamespaces() { virtCli, err := kubecli.GetKubevirtClient() PanicOnError(err) @@ -646,42 +758,42 @@ func PanicOnError(err error) { } } -func NewRandomVM() *v1.VirtualMachine { - return NewRandomVMWithNS(NamespaceTestDefault) +func NewRandomVMI() *v1.VirtualMachineInstance { + return NewRandomVMIWithNS(NamespaceTestDefault) } -func NewRandomVMWithNS(namespace string) *v1.VirtualMachine { - vm := v1.NewMinimalVMWithNS(namespace, "testvm"+rand.String(5)) +func NewRandomVMIWithNS(namespace string) *v1.VirtualMachineInstance { + vmi := v1.NewMinimalVMIWithNS(namespace, "testvmi"+rand.String(5)) t := defaultTestGracePeriod - vm.Spec.TerminationGracePeriodSeconds = &t - return vm + vmi.Spec.TerminationGracePeriodSeconds = &t + return vmi } -func NewRandomVMWithEphemeralDiskHighMemory(containerImage string) *v1.VirtualMachine { - vm := NewRandomVMWithEphemeralDisk(containerImage) +func NewRandomVMIWithEphemeralDiskHighMemory(containerImage string) *v1.VirtualMachineInstance { + vmi := NewRandomVMIWithEphemeralDisk(containerImage) - vm.Spec.Domain.Resources.Requests[k8sv1.ResourceMemory] = resource.MustParse("512M") - return vm + vmi.Spec.Domain.Resources.Requests[k8sv1.ResourceMemory] = resource.MustParse("512M") + return vmi } -func NewRandomVMWithEphemeralDiskAndUserdataHighMemory(containerImage string, userData string) *v1.VirtualMachine { - vm := NewRandomVMWithEphemeralDiskAndUserdata(containerImage, userData) +func NewRandomVMIWithEphemeralDiskAndUserdataHighMemory(containerImage string, userData string) *v1.VirtualMachineInstance { + vmi := NewRandomVMIWithEphemeralDiskAndUserdata(containerImage, userData) - vm.Spec.Domain.Resources.Requests[k8sv1.ResourceMemory] = resource.MustParse("512M") - return vm + vmi.Spec.Domain.Resources.Requests[k8sv1.ResourceMemory] = resource.MustParse("512M") + return vmi } -func NewRandomVMWithEphemeralDisk(containerImage string) *v1.VirtualMachine { - vm := NewRandomVM() +func NewRandomVMIWithEphemeralDisk(containerImage string) *v1.VirtualMachineInstance { + vmi := NewRandomVMI() - vm.Spec.Domain.Resources.Requests[k8sv1.ResourceMemory] = resource.MustParse("64M") - AddEphemeralDisk(vm, "disk0", "virtio", containerImage) - return vm + vmi.Spec.Domain.Resources.Requests[k8sv1.ResourceMemory] = resource.MustParse("64M") + AddEphemeralDisk(vmi, "disk0", "virtio", containerImage) + return vmi } -func AddEphemeralDisk(vm *v1.VirtualMachine, name string, bus string, image string) *v1.VirtualMachine { - vm.Spec.Domain.Devices.Disks = append(vm.Spec.Domain.Devices.Disks, v1.Disk{ +func AddEphemeralDisk(vmi *v1.VirtualMachineInstance, name string, bus string, image string) *v1.VirtualMachineInstance { + vmi.Spec.Domain.Devices.Disks = append(vmi.Spec.Domain.Devices.Disks, v1.Disk{ Name: name, VolumeName: name, DiskDevice: v1.DiskDevice{ @@ -690,7 +802,7 @@ func AddEphemeralDisk(vm *v1.VirtualMachine, name string, bus string, image stri }, }, }) - vm.Spec.Volumes = append(vm.Spec.Volumes, v1.Volume{ + vmi.Spec.Volumes = append(vmi.Spec.Volumes, v1.Volume{ Name: name, VolumeSource: v1.VolumeSource{ RegistryDisk: &v1.RegistryDiskSource{ @@ -699,11 +811,21 @@ func AddEphemeralDisk(vm *v1.VirtualMachine, name string, bus string, image stri }, }) - return vm + return vmi +} + +func AddBootOrderToDisk(vmi *v1.VirtualMachineInstance, diskName string, bootorder *uint) *v1.VirtualMachineInstance { + for i, d := range vmi.Spec.Domain.Devices.Disks { + if d.Name == diskName { + vmi.Spec.Domain.Devices.Disks[i].BootOrder = bootorder + return vmi + } + } + return vmi } -func AddPVCDisk(vm *v1.VirtualMachine, name string, bus string, claimName string) *v1.VirtualMachine { - vm.Spec.Domain.Devices.Disks = append(vm.Spec.Domain.Devices.Disks, v1.Disk{ +func AddPVCDisk(vmi *v1.VirtualMachineInstance, name string, bus string, claimName string) *v1.VirtualMachineInstance { + vmi.Spec.Domain.Devices.Disks = append(vmi.Spec.Domain.Devices.Disks, v1.Disk{ Name: name, VolumeName: name, DiskDevice: v1.DiskDevice{ @@ -712,7 +834,7 @@ func AddPVCDisk(vm *v1.VirtualMachine, name string, bus string, claimName string }, }, }) - vm.Spec.Volumes = append(vm.Spec.Volumes, v1.Volume{ + vmi.Spec.Volumes = append(vmi.Spec.Volumes, v1.Volume{ Name: name, VolumeSource: v1.VolumeSource{ PersistentVolumeClaim: &k8sv1.PersistentVolumeClaimVolumeSource{ @@ -721,18 +843,18 @@ func AddPVCDisk(vm *v1.VirtualMachine, name string, bus string, claimName string }, }) - return vm + return vmi } -func AddEphemeralFloppy(vm *v1.VirtualMachine, name string, image string) *v1.VirtualMachine { - vm.Spec.Domain.Devices.Disks = append(vm.Spec.Domain.Devices.Disks, v1.Disk{ +func AddEphemeralFloppy(vmi *v1.VirtualMachineInstance, name string, image string) *v1.VirtualMachineInstance { + vmi.Spec.Domain.Devices.Disks = append(vmi.Spec.Domain.Devices.Disks, v1.Disk{ Name: name, VolumeName: name, DiskDevice: v1.DiskDevice{ Floppy: &v1.FloppyTarget{}, }, }) - vm.Spec.Volumes = append(vm.Spec.Volumes, v1.Volume{ + vmi.Spec.Volumes = append(vmi.Spec.Volumes, v1.Volume{ Name: name, VolumeSource: v1.VolumeSource{ RegistryDisk: &v1.RegistryDiskSource{ @@ -741,13 +863,13 @@ func AddEphemeralFloppy(vm *v1.VirtualMachine, name string, image string) *v1.Vi }, }) - return vm + return vmi } -func NewRandomVMWithEphemeralDiskAndUserdata(containerImage string, userData string) *v1.VirtualMachine { - vm := NewRandomVMWithEphemeralDisk(containerImage) +func NewRandomVMIWithEphemeralDiskAndUserdata(containerImage string, userData string) *v1.VirtualMachineInstance { + vmi := NewRandomVMIWithEphemeralDisk(containerImage) - vm.Spec.Domain.Devices.Disks = append(vm.Spec.Domain.Devices.Disks, v1.Disk{ + vmi.Spec.Domain.Devices.Disks = append(vmi.Spec.Domain.Devices.Disks, v1.Disk{ Name: "disk1", VolumeName: "disk1", DiskDevice: v1.DiskDevice{ @@ -756,7 +878,7 @@ func NewRandomVMWithEphemeralDiskAndUserdata(containerImage string, userData str }, }, }) - vm.Spec.Volumes = append(vm.Spec.Volumes, v1.Volume{ + vmi.Spec.Volumes = append(vmi.Spec.Volumes, v1.Volume{ Name: "disk1", VolumeSource: v1.VolumeSource{ CloudInitNoCloud: &v1.CloudInitNoCloudSource{ @@ -764,14 +886,14 @@ func NewRandomVMWithEphemeralDiskAndUserdata(containerImage string, userData str }, }, }) - return vm + return vmi } -func NewRandomVMWithPVC(claimName string) *v1.VirtualMachine { - vm := NewRandomVM() +func NewRandomVMIWithPVC(claimName string) *v1.VirtualMachineInstance { + vmi := NewRandomVMI() - vm.Spec.Domain.Resources.Requests[k8sv1.ResourceMemory] = resource.MustParse("64M") - vm.Spec.Domain.Devices.Disks = append(vm.Spec.Domain.Devices.Disks, v1.Disk{ + vmi.Spec.Domain.Resources.Requests[k8sv1.ResourceMemory] = resource.MustParse("64M") + vmi.Spec.Domain.Devices.Disks = append(vmi.Spec.Domain.Devices.Disks, v1.Disk{ Name: "disk0", VolumeName: "disk0", DiskDevice: v1.DiskDevice{ @@ -780,7 +902,33 @@ func NewRandomVMWithPVC(claimName string) *v1.VirtualMachine { }, }, }) - vm.Spec.Volumes = append(vm.Spec.Volumes, v1.Volume{ + vmi.Spec.Volumes = append(vmi.Spec.Volumes, v1.Volume{ + Name: "disk0", + VolumeSource: v1.VolumeSource{ + PersistentVolumeClaim: &k8sv1.PersistentVolumeClaimVolumeSource{ + ClaimName: claimName, + }, + }, + }) + return vmi +} + +func NewRandomVMIWithCDRom(claimName string) *v1.VirtualMachineInstance { + vmi := NewRandomVMI() + + vmi.Spec.Domain.Resources.Requests[k8sv1.ResourceMemory] = resource.MustParse("64M") + vmi.Spec.Domain.Devices.Disks = append(vmi.Spec.Domain.Devices.Disks, v1.Disk{ + Name: "disk0", + VolumeName: "disk0", + DiskDevice: v1.DiskDevice{ + CDRom: &v1.CDRomTarget{ + // Do not specify ReadOnly flag so that + // default behavior can be tested + Bus: "sata", + }, + }, + }) + vmi.Spec.Volumes = append(vmi.Spec.Volumes, v1.Volume{ Name: "disk0", VolumeSource: v1.VolumeSource{ PersistentVolumeClaim: &k8sv1.PersistentVolumeClaimVolumeSource{ @@ -788,14 +936,14 @@ func NewRandomVMWithPVC(claimName string) *v1.VirtualMachine { }, }, }) - return vm + return vmi } -func NewRandomVMWithEphemeralPVC(claimName string) *v1.VirtualMachine { - vm := NewRandomVM() +func NewRandomVMIWithEphemeralPVC(claimName string) *v1.VirtualMachineInstance { + vmi := NewRandomVMI() - vm.Spec.Domain.Resources.Requests[k8sv1.ResourceMemory] = resource.MustParse("64M") - vm.Spec.Domain.Devices.Disks = append(vm.Spec.Domain.Devices.Disks, v1.Disk{ + vmi.Spec.Domain.Resources.Requests[k8sv1.ResourceMemory] = resource.MustParse("64M") + vmi.Spec.Domain.Devices.Disks = append(vmi.Spec.Domain.Devices.Disks, v1.Disk{ Name: "disk0", VolumeName: "disk0", DiskDevice: v1.DiskDevice{ @@ -804,7 +952,7 @@ func NewRandomVMWithEphemeralPVC(claimName string) *v1.VirtualMachine { }, }, }) - vm.Spec.Volumes = append(vm.Spec.Volumes, v1.Volume{ + vmi.Spec.Volumes = append(vmi.Spec.Volumes, v1.Volume{ Name: "disk0", VolumeSource: v1.VolumeSource{ @@ -815,13 +963,13 @@ func NewRandomVMWithEphemeralPVC(claimName string) *v1.VirtualMachine { }, }, }) - return vm + return vmi } -func NewRandomVMWithWatchdog() *v1.VirtualMachine { - vm := NewRandomVMWithEphemeralDisk(RegistryDiskFor(RegistryDiskAlpine)) +func NewRandomVMIWithWatchdog() *v1.VirtualMachineInstance { + vmi := NewRandomVMIWithEphemeralDisk(RegistryDiskFor(RegistryDiskAlpine)) - vm.Spec.Domain.Devices.Watchdog = &v1.Watchdog{ + vmi.Spec.Domain.Devices.Watchdog = &v1.Watchdog{ Name: "mywatchdog", WatchdogDevice: v1.WatchdogDevice{ I6300ESB: &v1.I6300ESBWatchdog{ @@ -829,21 +977,50 @@ func NewRandomVMWithWatchdog() *v1.VirtualMachine { }, }, } - return vm + return vmi } -// Block until the specified VM started and return the target node name. -func waitForVmStart(vm runtime.Object, seconds int, ignoreWarnings bool) (nodeName string) { - _, ok := vm.(*v1.VirtualMachine) - Expect(ok).To(BeTrue(), "Object is not of type *v1.VM") +func NewRandomVMIWithSlirpInterfaceEphemeralDiskAndUserdata(containerImage string, userData string, Ports []v1.Port) *v1.VirtualMachineInstance { + vmi := NewRandomVMIWithEphemeralDiskAndUserdata(containerImage, userData) + vmi.Spec.Domain.Devices.Interfaces = []v1.Interface{{Name: "default", Ports: Ports, InterfaceBindingMethod: v1.InterfaceBindingMethod{Slirp: &v1.InterfaceSlirp{}}}} + vmi.Spec.Networks = []v1.Network{*v1.DefaultPodNetwork()} + + return vmi +} + +func AddExplicitPodNetworkInterface(vmi *v1.VirtualMachineInstance) { + vmi.Spec.Domain.Devices.Interfaces = []v1.Interface{*v1.DefaultNetworkInterface()} + vmi.Spec.Networks = []v1.Network{*v1.DefaultPodNetwork()} +} + +func NewRandomVMIWithe1000NetworkInterface() *v1.VirtualMachineInstance { + // Use alpine because cirros dhcp client starts prematurily before link is ready + vmi := NewRandomVMIWithEphemeralDisk(RegistryDiskFor(RegistryDiskAlpine)) + AddExplicitPodNetworkInterface(vmi) + vmi.Spec.Domain.Devices.Interfaces[0].Model = "e1000" + return vmi +} + +func NewRandomVMIWithCustomMacAddress() *v1.VirtualMachineInstance { + vmi := NewRandomVMIWithEphemeralDisk(RegistryDiskFor(RegistryDiskAlpine)) + AddExplicitPodNetworkInterface(vmi) + vmi.Spec.Domain.Devices.Interfaces[0].MacAddress = "de:ad:00:00:be:af" + return vmi +} + +// Block until the specified VirtualMachineInstance started and return the target node name. +func waitForVMIStart(obj runtime.Object, seconds int, ignoreWarnings bool) (nodeName string) { + vmi, ok := obj.(*v1.VirtualMachineInstance) + Expect(ok).To(BeTrue(), "Object is not of type *v1.VMI") + virtClient, err := kubecli.GetKubevirtClient() Expect(err).ToNot(HaveOccurred()) - // Fetch the VM, to make sure we have a resourceVersion as a starting point for the watch - vmMeta := vm.(*v1.VirtualMachine).ObjectMeta - obj, err := virtClient.RestClient().Get().Resource("virtualmachines").Namespace(vmMeta.Namespace).Name(vmMeta.Name).Do().Get() + // Fetch the VirtualMachineInstance, to make sure we have a resourceVersion as a starting point for the watch + vmi, err = virtClient.VirtualMachineInstance(vmi.Namespace).Get(vmi.Name, &metav1.GetOptions{}) + Expect(err).ToNot(HaveOccurred()) - objectEventWatcher := NewObjectEventWatcher(obj).SinceWatchedObjectResourceVersion().Timeout(time.Duration(seconds) * time.Second) + objectEventWatcher := NewObjectEventWatcher(vmi).SinceWatchedObjectResourceVersion().Timeout(time.Duration(seconds) * time.Second) if ignoreWarnings != true { objectEventWatcher.FailOnWarnings() } @@ -851,13 +1028,13 @@ func waitForVmStart(vm runtime.Object, seconds int, ignoreWarnings bool) (nodeNa // FIXME the event order is wrong. First the document should be updated Eventually(func() bool { - obj, err := virtClient.RestClient().Get().Resource("virtualmachines").Namespace(vmMeta.Namespace).Name(vmMeta.Name).Do().Get() + vmi, err = virtClient.VirtualMachineInstance(vmi.Namespace).Get(vmi.Name, &metav1.GetOptions{}) Expect(err).ToNot(HaveOccurred()) - fetchedVM := obj.(*v1.VirtualMachine) - nodeName = fetchedVM.Status.NodeName + + nodeName = vmi.Status.NodeName // wait on both phase and graphics - if fetchedVM.Status.Phase == v1.Running { + if vmi.Status.Phase == v1.Running { return true } return false @@ -866,46 +1043,46 @@ func waitForVmStart(vm runtime.Object, seconds int, ignoreWarnings bool) (nodeNa return } -func WaitForSuccessfulVMStartIgnoreWarnings(vm runtime.Object) string { - return waitForVmStart(vm, 30, true) +func WaitForSuccessfulVMIStartIgnoreWarnings(vmi runtime.Object) string { + return waitForVMIStart(vmi, 30, true) } -func WaitForSuccessfulVMStartWithTimeout(vm runtime.Object, seconds int) (nodeName string) { - return waitForVmStart(vm, seconds, false) +func WaitForSuccessfulVMIStartWithTimeout(vmi runtime.Object, seconds int) (nodeName string) { + return waitForVMIStart(vmi, seconds, false) } -func WaitForVirtualMachineToDisappearWithTimeout(vm *v1.VirtualMachine, seconds int) { +func WaitForVirtualMachineToDisappearWithTimeout(vmi *v1.VirtualMachineInstance, seconds int) { virtClient, err := kubecli.GetKubevirtClient() Expect(err).ToNot(HaveOccurred()) Eventually(func() bool { - _, err := virtClient.VM(vm.Namespace).Get(vm.Name, metav1.GetOptions{}) + _, err := virtClient.VirtualMachineInstance(vmi.Namespace).Get(vmi.Name, &metav1.GetOptions{}) return errors.IsNotFound(err) }, seconds, 1*time.Second).Should(BeTrue()) } -func WaitForSuccessfulVMStart(vm runtime.Object) string { - return waitForVmStart(vm, 90, false) +func WaitForSuccessfulVMIStart(vmi runtime.Object) string { + return waitForVMIStart(vmi, 90, false) } func NewInt32(x int32) *int32 { return &x } -func NewRandomReplicaSetFromVM(vm *v1.VirtualMachine, replicas int32) *v1.VirtualMachineReplicaSet { +func NewRandomReplicaSetFromVMI(vmi *v1.VirtualMachineInstance, replicas int32) *v1.VirtualMachineInstanceReplicaSet { name := "replicaset" + rand.String(5) - rs := &v1.VirtualMachineReplicaSet{ + rs := &v1.VirtualMachineInstanceReplicaSet{ ObjectMeta: metav1.ObjectMeta{Name: "replicaset" + rand.String(5)}, - Spec: v1.VMReplicaSetSpec{ + Spec: v1.VirtualMachineInstanceReplicaSetSpec{ Replicas: &replicas, Selector: &metav1.LabelSelector{ MatchLabels: map[string]string{"name": name}, }, - Template: &v1.VMTemplateSpec{ + Template: &v1.VirtualMachineInstanceTemplateSpec{ ObjectMeta: metav1.ObjectMeta{ Labels: map[string]string{"name": name}, - Name: vm.ObjectMeta.Name, + Name: vmi.ObjectMeta.Name, }, - Spec: vm.Spec, + Spec: vmi.Spec, }, }, } @@ -948,24 +1125,32 @@ func RenderJob(name string, cmd []string, args []string) *k8sv1.Pod { return &job } -func NewConsoleExpecter(virtCli kubecli.KubevirtClient, vm *v1.VirtualMachine, timeout time.Duration, opts ...expect.Option) (expect.Expecter, <-chan error, error) { - vmReader, vmWriter := io.Pipe() +func NewConsoleExpecter(virtCli kubecli.KubevirtClient, vmi *v1.VirtualMachineInstance, timeout time.Duration, opts ...expect.Option) (expect.Expecter, <-chan error, error) { + vmiReader, vmiWriter := io.Pipe() expecterReader, expecterWriter := io.Pipe() resCh := make(chan error) - stopChan := make(chan struct{}) go func() { - err := virtCli.VM(vm.ObjectMeta.Namespace).SerialConsole(vm.ObjectMeta.Name, vmReader, expecterWriter) - resCh <- err + con, err := virtCli.VirtualMachineInstance(vmi.ObjectMeta.Namespace).SerialConsole(vmi.ObjectMeta.Name) + if err != nil { + resCh <- err + return + } + + resCh <- con.Stream(kubecli.StreamOptions{ + In: vmiReader, + Out: expecterWriter, + }) }() return expect.SpawnGeneric(&expect.GenOptions{ - In: vmWriter, + In: vmiWriter, Out: expecterReader, Wait: func() error { return <-resCh }, Close: func() error { - close(stopChan) + expecterWriter.Close() + vmiReader.Close() return nil }, Check: func() bool { return true }, @@ -991,28 +1176,85 @@ func RegistryDiskFor(name RegistryDisk) string { panic(fmt.Sprintf("Unsupported registry disk %s", name)) } -func LoggedInCirrosExpecter(vm *v1.VirtualMachine) (expect.Expecter, error) { +func CheckForTextExpecter(vmi *v1.VirtualMachineInstance, expected []expect.Batcher, wait int) error { virtClient, err := kubecli.GetKubevirtClient() PanicOnError(err) - expecter, _, err := NewConsoleExpecter(virtClient, vm, 10*time.Second) + expecter, _, err := NewConsoleExpecter(virtClient, vmi, 10*time.Second) if err != nil { + return err + } + defer expecter.Close() + + resp, err := expecter.ExpectBatch(expected, time.Second*time.Duration(wait)) + if err != nil { + log.DefaultLogger().Object(vmi).Infof("%v", resp) + } + return err +} + +func LoggedInCirrosExpecter(vmi *v1.VirtualMachineInstance) (expect.Expecter, error) { + virtClient, err := kubecli.GetKubevirtClient() + PanicOnError(err) + expecter, _, err := NewConsoleExpecter(virtClient, vmi, 10*time.Second) + if err != nil { + return nil, err + } + hostName := dns.SanitizeHostname(vmi) + + // Do not login, if we already logged in + err = expecter.Send("\n") + if err != nil { + expecter.Close() return nil, err } + _, _, err = expecter.Expect(regexp.MustCompile(`\$`), 10*time.Second) + if err == nil { + return expecter, nil + } + b := append([]expect.Batcher{ &expect.BSnd{S: "\n"}, &expect.BSnd{S: "\n"}, &expect.BExp{R: "login as 'cirros' user. default password: 'gocubsgo'. use 'sudo' for root."}, &expect.BSnd{S: "\n"}, - &expect.BExp{R: vm.Name + " login:"}, + &expect.BExp{R: hostName + " login:"}, &expect.BSnd{S: "cirros\n"}, &expect.BExp{R: "Password:"}, &expect.BSnd{S: "gocubsgo\n"}, - &expect.BExp{R: "$"}}) + &expect.BExp{R: "\\$"}}) + resp, err := expecter.ExpectBatch(b, 180*time.Second) + if err != nil { + log.DefaultLogger().Object(vmi).Infof("Login: %v", resp) + expecter.Close() + return nil, err + } + return expecter, nil +} + +func LoggedInAlpineExpecter(vmi *v1.VirtualMachineInstance) (expect.Expecter, error) { + virtClient, err := kubecli.GetKubevirtClient() + PanicOnError(err) + expecter, _, err := NewConsoleExpecter(virtClient, vmi, 10*time.Second) + if err != nil { + return nil, err + } + b := append([]expect.Batcher{ + &expect.BSnd{S: "\n"}, + &expect.BSnd{S: "\n"}, + &expect.BExp{R: "localhost login:"}, + &expect.BSnd{S: "root\n"}, + &expect.BExp{R: "localhost:~#"}}) res, err := expecter.ExpectBatch(b, 180*time.Second) - log.DefaultLogger().Object(vm).V(4).Infof("%v", res) + if err != nil { + log.DefaultLogger().Object(vmi).Infof("Login: %v", res) + expecter.Close() + return nil, err + } return expecter, err } +type VMIExpecterFactory func(*v1.VirtualMachineInstance) (expect.Expecter, error) + func NewVirtctlCommand(args ...string) *cobra.Command { commandline := []string{} master := flag.Lookup("master").Value @@ -1111,10 +1353,10 @@ func SkipIfNoKubectl() { } } -func RunKubectlCommand(args ...string) error { +func RunKubectlCommand(args ...string) (string, error) { kubeconfig := flag.Lookup("kubeconfig").Value if kubeconfig == nil || kubeconfig.String() == "" { - return fmt.Errorf("can not find kubeconfig") + return "", fmt.Errorf("can not find kubeconfig") } master := flag.Lookup("master").Value @@ -1126,43 +1368,202 @@ func RunKubectlCommand(args ...string) error { kubeconfEnv := fmt.Sprintf("KUBECONFIG=%s", kubeconfig.String()) cmd.Env = append(os.Environ(), kubeconfEnv) - err := cmd.Run() + stdOutBytes, err := cmd.Output() if err != nil { - return err + return string(stdOutBytes), err + } + return string(stdOutBytes), nil +} + +func SkipIfNoOc() { + if KubeVirtOcPath == "" { + var err error + KubeVirtOcPath, err = exec.LookPath("oc") + if err != nil { + Skip("Skip test that requires oc binary") + } } - return nil } -func GenerateVmJson(vm *v1.VirtualMachine) (string, error) { - data, err := json.Marshal(vm) +func RunOcCommand(args ...string) (string, error) { + if KubeVirtOcPath == "" { + var err error + KubeVirtOcPath, err = exec.LookPath("oc") + if err != nil { + return "", fmt.Errorf("can not find oc binary") + } + } + + kubeconfig := flag.Lookup("kubeconfig").Value + if kubeconfig == nil || kubeconfig.String() == "" { + return "", fmt.Errorf("can not find kubeconfig") + } + + master := flag.Lookup("master").Value + if master != nil && master.String() != "" { + args = append(args, "--server", master.String()) + } + + cmd := exec.Command(KubeVirtOcPath, args...) + kubeconfEnv := fmt.Sprintf("KUBECONFIG=%s", kubeconfig.String()) + cmd.Env = append(os.Environ(), kubeconfEnv) + + stdOutErrBytes, err := cmd.CombinedOutput() + + if err != nil { + fmt.Printf("%s %s %s\n%s%v\n", kubeconfEnv, KubeVirtOcPath, strings.Join(args, " "), string(stdOutErrBytes), err) + return string(stdOutErrBytes), err + } + return string(stdOutErrBytes), nil +} + +func GenerateVMIJson(vmi *v1.VirtualMachineInstance) (string, error) { + data, err := json.Marshal(vmi) + if err != nil { + return "", fmt.Errorf("failed to generate json for vmi %s", vmi.Name) + } + + jsonFile := fmt.Sprintf("%s.json", vmi.Name) + err = ioutil.WriteFile(jsonFile, data, 0644) + if err != nil { + return "", fmt.Errorf("failed to write json file %s", jsonFile) + } + return jsonFile, nil +} + +func GenerateTemplateJson(template *Template) (string, error) { + data, err := json.Marshal(template) if err != nil { - return "", fmt.Errorf("failed to generate json for vm %s", vm.Name) + return "", fmt.Errorf("failed to generate json for vm template %s", template.Name) } - yamlFile := fmt.Sprintf("%s.json", vm.Name) - err = ioutil.WriteFile(yamlFile, data, 0644) + jsonFile := fmt.Sprintf("%s.json", template.Name) + err = ioutil.WriteFile(jsonFile, data, 0644) if err != nil { - return "", fmt.Errorf("failed to write json file %s", yamlFile) + return "", fmt.Errorf("failed to write json file %s", jsonFile) } - return yamlFile, nil + return jsonFile, nil } -func NotDeleted(vms *v1.VirtualMachineList) (notDeleted []v1.VirtualMachine) { - for _, vm := range vms.Items { - if vm.DeletionTimestamp == nil { - notDeleted = append(notDeleted, vm) +func NotDeleted(vmis *v1.VirtualMachineInstanceList) (notDeleted []v1.VirtualMachineInstance) { + for _, vmi := range vmis.Items { + if vmi.DeletionTimestamp == nil { + notDeleted = append(notDeleted, vmi) } } return } -func UnfinishedVMPodSelector(vm *v1.VirtualMachine) metav1.ListOptions { +func UnfinishedVMIPodSelector(vmi *v1.VirtualMachineInstance) metav1.ListOptions { fieldSelector := fields.ParseSelectorOrDie( "status.phase!=" + string(k8sv1.PodFailed) + ",status.phase!=" + string(k8sv1.PodSucceeded)) - labelSelector, err := labels.Parse(fmt.Sprintf(v1.AppLabel+"=virt-launcher,"+v1.DomainLabel+" in (%s)", vm.GetName())) + labelSelector, err := labels.Parse(fmt.Sprintf(v1.AppLabel+"=virt-launcher,"+v1.DomainLabel+" in (%s)", vmi.GetName())) if err != nil { panic(err) } return metav1.ListOptions{FieldSelector: fieldSelector.String(), LabelSelector: labelSelector.String()} } + +// NewHelloWorldJob takes a DNS entry or an IP and a port which it will use create a pod +// which tries to contact the host on the provided port. It expects to receive "Hello World!" to succeed. +func NewHelloWorldJob(host string, port string) *k8sv1.Pod { + check := []string{fmt.Sprintf(`set -x; x="$(head -n 1 < <(nc %s %s -i 1 -w 1))"; echo "$x" ; if [ "$x" = "Hello World!" ]; then echo "succeeded"; exit 0; else echo "failed"; exit 1; fi`, host, port)} + job := RenderJob("netcat", []string{"/bin/bash", "-c"}, check) + + return job +} + +// NewHelloWorldJobUDP takes a DNS entry or an IP and a port which it will use create a pod +// which tries to contact the host on the provided port. It expects to receive "Hello World!" to succeed. +// Note that in case of UDP, the server will not see the connection unless something is sent over it +// However, netcat does not work well with UDP and closes before the answer arrives, for that another netcat call is needed, +// this time as a UDP listener +func NewHelloWorldJobUDP(host string, port string) *k8sv1.Pod { + localPort, err := strconv.Atoi(port) + if err != nil { + return nil + } + // local port is used to catch the reply - any number can be used + // we make it different than the port to be safe if both are running on the same machine + localPort-- + check := []string{fmt.Sprintf(`set -x; x="$(head -n 1 < <(echo | nc -up %d %s %s -i 1 -w 1 & nc -ul %d))"; echo "$x" ; if [ "$x" = "Hello UDP World!" ]; then echo "succeeded"; exit 0; else echo "failed"; exit 1; fi`, + localPort, host, port, localPort)} + job := RenderJob("netcat", []string{"/bin/bash", "-c"}, check) + + return job +} + +func GetNodeWithHugepages(virtClient kubecli.KubevirtClient, hugepages k8sv1.ResourceName) *k8sv1.Node { + nodes, err := virtClient.Core().Nodes().List(metav1.ListOptions{}) + Expect(err).ToNot(HaveOccurred()) + + for _, node := range nodes.Items { + if v, ok := node.Status.Capacity[hugepages]; ok && !v.IsZero() { + return &node + } + } + return nil +} + +// SkipIfVersionBelow will skip tests if it runs on an environment with k8s version below specified +func SkipIfVersionBelow(message string, expectedVersion string) { + virtClient, err := kubecli.GetKubevirtClient() + PanicOnError(err) + + response, err := virtClient.RestClient().Get().AbsPath("/version").DoRaw() + Expect(err).ToNot(HaveOccurred()) + + var info k8sversion.Info + + err = json.Unmarshal(response, &info) + Expect(err).ToNot(HaveOccurred()) + + curVersion := strings.Split(info.GitVersion, "+")[0] + curVersion = strings.Trim(curVersion, "v") + + if curVersion < expectedVersion { + Skip(message) + } +} + +// GetNodeLibvirtCapabilities returns node libvirt capabilities +func GetNodeLibvirtCapabilities(nodeName string) string { + virtClient, err := kubecli.GetKubevirtClient() + PanicOnError(err) + + // Create a virt-launcher pod, that can fetch virsh capabilities + vmi := NewRandomVMIWithEphemeralDiskAndUserdata(RegistryDiskFor(RegistryDiskCirros), "#!/bin/bash\necho 'hello'\n") + vmi.Spec.Affinity = &v1.Affinity{ + NodeAffinity: &k8sv1.NodeAffinity{ + RequiredDuringSchedulingIgnoredDuringExecution: &k8sv1.NodeSelector{ + NodeSelectorTerms: []k8sv1.NodeSelectorTerm{ + { + MatchExpressions: []k8sv1.NodeSelectorRequirement{ + {Key: "kubernetes.io/hostname", Operator: k8sv1.NodeSelectorOpIn, Values: []string{nodeName}}, + }, + }, + }, + }, + }, + } + + _, err = virtClient.VirtualMachineInstance(NamespaceTestDefault).Create(vmi) + Expect(err).ToNot(HaveOccurred()) + WaitForSuccessfulVMIStart(vmi) + + pods, err := virtClient.CoreV1().Pods(NamespaceTestDefault).List(UnfinishedVMIPodSelector(vmi)) + Expect(err).ToNot(HaveOccurred()) + Expect(pods.Items).NotTo(BeEmpty()) + vmiPod := pods.Items[0] + + output, err := ExecuteCommandOnPod( + virtClient, + &vmiPod, + "compute", + []string{"virsh", "-r", "capabilities"}, + ) + Expect(err).ToNot(HaveOccurred()) + + return output +} diff --git a/vendor/kubevirt.io/kubevirt/tools/crd-generator/crd-generator.go b/vendor/kubevirt.io/kubevirt/tools/crd-generator/crd-generator.go index 6fb338bcb..3cded3560 100644 --- a/vendor/kubevirt.io/kubevirt/tools/crd-generator/crd-generator.go +++ b/vendor/kubevirt.io/kubevirt/tools/crd-generator/crd-generator.go @@ -24,9 +24,11 @@ import ( "fmt" crdutils "github.com/ant31/crd-validation/pkg" + "github.com/go-openapi/spec" extensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + common "k8s.io/kube-openapi/pkg/common" "kubevirt.io/kubevirt/pkg/api/v1" ) @@ -45,43 +47,63 @@ func generateBlankCrd() *extensionsv1.CustomResourceDefinition { } } -func generateOfflineVirtualMachineCrd() { +func generateVirtualMachineCrd() { crd := generateBlankCrd() - crd.ObjectMeta.Name = "offlinevirtualmachines." + v1.OfflineVirtualMachineGroupVersionKind.Group + crd.ObjectMeta.Name = "virtualmachines." + v1.VirtualMachineGroupVersionKind.Group crd.Spec = extensionsv1.CustomResourceDefinitionSpec{ - Group: v1.OfflineVirtualMachineGroupVersionKind.Group, - Version: v1.OfflineVirtualMachineGroupVersionKind.Version, + Group: v1.VirtualMachineGroupVersionKind.Group, + Version: v1.VirtualMachineGroupVersionKind.Version, Scope: "Namespaced", Names: extensionsv1.CustomResourceDefinitionNames{ - Plural: "offlinevirtualmachines", - Singular: "offlinevirtualmachine", - Kind: v1.OfflineVirtualMachineGroupVersionKind.Kind, - ShortNames: []string{"ovm", "ovms"}, + Plural: "virtualmachines", + Singular: "virtualmachine", + Kind: v1.VirtualMachineGroupVersionKind.Kind, + ShortNames: []string{"vm", "vms"}, }, - Validation: crdutils.GetCustomResourceValidation("kubevirt.io/kubevirt/pkg/api/v1.OfflineVirtualMachine", v1.GetOpenAPIDefinitions), + Validation: crdutils.GetCustomResourceValidation("kubevirt.io/kubevirt/pkg/api/v1.VirtualMachine", definitionWrapper), } crdutils.MarshallCrd(crd, "yaml") } +func stripDescription(schema spec.Schema) spec.Schema { + schema.SchemaProps.Description = "" + + for key, val := range schema.SchemaProps.Properties { + schema.SchemaProps.Properties[key] = stripDescription(val) + } + return schema +} + +func definitionWrapper(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition { + definitions := v1.GetOpenAPIDefinitions(ref) + + for key, val := range definitions { + val.Schema = stripDescription(val.Schema) + definitions[key] = val + } + + return definitions +} + func generatePresetCrd() { crd := generateBlankCrd() - crd.ObjectMeta.Name = "virtualmachinepresets." + v1.VirtualMachinePresetGroupVersionKind.Group + crd.ObjectMeta.Name = "virtualmachineinstancepresets." + v1.VirtualMachineInstancePresetGroupVersionKind.Group crd.Spec = extensionsv1.CustomResourceDefinitionSpec{ - Group: v1.VirtualMachinePresetGroupVersionKind.Group, - Version: v1.VirtualMachinePresetGroupVersionKind.Version, + Group: v1.VirtualMachineInstancePresetGroupVersionKind.Group, + Version: v1.VirtualMachineInstancePresetGroupVersionKind.Version, Scope: "Namespaced", Names: extensionsv1.CustomResourceDefinitionNames{ - Plural: "virtualmachinepresets", - Singular: "virtualmachinepreset", - Kind: v1.VirtualMachinePresetGroupVersionKind.Kind, - ShortNames: []string{"vmpreset", "vmpresets"}, + Plural: "virtualmachineinstancepresets", + Singular: "virtualmachineinstancepreset", + Kind: v1.VirtualMachineInstancePresetGroupVersionKind.Kind, + ShortNames: []string{"vmipreset", "vmipresets"}, }, - Validation: crdutils.GetCustomResourceValidation("kubevirt.io/kubevirt/pkg/api/v1.VirtualMachinePreset", v1.GetOpenAPIDefinitions), + Validation: crdutils.GetCustomResourceValidation("kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineInstancePreset", definitionWrapper), } crdutils.MarshallCrd(crd, "yaml") @@ -90,58 +112,58 @@ func generatePresetCrd() { func generateReplicaSetCrd() { crd := generateBlankCrd() - crd.ObjectMeta.Name = "virtualmachinereplicasets." + v1.VMReplicaSetGroupVersionKind.Group + crd.ObjectMeta.Name = "virtualmachineinstancereplicasets." + v1.VirtualMachineInstanceReplicaSetGroupVersionKind.Group crd.Spec = extensionsv1.CustomResourceDefinitionSpec{ - Group: v1.VMReplicaSetGroupVersionKind.Group, - Version: v1.VMReplicaSetGroupVersionKind.Version, + Group: v1.VirtualMachineInstanceReplicaSetGroupVersionKind.Group, + Version: v1.VirtualMachineInstanceReplicaSetGroupVersionKind.Version, Scope: "Namespaced", Names: extensionsv1.CustomResourceDefinitionNames{ - Plural: "virtualmachinereplicasets", - Singular: "virtualmachinereplicaset", - Kind: v1.VMReplicaSetGroupVersionKind.Kind, - ShortNames: []string{"vmrs", "vmrss"}, + Plural: "virtualmachineinstancereplicasets", + Singular: "virtualmachineinstancereplicaset", + Kind: v1.VirtualMachineInstanceReplicaSetGroupVersionKind.Kind, + ShortNames: []string{"vmirs", "vmirss"}, }, - Validation: crdutils.GetCustomResourceValidation("kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineReplicaSet", v1.GetOpenAPIDefinitions), + Validation: crdutils.GetCustomResourceValidation("kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineInstanceReplicaSet", definitionWrapper), } crdutils.MarshallCrd(crd, "yaml") } -func generateVirtualMachineCrd() { +func generateVirtualMachineInstanceCrd() { crd := generateBlankCrd() - crd.ObjectMeta.Name = "virtualmachines." + v1.VirtualMachineGroupVersionKind.Group + crd.ObjectMeta.Name = "virtualmachineinstances." + v1.VirtualMachineInstanceGroupVersionKind.Group crd.Spec = extensionsv1.CustomResourceDefinitionSpec{ - Group: v1.VirtualMachineGroupVersionKind.Group, - Version: v1.VirtualMachineGroupVersionKind.Version, + Group: v1.VirtualMachineInstanceGroupVersionKind.Group, + Version: v1.VirtualMachineInstanceGroupVersionKind.Version, Scope: "Namespaced", Names: extensionsv1.CustomResourceDefinitionNames{ - Plural: "virtualmachines", - Singular: "virtualmachine", - Kind: v1.VirtualMachineGroupVersionKind.Kind, - ShortNames: []string{"vm", "vms"}, + Plural: "virtualmachineinstances", + Singular: "virtualmachineinstance", + Kind: v1.VirtualMachineInstanceGroupVersionKind.Kind, + ShortNames: []string{"vmi", "vmis"}, }, - Validation: crdutils.GetCustomResourceValidation("kubevirt.io/kubevirt/pkg/api/v1.VirtualMachine", v1.GetOpenAPIDefinitions), + Validation: crdutils.GetCustomResourceValidation("kubevirt.io/kubevirt/pkg/api/v1.VirtualMachineInstance", definitionWrapper), } crdutils.MarshallCrd(crd, "yaml") } func main() { - crdType := flag.String("crd-type", "", "Type of crd to generate. vm | vmpreset | vmrs | ovm") + crdType := flag.String("crd-type", "", "Type of crd to generate. vmi | vmipreset | vmirs | vm") flag.Parse() switch *crdType { - case "vm": - generateVirtualMachineCrd() - case "vmpreset": + case "vmi": + generateVirtualMachineInstanceCrd() + case "vmipreset": generatePresetCrd() - case "vmrs": + case "vmirs": generateReplicaSetCrd() - case "ovm": - generateOfflineVirtualMachineCrd() + case "vm": + generateVirtualMachineCrd() default: panic(fmt.Errorf("unknown crd type %s", *crdType)) } diff --git a/vendor/kubevirt.io/kubevirt/tools/vms-generator/types.go b/vendor/kubevirt.io/kubevirt/tools/vms-generator/types.go new file mode 100644 index 000000000..e81212904 --- /dev/null +++ b/vendor/kubevirt.io/kubevirt/tools/vms-generator/types.go @@ -0,0 +1,229 @@ +package main + +import ( + kapi "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" +) + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// Template contains the inputs needed to produce a Config. +type Template struct { + metav1.TypeMeta + metav1.ObjectMeta `json:"metadata"` + + // message is an optional instructional message that will + // be displayed when this template is instantiated. + // This field should inform the user how to utilize the newly created resources. + // Parameter substitution will be performed on the message before being + // displayed so that generated credentials and other parameters can be + // included in the output. + Message string `json:"message,omitempty"` + + // parameters is an optional array of Parameters used during the + // Template to Config transformation. + Parameters []Parameter `json:"parameters,omitempty"` + + // objects is an array of resources to include in this template. + // If a namespace value is hardcoded in the object, it will be removed + // during template instantiation, however if the namespace value + // is, or contains, a ${PARAMETER_REFERENCE}, the resolved + // value after parameter substitution will be respected and the object + // will be created in that namespace. + Objects []runtime.Object `json:"objects"` + + // objectLabels is an optional set of labels that are applied to every + // object during the Template to Config transformation. + ObjectLabels map[string]string `json:"objectLabels,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// TemplateList is a list of Template objects. +type TemplateList struct { + metav1.TypeMeta + metav1.ListMeta + Items []Template +} + +// Parameter defines a name/value variable that is to be processed during +// the Template to Config transformation. +type Parameter struct { + // Required: Parameter name must be set and it can be referenced in Template + // Items using ${PARAMETER_NAME} + Name string `json:"name"` + + // Optional: The name that will show in UI instead of parameter 'Name' + DisplayName string `json:"displayName,omitempty"` + + // Optional: Parameter can have description + Description string `json:"description,omitempty"` + + // Optional: Value holds the Parameter data. If specified, the generator + // will be ignored. The value replaces all occurrences of the Parameter + // ${Name} expression during the Template to Config transformation. + Value string `json:"value,omitempty"` + + // Optional: Generate specifies the generator to be used to generate + // random string from an input value specified by From field. The result + // string is stored into Value field. If empty, no generator is being + // used, leaving the result Value untouched. + Generate string `json:"generate,omitempty"` + + // Optional: From is an input value for the generator. + From string `json:"from,omitempty"` + + // Optional: Indicates the parameter must have a value. Defaults to false. + Required bool `json:"required,omitempty"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// TemplateInstance requests and records the instantiation of a Template. +// TemplateInstance is part of an experimental API. +type TemplateInstance struct { + metav1.TypeMeta + metav1.ObjectMeta + + // Spec describes the desired state of this TemplateInstance. + Spec TemplateInstanceSpec + + // Status describes the current state of this TemplateInstance. + Status TemplateInstanceStatus +} + +// TemplateInstanceSpec describes the desired state of a TemplateInstance. +type TemplateInstanceSpec struct { + // Template is a full copy of the template for instantiation. + Template Template + + // Secret is a reference to a Secret object containing the necessary + // template parameters. + Secret *kapi.LocalObjectReference + + // Requester holds the identity of the agent requesting the template + // instantiation. + Requester *TemplateInstanceRequester +} + +// TemplateInstanceRequester holds the identity of an agent requesting a +// template instantiation. +type TemplateInstanceRequester struct { + // username uniquely identifies this user among all active users. + Username string + + // uid is a unique value that identifies this user across time; if this user is + // deleted and another user by the same name is added, they will have + // different UIDs. + UID string + + // groups represent the groups this user is a part of. + Groups []string + + // extra holds additional information provided by the authenticator. + Extra map[string]ExtraValue +} + +// ExtraValue masks the value so protobuf can generate +type ExtraValue []string + +// TemplateInstanceStatus describes the current state of a TemplateInstance. +type TemplateInstanceStatus struct { + // Conditions represent the latest available observations of a + // TemplateInstance's current state. + Conditions []TemplateInstanceCondition + + // Objects references the objects created by the TemplateInstance. + Objects []TemplateInstanceObject +} + +// TemplateInstanceCondition contains condition information for a +// TemplateInstance. +type TemplateInstanceCondition struct { + // Type of the condition, currently Ready or InstantiateFailure. + Type TemplateInstanceConditionType + // Status of the condition, one of True, False or Unknown. + Status kapi.ConditionStatus + // LastTransitionTime is the last time a condition status transitioned from + // one state to another. + LastTransitionTime metav1.Time + // Reason is a brief machine readable explanation for the condition's last + // transition. + Reason string + // Message is a human readable description of the details of the last + // transition, complementing reason. + Message string +} + +// TemplateInstanceConditionType is the type of condition pertaining to a +// TemplateInstance. +type TemplateInstanceConditionType string + +const ( + // TemplateInstanceReady indicates the readiness of the template + // instantiation. + TemplateInstanceReady TemplateInstanceConditionType = "Ready" + // TemplateInstanceInstantiateFailure indicates the failure of the template + // instantiation + TemplateInstanceInstantiateFailure TemplateInstanceConditionType = "InstantiateFailure" +) + +// TemplateInstanceObject references an object created by a TemplateInstance. +type TemplateInstanceObject struct { + // ref is a reference to the created object. + Ref kapi.ObjectReference +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// TemplateInstanceList is a list of TemplateInstance objects. +type TemplateInstanceList struct { + metav1.TypeMeta + metav1.ListMeta + + // Items is a list of Templateinstances + Items []TemplateInstance +} + +// +genclient +// +genclient:nonNamespaced +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// BrokerTemplateInstance holds the service broker-related state associated with +// a TemplateInstance. BrokerTemplateInstance is part of an experimental API. +type BrokerTemplateInstance struct { + metav1.TypeMeta + metav1.ObjectMeta + + // Spec describes the state of this BrokerTemplateInstance. + Spec BrokerTemplateInstanceSpec +} + +// BrokerTemplateInstanceSpec describes the state of a BrokerTemplateInstance. +type BrokerTemplateInstanceSpec struct { + // TemplateInstance is a reference to a TemplateInstance object residing + // in a namespace. + TemplateInstance kapi.ObjectReference + + // Secret is a reference to a Secret object residing in a namespace, + // containing the necessary template parameters. + Secret kapi.ObjectReference + + // BindingIDs is a list of 'binding_id's provided during successive bind + // calls to the template service broker. + BindingIDs []string +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// BrokerTemplateInstanceList is a list of BrokerTemplateInstance objects. +type BrokerTemplateInstanceList struct { + metav1.TypeMeta + metav1.ListMeta + + // Items is a list of BrokerTemplateInstances + Items []BrokerTemplateInstance +} diff --git a/vendor/kubevirt.io/kubevirt/tools/vms-generator/vms-generator.go b/vendor/kubevirt.io/kubevirt/tools/vms-generator/vms-generator.go index 91b69a005..4690d529f 100644 --- a/vendor/kubevirt.io/kubevirt/tools/vms-generator/vms-generator.go +++ b/vendor/kubevirt.io/kubevirt/tools/vms-generator/vms-generator.go @@ -20,10 +20,10 @@ package main import ( - "encoding/base64" "flag" "fmt" "io/ioutil" + "os" "path/filepath" "github.com/ghodss/yaml" @@ -33,27 +33,38 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" + "encoding/json" + + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "k8s.io/apimachinery/pkg/runtime" + k8sfield "k8s.io/apimachinery/pkg/util/validation/field" + "kubevirt.io/kubevirt/pkg/api/v1" + "kubevirt.io/kubevirt/pkg/virt-api/validating-webhook" ) const ( - vmEphemeral = "vm-ephemeral" - vmFlavorSmall = "vm-flavor-small" - vmSata = "vm-sata" - vmFedora = "vm-fedora" - vmNoCloud = "vm-nocloud" - vmPvc = "vm-pvc" - vmWindows = "vm-windows" + vmiEphemeral = "vmi-ephemeral" + vmiFlavorSmall = "vmi-flavor-small" + vmiSata = "vmi-sata" + vmiFedora = "vmi-fedora" + vmiNoCloud = "vmi-nocloud" + vmiPVC = "vmi-pvc" + vmiWindows = "vmi-windows" + vmiSlirp = "vmi-slirp" + vmTemplateFedora = "vm-template-fedora" + vmTemplateRHEL7 = "vm-template-rhel7" + vmTemplateWindows = "vm-template-windows2012r2" ) const ( - ovmCirros = "ovm-cirros" - ovmAlpineMultiPvc = "ovm-alpine-multipvc" + vmCirros = "vm-cirros" + vmAlpineMultiPvc = "vm-alpine-multipvc" ) -const vmReplicaSetCirros = "vm-replicaset-cirros" +const vmiReplicaSetCirros = "vmi-replicaset-cirros" -const vmPresetSmall = "vm-preset-small" +const vmiPresetSmall = "vmi-preset-small" const ( busVirtio = "virtio" @@ -67,15 +78,15 @@ const ( const windowsFirmware = "5d307ca9-b3ef-428c-8861-06e72d69f223" -const apiVersion = "kubevirt.io/v1alpha1" +const apiVersion = "kubevirt.io/v1alpha2" -var dockerPrefix = "kubevirt" +var dockerPrefix = "registry:5000/kubevirt" var dockerTag = "devel" var gracePeriod = int64(0) -func getBaseVmSpec() *v1.VirtualMachineSpec { - return &v1.VirtualMachineSpec{ +func getBaseVMISpec() *v1.VirtualMachineInstanceSpec { + return &v1.VirtualMachineInstanceSpec{ TerminationGracePeriodSeconds: &gracePeriod, Domain: v1.DomainSpec{ Resources: v1.ResourceRequirements{ @@ -87,22 +98,23 @@ func getBaseVmSpec() *v1.VirtualMachineSpec { } } -func getBaseVm(name string) *v1.VirtualMachine { - baseVmSpec := getBaseVmSpec() +func getBaseVMI(name string) *v1.VirtualMachineInstance { + baseVMISpec := getBaseVMISpec() - return &v1.VirtualMachine{ + return &v1.VirtualMachineInstance{ TypeMeta: metav1.TypeMeta{ APIVersion: apiVersion, - Kind: "VirtualMachine", + Kind: "VirtualMachineInstance", }, ObjectMeta: metav1.ObjectMeta{ - Name: name, + Name: name, + Labels: map[string]string{"special": name}, }, - Spec: *baseVmSpec, + Spec: *baseVMISpec, } } -func addRegistryDisk(spec *v1.VirtualMachineSpec, image string, bus string) *v1.VirtualMachineSpec { +func addRegistryDisk(spec *v1.VirtualMachineInstanceSpec, image string, bus string) *v1.VirtualMachineInstanceSpec { spec.Domain.Devices = v1.Devices{ Disks: []v1.Disk{ { @@ -129,7 +141,11 @@ func addRegistryDisk(spec *v1.VirtualMachineSpec, image string, bus string) *v1. return spec } -func addNoCloudDisk(spec *v1.VirtualMachineSpec) *v1.VirtualMachineSpec { +func addNoCloudDisk(spec *v1.VirtualMachineInstanceSpec) *v1.VirtualMachineInstanceSpec { + return addNoCloudDiskWitUserData(spec, "#!/bin/sh\n\necho 'printed from cloud-init userdata'\n") +} + +func addNoCloudDiskWitUserData(spec *v1.VirtualMachineInstanceSpec, data string) *v1.VirtualMachineInstanceSpec { spec.Domain.Devices.Disks = append(spec.Domain.Devices.Disks, v1.Disk{ Name: "cloudinitdisk", VolumeName: "cloudinitvolume", @@ -140,19 +156,18 @@ func addNoCloudDisk(spec *v1.VirtualMachineSpec) *v1.VirtualMachineSpec { }, }) - userData := fmt.Sprint("#!/bin/sh\n\necho 'printed from cloud-init userdata'\n") spec.Volumes = append(spec.Volumes, v1.Volume{ Name: "cloudinitvolume", VolumeSource: v1.VolumeSource{ CloudInitNoCloud: &v1.CloudInitNoCloudSource{ - UserDataBase64: base64.StdEncoding.EncodeToString([]byte(userData)), + UserData: data, }, }, }) return spec } -func addEmptyDisk(spec *v1.VirtualMachineSpec, size string) *v1.VirtualMachineSpec { +func addEmptyDisk(spec *v1.VirtualMachineInstanceSpec, size string) *v1.VirtualMachineInstanceSpec { spec.Domain.Devices.Disks = append(spec.Domain.Devices.Disks, v1.Disk{ Name: "emptydisk", VolumeName: "emptydiskvolume", @@ -174,10 +189,10 @@ func addEmptyDisk(spec *v1.VirtualMachineSpec, size string) *v1.VirtualMachineSp return spec } -func addPvcDisk(spec *v1.VirtualMachineSpec, claimName string, bus string) *v1.VirtualMachineSpec { +func addPVCDisk(spec *v1.VirtualMachineInstanceSpec, claimName string, bus string, diskName string, volumeName string) *v1.VirtualMachineInstanceSpec { spec.Domain.Devices.Disks = append(spec.Domain.Devices.Disks, v1.Disk{ - Name: "pvcdisk", - VolumeName: "pvcvolume", + Name: diskName, + VolumeName: volumeName, DiskDevice: v1.DiskDevice{ Disk: &v1.DiskTarget{ Bus: bus, @@ -186,7 +201,7 @@ func addPvcDisk(spec *v1.VirtualMachineSpec, claimName string, bus string) *v1.V }) spec.Volumes = append(spec.Volumes, v1.Volume{ - Name: "pvcvolume", + Name: volumeName, VolumeSource: v1.VolumeSource{ PersistentVolumeClaim: &k8sv1.PersistentVolumeClaimVolumeSource{ ClaimName: claimName, @@ -196,63 +211,78 @@ func addPvcDisk(spec *v1.VirtualMachineSpec, claimName string, bus string) *v1.V return spec } -func getVmEphemeral() *v1.VirtualMachine { - vm := getBaseVm(vmEphemeral) +func getVMIEphemeral() *v1.VirtualMachineInstance { + vmi := getBaseVMI(vmiEphemeral) - addRegistryDisk(&vm.Spec, fmt.Sprintf("%s/%s:%s", dockerPrefix, imageCirros, dockerTag), busVirtio) - return vm + addRegistryDisk(&vmi.Spec, fmt.Sprintf("%s/%s:%s", dockerPrefix, imageCirros, dockerTag), busVirtio) + return vmi } -func getVmSata() *v1.VirtualMachine { - vm := getBaseVm(vmSata) +func getVMISata() *v1.VirtualMachineInstance { + vmi := getBaseVMI(vmiSata) - addRegistryDisk(&vm.Spec, fmt.Sprintf("%s/%s:%s", dockerPrefix, imageCirros, dockerTag), busSata) - return vm + addRegistryDisk(&vmi.Spec, fmt.Sprintf("%s/%s:%s", dockerPrefix, imageCirros, dockerTag), busSata) + return vmi } -func getVmEphemeralFedora() *v1.VirtualMachine { - vm := getBaseVm(vmFedora) +func getVMIEphemeralFedora() *v1.VirtualMachineInstance { + vmi := getBaseVMI(vmiFedora) + vmi.Spec.Domain.Resources.Requests[k8sv1.ResourceMemory] = resource.MustParse("1024M") + + addRegistryDisk(&vmi.Spec, fmt.Sprintf("%s/%s:%s", dockerPrefix, imageFedora, dockerTag), busVirtio) + addNoCloudDiskWitUserData(&vmi.Spec, "#cloud-config\npassword: fedora\nchpasswd: { expire: False }") + return vmi +} + +func getVMISlirp() *v1.VirtualMachineInstance { + vm := getBaseVMI(vmiSlirp) vm.Spec.Domain.Resources.Requests[k8sv1.ResourceMemory] = resource.MustParse("1024M") + vm.Spec.Networks = []v1.Network{v1.Network{Name: "testSlirp", NetworkSource: v1.NetworkSource{Pod: &v1.PodNetwork{}}}} addRegistryDisk(&vm.Spec, fmt.Sprintf("%s/%s:%s", dockerPrefix, imageFedora, dockerTag), busVirtio) - addNoCloudDisk(&vm.Spec) + addNoCloudDiskWitUserData(&vm.Spec, "#!/bin/bash\necho \"fedora\" |passwd fedora --stdin\nyum install -y nginx\nsystemctl enable nginx\nsystemctl start nginx") + + slirp := &v1.InterfaceSlirp{} + ports := []v1.Port{v1.Port{Name: "http", Protocol: "TCP", Port: 80}} + vm.Spec.Domain.Devices.Interfaces = []v1.Interface{v1.Interface{Name: "testSlirp", Ports: ports, InterfaceBindingMethod: v1.InterfaceBindingMethod{Slirp: slirp}}} + return vm } -func getVmNoCloud() *v1.VirtualMachine { - vm := getBaseVm(vmNoCloud) +func getVMINoCloud() *v1.VirtualMachineInstance { + vmi := getBaseVMI(vmiNoCloud) - addRegistryDisk(&vm.Spec, fmt.Sprintf("%s/%s:%s", dockerPrefix, imageCirros, dockerTag), busVirtio) - addNoCloudDisk(&vm.Spec) - addEmptyDisk(&vm.Spec, "2Gi") - return vm + addRegistryDisk(&vmi.Spec, fmt.Sprintf("%s/%s:%s", dockerPrefix, imageCirros, dockerTag), busVirtio) + addNoCloudDisk(&vmi.Spec) + addEmptyDisk(&vmi.Spec, "2Gi") + return vmi } -func getVmFlavorSmall() *v1.VirtualMachine { - vm := getBaseVm(vmFlavorSmall) - vm.ObjectMeta.Labels = map[string]string{ +func getVMIFlavorSmall() *v1.VirtualMachineInstance { + vmi := getBaseVMI(vmiFlavorSmall) + vmi.ObjectMeta.Labels = map[string]string{ "kubevirt.io/flavor": "small", } - addRegistryDisk(&vm.Spec, fmt.Sprintf("%s/%s:%s", dockerPrefix, imageCirros, dockerTag), busVirtio) - return vm + addRegistryDisk(&vmi.Spec, fmt.Sprintf("%s/%s:%s", dockerPrefix, imageCirros, dockerTag), busVirtio) + return vmi } -func getVmPvc() *v1.VirtualMachine { - vm := getBaseVm(vmPvc) +func getVMIPvc() *v1.VirtualMachineInstance { + vmi := getBaseVMI(vmiPVC) - addPvcDisk(&vm.Spec, "disk-alpine", busVirtio) - return vm + addPVCDisk(&vmi.Spec, "disk-alpine", busVirtio, "pvcdisk", "pvcvolume") + return vmi } -func getVmWindows() *v1.VirtualMachine { - vm := getBaseVm(vmWindows) +func getVMIWindows() *v1.VirtualMachineInstance { + vmi := getBaseVMI(vmiWindows) gracePeriod := int64(0) spinlocks := uint32(8191) firmware := types.UID(windowsFirmware) _false := false - vm.Spec = v1.VirtualMachineSpec{ + vmi.Spec = v1.VirtualMachineInstanceSpec{ TerminationGracePeriodSeconds: &gracePeriod, Domain: v1.DomainSpec{ CPU: &v1.CPU{Cores: 2}, @@ -265,6 +295,7 @@ func getVmWindows() *v1.VirtualMachine { Spinlocks: &v1.FeatureSpinlocks{Retries: &spinlocks}, }, }, + Machine: v1.Machine{Type: "q35"}, Clock: &v1.Clock{ ClockOffset: v1.ClockOffset{UTC: &v1.ClockOffsetUTC{}}, Timer: &v1.Timer{ @@ -280,104 +311,251 @@ func getVmWindows() *v1.VirtualMachine { k8sv1.ResourceMemory: resource.MustParse("2048Mi"), }, }, + Devices: v1.Devices{ + Interfaces: []v1.Interface{*v1.DefaultNetworkInterface()}, + }, }, + Networks: []v1.Network{*v1.DefaultPodNetwork()}, } - addPvcDisk(&vm.Spec, "disk-windows", busSata) - return vm + // pick e1000 network model type for windows machines + vmi.Spec.Domain.Devices.Interfaces[0].Model = "e1000" + + addPVCDisk(&vmi.Spec, "disk-windows", busSata, "pvcdisk", "pvcvolume") + return vmi } -func getBaseOvm(name string, labels map[string]string) *v1.OfflineVirtualMachine { - baseVmSpec := getBaseVmSpec() +func getBaseVM(name string, labels map[string]string) *v1.VirtualMachine { + baseVMISpec := getBaseVMISpec() - return &v1.OfflineVirtualMachine{ + return &v1.VirtualMachine{ TypeMeta: metav1.TypeMeta{ APIVersion: apiVersion, - Kind: "OfflineVirtualMachine", + Kind: "VirtualMachine", }, ObjectMeta: metav1.ObjectMeta{ Name: name, Labels: labels, }, - Spec: v1.OfflineVirtualMachineSpec{ + Spec: v1.VirtualMachineSpec{ Running: false, - Template: &v1.VMTemplateSpec{ + Template: &v1.VirtualMachineInstanceTemplateSpec{ ObjectMeta: metav1.ObjectMeta{ Labels: labels, }, - Spec: *baseVmSpec, + Spec: *baseVMISpec, }, }, } } -func getOvmCirros() *v1.OfflineVirtualMachine { - ovm := getBaseOvm(ovmCirros, map[string]string{ - "kubevirt.io/ovm": ovmCirros, +func getVMCirros() *v1.VirtualMachine { + vm := getBaseVM(vmCirros, map[string]string{ + "kubevirt.io/vm": vmCirros, }) - addRegistryDisk(&ovm.Spec.Template.Spec, fmt.Sprintf("%s/%s:%s", dockerPrefix, imageCirros, dockerTag), busVirtio) - addNoCloudDisk(&ovm.Spec.Template.Spec) - return ovm + addRegistryDisk(&vm.Spec.Template.Spec, fmt.Sprintf("%s/%s:%s", dockerPrefix, imageCirros, dockerTag), busVirtio) + addNoCloudDisk(&vm.Spec.Template.Spec) + return vm } -func getOvmMultiPvc() *v1.OfflineVirtualMachine { - ovm := getBaseOvm(ovmAlpineMultiPvc, map[string]string{ - "kubevirt.io/ovm": ovmAlpineMultiPvc, +func getTemplateFedora() *Template { + vm := getBaseVM("", map[string]string{"kubevirt-vm": "vm-${NAME}"}) + addRegistryDisk(&vm.Spec.Template.Spec, fmt.Sprintf("%s/%s:%s", dockerPrefix, imageFedora, dockerTag), busVirtio) + addNoCloudDiskWitUserData(&vm.Spec.Template.Spec, "#cloud-config\npassword: fedora\nchpasswd: { expire: False }") + + template := getBaseTemplate(vm, "4096Mi", "4") + template.ObjectMeta = metav1.ObjectMeta{ + Name: vmTemplateFedora, + Annotations: map[string]string{ + "description": "OCP KubeVirt Fedora 27 VM template", + "tags": "kubevirt,ocp,template,linux,virtualmachine", + "iconClass": "icon-fedora", + }, + Labels: map[string]string{ + "kubevirt.io/os": "fedora27", + "miq.github.io/kubevirt-is-vm-template": "true", + }, + } + return template +} + +func getTemplateRHEL7() *Template { + vm := getBaseVM("", map[string]string{"kubevirt-vm": "vm-${NAME}"}) + addPVCDisk(&vm.Spec.Template.Spec, "linux-vm-pvc-${NAME}", busVirtio, "disk0", "disk0-pvc") + + pvc := getPVCForTemplate("linux-vm-pvc-${NAME}") + + template := getBaseTemplate(vm, "4096Mi", "4") + template.ObjectMeta = metav1.ObjectMeta{ + Name: vmTemplateRHEL7, + Annotations: map[string]string{ + "iconClass": "icon-rhel", + "description": "OCP KubeVirt Red Hat Enterprise Linux 7.4 VM template", + "tags": "kubevirt,ocp,template,linux,virtualmachine", + }, + Labels: map[string]string{ + "kubevirt.io/os": "rhel-7.4", + "miq.github.io/kubevirt-is-vm-template": "true", + }, + } + template.Objects = append(template.Objects, pvc) + return template +} + +func getTemplateWindows() *Template { + vm := getBaseVM("", map[string]string{"kubevirt-vm": "vm-${NAME}"}) + windows := getVMIWindows() + vm.Spec.Template.Spec = windows.Spec + vm.Spec.Template.ObjectMeta.Annotations = windows.ObjectMeta.Annotations + addPVCDisk(&vm.Spec.Template.Spec, "windows-vm-pvc-${NAME}", busVirtio, "disk0", "disk0-pvc") + + pvc := getPVCForTemplate("windows-vm-pvc-${NAME}") + + template := getBaseTemplate(vm, "4096Mi", "4") + template.ObjectMeta = metav1.ObjectMeta{ + Name: vmTemplateWindows, + Annotations: map[string]string{ + "iconClass": "icon-windows", + "description": "OCP KubeVirt Microsoft Windows Server 2012 R2 VM template", + "tags": "kubevirt,ocp,template,windows,virtualmachine", + }, + Labels: map[string]string{ + "kubevirt.io/os": "win2k12r2", + "miq.github.io/kubevirt-is-vm-template": "true", + }, + } + template.Objects = append(template.Objects, pvc) + return template +} + +func getPVCForTemplate(name string) *k8sv1.PersistentVolumeClaim { + + return &k8sv1.PersistentVolumeClaim{ + TypeMeta: metav1.TypeMeta{ + Kind: "PersistentVolumeClaim", + APIVersion: "v1", + }, + ObjectMeta: metav1.ObjectMeta{ + Name: name, + }, + Spec: k8sv1.PersistentVolumeClaimSpec{ + AccessModes: []k8sv1.PersistentVolumeAccessMode{k8sv1.ReadWriteOnce}, + Resources: k8sv1.ResourceRequirements{ + Requests: k8sv1.ResourceList{ + k8sv1.ResourceStorage: resource.MustParse("10Gi"), + }, + }, + }, + } +} + +func getBaseTemplate(vm *v1.VirtualMachine, memory string, cores string) *Template { + + obj := toUnstructured(vm) + unstructured.SetNestedField(obj.Object, "${{CPU_CORES}}", "spec", "template", "spec", "domain", "cpu", "cores") + unstructured.SetNestedField(obj.Object, "${MEMORY}", "spec", "template", "spec", "domain", "resources", "requests", "memory") + obj.SetName("${NAME}") + + return &Template{ + TypeMeta: metav1.TypeMeta{ + Kind: "Template", + APIVersion: "v1", + }, + Objects: []runtime.Object{ + obj, + }, + Parameters: templateParameters(memory, cores), + } +} + +func toUnstructured(object runtime.Object) *unstructured.Unstructured { + raw, err := json.Marshal(object) + if err != nil { + panic(err) + } + var objmap map[string]interface{} + err = json.Unmarshal(raw, &objmap) + + return &unstructured.Unstructured{Object: objmap} +} + +func templateParameters(memory string, cores string) []Parameter { + return []Parameter{ + { + Name: "NAME", + Description: "Name for the new VM", + }, + { + Name: "MEMORY", + Description: "Amount of memory", + Value: memory, + }, + { + Name: "CPU_CORES", + Description: "Amount of cores", + Value: cores, + }, + } +} + +func getVMMultiPvc() *v1.VirtualMachine { + vm := getBaseVM(vmAlpineMultiPvc, map[string]string{ + "kubevirt.io/vm": vmAlpineMultiPvc, }) - addPvcDisk(&ovm.Spec.Template.Spec, "disk-alpine", busVirtio) - addPvcDisk(&ovm.Spec.Template.Spec, "disk-custom", busVirtio) + addPVCDisk(&vm.Spec.Template.Spec, "disk-alpine", busVirtio, "pvcdisk1", "pvcvolume1") + addPVCDisk(&vm.Spec.Template.Spec, "disk-custom", busVirtio, "pvcdisk2", "pvcvolume2") - return ovm + return vm } -func getBaseVmReplicaSet(name string, replicas int, selectorLabels map[string]string) *v1.VirtualMachineReplicaSet { - baseVmSpec := getBaseVmSpec() +func getBaseVMIReplicaSet(name string, replicas int, selectorLabels map[string]string) *v1.VirtualMachineInstanceReplicaSet { + baseVMISpec := getBaseVMISpec() replicasInt32 := int32(replicas) - return &v1.VirtualMachineReplicaSet{ + return &v1.VirtualMachineInstanceReplicaSet{ TypeMeta: metav1.TypeMeta{ APIVersion: apiVersion, - Kind: "VirtualMachineReplicaSet", + Kind: "VirtualMachineInstanceReplicaSet", }, ObjectMeta: metav1.ObjectMeta{ Name: name, }, - Spec: v1.VMReplicaSetSpec{ + Spec: v1.VirtualMachineInstanceReplicaSetSpec{ Replicas: &replicasInt32, Selector: &metav1.LabelSelector{ MatchLabels: selectorLabels, }, - Template: &v1.VMTemplateSpec{ + Template: &v1.VirtualMachineInstanceTemplateSpec{ ObjectMeta: metav1.ObjectMeta{ Labels: selectorLabels, }, - Spec: *baseVmSpec, + Spec: *baseVMISpec, }, }, } } -func getVmReplicaSetCirros() *v1.VirtualMachineReplicaSet { - vmReplicaSet := getBaseVmReplicaSet(vmReplicaSetCirros, 3, map[string]string{ - "kubevirt.io/vmReplicaSet": vmReplicaSetCirros, +func getVMIReplicaSetCirros() *v1.VirtualMachineInstanceReplicaSet { + vmReplicaSet := getBaseVMIReplicaSet(vmiReplicaSetCirros, 3, map[string]string{ + "kubevirt.io/vmReplicaSet": vmiReplicaSetCirros, }) addRegistryDisk(&vmReplicaSet.Spec.Template.Spec, fmt.Sprintf("%s/%s:%s", dockerPrefix, imageCirros, dockerTag), busVirtio) return vmReplicaSet } -func getBaseVmPreset(name string, selectorLabels map[string]string) *v1.VirtualMachinePreset { - return &v1.VirtualMachinePreset{ +func getBaseVMIPreset(name string, selectorLabels map[string]string) *v1.VirtualMachineInstancePreset { + return &v1.VirtualMachineInstancePreset{ TypeMeta: metav1.TypeMeta{ APIVersion: apiVersion, - Kind: "VirtualMachinePreset", + Kind: "VirtualMachineInstancePreset", }, ObjectMeta: metav1.ObjectMeta{ Name: name, }, - Spec: v1.VirtualMachinePresetSpec{ + Spec: v1.VirtualMachineInstancePresetSpec{ Selector: metav1.LabelSelector{ MatchLabels: selectorLabels, }, @@ -385,12 +563,12 @@ func getBaseVmPreset(name string, selectorLabels map[string]string) *v1.VirtualM } } -func getVmPresetSmall() *v1.VirtualMachinePreset { - vmPreset := getBaseVmPreset(vmPresetSmall, map[string]string{ - "kubevirt.io/vmPreset": vmPresetSmall, +func getVMIPresetSmall() *v1.VirtualMachineInstancePreset { + vmPreset := getBaseVMIPreset(vmiPresetSmall, map[string]string{ + "kubevirt.io/vmPreset": vmiPresetSmall, }) - vmPreset.Spec.Domain = &v1.DomainSpec{ + vmPreset.Spec.Domain = &v1.DomainPresetSpec{ Resources: v1.ResourceRequirements{ Requests: k8sv1.ResourceList{ k8sv1.ResourceMemory: resource.MustParse("64M"), @@ -406,28 +584,96 @@ func main() { genDir := flag.String("generated-vms-dir", "", "") flag.Parse() - var vms = map[string]interface{}{ - vmEphemeral: getVmEphemeral(), - vmFlavorSmall: getVmFlavorSmall(), - vmSata: getVmSata(), - vmFedora: getVmEphemeralFedora(), - vmNoCloud: getVmNoCloud(), - vmPvc: getVmPvc(), - vmWindows: getVmWindows(), - ovmCirros: getOvmCirros(), - ovmAlpineMultiPvc: getOvmMultiPvc(), - vmReplicaSetCirros: getVmReplicaSetCirros(), - vmPresetSmall: getVmPresetSmall(), + var vms = map[string]*v1.VirtualMachine{ + vmCirros: getVMCirros(), + vmAlpineMultiPvc: getVMMultiPvc(), } - for name, obj := range vms { + + var vmis = map[string]*v1.VirtualMachineInstance{ + vmiEphemeral: getVMIEphemeral(), + vmiFlavorSmall: getVMIFlavorSmall(), + vmiSata: getVMISata(), + vmiFedora: getVMIEphemeralFedora(), + vmiNoCloud: getVMINoCloud(), + vmiPVC: getVMIPvc(), + vmiWindows: getVMIWindows(), + vmiSlirp: getVMISlirp(), + } + + var vmireplicasets = map[string]*v1.VirtualMachineInstanceReplicaSet{ + vmiReplicaSetCirros: getVMIReplicaSetCirros(), + } + + var vmipresets = map[string]*v1.VirtualMachineInstancePreset{ + vmiPresetSmall: getVMIPresetSmall(), + } + + var templates = map[string]*Template{ + vmTemplateFedora: getTemplateFedora(), + vmTemplateRHEL7: getTemplateRHEL7(), + vmTemplateWindows: getTemplateWindows(), + } + + handleError := func(err error) { + if err != nil { + fmt.Fprintf(os.Stderr, "%s\n", err) + panic(err) + } + } + + handleCauses := func(causes []metav1.StatusCause, name string, objType string) { + if len(causes) > 0 { + for _, cause := range causes { + fmt.Fprintf( + os.Stderr, + "Failed to validate %s spec: failed to admit yaml for %s: %s at %s: %s\n", + objType, name, cause.Type, cause.Field, cause.Message) + } + panic(fmt.Errorf("Failed to admit %s of type %s", name, objType)) + } + } + + dumpObject := func(name string, obj interface{}) error { data, err := yaml.Marshal(obj) if err != nil { - fmt.Printf("Cannot marshal json: %s", fmt.Errorf("failed to generate yaml for vm %s", name)) + return fmt.Errorf("Failed to generate yaml for %s: %s", name, err) } err = ioutil.WriteFile(filepath.Join(*genDir, fmt.Sprintf("%s.yaml", name)), data, 0644) if err != nil { - fmt.Printf("Cannot write file: %s", fmt.Errorf("failed to write yaml file")) + return fmt.Errorf("Failed to write yaml file: %s", err) } + + return nil + } + + // Having no generics is lots of fun + for name, obj := range vms { + causes := validating_webhook.ValidateVirtualMachineSpec(k8sfield.NewPath("spec"), &obj.Spec) + handleCauses(causes, name, "vm") + handleError(dumpObject(name, *obj)) + } + + for name, obj := range vmis { + causes := validating_webhook.ValidateVirtualMachineInstanceSpec(k8sfield.NewPath("spec"), &obj.Spec) + handleCauses(causes, name, "vmi") + handleError(dumpObject(name, *obj)) + } + + for name, obj := range vmireplicasets { + causes := validating_webhook.ValidateVMIRSSpec(k8sfield.NewPath("spec"), &obj.Spec) + handleCauses(causes, name, "vmi replica set") + handleError(dumpObject(name, *obj)) + } + + for name, obj := range vmipresets { + causes := validating_webhook.ValidateVMIPresetSpec(k8sfield.NewPath("spec"), &obj.Spec) + handleCauses(causes, name, "vmi preset") + handleError(dumpObject(name, *obj)) + } + + // TODO:(ihar) how to validate templates? + for name, obj := range templates { + handleError(dumpObject(name, *obj)) } }