diff --git a/cmd/ocm/create/cluster/cmd.go b/cmd/ocm/create/cluster/cmd.go index 0ce0fbcb..1633b64e 100644 --- a/cmd/ocm/create/cluster/cmd.go +++ b/cmd/ocm/create/cluster/cmd.go @@ -750,6 +750,10 @@ func run(cmd *cobra.Command, argv []string) error { if err != nil { return err } + err = c.PrintClusterWarnings(connection, cluster) + if err != nil { + return err + } } return nil diff --git a/pkg/cluster/describe.go b/pkg/cluster/describe.go index 28a8b339..0d29f691 100644 --- a/pkg/cluster/describe.go +++ b/pkg/cluster/describe.go @@ -25,6 +25,7 @@ import ( sdk "github.com/openshift-online/ocm-sdk-go" amv1 "github.com/openshift-online/ocm-sdk-go/accountsmgmt/v1" cmv1 "github.com/openshift-online/ocm-sdk-go/clustersmgmt/v1" + slv1 "github.com/openshift-online/ocm-sdk-go/servicelogs/v1" ) const ( @@ -345,3 +346,17 @@ func findHyperShiftMgmtSvcClusters(conn *sdk.Connection, cluster *cmv1.Cluster) // Shouldn't normally happen as every management cluster should have a service cluster return mgmtClusterName, "" } + +func PrintClusterWarnings(connection *sdk.Connection, cluster *cmv1.Cluster) error { + serviceLogs, err := connection.ServiceLogs().V1().Clusters().ClusterLogs().List().ClusterID(cluster.ID()).Send() + if err != nil { + return err + } + serviceLogs.Items().Each(func(entry *slv1.LogEntry) bool { + if entry.Severity() == slv1.SeverityWarning { + fmt.Printf("⚠️ WARNING:\n%s\n%s\n", entry.Summary(), entry.Description()) + } + return true + }) + return nil +}