cluster.go 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. package types
  2. import (
  3. "github.com/porter-dev/porter/internal/kubernetes/prometheus"
  4. v1 "k8s.io/api/core/v1"
  5. )
  6. type Cluster struct {
  7. ID uint `json:"id"`
  8. // The project that this integration belongs to
  9. ProjectID uint `json:"project_id"`
  10. // Name of the cluster
  11. Name string `json:"name"`
  12. // Server endpoint for the cluster
  13. Server string `json:"server"`
  14. // The integration service for this cluster
  15. Service ClusterService `json:"service"`
  16. // The infra id, if cluster was provisioned with Porter
  17. InfraID uint `json:"infra_id"`
  18. // (optional) The aws integration id, if available
  19. AWSIntegrationID uint `json:"aws_integration_id"`
  20. }
  21. type ClusterGetResponse struct {
  22. *Cluster
  23. // The NGINX Ingress IP to access the cluster
  24. IngressIP string `json:"ingress_ip"`
  25. // Error displayed in case couldn't get the IP
  26. IngressError error `json:"ingress_error"`
  27. }
  28. type ClusterService string
  29. const (
  30. EKS ClusterService = "eks"
  31. DOKS ClusterService = "doks"
  32. GKE ClusterService = "gke"
  33. Kube ClusterService = "kube"
  34. )
  35. type ListNamespacesResponse struct {
  36. *v1.NamespaceList
  37. }
  38. type CreateNamespaceRequest struct {
  39. Name string `json:"name" form:"required"`
  40. }
  41. type CreateNamespaceResponse struct {
  42. *v1.Namespace
  43. }
  44. type DeleteNamespaceRequest struct {
  45. Name string `json:"name" form:"required"`
  46. }
  47. type GetTemporaryKubeconfigResponse struct {
  48. Kubeconfig []byte `json:"kubeconfig"`
  49. }
  50. type ListNGINXIngressesResponse []prometheus.SimpleIngress
  51. type GetPodMetricsRequest struct {
  52. prometheus.QueryOpts
  53. }
  54. type GetPodMetricsResponse *string
  55. type GetPodsRequest struct {
  56. Namespace string `schema:"namespace"`
  57. Selectors []string `schema:"selectors"`
  58. }