/ kubernetes / test / utils / image.go
image.go
 1  // Copyright 2025 Alibaba Group Holding Ltd.
 2  //
 3  // Licensed under the Apache License, Version 2.0 (the "License");
 4  // you may not use this file except in compliance with the License.
 5  // You may obtain a copy of the License at
 6  //
 7  //     http://www.apache.org/licenses/LICENSE-2.0
 8  //
 9  // Unless required by applicable law or agreed to in writing, software
10  // distributed under the License is distributed on an "AS IS" BASIS,
11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  // See the License for the specific language governing permissions and
13  // limitations under the License.
14  
15  package utils
16  
17  import "os"
18  
19  var (
20  	// ControllerImage is the controller manager image
21  	// Can be overridden via CONTROLLER_IMG env var
22  	ControllerImage = getEnv("CONTROLLER_IMG", "controller:dev")
23  
24  	// TaskExecutorImage is the task-executor image
25  	// Can be overridden via TASK_EXECUTOR_IMG env var
26  	TaskExecutorImage = getEnv("TASK_EXECUTOR_IMG", "task-executor:dev")
27  
28  	// SandboxImage is the image used for sandbox containers in tests
29  	// Always uses TaskExecutorImage to ensure the image is available in Kind
30  	SandboxImage = TaskExecutorImage
31  )
32  
33  func getEnv(key, defaultValue string) string {
34  	if v := os.Getenv(key); v != "" {
35  		return v
36  	}
37  	return defaultValue
38  }