This repository has been archived by the owner on Dec 15, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 753
Minor refactor for cronjobtrigger. Add some tests #640
Merged
Conversation
This file contains 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
andresmgot
force-pushed
the
cronjobTrigger
branch
from
March 22, 2018 17:01
7ff397f
to
640d97f
Compare
c.logger.Errorf("Failed to delete cronjob %s created for the function %s in namespace %s, Error: %s", cronJobName, functionObj.ObjectMeta.Name, functionObj.ObjectMeta.Namespace, err) | ||
} | ||
c.logger.Infof("Function %s deleted. Removing associated cronjob trigger", functionObj.Name) | ||
err := c.kubelessclient.KubelessV1beta1().CronJobTriggers(functionObj.Namespace).Delete(functionObj.Name, &metav1.DeleteOptions{}) |
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.
This makes assumption that cronjob trigger name is same as function name. Can we loop through the cron job triggers in the namespace and find the one with associated function name set to the function getting deleted?
@@ -349,12 +320,12 @@ func cronJobTriggerObjChanged(oldObj, newObj *kubelessApi.CronJobTrigger) bool { | |||
} | |||
// If the new and old CronJob trigger object's resource version is same | |||
if oldObj.ResourceVersion != newObj.ResourceVersion { | |||
return true |
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 false. this should be true.
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.
sorry, debug I forgot to restore
murali-reddy
approved these changes
Mar 26, 2018
andresmgot
added a commit
to andresmgot/kubeless
that referenced
this pull request
Mar 26, 2018
* Minor refactor for cronjobtrigger. Add some tests * Fix tests * Add debug info * Allow trigger deletion with RBAC * Review
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Issue Ref: None
Description:
Minor refactor of the CronjobTrigger. It removes the
groupVersion
discovery that we were doing for supporting Kubernetes 1.7 and 1.9 which means that this PR will fail until the version 1.7 is deprecated.Now when deleting a function, if it has a cronjobtrigger associated it will be deleted instead of just deleting the cronjob object.
It also includes unit/integration tests for checking that the trigger is removed when the function is deleted and that it properly detect changes in the cronjobtrigger.
TODOs:
- [ ] Docs