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()
}
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.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.")

View File

@ -42,7 +42,8 @@ var proxyDone bool
func tap() {
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)

View File

@ -13,7 +13,8 @@ import (
)
const (
TagLabel = "tag"
DockerRegistryLabel = "docker-registry"
DockerTagLabel = "docker-tag"
ProxyPortFrontLabel = "proxy-port-front"
ProxyPortHubLabel = "proxy-port-hub"
ProxyHostLabel = "proxy-host"
@ -41,7 +42,8 @@ type FrontConfig struct {
type TapConfig struct {
Hub HubConfig `yaml:"hub"`
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:".*"`
ProxyHost string `yaml:"proxy-host" default:"127.0.0.1"`
Namespaces []string `yaml:"namespaces"`

View File

@ -9,16 +9,16 @@ const (
)
var (
namespace = "kubeshark"
tag = "latest"
registry = "docker.io/kubeshark"
tag = "latest"
)
func GetNamespace() string {
return namespace
func GetRegistry() string {
return registry
}
func SetNamespace(value string) {
namespace = value
func SetRegistry(value string) {
registry = value
}
func GetTag() string {
@ -30,7 +30,7 @@ func SetTag(value 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 {