Skip to content

Commit

Permalink
terminology: repository -> registry
Browse files Browse the repository at this point in the history
  • Loading branch information
mattfenwick committed Oct 10, 2023
1 parent 577d0a8 commit c53de46
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 24 deletions.
6 changes: 3 additions & 3 deletions pkg/cli/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ type GenerateArgs struct {
DryRun bool
JobTimeoutSeconds int
JunitResultsFile string
ImageRepository string
ImageRegistry string
//BatchJobs bool
}

Expand Down Expand Up @@ -86,7 +86,7 @@ func SetupGenerateCommand() *cobra.Command {
command.Flags().BoolVar(&args.DryRun, "dry-run", false, "if true, don't actually do anything: just print out what would be done")

command.Flags().StringVar(&args.JunitResultsFile, "junit-results-file", "", "output junit results to the specified file")
command.Flags().StringVar(&args.ImageRepository, "image-repository", "registry.k8s.io", "Image repository for agnhost")
command.Flags().StringVar(&args.ImageRegistry, "image-registry", "registry.k8s.io", "Image registry for agnhost")

return command
}
Expand Down Expand Up @@ -115,7 +115,7 @@ func RunGenerateCommand(args *GenerateArgs) {
serverProtocols := parseProtocols(args.ServerProtocols)

batchJobs := false // args.BatchJobs
resources, err := probe.NewDefaultResources(kubernetes, args.ServerNamespaces, args.ServerPods, args.ServerPorts, serverProtocols, externalIPs, args.PodCreationTimeoutSeconds, batchJobs, args.ImageRepository)
resources, err := probe.NewDefaultResources(kubernetes, args.ServerNamespaces, args.ServerPods, args.ServerPorts, serverProtocols, externalIPs, args.PodCreationTimeoutSeconds, batchJobs, args.ImageRegistry)
utils.DoOrDie(err)

interpreterConfig := &connectivity.InterpreterConfig{
Expand Down
6 changes: 3 additions & 3 deletions pkg/cli/probe.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ type ProbeArgs struct {
ServerPorts []int
ServerNamespaces []string
ServerPods []string
ImageRepository string
ImageRegistry string
}

func SetupProbeCommand() *cobra.Command {
Expand Down Expand Up @@ -68,7 +68,7 @@ func SetupProbeCommand() *cobra.Command {
command.Flags().IntVar(&args.PerturbationWaitSeconds, "perturbation-wait-seconds", 5, "number of seconds to wait after perturbing the cluster (i.e. create a network policy, modify a ns/pod label) before running probes, to give the CNI time to update the cluster state")
command.Flags().IntVar(&args.PodCreationTimeoutSeconds, "pod-creation-timeout-seconds", 60, "number of seconds to wait for pods to create, be running and have IP addresses")
command.Flags().StringVar(&args.PolicyPath, "policy-path", "", "path to yaml network policy to create in kube; if empty, will not create any policies")
command.Flags().StringVar(&args.ImageRepository, "image-repository", "registry.k8s.io", "Image repository for agnhost")
command.Flags().StringVar(&args.ImageRegistry, "image-registry", "registry.k8s.io", "Image registry for agnhost")

return command
}
Expand All @@ -85,7 +85,7 @@ func RunProbeCommand(args *ProbeArgs) {
protocols := parseProtocols(args.Protocols)
serverProtocols := parseProtocols(args.ServerProtocols)

resources, err := probe.NewDefaultResources(kubernetes, args.ServerNamespaces, args.ServerPods, args.ServerPorts, serverProtocols, externalIPs, args.PodCreationTimeoutSeconds, false, args.ImageRepository)
resources, err := probe.NewDefaultResources(kubernetes, args.ServerNamespaces, args.ServerPods, args.ServerPorts, serverProtocols, externalIPs, args.PodCreationTimeoutSeconds, false, args.ImageRegistry)
utils.DoOrDie(err)

interpreterConfig := &connectivity.InterpreterConfig{
Expand Down
32 changes: 16 additions & 16 deletions pkg/connectivity/probe/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ func NewPod(ns string, name string, labels map[string]string, ip string, contain
}
}

func NewDefaultPod(ns string, name string, ports []int, protocols []v1.Protocol, batchJobs bool, imageRepository string) *Pod {
func NewDefaultPod(ns string, name string, ports []int, protocols []v1.Protocol, batchJobs bool, imageRegistry string) *Pod {
var containers []*Container
for _, port := range ports {
for _, protocol := range protocols {
containers = append(containers, NewDefaultContainer(port, protocol, batchJobs, imageRepository))
containers = append(containers, NewDefaultContainer(port, protocol, batchJobs, imageRegistry))
}
}
return &Pod{
Expand Down Expand Up @@ -164,22 +164,22 @@ func (p *Pod) PodString() PodString {
}

type Container struct {
Name string
Port int
Protocol v1.Protocol
PortName string
BatchJobs bool
imageRepository string
Name string
Port int
Protocol v1.Protocol
PortName string
BatchJobs bool
ImageRegistry string
}

func NewDefaultContainer(port int, protocol v1.Protocol, batchJobs bool, imageRepository string) *Container {
func NewDefaultContainer(port int, protocol v1.Protocol, batchJobs bool, imageRegistry string) *Container {
return &Container{
Name: fmt.Sprintf("cont-%d-%s", port, strings.ToLower(string(protocol))),
Port: port,
Protocol: protocol,
PortName: fmt.Sprintf("serve-%d-%s", port, strings.ToLower(string(protocol))),
BatchJobs: batchJobs,
imageRepository: imageRepository,
Name: fmt.Sprintf("cont-%d-%s", port, strings.ToLower(string(protocol))),
Port: port,
Protocol: protocol,
PortName: fmt.Sprintf("serve-%d-%s", port, strings.ToLower(string(protocol))),
BatchJobs: batchJobs,
ImageRegistry: imageRegistry,
}
}

Expand All @@ -195,7 +195,7 @@ func (c *Container) Image() string {
if c.BatchJobs {
return cyclonusWorkerImage
}
return c.imageRepository + "/" + agnhostImage
return c.ImageRegistry + "/" + agnhostImage
}

func (c *Container) KubeContainer() v1.Container {
Expand Down
4 changes: 2 additions & 2 deletions pkg/connectivity/probe/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type Resources struct {
//ExternalIPs []string
}

func NewDefaultResources(kubernetes kube.IKubernetes, namespaces []string, podNames []string, ports []int, protocols []v1.Protocol, externalIPs []string, podCreationTimeoutSeconds int, batchJobs bool, imageRepository string) (*Resources, error) {
func NewDefaultResources(kubernetes kube.IKubernetes, namespaces []string, podNames []string, ports []int, protocols []v1.Protocol, externalIPs []string, podCreationTimeoutSeconds int, batchJobs bool, imageRegistry string) (*Resources, error) {
//sort.Strings(externalIPs) // TODO why is this here?

r := &Resources{
Expand All @@ -28,7 +28,7 @@ func NewDefaultResources(kubernetes kube.IKubernetes, namespaces []string, podNa

for _, ns := range namespaces {
for _, podName := range podNames {
r.Pods = append(r.Pods, NewDefaultPod(ns, podName, ports, protocols, batchJobs, imageRepository))
r.Pods = append(r.Pods, NewDefaultPod(ns, podName, ports, protocols, batchJobs, imageRegistry))
}
r.Namespaces[ns] = map[string]string{"ns": ns}
}
Expand Down

0 comments on commit c53de46

Please sign in to comment.