generator_vault.go 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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 v1alpha1
  13. import (
  14. apiextensions "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
  15. metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
  16. esv1beta1 "github.com/external-secrets/external-secrets/apis/externalsecrets/v1beta1"
  17. )
  18. type VaultDynamicSecretSpec struct {
  19. // Used to select the correct ESO controller (think: ingress.ingressClassName)
  20. // The ESO controller is instantiated with a specific controller name and filters VDS based on this property
  21. // +optional
  22. Controller string `json:"controller,omitempty"`
  23. // Vault API method to use (GET/POST/other)
  24. Method string `json:"method,omitempty"`
  25. // Parameters to pass to Vault write (for non-GET methods)
  26. Parameters *apiextensions.JSON `json:"parameters,omitempty"`
  27. // Result type defines which data is returned from the generator.
  28. // By default it is the "data" section of the Vault API response.
  29. // When using e.g. /auth/token/create the "data" section is empty but
  30. // the "auth" section contains the generated token.
  31. // Please refer to the vault docs regarding the result data structure.
  32. // +kubebuilder:default=Data
  33. ResultType VaultDynamicSecretResultType `json:"resultType,omitempty"`
  34. // Used to configure http retries if failed
  35. // +optional
  36. RetrySettings *esv1beta1.SecretStoreRetrySettings `json:"retrySettings,omitempty"`
  37. // Vault provider common spec
  38. Provider *esv1beta1.VaultProvider `json:"provider"`
  39. // Vault path to obtain the dynamic secret from
  40. Path string `json:"path"`
  41. }
  42. // +kubebuilder:validation:Enum=Data;Auth
  43. type VaultDynamicSecretResultType string
  44. const (
  45. VaultDynamicSecretResultTypeData VaultDynamicSecretResultType = "Data"
  46. VaultDynamicSecretResultTypeAuth VaultDynamicSecretResultType = "Auth"
  47. )
  48. // +kubebuilder:object:root=true
  49. // +kubebuilder:storageversion
  50. // +kubebuilder:subresource:status
  51. // +kubebuilder:metadata:labels="external-secrets.io/component=controller"
  52. // +kubebuilder:resource:scope=Namespaced,categories={external-secrets, external-secrets-generators},shortName=vaultdynamicsecret
  53. type VaultDynamicSecret struct {
  54. metav1.TypeMeta `json:",inline"`
  55. metav1.ObjectMeta `json:"metadata,omitempty"`
  56. Spec VaultDynamicSecretSpec `json:"spec,omitempty"`
  57. }
  58. // +kubebuilder:object:root=true
  59. type VaultDynamicSecretList struct {
  60. metav1.TypeMeta `json:",inline"`
  61. metav1.ListMeta `json:"metadata,omitempty"`
  62. Items []VaultDynamicSecret `json:"items"`
  63. }