build_configmap

Function build_configmap 

Source
pub fn build_configmap(
    name: &str,
    namespace: &str,
    instance: &Bind9Instance,
    cluster: Option<&Bind9Cluster>,
    role_allow_transfer: Option<&Vec<String>>,
) -> Result<ConfigMap>
Expand description

Builds a Kubernetes ConfigMap containing BIND9 configuration files.

Creates a ConfigMap with the files NOT overridden by custom configMapRefs (instance overrides cluster):

  • named.conf - Main BIND9 configuration (omitted when namedConf ref is set)
  • named.conf.options - BIND9 options (omitted when namedConfOptions ref is set)
  • rndc.conf - RNDC client configuration (ALWAYS generated; it is not overridable and is mounted from this ConfigMap unconditionally)

Because rndc.conf is always present, this ConfigMap must always be created — even when both namedConf and namedConfOptions refs are set — so the pod’s config volume always has a backing ConfigMap.

§Arguments

  • name - Name for the ConfigMap (typically {instance-name}-config)
  • namespace - Kubernetes namespace
  • instance - Bind9Instance spec containing configuration options
  • cluster - Optional Bind9Cluster containing shared configuration
  • role_allow_transfer - Role-specific allow-transfer override from cluster spec

§Returns

A Kubernetes ConfigMap resource ready for creation/update

§Errors

Returns an error if any ACL, forwarder, or listen-address entry in the instance or cluster spec fails validation — see crate::bind9_acl for the accepted ACL syntax.