Replace struct initializers for TypeMeta with ObjectMeta

This commit is contained in:
Clayton Coleman 2014-10-23 16:55:58 -04:00
parent bc748fadfa
commit 7550c146dc
9 changed files with 21 additions and 19 deletions

View File

@ -125,7 +125,7 @@ func (ops *Operations) List() *api.ServerOpList {
sort.StringSlice(ids).Sort() sort.StringSlice(ids).Sort()
ol := &api.ServerOpList{} ol := &api.ServerOpList{}
for _, id := range ids { for _, id := range ids {
ol.Items = append(ol.Items, api.ServerOp{TypeMeta: api.TypeMeta{Name: id}}) ol.Items = append(ol.Items, api.ServerOp{ObjectMeta: api.ObjectMeta{Name: id}})
} }
return ol return ol
} }

View File

@ -245,7 +245,7 @@ func RunController(ctx api.Context, image, name string, replicas int, client cli
return err return err
} }
controller := &api.ReplicationController{ controller := &api.ReplicationController{
TypeMeta: api.TypeMeta{ ObjectMeta: api.ObjectMeta{
Name: name, Name: name,
}, },
DesiredState: api.ReplicationControllerState{ DesiredState: api.ReplicationControllerState{
@ -299,11 +299,13 @@ func RunController(ctx api.Context, image, name string, replicas int, client cli
func createService(ctx api.Context, name string, port int, client client.Interface) (*api.Service, error) { func createService(ctx api.Context, name string, port int, client client.Interface) (*api.Service, error) {
svc := &api.Service{ svc := &api.Service{
TypeMeta: api.TypeMeta{Name: name}, ObjectMeta: api.ObjectMeta{
Port: port, Name: name,
Labels: map[string]string{ Labels: map[string]string{
"simpleService": name, "simpleService": name,
},
}, },
Port: port,
Selector: map[string]string{ Selector: map[string]string{
"simpleService": name, "simpleService": name,
}, },

View File

@ -204,7 +204,7 @@ func (s *Server) handleContainerLogs(w http.ResponseWriter, req *http.Request) {
tail := uriValues.Get("tail") tail := uriValues.Get("tail")
podFullName := GetPodFullName(&api.BoundPod{ podFullName := GetPodFullName(&api.BoundPod{
TypeMeta: api.TypeMeta{ ObjectMeta: api.ObjectMeta{
Name: podID, Name: podID,
Namespace: podNamespace, Namespace: podNamespace,
Annotations: map[string]string{ConfigSourceAnnotationKey: "etcd"}, Annotations: map[string]string{ConfigSourceAnnotationKey: "etcd"},
@ -248,7 +248,7 @@ func (s *Server) handlePodInfo(w http.ResponseWriter, req *http.Request) {
} }
// TODO: backwards compatibility with existing API, needs API change // TODO: backwards compatibility with existing API, needs API change
podFullName := GetPodFullName(&api.BoundPod{ podFullName := GetPodFullName(&api.BoundPod{
TypeMeta: api.TypeMeta{ ObjectMeta: api.ObjectMeta{
Name: podID, Name: podID,
Namespace: podNamespace, Namespace: podNamespace,
Annotations: map[string]string{ConfigSourceAnnotationKey: "etcd"}, Annotations: map[string]string{ConfigSourceAnnotationKey: "etcd"},
@ -323,7 +323,7 @@ func (s *Server) handleRun(w http.ResponseWriter, req *http.Request) {
return return
} }
podFullName := GetPodFullName(&api.BoundPod{ podFullName := GetPodFullName(&api.BoundPod{
TypeMeta: api.TypeMeta{ ObjectMeta: api.ObjectMeta{
Name: podID, Name: podID,
Namespace: podNamespace, Namespace: podNamespace,
Annotations: map[string]string{ConfigSourceAnnotationKey: "etcd"}, Annotations: map[string]string{ConfigSourceAnnotationKey: "etcd"},
@ -373,7 +373,7 @@ func (s *Server) serveStats(w http.ResponseWriter, req *http.Request) {
case 3: case 3:
// Backward compatibility without uuid information // Backward compatibility without uuid information
podFullName := GetPodFullName(&api.BoundPod{ podFullName := GetPodFullName(&api.BoundPod{
TypeMeta: api.TypeMeta{ ObjectMeta: api.ObjectMeta{
Name: components[1], Name: components[1],
// TODO: I am broken // TODO: I am broken
Namespace: api.NamespaceDefault, Namespace: api.NamespaceDefault,
@ -383,7 +383,7 @@ func (s *Server) serveStats(w http.ResponseWriter, req *http.Request) {
stats, err = s.host.GetContainerInfo(podFullName, "", components[2], &query) stats, err = s.host.GetContainerInfo(podFullName, "", components[2], &query)
case 4: case 4:
podFullName := GetPodFullName(&api.BoundPod{ podFullName := GetPodFullName(&api.BoundPod{
TypeMeta: api.TypeMeta{ ObjectMeta: api.ObjectMeta{
Name: components[1], Name: components[1],
// TODO: I am broken // TODO: I am broken
Namespace: "", Namespace: "",

View File

@ -125,7 +125,7 @@ func (m *Master) init(c *Config) {
} else { } else {
for _, minionID := range c.Minions { for _, minionID := range c.Minions {
m.minionRegistry.CreateMinion(nil, &api.Minion{ m.minionRegistry.CreateMinion(nil, &api.Minion{
TypeMeta: api.TypeMeta{Name: minionID}, ObjectMeta: api.ObjectMeta{Name: minionID},
NodeResources: c.NodeResources, NodeResources: c.NodeResources,
}) })
} }

View File

@ -243,7 +243,7 @@ func (s ConfigSourceEtcd) ProcessChange(response *etcd.Response) {
parts := strings.Split(response.Node.Key[1:], "/") parts := strings.Split(response.Node.Key[1:], "/")
if len(parts) == 4 { if len(parts) == 4 {
glog.V(4).Infof("Deleting service: %s", parts[3]) glog.V(4).Infof("Deleting service: %s", parts[3])
serviceUpdate := ServiceUpdate{Op: REMOVE, Services: []api.Service{{TypeMeta: api.TypeMeta{Name: parts[3]}}}} serviceUpdate := ServiceUpdate{Op: REMOVE, Services: []api.Service{{ObjectMeta: api.ObjectMeta{Name: parts[3]}}}}
s.serviceChannel <- serviceUpdate s.serviceChannel <- serviceUpdate
return return
} }

View File

@ -106,7 +106,7 @@ func (rs *REST) Update(ctx api.Context, minion runtime.Object) (<-chan runtime.O
} }
func (rs *REST) toApiMinion(name string) *api.Minion { func (rs *REST) toApiMinion(name string) *api.Minion {
return &api.Minion{TypeMeta: api.TypeMeta{Name: name}} return &api.Minion{ObjectMeta: api.ObjectMeta{Name: name}}
} }
// ResourceLocation returns a URL to which one can send traffic for the specified minion. // ResourceLocation returns a URL to which one can send traffic for the specified minion.

View File

@ -77,7 +77,7 @@ func (r *MinionRegistry) DeleteMinion(ctx api.Context, minionID string) error {
var newList []api.Minion var newList []api.Minion
for _, node := range r.Minions.Items { for _, node := range r.Minions.Items {
if node.Name != minionID { if node.Name != minionID {
newList = append(newList, api.Minion{TypeMeta: api.TypeMeta{Name: node.Name}}) newList = append(newList, api.Minion{ObjectMeta: api.ObjectMeta{Name: node.Name}})
} }
} }
r.Minions.Items = newList r.Minions.Items = newList

View File

@ -76,7 +76,7 @@ func (e *EndpointController) SyncServiceEndpoints() error {
if err != nil { if err != nil {
if errors.IsNotFound(err) { if errors.IsNotFound(err) {
currentEndpoints = &api.Endpoints{ currentEndpoints = &api.Endpoints{
TypeMeta: api.TypeMeta{ ObjectMeta: api.ObjectMeta{
Name: service.Name, Name: service.Name,
}, },
} }

View File

@ -73,9 +73,9 @@ func (s *Scheduler) scheduleOne() {
return return
} }
b := &api.Binding{ b := &api.Binding{
TypeMeta: api.TypeMeta{Namespace: pod.Namespace}, ObjectMeta: api.ObjectMeta{Namespace: pod.Namespace},
PodID: pod.Name, PodID: pod.Name,
Host: dest, Host: dest,
} }
if err := s.config.Binder.Bind(b); err != nil { if err := s.config.Binder.Bind(b); err != nil {
record.Eventf(pod, "", string(api.PodWaiting), "failedScheduling", "Binding rejected: %v", err) record.Eventf(pod, "", string(api.PodWaiting), "failedScheduling", "Binding rejected: %v", err)