From 447f5838f47f1df2e150e3d9fb83e78a5371fbcd Mon Sep 17 00:00:00 2001 From: n313893254 Date: Wed, 16 Jan 2019 19:14:20 +0800 Subject: [PATCH] Cluster options in Edit as a Form are not all configurable in current Edit as YAML option https://github.com/rancher/rancher/issues/15396 --- .../cluster-driver/driver-rke/component.js | 19 ++++++++++++++++++- translations/en-us.yaml | 3 +++ translations/zh-hans.yaml | 3 +++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/lib/shared/addon/components/cluster-driver/driver-rke/component.js b/lib/shared/addon/components/cluster-driver/driver-rke/component.js index caecd2870..d2651f72b 100644 --- a/lib/shared/addon/components/cluster-driver/driver-rke/component.js +++ b/lib/shared/addon/components/cluster-driver/driver-rke/component.js @@ -492,6 +492,11 @@ export default InputTextFile.extend(ClusterDriver, { return ''; } + let cluster = this.getSupportedFields(get(this, 'cluster'), 'cluster'); + + delete cluster.rancher_kubernetes_engine_config + Object.assign(config, cluster) + config = removeEmpty(config, EXCLUDED_KEYS); while ( JSON.stringify(config) !== JSON.stringify(removeEmpty(config, EXCLUDED_KEYS)) ){ @@ -538,11 +543,23 @@ export default InputTextFile.extend(ClusterDriver, { set(this, 'clusterOptErrors', []); const validFields = this.getResourceFields('rancherKubernetesEngineConfig'); + const clusterFields = this.getResourceFields('cluster'); Object.keys(configs || {}).forEach((key) => { - if ( validFields[underlineToCamel(key)] ) { + if ( validFields[underlineToCamel(key)] || clusterFields[underlineToCamel(key)] ) { + if (configs[key] === null) { + return + } const obj = keysToCamel(configs[key]); + const clusterKey = ['docker_root_dir', 'enable_cluster_alerting', 'enable_cluster_monitoring', 'enable_network_policy'] + + if (clusterKey.includes(key)) { + set(this, `cluster.${ underlineToCamel(key) }`, obj) + + return + } + if ( key === 'services' && obj['kube-api'] ) { set(obj, 'kubeApi', obj['kube-api']); delete obj['kube-api']; diff --git a/translations/en-us.yaml b/translations/en-us.yaml index 998253fd5..86b7e0f00 100644 --- a/translations/en-us.yaml +++ b/translations/en-us.yaml @@ -6802,3 +6802,6 @@ rkeConfigComment: " kubelet:" " cluster_domain: cluster.local" " cluster_dns_server: 10.43.0.10" + docker_root_dir: | + "" + " # Rancher Config" \ No newline at end of file diff --git a/translations/zh-hans.yaml b/translations/zh-hans.yaml index 8659a86be..ee67bcc95 100644 --- a/translations/zh-hans.yaml +++ b/translations/zh-hans.yaml @@ -6650,3 +6650,6 @@ rkeConfigComment: " # 修改空间配额为$((4*1024*1024*1024)),默认2G,最大8G" " extra_args:" " quota-backend-bytes: '4294967296'" + docker_root_dir: | + "" + " # 自定义Rancher参数" \ No newline at end of file