generator_vault.go 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. // Vault provider common spec
  35. Provider *esv1beta1.VaultProvider `json:"provider"`
  36. // Vault path to obtain the dynamic secret from
  37. Path string `json:"path"`
  38. }
  39. // +kubebuilder:validation:Enum=Data;Auth
  40. type VaultDynamicSecretResultType string
  41. const (
  42. VaultDynamicSecretResultTypeData VaultDynamicSecretResultType = "Data"
  43. VaultDynamicSecretResultTypeAuth VaultDynamicSecretResultType = "Auth"
  44. )
  45. // +kubebuilder:object:root=true
  46. // +kubebuilder:storageversion
  47. // +kubebuilder:subresource:status
  48. // +kubebuilder:metadata:labels="external-secrets.io/component=controller"
  49. // +kubebuilder:resource:scope=Namespaced,categories={external-secrets, external-secrets-generators},shortName=vaultdynamicsecret
  50. type VaultDynamicSecret struct {
  51. metav1.TypeMeta `json:",inline"`
  52. metav1.ObjectMeta `json:"metadata,omitempty"`
  53. Spec VaultDynamicSecretSpec `json:"spec,omitempty"`
  54. }
  55. // +kubebuilder:object:root=true
  56. type VaultDynamicSecretList struct {
  57. metav1.TypeMeta `json:",inline"`
  58. metav1.ListMeta `json:"metadata,omitempty"`
  59. Items []VaultDynamicSecret `json:"items"`
  60. }