Skip to content

Commit

Permalink
Addressed review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
manirajv06 committed Sep 6, 2023
1 parent 7d020f6 commit 466d1ef
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/appmgmt/general/podevent_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,7 @@ func (p *PodEventHandler) addPod(pod *v1.Pod, eventSource EventSource) interface
Metadata: appMeta,
})
} else {
if app.GetApplicationID() != constants.AutoGenAppPrefix+"-"+pod.Namespace+"-"+constants.AutoGenAppSuffix &&
conf.GetSchedulerConf().GetSingleUserPerApplication() && app.GetUser() != appMeta.User {
if conf.GetSchedulerConf().GetSingleUserPerApplication() && app.GetUser() != appMeta.User && isAppIDUnique(app, pod) {
log.Log(log.ShimAppMgmtGeneral).Warn("rejecting application as it has been submitted by different user",
zap.String("app id ", appMeta.ApplicationID),
zap.String("app user", app.GetUser()),
Expand Down Expand Up @@ -189,6 +188,10 @@ func (p *PodEventHandler) deletePod(pod *v1.Pod) interfaces.ManagedApp {
return nil
}

func isAppIDUnique(app interfaces.ManagedApp, pod *v1.Pod) bool {
return app.GetApplicationID() != constants.AutoGenAppPrefix+"-"+pod.Namespace+"-"+constants.AutoGenAppSuffix
}

func NewPodEventHandler(amProtocol interfaces.ApplicationManagementProtocol, recoveryRunning bool) *PodEventHandler {
asyncEvents := make([]*podAsyncEvent, 0)
podEventHandler := &PodEventHandler{
Expand Down

0 comments on commit 466d1ef

Please sign in to comment.