Codebase cleanup & optimization (#1493)
Remove old v1 types that are no longer used and move fetcher structs to fetcher directory.
This commit is contained in:
@@ -28,7 +28,6 @@ import (
|
||||
"github.com/fission/fission/pkg/fission-cli/cmd"
|
||||
flagkey "github.com/fission/fission/pkg/fission-cli/flag/key"
|
||||
"github.com/fission/fission/pkg/fission-cli/util"
|
||||
"github.com/fission/fission/pkg/types"
|
||||
)
|
||||
|
||||
type CreateSubCommand struct {
|
||||
@@ -76,7 +75,7 @@ func (opts *CreateSubCommand) complete(input cli.Input) error {
|
||||
}
|
||||
|
||||
// check that the trigger has function reference type function weights
|
||||
if htTrigger.Spec.FunctionReference.Type != types.FunctionReferenceTypeFunctionWeights {
|
||||
if htTrigger.Spec.FunctionReference.Type != fv1.FunctionReferenceTypeFunctionWeights {
|
||||
return errors.New("canary config cannot be created for http triggers that do not reference functions by weights")
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@ import (
|
||||
"github.com/fission/fission/pkg/fission-cli/console"
|
||||
flagkey "github.com/fission/fission/pkg/fission-cli/flag/key"
|
||||
"github.com/fission/fission/pkg/fission-cli/util"
|
||||
"github.com/fission/fission/pkg/types"
|
||||
)
|
||||
|
||||
type CreateSubCommand struct {
|
||||
@@ -62,13 +61,13 @@ func (opts *CreateSubCommand) complete(input cli.Input) error {
|
||||
var mqType fv1.MessageQueueType
|
||||
switch input.String(flagkey.MqtMQType) {
|
||||
case "":
|
||||
mqType = types.MessageQueueTypeNats
|
||||
case types.MessageQueueTypeNats:
|
||||
mqType = types.MessageQueueTypeNats
|
||||
case types.MessageQueueTypeASQ:
|
||||
mqType = types.MessageQueueTypeASQ
|
||||
case types.MessageQueueTypeKafka:
|
||||
mqType = types.MessageQueueTypeKafka
|
||||
mqType = fv1.MessageQueueTypeNats
|
||||
case fv1.MessageQueueTypeNats:
|
||||
mqType = fv1.MessageQueueTypeNats
|
||||
case fv1.MessageQueueTypeASQ:
|
||||
mqType = fv1.MessageQueueTypeASQ
|
||||
case fv1.MessageQueueTypeKafka:
|
||||
mqType = fv1.MessageQueueTypeKafka
|
||||
default:
|
||||
return errors.New("Unknown message queue type, currently only \"nats-streaming, azure-storage-queue, kafka \" is supported")
|
||||
}
|
||||
@@ -131,7 +130,7 @@ func (opts *CreateSubCommand) complete(input cli.Input) error {
|
||||
},
|
||||
Spec: fv1.MessageQueueTriggerSpec{
|
||||
FunctionReference: fv1.FunctionReference{
|
||||
Type: types.FunctionReferenceTypeFunctionName,
|
||||
Type: fv1.FunctionReferenceTypeFunctionName,
|
||||
Name: fnName,
|
||||
},
|
||||
MessageQueueType: mqType,
|
||||
|
||||
@@ -33,7 +33,6 @@ import (
|
||||
fv1 "github.com/fission/fission/pkg/apis/fission.io/v1"
|
||||
"github.com/fission/fission/pkg/controller/client"
|
||||
storageSvcClient "github.com/fission/fission/pkg/storagesvc/client"
|
||||
"github.com/fission/fission/pkg/types"
|
||||
"github.com/fission/fission/pkg/utils"
|
||||
)
|
||||
|
||||
@@ -45,7 +44,7 @@ func UploadArchiveFile(ctx context.Context, client client.Interface, fileName st
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if size < types.ArchiveLiteralSizeLimit {
|
||||
if size < fv1.ArchiveLiteralSizeLimit {
|
||||
archive.Type = fv1.ArchiveTypeLiteral
|
||||
archive.Literal, err = GetContents(fileName)
|
||||
if err != nil {
|
||||
|
||||
@@ -40,7 +40,6 @@ import (
|
||||
"github.com/fission/fission/pkg/fission-cli/console"
|
||||
flagkey "github.com/fission/fission/pkg/fission-cli/flag/key"
|
||||
"github.com/fission/fission/pkg/fission-cli/util"
|
||||
"github.com/fission/fission/pkg/types"
|
||||
"github.com/fission/fission/pkg/utils"
|
||||
)
|
||||
|
||||
@@ -474,7 +473,7 @@ func localArchiveFromSpec(specDir string, aus *spectypes.ArchiveUploadSpec) (*fv
|
||||
}
|
||||
|
||||
// figure out if we're making a literal or a URL-based archive
|
||||
if size < types.ArchiveLiteralSizeLimit {
|
||||
if size < fv1.ArchiveLiteralSizeLimit {
|
||||
contents, err := pkgutil.GetContents(archiveFileName)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -27,7 +27,6 @@ import (
|
||||
fv1 "github.com/fission/fission/pkg/apis/fission.io/v1"
|
||||
"github.com/fission/fission/pkg/controller/client"
|
||||
"github.com/fission/fission/pkg/fission-cli/cmd/package/util"
|
||||
"github.com/fission/fission/pkg/types"
|
||||
)
|
||||
|
||||
type (
|
||||
@@ -83,11 +82,11 @@ func (w *packageBuildWatcher) watch(ctx context.Context) {
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
if pkg.Status.BuildStatus == types.BuildStatusNone {
|
||||
if pkg.Status.BuildStatus == fv1.BuildStatusNone {
|
||||
continue
|
||||
}
|
||||
if pkg.Status.BuildStatus == types.BuildStatusPending ||
|
||||
pkg.Status.BuildStatus == types.BuildStatusRunning {
|
||||
if pkg.Status.BuildStatus == fv1.BuildStatusPending ||
|
||||
pkg.Status.BuildStatus == fv1.BuildStatusRunning {
|
||||
keepWaiting = true
|
||||
}
|
||||
buildpkgs = append(buildpkgs, pkg)
|
||||
@@ -99,8 +98,8 @@ func (w *packageBuildWatcher) watch(ctx context.Context) {
|
||||
if _, printed := w.finished[k]; printed {
|
||||
continue
|
||||
}
|
||||
if pkg.Status.BuildStatus == types.BuildStatusFailed ||
|
||||
pkg.Status.BuildStatus == types.BuildStatusSucceeded {
|
||||
if pkg.Status.BuildStatus == fv1.BuildStatusFailed ||
|
||||
pkg.Status.BuildStatus == fv1.BuildStatusSucceeded {
|
||||
w.finished[k] = true
|
||||
fmt.Printf("------\n")
|
||||
util.PrintPackageSummary(os.Stdout, &pkg)
|
||||
|
||||
@@ -24,7 +24,6 @@ import (
|
||||
fv1 "github.com/fission/fission/pkg/apis/fission.io/v1"
|
||||
"github.com/fission/fission/pkg/controller/client"
|
||||
"github.com/fission/fission/pkg/fission-cli/console"
|
||||
"github.com/fission/fission/pkg/types"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -114,7 +113,7 @@ func (res CrdDumper) Dump(dumpDir string) {
|
||||
case CrdMessageQueueTrigger:
|
||||
var triggers []fv1.MessageQueueTrigger
|
||||
|
||||
for _, mqType := range []string{types.MessageQueueTypeNats, types.MessageQueueTypeASQ} {
|
||||
for _, mqType := range []string{fv1.MessageQueueTypeNats, fv1.MessageQueueTypeASQ, fv1.MessageQueueTypeKafka} {
|
||||
l, err := res.client.V1().MessageQueueTrigger().List(mqType, metav1.NamespaceAll)
|
||||
if err != nil {
|
||||
console.Warn(fmt.Sprintf("Error getting %v list: %v", res.crdType, err))
|
||||
|
||||
Reference in New Issue
Block a user