github.com/verrazzano/verrazzano@v1.7.0/platform-operator/controllers/configmaps/components/dev_shim_component.go (about)

     1  // Copyright (c) 2023, Oracle and/or its affiliates.
     2  // Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
     3  
     4  package components
     5  
     6  import (
     7  	"fmt"
     8  	"github.com/verrazzano/verrazzano/platform-operator/controllers/verrazzano/component/spi"
     9  	corev1 "k8s.io/api/core/v1"
    10  )
    11  
    12  func newDevShimComponent(cm *corev1.ConfigMap) (spi.Component, error) {
    13  	componentName, ok := cm.Data[componentNameKey]
    14  	if !ok {
    15  		return nil, fmt.Errorf("ConfigMap %s does not contain the name field, cannot reconcile component", cm.Name)
    16  	}
    17  
    18  	shimComponent, found := shimComponents[componentName]
    19  	if !found {
    20  		return nil, fmt.Errorf("Component name %s in configMap %s is not a valid shimComponent", componentName, cm.Name)
    21  	}
    22  
    23  	return shimComponent, nil
    24  }