Skip to content

Commit

Permalink
Fix operator check of the catalog
Browse files Browse the repository at this point in the history
Fix apache#4715

* When there is a catalog build error, show in the operator log
* Only prints catalog information when it's available
  • Loading branch information
claudio4j committed Sep 13, 2023
1 parent c89127a commit 7a18583
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
16 changes: 4 additions & 12 deletions pkg/cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package cmd

import (
"context"
"errors"
"fmt"

v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
Expand Down Expand Up @@ -153,19 +152,12 @@ func operatorInfo(ctx context.Context, c client.Client, namespace string) (map[s
if err != nil {
return nil, err
}
if catalog == nil {
msg := fmt.Sprintf("CamelCatalog version: %s", platform.Status.Build.RuntimeVersion)
if platform.Status.Build.RuntimeProvider != "" {
msg += fmt.Sprintf(", provider: %s", platform.Status.Build.RuntimeProvider)
}
msg += fmt.Sprintf(" can't be found in %s namespace", platform.Namespace)
return nil, errors.New(msg)
if catalog != nil {
infos["Camel Quarkus version"] = catalog.CamelCatalogSpec.Runtime.Metadata["camel-quarkus.version"]
infos["Camel version"] = catalog.CamelCatalogSpec.Runtime.Metadata["camel.version"]
infos["Quarkus version"] = catalog.CamelCatalogSpec.Runtime.Metadata["quarkus.version"]
}

infos["Camel Quarkus version"] = catalog.CamelCatalogSpec.Runtime.Metadata["camel-quarkus.version"]
infos["Camel version"] = catalog.CamelCatalogSpec.Runtime.Metadata["camel.version"]
infos["Quarkus version"] = catalog.CamelCatalogSpec.Runtime.Metadata["quarkus.version"]

return infos, nil
}

Expand Down
3 changes: 3 additions & 0 deletions pkg/controller/catalog/initialize.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ func initializeSpectrum(options spectrum.Options, ip *v1.IntegrationPlatform, ca
options.Target = imageName

err := buildRuntimeBuilderWithTimeoutSpectrum(options, ip.Status.Build.GetBuildCatalogToolTimeout().Duration)
if err != nil {
Log.Error(err, "Error trying to build Camel K builder container")
}

if err != nil {
target.Status.Phase = v1.CamelCatalogPhaseError
Expand Down

0 comments on commit 7a18583

Please sign in to comment.