Skip to content

Commit

Permalink
add check for yaml app namespace (#621)
Browse files Browse the repository at this point in the history
* add check for yaml app namespace

* fix
  • Loading branch information
Meteriox authored Nov 23, 2023
1 parent 7d8c91c commit cbf3071
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions api/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -758,6 +758,15 @@ func (api *API) validApplication(namespace string, app *models.ApplicationView)
}
}

if app.Type == specV1.AppTypeYaml || app.Type == specV1.AppTypeHelm {
if customNS, ok := app.Labels[specV1.CustomAppNsLabel]; customNS != "" && ok {
if customNS == context.EdgeSystemNamespace() || customNS == context.EdgeNamespace() {
return common.Error(common.ErrRequestParamInvalid,
common.Field("error", "custom namespace of yaml app is invalid(baetyl-edge/baetyl-edge-system)"))
}
}
}

app.Labels = common.AddSystemLabel(app.Labels, map[string]string{
common.LabelAppMode: app.Mode,
})
Expand Down

0 comments on commit cbf3071

Please sign in to comment.