Skip to content

Commit

Permalink
Check for 'connection refused' error
Browse files Browse the repository at this point in the history
This check becomes obsolete as soon as
fluxcd/kustomize-controller#289 has been
released, but prevents the bootstrap process from erroring on
`failed to download artifact from [..] connect: connection refused`
errors when the source-controller is taking a longer time to boot.

Signed-off-by: Hidde Beydals <[email protected]>
  • Loading branch information
hiddeco committed Mar 3, 2021
1 parent aabc931 commit 78ac765
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions pkg/bootstrap/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ import (
"strings"
"time"

"github.com/fluxcd/go-git-providers/gitprovider"
"github.com/fluxcd/go-git-providers/validation"
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta1"
"github.com/fluxcd/pkg/apis/meta"
corev1 "k8s.io/api/core/v1"
apierr "k8s.io/apimachinery/pkg/api/errors"
apimeta "k8s.io/apimachinery/pkg/api/meta"
Expand All @@ -37,6 +33,11 @@ import (
"sigs.k8s.io/kustomize/api/filesys"
"sigs.k8s.io/yaml"

"github.com/fluxcd/go-git-providers/gitprovider"
"github.com/fluxcd/go-git-providers/validation"
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta1"
"github.com/fluxcd/pkg/apis/meta"

"github.com/fluxcd/flux2/internal/utils"
"github.com/fluxcd/flux2/pkg/bootstrap/git"
"github.com/fluxcd/flux2/pkg/log"
Expand Down Expand Up @@ -444,6 +445,11 @@ func (b *Bootstrap) kustomizationReconciled(ctx context.Context,
case metav1.ConditionTrue:
return true, nil
case metav1.ConditionFalse:
// TODO(hidde): this check becomes obsolete when https:/fluxcd/kustomize-controller/pull/289
// has been released.
if strings.Contains(c.Message, "connection refused") {
return false, nil
}
return false, fmt.Errorf(c.Message)
}
}
Expand Down

0 comments on commit 78ac765

Please sign in to comment.