parameterstore.go 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. awscommon "github.com/external-secrets/external-secrets-e2e/suites/provider/cases/aws"
  18. "github.com/external-secrets/external-secrets-e2e/suites/provider/cases/common"
  19. esapi "github.com/external-secrets/external-secrets/apis/externalsecrets/v1beta1"
  20. )
  21. const (
  22. withStaticAuth = "with static auth"
  23. withReferentStaticAuth = "with static referent auth"
  24. )
  25. var _ = Describe("[aws] ", Label("aws", "parameterstore"), func() {
  26. f := framework.New("eso-aws-ps")
  27. prov := NewFromEnv(f)
  28. DescribeTable("sync secrets",
  29. framework.TableFuncWithExternalSecret(f,
  30. prov),
  31. framework.Compose(withStaticAuth, f, common.SimpleDataSync, useStaticAuth),
  32. framework.Compose(withStaticAuth, f, common.NestedJSONWithGJSON, useStaticAuth),
  33. framework.Compose(withStaticAuth, f, common.JSONDataFromSync, useStaticAuth),
  34. framework.Compose(withStaticAuth, f, common.JSONDataFromRewrite, useStaticAuth),
  35. framework.Compose(withStaticAuth, f, common.JSONDataWithProperty, useStaticAuth),
  36. framework.Compose(withStaticAuth, f, common.JSONDataWithTemplate, useStaticAuth),
  37. framework.Compose(withStaticAuth, f, common.DockerJSONConfig, useStaticAuth),
  38. framework.Compose(withStaticAuth, f, common.DataPropertyDockerconfigJSON, useStaticAuth),
  39. framework.Compose(withStaticAuth, f, common.SSHKeySync, useStaticAuth),
  40. framework.Compose(withStaticAuth, f, common.SSHKeySyncDataProperty, useStaticAuth),
  41. framework.Compose(withStaticAuth, f, common.SyncWithoutTargetName, useStaticAuth),
  42. framework.Compose(withStaticAuth, f, common.JSONDataWithoutTargetName, useStaticAuth),
  43. framework.Compose(withStaticAuth, f, common.SyncV1Alpha1, useStaticAuth),
  44. framework.Compose(withStaticAuth, f, common.DeletionPolicyDelete, useStaticAuth),
  45. // referent auth
  46. framework.Compose(withReferentStaticAuth, f, common.SimpleDataSync, useReferentStaticAuth),
  47. // These are specific to parameterstore
  48. framework.Compose(withStaticAuth, f, FindByName, useStaticAuth),
  49. framework.Compose(withStaticAuth, f, FindByNameWithPath, useStaticAuth),
  50. framework.Compose(withStaticAuth, f, FindByTag, useStaticAuth),
  51. framework.Compose(withStaticAuth, f, FindByTagWithPath, useStaticAuth),
  52. framework.Compose(withStaticAuth, f, VersionedParameter(prov), useStaticAuth),
  53. )
  54. })
  55. func useStaticAuth(tc *framework.TestCase) {
  56. tc.ExternalSecret.Spec.SecretStoreRef.Name = awscommon.StaticStoreName
  57. if tc.ExternalSecretV1Alpha1 != nil {
  58. tc.ExternalSecretV1Alpha1.Spec.SecretStoreRef.Name = awscommon.StaticStoreName
  59. }
  60. }
  61. func useReferentStaticAuth(tc *framework.TestCase) {
  62. tc.ExternalSecret.Spec.SecretStoreRef.Name = awscommon.ReferentSecretStoreName(tc.Framework)
  63. tc.ExternalSecret.Spec.SecretStoreRef.Kind = esapi.ClusterSecretStoreKind
  64. }