mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	Eliminates tautological comments
This commit is contained in:
		@@ -23,7 +23,7 @@ import (
 | 
			
		||||
 | 
			
		||||
// Labels allows you to present labels independently from their storage.
 | 
			
		||||
type Labels interface {
 | 
			
		||||
	// Get returns the value identified by the label.
 | 
			
		||||
	// Get returns the value for the provided label.
 | 
			
		||||
	Get(label string) (value string)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -42,7 +42,7 @@ func (ls Set) String() string {
 | 
			
		||||
	return strings.Join(selector, ",")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Get returns the value for the provided label.
 | 
			
		||||
// Get returns the value in the map for the provided label.
 | 
			
		||||
func (ls Set) Get(label string) string {
 | 
			
		||||
	return ls[label]
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -43,7 +43,7 @@ type Master struct {
 | 
			
		||||
	storage map[string]apiserver.RESTStorage
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewMemoryServer returns a memory (not etcd) backed apiserver.
 | 
			
		||||
// NewMemoryServer returns a new instance of Master backed with memory (not etcd).
 | 
			
		||||
func NewMemoryServer(minions []string, podInfoGetter client.PodInfoGetter, cloud cloudprovider.Interface) *Master {
 | 
			
		||||
	m := &Master{
 | 
			
		||||
		podRegistry:        registry.MakeMemoryRegistry(),
 | 
			
		||||
@@ -55,7 +55,7 @@ func NewMemoryServer(minions []string, podInfoGetter client.PodInfoGetter, cloud
 | 
			
		||||
	return m
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// New returns a new apiserver.
 | 
			
		||||
// New returns a new instance of Master connected to the given etcdServer.
 | 
			
		||||
func New(etcdServers, minions []string, podInfoGetter client.PodInfoGetter, cloud cloudprovider.Interface, minionRegexp string) *Master {
 | 
			
		||||
	etcdClient := etcd.NewClient(etcdServers)
 | 
			
		||||
	minionRegistry := minionRegistryMaker(minions, cloud, minionRegexp)
 | 
			
		||||
@@ -94,7 +94,7 @@ func (m *Master) init(cloud cloudprovider.Interface, podInfoGetter client.PodInf
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Run runs master. Never returns.
 | 
			
		||||
// Run begins serving the Kubernetes API. It never returns.
 | 
			
		||||
func (m *Master) Run(myAddress, apiPrefix string) error {
 | 
			
		||||
	endpoints := registry.MakeEndpointController(m.serviceRegistry, m.podRegistry)
 | 
			
		||||
	go util.Forever(func() { endpoints.SyncServiceEndpoints() }, time.Second*10)
 | 
			
		||||
@@ -111,7 +111,7 @@ func (m *Master) Run(myAddress, apiPrefix string) error {
 | 
			
		||||
 | 
			
		||||
// ConstructHandler returns an http.Handler which serves Kubernetes API.
 | 
			
		||||
// Instead of calling Run, you can call this function to get a handler for your own server.
 | 
			
		||||
// Intended for testing. Only call once.
 | 
			
		||||
// It is intended for testing. Only call once.
 | 
			
		||||
func (m *Master) ConstructHandler(apiPrefix string) http.Handler {
 | 
			
		||||
	endpoints := registry.MakeEndpointController(m.serviceRegistry, m.podRegistry)
 | 
			
		||||
	go util.Forever(func() { endpoints.SyncServiceEndpoints() }, time.Second*10)
 | 
			
		||||
 
 | 
			
		||||
@@ -40,7 +40,7 @@ type PodCache struct {
 | 
			
		||||
	podLock sync.Mutex
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewPodCache returns a new PodCache.
 | 
			
		||||
// NewPodCache returns a new PodCache which watches container information registered in the given PodRegistry.
 | 
			
		||||
func NewPodCache(info client.PodInfoGetter, pods registry.PodRegistry, period time.Duration) *PodCache {
 | 
			
		||||
	return &PodCache{
 | 
			
		||||
		containerInfo: info,
 | 
			
		||||
@@ -88,7 +88,8 @@ func (p *PodCache) UpdateAllContainers() {
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Loop runs forever, it is expected to be placed in a go routine.
 | 
			
		||||
// Loop begins watching updates of container information.
 | 
			
		||||
// It runs forever, and is expected to be placed in a go routine.
 | 
			
		||||
func (p *PodCache) Loop() {
 | 
			
		||||
	util.Forever(func() { p.UpdateAllContainers() }, p.period)
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -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