Skip to content

Commit

Permalink
Use porter azure plugin to store instances in blob storage
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeEvansLarah committed Jan 14, 2020
1 parent cab75b2 commit fcde6cf
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 3 deletions.
17 changes: 14 additions & 3 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
# Build Porter Azure plugin (remove this when `porter plugin install` command is implemented - https://github.com/deislabs/porter/issues/771)
FROM golang:1.13.6
RUN go get github.com/deislabs/porter-azure-plugins/...
WORKDIR /go/src/github.com/deislabs/porter-azure-plugins
RUN make build

FROM alpine:latest

ARG CNAB_ARM_DRIVER_VERSION
ARG CNAB_ARM_DRIVER_REPO

ENV PORTER_URL=https://cdn.deislabs.io/porter
ENV PORTER_VERSION=v0.17.1-beta.1
ENV PORTER_VERSION=v0.22.1-beta.1

ENV CNAB_AZURE_DRIVER_VERSION=v.0.0.3
ENV CNAB_AZURE_DRIVER_REPO=simongdavies/cnab-azure-driver
ENV CNAB_AZURE_DRIVER_VERSION=v0.0.4
ENV CNAB_AZURE_DRIVER_REPO=deislabs/cnab-azure-driver

ENV CNAB_ARM_DRIVER_VERSION=$CNAB_ARM_DRIVER_VERSION
ENV CNAB_ARM_DRIVER_REPO=$CNAB_ARM_DRIVER_REPO
Expand All @@ -32,4 +38,9 @@ RUN chmod +x "${TOOLHOME}/cnab-azure"
RUN curl "https://github.com/${CNAB_ARM_DRIVER_REPO}/releases/download/${CNAB_ARM_DRIVER_VERSION}/cnabarmdriver-linux-amd64" -fLo "${TOOLHOME}/cnabarmdriver"
RUN chmod +x "${TOOLHOME}/cnabarmdriver"

# Install Porter Azure plugin
RUN mkdir -p ${PORTER_HOME}/plugins
COPY --from=0 /go/src/github.com/deislabs/porter-azure-plugins/bin/plugins/azure ${PORTER_HOME}/plugins/
COPY config.toml ${PORTER_HOME}/

CMD cnabarmdriver
1 change: 1 addition & 0 deletions docker/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
instance-storage-plugin = "azure.blob"
14 changes: 14 additions & 0 deletions pkg/generator/testdata/azuredeploy-simple.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,16 @@
}
}
},
{
"type": "Microsoft.Storage/storageAccounts/blobServices/containers",
"name": "[concat(variables('cnab_azure_state_storage_account_name'), '/default/porter'))]",
"apiVersion": "2019-04-01",
"location": "[variables('aci_location')]",
"dependsOn": [
"[variables('cnab_azure_state_storage_account_name')]"
],
"properties": null
},
{
"type": "Microsoft.Storage/storageAccounts/fileServices/shares",
"name": "[concat(variables('cnab_azure_state_storage_account_name'), '/default/', variables('cnab_azure_state_fileshare'))]",
Expand Down Expand Up @@ -189,6 +199,10 @@
"name": "CNAB_BUNDLE_TAG",
"value": "cnabquickstarts.azurecr.io/porter/hello-world/bundle:1.0.0"
},
{
"name": "AZURE_STORAGE_CONNECTION_STRING",
"secureValue": "[listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('cnab_azure_state_storage_account_name')), '2019-04-01').keys[0].value]"
},
{
"name": "CNAB_PARAM_age",
"value": "[parameters('age')]"
Expand Down
14 changes: 14 additions & 0 deletions pkg/generator/testdata/azuredeploy.json
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,16 @@
}
}
},
{
"type": "Microsoft.Storage/storageAccounts/blobServices/containers",
"name": "[concat(variables('cnab_azure_state_storage_account_name'), '/default/porter'))]",
"apiVersion": "2019-04-01",
"location": "[variables('aci_location')]",
"dependsOn": [
"[variables('cnab_azure_state_storage_account_name')]"
],
"properties": null
},
{
"type": "Microsoft.Storage/storageAccounts/fileServices/shares",
"name": "[concat(variables('cnab_azure_state_storage_account_name'), '/default/', variables('cnab_azure_state_fileshare'))]",
Expand Down Expand Up @@ -304,6 +314,10 @@
"name": "CNAB_BUNDLE_TAG",
"value": "cnabquickstarts.azurecr.io/porter/hello-world/bundle:1.0.0"
},
{
"name": "AZURE_STORAGE_CONNECTION_STRING",
"secureValue": "[listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('cnab_azure_state_storage_account_name')), '2019-04-01').keys[0].value]"
},
{
"name": "CNAB_PARAM_age",
"value": "[parameters('age')]"
Expand Down
13 changes: 13 additions & 0 deletions pkg/template/cnab-arm-driver-template.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@ func NewCnabArmDriverTemplate(bundleName string, bundleTag string, containerImag
},
},
},
{
Type: "Microsoft.Storage/storageAccounts/blobServices/containers",
Name: "[concat(variables('cnab_azure_state_storage_account_name'), '/default/porter'))]",
APIVersion: "2019-04-01",
Location: "[variables('aci_location')]",
DependsOn: []string{
"[variables('cnab_azure_state_storage_account_name')]",
},
},
{
Type: "Microsoft.Storage/storageAccounts/fileServices/shares",
Name: "[concat(variables('cnab_azure_state_storage_account_name'), '/default/', variables('cnab_azure_state_fileshare'))]",
Expand Down Expand Up @@ -116,6 +125,10 @@ func NewCnabArmDriverTemplate(bundleName string, bundleTag string, containerImag
Name: common.GetEnvironmentVariableNames().CnabBundleTag,
Value: bundleTag,
},
{
Name: "AZURE_STORAGE_CONNECTION_STRING",
SecureValue: "[listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('cnab_azure_state_storage_account_name')), '2019-04-01').keys[0].value]",
},
},
},
},
Expand Down

0 comments on commit fcde6cf

Please sign in to comment.