separate ResourceNameToEnvvar to utils
package util
import (
+ "fmt"
+ "strings"
+
v1 "kubevirt.io/client-go/api/v1"
)
@@ -46,3 +49,10 @@ func IsVMIVirtiofsEnabled(vmi *v1.VirtualMachineInstance) bool {
}
return false
}
+
+func ResourceNameToEnvvar(prefix string, resourceName string) string {
+ varName := strings.ToUpper(resourceName)
+ varName = strings.Replace(varName, "/", "_", -1)
+ varName = strings.Replace(varName, ".", "_", -1)
+ return fmt.Sprintf("%s_%s", prefix, varName)
+}
