Skip to content
This repository has been archived by the owner on Oct 24, 2018. It is now read-only.

Conversation

hieptranquoc
Copy link
Contributor

please help me check this PR! pls

@ghost ghost assigned hieptranquoc Feb 23, 2018
@ghost ghost added the stag:under-review label Feb 23, 2018
@hieptranquoc hieptranquoc force-pushed the feature/#31-add-k8s-resource-to-manage-a-k8s-instance branch 5 times, most recently from cf3f29c to 8203203 Compare February 23, 2018 16:23
@hoatle
Copy link
Member

hoatle commented Feb 27, 2018

@hieptranquoc please make sure we get all the tests passed on travis-ci.

@hoatle hoatle self-requested a review February 27, 2018 02:29
README.md Outdated
@@ -40,6 +41,12 @@ helm 'install helm' do
version '' #application version (if empty, default: latest)
binary_path '' #application path (if empty, default: /usr/local/bin/helm)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we need to update this

README.md Outdated
@@ -164,7 +172,7 @@ end
### Properties
- `action` - `:install` to install `kubectl`, `:remove` to uninstall `kubectl`.
- `version` - The desired version of `kubectl`.
- `binary_path` - Application path (if empty, default:/usr/local/bin/kubectl)
- `binary_path` - Application path (if empty, default:/usr/local/bin)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

default:/usr... => default: /usr... (we need a white space after the semicolon character)

end

bash 'create kubectl config dir' do
user 'vagrant'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is hard-coded, make sure it's configurable

@hoatle
Copy link
Member

hoatle commented Feb 27, 2018

@hieptranquoc This is minikube install, let's call the resource: "minikube" instead of "kubernetes" because we can have more k8s deployment resource in the future. minikube is one type of k8s deployment which is intented for local dev only, this is basically good to me, just to adjust and update more basing on my comments and we should be good to go to release this for minikube resource. This should be very handful for our local dev testing.

@hoatle
Copy link
Member

hoatle commented Feb 27, 2018

@phuonglm @datphan should look into this for your reference, this is the installer of k8s with minikube https://github.com/kubernetes/minikube

@hoatle
Copy link
Member

hoatle commented Mar 21, 2018

==> default:     * bash[set env var] action run
==> default: 
==> default:       [execute] sed: -e expression #1, char 35: unknown option to `s'
==> default:                 sed: -e expression #1, char 29: unknown option to `s'

something wrong with this

@hoatle
Copy link
Member

hoatle commented Mar 21, 2018

==> default:     * execute[start minikube] action run
==> default: [2018-03-21T13:15:05+00:00] INFO: execute[Guard resource] ran successfully
==> default: 
==> default:       [execute] Starting local Kubernetes v1.9.0 cluster...
==> default:                 Starting VM...
==> default:                 Getting VM IP address...
==> default:                 Moving files into cluster...
==> default:                 
==> default: Setting up certs...
==> default:                 
==> default: Connecting to cluster...
==> default:                 
==> default: Setting up kubeconfig...
==> default:                 Starting cluster components...

this step is super slow, not sure why so super slow?

@hoatle
Copy link
Member

hoatle commented Mar 21, 2018

and then I got the following errors several times:

==> default: Setting up kubeconfig...
==> default:                 Starting cluster components...
==> default:                 E0321 13:45:41.178047    4792 start.go:276] Error starting cluster:  kubeadm init error running command: sudo /usr/bin/kubeadm init --config /var/lib/kubeadm.yaml --skip-preflight-checks: running command: sudo /usr/bin/kubeadm init --config /var/lib/kubeadm.yaml --skip-preflight-checks: exit status 1
==> default:       
==> default:       ================================================================================
==> default:       Error executing action `run` on resource 'execute[start minikube]'
==> default:       ================================================================================
==> default:       
==> default: 
==> default:       
==> default: Mixlib::ShellOut::ShellCommandFailed
==> default:       
==> default: ------------------------------------
==> default:       
==> default: Expected process to exit with [0], but received '1'
==> default:       ---- Begin output of sudo -E minikube start --vm-driver=none --network-plugin=cni --bootstrapper=kubeadm --kubernetes-version v1.9.0 ----
==> default:       STDOUT: Starting local Kubernetes v1.9.0 cluster...
==> default:       Starting VM...
==> default:       Getting VM IP address...
==> default:       Moving files into cluster...
==> default:       Setting up certs...
==> default:       Connecting to cluster...
==> default:       Setting up kubeconfig...
==> default:       Starting cluster components...
==> default:       STDERR: E0321 13:45:41.178047    4792 start.go:276] Error starting cluster:  kubeadm init error running command: sudo /usr/bin/kubeadm init --config /var/lib/kubeadm.yaml --skip-preflight-checks: running command: sudo /usr/bin/kubeadm init --config /var/lib/kubeadm.yaml --skip-preflight-checks: exit status 1
==> default:       ---- End output of sudo -E minikube start --vm-driver=none --network-plugin=cni --bootstrapper=kubeadm --kubernetes-version v1.9.0 ----
==> default:       Ran sudo -E minikube start --vm-driver=none --network-plugin=cni --bootstrapper=kubeadm --kubernetes-version v1.9.0 returned 1
==> default:       
==> default: 
==> default:       Resource Declaration:
==> default:       ---------------------
==> default:       # In /var/chef/cache/cookbooks/kubernetes-stack/resources/kubernetes.rb
==> default:       
==> default:        85:       execute 'start minikube' do
==> default:        86:         user 'vagrant'
==> default:        87:         environment(
==> default:        88:           'HOME' => '/home/vagrant',
==> default:        89:           'USER' => 'vagrant'
==> default:        90:         )
==> default: 
==> default:        91:         command "sudo -E minikube start --vm-driver=none --network-plugin=cni --bootstrapper=kubeadm --kubernetes-version #{k8s_version}"
==> default:        92:         only_if 'which minikube'
==> default:        93:       end
==> default:        94:     end
==> default:       
==> default:       Compiled Resource:
==> default:       ------------------
==> default:       # Declared in /var/chef/cache/cookbooks/kubernetes-stack/resources/kubernetes.rb:85:in `block in class_from_file'
==> default:       
==> default: 
==> default:       execute("start minikube") do
==> default:         action [:run]
==> default:         default_guard_interpreter :execute
==> default:         command "sudo -E minikube start --vm-driver=none --network-plugin=cni --bootstrapper=kubeadm --kubernetes-version v1.9.0"
==> default:       
==> default:   backup 5
==> default:         environment {"HOME"=>"/home/vagrant", "USER"=>"vagrant"}
==> default:         returns 0
==> default:         user "vagrant"
==> default:         declared_type :execute
==> default:         cookbook_name "iorad"
==> default:         domain nil
==> default:         only_if "which minikube"
==> default:       
==> default: end
==> default:       
==> default: 
==> default:       System Info:
==> default:       ------------
==> default:       
==> default: chef_version=13.1.31
==> default:       platform=ubuntu
==> default: 
==> default:       platform_version=16.04
==> default:       ruby=ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
==> default:       program_name=chef-solo worker: ppid=4299;start=13:14:17;
==> default:       executable=/opt/chef/bin/chef-solo
==> default:       
==> default: 
==> default: [2018-03-21T13:45:41+00:00] INFO: Running queued delayed notifications before re-raising exception
==> default:     
==> default:     ================================================================================
==> default:     Error executing action `install` on resource 'kubernetes[install kubernetes v1.9.0]'
==> default:     ================================================================================
==> default:     
==> default:     Mixlib::ShellOut::ShellCommandFailed
==> default:     ------------------------------------
==> default:     execute[start minikube] (/var/chef/cache/cookbooks/kubernetes-stack/resources/kubernetes.rb line 85) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
==> default:     ---- Begin output of sudo -E minikube start --vm-driver=none --network-plugin=cni --bootstrapper=kubeadm --kubernetes-version v1.9.0 ----
==> default:     STDOUT: Starting local Kubernetes v1.9.0 cluster...
==> default:     Starting VM...
==> default:     Getting VM IP address...
==> default:     Moving files into cluster...
==> default:     Setting up certs...
==> default:     Connecting to cluster...
==> default:     Setting up kubeconfig...
==> default:     Starting cluster components...
==> default:     STDERR: E0321 13:45:41.178047    4792 start.go:276] Error starting cluster:  kubeadm init error running command: sudo /usr/bin/kubeadm init --config /var/lib/kubeadm.yaml --skip-preflight-checks: running command: sudo /usr/bin/kubeadm init --config /var/lib/kubeadm.yaml --skip-preflight-checks: exit status 1
==> default:     ---- End output of sudo -E minikube start --vm-driver=none --network-plugin=cni --bootstrapper=kubeadm --kubernetes-version v1.9.0 ----
==> default:     Ran sudo -E minikube start --vm-driver=none --network-plugin=cni --bootstrapper=kubeadm --kubernetes-version v1.9.0 returned 1
==> default:     
==> default:     Resource Declaration:
==> default:     ---------------------
==> default:     
==> default: # In /var/chef/cache/cookbooks/iorad/recipes/k8s.rb
==> default:     
==> default:      47:     kubernetes "#{act} kubernetes #{kubernetes_opt['version']}" do
==> default:      48:       version kubernetes_opt['version']
==> default:     
==> default:  49:       action act
==> default:      50:     end
==> default:      51: 
==> default:     
==> default:     Compiled Resource:
==> default:     ------------------
==> default:     # Declared in /var/chef/cache/cookbooks/iorad/recipes/k8s.rb:47:in `from_file'
==> default:     
==> default:     kubernetes("install kubernetes v1.9.0") do
==> default:       action [:install]
==> default:       updated true
==> default:       updated_by_last_action true
==> default:     
==> default:   default_guard_interpreter :default
==> default:       declared_type :kubernetes
==> default:       cookbook_name "iorad"
==> default:       recipe_name "k8s"
==> default:       version "v1.9.0"
==> default:     end
==> default:     
==> default: 
==> default:     System Info:
==> default:     ------------
==> default:     chef_version=13.1.31
==> default:     platform=ubuntu
==> default:     platform_version=16.04
==> default:     ruby=ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
==> default:     program_name=chef-solo worker: ppid=4299;start=13:14:17;
==> default:     executable=/opt/chef/bin/chef-solo
==> default:     
==> default: 
==> default: [2018-03-21T13:45:41+00:00] INFO: Running queued delayed notifications before re-raising exception
==> default: 
==> default: Running handlers:
==> default: [2018-03-21T13:45:41+00:00] ERROR: Running exception handlers
==> default: Running handlers complete
==> default: [2018-03-21T13:45:41+00:00] ERROR: Exception handlers complete
==> default: Chef Client failed. 6 resources updated in 31 minutes 23 seconds
==> default: [2018-03-21T13:45:41+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
==> default: [2018-03-21T13:45:41+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
==> default: [2018-03-21T13:45:41+00:00] ERROR: kubernetes[install kubernetes v1.9.0] (iorad::k8s line 47) had an error: Mixlib::ShellOut::ShellCommandFailed: execute[start minikube] (/var/chef/cache/cookbooks/kubernetes-stack/resources/kubernetes.rb line 85) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
==> default: ---- Begin output of sudo -E minikube start --vm-driver=none --network-plugin=cni --bootstrapper=kubeadm --kubernetes-version v1.9.0 ----
==> default: STDOUT: Starting local Kubernetes v1.9.0 cluster...
==> default: Starting VM...
==> default: Getting VM IP address...
==> default: Moving files into cluster...
==> default: Setting up certs...
==> default: Connecting to cluster...
==> default: Setting up kubeconfig...
==> default: Starting cluster components...
==> default: STDERR: E0321 13:45:41.178047    4792 start.go:276] Error starting cluster:  kubeadm init error running command: sudo /usr/bin/kubeadm init --config /var/lib/kubeadm.yaml --skip-preflight-checks: running command: sudo /usr/bin/kubeadm init --config /var/lib/kubeadm.yaml --skip-preflight-checks: exit status 1
==> default: ---- End output of sudo -E minikube start --vm-driver=none --network-plugin=cni --bootstrapper=kubeadm --kubernetes-version v1.9.0 ----
==> default: Ran sudo -E minikube start --vm-driver=none --network-plugin=cni --bootstrapper=kubeadm --kubernetes-version v1.9.0 returned 1
==> default: [2018-03-21T13:45:41+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.
==> default: The previous process exited with exit code 1.

'HOME' => '/home/vagrant',
'USER' => 'vagrant'
)
command "sudo -E minikube start --vm-driver=none --network-plugin=cni --bootstrapper=kubeadm --kubernetes-version #{k8s_version}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should use #{binary_path}/minikube

end

action_class do
def docker
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for docker installation, please use https://github.com/chef-cookbooks/docker instead.

end
end

def create_vagrant_user
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vagrant is so specific to the vagrant user, this is not good, we should make sure to support any specified user instead.

@hoatle
Copy link
Member

hoatle commented Apr 17, 2018

I got this problem sometimes:

we need to make sure that the PR works as stable as possible.

@hieptranquoc this takes a lot of time to get this done, please concentrate to get this done ASAP.

@hoatle
Copy link
Member

hoatle commented Apr 17, 2018

the installation does not always work, it took me a lot of time to figure things out, sometimes it works, sometimes it does not, very unstable.

@hoatle
Copy link
Member

hoatle commented Apr 18, 2018

I got repeatedly this kind of error:

==> default: STDERR: E0418 04:32:01.767741    3265 start.go:276] Error starting cluster:  kubeadm init error sudo /usr/bin/kubeadm init --config /var/lib/kubeadm.yaml --ignore-preflight-errors=DirAvailable--etc-kubernetes-manifests --ignore-preflight-errors=DirAvailable--data --ignore-preflight-errors=FileAvailable--etc-kubernetes-manifests-kube-scheduler.yaml --ignore-preflight-errors=FileAvailable--etc-kubernetes-manifests-kube-apiserver.yaml --ignore-preflight-errors=FileAvailable--etc-kubernetes-manifests-kube-controller-manager.yaml --ignore-preflight-errors=FileAvailable--etc-kubernetes-manifests-etcd.yaml --ignore-preflight-errors=Swap  running command: : running command: sudo /usr/bin/kubeadm init --config /var/lib/kubeadm.yaml --ignore-preflight-errors=DirAvailable--etc-kubernetes-manifests --ignore-preflight-errors=DirAvailable--data --ignore-preflight-errors=FileAvailable--etc-kubernetes-manifests-kube-scheduler.yaml --ignore-preflight-errors=FileAvailable--etc-kubernetes-manifests-kube-apiserver.yaml --ignore-preflight-errors=FileAvailable--etc-kubernetes-manifests-kube-controller-manager.yaml --ignore-preflight-errors=FileAvailable--etc-kubernetes-manifests-etcd.yaml --ignore-preflight-errors=Swap 
==> default:  output: [init] Using Kubernetes version: v1.9.6
==> default: [init] Using Authorization modes: [Node RBAC]
==> default: [preflight] Running pre-flight checks.
==> default: 	[WARNING SystemVerification]: docker version is greater than the most recently validated version. Docker version: 18.04.0-ce. Max validated version: 17.03
==> default: 	[WARNING Hostname]: hostname "minikube" could not be reached
==> default: 	[WARNING Hostname]: hostname "minikube" lookup minikube on 10.0.2.3:53: no such host
==> default: 	[WARNING Swap]: running with swap on is not supported. Please disable swap
==> default: 	[WARNING FileExisting-ebtables]: ebtables not found in system path
==> default: 	[WARNING FileExisting-crictl]: crictl not found in system path
==> default: 	[WARNING ExtraArgs]: kube-apiserver: failed to parse extra argument --require-kubeconfig=true
==> default: [certificates] Using the existing ca certificate and key.
==> default: [certificates] Using the existing apiserver certificate and key.
==> default: [certificates] Generated apiserver-kubelet-client certificate and key.
==> default: [certificates] Generated sa key and public key.
==> default: [certificates] Generated front-proxy-ca certificate and key.
==> default: [certificates] Generated front-proxy-client certificate and key.
==> default: [certificates] Valid certificates and keys now exist in "/var/lib/localkube/certs/"
==> default: [kubeconfig] Wrote KubeConfig file to disk: "admin.conf"
==> default: [kubeconfig] Wrote KubeConfig file to disk: "kubelet.conf"
==> default: [kubeconfig] Wrote KubeConfig file to disk: "controller-manager.conf"
==> default: [kubeconfig] Wrote KubeConfig file to disk: "scheduler.conf"
==> default: [controlplane] Wrote Static Pod manifest for component kube-apiserver to "/etc/kubernetes/manifests/kube-apiserver.yaml"
==> default: [controlplane] Wrote Static Pod manifest for component kube-controller-manager to "/etc/kubernetes/manifests/kube-controller-manager.yaml"
==> default: [controlplane] Wrote Static Pod manifest for component kube-scheduler to "/etc/kubernetes/manifests/kube-scheduler.yaml"
==> default: [etcd] Wrote Static Pod manifest for a local etcd instance to "/etc/kubernetes/manifests/etcd.yaml"
==> default: [init] Waiting for the kubelet to boot up the control plane as Static Pods from directory "/etc/kubernetes/manifests".
==> default: [init] This might take a minute or longer if the control plane images have to be pulled.
==> default: 
==> default: Unfortunately, an error has occurred:
==> default: 	timed out waiting for the condition
==> default: 
==> default: This error is likely caused by:
==> default: 	- The kubelet is not running
==> default: 	- The kubelet is unhealthy due to a misconfiguration of the node in some way (required cgroups disabled)
==> default: 	- There is no internet connection, so the kubelet cannot pull the following control plane images:
==> default: 		- gcr.io/google_containers/kube-apiserver-amd64:v1.9.6
==> default: 		- gcr.io/google_containers/kube-controller-manager-amd64:v1.9.6
==> default: 		- gcr.io/google_containers/kube-scheduler-amd64:v1.9.6
==> default: 
==> default: If you are on a systemd-powered system, you can try to troubleshoot the error with the following commands:
==> default: 	- 'systemctl status kubelet'
==> default: 	- 'journalctl -xeu kubelet'
==> default: couldn't initialize a Kubernetes cluster
==> default: : running command: sudo /usr/bin/kubeadm init --config /var/lib/kubeadm.yaml --ignore-preflight-errors=DirAvailable--etc-kubernetes-manifests --ignore-preflight-errors=DirAvailable--data --ignore-preflight-errors=FileAvailable--etc-kubernetes-manifests-kube-scheduler.yaml --ignore-preflight-errors=FileAvailable--etc-kubernetes-manifests-kube-apiserver.yaml --ignore-preflight-errors=FileAvailable--etc-kubernetes-manifests-kube-controller-manager.yaml --ignore-preflight-errors=FileAvailable--etc-kubernetes-manifests-etcd.yaml --ignore-preflight-errors=Swap 
==> default: .: exit status 1
==> default: ---- End output of sudo -E minikube start --vm-driver=none --network-plugin=cni --bootstrapper=kubeadm --kubernetes-version v1.9.6 ----
==> default: Ran sudo -E minikube start --vm-driver=none --network-plugin=cni --bootstrapper=kubeadm --kubernetes-version v1.9.6 returned 1
==> default: [2018-04-18T04:32:01+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

@hoatle
Copy link
Member

hoatle commented Apr 24, 2018

seems that I'm having this problem: kubernetes/minikube#2707

make sure we can specify the minikube version.

@hieptranquoc hieptranquoc force-pushed the feature/#31-add-k8s-resource-to-manage-a-k8s-instance branch 7 times, most recently from e8711de to 599d741 Compare April 26, 2018 13:59
@hieptranquoc hieptranquoc force-pushed the feature/#31-add-k8s-resource-to-manage-a-k8s-instance branch 7 times, most recently from 3d0bad8 to 1e00ccc Compare April 26, 2018 17:59
Copy link
Member

@hoatle hoatle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check my comments.

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

git ignore .idea stuff

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this file

README.md Outdated
- `minikube` should be run with special user. You can change by override attributes in recipe:

```ruby
node.override['kubernetes-stack']['user'] = `user`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

node.override['kubernetes-stack']['minikube_user'] = "user" is better to me.

README.md Outdated
node.override['kubernetes-stack']['user'] = `user`
```

- or edit attributes in `default.rb` file
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

edit the vendor files should not be allowed.

@@ -1,21 +1,27 @@
# frozen_string_literal: true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrong license, please use the previous Teracy license header.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need any attributes here. It does not make sense to me.

# See the License for the specific language governing permissions and
# limitations under the License.
#
default['kubernetes-stack']['arch'] = 'amd64'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is dynamic and can be got from the chef provided info. Let users to override these kind of attributes is non-sense.

#
default['kubernetes-stack']['arch'] = 'amd64'
default['kubernetes-stack']['sys'] = 'linux'
default['kubernetes-stack']['user'] = node['kubernetes-stack']['user'] || 'vagrant'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is specific to a resource, move this to the resource property instead of the general cookbook attributes.

cookbook attributes can be used for some general or common config, don't overuse it here.

default['kubernetes-stack']['arch'] = 'amd64'
default['kubernetes-stack']['sys'] = 'linux'
default['kubernetes-stack']['user'] = node['kubernetes-stack']['user'] || 'vagrant'
default['kubernetes-stack']['home'] = "/home/#{node['kubernetes-stack']['user']}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should move to the minikube resource property, is this really needed for users to configure? Which case do users need to configure this?

default['kubernetes-stack']['home'] = "/home/#{node['kubernetes-stack']['user']}"

default['docker_machine']['version'] = 'v0.14.0'
default['docker_machine']['command_path'] = '/usr/local/bin/docker-machine'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

path, use the same consistent name.

default['docker_machine']['path'] = '/usr/local/bin'

intermediate_instructions:
- RUN yum -y install lsof which net-tools curl bash-completion

# - name: centos-7
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why remove centos-7 tests?


install_path = '/usr/lib'
log "create #{new_resource.path} directory" do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not this?

Chef::Log.info("create #{new_resource.path} directory")

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and why duplicated logs?

@hieptranquoc hieptranquoc force-pushed the feature/#31-add-k8s-resource-to-manage-a-k8s-instance branch 11 times, most recently from 562a87f to c85747b Compare May 7, 2018 20:25
@hieptranquoc hieptranquoc force-pushed the feature/#31-add-k8s-resource-to-manage-a-k8s-instance branch from c85747b to ba89ab0 Compare May 7, 2018 20:36
@hieptranquoc
Copy link
Contributor Author

@hoatle i fixed all your comment, please check again!

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this file

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove all .idea/ files

@@ -19,3 +22,6 @@
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

default['docker_machine']['version'] = 'v0.14.0'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove all these stuff, not useful to users and not supposed to be used by users.

end
end

action :run do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:run should not be introduced, we should have ":install", ":remove" action, that's enough for us.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when minikube is stopped manually, :install should make it run again (this case is useful when I want to stop minikube temporarily and use it later)

@hoatle
Copy link
Member

hoatle commented May 12, 2018

@hieptranquoc please consider this:

minikube "" do
  version minikube_opt['version']
  user_name minikube_opt['user_name']
  action [:install, :remove]
end

minikube_k8s "" do
  k8s_version
  network_plugin
  bootstrapper
  vm_driver
  action [:start, :stop]
end

We have 2 resources: one to install/remove minikube and one to start/stop minikube_k8s.

install action: install the exact specified minikube version or the latest one
remove action: stop and remove minikube if running/installed
start action: start minikube if it's installed
stop action: stop minikube if it's running.

I think this will help us to manage minikube better.

Let me know what you think then.

@datphan
Copy link

datphan commented May 28, 2018

Please use root user instead of vagrant at resources/kubernetes.rb

execute 'start minikube' do
        user 'root' # instead of vagrant

Because of this error:

==> default: ---- Begin output of sudo -E minikube start --vm-driver=none --network-plugin=cni --bootstrapper=kubeadm --kubernetes-version v1.9.6 ----
==> default:     STDOUT: 
==> default:     STDERR: sudo: no tty present and no askpass program specified
==> default:     ---- End output of sudo -E minikube start --vm-driver=none --network-plugin=cni --bootstrapper=kubeadm --kubernetes-version v1.9.6 ----
==> default:     Ran sudo -E minikube start --vm-driver=none --network-plugin=cni --bootstrapper=kubeadm --kubernetes-version v1.9.6 returned 1
==> default:     

@datphan
Copy link

datphan commented May 28, 2018

Same thing happen at recipes/k8s.rb

execute 'helm init' do
        user 'root' # instead of vagrant

Because of this error:

==> default: [2018-05-28T15:55:52+00:00] ERROR: execute[helm init] (mathlabs::k8s line 66) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
==> default: ---- Begin output of helm init --service-account default --wait ----
==> default: STDOUT: $HELM_HOME has been configured at /home/vagrant/.helm.
==> default: STDERR: Error: could not get kubernetes client: could not get Kubernetes config for context "": invalid configuration: unable to read client-key /home/vagrant/.minikube/client.key for minikube due to open /home/vagrant/.minikube/client.key: permission denied
==> default: ---- End output of helm init --service-account default --wait ----
==> default: Ran helm init --service-account default --wait returned 1

@hoatle
Copy link
Member

hoatle commented Aug 17, 2018

close for now, we're moving to https://github.com/hoatle/teracy-dev-k8s instead.

@hoatle hoatle closed this Aug 17, 2018
@ghost ghost removed the stag:under-review label Aug 17, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants