diff --git a/config/config.go b/config/config.go index 628fd7e4..2678ebd7 100644 --- a/config/config.go +++ b/config/config.go @@ -25,7 +25,7 @@ type Config struct { BPFLogDir string MinKernelMajorVer int MinKernelMinorVer int - KFRepoURL string + EBPFRepoURL string HttpClientTimeout time.Duration MaxNFReStartCount int Environment string @@ -35,9 +35,9 @@ type Config struct { // stats // Prometheus endpoint for pull/scrape the metrics. - MetricsAddr string - KFPollInterval time.Duration - NMetricSamples int + MetricsAddr string + EBPFPollInterval time.Duration + NMetricSamples int ShutdownTimeout time.Duration @@ -99,12 +99,12 @@ func ReadConfig(configPath string) (*Config, error) { BPFLogDir: LoadOptionalConfigString(confReader, "l3afd", "bpf-log-dir", ""), MinKernelMajorVer: LoadOptionalConfigInt(confReader, "l3afd", "kernel-major-version", 5), MinKernelMinorVer: LoadOptionalConfigInt(confReader, "l3afd", "kernel-minor-version", 1), - KFRepoURL: LoadConfigString(confReader, "kf-repo", "url"), + EBPFRepoURL: LoadConfigString(confReader, "ebpf-repo", "url"), HttpClientTimeout: LoadOptionalConfigDuration(confReader, "l3afd", "http-client-timeout", 10*time.Second), MaxNFReStartCount: LoadOptionalConfigInt(confReader, "l3afd", "max-nf-restart-count", 3), BpfChainingEnabled: LoadConfigBool(confReader, "l3afd", "bpf-chaining-enabled"), MetricsAddr: LoadConfigString(confReader, "web", "metrics-addr"), - KFPollInterval: LoadOptionalConfigDuration(confReader, "web", "kf-poll-interval", 30*time.Second), + EBPFPollInterval: LoadOptionalConfigDuration(confReader, "web", "ebpf-poll-interval", 30*time.Second), NMetricSamples: LoadOptionalConfigInt(confReader, "web", "n-metric-samples", 20), ShutdownTimeout: LoadOptionalConfigDuration(confReader, "l3afd", "shutdown-timeout", 5*time.Second), SwaggerApiEnabled: LoadOptionalConfigBool(confReader, "l3afd", "swagger-api-enabled", false), diff --git a/config/l3afd.cfg b/config/l3afd.cfg index a35a4130..7829c23f 100644 --- a/config/l3afd.cfg +++ b/config/l3afd.cfg @@ -18,12 +18,12 @@ environment: PROD BpfMapDefaultPath: /sys/fs/bpf -[kf-repo] +[ebpf-repo] url: http://localhost:8000/ [web] metrics-addr: 0.0.0.0:8898 -kf-poll-interval: 30s +ebpf-poll-interval: 30s n-metric-samples: 20 [xdp-root-program] diff --git a/docs/configdoc.md b/docs/configdoc.md index b80a4d03..bcfc57d6 100644 --- a/docs/configdoc.md +++ b/docs/configdoc.md @@ -43,18 +43,18 @@ environment: PROD |environment|`"PROD"`|If set to anything other than "PROD", mTLS security will not be checked| Yes | |BpfMapDefaultPath|`"/sys/fs/bpf"`|The base pin path for eBPF maps| Yes | -## [kf-repo] +## [ebpf-repo] | FieldName | Default | Description | Required | | ------------- | ------------- | --------------- |----------| |url| `"http://localhost:8000/"`|Default repository from which to download eBPF packages| Yes | ## [web] -| FieldName | Default | Description | Required | -| ------------- | ------------- | --------------- |----------| -|metrics-addr|`"0.0.0.0:8898"`|Prometheus endpoint for pulling/scraping the metrics. For more info about Prometheus see [prometheus.io](https://prometheus.io/) | Yes | -|kf-poll-interval|`"30s"`|Periodic interval at which to scrape metrics using Prometheus| No | -|n-metric-samples|`"20"`|Number of Metric Samples| No | +| FieldName | Default | Description | Required | +|--------------------| ------------- | --------------- |----------| +| metrics-addr |`"0.0.0.0:8898"`|Prometheus endpoint for pulling/scraping the metrics. For more info about Prometheus see [prometheus.io](https://prometheus.io/) | Yes | +| ebpf-poll-interval |`"30s"`|Periodic interval at which to scrape metrics using Prometheus| No | +| n-metric-samples |`"20"`|Number of Metric Samples| No | ## [xdp-root-program] diff --git a/kf/bpf.go b/kf/bpf.go index b986d60d..df5fc0f9 100644 --- a/kf/bpf.go +++ b/kf/bpf.go @@ -535,7 +535,7 @@ func (b *BPF) GetArtifacts(conf *config.Config) error { isDefaultURLUsed := false RepoURL := b.Program.EPRURL if len(b.Program.EPRURL) == 0 { - RepoURL = conf.KFRepoURL + RepoURL = conf.EBPFRepoURL isDefaultURLUsed = true } diff --git a/kf/bpf_test.go b/kf/bpf_test.go index 8e375fa7..d854c219 100644 --- a/kf/bpf_test.go +++ b/kf/bpf_test.go @@ -428,7 +428,7 @@ func TestBPF_GetArtifacts(t *testing.T) { }), }, args: args{conf: &config.Config{BPFDir: "/tmp", - KFRepoURL: "https://l3af.io/"}}, + EBPFRepoURL: "https://l3af.io/"}}, wantErr: true, }, { @@ -443,8 +443,8 @@ func TestBPF_GetArtifacts(t *testing.T) { }, args: args{ conf: &config.Config{ - BPFDir: "/tmp", - KFRepoURL: "https://l3af.io/", + BPFDir: "/tmp", + EBPFRepoURL: "https://l3af.io/", }, }, wantErr: true, @@ -461,8 +461,8 @@ func TestBPF_GetArtifacts(t *testing.T) { }, args: args{ conf: &config.Config{ - BPFDir: "/tmp", - KFRepoURL: "https://l3af.io/", + BPFDir: "/tmp", + EBPFRepoURL: "https://l3af.io/", }, }, wantErr: true, @@ -479,8 +479,8 @@ func TestBPF_GetArtifacts(t *testing.T) { }, args: args{ conf: &config.Config{ - BPFDir: "/tmp", - KFRepoURL: "https://l3af.io/", + BPFDir: "/tmp", + EBPFRepoURL: "https://l3af.io/", }, }, wantErr: true, diff --git a/kf/nfconfig_test.go b/kf/nfconfig_test.go index 9962b9a5..57d9dca8 100644 --- a/kf/nfconfig_test.go +++ b/kf/nfconfig_test.go @@ -288,7 +288,7 @@ func TestNFConfigs_Deploy(t *testing.T) { ingressXDPBpfs: make(map[string]*list.List), ingressTCBpfs: make(map[string]*list.List), egressTCBpfs: make(map[string]*list.List), - hostConfig: &config.Config{BPFDir: "/tmp", KFRepoURL: "http://www.example.com"}, + hostConfig: &config.Config{BPFDir: "/tmp", EBPFRepoURL: "http://www.example.com"}, processMon: pMon, metricsMon: mMon, }, @@ -307,7 +307,7 @@ func TestNFConfigs_Deploy(t *testing.T) { ingressXDPBpfs: make(map[string]*list.List), ingressTCBpfs: make(map[string]*list.List), egressTCBpfs: make(map[string]*list.List), - hostConfig: &config.Config{BPFDir: "/tmp", KFRepoURL: "http://www.example.com"}, + hostConfig: &config.Config{BPFDir: "/tmp", EBPFRepoURL: "http://www.example.com"}, processMon: pMon, metricsMon: mMon, }, @@ -326,7 +326,7 @@ func TestNFConfigs_Deploy(t *testing.T) { ingressXDPBpfs: make(map[string]*list.List), ingressTCBpfs: make(map[string]*list.List), egressTCBpfs: make(map[string]*list.List), - hostConfig: &config.Config{BPFDir: "/tmp", KFRepoURL: "http://www.example.com"}, + hostConfig: &config.Config{BPFDir: "/tmp", EBPFRepoURL: "http://www.example.com"}, processMon: pMon, metricsMon: mMon, }, diff --git a/main.go b/main.go index 19061fa6..2ceb77bc 100644 --- a/main.go +++ b/main.go @@ -88,7 +88,7 @@ func main() { log.Error().Err(err).Msg("L3afd registration failed") } - kfConfigs, err := SetupNFConfigs(ctx, conf) + ebpfConfigs, err := SetupNFConfigs(ctx, conf) if err != nil { log.Fatal().Err(err).Msg("L3afd failed to start") } @@ -99,17 +99,17 @@ func main() { } if t != nil { - if err := kfConfigs.DeployeBPFPrograms(t); err != nil { + if err := ebpfConfigs.DeployeBPFPrograms(t); err != nil { log.Error().Err(err).Msg("L3afd filed to deploy persistent configs from store") } } - if err := handlers.InitConfigs(kfConfigs); err != nil { + if err := handlers.InitConfigs(ebpfConfigs); err != nil { log.Fatal().Err(err).Msg("L3afd failed to initialise configs") } if conf.EBPFChainDebugEnabled { - kf.SetupKFDebug(conf.EBPFChainDebugAddr, kfConfigs) + kf.SetupKFDebug(conf.EBPFChainDebugAddr, ebpfConfigs) } select {} } @@ -124,7 +124,7 @@ func SetupNFConfigs(ctx context.Context, conf *config.Config) (*kf.NFConfigs, er // setup Metrics endpoint stats.SetupMetrics(machineHostname, daemonName, conf.MetricsAddr) - pMon := kf.NewpCheck(conf.MaxNFReStartCount, conf.BpfChainingEnabled, conf.KFPollInterval) + pMon := kf.NewpCheck(conf.MaxNFReStartCount, conf.BpfChainingEnabled, conf.EBPFPollInterval) kfM := kf.NewpKFMetrics(conf.BpfChainingEnabled, conf.NMetricSamples) nfConfigs, err := kf.NewNFConfigs(ctx, machineHostname, conf, pMon, kfM)