Skip to content

Commit

Permalink
Return error if parseGateways failed (knative#5886)
Browse files Browse the repository at this point in the history
This patch makes two tiny changes in config-istio:

- use defaultReconcileGateway as const
- return an error when parseGateways fails.
  • Loading branch information
nak3 authored and knative-prow-robot committed Oct 28, 2019
1 parent 775e74e commit e365b35
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions pkg/reconciler/ingress/config/istio.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ const (
// ReconcileExternalGatewayKey the is the name of the configuration entry that specifies
// reconciling external Istio Gateways or not.
ReconcileExternalGatewayKey = "reconcileExternalGateway"

// defaultReconcileGateway is the default value of reconcileExternalGateway.
defaultReconcileGateway = false
)

func defaultGateways() []Gateway {
Expand All @@ -62,8 +65,6 @@ func defaultLocalGateways() []Gateway {
}}
}

var defaultReconcileGateway = false

// Gateway specifies the name of the Gateway and the K8s Service backing it.
type Gateway struct {
Namespace string
Expand Down Expand Up @@ -125,13 +126,13 @@ func NewIstioFromConfigMap(configMap *corev1.ConfigMap) (*Istio, error) {
gateways = defaultGateways()
}
localGateways, err := parseGateways(configMap, LocalGatewayKeyPrefix)
if err != nil {
return nil, err
}
if len(localGateways) == 0 {
localGateways = defaultLocalGateways()
}
localGateways = removeMeshGateway(localGateways)
if err != nil {
return nil, err
}
reconcileGateway := defaultReconcileGateway
if reconcileGatewayStr := configMap.Data[ReconcileExternalGatewayKey]; len(reconcileGatewayStr) != 0 {
if reconcileGateway, err = strconv.ParseBool(reconcileGatewayStr); err != nil {
Expand Down

0 comments on commit e365b35

Please sign in to comment.