Skip to content

Commit

Permalink
simplify featuregate flag parsing for SSORoleMatch
Browse files Browse the repository at this point in the history
  • Loading branch information
richzli authored and sushanth0910 committed Jan 31, 2025
1 parent 673b441 commit b2db144
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions cmd/aws-iam-authenticator/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"errors"
"fmt"
"os"
"strings"

"sigs.k8s.io/aws-iam-authenticator/pkg/config"
"sigs.k8s.io/aws-iam-authenticator/pkg/mapper"
Expand Down Expand Up @@ -132,18 +131,14 @@ func getConfig() (config.Config, error) {
cfg.ReservedPrefixConfig[c.BackendMode] = c
}
}
if featureGateString := viper.GetString("feature-gates"); featureGateString != "" {
for _, fg := range strings.Split(featureGateString, ",") {
if strings.Contains(fg, string(config.SSORoleMatch)) &&
strings.Contains(fg, "true") {
logrus.Info("SSORoleMatch feature enabled")
config.SSORoleMatchEnabled = true
}
}
if featureGates.Enabled(config.SSORoleMatch) {
logrus.Info("SSORoleMatch feature enabled")
config.SSORoleMatchEnabled = true
}
if featureGates.Enabled(config.ConfiguredInitDirectories) {
logrus.Info("ConfiguredInitDirectories feature enabled")
}

if cfg.ClusterID == "" {
return cfg, errors.New("cluster ID cannot be empty")
}
Expand Down

0 comments on commit b2db144

Please sign in to comment.