Skip to content

Commit

Permalink
cilium, status: add clock source status
Browse files Browse the repository at this point in the history
Add a Cilium status dump on this datapath feature in order to allow
for easier introspection. Clock source will show up under --verbose.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
  • Loading branch information
borkmann committed Nov 17, 2020
1 parent d170ce8 commit 7436d3c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
10 changes: 10 additions & 0 deletions daemon/cmd/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,15 @@ func (d *Daemon) getHostRoutingStatus() *models.HostRouting {
return s
}

func (d *Daemon) getClockSourceStatus() *models.ClockSource {
s := &models.ClockSource{Mode: models.ClockSourceModeKtime}
if option.Config.ClockSource == option.ClockSourceJiffies {
s.Mode = models.ClockSourceModeJiffies
s.Hertz = int64(option.Config.KernelHz)
}
return s
}

func (d *Daemon) getKubeProxyReplacementStatus() *models.KubeProxyReplacement {
var mode string
switch option.Config.KubeProxyReplacement {
Expand Down Expand Up @@ -875,6 +884,7 @@ func (d *Daemon) startStatusCollector() {
d.statusResponse.Masquerading = d.getMasqueradingStatus()
d.statusResponse.BandwidthManager = d.getBandwidthManagerStatus()
d.statusResponse.HostRouting = d.getHostRoutingStatus()
d.statusResponse.ClockSource = d.getClockSourceStatus()
d.statusResponse.BpfMaps = d.getBPFMapStatus()

d.statusCollector = status.NewCollector(probes, status.Config{})
Expand Down
12 changes: 12 additions & 0 deletions pkg/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,8 @@ type StatusDetails struct {
BPFMapDetails bool
// KubeProxyReplacementDetails causes BPF kube-proxy details to be printed by FormatStatusResponse.
KubeProxyReplacementDetails bool
// ClockSourceDetails causes BPF time-keeping internals to be printed by FormatStatusResponse.
ClockSourceDetails bool
}

var (
Expand All @@ -271,6 +273,7 @@ var (
AllClusters: true,
BPFMapDetails: true,
KubeProxyReplacementDetails: true,
ClockSourceDetails: true,
}
)

Expand Down Expand Up @@ -417,6 +420,15 @@ func FormatStatusResponse(w io.Writer, sr *models.StatusResponse, sd StatusDetai
fmt.Fprintf(w, "Masquerading:\t%s\n", status)
}

if sd.ClockSourceDetails && sr.ClockSource != nil {
status := sr.ClockSource.Mode
if sr.ClockSource.Mode == models.ClockSourceModeJiffies {
status = fmt.Sprintf("%s\t[%d Hz]",
sr.ClockSource.Mode, sr.ClockSource.Hertz)
}
fmt.Fprintf(w, "Clock Source for BPF:\t%s\n", status)
}

if sr.Controllers != nil {
nFailing, out := 0, []string{" Name\tLast success\tLast error\tCount\tMessage\n"}
for _, ctrl := range sr.Controllers {
Expand Down

0 comments on commit 7436d3c

Please sign in to comment.