secretsmanager_managed.go 5.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /*
  2. Licensed under the Apache License, Version 2.0 (the "License");
  3. you may not use this file except in compliance with the License.
  4. You may obtain a copy of the License at
  5. http://www.apache.org/licenses/LICENSE-2.0
  6. Unless required by applicable law or agreed to in writing, software
  7. distributed under the License is distributed on an "AS IS" BASIS,
  8. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  9. See the License for the specific language governing permissions and
  10. limitations under the License.
  11. */
  12. package aws
  13. import (
  14. // nolint
  15. . "github.com/onsi/ginkgo/v2"
  16. "github.com/external-secrets/external-secrets-e2e/framework"
  17. "github.com/external-secrets/external-secrets-e2e/framework/addon"
  18. awscommon "github.com/external-secrets/external-secrets-e2e/suites/provider/cases/aws"
  19. "github.com/external-secrets/external-secrets-e2e/suites/provider/cases/common"
  20. )
  21. // here we use the global eso instance
  22. // that uses the service account in the default namespace
  23. // which was created by terraform.
  24. var _ = Describe("[awsmanaged] IRSA via referenced service account", Label("aws", "secretsmanager", "managed"), func() {
  25. f := framework.New("eso-aws-managed")
  26. prov := NewFromEnv(f)
  27. // nolint
  28. DescribeTable("sync secretsmanager secrets",
  29. framework.TableFuncWithExternalSecret(f,
  30. prov),
  31. framework.Compose(awscommon.WithReferencedIRSA, f, common.SimpleDataSync, awscommon.UseClusterSecretStore),
  32. framework.Compose(awscommon.WithReferencedIRSA, f, common.NestedJSONWithGJSON, awscommon.UseClusterSecretStore),
  33. framework.Compose(awscommon.WithReferencedIRSA, f, common.JSONDataFromSync, awscommon.UseClusterSecretStore),
  34. framework.Compose(awscommon.WithReferencedIRSA, f, common.JSONDataWithProperty, awscommon.UseClusterSecretStore),
  35. framework.Compose(awscommon.WithReferencedIRSA, f, common.JSONDataWithTemplate, awscommon.UseClusterSecretStore),
  36. framework.Compose(awscommon.WithReferencedIRSA, f, common.DockerJSONConfig, awscommon.UseClusterSecretStore),
  37. framework.Compose(awscommon.WithReferencedIRSA, f, common.DataPropertyDockerconfigJSON, awscommon.UseClusterSecretStore),
  38. framework.Compose(awscommon.WithReferencedIRSA, f, common.SSHKeySync, awscommon.UseClusterSecretStore),
  39. framework.Compose(awscommon.WithReferencedIRSA, f, common.SSHKeySyncDataProperty, awscommon.UseClusterSecretStore),
  40. framework.Compose(awscommon.WithReferencedIRSA, f, common.SyncWithoutTargetName, awscommon.UseClusterSecretStore),
  41. framework.Compose(awscommon.WithReferencedIRSA, f, common.JSONDataWithoutTargetName, awscommon.UseClusterSecretStore),
  42. framework.Compose(awscommon.WithReferencedIRSA, f, common.FindByName, awscommon.UseClusterSecretStore),
  43. framework.Compose(awscommon.WithReferencedIRSA, f, common.FindByNameWithPath, awscommon.UseClusterSecretStore),
  44. framework.Compose(awscommon.WithReferencedIRSA, f, common.FindByTag, awscommon.UseClusterSecretStore),
  45. framework.Compose(awscommon.WithReferencedIRSA, f, common.FindByTagWithPath, awscommon.UseClusterSecretStore),
  46. )
  47. })
  48. // here we create a central eso instance in the default namespace
  49. // that mounts the service account which was created by terraform.
  50. var _ = Describe("[awsmanaged] with mounted IRSA", Label("aws", "secretsmanager", "managed"), func() {
  51. f := framework.New("eso-aws-managed")
  52. prov := NewFromEnv(f)
  53. // each test case gets its own ESO instance
  54. BeforeEach(func() {
  55. f.Install(addon.NewESO(
  56. addon.WithControllerClass(f.BaseName),
  57. addon.WithServiceAccount(prov.ServiceAccountName),
  58. addon.WithReleaseName(f.Namespace.Name),
  59. addon.WithNamespace("default"),
  60. addon.WithoutWebhook(),
  61. addon.WithoutCertController(),
  62. ))
  63. })
  64. // nolint
  65. DescribeTable("sync secretsmanager secrets",
  66. framework.TableFuncWithExternalSecret(f,
  67. prov),
  68. framework.Compose(awscommon.WithMountedIRSA, f, common.SimpleDataSync, awscommon.UseMountedIRSAStore),
  69. framework.Compose(awscommon.WithMountedIRSA, f, common.NestedJSONWithGJSON, awscommon.UseMountedIRSAStore),
  70. framework.Compose(awscommon.WithMountedIRSA, f, common.JSONDataFromSync, awscommon.UseMountedIRSAStore),
  71. framework.Compose(awscommon.WithMountedIRSA, f, common.JSONDataWithProperty, awscommon.UseMountedIRSAStore),
  72. framework.Compose(awscommon.WithMountedIRSA, f, common.JSONDataWithTemplate, awscommon.UseMountedIRSAStore),
  73. framework.Compose(awscommon.WithMountedIRSA, f, common.DockerJSONConfig, awscommon.UseMountedIRSAStore),
  74. framework.Compose(awscommon.WithMountedIRSA, f, common.DataPropertyDockerconfigJSON, awscommon.UseMountedIRSAStore),
  75. framework.Compose(awscommon.WithMountedIRSA, f, common.SSHKeySync, awscommon.UseMountedIRSAStore),
  76. framework.Compose(awscommon.WithMountedIRSA, f, common.SSHKeySyncDataProperty, awscommon.UseMountedIRSAStore),
  77. framework.Compose(awscommon.WithMountedIRSA, f, common.SyncWithoutTargetName, awscommon.UseMountedIRSAStore),
  78. framework.Compose(awscommon.WithMountedIRSA, f, common.JSONDataWithoutTargetName, awscommon.UseMountedIRSAStore),
  79. framework.Compose(awscommon.WithMountedIRSA, f, common.FindByName, awscommon.UseMountedIRSAStore),
  80. framework.Compose(awscommon.WithMountedIRSA, f, common.FindByNameWithPath, awscommon.UseMountedIRSAStore),
  81. framework.Compose(awscommon.WithMountedIRSA, f, common.FindByTag, awscommon.UseMountedIRSAStore),
  82. framework.Compose(awscommon.WithMountedIRSA, f, common.FindByTagWithPath, awscommon.UseMountedIRSAStore),
  83. )
  84. })