@gradientedge/cdk-utils-azure 2.21.0 → 2.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Deployment, DeploymentMode, Resource } from '@pulumi/azure-native/resources/index.js';
|
|
2
2
|
import { ClientCertMode, ManagedServiceIdentityType, WebApp, WebAppFunction } from '@pulumi/azure-native/web/index.js';
|
|
3
|
+
import { v5 as uuidv5 } from 'uuid';
|
|
3
4
|
import { CommonAzureStack } from '../../common/index.js';
|
|
4
5
|
/**
|
|
5
6
|
* Provides operations on Azure Functions using Pulumi
|
|
@@ -86,10 +87,22 @@ export class AzureFunctionManager {
|
|
|
86
87
|
throw new Error(`Props undefined for ${id}`);
|
|
87
88
|
// Get resource group name
|
|
88
89
|
const resourceGroupName = props.resourceGroupName ?? scope.resourceNameFormatter.format(scope.props.resourceGroupName);
|
|
90
|
+
const name = scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.functionApp);
|
|
91
|
+
const location = props.location ?? scope.props.location;
|
|
92
|
+
const runtime = {
|
|
93
|
+
...props.runtime,
|
|
94
|
+
name: props.runtime?.name ?? 'node',
|
|
95
|
+
version: props.runtime?.version ?? CommonAzureStack.NODEJS_RUNTIME,
|
|
96
|
+
};
|
|
97
|
+
const scaleAndConcurrency = {
|
|
98
|
+
...props.scaleAndConcurrency,
|
|
99
|
+
instanceMemoryMB: props.scaleAndConcurrency?.instanceMemoryMB ?? 4096,
|
|
100
|
+
maximumInstanceCount: props.scaleAndConcurrency?.maximumInstanceCount ?? 40,
|
|
101
|
+
};
|
|
89
102
|
const functionApp = new WebApp(`${id}-fc`, {
|
|
90
103
|
...props,
|
|
91
|
-
name
|
|
92
|
-
location
|
|
104
|
+
name,
|
|
105
|
+
location,
|
|
93
106
|
resourceGroupName,
|
|
94
107
|
kind: props.kind ?? 'functionapp,linux',
|
|
95
108
|
reserved: props.reserved ?? true,
|
|
@@ -103,16 +116,8 @@ export class AzureFunctionManager {
|
|
|
103
116
|
clientCertEnabled: props.clientCertEnabled ?? false,
|
|
104
117
|
functionAppConfig: {
|
|
105
118
|
...props.functionAppConfig,
|
|
106
|
-
runtime
|
|
107
|
-
|
|
108
|
-
name: props.runtime?.name ?? 'node',
|
|
109
|
-
version: props.runtime?.version ?? CommonAzureStack.NODEJS_RUNTIME,
|
|
110
|
-
},
|
|
111
|
-
scaleAndConcurrency: {
|
|
112
|
-
...props.scaleAndConcurrency,
|
|
113
|
-
instanceMemoryMB: props.scaleAndConcurrency?.instanceMemoryMB ?? 4096,
|
|
114
|
-
maximumInstanceCount: props.scaleAndConcurrency?.maximumInstanceCount ?? 40,
|
|
115
|
-
},
|
|
119
|
+
runtime,
|
|
120
|
+
scaleAndConcurrency,
|
|
116
121
|
},
|
|
117
122
|
siteConfig: props.siteConfig ?? {
|
|
118
123
|
http20Enabled: true,
|
|
@@ -124,8 +129,10 @@ export class AzureFunctionManager {
|
|
|
124
129
|
...props.tags,
|
|
125
130
|
},
|
|
126
131
|
}, { parent: scope, ...resourceOptions });
|
|
127
|
-
|
|
128
|
-
|
|
132
|
+
// perform a deployment for the rolling update strategy
|
|
133
|
+
const deploymentId = uuidv5(`${id}-depl`, uuidv5.DNS);
|
|
134
|
+
new Deployment(deploymentId, {
|
|
135
|
+
deploymentName: deploymentId,
|
|
129
136
|
resourceGroupName,
|
|
130
137
|
properties: {
|
|
131
138
|
mode: DeploymentMode.Incremental,
|
|
@@ -136,23 +143,13 @@ export class AzureFunctionManager {
|
|
|
136
143
|
{
|
|
137
144
|
type: 'Microsoft.Web/sites',
|
|
138
145
|
apiVersion: '2024-04-01',
|
|
139
|
-
name
|
|
140
|
-
location
|
|
146
|
+
name,
|
|
147
|
+
location,
|
|
141
148
|
properties: {
|
|
142
149
|
functionAppConfig: {
|
|
143
150
|
...props.functionAppConfig,
|
|
144
|
-
runtime
|
|
145
|
-
|
|
146
|
-
name: props.runtime?.name ?? functionAppConfig?.runtime?.name ?? 'node',
|
|
147
|
-
version: props.runtime?.version ??
|
|
148
|
-
functionAppConfig?.runtime?.version ??
|
|
149
|
-
CommonAzureStack.NODEJS_RUNTIME,
|
|
150
|
-
},
|
|
151
|
-
scaleAndConcurrency: {
|
|
152
|
-
...props.scaleAndConcurrency,
|
|
153
|
-
instanceMemoryMB: props.scaleAndConcurrency?.instanceMemoryMB ?? 4096,
|
|
154
|
-
maximumInstanceCount: props.scaleAndConcurrency?.maximumInstanceCount ?? 40,
|
|
155
|
-
},
|
|
151
|
+
runtime,
|
|
152
|
+
scaleAndConcurrency,
|
|
156
153
|
siteUpdateStrategy: {
|
|
157
154
|
type: 'RollingUpdate',
|
|
158
155
|
},
|