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/09/18 08:49:59 UTC

[GitHub] oscerd closed pull request #88: Simplify install and update readme

oscerd closed pull request #88: Simplify install and update readme
URL: https://github.com/apache/camel-k/pull/88
 
 
   

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/README.md b/README.md
index d86638a..4bbdf09 100644
--- a/README.md
+++ b/README.md
@@ -4,8 +4,7 @@ Apache Camel K (a.k.a. Kamel) is a lightweight integration framework built from
 
 ## Getting Started
 
-You can run Camel K integrations on a Kubernetes or Openshift cluster, so you can choose to create a development cluster or use a cloud instance
-for Camel K.
+Camel K allows to run integrations on a Kubernetes or Openshift cluster. If you don't have a cloud instance of Kubernetes or Openshift, you can create a development cluster following the instructions below.
 
 ### Creating a Development Cluster
 There are various options for creating a development cluster:
@@ -34,8 +33,9 @@ Minikube and Kubernetes are not yet supported (but support is coming soon).
 ### Setting Up the Cluster
 
 To start using Camel K you need the **"kamel"** binary, that can be used to both configure the cluster and run integrations.
+Look into the [release page](https://github.com/apache/camel-k/releases) for latest version of the `kamel` tool.
 
-There's currently no release channel for the "kamel" binary, so you need to **build it from source!** Refer to the [contributing guide](#contributing)
+If you wanto to contribute, you can also **build it from source!** Refer to the [contributing guide](#contributing)
 for information on how to do it.
 
 Once you have the "kamel" binary, log into your cluster using the "oc" or "kubectl" tool and execute the following command to install Camel K:
@@ -178,8 +178,8 @@ make test-integration
 ### Running
 
 If you want to install everything you have in your source code and see it running on Kubernetes, you need to run the following command:
-- `make install-minishift`: to build the project and run it on Minishift, the default namespace for this is `myproject`
-- you can specify a different namespace with `make install-minishift project=myawesomeproject`
+- Run `make install-minishift` (or just `make install`): to build the project and install it in the current namespace on Minishift
+- You can specify a different namespace with `make install-minishift project=myawesomeproject`
 
 This command assumes you have an already running Minishift instance.
 
@@ -195,7 +195,6 @@ To add additional dependencies to your routes:
 ./kamel run -d camel:dns runtime/examples/dns.js
 ```
 
-
 ### Debugging and Running from IDE
 
 Sometimes it's useful to debug the code from the IDE when troubleshooting.
diff --git a/build/Makefile b/build/Makefile
index 172ccd5..3bc099c 100644
--- a/build/Makefile
+++ b/build/Makefile
@@ -52,6 +52,7 @@ images-build:
 images-push:
 	./build/images_push.sh
 
+install: install-minishift
 install-minishift:
 	./build/install_minishift.sh
 
diff --git a/build/install_minishift.sh b/build/install_minishift.sh
index 00c0104..52829e4 100755
--- a/build/install_minishift.sh
+++ b/build/install_minishift.sh
@@ -1,22 +1,30 @@
 #!/bin/sh
 
+# Exit on error
+set -e
+
 if [ "$project" = "" ]; then
-  project="myproject"
-fi
-echo $project
-if [ "$project" != "myproject" ]; then
-  oc new-project $project
-  oc project $project
+  project=$(oc project -q)
+else
+  oc new-project $project 2>/dev/null || true
 fi
-oc login -u system:admin 
+
+# Compile and build images
 make
 eval $(minishift docker-env)
 make images
-./kamel install --cluster-setup
-oc delete pod -l name=camel-k-operator
-oc login -u developer 
-if [ "$project" != "myproject" ]; then
-  oc project $project
+
+# Try setup with standard user
+ret=0
+./kamel install -n $project 2>/dev/null || export ret=$?
+
+if [ $ret -ne 0 ]; then
+  # Login as admin if cluster setup fails with standard user
+  olduser=$(oc whoami)
+  oc login -u system:admin
+  ./kamel install --cluster-setup
+  oc login -u $olduser
+  ./kamel install -n $project
 fi
-./kamel install
 
+oc delete pod -l name=camel-k-operator -n $project || true
diff --git a/cmd/kamel/kamel.go b/cmd/kamel/kamel.go
index ff56647..b1cba54 100644
--- a/cmd/kamel/kamel.go
+++ b/cmd/kamel/kamel.go
@@ -36,7 +36,7 @@ func main() {
 
 func exitOnError(err error) {
 	if err != nil {
-		fmt.Println(err)
+		fmt.Println("Error:", err)
 		os.Exit(1)
 	}
 }
diff --git a/deploy/operator-deployment.yaml b/deploy/operator-deployment.yaml
index a53fa27..c171ffb 100644
--- a/deploy/operator-deployment.yaml
+++ b/deploy/operator-deployment.yaml
@@ -6,6 +6,8 @@ metadata:
     app: "camel-k"
 spec:
   replicas: 1
+  strategy:
+    type: Recreate
   selector:
     matchLabels:
       name: camel-k-operator
diff --git a/deploy/resources.go b/deploy/resources.go
index 189d4ef..ed871fd 100644
--- a/deploy/resources.go
+++ b/deploy/resources.go
@@ -102,6 +102,8 @@ metadata:
     app: "camel-k"
 spec:
   replicas: 1
+  strategy:
+    type: Recreate
   selector:
     matchLabels:
       name: camel-k-operator
diff --git a/pkg/client/cmd/install.go b/pkg/client/cmd/install.go
index 15a4de0..d71c3c5 100644
--- a/pkg/client/cmd/install.go
+++ b/pkg/client/cmd/install.go
@@ -24,7 +24,8 @@ import (
 
 	"github.com/apache/camel-k/pkg/install"
 	"github.com/spf13/cobra"
-	"k8s.io/apimachinery/pkg/api/errors"
+	k8serrors "k8s.io/apimachinery/pkg/api/errors"
+	"github.com/pkg/errors"
 )
 
 // NewCmdInstall --
@@ -52,11 +53,9 @@ type installCmdOptions struct {
 
 func (o *installCmdOptions) install(cmd *cobra.Command, args []string) error {
 	err := install.SetupClusterwideResources()
-	if err != nil && errors.IsForbidden(err) {
-		// TODO explain that this is a one time operation and add a flag to do cluster-level operations only when logged as admin
+	if err != nil && k8serrors.IsForbidden(err) {
 		fmt.Println("Current user is not authorized to create cluster-wide objects like custom resource definitions or cluster roles: ", err)
-		fmt.Println("Please login as cluster-admin and execute \"kamel install --cluster-setup\" to install those resources (one-time operation).")
-		return nil // TODO better error handling: if here we return err the help page is shown
+		return errors.New("please login as cluster-admin and execute \"kamel install --cluster-setup\" to install cluster-wide resources (one-time operation)")
 	}
 
 	if o.clusterSetupOnly {


 

----------------------------------------------------------------
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