Only allow PNI to be selected if a network policy is selected

rancher/dashboard#4452
This commit is contained in:
Cody Jackson 2022-01-05 13:59:44 -07:00
parent 8882463d22
commit 38503c3640
3 changed files with 16 additions and 2 deletions

View File

@ -321,6 +321,10 @@ export default Component.extend(ClusterDriver, {
if (networkPlugin === 'kubenet' && networkPolicy === 'azure') {
set(this, 'config.networkPolicy', null);
}
if (this.config.networkPolicy === null) {
set(this, 'cluster.enableNetworkPolicy', false)
}
}),
resetIpRanges: observer('config.privateCluster', 'loadBalancerSku', function() {

View File

@ -562,7 +562,7 @@
<Input
@type="checkbox"
@checked={{mut cluster.enableNetworkPolicy}}
@disabled={{editing}}
@disabled={{or editing (not config.networkPolicy)}}
/>
{{t "clusterNew.rke.networkPolicy.label"}}
{{#if editing}}
@ -571,11 +571,20 @@
@model={{t "clusterNew.rke.networkPolicy.editHelp"}}
@tooltipTemplate="tooltip-static"
@aria-describedby="tooltip-base"
@tooltipFor="tooltipNetworkPolicy"
@placement="top"
>
<i class="acc-label icon icon-info"></i>
</TooltipElement>
{{else if (not config.networkPolicy)}}
<TooltipElement
@type="tooltip-basic"
@model={{t "clusterNew.rke.networkPolicy.selectNetworkPolicyHelp"}}
@tooltipTemplate="tooltip-static"
@aria-describedby="tooltip-base"
@placement="top"
>
<i class="acc-label icon icon-info"></i>
</TooltipElement>
{{/if}}
</label>
</div>

View File

@ -4649,6 +4649,7 @@ clusterNew:
networkPolicy:
label: Project Network Isolation
editHelp: The Project Network Isolation option cannot be changed after the cluster is created
selectNetworkPolicyHelp: You must have a Network Policy selected to use Project Network Isolation
nodeName:
detail: Optionally configure the node name as identification instead of the actual hostname
placeholder: e.g. my-worker-node