kube.go 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. package integrations
  2. import "gorm.io/gorm"
  3. // KubeIntegrationName is the name of a kube auth mechanism
  4. type KubeIntegrationName string
  5. // The supported kube auth mechanisms
  6. const (
  7. KubeX509 KubeIntegrationName = "x509"
  8. KubeBasic = "basic"
  9. KubeBearer = "bearer"
  10. KubeLocal = "local"
  11. )
  12. // KubeIntegration represents the kube-native auth mechanisms: using x509 certs,
  13. // basic (username/password), bearer tokens, or local (using local kubeconfig)
  14. type KubeIntegration struct {
  15. gorm.Model
  16. // The name of the auth mechanism
  17. Mechanism KubeIntegrationName `json:"mechanism"`
  18. // The id of the user that linked this auth mechanism
  19. UserID uint `json:"user_id"`
  20. // The project that this integration belongs to
  21. ProjectID uint `json:"project_id"`
  22. // ------------------------------------------------------------------
  23. // All fields encrypted before storage.
  24. // ------------------------------------------------------------------
  25. // Certificate data is used by x509 auth mechanisms over TLS
  26. ClientCertificateData []byte `json:"client-certificate-data,omitempty"`
  27. ClientKeyData []byte `json:"client-key-data,omitempty"`
  28. // Token is used for bearer-token auth mechanisms
  29. Token []byte `json:"token,omitempty"`
  30. // Username/Password for basic authentication to a cluster
  31. Username []byte `json:"username,omitempty"`
  32. Password []byte `json:"password,omitempty"`
  33. // The raw kubeconfig, used by local auth mechanisms
  34. Kubeconfig []byte `json:"kubeconfig"`
  35. }