-
Notifications
You must be signed in to change notification settings - Fork 437
[Modules] Added module for Redis Cache Enterprise and Database #3984
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
187ae41
test
ahmadabdalla 166427d
generated docs
ahmadabdalla 183b58a
updated redis
ahmadabdalla 7cdf759
updated redis with databases
ahmadabdalla 3172bd3
updated params
ahmadabdalla 4094bc3
added geo replication support
ahmadabdalla 5a858b4
Merge branch 'main' into users/ahmad/redisE
ahmadabdalla 331973c
Updated geo
ahmadabdalla 8a7b2c2
updated tests
ahmadabdalla 28c6c2a
updated templates
ahmadabdalla 71a644c
Merge remote-tracking branch 'origin/main' into users/ahmad/redisE
ahmadabdalla 43654ed
Updated test cases
ahmadabdalla 824080d
updated readmes and added RBAC
ahmadabdalla 829edef
updated main.json
ahmadabdalla 9cef3c9
Updated doco and tests
ahmadabdalla af709b1
updated JSON
ahmadabdalla f2bf4a2
Updated tests
ahmadabdalla 6f475ca
Updated test cases
ahmadabdalla 276cf36
Updated versions
ahmadabdalla File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| name: 'Cache - Redis Enterprise' | ||
|
|
||
| parameters: | ||
| - name: staticValidation | ||
| displayName: Execute static validation | ||
| type: boolean | ||
| default: true | ||
| - name: deploymentValidation | ||
| displayName: Execute deployment validation | ||
| type: boolean | ||
| default: true | ||
| - name: removeDeployment | ||
| displayName: Remove deployed module | ||
| type: boolean | ||
| default: true | ||
| - name: prerelease | ||
| displayName: Publish prerelease module | ||
| type: boolean | ||
| default: false | ||
|
|
||
| pr: none | ||
|
|
||
| trigger: | ||
| batch: true | ||
| branches: | ||
| include: | ||
| - main | ||
| paths: | ||
| include: | ||
| - '/modules/cache/redis-enterprise/*' | ||
| - '/modules/network/private-endpoint/*' | ||
| - '/.azuredevops/modulePipelines/ms.cache.redisenterprise.yml' | ||
| - '/.azuredevops/pipelineTemplates/*.yml' | ||
| - '/utilities/pipelines/*' | ||
| exclude: | ||
| - '/utilities/pipelines/deploymentRemoval/*' | ||
| - '/**/*.md' | ||
|
|
||
| variables: | ||
| - template: '../../settings.yml' | ||
| - group: 'PLATFORM_VARIABLES' | ||
| - name: modulePath | ||
| value: '/modules/cache/redis-enterprise' | ||
|
|
||
| stages: | ||
| - template: /.azuredevops/pipelineTemplates/stages.module.yml | ||
| parameters: | ||
| staticValidation: '${{ parameters.staticValidation }}' | ||
| deploymentValidation: '${{ parameters.deploymentValidation }}' | ||
| removeDeployment: '${{ parameters.removeDeployment }}' | ||
| prerelease: '${{ parameters.prerelease }}' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| name: 'Cache - Redis Enterprise' | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| staticValidation: | ||
| type: boolean | ||
| description: 'Execute static validation' | ||
| required: false | ||
| default: true | ||
| deploymentValidation: | ||
| type: boolean | ||
| description: 'Execute deployment validation' | ||
| required: false | ||
| default: true | ||
| removeDeployment: | ||
| type: boolean | ||
| description: 'Remove deployed module' | ||
| required: false | ||
| default: true | ||
| prerelease: | ||
| type: boolean | ||
| description: 'Publish prerelease module' | ||
| required: false | ||
| default: false | ||
| push: | ||
| branches: | ||
| - main | ||
| paths: | ||
| - 'modules/cache/redis-enterprise/**' | ||
| - 'modules/network/private-endpoint/**' | ||
| - '.github/actions/templates/**' | ||
| - '.github/workflows/template.module.yml' | ||
| - '.github/workflows/ms.cache.redisenterprise.yml' | ||
| - 'utilities/pipelines/**' | ||
| - '!utilities/pipelines/deploymentRemoval/**' | ||
| - '!*/**/README.md' | ||
|
|
||
| env: | ||
| modulePath: 'modules/cache/redis-enterprise' | ||
| workflowPath: '.github/workflows/ms.cache.redisenterprise.yml' | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }} | ||
|
|
||
| jobs: | ||
| ########################### | ||
| # Initialize pipeline # | ||
| ########################### | ||
| job_initialize_pipeline: | ||
| runs-on: ubuntu-20.04 | ||
| name: 'Initialize pipeline' | ||
| steps: | ||
| - name: 'Checkout' | ||
| uses: actions/checkout@v3 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: 'Set input parameters to output variables' | ||
| id: get-workflow-param | ||
| uses: ./.github/actions/templates/getWorkflowInput | ||
| with: | ||
| workflowPath: '${{ env.workflowPath}}' | ||
| - name: 'Get parameter file paths' | ||
| id: get-module-test-file-paths | ||
| uses: ./.github/actions/templates/getModuleTestFiles | ||
| with: | ||
| modulePath: '${{ env.modulePath }}' | ||
| outputs: | ||
| workflowInput: ${{ steps.get-workflow-param.outputs.workflowInput }} | ||
| moduleTestFilePaths: ${{ steps.get-module-test-file-paths.outputs.moduleTestFilePaths }} | ||
| modulePath: '${{ env.modulePath }}' | ||
|
|
||
| ############################## | ||
| # Call reusable workflow # | ||
| ############################## | ||
| call-workflow-passing-data: | ||
| name: 'Module' | ||
| needs: | ||
| - job_initialize_pipeline | ||
| uses: ./.github/workflows/template.module.yml | ||
| with: | ||
| workflowInput: '${{ needs.job_initialize_pipeline.outputs.workflowInput }}' | ||
| moduleTestFilePaths: '${{ needs.job_initialize_pipeline.outputs.moduleTestFilePaths }}' | ||
| modulePath: '${{ needs.job_initialize_pipeline.outputs.modulePath}}' | ||
| secrets: inherit |
69 changes: 69 additions & 0 deletions
69
modules/cache/redis-enterprise/.bicep/nested_roleAssignments.bicep
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| @sys.description('Required. The IDs of the principals to assign the role to.') | ||
| param principalIds array | ||
|
|
||
| @sys.description('Required. The name of the role to assign. If it cannot be found you can specify the role definition ID instead.') | ||
| param roleDefinitionIdOrName string | ||
|
|
||
| @sys.description('Required. The resource ID of the resource to apply the role assignment to.') | ||
| param resourceId string | ||
|
|
||
| @sys.description('Optional. The principal type of the assigned principal ID.') | ||
| @allowed([ | ||
| 'ServicePrincipal' | ||
| 'Group' | ||
| 'User' | ||
| 'ForeignGroup' | ||
| 'Device' | ||
| '' | ||
| ]) | ||
| param principalType string = '' | ||
|
|
||
| @sys.description('Optional. The description of the role assignment.') | ||
| param description string = '' | ||
|
|
||
| @sys.description('Optional. The conditions on the role assignment. This limits the resources it can be assigned to. e.g.: @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase "foo_storage_container".') | ||
| param condition string = '' | ||
|
|
||
| @sys.description('Optional. Version of the condition.') | ||
| @allowed([ | ||
| '2.0' | ||
| ]) | ||
| param conditionVersion string = '2.0' | ||
|
|
||
| @sys.description('Optional. Id of the delegated managed identity resource.') | ||
| param delegatedManagedIdentityResourceId string = '' | ||
|
|
||
| var builtInRoleNames = { | ||
| Contributor: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'b24988ac-6180-42a0-ab88-20f7382dd24c') | ||
| 'Log Analytics Contributor': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '92aaf0da-9dab-42b6-94a3-d43ce8d16293') | ||
| 'Log Analytics Reader': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '73c42c96-874c-492b-b04d-ab87d138a893') | ||
| 'Managed Application Contributor Role': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '641177b8-a67a-45b9-a033-47bc880bb21e') | ||
| 'Managed Application Operator Role': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'c7393b34-138c-406f-901b-d8cf2b17e6ae') | ||
| 'Managed Applications Reader': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'b9331d33-8a36-4f8c-b097-4f54124fdb44') | ||
| 'Monitoring Contributor': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '749f88d5-cbae-40b8-bcfc-e573ddc772fa') | ||
| 'Monitoring Reader': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '43d0d8ad-25c7-4714-9337-8ba259a9fe05') | ||
| Owner: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '8e3af657-a8ff-443c-a75c-2fe8c4bcb635') | ||
| Reader: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'acdd72a7-3385-48ef-bd42-f606fba81ae7') | ||
| 'Redis Cache Contributor': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'e0f68234-74aa-48ed-b826-c38b57376e17') | ||
| 'Resource Policy Contributor': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '36243c78-bf99-498c-9df9-86d9f8d28608') | ||
| 'Role Based Access Control Administrator (Preview)': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'f58310d9-a9f6-439a-9e8d-f62e7b41a168') | ||
| 'User Access Administrator': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '18d7d88d-d35e-4fb5-a5c3-7773c20a72d9') | ||
| } | ||
|
|
||
| resource redisCacheEnterprise 'Microsoft.Cache/redisEnterprise@2022-01-01' existing = { | ||
| name: last(split(resourceId, '/'))! | ||
| } | ||
|
|
||
| resource roleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = [for principalId in principalIds: { | ||
| name: guid(redisCacheEnterprise.id, principalId, roleDefinitionIdOrName) | ||
| properties: { | ||
| description: description | ||
| roleDefinitionId: contains(builtInRoleNames, roleDefinitionIdOrName) ? builtInRoleNames[roleDefinitionIdOrName] : roleDefinitionIdOrName | ||
| principalId: principalId | ||
| principalType: !empty(principalType) ? any(principalType) : null | ||
| condition: !empty(condition) ? condition : null | ||
| conditionVersion: !empty(conditionVersion) && !empty(condition) ? conditionVersion : null | ||
| delegatedManagedIdentityResourceId: !empty(delegatedManagedIdentityResourceId) ? delegatedManagedIdentityResourceId : null | ||
| } | ||
| scope: redisCacheEnterprise | ||
| }] |
60 changes: 60 additions & 0 deletions
60
modules/cache/redis-enterprise/.test/common/dependencies.bicep
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| @description('Optional. The location to deploy resources to.') | ||
| param location string = resourceGroup().location | ||
|
|
||
| @description('Required. The name of the Virtual Network to create.') | ||
| param virtualNetworkName string | ||
|
|
||
| @description('Required. The name of the Managed Identity to create.') | ||
| param managedIdentityName string | ||
|
|
||
| var addressPrefix = '10.0.0.0/16' | ||
|
|
||
| resource virtualNetwork 'Microsoft.Network/virtualNetworks@2023-04-01' = { | ||
| name: virtualNetworkName | ||
| location: location | ||
| properties: { | ||
| addressSpace: { | ||
| addressPrefixes: [ | ||
| addressPrefix | ||
| ] | ||
| } | ||
| subnets: [ | ||
| { | ||
| name: 'defaultSubnet' | ||
| properties: { | ||
| addressPrefix: cidrSubnet(addressPrefix, 16, 0) | ||
| } | ||
| } | ||
| ] | ||
| } | ||
| } | ||
|
|
||
| resource privateDNSZone 'Microsoft.Network/privateDnsZones@2020-06-01' = { | ||
| name: 'privatelink.redisenterprise.cache.azure.net' | ||
| location: 'global' | ||
|
|
||
| resource virtualNetworkLinks 'virtualNetworkLinks@2020-06-01' = { | ||
| name: '${virtualNetwork.name}-vnetlink' | ||
| location: 'global' | ||
| properties: { | ||
| virtualNetwork: { | ||
| id: virtualNetwork.id | ||
| } | ||
| registrationEnabled: false | ||
| } | ||
| } | ||
| } | ||
|
|
||
| resource managedIdentity 'Microsoft.ManagedIdentity/userAssignedIdentities@2018-11-30' = { | ||
| name: managedIdentityName | ||
| location: location | ||
| } | ||
|
|
||
| @description('The resource ID of the created Virtual Network Subnet.') | ||
| output subnetResourceId string = virtualNetwork.properties.subnets[0].id | ||
|
|
||
| @description('The resource ID of the created Private DNS Zone.') | ||
| output privateDNSResourceId string = privateDNSZone.id | ||
|
|
||
| @description('The principal ID of the created Managed Identity.') | ||
| output managedIdentityPrincipalId string = managedIdentity.properties.principalId |
125 changes: 125 additions & 0 deletions
125
modules/cache/redis-enterprise/.test/common/main.test.bicep
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,125 @@ | ||
| targetScope = 'subscription' | ||
|
|
||
| // ========== // | ||
| // Parameters // | ||
| // ========== // | ||
|
|
||
| @description('Optional. The name of the resource group to deploy for testing purposes.') | ||
| @maxLength(90) | ||
| param resourceGroupName string = 'ms.cache.redisenterprise-${serviceShort}-rg' | ||
|
|
||
| @description('Optional. The location to deploy resources to.') | ||
| param location string = deployment().location | ||
|
|
||
| @description('Optional. A short identifier for the kind of deployment. Should be kept short to not run into resource-name length-constraints.') | ||
| param serviceShort string = 'crecom' | ||
|
|
||
| @description('Optional. Enable telemetry via a Globally Unique Identifier (GUID).') | ||
| param enableDefaultTelemetry bool = true | ||
|
|
||
| @description('Optional. A token to inject into the name of each resource.') | ||
| param namePrefix string = '[[namePrefix]]' | ||
|
|
||
| // ============ // | ||
| // Dependencies // | ||
| // ============ // | ||
|
|
||
| // General resources | ||
| // ================= | ||
| resource resourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' = { | ||
| name: resourceGroupName | ||
| location: location | ||
| } | ||
|
|
||
| module nestedDependencies 'dependencies.bicep' = { | ||
| scope: resourceGroup | ||
| name: '${uniqueString(deployment().name, location)}-nestedDependencies' | ||
| params: { | ||
| virtualNetworkName: 'dep-${namePrefix}-vnet-${serviceShort}' | ||
| managedIdentityName: 'dep-${namePrefix}-msi-ds-${serviceShort}' | ||
| } | ||
| } | ||
|
|
||
| // Diagnostics | ||
| // =========== | ||
| module diagnosticDependencies '../../../../.shared/.templates/diagnostic.dependencies.bicep' = { | ||
| scope: resourceGroup | ||
| name: '${uniqueString(deployment().name, location)}-diagnosticDependencies' | ||
| params: { | ||
| storageAccountName: 'dep${namePrefix}diasa${serviceShort}01' | ||
| logAnalyticsWorkspaceName: 'dep-${namePrefix}-law-${serviceShort}' | ||
| eventHubNamespaceEventHubName: 'dep-${namePrefix}-evh-${serviceShort}' | ||
| eventHubNamespaceName: 'dep-${namePrefix}-evhns-${serviceShort}' | ||
| location: location | ||
| } | ||
| } | ||
|
|
||
| // ============== // | ||
| // Test Execution // | ||
| // ============== // | ||
|
|
||
| module testDeployment '../../main.bicep' = { | ||
| scope: resourceGroup | ||
| name: '${uniqueString(deployment().name, location)}-test-${serviceShort}' | ||
| params: { | ||
| enableDefaultTelemetry: enableDefaultTelemetry | ||
| name: '${namePrefix}${serviceShort}001' | ||
| capacity: 2 | ||
| diagnosticStorageAccountId: diagnosticDependencies.outputs.storageAccountResourceId | ||
| diagnosticWorkspaceId: diagnosticDependencies.outputs.logAnalyticsWorkspaceResourceId | ||
| diagnosticEventHubAuthorizationRuleId: diagnosticDependencies.outputs.eventHubAuthorizationRuleId | ||
| diagnosticEventHubName: diagnosticDependencies.outputs.eventHubNamespaceEventHubName | ||
| diagnosticSettingsName: 'redisdiagnostics' | ||
| lock: 'CanNotDelete' | ||
| roleAssignments: [ | ||
| { | ||
| roleDefinitionIdOrName: 'Reader' | ||
| principalIds: [ | ||
| nestedDependencies.outputs.managedIdentityPrincipalId | ||
| ] | ||
| principalType: 'ServicePrincipal' | ||
| } | ||
| ] | ||
| minimumTlsVersion: '1.2' | ||
| zoneRedundant: true | ||
| privateEndpoints: [ | ||
| { | ||
| privateDnsZoneGroup: { | ||
| privateDNSResourceIds: [ | ||
| nestedDependencies.outputs.privateDNSResourceId | ||
| ] | ||
| } | ||
| service: 'redisEnterprise' | ||
| subnetResourceId: nestedDependencies.outputs.subnetResourceId | ||
| tags: { | ||
| 'hidden-title': 'This is visible in the resource name' | ||
| Environment: 'Non-Prod' | ||
| Role: 'DeploymentValidation' | ||
| } | ||
| } | ||
| ] | ||
| databases: [ | ||
| { | ||
| clusteringPolicy: 'EnterpriseCluster' | ||
| evictionPolicy: 'AllKeysLFU' | ||
| modules: [ | ||
| { | ||
| name: 'RedisBloom' | ||
| } | ||
| { | ||
| name: 'RedisTimeSeries' | ||
| args: 'RETENTION_POLICY 20' | ||
| } | ||
| ] | ||
| persistenceAofEnabled: true | ||
| persistenceAofFrequency: '1s' | ||
| persistenceRdbEnabled: false | ||
| port: 10000 | ||
| } | ||
| ] | ||
| tags: { | ||
| 'hidden-title': 'This is visible in the resource name' | ||
| resourceType: 'Redis Cache Enterprise' | ||
| } | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.