Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new metadata to internal/v1beta(1|2) for v1beta3 #1622

Merged
merged 2 commits into from
Oct 7, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions pkg/api/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,12 @@ type TypeMeta struct {
ResourceVersion uint64 `json:"resourceVersion,omitempty" yaml:"resourceVersion,omitempty"`
APIVersion string `json:"apiVersion,omitempty" yaml:"apiVersion,omitempty"`
Namespace string `json:"namespace",omitempty" yaml:"namespace,omitempty"`
UID string `json:"uid,omitempty" yaml:"uid,omitempty"`

// Annotations are unstructured key value data stored with a resource that may be set by
// external tooling. They are not queryable and should be preserved when modifying
// objects.
Annotations map[string]string `json:"annotations,omitempty" yaml:"annotations,omitempty"`
}

const (
Expand Down Expand Up @@ -665,6 +671,7 @@ func (*ServerOpList) IsAnAPIObject() {}
// ObjectReference contains enough information to let you inspect or modify the referred object.
type ObjectReference struct {
Kind string `json:"kind,omitempty" yaml:"kind,omitempty"`
Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
UID string `json:"uid,omitempty" yaml:"uid,omitempty"`
APIVersion string `json:"apiVersion,omitempty" yaml:"apiVersion,omitempty"`
Expand Down
36 changes: 27 additions & 9 deletions pkg/api/v1beta1/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,40 @@ var Codec = runtime.CodecFor(api.Scheme, "v1beta1")

func init() {
api.Scheme.AddKnownTypes("v1beta1",
&PodList{},
&Pod{},
&ReplicationControllerList{},
&PodList{},
&ReplicationController{},
&ServiceList{},
&ReplicationControllerList{},
&Service{},
&MinionList{},
&Minion{},
&Status{},
&ServerOpList{},
&ServerOp{},
&ContainerManifestList{},
&ServiceList{},
&Endpoints{},
&EndpointsList{},
&Minion{},
&MinionList{},
&Binding{},
&Status{},
&ServerOp{},
&ServerOpList{},
&Event{},
&EventList{},
&ContainerManifestList{},
)
}

func (*Pod) IsAnAPIObject() {}
func (*PodList) IsAnAPIObject() {}
func (*ReplicationController) IsAnAPIObject() {}
func (*ReplicationControllerList) IsAnAPIObject() {}
func (*Service) IsAnAPIObject() {}
func (*ServiceList) IsAnAPIObject() {}
func (*Endpoints) IsAnAPIObject() {}
func (*EndpointsList) IsAnAPIObject() {}
func (*Minion) IsAnAPIObject() {}
func (*MinionList) IsAnAPIObject() {}
func (*Binding) IsAnAPIObject() {}
func (*Status) IsAnAPIObject() {}
func (*ServerOp) IsAnAPIObject() {}
func (*ServerOpList) IsAnAPIObject() {}
func (*Event) IsAnAPIObject() {}
func (*EventList) IsAnAPIObject() {}
func (*ContainerManifestList) IsAnAPIObject() {}
43 changes: 7 additions & 36 deletions pkg/api/v1beta1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ type ContainerManifestList struct {
Items []ContainerManifest `json:"items,omitempty" yaml:"items,omitempty"`
}

func (*ContainerManifestList) IsAnAPIObject() {}

// Volume represents a named volume in a pod that may be accessed by any containers in the pod.
type Volume struct {
// Required: This must be a DNS_LABEL. Each volume in a pod must have
Expand Down Expand Up @@ -259,14 +257,18 @@ type Lifecycle struct {
type TypeMeta struct {
Kind string `json:"kind,omitempty" yaml:"kind,omitempty"`
ID string `json:"id,omitempty" yaml:"id,omitempty"`
UID string `json:"uid,omitempty" yaml:"uid,omitempty"`
CreationTimestamp util.Time `json:"creationTimestamp,omitempty" yaml:"creationTimestamp,omitempty"`
SelfLink string `json:"selfLink,omitempty" yaml:"selfLink,omitempty"`
ResourceVersion uint64 `json:"resourceVersion,omitempty" yaml:"resourceVersion,omitempty"`
APIVersion string `json:"apiVersion,omitempty" yaml:"apiVersion,omitempty"`
Namespace string `json:"namespace",omitempty" yaml:"namespace,omitempty"`
}

func (*TypeMeta) IsAnAPIObject() {}
// Annotations are unstructured key value data stored with a resource that may be set by
// external tooling. They are not queryable and should be preserved when modifying
// objects.
Annotations map[string]string `json:"annotations,omitempty" yaml:"annotations,omitempty"`
}

// PodStatus represents a status of a pod.
type PodStatus string
Expand Down Expand Up @@ -363,8 +365,6 @@ type PodList struct {
Items []Pod `json:"items" yaml:"items,omitempty"`
}

func (*PodList) IsAnAPIObject() {}

// Pod is a collection of containers, used as either input (create, update) or as output (list, get).
type Pod struct {
TypeMeta `json:",inline" yaml:",inline"`
Expand All @@ -373,8 +373,6 @@ type Pod struct {
CurrentState PodState `json:"currentState,omitempty" yaml:"currentState,omitempty"`
}

func (*Pod) IsAnAPIObject() {}

// ReplicationControllerState is the state of a replication controller, either input (create, update) or as output (list, get).
type ReplicationControllerState struct {
Replicas int `json:"replicas" yaml:"replicas"`
Expand All @@ -388,8 +386,6 @@ type ReplicationControllerList struct {
Items []ReplicationController `json:"items,omitempty" yaml:"items,omitempty"`
}

func (*ReplicationControllerList) IsAnAPIObject() {}

// ReplicationController represents the configuration of a replication controller.
type ReplicationController struct {
TypeMeta `json:",inline" yaml:",inline"`
Expand All @@ -398,8 +394,6 @@ type ReplicationController struct {
Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"`
}

func (*ReplicationController) IsAnAPIObject() {}

// PodTemplate holds the information used for creating pods.
type PodTemplate struct {
DesiredState PodState `json:"desiredState,omitempty" yaml:"desiredState,omitempty"`
Expand All @@ -412,8 +406,6 @@ type ServiceList struct {
Items []Service `json:"items" yaml:"items"`
}

func (*ServiceList) IsAnAPIObject() {}

// 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.
Expand All @@ -437,25 +429,19 @@ type Service struct {
ContainerPort util.IntOrString `json:"containerPort,omitempty" yaml:"containerPort,omitempty"`
}

func (*Service) IsAnAPIObject() {}

// Endpoints is a collection of endpoints that implement the actual service, for example:
// Name: "mysql", Endpoints: ["10.10.1.1:1909", "10.10.2.2:8834"]
type Endpoints struct {
TypeMeta `json:",inline" yaml:",inline"`
Endpoints []string `json:"endpoints,omitempty" yaml:"endpoints,omitempty"`
}

func (*Endpoints) IsAnAPIObject() {}

// EndpointsList is a list of endpoints.
type EndpointsList struct {
TypeMeta `json:",inline" yaml:",inline"`
Items []Endpoints `json:"items,omitempty" yaml:"items,omitempty"`
}

func (*EndpointsList) IsAnAPIObject() {}

// NodeResources represents resources on a Kubernetes system node
// see https://github.com/GoogleCloudPlatform/kubernetes/blob/master/docs/resources.md for more details.
type NodeResources struct {
Expand All @@ -477,8 +463,6 @@ type Minion struct {
NodeResources NodeResources `json:"resources,omitempty" yaml:"resources,omitempty"`
}

func (*Minion) IsAnAPIObject() {}

// MinionList is a list of minions.
type MinionList struct {
TypeMeta `json:",inline" yaml:",inline"`
Expand All @@ -488,17 +472,13 @@ type MinionList struct {
Items []Minion `json:"items,omitempty" yaml:"items,omitempty"`
}

func (*MinionList) IsAnAPIObject() {}

// Binding is written by a scheduler to cause a pod to be bound to a host.
type Binding struct {
TypeMeta `json:",inline" yaml:",inline"`
PodID string `json:"podID" yaml:"podID"`
Host string `json:"host" yaml:"host"`
}

func (*Binding) IsAnAPIObject() {}

// Status is a return value for calls that don't return other objects.
// TODO: this could go in apiserver, but I'm including it here so clients needn't
// import both.
Expand All @@ -522,8 +502,6 @@ type Status struct {
Code int `json:"code,omitempty" yaml:"code,omitempty"`
}

func (*Status) IsAnAPIObject() {}

// 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
Expand Down Expand Up @@ -647,19 +625,16 @@ type ServerOp struct {
TypeMeta `yaml:",inline" json:",inline"`
}

func (*ServerOp) IsAnAPIObject() {}

// ServerOpList is a list of operations, as delivered to API clients.
type ServerOpList struct {
TypeMeta `yaml:",inline" json:",inline"`
Items []ServerOp `yaml:"items,omitempty" json:"items,omitempty"`
}

func (*ServerOpList) IsAnAPIObject() {}

// ObjectReference contains enough information to let you inspect or modify the referred object.
type ObjectReference struct {
Kind string `json:"kind,omitempty" yaml:"kind,omitempty"`
Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
UID string `json:"uid,omitempty" yaml:"uid,omitempty"`
APIVersion string `json:"apiVersion,omitempty" yaml:"apiVersion,omitempty"`
Expand Down Expand Up @@ -707,12 +682,8 @@ type Event struct {
Source string `json:"source,omitempty" yaml:"source,omitempty"`
}

func (*Event) IsAnAPIObject() {}

// EventList is a list of events.
type EventList struct {
TypeMeta `yaml:",inline" json:",inline"`
Items []Event `yaml:"items,omitempty" json:"items,omitempty"`
}

func (*EventList) IsAnAPIObject() {}
36 changes: 27 additions & 9 deletions pkg/api/v1beta2/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,40 @@ var Codec = runtime.CodecFor(api.Scheme, "v1beta2")

func init() {
api.Scheme.AddKnownTypes("v1beta2",
&PodList{},
&Pod{},
&ReplicationControllerList{},
&PodList{},
&ReplicationController{},
&ServiceList{},
&ReplicationControllerList{},
&Service{},
&MinionList{},
&Minion{},
&Status{},
&ServerOpList{},
&ServerOp{},
&ContainerManifestList{},
&ServiceList{},
&Endpoints{},
&EndpointsList{},
&Minion{},
&MinionList{},
&Binding{},
&Status{},
&ServerOp{},
&ServerOpList{},
&Event{},
&EventList{},
&ContainerManifestList{},
)
}

func (*Pod) IsAnAPIObject() {}
func (*PodList) IsAnAPIObject() {}
func (*ReplicationController) IsAnAPIObject() {}
func (*ReplicationControllerList) IsAnAPIObject() {}
func (*Service) IsAnAPIObject() {}
func (*ServiceList) IsAnAPIObject() {}
func (*Endpoints) IsAnAPIObject() {}
func (*EndpointsList) IsAnAPIObject() {}
func (*Minion) IsAnAPIObject() {}
func (*MinionList) IsAnAPIObject() {}
func (*Binding) IsAnAPIObject() {}
func (*Status) IsAnAPIObject() {}
func (*ServerOp) IsAnAPIObject() {}
func (*ServerOpList) IsAnAPIObject() {}
func (*Event) IsAnAPIObject() {}
func (*EventList) IsAnAPIObject() {}
func (*ContainerManifestList) IsAnAPIObject() {}