Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/models/cluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ export const DEFAULT_GKE_NODE_POOL_CONFIG = {
},
initialNodeCount: 3,
management: {
autoRepair: false,
autoUpgrade: false,
autoRepair: true,
autoUpgrade: true,
},
maxPodsConstraint: 110,
name: null,
Expand Down
20 changes: 0 additions & 20 deletions lib/shared/addon/components/cluster-driver/driver-gke/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,6 @@ import { DEFAULT_GKE_CONFIG, DEFAULT_GKE_NODE_POOL_CONFIG } from 'ui/models/clus
import layout from './template';
import Semver from 'semver';

const MIN_MAX = {
clusterIpv4Cidr: {
max: 9,
min: 19
},
clusterIpv4CidrBlock: {
max: 9,
min: 24
},
nodeIpv4CidrBlock: {
max: 8,
min: 29
},
servicesIpv4CidrBlock: {
max: 16,
min: 27
}
}

export default Component.extend(ClusterDriver, {
google: service(),
intl: service(),
Expand All @@ -55,7 +36,6 @@ export default Component.extend(ClusterDriver, {
clusterLocationSaved: false,
clusterLocationSaving: false,
showLogMonServiceWarning: false,
minMaxRanges: MIN_MAX,

defalutNodePoolConfig: DEFAULT_GKE_NODE_POOL_CONFIG,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,26 +312,16 @@
{{t
"clusterNew.googlegke.ipAllocationPolicy.clusterIpv4CidrBlock.accesslabel"
}}
<p class="inline help-block">
{{t
"clusterNew.googlegke.ipAllocationPolicy.minMax"
min=minMaxRanges.clusterIpv4CidrBlock.min
max=minMaxRanges.clusterIpv4CidrBlock.max
}}
</p>
</label>
<InputOrDisplay
@editable={{isNew}}
@value={{config.ipAllocationPolicy.clusterIpv4CidrBlock}}
>
<InputCidr
@disabled={{not config.ipAllocationPolicy.useIpAliases}}
@maxSize={{minMaxRanges.clusterIpv4CidrBlock.max}}
@minSize={{minMaxRanges.clusterIpv4CidrBlock.min}}
@placeholder={{t
"clusterNew.googlegke.ipAllocationPolicy.clusterIpv4CidrBlock.placeholder"
}}
@validateMinMax={{true}}
@value={{mut config.ipAllocationPolicy.clusterIpv4CidrBlock}}
/>
</InputOrDisplay>
Expand All @@ -342,26 +332,16 @@
<div class="col span-6">
<label class="acc-label">
{{t "clusterNew.googlegke.ipPolicyNodeIpv4CidrBlock.label"}}
<p class="inline help-block">
{{t
"clusterNew.googlegke.ipAllocationPolicy.minMax"
min=minMaxRanges.nodeIpv4CidrBlock.min
max=minMaxRanges.nodeIpv4CidrBlock.max
}}
</p>
</label>
<InputOrDisplay
@editable={{isNew}}
@value={{config.ipAllocationPolicy.nodeIpv4CidrBlock}}
>
<InputCidr
@disabled={{not config.ipAllocationPolicy.createSubnetwork}}
@maxSize={{minMaxRanges.nodeIpv4CidrBlock.max}}
@minSize={{minMaxRanges.nodeIpv4CidrBlock.min}}
@placeholder={{t
"clusterNew.googlegke.ipPolicyNodeIpv4CidrBlock.placeholder"
}}
@validateMinMax={{true}}
@value={{mut config.ipAllocationPolicy.nodeIpv4CidrBlock}}
/>
</InputOrDisplay>
Expand Down Expand Up @@ -393,26 +373,16 @@
<div class="col span-6">
<label class="acc-label">
{{t "clusterNew.googlegke.ipPolicyServicesIpv4CidrBlock.label"}}
<p class="inline help-block">
{{t
"clusterNew.googlegke.ipAllocationPolicy.minMax"
min=minMaxRanges.servicesIpv4CidrBlock.min
max=minMaxRanges.servicesIpv4CidrBlock.max
}}
</p>
</label>
<InputOrDisplay
@editable={{isNew}}
@value={{config.ipAllocationPolicy.servicesIpv4CidrBlock}}
>
<InputCidr
@disabled={{not config.ipAllocationPolicy.useIpAliases}}
@maxSize={{minMaxRanges.servicesIpv4CidrBlock.max}}
@minSize={{minMaxRanges.servicesIpv4CidrBlock.min}}
@placeholder={{t
"clusterNew.googlegke.ipPolicyServicesIpv4CidrBlock.placeholder"
}}
@validateMinMax={{true}}
@value={{mut config.ipAllocationPolicy.servicesIpv4CidrBlock}}
/>
</InputOrDisplay>
Expand All @@ -427,6 +397,7 @@
@isNew={{isNew}}
/>
<CruMasterAuthNetwork
@clusterConfig={{config}}
@config={{mut config.masterAuthorizedNetworks}}
@isNew={{isNew}}
@editing={{editing}}
Expand Down
18 changes: 15 additions & 3 deletions lib/shared/addon/components/cru-master-auth-network/component.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
import Component from '@ember/component';
import { get, observer, set } from '@ember/object';
import layout from './template';

export default Component.extend({
layout,

editing: false,
isNew: true,
config: null,
editing: false,
isNew: true,
config: null,
clusterConfig: null,


privateClusterChanged: observer('clusterConfig.privateClusterConfig.enablePrivateEndpoint', function() {
const config = get(this, 'config') || { enabled: false };
const clusterConfig = get(this, 'clusterConfig') || { privateClusterConfig: { enablePrivateEndpoint: false } };

if (clusterConfig.privateClusterConfig.enablePrivateEndpoint && !config.enabled) {
set(this, 'config.enabled', true);
}
}),
});
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
<div class="form-control-static">
<div class="checkbox">
<label>
{{input type="checkbox" checked=config.enabled disabled=editing}}
{{input
type="checkbox"
checked=config.enabled
disabled=(or editing clusterConfig.privateClusterConfig.enablePrivateEndpoint)
}}
{{t "clusterNew.googlegke.enableMasterAuthorizedNetwork.label"}}
</label>
</div>
Expand Down
10 changes: 9 additions & 1 deletion lib/shared/addon/components/cru-private-cluster/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ export default Component.extend({
defaultConfig: DEFAULT_PRIVATE_CONFIG,

enablePrivateNodesChanged: on('init', observer('config.enablePrivateNodes', function() {
if (this.isDestroyed || this.isDestroying) {
return;
}

const { config } = this;
const {
enablePrivateEndpoint,
Expand All @@ -33,7 +37,11 @@ export default Component.extend({

if (this.isNew && !config?.enablePrivateNodes) {
next(this, () => {
if (config.enablePrivateNodes) {
if (this.isDestroyed || this.isDestroying) {
return;
}

if (!config.enablePrivateNodes) {
set(this, 'config.enablePrivateEndpoint', enablePrivateEndpoint);
}

Expand Down
26 changes: 14 additions & 12 deletions lib/shared/addon/components/cru-private-cluster/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@
</label>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col span-6">
<div class="form-control-static">
<div class="checkbox">
<label>
Expand All @@ -54,14 +50,20 @@
<FieldRequired />
{{/if}}
</label>
{{input
value=config.masterIpv4CidrBlock
placeholder=(t "clusterNew.googlegke.masterIpv4CidrBlock.placeholder")
disabled=(or editing (not config.enablePrivateNodes))
}}
<p class="help-block">
{{t "clusterNew.googlegke.masterIpv4CidrBlock.help"}}
</p>
<div class="form-control-static">
<InputCidr
@value={{mut config.masterIpv4CidrBlock}}
@placeholder={{t
"clusterNew.googlegke.masterIpv4CidrBlock.placeholder"
}}
@disabled={{or editing (not config.enablePrivateNodes)}}
/>
</div>
<div>
<p class="inline help-block">
{{t "clusterNew.googlegke.masterIpv4CidrBlock.help"}}
</p>
</div>
</div>
</div>
</section>
1 change: 1 addition & 0 deletions lib/shared/addon/components/import-command/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
{{t
"clusterNew.import.command.instructionGkeCluster"
appName=settings.appName
docsBase=settings.docsBase
htmlSafe=true
}}
</div>
Expand Down
17 changes: 1 addition & 16 deletions lib/shared/addon/components/input-cidr/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ export default Component.extend({
errorMessage: '',
disabled: null,
placeholder: '10.0.0.0/14',
minSize: 24,
maxSize: 8,
validateMinMax: false,

actions: {
focusOutHandler() {
Expand All @@ -45,19 +42,7 @@ export default Component.extend({
}

try {
const parsed = ipaddr.parseCIDR(value);

if (this.validateMinMax) {
const size = parsed[1];

// ipaddress masks are counter intuitive, larger the number the smaller the mask size. 8 > 24
if (size > this.minSize || size < this.maxSize ) {
setProperties(this, {
invalid: true,
errorMessage: `invalid service address range: netmask must be between ${ this.minSize } and ${ this.maxSize }`,
});
}
}
ipaddr.parseCIDR(value);
} catch (error) {
setProperties(this, {
invalid: true,
Expand Down
9 changes: 4 additions & 5 deletions translations/en-us.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3652,7 +3652,7 @@ clusterNew:
detail: Choose the Google Project ID and Cloud Credential that will be used to launch your cluster.
next: 'Next: Configure Cluster'
projectId:
help: TBD - Needs to match Project Id in Credential
help: Must to match Project Id from Credential JSON
label: Google Project ID
title: Google Account Access
alphaFeatures:
Expand Down Expand Up @@ -3774,7 +3774,6 @@ clusterNew:
detail: Choose a region or zone to import an GKE cluster from
title: Cluster Location
ipAllocationPolicy:
minMax: "(Min: {min}, Max: {max})"
clusterIpv4CidrBlock:
accesslabel: Cluster Pod address range
placeholder: e.g. 10.96.0.0/11
Expand Down Expand Up @@ -3840,7 +3839,7 @@ clusterNew:
placeholder: Your Master Authorized Network CIDR Blocks
masterIpv4CidrBlock:
error: A Master IPV4 CIDR block is required when creating a private cluster
help: Master CIDR block size must be /28
help: Master CIDR block mask must be /28
label: Master IPV4 CIDR Block
placeholder: e.g. 10.42.0.0/28
masterVersion:
Expand Down Expand Up @@ -3899,7 +3898,7 @@ clusterNew:
label: Preemptible nodes (beta)
warning: Preemptible nodes will live at most 24 hours.
privateCluster:
details: GKE private clusters is an advanced and unique use case which requires a special GKE configurations. Before enabling private clusters ensure you have read through the <a href="{docsBase}/cluster-provisioning" target="_blank" rel="nofollow noopener noreferrer">docs TBD</a> for instructions on configuring GKE so private nodes may communicate with {appName}.
details: GKE private clusters is an advanced and unique use case which requires a special GKE configurations. Before enabling private clusters ensure you have read through the <a href="{docsBase}/cluster-provisioning/hosted-kubernetes-clusters/gke/" target="_blank" rel="nofollow noopener noreferrer">GKE cluster provisioning docs</a> for instructions on configuring GKE so private nodes may communicate with {appName}.
privateEndpoint:
help: Control plane may only be accessed via the private IP.
label: Enable Private Endpoint
Expand Down Expand Up @@ -4101,7 +4100,7 @@ clusterNew:
import:
command:
instructionEksCluster: You are creating an EKS cluster that has private API access only. {appName} requires network access to the Kubernetes endpoint to complete cluster creation; You must manually run one of the following commands.
instructionGkeCluster: You are creating a private GKE cluster, nodes in a private cluster do not have public IP addresses. For {appName} to finish setting up your cluster it must be able to speak to your nodes. Follow these <a href="https://rancher.com/docs/rancher/v2.x/" target="_blank" rel="nofollow noopener noreferrer">instructions TBD</a> to configure GKE in a way which allows this access.
instructionGkeCluster: You are creating a private GKE cluster, nodes in a private cluster do not have public IP addresses. For {appName} to finish setting up your cluster it must be able to speak to your nodes. Ensure you follow these <a href="{docsBase}/cluster-provisioning/hosted-kubernetes-clusters/gke/" target="_blank" rel="nofollow noopener noreferrer">private cluster provisioning instructions</a> to configure GKE in a way which allows this access.
instructions: 'Run the kubectl command below on an existing Kubernetes cluster running a supported Kubernetes version to import it into {appName}:'
instructionsAdminRole: >-
<b>Note:</b> If you want to import a Google Kubernetes Engine (GKE) cluster (or any cluster that does not supply you with a kubectl configuration file with the ClusterRole <b>cluster-admin</b> bound to it), you need to bind the ClusterRole <b>cluster-admin</b> using the command below.<br/><br/>Replace <b>[USER_ACCOUNT]</b> with your Google account address (you can retrieve this using <b>gcloud config get-value account</b>). If you are not importing a Google Kubernetes Engine cluster,
Expand Down