mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-15 14:53:44 +00:00
Replace struct initializers for TypeMeta with ObjectMeta
This commit is contained in:
parent
bc748fadfa
commit
7550c146dc
@ -125,7 +125,7 @@ func (ops *Operations) List() *api.ServerOpList {
|
||||
sort.StringSlice(ids).Sort()
|
||||
ol := &api.ServerOpList{}
|
||||
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
|
||||
}
|
||||
|
@ -245,7 +245,7 @@ func RunController(ctx api.Context, image, name string, replicas int, client cli
|
||||
return err
|
||||
}
|
||||
controller := &api.ReplicationController{
|
||||
TypeMeta: api.TypeMeta{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
Name: name,
|
||||
},
|
||||
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) {
|
||||
svc := &api.Service{
|
||||
TypeMeta: api.TypeMeta{Name: name},
|
||||
Port: port,
|
||||
Labels: map[string]string{
|
||||
"simpleService": name,
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
Name: name,
|
||||
Labels: map[string]string{
|
||||
"simpleService": name,
|
||||
},
|
||||
},
|
||||
Port: port,
|
||||
Selector: map[string]string{
|
||||
"simpleService": name,
|
||||
},
|
||||
|
@ -204,7 +204,7 @@ func (s *Server) handleContainerLogs(w http.ResponseWriter, req *http.Request) {
|
||||
tail := uriValues.Get("tail")
|
||||
|
||||
podFullName := GetPodFullName(&api.BoundPod{
|
||||
TypeMeta: api.TypeMeta{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
Name: podID,
|
||||
Namespace: podNamespace,
|
||||
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
|
||||
podFullName := GetPodFullName(&api.BoundPod{
|
||||
TypeMeta: api.TypeMeta{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
Name: podID,
|
||||
Namespace: podNamespace,
|
||||
Annotations: map[string]string{ConfigSourceAnnotationKey: "etcd"},
|
||||
@ -323,7 +323,7 @@ func (s *Server) handleRun(w http.ResponseWriter, req *http.Request) {
|
||||
return
|
||||
}
|
||||
podFullName := GetPodFullName(&api.BoundPod{
|
||||
TypeMeta: api.TypeMeta{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
Name: podID,
|
||||
Namespace: podNamespace,
|
||||
Annotations: map[string]string{ConfigSourceAnnotationKey: "etcd"},
|
||||
@ -373,7 +373,7 @@ func (s *Server) serveStats(w http.ResponseWriter, req *http.Request) {
|
||||
case 3:
|
||||
// Backward compatibility without uuid information
|
||||
podFullName := GetPodFullName(&api.BoundPod{
|
||||
TypeMeta: api.TypeMeta{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
Name: components[1],
|
||||
// TODO: I am broken
|
||||
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)
|
||||
case 4:
|
||||
podFullName := GetPodFullName(&api.BoundPod{
|
||||
TypeMeta: api.TypeMeta{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
Name: components[1],
|
||||
// TODO: I am broken
|
||||
Namespace: "",
|
||||
|
@ -125,7 +125,7 @@ func (m *Master) init(c *Config) {
|
||||
} else {
|
||||
for _, minionID := range c.Minions {
|
||||
m.minionRegistry.CreateMinion(nil, &api.Minion{
|
||||
TypeMeta: api.TypeMeta{Name: minionID},
|
||||
ObjectMeta: api.ObjectMeta{Name: minionID},
|
||||
NodeResources: c.NodeResources,
|
||||
})
|
||||
}
|
||||
|
@ -243,7 +243,7 @@ func (s ConfigSourceEtcd) ProcessChange(response *etcd.Response) {
|
||||
parts := strings.Split(response.Node.Key[1:], "/")
|
||||
if len(parts) == 4 {
|
||||
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
|
||||
return
|
||||
}
|
||||
|
@ -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 {
|
||||
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.
|
||||
|
@ -77,7 +77,7 @@ func (r *MinionRegistry) DeleteMinion(ctx api.Context, minionID string) error {
|
||||
var newList []api.Minion
|
||||
for _, node := range r.Minions.Items {
|
||||
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
|
||||
|
@ -76,7 +76,7 @@ func (e *EndpointController) SyncServiceEndpoints() error {
|
||||
if err != nil {
|
||||
if errors.IsNotFound(err) {
|
||||
currentEndpoints = &api.Endpoints{
|
||||
TypeMeta: api.TypeMeta{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
Name: service.Name,
|
||||
},
|
||||
}
|
||||
|
@ -73,9 +73,9 @@ func (s *Scheduler) scheduleOne() {
|
||||
return
|
||||
}
|
||||
b := &api.Binding{
|
||||
TypeMeta: api.TypeMeta{Namespace: pod.Namespace},
|
||||
PodID: pod.Name,
|
||||
Host: dest,
|
||||
ObjectMeta: api.ObjectMeta{Namespace: pod.Namespace},
|
||||
PodID: pod.Name,
|
||||
Host: dest,
|
||||
}
|
||||
if err := s.config.Binder.Bind(b); err != nil {
|
||||
record.Eventf(pod, "", string(api.PodWaiting), "failedScheduling", "Binding rejected: %v", err)
|
||||
|
Loading…
Reference in New Issue
Block a user