Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow managing (Cluster)Issuer manifests #159

Merged
merged 1 commit into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions class/defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ parameters:
ingress:
class: 'nginx'
secrets: {}
cluster_issuers: {}
issuers: {}
acme_dns_api: {}
# acme_dns_api:
# endpoint: acme-dns-api.example.com
Expand Down
6 changes: 5 additions & 1 deletion component/main.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ local secrets = [
for s in std.objectFields(params.secrets)
];

local issuers = com.generateResources(params.issuers, cm.issuer);
local clusterIssuers = com.generateResources(params.cluster_issuers, cm.clusterIssuer);

local acmedns = import 'acme-dns.libsonnet';

{
Expand All @@ -56,8 +59,9 @@ local acmedns = import 'acme-dns.libsonnet';
[
if params.letsencrypt_clusterissuers.staging then letsencrypt_staging,
if params.letsencrypt_clusterissuers.production then letsencrypt_production,
]
] + clusterIssuers
),
'05_issuer': issuers,
[if std.length(secrets) > 0 then '10_solver_secrets']:
secrets,
[if std.objectHas(acmedns, 'manifests') then '20_acme_dns']:
Expand Down
30 changes: 30 additions & 0 deletions docs/modules/ROOT/pages/references/parameters.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,36 @@ By default, secrets are created in the namespace in which cert-manager is deploy

See the https://cert-manager.io/docs/configuration/acme/dns01/[cert-manager documentation] for DNS01 solvers which are supported by cert-manager.

== `cluster_issuers`, `issuers`

[horizontal]
type:: dictionary
default:: `{}`
example::
+
[source,yaml]
----
issuers:
ca-issuer:
metadata:
namespace: mesh-system
spec:
ca:
secretName: ca-key-pair

cluster_issuers:
ca-issuer:
spec:
ca:
secretName: ca-key-pair
----

Dictionaries holding issuers and cluster issuers.
Each key in the dictionary is used as the name of an issuer.
The value of the key is merged directly into an empty Kubernetes `(Cluster)Issuer` resource.

See the https://cert-manager.io/docs/concepts/issuer/[cert-manager documentation] for how to configure such issuers.

== `acme_dns_api`

[horizontal]
Expand Down
14 changes: 14 additions & 0 deletions tests/defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,19 @@ parameters:
- example.com
- apps.example.com

issuers:
ca-issuer:
metadata:
namespace: mesh-system
spec:
ca:
secretName: ca-key-pair

cluster_issuers:
ca-issuer:
spec:
ca:
secretName: ca-key-pair

prometheus:
defaultInstance: infra-monitoring
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,14 @@ spec:
- http01:
ingress:
class: nginx
---
apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
annotations: {}
labels:
name: ca-issuer
name: ca-issuer
spec:
ca:
secretName: ca-key-pair
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
annotations: {}
labels:
name: ca-issuer
name: ca-issuer
namespace: mesh-system
spec:
ca:
secretName: ca-key-pair
Loading