@@ -94,9 +94,6 @@ var Cmd = &cobra.Command{
9494 Example : ` # Edit a cluster named "mycluster" to make it private
9595 rosa edit cluster -c mycluster --private
9696
97- # Edit a cluster named "mycluster" to enable User Workload Monitoring
98- rosa edit cluster -c mycluster --disable-workload-monitoring=false
99-
10097 # Edit all options interactively
10198 rosa edit cluster -c mycluster --interactive` ,
10299 Run : run ,
@@ -144,9 +141,9 @@ func init() {
144141 & args .disableWorkloadMonitoring ,
145142 "disable-workload-monitoring" ,
146143 false ,
147- "[DEPRECATED FOR ROSA HCP] Enables you to monitor your own projects in isolation from Red Hat Site " +
148- "Reliability Engineer (SRE) " +
149- "platform metrics ." ,
144+ "Enables you to monitor your own projects in isolation from Red Hat Site " +
145+ "Reliability Engineer (SRE) platform metrics. " +
146+ "Not supported for Hosted Control Plane clusters ." ,
150147 )
151148 flags .StringVar (
152149 & args .httpProxy ,
@@ -273,7 +270,8 @@ func run(cmd *cobra.Command, _ []string) {
273270 cluster := r .FetchCluster ()
274271
275272 if aws .IsHostedCP (cluster ) && cmd .Flags ().Changed ("disable-workload-monitoring" ) {
276- r .Reporter .Warnf (arguments .UwmDeprecationMessage )
273+ r .Reporter .Errorf (arguments .UwmNotSupportedMessage )
274+ os .Exit (1 )
277275 }
278276
279277 // Validate flags:
@@ -388,6 +386,7 @@ func run(cmd *cobra.Command, _ []string) {
388386
389387 var disableWorkloadMonitoring * bool
390388 var disableWorkloadMonitoringValue bool
389+ isHostedCP := aws .IsHostedCP (cluster )
391390
392391 if cmd .Flags ().Changed ("disable-workload-monitoring" ) {
393392 disableWorkloadMonitoringValue = args .disableWorkloadMonitoring
@@ -396,22 +395,18 @@ func run(cmd *cobra.Command, _ []string) {
396395 disableWorkloadMonitoringValue = cluster .DisableUserWorkloadMonitoring ()
397396 }
398397
399- if interactive .Enabled () {
398+ if interactive .Enabled () && ! isHostedCP {
400399 disableWorkloadMonitoringValue , err = interactive .GetBool (interactive.Input {
401400 Question : "Disable Workload monitoring" ,
402401 Help : cmd .Flags ().Lookup ("disable-workload-monitoring" ).Usage ,
403402 Default : disableWorkloadMonitoringValue ,
404403 })
405404 if err != nil {
406- _ = r .Reporter .Errorf ("Expected a valid disable-workload-monitoring value: %v" , err )
407405 _ = r .Reporter .Errorf ("Expected a valid disable-workload-monitoring value: %v" , err )
408406 os .Exit (1 )
409407 }
410- if aws .IsHostedCP (cluster ) {
411- r .Reporter .Warnf (arguments .UwmDeprecationMessage )
412- }
413408 disableWorkloadMonitoring = & disableWorkloadMonitoringValue
414- } else if disableWorkloadMonitoringValue {
409+ } else if disableWorkloadMonitoringValue && ! isHostedCP {
415410 if ! confirm .Confirm ("disable workload monitoring for your cluster %s" , clusterKey ) {
416411 os .Exit (0 )
417412 }
@@ -562,10 +557,7 @@ func run(cmd *cobra.Command, _ []string) {
562557 }
563558
564559 /******* AdditionalTrustBundle *******/
565- updateAdditionalTrustBundle := false
566- if additionalTrustBundleFile != nil {
567- updateAdditionalTrustBundle = true
568- }
560+ updateAdditionalTrustBundle := additionalTrustBundleFile != nil
569561 if useExistingVPC && ! updateAdditionalTrustBundle && additionalTrustBundleFile == nil &&
570562 interactive .Enabled () {
571563 updateAdditionalTrustBundleValue , err := interactive .GetBool (interactive.Input {
@@ -620,10 +612,7 @@ func run(cmd *cobra.Command, _ []string) {
620612 }
621613
622614 /******* AdditionalAllowedPrincipals *******/
623- updateAdditionalAllowedPrincipals := false
624- if additionalAllowedPrincipals != nil {
625- updateAdditionalAllowedPrincipals = true
626- }
615+ updateAdditionalAllowedPrincipals := additionalAllowedPrincipals != nil
627616 if ! updateAdditionalAllowedPrincipals && additionalAllowedPrincipals == nil &&
628617 interactive .Enabled () {
629618 updateAdditionalAllowedPrincipalsValue , err := interactive .GetBool (interactive.Input {
@@ -702,9 +691,13 @@ func run(cmd *cobra.Command, _ []string) {
702691 }
703692
704693 clusterConfig := ocm.Spec {
705- Expiration : expiration ,
706- Private : private ,
707- DisableWorkloadMonitoring : disableWorkloadMonitoring ,
694+ Expiration : expiration ,
695+ Private : private ,
696+ }
697+
698+ // Only set DisableWorkloadMonitoring for non-HCP clusters
699+ if ! isHostedCP {
700+ clusterConfig .DisableWorkloadMonitoring = disableWorkloadMonitoring
708701 }
709702
710703 if httpProxy != nil {
@@ -1013,15 +1006,15 @@ func warnUserForOAuthHCPVisibility(r *rosa.Runtime, clusterKey string, cluster *
10131006func validateExpiration () (expiration time.Time , err error ) {
10141007 // Validate options
10151008 if len (args .expirationTime ) > 0 && args .expirationDuration != 0 {
1016- err = errors .New ("At most one of 'expiration-time' or 'expiration' may be specified" )
1009+ err = errors .New ("at most one of 'expiration-time' or 'expiration' may be specified" )
10171010 return
10181011 }
10191012
10201013 // Parse the expiration options
10211014 if len (args .expirationTime ) > 0 {
10221015 t , err := parseRFC3339 (args .expirationTime )
10231016 if err != nil {
1024- err = fmt .Errorf ("Failed to parse expiration-time: %s" , err )
1017+ err = fmt .Errorf ("failed to parse expiration-time: %s" , err )
10251018 return expiration , err
10261019 }
10271020
@@ -1039,7 +1032,7 @@ func validateExpiration() (expiration time.Time, err error) {
10391032func validateOvnInternalSubnetConfiguration () (ovnInternalSubnets map [string ]string , err error ) {
10401033 if len (args .ovnInternalSubnets ) > 0 {
10411034 if args .networkType == "" {
1042- err = fmt .Errorf ("Expected a value for %s when supplying the flag %s" , ocm .NetworkTypeFlagName ,
1035+ err = fmt .Errorf ("expected a value for %s when supplying the flag %s" , ocm .NetworkTypeFlagName ,
10431036 ocm .OvnInternalSubnetsFlagName )
10441037 return
10451038 }
@@ -1052,7 +1045,7 @@ func validateOvnInternalSubnetConfiguration() (ovnInternalSubnets map[string]str
10521045func validateNetworkType () (networkConfig string , err error ) {
10531046 if len (args .networkType ) > 0 {
10541047 if args .networkType != ocm .NetworkTypeOvn && args .networkType != ocm .NetworkTypeOvnAlias {
1055- err = fmt .Errorf ("Incorrect network type '%s', please use '%s' or remove the flag" ,
1048+ err = fmt .Errorf ("incorrect network type '%s', please use '%s' or remove the flag" ,
10561049 args .networkType , ocm .NetworkTypeOvn )
10571050 } else {
10581051 networkConfig = ocm .NetworkTypeOvn // allows use of alias (OVN-Kubernetes)- but sets it to correct value for API
@@ -1088,11 +1081,11 @@ func setAuditLogForwarding(r *rosa.Runtime, cmd *cobra.Command, cluster *cmv1.Cl
10881081 argValuePtr * string , err error ) {
10891082 if cmd .Flags ().Changed ("audit-log-arn" ) {
10901083 if ! aws .IsHostedCP (cluster ) {
1091- return nil , fmt .Errorf ("Audit log forwarding to AWS CloudWatch is only supported for Hosted Control Plane clusters" )
1084+ return nil , fmt .Errorf ("audit log forwarding to AWS CloudWatch is only supported for Hosted Control Plane clusters" )
10921085
10931086 }
10941087 if auditLogArn != "" && ! aws .RoleArnRE .MatchString (auditLogArn ) {
1095- return nil , fmt .Errorf ("Expected a valid value for audit-log-arn matching %s" , aws .RoleArnRE .String ())
1088+ return nil , fmt .Errorf ("expected a valid value for audit-log-arn matching %s" , aws .RoleArnRE .String ())
10961089 }
10971090 argValuePtr := new (string )
10981091 * argValuePtr = auditLogArn
@@ -1129,7 +1122,7 @@ func auditLogInteractivePrompt(r *rosa.Runtime, cmd *cobra.Command, cluster *cmv
11291122 Required : true ,
11301123 })
11311124 if err != nil {
1132- return nil , fmt .Errorf ("Expected a valid value: %s" , err )
1125+ return nil , fmt .Errorf ("expected a valid value: %s" , err )
11331126 }
11341127 if requestAuditLogForwarding {
11351128
@@ -1146,7 +1139,7 @@ func auditLogInteractivePrompt(r *rosa.Runtime, cmd *cobra.Command, cluster *cmv
11461139 },
11471140 })
11481141 if err != nil {
1149- return nil , fmt .Errorf ("Expected a valid value for audit-log-arn: %s" , err )
1142+ return nil , fmt .Errorf ("expected a valid value for audit-log-arn: %s" , err )
11501143 }
11511144 * auditLogRolePtr = auditLogRoleValue
11521145 return auditLogRolePtr , nil
@@ -1159,7 +1152,7 @@ func auditLogInteractivePrompt(r *rosa.Runtime, cmd *cobra.Command, cluster *cmv
11591152 Default : false ,
11601153 })
11611154 if err != nil {
1162- return nil , fmt .Errorf ("Expected a valid value: %s" , err )
1155+ return nil , fmt .Errorf ("expected a valid value: %s" , err )
11631156 }
11641157 if disableAuditLog {
11651158 * auditLogRolePtr = ""
@@ -1190,7 +1183,7 @@ func BuildClusterConfigWithRegistry(clusterConfig ocm.Spec, allowedRegistries []
11901183 ca , err := clusterregistryconfig .BuildAdditionalTrustedCAFromInputFile (additionalTrustedCa )
11911184 if err != nil {
11921185 return clusterConfig , fmt .Errorf (
1193- "Failed to build the additional trusted ca from file %s, got error: %s" ,
1186+ "failed to build the additional trusted ca from file %s, got error: %s" ,
11941187 additionalTrustedCa , err )
11951188 }
11961189 clusterConfig .AdditionalTrustedCa = ca
0 commit comments