in pkg/observability/k8s-events.go [231:260]
func generateNodeAnnotations(node *corev1.Node, annotations map[string]string) map[string]string {
nodeAnnotations := make(map[string]string)
for k, v := range annotations {
nodeAnnotations[k] = v
}
nodeAnnotations["availability-zone"] = node.Labels["topology.kubernetes.io/zone"]
nodeAnnotations["instance-id"] = node.Spec.ProviderID[strings.LastIndex(node.Spec.ProviderID, "/")+1:]
nodeAnnotations["instance-type"] = node.Labels["node.kubernetes.io/instance-type"]
nodeAnnotations["local-hostname"] = node.Name
for _, address := range node.Status.Addresses {
// If there's more than one address of the same type, use the first one
switch address.Type {
case corev1.NodeInternalIP:
if _, exist := annotations["local-ipv4"]; !exist {
nodeAnnotations["local-ipv4"] = address.Address
}
case corev1.NodeExternalDNS:
if _, exist := annotations["public-hostname"]; !exist {
nodeAnnotations["public-hostname"] = address.Address
}
case corev1.NodeExternalIP:
if _, exist := annotations["public-ipv4"]; !exist {
nodeAnnotations["public-ipv4"] = address.Address
}
}
}
nodeAnnotations["region"] = node.Labels["topology.kubernetes.io/region"]
return nodeAnnotations
}