File tree Expand file tree Collapse file tree 2 files changed +24
-7
lines changed
Expand file tree Collapse file tree 2 files changed +24
-7
lines changed Original file line number Diff line number Diff line change @@ -55,10 +55,12 @@ func getPluginPodSpec() corev1.PodSpec {
5555 podSpec := corev1.PodSpec {
5656 Containers : []corev1.Container {
5757 {
58- Env : util .ProxyEnvVars (),
59- Name : gitopsPluginName ,
60- Image : consolePluginImage ,
61- ImagePullPolicy : corev1 .PullAlways ,
58+ Env : util .ProxyEnvVars (),
59+ Name : gitopsPluginName ,
60+ Image : consolePluginImage ,
61+ ImagePullPolicy : corev1 .PullAlways ,
62+ TerminationMessagePath : corev1 .TerminationMessagePathDefault ,
63+ TerminationMessagePolicy : corev1 .TerminationMessageReadFile ,
6264 Ports : []corev1.ContainerPort {
6365 {
6466 Name : "http" ,
Original file line number Diff line number Diff line change @@ -114,9 +114,24 @@ func (r *ReconcileGitopsService) SetupWithManager(mgr ctrl.Manager) error {
114114 })),
115115 ).Watches (& argoapp.ArgoCD {},
116116 & handler.EnqueueRequestForObject {},
117- builder .WithPredicates (predicate .NewPredicateFuncs (func (obj client.Object ) bool {
118- return obj .GetName () == "openshift-gitops" && obj .GetNamespace () == "openshift-gitops"
119- }))).
117+ builder .WithPredicates (predicate.Funcs {
118+ CreateFunc : func (e event.CreateEvent ) bool {
119+ // Only watch openshift-gitops ArgoCD
120+ return e .Object .GetName () == "openshift-gitops" && e .Object .GetNamespace () == "openshift-gitops"
121+ },
122+ UpdateFunc : func (e event.UpdateEvent ) bool {
123+ // Only watch openshift-gitops ArgoCD
124+ if e .ObjectNew .GetName () != "openshift-gitops" || e .ObjectNew .GetNamespace () != "openshift-gitops" {
125+ return false
126+ }
127+ // Ignore updates to CR status in which case metadata.Generation does not change
128+ return e .ObjectOld .GetGeneration () != e .ObjectNew .GetGeneration ()
129+ },
130+ DeleteFunc : func (e event.DeleteEvent ) bool {
131+ // Only watch openshift-gitops ArgoCD
132+ return e .Object .GetName () == "openshift-gitops" && e .Object .GetNamespace () == "openshift-gitops"
133+ },
134+ })).
120135 Complete (r )
121136}
122137
You can’t perform that action at this time.
0 commit comments