Skip to content

Commit

Permalink
Add weave network support to RKE clusters
Browse files Browse the repository at this point in the history
  • Loading branch information
westlywright authored and n313893254 committed Jan 2, 2019
1 parent cd64bd2 commit cf14771
Show file tree
Hide file tree
Showing 3 changed files with 252 additions and 126 deletions.
40 changes: 30 additions & 10 deletions lib/shared/addon/components/cluster-driver/driver-rke/component.js
Expand Up @@ -5,7 +5,9 @@ import {
} from '@ember/object';
import { maxSatisfying } from 'shared/utils/parse-version';
import { inject as service } from '@ember/service';
import { underlineToCamel, removeEmpty, keysToCamel, validateEndpoint } from 'shared/utils/util';
import {
underlineToCamel, removeEmpty, keysToCamel, validateEndpoint, randomStr
} from 'shared/utils/util';
import { validateHostname } from 'ember-api-store/utils/validate';

import C from 'shared/utils/constants';
Expand Down Expand Up @@ -44,11 +46,16 @@ const NETWORKCHOICES = [
label: 'clusterNew.rke.network.canal',
value: 'canal'
},
{
label: 'clusterNew.rke.network.weave',
value: 'weave'
},
];

const FLANNEL = 'flannel'
const CANAL = 'canal'
const HOST_GW = 'host-gw'
const FLANNEL = 'flannel';
const CANAL = 'canal';
const WEAVE = 'weave';
const HOST_GW = 'host-gw';
const DEFAULT_BACKEND_TYPE = 'vxlan';

const AUTHCHOICES = [
Expand Down Expand Up @@ -106,6 +113,7 @@ export default InputTextFile.extend(ClusterDriver, {
windowsEnable: false,
isLinux: true,
windowsSupport: false,
weaveCustomPassword: false,
isNew: equal('mode', 'new'),
isEdit: equal('mode', 'edit'),
notView: or('isNew', 'isEdit'),
Expand Down Expand Up @@ -186,13 +194,25 @@ export default InputTextFile.extend(ClusterDriver, {
},

networkPluginDidChange: observer('cluster.rancherKubernetesEngineConfig.network.plugin', function() {
let plugin = get(this, 'config.network.plugin');
let plugin = get(this, 'cluster.rancherKubernetesEngineConfig.network.plugin');

if (plugin && plugin !== CANAL) {
set(this, 'cluster.enableNetworkPolicy', false);
}
if (plugin && plugin !== FLANNEL) {
set(this, 'windowsSupport', false)
if (plugin) {
if (plugin !== CANAL) {
set(this, 'cluster.enableNetworkPolicy', false);
}

if (plugin !== FLANNEL) {
set(this, 'windowsSupport', false)
}

if (plugin === WEAVE) {
set(this, 'cluster.rancherKubernetesEngineConfig.network.weaveNetworkProvider', this.globalStore.createRecord({
type: 'weaveNetworkProvider',
password: randomStr(16, 16, 'password')
}));
} else if (plugin !== WEAVE && get(this, 'cluster.rancherKubernetesEngineConfig.network.weaveNetworkProvider.password')) {
set(this, 'cluster.rancherKubernetesEngineConfig.network.weaveNetworkProvider', null);
}
}
}),

Expand Down

0 comments on commit cf14771

Please sign in to comment.