2021-04-06 10:08:43 +00:00
|
|
|
package edge
|
|
|
|
|
|
|
|
import portainer "github.com/portainer/portainer/api"
|
|
|
|
|
2021-09-20 00:14:22 +00:00
|
|
|
// LoadEdgeJobs registers all edge jobs inside corresponding environment(endpoint) tunnel
|
2021-04-06 10:08:43 +00:00
|
|
|
func LoadEdgeJobs(dataStore portainer.DataStore, reverseTunnelService portainer.ReverseTunnelService) error {
|
|
|
|
edgeJobs, err := dataStore.EdgeJob().EdgeJobs()
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, edgeJob := range edgeJobs {
|
|
|
|
for endpointID := range edgeJob.Endpoints {
|
|
|
|
reverseTunnelService.AddEdgeJob(endpointID, &edgeJob)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|