-
Notifications
You must be signed in to change notification settings - Fork 3
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
Fix access policies not updating status when no job #532
Conversation
WalkthroughThe pull request introduces significant updates to the Changes
Possibly related PRs
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 1
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (5)
- internal/controllers/skipjob.go (2 hunks)
- tests/skipjob/access-policy-job/chainsaw-test.yaml (1 hunks)
- tests/skipjob/access-policy-job/skipjob-cron-assert.yaml (1 hunks)
- tests/skipjob/access-policy-job/status-ready-no-job-assert.yaml (1 hunks)
- tests/skipjob/access-policy-job/status-ready-no-job.yaml (1 hunks)
Additional comments not posted (4)
tests/skipjob/access-policy-job/status-ready-no-job.yaml (1)
1-19
: Configuration appears correct and well-structured.This new YAML file for
SKIPJob
namedstatus-ready-no-job
is well-structured and follows Kubernetes configuration standards. The access policy, image, cron, and job settings are clearly defined, which should work as expected in the Kubernetes environment.tests/skipjob/access-policy-job/chainsaw-test.yaml (1)
37-41
: New test block added correctly.The addition of the
try
block withapply
andassert
operations forstatus-ready-no-job.yaml
andstatus-ready-no-job-assert.yaml
respectively is correctly implemented. This enhances the test coverage by including checks for the status readiness without a job, which aligns with the PR objectives.tests/skipjob/access-policy-job/status-ready-no-job-assert.yaml (1)
1-45
: Assertion configuration appears correct and comprehensive.This new YAML file for asserting the status of
status-ready-no-job
SKIPJob is well-structured and comprehensive. It includes detailed conditions and subresources statuses, which should effectively validate the state of the SKIPJob as intended.tests/skipjob/access-policy-job/skipjob-cron-assert.yaml (1)
27-27
: Proper placement and usage of theaccessPolicies
field.The addition of
accessPolicies
under thestatus
section is correctly implemented. Ensure that the valueReady
is consistent with other status values used across your Kubernetes configurations.Run the following script to verify consistency of status values across Kubernetes configurations:
Verification successful
Consistent usage of the
accessPolicies: Ready
status value.The status value
Ready
foraccessPolicies
is consistently used across multiple YAML files in the codebase, indicating it is a standard and accepted status value. No inconsistencies were found with other status values.
- Files with
accessPolicies: Ready
include:
tests/skipjob/access-policy-job/skipjob-cron-assert.yaml
tests/skipjob/access-policy-job/application-assert.yaml
tests/application/access-policy/advanced-assert.yaml
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify consistency of status values across Kubernetes configurations. # Test: Search for status values in Kubernetes YAML files. Expect: Consistent usage of status values. rg --type yaml -A 5 $'status:'Length of output: 34295
if len(jobList.Items) == 0 { | ||
skipJob.Status.Conditions = []v1.Condition{ | ||
r.getConditionFailed(skipJob, v1.ConditionFalse, nil), | ||
r.getConditionRunning(skipJob, v1.ConditionFalse), | ||
r.getConditionFinished(skipJob, v1.ConditionFalse), | ||
} |
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.
Enhanced handling of empty job lists in updateConditions
.
The new logic to handle cases where the job list is empty is correctly implemented. This change ensures that the job's status is accurately reported even when no jobs are present.
Consider adding unit tests to cover this new logic to ensure it behaves as expected under various scenarios.
Would you like assistance in writing these unit tests? I can help draft some test cases or open a GitHub issue to track this task.
Summary by CodeRabbit
New Features
Bug Fixes
Tests