-
Notifications
You must be signed in to change notification settings - Fork 776
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
feat: add CleanupPolicy validation code to CleanupPolicyHandler #5338
Conversation
Codecov Report
@@ Coverage Diff @@
## main #5338 +/- ##
==========================================
- Coverage 36.03% 35.98% -0.05%
==========================================
Files 167 169 +2
Lines 18913 18938 +25
==========================================
Hits 6815 6815
- Misses 11309 11334 +25
Partials 789 789
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
14a73f0
to
8dc9350
Compare
cmd/cleanup-controller/main.go
Outdated
os.Exit(1) | ||
} | ||
|
||
openApiManager, err := openapi.NewManager() |
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.
Do we need the open api manager ?
8dc9350
to
064f800
Compare
This is a good start. Can you add a kuttl test, at least for simple cases ? |
@NikhilSharmaWe it looks like we are not supporting namespaced policy ? |
@eddycharly We are using |
@NikhilSharmaWe I mean in this code:
How is this going to work with |
064f800
to
1aeaa0a
Compare
cmd/cleanup-controller/handlers.go
Outdated
|
||
type cleanupPolicyHandlers struct { | ||
client dclient.Interface | ||
openApiManager openapi.Manager |
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.
Why add openAPIManager? Do we need extra schema validation for cleanup policies?
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.
Aren't we going to need it to validate the resource scope ?
// setup signals | ||
signalCtx, signalCancel := setupSignals() | ||
defer signalCancel() | ||
metricsConfig, metricsShutdown, err := setupMetrics(logger, kubeClient) |
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.
What metrics do we want to expose for cleanup policies?
@NikhilSharmaWe - can you be more specific about what validations are added via this PR? |
Signed-off-by: Nikhil Sharma <nikhilsharma230303@gmail.com>
1aeaa0a
to
ddae541
Compare
73bef2e
to
a722e40
Compare
Signed-off-by: Nikhil Sharma <nikhilsharma230303@gmail.com>
51c75cb
to
569431a
Compare
Signed-off-by: Nikhil Sharma nikhilsharma230303@gmail.com
Explanation
This PR add validation code for validating
CleanupPolicies
toCleanupPolicyHandler
.Validations added:
Schedule
specified by the user is in proper cron format or not.MatchResources
andExcludeResources
.