This repository has been archived by the owner on May 3, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
installation controller: reinstall deleted objects
One of the biggest complaints we get from users not being able to finish their rollouts is that their incumbents are unhealthy, and one of the biggest causes for that is when Deployments disappear[1] from the target clusters. This happens because the installation controller does not even try to replace objects after its first pass is completed, and CanOverride is set to false. Now, the installation controller will do a full run of the installer on every sync, reinstalling any objects that are gone, whatever their kind. Additionally, we'll start to listen to Service and Deployment events, so that we can sync the InstallationTarget whenever someone messes with these objects in the target clusters. We do this only for Deployments and Services because they're the only ones that can cause shipper to hang, as it depends on them in the capacity and traffic controller, respectively. [1] Users swear they haven't deleted them. We have yet to find another cause for this mistery.
- Loading branch information
1 parent
a0c4ebf
commit cdf9c1d
Showing
8 changed files
with
218 additions
and
71 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package controller | ||
|
||
import ( | ||
shipper "github.com/bookingcom/shipper/pkg/apis/shipper/v1alpha1" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/client-go/tools/cache" | ||
"k8s.io/klog" | ||
) | ||
|
||
func NewAppClusterEventHandler(callback func(obj interface{})) cache.ResourceEventHandler { | ||
return cache.FilteringResourceEventHandler{ | ||
FilterFunc: func(obj interface{}) bool { | ||
kubeobj, ok := obj.(metav1.Object) | ||
if !ok { | ||
klog.Warningf("Received something that's not a metav1/Object: %v", obj) | ||
return false | ||
} | ||
|
||
_, ok = kubeobj.GetLabels()[shipper.ReleaseLabel] | ||
|
||
return ok | ||
}, | ||
Handler: cache.ResourceEventHandlerFuncs{ | ||
AddFunc: func(obj interface{}) { | ||
callback(obj) | ||
}, | ||
UpdateFunc: func(old, new interface{}) { | ||
callback(new) | ||
}, | ||
DeleteFunc: func(obj interface{}) { | ||
callback(obj) | ||
}, | ||
}, | ||
} | ||
} |
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
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
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
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
Oops, something went wrong.