Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ score-compose init --provisioners https://raw.githubusercontent.com/score-spec/c
| 10-dns-with-url.provisioners.yaml | `dns` | (any) | (none) | `host`, `url` | Outputs a `*.localhost` domain as the hostname and associated URL in http on port `8080`.
| 10-endpoint-with-microcks.provisioners.yaml | `endpoint` | (any) | `port`, `openapi_file`, `openapi_title` | `url` | Outputs an endpoint URL for connecting to an other workload (a Microcks mock is generated if not found).
| 10-env.provisioners.yaml | `environment` | (any) | (none) | (none) | Loads environment variables from a local `.env` file.
| 10-gcp-pubsub-emulator.provisioners.yaml | `gcp-pubsub-emulator` | (any) | `project_id` | `host`, `port`, `project_id`, `emulator_host` | Generates a Google Cloud Pub/Sub Emulator service for local development.
| 10-hpa.provisioners.yaml | `horizontal-pod-autoscaler` | (any) | (none) | (none) | Generates an empty object because HPA is not supported in Docker Compose.
| 10-dmr-llm-model-via-curl-cmd.provisioners.yaml | `llm-model` | (any) | `model` | `model`, `url`, `api-key` | Runs `curl` to download the model with the Docker Model Runner (DMR).
| 10-dmr-llm-model-via-curl-service.provisioners.yaml | `llm-model` | (any) | `model` | `model`, `url`, `api-key` | Generates a `curl` service downloading the model with the Docker Model Runner (DMR).
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# GCP Pub/Sub Emulator provisioner
# For local development and testing without connecting to real GCP
- uri: template://community-provisioners/gcp-pubsub-emulator
type: gcp-pubsub-emulator
description: Generates a Google Cloud Pub/Sub Emulator service for local development.
supported_params:
- project_id
init: |
port: 8085
randomServiceName: pubsub-emulator-{{ randAlphaNum 6 | lower }}
defaultProjectId: test-project-{{ randAlphaNum 6 | lower }}
state: |
serviceName: {{ dig "serviceName" .Init.randomServiceName .State | quote }}
projectId: {{ dig "projectId" (.Params.project_id | default .Init.defaultProjectId) .State | quote }}
outputs: |
host: {{ .State.serviceName }}
port: {{ .Init.port }}
project_id: {{ .State.projectId }}
emulator_host: {{ .State.serviceName }}:{{ .Init.port }}
expected_outputs:
- host
- port
- project_id
- emulator_host
services: |
{{ .State.serviceName }}:
labels:
dev.score.compose.res.uid: {{ .Uid }}
image: gcr.io/google.com/cloudsdktool/google-cloud-cli:emulators
command:
- gcloud
- beta
- emulators
- pubsub
- start
- --host-port=0.0.0.0:{{ .Init.port }}
- --project={{ .State.projectId }}
restart: always
info_logs: |
- "{{ .Uid }}: Pub/Sub Emulator is running at {{ .State.serviceName }}:{{ .Init.port }}"
18 changes: 18 additions & 0 deletions gcp-pubsub-emulator/score.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: score.dev/v1b1
metadata:
name: my-workload
containers:
my-container:
image: busybox
command: ["/bin/sh"]
args: ["-c", "while true; do echo $PUBSUB_EMULATOR_HOST; sleep 5; done"]
variables:
PUBSUB_HOST: "${resources.pubsub.host}"
PUBSUB_PORT: "${resources.pubsub.port}"
PUBSUB_PROJECT_ID: "${resources.pubsub.project_id}"
PUBSUB_EMULATOR_HOST: "${resources.pubsub.emulator_host}"
resources:
pubsub:
type: gcp-pubsub-emulator
params:
project_id: my-test-project