mirror of
https://github.com/kubeshark/kubeshark.git
synced 2026-05-07 09:47:19 +00:00
* modified Dockerfile to work for both amd64 (Intel) and arm64 (M1) * added changelog * Update `Dockerfile` to have `ARCH` build argument * Remove `docs/CHANGES.md` * Upgrade the Basenine version from `v0.3.0` to `v0.4.6` * Update `publish.yml` to have `ARCH` build argument * Switch `BasenineImageRepo` to Docker Hub * Have separate build arguments for `ARCH` and `GOARCH` * Upgrade the Basenine version from `v0.4.6` to `v0.4.10` * Oops forgot to update the 10th duplicated shell script * Fix the oopsie and reduce duplications * Fix `Dockerfile` * Fix the incompatibility issue between Go plugins and gold linker in Alpine inside `Dockerfile` * Fix `asm: xxhash_amd64.s:120: when dynamic linking, R15 is clobbered by a global variable access` error * Update `Dockerfile` to have cross-compilation on an AMD64 machine Also revert changes in the shell scripts * Delete `debug.Dockerfile` * Create a custom base (`debian:buster-slim` based) image for the shipped image * Replace `mertyildiran/debian-pcap` with `up9inc/debian-pcap` * Upgrade Basenine version to `v0.4.12` * Use `debian:stable-slim` as the base * Fix the indentation in the `Dockerfile` * Update `publish.yml` * Enable `publish.yml` for `feature/multiarch_build` branch * Tag correctly and set `ARCH` Docker argument * Remove the lines that are forgotten to be removed from the shell scripts * Add `MizuAgentImageRepo` constant and use it as default `AgentImage` value * Bring back `Set up Cloud SDK` step to `Build the CLI and publish` job * Build ARM64 CLI for Linux as well * Revert "Enable `publish.yml` for `feature/multiarch_build` branch" This reverts commitd30be4c1f0. * Revert Go 1.17 upgrade * Remove `build_extensions_debug.sh` as well * Make the `Dockerfile` to compile the agent statically * Statically link the protocol extensions * Fix `Dockerfile` * Bring back `-s -w` flags * Verify the signatures of the downloads in `dockcross/linux-arm64-musl` * Revert modifications in some shell scripts * Make the `BUILDARCH` and `TARGETARCH` separation in the `Dockerfile` * Separate cross-compilation builder image into a separate repo named `up9inc/linux-arm64-musl-go-libpcap` * Fill the shell script and specify the tag for `dockcross/linux-arm64-musl` * Remove the unnecessary dependencies from `builder-native-base` * Improve the comments in the `Dockerfile` * Upgrade Basenine version to `v0.4.13` * Fix `Dockerfile` * Revert "Revert "Enable `publish.yml` for `feature/multiarch_build` branch"" This reverts commit303e466bdc. * Revert "Revert "Revert "Enable `publish.yml` for `feature/multiarch_build` branch""" This reverts commit0fe252bbdb. * Remove `push-docker-debug` from the `Makefile` * Rename `publish.yml` to `release.yml` Co-authored-by: Alex Haiut <alex@up9.com>
88 lines
3.5 KiB
Go
88 lines
3.5 KiB
Go
package config
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"path"
|
|
"path/filepath"
|
|
|
|
"github.com/op/go-logging"
|
|
"github.com/up9inc/mizu/cli/config/configStructs"
|
|
"github.com/up9inc/mizu/cli/mizu"
|
|
"github.com/up9inc/mizu/shared"
|
|
v1 "k8s.io/api/core/v1"
|
|
"k8s.io/client-go/util/homedir"
|
|
)
|
|
|
|
const (
|
|
MizuResourcesNamespaceConfigName = "mizu-resources-namespace"
|
|
ConfigFilePathCommandName = "config-path"
|
|
KubeConfigPathConfigName = "kube-config-path"
|
|
)
|
|
|
|
type ConfigStruct struct {
|
|
Tap configStructs.TapConfig `yaml:"tap"`
|
|
Version configStructs.VersionConfig `yaml:"version"`
|
|
View configStructs.ViewConfig `yaml:"view"`
|
|
Logs configStructs.LogsConfig `yaml:"logs"`
|
|
Auth configStructs.AuthConfig `yaml:"auth"`
|
|
Config configStructs.ConfigConfig `yaml:"config,omitempty"`
|
|
AgentImage string `yaml:"agent-image,omitempty" readonly:""`
|
|
BasenineImage string `yaml:"basenine-image,omitempty" readonly:""`
|
|
KratosImage string `yaml:"kratos-image,omitempty" readonly:""`
|
|
KetoImage string `yaml:"keto-image,omitempty" readonly:""`
|
|
ImagePullPolicyStr string `yaml:"image-pull-policy" default:"Always"`
|
|
MizuResourcesNamespace string `yaml:"mizu-resources-namespace" default:"mizu"`
|
|
Telemetry bool `yaml:"telemetry" default:"true"`
|
|
DumpLogs bool `yaml:"dump-logs" default:"false"`
|
|
KubeConfigPathStr string `yaml:"kube-config-path"`
|
|
ConfigFilePath string `yaml:"config-path,omitempty" readonly:""`
|
|
HeadlessMode bool `yaml:"headless" default:"false"`
|
|
LogLevelStr string `yaml:"log-level,omitempty" default:"INFO" readonly:""`
|
|
ServiceMap bool `yaml:"service-map,omitempty" default:"false" readonly:""`
|
|
OAS bool `yaml:"oas,omitempty" default:"false" readonly:""`
|
|
}
|
|
|
|
func (config *ConfigStruct) validate() error {
|
|
if _, err := logging.LogLevel(config.LogLevelStr); err != nil {
|
|
return fmt.Errorf("%s is not a valid log level, err: %v", config.LogLevelStr, err)
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (config *ConfigStruct) SetDefaults() {
|
|
config.BasenineImage = fmt.Sprintf("%s:%s", shared.BasenineImageRepo, shared.BasenineImageTag)
|
|
config.KratosImage = shared.KratosImageDefault
|
|
config.KetoImage = shared.KetoImageDefault
|
|
config.AgentImage = fmt.Sprintf("%s:%s", shared.MizuAgentImageRepo, mizu.SemVer)
|
|
config.ConfigFilePath = path.Join(mizu.GetMizuFolderPath(), "config.yaml")
|
|
}
|
|
|
|
func (config *ConfigStruct) ImagePullPolicy() v1.PullPolicy {
|
|
return v1.PullPolicy(config.ImagePullPolicyStr)
|
|
}
|
|
|
|
func (config *ConfigStruct) IsNsRestrictedMode() bool {
|
|
return config.MizuResourcesNamespace != "mizu" // Notice "mizu" string must match the default MizuResourcesNamespace
|
|
}
|
|
|
|
func (config *ConfigStruct) KubeConfigPath() string {
|
|
if config.KubeConfigPathStr != "" {
|
|
return config.KubeConfigPathStr
|
|
}
|
|
|
|
envKubeConfigPath := os.Getenv("KUBECONFIG")
|
|
if envKubeConfigPath != "" {
|
|
return envKubeConfigPath
|
|
}
|
|
|
|
home := homedir.HomeDir()
|
|
return filepath.Join(home, ".kube", "config")
|
|
}
|
|
|
|
func (config *ConfigStruct) LogLevel() logging.Level {
|
|
logLevel, _ := logging.LogLevel(config.LogLevelStr)
|
|
return logLevel
|
|
}
|