@@ -56,8 +56,6 @@ const (
5656 // Operator components
5757 IstioOperatorComponentName ComponentName = "IstioOperator"
5858 IstioOperatorCustomResourceName ComponentName = "IstioOperatorCustomResource"
59-
60-
6159)
6260
6361var (
7472 CNIComponentName ,
7573 }
7674 allComponentNamesMap = make (map [ComponentName ]bool )
77- // TODO: merge this with the componentMaps defined in translateConfig
75+
7876 // ComponentNameToHelmComponentPath defines mapping from component name to helm component root path.
79- ComponentNameToHelmComponentPath = map [ComponentName ]string {
77+ // TODO: merge this with the componentMaps defined in translateConfig
78+ ComponentNameToHelmComponentPath = map [ComponentName ]string {
8079 PilotComponentName : "pilot" ,
8180 GalleyComponentName : "galley" ,
8281 SidecarInjectorComponentName : "sidecarInjectorWebhook" ,
@@ -119,9 +118,15 @@ func (cn ComponentName) IsAddon() bool {
119118// IsComponentEnabledInSpec assumes that controlPlaneSpec has been validated.
120119// TODO: remove extra validations when comfort level is high enough.
121120func IsComponentEnabledInSpec (componentName ComponentName , controlPlaneSpec * v1alpha1.IstioOperatorSpec ) (bool , error ) {
122- // if component enablement path is defined and found in Values part, return it first, otherwise check from ISCP.
121+ // for addon components, enablement is defined in values part.
122+ if componentName == AddonComponentName {
123+ enabled , _ , err := IsComponentEnabledFromValue (string (componentName ), controlPlaneSpec .Values )
124+ return enabled , err
125+ }
126+ // for Istio components, check whether override path exist in values part first then ISCP.
123127 valuePath := ComponentNameToHelmComponentPath [componentName ]
124128 enabled , pathExist , err := IsComponentEnabledFromValue (valuePath , controlPlaneSpec .Values )
129+ // only return value when path exists
125130 if err == nil && pathExist {
126131 return enabled , nil
127132 }
@@ -165,7 +170,7 @@ func IsComponentEnabledFromValue(valuePath string, valueSpec map[string]interfac
165170 return false , false , err
166171 }
167172 if found {
168- return true , true , nil
173+ return true , false , nil
169174 }
170175 return false , false , nil
171176 }
0 commit comments