Skip to content

Commit

Permalink
feat(kamelets): bundling from jar
Browse files Browse the repository at this point in the history
This is required to simplify the release process and leverage to distributed catalog as dependency
  • Loading branch information
squakez committed Sep 12, 2024
1 parent 67fabf7 commit d529e00
Show file tree
Hide file tree
Showing 27 changed files with 935 additions and 902 deletions.
5 changes: 1 addition & 4 deletions build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,17 @@ ENV MAVEN_USER_HOME="${MAVEN_HOME}"
RUN ${MVNW_DIR}/mvnw --version | grep "Maven home:" | sed 's/Maven home: //' >> ${MVNW_DIR}default \
&& cp -r /usr/share/maven/lib/. $(cat ${MVNW_DIR}default)/lib \
&& rm $(cat ${MVNW_DIR}default)/lib/maven-slf4j-provider* \
&& rm $(cat ${MVNW_DIR}default)/lib/slf4j-api-1.*
&& rm $(cat ${MVNW_DIR}default)/lib/slf4j-api-1.*

ENV MAVEN_OPTS="${MAVEN_OPTS} -Dlogback.configurationFile=${MAVEN_HOME}/conf/logback.xml"

ADD build/_maven_output ${MVN_REPO}
# Fix https://github.com/moby/moby/issues/37965
RUN true
ADD build/_kamelets /kamelets

RUN chgrp -R 0 ${MVN_REPO} \
&& chown -R 1001:0 ${MVN_REPO} \
&& chmod -R 775 ${MVN_REPO} \
&& chgrp -R 0 /kamelets \
&& chmod -R g=u /kamelets \
&& chgrp -R 0 ${MAVEN_HOME} \
&& chown -R 1001:0 ${MAVEN_HOME} \
&& chmod -R 775 ${MAVEN_HOME}
Expand Down
7 changes: 4 additions & 3 deletions pkg/apis/camel/v1/integrationplatform_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,19 +192,20 @@ const (
// IntegrationPlatformPhaseError when the IntegrationPlatform had some error (see Conditions).
IntegrationPlatformPhaseError IntegrationPlatformPhase = "Error"
// IntegrationPlatformPhaseCreateCatalog when the IntegrationPlatform creates a new CamelCatalog.
// Deprecated no longer in use.
IntegrationPlatformPhaseCreateCatalog IntegrationPlatformPhase = "CreateCatalog"

// IntegrationPlatformConditionReady is the condition if the IntegrationPlatform is ready.
// Deprecated: use IntegrationPlatformConditionTypeCreated.
IntegrationPlatformConditionReady = "Ready"
// IntegrationPlatformConditionTypeCreated is the condition if the IntegrationPlatform has been created.
IntegrationPlatformConditionTypeCreated IntegrationPlatformConditionType = "Created"

// IntegrationPlatformConditionTypeRegistryAvailable is the condition for the availability of a container registry.
IntegrationPlatformConditionTypeRegistryAvailable IntegrationPlatformConditionType = "RegistryAvailable"

// IntegrationPlatformConditionCamelCatalogAvailable is the condition for the availability of a container registry.
// IntegrationPlatformConditionCamelCatalogAvailable is the condition for the availability of a the CamelCatalog.
IntegrationPlatformConditionCamelCatalogAvailable IntegrationPlatformConditionType = "CamelCatalogAvailable"
// IntegrationPlatformConditionKameletCatalogAvailable is the condition for the availability of a Kamelet catalog.
IntegrationPlatformConditionKameletCatalogAvailable IntegrationPlatformConditionType = "KameletCatalogAvailable"

// IntegrationPlatformConditionCreatedReason represents the reason that the IntegrationPlatform is created.
IntegrationPlatformConditionCreatedReason = "IntegrationPlatformCreated"
Expand Down
5 changes: 5 additions & 0 deletions pkg/apis/camel/v1/kamelet_types_support.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,11 @@ func (k *Kamelet) SortedTypesKeys() []TypeSlot {
return res
}

// IsBundled returns true if the Kamelet is coming from a pre-bundled installation.
func (k *Kamelet) IsBundled() bool {
return k.Labels != nil && k.Labels[KameletBundledLabel] == "true"
}

func ValidKameletName(name string) bool {
return !reservedKameletNames[name]
}
Expand Down
24 changes: 0 additions & 24 deletions pkg/cmd/reset.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ limitations under the License.
package cmd

import (
"errors"
"fmt"

v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
Expand Down Expand Up @@ -93,13 +92,6 @@ func (o *resetCmdOptions) reset(cmd *cobra.Command, _ []string) {
}
fmt.Fprintln(cmd.OutOrStdout(), n, "integration kits deleted from namespace", o.Namespace)
}

if err = o.resetIntegrationPlatform(c); err != nil {
fmt.Fprintln(cmd.ErrOrStderr(), err)
return
}

fmt.Fprintln(cmd.OutOrStdout(), "Camel K platform has been reset successfully!")
}

func (o *resetCmdOptions) deleteAllIntegrations(c client.Client) (int, error) {
Expand Down Expand Up @@ -163,22 +155,6 @@ func (o *resetCmdOptions) deleteAllKameletBindings(c client.Client) (int, error)
return len(list.Items), nil
}

func (o *resetCmdOptions) resetIntegrationPlatform(c client.Client) error {
list := v1.NewIntegrationPlatformList()
if err := c.List(o.Context, &list, k8sclient.InNamespace(o.Namespace)); err != nil {
return fmt.Errorf("could not retrieve integration platform from namespace %s: %w", o.Namespace, err)
}
if len(list.Items) > 1 {
return fmt.Errorf("expected 1 integration platform in the namespace, found: %d", len(list.Items))
} else if len(list.Items) == 0 {
return errors.New("no integration platforms found in the namespace")
}
platform := list.Items[0]
// Let's reset the status
platform.Status = v1.IntegrationPlatformStatus{}
return c.Status().Update(o.Context, &platform)
}

func isIntegrationOwned(it v1.Integration) bool {
for _, ref := range it.OwnerReferences {
gv, err := schema.ParseGroupVersion(ref.APIVersion)
Expand Down
1 change: 0 additions & 1 deletion pkg/controller/catalog/initialize.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ func (action *initializeAction) CanHandle(catalog *v1.CamelCatalog) bool {

func (action *initializeAction) Handle(ctx context.Context, catalog *v1.CamelCatalog) (*v1.CamelCatalog, error) {
action.L.Info("Initializing CamelCatalog")

platform, err := platformutil.GetForName(ctx, action.client, catalog.Namespace, defaults.OperatorID())

if err != nil {
Expand Down
84 changes: 0 additions & 84 deletions pkg/controller/integrationplatform/catalog.go

This file was deleted.

Loading

0 comments on commit d529e00

Please sign in to comment.