Scale set workers properly come online

This adds the workers needed to start listening for scale set messages.
There is no handling of messages yet.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
This commit is contained in:
Gabriel Adrian Samfira 2025-04-16 16:39:16 +00:00
parent 6a5c309399
commit a2aeac731c
15 changed files with 668 additions and 57 deletions

View file

@ -136,6 +136,17 @@ type ScaleSet struct {
Instances []Instance `gorm:"foreignKey:ScaleSetFkID"`
}
type RepositoryEvent struct {
gorm.Model
EventType params.EventType
EventLevel params.EventLevel
Message string `gorm:"type:text"`
RepoID uuid.UUID `gorm:"index:idx_repo_event"`
Repo Repository `gorm:"foreignKey:RepoID"`
}
type Repository struct {
Base
@ -154,8 +165,20 @@ type Repository struct {
EndpointName *string `gorm:"index:idx_owner_nocase,unique,collate:nocase"`
Endpoint GithubEndpoint `gorm:"foreignKey:EndpointName;constraint:OnDelete:SET NULL"`
Events []RepositoryEvent `gorm:"foreignKey:RepoID;constraint:OnDelete:CASCADE,OnUpdate:CASCADE;"`
}
type OrganizationEvent struct {
gorm.Model
EventType params.EventType
EventLevel params.EventLevel
Message string `gorm:"type:text"`
OrgID uuid.UUID `gorm:"index:idx_org_event"`
Org Organization `gorm:"foreignKey:OrgID"`
}
type Organization struct {
Base
@ -173,6 +196,19 @@ type Organization struct {
EndpointName *string `gorm:"index:idx_org_name_nocase,collate:nocase"`
Endpoint GithubEndpoint `gorm:"foreignKey:EndpointName;constraint:OnDelete:SET NULL"`
Events []OrganizationEvent `gorm:"foreignKey:OrgID;constraint:OnDelete:CASCADE,OnUpdate:CASCADE;"`
}
type EnterpriseEvent struct {
gorm.Model
EventType params.EventType
EventLevel params.EventLevel
Message string `gorm:"type:text"`
EnterpriseID uuid.UUID `gorm:"index:idx_enterprise_event"`
Enterprise Enterprise `gorm:"foreignKey:EnterpriseID"`
}
type Enterprise struct {
@ -192,6 +228,8 @@ type Enterprise struct {
EndpointName *string `gorm:"index:idx_ent_name_nocase,collate:nocase"`
Endpoint GithubEndpoint `gorm:"foreignKey:EndpointName;constraint:OnDelete:SET NULL"`
Events []EnterpriseEvent `gorm:"foreignKey:EnterpriseID;constraint:OnDelete:CASCADE,OnUpdate:CASCADE;"`
}
type Address struct {