Skip to content

Commit

Permalink
Fix uncheckedConfigurator errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Dean-Coakley committed Aug 24, 2018
1 parent 7366989 commit e117ace
Showing 1 changed file with 24 additions and 12 deletions.
36 changes: 24 additions & 12 deletions nginx-controller/nginx/configurator.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,12 @@ func (cnf *Configurator) AddOrUpdateDHParam(content string) (string, error) {

// AddOrUpdateIngress adds or updates NGINX configuration for the Ingress resource
func (cnf *Configurator) AddOrUpdateIngress(ingEx *IngressEx) error {
cnf.addOrUpdateIngress(ingEx)

if err := cnf.nginx.Reload(); err != nil {
return fmt.Errorf("Error when adding or updating ingress %v/%v: %v", ingEx.Ingress.Namespace, ingEx.Ingress.Name, err)
err := cnf.addOrUpdateIngress(ingEx)
if err != nil {
return fmt.Errorf("Error adding or updating ingress %v/%v: %v", ingEx.Ingress.Namespace, ingEx.Ingress.Name, err)
}
if err = cnf.nginx.Reload(); err != nil {
return fmt.Errorf("Error reloading NGINX for %v/%v: %v", ingEx.Ingress.Namespace, ingEx.Ingress.Name, err)
}
return nil
}
Expand All @@ -81,11 +83,13 @@ func (cnf *Configurator) addOrUpdateIngress(ingEx *IngressEx) error {

// AddOrUpdateMergableIngress adds or updates NGINX configuration for the Ingress resources with Mergeable Types
func (cnf *Configurator) AddOrUpdateMergableIngress(mergeableIngs *MergeableIngresses) error {
cnf.addOrUpdateMergableIngress(mergeableIngs)

if err := cnf.nginx.Reload(); err != nil {
err := cnf.addOrUpdateMergableIngress(mergeableIngs)
if err != nil {
return fmt.Errorf("Error when adding or updating ingress %v/%v: %v", mergeableIngs.Master.Ingress.Namespace, mergeableIngs.Master.Ingress.Name, err)
}
if err = cnf.nginx.Reload(); err != nil {
return fmt.Errorf("Error reloading NGINX for %v/%v: %v", mergeableIngs.Master.Ingress.Namespace, mergeableIngs.Master.Ingress.Name, err)
}
return nil
}

Expand Down Expand Up @@ -877,7 +881,10 @@ func upstreamMapToSlice(upstreams map[string]Upstream) []Upstream {
func (cnf *Configurator) AddOrUpdateSecret(secret *api_v1.Secret) error {
cnf.addOrUpdateSecret(secret)

kind, _ := GetSecretKind(secret)
kind, err := GetSecretKind(secret)
if err != nil {
return fmt.Errorf("Error secret is unknown")
}
if cnf.isPlus() && kind == JWK {
return nil
}
Expand Down Expand Up @@ -962,10 +969,13 @@ func (cnf *Configurator) DeleteIngress(key string) error {

// UpdateEndpoints updates endpoints in NGINX configuration for the Ingress resource
func (cnf *Configurator) UpdateEndpoints(ingEx *IngressEx) error {
cnf.addOrUpdateIngress(ingEx)
err := cnf.addOrUpdateIngress(ingEx)
if err != nil {
return fmt.Errorf("Error adding or updating ingress %v/%v: %v", ingEx.Ingress.Namespace, ingEx.Ingress.Name, err)
}

if cnf.isPlus() {
err := cnf.updatePlusEndpoints(ingEx)
err = cnf.updatePlusEndpoints(ingEx)
if err == nil {
return nil
}
Expand All @@ -980,10 +990,12 @@ func (cnf *Configurator) UpdateEndpoints(ingEx *IngressEx) error {

// UpdateEndpointsMergeableIngress updates endpoints in NGINX configuration for a mergeable Ingress resource
func (cnf *Configurator) UpdateEndpointsMergeableIngress(mergeableIngs *MergeableIngresses) error {
cnf.addOrUpdateMergableIngress(mergeableIngs)
err := cnf.addOrUpdateMergableIngress(mergeableIngs)
if err != nil {
return fmt.Errorf("Error adding or updating ingress %v/%v: %v", mergeableIngs.Master.Ingress.Namespace, mergeableIngs.Master.Ingress.Name, err)
}

if cnf.isPlus() {
var err error
for _, ing := range mergeableIngs.Minions {
err = cnf.updatePlusEndpoints(ing)
if err != nil {
Expand Down

0 comments on commit e117ace

Please sign in to comment.