@@ -631,6 +631,10 @@ func checkKeysPresentAndNotEmpty(data interface{}, keys []string) bool {
631
631
return true
632
632
}
633
633
634
+ func (r * ImageGenerator ) getImageConfigMapName () string {
635
+ return r .provider + "-podvm-image-cm"
636
+ }
637
+
634
638
// Function to create ConfigMap from a YAML file based on cloud provider
635
639
// azure-podvm-image-cm.yaml for Azure
636
640
// aws-podvm-image-cm.yaml for AWS
@@ -645,14 +649,14 @@ func (r *ImageGenerator) createImageConfigMapFromFile() error {
645
649
// If it doesn't exist, create the ConfigMap
646
650
647
651
if err := r .client .Get (context .TODO (), types.NamespacedName {
648
- Name : r .provider + "-podvm-image-cm" ,
652
+ Name : r .getImageConfigMapName () ,
649
653
Namespace : OperatorNamespace ,
650
654
}, & corev1.ConfigMap {}); err == nil {
651
655
igLogger .Info ("ConfigMap already exists" , "name" , r .provider + "-podvm-image-cm" )
652
656
return nil
653
657
}
654
658
655
- filename := r .provider + "-podvm-image-cm .yaml"
659
+ filename := r .getImageConfigMapName () + ".yaml"
656
660
configMapYamlFile := filepath .Join (peerpodsImageJobsPathLocation , filename )
657
661
yamlData , err := readYamlFile (configMapYamlFile )
658
662
if err != nil {
@@ -693,7 +697,7 @@ func (r *ImageGenerator) updateImageConfigMap() error {
693
697
// If it doesn't exist, return an error
694
698
// If it exists, update the ConfigMap
695
699
696
- cmName := r .provider + "-podvm-image-cm"
700
+ cmName := r .getImageConfigMapName ()
697
701
cm := & corev1.ConfigMap {}
698
702
if err := r .client .Get (context .TODO (), types.NamespacedName {
699
703
Name : cmName ,
0 commit comments