THIS IS A TEST INSTANCE ONLY! REPOSITORIES CAN BE DELETED AT ANY TIME!

Browse Source

fix(api): fix an issue with ownership for services and stacks (#3512)

tags/1.23.1^2
William Anthony Lapenna 1 month ago
parent
commit
17bc17f638
1 changed files with 9 additions and 6 deletions
  1. +9
    -6
      api/http/proxy/factory/docker/containers.go

+ 9
- 6
api/http/proxy/factory/docker/containers.go View File

@@ -5,7 +5,7 @@ import (
"net/http"

"github.com/docker/docker/client"
"github.com/portainer/portainer/api"
portainer "github.com/portainer/portainer/api"
"github.com/portainer/portainer/api/http/proxy/factory/responseutils"
)

@@ -19,16 +19,19 @@ func getInheritedResourceControlFromContainerLabels(dockerClient *client.Client,
return nil, err
}

serviceName := container.Config.Labels[resourceLabelForDockerServiceID]
if serviceName != "" {
serviceResourceControl := portainer.GetResourceControlByResourceIDAndType(serviceName, portainer.ServiceResourceControl, resourceControls)
if serviceResourceControl != nil {
return serviceResourceControl, nil
}
}

swarmStackName := container.Config.Labels[resourceLabelForDockerSwarmStackName]
if swarmStackName != "" {
return portainer.GetResourceControlByResourceIDAndType(swarmStackName, portainer.StackResourceControl, resourceControls), nil
}

serviceName := container.Config.Labels[resourceLabelForDockerServiceID]
if serviceName != "" {
return portainer.GetResourceControlByResourceIDAndType(serviceName, portainer.ServiceResourceControl, resourceControls), nil
}

composeStackName := container.Config.Labels[resourceLabelForDockerComposeStackName]
if composeStackName != "" {
return portainer.GetResourceControlByResourceIDAndType(composeStackName, portainer.StackResourceControl, resourceControls), nil


Loading…
Cancel
Save