func updateContainers()

in appconfigmgrv2/api/webhooks/builtins/pod_webhook.go [134:158]


func updateContainers(pod *corev1.Pod, appName string, mountName string, mountPath string, envName string) {
	log.Info("updateContainers",
		"appName", appName,
		"mountName", mountName,
		"mountPath", mountPath,
	)

	for index, element := range pod.Spec.Containers {
		if strings.HasPrefix(appName, element.Name) {
			log.Info("updateContainers:found",
				"appName", element.Name,
				"mountName", mountName,
				"mountPath", mountPath)
			updateContainerMounts(&element, element.Name, mountName, mountPath)
			updateContainerEnv(&element, element.Name, envName, mountPath+"/key.json")
			pod.Spec.Containers[index] = element
			return
		}
	}

	//TODO - Decide how to fail or just warning
	log.Info("updateContainers:containerNotFound", "appName", appName,
		"mountName", mountName,
		"mountPath", mountPath)
}