You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by GitBox <gi...@apache.org> on 2018/12/07 10:01:04 UTC

[GitHub] nicolaferraro closed pull request #267: chore: rename constant KamelPlatform to IntegrationContextTypePlatform

nicolaferraro closed pull request #267: chore: rename constant KamelPlatform to IntegrationContextTypePlatform
URL: https://github.com/apache/camel-k/pull/267
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/pkg/apis/camel/v1alpha1/types.go b/pkg/apis/camel/v1alpha1/types.go
index f2b506fa..cc52ad6b 100644
--- a/pkg/apis/camel/v1alpha1/types.go
+++ b/pkg/apis/camel/v1alpha1/types.go
@@ -87,8 +87,6 @@ const (
 	LanguageXML Language = "xml"
 	// LanguageKotlin --
 	LanguageKotlin Language = "kts"
-	// KamelPlatform --
-	KamelPlatform = "platform"
 )
 
 // A IntegrationTraitSpec contains the configuration of a trait
@@ -185,6 +183,9 @@ const (
 	// IntegrationContextKind --
 	IntegrationContextKind string = "IntegrationContext"
 
+	// IntegrationContextTypePlatform --
+	IntegrationContextTypePlatform = "platform"
+
 	// IntegrationContextPhaseBuilding --
 	IntegrationContextPhaseBuilding IntegrationContextPhase = "Building"
 	// IntegrationContextPhaseReady --
diff --git a/pkg/builder/builder_steps.go b/pkg/builder/builder_steps.go
index 4a24e026..a32502e9 100644
--- a/pkg/builder/builder_steps.go
+++ b/pkg/builder/builder_steps.go
@@ -285,7 +285,7 @@ func ListPublishedImages(namespace string) ([]PublishedImage, error) {
 		if ctx.Status.Phase != v1alpha1.IntegrationContextPhaseReady || ctx.Labels == nil {
 			continue
 		}
-		if ctxType, present := ctx.Labels["camel.apache.org/context.type"]; !present || ctxType != v1alpha1.KamelPlatform {
+		if ctxType, present := ctx.Labels["camel.apache.org/context.type"]; !present || ctxType != v1alpha1.IntegrationContextTypePlatform {
 			continue
 		}
 
diff --git a/pkg/client/cmd/context_create.go b/pkg/client/cmd/context_create.go
index 497f4d6e..0bc8e97e 100644
--- a/pkg/client/cmd/context_create.go
+++ b/pkg/client/cmd/context_create.go
@@ -86,7 +86,7 @@ func (command *contextCreateCommand) run(cmd *cobra.Command, args []string) erro
 		// the integration context already exists, let's check that it is
 		// not a platform one which is supposed to be "read only"
 
-		if ctx.Labels["camel.apache.org/context.type"] == v1alpha1.KamelPlatform {
+		if ctx.Labels["camel.apache.org/context.type"] == v1alpha1.IntegrationContextTypePlatform {
 			fmt.Printf("integration context \"%s\" is not editable\n", ctx.Name)
 			return nil
 		}
diff --git a/pkg/client/cmd/context_delete.go b/pkg/client/cmd/context_delete.go
index d22b61e4..cf64eee9 100644
--- a/pkg/client/cmd/context_delete.go
+++ b/pkg/client/cmd/context_delete.go
@@ -82,7 +82,7 @@ func (command *contextDeleteCommand) run(args []string) error {
 		names = make([]string, 0, len(ctxList.Items))
 		for _, item := range ctxList.Items {
 			// only include non platform contexts
-			if item.Labels["camel.apache.org/context.type"] != v1alpha1.KamelPlatform {
+			if item.Labels["camel.apache.org/context.type"] != v1alpha1.IntegrationContextTypePlatform {
 				names = append(names, item.Name)
 			}
 		}
@@ -114,7 +114,7 @@ func (command *contextDeleteCommand) delete(name string) error {
 
 	// check that it is not a platform one which is supposed to be "read only"
 	// thus not managed by the end user
-	if ctx.Labels["camel.apache.org/context.type"] == v1alpha1.KamelPlatform {
+	if ctx.Labels["camel.apache.org/context.type"] == v1alpha1.IntegrationContextTypePlatform {
 		// skip platform contexts while deleting all contexts
 		if command.all {
 			return nil
diff --git a/pkg/client/cmd/context_get.go b/pkg/client/cmd/context_get.go
index af60a935..f264b916 100644
--- a/pkg/client/cmd/context_get.go
+++ b/pkg/client/cmd/context_get.go
@@ -49,7 +49,7 @@ func newContextGetCmd(rootCmdOptions *RootCmdOptions) *cobra.Command {
 	}
 
 	cmd.Flags().BoolVar(&impl.user, "user", true, "Includes user contexts")
-	cmd.Flags().BoolVar(&impl.platform, v1alpha1.KamelPlatform, true, "Includes platform contexts")
+	cmd.Flags().BoolVar(&impl.platform, v1alpha1.IntegrationContextTypePlatform, true, "Includes platform contexts")
 
 	return &cmd
 }
@@ -76,7 +76,7 @@ func (command *contextGetCommand) run() error {
 	for _, ctx := range ctxList.Items {
 		t := ctx.Labels["camel.apache.org/context.type"]
 		u := command.user && t == "user"
-		p := command.platform && t == v1alpha1.KamelPlatform
+		p := command.platform && t == v1alpha1.IntegrationContextTypePlatform
 
 		if u || p {
 			fmt.Fprintf(w, "%s\t%s\t%s\n", ctx.Name, t, string(ctx.Status.Phase))
diff --git a/pkg/stub/action/integration/build_context.go b/pkg/stub/action/integration/build_context.go
index 679945e2..ecadcc59 100644
--- a/pkg/stub/action/integration/build_context.go
+++ b/pkg/stub/action/integration/build_context.go
@@ -60,7 +60,7 @@ func (action *buildContextAction) Handle(integration *v1alpha1.Integration) erro
 	}
 
 	if ctx != nil {
-		if ctx.Labels["camel.apache.org/context.type"] == v1alpha1.KamelPlatform {
+		if ctx.Labels["camel.apache.org/context.type"] == v1alpha1.IntegrationContextTypePlatform {
 			// This is a platform context and as it is auto generated it may get
 			// out of sync if the integration that has generated it, has been
 			// amended to add/remove dependencies
@@ -129,7 +129,7 @@ func (action *buildContextAction) Handle(integration *v1alpha1.Integration) erro
 	// Add some information for post-processing, this may need to be refactored
 	// to a proper data structure
 	platformCtx.Labels = map[string]string{
-		"camel.apache.org/context.type":               v1alpha1.KamelPlatform,
+		"camel.apache.org/context.type":               v1alpha1.IntegrationContextTypePlatform,
 		"camel.apache.org/context.created.by.kind":    v1alpha1.IntegrationKind,
 		"camel.apache.org/context.created.by.name":    integration.Name,
 		"camel.apache.org/context.created.by.version": integration.ResourceVersion,
diff --git a/pkg/stub/action/integration/util.go b/pkg/stub/action/integration/util.go
index b48e6f1b..26c1fd8a 100644
--- a/pkg/stub/action/integration/util.go
+++ b/pkg/stub/action/integration/util.go
@@ -45,7 +45,7 @@ func LookupContextForIntegration(integration *v1alpha1.Integration) (*v1alpha1.I
 
 	for _, ctx := range ctxList.Items {
 		ctx := ctx // pin
-		if ctx.Labels["camel.apache.org/context.type"] == v1alpha1.KamelPlatform {
+		if ctx.Labels["camel.apache.org/context.type"] == v1alpha1.IntegrationContextTypePlatform {
 			ideps := len(integration.Spec.Dependencies)
 			cdeps := len(ctx.Spec.Dependencies)
 


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services