-
Notifications
You must be signed in to change notification settings - Fork 62
Support for optional field in configmap / secret ref #181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
Hi @ltamaster, are you still maintaining this repo? |
|
Hi @fdevans, I see you were active in this repo last week, any chance you can take a look at this small PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for the optional field in configmap and secret references in Kubernetes job creation. The changes enable users to specify whether a configmap or secret reference should be treated as optional during job execution.
- Extracts configmap and secret references to separate variables for cleaner code
- Adds support for the
optionalfield in both V1ConfigMapEnvSource and V1SecretEnvSource - Fixes parameter passing by using named parameters instead of positional ones
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| config_map_ref=client.V1ConfigMapEnvSource( | ||
| env_from_data['configMapRef']['name'] | ||
| name=config_map_ref['name'], | ||
| optional=config_map_ref.get('optional') | ||
| ) |
Copilot
AI
Oct 1, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original code was passing the name as a positional argument, but V1ConfigMapEnvSource expects named parameters. However, the API typically expects the optional parameter to be a boolean. Using .get('optional') could return None, which may not be handled correctly by the Kubernetes client. Consider using .get('optional', False) to provide a default boolean value.
| secret_ref=client.V1SecretEnvSource( | ||
| env_from_data['secretRef']['name'] | ||
| name=secret_ref['name'], | ||
| optional=secret_ref.get('optional') | ||
| ) |
Copilot
AI
Oct 1, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to the configmap reference, the optional parameter should have a boolean default value. Using .get('optional') could return None, which may cause issues with the Kubernetes client. Consider using .get('optional', False) to ensure a proper boolean value is always passed.
|
@fdevans fixed according to the copilot suggestions |
No description provided.