// initK8SMapping generates the k8s settings mapping for components that are enabled based on templates.
initK8SMapping generates the k8s settings mapping for components that are enabled based on templates.
// initK8SMapping generates the k8s settings mapping for components that are enabled based on templates .
func (t *ReverseTranslator) initK8SMapping(valueTree map[string]interface{}) error {
	outputMapping := make(map[string]*Translation)
	for valKey, componentName := range t.ValuesToComponentName {
		cnEnabled, _, err := IsComponentEnabledFromValue(componentName, valueTree)
		if err != nil {
			return err
		}
		if !cnEnabled {
			log.Infof("Component:%s disabled, skip k8s mapping", componentName)
			continue
		}
		for K8SValKey, outPathTmpl := range t.KubernetesPatternMapping {
			newKey, err := renderComponentName(K8SValKey, valKey)
			if err != nil {
				return err
			}
			newVal, err := renderFeatureComponentPathTemplate(outPathTmpl, componentName)
			if err != nil {
				return err
			}
			outputMapping[newKey] = &Translation{newVal, nil}
		}
	}
	t.KubernetesMapping = outputMapping
	return nil
}
func ( t * ReverseTranslator ) initK8SMapping ( valueTree map [ string ] interface { } ) error { outputMapping := make ( map [ string ] * Translation ) for valKey , componentName := range t . ValuesToComponentName { cnEnabled , _ , err := IsComponentEnabledFromValue ( componentName , valueTree ) if err != nil { return err } if ! cnEnabled { log . Infof ( " " , componentName ) continue } for K8SValKey , outPathTmpl := range t . KubernetesPatternMapping { newKey , err := renderComponentName ( K8SValKey , valKey ) if err != nil { return err } newVal , err := renderFeatureComponentPathTemplate ( outPathTmpl , componentName ) if err != nil { return err } outputMapping [ newKey ] = & Translation { newVal , nil } } } t . KubernetesMapping = outputMapping return nil }
initK8SMapping generates the k8s settings mapping for components that are enabled based on templates.
initK8SMapping generates the k8s settings mapping for components that are enabled based on templates .