diff --git a/helper/src/components/deployTab.js b/helper/src/components/deployTab.js
index 146e87fd9..9c14bbea0 100644
--- a/helper/src/components/deployTab.js
+++ b/helper/src/components/deployTab.js
@@ -249,26 +249,37 @@ export default function DeployTab({ defaults, updateFn, tabValues, invalidArray,
}).join('')
const post_deployBASHcmd = `\n\n# Deploy charts into cluster\n` +
- (deploy.selectedTemplate === "local" ? `bash .${ cluster.apisecurity === "private" ? '' : '/postdeploy/scripts'}/postdeploy.sh ` : `curl -sL ${deployRelease.postBASH_url} | bash -s -- `) +
- (deploy.selectedTemplate === 'local' ? (cluster.apisecurity === "private" ? '-r .' : '') : `-r ${deployRelease.base_download_url}`) +
- Object.keys(post_params).map(k => {
- const val = post_params[k]
- const targetVal = Array.isArray(val) ? JSON.stringify(JSON.stringify(val)) : val
- return ` \\\n\t-p ${k}=${targetVal}`
- }).join('')+
- (!deploy.disablePreviews ? preview_post_deployBASHcmd : '')
+ (deploy.selectedTemplate === "local" ? `bash .${ cluster.apisecurity === "private" ? '' : '/postdeploy/scripts'}/postdeploy.sh ` : `curl -sL ${deployRelease.postBASH_url} | bash -s -- `) +
+ (deploy.selectedTemplate === 'local' ? (cluster.apisecurity === "private" ? '-r .' : '') : `-r ${deployRelease.base_download_url}`) +
+ Object.keys(post_params).map(k => {
+ const val = post_params[k]
+ const targetVal = Array.isArray(val) ? JSON.stringify(JSON.stringify(val)) : val
+ return ` \\\n\t-p ${k}=${targetVal}`
+ }).join('')+
+ (!deploy.disablePreviews ? preview_post_deployBASHcmd : '')
- const post_deployBASHstr = cluster.apisecurity !== "private" ?
+ const displayPostCmd =
+ Object.keys(post_params).length >0 || (!deploy.disablePreviews && Object.keys(preview_post_params).length >0)
+
+ const getCredentials =
'# Get credentials for your new AKS cluster & login (interactive)\n' +
`az aks get-credentials -g ${deploy.rg} -n ${aks}\n` +
- 'kubectl get nodes' +
- post_deployBASHcmd
- :
+ 'kubectl get nodes'
+
+ const privateCluster =
'# Private cluster, so use command invoke\n' +
`az aks command invoke -g ${deploy.rg} -n ${aks} --command "` +
post_deployBASHcmd.replaceAll('"', '\\"') +
`\n"${deploy.selectedTemplate === "local" ? ' --file ./postdeploy/scripts/postdeploy.sh --file ./postdeploy/helm/Az-CertManagerIssuer-0.3.0.tgz --file ./postdeploy/k8smanifests/networkpolicy-deny-all.yml --file ./helper/src/dependencies.json' : ''}`
+ const post_deployBASHstr = cluster.apisecurity !== "private" ?
+ (deploy.getCreds || displayPostCmd ?
+ getCredentials + (displayPostCmd ? post_deployBASHcmd : '')
+ :
+ '')
+ :
+ (displayPostCmd) ? privateCluster : ''
+
const networkWatcher = net.nsg && net.nsgFlowLogs !== defaults.net.nsgFlowLogs ?
`# Create Network Watcher Resource Group If It Doesn't Exist\n` +
`if [ $(az group exists --name NetworkWatcherRG) = false ]; then az group create -l ${deploy.location} -n NetworkWatcherRG; fi\n\n` : ''
@@ -284,16 +295,18 @@ export default function DeployTab({ defaults, updateFn, tabValues, invalidArray,
const val = finalParams[k]
const targetVal = Array.isArray(val) ? JSON.stringify(JSON.stringify(val)) : val
return ` \\\n\t${k}=${targetVal}`
- }).join('') + '\n\n' + (Object.keys(post_params).length >0 || (!deploy.disablePreviews && Object.keys(preview_post_params).length >0) ? post_deployBASHstr : '')
+ }).join('') +
+ '\n\n' +
+ (displayPostCmd || deploy.getCreds ? post_deployBASHstr : '')
- //Powershell (Remember to align any changes with Bash)
- const preview_post_deployPScmd = Object.keys(preview_post_params).map(k => {
- const val = preview_post_params[k]
- const targetVal = Array.isArray(val) ? JSON.stringify(JSON.stringify(val)) : val
- return ` \`\n\t-${k} ${targetVal}`
- }).join('')
+ //Powershell (Remember to align any changes with Bash)
+ const preview_post_deployPScmd = Object.keys(preview_post_params).map(k => {
+ const val = preview_post_params[k]
+ const targetVal = Array.isArray(val) ? JSON.stringify(JSON.stringify(val)) : val
+ return ` \`\n\t-${k} ${targetVal}`
+ }).join('')
- const post_deployPScmd = `\n\n# Deploy charts into cluster\n` +
+ const post_deployPScmd = `\n\n# Deploy charts into cluster\n` +
(deploy.selectedTemplate === "local" ? ` .${ cluster.apisecurity === "private" ? '' : '/postdeploy/scripts'}/postdeploy.ps1 ` : `& $([scriptblock]::Create((New-Object Net.WebClient).DownloadString("${deployRelease.postPS_url}")))`) +
(deploy.selectedTemplate === 'local' ? (cluster.apisecurity === "private" ? '-r .' : '') : ` -releace_version="${deployRelease.base_download_url}"`) +
Object.keys(post_params).map(k => {
@@ -303,15 +316,15 @@ export default function DeployTab({ defaults, updateFn, tabValues, invalidArray,
}).join('')+
(!deploy.disablePreviews ? preview_post_deployPScmd : '')
+ const post_deployPSstr = cluster.apisecurity !== "private" ?
+ (deploy.getCreds || displayPostCmd ?
+ getCredentials + (displayPostCmd ? post_deployPScmd : '')
+ :
+ '')
+ :
+ (displayPostCmd) ? privateCluster : ''
- //Below used when not a private cluster (used further below the BASH postdeploy script if a private cluster)
- const post_deployPSstr =
- '# Get credentials for your new AKS cluster & login (interactive)\n' +
- `az aks get-credentials -g ${deploy.rg} -n ${aks}\n` +
- 'kubectl get nodes' +
- post_deployPScmd
-
- const deployPScmd =
+ const deployPScmd =
`# Create Resource Group\n` +
`az group create -l ${deploy.location} -n ${deploy.rg}\n\n` + networkWatcher +
`# Deploy template with in-line parameters\n` +
@@ -320,8 +333,9 @@ export default function DeployTab({ defaults, updateFn, tabValues, invalidArray,
const val = finalParams[k]
const targetVal = Array.isArray(val) ? JSON.stringify(JSON.stringify(val)).replaceAll('"[\\', '\'[').replaceAll('\\"]"', '"]\'').replaceAll('\\",\\"','","') : val
return ` \`\n\t${k}=${targetVal}`
- }).join('') + '\n\n' + (Object.keys(post_params).length >0 || (!deploy.disablePreviews && Object.keys(preview_post_params).length >0) ? cluster.apisecurity !== "private" ? post_deployPSstr: post_deployBASHstr : '')
-
+ }).join('') +
+ '\n\n' +
+ (displayPostCmd || deploy.getCreds ? post_deployPSstr : '')
//Terraform
const deployTfcmd = `#download the *.tf files and run these commands to deploy using terraform\n#for more AKS Construction samples of deploying with terraform, see https://aka.ms/aksc/terraform\n\nterraform fmt\nterraform init\nterraform validate\nterraform plan -out main.tfplan\nterraform apply main.tfplan\nterraform output`
@@ -451,6 +465,12 @@ az role assignment create --role "Managed Identity Operator" --assignee-principa
{ deploy.keyVaultIPAllowlist && net.vnetprivateend && "Add current IP to KeyVault firewall" will enable KeyVaults PublicNetworkAccess property }
+
+
+ updateFn("getCreds", v)} label="Always show the 'az aks get-credentials' command to quickly connect to your new cluster" />
+
+
+
updateFn("enableTelemetry", v)} label="Enable telemetry feedback to Microsoft" />
diff --git a/helper/src/config.json b/helper/src/config.json
index b43215c31..6af967804 100644
--- a/helper/src/config.json
+++ b/helper/src/config.json
@@ -28,7 +28,8 @@
"githubrepo": "",
"githubrepobranch": "main",
"deployItemKey": "deployArmCli",
- "workloadDeployCommands" : []
+ "workloadDeployCommands" : [],
+ "getCreds" : true
},
"cluster": {
"keyVaultKmsByoRG": "",