forked from apache/camel-k
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix apache#1574: implement changes in source loading
- Loading branch information
1 parent
230a1e9
commit 56d06e0
Showing
18 changed files
with
284 additions
and
192 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
= Kamelets Trait | ||
|
||
// Start of autogenerated code - DO NOT EDIT! (description) | ||
The kamelets trait is a platform trait used to inject Kamelets into the integration runtime. | ||
|
||
|
||
This trait is available in the following profiles: **Kubernetes, Knative, OpenShift**. | ||
|
||
WARNING: The kamelets trait is a *platform trait*: disabling it may compromise the platform functionality. | ||
|
||
// End of autogenerated code - DO NOT EDIT! (description) | ||
// Start of autogenerated code - DO NOT EDIT! (configuration) | ||
== Configuration | ||
|
||
Trait properties can be specified when running any integration with the CLI: | ||
``` | ||
kamel run --trait kamelets.[key]=[value] --trait kamelets.[key2]=[value2] integration.groovy | ||
``` | ||
The following configuration options are available: | ||
|
||
[cols="2,1,5a"] | ||
|=== | ||
|Property | Type | Description | ||
|
||
| kamelets.enabled | ||
| bool | ||
| Can be used to enable or disable a trait. All traits share this common property. | ||
|
||
| kamelets.auto | ||
| bool | ||
| Automatically inject all referenced Kamelets and their default configuration (enabled by default) | ||
|
||
| kamelets.list | ||
| string | ||
| Comma separated list of Kamelet names to load into the current integration | ||
|
||
|=== | ||
|
||
// End of autogenerated code - DO NOT EDIT! (configuration) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package kamelet | ||
|
||
import ( | ||
"encoding/json" | ||
"fmt" | ||
"sort" | ||
|
||
"github.com/apache/camel-k/pkg/apis/camel/v1alpha1" | ||
"github.com/pkg/errors" | ||
) | ||
|
||
func updateStatus(kamelet *v1alpha1.Kamelet) (*v1alpha1.Kamelet, error) { | ||
target := kamelet.DeepCopy() | ||
target.Status.Phase = v1alpha1.KameletPhaseReady | ||
if err := recomputeProperties(target); err != nil { | ||
return nil, err | ||
} | ||
return target, nil | ||
} | ||
|
||
func recomputeProperties(kamelet *v1alpha1.Kamelet) error { | ||
kamelet.Status.Properties = make([]v1alpha1.KameletProperty, 0, len(kamelet.Spec.Definition.Properties)) | ||
propSet := make(map[string]bool) | ||
for k, v := range kamelet.Spec.Definition.Properties { | ||
if propSet[k] { | ||
continue | ||
} | ||
propSet[k] = true | ||
defValue := "" | ||
if v.Default != nil { | ||
var val interface{} | ||
if err := json.Unmarshal(*v.Default, &val); err != nil { | ||
return errors.Wrapf(err, "cannot decode default value for property %q", k) | ||
} | ||
defValue = fmt.Sprintf("%v", val) | ||
} | ||
kamelet.Status.Properties = append(kamelet.Status.Properties, v1alpha1.KameletProperty{ | ||
Name: k, | ||
Default: defValue, | ||
}) | ||
} | ||
sort.SliceStable(kamelet.Status.Properties, func(i, j int) bool { | ||
pi := kamelet.Status.Properties[i].Name | ||
pj := kamelet.Status.Properties[j].Name | ||
return pi < pj | ||
}) | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.