Skip to content

Commit 49c1c3f

Browse files
Update generated content (#296)
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: mathieu-benoit <11720844+mathieu-benoit@users.noreply.github.com>
1 parent 31c7730 commit 49c1c3f

11 files changed

Lines changed: 479 additions & 0 deletions

File tree

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
title: "azurite-azure-blob"
3+
draft: false
4+
mermaid: true
5+
type: examples
6+
source: "community"
7+
implementation: "score-k8s"
8+
resourceType: "azure-blob"
9+
provisionerType: "template"
10+
flavor: "azurite"
11+
excerpt: 'Runs [Azurite](https://learn.microsoft.com/en-us/azure/storage/common/storage-use-azurite), the Azure Storage emulator, as a `StatefulSet` with a 1Gi volume, and exposes its blob endpoint through a `ClusterIP` Service on port `10000`. It&#39;s meant for local development against the Azure Blob SDK without provisioning a real Storage account.'
12+
description: 'Generates an Azurite (Azure Storage emulator) StatefulSet and Service exposing the blob endpoint.'
13+
expectedOutputs:
14+
- connection_string
15+
- account_name
16+
- account_key
17+
- blob_endpoint
18+
- container
19+
supportedParams:
20+
- container
21+
hasMore: true
22+
23+
---
24+
25+
## For `10-azurite-azure-blob.provisioners.yaml`
26+
27+
Runs [Azurite](https://learn.microsoft.com/en-us/azure/storage/common/storage-use-azurite), the Azure Storage emulator, as a `StatefulSet` with a 1Gi volume, and exposes its blob endpoint through a `ClusterIP` Service on port `10000`. It's meant for local development against the Azure Blob SDK without provisioning a real Storage account.
28+
29+
The workload gets these outputs:
30+
31+
- `connection_string` - ready to drop into `AZURE_STORAGE_CONNECTION_STRING` or pass to `BlobServiceClient`.
32+
- `account_name`, `account_key` - Azurite's well-known dev account (`devstoreaccount1`).
33+
- `blob_endpoint` - `http://<service>:10000/devstoreaccount1`.
34+
- `container` - a container name for the workload to use. Override it with the `container` param.
35+
36+
A couple of things worth knowing:
37+
38+
- The account name and key are Azurite's [well-known credentials](https://learn.microsoft.com/en-us/azure/storage/common/storage-use-azurite#well-known-storage-account-and-key). They're the same for every Azurite instance and are published in the docs, so treat them as a local-dev convenience, not as secrets.
39+
- Azurite starts empty. The `container` output is just a name - have your app create it on startup (`create_if_not_exists` / `createIfNotExists` exists in every Azure SDK), or run `az storage container create` against the endpoint once it's up.
40+
41+
Prerequisites:
42+
43+
- None beyond `score-k8s`. This is a template provisioner, so there's no `helm` or `yq` dependency.
44+
- To actually run it, apply the generated manifests to any cluster. If you don't have one, `.scripts/setup-kind-cluster.sh` spins up a local Kind cluster.
45+
46+
{{% resource-provisioner-content description="Generates an Azurite (Azure Storage emulator) StatefulSet and Service exposing the blob endpoint." type="azure-blob" supportedParams="container" expectedOutputs="connection_string,account_name,account_key,blob_endpoint,container" %}}
47+
48+
{{% example-file filename="10-azurite-azure-blob.provisioners.yaml" dir="resource-provisioners/community/azure-blob/score-k8s" githubUrl="https://github.com/score-spec/community-provisioners/blob/main" %}}
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
---
2+
title: "Azure Blob"
3+
draft: false
4+
mermaid: true
5+
type: examples
6+
excerpt: ''
7+
hasMore: false
8+
parent: "Community Provisioners"
9+
flavor: "Resources"
10+
11+
---
12+
13+
{{% example-file filename="score.yaml" dir="score/resources/community-provisioners/azure-blob" githubUrl="https://github.com/score-spec/community-provisioners/blob/main" %}}
14+
15+
{{< tabs >}}
16+
{{% tab name="score-compose" %}}
17+
Initialize your local workspace, by importing a specific community provisioner:
18+
19+
```bash
20+
score-compose init --provisioners REPLACE-ME-WITH-ACTUAL-PROVISIONER-FILE-URL.yaml
21+
```
22+
23+
_Note: you need to replace `REPLACE-ME-WITH-ACTUAL-PROVISIONER-FILE-URL.yaml` by the actual provisioner file you want to use and import. More information [here](https://docs.score.dev/docs/score-implementation/score-compose/resources-provisioners/#install-provisioner-files)._
24+
25+
Get the provisioners definition:
26+
27+
```bash
28+
score-compose provisioners list
29+
```
30+
31+
Generate the platform specific manifests:
32+
33+
```bash
34+
score-compose generate score.yaml
35+
```
36+
37+
See the resource outputs:
38+
39+
```bash
40+
score-compose resources list
41+
```
42+
43+
You can run the following command on each resource listed with the previous command to get their `outputs`:
44+
45+
```bash
46+
score-compose resources get-outputs
47+
```
48+
49+
Deploy the generated manifests:
50+
51+
```bash
52+
docker compose up -d
53+
```
54+
55+
See the running containers:
56+
57+
```bash
58+
docker ps
59+
```
60+
61+
{{%/ tab %}}
62+
{{% tab name="score-k8s" %}}
63+
{{% example-file filename="10-azurite-azure-blob.provisioners.yaml" dir="score/resources/community-provisioners/azure-blob/score-k8s" githubUrl="https://github.com/score-spec/community-provisioners/blob/main" %}}
64+
{{% example-file filename="README.md" dir="score/resources/community-provisioners/azure-blob/score-k8s" githubUrl="https://github.com/score-spec/community-provisioners/blob/main" %}}
65+
66+
---
67+
68+
Initialize your local workspace, by importing a specific community provisioner:
69+
70+
```bash
71+
score-k8s init --provisioners REPLACE-ME-WITH-ACTUAL-PROVISIONER-FILE-URL.yaml
72+
```
73+
74+
_Note: you need to replace `REPLACE-ME-WITH-ACTUAL-PROVISIONER-FILE-URL.yaml` by the actual provisioner file you want to use and import. More information [here](https://docs.score.dev/docs/score-implementation/score-k8s/resources-provisioners/#install-provisioner-files)._
75+
76+
Get the provisioners definition:
77+
78+
```bash
79+
score-k8s provisioners list
80+
```
81+
82+
Generate the platform specific manifests:
83+
84+
```bash
85+
score-k8s generate score.yaml
86+
```
87+
88+
See the resource outputs:
89+
90+
```bash
91+
score-k8s resources list
92+
```
93+
94+
You can run the following command on each resource listed with the previous command to get their `outputs`:
95+
96+
```bash
97+
score-k8s resources get-outputs
98+
```
99+
100+
Deploy the generated manifests:
101+
102+
```bash
103+
kubectl apply -f manifests.yaml
104+
```
105+
106+
See the running containers:
107+
108+
```bash
109+
kubectl get all
110+
```
111+
112+
{{%/ tab %}}
113+
{{< /tabs >}}

data/examplesMeta.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ resource-provisioners:
99
- template
1010
resourceType:
1111
- amqp
12+
- azure-blob
1213
- dapr-pubsub
1314
- dapr-state-store
1415
- dapr-subscription
@@ -33,6 +34,7 @@ resource-provisioners:
3334
- service-port
3435
- volume
3536
flavor:
37+
- azurite
3638
- dapr
3739
- default
3840
- dmr

gen/external-content/resource-provisioners/community/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ score-k8s init --provisioners https://raw.githubusercontent.com/score-spec/commu
3535

3636
| File | Type | Class | Params | Outputs | Description
3737
| ---- | ---- | ----- | ------ | ------- | -----------
38+
| 10-azurite-azure-blob.provisioners.yaml | `azure-blob` | (any) | `container` | `connection_string`, `account_name`, `account_key`, `blob_endpoint`, `container` | Generates an Azurite (Azure Storage emulator) `StatefulSet` and `Service` exposing the blob endpoint.
3839
| 10-rabbitmq-dapr-pubsub.provisioners.yaml | `dapr-pubsub` | (any) | (none) | `name` | Generates a Dapr PubSub `Component` pointing to a RabbitMQ `StatefulSet`.
3940
| 10-redis-dapr-pubsub.provisioners.yaml | `dapr-pubsub` | (any) | (none) | `name` | Generates a Dapr PubSub `Component` pointing to a Redis `StatefulSet`.
4041
| 10-redis-dapr-state-store.provisioners.yaml | `dapr-state-store` | (any) | (none) | `name` | Generates a Dapr StateStore `Component` pointing to a Redis `StatefulSet`.
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
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
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
## For `10-azurite-azure-blob.provisioners.yaml`
2+
3+
Runs [Azurite](https://learn.microsoft.com/en-us/azure/storage/common/storage-use-azurite), the Azure Storage emulator, as a `StatefulSet` with a 1Gi volume, and exposes its blob endpoint through a `ClusterIP` Service on port `10000`. It's meant for local development against the Azure Blob SDK without provisioning a real Storage account.
4+
5+
The workload gets these outputs:
6+
7+
- `connection_string` - ready to drop into `AZURE_STORAGE_CONNECTION_STRING` or pass to `BlobServiceClient`.
8+
- `account_name`, `account_key` - Azurite's well-known dev account (`devstoreaccount1`).
9+
- `blob_endpoint` - `http://<service>:10000/devstoreaccount1`.
10+
- `container` - a container name for the workload to use. Override it with the `container` param.
11+
12+
A couple of things worth knowing:
13+
14+
- The account name and key are Azurite's [well-known credentials](https://learn.microsoft.com/en-us/azure/storage/common/storage-use-azurite#well-known-storage-account-and-key). They're the same for every Azurite instance and are published in the docs, so treat them as a local-dev convenience, not as secrets.
15+
- Azurite starts empty. The `container` output is just a name - have your app create it on startup (`create_if_not_exists` / `createIfNotExists` exists in every Azure SDK), or run `az storage container create` against the endpoint once it's up.
16+
17+
Prerequisites:
18+
- None beyond `score-k8s`. This is a template provisioner, so there's no `helm` or `yq` dependency.
19+
- To actually run it, apply the generated manifests to any cluster. If you don't have one, `.scripts/setup-kind-cluster.sh` spins up a local Kind cluster.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
apiVersion: score.dev/v1b1
2+
metadata:
3+
name: my-workload
4+
containers:
5+
my-container:
6+
image: busybox
7+
command: ["/bin/sh"]
8+
args: ["-c", "while true; do echo $AZURE_STORAGE_CONNECTION_STRING; sleep 5; done"]
9+
variables:
10+
AZURE_STORAGE_CONNECTION_STRING: "${resources.blob.connection_string}"
11+
AZURE_STORAGE_ACCOUNT: "${resources.blob.account_name}"
12+
AZURE_STORAGE_KEY: "${resources.blob.account_key}"
13+
AZURE_BLOB_ENDPOINT: "${resources.blob.blob_endpoint}"
14+
AZURE_BLOB_CONTAINER: "${resources.blob.container}"
15+
resources:
16+
blob:
17+
type: azure-blob
18+
params:
19+
container: my-workload-data

gen/external-content/score/resources/community-provisioners/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ score-k8s init --provisioners https://raw.githubusercontent.com/score-spec/commu
3535

3636
| File | Type | Class | Params | Outputs | Description
3737
| ---- | ---- | ----- | ------ | ------- | -----------
38+
| 10-azurite-azure-blob.provisioners.yaml | `azure-blob` | (any) | `container` | `connection_string`, `account_name`, `account_key`, `blob_endpoint`, `container` | Generates an Azurite (Azure Storage emulator) `StatefulSet` and `Service` exposing the blob endpoint.
3839
| 10-rabbitmq-dapr-pubsub.provisioners.yaml | `dapr-pubsub` | (any) | (none) | `name` | Generates a Dapr PubSub `Component` pointing to a RabbitMQ `StatefulSet`.
3940
| 10-redis-dapr-pubsub.provisioners.yaml | `dapr-pubsub` | (any) | (none) | `name` | Generates a Dapr PubSub `Component` pointing to a Redis `StatefulSet`.
4041
| 10-redis-dapr-state-store.provisioners.yaml | `dapr-state-store` | (any) | (none) | `name` | Generates a Dapr StateStore `Component` pointing to a Redis `StatefulSet`.

0 commit comments

Comments
 (0)