Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allowing provider to be changed for kentik flow #675

Merged
merged 1 commit into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed .DS_Store
Binary file not shown.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,5 @@ cmd/version/generated_version.go

## local configuration
config.yaml

.DS_Store
8 changes: 5 additions & 3 deletions pkg/cat/jchf.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import (
var (
DEFAULT_GEO = []byte("--")
DEFAULT_GEO_PACKED = patricia.PackGeo(DEFAULT_GEO)

defaultProvider = kt.ProviderFlowDevice
)

func (kc *KTranslate) getEventType(dst *kt.JCHF) string {
Expand Down Expand Up @@ -47,12 +49,12 @@ func (kc *KTranslate) getProviderType(dst *kt.JCHF) kt.Provider {

udr, ok := dst.CustomStr[UDR_TYPE]
if !ok { // Return this right away.
return kt.ProviderFlowDevice
return defaultProvider
}

// Or maybe its a host.
if udr == "kprobe" || udr == "kappa" {
return kt.ProviderFlowDevice
return defaultProvider
}

// Else, if its synth, return this.
Expand All @@ -66,7 +68,7 @@ func (kc *KTranslate) getProviderType(dst *kt.JCHF) kt.Provider {
}

// Default to provider.
return kt.ProviderFlowDevice
return defaultProvider
}

func (kc *KTranslate) flowToJCHF(ctx context.Context, dst *kt.JCHF, src *Flow, currentTS int64, tagcache map[uint64]string) error {
Expand Down
6 changes: 6 additions & 0 deletions pkg/cat/kkc.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,12 @@ func NewKTranslate(config *ktranslate.Config, log logger.ContextL, registry go_m
kc.objmgr = s3mgr
}

// If the default provider env var is set, pass this into the system.
dp := kt.LookupEnvString("KENTIK_DEFAULT_PROVIDER_TYPE", "")
if dp != "" {
defaultProvider = kt.Provider(dp)
}

return kc, nil
}

Expand Down
Loading