azure_secret.go 4.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*
  2. Copyright © The ESO Authors
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. https://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. package azure
  14. import (
  15. // nolint
  16. . "github.com/onsi/ginkgo/v2"
  17. "github.com/external-secrets/external-secrets-e2e/framework"
  18. "github.com/external-secrets/external-secrets-e2e/suites/provider/cases/common"
  19. esapi "github.com/external-secrets/external-secrets/apis/externalsecrets/v1"
  20. )
  21. const (
  22. withStaticCredentials = "with static credentials"
  23. withReferentAuth = "with referent auth"
  24. withNewSDK = "with new SDK"
  25. )
  26. // keyvault type=secret should behave just like any other secret store.
  27. var _ = Describe("[azure]", Label("azure", "keyvault", "secret"), func() {
  28. f := framework.New("eso-azure")
  29. prov := newFromEnv(f)
  30. DescribeTable("sync secrets", framework.TableFuncWithExternalSecret(f, prov),
  31. framework.Compose(withStaticCredentials, f, common.SimpleDataSync, useStaticCredentials),
  32. framework.Compose(withStaticCredentials, f, common.NestedJSONWithGJSON, useStaticCredentials),
  33. framework.Compose(withStaticCredentials, f, common.JSONDataFromSync, useStaticCredentials),
  34. framework.Compose(withStaticCredentials, f, common.JSONDataFromRewrite, useStaticCredentials),
  35. framework.Compose(withStaticCredentials, f, common.JSONDataWithProperty, useStaticCredentials),
  36. framework.Compose(withStaticCredentials, f, common.JSONDataWithTemplate, useStaticCredentials),
  37. framework.Compose(withStaticCredentials, f, common.DockerJSONConfig, useStaticCredentials),
  38. framework.Compose(withStaticCredentials, f, common.DataPropertyDockerconfigJSON, useStaticCredentials),
  39. framework.Compose(withStaticCredentials, f, common.SSHKeySync, useStaticCredentials),
  40. framework.Compose(withStaticCredentials, f, common.SSHKeySyncDataProperty, useStaticCredentials),
  41. framework.Compose(withStaticCredentials, f, common.SyncWithoutTargetName, useStaticCredentials),
  42. framework.Compose(withStaticCredentials, f, common.JSONDataWithoutTargetName, useStaticCredentials),
  43. framework.Compose(withStaticCredentials, f, common.SimpleDataSync, useReferentAuth),
  44. // New SDK tests
  45. framework.Compose(withNewSDK, f, common.SimpleDataSync, useNewSDK),
  46. framework.Compose(withNewSDK, f, common.NestedJSONWithGJSON, useNewSDK),
  47. framework.Compose(withNewSDK, f, common.JSONDataFromSync, useNewSDK),
  48. framework.Compose(withNewSDK, f, common.JSONDataFromRewrite, useNewSDK),
  49. framework.Compose(withNewSDK, f, common.JSONDataWithProperty, useNewSDK),
  50. framework.Compose(withNewSDK, f, common.JSONDataWithTemplate, useNewSDK),
  51. framework.Compose(withNewSDK, f, common.DockerJSONConfig, useNewSDK),
  52. framework.Compose(withNewSDK, f, common.DataPropertyDockerconfigJSON, useNewSDK),
  53. framework.Compose(withNewSDK, f, common.SSHKeySync, useNewSDK),
  54. framework.Compose(withNewSDK, f, common.SSHKeySyncDataProperty, useNewSDK),
  55. framework.Compose(withNewSDK, f, common.SyncWithoutTargetName, useNewSDK),
  56. framework.Compose(withNewSDK, f, common.JSONDataWithoutTargetName, useNewSDK),
  57. framework.Compose(withNewSDK, f, common.SimpleDataSync, useReferentAuthNewSDK),
  58. )
  59. })
  60. func useStaticCredentials(tc *framework.TestCase) {
  61. tc.ExternalSecret.Spec.SecretStoreRef.Name = tc.Framework.Namespace.Name
  62. }
  63. func useReferentAuth(tc *framework.TestCase) {
  64. tc.ExternalSecret.Spec.SecretStoreRef.Name = referentAuthName(tc.Framework)
  65. tc.ExternalSecret.Spec.SecretStoreRef.Kind = esapi.ClusterSecretStoreKind
  66. }
  67. func useNewSDK(tc *framework.TestCase) {
  68. tc.ExternalSecret.Spec.SecretStoreRef.Name = tc.Framework.Namespace.Name + "-new-sdk"
  69. }
  70. func useReferentAuthNewSDK(tc *framework.TestCase) {
  71. tc.ExternalSecret.Spec.SecretStoreRef.Name = referentAuthName(tc.Framework) + "-new-sdk"
  72. tc.ExternalSecret.Spec.SecretStoreRef.Kind = esapi.ClusterSecretStoreKind
  73. }