mirror of https://github.com/rancher/ui.git
Windows support
This commit is contained in:
parent
f9e86fad1e
commit
64be404fbb
|
|
@ -98,6 +98,9 @@ export default InputTextFile.extend(ClusterDriver, {
|
|||
worker: true,
|
||||
defaultDockerRootDir: null,
|
||||
|
||||
windowsEnable: null,
|
||||
isLinux: true,
|
||||
windowsSupport: false,
|
||||
isNew: equal('mode', 'new'),
|
||||
isEdit: equal('mode', 'edit'),
|
||||
notView: or('isNew', 'isEdit'),
|
||||
|
|
@ -145,6 +148,16 @@ export default InputTextFile.extend(ClusterDriver, {
|
|||
let defaultCluster = globalStore.createRecord({ type: 'cluster' })
|
||||
|
||||
set(this, 'defaultDockerRootDir', defaultCluster.dockerRootDir)
|
||||
|
||||
if (!get(this, 'isEdit')) {
|
||||
this.windowsSupportChange()
|
||||
}
|
||||
|
||||
if (get(this, 'isEdit')) {
|
||||
if (get(this, 'config.network.options.flannel_backend_type')) {
|
||||
set(this, 'windowsSupport', true)
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
|
@ -186,8 +199,9 @@ export default InputTextFile.extend(ClusterDriver, {
|
|||
strategy: 'x509',
|
||||
}),
|
||||
network: globalStore.createRecord({
|
||||
type: 'networkConfig',
|
||||
plugin: 'canal',
|
||||
type: 'networkConfig',
|
||||
plugin: 'canal',
|
||||
options: { flannel_backend_type: null, },
|
||||
}),
|
||||
ingress: globalStore.createRecord({
|
||||
type: 'ingressConfig',
|
||||
|
|
@ -231,6 +245,43 @@ export default InputTextFile.extend(ClusterDriver, {
|
|||
}
|
||||
}),
|
||||
|
||||
windowsSupportChange: observer('windowsSupport', function() {
|
||||
const windowsSupport = get(this, 'windowsSupport')
|
||||
|
||||
if (windowsSupport) {
|
||||
let res = NETWORKCHOICES.filter((n) => n.value === 'flannel')
|
||||
|
||||
setProperties(this, {
|
||||
networkContent: res,
|
||||
'config.network.plugin': 'flannel',
|
||||
'config.network.options.flannel_backend_type': 'host-gw',
|
||||
})
|
||||
} else {
|
||||
setProperties(this, {
|
||||
networkContent: NETWORKCHOICES,
|
||||
'config.network.options.flannel_backend_type': null,
|
||||
})
|
||||
}
|
||||
}),
|
||||
|
||||
isLinuxChanged: observer('isLinux', function() {
|
||||
if (get(this, 'nodeWhich') !== 'custom') {
|
||||
return
|
||||
}
|
||||
const mode = get(this, 'mode')
|
||||
const isLinux = get(this, 'isLinux')
|
||||
|
||||
if (mode === 'edit') {
|
||||
if (!isLinux) {
|
||||
setProperties(this, {
|
||||
controlplane: false,
|
||||
etcd: false,
|
||||
worker: true,
|
||||
})
|
||||
}
|
||||
}
|
||||
}),
|
||||
|
||||
versionChoices: computed('initialVersion', `settings.${ C.SETTING.VERSIONS_K8S }`, 'config.kubernetesVersion', function() {
|
||||
const versions = JSON.parse(get(this, `settings.${ C.SETTING.VERSIONS_K8S }`) || '{}');
|
||||
|
||||
|
|
@ -296,7 +347,7 @@ export default InputTextFile.extend(ClusterDriver, {
|
|||
return cur - orig;
|
||||
}),
|
||||
|
||||
command: computed('labels', 'token.nodeCommand', 'etcd', 'controlplane', 'worker', 'address', 'internalAddress', 'nodeName', function() {
|
||||
command: computed('labels', 'token.nodeCommand', 'token.windowsNodeCommand', 'etcd', 'controlplane', 'worker', 'address', 'internalAddress', 'nodeName', 'isLinux', function() {
|
||||
let out = get(this, 'token.nodeCommand');
|
||||
|
||||
if ( !out ) {
|
||||
|
|
@ -333,6 +384,24 @@ export default InputTextFile.extend(ClusterDriver, {
|
|||
out += ` --label ${ key }=${ labels[key] }`;
|
||||
});
|
||||
|
||||
if (!get(this, 'isLinux')) {
|
||||
out = get(this, 'token.windowsNodeCommand') || ''
|
||||
out = out.replace('--isolation hyperv ', '')
|
||||
let addressCmd = ''
|
||||
|
||||
if (address) {
|
||||
addressCmd += ` -address ${ address }`
|
||||
}
|
||||
|
||||
if (internalAddress) {
|
||||
addressCmd += ` -internalAddress ${ internalAddress }`
|
||||
}
|
||||
|
||||
if (addressCmd) {
|
||||
out = out.replace(`; if($?)`, `${ addressCmd }; if($?)`)
|
||||
}
|
||||
}
|
||||
|
||||
return out;
|
||||
}),
|
||||
|
||||
|
|
|
|||
|
|
@ -35,6 +35,25 @@
|
|||
</div>
|
||||
{{copy-to-clipboard tooltipText="" buttonText="copyToClipboard.tooltip" clipboardText=value class="with-clip"}}
|
||||
{{else}}
|
||||
{{#if (eq nodeWhich 'custom')}}
|
||||
<div class="row">
|
||||
<div class="col span-4">
|
||||
<label class="acc-label">{{t 'clusterNew.rke.windowsSupport.label'}}</label>
|
||||
<div class="radio">
|
||||
<label>
|
||||
{{radio-button selection=windowsSupport value=false }}
|
||||
{{t 'generic.disabled'}}
|
||||
</label>
|
||||
</div>
|
||||
<div class="radio">
|
||||
<label>
|
||||
{{radio-button selection=windowsSupport value=true }}
|
||||
{{t 'generic.enabled'}}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
<div class="row">
|
||||
<div class="col span-4">
|
||||
<label class="acc-label">{{t 'clusterNew.rke.version.label'}}</label>
|
||||
|
|
@ -48,7 +67,7 @@
|
|||
<label class="acc-label">{{t 'clusterNew.rke.network.label'}}</label>
|
||||
{{new-select
|
||||
classNames="form-control"
|
||||
content=networkChoices
|
||||
content=networkContent
|
||||
localizedLabel=true
|
||||
value=cluster.rancherKubernetesEngineConfig.network.plugin
|
||||
disabled=isEdit
|
||||
|
|
@ -201,8 +220,35 @@
|
|||
{{/if}}
|
||||
|
||||
{{#if (and isCustom (eq step 2)) }}
|
||||
|
||||
{{#accordion-list showExpandAll=false as |al expandFn|}}
|
||||
{{#if windowsSupport}}
|
||||
{{#accordion-list-item
|
||||
title=(t 'clusterNew.rke.system.title')
|
||||
detail=(t 'clusterNew.rke.system.detail')
|
||||
expandOnInit=true
|
||||
expandAll=al.expandAll
|
||||
expand=(action expandFn)
|
||||
}}
|
||||
<div class="row">
|
||||
<div class="col span-6 text-center mt-0 mb-0">
|
||||
<div class="radio">
|
||||
<label>
|
||||
{{radio-button selection=isLinux value=true}}
|
||||
Linux
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col span-6 text-center mt-0 mb-0">
|
||||
<div class="radio">
|
||||
<label>
|
||||
{{radio-button selection=isLinux value=false}}
|
||||
Windows
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{/accordion-list-item}}
|
||||
{{/if}}
|
||||
{{#accordion-list-item
|
||||
title=(t 'clusterNew.rke.role.pageheader')
|
||||
detail=(t 'clusterNew.rke.info.text')
|
||||
|
|
@ -225,13 +271,13 @@
|
|||
<li>
|
||||
<div class="row">
|
||||
<div class="col span-4 text-center mt-0 mb-0">
|
||||
<label class="p-10 pl-30 pr-30">{{input type="checkbox" checked=etcd}} {{t 'clusterNew.rke.role.header.etcd'}}</label>
|
||||
<label class="p-10 pl-30 pr-30 {{unless isLinux 'text-muted'}}">{{input type="checkbox" checked=etcd disabled=(not isLinux) }} {{t 'clusterNew.rke.role.header.etcd'}}</label>
|
||||
</div>
|
||||
<div class="col span-4 text-center mt-0 mb-0">
|
||||
<label class="p-10 pl-30 pr-30">{{input type="checkbox" checked=controlplane}} {{t 'clusterNew.rke.role.header.controlplane'}}</label>
|
||||
<label class="p-10 pl-30 pr-30 {{unless isLinux 'text-muted'}}">{{input type="checkbox" checked=controlplane disabled=(not isLinux) }} {{t 'clusterNew.rke.role.header.controlplane'}}</label>
|
||||
</div>
|
||||
<div class="col span-4 text-center mt-0 mb-0">
|
||||
<label class="p-10 pl-30 pr-30">{{input type="checkbox" checked=worker}} {{t 'clusterNew.rke.role.header.worker'}}</label>
|
||||
<label class="p-10 pl-30 pr-30">{{input type="checkbox" checked=worker disabled=(not isLinux) }} {{t 'clusterNew.rke.role.header.worker'}}</label>
|
||||
</div>
|
||||
</div>
|
||||
{{#advanced-section advanced=advanced}}
|
||||
|
|
@ -343,7 +389,7 @@
|
|||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
{{t 'clusterNew.rke.command.instructions'}}
|
||||
{{t (if isLinux 'clusterNew.rke.command.instructions' 'clusterNew.rke.command.winInstructions') htmlSafe=true}}
|
||||
{{!-- <p class="help-block">{{t 'clusterNew.rke.labels.detail'}}</p> --}}
|
||||
<ul class="list-unstyled">
|
||||
<li>
|
||||
|
|
@ -364,6 +410,14 @@
|
|||
</section>
|
||||
{{/accordion-list-item}}
|
||||
|
||||
{{#if isLinux}}
|
||||
{{form-user-labels
|
||||
setLabels=(action 'setLabels')
|
||||
expandAll=al.expandAll
|
||||
expand=(action expandFn)
|
||||
detailKey="formUserLabels.nodeDetail"
|
||||
}}
|
||||
{{/if}}
|
||||
{{/accordion-list}}
|
||||
|
||||
{{#if newNodeCount}}
|
||||
|
|
|
|||
|
|
@ -90,7 +90,14 @@ export default Component.extend(ThrottledResize, {
|
|||
|
||||
url = `${ scheme }${ window.location.host }/k8s/clusters/${ clusterId }/api/v1/namespaces/${ namespaceId }/pods/${ podName }/exec`;
|
||||
url += `?container=${ encodeURIComponent(containerName) }&stdout=1&stdin=1&stderr=1&tty=1`;
|
||||
const command = get(instance, 'command') || DEFAULT_COMMAND;
|
||||
let command = get(instance, 'command') || DEFAULT_COMMAND;
|
||||
|
||||
const { node } = instance || {}
|
||||
const system = node.info && node.info.os && node.info.os.operatingSystem || ''
|
||||
|
||||
if (system.startsWith('Windows')) {
|
||||
command = ['cmd']
|
||||
}
|
||||
|
||||
command.forEach((c) => {
|
||||
url += `&command=${ encodeURIComponent(c) }`;
|
||||
|
|
|
|||
|
|
@ -2078,6 +2078,7 @@ clusterNew:
|
|||
text: Editing node options will update the command you will run on your existing machines
|
||||
command:
|
||||
instructions: 'Run this command on one or more existing machines already running a supported version of Docker.'
|
||||
winInstructions: 'Run this command in <code>CMD</code> on one or more existing machines already running a supported version of Docker and windows server version more than <code style="color: #27AA5E; background: rgba(39, 170, 94, 0.15);">1803</code>.'
|
||||
auth:
|
||||
label: Auth Provider
|
||||
x509: x509
|
||||
|
|
@ -2099,6 +2100,8 @@ clusterNew:
|
|||
calico:
|
||||
cloudProvider:
|
||||
label: Cloud Provider
|
||||
type:
|
||||
info: Only support "host-gw" backend
|
||||
ingress:
|
||||
label: Nginx Ingress
|
||||
monitoring:
|
||||
|
|
@ -2159,6 +2162,12 @@ clusterNew:
|
|||
worker: Please select at least one node to use as a worker.
|
||||
dockerRootDir:
|
||||
placeholder: Default directory is {dir}.
|
||||
system:
|
||||
title: Node Operating System
|
||||
detail: The OS of the node which will be added into the cluster
|
||||
windowsSupport:
|
||||
label: Windows Support (Experimental)
|
||||
disabled: Not support {plugin} network provider.
|
||||
custom:
|
||||
label: Custom
|
||||
shortLabel: Custom
|
||||
|
|
|
|||
Loading…
Reference in New Issue