Skip to content

Commit

Permalink
OCM-6569 | fix: Hide the duplicate output of operator roles
Browse files Browse the repository at this point in the history
Signed-off-by: Maggie Chen <[email protected]>

fix lint

Signed-off-by: Maggie Chen <[email protected]>
  • Loading branch information
chenz4027 committed May 17, 2024
1 parent 193245a commit fb1e4cf
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion cmd/create/cluster/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -1790,7 +1790,7 @@ func run(cmd *cobra.Command, _ []string) {
os.Exit(1)
} else {
err = ocm.ValidateOperatorRolesMatchOidcProvider(r.Reporter, awsClient, computedOperatorIamRoleList,
oidcConfig.IssuerUrl(), ocm.GetVersionMinor(version), expectedOperatorRolePath, managedPolicies)
oidcConfig.IssuerUrl(), ocm.GetVersionMinor(version), expectedOperatorRolePath, managedPolicies, true)
if err != nil {
r.Reporter.Errorf("%v", err)
os.Exit(1)
Expand Down
2 changes: 1 addition & 1 deletion cmd/create/operatorroles/by_clusterkey.go
Original file line number Diff line number Diff line change
Expand Up @@ -434,5 +434,5 @@ func validateOperatorRolesMatchOidcProvider(r *rosa.Runtime, cluster *cmv1.Clust
}
return ocm.ValidateOperatorRolesMatchOidcProvider(r.Reporter, r.AWSClient,
operatorRolesList, cluster.AWS().STS().OidcConfig().IssuerUrl(),
ocm.GetVersionMinor(cluster.Version().RawID()), expectedPath, cluster.AWS().STS().ManagedPolicies())
ocm.GetVersionMinor(cluster.Version().RawID()), expectedPath, cluster.AWS().STS().ManagedPolicies(), false)
}
2 changes: 1 addition & 1 deletion cmd/create/operatorroles/by_prefix.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ func handleOperatorRoleCreationByPrefix(r *rosa.Runtime, env string,
os.Exit(1)
}
err = ocm.ValidateOperatorRolesMatchOidcProvider(r.Reporter, r.AWSClient,
operatorRolesList, oidcConfig.IssuerUrl(), "4.0", path, managedPolicies)
operatorRolesList, oidcConfig.IssuerUrl(), "4.0", path, managedPolicies, true)
if err != nil && !awserr.IsNoSuchEntityException(err) {
r.Reporter.Errorf("%v", err)
os.Exit(1)
Expand Down
5 changes: 3 additions & 2 deletions pkg/ocm/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -854,13 +854,14 @@ func (c *Client) GetVersionsList(channelGroup string, defaultFirst bool) ([]stri

func ValidateOperatorRolesMatchOidcProvider(reporter *reporter.Object, awsClient aws.Client,
operatorIAMRoleList []OperatorIAMRole, oidcEndpointUrl string,
clusterVersion string, expectedOperatorRolePath string, accountRolesHasManagedPolicies bool) error {
clusterVersion string, expectedOperatorRolePath string,
accountRolesHasManagedPolicies bool, logOperatorRoles bool) error {
operatorIAMRoles := operatorIAMRoleList
parsedUrl, err := url.Parse(oidcEndpointUrl)
if err != nil {
return err
}
printInfo := reporter.IsTerminal() && !output.HasFlag()
printInfo := reporter.IsTerminal() && !output.HasFlag() && logOperatorRoles
if printInfo {
reporter.Infof("Reusable OIDC Configuration detected. Validating trusted relationships to operator roles: ")
}
Expand Down

0 comments on commit fb1e4cf

Please sign in to comment.