Skip to content

Commit

Permalink
Fix k8s loop stopped on exclude
Browse files Browse the repository at this point in the history
  • Loading branch information
mickours committed Apr 26, 2024
1 parent 81813b4 commit 0f98467
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion connectors/k8s.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ type K8sConfig struct {
var bebida_prefix = "ryax.tech/"

func WatchQueues(channel chan interface{}, defaultPunchNbCore int, defaultPunchDuration int) {
defer panic("The kubernetes watcher stopped for unknown reason. Quit!")

k8sConfig := K8sConfig{namespace: "default", labelSelector: "", kubeconfigPath: os.Getenv("KUBECONFIG")}

config, err := clientcmd.BuildConfigFromFlags("", k8sConfig.kubeconfigPath)
Expand All @@ -50,7 +52,7 @@ func WatchQueues(channel chan interface{}, defaultPunchNbCore int, defaultPunchD
// Exclude pod if explicitly requested
if pod.Annotations[bebida_prefix+"bebida"] == "exclude" {
log.Infof("Found exclusion annotation %s, do exclude this pod", bebida_prefix+"bebida: exclude")
return
continue
}
pendingPod := events.NewPendingPod(defaultPunchNbCore, defaultPunchDuration)
pendingPod.PodId = pod.ObjectMeta.Name
Expand Down

0 comments on commit 0f98467

Please sign in to comment.