mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-07-06 12:59:13 +00:00
scripting improvements
This commit is contained in:
parent
f026c3604a
commit
7b94c9beff
@ -70,6 +70,7 @@ func createScript(provider *kubernetes.Provider, script misc.ConfigMapScript) (i
|
|||||||
}
|
}
|
||||||
scripts[index] = script
|
scripts[index] = script
|
||||||
|
|
||||||
|
log.Info().Str("title", script.Title).Bool("Active", script.Active).Int64("Index", index).Msg("Creating script")
|
||||||
var data []byte
|
var data []byte
|
||||||
data, err = json.Marshal(scripts)
|
data, err = json.Marshal(scripts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -146,7 +147,7 @@ func watchScripts(provider *kubernetes.Provider, block bool) {
|
|||||||
index, err := createScript(provider, script.ConfigMap())
|
index, err := createScript(provider, script.ConfigMap())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error().Err(err).Send()
|
log.Error().Err(err).Send()
|
||||||
return
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
files[script.Path] = index
|
files[script.Path] = index
|
||||||
|
@ -84,7 +84,16 @@ func SetConfig(provider *Provider, key string, value string) (updated bool, err
|
|||||||
_, err = provider.clientSet.CoreV1().ConfigMaps(config.Config.Tap.Release.Namespace).Update(context.TODO(), configMap, metav1.UpdateOptions{})
|
_, err = provider.clientSet.CoreV1().ConfigMaps(config.Config.Tap.Release.Namespace).Update(context.TODO(), configMap, metav1.UpdateOptions{})
|
||||||
if err == nil {
|
if err == nil {
|
||||||
if updated {
|
if updated {
|
||||||
log.Info().Str("config", key).Str("value", value).Msg("Updated:")
|
log.Info().
|
||||||
|
Str("config", key).
|
||||||
|
Str("value", func() string {
|
||||||
|
if len(value) > 10 {
|
||||||
|
return value[:10]
|
||||||
|
}
|
||||||
|
return value
|
||||||
|
}()).
|
||||||
|
Int("length", len(value)).
|
||||||
|
Msg("Updated. Printing only 10 first characters of value:")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
log.Error().Str("config", key).Err(err).Send()
|
log.Error().Str("config", key).Err(err).Send()
|
||||||
|
Loading…
Reference in New Issue
Block a user