🔨 Define DockerConfig

This commit is contained in:
M. Mert Yildiran 2022-12-28 05:16:03 +03:00
parent 23b6dd220a
commit 1dec62e50c
No known key found for this signature in database
GPG Key ID: DA5D6DCBB758A461
4 changed files with 12 additions and 8 deletions

View File

@ -46,8 +46,8 @@ func init() {
log.Debug().Err(err).Send()
}
tapCmd.Flags().StringP(configStructs.DockerRegistryLabel, "r", defaultTapConfig.DockerRegistry, "The Docker registry that's hosting the images.")
tapCmd.Flags().StringP(configStructs.DockerTagLabel, "t", defaultTapConfig.DockerTag, "The tag of the Docker images that are going to be pulled.")
tapCmd.Flags().StringP(configStructs.DockerRegistryLabel, "r", defaultTapConfig.Docker.Registry, "The Docker registry that's hosting the images.")
tapCmd.Flags().StringP(configStructs.DockerTagLabel, "t", defaultTapConfig.Docker.Tag, "The tag of the Docker images that are going to be pulled.")
tapCmd.Flags().Uint16(configStructs.ProxyPortFrontLabel, defaultTapConfig.Proxy.Front.SrcPort, "Provide a custom port for the front-end proxy/port-forward.")
tapCmd.Flags().Uint16(configStructs.ProxyPortHubLabel, defaultTapConfig.Proxy.Hub.SrcPort, "Provide a custom port for the Hub proxy/port-forward.")
tapCmd.Flags().String(configStructs.ProxyHostLabel, defaultTapConfig.Proxy.Host, "Provide a custom host for the proxy/port-forward.")

View File

@ -228,8 +228,8 @@ func stopAndRemoveContainers(
}
func pcap(tarPath string) {
docker.SetRegistry(config.Config.Tap.DockerRegistry)
docker.SetTag(config.Config.Tap.DockerTag)
docker.SetRegistry(config.Config.Tap.Docker.Registry)
docker.SetTag(config.Config.Tap.Docker.Tag)
ctx := context.Background()
cli, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation())

View File

@ -40,8 +40,8 @@ var proxyDone bool
func tap() {
state.startTime = time.Now()
docker.SetRegistry(config.Config.Tap.DockerRegistry)
docker.SetTag(config.Config.Tap.DockerTag)
docker.SetRegistry(config.Config.Tap.Docker.Registry)
docker.SetTag(config.Config.Tap.Docker.Tag)
log.Info().Str("registry", docker.GetRegistry()).Str("tag", docker.GetTag()).Msg("Using Docker:")
if config.Config.Tap.Pcap != "" {
pcap(config.Config.Tap.Pcap)

View File

@ -46,10 +46,14 @@ type ProxyConfig struct {
Host string `yaml:"host" default:"127.0.0.1"`
}
type DockerConfig struct {
Registry string `yaml:"registry" default:"docker.io/kubeshark"`
Tag string `yaml:"tag" default:"latest"`
}
type TapConfig struct {
Docker DockerConfig `yaml:"docker"`
Proxy ProxyConfig `yaml:"proxy"`
DockerRegistry string `yaml:"docker-registry" default:"docker.io/kubeshark"`
DockerTag string `yaml:"docker-tag" default:"latest"`
PodRegexStr string `yaml:"regex" default:".*"`
Namespaces []string `yaml:"namespaces"`
AllNamespaces bool `yaml:"all-namespaces" default:"false"`