Skip to content

Commit

Permalink
OSSM-5881 Do not require ingress and egress gateways when `spec.clust…
Browse files Browse the repository at this point in the history
…er.multiCluster` is enabled
  • Loading branch information
mayleighnmyers committed Apr 18, 2024
1 parent e3576ed commit c3e6010
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions pkg/apis/maistra/conversion/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -406,8 +406,9 @@ func populateClusterConfig(in *v1.HelmValues, out *v2.ControlPlaneSpec) error {
} else if err != nil {
return err
}
ingressGateway := make(map[string]interface{})
if ingressEnabled, ok, err := multiClusterOverrides.GetFieldNoCopy("ingressEnabled"); ok {
if ingressGateway, ok, err := v1.NewHelmValues(gateways).GetMap("istio-ingressgateway"); ok && len(ingressGateway) > 0 {
if ingressEnabled == nil || !ok || len(ingressGateway) == 0 {
if ingressEnabled == nil {
delete(ingressGateway, "enabled")
} else {
Expand All @@ -419,38 +420,38 @@ func populateClusterConfig(in *v1.HelmValues, out *v2.ControlPlaneSpec) error {
} else {
gateways["istio-ingressgateway"] = ingressGateway
}
updateGateways = true
updateGateways = false
} else if err != nil {
return nil
}
} else if err != nil {
return nil
}
if egressGateway, ok, err := v1.NewHelmValues(gateways).GetMap("istio-egressgateway"); ok && len(egressGateway) > 0 {
updateEgress := false
if egressEnabled, ok, err := multiClusterOverrides.GetFieldNoCopy("egressEnabled"); ok {
egressGateway := make(map[string]interface{})
if egressEnabled, ok, err := multiClusterOverrides.GetFieldNoCopy("egressEnabled"); ok {
if egressEnabled == nil || !ok || len(egressGateway) == 0 {
if egressEnabled == nil {
delete(egressGateway, "enabled")
} else {
egressGateway["enabled"] = egressEnabled
}
updateEgress = true
updateGateways = false
} else if err != nil {
return nil
}
if addedExternal, ok, err := multiClusterOverrides.GetAndRemoveBool("addedExternal"); ok && addedExternal {
if requestedNetworkView, ok, err := v1.NewHelmValues(egressGateway).GetAndRemoveString("env.ISTIO_META_REQUESTED_NETWORK_VIEW"); ok {
newRequestedNetworkView := externalRequestedNetworkRegex.ReplaceAllString(requestedNetworkView, "$1")
if newRequestedNetworkView != requestedNetworkView && newRequestedNetworkView != "" {
updateEgress = true
updateGateways = true
if err := setHelmStringValue(egressGateway, "env.ISTIO_META_REQUESTED_NETWORK_VIEW", newRequestedNetworkView); err != nil {
return err
}
}
// cleanup for to avoid extraneous empty ClusterEgress
if env, ok, err := v1.NewHelmValues(egressGateway).GetMap("env"); ok && len(env) == 0 {
delete(egressGateway, "env")
updateEgress = true
updateGateways = true
} else if err != nil {
return err
}
Expand All @@ -460,7 +461,7 @@ func populateClusterConfig(in *v1.HelmValues, out *v2.ControlPlaneSpec) error {
} else if err != nil {
return err
}
if updateEgress {
if updateGateways {
if shouldDeleteGatewayValues(egressGateway) {
// only element should be name
delete(gateways, "istio-egressgateway")
Expand Down

0 comments on commit c3e6010

Please sign in to comment.