build_labels_from_instance

Function build_labels_from_instance 

Source
pub fn build_labels_from_instance(
    instance_name: &str,
    instance: &Bind9Instance,
) -> BTreeMap<String, String>
Expand description

Builds standardized Kubernetes labels for BIND9 instance resources, propagating the managed-by label from the Bind9Instance if it exists.

This function checks if the instance has a bindy.firestoned.io/managed-by label. If it does (indicating the instance is managed by a Bind9Cluster), that label value is propagated to the app.kubernetes.io/managed-by label. Otherwise, it defaults to Bind9Instance.

This ensures that when a Bind9Cluster creates a Bind9Instance with managed-by: Bind9Cluster, all child resources (Deployments, Services) also get managed-by: Bind9Cluster.

§Arguments

  • instance_name - Name of the Bind9Instance resource
  • instance - The Bind9Instance resource to check for management labels

§Returns

A BTreeMap of label key-value pairs