Switch to google/uuid from satori/go.uuid (#2852)
Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
This commit is contained in:
@@ -15,6 +15,7 @@ require (
|
|||||||
github.com/go-git/go-git/v5 v5.9.0
|
github.com/go-git/go-git/v5 v5.9.0
|
||||||
github.com/golang-jwt/jwt/v4 v4.5.0
|
github.com/golang-jwt/jwt/v4 v4.5.0
|
||||||
github.com/google/go-cmp v0.6.0
|
github.com/google/go-cmp v0.6.0
|
||||||
|
github.com/google/uuid v1.3.0
|
||||||
github.com/gorilla/mux v1.8.0
|
github.com/gorilla/mux v1.8.0
|
||||||
github.com/graymeta/stow v0.2.8
|
github.com/graymeta/stow v0.2.8
|
||||||
github.com/hashicorp/go-multierror v1.1.1
|
github.com/hashicorp/go-multierror v1.1.1
|
||||||
@@ -28,7 +29,6 @@ require (
|
|||||||
github.com/prometheus/common v0.44.0
|
github.com/prometheus/common v0.44.0
|
||||||
github.com/robfig/cron/v3 v3.0.1
|
github.com/robfig/cron/v3 v3.0.1
|
||||||
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06
|
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06
|
||||||
github.com/satori/go.uuid v1.2.1-0.20181028125025-b2ce2384e17b
|
|
||||||
github.com/spf13/cobra v1.7.0
|
github.com/spf13/cobra v1.7.0
|
||||||
github.com/spf13/pflag v1.0.5
|
github.com/spf13/pflag v1.0.5
|
||||||
github.com/stretchr/testify v1.8.4
|
github.com/stretchr/testify v1.8.4
|
||||||
@@ -103,7 +103,6 @@ require (
|
|||||||
github.com/golang/snappy v0.0.4 // indirect
|
github.com/golang/snappy v0.0.4 // indirect
|
||||||
github.com/google/gnostic-models v0.6.8 // indirect
|
github.com/google/gnostic-models v0.6.8 // indirect
|
||||||
github.com/google/gofuzz v1.2.0 // indirect
|
github.com/google/gofuzz v1.2.0 // indirect
|
||||||
github.com/google/uuid v1.3.0 // indirect
|
|
||||||
github.com/gotestyourself/gotestyourself v2.2.0+incompatible // indirect
|
github.com/gotestyourself/gotestyourself v2.2.0+incompatible // indirect
|
||||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect
|
github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect
|
||||||
github.com/hashicorp/errwrap v1.0.0 // indirect
|
github.com/hashicorp/errwrap v1.0.0 // indirect
|
||||||
|
|||||||
@@ -431,8 +431,6 @@ github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQD
|
|||||||
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 h1:OkMGxebDjyw0ULyrTYWeN0UNCCkmCWfjPnIA2W6oviI=
|
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 h1:OkMGxebDjyw0ULyrTYWeN0UNCCkmCWfjPnIA2W6oviI=
|
||||||
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06/go.mod h1:+ePHsJ1keEjQtpvf9HHw0f4ZeJ0TLRsxhunSI2hYJSs=
|
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06/go.mod h1:+ePHsJ1keEjQtpvf9HHw0f4ZeJ0TLRsxhunSI2hYJSs=
|
||||||
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
|
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
|
||||||
github.com/satori/go.uuid v1.2.1-0.20181028125025-b2ce2384e17b h1:gQZ0qzfKHQIybLANtM3mBXNUtOfsCFXeTsnBqCsx1KM=
|
|
||||||
github.com/satori/go.uuid v1.2.1-0.20181028125025-b2ce2384e17b/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
|
|
||||||
github.com/seccomp/libseccomp-golang v0.9.2-0.20220502022130-f33da4d89646/go.mod h1:JA8cRccbGaA1s33RQf7Y1+q9gHmZX1yB/z9WDN1C6fg=
|
github.com/seccomp/libseccomp-golang v0.9.2-0.20220502022130-f33da4d89646/go.mod h1:JA8cRccbGaA1s33RQf7Y1+q9gHmZX1yB/z9WDN1C6fg=
|
||||||
github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
|
github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
|
||||||
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
|
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
|
||||||
|
|||||||
@@ -7,12 +7,10 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
uuid "github.com/satori/go.uuid"
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
apiv1 "k8s.io/api/core/v1"
|
apiv1 "k8s.io/api/core/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/labels"
|
"k8s.io/apimachinery/pkg/labels"
|
||||||
"k8s.io/apimachinery/pkg/types"
|
|
||||||
"k8s.io/apimachinery/pkg/util/wait"
|
"k8s.io/apimachinery/pkg/util/wait"
|
||||||
"k8s.io/client-go/kubernetes/fake"
|
"k8s.io/client-go/kubernetes/fake"
|
||||||
k8sCache "k8s.io/client-go/tools/cache"
|
k8sCache "k8s.io/client-go/tools/cache"
|
||||||
@@ -23,6 +21,7 @@ import (
|
|||||||
genInformer "github.com/fission/fission/pkg/generated/informers/externalversions"
|
genInformer "github.com/fission/fission/pkg/generated/informers/externalversions"
|
||||||
"github.com/fission/fission/pkg/utils"
|
"github.com/fission/fission/pkg/utils"
|
||||||
"github.com/fission/fission/pkg/utils/loggerfactory"
|
"github.com/fission/fission/pkg/utils/loggerfactory"
|
||||||
|
"github.com/fission/fission/pkg/utils/uuid"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -120,15 +119,11 @@ func TestRefreshFuncPods(t *testing.T) {
|
|||||||
}
|
}
|
||||||
assert.Equal(t, envRes.ObjectMeta.Name, envName)
|
assert.Equal(t, envRes.ObjectMeta.Name, envName)
|
||||||
|
|
||||||
funcUID, err := uuid.NewV4()
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
funcSpec := fv1.Function{
|
funcSpec := fv1.Function{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: functionName,
|
Name: functionName,
|
||||||
Namespace: defaultNamespace,
|
Namespace: defaultNamespace,
|
||||||
UID: types.UID(funcUID.String()),
|
UID: uuid.NewUUID(),
|
||||||
},
|
},
|
||||||
Spec: fv1.FunctionSpec{
|
Spec: fv1.FunctionSpec{
|
||||||
Environment: fv1.EnvironmentReference{
|
Environment: fv1.EnvironmentReference{
|
||||||
|
|||||||
+3
-11
@@ -28,9 +28,9 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/google/uuid"
|
||||||
"github.com/mholt/archiver/v3"
|
"github.com/mholt/archiver/v3"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
uuid "github.com/satori/go.uuid"
|
|
||||||
"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"
|
"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
"golang.org/x/net/context/ctxhttp"
|
"golang.org/x/net/context/ctxhttp"
|
||||||
@@ -352,16 +352,8 @@ func (fetcher *Fetcher) Fetch(ctx context.Context, pkg *fv1.Package, req Functio
|
|||||||
//checking if file is a zip
|
//checking if file is a zip
|
||||||
if match, _ := utils.IsZip(tmpPath); match && !req.KeepArchive {
|
if match, _ := utils.IsZip(tmpPath); match && !req.KeepArchive {
|
||||||
// unarchive tmp file to a tmp unarchive path
|
// unarchive tmp file to a tmp unarchive path
|
||||||
id, err := uuid.NewV4()
|
tmpUnarchivePath := filepath.Join(fetcher.sharedVolumePath, uuid.NewString())
|
||||||
if err != nil {
|
err := fetcher.unarchive(tmpPath, tmpUnarchivePath)
|
||||||
logger.Error("error generating uuid",
|
|
||||||
zap.Error(err),
|
|
||||||
zap.String("archive_location", tmpPath))
|
|
||||||
return http.StatusInternalServerError, err
|
|
||||||
}
|
|
||||||
|
|
||||||
tmpUnarchivePath := filepath.Join(fetcher.sharedVolumePath, id.String())
|
|
||||||
err = fetcher.unarchive(tmpPath, tmpUnarchivePath)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error("error unarchive",
|
logger.Error("error unarchive",
|
||||||
zap.Error(err),
|
zap.Error(err),
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
uuid "github.com/satori/go.uuid"
|
|
||||||
asv2 "k8s.io/api/autoscaling/v2"
|
asv2 "k8s.io/api/autoscaling/v2"
|
||||||
apiv1 "k8s.io/api/core/v1"
|
apiv1 "k8s.io/api/core/v1"
|
||||||
k8serrors "k8s.io/apimachinery/pkg/api/errors"
|
k8serrors "k8s.io/apimachinery/pkg/api/errors"
|
||||||
@@ -37,6 +36,7 @@ import (
|
|||||||
"github.com/fission/fission/pkg/fission-cli/console"
|
"github.com/fission/fission/pkg/fission-cli/console"
|
||||||
flagkey "github.com/fission/fission/pkg/fission-cli/flag/key"
|
flagkey "github.com/fission/fission/pkg/fission-cli/flag/key"
|
||||||
"github.com/fission/fission/pkg/fission-cli/util"
|
"github.com/fission/fission/pkg/fission-cli/util"
|
||||||
|
"github.com/fission/fission/pkg/utils/uuid"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -217,11 +217,7 @@ func (opts *CreateSubCommand) complete(input cli.Input) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
buildcmd := input.String(flagkey.PkgBuildCmd)
|
buildcmd := input.String(flagkey.PkgBuildCmd)
|
||||||
id, err := uuid.NewV4()
|
pkgName := generatePackageName(fnName, uuid.NewString())
|
||||||
if err != nil {
|
|
||||||
return errors.Wrap(err, "error generating uuid")
|
|
||||||
}
|
|
||||||
pkgName := generatePackageName(fnName, id.String())
|
|
||||||
|
|
||||||
// create new package in the same namespace as the function.
|
// create new package in the same namespace as the function.
|
||||||
pkgMetadata, err = _package.CreatePackage(input, opts.Client(), pkgName, fnNamespace, envName,
|
pkgMetadata, err = _package.CreatePackage(input, opts.Client(), pkgName, fnNamespace, envName,
|
||||||
@@ -401,11 +397,7 @@ func (opts *CreateSubCommand) run(input cli.Input) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
id, err := uuid.NewV4()
|
triggerName := uuid.NewString()
|
||||||
if err != nil {
|
|
||||||
return errors.Wrap(err, "error generating UUID")
|
|
||||||
}
|
|
||||||
triggerName := id.String()
|
|
||||||
ht := &fv1.HTTPTrigger{
|
ht := &fv1.HTTPTrigger{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: triggerName,
|
Name: triggerName,
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package function
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
uuid "github.com/satori/go.uuid"
|
"github.com/fission/fission/pkg/utils/uuid"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestGeneratePackageName(t *testing.T) {
|
func TestGeneratePackageName(t *testing.T) {
|
||||||
@@ -29,11 +29,7 @@ func TestGeneratePackageName(t *testing.T) {
|
|||||||
},
|
},
|
||||||
} {
|
} {
|
||||||
t.Run(test.name, func(t *testing.T) {
|
t.Run(test.name, func(t *testing.T) {
|
||||||
id, err := uuid.NewV4()
|
pkgName := generatePackageName(test.fnName, uuid.NewString())
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
pkgName := generatePackageName(test.fnName, id.String())
|
|
||||||
if len(pkgName) > test.expected {
|
if len(pkgName) > test.expected {
|
||||||
t.Errorf("expected len of package to be %v, got %v", test.expected, len(pkgName))
|
t.Errorf("expected len of package to be %v, got %v", test.expected, len(pkgName))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
uuid "github.com/satori/go.uuid"
|
|
||||||
kerrors "k8s.io/apimachinery/pkg/api/errors"
|
kerrors "k8s.io/apimachinery/pkg/api/errors"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
|
||||||
@@ -34,6 +33,7 @@ import (
|
|||||||
"github.com/fission/fission/pkg/fission-cli/console"
|
"github.com/fission/fission/pkg/fission-cli/console"
|
||||||
flagkey "github.com/fission/fission/pkg/fission-cli/flag/key"
|
flagkey "github.com/fission/fission/pkg/fission-cli/flag/key"
|
||||||
"github.com/fission/fission/pkg/fission-cli/util"
|
"github.com/fission/fission/pkg/fission-cli/util"
|
||||||
|
"github.com/fission/fission/pkg/utils/uuid"
|
||||||
)
|
)
|
||||||
|
|
||||||
type CreateSubCommand struct {
|
type CreateSubCommand struct {
|
||||||
@@ -70,11 +70,7 @@ func (opts *CreateSubCommand) complete(input cli.Input) error {
|
|||||||
// just name triggers by uuid.
|
// just name triggers by uuid.
|
||||||
if len(triggerName) == 0 {
|
if len(triggerName) == 0 {
|
||||||
console.Warn(fmt.Sprintf("--%v will be soon marked as required flag, see 'help' for details", flagkey.HtName))
|
console.Warn(fmt.Sprintf("--%v will be soon marked as required flag, see 'help' for details", flagkey.HtName))
|
||||||
id, err := uuid.NewV4()
|
triggerName = uuid.NewString()
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
triggerName = id.String()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
userProvidedNS, fnNamespace, err := opts.GetResourceNamespace(input, flagkey.NamespaceFunction)
|
userProvidedNS, fnNamespace, err := opts.GetResourceNamespace(input, flagkey.NamespaceFunction)
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
uuid "github.com/satori/go.uuid"
|
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
|
||||||
fv1 "github.com/fission/fission/pkg/apis/core/v1"
|
fv1 "github.com/fission/fission/pkg/apis/core/v1"
|
||||||
@@ -30,6 +29,7 @@ import (
|
|||||||
"github.com/fission/fission/pkg/fission-cli/console"
|
"github.com/fission/fission/pkg/fission-cli/console"
|
||||||
flagkey "github.com/fission/fission/pkg/fission-cli/flag/key"
|
flagkey "github.com/fission/fission/pkg/fission-cli/flag/key"
|
||||||
"github.com/fission/fission/pkg/fission-cli/util"
|
"github.com/fission/fission/pkg/fission-cli/util"
|
||||||
|
"github.com/fission/fission/pkg/utils/uuid"
|
||||||
)
|
)
|
||||||
|
|
||||||
type CreateSubCommand struct {
|
type CreateSubCommand struct {
|
||||||
@@ -53,11 +53,7 @@ func (opts *CreateSubCommand) complete(input cli.Input) error {
|
|||||||
watchName := input.String(flagkey.KwName)
|
watchName := input.String(flagkey.KwName)
|
||||||
if len(watchName) == 0 {
|
if len(watchName) == 0 {
|
||||||
console.Warn(fmt.Sprintf("--%v will be soon marked as required flag, see 'help' for details", flagkey.MqtName))
|
console.Warn(fmt.Sprintf("--%v will be soon marked as required flag, see 'help' for details", flagkey.MqtName))
|
||||||
id, err := uuid.NewV4()
|
watchName = uuid.NewString()
|
||||||
if err != nil {
|
|
||||||
return errors.Wrap(err, "error generating uuid")
|
|
||||||
}
|
|
||||||
watchName = id.String()
|
|
||||||
}
|
}
|
||||||
fnName := input.String(flagkey.KwFnName)
|
fnName := input.String(flagkey.KwFnName)
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
uuid "github.com/satori/go.uuid"
|
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
|
||||||
fv1 "github.com/fission/fission/pkg/apis/core/v1"
|
fv1 "github.com/fission/fission/pkg/apis/core/v1"
|
||||||
@@ -31,6 +30,7 @@ import (
|
|||||||
flagkey "github.com/fission/fission/pkg/fission-cli/flag/key"
|
flagkey "github.com/fission/fission/pkg/fission-cli/flag/key"
|
||||||
"github.com/fission/fission/pkg/fission-cli/util"
|
"github.com/fission/fission/pkg/fission-cli/util"
|
||||||
"github.com/fission/fission/pkg/mqtrigger/validator"
|
"github.com/fission/fission/pkg/mqtrigger/validator"
|
||||||
|
"github.com/fission/fission/pkg/utils/uuid"
|
||||||
)
|
)
|
||||||
|
|
||||||
type CreateSubCommand struct {
|
type CreateSubCommand struct {
|
||||||
@@ -54,11 +54,7 @@ func (opts *CreateSubCommand) complete(input cli.Input) error {
|
|||||||
mqtName := input.String(flagkey.MqtName)
|
mqtName := input.String(flagkey.MqtName)
|
||||||
if len(mqtName) == 0 {
|
if len(mqtName) == 0 {
|
||||||
console.Warn(fmt.Sprintf("--%v will be soon marked as required flag, see 'help' for details", flagkey.MqtName))
|
console.Warn(fmt.Sprintf("--%v will be soon marked as required flag, see 'help' for details", flagkey.MqtName))
|
||||||
id, err := uuid.NewV4()
|
mqtName = uuid.NewString()
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
mqtName = id.String()
|
|
||||||
}
|
}
|
||||||
fnName := input.String(flagkey.MqtFnName)
|
fnName := input.String(flagkey.MqtFnName)
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ import (
|
|||||||
|
|
||||||
"github.com/dchest/uniuri"
|
"github.com/dchest/uniuri"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
uuid "github.com/satori/go.uuid"
|
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
|
||||||
fv1 "github.com/fission/fission/pkg/apis/core/v1"
|
fv1 "github.com/fission/fission/pkg/apis/core/v1"
|
||||||
@@ -34,6 +33,7 @@ import (
|
|||||||
"github.com/fission/fission/pkg/fission-cli/console"
|
"github.com/fission/fission/pkg/fission-cli/console"
|
||||||
flagkey "github.com/fission/fission/pkg/fission-cli/flag/key"
|
flagkey "github.com/fission/fission/pkg/fission-cli/flag/key"
|
||||||
"github.com/fission/fission/pkg/fission-cli/util"
|
"github.com/fission/fission/pkg/fission-cli/util"
|
||||||
|
"github.com/fission/fission/pkg/utils/uuid"
|
||||||
)
|
)
|
||||||
|
|
||||||
type CreateSubCommand struct {
|
type CreateSubCommand struct {
|
||||||
@@ -179,11 +179,7 @@ func CreatePackage(input cli.Input, client cmd.Client, pkgName string, pkgNamesp
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(pkgName) == 0 {
|
if len(pkgName) == 0 {
|
||||||
id, err := uuid.NewV4()
|
pkgName = strings.ToLower(uuid.NewString())
|
||||||
if err != nil {
|
|
||||||
return nil, errors.Wrap(err, "error generating UUID")
|
|
||||||
}
|
|
||||||
pkgName = strings.ToLower(id.String())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pkg := &fv1.Package{
|
pkg := &fv1.Package{
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ import (
|
|||||||
"github.com/dchest/uniuri"
|
"github.com/dchest/uniuri"
|
||||||
"github.com/hashicorp/go-multierror"
|
"github.com/hashicorp/go-multierror"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
uuid "github.com/satori/go.uuid"
|
|
||||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
|
||||||
fv1 "github.com/fission/fission/pkg/apis/core/v1"
|
fv1 "github.com/fission/fission/pkg/apis/core/v1"
|
||||||
@@ -40,6 +39,7 @@ import (
|
|||||||
flagkey "github.com/fission/fission/pkg/fission-cli/flag/key"
|
flagkey "github.com/fission/fission/pkg/fission-cli/flag/key"
|
||||||
"github.com/fission/fission/pkg/fission-cli/util"
|
"github.com/fission/fission/pkg/fission-cli/util"
|
||||||
"github.com/fission/fission/pkg/utils"
|
"github.com/fission/fission/pkg/utils"
|
||||||
|
"github.com/fission/fission/pkg/utils/uuid"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CreateArchive returns a fv1.Archive made from an archive . If specFile, then
|
// CreateArchive returns a fv1.Archive made from an archive . If specFile, then
|
||||||
@@ -124,11 +124,7 @@ func CreateArchive(client cmd.Client, input cli.Input, includeFiles []string, no
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
id, err := uuid.NewV4()
|
file := filepath.Join(tmpDir, uuid.NewString())
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
file := filepath.Join(tmpDir, id.String())
|
|
||||||
err = utils.DownloadUrl(input.Context(), http.DefaultClient, fileURL, file)
|
err = utils.DownloadUrl(input.Context(), http.DefaultClient, fileURL, file)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "error downloading file from the given URL")
|
return nil, errors.Wrap(err, "error downloading file from the given URL")
|
||||||
|
|||||||
@@ -27,13 +27,13 @@ import (
|
|||||||
"text/tabwriter"
|
"text/tabwriter"
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
uuid "github.com/satori/go.uuid"
|
|
||||||
|
|
||||||
fv1 "github.com/fission/fission/pkg/apis/core/v1"
|
fv1 "github.com/fission/fission/pkg/apis/core/v1"
|
||||||
"github.com/fission/fission/pkg/fission-cli/cmd"
|
"github.com/fission/fission/pkg/fission-cli/cmd"
|
||||||
"github.com/fission/fission/pkg/fission-cli/util"
|
"github.com/fission/fission/pkg/fission-cli/util"
|
||||||
storageSvcClient "github.com/fission/fission/pkg/storagesvc/client"
|
storageSvcClient "github.com/fission/fission/pkg/storagesvc/client"
|
||||||
"github.com/fission/fission/pkg/utils"
|
"github.com/fission/fission/pkg/utils"
|
||||||
|
"github.com/fission/fission/pkg/utils/uuid"
|
||||||
)
|
)
|
||||||
|
|
||||||
func UploadArchiveFile(ctx context.Context, client cmd.Client, fileName string) (*fv1.Archive, error) {
|
func UploadArchiveFile(ctx context.Context, client cmd.Client, fileName string) (*fv1.Archive, error) {
|
||||||
@@ -141,11 +141,7 @@ func DownloadToTempFile(fileUrl string) (string, error) {
|
|||||||
return "", errors.Wrapf(err, "error creating temp directory %v", tmpDir)
|
return "", errors.Wrapf(err, "error creating temp directory %v", tmpDir)
|
||||||
}
|
}
|
||||||
|
|
||||||
id, err := uuid.NewV4()
|
tmpFilename := uuid.NewString()
|
||||||
if err != nil {
|
|
||||||
return "", errors.Wrapf(err, "error generating UUID")
|
|
||||||
}
|
|
||||||
tmpFilename := id.String()
|
|
||||||
destination := filepath.Join(tmpDir, tmpFilename)
|
destination := filepath.Join(tmpDir, tmpFilename)
|
||||||
|
|
||||||
err = WriteArchiveToFile(destination, reader)
|
err = WriteArchiveToFile(destination, reader)
|
||||||
@@ -209,11 +205,8 @@ func WriteArchiveToFile(fileName string, reader io.Reader) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
id, err := uuid.NewV4()
|
|
||||||
if err != nil {
|
tmpFileName := uuid.NewString()
|
||||||
return err
|
|
||||||
}
|
|
||||||
tmpFileName := id.String()
|
|
||||||
|
|
||||||
path := filepath.Join(tmpDir, tmpFileName+".tmp")
|
path := filepath.Join(tmpDir, tmpFileName+".tmp")
|
||||||
w, err := os.Create(path)
|
w, err := os.Create(path)
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
uuid "github.com/satori/go.uuid"
|
|
||||||
"sigs.k8s.io/yaml"
|
"sigs.k8s.io/yaml"
|
||||||
|
|
||||||
"github.com/fission/fission/pkg/fission-cli/cliwrapper/cli"
|
"github.com/fission/fission/pkg/fission-cli/cliwrapper/cli"
|
||||||
@@ -30,6 +29,7 @@ import (
|
|||||||
spectypes "github.com/fission/fission/pkg/fission-cli/cmd/spec/types"
|
spectypes "github.com/fission/fission/pkg/fission-cli/cmd/spec/types"
|
||||||
flagkey "github.com/fission/fission/pkg/fission-cli/flag/key"
|
flagkey "github.com/fission/fission/pkg/fission-cli/flag/key"
|
||||||
"github.com/fission/fission/pkg/fission-cli/util"
|
"github.com/fission/fission/pkg/fission-cli/util"
|
||||||
|
"github.com/fission/fission/pkg/utils/uuid"
|
||||||
)
|
)
|
||||||
|
|
||||||
type InitSubCommand struct {
|
type InitSubCommand struct {
|
||||||
@@ -66,11 +66,7 @@ func (opts *InitSubCommand) complete(input cli.Input) error {
|
|||||||
|
|
||||||
deployID := input.String(flagkey.SpecDeployID)
|
deployID := input.String(flagkey.SpecDeployID)
|
||||||
if len(deployID) == 0 {
|
if len(deployID) == 0 {
|
||||||
id, err := uuid.NewV4()
|
deployID = uuid.NewString()
|
||||||
if err != nil {
|
|
||||||
return errors.Wrap(err, "error generating UUID")
|
|
||||||
}
|
|
||||||
deployID = id.String()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create spec dir
|
// Create spec dir
|
||||||
|
|||||||
@@ -21,10 +21,10 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/fission/fission/pkg/fission-cli/cmd"
|
"github.com/fission/fission/pkg/fission-cli/cmd"
|
||||||
|
"github.com/fission/fission/pkg/utils/uuid"
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/robfig/cron/v3"
|
"github.com/robfig/cron/v3"
|
||||||
uuid "github.com/satori/go.uuid"
|
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
|
||||||
fv1 "github.com/fission/fission/pkg/apis/core/v1"
|
fv1 "github.com/fission/fission/pkg/apis/core/v1"
|
||||||
@@ -55,11 +55,7 @@ func (opts *CreateSubCommand) do(input cli.Input) error {
|
|||||||
func (opts *CreateSubCommand) complete(input cli.Input) (err error) {
|
func (opts *CreateSubCommand) complete(input cli.Input) (err error) {
|
||||||
name := input.String(flagkey.TtName)
|
name := input.String(flagkey.TtName)
|
||||||
if len(name) == 0 {
|
if len(name) == 0 {
|
||||||
id, err := uuid.NewV4()
|
name = uuid.NewString()
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
name = id.String()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fnName := input.String(flagkey.TtFnName)
|
fnName := input.String(flagkey.TtFnName)
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ package storagesvc
|
|||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"github.com/fission/fission/pkg/utils/uuid"
|
||||||
"github.com/graymeta/stow"
|
"github.com/graymeta/stow"
|
||||||
_ "github.com/graymeta/stow/local"
|
_ "github.com/graymeta/stow/local"
|
||||||
uuid "github.com/satori/go.uuid"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type localStorage struct {
|
type localStorage struct {
|
||||||
@@ -35,11 +35,7 @@ func (ls localStorage) getStorageType() StorageType {
|
|||||||
func (ls localStorage) getUploadFileName() (string, error) {
|
func (ls localStorage) getUploadFileName() (string, error) {
|
||||||
// This is not the item ID (that's returned by Put)
|
// This is not the item ID (that's returned by Put)
|
||||||
// should we just use handler.Filename? what are the constraints here?
|
// should we just use handler.Filename? what are the constraints here?
|
||||||
id, err := uuid.NewV4()
|
return uuid.NewString(), nil
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
return id.String(), err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ls localStorage) getSubDir() string {
|
func (ls localStorage) getSubDir() string {
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ import (
|
|||||||
|
|
||||||
"github.com/graymeta/stow"
|
"github.com/graymeta/stow"
|
||||||
"github.com/graymeta/stow/s3"
|
"github.com/graymeta/stow/s3"
|
||||||
uuid "github.com/satori/go.uuid"
|
|
||||||
|
"github.com/fission/fission/pkg/utils/uuid"
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
@@ -54,11 +55,8 @@ func (ss s3Storage) getSubDir() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (ss s3Storage) getUploadFileName() (string, error) {
|
func (ss s3Storage) getUploadFileName() (string, error) {
|
||||||
id, err := uuid.NewV4()
|
id := uuid.NewString()
|
||||||
if err != nil {
|
return path.Join(ss.subDir, id), nil
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
return path.Join(ss.subDir, id.String()), nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ss s3Storage) dial() (stow.Location, error) {
|
func (ss s3Storage) dial() (stow.Location, error) {
|
||||||
|
|||||||
@@ -19,13 +19,12 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
uuid "github.com/satori/go.uuid"
|
"github.com/fission/fission/pkg/utils/uuid"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -49,10 +48,7 @@ type (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func NewTracker() (*Tracker, error) {
|
func NewTracker() (*Tracker, error) {
|
||||||
id, err := uuid.NewV4()
|
id := uuid.NewString()
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("tracker.NewTracker: error generating UUID: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
gaTrackingID := os.Getenv(GA_TRACKING_ID)
|
gaTrackingID := os.Getenv(GA_TRACKING_ID)
|
||||||
if gaTrackingID == "" {
|
if gaTrackingID == "" {
|
||||||
@@ -66,7 +62,7 @@ func NewTracker() (*Tracker, error) {
|
|||||||
|
|
||||||
tracker := &Tracker{
|
tracker := &Tracker{
|
||||||
gaPropertyID: gaTrackingID,
|
gaPropertyID: gaTrackingID,
|
||||||
cid: id.String(),
|
cid: id,
|
||||||
gaAPIURL: gaAPIURL,
|
gaAPIURL: gaAPIURL,
|
||||||
}
|
}
|
||||||
return tracker, nil
|
return tracker, nil
|
||||||
|
|||||||
@@ -7,8 +7,6 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
uuid "github.com/satori/go.uuid"
|
|
||||||
|
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
authorizationv1 "k8s.io/api/authorization/v1"
|
authorizationv1 "k8s.io/api/authorization/v1"
|
||||||
v1 "k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
@@ -18,6 +16,8 @@ import (
|
|||||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
"k8s.io/apimachinery/pkg/util/wait"
|
"k8s.io/apimachinery/pkg/util/wait"
|
||||||
"k8s.io/client-go/kubernetes"
|
"k8s.io/client-go/kubernetes"
|
||||||
|
|
||||||
|
"github.com/fission/fission/pkg/utils/uuid"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -292,11 +292,8 @@ func createGetSA(ctx context.Context, k8sClient kubernetes.Interface, SAName, ns
|
|||||||
|
|
||||||
// generateSuffix generates a random string of 6 characters
|
// generateSuffix generates a random string of 6 characters
|
||||||
func generateSuffix() (string, error) {
|
func generateSuffix() (string, error) {
|
||||||
id, err := uuid.NewV4()
|
id := uuid.NewString()
|
||||||
if err != nil {
|
return id[:6], nil
|
||||||
return "", nil
|
|
||||||
}
|
|
||||||
return id.String()[:6], nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func createServiceAccount() bool {
|
func createServiceAccount() bool {
|
||||||
|
|||||||
+2
-6
@@ -31,12 +31,12 @@ import (
|
|||||||
|
|
||||||
"github.com/mholt/archiver/v3"
|
"github.com/mholt/archiver/v3"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
uuid "github.com/satori/go.uuid"
|
|
||||||
"golang.org/x/net/context/ctxhttp"
|
"golang.org/x/net/context/ctxhttp"
|
||||||
apiv1 "k8s.io/api/core/v1"
|
apiv1 "k8s.io/api/core/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
|
||||||
fv1 "github.com/fission/fission/pkg/apis/core/v1"
|
fv1 "github.com/fission/fission/pkg/apis/core/v1"
|
||||||
|
"github.com/fission/fission/pkg/utils/uuid"
|
||||||
)
|
)
|
||||||
|
|
||||||
func UrlForFunction(name, namespace string) string {
|
func UrlForFunction(name, namespace string) string {
|
||||||
@@ -60,11 +60,7 @@ func GetFunctionIstioServiceName(fnName, fnNamespace string) string {
|
|||||||
|
|
||||||
// GetTempDir creates and return a temporary directory
|
// GetTempDir creates and return a temporary directory
|
||||||
func GetTempDir() (string, error) {
|
func GetTempDir() (string, error) {
|
||||||
id, err := uuid.NewV4()
|
tmpDir := uuid.NewString()
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
tmpDir := id.String()
|
|
||||||
dir, err := os.MkdirTemp("", tmpDir)
|
dir, err := os.MkdirTemp("", tmpDir)
|
||||||
return dir, err
|
return dir, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package uuid
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/google/uuid"
|
||||||
|
"k8s.io/apimachinery/pkg/types"
|
||||||
|
)
|
||||||
|
|
||||||
|
func NewUUID() types.UID {
|
||||||
|
return types.UID(uuid.New().String())
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewString() string {
|
||||||
|
return uuid.New().String()
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user