-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add handling of null values in dictionary lists
- Loading branch information
Showing
4 changed files
with
53 additions
and
22 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import kubernetes_asyncio | ||
import os | ||
|
||
class Poolboy(): | ||
manage_claims_interval = int(os.environ.get('MANAGE_CLAIMS_INTERVAL', 60)) | ||
manage_handles_interval = int(os.environ.get('MANAGE_HANDLES_INTERVAL', 60)) | ||
operator_domain = os.environ.get('OPERATOR_DOMAIN', 'poolboy.gpte.redhat.com') | ||
operator_version = os.environ.get('OPERATOR_VERSION', 'v1') | ||
operator_api_version = f"{operator_domain}/{operator_version}" | ||
resource_refresh_interval = int(os.environ.get('RESOURCE_REFRESH_INTERVAL', 600)) | ||
|
||
@classmethod | ||
async def on_cleanup(cls): | ||
await cls.api_client.close() | ||
|
||
@classmethod | ||
async def on_startup(cls): | ||
if os.path.exists('/run/secrets/kubernetes.io/serviceaccount'): | ||
kubernetes_asyncio.config.load_incluster_config() | ||
with open('/run/secrets/kubernetes.io/serviceaccount/namespace') as f: | ||
cls.namespace = f.read() | ||
else: | ||
await kubernetes_asyncio.config.load_kube_config() | ||
if 'OPERATOR_NAMESPACE' in os.environ: | ||
cls.namespace = os.environ['OPERATOR_NAMESPACE'] | ||
else: | ||
raise Exception( | ||
'Unable to determine operator namespace. ' | ||
'Please set OPERATOR_NAMESPACE environment variable.' | ||
) | ||
|
||
cls.api_client = kubernetes_asyncio.client.ApiClient() | ||
cls.core_v1_api = kubernetes_asyncio.client.CoreV1Api(cls.api_client) | ||
cls.custom_objects_api = kubernetes_asyncio.client.CustomObjectsApi(cls.api_client) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters