No description
  • Go 89.3%
  • Dockerfile 7.2%
  • Shell 3.5%
Find a file
2020-05-03 13:07:19 +02:00
config small update 2020-05-03 12:44:14 +02:00
.gitignore first commit 2019-12-01 21:25:08 +01:00
.ko.yaml updates configs 2019-12-14 19:51:38 +01:00
build.sh first commit 2019-12-01 21:25:08 +01:00
Dockerfile small update 2020-05-03 12:44:14 +02:00
go.mod first commit 2019-12-01 21:25:08 +01:00
go.sum first commit 2019-12-01 21:25:08 +01:00
LICENSE fixed license 2019-12-01 21:33:24 +01:00
main.go fixed license 2019-12-01 21:33:24 +01:00
README.md fixed tab char 2020-05-03 13:07:19 +02:00

template-solver

The template-solver is a Cert-Manager Webhook solver implementation, that itself constructs and sends webhooks or API requests.

Requirements

  • Kubernetes Cluster
  • Cert-Manager v0.12.0
  • go
  • ko

Usage

Config

Note: headers, urlData and bodyData values need to start with an upper-case letter.

If bodyTemplate is defined a POST request will be sent.

Cleanup requests contain an empty DNSKey.

webhook:
  groupName: template-solver
  solverName: template-solver
  config:
    apiKeySecretRef:
      name: api-key
      key: example.com
    headers:
      Content-Type: "application/json"
    urlTemplate: "{{.URLData.Url}}{{.APIKey}}={{.DNSKey}}"
    urlData:
      Url: "https://ns.example.com/update.html?"
    bodyTemplate: ""
    bodyData:

Example

Secret to store webhook API key:

Note: the api-key secret must be created in the same namespace as the Certificate.

apiVersion: v1
kind: Secret
metadata:
  name: api-key
  namespace: default
type: Opaque
stringData:
  example.com: 92f6766fc1a43d9a96ccd93d33294cc6

Issuer:

apiVersion: cert-manager.io/v1alpha2
kind: Issuer
metadata:
  name: template-solver-issuer
  namespace: default
spec:
  acme:
    email: user@example.com
    server: https://acme-staging-v02.api.letsencrypt.org/directory
    privateKeySecretRef:
      name: template-solver-issuer-account-key
    solvers:
    - dns01:
        webhook:
          groupName: template-solver
          solverName: template-solver
          config:
            apiKeySecretRef:
              name: api-key
              key: example.com
            urlTemplate: "{{.URLData.Url}}{{.APIKey}}={{.DNSKey}}"
            urlData:
              Url: "https://ns.example.com/update.html?"

Certificate:

apiVersion: cert-manager.io/v1alpha2
kind: Certificate
metadata:
  name: example-com
  namespace: default
spec:
  secretName: example-com-tls
  duration: 2160h
  renewBefore: 360h
  isCA: false
  keySize: 2048
  keyAlgorithm: rsa
  keyEncoding: pkcs1
  usages:
    - server auth
    - client auth
  dnsNames:
  - '*.example.com'
  issuerRef:
    name: template-solver-issuer

Build and run

echo KO_DOCKER_REPO='gcr.io/my-gcloud-project-name' >env.txt

./build.sh