Repository navigation
feat(job): implement custom environment variables (--env flag) support - #5856
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enables greater flexibility for job submissions by allowing users to define custom environment variables via the --env flag. The changes include necessary updates to the CLI command, orchestration logic, and Kubernetes manifest templates, ensuring that environment variables are correctly propagated to the target containers while maintaining strict naming validation. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces support for passing custom environment variables to workload containers via a new --env flag in the gcluster job submit command. It includes POSIX-compliant validation for environment variable keys, updates the Kubernetes JobSet and Pathways templates to inject these variables, and adds comprehensive unit tests and documentation. The reviewer's feedback focuses on ensuring deterministic manifest generation by converting the environment variables map into a sorted slice of structs before rendering the templates, preventing randomized ordering in the generated Kubernetes manifests.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces support for custom environment variables in the 'gcluster job submit' command via a new '--env' flag. The changes include command-line flag parsing and validation, updates to GKE and Pathways JobSet templates to inject the environment variables, comprehensive unit tests, and updated documentation. The review feedback recommends minor performance optimizations to avoid unnecessary map and slice allocations by returning early when no environment variables are provided.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces support for passing custom environment variables to workload containers via a new --env flag in the gcluster job submit command. It includes input validation to ensure environment variable keys conform to POSIX naming standards, updates the GKE and Pathways JobSet templates to inject these variables, and adds comprehensive unit tests and documentation. I have no feedback to provide as there are no review comments to evaluate.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces support for passing custom environment variables to workload containers via a new --env flag in the gcluster job submit command, complete with POSIX-compliant validation, template updates for GKE and Pathways, unit tests, and documentation. The review feedback correctly points out that for Pathways jobs, these environment variables must also be propagated to the pathways-worker container in the worker replicatedJob to ensure critical JAX/XLA configurations are not ignored during TPU execution.
a9c6d59 to
807a5e3
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request adds support for passing custom environment variables to workload containers via a new --env flag in the gcluster job submit command, complete with validation, template updates for JobSet and Pathways, documentation, and unit tests. The review feedback suggests improving maintainability and testability by passing the environment variables as an argument to the validation function instead of relying on a package-level global variable, and optimizing slice allocations in the GKE orchestrator by pre-allocating slices with known capacities.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces support for passing custom environment variables to workload containers via a new --env flag in the gcluster job submit command. It includes robust validation of environment variable keys conforming to POSIX naming rules, updates to both standard GKE and Pathways JobSet templates to inject these variables, comprehensive unit tests covering validation and manifest generation, and updated documentation. The implementation is clean, well-tested, and well-documented, so I have no further feedback to provide.
|
/gemini review |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces support for passing custom environment variables to standard and Pathways workload containers using new CLI flags. The changes span CLI flag parsing, validation, unit tests, documentation, and template rendering. Feedback on the changes includes: updating validation logic to check the new pathways environment variable slices to prevent validation bypass, resetting the new global environment variable slices in tests to avoid test pollution, and refactoring redundant anonymous functions used for sorting and converting environment variables into a single helper function.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request adds support for passing custom environment variables to workload containers in GKE JobSets, including standard workloads and Pathways components (proxy, server, and worker). It introduces new CLI flags, validation logic for environment variable keys, template updates to inject these variables into Kubernetes manifests, and comprehensive unit tests. The feedback suggests defining a named EnvVar struct type instead of repeating anonymous struct definitions in gke_job_orchestrator.go and types.go to improve code readability, maintainability, and type safety.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces support for passing custom environment variables to both standard and Pathways workload containers via new CLI flags (--env, --pathways-proxy-env, --pathways-server-env, and --pathways-worker-env). It includes validation to ensure environment variable keys conform to POSIX naming rules, updates the GKE JobSet templates to inject these variables, and adds comprehensive unit tests and documentation. Feedback suggests refactoring the sequential validation calls of the environment flags into a single loop to improve maintainability and reduce repetition.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces support for passing custom environment variables to workload containers and Pathways components (proxy, server, and worker) via new CLI flags: --env, --pathways-proxy-env, --pathways-server-env, and --pathways-worker-env. It includes validation logic to ensure environment variable keys conform to POSIX naming rules, updates the GKE manifest templates to inject these variables, and adds comprehensive unit tests and documentation. The review feedback recommends adding documentation comments to the newly introduced exported EnvVar struct and its fields in pkg/orchestrator/gke/types.go to align with Go best practices and the repository style guide.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces support for passing custom environment variables to workload and Pathways containers (proxy, server, and worker) via new CLI flags (--env, --pathways-proxy-env, --pathways-server-env, and --pathways-worker-env). It includes validation to ensure keys conform to POSIX naming rules, updates the GKE and Pathways JobSet templates to inject these variables, adds comprehensive unit tests, and updates the documentation with examples. There are no review comments to address, and the implementation is clean and well-tested.
aba3034
into
GoogleCloudPlatform:develop
New --env Flags: Added a new --env flag to the 'gcluster job submit' command to allow users to pass custom environment variables to their workload containers. Also, introduced pathways specific new environment flags in cmd/job/submit.go:
Validation Logic: Implemented validation for environment variable keys to ensure they adhere to POSIX naming conventions (letters, numbers, and underscores, without starting with a digit).
Template Updates: Updated GKE and Pathways JobSet templates to inject the provided environment variables into the container specifications.
Testing and Documentation: Added comprehensive unit tests for flag parsing and validation, and updated the job guide documentation with usage examples.
Submission Checklist
NOTE: Community submissions can take up to 2 weeks to be reviewed.
Please take the following actions before submitting this pull request.