Don't spam warnings when stopped container discovered (#530)
This commit is contained in:
@@ -0,0 +1,37 @@
|
|||||||
|
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
|
||||||
|
// README at: https://github.com/devcontainers/templates/tree/main/src/go
|
||||||
|
{
|
||||||
|
"name": "Go",
|
||||||
|
// Use bookworm due to
|
||||||
|
// (!) The 'moby' option is not supported on Debian 'trixie' because 'moby-cli' and related system packages have been removed from that distribution.
|
||||||
|
// (!) To continue, either set the feature option '"moby": false' or use a different base image (for example: 'debian:bookworm' or 'ubuntu-24.04').
|
||||||
|
"image": "golang:1.25-bookworm",
|
||||||
|
// Features to add to the dev container. More info: https://containers.dev/features.
|
||||||
|
"features": {
|
||||||
|
// For in-docker discovery testing
|
||||||
|
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {}
|
||||||
|
},
|
||||||
|
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||||
|
"forwardPorts": [
|
||||||
|
25565
|
||||||
|
],
|
||||||
|
|
||||||
|
containerEnv: {
|
||||||
|
"GOROOT": "/usr/local/go"
|
||||||
|
},
|
||||||
|
|
||||||
|
// Configure tool-specific properties.
|
||||||
|
"customizations": {
|
||||||
|
"jetbrains": {
|
||||||
|
"backend": "IntelliJ",
|
||||||
|
"plugins": [
|
||||||
|
"org.jetbrains.plugins.go"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"vscode": {
|
||||||
|
"extensions": [
|
||||||
|
"golang.go"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+17
-17
@@ -19,13 +19,13 @@ type IDockerWatcher interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
DockerRouterLabelHost = "mc-router.host"
|
DockerRouterLabelHost = "mc-router.host"
|
||||||
DockerRouterLabelPort = "mc-router.port"
|
DockerRouterLabelPort = "mc-router.port"
|
||||||
DockerRouterLabelDefault = "mc-router.default"
|
DockerRouterLabelDefault = "mc-router.default"
|
||||||
DockerRouterLabelNetwork = "mc-router.network"
|
DockerRouterLabelNetwork = "mc-router.network"
|
||||||
DockerRouterLabelAutoScaleUp = "mc-router.auto-scale-up"
|
DockerRouterLabelAutoScaleUp = "mc-router.auto-scale-up"
|
||||||
DockerRouterLabelAutoScaleDown = "mc-router.auto-scale-down"
|
DockerRouterLabelAutoScaleDown = "mc-router.auto-scale-down"
|
||||||
DockerRouterLabelAutoScaleAsleepMOTD = "mc-router.auto-scale-asleep-motd"
|
DockerRouterLabelAutoScaleAsleepMOTD = "mc-router.auto-scale-asleep-motd"
|
||||||
DockerRouterLabelAutoScaleLoadingMOTD = "mc-router.auto-scale-loading-motd"
|
DockerRouterLabelAutoScaleLoadingMOTD = "mc-router.auto-scale-loading-motd"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -342,16 +342,16 @@ func (w *dockerWatcherImpl) listContainers(ctx context.Context) ([]*routableCont
|
|||||||
}
|
}
|
||||||
|
|
||||||
type parsedDockerContainerData struct {
|
type parsedDockerContainerData struct {
|
||||||
hosts []string
|
hosts []string
|
||||||
port uint64
|
port uint64
|
||||||
def *bool
|
def *bool
|
||||||
network *string
|
network *string
|
||||||
ip string
|
ip string
|
||||||
autoScaleDown bool
|
autoScaleDown bool
|
||||||
autoScaleUp bool
|
autoScaleUp bool
|
||||||
autoScaleAsleepMOTD string
|
autoScaleAsleepMOTD string
|
||||||
autoScaleLoadingMOTD string
|
autoScaleLoadingMOTD string
|
||||||
notRunning bool
|
notRunning bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *dockerWatcherImpl) parseContainerData(container *container.InspectResponse) (data parsedDockerContainerData, ok bool) {
|
func (w *dockerWatcherImpl) parseContainerData(container *container.InspectResponse) (data parsedDockerContainerData, ok bool) {
|
||||||
@@ -494,7 +494,7 @@ func (w *dockerWatcherImpl) parseContainerData(container *container.InspectRespo
|
|||||||
if container.State != nil && !container.State.Running {
|
if container.State != nil && !container.State.Running {
|
||||||
if !w.config.autoScaleUp {
|
if !w.config.autoScaleUp {
|
||||||
logrus.WithFields(logrus.Fields{"containerId": container.ID, "containerNames": container.Name}).
|
logrus.WithFields(logrus.Fields{"containerId": container.ID, "containerNames": container.Name}).
|
||||||
Warnf("ignoring container, not running and auto scale up is disabled")
|
Debugf("ignoring container, not running and auto scale up is disabled")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
data.notRunning = true
|
data.notRunning = true
|
||||||
|
|||||||
Reference in New Issue
Block a user