1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-19 13:29:41 +02:00

refactor(edge): init endpoint relation when endpoint is created [BE-11928] (#814)

This commit is contained in:
Oscar Zhou 2025-07-01 06:15:56 +12:00 committed by GitHub
parent b43f864511
commit b6f3682a62
10 changed files with 62 additions and 43 deletions

View file

@ -249,3 +249,19 @@ func getEndpointCheckinInterval(endpoint *portainer.Endpoint, settings *portaine
return defaultInterval
}
func InitializeEdgeEndpointRelation(endpoint *portainer.Endpoint, tx dataservices.DataStoreTx) error {
if !IsEdgeEndpoint(endpoint) {
return nil
}
relation := &portainer.EndpointRelation{
EndpointID: endpoint.ID,
EdgeStacks: make(map[portainer.EdgeStackID]bool),
}
if err := tx.EndpointRelation().Create(relation); err != nil {
return err
}
return nil
}