From 84e4ef7fe632d93b91b2ccbd1f8d70315e8f0390 Mon Sep 17 00:00:00 2001 From: Justin Riley Date: Thu, 9 Nov 2023 14:35:55 -0500 Subject: [PATCH] add OpenShift GPU quota support --- src/coldfront_plugin_cloud/attributes.py | 2 ++ src/coldfront_plugin_cloud/openshift.py | 1 + src/coldfront_plugin_cloud/tasks.py | 5 ++++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/coldfront_plugin_cloud/attributes.py b/src/coldfront_plugin_cloud/attributes.py index 68f31de..f281145 100644 --- a/src/coldfront_plugin_cloud/attributes.py +++ b/src/coldfront_plugin_cloud/attributes.py @@ -48,6 +48,7 @@ QUOTA_LIMITS_MEMORY = 'OpenShift Limit on RAM Quota (MB)' QUOTA_LIMITS_EPHEMERAL_STORAGE_GB = 'OpenShift Limit on Ephemeral Storage Quota (GB)' QUOTA_REQUESTS_STORAGE = 'OpenShift Request on Storage Quota (GB)' +QUOTA_REQUESTS_GPU = 'OpenShift Request on GPU Quota' QUOTA_PVC = 'OpenShift Persistent Volume Claims Quota' @@ -63,4 +64,5 @@ QUOTA_LIMITS_MEMORY, QUOTA_LIMITS_EPHEMERAL_STORAGE_GB, QUOTA_REQUESTS_STORAGE, + QUOTA_REQUESTS_GPU, QUOTA_PVC] diff --git a/src/coldfront_plugin_cloud/openshift.py b/src/coldfront_plugin_cloud/openshift.py index de86982..2e9df54 100644 --- a/src/coldfront_plugin_cloud/openshift.py +++ b/src/coldfront_plugin_cloud/openshift.py @@ -14,6 +14,7 @@ attributes.QUOTA_LIMITS_MEMORY: lambda x: {":limits.memory": f"{x}Mi"}, attributes.QUOTA_LIMITS_EPHEMERAL_STORAGE_GB: lambda x: {":limits.ephemeral-storage": f"{x}Gi"}, attributes.QUOTA_REQUESTS_STORAGE: lambda x: {":requests.storage": f"{x}Gi"}, + attributes.QUOTA_REQUESTS_GPU: lambda x: {":requests.nvidia.com/gpu": f"{x}"}, attributes.QUOTA_PVC: lambda x: {":persistentvolumeclaims": f"{x}"}, } diff --git a/src/coldfront_plugin_cloud/tasks.py b/src/coldfront_plugin_cloud/tasks.py index d92bbeb..d9a3626 100644 --- a/src/coldfront_plugin_cloud/tasks.py +++ b/src/coldfront_plugin_cloud/tasks.py @@ -33,6 +33,7 @@ attributes.QUOTA_LIMITS_MEMORY: 4096, attributes.QUOTA_LIMITS_EPHEMERAL_STORAGE_GB: 5, attributes.QUOTA_REQUESTS_STORAGE: 20, + attributes.QUOTA_REQUESTS_GPU: 1, attributes.QUOTA_PVC: 2 } } @@ -45,7 +46,9 @@ attributes.QUOTA_FLOATING_IPS: 2, attributes.QUOTA_GPU: 0, }, - 'openshift': dict() + 'openshift': { + attributes.QUOTA_REQUESTS_GPU: 0, + } }