Skip to content
Snippets Groups Projects
Commit 9af6c539 authored by scott's avatar scott
Browse files

Fix latest comment

parent e5c3ff50
No related branches found
No related tags found
No related merge requests found
......@@ -92,7 +92,7 @@ func (l *configurationListener) Next() (*registry.ServiceEvent, error) {
for {
select {
case <-l.registry.Done():
logger.Warnf("listener's kubernetes client connection is broken, so kubernetes event listener exit now.")
logger.Warnf("listener's kubernetes client connection is broken, so kubernetes event listener exits now.")
return nil, perrors.New("listener stopped")
case e := <-l.events:
......
......@@ -150,7 +150,7 @@ func newKubernetesRegistry(url *common.URL) (registry.Registry, error) {
r.InitBaseRegistry(url, r)
if err := kubernetes.ValidateClient(r); err != nil {
return nil, err
return nil, perrors.WithStack(err)
}
r.WaitGroup().Add(1)
......@@ -162,10 +162,11 @@ func newKubernetesRegistry(url *common.URL) (registry.Registry, error) {
return r, nil
}
func newMockKubernetesRegistry(url *common.URL, namespace string, clientGeneratorFunc func() (k8s.Interface, error)) (
registry.Registry,
error,
) {
func newMockKubernetesRegistry(
url *common.URL,
namespace string,
clientGeneratorFunc func() (k8s.Interface, error),
) (registry.Registry, error) {
var err error
......
......@@ -418,7 +418,6 @@ func (c *Client) handleWatchedPodEvent(p *v1.Pod, eventType watch.EventType) {
func (c *Client) unmarshalRecord(record string) ([]*Object, error) {
if len(record) == 0 {
// NOTICE:
// []*Object is nil.
return nil, nil
}
......@@ -503,12 +502,14 @@ func (c *Client) patchCurrentPod(patch []byte) (*v1.Pod, error) {
return updatedPod, nil
}
// assemble the dubbo kubernete label
// assemble the dubbo kubernetes label
// every dubbo instance should be labeled spec {"dubbo.io/label":"dubbo.io/label-value"} label
func (c *Client) assembleDUBBOLabel(currentPod *v1.Pod) (oldPod *v1.Pod, newPod *v1.Pod, err error) {
func (c *Client) assembleDUBBOLabel(currentPod *v1.Pod) (*v1.Pod, *v1.Pod, error) {
oldPod = &v1.Pod{}
newPod = &v1.Pod{}
var (
oldPod = &v1.Pod{}
newPod = &v1.Pod{}
)
oldPod.Labels = make(map[string]string, 8)
newPod.Labels = make(map[string]string, 8)
......@@ -517,8 +518,7 @@ func (c *Client) assembleDUBBOLabel(currentPod *v1.Pod) (oldPod *v1.Pod, newPod
if currentPod.GetLabels()[DubboIOLabelKey] == DubboIOLabelValue {
// already have label
err = ErrDubboLabelAlreadyExist
return
return nil, nil, ErrDubboLabelAlreadyExist
}
}
......@@ -529,7 +529,7 @@ func (c *Client) assembleDUBBOLabel(currentPod *v1.Pod) (oldPod *v1.Pod, newPod
}
// assign new label for current pod
newPod.Labels[DubboIOLabelKey] = DubboIOLabelValue
return
return oldPod, newPod, nil
}
// assemble the dubbo kubernetes annotations
......
......@@ -84,7 +84,7 @@ type Store interface {
Done() <-chan struct{}
}
// Stopped Watcher
// Watcher
type Watcher interface {
// the watcher's id
ID() string
......@@ -200,9 +200,7 @@ func (s *storeImpl) Put(object *Object) error {
}
// valid
// valid the client status
// NOTICE:
// should protected by lock
// valid the client status should protected by lock
func (s *storeImpl) valid() error {
select {
case <-s.ctx.Done():
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment