This Docker image provides cURL,
gotempl and the script curl-gotempl
to configure a cURL request with templated args (URL, body, headers, cookies,
args and config are golang template files from gotempl).
| Variable | Default | Description |
|---|---|---|
REQUEST_URL | - | Required URL to work with |
REQUEST_METHOD | GET | http method to use |
REQUEST_BODY | `` | templated body to send such as request body. File if prefixed by @ |
REQUEST_HEADERS | `` | templated http headers to send. File if prefixed by @ |
REQUEST_COOKIES | `` | templated http cookies to send. File if prefixed by @ |
REQUEST_CONFIG | `` | templated cURL config. File if prefixed by @ |
REQUEST_ARGS | `` | cURL cli args |
TEMPLATE_DATA | `` | data to use in templates. File if prefixed by @ |
TEMPLATE_DATA_FORMAT | json | data file format to use to complete request body, headers, cookies, args and configuration. Others are yaml and toml |
---
apiVersion: kubirds.com/v1
kind: Unit
metadata:
name: mywebsite-healthcheck
namespace: default
labels:
mywebsite: healthcheck
spec:
image:
name: ghcr.io/link-society/curl-gotempl:latest
pullPolicy: Always
command: curl-gotempl
env:
- name: REQUEST_URL
value: https://mywebsite.com/health
---
apiVersion: kubirds.com/v1
kind: Reactor
metadata:
name: http-notifier
namespace: default
spec:
unitSelector:
mywebsite: healthcheck
image:
name: ghcr.io/link-society/curl-gotempl:latest
pullPolicy: Always
command: curl-gotempl
env:
- name: REQUEST_URL
value: https://slack.api
- name: TOKEN # authorization bearer token
valueFrom:
secretKeyRef:
name: secret_name
key: TOKEN
- name: REQUEST_HEADERS # authorized request
value: | # authorization and content-type
Authorization: Bearer {{ .Env.TOKEN }}
Content-Type: application/json
- name: REQUEST_METHOD # POST method
value: POST
- name: REQUEST_ARGS # send unit logs through proxy
value: | # proxy and unit output logs to upload
-T {{ .Env.UNIT_OUTPUT }}
-x https://myproxy:3000
- name: REQUEST_BODY
value: New state {{ .Env.UNIT_NAME }}/{{ .Env.UNIT_STATE }}
Content type
Image
Digest
Size
11.6 MB
Last updated
over 4 years ago
docker pull linksociety/curl-gotempl