mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-14 13:45:06 +00:00
Eliminates tautological comments
This commit is contained in:
@@ -54,14 +54,14 @@ type EndpointsUpdate struct {
|
||||
Op Operation
|
||||
}
|
||||
|
||||
// ServiceConfigHandler handles update notifications of the set of services.
|
||||
// ServiceConfigHandler is an abstract interface of objects which receive update notifications of the set of services.
|
||||
type ServiceConfigHandler interface {
|
||||
// OnUpdate gets called when a configuration has been changed by one of the sources.
|
||||
// This is the union of all the configuration sources.
|
||||
OnUpdate(services []api.Service)
|
||||
}
|
||||
|
||||
// EndpointsConfigHandler handles update notifications of the set of endpoints.
|
||||
// EndpointsConfigHandler is an abstract interface of objects which receive update notifications of the set of endpoints.
|
||||
type EndpointsConfigHandler interface {
|
||||
// OnUpdate gets called when endpoints configuration is changed for a given
|
||||
// service on any of the configuration sources. An example is when a new
|
||||
|
@@ -54,8 +54,7 @@ type ConfigSourceEtcd struct {
|
||||
endpointsChannel chan EndpointsUpdate
|
||||
}
|
||||
|
||||
// NewConfigSourceEtcd creates a new ConfigSourceEtcd.
|
||||
// It immediately runs the created ConfigSourceEtcd in a goroutine.
|
||||
// NewConfigSourceEtcd creates a new ConfigSourceEtcd and immediately runs the created ConfigSourceEtcd in a goroutine.
|
||||
func NewConfigSourceEtcd(client *etcd.Client, serviceChannel chan ServiceUpdate, endpointsChannel chan EndpointsUpdate) ConfigSourceEtcd {
|
||||
config := ConfigSourceEtcd{
|
||||
client: client,
|
||||
|
@@ -51,15 +51,14 @@ type serviceConfig struct {
|
||||
} `json: "service"`
|
||||
}
|
||||
|
||||
// ConfigSourceFile periodically reads service configurations in JSON from a file, and sends the services and endpoints defined in th file to the specified channels.
|
||||
// ConfigSourceFile periodically reads service configurations in JSON from a file, and sends the services and endpoints defined in the file to the specified channels.
|
||||
type ConfigSourceFile struct {
|
||||
serviceChannel chan ServiceUpdate
|
||||
endpointsChannel chan EndpointsUpdate
|
||||
filename string
|
||||
}
|
||||
|
||||
// NewConfigSourceFile creates a new ConfigSourceFile.
|
||||
// It immediately runs the created ConfigSourceFile in a goroutine.
|
||||
// NewConfigSourceFile creates a new ConfigSourceFile and let it immediately runs the created ConfigSourceFile in a goroutine.
|
||||
func NewConfigSourceFile(filename string, serviceChannel chan ServiceUpdate, endpointsChannel chan EndpointsUpdate) ConfigSourceFile {
|
||||
config := ConfigSourceFile{
|
||||
filename: filename,
|
||||
|
@@ -33,12 +33,11 @@ type Proxier struct {
|
||||
serviceMap map[string]int
|
||||
}
|
||||
|
||||
// NewProxier returns a new Proxier.
|
||||
// NewProxier returns a newly created and correctly initialized instance of Proxier.
|
||||
func NewProxier(loadBalancer LoadBalancer) *Proxier {
|
||||
return &Proxier{loadBalancer: loadBalancer, serviceMap: make(map[string]int)}
|
||||
}
|
||||
|
||||
// copyBytes copies bytes from in to out until EOF.
|
||||
func copyBytes(in, out *net.TCPConn) {
|
||||
glog.Infof("Copying from %v <-> %v <-> %v <-> %v",
|
||||
in.RemoteAddr(), in.LocalAddr(), out.LocalAddr(), out.RemoteAddr())
|
||||
@@ -122,7 +121,8 @@ func (proxier Proxier) addServiceCommon(service string, l net.Listener) {
|
||||
go proxier.AcceptHandler(service, l)
|
||||
}
|
||||
|
||||
// OnUpdate handles update notices for the updated services.
|
||||
// OnUpdate recieves update notices for the updated services and start listening newly added services.
|
||||
// It implements "github.com/GoogleCloudPlatform/kubernetes/pkg/proxy/config".ServiceConfigHandler.OnUpdate.
|
||||
func (proxier Proxier) OnUpdate(services []api.Service) {
|
||||
glog.Infof("Received update notice: %+v", services)
|
||||
for _, service := range services {
|
||||
|
@@ -36,7 +36,7 @@ type LoadBalancerRR struct {
|
||||
rrIndex map[string]int
|
||||
}
|
||||
|
||||
// NewLoadBalancerRR returns a new LoadBalancerRR.
|
||||
// NewLoadBalancerRR returns a newly created and correctly initialized instance of LoadBalancerRR.
|
||||
func NewLoadBalancerRR() *LoadBalancerRR {
|
||||
return &LoadBalancerRR{endpointsMap: make(map[string][]string), rrIndex: make(map[string]int)}
|
||||
}
|
||||
@@ -70,7 +70,6 @@ func (impl LoadBalancerRR) isValid(spec string) bool {
|
||||
return value > 0
|
||||
}
|
||||
|
||||
// filterValidEndpoints filters out invalid endpoints.
|
||||
func (impl LoadBalancerRR) filterValidEndpoints(endpoints []string) []string {
|
||||
var result []string
|
||||
for _, spec := range endpoints {
|
||||
|
Reference in New Issue
Block a user