You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: credential.go
    path of file: ./repos/erda/internal/tools/cluster-agent/pkg/client
    
    the code of the file until where you have to start completion: // Copyright (c) 2021 Terminus, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package client

import (
	"context"
	"fmt"
	"math/rand"
	"time"

	"github.com/sirupsen/logrus"
	corev1 "k8s.io/api/core/v1"
	k8serrors "k8s.io/apimachinery/pkg/api/errors"
	meta
    
func (c *Client) getRetryWatcher(cs kubernetes.Interface, ns string) (*watchtools.RetryWatcher, error) {
	selector, err := fields.ParseSelector(fmt.Sprintf("metadata.name=%s", apistructs.ErdaClusterCredential))
	if err != nil {
		return nil, fmt.Errorf("parse selector error: %v", err)
	}

	// Get or create secret
	secInit, err := cs.CoreV1().Secrets(ns).List(context.Background(), metav1.ListOptions{
		FieldSelector: selector.String(),
	})
	if err != nil && !k8serrors.IsNotFound(err) {
		return nil, fmt.Errorf("get init secret list error: %v", err)
	}

	// load initial secret
	if secInit != nil && len(secInit.Items) > 0 {
		initData, ok := secInit.Items[0].Data[apistructs.ClusterAccessKey]
		if !ok {
			logrus.Warn("no valid cluster access key was got")
		} else {
			logrus.Infof("load initial cluster access key, content %s", string(initData))
			c.setAccessKey(string(initData))
		}
	} else {
		logrus.Warn("no valid cluster access key was got")
	}

	// create retry watcher
	retryWatcher, err := watchtools.NewRetryWatcher(secInit.ResourceVersion, &cache.ListWatch{
		WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
			options.FieldSelector = selector.String()
			return cs.CoreV1().Secrets(ns).Watch(context.Background(), options)
		},
	})

	if err != nil {
		return nil, fmt.Errorf("create retry watcher error: %v", err)
	}

	return retryWatcher, nil
}