build - prozess optimiert mit push nach zot
nginx-kill - > maint. site...
This commit is contained in:
1 parent
665135f87e
commit
64417d8353
19 files changed
+447
-61
No files matched your search
+18
-4
@@ -230,27 +230,41 @@ func (a *Agent) sendLoop(ctx context.Context, hc *http.Client, host string, trig
|
||||
}
|
||||
|
||||
// collect ermittelt den aktuellen Zustand: Docker-Container und Dienste aus
|
||||
// ConfigDir samt Healthcheck-Ausfällen. Ohne Docker-Socket (Bare-Metal)
|
||||
// ConfigDir samt Ausfällen (gestoppte Container, Healthchecks). Ohne Docker-Socket (Bare-Metal)
|
||||
// entfallen die Container; schlägt die Docker-API fehl, wird nichts
|
||||
// gesendet (sonst würden alle Container-Routen entfernt).
|
||||
func (a *Agent) collect(ctx context.Context, host string) (registry.NodeState, error) {
|
||||
state := registry.NodeState{Workloads: []registry.Workload{}}
|
||||
if a.dockerAvailable() {
|
||||
containers, err := (&docker.Client{Socket: a.cfg.DockerSocket}).List(ctx)
|
||||
client := &docker.Client{Socket: a.cfg.DockerSocket}
|
||||
containers, err := client.List(ctx)
|
||||
if err != nil {
|
||||
return state, err
|
||||
}
|
||||
ws, warnings := Workloads(containers, host)
|
||||
// Gestoppte Container nennen in der Liste keine Ports.
|
||||
for i, c := range containers {
|
||||
if c.State == "running" || !enabled(c.Labels) {
|
||||
continue
|
||||
}
|
||||
ports, err := client.PortBindings(ctx, c.ID)
|
||||
if err != nil {
|
||||
a.log.Debug("Portzuordnung nicht lesbar", "container", c.Name(), "err", err)
|
||||
continue // inzwischen entfernt o. Ä. → Workloads warnt
|
||||
}
|
||||
containers[i].Ports = ports
|
||||
}
|
||||
ws, down, warnings := Workloads(containers, host)
|
||||
for _, w := range warnings {
|
||||
a.log.Warn("Container nicht übernommen", "grund", w)
|
||||
}
|
||||
state.Workloads = append(state.Workloads, ws...)
|
||||
state.DownServices = append(state.DownServices, down...)
|
||||
}
|
||||
a.mu.Lock()
|
||||
specs := a.fileSpecs
|
||||
a.mu.Unlock()
|
||||
state.Workloads = append(state.Workloads, FileWorkloads(specs, host)...)
|
||||
state.DownServices = a.health.down()
|
||||
state.DownServices = append(state.DownServices, a.health.down()...)
|
||||
return state, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user