Skip to content
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

WIP: Add geo-replications to svc and ocp ACRs #995

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
9 changes: 9 additions & 0 deletions dev-infrastructure/configurations/region.tmpl.bicepparam
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
using '../templates/region.bicep'

// general
param globalRegion = '{{ .global.region }}'
param globalResourceGroup = '{{ .global.rg }}'
param regionalRegion = '{{ .region }}'

// acr
param ocpAcrName = '{{ .ocpAcrName }}'
param svcAcrName = '{{ .svcAcrName }}'

// dns
param baseDNSZoneName = '{{ .baseDnsZoneName }}'
param baseDNSZoneResourceGroup = '{{ .baseDnsZoneRG }}'
Expand Down
23 changes: 23 additions & 0 deletions dev-infrastructure/modules/acr/acr-replication.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
@description('ACR replication resource location')
param acrReplicationLocation string

@description('Parent ACR resource name')
param acrReplicationParentAcrName string

@minLength(5)
@maxLength(40)
@description('ACR replication name (must be globally unique)')
param acrReplicationReplicaName string

resource parentAcr 'Microsoft.ContainerRegistry/registries@2023-11-01-preview' existing = {
name: acrReplicationParentAcrName
}

resource acrReplication 'Microsoft.ContainerRegistry/registries/replications@2023-11-01-preview' = {
parent: parentAcr
name: acrReplicationReplicaName
location: acrReplicationLocation
properties: {
regionEndpointEnabled: true
}
}
32 changes: 32 additions & 0 deletions dev-infrastructure/templates/region.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ param baseDNSZoneResourceGroup string = 'global'

param regionalDNSSubdomain string

param globalRegion string
param regionalRegion string
param globalResourceGroup string
param ocpAcrName string
param svcAcrName string

// Tags the resource group
resource subscriptionTags 'Microsoft.Resources/tags@2024-03-01' = {
name: 'default'
Expand Down Expand Up @@ -51,6 +57,32 @@ module regionalZoneDelegation '../modules/dns/zone-delegation.bicep' = {
}
}

//
// R E G I O N A L A C R R E P L I C A T I O N
//

var ocpAcrReplicationName = '${ocpAcrName}${location}replica'
module ocpAcrReplication '../modules/acr/acr-replication.bicep' = if (globalRegion != regionalRegion) {
name: ocpAcrReplicationName
scope: resourceGroup(globalResourceGroup)
params: {
acrReplicationLocation: location
acrReplicationParentAcrName: ocpAcrName
acrReplicationReplicaName: ocpAcrReplicationName
}
}

var svcAcrReplicationName = '${svcAcrName}${location}replica'
module svcAcrReplication '../modules/acr/acr-replication.bicep' = if (globalRegion != regionalRegion) {
name: svcAcrReplicationName
scope: resourceGroup(globalResourceGroup)
params: {
acrReplicationLocation: location
acrReplicationParentAcrName: svcAcrName
acrReplicationReplicaName: svcAcrReplicationName
}
}

//
// M A E S T R O
//
Expand Down
Loading