cluster.go 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. }
  59. type CreateClusterManualRequest struct {
  60. Name string `json:"name" form:"required"`
  61. ProjectID uint `json:"project_id" form:"required"`
  62. Server string `json:"server" form:"required"`
  63. GCPIntegrationID uint `json:"gcp_integration_id"`
  64. AWSIntegrationID uint `json:"aws_integration_id"`
  65. CertificateAuthorityData string `json:"certificate_authority_data,omitempty"`
  66. }