fix: unwanted retry of namespace create for existing namespace
retry removed completely
became superfluous again, with initial namespace creation moved to external installer
@@ -2,14 +2,8 @@ package client
import (
"encoding/json"
- "fmt"
- "time"
- "github.com/avast/retry-go"
-
- "github.com/epinio/epinio/helpers"
api "github.com/epinio/epinio/internal/api/v1"
- "github.com/epinio/epinio/internal/duration"
"github.com/epinio/epinio/pkg/api/core/v1/models"
)
@@ -22,33 +16,7 @@ func (c *Client) NamespaceCreate(req models.NamespaceCreateRequest) (models.Resp
return resp, nil
}
- details := c.log.V(1) // NOTE: Increment of level, not absolute.
-
- var data []byte
- err = retry.Do(
- func() error {
- details.Info("create namespace", "namespace", req.Name)
- data, err = c.post(api.Routes.Path("Namespaces"), string(b))
- return err
- },
- retry.RetryIf(func(err error) bool {
- if r, ok := err.(interface{ StatusCode() int }); ok {
- return helpers.RetryableCode(r.StatusCode())
- }
- retry := helpers.Retryable(err.Error())
-
- details.Info("create error", "error", err.Error(), "retry", retry)
- return retry
- }),
- retry.OnRetry(func(n uint, err error) {
- details.WithValues(
- "tries", fmt.Sprintf("%d/%d", n, duration.RetryMax),
- "error", err.Error(),
- ).Info("Retrying to create namespace")
- }),
- retry.Delay(time.Second),
- retry.Attempts(duration.RetryMax),
- )
+ data, err := c.post(api.Routes.Path("Namespaces"), string(b))
if err != nil {
return resp, err
}
