kubesphere.io/api@v0.0.0-20231107125330-c9a03957060c/devops/v1alpha3/credential_types.go (about)

     1  /*
     2  Copyright 2020 The KubeSphere Authors.
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8      http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  
    17  package v1alpha3
    18  
    19  import v1 "k8s.io/api/core/v1"
    20  
    21  /*
    22  *
    23  We use a special type of secret as a credential for DevOps.
    24  This file will not contain CRD, but the credential type constants and their fields.
    25  */
    26  const (
    27  	CredentialFinalizerName  = "finalizers.kubesphere.io/credential"
    28  	DevOpsCredentialPrefix   = "credential.devops.kubesphere.io/"
    29  	DevOpsCredentialDataHash = DevOpsCredentialPrefix + "datahash"
    30  	// SecretTypeBasicAuth contains data needed for basic authentication.
    31  	//
    32  	// Required at least one of fields:
    33  	// - Secret.Data["username"] - username used for authentication
    34  	// - Secret.Data["password"] - password or token needed for authentication
    35  	SecretTypeBasicAuth v1.SecretType = DevOpsCredentialPrefix + "basic-auth"
    36  	// BasicAuthUsernameKey is the key of the username for SecretTypeBasicAuth secrets
    37  	BasicAuthUsernameKey = "username"
    38  	// BasicAuthPasswordKey is the key of the password or token for SecretTypeBasicAuth secrets
    39  	BasicAuthPasswordKey = "password"
    40  
    41  	// SecretTypeSSHAuth contains data needed for ssh authentication.
    42  	//
    43  	// Required at least one of fields:
    44  	// - Secret.Data["username"] - username used for authentication
    45  	// - Secret.Data["passphrase"] - passphrase needed for authentication
    46  	// - Secret.Data["privatekey"] - privatekey needed for authentication
    47  	SecretTypeSSHAuth v1.SecretType = DevOpsCredentialPrefix + "ssh-auth"
    48  	// SSHAuthUsernameKey is the key of the username for SecretTypeSSHAuth secrets
    49  	SSHAuthUsernameKey = "username"
    50  	// SSHAuthPrivateKey is the key of the passphrase for SecretTypeSSHAuth secrets
    51  	SSHAuthPassphraseKey = "passphrase"
    52  	// SSHAuthPrivateKey is the key of the privatekey for SecretTypeSSHAuth secrets
    53  	SSHAuthPrivateKey = "private_key"
    54  
    55  	// SecretTypeSecretText contains data.
    56  	//
    57  	// Required at least one of fields:
    58  	// - Secret.Data["secret"] - secret
    59  	SecretTypeSecretText v1.SecretType = DevOpsCredentialPrefix + "secret-text"
    60  	// SecretTextSecretKey is the key of the secret for SecretTypeSecretText secrets
    61  	SecretTextSecretKey = "secret"
    62  
    63  	// SecretTypeKubeConfig contains data.
    64  	//
    65  	// Required at least one of fields:
    66  	// - Secret.Data["secret"] - secret
    67  	SecretTypeKubeConfig v1.SecretType = DevOpsCredentialPrefix + "kubeconfig"
    68  	// KubeConfigSecretKey is the key of the secret for SecretTypeKubeConfig secrets
    69  	KubeConfigSecretKey = "content"
    70  	//	CredentialAutoSyncAnnoKey is used to indicate whether the secret is automatically synchronized to devops.
    71  	//	In the old version, the credential is stored in jenkins and cannot be obtained.
    72  	//	This field is set to ensure that the secret is not overwritten by a nil value.
    73  	CredentialAutoSyncAnnoKey   = DevOpsCredentialPrefix + "autosync"
    74  	CredentialSyncStatusAnnoKey = DevOpsCredentialPrefix + "syncstatus"
    75  	CredentialSyncTimeAnnoKey   = DevOpsCredentialPrefix + "synctime"
    76  	CredentialSyncMsgAnnoKey    = DevOpsCredentialPrefix + "syncmsg"
    77  )