|
| 1 | +# Azurite (Azure Storage emulator) provisioner for the azure-blob resource type. |
| 2 | +# Runs Azurite in the cluster and gives the workload a connection string plus the |
| 3 | +# well-known dev-storage credentials, so apps using the Azure Blob SDK can work |
| 4 | +# against it locally without a real Azure Storage account. |
| 5 | +# See https://learn.microsoft.com/en-us/azure/storage/common/storage-use-azurite |
| 6 | +- uri: template://community-provisioners/azurite-azure-blob |
| 7 | + type: azure-blob |
| 8 | + description: Generates an Azurite (Azure Storage emulator) StatefulSet and Service exposing the blob endpoint. |
| 9 | + supported_params: |
| 10 | + - container |
| 11 | + init: | |
| 12 | + blobPort: 10000 |
| 13 | + accountName: devstoreaccount1 |
| 14 | + accountKey: "Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==" |
| 15 | + defaultContainer: blob-{{ randAlphaNum 6 | lower }} |
| 16 | + state: | |
| 17 | + service: azurite-{{ .SourceWorkload }}-{{ substr 0 8 .Guid | lower }} |
| 18 | + container: {{ dig "container" (.Params.container | default .Init.defaultContainer) .State | quote }} |
| 19 | + outputs: | |
| 20 | + connection_string: "DefaultEndpointsProtocol=http;AccountName={{ .Init.accountName }};AccountKey={{ .Init.accountKey }};BlobEndpoint=http://{{ .State.service }}:{{ .Init.blobPort }}/{{ .Init.accountName }};" |
| 21 | + account_name: {{ .Init.accountName | quote }} |
| 22 | + account_key: {{ .Init.accountKey | quote }} |
| 23 | + blob_endpoint: "http://{{ .State.service }}:{{ .Init.blobPort }}/{{ .Init.accountName }}" |
| 24 | + container: {{ .State.container | quote }} |
| 25 | + expected_outputs: |
| 26 | + - connection_string |
| 27 | + - account_name |
| 28 | + - account_key |
| 29 | + - blob_endpoint |
| 30 | + - container |
| 31 | + manifests: | |
| 32 | + - apiVersion: apps/v1 |
| 33 | + kind: StatefulSet |
| 34 | + metadata: |
| 35 | + name: {{ .State.service }} |
| 36 | + {{ if ne .Namespace "" }} |
| 37 | + namespace: {{ .Namespace }} |
| 38 | + {{ end }} |
| 39 | + annotations: |
| 40 | + k8s.score.dev/source-workload: {{ .SourceWorkload }} |
| 41 | + k8s.score.dev/resource-uid: {{ .Uid }} |
| 42 | + k8s.score.dev/resource-guid: {{ .Guid }} |
| 43 | + labels: |
| 44 | + app.kubernetes.io/managed-by: score-k8s |
| 45 | + app.kubernetes.io/name: {{ .State.service }} |
| 46 | + app.kubernetes.io/instance: {{ .State.service }} |
| 47 | + spec: |
| 48 | + serviceName: {{ .State.service }} |
| 49 | + replicas: 1 |
| 50 | + selector: |
| 51 | + matchLabels: |
| 52 | + app.kubernetes.io/instance: {{ .State.service }} |
| 53 | + template: |
| 54 | + metadata: |
| 55 | + labels: |
| 56 | + app.kubernetes.io/managed-by: score-k8s |
| 57 | + app.kubernetes.io/name: {{ .State.service }} |
| 58 | + app.kubernetes.io/instance: {{ .State.service }} |
| 59 | + spec: |
| 60 | + containers: |
| 61 | + - name: azurite |
| 62 | + image: mcr.microsoft.com/azure-storage/azurite:latest |
| 63 | + command: ["azurite-blob"] |
| 64 | + args: |
| 65 | + - --blobHost |
| 66 | + - 0.0.0.0 |
| 67 | + - --blobPort |
| 68 | + - "{{ .Init.blobPort }}" |
| 69 | + - --location |
| 70 | + - /data |
| 71 | + ports: |
| 72 | + - name: blob |
| 73 | + containerPort: {{ .Init.blobPort }} |
| 74 | + volumeMounts: |
| 75 | + - name: data |
| 76 | + mountPath: /data |
| 77 | + readinessProbe: |
| 78 | + tcpSocket: |
| 79 | + port: {{ .Init.blobPort }} |
| 80 | + initialDelaySeconds: 5 |
| 81 | + periodSeconds: 5 |
| 82 | + securityContext: |
| 83 | + allowPrivilegeEscalation: false |
| 84 | + capabilities: |
| 85 | + drop: |
| 86 | + - ALL |
| 87 | + securityContext: |
| 88 | + fsGroup: 1000 |
| 89 | + volumeClaimTemplates: |
| 90 | + - metadata: |
| 91 | + name: data |
| 92 | + spec: |
| 93 | + accessModes: ["ReadWriteOnce"] |
| 94 | + resources: |
| 95 | + requests: |
| 96 | + storage: 1Gi |
| 97 | + - apiVersion: v1 |
| 98 | + kind: Service |
| 99 | + metadata: |
| 100 | + name: {{ .State.service }} |
| 101 | + {{ if ne .Namespace "" }} |
| 102 | + namespace: {{ .Namespace }} |
| 103 | + {{ end }} |
| 104 | + annotations: |
| 105 | + k8s.score.dev/source-workload: {{ .SourceWorkload }} |
| 106 | + k8s.score.dev/resource-uid: {{ .Uid }} |
| 107 | + k8s.score.dev/resource-guid: {{ .Guid }} |
| 108 | + labels: |
| 109 | + app.kubernetes.io/managed-by: score-k8s |
| 110 | + app.kubernetes.io/name: {{ .State.service }} |
| 111 | + app.kubernetes.io/instance: {{ .State.service }} |
| 112 | + spec: |
| 113 | + selector: |
| 114 | + app.kubernetes.io/instance: {{ .State.service }} |
| 115 | + type: ClusterIP |
| 116 | + ports: |
| 117 | + - port: {{ .Init.blobPort }} |
| 118 | + targetPort: {{ .Init.blobPort }} |
| 119 | + name: blob |
0 commit comments