Update k8sTapManager.go, provider.go, and watch.go

This commit is contained in:
Rami Berman
2021-10-31 16:55:49 +02:00
parent bfbb63b3d0
commit e044be2bc7
3 changed files with 5 additions and 6 deletions
+3 -2
View File
@@ -20,7 +20,7 @@ type TappedPodChangeEvent struct {
Removed []core.Pod
}
// MizuTapperSyncer syncs tappers using a k8s pod watch
// MizuTapperSyncer uses a k8s pod watch to update tapper daemonsets when targeted pods are removed or created
type MizuTapperSyncer struct {
context context.Context
CurrentlyTappedPods []core.Pod
@@ -28,7 +28,7 @@ type MizuTapperSyncer struct {
kubernetesProvider *Provider
TapPodChangesOut chan TappedPodChangeEvent
ErrorOut chan K8sTapManagerError
shouldUpdateTappers bool // used to prevent updating tapper daemonsets before api is available but still get targeted pod change events
shouldUpdateTappers bool // Used to prevent daemonset updates but still allow tracking targeted pods
}
type TapperSyncerConfig struct {
@@ -155,6 +155,7 @@ func (tapperSyncer *MizuTapperSyncer) watchPodsForTapping() {
case <-tapperSyncer.context.Done():
logger.Log.Debugf("Watching pods loop, context done, stopping `restart tappers debouncer`")
restartTappersDebouncer.Cancel()
// TODO: Does this also perform cleanup?
return
}
}
-2
View File
@@ -765,8 +765,6 @@ func validateNotProxy(kubernetesConfig clientcmd.ClientConfig, restClientConfig
if *proxyServerVersion == (version.Info{}) {
return &ClusterBehindProxyError{}
// TODO: handle this with CLI from outside the function, or move to outside or shared
//return fmt.Errorf("cannot establish http-proxy connection to the Kubernetes cluster. If youre using Lens or similar tool, please run mizu with regular kubectl config using --%v %v=$HOME/.kube/config flag", "set", "kube-config-path")
}
}
+2 -2
View File
@@ -28,7 +28,7 @@ func FilteredWatch(ctx context.Context, kubernetesProvider *Provider, targetName
go func(targetNamespace string) {
defer wg.Done()
watchRestartDebouncer := debounce.NewDebouncer(1*time.Minute, func() {})
watchRestartDebouncer := debounce.NewDebouncer(1 * time.Minute, func() {})
for {
watcher := kubernetesProvider.GetPodWatcher(ctx, targetNamespace)
@@ -36,7 +36,7 @@ func FilteredWatch(ctx context.Context, kubernetesProvider *Provider, targetName
watcher.Stop()
select {
case <-ctx.Done():
case <- ctx.Done():
return
default:
break