add protobuf generation

This commit is contained in:
jianhuiz 2016-04-22 14:53:55 -07:00
parent 384f801cb0
commit 3bdd4130cd
5 changed files with 1732 additions and 18 deletions

View File

@ -70,6 +70,7 @@ func New() *Generator {
`k8s.io/kubernetes/pkg/apis/autoscaling/v1`,
`k8s.io/kubernetes/pkg/apis/batch/v1`,
`k8s.io/kubernetes/pkg/apis/apps/v1alpha1`,
`k8s.io/kubernetes/federation/apis/federation/v1alpha1`,
}, ","),
DropEmbeddedFields: "k8s.io/kubernetes/pkg/api/unversioned.TypeMeta",
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,109 @@
/*
Copyright 2016 The Kubernetes Authors All rights reserved.
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.
*/
// This file was autogenerated by go-to-protobuf. Do not edit it manually!
syntax = 'proto2';
package k8s.io.kubernetes.federation.apis.federation.v1alpha1;
import "k8s.io/kubernetes/pkg/api/resource/generated.proto";
import "k8s.io/kubernetes/pkg/api/unversioned/generated.proto";
import "k8s.io/kubernetes/pkg/api/v1/generated.proto";
import "k8s.io/kubernetes/pkg/util/intstr/generated.proto";
// Package-wide variables from generator "generated".
option go_package = "v1alpha1";
// Information about a registered cluster in a federated kubernetes setup. Clusters are not namespaced and have unique names in the federation.
message Cluster {
// Standard object's metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
optional k8s.io.kubernetes.pkg.api.v1.ObjectMeta metadata = 1;
// Spec defines the behavior of the Cluster.
optional ClusterSpec spec = 2;
// Status describes the current status of a Cluster
optional ClusterStatus status = 3;
}
// ClusterCondition describes current state of a cluster.
message ClusterCondition {
// Type of cluster condition, Complete or Failed.
optional string type = 1;
// Status of the condition, one of True, False, Unknown.
optional string status = 2;
// Last time the condition was checked.
optional k8s.io.kubernetes.pkg.api.unversioned.Time lastProbeTime = 3;
// Last time the condition transit from one status to another.
optional k8s.io.kubernetes.pkg.api.unversioned.Time lastTransitionTime = 4;
// (brief) reason for the condition's last transition.
optional string reason = 5;
// Human readable message indicating details about last transition.
optional string message = 6;
}
// A list of all the kubernetes clusters registered to the federation
message ClusterList {
// Standard list metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds
optional k8s.io.kubernetes.pkg.api.unversioned.ListMeta metadata = 1;
// List of Cluster objects.
repeated Cluster items = 2;
}
// Cluster metadata
message ClusterMeta {
// Release version of the cluster.
optional string version = 1;
}
// ClusterSpec describes the attributes of a kubernetes cluster.
message ClusterSpec {
// A map of client CIDR to server address.
// 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.
repeated k8s.io.kubernetes.pkg.api.unversioned.ServerAddressByClientCIDR serverAddressByClientCIDRs = 1;
// the type (e.g. bearer token, client certificate etc) and data of the credential used to access cluster.
// Its used for system routines (not behalf of users)
// TODO: string may not enough, https://github.com/kubernetes/kubernetes/pull/23847#discussion_r59301275
optional string credential = 2;
}
// ClusterStatus is information about the current status of a cluster updated by cluster controller peridocally.
message ClusterStatus {
// Conditions is an array of current cluster conditions.
repeated ClusterCondition conditions = 1;
// Capacity represents the total resources of the cluster
map<string, k8s.io.kubernetes.pkg.api.resource.Quantity> capacity = 2;
// Allocatable represents the total resources of a cluster that are available for scheduling.
map<string, k8s.io.kubernetes.pkg.api.resource.Quantity> allocatable = 3;
optional ClusterMeta clusterMeta = 4;
}

View File

@ -27,11 +27,11 @@ type ClusterSpec struct {
// 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.
ServerAddressByClientCIDRs []unversioned.ServerAddressByClientCIDR `json:"serverAddressByClientCIDRs" patchStrategy:"merge" patchMergeKey:"clientCIDR"`
ServerAddressByClientCIDRs []unversioned.ServerAddressByClientCIDR `json:"serverAddressByClientCIDRs" patchStrategy:"merge" patchMergeKey:"clientCIDR" protobuf:"bytes,1,rep,name=serverAddressByClientCIDRs"`
// the type (e.g. bearer token, client certificate etc) and data of the credential used to access cluster.
// Its used for system routines (not behalf of users)
// TODO: string may not enough, https://github.com/kubernetes/kubernetes/pull/23847#discussion_r59301275
Credential string `json:"credential,omitempty"`
Credential string `json:"credential,omitempty" protobuf:"bytes,2,opt,name=credential"`
}
type ClusterConditionType string
@ -47,34 +47,34 @@ const (
// ClusterCondition describes current state of a cluster.
type ClusterCondition struct {
// Type of cluster condition, Complete or Failed.
Type ClusterConditionType `json:"type"`
Type ClusterConditionType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=ClusterConditionType"`
// Status of the condition, one of True, False, Unknown.
Status v1.ConditionStatus `json:"status"`
Status v1.ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status,casttype=k8s.io/kubernetes/pkg/api/v1.ConditionStatus"`
// Last time the condition was checked.
LastProbeTime unversioned.Time `json:"lastProbeTime,omitempty"`
LastProbeTime unversioned.Time `json:"lastProbeTime,omitempty" protobuf:"bytes,3,opt,name=lastProbeTime"`
// Last time the condition transit from one status to another.
LastTransitionTime unversioned.Time `json:"lastTransitionTime,omitempty"`
LastTransitionTime unversioned.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,4,opt,name=lastTransitionTime"`
// (brief) reason for the condition's last transition.
Reason string `json:"reason,omitempty"`
Reason string `json:"reason,omitempty" protobuf:"bytes,5,opt,name=reason"`
// Human readable message indicating details about last transition.
Message string `json:"message,omitempty"`
Message string `json:"message,omitempty" protobuf:"bytes,6,opt,name=message"`
}
// Cluster metadata
type ClusterMeta struct {
// Release version of the cluster.
Version string `json:"version,omitempty"`
Version string `json:"version,omitempty" protobuf:"bytes,1,opt,name=version"`
}
// ClusterStatus is information about the current status of a cluster updated by cluster controller peridocally.
type ClusterStatus struct {
// Conditions is an array of current cluster conditions.
Conditions []ClusterCondition `json:"conditions,omitempty"`
Conditions []ClusterCondition `json:"conditions,omitempty" protobuf:"bytes,1,rep,name=conditions"`
// Capacity represents the total resources of the cluster
Capacity v1.ResourceList `json:"capacity,omitempty"`
Capacity v1.ResourceList `json:"capacity,omitempty" protobuf:"bytes,2,rep,name=capacity,casttype=k8s.io/kubernetes/pkg/api/v1.ResourceList,castkey=k8s.io/kubernetes/pkg/api/v1.ResourceName"`
// Allocatable represents the total resources of a cluster that are available for scheduling.
Allocatable v1.ResourceList `json:"allocatable,omitempty"`
ClusterMeta `json:",inline"`
Allocatable v1.ResourceList `json:"allocatable,omitempty" protobuf:"bytes,3,rep,name=allocatable,casttype=k8s.io/kubernetes/pkg/api/v1.ResourceList,castkey=k8s.io/kubernetes/pkg/api/v1.ResourceName"`
ClusterMeta `json:",inline" protobuf:"bytes,4,opt,name=clusterMeta"`
}
// Information about a registered cluster in a federated kubernetes setup. Clusters are not namespaced and have unique names in the federation.
@ -82,12 +82,12 @@ type Cluster struct {
unversioned.TypeMeta `json:",inline"`
// Standard object's metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
v1.ObjectMeta `json:"metadata,omitempty"`
v1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// Spec defines the behavior of the Cluster.
Spec ClusterSpec `json:"spec,omitempty"`
Spec ClusterSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
// Status describes the current status of a Cluster
Status ClusterStatus `json:"status,omitempty"`
Status ClusterStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
}
// A list of all the kubernetes clusters registered to the federation
@ -95,8 +95,8 @@ type ClusterList struct {
unversioned.TypeMeta `json:",inline"`
// Standard list metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds
unversioned.ListMeta `json:"metadata,omitempty"`
unversioned.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// List of Cluster objects.
Items []Cluster `json:"items"`
Items []Cluster `json:"items" protobuf:"bytes,2,rep,name=items"`
}

View File

@ -42,6 +42,7 @@ function prereqs() {
--volume "${REPO_DIR:-${KUBE_ROOT}}/Godeps/_workspace/src:/go/src/${KUBE_GO_PACKAGE}/Godeps/_workspace/src"
--volume "${REPO_DIR:-${KUBE_ROOT}}/hack:/go/src/${KUBE_GO_PACKAGE}/hack"
--volume "${REPO_DIR:-${KUBE_ROOT}}/pkg:/go/src/${KUBE_GO_PACKAGE}/pkg"
--volume "${REPO_DIR:-${KUBE_ROOT}}/federation:/go/src/${KUBE_GO_PACKAGE}/federation"
--volume "${REPO_DIR:-${KUBE_ROOT}}/third_party:/go/src/${KUBE_GO_PACKAGE}/third_party"
--volume /etc/localtime:/etc/localtime:ro
--volumes-from "${KUBE_BUILD_DATA_CONTAINER_NAME}"