This is an automated email from the ASF dual-hosted git repository.

ywkim pushed a commit to branch cnb
in repository https://gitbox.apache.org/repos/asf/bigtop.git


The following commit(s) were added to refs/heads/cnb by this push:
     new ff4ae5b  BIGTOP-3256: Better initial setup via vagrant and kubectl 
plugin
ff4ae5b is described below

commit ff4ae5b0f2a3033503c6140b704bd0822c56ef12
Author: Youngwoo Kim <yw...@apache.org>
AuthorDate: Thu Oct 17 13:35:18 2019 +0900

    BIGTOP-3256: Better initial setup via vagrant and kubectl plugin
---
 README.md                                        | 13 ++---
 {kubernetes/kubectl => kubectl}/plugin/README.md |  0
 kubectl/plugin/kubectl-bigtop                    | 63 ++++++++++++++++++++++++
 kubernetes/kubectl/plugin/kubectl-bigtop         | 17 -------
 kubespray/vagrant/Vagrantfile                    |  5 +-
 5 files changed, 71 insertions(+), 27 deletions(-)

diff --git a/README.md b/README.md
index abc870f..53c288b 100755
--- a/README.md
+++ b/README.md
@@ -112,16 +112,11 @@ $ vagrant up
 ```
 $ vagrant ssh k8s-1
 
-k8s-1$ mkdir -p ~/.kube
-k8s-1$ sudo cp /etc/kubernetes/admin.conf .kube/config
-k8s-1$ sudo chown -R vagrant:vagrant .kube
-k8s-1$ kubectl cluster-info
-
-Kubernetes master is running at https://172.17.8.101:6443
-coredns is running at 
https://172.17.8.101:6443/api/v1/namespaces/kube-system/services/coredns:dns/proxy
-kubernetes-dashboard is running at 
https://172.17.8.101:6443/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy
+```
+```
+k8s-1$ kubectl plugin list
+k8s-1$ kubectl bigtop kubectl-config && kubectl bigtop helm-install
 
-To further debug and diagnose cluster problems, use 'kubectl cluster-info 
dump'.
 ```
 
 ## Storage
diff --git a/kubernetes/kubectl/plugin/README.md b/kubectl/plugin/README.md
similarity index 100%
rename from kubernetes/kubectl/plugin/README.md
rename to kubectl/plugin/README.md
diff --git a/kubectl/plugin/kubectl-bigtop b/kubectl/plugin/kubectl-bigtop
new file mode 100755
index 0000000..89abf3c
--- /dev/null
+++ b/kubectl/plugin/kubectl-bigtop
@@ -0,0 +1,63 @@
+#!/usr/bin/env bash
+
+set -ex
+
+echo "Kubectl plugin for Apache Bigtop"
+
+BIGTOP_HOME=${BIGTOP_HOME:-/bigtop}
+
+
+detect_java() {
+  # detect JAVA_HOME
+  source 
$BIGTOP_HOME/bigtop-packages/src/common/bigtop-utils/bigtop-detect-javahome
+
+  if [ -x "$JAVA_HOME/bin/java" ]; then
+      JAVA="$JAVA_HOME/bin/java"
+  else
+      JAVA=`which java`
+  fi
+
+  if [ -z "$JAVA" ]; then
+      echo "could not find java; set JAVA_HOME or ensure java is in PATH"
+      exit 1
+  fi
+}
+
+# version of Bigtop plugin
+if [[ "$1" == "version" ]]; then
+    # FIXME
+    echo "9.9.9"
+    exit 0
+fi
+
+# Configure kubectl
+if [[ "$1" == "kubectl-config" ]]; then
+    # FIXME
+    if [[ ! -f "$HOME/.kube/config" ]]; then
+        echo "configuring kubectl..."
+        sudo mkdir -p ~/.kube
+        sudo cp /etc/kubernetes/admin.conf ~/.kube/config
+        sudo chown -R $USER:$USER ~/.kube
+        kubectl config view
+    fi
+fi
+
+# Cluster info
+if [[ "$1" == "cluster-info" ]]; then
+    kubectl cluster-info
+    exit 0
+fi
+
+# Install Helm
+if [[ "$1" == "helm-install" ]]; then
+    curl -L https://git.io/get_helm.sh | bash
+    helm version -c
+    kubectl --namespace kube-system create serviceaccount tiller
+    kubectl create clusterrolebinding tiller-cluster-rule 
--clusterrole=cluster-admin --serviceaccount=kube-system:tiller
+    helm init --history-max 200
+    sleep 10s
+    kubectl --namespace kube-system patch deploy tiller-deploy -p 
'{"spec":{"template":{"spec":{"serviceAccount":"tiller"}}}}'
+    sleep 10s
+    helm version
+    exit 0
+fi
diff --git a/kubernetes/kubectl/plugin/kubectl-bigtop 
b/kubernetes/kubectl/plugin/kubectl-bigtop
deleted file mode 100755
index 6dd2040..0000000
--- a/kubernetes/kubectl/plugin/kubectl-bigtop
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/usr/bin/env bash
-
-echo "Kubectl plugin for Apache Bigtop"
-
-# version of Bigtop plugin
-if [[ "$1" == "version" ]]
-then
-    echo "2.0.0"
-    exit 0
-fi
-
-if [[ "$1" == "cluster-info" ]]
-then
-    kubectl cluster-info
-    exit 0
-fi
-
diff --git a/kubespray/vagrant/Vagrantfile b/kubespray/vagrant/Vagrantfile
index 9702059..99131d5 100644
--- a/kubespray/vagrant/Vagrantfile
+++ b/kubespray/vagrant/Vagrantfile
@@ -178,6 +178,9 @@ Vagrant.configure("2") do |config|
       # Disable swap for each vm
       node.vm.provision "shell", inline: "swapoff -a"
 
+      node.vm.provision "shell", inline: "yum install -y lvm2"
+      node.vm.provision "shell", inline: "sudo cp 
/bigtop/kubectl/plugin/kubectl-bigtop /usr/local/bin/ ; sudo chmod +x 
/usr/local/bin/kubectl-bigtop" 
+
       host_vars[vm_name] = {
         "ip": ip,
         "flannel_interface": "eth1",
@@ -219,7 +222,7 @@ Vagrant.configure("2") do |config|
             "kube-node" => 
["#{$instance_name_prefix}-[1:#{$kube_node_instances}]"],
             "k8s-cluster:children" => ["kube-master", "kube-node"],
           }
-        end
+          end
       end
 
     end

Reply via email to