mirror of
https://github.com/kubeshark/kubeshark.git
synced 2026-01-30 05:54:21 +00:00
* ✨ Use the Helm chart in `tap` command to install Kubeshark * ⬆️ Set Go version to `1.19` in `go.mod` file * ✨ Add `Helm` struct`, `NewHelm` and `NewHelmDefault` methods * ⚡ Better logging and error return * ⚡ Pass the config as `values.yaml` to Helm install * 🔥 Remove `helm-chart`, `manifests` and `check` commands * ➖ Run `go mod tidy` * 🎨 Move `helm` package into `kubernetes` package * 🔥 Remove `# THIS FILE IS AUTOMATICALLY GENERATED BY KUBESHARK CLI. DO NOT EDIT!` notice from the manifests and Helm templates * 🔥 Remove the unused `GenerateApplyConfiguration` and `buildWithDefaultLabels` methods
47 lines
932 B
Go
47 lines
932 B
Go
package configStructs
|
|
|
|
import (
|
|
"io/fs"
|
|
"os"
|
|
"path/filepath"
|
|
|
|
"github.com/kubeshark/kubeshark/misc"
|
|
"github.com/rs/zerolog/log"
|
|
)
|
|
|
|
type ScriptingConfig struct {
|
|
Env map[string]interface{} `yaml:"env" json:"env"`
|
|
Source string `yaml:"source" json:"source" default:""`
|
|
WatchScripts bool `yaml:"watchScripts" json:"watchScripts" default:"true"`
|
|
}
|
|
|
|
func (config *ScriptingConfig) GetScripts() (scripts []*misc.Script, err error) {
|
|
if config.Source == "" {
|
|
return
|
|
}
|
|
|
|
var files []fs.DirEntry
|
|
files, err = os.ReadDir(config.Source)
|
|
if err != nil {
|
|
return
|
|
}
|
|
|
|
for _, f := range files {
|
|
if f.IsDir() {
|
|
continue
|
|
}
|
|
|
|
var script *misc.Script
|
|
path := filepath.Join(config.Source, f.Name())
|
|
script, err = misc.ReadScriptFile(path)
|
|
if err != nil {
|
|
return
|
|
}
|
|
scripts = append(scripts, script)
|
|
|
|
log.Debug().Str("path", path).Msg("Found script:")
|
|
}
|
|
|
|
return
|
|
}
|