From a5f42ad04f2fb394f98c12773d62aae6d201d4ac Mon Sep 17 00:00:00 2001 From: Laszlo Kiraly Date: Tue, 31 May 2022 13:53:06 +0200 Subject: [PATCH] Data path healing should be disabled Related issue: cmd-nsc-446 Signed-off-by: Laszlo Kiraly --- internal/config/config.go | 2 ++ main.go | 18 ++++++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/internal/config/config.go b/internal/config/config.go index 0312de87..0a04e7cd 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -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 // @@ -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"` } diff --git a/main.go b/main.go index bd0b9a23..af1afb62 100644 --- a/main.go +++ b/main.go @@ -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. // @@ -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(),