|
@@ -22,6 +22,14 @@ import (
|
|
|
"github.com/external-secrets/external-secrets/e2e/framework"
|
|
"github.com/external-secrets/external-secrets/e2e/framework"
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
|
|
+const (
|
|
|
|
|
+ // Constants.
|
|
|
|
|
+ dockerConfigExampleName = "docker-config-example"
|
|
|
|
|
+ dockerConfigJSONKey = ".dockerconfigjson"
|
|
|
|
|
+ mysecretToStringTemplating = "{{ .mysecret | toString }}"
|
|
|
|
|
+ sshPrivateKey = "ssh-privatekey"
|
|
|
|
|
+)
|
|
|
|
|
+
|
|
|
// This case creates multiple secrets with simple key/value pairs and syncs them using multiple .Spec.Data blocks.
|
|
// This case creates multiple secrets with simple key/value pairs and syncs them using multiple .Spec.Data blocks.
|
|
|
// Not supported by: vault.
|
|
// Not supported by: vault.
|
|
|
func SimpleDataSync(f *framework.Framework) (string, func(*framework.TestCase)) {
|
|
func SimpleDataSync(f *framework.Framework) (string, func(*framework.TestCase)) {
|
|
@@ -289,7 +297,7 @@ func NestedJSONWithGJSON(f *framework.Framework) (string, func(*framework.TestCa
|
|
|
// not supported by: vault.
|
|
// not supported by: vault.
|
|
|
func DockerJSONConfig(f *framework.Framework) (string, func(*framework.TestCase)) {
|
|
func DockerJSONConfig(f *framework.Framework) (string, func(*framework.TestCase)) {
|
|
|
return "[common] should sync docker configurated json secrets with template simple", func(tc *framework.TestCase) {
|
|
return "[common] should sync docker configurated json secrets with template simple", func(tc *framework.TestCase) {
|
|
|
- cloudSecretName := fmt.Sprintf("%s-%s", f.Namespace.Name, "docker-config-example")
|
|
|
|
|
|
|
+ cloudSecretName := fmt.Sprintf("%s-%s", f.Namespace.Name, dockerConfigExampleName)
|
|
|
dockerconfig := `{"auths":{"https://index.docker.io/v1/": {"auth": "c3R...zE2"}}}`
|
|
dockerconfig := `{"auths":{"https://index.docker.io/v1/": {"auth": "c3R...zE2"}}}`
|
|
|
cloudSecretValue := fmt.Sprintf(`{"dockerconfig": %s}`, dockerconfig)
|
|
cloudSecretValue := fmt.Sprintf(`{"dockerconfig": %s}`, dockerconfig)
|
|
|
tc.Secrets = map[string]string{
|
|
tc.Secrets = map[string]string{
|
|
@@ -299,7 +307,7 @@ func DockerJSONConfig(f *framework.Framework) (string, func(*framework.TestCase)
|
|
|
tc.ExpectedSecret = &v1.Secret{
|
|
tc.ExpectedSecret = &v1.Secret{
|
|
|
Type: v1.SecretTypeOpaque,
|
|
Type: v1.SecretTypeOpaque,
|
|
|
Data: map[string][]byte{
|
|
Data: map[string][]byte{
|
|
|
- ".dockerconfigjson": []byte(dockerconfig),
|
|
|
|
|
|
|
+ dockerConfigJSONKey: []byte(dockerconfig),
|
|
|
},
|
|
},
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -315,7 +323,7 @@ func DockerJSONConfig(f *framework.Framework) (string, func(*framework.TestCase)
|
|
|
|
|
|
|
|
tc.ExternalSecret.Spec.Target.Template = &esv1alpha1.ExternalSecretTemplate{
|
|
tc.ExternalSecret.Spec.Target.Template = &esv1alpha1.ExternalSecretTemplate{
|
|
|
Data: map[string]string{
|
|
Data: map[string]string{
|
|
|
- ".dockerconfigjson": "{{ .mysecret | toString }}",
|
|
|
|
|
|
|
+ dockerConfigJSONKey: mysecretToStringTemplating,
|
|
|
},
|
|
},
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -326,7 +334,7 @@ func DockerJSONConfig(f *framework.Framework) (string, func(*framework.TestCase)
|
|
|
// Need to have a key holding dockerconfig to be supported by vault.
|
|
// Need to have a key holding dockerconfig to be supported by vault.
|
|
|
func DataPropertyDockerconfigJSON(f *framework.Framework) (string, func(*framework.TestCase)) {
|
|
func DataPropertyDockerconfigJSON(f *framework.Framework) (string, func(*framework.TestCase)) {
|
|
|
return "[common] should sync docker configurated json secrets with template", func(tc *framework.TestCase) {
|
|
return "[common] should sync docker configurated json secrets with template", func(tc *framework.TestCase) {
|
|
|
- cloudSecretName := fmt.Sprintf("%s-%s", f.Namespace.Name, "docker-config-example")
|
|
|
|
|
|
|
+ cloudSecretName := fmt.Sprintf("%s-%s", f.Namespace.Name, dockerConfigExampleName)
|
|
|
dockerconfigString := `"{\"auths\":{\"https://index.docker.io/v1/\": {\"auth\": \"c3R...zE2\"}}}"`
|
|
dockerconfigString := `"{\"auths\":{\"https://index.docker.io/v1/\": {\"auth\": \"c3R...zE2\"}}}"`
|
|
|
dockerconfig := `{"auths":{"https://index.docker.io/v1/": {"auth": "c3R...zE2"}}}`
|
|
dockerconfig := `{"auths":{"https://index.docker.io/v1/": {"auth": "c3R...zE2"}}}`
|
|
|
cloudSecretValue := fmt.Sprintf(`{"dockerconfig": %s}`, dockerconfigString)
|
|
cloudSecretValue := fmt.Sprintf(`{"dockerconfig": %s}`, dockerconfigString)
|
|
@@ -337,7 +345,7 @@ func DataPropertyDockerconfigJSON(f *framework.Framework) (string, func(*framewo
|
|
|
tc.ExpectedSecret = &v1.Secret{
|
|
tc.ExpectedSecret = &v1.Secret{
|
|
|
Type: v1.SecretTypeDockerConfigJson,
|
|
Type: v1.SecretTypeDockerConfigJson,
|
|
|
Data: map[string][]byte{
|
|
Data: map[string][]byte{
|
|
|
- ".dockerconfigjson": []byte(dockerconfig),
|
|
|
|
|
|
|
+ dockerConfigJSONKey: []byte(dockerconfig),
|
|
|
},
|
|
},
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -354,7 +362,7 @@ func DataPropertyDockerconfigJSON(f *framework.Framework) (string, func(*framewo
|
|
|
tc.ExternalSecret.Spec.Target.Template = &esv1alpha1.ExternalSecretTemplate{
|
|
tc.ExternalSecret.Spec.Target.Template = &esv1alpha1.ExternalSecretTemplate{
|
|
|
Type: v1.SecretTypeDockerConfigJson,
|
|
Type: v1.SecretTypeDockerConfigJson,
|
|
|
Data: map[string]string{
|
|
Data: map[string]string{
|
|
|
- ".dockerconfigjson": "{{ .mysecret | toString }}",
|
|
|
|
|
|
|
+ dockerConfigJSONKey: mysecretToStringTemplating,
|
|
|
},
|
|
},
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -411,7 +419,7 @@ func SSHKeySync(f *framework.Framework) (string, func(*framework.TestCase)) {
|
|
|
tc.ExpectedSecret = &v1.Secret{
|
|
tc.ExpectedSecret = &v1.Secret{
|
|
|
Type: v1.SecretTypeSSHAuth,
|
|
Type: v1.SecretTypeSSHAuth,
|
|
|
Data: map[string][]byte{
|
|
Data: map[string][]byte{
|
|
|
- "ssh-privatekey": []byte(sshSecretValue),
|
|
|
|
|
|
|
+ sshPrivateKey: []byte(sshSecretValue),
|
|
|
},
|
|
},
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -427,7 +435,7 @@ func SSHKeySync(f *framework.Framework) (string, func(*framework.TestCase)) {
|
|
|
tc.ExternalSecret.Spec.Target.Template = &esv1alpha1.ExternalSecretTemplate{
|
|
tc.ExternalSecret.Spec.Target.Template = &esv1alpha1.ExternalSecretTemplate{
|
|
|
Type: v1.SecretTypeSSHAuth,
|
|
Type: v1.SecretTypeSSHAuth,
|
|
|
Data: map[string]string{
|
|
Data: map[string]string{
|
|
|
- "ssh-privatekey": "{{ .mysecret | toString }}",
|
|
|
|
|
|
|
+ sshPrivateKey: mysecretToStringTemplating,
|
|
|
},
|
|
},
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -436,7 +444,7 @@ func SSHKeySync(f *framework.Framework) (string, func(*framework.TestCase)) {
|
|
|
// This case adds an ssh private key secret and syncs it.
|
|
// This case adds an ssh private key secret and syncs it.
|
|
|
func SSHKeySyncDataProperty(f *framework.Framework) (string, func(*framework.TestCase)) {
|
|
func SSHKeySyncDataProperty(f *framework.Framework) (string, func(*framework.TestCase)) {
|
|
|
return "[common] should sync ssh key with provider.", func(tc *framework.TestCase) {
|
|
return "[common] should sync ssh key with provider.", func(tc *framework.TestCase) {
|
|
|
- cloudSecretName := fmt.Sprintf("%s-%s", f.Namespace.Name, "docker-config-example")
|
|
|
|
|
|
|
+ cloudSecretName := fmt.Sprintf("%s-%s", f.Namespace.Name, dockerConfigExampleName)
|
|
|
SSHKey := `-----BEGIN OPENSSH PRIVATE KEY-----
|
|
SSHKey := `-----BEGIN OPENSSH PRIVATE KEY-----
|
|
|
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcn
|
|
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcn
|
|
|
NhAAAAAwEAAQAAAYEAsARoZUqo6L5dd0WRjZ2QPq/kKlbjtUY1njzJ01UtdC1u1eSJFUnV
|
|
NhAAAAAwEAAQAAAYEAsARoZUqo6L5dd0WRjZ2QPq/kKlbjtUY1njzJ01UtdC1u1eSJFUnV
|
|
@@ -483,7 +491,7 @@ func SSHKeySyncDataProperty(f *framework.Framework) (string, func(*framework.Tes
|
|
|
tc.ExpectedSecret = &v1.Secret{
|
|
tc.ExpectedSecret = &v1.Secret{
|
|
|
Type: v1.SecretTypeSSHAuth,
|
|
Type: v1.SecretTypeSSHAuth,
|
|
|
Data: map[string][]byte{
|
|
Data: map[string][]byte{
|
|
|
- "ssh-privatekey": []byte(SSHKey),
|
|
|
|
|
|
|
+ sshPrivateKey: []byte(SSHKey),
|
|
|
},
|
|
},
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -500,7 +508,7 @@ func SSHKeySyncDataProperty(f *framework.Framework) (string, func(*framework.Tes
|
|
|
tc.ExternalSecret.Spec.Target.Template = &esv1alpha1.ExternalSecretTemplate{
|
|
tc.ExternalSecret.Spec.Target.Template = &esv1alpha1.ExternalSecretTemplate{
|
|
|
Type: v1.SecretTypeSSHAuth,
|
|
Type: v1.SecretTypeSSHAuth,
|
|
|
Data: map[string]string{
|
|
Data: map[string]string{
|
|
|
- "ssh-privatekey": "{{ .mysecret | toString }}",
|
|
|
|
|
|
|
+ sshPrivateKey: mysecretToStringTemplating,
|
|
|
},
|
|
},
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|