From 77355e872b699e1e4a97b722e66dd980c7a2361d Mon Sep 17 00:00:00 2001 From: loganhz Date: Thu, 26 Apr 2018 08:33:16 +0800 Subject: [PATCH 1/7] Fix config map issue https://github.com/rancher/rancher/issues/12778 --- .../addon/components/container/form-sources/component.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/shared/addon/components/container/form-sources/component.js b/lib/shared/addon/components/container/form-sources/component.js index 2994017c8..53c8466bf 100644 --- a/lib/shared/addon/components/container/form-sources/component.js +++ b/lib/shared/addon/components/container/form-sources/component.js @@ -54,5 +54,11 @@ export default Component.extend({ if (!get(this, 'sources') ) { set(this, 'sources', []) } + + get(this, 'sources').forEach((source) => { + if ( source.sourceKey === undefined ) { + set(source, 'sourceKey', null); + } + }); }, }); From 67c08e265e8f757de48cbf9bd0eaa049f78cb69c Mon Sep 17 00:00:00 2001 From: loganhz Date: Thu, 26 Apr 2018 09:25:55 +0800 Subject: [PATCH 2/7] Fix login issue https://github.com/rancher/rancher/issues/13102 --- lib/login/addon/components/login-user-pass/component.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/login/addon/components/login-user-pass/component.js b/lib/login/addon/components/login-user-pass/component.js index fd2027817..30dd519c4 100644 --- a/lib/login/addon/components/login-user-pass/component.js +++ b/lib/login/addon/components/login-user-pass/component.js @@ -109,8 +109,4 @@ export default Component.extend({ next(this, 'focusSomething'); }, - willDestroyElement() { - set(this, 'shown', false); - }, - }); From 975cebd23f589c6cb6a54d9da117334d74c5e394 Mon Sep 17 00:00:00 2001 From: loganhz Date: Thu, 26 Apr 2018 12:13:17 +0800 Subject: [PATCH 3/7] Update catalog --- app/apps-tab/detail/template.hbs | 4 ++-- lib/shared/addon/components/modal-rollback-app/component.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/apps-tab/detail/template.hbs b/app/apps-tab/detail/template.hbs index 353a2283c..465eb035b 100644 --- a/app/apps-tab/detail/template.hbs +++ b/app/apps-tab/detail/template.hbs @@ -38,7 +38,7 @@
{{#accordion-list as |al expandFn|}} - {{#if model.app.status.notes}} + {{#if model.app.notes}} {{#accordion-list-item title=(t 'appDetailPage.notes.title') detail=(t 'appDetailPage.notes.detail') @@ -46,7 +46,7 @@ expand=(action expandFn) expandOnInit=false }} - {{marked-down markdown=model.app.status.notes}} + {{marked-down markdown=model.app.notes}} {{/accordion-list-item}} {{/if}} diff --git a/lib/shared/addon/components/modal-rollback-app/component.js b/lib/shared/addon/components/modal-rollback-app/component.js index eccf48457..db807ab4a 100644 --- a/lib/shared/addon/components/modal-rollback-app/component.js +++ b/lib/shared/addon/components/modal-rollback-app/component.js @@ -25,9 +25,9 @@ export default Component.extend(ModalBase, { actions: { save(cb) { - const revision = get(this, 'revisionId'); + const revisionId = get(this, 'revisionId'); get(this, 'model').doAction('rollback', { - revision, + revisionId, }).then(() => { this.send('cancel'); }).finally(() => { From da87ee780fc1678cfb8ff28d9289722937c788d2 Mon Sep 17 00:00:00 2001 From: loganhz Date: Thu, 26 Apr 2018 23:07:28 +0800 Subject: [PATCH 4/7] Fix volume issue https://github.com/rancher/rancher/issues/13090 --- app/workload/template.hbs | 1 + .../container/form-volume-row/component.js | 1 + .../container/form-volume-row/template.hbs | 105 +++++++++++------- .../container/form-volumes/component.js | 5 + .../components/form-key-to-path/component.js | 4 +- .../schema/input-secret/component.js | 4 +- .../source-config-map/template.hbs | 26 +++-- .../volume-source/source-secret/component.js | 1 + .../volume-source/source-secret/template.hbs | 26 +++-- translations/en-us.yaml | 5 + 10 files changed, 112 insertions(+), 66 deletions(-) diff --git a/app/workload/template.hbs b/app/workload/template.hbs index 88b0f67d7..6979e5346 100644 --- a/app/workload/template.hbs +++ b/app/workload/template.hbs @@ -173,6 +173,7 @@ {{container/form-volumes launchConfig=activeLaunchConfig workload=service + namespace=service.namespace editing=false expandAll=al.expandAll expandFn=expandFn diff --git a/lib/shared/addon/components/container/form-volume-row/component.js b/lib/shared/addon/components/container/form-volume-row/component.js index a7af73921..e3dac293f 100644 --- a/lib/shared/addon/components/container/form-volume-row/component.js +++ b/lib/shared/addon/components/container/form-volume-row/component.js @@ -10,6 +10,7 @@ export default Component.extend({ modalService: service('modal'), tagName: '', + editing: true, pvcs: null, pvcChoices: computed('pvcs.@each.{name,state}', function() { diff --git a/lib/shared/addon/components/container/form-volume-row/template.hbs b/lib/shared/addon/components/container/form-volume-row/template.hbs index 3b7e9bd93..76e69dc8e 100644 --- a/lib/shared/addon/components/container/form-volume-row/template.hbs +++ b/lib/shared/addon/components/container/form-volume-row/template.hbs @@ -70,7 +70,7 @@ {{else if (eq model.mode "bindMount")}} {{volume-source/source-host-path volume=model.volume - editing=true + editing=editing }} {{else if (eq model.mode "customLogPath")}} {{volume-source/source-custom-log-path @@ -78,19 +78,19 @@ model=model volume=model.volume mounts=model.mounts - editing=true + editing=editing }} {{else if (eq model.mode "secret")}} {{volume-source/source-secret namespace=namespace volume=model.volume - editing=true + editing=editing }} {{else if (eq model.mode "configmap")}} {{volume-source/source-config-map namespace=namespace volume=model.volume - editing=true + editing=editing }} {{/if}} {{#if (eq model.mode "customLogPath")}} @@ -99,47 +99,66 @@
{{#if model.mounts.length}} - - - - - - - - - - {{#each model.mounts as |mnt|}} - - - - - - - - - {{/each}} -
Mount Point{{field-required}} Sub Path in Volume Read-Only 
- {{input value=mnt.mountPath}} - - {{input value=mnt.subPath}} - - {{input type="checkbox" classNames="form-control" checked=mnt.readOnly}} - - -
+ + + + + + + + + + + + + {{#each model.mounts as |mnt|}} + + + + + + + + + {{/each}} + +
{{t "formVolumeRow.mounts.mountPoint"}}{{#if editing}}{{field-required}}{{/if}} {{t "formVolumeRow.mounts.subPath"}} {{t "formVolumeRow.mounts.readOnly"}} 
+ {{#if editing}} + {{input value=mnt.mountPath}} + {{else}} + {{mnt.mountPath}} + {{/if}} + + {{#if editing}} + {{input value=mnt.subPath}} + {{else}} + {{mnt.subPath}} + {{/if}} + + {{#if editing}} + {{input type="checkbox" classNames="form-control" checked=mnt.readOnly}} + {{else}} + {{mnt.readOnly}} + {{/if}} + + {{#if editing}} + + {{/if}} +
{{else}} - The volume will not be mounted in the current container. It may be used by other containers in the pod. + {{t "formVolumeRow.mounts.helper"}} + {{/if}} + {{#if editing}} +
+ +
{{/if}} - -
- -
{{/if}} diff --git a/lib/shared/addon/components/container/form-volumes/component.js b/lib/shared/addon/components/container/form-volumes/component.js index 9c5c94c0f..6c63e3f7c 100644 --- a/lib/shared/addon/components/container/form-volumes/component.js +++ b/lib/shared/addon/components/container/form-volumes/component.js @@ -71,6 +71,11 @@ export default Component.extend({ mode: SECRET, volume, }; + } else if (volume.configMap) { + entry = { + mode: CONFIG_MAP, + volume, + }; } else { entry = { mode: EXISTING_VOLUME, diff --git a/lib/shared/addon/components/form-key-to-path/component.js b/lib/shared/addon/components/form-key-to-path/component.js index bafeaca30..1a13808ba 100644 --- a/lib/shared/addon/components/form-key-to-path/component.js +++ b/lib/shared/addon/components/form-key-to-path/component.js @@ -14,7 +14,7 @@ export default Component.extend({ configMapName: null, mode: SECRET, - editing: true, + editing: null, ary: null, keys: null, allSecrets: null, @@ -50,6 +50,8 @@ export default Component.extend({ if ( get(this, 'mode') === SECRET ) { const allSecrets = get(this, 'store').all('secret'); + const namespacedSecrets = get(this,'store').all('namespacedSecret').filterBy('type','namespacedSecret'); + allSecrets.pushObjects(namespacedSecrets); set(this, 'allSecrets', allSecrets); this.updateSecretKeys(); } diff --git a/lib/shared/addon/components/schema/input-secret/component.js b/lib/shared/addon/components/schema/input-secret/component.js index a7041d1a9..4e3822464 100644 --- a/lib/shared/addon/components/schema/input-secret/component.js +++ b/lib/shared/addon/components/schema/input-secret/component.js @@ -33,7 +33,7 @@ export default Component.extend({ var exact; get(this,'projectSecrets').forEach((secret) => { - if ( def === get(secret,'name') ) { + if ( def === get(secret, get(this,'valueKey')) ) { exact = get(secret,'id'); } }); @@ -41,7 +41,7 @@ export default Component.extend({ const namespaceId = get(this,'namespace.id'); if ( !exact && namespaceId ) { get(this,'namespaceSecrets').forEach((secret) => { - if ( def === get(secret,'name') && get(secret,'namespaceId') === namespaceId) { + if ( def === get(secret, get(this,'valueKey')) && get(secret,'namespaceId') === namespaceId) { exact = get(secret,'id'); } }); diff --git a/lib/shared/addon/components/volume-source/source-config-map/template.hbs b/lib/shared/addon/components/volume-source/source-config-map/template.hbs index 6c45391b6..23283d003 100644 --- a/lib/shared/addon/components/volume-source/source-config-map/template.hbs +++ b/lib/shared/addon/components/volume-source/source-config-map/template.hbs @@ -18,7 +18,7 @@ {{else}} -
+
{{config.optional}}
{{/if}} @@ -27,11 +27,17 @@
- {{schema/input-config-map - namespace=namespace - value=config.name - valueKey='name' - }} + {{#if editing}} + {{schema/input-config-map + namespace=namespace + value=config.name + valueKey='name' + }} + {{else}} +
+ {{config.name}} +
+ {{/if}}
{{#if config.name}}
@@ -50,12 +56,12 @@
{{else if specific}} -
- {{t 'formKeyToPath.default'}} +
+ {{t 'formKeyToPath.specific'}}
{{else if (not specific)}} -
- {{t 'formKeyToPath.specific'}} +
+ {{t 'formKeyToPath.default'}}
{{/if}}
diff --git a/lib/shared/addon/components/volume-source/source-secret/component.js b/lib/shared/addon/components/volume-source/source-secret/component.js index 88463a979..aaad49f58 100644 --- a/lib/shared/addon/components/volume-source/source-secret/component.js +++ b/lib/shared/addon/components/volume-source/source-secret/component.js @@ -10,6 +10,7 @@ export default Component.extend(VolumeSource, { specific: false, defaultMode: null, + editing: true, didReceiveAttrs() { this._super(...arguments); diff --git a/lib/shared/addon/components/volume-source/source-secret/template.hbs b/lib/shared/addon/components/volume-source/source-secret/template.hbs index 72cbcaeb6..567628731 100644 --- a/lib/shared/addon/components/volume-source/source-secret/template.hbs +++ b/lib/shared/addon/components/volume-source/source-secret/template.hbs @@ -18,7 +18,7 @@
{{else}} -
+
{{config.optional}}
{{/if}} @@ -27,11 +27,17 @@
- {{schema/input-secret - namespace=namespace - value=config.secretId - valueKey='id' - }} + {{#if editing}} + {{schema/input-secret + namespace=namespace + value=config.secretId + valueKey='id' + }} + {{else}} +
+ {{config.secretId}} +
+ {{/if}}
{{#if config.secretId}}
@@ -50,12 +56,12 @@
{{else if specific}} -
- {{t 'formKeyToPath.default'}} +
+ {{t 'formKeyToPath.specific'}}
{{else if (not specific)}} -
- {{t 'formKeyToPath.specific'}} +
+ {{t 'formKeyToPath.default'}}
{{/if}}
diff --git a/translations/en-us.yaml b/translations/en-us.yaml index d0cdb2354..d4fd17d04 100644 --- a/translations/en-us.yaml +++ b/translations/en-us.yaml @@ -3718,6 +3718,11 @@ formVolumeRow: readOnly: Read-Only noVolume: The volume will not be mounted in the current container. It may be used by other containers in the pod. addMount: Add Mount + mounts: + mountPoint: Mount Point + subPath: Sub Path in Volume + readOnly: Read-Only + helper: The volume will not be mounted in the current container. It may be used by other containers in the pod. customLogPath: helpText: We will deploy a flexvolume driver to create a volume and mount the log to the host. This feature is supported on GKE cluster now. formVolumes: From 7fc6f081cba51eeee29cbf79f95681f56978a057 Mon Sep 17 00:00:00 2001 From: loganhz Date: Thu, 26 Apr 2018 23:43:19 +0800 Subject: [PATCH 5/7] Fix registry issue https://github.com/rancher/rancher/issues/12663 --- .../components/cluster-driver/driver-rke/component.js | 9 +++++++++ 1 file changed, 9 insertions(+) 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 591fc921f..3aeab11dc 100644 --- a/lib/shared/addon/components/cluster-driver/driver-rke/component.js +++ b/lib/shared/addon/components/cluster-driver/driver-rke/component.js @@ -67,6 +67,15 @@ export default Component.extend(ClusterDriver, { set(this, 'initialNodeCounts', counts); set(this, 'initialVersion', get(this, 'cluster.rancherKubernetesEngineConfig.kubernetesVersion')); + + const config = get(this, 'cluster.rancherKubernetesEngineConfig'); + if ( get(config, 'privateRegistries.length') > 0 ) { + const registry = get(config, 'privateRegistries.firstObject'); + set(this, 'registry', 'custom'); + set(this, 'registryUrl', get(registry, 'url')); + set(this, 'registryUser', get(registry, 'user')); + set(this, 'registryPass', get(registry, 'password')); + } }, didInsertElement() { From 3aadeb1c87e3b9f7f2497f98f19fb93c2b652584 Mon Sep 17 00:00:00 2001 From: loganhz Date: Thu, 26 Apr 2018 23:47:14 +0800 Subject: [PATCH 6/7] Fix registry issue --- .../addon/components/cluster-driver/driver-rke/component.js | 2 +- 1 file changed, 1 insertion(+), 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 3aeab11dc..ec230cd98 100644 --- a/lib/shared/addon/components/cluster-driver/driver-rke/component.js +++ b/lib/shared/addon/components/cluster-driver/driver-rke/component.js @@ -69,7 +69,7 @@ export default Component.extend(ClusterDriver, { set(this, 'initialVersion', get(this, 'cluster.rancherKubernetesEngineConfig.kubernetesVersion')); const config = get(this, 'cluster.rancherKubernetesEngineConfig'); - if ( get(config, 'privateRegistries.length') > 0 ) { + if ( config && get(config, 'privateRegistries.length') > 0 ) { const registry = get(config, 'privateRegistries.firstObject'); set(this, 'registry', 'custom'); set(this, 'registryUrl', get(registry, 'url')); From 90e4e509b0ecb76d4fa77edab1a706e97cd97fc8 Mon Sep 17 00:00:00 2001 From: loganhz Date: Fri, 27 Apr 2018 00:10:14 +0800 Subject: [PATCH 7/7] Support add tags in AWS node template https://github.com/rancher/rancher/issues/13069 --- .../node-driver/driver-amazonec2/component.js | 25 ++++++++++++++++++- .../node-driver/driver-amazonec2/template.hbs | 10 ++++++++ translations/en-us.yaml | 4 +++ 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/lib/shared/addon/components/node-driver/driver-amazonec2/component.js b/lib/shared/addon/components/node-driver/driver-amazonec2/component.js index 2a9a8444c..2a7ee0592 100644 --- a/lib/shared/addon/components/node-driver/driver-amazonec2/component.js +++ b/lib/shared/addon/components/node-driver/driver-amazonec2/component.js @@ -1,6 +1,6 @@ import $ from 'jquery'; import { scheduleOnce } from '@ember/runloop'; -import EmberObject, { computed, get, set, setProperties } from '@ember/object'; +import EmberObject, { observer, computed, get, set, setProperties } from '@ember/object'; import { alias, equal } from '@ember/object/computed'; import { inject as service } from '@ember/service'; import Component from '@ember/component'; @@ -169,6 +169,7 @@ export default Component.extend(NodeDriver, { instanceTypes : INSTANCE_TYPES, regionChoices : REGIONS, step : 1, + tags : null, bootstrap: function() { let pref = get(this, 'prefs.amazonec2')||{}; @@ -219,6 +220,17 @@ export default Component.extend(NodeDriver, { selectedSecurityGroup : cur, }); } + + const tagsString = get(this, 'config.tags'); + if( tagsString ) { + const array = tagsString.split(','); + const tags = {}; + for (let i=0; i< array.length-1; i=i+2) { + tags[array[i]] = array[i+1]; + } + debugger + set(this, 'tags', tags); + } }, willDestroyElement: function() { @@ -508,4 +520,15 @@ export default Component.extend(NodeDriver, { subnetById: function(id) { return (get(this, 'allSubnets')||[]).filterBy('subnetId',id)[0]; }, + + tagsDidChange: observer('tags', function() { + const array = []; + const tags = get(this, 'tags') || {}; + Object.keys(tags).forEach((key) => { + array.push(key); + array.push(tags[key]); + }); + + set(this, 'config.tags', array.join(',')); + }), }); diff --git a/lib/shared/addon/components/node-driver/driver-amazonec2/template.hbs b/lib/shared/addon/components/node-driver/driver-amazonec2/template.hbs index e7fbf7267..7f9b7f278 100644 --- a/lib/shared/addon/components/node-driver/driver-amazonec2/template.hbs +++ b/lib/shared/addon/components/node-driver/driver-amazonec2/template.hbs @@ -282,6 +282,16 @@
{{/if}}
+ +
+
+ {{form-key-value + addActionLabel="nodeDriver.amazonec2.tags.addActionLabel" + initialMap=tags + changed=(action (mut tags)) + }} +
+
{{/accordion-list-item}}
{{templateOptionsTitle}}
diff --git a/translations/en-us.yaml b/translations/en-us.yaml index d4fd17d04..f5cc9580a 100644 --- a/translations/en-us.yaml +++ b/translations/en-us.yaml @@ -4440,6 +4440,10 @@ nodeDriver: defaultCreate: "Standard: Automatically create a {groupName} group" next: "Next: Set Instance options" loading: Loading Instance options... + tags: + addActionLabel: Add AWS Tag + valueLabel: Tags + placeholder: e.g. dev instance: title: 4. Instance detail: Customize the EC2 Instance that will be created.