Skip to content

Commit

Permalink
cert-manager: Add support for Azure DNS
Browse files Browse the repository at this point in the history
  • Loading branch information
gtirloni committed Jul 25, 2024
1 parent 558c4a6 commit ecdd3bd
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 0 deletions.
16 changes: 16 additions & 0 deletions doc/source/deploy/certificates.rst
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,22 @@ your ACME server can reach your API, you don't need to do anything else.
If your ACME server cannot reach your API, you will need to use the ``DNS-01``
challenges which require you to configure your DNS provider.

Azure DNS
*********

To configure cert-manager with Azure DNS, create a `Service Principal
<https://cert-manager.io/docs/configuration/acme/dns01/azuredns/#service-principal>`_ and set the following variables:

.. code-block:: yaml
cluster_issuer_acme_solver: azuredns
cluster_issuer_acme_azuredns_client_id: <CLIENT_ID>
cluster_issuer_acme_azuredns_client_secret: <CLIENT_SECRET>
cluster_issuer_acme_azuredns_subscription_id: <SUBSCRIPTION_ID>
cluster_issuer_acme_azuredns_tenant_id: <TENANT_ID>
cluster_issuer_acme_azuredns_resourcegroup_name: <RESOURCEGROUP_NAME>
cluster_issuer_acme_azuredns_hostedzone_name: <HOSTEDZONE_NAME>
RFC2136
*******

Expand Down
9 changes: 9 additions & 0 deletions roles/cluster_issuer/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,12 @@ cluster_issuer_ca_secret_name: cert-manager-issuer-ca

cluster_issuer_self_signed_certificate_name: self-signed-ca
cluster_issuer_self_signed_secret_name: cert-manager-selfsigned-ca

cluster_issuer_acme_azuredns_secret_name: cert-manager-issuer-azuredns-credentials
cluster_issuer_acme_azuredns_environment: AzurePublicCloud
# cluster_issuer_acme_azuredns_client_id:
# cluster_issuer_acme_azuredns_client_secret:
# cluster_issuer_acme_azuredns_subscription_id:
# cluster_issuer_acme_azuredns_tenant_id:
# cluster_issuer_acme_azuredns_resourcegroup_name:
# cluster_issuer_acme_azuredns_hostedzone_name:
43 changes: 43 additions & 0 deletions roles/cluster_issuer/tasks/type/acme/solver/azuredns.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) VEXXHOST, Inc.

- name: Create ClusterIssuer
run_once: true
kubernetes.core.k8s:
state: present
definition:
- apiVersion: v1
kind: Secret
metadata:
name: "{{ cluster_issuer_acme_azuredns_secret_name }}"
namespace: cert-manager
app.kubernetes.io/part-of: cert-manager
app.kubernetes.io/managed-by: Ansible
type: Opaque
stringData:
client-secret: "{{ cluster_issuer_acme_azuredns_client_secret }}"

- apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
name: "{{ cluster_issuer_name }}"
app.kubernetes.io/part-of: cert-manager
app.kubernetes.io/managed-by: Ansible
spec:
acme:
email: "{{ cluster_issuer_acme_email }}"
server: "{{ cluster_issuer_acme_server }}"
privateKeySecretRef:
name: "{{ cluster_issuer_acme_private_key_secret_name }}"
solvers:
- dns01:
azureDNS:
clientID: "{{ cluster_issuer_acme_azuredns_client_id }}"
clientSecretSecretRef:
name: "{{ cluster_issuer_acme_azuredns_secret_name }}"
key: client-secret
subscriptionID: "{{ cluster_issuer_acme_azuredns_subscription_id }}"
tenantID: "{{ cluster_issuer_acme_azuredns_tenant_id }}"
resourceGroupName: "{{ cluster_issuer_acme_azuredns_resourcegroup_name }}"
hostedZoneName: "{{ cluster_issuer_acme_azuredns_hostedzone_name }}"
environment: "{{ cluster_issuer_acme_azuredns_environment }}"

0 comments on commit ecdd3bd

Please sign in to comment.