lib/cloud/sh/providers/digital_ocean.rb in cloud-sh-1.0.1 vs lib/cloud/sh/providers/digital_ocean.rb in cloud-sh-1.0.2

- old
+ new

@@ -5,19 +5,19 @@ module Cloud module Sh module Providers class DigitalOcean < Base - def self.refresh_k8s_configs - return if File.exist?(kube_config) && (Time.now.to_i - File.mtime(kube_config).to_i) < 3600 + def self.refresh_k8s_configs(force: false) + return if !force && File.exist?(kube_config) && (Time.now.to_i - File.mtime(kube_config).to_i) < 3600 configs = Cloud::Sh.config.accounts.map { |account| new(account).k8s_configs }.flatten.compact config = configs.shift configs.each do |cfg| config["clusters"] += cfg["clusters"] config["contexts"] += cfg["contexts"] config["users"] += cfg["users"] end - config["current-context"] = config["contexts"].first["name"] + config["current-context"] = Cloud::Sh.config.raw["default_kubectl_context"] || config["contexts"].first["name"] File.write(kube_config, YAML.dump(config)) end def self.kube_config File.expand_path(".kube/cloud_sh_config", "~/")