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:
Ta-Ching Chen
2020-01-16 16:47:32 +08:00
committed by GitHub
parent 574fb55fcf
commit bb3e6d6907
37 changed files with 305 additions and 498 deletions
+3 -4
View File
@@ -41,7 +41,6 @@ import (
fv1 "github.com/fission/fission/pkg/apis/fission.io/v1"
ferror "github.com/fission/fission/pkg/error"
"github.com/fission/fission/pkg/types"
)
func RegisterFunctionRoute(ws *restful.WebService) {
@@ -307,9 +306,9 @@ func (a *API) FunctionPodLogs(w http.ResponseWriter, r *http.Request) {
// Get function Pods first
selector := map[string]string{
types.FUNCTION_UID: string(f.ObjectMeta.UID),
types.ENVIRONMENT_NAME: f.Spec.Environment.Name,
types.ENVIRONMENT_NAMESPACE: f.Spec.Environment.Namespace,
fv1.FUNCTION_UID: string(f.ObjectMeta.UID),
fv1.ENVIRONMENT_NAME: f.Spec.Environment.Name,
fv1.ENVIRONMENT_NAMESPACE: f.Spec.Environment.Namespace,
}
podList, err := a.kubernetesClient.CoreV1().Pods(podNs).List(metav1.ListOptions{
LabelSelector: labels.Set(selector).AsSelector().String(),
+4 -5
View File
@@ -25,7 +25,6 @@ import (
"github.com/dustin/go-humanize"
"github.com/emicklei/go-restful"
restfulspec "github.com/emicklei/go-restful-openapi"
"github.com/fission/fission/pkg/types"
"github.com/go-openapi/spec"
"github.com/gorilla/mux"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -136,15 +135,15 @@ func (a *API) PackageApiCreate(w http.ResponseWriter, r *http.Request) {
}
// Ensure size limits
if len(f.Spec.Source.Literal) > int(types.ArchiveLiteralSizeLimit) {
if len(f.Spec.Source.Literal) > int(fv1.ArchiveLiteralSizeLimit) {
err := ferror.MakeError(ferror.ErrorInvalidArgument,
fmt.Sprintf("Package literal larger than %s", humanize.Bytes(uint64(types.ArchiveLiteralSizeLimit))))
fmt.Sprintf("Package literal larger than %s", humanize.Bytes(uint64(fv1.ArchiveLiteralSizeLimit))))
a.respondWithError(w, err)
return
}
if len(f.Spec.Deployment.Literal) > int(types.ArchiveLiteralSizeLimit) {
if len(f.Spec.Deployment.Literal) > int(fv1.ArchiveLiteralSizeLimit) {
err := ferror.MakeError(ferror.ErrorInvalidArgument,
fmt.Sprintf("Package literal larger than %s", humanize.Bytes(uint64(types.ArchiveLiteralSizeLimit))))
fmt.Sprintf("Package literal larger than %s", humanize.Bytes(uint64(fv1.ArchiveLiteralSizeLimit))))
a.respondWithError(w, err)
return
}