项目作者: scaleway

项目描述 :
A Scaleway DNS ACME webhook for cert-manager
高级语言: Go
项目地址: git://github.com/scaleway/cert-manager-webhook-scaleway.git
创建时间: 2020-11-18T17:00:00Z
项目社区:https://github.com/scaleway/cert-manager-webhook-scaleway

开源协议:

下载


cert-manager Webhook for Scaleway DNS

cert-manager Webhook for Scaleway DNS is a ACME webhook for cert-manager allowing users to use Scaleway DNS for DNS01 challenge.

Getting started

Prerequisites

Installing

Attention: starting from 0.1.0 the chart’s name is now named scaleway-certmanager-webhook, if upgrading from an older version you might want to add --set nameOverride=scaleway-webhook

  • Add scaleway’s helm chart repository:
  1. helm repo add scaleway https://helm.scw.cloud/
  2. helm repo update
  • Install the chart
  1. helm install scaleway-certmanager-webhook scaleway/scaleway-certmanager-webhook
  • Alternatively, you can install the webhook with default credentials with:
  1. helm install scaleway-certmanager-webhook scaleway/scaleway-certmanager-webhook --set secret.accessKey=<YOUR-ACCESS-KEY> --set secret.secretKey=<YOUR-SECRET_KEY>

The Scaleway Webhook is now installed! :tada:

Refer to the chart’s documentation for more configuration options.

Alternatively, you may use the provided bundle for a basic install in the cert-manager namespace:
kubectl apply -f https://raw.githubusercontent.com/scaleway/cert-manager-webhook-scaleway/main/deploy/bundle.yaml

How to use it

Note: It uses the cert-manager webhook system. Everything after the issuer is configured is just cert-manager. You can find out more in their documentation.

Now that the webhook is installed, here is how to use it.
Let’s say you need a certificate for example.com (should be registered in Scaleway DNS).

First step is to create a secret containing the Scaleway Access and Secret keys. Create the scaleway-secret.yaml file with the following content:
(Only needed if you don’t have default credentials as seen above).

  1. apiVersion: v1
  2. stringData:
  3. SCW_ACCESS_KEY: <YOUR-SCALEWAY-ACCESS-KEY>
  4. SCW_SECRET_KEY: <YOUR-SCALEWAY-SECRET-KEY>
  5. kind: Secret
  6. metadata:
  7. name: scaleway-secret
  8. type: Opaque

And run:

  1. kubectl create -f scaleway-secret.yaml

Next step is to create a cert-manager Issuer. Create a issuer.yaml file with the following content:

  1. apiVersion: cert-manager.io/v1
  2. kind: Issuer
  3. metadata:
  4. name: my-scaleway-issuer
  5. spec:
  6. acme:
  7. email: my-user@example.com
  8. # this is the acme staging URL
  9. server: https://acme-staging-v02.api.letsencrypt.org/directory
  10. # for production use this URL instead
  11. # server: https://acme-v02.api.letsencrypt.org/directory
  12. privateKeySecretRef:
  13. name: my-scaleway-private-key-secret
  14. solvers:
  15. - dns01:
  16. webhook:
  17. groupName: acme.scaleway.com
  18. solverName: scaleway
  19. config:
  20. # Only needed if you don't have default credentials as seen above.
  21. accessKeySecretRef:
  22. key: SCW_ACCESS_KEY
  23. name: scaleway-secret
  24. secretKeySecretRef:
  25. key: SCW_SECRET_KEY
  26. name: scaleway-secret

And run:

  1. kubectl create -f issuer.yaml

Finally, you can now create the Certificate object for example.com. Create a certificate.yaml file with the following content:

  1. apiVersion: cert-manager.io/v1
  2. kind: Certificate
  3. metadata:
  4. name: example-com
  5. spec:
  6. dnsNames:
  7. - example.com
  8. issuerRef:
  9. name: my-scaleway-issuer
  10. secretName: example-com-tls

And run:

  1. kubectl create -f certificate.yaml

After some seconds, you should see the certificate as ready:

  1. $ kubectl get certificate example-com
  2. NAME READY SECRET AGE
  3. example-com True example-com-tls 1m12s

Your certificate is now available in the example-com-tls secret!

Integration testing

Before running the test, you need:

  • A valid domain on Scaleway DNS (here example.com)
  • The variables SCW_ACCESS_KEY and SCW_SECRET_KEY valid and in the environment

In order to run the integration tests, run:

  1. TEST_ZONE_NAME=example.com make test