mirror of
https://github.com/portainer/portainer.git
synced 2025-07-24 07:49:41 +02:00
fix: review snapshot and post init migration logic (#158)
This commit is contained in:
parent
07d1eedae3
commit
20e3d3a15b
5 changed files with 206 additions and 11 deletions
20
pkg/endpoints/utils.go
Normal file
20
pkg/endpoints/utils.go
Normal file
|
@ -0,0 +1,20 @@
|
|||
package endpoints
|
||||
|
||||
import portainer "github.com/portainer/portainer/api"
|
||||
|
||||
// IsEdgeEndpoint returns true if this is an Edge endpoint
|
||||
func IsEdgeEndpoint(endpoint *portainer.Endpoint) bool {
|
||||
return endpoint.Type == portainer.EdgeAgentOnDockerEnvironment || endpoint.Type == portainer.EdgeAgentOnKubernetesEnvironment
|
||||
}
|
||||
|
||||
// IsAssociatedEdgeEndpoint returns true if the environment is an Edge environment
|
||||
// and has a set EdgeID and UserTrusted is true.
|
||||
func IsAssociatedEdgeEndpoint(endpoint *portainer.Endpoint) bool {
|
||||
return IsEdgeEndpoint(endpoint) && endpoint.EdgeID != "" && endpoint.UserTrusted
|
||||
}
|
||||
|
||||
// HasDirectConnectivity returns true if the environment is a non-Edge environment
|
||||
// or is an associated Edge environment that is not in async mode.
|
||||
func HasDirectConnectivity(endpoint *portainer.Endpoint) bool {
|
||||
return !IsEdgeEndpoint(endpoint) || (IsAssociatedEdgeEndpoint(endpoint) && !endpoint.Edge.AsyncMode)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue