Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2789aff

Browse files
committed
Remove /Validate endpoint
1 parent a7341cf commit 2789aff

File tree

3 files changed

+3
-33
lines changed

3 files changed

+3
-33
lines changed

pkg/apiserver/apiserver.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,6 @@ func (g *APIGroupVersion) InstallREST(container *restful.Container) error {
149149
return errors.NewAggregate(registrationErrors)
150150
}
151151

152-
// TODO: This endpoint is deprecated and should be removed at some point.
153-
// Use "componentstatus" API instead.
154-
func InstallValidator(mux Mux, servers func() map[string]Server) {
155-
mux.Handle("/validate", NewValidator(servers))
156-
}
157-
158152
// TODO: document all handlers
159153
// InstallSupport registers the APIServer support functions
160154
func InstallSupport(mux Mux, ws *restful.WebService) {

pkg/master/master.go

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ import (
4141
"github.com/GoogleCloudPlatform/kubernetes/pkg/auth/authorizer"
4242
"github.com/GoogleCloudPlatform/kubernetes/pkg/auth/handlers"
4343
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
44-
"github.com/GoogleCloudPlatform/kubernetes/pkg/fields"
45-
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
4644
"github.com/GoogleCloudPlatform/kubernetes/pkg/master/ports"
4745
"github.com/GoogleCloudPlatform/kubernetes/pkg/registry/componentstatus"
4846
controlleretcd "github.com/GoogleCloudPlatform/kubernetes/pkg/registry/controller/etcd"
@@ -465,7 +463,7 @@ func (m *Master) init(c *Config) {
465463
"persistentVolumeClaims": persistentVolumeClaimStorage,
466464
"persistentVolumeClaims/status": persistentVolumeClaimStatusStorage,
467465

468-
"componentStatuses": componentstatus.NewStorage(func() map[string]apiserver.Server { return m.getServersToValidate(c, false) }),
466+
"componentStatuses": componentstatus.NewStorage(func() map[string]apiserver.Server { return m.getServersToValidate(c) }),
469467
}
470468

471469
apiVersions := []string{}
@@ -507,8 +505,6 @@ func (m *Master) init(c *Config) {
507505
m.mux.HandleFunc("/", apiserver.IndexHandler(m.handlerContainer, m.muxHelper))
508506
}
509507

510-
// TODO: This is now deprecated. Should be removed once client dependencies are gone.
511-
apiserver.InstallValidator(m.muxHelper, func() map[string]apiserver.Server { return m.getServersToValidate(c, true) })
512508
if c.EnableLogsSupport {
513509
apiserver.InstallLogsSupport(m.muxHelper)
514510
}
@@ -637,7 +633,7 @@ func (m *Master) InstallSwaggerAPI() {
637633
swagger.RegisterSwaggerService(swaggerConfig, m.handlerContainer)
638634
}
639635

640-
func (m *Master) getServersToValidate(c *Config, includeNodes bool) map[string]apiserver.Server {
636+
func (m *Master) getServersToValidate(c *Config) map[string]apiserver.Server {
641637
serversToValidate := map[string]apiserver.Server{
642638
"controller-manager": {Addr: "127.0.0.1", Port: ports.ControllerManagerPort, Path: "/healthz"},
643639
"scheduler": {Addr: "127.0.0.1", Port: ports.SchedulerPort, Path: "/healthz"},
@@ -664,15 +660,6 @@ func (m *Master) getServersToValidate(c *Config, includeNodes bool) map[string]a
664660
}
665661
serversToValidate[fmt.Sprintf("etcd-%d", ix)] = apiserver.Server{Addr: addr, Port: port, Path: "/v2/keys/"}
666662
}
667-
if includeNodes && m.nodeRegistry != nil {
668-
nodes, err := m.nodeRegistry.ListMinions(api.NewDefaultContext(), labels.Everything(), fields.Everything())
669-
if err != nil {
670-
glog.Errorf("Failed to list minions: %v", err)
671-
}
672-
for ix, node := range nodes.Items {
673-
serversToValidate[fmt.Sprintf("node-%d", ix)] = apiserver.Server{Addr: node.Name, Port: ports.KubeletPort, Path: "/healthz", EnableHTTPS: true}
674-
}
675-
}
676663
return serversToValidate
677664
}
678665

pkg/master/master_test.go

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,7 @@ func TestGetServersToValidate(t *testing.T) {
3636

3737
master.nodeRegistry = registrytest.NewMinionRegistry([]string{"node1", "node2"}, api.NodeResources{})
3838

39-
servers := master.getServersToValidate(&config, true)
40-
41-
if len(servers) != 7 {
42-
t.Errorf("unexpected server list: %#v", servers)
43-
}
44-
for _, server := range []string{"scheduler", "controller-manager", "etcd-0", "etcd-1", "etcd-2", "node-0", "node-1"} {
45-
if _, ok := servers[server]; !ok {
46-
t.Errorf("server list missing: %s", server)
47-
}
48-
}
49-
50-
servers = master.getServersToValidate(&config, false)
39+
servers := master.getServersToValidate(&config)
5140

5241
if len(servers) != 5 {
5342
t.Errorf("unexpected server list: %#v", servers)

0 commit comments

Comments
 (0)