system_service_status.go 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package models
  2. import (
  3. "time"
  4. "github.com/google/uuid"
  5. "gorm.io/gorm"
  6. )
  7. // SystemServiceStatus represents a status entry in a database for a single service in a specific cluster
  8. type SystemServiceStatus struct {
  9. gorm.Model
  10. // ID is a unique identifier for a given event
  11. ID uuid.UUID `gorm:"type:uuid;primaryKey" json:"id"`
  12. // CreatedAt is the time (UTC) that a given status was created. This should not change.
  13. CreatedAt time.Time `json:"created_at"`
  14. // UpdatedAt is the time (UTC) that the status was last updated.
  15. UpdatedAt time.Time `json:"updated_at"`
  16. ProjectID uint `json:"project_id"`
  17. ClusterID uint `json:"cluster_id"`
  18. // InvolvedObjectType is the type of k8s object that the service runs
  19. // this is currently expected to be "Deployment", "StatefulSet" or "DaemonSet"
  20. InvolvedObjectType string `json:"involved_object_type"`
  21. Name string `json:"name"`
  22. Namespace string `json:"namespace"`
  23. // Any other relevant metadata. This field allows us to be flexible in the future.
  24. Metadata JSONB `json:"metadata" sql:"type:jsonb" gorm:"type:jsonb"`
  25. }
  26. // TableName overrides the table name
  27. func (SystemServiceStatus) TableName() string {
  28. return "system_service_status"
  29. }