fix sync kubeconfig bug

Signed-off-by: shaowenchen <mail@chenshaowen.com>
This commit is contained in:
shaowenchen
2020-07-09 16:28:31 +08:00
parent 5223362cc8
commit fbaeddb897
2 changed files with 2 additions and 2 deletions

View File

@@ -64,7 +64,7 @@ const (
// - Secret.Data["secret"] - secret // - Secret.Data["secret"] - secret
SecretTypeKubeConfig v1.SecretType = DevOpsCredentialPrefix + "kubeconfig" SecretTypeKubeConfig v1.SecretType = DevOpsCredentialPrefix + "kubeconfig"
// KubeConfigSecretKey is the key of the secret for SecretTypeKubeConfig secrets // KubeConfigSecretKey is the key of the secret for SecretTypeKubeConfig secrets
KubeConfigSecretKey = "secret" KubeConfigSecretKey = "content"
// CredentialAutoSyncAnnoKey is used to indicate whether the secret is automatically synchronized to devops. // CredentialAutoSyncAnnoKey is used to indicate whether the secret is automatically synchronized to devops.
// In the old version, the credential is stored in jenkins and cannot be obtained. // In the old version, the credential is stored in jenkins and cannot be obtained.
// This field is set to ensure that the secret is not overwritten by a nil value. // This field is set to ensure that the secret is not overwritten by a nil value.

View File

@@ -89,7 +89,7 @@ func TestNewKubeconfigCredential(t *testing.T) {
Namespace: "test", Namespace: "test",
}, },
Type: "credential.devops.kubesphere.io/kubeconfig", Type: "credential.devops.kubesphere.io/kubeconfig",
Data: map[string][]byte{"secret": content}, Data: map[string][]byte{"content": content},
} }
credential := NewKubeconfigCredential(secret) credential := NewKubeconfigCredential(secret)
if credential.StaplerClass != "com.microsoft.jenkins.kubernetes.credentials.KubeconfigCredentials" { if credential.StaplerClass != "com.microsoft.jenkins.kubernetes.credentials.KubeconfigCredentials" {