service.go 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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. // @bingen:generate:ServicePort
  11. type ServicePort struct {
  12. Name string `json:"name"`
  13. Port uint16 `json:"port"`
  14. TargetPort uint16 `json:"targetPort"`
  15. NodePort uint16 `json:"nodePort"`
  16. Protocol string `json:"protocol"`
  17. }
  18. // @bingen:generate:Service
  19. type Service struct {
  20. UID string `json:"uid"`
  21. ClusterUID string `json:"clusterUid"`
  22. NamespaceUID string `json:"namespaceUid"`
  23. Name string `json:"name"`
  24. Type ServiceType `json:"type"`
  25. Hostname string `json:"hostname,omitempty"`
  26. Labels map[string]string `json:"labels,omitempty"`
  27. Annotations map[string]string `json:"annotations,omitempty"`
  28. Ports []ServicePort `json:"ports,omitempty"`
  29. Start time.Time `json:"start"`
  30. End time.Time `json:"end"`
  31. NetworkTransferBytes uint64 `json:"networkTransferBytes"`
  32. NetworkReceiveBytes uint64 `json:"networkReceiveBytes"`
  33. }