Skip to content

Commit

Permalink
[v0.3.10] Don't error if external-rules feature flag is not found whe…
Browse files Browse the repository at this point in the history
…n evaluating RoleTemplates (#399)

return false instead
  • Loading branch information
raulcabello committed Jun 13, 2024
1 parent 57ad77a commit 0339593
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/auth/roleTemplate.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
v3 "github.com/rancher/webhook/pkg/generated/controllers/management.cattle.io/v3"
v1 "github.com/rancher/wrangler/pkg/generated/controllers/rbac/v1"
rbacv1 "k8s.io/api/rbac/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
)

const ExternalRulesFeature = "external-rules"
Expand Down Expand Up @@ -109,6 +110,9 @@ func (r *RoleTemplateResolver) gatherRules(roleTemplate *rancherv3.RoleTemplate,
func (r *RoleTemplateResolver) isExternalRulesFeatureFlagEnabled() (bool, error) {
f, err := r.features.Get(ExternalRulesFeature)
if err != nil {
if apierrors.IsNotFound(err) {
return false, nil
}
return false, err
}
if f.Spec.Value == nil {
Expand Down

0 comments on commit 0339593

Please sign in to comment.