service.go 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. package kubemodel
  2. import "time"
  3. type ServiceType string
  4. const (
  5. ServiceTypeClusterIP ServiceType = "ClusterIP"
  6. ServiceTypeNodePort ServiceType = "NodePort"
  7. ServiceTypeLoadBalancer ServiceType = "LoadBalancer"
  8. ServiceTypeExternalName ServiceType = "ExternalName"
  9. )
  10. type ServicePort struct {
  11. Name string `json:"name"`
  12. Port uint16 `json:"port"`
  13. TargetPort uint16 `json:"targetPort"`
  14. NodePort uint16 `json:"nodePort"`
  15. Protocol string `json:"protocol"`
  16. }
  17. type Service struct {
  18. UID string `json:"uid"`
  19. ClusterUID string `json:"clusterUid"`
  20. NamespaceUID string `json:"namespaceUid"`
  21. Name string `json:"name"`
  22. Type ServiceType `json:"type"`
  23. Hostname string `json:"hostname,omitempty"`
  24. Labels map[string]string `json:"labels,omitempty"`
  25. Annotations map[string]string `json:"annotations,omitempty"`
  26. Ports []ServicePort `json:"ports,omitempty"`
  27. Start time.Time `json:"start"`
  28. End time.Time `json:"end"`
  29. NetworkTransferBytes uint64 `json:"networkTransferBytes"`
  30. NetworkReceiveBytes uint64 `json:"networkReceiveBytes"`
  31. }