feat(k8s): support acme-email config for Caddy ingress
Adds support for configuring ACME email for Let's Encrypt certificates in kind deployments. The email can be specified in the spec under network.acme-email and will be used to configure the Caddy ingress controller ConfigMap. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>caddy-pvc-persistence
parent
411e777980
commit
21d0975e71
|
|
@ -301,7 +301,8 @@ class K8sDeployer(Deployer):
|
||||||
self.connect_api()
|
self.connect_api()
|
||||||
if self.is_kind() and not self.skip_cluster_management:
|
if self.is_kind() and not self.skip_cluster_management:
|
||||||
# Configure ingress controller (not installed by default in kind)
|
# Configure ingress controller (not installed by default in kind)
|
||||||
install_ingress_for_kind()
|
acme_email = self.cluster_info.spec.get_acme_email()
|
||||||
|
install_ingress_for_kind(acme_email=acme_email)
|
||||||
# Wait for ingress to start
|
# Wait for ingress to start
|
||||||
# (deployment provisioning will fail unless this is done)
|
# (deployment provisioning will fail unless this is done)
|
||||||
wait_for_ingress_in_kind()
|
wait_for_ingress_in_kind()
|
||||||
|
|
|
||||||
|
|
@ -132,7 +132,7 @@ def wait_for_ingress_in_kind():
|
||||||
error_exit("ERROR: Timed out waiting for Caddy ingress to become ready")
|
error_exit("ERROR: Timed out waiting for Caddy ingress to become ready")
|
||||||
|
|
||||||
|
|
||||||
def install_ingress_for_kind():
|
def install_ingress_for_kind(acme_email: str = ""):
|
||||||
api_client = client.ApiClient()
|
api_client = client.ApiClient()
|
||||||
ingress_install = os.path.abspath(
|
ingress_install = os.path.abspath(
|
||||||
get_k8s_dir().joinpath(
|
get_k8s_dir().joinpath(
|
||||||
|
|
@ -143,6 +143,21 @@ def install_ingress_for_kind():
|
||||||
print("Installing Caddy ingress controller in kind cluster")
|
print("Installing Caddy ingress controller in kind cluster")
|
||||||
utils.create_from_yaml(api_client, yaml_file=ingress_install)
|
utils.create_from_yaml(api_client, yaml_file=ingress_install)
|
||||||
|
|
||||||
|
# Patch ConfigMap with ACME email if provided
|
||||||
|
if acme_email:
|
||||||
|
if opts.o.debug:
|
||||||
|
print(f"Configuring ACME email: {acme_email}")
|
||||||
|
core_api = client.CoreV1Api()
|
||||||
|
configmap = core_api.read_namespaced_config_map(
|
||||||
|
name="caddy-ingress-controller-configmap", namespace="caddy-system"
|
||||||
|
)
|
||||||
|
configmap.data["email"] = acme_email
|
||||||
|
core_api.patch_namespaced_config_map(
|
||||||
|
name="caddy-ingress-controller-configmap",
|
||||||
|
namespace="caddy-system",
|
||||||
|
body=configmap,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def load_images_into_kind(kind_cluster_name: str, image_set: Set[str]):
|
def load_images_into_kind(kind_cluster_name: str, image_set: Set[str]):
|
||||||
for image in image_set:
|
for image in image_set:
|
||||||
|
|
|
||||||
|
|
@ -117,6 +117,9 @@ class Spec:
|
||||||
def get_http_proxy(self):
|
def get_http_proxy(self):
|
||||||
return self.obj.get(constants.network_key, {}).get(constants.http_proxy_key, [])
|
return self.obj.get(constants.network_key, {}).get(constants.http_proxy_key, [])
|
||||||
|
|
||||||
|
def get_acme_email(self):
|
||||||
|
return self.obj.get(constants.network_key, {}).get("acme-email", "")
|
||||||
|
|
||||||
def get_annotations(self):
|
def get_annotations(self):
|
||||||
return self.obj.get(constants.annotations_key, {})
|
return self.obj.get(constants.annotations_key, {})
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue