mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-16 06:32:32 +00:00
Rename ID -> Name
This commit is contained in:
@@ -72,13 +72,13 @@ func (e *EndpointController) SyncServiceEndpoints() error {
|
||||
}
|
||||
endpoints = append(endpoints, net.JoinHostPort(pod.CurrentState.PodIP, strconv.Itoa(port)))
|
||||
}
|
||||
currentEndpoints, err := e.client.GetEndpoints(nsCtx, service.ID)
|
||||
currentEndpoints, err := e.client.GetEndpoints(nsCtx, service.Name)
|
||||
if err != nil {
|
||||
// TODO this is brittle as all get out, refactor the client libraries to return a structured error.
|
||||
if errors.IsNotFound(err) {
|
||||
currentEndpoints = &api.Endpoints{
|
||||
TypeMeta: api.TypeMeta{
|
||||
ID: service.ID,
|
||||
Name: service.Name,
|
||||
},
|
||||
}
|
||||
} else {
|
||||
@@ -96,7 +96,7 @@ func (e *EndpointController) SyncServiceEndpoints() error {
|
||||
} else {
|
||||
// Pre-existing
|
||||
if endpointsEqual(currentEndpoints, endpoints) {
|
||||
glog.V(2).Infof("endpoints are equal for %s, skipping update", service.ID)
|
||||
glog.V(2).Infof("endpoints are equal for %s, skipping update", service.Name)
|
||||
continue
|
||||
}
|
||||
_, err = e.client.UpdateEndpoints(nsCtx, newEndpoints)
|
||||
|
@@ -35,7 +35,7 @@ func newPodList(count int) api.PodList {
|
||||
for i := 0; i < count; i++ {
|
||||
pods = append(pods, api.Pod{
|
||||
TypeMeta: api.TypeMeta{
|
||||
ID: fmt.Sprintf("pod%d", i),
|
||||
Name: fmt.Sprintf("pod%d", i),
|
||||
APIVersion: testapi.Version(),
|
||||
},
|
||||
DesiredState: api.PodState{
|
||||
@@ -181,7 +181,7 @@ func TestSyncEndpointsItemsPreexisting(t *testing.T) {
|
||||
serviceList := api.ServiceList{
|
||||
Items: []api.Service{
|
||||
{
|
||||
TypeMeta: api.TypeMeta{ID: "foo"},
|
||||
TypeMeta: api.TypeMeta{Name: "foo"},
|
||||
Selector: map[string]string{
|
||||
"foo": "bar",
|
||||
},
|
||||
@@ -193,7 +193,7 @@ func TestSyncEndpointsItemsPreexisting(t *testing.T) {
|
||||
serverResponse{http.StatusOK, serviceList},
|
||||
serverResponse{http.StatusOK, api.Endpoints{
|
||||
TypeMeta: api.TypeMeta{
|
||||
ID: "foo",
|
||||
Name: "foo",
|
||||
ResourceVersion: "1",
|
||||
},
|
||||
Endpoints: []string{"6.7.8.9:1000"},
|
||||
@@ -205,7 +205,7 @@ func TestSyncEndpointsItemsPreexisting(t *testing.T) {
|
||||
}
|
||||
data := runtime.EncodeOrDie(testapi.Codec(), &api.Endpoints{
|
||||
TypeMeta: api.TypeMeta{
|
||||
ID: "foo",
|
||||
Name: "foo",
|
||||
ResourceVersion: "1",
|
||||
},
|
||||
Endpoints: []string{"1.2.3.4:8080"},
|
||||
@@ -217,7 +217,7 @@ func TestSyncEndpointsItemsPreexistingIdentical(t *testing.T) {
|
||||
serviceList := api.ServiceList{
|
||||
Items: []api.Service{
|
||||
{
|
||||
TypeMeta: api.TypeMeta{ID: "foo"},
|
||||
TypeMeta: api.TypeMeta{Name: "foo"},
|
||||
Selector: map[string]string{
|
||||
"foo": "bar",
|
||||
},
|
||||
@@ -245,7 +245,7 @@ func TestSyncEndpointsItems(t *testing.T) {
|
||||
serviceList := api.ServiceList{
|
||||
Items: []api.Service{
|
||||
{
|
||||
TypeMeta: api.TypeMeta{ID: "foo"},
|
||||
TypeMeta: api.TypeMeta{Name: "foo"},
|
||||
Selector: map[string]string{
|
||||
"foo": "bar",
|
||||
},
|
||||
|
Reference in New Issue
Block a user