зеркало из https://github.com/Azure/ipam.git
Improved logging, minor tweaks to deployment script and documentation
This commit is contained in:
Родитель
3eea9655d9
Коммит
d2ccb87487
|
@ -193,6 +193,7 @@ DynamicParam {
|
|||
$validators = @{
|
||||
functionName = '^(?=^.{2,59}$)([^-][\w-]*[^-])$'
|
||||
appServiceName = '^(?=^.{2,59}$)([^-][\w-]*[^-])$'
|
||||
functionPlanName = '^(?=^.{1,40}$)([\w-]*)$'
|
||||
appServicePlanName = '^(?=^.{1,40}$)([\w-]*)$'
|
||||
cosmosAccountName = '^(?=^.{3,44}$)([^-][a-z0-9-]*[^-])$'
|
||||
cosmosContainerName = '^(?=^.{1,255}$)([^/\\#?]*)$'
|
||||
|
@ -211,11 +212,13 @@ DynamicParam {
|
|||
|
||||
if(-not $Function) {
|
||||
$validators.Remove('functionName')
|
||||
$validators.Remove('functionPlanName')
|
||||
$validators.Remove('storageAccountName')
|
||||
}
|
||||
|
||||
if($Function) {
|
||||
$validators.Remove('appServiceName')
|
||||
$validators.Remove('appServicePlanName')
|
||||
}
|
||||
|
||||
$attrApp = [System.Management.Automation.ParameterAttribute]::new()
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
@description('Function App Name')
|
||||
param functionAppName string
|
||||
|
||||
@description('Function App Plan Name')
|
||||
param functionAppPlanName string
|
||||
@description('Function Plan Name')
|
||||
param functionPlanName string
|
||||
|
||||
@description('CosmosDB URI')
|
||||
param cosmosDbUri string
|
||||
|
@ -50,8 +50,8 @@ resource storageAccount 'Microsoft.Storage/storageAccounts@2021-06-01' existing
|
|||
name: storageAccountName
|
||||
}
|
||||
|
||||
resource functionAppPlan 'Microsoft.Web/serverfarms@2021-02-01' = {
|
||||
name: functionAppPlanName
|
||||
resource functionPlan 'Microsoft.Web/serverfarms@2021-02-01' = {
|
||||
name: functionPlanName
|
||||
location: location
|
||||
sku: {
|
||||
name: 'EP1'
|
||||
|
@ -75,7 +75,7 @@ resource functionApp 'Microsoft.Web/sites@2021-03-01' = {
|
|||
}
|
||||
properties: {
|
||||
httpsOnly: true
|
||||
serverFarmId: functionAppPlan.id
|
||||
serverFarmId: functionPlan.id
|
||||
keyVaultReferenceIdentity: managedIdentityId
|
||||
siteConfig: {
|
||||
acrUseManagedIdentityCreds: privateAcr ? true : false
|
||||
|
@ -210,7 +210,7 @@ resource applicationInsights 'Microsoft.Insights/components@2020-02-02' = {
|
|||
|
||||
resource diagnosticSettingsPlan 'Microsoft.Insights/diagnosticSettings@2021-05-01-preview' = {
|
||||
name: 'diagSettings'
|
||||
scope: functionAppPlan
|
||||
scope: functionPlan
|
||||
properties: {
|
||||
metrics: [
|
||||
{
|
||||
|
|
|
@ -40,6 +40,7 @@ param tags object = {}
|
|||
param resourceNames object = {
|
||||
functionName: '${namePrefix}-${uniqueString(guid)}'
|
||||
appServiceName: '${namePrefix}-${uniqueString(guid)}'
|
||||
functionPlanName: '${namePrefix}-asp-${uniqueString(guid)}'
|
||||
appServicePlanName: '${namePrefix}-asp-${uniqueString(guid)}'
|
||||
cosmosAccountName: '${namePrefix}-dbacct-${uniqueString(guid)}'
|
||||
cosmosContainerName: '${namePrefix}-ctr'
|
||||
|
@ -143,8 +144,8 @@ module appService 'appService.bicep' = if (!deployAsFunc) {
|
|||
params: {
|
||||
location: location
|
||||
azureCloud: azureCloud
|
||||
appServicePlanName: resourceNames.appServicePlanName
|
||||
appServiceName: resourceNames.appServiceName
|
||||
appServicePlanName: resourceNames.appServicePlanName
|
||||
keyVaultUri: keyVault.outputs.keyVaultUri
|
||||
cosmosDbUri: cosmos.outputs.cosmosDocumentEndpoint
|
||||
databaseName: resourceNames.cosmosDatabaseName
|
||||
|
@ -165,8 +166,8 @@ module functionApp 'functionApp.bicep' = if (deployAsFunc) {
|
|||
params: {
|
||||
location: location
|
||||
azureCloud: azureCloud
|
||||
functionAppPlanName: resourceNames.appServicePlanName
|
||||
functionAppName: resourceNames.functionName
|
||||
functionPlanName: resourceNames.appServicePlanName
|
||||
keyVaultUri: keyVault.outputs.keyVaultUri
|
||||
cosmosDbUri: cosmos.outputs.cosmosDocumentEndpoint
|
||||
databaseName: resourceNames.cosmosDatabaseName
|
||||
|
|
|
@ -63,7 +63,7 @@ Next, use the following commands to update the Azure IPAM containers within your
|
|||
az acr build -r <ACR Name> -t ipam:latest -f ./Dockerfile .
|
||||
|
||||
# Function Container
|
||||
az acr build -r <ACR Name> -t ipamfunc:latest -f .Dockerfile.func .
|
||||
az acr build -r <ACR Name> -t ipamfunc:latest -f ./Dockerfile.func .
|
||||
```
|
||||
|
||||
If you're using the legacy Azure IPAM multi-container deployment (prior to v3.0.0), please use the following commands to update your containers instead
|
||||
|
|
|
@ -234,7 +234,7 @@ $ResourceNames = @{
|
|||
```powershell
|
||||
$ResourceNames = @{
|
||||
functionName = 'myfunction01'
|
||||
appServicePlanName = 'myappserviceplan01'
|
||||
functionPlanName = 'myfunctionplan01'
|
||||
cosmosAccountName = 'mycosmosaccount01'
|
||||
cosmosContainerName = 'mycontainer01'
|
||||
cosmosDatabaseName = 'mydatabase01'
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"logger": {
|
||||
"path": "./logs",
|
||||
"filename": "access.log",
|
||||
"filename": "ipam.log",
|
||||
"level": "info",
|
||||
"rotation": "30 days",
|
||||
"retention": "12 months",
|
||||
|
|
|
@ -47,7 +47,7 @@ class IPAMLogger:
|
|||
logging_config = config.get('logger')
|
||||
|
||||
logger = cls.customize_logging(
|
||||
os.path.join(tempfile.gettempdir(), "logs", "access.log") if os.environ.get('FUNCTIONS_WORKER_RUNTIME') else logging_config.get('path'),
|
||||
os.environ.get('IPAM_LOGFILE_LOCATION', os.path.join(tempfile.gettempdir(), "logs", "ipam.log")),
|
||||
level=logging_config.get('level'),
|
||||
retention=logging_config.get('retention'),
|
||||
rotation=logging_config.get('rotation'),
|
||||
|
@ -79,7 +79,7 @@ class IPAMLogger:
|
|||
retention=retention,
|
||||
enqueue=True,
|
||||
backtrace=True,
|
||||
level=level.upper(),
|
||||
level='DEBUG',
|
||||
format=format
|
||||
)
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@ import copy
|
|||
import json
|
||||
import shutil
|
||||
import tempfile
|
||||
import traceback
|
||||
from pathlib import Path
|
||||
from urllib.parse import urlparse
|
||||
|
||||
|
@ -478,6 +479,8 @@ async def find_reservations() -> None:
|
|||
await azure.match_resv_to_vnets()
|
||||
except Exception as e:
|
||||
logger.error('Error running network check loop!')
|
||||
tb = traceback.format_exc()
|
||||
logger.debug(tb);
|
||||
raise e
|
||||
|
||||
@app.exception_handler(StarletteHTTPException)
|
||||
|
|
Загрузка…
Ссылка в новой задаче