Skip to content

Commit

Permalink
remove production
Browse files Browse the repository at this point in the history
Signed-off-by: panxunying <[email protected]>
  • Loading branch information
panxunying committed Sep 30, 2022
1 parent fbda62a commit 5c39dd6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/microservice/policy/core/service/bundle/opa_bundle.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,9 @@ func generateOPARoles(roles []*models.Role, policyMetas []*models.PolicyMeta) *o
verbAttrMap := make(map[string]sets.String)
resourceVerbs := make(map[string]sets.String)
for _, r := range ro.Rules {
if r.Resources[0] == "ProductionEnvironment" {
continue
}
for _, verb := range r.Verbs {
if verbs, ok := resourceVerbs[r.Resources[0]]; ok {
for _, v := range r.Verbs {
Expand Down Expand Up @@ -285,6 +288,9 @@ func generateOPARoles(roles []*models.Role, policyMetas []*models.PolicyMeta) *o
opaRole.Rules = append(opaRole.Rules, ruleList...)
}
for _, r := range ro.Rules {
if r.Resources[0] == "ProductionEnvironment" {
continue
}
if r.Kind != models.KindResource {
if len(r.Verbs) == 1 && r.Verbs[0] == models.MethodAll {
r.Verbs = AllMethods
Expand Down

0 comments on commit 5c39dd6

Please sign in to comment.