conjur.go 4.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. limitations under the License.
  10. */
  11. package conjur
  12. import (
  13. // nolint
  14. . "github.com/onsi/ginkgo/v2"
  15. "github.com/external-secrets/external-secrets-e2e/framework"
  16. "github.com/external-secrets/external-secrets-e2e/suites/provider/cases/common"
  17. )
  18. const (
  19. withTokenAuth = "with apikey auth"
  20. withJWTK8s = "with jwt k8s provider"
  21. withJWTK8sHostID = "with jwt k8s hostid provider"
  22. )
  23. var _ = Describe("[conjur]", Label("conjur"), func() {
  24. f := framework.New("eso-conjur")
  25. prov := newConjurProvider(f)
  26. DescribeTable("sync secrets",
  27. framework.TableFuncWithExternalSecret(f, prov),
  28. // use api key auth
  29. framework.Compose(withTokenAuth, f, common.FindByName, useApiKeyAuth),
  30. framework.Compose(withTokenAuth, f, common.FindByNameAndRewrite, useApiKeyAuth),
  31. framework.Compose(withTokenAuth, f, common.FindByTag, useApiKeyAuth),
  32. framework.Compose(withTokenAuth, f, common.SimpleDataSync, useApiKeyAuth),
  33. framework.Compose(withTokenAuth, f, common.SyncWithoutTargetName, useApiKeyAuth),
  34. framework.Compose(withTokenAuth, f, common.JSONDataFromSync, useApiKeyAuth),
  35. framework.Compose(withTokenAuth, f, common.JSONDataFromRewrite, useApiKeyAuth),
  36. framework.Compose(withTokenAuth, f, common.JSONDataWithProperty, useApiKeyAuth),
  37. framework.Compose(withTokenAuth, f, common.JSONDataWithTemplate, useApiKeyAuth),
  38. framework.Compose(withTokenAuth, f, common.DataPropertyDockerconfigJSON, useApiKeyAuth),
  39. framework.Compose(withTokenAuth, f, common.JSONDataWithoutTargetName, useApiKeyAuth),
  40. framework.Compose(withTokenAuth, f, common.DecodingPolicySync, useApiKeyAuth),
  41. framework.Compose(withTokenAuth, f, common.JSONDataWithTemplateFromLiteral, useApiKeyAuth),
  42. framework.Compose(withTokenAuth, f, common.TemplateFromConfigmaps, useApiKeyAuth),
  43. framework.Compose(withTokenAuth, f, common.SSHKeySync, useApiKeyAuth),
  44. framework.Compose(withTokenAuth, f, common.SSHKeySyncDataProperty, useApiKeyAuth),
  45. framework.Compose(withTokenAuth, f, common.DockerJSONConfig, useApiKeyAuth),
  46. framework.Compose(withTokenAuth, f, common.NestedJSONWithGJSON, useApiKeyAuth),
  47. // use jwt k8s provider
  48. framework.Compose(withJWTK8s, f, common.FindByName, useJWTK8sProvider),
  49. framework.Compose(withJWTK8s, f, common.FindByNameAndRewrite, useJWTK8sProvider),
  50. framework.Compose(withJWTK8s, f, common.FindByTag, useJWTK8sProvider),
  51. framework.Compose(withJWTK8s, f, common.SimpleDataSync, useJWTK8sProvider),
  52. framework.Compose(withJWTK8s, f, common.SyncWithoutTargetName, useJWTK8sProvider),
  53. framework.Compose(withJWTK8s, f, common.JSONDataFromSync, useJWTK8sProvider),
  54. framework.Compose(withJWTK8s, f, common.JSONDataFromRewrite, useJWTK8sProvider),
  55. // use jwt k8s hostid provider
  56. framework.Compose(withJWTK8sHostID, f, common.FindByName, useJWTK8sHostIDProvider),
  57. framework.Compose(withJWTK8sHostID, f, common.FindByNameAndRewrite, useJWTK8sHostIDProvider),
  58. framework.Compose(withJWTK8sHostID, f, common.FindByTag, useJWTK8sHostIDProvider),
  59. framework.Compose(withJWTK8sHostID, f, common.SimpleDataSync, useJWTK8sHostIDProvider),
  60. framework.Compose(withJWTK8sHostID, f, common.SyncWithoutTargetName, useJWTK8sHostIDProvider),
  61. framework.Compose(withJWTK8sHostID, f, common.JSONDataFromSync, useJWTK8sHostIDProvider),
  62. framework.Compose(withJWTK8sHostID, f, common.JSONDataFromRewrite, useJWTK8sHostIDProvider),
  63. )
  64. })
  65. func useApiKeyAuth(tc *framework.TestCase) {
  66. tc.ExternalSecret.Spec.SecretStoreRef.Name = tc.Framework.Namespace.Name
  67. }
  68. func useJWTK8sProvider(tc *framework.TestCase) {
  69. tc.ExternalSecret.Spec.SecretStoreRef.Name = jwtK8sProviderName
  70. }
  71. func useJWTK8sHostIDProvider(tc *framework.TestCase) {
  72. tc.ExternalSecret.Spec.SecretStoreRef.Name = jwtK8sHostIDProviderName
  73. }