Skip to content

Conversation

@GuyCarmy
Copy link
Contributor

No description provided.

@GuyCarmy
Copy link
Contributor Author

Hi @ltamaster, are you still maintaining this repo?
a very small PR to enable "optional" for envFrom for jobs, tested on my side, please review.
Thanks

@GuyCarmy
Copy link
Contributor Author

GuyCarmy commented Sep 3, 2025

Hi @fdevans, I see you were active in this repo last week, any chance you can take a look at this small PR?

@fdevans fdevans requested a review from Copilot October 1, 2025 23:05
Copy link
Contributor

Copilot AI left a 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 optional field 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.

Comment on lines 98 to 101
config_map_ref=client.V1ConfigMapEnvSource(
env_from_data['configMapRef']['name']
name=config_map_ref['name'],
optional=config_map_ref.get('optional')
)
Copy link

Copilot AI Oct 1, 2025

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.
Comment on lines 108 to 111
secret_ref=client.V1SecretEnvSource(
env_from_data['secretRef']['name']
name=secret_ref['name'],
optional=secret_ref.get('optional')
)
Copy link

Copilot AI Oct 1, 2025

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.
@GuyCarmy
Copy link
Contributor Author

@fdevans fixed according to the copilot suggestions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant