Skip to content

Commit 30bda44

Browse files
authored
Merge pull request #156 from mspnp/dev
Fabrikam Drone Delivery 0.1.0 - helm3 & Network Policies update
2 parents 0d3f120 + 49b08da commit 30bda44

File tree

103 files changed

+2172
-2136
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+2172
-2136
lines changed

azuredeploy.json

+66-59
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,12 @@
226226
"appGatewayNamePrefix": "appg",
227227
"aksVnetAddressPrefix": "10.10.0.0/16",
228228
"aksClusterSubnetPrefix": "10.10.0.0/21",
229+
"appGatewaySubnetPrefixes": [
230+
"10.10.8.0/24",
231+
"10.10.9.0/24",
232+
"10.10.10.0/24",
233+
"10.10.11.0/24"
234+
],
229235
"firewallSubnetPrefix": "10.10.12.0/24",
230236
"firewallSubnetName": "AzureFirewallSubnet",
231237
"aksVnetNamePrefix": "vnet",
@@ -252,8 +258,7 @@
252258
"applicationGatewayMinCapacity": 1,
253259
"aksVnetName": "[uniqueString(variables('aksVnetNamePrefix'), resourceGroup().id)]",
254260
"aksClusterSubnetName": "[uniqueString(variables('aksClusterSubnetNamePrefix'), resourceGroup().id)]",
255-
"appGatewaySubnetName": "[concat(parameters('environmentName'),'-agsn-', uniqueString(variables('appGatewayNamePrefix'), resourceGroup().id))]",
256-
"appGatewaySubnetPrefix": "10.10.8.0/24",
261+
"appGatewaySubnetIndex": 0,
257262
"appGatewayPublicIpName": "[concat(parameters('environmentName'),'-agip-', uniqueString(variables('appGatewayNamePrefix'), resourceGroup().id))]",
258263
"appGatewayPublicDnsName": "[concat(parameters('environmentName'),'-ingest-', uniqueString(variables('appGatewayNamePrefix'), resourceGroup().id))]",
259264
"appInsightsName": "[concat(parameters('environmentName'),uniqueString(variables('aiNamePrefix'),resourceGroup().id))]",
@@ -291,8 +296,7 @@
291296
"applicationGatewayMinCapacity": 1,
292297
"aksVnetName": "[uniqueString(variables('aksVnetNamePrefix'), resourceGroup().id)]",
293298
"aksClusterSubnetName": "[uniqueString(variables('aksClusterSubnetNamePrefix'), resourceGroup().id)]",
294-
"appGatewaySubnetName": "[concat(parameters('environmentName'),'-agsn-', uniqueString(variables('appGatewayNamePrefix'), resourceGroup().id))]",
295-
"appGatewaySubnetPrefix": "10.10.9.0/24",
299+
"appGatewaySubnetIndex": 1,
296300
"appGatewayPublicIpName": "[concat(parameters('environmentName'),'-agip-', uniqueString(variables('appGatewayNamePrefix'), resourceGroup().id))]",
297301
"appGatewayPublicDnsName": "[concat(parameters('environmentName'),'-ingest-', uniqueString(variables('appGatewayNamePrefix'), resourceGroup().id))]",
298302
"appInsightsName": "[concat(parameters('environmentName'),uniqueString(variables('aiNamePrefix'),resourceGroup().id))]",
@@ -330,8 +334,7 @@
330334
"applicationGatewayMinCapacity": 2,
331335
"aksVnetName": "[uniqueString(variables('aksVnetNamePrefix'), resourceGroup().id)]",
332336
"aksClusterSubnetName": "[uniqueString(variables('aksClusterSubnetNamePrefix'), resourceGroup().id)]",
333-
"appGatewaySubnetName": "[concat(parameters('environmentName'),'-agsn-', uniqueString(variables('appGatewayNamePrefix'), resourceGroup().id))]",
334-
"appGatewaySubnetPrefix": "10.10.10.0/24",
337+
"appGatewaySubnetIndex": 2,
335338
"appGatewayPublicIpName": "[concat(parameters('environmentName'),'-agip-', uniqueString(variables('appGatewayNamePrefix'), resourceGroup().id))]",
336339
"appGatewayPublicDnsName": "[concat(parameters('environmentName'),'-ingest-', uniqueString(variables('appGatewayNamePrefix'), resourceGroup().id))]",
337340
"appInsightsName": "[concat(parameters('environmentName'),uniqueString(variables('aiNamePrefix'),resourceGroup().id))]",
@@ -369,8 +372,7 @@
369372
"applicationGatewayMinCapacity": 2,
370373
"aksVnetName": "[uniqueString(variables('aksVnetNamePrefix'), resourceGroup().id)]",
371374
"aksClusterSubnetName": "[uniqueString(variables('aksClusterSubnetNamePrefix'), resourceGroup().id)]",
372-
"appGatewaySubnetName": "[concat(parameters('environmentName'),'-agsn-', uniqueString(variables('appGatewayNamePrefix'), resourceGroup().id))]",
373-
"appGatewaySubnetPrefix": "10.10.11.0/24",
375+
"appGatewaySubnetIndex": 3,
374376
"appGatewayPublicIpName": "[concat(parameters('environmentName'),'-agip-', uniqueString(variables('appGatewayNamePrefix'), resourceGroup().id))]",
375377
"appGatewayPublicDnsName": "[concat(parameters('environmentName'),'-ingest-', uniqueString(variables('appGatewayNamePrefix'), resourceGroup().id))]",
376378
"appInsightsName": "[concat(parameters('environmentName'),uniqueString(variables('aiNamePrefix'),resourceGroup().id))]",
@@ -398,7 +400,59 @@
398400
"workspaceSku": "PerGB2018",
399401
"workspaceRetentionInDays": 730
400402
}
401-
}
403+
},
404+
"aksClusterSubnet": {
405+
"name": "[variables('environmentSettings')[parameters('environmentName')].aksClusterSubnetName]",
406+
"properties": {
407+
"addressPrefix": "[variables('aksClusterSubnetPrefix')]",
408+
"privateEndpointNetworkPolicies": "Enabled",
409+
"privateLinkServiceNetworkPolicies": "Enabled"
410+
}
411+
},
412+
"firewallSubnet": {
413+
"name": "[variables('firewallSubnetName')]",
414+
"properties": {
415+
"addressPrefix": "[variables('firewallSubnetPrefix')]",
416+
"serviceEndpoints": [
417+
{
418+
"service": "Microsoft.KeyVault",
419+
"locations": [
420+
"[resourceGroup().location]"
421+
]
422+
},
423+
{
424+
"service": "Microsoft.AzureCosmosDB",
425+
"locations": [
426+
"[resourceGroup().location]"
427+
]
428+
},
429+
{
430+
"service": "Microsoft.Storage",
431+
"locations": [
432+
"[resourceGroup().location]"
433+
]
434+
},
435+
{
436+
"service": "Microsoft.ServiceBus",
437+
"locations": [
438+
"[resourceGroup().location]"
439+
]
440+
}
441+
]
442+
}
443+
},
444+
"copy": [
445+
{
446+
"name": "appGatewaySubnetsLoop",
447+
"count": "[length(variables('appGatewaySubnetPrefixes'))]",
448+
"input": {
449+
"name": "[concat('agsn-', uniqueString(variables('appGatewayNamePrefix'), resourceGroup().id), copyIndex('appGatewaySubnetsLoop'))]",
450+
"properties": {
451+
"addressPrefix": "[variables('appGatewaySubnetPrefixes')[copyIndex('appGatewaySubnetsLoop')]]"
452+
}
453+
}
454+
}
455+
]
402456
},
403457
"resources": [
404458
{
@@ -477,54 +531,7 @@
477531
"[variables('aksVnetAddressPrefix')]"
478532
]
479533
},
480-
"subnets": [
481-
{
482-
"name": "[variables('environmentSettings')[parameters('environmentName')].aksClusterSubnetName]",
483-
"properties": {
484-
"addressPrefix": "[variables('aksClusterSubnetPrefix')]",
485-
"privateEndpointNetworkPolicies": "Enabled",
486-
"privateLinkServiceNetworkPolicies": "Enabled"
487-
}
488-
},
489-
{
490-
"name": "[variables('firewallSubnetName')]",
491-
"properties": {
492-
"addressPrefix": "[variables('firewallSubnetPrefix')]",
493-
"serviceEndpoints": [
494-
{
495-
"service": "Microsoft.KeyVault",
496-
"locations": [
497-
"[resourceGroup().location]"
498-
]
499-
},
500-
{
501-
"service": "Microsoft.AzureCosmosDB",
502-
"locations": [
503-
"[resourceGroup().location]"
504-
]
505-
},
506-
{
507-
"service": "Microsoft.Storage",
508-
"locations": [
509-
"[resourceGroup().location]"
510-
]
511-
},
512-
{
513-
"service": "Microsoft.ServiceBus",
514-
"locations": [
515-
"[resourceGroup().location]"
516-
]
517-
}
518-
]
519-
}
520-
},
521-
{
522-
"name": "[variables('environmentSettings')[parameters('environmentName')].appGatewaySubnetName]",
523-
"properties": {
524-
"addressPrefix": "[variables('environmentSettings')[parameters('environmentName')].appGatewaySubnetPrefix]"
525-
}
526-
}
527-
]
534+
"subnets": "[concat(createArray(variables('aksClusterSubnet'), variables('firewallSubnet')), variables('appGatewaySubnetsLoop'))]"
528535
}
529536
},
530537
{
@@ -572,7 +579,7 @@
572579
"name": "appGatewayIpConfig",
573580
"properties": {
574581
"subnet": {
575-
"id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('environmentSettings')[parameters('environmentName')].aksVnetName, variables('environmentSettings')[parameters('environmentName')].appGatewaySubnetName)]"
582+
"id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('environmentSettings')[parameters('environmentName')].aksVnetName, variables('appGatewaySubnetsLoop')[variables('environmentSettings')[parameters('environmentName')].appGatewaySubnetIndex].name)]"
576583
}
577584
}
578585
}
@@ -1584,7 +1591,7 @@
15841591
"type": "string"
15851592
},
15861593
"appGatewaySubnetPrefix": {
1587-
"value": "[variables('environmentSettings')[parameters('environmentName')].appGatewaySubnetPrefix]",
1594+
"value": "[variables('appGatewaySubnetsLoop')[variables('environmentSettings')[parameters('environmentName')].appGatewaySubnetIndex].properties.addressPrefix]",
15881595
"type": "string"
15891596
},
15901597
"aksVNetName": {

charts/delivery/.helmignore

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*~
18+
# Various IDEs
19+
.project
20+
.idea/
21+
*.tmproj
22+
.vscode/

charts/delivery/Chart.yaml

+36
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,40 @@
1+
apiVersion: v2
12
name: delivery
23
version: v0.1.0
34
appVersion: v0.1.0
45
description: Fabrikam Drone Delivery Service
6+
type: application
7+
home: https://docs.microsoft.com/en-us/azure/architecture/reference-architectures/microservices/aks
8+
sources:
9+
- https://github.com/mspnp/microservices-reference-implementation
10+
dependencies:
11+
- name: delivery-dev
12+
repository: "file://envs/delivery-dev"
13+
version: v0.1.0
14+
condition: envs.dev
15+
import-values:
16+
- data
17+
18+
- name: delivery-prod
19+
repository: "file://envs/delivery-prod"
20+
version: v0.1.0
21+
condition: envs.prod
22+
import-values:
23+
- data
24+
25+
- name: delivery-qa
26+
repository: "file://envs/delivery-qa"
27+
version: v0.1.0
28+
condition: envs.qa
29+
import-values:
30+
- data
31+
32+
- name: delivery-staging
33+
repository: "file://envs/delivery-staging"
34+
version: v0.1.0
35+
condition: envs.staging
36+
import-values:
37+
- data
38+
maintainers:
39+
40+
name: ferantivero
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
apiVersion: v2
12
name: delivery-dev
23
version: v0.1.0
34
appVersion: v0.1.0
45
description: Fabrikam Drone Delivery Service
6+
type: application
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
apiVersion: v2
12
name: delivery-prod
23
version: v0.1.0
34
appVersion: v0.1.0
45
description: Fabrikam Drone Delivery Service
6+
type: application
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
apiVersion: v2
12
name: delivery-qa
23
version: v0.1.0
34
appVersion: v0.1.0
45
description: Fabrikam Drone Delivery Service
6+
type: application
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
apiVersion: v2
12
name: delivery-staging
23
version: v0.1.0
34
appVersion: v0.1.0
45
description: Fabrikam Drone Delivery Service
6+
type: application

charts/delivery/requirements.lock

-15
This file was deleted.

charts/delivery/requirements.yaml

-32
This file was deleted.

charts/delivery/templates/NOTES.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ Thank you for installing {{ .Chart.Name }}.
22

33
Your release is named {{ .Release.Name }}.
44

5-
All the objects were created in the namespace {{ .Values.namespace }}
5+
All the objects were created in the namespace {{ .Release.Namespace }}
66

77
To learn more about the release, try:
88

9-
$ helm status {{ .Release.Name }}
10-
$ helm get {{ .Release.Name }}
9+
$ helm status {{ .Release.Name }} --namespace {{ .Release.Namespace }}
10+
$ helm get all {{ .Release.Name }} --namespace {{ .Release.Namespace }}

charts/delivery/templates/_helpers.tpl

+21
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,24 @@ Create chart name and version as used by the chart label.
3838
{{- define "delivery.chart" -}}
3939
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
4040
{{- end -}}
41+
42+
{{/*
43+
Common labels
44+
*/}}
45+
{{- define "delivery.labels" -}}
46+
helm.sh/chart: {{ include "delivery.chart" . }}
47+
{{ include "delivery.selectorLabels" . }}
48+
{{- if .Chart.AppVersion }}
49+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
50+
{{- end }}
51+
app.kubernetes.io/managed-by: {{ .Release.Service }}
52+
{{- end -}}
53+
54+
{{/*
55+
Selector labels
56+
*/}}
57+
{{- define "delivery.selectorLabels" -}}
58+
app.kubernetes.io/name: {{ include "delivery.name" . }}
59+
app.kubernetes.io/instance: {{ .Release.Name }}
60+
{{- end -}}
61+

charts/delivery/templates/delivery-networkpolicy-allow-egress-traffic.yaml

+20-3
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,27 @@ spec:
2323
app.kubernetes.io/version: {{ .Chart.AppVersion }}
2424
policyTypes:
2525
- Egress
26-
{{- if .Values.networkPolicy.egress.customSelectors }}
2726
egress:
28-
{{ toYaml .Values.networkPolicy.egress.customSelectors | indent 2 }}
27+
# allow egress traffic to kubedns
28+
- to:
29+
- podSelector:
30+
matchLabels:
31+
k8s-app: kube-dns
32+
namespaceSelector: {}
33+
ports:
34+
- port: 53
35+
protocol: UDP
36+
- port: 53
37+
protocol: TCP
38+
{{- if .Values.networkPolicy.egress.external.enabled }}
39+
# allow egress traffic to all external resources except pods within the
40+
# cluster subnet
41+
- to:
42+
- ipBlock:
43+
cidr: 0.0.0.0/0
44+
except:
45+
- {{ required "networkPolicy.egress.external.clusterSubnetPrefix is required to enable external traffic" .Values.networkPolicy.egress.external.clusterSubnetPrefix }}
2946
{{- else if .Values.networkPolicy.egress.allowAll }}
30-
egress: []
47+
- to: []
3148
{{- end -}}
3249
{{ end }}

0 commit comments

Comments
 (0)