Skip to content

Commit

Permalink
pass parameter direktly to template
Browse files Browse the repository at this point in the history
  • Loading branch information
rwaffen committed Dec 15, 2023
1 parent 0665ac5 commit a0974cc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 4 additions & 2 deletions manifests/server/resources/coredns.pp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# @param kubeconfig The path to the kubeconfig to use for kubectl commands
# @param registry The CoreDNS image registry to use
# @param template_path The path to the template to use for the CoreDNS ConfigMap
# @param template_variables The variables to use for the CoreDNS ConfigMap template
#
class k8s::server::resources::coredns (
K8s::Ensure $ensure = $k8s::ensure,
Expand All @@ -25,7 +26,8 @@
Hash[String,Data] $deployment_config = $k8s::server::resources::coredns_deployment_config,
Array[String[1]] $hosts = [],
String[1] $template_path = 'k8s/server/resources/coredns_corefile.epp',
Optional[String[1]] $corefile_content = undef
Optional[String[1]] $corefile_content = undef,
Hash[String, Any] $template_variables = { cluster_domain => $cluster_domain },
) {
assert_private()

Expand All @@ -45,7 +47,7 @@
if $corefile_content {
$_corefile_content = $corefile_content
} else {
$_corefile_content = epp($template_path)
$_corefile_content = epp($template_path, $template_variables)
}

kubectl_apply {
Expand Down
5 changes: 4 additions & 1 deletion templates/server/resources/coredns_corefile.epp
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
<%- |
Stdlib::Fqdn $cluster_domain,
| -%>
.:53 {
errors
health {
lameduck 5s
}
ready
kubernetes <%= $k8s::server::resources::coredns::cluster_domain %> in-addr.arpa ip6.arpa {
kubernetes <%= $cluster_domain %> in-addr.arpa ip6.arpa {
fallthrough in-addr.arpa ip6.arpa
}
prometheus :9153
Expand Down

0 comments on commit a0974cc

Please sign in to comment.