models.go 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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 webhook
  13. import (
  14. metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
  15. esv1 "github.com/external-secrets/external-secrets/apis/externalsecrets/v1"
  16. esmeta "github.com/external-secrets/external-secrets/apis/meta/v1"
  17. )
  18. type Spec struct {
  19. // Webhook Method
  20. // +optional, default GET
  21. Method string `json:"method,omitempty"`
  22. // Webhook url to call
  23. URL string `json:"url"`
  24. // Headers
  25. // +optional
  26. Headers map[string]string `json:"headers,omitempty"`
  27. // Auth specifies a authorization protocol. Only one protocol may be set.
  28. // +optional
  29. Auth *AuthorizationProtocol `json:"auth,omitempty"`
  30. // Body
  31. // +optional
  32. Body string `json:"body,omitempty"`
  33. // Timeout
  34. // +optional
  35. Timeout *metav1.Duration `json:"timeout,omitempty"`
  36. // Result formatting
  37. Result Result `json:"result"`
  38. // Secrets to fill in templates
  39. // These secrets will be passed to the templating function as key value pairs under the given name
  40. // +optional
  41. Secrets []Secret `json:"secrets,omitempty"`
  42. // PEM encoded CA bundle used to validate webhook server certificate. Only used
  43. // if the Server URL is using HTTPS protocol. This parameter is ignored for
  44. // plain HTTP protocol connection. If not set the system root certificates
  45. // are used to validate the TLS connection.
  46. // +optional
  47. CABundle []byte `json:"caBundle,omitempty"`
  48. // The provider for the CA bundle to use to validate webhook server certificate.
  49. // +optional
  50. CAProvider *esv1.CAProvider `json:"caProvider,omitempty"`
  51. }
  52. // AuthorizationProtocol contains the protocol-specific configuration
  53. // +kubebuilder:validation:MinProperties=1
  54. // +kubebuilder:validation:MaxProperties=1
  55. type AuthorizationProtocol struct {
  56. // NTLMProtocol configures the store to use NTLM for auth
  57. // +optional
  58. NTLM *NTLMProtocol `json:"ntlm,omitempty"`
  59. // Define other protocols here
  60. }
  61. // NTLMProtocol contains the NTLM-specific configuration.
  62. type NTLMProtocol struct {
  63. UserName esmeta.SecretKeySelector `json:"usernameSecret"`
  64. Password esmeta.SecretKeySelector `json:"passwordSecret"`
  65. }
  66. type Result struct {
  67. // Json path of return value
  68. // +optional
  69. JSONPath string `json:"jsonPath,omitempty"`
  70. }
  71. type Secret struct {
  72. // Name of this secret in templates
  73. Name string `json:"name"`
  74. // Secret ref to fill in credentials
  75. SecretRef esmeta.SecretKeySelector `json:"secretRef"`
  76. }