Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions contents/job-create.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,18 +92,22 @@ def create_job_object(data):
env_from = []
for env_from_data in env_froms_data:
if 'configMapRef' in env_from_data:
config_map_ref = env_from_data['configMapRef']
env_from.append(
client.V1EnvFromSource(
config_map_ref=client.V1ConfigMapEnvSource(
env_from_data['configMapRef']['name']
name=config_map_ref['name'],
optional=config_map_ref.get('optional', False)
)
Comment on lines 98 to 101

Copilot AI Oct 1, 2025

Copy link

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.

Copilot uses AI. Check for mistakes.
)
)
elif 'secretRef' in env_from_data:
secret_ref = env_from_data['secretRef']
env_from.append(
client.V1EnvFromSource(
secret_ref=client.V1SecretEnvSource(
env_from_data['secretRef']['name']
name=secret_ref['name'],
optional=secret_ref.get('optional', False)
)
Comment on lines 108 to 111

Copilot AI Oct 1, 2025

Copy link

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.

Copilot uses AI. Check for mistakes.
)
)
Expand Down
Loading