Skip to content

Commit

Permalink
node pod probe daemon
Browse files Browse the repository at this point in the history
Signed-off-by: liheng.zms <[email protected]>
  • Loading branch information
zmberg committed Sep 19, 2022
1 parent 16277db commit 974f35e
Show file tree
Hide file tree
Showing 9 changed files with 1,405 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/e2e-1.16.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -419,4 +419,16 @@ jobs:
kubectl get pod -n kruise-system --no-headers -l control-plane=controller-manager | awk '{print $1}' | xargs kubectl logs -p -n kruise-system
exit 1
fi
kubectl get pods -n kruise-system -l control-plane=daemon -o=jsonpath="{range .items[*]}{.metadata.namespace}{\"\t\"}{.metadata.name}{\"\n\"}{end}" | while read ns name;
do
restartCount=$(kubectl get pod -n ${ns} ${name} --no-headers | awk '{print $4}')
if [ "${restartCount}" -eq "0" ];then
echo "Kruise-daemon has not restarted"
else
kubectl get pods -n ${ns} -l control-plane=daemon --no-headers
echo "Kruise-daemon has restarted, abort!!!"
kubectl logs -p -n ${ns} ${name}
exit 1
fi
done
exit $retVal
12 changes: 12 additions & 0 deletions .github/workflows/e2e-1.24.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -477,4 +477,16 @@ jobs:
kubectl get pod -n kruise-system --no-headers -l control-plane=controller-manager | awk '{print $1}' | xargs kubectl logs -p -n kruise-system
exit 1
fi
kubectl get pods -n kruise-system -l control-plane=daemon -o=jsonpath="{range .items[*]}{.metadata.namespace}{\"\t\"}{.metadata.name}{\"\n\"}{end}" | while read ns name;
do
restartCount=$(kubectl get pod -n ${ns} ${name} --no-headers | awk '{print $4}')
if [ "${restartCount}" -eq "0" ];then
echo "Kruise-daemon has not restarted"
else
kubectl get pods -n ${ns} -l control-plane=daemon --no-headers
echo "Kruise-daemon has restarted, abort!!!"
kubectl logs -p -n ${ns} ${name}
exit 1
fi
done
exit $retVal
16 changes: 16 additions & 0 deletions config/rbac/daemon_role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,19 @@ rules:
- get
- list
- watch
- apiGroups:
- apps.kruise.io
resources:
- nodepodprobes
verbs:
- get
- list
- watch
- apiGroups:
- apps.kruise.io
resources:
- nodepodprobes/status
verbs:
- get
- patch
- update
9 changes: 9 additions & 0 deletions pkg/daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import (
"net/http"
"sync"

"github.com/openkruise/kruise/pkg/daemon/podprobe"

"github.com/prometheus/client_golang/prometheus/promhttp"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -147,9 +149,16 @@ func NewDaemon(cfg *rest.Config, bindAddress string) (Daemon, error) {
return nil, fmt.Errorf("failed to new crr daemon controller: %v", err)
}

// node pod probe
nppController, err := podprobe.NewController(opts)
if err != nil {
return nil, fmt.Errorf("failed to new nodePodProbe daemon controller: %v", err)
}

var runnables = []Runnable{
puller,
crrController,
nppController,
}

if utilfeature.DefaultFeatureGate.Enabled(features.DaemonWatchingPod) {
Expand Down
Loading

0 comments on commit 974f35e

Please sign in to comment.