Skip to content

Commit

Permalink
Data path healing should be disabled
Browse files Browse the repository at this point in the history
Related issue: cmd-nsc-446

Signed-off-by: Laszlo Kiraly <laszlo.kiraly@est.tech>
  • Loading branch information
ljkiraly committed May 31, 2022
1 parent f777685 commit a5f42ad
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
2 changes: 2 additions & 0 deletions internal/config/config.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) 2020-2022 Doc.ai and/or its affiliates.
// Copyright (c) 2021-2022 Nordix and/or its affiliates.
//
// SPDX-License-Identifier: Apache-2.0
//
Expand Down Expand Up @@ -44,6 +45,7 @@ type Config struct {

CoreDNSConfigPath string `default:"/etc/coredns/Corefile" desc:"Default path to the Corefile source"`

LivenessCheck string `default:"enabled" desc:"Dataplane liveness check enabled/disabled"`
LivenessCheckInterval time.Duration `default:"200ms" desc:"Dataplane liveness check interval"`
LivenessCheckTimeout time.Duration `default:"1s" desc:"Dataplane liveness check timeout"`
}
Expand Down
18 changes: 12 additions & 6 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) 2020-2022 Doc.ai and/or its affiliates.
// Copyright (c) 2021-2022 Nordix and/or its affiliates.
//
// Copyright (c) 2022 Cisco and/or its affiliates.
//
Expand Down Expand Up @@ -159,16 +160,21 @@ func main() {
dnsClient = dnscontext.NewClient(dnscontext.WithChainContext(ctx), dnscontext.WithCorefilePath(c.CoreDNSConfigPath))
}

var healClient = null.NewClient()

if c.LivenessCheck != "disabled" {
healClient = heal.NewClient(
ctx,
heal.WithLivenessCheck(kernelheal.KernelLivenessCheck),
heal.WithLivenessCheckInterval(c.LivenessCheckInterval),
heal.WithLivenessCheckTimeout(c.LivenessCheckTimeout))
}

nsmClient := client.NewClient(ctx,
client.WithClientURL(&c.ConnectTo),
client.WithName(c.Name),
client.WithAuthorizeClient(authorize.NewClient()),
client.WithHealClient(
heal.NewClient(
ctx,
heal.WithLivenessCheck(kernelheal.KernelLivenessCheck),
heal.WithLivenessCheckInterval(c.LivenessCheckInterval),
heal.WithLivenessCheckTimeout(c.LivenessCheckTimeout))),
client.WithHealClient(healClient),
client.WithAdditionalFunctionality(
clientinfo.NewClient(),
sriovtoken.NewClient(),
Expand Down

0 comments on commit a5f42ad

Please sign in to comment.