Skip to content

Commit

Permalink
Merge pull request #99 from rakshitgondwal/feat/image-version-matching
Browse files Browse the repository at this point in the history
feat: image version matching
  • Loading branch information
k8s-ci-robot authored Jan 17, 2024
2 parents 8cd8696 + 0e0f32a commit 9be175e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
15 changes: 12 additions & 3 deletions pkg/common/args.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ import (
"sigs.k8s.io/hydrophone/pkg/log"
)

// ConformanceImage is used to define the container image being used to run the conformance tests
var ConformanceImage string

// ArgConfig stores the argument passed when running the program
type ArgConfig struct {
// Focus set the E2E_FOCUS env var to run a specific test
Expand Down Expand Up @@ -78,6 +81,7 @@ type ArgConfig struct {

// InitArgs initializes the arguments passed to the program
func InitArgs() (*ArgConfig, error) {

var cfg ArgConfig

outputDir, err := os.Getwd()
Expand All @@ -87,8 +91,7 @@ func InitArgs() (*ArgConfig, error) {

flag.StringVar(&cfg.Focus, "focus", "", "focus runs a specific e2e test. e.g. - sig-auth. allows regular expressions.")
flag.StringVar(&cfg.Skip, "skip", "", "skip specific tests. allows regular expressions.")
flag.StringVar(&cfg.ConformanceImage, "conformance-image", containerImage,
"specify a conformance container image of your choice.")
flag.StringVar(&cfg.ConformanceImage, "conformance-image", "", "specify a conformance container image of your choice.")
flag.StringVar(&cfg.BusyboxImage, "busybox-image", busyboxImage,
"specify an alternate busybox container image.")
flag.StringVar(&cfg.Kubeconfig, "kubeconfig", "", "path to the kubeconfig file.")
Expand Down Expand Up @@ -119,6 +122,8 @@ func InitArgs() (*ArgConfig, error) {
return nil, fmt.Errorf("specify either --conformance or --focus arguments, not both")
}

ConformanceImage = cfg.ConformanceImage

return &cfg, nil
}

Expand All @@ -129,6 +134,10 @@ func PrintInfo(clientSet *kubernetes.Clientset, config *rest.Config) {
log.Fatal("Error fetching server version: ", err)
}

if ConformanceImage == "" {
ConformanceImage = fmt.Sprintf("registry.k8s.io/conformance:%s", serverVersion.String())
}

log.Printf("API endpoint : %s", config.Host)
log.Printf("Server version : %#v", *serverVersion)
}
Expand All @@ -143,7 +152,7 @@ func ValidateArgs(clientSet *kubernetes.Clientset, config *rest.Config, cfg *Arg
if cfg.Skip != "" {
log.Printf("Skipping tests : '%s'", cfg.Skip)
}
log.Printf("Using conformance image : '%s'", cfg.ConformanceImage)
log.Printf("Using conformance image : '%s'", ConformanceImage)
log.Printf("Using busybox image : '%s'", cfg.BusyboxImage)
log.Printf("Test framework will start '%d' threads and use verbosity '%d'",
cfg.Parallel, cfg.Verbosity)
Expand Down
2 changes: 0 additions & 2 deletions pkg/common/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ limitations under the License.
package common

const (
// containerImage is the default contaimer image used to run the conformance tests
containerImage = "registry.k8s.io/conformance:v1.29.0"
// busyboxImage is the image used to extract the e2e logs
busyboxImage = "registry.k8s.io/e2e-test-images/busybox:1.36.1-1"
// Namespace is the namespace where the conformance pod is created
Expand Down
2 changes: 1 addition & 1 deletion pkg/service/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func RunE2E(clientset *kubernetes.Clientset, cfg *common.ArgConfig) {
Containers: []v1.Container{
{
Name: common.ConformanceContainer,
Image: cfg.ConformanceImage,
Image: common.ConformanceImage,
ImagePullPolicy: v1.PullIfNotPresent,
Env: []v1.EnvVar{
{
Expand Down
2 changes: 1 addition & 1 deletion pkg/service/list_images.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func PrintListImages(cfg *common.ArgConfig, clientSet *kubernetes.Clientset, con
Containers: []corev1.Container{
{
Name: common.ConformanceContainer,
Image: cfg.ConformanceImage,
Image: common.ConformanceImage,
Command: []string{
"/usr/local/bin/e2e.test",
"--list-images",
Expand Down

0 comments on commit 9be175e

Please sign in to comment.