cluster.go 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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