Skip to content

Commit

Permalink
feat(api): Kit-less Integration
Browse files Browse the repository at this point in the history
Closes #2365
  • Loading branch information
squakez committed Aug 28, 2024
1 parent 6d9bdaa commit 6935636
Show file tree
Hide file tree
Showing 22 changed files with 550 additions and 195 deletions.
4 changes: 0 additions & 4 deletions addons/telemetry/telemetry.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,6 @@ func (t *telemetryTrait) setCatalogConfiguration(e *trait.Environment) {

// Deprecated: to be removed in future release in favor of func setCatalogConfiguration().
func (t *telemetryTrait) setRuntimeProviderProperties(e *trait.Environment) {
if e.CamelCatalog == nil {
return
}

provider := e.CamelCatalog.CamelCatalogSpec.Runtime.Provider
properties := telemetryProperties[provider]
if appPropEnabled := properties[propEnabled]; appPropEnabled != "" {
Expand Down
5 changes: 5 additions & 0 deletions pkg/apis/camel/v1/integration_types_support.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ func (in *Integration) UserDefinedSources() []SourceSpec {
return sources
}

// IsManagedBuild returns true when the Integration requires to be built by the operator.
func (in *Integration) IsManagedBuild() bool {
return in.Spec.Traits.Container == nil || in.Spec.Traits.Container.Image == ""
}

func (in *IntegrationSpec) AddSource(name string, content string, language Language) {
in.Sources = append(in.Sources, NewSourceSpec(name, content, language))
}
Expand Down
1 change: 1 addition & 0 deletions pkg/apis/camel/v1/integrationkit_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ const (
IntegrationKitTypeUser = "user"
// IntegrationKitTypeExternal identifies a Kit created by any third party.
IntegrationKitTypeExternal = "external"
// Deprecated: synthetic Integration Kits are replaced by non managed build Integrations.
// IntegrationKitTypeSynthetic identifies a synthetic Kit (generated for any container image for which the operator cannot make any assumption).
IntegrationKitTypeSynthetic = "synthetic"

Expand Down
1 change: 1 addition & 0 deletions pkg/apis/camel/v1/integrationkit_types_support.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ func (in *IntegrationKit) IsExternal() bool {
return in.Labels[IntegrationKitTypeLabel] == IntegrationKitTypeExternal
}

// Deprecated: synthetic Integration Kits are replaced by syntentic Integrations.
// IsSynthetic returns true for synthetic IntegrationKits.
func (in *IntegrationKit) IsSynthetic() bool {
return in.Labels[IntegrationKitTypeLabel] == IntegrationKitTypeSynthetic
Expand Down
7 changes: 4 additions & 3 deletions pkg/builder/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"strings"

"github.com/apache/camel-k/v2/pkg/util/io"
"github.com/apache/camel-k/v2/pkg/util/kubernetes"
"github.com/apache/camel-k/v2/pkg/util/log"

"k8s.io/apimachinery/pkg/labels"
Expand Down Expand Up @@ -193,9 +194,9 @@ func listPublishedImages(context *builderContext) ([]v1.IntegrationKitStatus, er
options := []ctrl.ListOption{
ctrl.InNamespace(context.Namespace),
ctrl.MatchingLabels{
v1.IntegrationKitTypeLabel: v1.IntegrationKitTypePlatform,
"camel.apache.org/runtime.version": context.Catalog.Runtime.Version,
"camel.apache.org/runtime.provider": string(context.Catalog.Runtime.Provider),
v1.IntegrationKitTypeLabel: v1.IntegrationKitTypePlatform,
kubernetes.CamelLabelRuntimeVersion: context.Catalog.Runtime.Version,
kubernetes.CamelLabelRuntimeProvider: string(context.Catalog.Runtime.Provider),
},
ctrl.MatchingLabelsSelector{
Selector: labels.NewSelector().Add(*excludeNativeImages),
Expand Down
13 changes: 7 additions & 6 deletions pkg/builder/image_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
"github.com/apache/camel-k/v2/pkg/util/camel"
"github.com/apache/camel-k/v2/pkg/util/cancellable"
"github.com/apache/camel-k/v2/pkg/util/kubernetes"
"github.com/apache/camel-k/v2/pkg/util/test"
)

Expand All @@ -45,9 +46,9 @@ func TestListPublishedImages(t *testing.T) {
Namespace: "ns",
Name: "my-kit-1",
Labels: map[string]string{
v1.IntegrationKitTypeLabel: v1.IntegrationKitTypePlatform,
"camel.apache.org/runtime.version": catalog.Runtime.Version,
"camel.apache.org/runtime.provider": string(catalog.Runtime.Provider),
v1.IntegrationKitTypeLabel: v1.IntegrationKitTypePlatform,
kubernetes.CamelLabelRuntimeVersion: catalog.Runtime.Version,
kubernetes.CamelLabelRuntimeProvider: string(catalog.Runtime.Provider),
},
},
Status: v1.IntegrationKitStatus{
Expand All @@ -66,9 +67,9 @@ func TestListPublishedImages(t *testing.T) {
Namespace: "ns",
Name: "my-kit-2",
Labels: map[string]string{
v1.IntegrationKitTypeLabel: v1.IntegrationKitTypePlatform,
"camel.apache.org/runtime.version": catalog.Runtime.Version,
"camel.apache.org/runtime.provider": string(catalog.Runtime.Provider),
v1.IntegrationKitTypeLabel: v1.IntegrationKitTypePlatform,
kubernetes.CamelLabelRuntimeVersion: catalog.Runtime.Version,
kubernetes.CamelLabelRuntimeProvider: string(catalog.Runtime.Provider),
},
},
Status: v1.IntegrationKitStatus{
Expand Down
Loading

0 comments on commit 6935636

Please sign in to comment.