in webhooks/alloydb-mutating-wh/handlers/pod_tolerations_handler.go [31:49]
func BuildTolerations() {
path := os.Getenv("TOLERATION_CONFIG_PATH")
fileName := os.Getenv("TOLERATION_CONFIG_FILE")
filePath := filepath.Join(path, fileName)
configFile, err := os.Open(filePath)
if err != nil {
log.Fatalf(fmt.Sprintf("handlers.BuildTolerations():Error opening tolerations config file %s", os.Getenv("TOLERATION_CONFIG_PATH")), err)
}
defer configFile.Close()
data, err := io.ReadAll(configFile)
if err != nil {
log.Fatalf("handlers.BuildTolerations():Error reading the toleration data from the file:: %v", err)
}
if err = json.Unmarshal(data, &tolerations); err != nil {
log.Fatalf("handlers.BuildTolerations():Error unmarshalling the toleration data from the file:: %v", err)
}
log.Info("handlers.BuildTolerations():Initialized the tolerations to be configured for the pod")
}