lib/sct/commands/cluster.rb in sct-0.1.11 vs lib/sct/commands/cluster.rb in sct-0.1.12
- old
+ new
@@ -14,42 +14,46 @@
OPTIONS = []
def execute(args, options)
return puts "SCT has not been initialized. Run 'sct init' first.".red unless Sct::Config.exists
- if Sct::Config::WINDOWS
+ if Sct::Helpers.operatingSystem == Sct::Helpers::WINDOWS
minikube = "minikube.exe"
else
minikube = "minikube"
end
case args[0]
when "up"
system("#{minikube} start")
system("#{minikube} ssh -- 'sudo su -c \"echo 10048576 > /proc/sys/fs/inotify/max_user_watches\"'")
- system("sct cluster update-config")
+ update_config
system("kubectl config use-context minikube")
system("kubectl delete pod -n kube-system $(kubectl get pods -n kube-system | grep registry-creds | awk '{print $1}')")
system("sudo sct hostfile")
puts "\nāļø You can now visit your environment at š https://spend-cloud.spend.cloud.local š"
when "down"
system("#{minikube} stop")
when "update-config"
- return puts "Skipping minikube config ( only needed for windows )".yellow unless Sct::Config.operatingSystem == Sct::Config::WINDOWS
+ update_config
+ else
+ puts "Unknown or missing argument. Please run 'sct cluster up','sct cluster down' or 'sct cluster update-config'".red
+ end
+ end
- windows_home_path = Sct::Config.getTrueHomePath
- kube_file_path = windows_home_path+"/.kube/config"
+ def update_config
+ return puts "Skipping minikube config (only needed for Windows)".yellow unless Sct::Helpers.operatingSystem == Sct::Helpers::WINDOWS
- if !File.exists?(kube_file_path)
- return puts "#{kube_file_path} doesn't exist".red
- end
+ windows_home_path = Sct::Helpers.windowsHomePath
+ kube_file_path = windows_home_path+"/.kube/config"
- system("sed -e 's~\\\\~/~g' -e 's~C:~/mnt/c~g' < #{kube_file_path} > ~/.kube/minikube-config")
-
- return puts "Windows minikube config copied to ~/.kube/minikube-config".green
- else
- puts "Unknown or missing argument. Please run 'sct cluster up','sct cluster down' or 'sct cluster update-config'".red
+ if !File.exists?(kube_file_path)
+ return puts "#{kube_file_path} doesn't exist".red
end
+
+ system("sed -e 's~\\\\~/~g' -e 's~C:~/mnt/c~g' < #{kube_file_path} > ~/.kube/minikube-config")
+
+ return puts "Windows minikube config copied to ~/.kube/minikube-config".green
end
implements CommandInterface
end