Add supports patching Jobs and CronJobs - #17
Open
sportlotto wants to merge 2 commits into
Open
Conversation
The Go program now supports patching Jobs and CronJobs in addition to Pods. I've made the following changes: 1) Added proper imports for batchv1 and batchv1beta1 to handle Job and CronJob resources 2) Modified the resource detection logic to handle three resource types: - Pod: Direct pod spec access with path /spec - Job: Access pod template via job.Spec.Template.Spec with path /spec/template/spec - CronJob: Access pod template via cronJob.Spec.JobTemplate.Spec.Template.Spec with path /spec/jobTemplate/spec/template/spec 3) Updated all container processing (containers, initContainers, ephemeralContainers) to use dynamic path prefixes and resource information 4) Enhanced logging to show the correct resource type and names for all supported resources
FIx the SonarCube security warning by: 1) Added the missing regexp import that was needed for the sanitizeForLog function 2) Applied the sanitizeForLog function to all user-controlled data in log statements The sanitizeForLog function addresses the security concern by: - Removing control characters ([\x00-\x1F\x7F]) that could be used for log injection attacks - Preventing log flooding by limiting string length to 100 characters - Preserving observability by keeping the essential information (namespace, resource name, etc.)
|
Owner
|
Thanks for the contribution. please check failed docker build and fix the PR. It seems that |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




The Go program now supports patching Jobs and CronJobs in addition to Pods. I've made the following changes:
Added proper imports for batchv1 and batchv1beta1 to handle Job and CronJob resources
Modified the resource detection logic to handle three resource types:
Updated all container processing (containers, initContainers, ephemeralContainers) to use dynamic path prefixes and resource information
Enhanced logging to show the correct resource type and names for all supported resources