From d422c6049fa0d5c30b42bb64945e75e884da2bf5 Mon Sep 17 00:00:00 2001 From: Janusz Dziurzynski Date: Thu, 11 Aug 2022 18:43:44 -0400 Subject: [PATCH 1/3] Add support for enabling the Dapr extension Signed-off-by: Janusz Dziurzynski --- .../workflows_dep/regressionparams/dapr.json | 15 ++++++++++ bicep/main.bicep | 24 +++++++++++++++ helper/src/components/addonsTab.js | 30 +++++++++++++++++-- helper/src/components/deployTab.js | 3 +- helper/src/config.json | 2 ++ 5 files changed, 70 insertions(+), 4 deletions(-) create mode 100644 .github/workflows_dep/regressionparams/dapr.json diff --git a/.github/workflows_dep/regressionparams/dapr.json b/.github/workflows_dep/regressionparams/dapr.json new file mode 100644 index 000000000..6dca92246 --- /dev/null +++ b/.github/workflows_dep/regressionparams/dapr.json @@ -0,0 +1,15 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "resourceName": { + "value": "az-k8s-dapr" + }, + "agentVMSize": { + "value": "Standard_DS3_v2" + }, + "fluxGitOpsAddon": { + "value": true + } + } +} diff --git a/bicep/main.bicep b/bicep/main.bicep index 2623ecb1f..812d920fc 100644 --- a/bicep/main.bicep +++ b/bicep/main.bicep @@ -1183,6 +1183,30 @@ resource fluxAddon 'Microsoft.KubernetesConfiguration/extensions@2022-04-02-prev } output fluxReleaseNamespace string = fluxGitOpsAddon ? fluxAddon.properties.scope.cluster.releaseNamespace : '' +param daprAddon bool = false +param daprAddon_enableHighAvailability bool = false + +resource daprExtension 'Microsoft.KubernetesConfiguration/extensions@2022-04-02-preview' = if(daprAddon) { + name: 'dapr' + scope: aks + properties: { + extensionType: 'Microsoft.Dapr' + autoUpgradeMinorVersion: true + releaseTrain: 'Stable' + configurationSettings: { + 'global.ha.enabled': daprAddon_enableHighAvailability ? 'true' : 'false' + } + scope: { + cluster: { + releaseNamespace: 'dapr-system' + } + } + configurationProtectedSettings: {} + } +} + +output daprReleaseNamespace string = daprAddon ? daprExtension.properties.scope.cluster.releaseNamespace : '' + /*__ ___. ______ .__ __. __ .___________. ______ .______ __ .__ __. _______ | \/ | / __ \ | \ | | | | | | / __ \ | _ \ | | | \ | | / _____| diff --git a/helper/src/components/addonsTab.js b/helper/src/components/addonsTab.js index 01786bdcd..0d0006abf 100644 --- a/helper/src/components/addonsTab.js +++ b/helper/src/components/addonsTab.js @@ -384,8 +384,32 @@ export default function ({ tabValues, updateFn, featureFlag, invalidArray }) { - - + - ) + + + + Enabling this option installs dapr, but doesn't apply configuration + + updateFn("daprAddon", v)} + label="Install the Dapr AddOn" + /> + updateFn("daprAddon_enableHighAvailability", v)} + label="Enable high availability mode" + /> + + + ); } diff --git a/helper/src/components/deployTab.js b/helper/src/components/deployTab.js index 8e64a0978..c3bfb0f21 100644 --- a/helper/src/components/deployTab.js +++ b/helper/src/components/deployTab.js @@ -88,7 +88,8 @@ export default function DeployTab({ defaults, updateFn, tabValues, invalidArray, ...(addons.csisecret !== "none" && { keyVaultAksCSI: true }), ...(addons.csisecret === 'akvNew' && { keyVaultCreate: true, ...(deploy.kvCertSecretRole && { keyVaultOfficerRolePrincipalId: "$(az ad signed-in-user show --query id --out tsv)"}) }), ...(addons.csisecret !== "none" && addons.keyVaultAksCSIPollInterval !== defaults.addons.keyVaultAksCSIPollInterval && { keyVaultAksCSIPollInterval: addons.keyVaultAksCSIPollInterval }), - ...(addons.fluxGitOpsAddon !== defaults.addons.fluxGitOpsAddon && { fluxGitOpsAddon: addons.fluxGitOpsAddon}) + ...(addons.fluxGitOpsAddon !== defaults.addons.fluxGitOpsAddon && { fluxGitOpsAddon: addons.fluxGitOpsAddon}), + ...(addons.daprAddon !== defaults.addons.daprAddon && { daprAddon: addons.daprAddon }), } const preview_params = { diff --git a/helper/src/config.json b/helper/src/config.json index 153776d18..216522899 100644 --- a/helper/src/config.json +++ b/helper/src/config.json @@ -50,6 +50,8 @@ "DefenderForContainers" : false }, "addons": { + "daprAddon": false, + "daprAddon_enableHighAvailability": false, "fluxGitOpsAddon": false, "networkPolicy": "none", "kedaAddon": false, From cd5496981f5363c3d72193b3cd5a60697deb6533 Mon Sep 17 00:00:00 2001 From: Janusz Dziurzynski Date: Thu, 11 Aug 2022 20:15:02 -0400 Subject: [PATCH 2/3] Add "dapr" to cspell Signed-off-by: Janusz Dziurzynski --- cspell.json | 1 + 1 file changed, 1 insertion(+) diff --git a/cspell.json b/cspell.json index 5bf3832e6..00edb5412 100644 --- a/cspell.json +++ b/cspell.json @@ -41,6 +41,7 @@ "currenttab", "currt", "currv", + "dapr", "Daemonset", "demoapp", "denydefault", From 2d815ea4c0c3b7a147a68c074f1182b85fdb5059 Mon Sep 17 00:00:00 2001 From: Janusz Dziurzynski Date: Fri, 12 Aug 2022 11:37:21 -0400 Subject: [PATCH 3/3] Tweaks based on review feedback Signed-off-by: Janusz Dziurzynski --- .github/workflows_dep/regressionparams/dapr.json | 5 ++++- bicep/main.bicep | 6 ++++-- cspell.json | 1 + helper/src/components/addonsTab.js | 4 ++-- helper/src/components/deployTab.js | 3 ++- helper/src/config.json | 2 +- 6 files changed, 14 insertions(+), 7 deletions(-) diff --git a/.github/workflows_dep/regressionparams/dapr.json b/.github/workflows_dep/regressionparams/dapr.json index 6dca92246..429b073ff 100644 --- a/.github/workflows_dep/regressionparams/dapr.json +++ b/.github/workflows_dep/regressionparams/dapr.json @@ -8,7 +8,10 @@ "agentVMSize": { "value": "Standard_DS3_v2" }, - "fluxGitOpsAddon": { + "daprAddon": { + "value": true + }, + "daprAddonHA": { "value": true } } diff --git a/bicep/main.bicep b/bicep/main.bicep index 812d920fc..274bfb72e 100644 --- a/bicep/main.bicep +++ b/bicep/main.bicep @@ -1183,8 +1183,10 @@ resource fluxAddon 'Microsoft.KubernetesConfiguration/extensions@2022-04-02-prev } output fluxReleaseNamespace string = fluxGitOpsAddon ? fluxAddon.properties.scope.cluster.releaseNamespace : '' +@description('Add the Dapr extension') param daprAddon bool = false -param daprAddon_enableHighAvailability bool = false +@description('Enable high availability (HA) mode for the Dapr control plane') +param daprAddonHA bool = false resource daprExtension 'Microsoft.KubernetesConfiguration/extensions@2022-04-02-preview' = if(daprAddon) { name: 'dapr' @@ -1194,7 +1196,7 @@ resource daprExtension 'Microsoft.KubernetesConfiguration/extensions@2022-04-02- autoUpgradeMinorVersion: true releaseTrain: 'Stable' configurationSettings: { - 'global.ha.enabled': daprAddon_enableHighAvailability ? 'true' : 'false' + 'global.ha.enabled': '${daprAddonHA}' } scope: { cluster: { diff --git a/cspell.json b/cspell.json index 00edb5412..b5a6570df 100644 --- a/cspell.json +++ b/cspell.json @@ -42,6 +42,7 @@ "currt", "currv", "dapr", + "Dapr", "Daemonset", "demoapp", "denydefault", diff --git a/helper/src/components/addonsTab.js b/helper/src/components/addonsTab.js index 0d0006abf..5f4847656 100644 --- a/helper/src/components/addonsTab.js +++ b/helper/src/components/addonsTab.js @@ -405,8 +405,8 @@ export default function ({ tabValues, updateFn, featureFlag, invalidArray }) { disabled={!addons.daprAddon} styles={{ root: { marginLeft: "50px" } }} inputProps={{ "data-testid": "addons-dapr-ha-checkbox" }} - checked={addons.daprAddon_enableHighAvailability} - onChange={(ev, v) => updateFn("daprAddon_enableHighAvailability", v)} + checked={addons.daprAddonHA} + onChange={(ev, v) => updateFn("daprAddonHA", v)} label="Enable high availability mode" /> diff --git a/helper/src/components/deployTab.js b/helper/src/components/deployTab.js index c3bfb0f21..cd4a06a58 100644 --- a/helper/src/components/deployTab.js +++ b/helper/src/components/deployTab.js @@ -90,6 +90,7 @@ export default function DeployTab({ defaults, updateFn, tabValues, invalidArray, ...(addons.csisecret !== "none" && addons.keyVaultAksCSIPollInterval !== defaults.addons.keyVaultAksCSIPollInterval && { keyVaultAksCSIPollInterval: addons.keyVaultAksCSIPollInterval }), ...(addons.fluxGitOpsAddon !== defaults.addons.fluxGitOpsAddon && { fluxGitOpsAddon: addons.fluxGitOpsAddon}), ...(addons.daprAddon !== defaults.addons.daprAddon && { daprAddon: addons.daprAddon }), + ...(addons.daprAddonHA !== defaults.addons.daprAddonHA && { daprAddonHA: addons.daprAddonHA }), } const preview_params = { @@ -517,4 +518,4 @@ az ad sp delete --id $(az ad sp show --id \${rmId[0]} --query id -o tsv) ) -} \ No newline at end of file +} diff --git a/helper/src/config.json b/helper/src/config.json index 216522899..af2163c5f 100644 --- a/helper/src/config.json +++ b/helper/src/config.json @@ -51,7 +51,7 @@ }, "addons": { "daprAddon": false, - "daprAddon_enableHighAvailability": false, + "daprAddonHA": false, "fluxGitOpsAddon": false, "networkPolicy": "none", "kedaAddon": false,