Skip to content

Commit

Permalink
feat(daml-on-sawtooth): add individual daml-triggers
Browse files Browse the repository at this point in the history
SXT-566

Signed-off-by: Kevin O'Donnell <kevin@blockchaintp.com>
SXT-566
SXT-566
  • Loading branch information
scealiontach committed Feb 15, 2021
1 parent 285031c commit 61e9121
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 6 deletions.
7 changes: 6 additions & 1 deletion charts/daml-on-sawtooth/README.md
Expand Up @@ -27,6 +27,9 @@
| `sawtooth.containers.daml_trigger.args` | extra args | string | nil |
| `sawtooth.containers.daml_trigger.env` | list of environment name/valie dicts | map | nil |
| `sawtooth.containers.daml_trigger.imagePullPolicy` | imagePullPolicy for container | string | IfNotPresent |
| `sawtooth.containers.daml_rpc.args` | extra args | string | nil |
| `sawtooth.containers.daml_rpc.env` | list of environment name/valie dicts | map | nil |
| `sawtooth.containers.daml_rpc.imagePullPolicy` | imagePullPolicy for container | string | IfNotPresent |
| `sawtooth.containers.daml_tp.args` | extra args | string | nil |
| `sawtooth.containers.daml_tp.env` | list of environment name/valie dicts | map | nil |
| `sawtooth.containers.daml_tp.imagePullPolicy` | imagePullPolicy for container | string | IfNotPresent |
Expand Down Expand Up @@ -139,6 +142,7 @@
| field | default |
|- |- |
| `images.postgres` | postgres:11
| `images.daml_trigger` | blockchaintp/daml-trigger:BTP2.1.0rc14
| `images.daml_trigger` | blockchaintp/daml-trigger-service:BTP2.1.0rc14
| `images.daml_json_api` | blockchaintp/daml-json-api:BTP2.1.0rc14
| `images.daml_rpc` | blockchaintp/sawtooth-daml-rpc:BTP2.1.0rc14
Expand All @@ -164,10 +168,11 @@ Tiggers are described using maps of the following parameters

| field | description | required | type | default |
|- |- |- |- |- |
| `name` | kubernetes name of the trigger container | no | string | (system-determined) |
| `name` | kubernetes name of the trigger container | yes | string | (system-determined) |
| `triggerName` | daml name of the trigger to be run | yes | string | nil |
| `darFile` | path of the dar file to use | yes | string | nil |
| `party` | name of the party to use | yes | string | nil |
| `env` | environment var for the trigger | no | list | [] |

## Custom TP Definitions

Expand Down
49 changes: 46 additions & 3 deletions charts/daml-on-sawtooth/templates/daml-rpc.yaml
Expand Up @@ -71,8 +71,8 @@ spec:
value: {{ .value | quote }}
{{- end }}
{{ if .Values.daml.trigger_service.enabled }}
- name: daml-trigger
image: {{.Values.images.daml_trigger}}
- name: daml-trigger-service
image: {{.Values.images.daml_trigger_service}}
imagePullPolicy: {{.Values.sawtooth.containers.daml_trigger.imagePullPolicy}}
ports:
- containerPort: {{.Values.sawtooth.ports.trigger_http_port}}
Expand Down Expand Up @@ -130,9 +130,44 @@ spec:
volumeMounts:
{{- toYaml .Values.sawtooth.daml.trigger.extraVolumeMounts | nindent 12 }}
{{- end }}
{{ end }}
{{- end }}
{{- range .Values.daml.triggers }}
- name: {{.name}}
image: {{$.Values.images.daml_trigger}}
imagePullPolicy: {{$.Values.sawtooth.containers.daml_trigger.imagePullPolicy}}
command:
- bash
- -c
args:
- |
/home/daml/.daml/bin/trigger-entrypoint \
{{- if $.Values.sawtooth.containers.daml_trigger.args }}
{{$.Values.sawtooth.containers.daml_trigger.args }} \
{{- end}}
{{- if .args }}
{{.args }} \
{{- end}}
env:
- name: DAR_FILE
value: {{.darFile | quote}}
- name: LEDGER_PARTY
value: {{.party | quote}}
- name: TRIGGER_NAME
value: {{.triggerName | quote}}
{{- range .env }}
- name: {{ .name }}
value: {{ .value | quote }}
{{- end }}
{{- range $.Values.sawtooth.containers.daml_trigger.env }}
- name: {{ .name }}
value: {{ .value | quote }}
{{- end }}
volumeMounts:
{{- toYaml $.Values.sawtooth.daml.trigger.extraVolumeMounts | nindent 12 }}
{{- end }}
- name: daml-rpc
image: {{.Values.images.daml_rpc}}
imagePullPolicy: {{.Values.sawtooth.containers.daml_rpc.imagePullPolicy}}
command: [ "bash", "-xc"]
args:
- |
Expand All @@ -145,10 +180,18 @@ spec:
{{- if .Values.daml.auth.enabled }}
--auth-jwt-rs256-crt /secrets/jwt/jwt.crt \
{{- end }}
{{- if .Values.sawtooth.containers.daml_rpc.args }}
{{.Values.sawtooth.containers.daml_rpc.args }} \
{{- end}}
{{- if .Values.sawtooth.daml.extra_args.enabled }}
{{ .Values.sawtooth.daml.extra_args.arg_str }} \
{{- end }}
;
env:
{{- range .Values.sawtooth.containers.daml_rpc.env }}
- name: {{ .name }}
value: {{ .value | quote }}
{{- end }}
resources:
limits:
cpu: "250m"
Expand Down
14 changes: 12 additions & 2 deletions charts/daml-on-sawtooth/values.yaml
Expand Up @@ -67,6 +67,13 @@ sawtooth:
env:
## @md | `sawtooth.containers.daml_trigger.imagePullPolicy` | imagePullPolicy for container | string | IfNotPresent |
imagePullPolicy: IfNotPresent
daml_rpc:
## @md | `sawtooth.containers.daml_rpc.args` | extra args | string | nil |
args:
## @md | `sawtooth.containers.daml_rpc.env` | list of environment name/valie dicts | map | nil |
env:
## @md | `sawtooth.containers.daml_rpc.imagePullPolicy` | imagePullPolicy for container | string | IfNotPresent |
imagePullPolicy: IfNotPresent
daml_tp:
## @md | `sawtooth.containers.daml_tp.args` | extra args | string | nil |
args:
Expand Down Expand Up @@ -343,8 +350,10 @@ images:
## @md |- |- |
## @md | `images.postgres` | postgres:11
postgres: postgres:11
## @md | `images.daml_trigger` | blockchaintp/daml-trigger:BTP2.1.0rc14
daml_trigger: blockchaintp/daml-trigger:BTP2.1.0rc14
## @md | `images.daml_trigger` | blockchaintp/daml-trigger-service:BTP2.1.0rc14
daml_trigger: blockchaintp/daml-trigger-service:BTP2.1.0rc14
daml_trigger_service: blockchaintp/daml-trigger-service:BTP2.1.0rc14
## @md | `images.daml_json_api` | blockchaintp/daml-json-api:BTP2.1.0rc14
daml_json_api: blockchaintp/daml-json-api:BTP2.1.0rc14
## @md | `images.daml_rpc` | blockchaintp/sawtooth-daml-rpc:BTP2.1.0rc14
Expand Down Expand Up @@ -387,10 +396,11 @@ images:
## @md
## @md | field | description | required | type | default |
## @md |- |- |- |- |- |
## @md | `name` | kubernetes name of the trigger container | no | string | (system-determined) |
## @md | `name` | kubernetes name of the trigger container | yes | string | (system-determined) |
## @md | `triggerName` | daml name of the trigger to be run | yes | string | nil |
## @md | `darFile` | path of the dar file to use | yes | string | nil |
## @md | `party` | name of the party to use | yes | string | nil |
## @md | `env` | environment var for the trigger | no | list | [] |

## @md
## @md ## Custom TP Definitions
Expand Down

0 comments on commit 61e9121

Please sign in to comment.