mirror of https://github.com/rancher/ui.git
Merge pull request #4681 from westlywright/enhc.gkev2.networkconfig
GKE v2 Network Policy Validation
This commit is contained in:
commit
1cc18ed67c
|
|
@ -511,6 +511,78 @@ export default Component.extend(ClusterDriver, {
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
showPolicyConfigWarning: computed('config.clusterAddons.networkPolicyConfig', 'editing', 'model.originalCluster.gkeStatus.upstreamSpec', 'upstreamSpec.clusterAddons.networkPolicyConfig', function() {
|
||||||
|
const upstreamSpec = get(this, 'model.originalCluster.gkeStatus.upstreamSpec');
|
||||||
|
|
||||||
|
if (this.editing && !isEmpty(upstreamSpec)) {
|
||||||
|
const ogNetworkPolicyConfig = get(this, 'upstreamSpec.clusterAddons.networkPolicyConfig') ?? false;
|
||||||
|
const currentNetworkPolicyConfig = get(this, 'config.clusterAddons.networkPolicyConfig') ?? false;
|
||||||
|
|
||||||
|
// if user is turning off show warning
|
||||||
|
if (ogNetworkPolicyConfig && !currentNetworkPolicyConfig) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}),
|
||||||
|
|
||||||
|
showPolicyEnabledWarning: computed('config.networkPolicyEnabled', 'editing', 'model.originalCluster.gkeStatus.upstreamSpec.networkPolicyEnabled', function() {
|
||||||
|
const upstreamSpec = get(this, 'model.originalCluster.gkeStatus.upstreamSpec');
|
||||||
|
|
||||||
|
if (this.editing && !isEmpty(upstreamSpec)) {
|
||||||
|
const ogNetworkPolicyEnabled = get(this, 'model.originalCluster.gkeStatus.upstreamSpec.networkPolicyEnabled') ?? false;
|
||||||
|
const currentNetworkPolicyEnabled = get(this, 'config.networkPolicyEnabled') ?? false;
|
||||||
|
|
||||||
|
// if user is turning off show warning
|
||||||
|
if (ogNetworkPolicyEnabled && !currentNetworkPolicyEnabled) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}),
|
||||||
|
|
||||||
|
shouldDisableNetworkPolicyEnabled: computed('config.clusterAddons.networkPolicyConfig', 'config.networkPolicyEnabled', 'editing', 'isNewOrEditable', 'model.originalCluster.gkeStatus.upstreamSpec.clusterAddons.networkPolicyConfig', 'model.originalCluster.gkeStatus.upstreamSpec.networkPolicyEnabled', function() {
|
||||||
|
const currentNetworkPolicyConfig = get(this, 'config.clusterAddons.networkPolicyConfig') ?? false;
|
||||||
|
const ogNetworkPolicyConfig = get(this, 'model.originalCluster.gkeStatus.upstreamSpec.clusterAddons.networkPolicyConfig') ?? false;
|
||||||
|
const ogNetworkPolicyEnabled = get(this, 'model.originalCluster.gkeStatus.upstreamSpec.networkPolicyEnabled') ?? false;
|
||||||
|
|
||||||
|
if (this.isNewOrEditable) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
if (this.editing) {
|
||||||
|
if (!ogNetworkPolicyConfig && !ogNetworkPolicyEnabled) {
|
||||||
|
return true;
|
||||||
|
} else if (!currentNetworkPolicyConfig) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}),
|
||||||
|
|
||||||
|
shouldDisableNetworkPolicyConfig: computed('config.networkPolicyEnabled', 'editing', 'isNewOrEditable', 'model.originalCluster.gkeStatus.upstreamSpec.clusterAddons.networkPolicyConfig', 'model.originalCluster.gkeStatus.upstreamSpec.networkPolicyEnabled', function() {
|
||||||
|
const currentNetworkPolicyEnabled = get(this, 'config.networkPolicyEnabled') ?? false;
|
||||||
|
const ogNetworkPolicyEnabled = get(this, 'model.originalCluster.gkeStatus.upstreamSpec.networkPolicyEnabled') ?? false;
|
||||||
|
const ogNetworkPolicyConfig = get(this, 'model.originalCluster.gkeStatus.upstreamSpec.clusterAddons.networkPolicyConfig') ?? false;
|
||||||
|
|
||||||
|
if (this.isNewOrEditable) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
if (this.editing) {
|
||||||
|
if (currentNetworkPolicyEnabled && !ogNetworkPolicyEnabled ) {
|
||||||
|
return true;
|
||||||
|
} else if (ogNetworkPolicyEnabled && ogNetworkPolicyConfig) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}),
|
||||||
|
|
||||||
hasProvisioned: computed('model.cluster', function() {
|
hasProvisioned: computed('model.cluster', function() {
|
||||||
const cluster = get(this, 'model.cluster');
|
const cluster = get(this, 'model.cluster');
|
||||||
const { state = '', isError = false } = cluster;
|
const { state = '', isError = false } = cluster;
|
||||||
|
|
|
||||||
|
|
@ -275,16 +275,51 @@
|
||||||
{{t "clusterNew.googlegke.useIpAliases.label"}}
|
{{t "clusterNew.googlegke.useIpAliases.label"}}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="checkbox">
|
||||||
|
<label>
|
||||||
|
{{input
|
||||||
|
type="checkbox"
|
||||||
|
checked=config.clusterAddons.networkPolicyConfig
|
||||||
|
disabled=shouldDisableNetworkPolicyConfig
|
||||||
|
}}
|
||||||
|
{{t "clusterNew.googlegke.clusterAddons.networkPolicyConfig"}}
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
<div class="checkbox">
|
<div class="checkbox">
|
||||||
<label>
|
<label>
|
||||||
{{input
|
{{input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
checked=config.networkPolicyEnabled
|
checked=config.networkPolicyEnabled
|
||||||
disabled=(or
|
disabled=shouldDisableNetworkPolicyEnabled
|
||||||
(not isNewOrEditable) cluster.enableNetworkPolicy
|
|
||||||
)
|
|
||||||
}}
|
}}
|
||||||
{{t "clusterNew.googlegke.networkPolicy.label"}}
|
{{t "clusterNew.googlegke.networkPolicy.label"}}
|
||||||
|
{{#if
|
||||||
|
(and
|
||||||
|
editing
|
||||||
|
(and
|
||||||
|
(or
|
||||||
|
model.originalCluster.gkeStatus.upstreamSpec.networkPolicyEnabled
|
||||||
|
model.originalCluster.gkeStatus.upstreamSpec.clusterAddons.networkPolicyConfig
|
||||||
|
)
|
||||||
|
(not
|
||||||
|
(or
|
||||||
|
config.networkPolicyEnabled
|
||||||
|
config.clusterAddons.networkPolicyConfig
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
{{#tooltip-element
|
||||||
|
type="tooltip-basic"
|
||||||
|
model=(t "clusterNew.googlegke.networkPolicy.help")
|
||||||
|
tooltipTemplate="tooltip-static"
|
||||||
|
aria-describedby="tooltip-base"
|
||||||
|
tooltipFor="tooltipLink"
|
||||||
|
}}
|
||||||
|
<i class="icon icon-info"></i>
|
||||||
|
{{/tooltip-element}}
|
||||||
|
{{/if}}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="checkbox">
|
<div class="checkbox">
|
||||||
|
|
@ -302,6 +337,14 @@
|
||||||
@message={{t "clusterNew.googlegke.useIpAliases.warning"}}
|
@message={{t "clusterNew.googlegke.useIpAliases.warning"}}
|
||||||
/>
|
/>
|
||||||
{{/unless}}
|
{{/unless}}
|
||||||
|
{{#if (or showPolicyEnabledWarning showPolicyConfigWarning)}}
|
||||||
|
<BannerMessage
|
||||||
|
@icon="icon-alert"
|
||||||
|
@color="bg-warning mb-10"
|
||||||
|
@message={{t "clusterNew.googlegke.policyConfigDisableWarning"
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
@ -489,18 +532,6 @@
|
||||||
{{t "clusterNew.googlegke.clusterAddons.httpLoadBalancing"}}
|
{{t "clusterNew.googlegke.clusterAddons.httpLoadBalancing"}}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="checkbox">
|
|
||||||
<label>
|
|
||||||
{{input
|
|
||||||
type="checkbox"
|
|
||||||
checked=config.clusterAddons.networkPolicyConfig
|
|
||||||
disabled=(or
|
|
||||||
(not isNewOrEditable) cluster.enableNetworkPolicy
|
|
||||||
)
|
|
||||||
}}
|
|
||||||
{{t "clusterNew.googlegke.clusterAddons.networkPolicyConfig"}}
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col span-6">
|
<div class="col span-6">
|
||||||
<label class="acc-label">
|
<label class="acc-label">
|
||||||
|
|
|
||||||
|
|
@ -3918,7 +3918,7 @@ clusterNew:
|
||||||
zone: Zonal
|
zone: Zonal
|
||||||
locations:
|
locations:
|
||||||
label: Additional Zones
|
label: Additional Zones
|
||||||
warning: "Total (in all zones): {totalNodes}"
|
warning: 'Total (in all zones): {totalNodes}'
|
||||||
loggingMonitoringWarning: Logging and Monitoring service options can be created independently, but they may not be updated separately. They must both either be NONE or have their corresponding service set.
|
loggingMonitoringWarning: Logging and Monitoring service options can be created independently, but they may not be updated separately. They must both either be NONE or have their corresponding service set.
|
||||||
loggingService:
|
loggingService:
|
||||||
default: logging.googleapis.com/kubernetes
|
default: logging.googleapis.com/kubernetes
|
||||||
|
|
@ -3965,7 +3965,8 @@ clusterNew:
|
||||||
network:
|
network:
|
||||||
label: Network
|
label: Network
|
||||||
networkPolicy:
|
networkPolicy:
|
||||||
label: Network Policy
|
help: To enable network policy for nodes, first enable network policy for master and apply the update.
|
||||||
|
label: Network Policy for Nodes
|
||||||
nodeCount:
|
nodeCount:
|
||||||
label: Node Count
|
label: Node Count
|
||||||
outsideError: The specified number of nodes in the node pool is outside the specified autoscaling limits
|
outsideError: The specified number of nodes in the node pool is outside the specified autoscaling limits
|
||||||
|
|
@ -4000,6 +4001,7 @@ clusterNew:
|
||||||
default: Allow default access
|
default: Allow default access
|
||||||
full: Allow full access to all Cloud APIs
|
full: Allow full access to all Cloud APIs
|
||||||
label: Access scopes
|
label: Access scopes
|
||||||
|
policyConfigDisableWarning: Disabling "network policy" will remove and recreate all nodes in all node pools. Depending on the specs of the cluster, this could take a significant amount of time.
|
||||||
preemptible:
|
preemptible:
|
||||||
label: Preemptible nodes (beta)
|
label: Preemptible nodes (beta)
|
||||||
warning: Preemptible nodes will live at most 24 hours.
|
warning: Preemptible nodes will live at most 24 hours.
|
||||||
|
|
@ -4057,9 +4059,9 @@ clusterNew:
|
||||||
taskQueue:
|
taskQueue:
|
||||||
label: Task queue
|
label: Task queue
|
||||||
useIpAliases:
|
useIpAliases:
|
||||||
|
error: Use IP Aliases is disabled, a network and subnetwork must be selected.
|
||||||
label: Ip Aliases
|
label: Ip Aliases
|
||||||
warning: When Disabling IP Aliases you must select both a network and subnet.
|
warning: When Disabling IP Aliases you must select both a network and subnet.
|
||||||
error: Use IP Aliases is disabled, a network and subnetwork must be selected.
|
|
||||||
userInfo:
|
userInfo:
|
||||||
label: User Info
|
label: User Info
|
||||||
zone:
|
zone:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue