|
5 | 5 | Return codes: |
6 | 6 | 0: Default StorageClass is available, and setup to SCS standard |
7 | 7 | 1: Not able to connect to k8s api |
| 8 | +2: Kubeconfig not set |
| 9 | +3: Conflicting Resources |
8 | 10 |
|
9 | 11 | 31: Default storage class has no provisioner |
10 | 12 | 32: None or more then one default Storage Class is defined |
@@ -97,7 +99,7 @@ def create_pvc_pod(k8s_api_instance, storage_class): |
97 | 99 | requests={"storage": "1Gi"}, |
98 | 100 | ) |
99 | 101 | pvc_spec = client.V1PersistentVolumeClaimSpec( |
100 | | - access_modes=["ReadWriteMany"], |
| 102 | + access_modes=["ReadWriteOnce"], |
101 | 103 | storage_class_name=storage_class, |
102 | 104 | resources=pvc_resources, |
103 | 105 | ) |
@@ -203,10 +205,11 @@ def check_csi_provider(k8s_core_api): |
203 | 205 | return_code=33, |
204 | 206 | ) |
205 | 207 | else: |
206 | | - raise SCSTestException( |
207 | | - f"CSI-Provider: No CSI Provider found.", |
208 | | - return_code=34, |
209 | | - ) |
| 208 | + logger.info("CSI-Provider: No CSI Provider found.") |
| 209 | + # raise SCSTestException( |
| 210 | + # "CSI-Provider: No CSI Provider found.", |
| 211 | + # return_code=34, |
| 212 | + # ) |
210 | 213 | return 0 |
211 | 214 |
|
212 | 215 |
|
@@ -359,33 +362,23 @@ def main(argv): |
359 | 362 | except ApiException as api_exception: |
360 | 363 | if api_exception.status == 409: |
361 | 364 | logger.info( |
362 | | - "(409) conflicting resources, " |
| 365 | + "conflicting resources, " |
363 | 366 | "try to clean up left overs, then start again" |
364 | 367 | ) |
365 | | - # return_code = create_pvc_pod(k8s_core_api, default_class_name) |
366 | | - env.return_code = 1 |
| 368 | + env.return_code = 3 |
367 | 369 | env.return_message = "(409) conflicting resources" |
368 | 370 | return |
369 | 371 | else: |
370 | 372 | logger.info(f"An API error occurred: {api_exception}") |
371 | 373 | env.return_code = 1 |
372 | 374 |
|
373 | | - # Check if default_persistent volume has ReadWriteOnce defined (MANDATORY) |
374 | | - try: |
375 | | - logger.info("check_default_persistentvolume_readwriteonce()") |
| 375 | + logger.info( |
| 376 | + "Check if default_persistent volume has ReadWriteOnce defined (MANDATORY)" |
| 377 | + ) |
| 378 | + env.return_code = check_default_persistentvolumeclaim_readwriteonce( |
| 379 | + k8s_core_api |
| 380 | + ) |
376 | 381 |
|
377 | | - env.return_code = check_default_persistentvolumeclaim_readwriteonce( |
378 | | - k8s_core_api |
379 | | - ) |
380 | | - # this might be to much |
381 | | - except SCSTestException as test_exception: |
382 | | - logger.error(f"L{inspect.currentframe().f_lineno} {test_exception}") |
383 | | - env.return_message = f"{test_exception}" |
384 | | - env.return_code = test_exception.return_code |
385 | | - except Exception as exception_message: |
386 | | - logger.info(f"{exception_message}") |
387 | | - env.return_message = f"{exception_message}" |
388 | | - env.return_code = 1 |
389 | 382 | env.return_code = check_csi_provider(env.k8s_core_api) |
390 | 383 | logger.debug(f"CSI Provider check: {env.return_code}") |
391 | 384 | return env.return_code |
|
0 commit comments