diff options
Diffstat (limited to '')
-rw-r--r-- | src/go/collectors/go.d.plugin/modules/k8s_state/update_state.go | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/go/collectors/go.d.plugin/modules/k8s_state/update_state.go b/src/go/collectors/go.d.plugin/modules/k8s_state/update_state.go new file mode 100644 index 000000000..88f3272c1 --- /dev/null +++ b/src/go/collectors/go.d.plugin/modules/k8s_state/update_state.go @@ -0,0 +1,27 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +package k8s_state + +func (ks *KubeState) runUpdateState(in <-chan resource) { + for { + select { + case <-ks.ctx.Done(): + return + case r := <-in: + ks.state.Lock() + switch r.kind() { + case kubeResourceNode: + ks.updateNodeState(r) + case kubeResourcePod: + ks.updatePodState(r) + } + ks.state.Unlock() + } + } +} + +func copyLabels(dst, src map[string]string) { + for k, v := range src { + dst[k] = v + } +} |