Skip to content

Commit b0a41fd

Browse files
Merge pull request #28 from jeremyrickard/update-templating-paths
Update for better user specified arm templates
2 parents 720f23e + dc65ee6 commit b0a41fd

9 files changed

+3
-46
lines changed

pkg/azure/arm/arm.go

-18
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,13 @@ type Deployer interface {
3434
location string,
3535
template []byte,
3636
armParams map[string]interface{},
37-
tags map[string]string,
3837
) (map[string]interface{}, error)
3938
Update(
4039
deploymentName string,
4140
resourceGroupName string,
4241
location string,
4342
template []byte,
4443
armParams map[string]interface{},
45-
tags map[string]string,
4644
) (map[string]interface{}, error)
4745
Delete(deploymentName string, resourceGroupName string) error
4846
}
@@ -76,7 +74,6 @@ func (d *deployer) Deploy(
7674
location string,
7775
template []byte,
7876
armParams map[string]interface{},
79-
tags map[string]string,
8077
) (map[string]interface{}, error) {
8178

8279
// Get the deployment and its current status
@@ -105,7 +102,6 @@ func (d *deployer) Deploy(
105102
location,
106103
template,
107104
armParams,
108-
tags,
109105
); err != nil {
110106
return nil, fmt.Errorf(
111107
`error deploying "%s" in resource group "%s": %s`,
@@ -165,7 +161,6 @@ func (d *deployer) Update(
165161
location string,
166162
template []byte,
167163
armParams map[string]interface{},
168-
tags map[string]string,
169164
) (map[string]interface{}, error) {
170165
// Get the deployment's current status
171166
_, ds, err := d.getDeploymentAndStatus(
@@ -223,7 +218,6 @@ func (d *deployer) Update(
223218
location,
224219
template,
225220
armParams,
226-
tags,
227221
)
228222
if err != nil {
229223
return nil, fmt.Errorf(
@@ -329,7 +323,6 @@ func (d *deployer) doDeployment(
329323
location string,
330324
armTemplate []byte,
331325
armParams map[string]interface{},
332-
tags map[string]string,
333326
) (*resourcesSDK.DeploymentExtended, error) {
334327
ctx, cancel := context.WithCancel(context.Background())
335328
defer cancel()
@@ -363,22 +356,11 @@ func (d *deployer) doDeployment(
363356
return nil, fmt.Errorf("error unmarshaling ARM template: %s", err)
364357
}
365358

366-
// Deal with the possibility that tags == nil
367-
if tags == nil {
368-
tags = make(map[string]string)
369-
}
370-
371-
// Augment the provided tags with heritage information
372-
tags["heritage"] = "porter-azure-mixin"
373-
374359
// Deal with the possiiblity that params == nil
375360
if armParams == nil {
376361
armParams = make(map[string]interface{})
377362
}
378363

379-
// Augment the params with tags
380-
armParams["tags"] = tags
381-
382364
// Convert a simple map[string]interface{} to the more complex
383365
// map[string]map[string]interface{} required by the deployments client
384366
armParamsMap := map[string]interface{}{}

pkg/azure/arm/template.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ func GetTemplate(kind string) ([]byte, error) {
1919

2020
func (d deployer) FindTemplate(kind, template string) ([]byte, error) {
2121
if kind == "arm" {
22-
template := fmt.Sprintf("/cnab/arm/templates/%s", template)
22+
template := fmt.Sprintf("/cnab/app/%s", template)
2323
f, err := d.context.FileSystem.Open(template)
2424
if err != nil {
2525
return nil, errors.Wrap(err, fmt.Sprintf("couldn't find template %s", template))

pkg/azure/arm/template_test.go

+1-5
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,14 @@ const mysqlTemplate = `{
3030
},
3131
"sslEnforcement": {
3232
"type": "string"
33-
},
34-
"tags": {
35-
"type": "object"
36-
}
33+
}
3734
},
3835
"resources": [
3936
{
4037
"apiVersion": "2017-12-01-preview",
4138
"kind": "",
4239
"location": "[parameters('location')]",
4340
"name": "[parameters('serverName')]",
44-
"tags": "[parameters('tags')]",
4541
"properties": {
4642
"version": "[parameters('version')]",
4743
"administratorLogin": "[parameters('administratorLogin')]",

pkg/azure/arm/templates/aci.template

-4
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@
4343
"defaultValue" : "OnFailure",
4444
"type": "String"
4545
},
46-
"tags": {
47-
"type": "object"
48-
},
4946
"environmentVariables" : {
5047
"type" : "array",
5148
"defaultValue" : {
@@ -71,7 +68,6 @@
7168
"resources": [{
7269
"name": "[variables('name')]",
7370
"type": "Microsoft.ContainerInstance/containerGroups",
74-
"tags": "[parameters('tags')]",
7571
"apiVersion": "[variables('APIversion')]",
7672
"location": "[variables('location')]",
7773
"properties": {

pkg/azure/arm/templates/aks.template

-4
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,6 @@
7676
"metadata": {
7777
"description": "The version of Kubernetes."
7878
}
79-
},
80-
"tags": {
81-
"type": "object"
8279
}
8380
},
8481
"resources": [
@@ -87,7 +84,6 @@
8784
"type": "Microsoft.ContainerService/managedClusters",
8885
"location": "[parameters('location')]",
8986
"name": "[parameters('clusterName')]",
90-
"tags": "[parameters('tags')]",
9187
"properties": {
9288
"kubernetesVersion": "[parameters('kubernetesVersion')]",
9389
"dnsPrefix": "[parameters('dnsPrefix')]",

pkg/azure/arm/templates/cosmosdb.template

-4
Original file line numberDiff line numberDiff line change
@@ -50,17 +50,13 @@
5050
"metadata": {
5151
"description": "Conditional to enable api specific capabilities if MongoDB is the API chosen."
5252
}
53-
},
54-
"tags": {
55-
"type": "object"
5653
}
5754
},
5855
"variables": {},
5956
"resources": [
6057
{
6158
"apiVersion": "[parameters('apiVersion')]",
6259
"kind": "[parameters('kind')]",
63-
"tags": "[parameters('tags')]",
6460
"type": "Microsoft.DocumentDB/databaseAccounts",
6561
"name": "[parameters('name')]",
6662
"location": "[parameters('location')]",

pkg/azure/arm/templates/mysql.template

+1-5
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,14 @@
2222
},
2323
"sslEnforcement": {
2424
"type": "string"
25-
},
26-
"tags": {
27-
"type": "object"
28-
}
25+
}
2926
},
3027
"resources": [
3128
{
3229
"apiVersion": "2017-12-01-preview",
3330
"kind": "",
3431
"location": "[parameters('location')]",
3532
"name": "[parameters('serverName')]",
36-
"tags": "[parameters('tags')]",
3733
"properties": {
3834
"version": "[parameters('version')]",
3935
"administratorLogin": "[parameters('administratorLogin')]",

pkg/azure/arm/templates/storage.template

-4
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@
1010
},
1111
"storageContainerName": {
1212
"type": "string"
13-
},
14-
"tags": {
15-
"type": "object"
1613
}
1714
},
1815
"resources": [
@@ -25,7 +22,6 @@
2522
},
2623
"kind": "StorageV2",
2724
"location": "[parameters('location')]",
28-
"tags": "[parameters('tags')]",
2925
"identity": {
3026
"type": "SystemAssigned"
3127
},

pkg/azure/install.go

-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ func (m *Mixin) Install() error {
6060
step.Parameters["location"].(string),
6161
t,
6262
step.Parameters, //arm params
63-
nil, //Tags not supported right now
6463
)
6564
if err != nil {
6665
return err

0 commit comments

Comments
 (0)