1 package servicemirror 2 3 import ( 4 "fmt" 5 6 consts "github.com/linkerd/linkerd2/pkg/k8s" 7 corev1 "k8s.io/api/core/v1" 8 ) 9 10 // ParseRemoteClusterSecret extracts the credentials used to access the remote cluster 11 func ParseRemoteClusterSecret(secret *corev1.Secret) ([]byte, error) { 12 config, hasConfig := secret.Data[consts.ConfigKeyName] 13 14 if !hasConfig { 15 return nil, fmt.Errorf("secret should contain target cluster name as annotation %s", consts.RemoteClusterNameLabel) 16 } 17 18 return config, nil 19 } 20