feat: support manually managed cert issuers on k3s
The `cert-issuer-name` and `cert-issuer-kind` properties point an app's generated `Certificate` at a cert-manager issuer created outside of Dokku, allowing certificates to be issued through solvers the built-in letsencrypt integration cannot use, such as `dns01` for wildcard certificates. Setting an issuer enables https on its own, as a manually managed issuer has no email for Dokku to configure. An imported certificate still takes precedence, and `letsencrypt-server false` remains the single off switch. Dokku warns before a build starts when the referenced issuer is absent from the cluster, without blocking the deploy. Wildcard domains no longer collide with their apex domain when generating ingress names, and `letsencrypt-server` values are now validated when set rather than at deploy time.
This commit is contained in:
14 files changed
+980
-42
No files matched your search
@@ -25,6 +25,7 @@ import (
|
||||
batchv1 "k8s.io/api/batch/v1"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
networkingv1 "k8s.io/api/networking/v1"
|
||||
k8serrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
@@ -684,6 +685,48 @@ func (k KubernetesClient) GetSecret(ctx context.Context, input GetSecretInput) (
|
||||
return *secret, err
|
||||
}
|
||||
|
||||
// CertIssuerExistsInput contains all the information needed to look up a cert-manager issuer
|
||||
type CertIssuerExistsInput struct {
|
||||
// Kind is the cert-manager issuer kind, either Issuer or ClusterIssuer
|
||||
Kind string
|
||||
|
||||
// Name is the cert-manager issuer name
|
||||
Name string
|
||||
|
||||
// Namespace is the namespace to search for a namespaced Issuer. It is ignored
|
||||
// for a cluster-scoped ClusterIssuer.
|
||||
Namespace string
|
||||
}
|
||||
|
||||
// CertIssuerExists reports whether a cert-manager issuer of the given kind and name
|
||||
// exists. A missing issuer returns false with no error, while an unreachable cluster,
|
||||
// an absent cert-manager CRD, or insufficient permissions return an error so callers
|
||||
// can distinguish "not there" from "could not tell".
|
||||
func (k KubernetesClient) CertIssuerExists(ctx context.Context, input CertIssuerExistsInput) (bool, error) {
|
||||
resource := "clusterissuers"
|
||||
namespace := ""
|
||||
if input.Kind == CertIssuerKindIssuer {
|
||||
resource = "issuers"
|
||||
namespace = input.Namespace
|
||||
}
|
||||
|
||||
gvr := schema.GroupVersionResource{
|
||||
Group: "cert-manager.io",
|
||||
Version: "v1",
|
||||
Resource: resource,
|
||||
}
|
||||
|
||||
_, err := k.DynamicClient.Resource(gvr).Namespace(namespace).Get(ctx, input.Name, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
if k8serrors.IsNotFound(err) {
|
||||
return false, nil
|
||||
}
|
||||
return false, err
|
||||
}
|
||||
|
||||
return true, nil
|
||||
}
|
||||
|
||||
// LabelNodeInput contains all the information needed to label a Kubernetes node
|
||||
type LabelNodeInput struct {
|
||||
// Name is the Kubernetes node name
|
||||
|
||||
Reference in new issue
Block a user