mirror of
https://github.com/portainer/portainer.git
synced 2025-07-22 14:59:41 +02:00
fix(edge/stacks): validate deployment type [EE-4580] (#8875)
This commit is contained in:
parent
334eee0c8c
commit
5f6ddc2fad
5 changed files with 68 additions and 45 deletions
|
@ -30,3 +30,16 @@ func hasEndpointPredicate(endpointService dataservices.EndpointService, endpoint
|
|||
|
||||
return false, nil
|
||||
}
|
||||
|
||||
func hasWrongEnvironmentType(endpointService dataservices.EndpointService, endpointIDs []portainer.EndpointID, deploymentType portainer.EdgeStackDeploymentType) (bool, error) {
|
||||
return hasEndpointPredicate(endpointService, endpointIDs, func(e *portainer.Endpoint) bool {
|
||||
switch deploymentType {
|
||||
case portainer.EdgeStackDeploymentKubernetes:
|
||||
return !endpointutils.IsKubernetesEndpoint(e)
|
||||
case portainer.EdgeStackDeploymentCompose:
|
||||
return !endpointutils.IsDockerEndpoint(e)
|
||||
default:
|
||||
return true
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue