假设我知道以下秘密参数:
"name": "aaa",
"docker-server": "a.b.com",
"docker-username": "aaa",
"docker-password": "aaaa",
"docker-email": "aaa@gmail.com"
然后我想用client-go创建一个pull-image secret
secret := &corev1.Secret{
ObjectMeta: metav1.ObjectMeta{
Name: "pull-image-secret",
Namespace: "aaaaaa",
},
Type: "kubernetes.io/dockerconfigjson",
Data: map[string][]byte{".dockerconfigjson": []byte(secretData)},
}
err = k8sClient.Create(context.Background(), secret)
我的问题是,如何将秘密参数转换为秘密数据?