-
Notifications
You must be signed in to change notification settings - Fork 1
/
secrets.go
29 lines (27 loc) · 887 Bytes
/
secrets.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package testkube
import (
"github.com/jenkins-x/jx/pkg/kube"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// CreateTestPipelineGitSecret creates a test git pipeline credential secret
func CreateTestPipelineGitSecret(gitServiceKind string, name string, gitUrl string, username string, password string) corev1.Secret {
return corev1.Secret{
ObjectMeta: metav1.ObjectMeta{
Name: kube.ToValidName(name),
Annotations: map[string]string{
kube.AnnotationURL: gitUrl,
kube.AnnotationName: name,
},
Labels: map[string]string{
kube.LabelKind: kube.ValueKindGit,
kube.LabelCredentialsType: kube.ValueCredentialTypeUsernamePassword,
kube.LabelServiceKind: gitServiceKind,
},
},
Data: map[string][]byte{
kube.SecretDataUsername: []byte(username),
kube.SecretDataPassword: []byte(password),
},
}
}