3333GKE_VERSIONS_FILE = ".github/gke_versions.json"
3434OPENSHIFT_VERSIONS_FILE = ".github/openshift_versions.json"
3535KIND_VERSIONS_FILE = ".github/kind_versions.json"
36+ K3D_VERSIONS_FILE = ".github/k3d_versions.json"
3637VERSION_SCOPE_FILE = ".github/k8s_versions_scope.json"
3738E2E_TEST_TIMEOUT = ".github/e2e_test_timeout.json"
3839
@@ -114,6 +115,16 @@ def filter_version(versions_list, version_range):
114115 print (f"Failed opening file: { KIND_VERSIONS_FILE } " )
115116 exit (1 )
116117
118+ # Kubernetes versions on k3d to use during the tests
119+ try :
120+ with open (K3D_VERSIONS_FILE ) as json_file :
121+ version_list = json .load (json_file )
122+ k3d_versions = filter_version (version_list , SUPPORT_K8S_VERSION ["K3D" ])
123+ K3D_K8S = VersionList (k3d_versions )
124+ except :
125+ print (f"Failed opening file: { K3D_VERSIONS_FILE } " )
126+ exit (1 )
127+
117128# Kubernetes versions on EKS to use during the tests
118129try :
119130 with open (EKS_VERSIONS_FILE ) as json_file :
@@ -177,7 +188,7 @@ class E2EJob(dict):
177188 def __init__ (self , k8s_version , postgres_version_list , flavor ):
178189 postgres_version = postgres_version_list .latest
179190 postgres_version_pre = postgres_version_list .oldest
180- short_postgres_version = postgres_version .split ('-' )[0 ]
191+ short_postgres_version = postgres_version .split ("-" )[0 ]
181192
182193 if flavor == "pg" :
183194 name = f"{ k8s_version } -PostgreSQL-{ short_postgres_version } "
@@ -199,17 +210,17 @@ def __hash__(self):
199210 return hash (self ["id" ])
200211
201212
202- def build_push_include_local ():
213+ def build_push_include_kind ():
203214 """Build the list of tests running on push"""
204215 return {
205216 E2EJob (KIND_K8S .latest , POSTGRES .latest , "pg" ),
206217 E2EJob (KIND_K8S .oldest , POSTGRES .oldest , "pg" ),
207218 }
208219
209220
210- def build_pull_request_include_local ():
221+ def build_pull_request_include_kind ():
211222 """Build the list of tests running on pull request"""
212- result = build_push_include_local ()
223+ result = build_push_include_kind ()
213224
214225 # Iterate over K8S versions
215226 for k8s_version in KIND_K8S :
@@ -224,9 +235,9 @@ def build_pull_request_include_local():
224235 return result
225236
226237
227- def build_main_include_local ():
238+ def build_main_include_kind ():
228239 """Build the list tests running on main"""
229- result = build_pull_request_include_local ()
240+ result = build_pull_request_include_kind ()
230241
231242 # Iterate over K8S versions
232243 for k8s_version in KIND_K8S :
@@ -241,29 +252,29 @@ def build_main_include_local():
241252 return result
242253
243254
244- def build_schedule_include_local ():
255+ def build_schedule_include_kind ():
245256 """Build the list of tests running on schedule"""
246257 # For the moment scheduled tests are identical to main
247- return build_main_include_local ()
258+ return build_main_include_kind ()
248259
249260
250- def build_push_include_cloud (engine_version_list ):
261+ def build_push_include_default (engine_version_list ):
251262 return {}
252263
253264
254- def build_pull_request_include_cloud (engine_version_list ):
265+ def build_pull_request_include_default (engine_version_list ):
255266 return {
256267 E2EJob (engine_version_list .latest , POSTGRES .latest , "pg" ),
257268 }
258269
259270
260- def build_main_include_cloud (engine_version_list ):
271+ def build_main_include_default (engine_version_list ):
261272 return {
262273 E2EJob (engine_version_list .latest , POSTGRES .latest , "pg" ),
263274 }
264275
265276
266- def build_schedule_include_cloud (engine_version_list ):
277+ def build_schedule_include_default (engine_version_list ):
267278 """Build the list of tests running on schedule"""
268279 result = set ()
269280 # Iterate over K8S versions
@@ -276,45 +287,53 @@ def build_schedule_include_cloud(engine_version_list):
276287
277288
278289ENGINE_MODES = {
279- "local" : {
280- "push" : build_push_include_local ,
281- "pull_request" : build_pull_request_include_local ,
282- "issue_comment" : build_pull_request_include_local ,
283- "workflow_dispatch" : build_pull_request_include_local ,
284- "main" : build_main_include_local ,
285- "schedule" : build_schedule_include_local ,
290+ "kind" : {
291+ "push" : build_push_include_kind ,
292+ "pull_request" : build_pull_request_include_kind ,
293+ "issue_comment" : build_pull_request_include_kind ,
294+ "workflow_dispatch" : build_pull_request_include_kind ,
295+ "main" : build_main_include_kind ,
296+ "schedule" : build_schedule_include_kind ,
297+ },
298+ "k3d" : {
299+ "push" : lambda : build_push_include_default (K3D_K8S ),
300+ "pull_request" : lambda : build_pull_request_include_default (K3D_K8S ),
301+ "issue_comment" : lambda : build_pull_request_include_default (K3D_K8S ),
302+ "workflow_dispatch" : lambda : build_pull_request_include_default (K3D_K8S ),
303+ "main" : lambda : build_main_include_default (K3D_K8S ),
304+ "schedule" : lambda : build_schedule_include_default (K3D_K8S ),
286305 },
287306 "eks" : {
288- "push" : lambda : build_push_include_cloud (EKS_K8S ),
289- "pull_request" : lambda : build_pull_request_include_cloud (EKS_K8S ),
290- "issue_comment" : lambda : build_pull_request_include_cloud (EKS_K8S ),
291- "workflow_dispatch" : lambda : build_pull_request_include_cloud (EKS_K8S ),
292- "main" : lambda : build_main_include_cloud (EKS_K8S ),
293- "schedule" : lambda : build_schedule_include_cloud (EKS_K8S ),
307+ "push" : lambda : build_push_include_default (EKS_K8S ),
308+ "pull_request" : lambda : build_pull_request_include_default (EKS_K8S ),
309+ "issue_comment" : lambda : build_pull_request_include_default (EKS_K8S ),
310+ "workflow_dispatch" : lambda : build_pull_request_include_default (EKS_K8S ),
311+ "main" : lambda : build_main_include_default (EKS_K8S ),
312+ "schedule" : lambda : build_schedule_include_default (EKS_K8S ),
294313 },
295314 "aks" : {
296- "push" : lambda : build_push_include_cloud (AKS_K8S ),
297- "pull_request" : lambda : build_pull_request_include_cloud (AKS_K8S ),
298- "issue_comment" : lambda : build_pull_request_include_cloud (AKS_K8S ),
299- "workflow_dispatch" : lambda : build_pull_request_include_cloud (AKS_K8S ),
300- "main" : lambda : build_main_include_cloud (AKS_K8S ),
301- "schedule" : lambda : build_schedule_include_cloud (AKS_K8S ),
315+ "push" : lambda : build_push_include_default (AKS_K8S ),
316+ "pull_request" : lambda : build_pull_request_include_default (AKS_K8S ),
317+ "issue_comment" : lambda : build_pull_request_include_default (AKS_K8S ),
318+ "workflow_dispatch" : lambda : build_pull_request_include_default (AKS_K8S ),
319+ "main" : lambda : build_main_include_default (AKS_K8S ),
320+ "schedule" : lambda : build_schedule_include_default (AKS_K8S ),
302321 },
303322 "gke" : {
304- "push" : lambda : build_push_include_cloud (GKE_K8S ),
305- "pull_request" : lambda : build_pull_request_include_cloud (GKE_K8S ),
306- "issue_comment" : lambda : build_pull_request_include_cloud (GKE_K8S ),
307- "workflow_dispatch" : lambda : build_pull_request_include_cloud (GKE_K8S ),
308- "main" : lambda : build_main_include_cloud (GKE_K8S ),
309- "schedule" : lambda : build_schedule_include_cloud (GKE_K8S ),
323+ "push" : lambda : build_push_include_default (GKE_K8S ),
324+ "pull_request" : lambda : build_pull_request_include_default (GKE_K8S ),
325+ "issue_comment" : lambda : build_pull_request_include_default (GKE_K8S ),
326+ "workflow_dispatch" : lambda : build_pull_request_include_default (GKE_K8S ),
327+ "main" : lambda : build_main_include_default (GKE_K8S ),
328+ "schedule" : lambda : build_schedule_include_default (GKE_K8S ),
310329 },
311330 "openshift" : {
312- "push" : lambda : build_push_include_cloud (OPENSHIFT_K8S ),
313- "pull_request" : lambda : build_pull_request_include_cloud (OPENSHIFT_K8S ),
314- "issue_comment" : lambda : build_pull_request_include_cloud (OPENSHIFT_K8S ),
315- "workflow_dispatch" : lambda : build_pull_request_include_cloud (OPENSHIFT_K8S ),
316- "main" : lambda : build_main_include_cloud (OPENSHIFT_K8S ),
317- "schedule" : lambda : build_schedule_include_cloud (OPENSHIFT_K8S ),
331+ "push" : lambda : build_push_include_default (OPENSHIFT_K8S ),
332+ "pull_request" : lambda : build_pull_request_include_default (OPENSHIFT_K8S ),
333+ "issue_comment" : lambda : build_pull_request_include_default (OPENSHIFT_K8S ),
334+ "workflow_dispatch" : lambda : build_pull_request_include_default (OPENSHIFT_K8S ),
335+ "main" : lambda : build_main_include_default (OPENSHIFT_K8S ),
336+ "schedule" : lambda : build_schedule_include_default (OPENSHIFT_K8S ),
318337 },
319338}
320339
0 commit comments