diff --git a/VERSION b/VERSION index 34686ab157255..5c4d1382db87b 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.1.14-cap-CR-11708-send-app-deletion +2.1.15-cap-CR-process-non-root-app diff --git a/server/application/application.go b/server/application/application.go index 47e60b9cc565d..d2e05a2e94e90 100644 --- a/server/application/application.go +++ b/server/application/application.go @@ -5,6 +5,7 @@ import ( "errors" "fmt" "math" + "os" "reflect" "sort" "strconv" @@ -828,6 +829,15 @@ func (s *Server) Watch(q *application.ApplicationQuery, ws application.Applicati } } +func shouldProcessNonRootApp() bool { + value := os.Getenv("PROCESS_NON_ROOT_APP") + result, err := strconv.ParseBool(value) + if err != nil { + return false + } + return result +} + func (s *Server) StartEventSource(es *events.EventSource, stream events.Eventing_StartEventSourceServer) error { var ( logCtx log.FieldLogger = log.StandardLogger() @@ -875,7 +885,7 @@ func (s *Server) StartEventSource(es *events.EventSource, stream events.Eventing return } - err := s.streamApplicationEvents(stream.Context(), &a, es, stream, ts) + err := s.streamApplicationEvents(stream.Context(), &a, es, stream, ts, shouldProcessNonRootApp()) if err != nil { logCtx.WithError(err).Error("failed to stream application events") return @@ -972,6 +982,7 @@ func (s *Server) streamApplicationEvents( es *events.EventSource, stream events.Eventing_StartEventSourceServer, ts string, + processRootApp bool, ) error { var ( logCtx = log.WithField("application", a.Name) @@ -985,7 +996,7 @@ func (s *Server) streamApplicationEvents( isChildApp = a.Labels["app.kubernetes.io/instance"] != "" } - if !isChildApp { + if !isChildApp || processRootApp { // application events for child apps would be sent by its parent app // as resource event appEvent, err := s.getApplicationEventPayload(ctx, a, es, ts)