Class: ClusterCommonService
- Inherits:
-
Object
- Object
- ClusterCommonService
- Defined in:
- lib/uffizzi/services/cluster/common_service.rb
Class Method Summary collapse
- .parse_kubeconfig(kubeconfig) ⇒ Object
- .save_previous_current_context(kubeconfig_path, current_context) ⇒ Object
- .update_clusters_config(id, params) ⇒ Object
Class Method Details
.parse_kubeconfig(kubeconfig) ⇒ Object
19 20 21 22 23 |
# File 'lib/uffizzi/services/cluster/common_service.rb', line 19 def parse_kubeconfig(kubeconfig) return if kubeconfig.nil? Psych.safe_load(Base64.decode64(kubeconfig)) end |
.save_previous_current_context(kubeconfig_path, current_context) ⇒ Object
7 8 9 10 11 12 |
# File 'lib/uffizzi/services/cluster/common_service.rb', line 7 def save_previous_current_context(kubeconfig_path, current_context) return if kubeconfig_path.nil? || Uffizzi::ConfigHelper.previous_current_context_by_path(kubeconfig_path).present? previous_current_contexts = Uffizzi::ConfigHelper.set_previous_current_context_by_path(kubeconfig_path, current_context) Uffizzi::ConfigFile.write_option(:previous_current_contexts, previous_current_contexts) end |
.update_clusters_config(id, params) ⇒ Object
14 15 16 17 |
# File 'lib/uffizzi/services/cluster/common_service.rb', line 14 def update_clusters_config(id, params) clusters_config = Uffizzi::ConfigHelper.update_clusters_config_by_id(id, params) Uffizzi::ConfigFile.write_option(:clusters, clusters_config) end |