Add --docker-registry option to tap command

This commit is contained in:
M. Mert Yildiran 2022-12-26 07:53:24 +03:00
parent 034a540530
commit 07bd12e396
No known key found for this signature in database
GPG Key ID: DA5D6DCBB758A461
4 changed files with 15 additions and 11 deletions

View File

@ -46,7 +46,8 @@ func init() {
log.Debug().Err(err).Send() log.Debug().Err(err).Send()
} }
tapCmd.Flags().StringP(configStructs.TagLabel, "t", defaultTapConfig.Tag, "The tag of the Docker images that are going to be pulled.") 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().Uint16(configStructs.ProxyPortFrontLabel, defaultTapConfig.Front.SrcPort, "Provide a custom port for the front-end proxy/port-forward.") tapCmd.Flags().Uint16(configStructs.ProxyPortFrontLabel, defaultTapConfig.Front.SrcPort, "Provide a custom port for the front-end proxy/port-forward.")
tapCmd.Flags().Uint16(configStructs.ProxyPortHubLabel, defaultTapConfig.Hub.SrcPort, "Provide a custom port for the Hub proxy/port-forward.") tapCmd.Flags().Uint16(configStructs.ProxyPortHubLabel, defaultTapConfig.Hub.SrcPort, "Provide a custom port for the Hub proxy/port-forward.")
tapCmd.Flags().String(configStructs.ProxyHostLabel, defaultTapConfig.ProxyHost, "Provide a custom host for the proxy/port-forward.") tapCmd.Flags().String(configStructs.ProxyHostLabel, defaultTapConfig.ProxyHost, "Provide a custom host for the proxy/port-forward.")

View File

@ -42,7 +42,8 @@ var proxyDone bool
func tap() { func tap() {
state.startTime = time.Now() state.startTime = time.Now()
docker.SetTag(config.Config.Tap.Tag) docker.SetRegistry(config.Config.Tap.DockerRegistry)
docker.SetTag(config.Config.Tap.DockerTag)
connector = connect.NewConnector(kubernetes.GetLocalhostOnPort(config.Config.Tap.Hub.SrcPort), connect.DefaultRetries, connect.DefaultTimeout) connector = connect.NewConnector(kubernetes.GetLocalhostOnPort(config.Config.Tap.Hub.SrcPort), connect.DefaultRetries, connect.DefaultTimeout)

View File

@ -13,7 +13,8 @@ import (
) )
const ( const (
TagLabel = "tag" DockerRegistryLabel = "docker-registry"
DockerTagLabel = "docker-tag"
ProxyPortFrontLabel = "proxy-port-front" ProxyPortFrontLabel = "proxy-port-front"
ProxyPortHubLabel = "proxy-port-hub" ProxyPortHubLabel = "proxy-port-hub"
ProxyHostLabel = "proxy-host" ProxyHostLabel = "proxy-host"
@ -41,7 +42,8 @@ type FrontConfig struct {
type TapConfig struct { type TapConfig struct {
Hub HubConfig `yaml:"hub"` Hub HubConfig `yaml:"hub"`
Front FrontConfig `yaml:"front"` Front FrontConfig `yaml:"front"`
Tag string `yaml:"tag" default:"latest"` DockerRegistry string `yaml:"docker-registry" default:"docker.io/kubeshark"`
DockerTag string `yaml:"docker-tag" default:"latest"`
PodRegexStr string `yaml:"regex" default:".*"` PodRegexStr string `yaml:"regex" default:".*"`
ProxyHost string `yaml:"proxy-host" default:"127.0.0.1"` ProxyHost string `yaml:"proxy-host" default:"127.0.0.1"`
Namespaces []string `yaml:"namespaces"` Namespaces []string `yaml:"namespaces"`

View File

@ -9,16 +9,16 @@ const (
) )
var ( var (
namespace = "kubeshark" registry = "docker.io/kubeshark"
tag = "latest" tag = "latest"
) )
func GetNamespace() string { func GetRegistry() string {
return namespace return registry
} }
func SetNamespace(value string) { func SetRegistry(value string) {
namespace = value registry = value
} }
func GetTag() string { func GetTag() string {
@ -30,7 +30,7 @@ func SetTag(value string) {
} }
func getImage(image string) string { func getImage(image string) string {
return fmt.Sprintf("%s/%s:%s", namespace, image, tag) return fmt.Sprintf("%s/%s:%s", registry, image, tag)
} }
func GetHubImage() string { func GetHubImage() string {