mirror of https://github.com/kubevela/kubevela.git
refactor cli/dashboard/apiserver to reference folder (#1084)
* refactor cli/dashboard/apiserver to reference folder * address comments
This commit is contained in:
parent
13a70e6819
commit
dd222ac876
|
|
@ -9,7 +9,7 @@ on:
|
|||
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ./dashboard
|
||||
working-directory: ./references/dashboard
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-20.04
|
||||
|
|
|
|||
|
|
@ -36,8 +36,8 @@ pkg/test/vela
|
|||
config/crd/bases
|
||||
tmp/
|
||||
|
||||
cmd/vela/fake/source.go
|
||||
cmd/vela/fake/chart_source.go
|
||||
references/cmd/cli/fake/source.go
|
||||
references/cmd/cli/fake/chart_source.go
|
||||
charts/vela-core/crds/_.yaml
|
||||
.test_vela
|
||||
|
||||
|
|
@ -46,11 +46,11 @@ charts/vela-core/crds/_.yaml
|
|||
# Dashboard
|
||||
node_modules/
|
||||
.eslintcache
|
||||
dashboard/dist/
|
||||
dashboard/package-lock.json
|
||||
dashboard/src/.umi/
|
||||
references/dashboard/dist/
|
||||
references/dashboard/package-lock.json
|
||||
references/dashboard/src/.umi/
|
||||
package-lock.json
|
||||
dashboard/src/.umi-production/
|
||||
references/dashboard/src/.umi-production/
|
||||
|
||||
# Swagger: generate Restful API
|
||||
pkg/server/docs/index.html
|
||||
references/apiserver/docs/index.html
|
||||
|
|
|
|||
23
Makefile
23
Makefile
|
|
@ -39,19 +39,20 @@ all: build
|
|||
# Run tests
|
||||
test: vet lint staticcheck
|
||||
go test -race -coverprofile=coverage.txt -covermode=atomic ./pkg/... ./cmd/...
|
||||
go test -race -covermode=atomic ./references/apiserver/... ./references/cli/... ./references/common/...
|
||||
@$(OK) unit-tests pass
|
||||
|
||||
# Build manager binary
|
||||
build: fmt vet lint staticcheck
|
||||
go run hack/chart/generate.go
|
||||
go build -o bin/vela -ldflags ${LDFLAGS} cmd/vela/main.go
|
||||
git checkout cmd/vela/fake/chart_source.go
|
||||
go build -o bin/vela -ldflags ${LDFLAGS} references/cmd/cli/main.go
|
||||
git checkout references/cmd/cli/fake/chart_source.go
|
||||
@$(OK) build succeed
|
||||
|
||||
vela-cli:
|
||||
go run hack/chart/generate.go
|
||||
go build -o bin/vela -ldflags ${LDFLAGS} cmd/vela/main.go
|
||||
git checkout cmd/vela/fake/chart_source.go
|
||||
go build -o bin/vela -ldflags ${LDFLAGS} references/cmd/cli/main.go
|
||||
git checkout references/cmd/cli/fake/chart_source.go
|
||||
|
||||
dashboard-build:
|
||||
cd dashboard && npm install && cd ..
|
||||
|
|
@ -62,16 +63,16 @@ doc-gen:
|
|||
go run hack/references/generate.go
|
||||
|
||||
api-gen:
|
||||
swag init -g pkg/server/route.go --output pkg/server/docs
|
||||
swagger-codegen generate -l html2 -i pkg/server/docs/swagger.yaml -o pkg/server/docs
|
||||
mv pkg/server/docs/index.html docs/en/developers/references/restful-api/
|
||||
swag init -g references/apiserver/route.go --output references/apiserver/docs
|
||||
swagger-codegen generate -l html2 -i references/apiserver/docs/swagger.yaml -o references/apiserver/docs
|
||||
mv references/apiserver/docs/index.html docs/en/developers/references/restful-api/
|
||||
|
||||
generate-source:
|
||||
go run hack/frontend/source.go
|
||||
|
||||
cross-build:
|
||||
go run hack/chart/generate.go
|
||||
GO111MODULE=on CGO_ENABLED=0 $(GOX) -ldflags $(LDFLAGS) -parallel=2 -output="_bin/{{.OS}}-{{.Arch}}/vela" -osarch='$(TARGETS)' ./cmd/vela/
|
||||
GO111MODULE=on CGO_ENABLED=0 $(GOX) -ldflags $(LDFLAGS) -parallel=2 -output="_bin/{{.OS}}-{{.Arch}}/vela" -osarch='$(TARGETS)' ./references/cmd/cli/
|
||||
|
||||
compress:
|
||||
( \
|
||||
|
|
@ -243,8 +244,8 @@ CUE=$(shell which cue)
|
|||
endif
|
||||
|
||||
start-dashboard:
|
||||
go run pkg/server/main/startAPIServer.go &
|
||||
cd dashboard && npm install && npm start && cd ..
|
||||
go run references/cmd/apiserver/main.go &
|
||||
cd references/dashboard && npm install && npm start && cd ..
|
||||
|
||||
swagger-gen:
|
||||
$(GOBIN)/swag init -g server/route.go -d pkg/ -o pkg/server/docs/
|
||||
$(GOBIN)/swag init -g apiserver/route.go -d pkg/ -o references/apiserver/docs/
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ import (
|
|||
|
||||
oamcore "github.com/oam-dev/kubevela/apis/core.oam.dev"
|
||||
velacore "github.com/oam-dev/kubevela/apis/standard.oam.dev/v1alpha1"
|
||||
"github.com/oam-dev/kubevela/pkg/appfile/driver"
|
||||
velacontroller "github.com/oam-dev/kubevela/pkg/controller"
|
||||
oamcontroller "github.com/oam-dev/kubevela/pkg/controller/core.oam.dev"
|
||||
oamv1alpha2 "github.com/oam-dev/kubevela/pkg/controller/core.oam.dev/v1alpha2"
|
||||
|
|
@ -102,7 +101,7 @@ func main() {
|
|||
flag.StringVar(&controllerArgs.CustomRevisionHookURL, "custom-revision-hook-url", "",
|
||||
"custom-revision-hook-url is a webhook url which will let KubeVela core to call with applicationConfiguration and component info and return a customized component revision")
|
||||
flag.StringVar(&disableCaps, "disable-caps", "", "To be disabled builtin capability list.")
|
||||
flag.StringVar(&storageDriver, "storage-driver", driver.LocalDriverName, "Application file save to the storage driver")
|
||||
flag.StringVar(&storageDriver, "storage-driver", "Local", "Application file save to the storage driver")
|
||||
flag.DurationVar(&syncPeriod, "informer-re-sync-interval", 5*time.Minute,
|
||||
"controller shared informer lister full re-sync period")
|
||||
flag.Parse()
|
||||
|
|
|
|||
|
|
@ -260,7 +260,7 @@ github.com/spf13/cobra.(*Command).ExecuteC
|
|||
github.com/spf13/cobra.(*Command).Execute
|
||||
/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.1.1/command.go:895
|
||||
main.main
|
||||
/home/runner/work/kubevela/kubevela/cmd/vela/main.go:16
|
||||
/home/runner/work/kubevela/kubevela/references/cmd/cli/main.go:16
|
||||
runtime.main
|
||||
/opt/hostedtoolcache/go/1.14.13/x64/src/runtime/proc.go:203
|
||||
runtime.goexit
|
||||
|
|
|
|||
|
|
@ -11,9 +11,9 @@ import (
|
|||
"github.com/onsi/gomega"
|
||||
|
||||
"github.com/oam-dev/kubevela/e2e"
|
||||
"github.com/oam-dev/kubevela/pkg/appfile/api"
|
||||
"github.com/oam-dev/kubevela/pkg/server/apis"
|
||||
"github.com/oam-dev/kubevela/pkg/server/util"
|
||||
"github.com/oam-dev/kubevela/references/apiserver/apis"
|
||||
"github.com/oam-dev/kubevela/references/apiserver/util"
|
||||
"github.com/oam-dev/kubevela/references/appfile/api"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import (
|
|||
|
||||
"github.com/oam-dev/kubevela/apis/types"
|
||||
"github.com/oam-dev/kubevela/e2e"
|
||||
"github.com/oam-dev/kubevela/pkg/server/apis"
|
||||
"github.com/oam-dev/kubevela/references/apiserver/apis"
|
||||
|
||||
"github.com/onsi/ginkgo"
|
||||
"github.com/onsi/gomega"
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@ import (
|
|||
"github.com/onsi/ginkgo"
|
||||
"github.com/onsi/gomega"
|
||||
|
||||
"github.com/oam-dev/kubevela/pkg/server/apis"
|
||||
"github.com/oam-dev/kubevela/pkg/server/util"
|
||||
"github.com/oam-dev/kubevela/references/apiserver/apis"
|
||||
"github.com/oam-dev/kubevela/references/apiserver/util"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ set -e
|
|||
|
||||
echo "building binary"
|
||||
echo "========"
|
||||
go build -o bin/vela ./cmd/vela/
|
||||
go build -o bin/vela ./references/cmd/cli/
|
||||
export PATH=bin/:$PATH
|
||||
|
||||
echo "vela up"
|
||||
|
|
|
|||
|
|
@ -27,5 +27,5 @@ func printToFile(data string) {
|
|||
var ChartSource = "`)
|
||||
utils.FprintZipData(&buffer, []byte(data))
|
||||
buffer.WriteString(`"`)
|
||||
_ = ioutil.WriteFile("cmd/vela/fake/chart_source.go", buffer.Bytes(), 0644)
|
||||
_ = ioutil.WriteFile("references/cmd/cli/fake/chart_source.go", buffer.Bytes(), 0644)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,13 +3,13 @@ package main
|
|||
import (
|
||||
"log"
|
||||
|
||||
"github.com/oam-dev/kubevela/pkg/commands"
|
||||
"github.com/oam-dev/kubevela/references/cli"
|
||||
|
||||
"github.com/spf13/cobra/doc"
|
||||
)
|
||||
|
||||
func main() {
|
||||
vela := commands.NewCommand()
|
||||
vela := cli.NewCommand()
|
||||
err := doc.GenMarkdownTree(vela, "./docs/en/cli/")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
|
|
|||
|
|
@ -48,5 +48,5 @@ func PrintToFile(data string) {
|
|||
var FrontendSource = "`)
|
||||
utils.FprintZipData(&buffer, []byte(data))
|
||||
buffer.WriteString(`"`)
|
||||
_ = ioutil.WriteFile("cmd/vela/fake/source.go", buffer.Bytes(), 0644)
|
||||
_ = ioutil.WriteFile("references/cmd/cli/fake/source.go", buffer.Bytes(), 0644)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import (
|
|||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/oam-dev/kubevela/pkg/plugins"
|
||||
"github.com/oam-dev/kubevela/references/plugins"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,64 @@
|
|||
package appfile
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
"k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
|
||||
"k8s.io/client-go/rest"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
"sigs.k8s.io/controller-runtime/pkg/envtest"
|
||||
"sigs.k8s.io/controller-runtime/pkg/envtest/printer"
|
||||
logf "sigs.k8s.io/controller-runtime/pkg/log"
|
||||
"sigs.k8s.io/controller-runtime/pkg/log/zap"
|
||||
|
||||
corev1alpha2 "github.com/oam-dev/kubevela/apis/core.oam.dev"
|
||||
// +kubebuilder:scaffold:imports
|
||||
)
|
||||
|
||||
var cfg *rest.Config
|
||||
var scheme *runtime.Scheme
|
||||
var k8sClient client.Client
|
||||
var testEnv *envtest.Environment
|
||||
|
||||
func TestAppFile(t *testing.T) {
|
||||
RegisterFailHandler(Fail)
|
||||
RunSpecsWithDefaultAndCustomReporters(t,
|
||||
"Cli Suite",
|
||||
[]Reporter{printer.NewlineReporter{}})
|
||||
}
|
||||
|
||||
var _ = BeforeSuite(func(done Done) {
|
||||
logf.SetLogger(zap.New(zap.UseDevMode(true), zap.WriteTo(GinkgoWriter)))
|
||||
//ctx := context.Background()
|
||||
By("bootstrapping test environment")
|
||||
useExistCluster := false
|
||||
testEnv = &envtest.Environment{
|
||||
CRDDirectoryPaths: []string{filepath.Join("..", "..", "charts", "vela-core", "crds")},
|
||||
UseExistingCluster: &useExistCluster,
|
||||
}
|
||||
|
||||
var err error
|
||||
cfg, err = testEnv.Start()
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(cfg).ToNot(BeNil())
|
||||
scheme = runtime.NewScheme()
|
||||
Expect(corev1alpha2.AddToScheme(scheme)).NotTo(HaveOccurred())
|
||||
Expect(clientgoscheme.AddToScheme(scheme)).NotTo(HaveOccurred())
|
||||
Expect(v1beta1.AddToScheme(scheme)).NotTo(HaveOccurred())
|
||||
k8sClient, err = client.New(cfg, client.Options{Scheme: scheme})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(k8sClient).ToNot(BeNil())
|
||||
|
||||
close(done)
|
||||
}, 60)
|
||||
|
||||
var _ = AfterSuite(func() {
|
||||
By("tearing down the test environment")
|
||||
err := testEnv.Stop()
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
|
@ -9,7 +9,7 @@ import (
|
|||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/oam-dev/kubevela/pkg/builtin/registry"
|
||||
cmdutil "github.com/oam-dev/kubevela/pkg/commands/util"
|
||||
cmdutil "github.com/oam-dev/kubevela/pkg/utils/util"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import (
|
|||
"github.com/bmizerany/assert"
|
||||
|
||||
"github.com/oam-dev/kubevela/pkg/builtin/registry"
|
||||
cmdutil "github.com/oam-dev/kubevela/pkg/commands/util"
|
||||
cmdutil "github.com/oam-dev/kubevela/pkg/utils/util"
|
||||
)
|
||||
|
||||
func TestBuild(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ import (
|
|||
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/oam-dev/kubevela/pkg/commands/util"
|
||||
"github.com/oam-dev/kubevela/pkg/utils/util"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import (
|
|||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
cmdutil "github.com/oam-dev/kubevela/pkg/commands/util"
|
||||
cmdutil "github.com/oam-dev/kubevela/pkg/utils/util"
|
||||
)
|
||||
|
||||
var mock map[string]interface{}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import (
|
|||
_ "github.com/oam-dev/kubevela/pkg/builtin/http"
|
||||
|
||||
"github.com/oam-dev/kubevela/pkg/builtin/registry"
|
||||
cmdutil "github.com/oam-dev/kubevela/pkg/commands/util"
|
||||
cmdutil "github.com/oam-dev/kubevela/pkg/utils/util"
|
||||
)
|
||||
|
||||
// RunBuildInTasks do initializing tasks for appfile.
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ import (
|
|||
"sigs.k8s.io/controller-runtime/pkg/reconcile"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/v1alpha2"
|
||||
"github.com/oam-dev/kubevela/pkg/server/util"
|
||||
)
|
||||
|
||||
// RevisionHookRequest is request body for custom component revision hook
|
||||
|
|
@ -36,6 +35,9 @@ type RevisionHookRequest struct {
|
|||
Comp *v1alpha2.Component `json:"component"`
|
||||
}
|
||||
|
||||
// ContentTypeJSON : json
|
||||
const ContentTypeJSON = "application/json"
|
||||
|
||||
func (c *ComponentHandler) customComponentRevisionHook(relatedApps []reconcile.Request, comp *v1alpha2.Component) error {
|
||||
if c.CustomRevisionHookURL == "" {
|
||||
return nil
|
||||
|
|
@ -52,7 +54,7 @@ func (c *ComponentHandler) customComponentRevisionHook(relatedApps []reconcile.R
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
httpRequest.Header.Set("Content-Type", util.ContentTypeJSON)
|
||||
httpRequest.Header.Set("Content-Type", ContentTypeJSON)
|
||||
resp, err := http.DefaultClient.Do(httpRequest)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
|||
|
|
@ -1,40 +0,0 @@
|
|||
apiVersion: core.oam.dev/v1alpha2
|
||||
kind: WorkloadDefinition
|
||||
metadata:
|
||||
name: deployments.testapps
|
||||
labels:
|
||||
usecase: forplugintest
|
||||
spec:
|
||||
definitionRef:
|
||||
name: deployments.apps
|
||||
extension:
|
||||
template: |
|
||||
output: {
|
||||
apiVersion: "apps/v1"
|
||||
kind: "Deployment"
|
||||
metadata: name: context.name
|
||||
spec: {
|
||||
containers: [{
|
||||
image: parameter.image
|
||||
name: context.name
|
||||
env: parameter.env
|
||||
ports: [{
|
||||
containerPort: parameter.port
|
||||
protocol: "TCP"
|
||||
name: "default"
|
||||
}]
|
||||
}]
|
||||
}
|
||||
}
|
||||
parameter: {
|
||||
// +usage=Which image would you like to use for your service
|
||||
// +short=i
|
||||
image: string
|
||||
// +usage=Which port do you want customer traffic sent to
|
||||
// +short=p
|
||||
port: *8080 | int
|
||||
env: [...{
|
||||
name: string
|
||||
value: string
|
||||
}]
|
||||
}
|
||||
|
|
@ -20,7 +20,7 @@ import (
|
|||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/types"
|
||||
cmdutil "github.com/oam-dev/kubevela/pkg/commands/util"
|
||||
cmdutil "github.com/oam-dev/kubevela/pkg/utils/util"
|
||||
)
|
||||
|
||||
// VelaDebugLog defines an ENV to set vela helm install log to be debug
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
# Vela CLI and Dashboard Reference Implementation
|
||||
|
||||
This folder contains all reference implementation of vela cli, apiserver and dashboard.
|
||||
It provides a PoC of how to integrate KubeVela with your own system,
|
||||
you can refer to these implementation and build your own.
|
||||
|
||||
The formal KubeVela APIServer is a standalone project called [velacp](https://github.com/oam-dev/velacp).
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package server
|
||||
package apiserver
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package server
|
||||
package apiserver
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
|
@ -6,11 +6,11 @@ import (
|
|||
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
"github.com/oam-dev/kubevela/pkg/appfile/api"
|
||||
cmdutil "github.com/oam-dev/kubevela/pkg/commands/util"
|
||||
"github.com/oam-dev/kubevela/pkg/server/util"
|
||||
"github.com/oam-dev/kubevela/pkg/serverlib"
|
||||
"github.com/oam-dev/kubevela/pkg/utils/env"
|
||||
cmdutil "github.com/oam-dev/kubevela/pkg/utils/util"
|
||||
"github.com/oam-dev/kubevela/references/apiserver/util"
|
||||
"github.com/oam-dev/kubevela/references/appfile/api"
|
||||
"github.com/oam-dev/kubevela/references/common"
|
||||
)
|
||||
|
||||
// UpdateApps is placeholder for updating applications
|
||||
|
|
@ -28,7 +28,7 @@ func (s *APIServer) GetApp(c *gin.Context) {
|
|||
namespace := envMeta.Namespace
|
||||
appName := c.Param("appName")
|
||||
ctx := util.GetContext(c)
|
||||
applicationMeta, err := serverlib.RetrieveApplicationStatusByName(ctx, s.KubeClient, appName, namespace)
|
||||
applicationMeta, err := common.RetrieveApplicationStatusByName(ctx, s.KubeClient, appName, namespace)
|
||||
if err != nil {
|
||||
util.HandleError(c, util.StatusInternalServerError, err)
|
||||
return
|
||||
|
|
@ -54,7 +54,7 @@ func (s *APIServer) ListApps(c *gin.Context) {
|
|||
namespace := envMeta.Namespace
|
||||
|
||||
ctx := util.GetContext(c)
|
||||
applicationMetaList, err := serverlib.ListApplications(ctx, s.KubeClient, serverlib.Option{Namespace: namespace})
|
||||
applicationMetaList, err := common.ListApplications(ctx, s.KubeClient, common.Option{Namespace: namespace})
|
||||
if err != nil {
|
||||
util.HandleError(c, util.StatusInternalServerError, err.Error())
|
||||
return
|
||||
|
|
@ -72,7 +72,7 @@ func (s *APIServer) DeleteApps(c *gin.Context) {
|
|||
}
|
||||
appName := c.Param("appName")
|
||||
|
||||
o := serverlib.DeleteOptions{
|
||||
o := common.DeleteOptions{
|
||||
Client: s.KubeClient,
|
||||
Env: envMeta,
|
||||
AppName: appName,
|
||||
|
|
@ -102,7 +102,7 @@ func (s *APIServer) CreateApplication(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
ioStream := cmdutil.IOStreams{In: os.Stdin, Out: os.Stdout, ErrOut: os.Stderr}
|
||||
o := &serverlib.AppfileOptions{
|
||||
o := &common.AppfileOptions{
|
||||
Kubecli: s.KubeClient,
|
||||
IO: ioStream,
|
||||
Env: env,
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
package server
|
||||
package apiserver
|
||||
|
||||
import (
|
||||
"github.com/oam-dev/kubevela/pkg/plugins"
|
||||
"github.com/oam-dev/kubevela/pkg/server/util"
|
||||
"github.com/oam-dev/kubevela/pkg/serverlib"
|
||||
"github.com/oam-dev/kubevela/references/apiserver/util"
|
||||
"github.com/oam-dev/kubevela/references/common"
|
||||
"github.com/oam-dev/kubevela/references/plugins"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
|
@ -15,7 +15,7 @@ func (s *APIServer) AddCapabilityCenter(c *gin.Context) {
|
|||
util.HandleError(c, util.StatusInternalServerError, "the add capability center request body is invalid")
|
||||
return
|
||||
}
|
||||
if err := serverlib.AddCapabilityCenter(body.Name, body.Address, body.Token); err != nil {
|
||||
if err := common.AddCapabilityCenter(body.Name, body.Address, body.Token); err != nil {
|
||||
util.HandleError(c, util.StatusInternalServerError, err.Error())
|
||||
return
|
||||
}
|
||||
|
|
@ -24,7 +24,7 @@ func (s *APIServer) AddCapabilityCenter(c *gin.Context) {
|
|||
|
||||
// ListCapabilityCenters list all added capability centers
|
||||
func (s *APIServer) ListCapabilityCenters(c *gin.Context) {
|
||||
capabilityCenterList, err := serverlib.ListCapabilityCenters()
|
||||
capabilityCenterList, err := common.ListCapabilityCenters()
|
||||
if err != nil {
|
||||
util.HandleError(c, util.StatusInternalServerError, err.Error())
|
||||
return
|
||||
|
|
@ -35,7 +35,7 @@ func (s *APIServer) ListCapabilityCenters(c *gin.Context) {
|
|||
// SyncCapabilityCenter synchronizes capability center from remote
|
||||
func (s *APIServer) SyncCapabilityCenter(c *gin.Context) {
|
||||
capabilityCenterName := c.Param("capabilityCenterName")
|
||||
if err := serverlib.SyncCapabilityCenter(capabilityCenterName); err != nil {
|
||||
if err := common.SyncCapabilityCenter(capabilityCenterName); err != nil {
|
||||
util.HandleError(c, util.StatusInternalServerError, err.Error())
|
||||
return
|
||||
}
|
||||
|
|
@ -45,7 +45,7 @@ func (s *APIServer) SyncCapabilityCenter(c *gin.Context) {
|
|||
// AddCapabilityIntoCluster adds specific capability into cluster
|
||||
func (s *APIServer) AddCapabilityIntoCluster(c *gin.Context) {
|
||||
cap := c.Param("capabilityCenterName") + "/" + c.Param("capabilityName")
|
||||
msg, err := serverlib.AddCapabilityIntoCluster(s.KubeClient, s.dm, cap)
|
||||
msg, err := common.AddCapabilityIntoCluster(s.KubeClient, s.dm, cap)
|
||||
if err != nil {
|
||||
util.HandleError(c, util.StatusInternalServerError)
|
||||
return
|
||||
|
|
@ -56,14 +56,14 @@ func (s *APIServer) AddCapabilityIntoCluster(c *gin.Context) {
|
|||
// DeleteCapabilityCenter deltes a capability cernter already added
|
||||
func (s *APIServer) DeleteCapabilityCenter(c *gin.Context) {
|
||||
capabilityCenterName := c.Param("capabilityCenterName")
|
||||
msg, err := serverlib.RemoveCapabilityCenter(capabilityCenterName)
|
||||
msg, err := common.RemoveCapabilityCenter(capabilityCenterName)
|
||||
util.AssembleResponse(c, msg, err)
|
||||
}
|
||||
|
||||
// RemoveCapabilityFromCluster remove a specific capability from cluster
|
||||
func (s *APIServer) RemoveCapabilityFromCluster(c *gin.Context) {
|
||||
capabilityCenterName := c.Param("capabilityName")
|
||||
msg, err := serverlib.RemoveCapabilityFromCluster(s.KubeClient, capabilityCenterName)
|
||||
msg, err := common.RemoveCapabilityFromCluster(s.KubeClient, capabilityCenterName)
|
||||
if err != nil {
|
||||
util.HandleError(c, util.StatusInternalServerError, err.Error())
|
||||
return
|
||||
|
|
@ -74,7 +74,7 @@ func (s *APIServer) RemoveCapabilityFromCluster(c *gin.Context) {
|
|||
// ListCapabilities lists capabilities of a capability center
|
||||
func (s *APIServer) ListCapabilities(c *gin.Context) {
|
||||
capabilityCenterName := c.Param("capabilityName")
|
||||
capabilityList, err := serverlib.ListCapabilities(capabilityCenterName)
|
||||
capabilityList, err := common.ListCapabilities(capabilityCenterName)
|
||||
if err != nil {
|
||||
util.HandleError(c, util.StatusInternalServerError, err.Error())
|
||||
return
|
||||
|
|
@ -1,14 +1,14 @@
|
|||
package server
|
||||
package apiserver
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
cmdutil "github.com/oam-dev/kubevela/pkg/commands/util"
|
||||
"github.com/oam-dev/kubevela/pkg/server/util"
|
||||
"github.com/oam-dev/kubevela/pkg/serverlib"
|
||||
"github.com/oam-dev/kubevela/pkg/utils/env"
|
||||
cmdutil "github.com/oam-dev/kubevela/pkg/utils/util"
|
||||
"github.com/oam-dev/kubevela/references/apiserver/util"
|
||||
"github.com/oam-dev/kubevela/references/common"
|
||||
)
|
||||
|
||||
// GetComponent gets a comoponent from cluster
|
||||
|
|
@ -23,7 +23,7 @@ func (s *APIServer) GetComponent(c *gin.Context) {
|
|||
applicationName := c.Param("appName")
|
||||
componentName := c.Param("compName")
|
||||
ctx := util.GetContext(c)
|
||||
componentMeta, err := serverlib.RetrieveComponent(ctx, s.KubeClient, applicationName, componentName, namespace)
|
||||
componentMeta, err := common.RetrieveComponent(ctx, s.KubeClient, applicationName, componentName, namespace)
|
||||
if err != nil {
|
||||
util.HandleError(c, util.StatusInternalServerError, err)
|
||||
return
|
||||
|
|
@ -42,7 +42,7 @@ func (s *APIServer) DeleteComponent(c *gin.Context) {
|
|||
appName := c.Param("appName")
|
||||
componentName := c.Param("compName")
|
||||
|
||||
o := serverlib.DeleteOptions{
|
||||
o := common.DeleteOptions{
|
||||
Client: s.KubeClient,
|
||||
Env: envMeta,
|
||||
AppName: appName,
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
package server
|
||||
package apiserver
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
"github.com/oam-dev/kubevela/pkg/server/util"
|
||||
"github.com/oam-dev/kubevela/pkg/serverlib"
|
||||
"github.com/oam-dev/kubevela/references/apiserver/util"
|
||||
"github.com/oam-dev/kubevela/references/common"
|
||||
)
|
||||
|
||||
// GetDefinition gets OpenAPI schema from Cue section of a WorkloadDefinition/TraitDefinition
|
||||
|
|
@ -17,7 +17,7 @@ import (
|
|||
// @Router /definitions/{definitionName} [get]
|
||||
func (s *APIServer) GetDefinition(c *gin.Context) {
|
||||
definitionName := c.Param("name")
|
||||
parameter, err := serverlib.GetDefinition(definitionName)
|
||||
parameter, err := common.GetDefinition(definitionName)
|
||||
if err != nil {
|
||||
util.HandleError(c, util.StatusInternalServerError, err)
|
||||
return
|
||||
|
|
@ -1,13 +1,13 @@
|
|||
package server
|
||||
package apiserver
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
ctrl "sigs.k8s.io/controller-runtime"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/types"
|
||||
"github.com/oam-dev/kubevela/pkg/server/apis"
|
||||
"github.com/oam-dev/kubevela/pkg/server/util"
|
||||
"github.com/oam-dev/kubevela/pkg/utils/env"
|
||||
"github.com/oam-dev/kubevela/references/apiserver/apis"
|
||||
"github.com/oam-dev/kubevela/references/apiserver/util"
|
||||
)
|
||||
|
||||
// CreateEnv creates an environment
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
package server
|
||||
package apiserver
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
"github.com/oam-dev/kubevela/pkg/server/apis"
|
||||
"github.com/oam-dev/kubevela/references/apiserver/apis"
|
||||
"github.com/oam-dev/kubevela/version"
|
||||
)
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package server
|
||||
package apiserver
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
|
@ -12,8 +12,8 @@ import (
|
|||
"github.com/gin-gonic/gin"
|
||||
|
||||
// swagger json data
|
||||
_ "github.com/oam-dev/kubevela/pkg/server/docs"
|
||||
"github.com/oam-dev/kubevela/pkg/server/util"
|
||||
_ "github.com/oam-dev/kubevela/references/apiserver/docs"
|
||||
"github.com/oam-dev/kubevela/references/apiserver/util"
|
||||
)
|
||||
|
||||
// setupRoute sets gin http server handler
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package server
|
||||
package apiserver
|
||||
|
||||
import "github.com/gin-gonic/gin"
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package server
|
||||
package apiserver
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package server
|
||||
package apiserver
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
|
@ -10,13 +10,13 @@ import (
|
|||
ctrl "sigs.k8s.io/controller-runtime"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/types"
|
||||
"github.com/oam-dev/kubevela/pkg/appfile/api"
|
||||
util2 "github.com/oam-dev/kubevela/pkg/commands/util"
|
||||
"github.com/oam-dev/kubevela/pkg/plugins"
|
||||
"github.com/oam-dev/kubevela/pkg/server/apis"
|
||||
"github.com/oam-dev/kubevela/pkg/server/util"
|
||||
"github.com/oam-dev/kubevela/pkg/serverlib"
|
||||
env2 "github.com/oam-dev/kubevela/pkg/utils/env"
|
||||
util2 "github.com/oam-dev/kubevela/pkg/utils/util"
|
||||
"github.com/oam-dev/kubevela/references/apiserver/apis"
|
||||
"github.com/oam-dev/kubevela/references/apiserver/util"
|
||||
"github.com/oam-dev/kubevela/references/appfile/api"
|
||||
"github.com/oam-dev/kubevela/references/common"
|
||||
"github.com/oam-dev/kubevela/references/plugins"
|
||||
)
|
||||
|
||||
// AttachTrait attaches a trait to a component
|
||||
|
|
@ -46,7 +46,7 @@ func (s *APIServer) GetTrait(c *gin.Context) {
|
|||
var capability types.Capability
|
||||
var err error
|
||||
|
||||
if capability, err = serverlib.GetTraitDefinition(&workloadType, traitType); err != nil {
|
||||
if capability, err = common.GetTraitDefinition(&workloadType, traitType); err != nil {
|
||||
util.HandleError(c, util.StatusInternalServerError, err)
|
||||
return
|
||||
}
|
||||
|
|
@ -58,7 +58,7 @@ func (s *APIServer) ListTrait(c *gin.Context) {
|
|||
var traitList []types.Capability
|
||||
var workloadName string
|
||||
var err error
|
||||
if traitList, err = serverlib.ListTraitDefinitions(&workloadName); err != nil {
|
||||
if traitList, err = common.ListTraitDefinitions(&workloadName); err != nil {
|
||||
util.HandleError(c, util.StatusInternalServerError, err)
|
||||
return
|
||||
}
|
||||
|
|
@ -115,12 +115,12 @@ func (s *APIServer) DoAttachTrait(c context.Context, body apis.TraitBody) (strin
|
|||
return "", err
|
||||
}
|
||||
|
||||
appObj, err = serverlib.AddOrUpdateTrait(env, body.AppName, body.ComponentName, fs, template)
|
||||
appObj, err = common.AddOrUpdateTrait(env, body.AppName, body.ComponentName, fs, template)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
io := util2.IOStreams{In: os.Stdin, Out: os.Stdout, ErrOut: os.Stderr}
|
||||
return serverlib.TraitOperationRun(c, s.KubeClient, env, appObj, staging, io)
|
||||
return common.TraitOperationRun(c, s.KubeClient, env, appObj, staging, io)
|
||||
}
|
||||
|
||||
// DoDetachTrait executes detaching trait operation
|
||||
|
|
@ -130,7 +130,7 @@ func (s *APIServer) DoDetachTrait(c context.Context, envName string, traitType s
|
|||
if appName == "" {
|
||||
appName = componentName
|
||||
}
|
||||
if appObj, err = serverlib.PrepareDetachTrait(envName, traitType, componentName, appName); err != nil {
|
||||
if appObj, err = common.PrepareDetachTrait(envName, traitType, componentName, appName); err != nil {
|
||||
return "", err
|
||||
}
|
||||
// Run
|
||||
|
|
@ -139,5 +139,5 @@ func (s *APIServer) DoDetachTrait(c context.Context, envName string, traitType s
|
|||
return "", err
|
||||
}
|
||||
io := util2.IOStreams{In: os.Stdin, Out: os.Stdout, ErrOut: os.Stderr}
|
||||
return serverlib.TraitOperationRun(c, s.KubeClient, env, appObj, staging, io)
|
||||
return common.TraitOperationRun(c, s.KubeClient, env, appObj, staging, io)
|
||||
}
|
||||
|
|
@ -6,7 +6,7 @@ import (
|
|||
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
"github.com/oam-dev/kubevela/pkg/server/apis"
|
||||
"github.com/oam-dev/kubevela/references/apiserver/apis"
|
||||
)
|
||||
|
||||
// DefaultDashboardPort refers to the default port number of dashboard
|
||||
|
|
@ -1,12 +1,12 @@
|
|||
package server
|
||||
package apiserver
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/types"
|
||||
"github.com/oam-dev/kubevela/pkg/plugins"
|
||||
"github.com/oam-dev/kubevela/pkg/server/apis"
|
||||
"github.com/oam-dev/kubevela/pkg/server/util"
|
||||
"github.com/oam-dev/kubevela/references/apiserver/apis"
|
||||
"github.com/oam-dev/kubevela/references/apiserver/util"
|
||||
"github.com/oam-dev/kubevela/references/plugins"
|
||||
)
|
||||
|
||||
// UpdateWorkload updates a workload
|
||||
|
|
@ -16,9 +16,10 @@ import (
|
|||
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/v1alpha2"
|
||||
"github.com/oam-dev/kubevela/apis/types"
|
||||
"github.com/oam-dev/kubevela/pkg/commands/util"
|
||||
"github.com/oam-dev/kubevela/pkg/appfile"
|
||||
"github.com/oam-dev/kubevela/pkg/oam/discoverymapper"
|
||||
"github.com/oam-dev/kubevela/pkg/utils/common"
|
||||
"github.com/oam-dev/kubevela/pkg/utils/util"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
@ -33,7 +34,7 @@ func ApplyTerraform(app *v1alpha2.Application, k8sClient client.Client, ioStream
|
|||
// TODO(zzxwill) Need to check whether authentication credentials of a specific cloud provider are exported as environment variables, like `ALICLOUD_ACCESS_KEY`
|
||||
var nativeVelaComponents []v1alpha2.ApplicationComponent
|
||||
// parse template
|
||||
appParser := NewApplicationParser(k8sClient, dm)
|
||||
appParser := appfile.NewApplicationParser(k8sClient, dm)
|
||||
appFile, err := appParser.GenerateAppFile(app.Name, app)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to parse appfile: %w", err)
|
||||
|
|
@ -166,8 +167,8 @@ func generateSecretFromTerraformOutput(k8sClient client.Client, outputList []str
|
|||
}
|
||||
|
||||
// getTerraformJSONFiles gets Terraform JSON files or modules from workload
|
||||
func getTerraformJSONFiles(k8sClient client.Client, wl *Workload, applicationName string, namespace string) ([]byte, error) {
|
||||
pCtx, err := PrepareProcessContext(k8sClient, wl, applicationName, namespace)
|
||||
func getTerraformJSONFiles(k8sClient client.Client, wl *appfile.Workload, applicationName string, namespace string) ([]byte, error) {
|
||||
pCtx, err := appfile.PrepareProcessContext(k8sClient, wl, applicationName, namespace)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -10,8 +10,8 @@ import (
|
|||
"k8s.io/apimachinery/pkg/runtime"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/v1alpha2"
|
||||
"github.com/oam-dev/kubevela/pkg/commands/util"
|
||||
"github.com/oam-dev/kubevela/pkg/oam/discoverymapper"
|
||||
"github.com/oam-dev/kubevela/pkg/utils/util"
|
||||
)
|
||||
|
||||
var _ = It("Test ApplyTerraform", func() {
|
||||
|
|
@ -16,10 +16,10 @@ import (
|
|||
"github.com/oam-dev/kubevela/apis/core.oam.dev/v1alpha2"
|
||||
"github.com/oam-dev/kubevela/apis/types"
|
||||
"github.com/oam-dev/kubevela/pkg/appfile/config"
|
||||
"github.com/oam-dev/kubevela/pkg/appfile/template"
|
||||
"github.com/oam-dev/kubevela/pkg/builtin"
|
||||
cmdutil "github.com/oam-dev/kubevela/pkg/commands/util"
|
||||
"github.com/oam-dev/kubevela/pkg/oam"
|
||||
cmdutil "github.com/oam-dev/kubevela/pkg/utils/util"
|
||||
"github.com/oam-dev/kubevela/references/appfile/template"
|
||||
)
|
||||
|
||||
// error msg used in Appfile
|
||||
|
|
@ -14,10 +14,10 @@ import (
|
|||
"github.com/oam-dev/kubevela/apis/core.oam.dev/v1alpha2"
|
||||
"github.com/oam-dev/kubevela/apis/types"
|
||||
"github.com/oam-dev/kubevela/pkg/appfile/config"
|
||||
"github.com/oam-dev/kubevela/pkg/appfile/template"
|
||||
cmdutil "github.com/oam-dev/kubevela/pkg/commands/util"
|
||||
"github.com/oam-dev/kubevela/pkg/oam"
|
||||
"github.com/oam-dev/kubevela/pkg/oam/util"
|
||||
cmdutil "github.com/oam-dev/kubevela/pkg/utils/util"
|
||||
"github.com/oam-dev/kubevela/references/appfile/template"
|
||||
)
|
||||
|
||||
func TestBuildOAMApplication2(t *testing.T) {
|
||||
|
|
@ -17,7 +17,7 @@ limitations under the License.
|
|||
package api
|
||||
|
||||
import (
|
||||
"github.com/oam-dev/kubevela/pkg/appfile/template"
|
||||
"github.com/oam-dev/kubevela/references/appfile/template"
|
||||
)
|
||||
|
||||
// Application is an implementation level object for Appfile, all vela commands will access AppFile from Appliction struct here.
|
||||
|
|
@ -6,7 +6,7 @@ import (
|
|||
"k8s.io/apimachinery/pkg/runtime"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/v1alpha2"
|
||||
"github.com/oam-dev/kubevela/pkg/appfile/template"
|
||||
"github.com/oam-dev/kubevela/references/appfile/template"
|
||||
)
|
||||
|
||||
// Service defines the service spec for AppFile, it will contain all related information including OAM component, traits, source to image, etc...
|
||||
|
|
@ -11,8 +11,8 @@ import (
|
|||
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/v1alpha2"
|
||||
"github.com/oam-dev/kubevela/apis/types"
|
||||
"github.com/oam-dev/kubevela/pkg/appfile/api"
|
||||
"github.com/oam-dev/kubevela/pkg/appfile/template"
|
||||
"github.com/oam-dev/kubevela/references/appfile/api"
|
||||
"github.com/oam-dev/kubevela/references/appfile/template"
|
||||
)
|
||||
|
||||
// NewEmptyApplication new empty application, only set tm
|
||||
|
|
@ -10,7 +10,7 @@ import (
|
|||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/types"
|
||||
"github.com/oam-dev/kubevela/pkg/appfile/template"
|
||||
"github.com/oam-dev/kubevela/references/appfile/template"
|
||||
)
|
||||
|
||||
func TestApplication(t *testing.T) {
|
||||
|
|
@ -3,7 +3,7 @@ package driver
|
|||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/oam-dev/kubevela/pkg/appfile/api"
|
||||
"github.com/oam-dev/kubevela/references/appfile/api"
|
||||
)
|
||||
|
||||
// ConfigMapDriverName is local storage driver name
|
||||
|
|
@ -4,7 +4,7 @@ import (
|
|||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/oam-dev/kubevela/pkg/appfile/api"
|
||||
"github.com/oam-dev/kubevela/references/appfile/api"
|
||||
)
|
||||
|
||||
func TestConfigMap_Delete(t *testing.T) {
|
||||
|
|
@ -10,10 +10,10 @@ import (
|
|||
|
||||
"github.com/ghodss/yaml"
|
||||
|
||||
"github.com/oam-dev/kubevela/pkg/appfile/api"
|
||||
"github.com/oam-dev/kubevela/pkg/appfile/template"
|
||||
"github.com/oam-dev/kubevela/pkg/utils/env"
|
||||
"github.com/oam-dev/kubevela/pkg/utils/system"
|
||||
"github.com/oam-dev/kubevela/references/appfile/api"
|
||||
"github.com/oam-dev/kubevela/references/appfile/template"
|
||||
)
|
||||
|
||||
// LocalDriverName is local storage driver name
|
||||
|
|
@ -9,8 +9,8 @@ import (
|
|||
|
||||
"github.com/ghodss/yaml"
|
||||
|
||||
"github.com/oam-dev/kubevela/pkg/appfile/api"
|
||||
"github.com/oam-dev/kubevela/pkg/appfile/template"
|
||||
"github.com/oam-dev/kubevela/references/appfile/api"
|
||||
"github.com/oam-dev/kubevela/references/appfile/template"
|
||||
)
|
||||
|
||||
var dir string
|
||||
|
|
@ -3,7 +3,7 @@ package appfile
|
|||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/oam-dev/kubevela/pkg/appfile/api"
|
||||
"github.com/oam-dev/kubevela/references/appfile/api"
|
||||
)
|
||||
|
||||
// SetWorkload will set user workload for Appfile
|
||||
|
|
@ -9,22 +9,9 @@ import (
|
|||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/v1alpha2"
|
||||
"github.com/oam-dev/kubevela/apis/types"
|
||||
"github.com/oam-dev/kubevela/pkg/appfile/api"
|
||||
cmdutil "github.com/oam-dev/kubevela/pkg/commands/util"
|
||||
"github.com/oam-dev/kubevela/pkg/oam"
|
||||
)
|
||||
|
||||
// BuildRun will build application and deploy from Appfile
|
||||
func BuildRun(ctx context.Context, app *api.Application, client client.Client, env *types.EnvMeta, io cmdutil.IOStreams) error {
|
||||
o, scopes, err := app.BuildOAMApplication(env, io, app.Tm, true)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return Run(ctx, client, o, scopes)
|
||||
}
|
||||
|
||||
// Run will deploy OAM objects and other assistant K8s Objects including ConfigMap, OAM Scope Custom Resource.
|
||||
func Run(ctx context.Context, client client.Client, app *v1alpha2.Application, assistantObjects []oam.Object) error {
|
||||
if err := CreateOrUpdateObjects(ctx, client, assistantObjects); err != nil {
|
||||
|
|
@ -3,9 +3,9 @@ package appfile
|
|||
import (
|
||||
"os"
|
||||
|
||||
"github.com/oam-dev/kubevela/pkg/appfile/api"
|
||||
"github.com/oam-dev/kubevela/pkg/appfile/driver"
|
||||
"github.com/oam-dev/kubevela/pkg/utils/system"
|
||||
"github.com/oam-dev/kubevela/references/appfile/api"
|
||||
"github.com/oam-dev/kubevela/references/appfile/driver"
|
||||
)
|
||||
|
||||
// Store application store client
|
||||
|
|
@ -4,8 +4,8 @@ import (
|
|||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/oam-dev/kubevela/pkg/appfile/driver"
|
||||
"github.com/oam-dev/kubevela/pkg/utils/system"
|
||||
"github.com/oam-dev/kubevela/references/appfile/driver"
|
||||
)
|
||||
|
||||
func TestGetStorage(t *testing.T) {
|
||||
|
|
@ -2,7 +2,7 @@ package template
|
|||
|
||||
import (
|
||||
"github.com/oam-dev/kubevela/apis/types"
|
||||
"github.com/oam-dev/kubevela/pkg/plugins"
|
||||
"github.com/oam-dev/kubevela/references/plugins"
|
||||
)
|
||||
|
||||
// Manager defines a manager for template
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package commands
|
||||
package cli
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
|
@ -9,9 +9,9 @@ import (
|
|||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/types"
|
||||
cmdutil "github.com/oam-dev/kubevela/pkg/commands/util"
|
||||
"github.com/oam-dev/kubevela/pkg/oam/discoverymapper"
|
||||
"github.com/oam-dev/kubevela/pkg/serverlib"
|
||||
cmdutil "github.com/oam-dev/kubevela/pkg/utils/util"
|
||||
"github.com/oam-dev/kubevela/references/common"
|
||||
)
|
||||
|
||||
// CapabilityCommandGroup commands for capability center
|
||||
|
|
@ -67,7 +67,7 @@ func NewCapCenterConfigCommand(ioStreams cmdutil.IOStreams) *cobra.Command {
|
|||
capName := args[0]
|
||||
capURL := args[1]
|
||||
token := cmd.Flag("token").Value.String()
|
||||
if err := serverlib.AddCapabilityCenter(capName, capURL, token); err != nil {
|
||||
if err := common.AddCapabilityCenter(capName, capURL, token); err != nil {
|
||||
return err
|
||||
}
|
||||
ioStreams.Infof("Successfully configured capability center %s and sync from remote\n", capName)
|
||||
|
|
@ -102,7 +102,7 @@ func NewCapInstallCommand(c types.Args, ioStreams cmdutil.IOStreams) *cobra.Comm
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if _, err = serverlib.AddCapabilityIntoCluster(newClient, mapper, args[0]); err != nil {
|
||||
if _, err = common.AddCapabilityIntoCluster(newClient, mapper, args[0]); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
|
|
@ -138,7 +138,7 @@ func NewCapUninstallCommand(c types.Args, ioStreams cmdutil.IOStreams) *cobra.Co
|
|||
}
|
||||
name = l[1]
|
||||
}
|
||||
return serverlib.RemoveCapability(newClient, name, ioStreams)
|
||||
return common.RemoveCapability(newClient, name, ioStreams)
|
||||
},
|
||||
}
|
||||
cmd.PersistentFlags().StringP("token", "t", "", "Github Repo token")
|
||||
|
|
@ -157,7 +157,7 @@ func NewCapCenterSyncCommand(ioStreams cmdutil.IOStreams) *cobra.Command {
|
|||
if len(args) > 0 {
|
||||
specified = args[0]
|
||||
}
|
||||
if err := serverlib.SyncCapabilityCenter(specified); err != nil {
|
||||
if err := common.SyncCapabilityCenter(specified); err != nil {
|
||||
return err
|
||||
}
|
||||
ioStreams.Info("sync finished")
|
||||
|
|
@ -179,7 +179,7 @@ func NewCapListCommand(ioStreams cmdutil.IOStreams) *cobra.Command {
|
|||
if len(args) > 0 {
|
||||
repoName = args[0]
|
||||
}
|
||||
capabilityList, err := serverlib.ListCapabilities(repoName)
|
||||
capabilityList, err := common.ListCapabilities(repoName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
@ -228,7 +228,7 @@ func listCapCenters(ioStreams cmdutil.IOStreams) error {
|
|||
table := newUITable()
|
||||
table.MaxColWidth = 80
|
||||
table.AddRow("NAME", "ADDRESS")
|
||||
capabilityCenterList, err := serverlib.ListCapabilityCenters()
|
||||
capabilityCenterList, err := common.ListCapabilityCenters()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
@ -244,7 +244,7 @@ func removeCapCenter(args []string, ioStreams cmdutil.IOStreams) error {
|
|||
return errors.New("you must specify <name> for capability center you want to remove")
|
||||
}
|
||||
centerName := args[0]
|
||||
msg, err := serverlib.RemoveCapabilityCenter(centerName)
|
||||
msg, err := common.RemoveCapabilityCenter(centerName)
|
||||
if err == nil {
|
||||
ioStreams.Info(msg)
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package commands
|
||||
package cli
|
||||
|
||||
import (
|
||||
"flag"
|
||||
|
|
@ -10,10 +10,10 @@ import (
|
|||
"k8s.io/klog"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/types"
|
||||
"github.com/oam-dev/kubevela/cmd/vela/fake"
|
||||
"github.com/oam-dev/kubevela/pkg/commands/util"
|
||||
"github.com/oam-dev/kubevela/pkg/utils/common"
|
||||
"github.com/oam-dev/kubevela/pkg/utils/system"
|
||||
"github.com/oam-dev/kubevela/pkg/utils/util"
|
||||
"github.com/oam-dev/kubevela/references/cmd/cli/fake"
|
||||
"github.com/oam-dev/kubevela/version"
|
||||
)
|
||||
|
||||
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
package commands
|
||||
package cli
|
||||
|
||||
// constants used in `svc` command
|
||||
const (
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package commands
|
||||
package cli
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package commands
|
||||
package cli
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
|
|
@ -11,8 +11,8 @@ import (
|
|||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/types"
|
||||
cmdutil "github.com/oam-dev/kubevela/pkg/commands/util"
|
||||
"github.com/oam-dev/kubevela/pkg/utils/config"
|
||||
cmdutil "github.com/oam-dev/kubevela/pkg/utils/util"
|
||||
)
|
||||
|
||||
// Notes about config dir layout:
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package commands
|
||||
package cli
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
|
|
@ -8,8 +8,8 @@ import (
|
|||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
cmdutil "github.com/oam-dev/kubevela/pkg/commands/util"
|
||||
"github.com/oam-dev/kubevela/pkg/utils/system"
|
||||
cmdutil "github.com/oam-dev/kubevela/pkg/utils/util"
|
||||
)
|
||||
|
||||
func TestConfigCommand(t *testing.T) {
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package commands
|
||||
package cli
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
|
@ -24,11 +24,11 @@ import (
|
|||
"sigs.k8s.io/controller-runtime/pkg/log/zap"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/types"
|
||||
cmdutil "github.com/oam-dev/kubevela/pkg/commands/util"
|
||||
"github.com/oam-dev/kubevela/pkg/server"
|
||||
"github.com/oam-dev/kubevela/pkg/server/util"
|
||||
"github.com/oam-dev/kubevela/pkg/utils/helm"
|
||||
"github.com/oam-dev/kubevela/pkg/utils/system"
|
||||
cmdutil "github.com/oam-dev/kubevela/pkg/utils/util"
|
||||
"github.com/oam-dev/kubevela/references/apiserver"
|
||||
"github.com/oam-dev/kubevela/references/apiserver/util"
|
||||
)
|
||||
|
||||
// NewDashboardCommand creates `dashboard` command and its nested children commands
|
||||
|
|
@ -170,7 +170,7 @@ func SetupAPIServer(c types.Args, cmd *cobra.Command, o Options) error {
|
|||
}
|
||||
|
||||
// Setup RESTful server
|
||||
server, err := server.New(c, o.port, o.staticPath)
|
||||
server, err := apiserver.New(c, o.port, o.staticPath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package commands
|
||||
package cli
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
|
@ -8,8 +8,8 @@ import (
|
|||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/types"
|
||||
cmdutil "github.com/oam-dev/kubevela/pkg/commands/util"
|
||||
"github.com/oam-dev/kubevela/pkg/serverlib"
|
||||
cmdutil "github.com/oam-dev/kubevela/pkg/utils/util"
|
||||
"github.com/oam-dev/kubevela/references/common"
|
||||
)
|
||||
|
||||
// NewDeleteCommand Delete App
|
||||
|
|
@ -34,7 +34,7 @@ func NewDeleteCommand(c types.Args, ioStreams cmdutil.IOStreams) *cobra.Command
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
o := &serverlib.DeleteOptions{}
|
||||
o := &common.DeleteOptions{}
|
||||
o.Client = newClient
|
||||
o.Env, err = GetEnv(cmd)
|
||||
if err != nil {
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package commands
|
||||
package cli
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
|
@ -13,8 +13,8 @@ import (
|
|||
corev1alpha2 "github.com/oam-dev/kubevela/apis/core.oam.dev/v1alpha2"
|
||||
"github.com/oam-dev/kubevela/apis/types"
|
||||
"github.com/oam-dev/kubevela/pkg/appfile"
|
||||
cmdutil "github.com/oam-dev/kubevela/pkg/commands/util"
|
||||
"github.com/oam-dev/kubevela/pkg/oam/discoverymapper"
|
||||
cmdutil "github.com/oam-dev/kubevela/pkg/utils/util"
|
||||
)
|
||||
|
||||
type dryRunOptions struct {
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package commands
|
||||
package cli
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
|
@ -9,9 +9,9 @@ import (
|
|||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/types"
|
||||
cmdutil "github.com/oam-dev/kubevela/pkg/commands/util"
|
||||
"github.com/oam-dev/kubevela/pkg/utils/env"
|
||||
"github.com/oam-dev/kubevela/pkg/utils/system"
|
||||
cmdutil "github.com/oam-dev/kubevela/pkg/utils/util"
|
||||
)
|
||||
|
||||
// NewEnvCommand creates `env` command and its nested children
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package commands
|
||||
package cli
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
|
|
@ -12,9 +12,9 @@ import (
|
|||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/types"
|
||||
cmdutil "github.com/oam-dev/kubevela/pkg/commands/util"
|
||||
"github.com/oam-dev/kubevela/pkg/utils/env"
|
||||
"github.com/oam-dev/kubevela/pkg/utils/system"
|
||||
cmdutil "github.com/oam-dev/kubevela/pkg/utils/util"
|
||||
)
|
||||
|
||||
func TestENV(t *testing.T) {
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package commands
|
||||
package cli
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
|
@ -15,11 +15,11 @@ import (
|
|||
k8scmdutil "k8s.io/kubectl/pkg/cmd/util"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/types"
|
||||
"github.com/oam-dev/kubevela/pkg/appfile"
|
||||
"github.com/oam-dev/kubevela/pkg/appfile/api"
|
||||
"github.com/oam-dev/kubevela/pkg/commands/util"
|
||||
"github.com/oam-dev/kubevela/pkg/oam"
|
||||
"github.com/oam-dev/kubevela/pkg/utils/common"
|
||||
"github.com/oam-dev/kubevela/pkg/utils/util"
|
||||
"github.com/oam-dev/kubevela/references/appfile"
|
||||
"github.com/oam-dev/kubevela/references/appfile/api"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package commands
|
||||
package cli
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
|
@ -6,7 +6,7 @@ import (
|
|||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/oam-dev/kubevela/pkg/appfile/api"
|
||||
"github.com/oam-dev/kubevela/references/appfile/api"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
|
@ -19,8 +19,8 @@ import (
|
|||
k8scmdutil "k8s.io/kubectl/pkg/cmd/util"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/types"
|
||||
cmdutil "github.com/oam-dev/kubevela/pkg/commands/util"
|
||||
"github.com/oam-dev/kubevela/pkg/oam"
|
||||
cmdutil "github.com/oam-dev/kubevela/pkg/utils/util"
|
||||
)
|
||||
|
||||
func TestExecCommand(t *testing.T) {
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
package commands
|
||||
package cli
|
||||
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/types"
|
||||
cmdutil "github.com/oam-dev/kubevela/pkg/commands/util"
|
||||
"github.com/oam-dev/kubevela/pkg/serverlib"
|
||||
cmdutil "github.com/oam-dev/kubevela/pkg/utils/util"
|
||||
"github.com/oam-dev/kubevela/references/common"
|
||||
)
|
||||
|
||||
// NewExportCommand will create command for exporting deploy manifests from an AppFile
|
||||
|
|
@ -19,7 +19,7 @@ func NewExportCommand(c types.Args, ioStream cmdutil.IOStreams) *cobra.Command {
|
|||
types.TagCommandType: types.TypeStart,
|
||||
},
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
o := &serverlib.AppfileOptions{
|
||||
o := &common.AppfileOptions{
|
||||
IO: ioStream,
|
||||
Env: &types.EnvMeta{},
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package commands
|
||||
package cli
|
||||
|
||||
import (
|
||||
"github.com/oam-dev/kubevela/apis/types"
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package commands
|
||||
package cli
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
|
@ -16,12 +16,12 @@ import (
|
|||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/types"
|
||||
"github.com/oam-dev/kubevela/pkg/appfile"
|
||||
"github.com/oam-dev/kubevela/pkg/appfile/api"
|
||||
cmdutil "github.com/oam-dev/kubevela/pkg/commands/util"
|
||||
"github.com/oam-dev/kubevela/pkg/plugins"
|
||||
"github.com/oam-dev/kubevela/pkg/serverlib"
|
||||
"github.com/oam-dev/kubevela/pkg/utils/env"
|
||||
cmdutil "github.com/oam-dev/kubevela/pkg/utils/util"
|
||||
"github.com/oam-dev/kubevela/references/appfile"
|
||||
"github.com/oam-dev/kubevela/references/appfile/api"
|
||||
"github.com/oam-dev/kubevela/references/common"
|
||||
"github.com/oam-dev/kubevela/references/plugins"
|
||||
)
|
||||
|
||||
type appInitOptions struct {
|
||||
|
|
@ -92,7 +92,7 @@ func NewInitCommand(c types.Args, ioStreams cmdutil.IOStreams) *cobra.Command {
|
|||
}
|
||||
|
||||
ctx := context.Background()
|
||||
err = appfile.BuildRun(ctx, o.app, o.client, o.Env, o.IOStreams)
|
||||
err = common.BuildRun(ctx, o.app, o.client, o.Env, o.IOStreams)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
@ -306,7 +306,7 @@ func (o *appInitOptions) Workload() error {
|
|||
// other type not supported
|
||||
}
|
||||
}
|
||||
o.app, err = serverlib.BaseComplete(o.Env.Name, o.workloadName, o.appName, fs, o.workloadType)
|
||||
o.app, err = common.BaseComplete(o.Env.Name, o.workloadName, o.appName, fs, o.workloadType)
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
@ -343,7 +343,7 @@ func (o *appInitOptions) Traits() error {
|
|||
types.SetFlagBy(tflags, pa)
|
||||
}
|
||||
// TODO(wonderflow): give a way to add parameter for trait
|
||||
o.app, err = serverlib.AddOrUpdateTrait(o.Env, o.appName, o.workloadName, tflags, trait)
|
||||
o.app, err = common.AddOrUpdateTrait(o.Env, o.appName, o.workloadName, tflags, trait)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package commands
|
||||
package cli
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
|
@ -16,10 +16,10 @@ import (
|
|||
"k8s.io/client-go/kubernetes"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/types"
|
||||
"github.com/oam-dev/kubevela/pkg/appfile"
|
||||
"github.com/oam-dev/kubevela/pkg/appfile/api"
|
||||
"github.com/oam-dev/kubevela/pkg/commands/util"
|
||||
"github.com/oam-dev/kubevela/pkg/utils/common"
|
||||
"github.com/oam-dev/kubevela/pkg/utils/util"
|
||||
"github.com/oam-dev/kubevela/references/appfile"
|
||||
"github.com/oam-dev/kubevela/references/appfile/api"
|
||||
)
|
||||
|
||||
// NewLogsCommand creates `logs` command to tail logs of application
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package commands
|
||||
package cli
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
|
@ -9,10 +9,10 @@ import (
|
|||
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/v1alpha2"
|
||||
"github.com/oam-dev/kubevela/apis/types"
|
||||
"github.com/oam-dev/kubevela/pkg/appfile"
|
||||
cmdutil "github.com/oam-dev/kubevela/pkg/commands/util"
|
||||
"github.com/oam-dev/kubevela/pkg/server/apis"
|
||||
"github.com/oam-dev/kubevela/pkg/serverlib"
|
||||
cmdutil "github.com/oam-dev/kubevela/pkg/utils/util"
|
||||
"github.com/oam-dev/kubevela/references/apiserver/apis"
|
||||
"github.com/oam-dev/kubevela/references/appfile"
|
||||
"github.com/oam-dev/kubevela/references/common"
|
||||
)
|
||||
|
||||
// NewListCommand creates `ls` command and its nested children command
|
||||
|
|
@ -54,7 +54,7 @@ func NewListCommand(c types.Args, ioStreams cmdutil.IOStreams) *cobra.Command {
|
|||
|
||||
func printComponentList(ctx context.Context, c client.Reader, appName string, env *types.EnvMeta,
|
||||
ioStreams cmdutil.IOStreams) {
|
||||
deployedComponentList, err := serverlib.ListComponents(ctx, c, serverlib.Option{
|
||||
deployedComponentList, err := common.ListComponents(ctx, c, common.Option{
|
||||
AppName: appName,
|
||||
Namespace: env.Namespace,
|
||||
})
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package commands
|
||||
package cli
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
|
@ -24,11 +24,11 @@ import (
|
|||
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/v1alpha2"
|
||||
"github.com/oam-dev/kubevela/apis/types"
|
||||
"github.com/oam-dev/kubevela/pkg/appfile"
|
||||
"github.com/oam-dev/kubevela/pkg/appfile/api"
|
||||
"github.com/oam-dev/kubevela/pkg/commands/util"
|
||||
"github.com/oam-dev/kubevela/pkg/oam"
|
||||
"github.com/oam-dev/kubevela/pkg/utils/common"
|
||||
"github.com/oam-dev/kubevela/pkg/utils/util"
|
||||
"github.com/oam-dev/kubevela/references/appfile"
|
||||
"github.com/oam-dev/kubevela/references/appfile/api"
|
||||
)
|
||||
|
||||
// VelaPortForwardOptions for vela port-forward
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package commands
|
||||
package cli
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
|
@ -15,8 +15,8 @@ import (
|
|||
cmdtesting "k8s.io/kubectl/pkg/cmd/testing"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/types"
|
||||
cmdutil "github.com/oam-dev/kubevela/pkg/commands/util"
|
||||
"github.com/oam-dev/kubevela/pkg/oam"
|
||||
cmdutil "github.com/oam-dev/kubevela/pkg/utils/util"
|
||||
)
|
||||
|
||||
func TestPortForwardCommand(t *testing.T) {
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package commands
|
||||
package cli
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package commands
|
||||
package cli
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
|
@ -14,9 +14,9 @@ import (
|
|||
"github.com/mitchellh/hashstructure/v2"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/types"
|
||||
cmdutil "github.com/oam-dev/kubevela/pkg/commands/util"
|
||||
"github.com/oam-dev/kubevela/pkg/plugins"
|
||||
"github.com/oam-dev/kubevela/pkg/utils/system"
|
||||
cmdutil "github.com/oam-dev/kubevela/pkg/utils/util"
|
||||
"github.com/oam-dev/kubevela/references/plugins"
|
||||
)
|
||||
|
||||
type refreshStatus string
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package commands
|
||||
package cli
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package commands
|
||||
package cli
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
|
@ -15,9 +15,9 @@ import (
|
|||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/types"
|
||||
cmdutil "github.com/oam-dev/kubevela/pkg/commands/util"
|
||||
"github.com/oam-dev/kubevela/pkg/plugins"
|
||||
"github.com/oam-dev/kubevela/pkg/utils/system"
|
||||
cmdutil "github.com/oam-dev/kubevela/pkg/utils/util"
|
||||
"github.com/oam-dev/kubevela/references/plugins"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package commands
|
||||
package cli
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
|
@ -12,7 +12,7 @@ import (
|
|||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/types"
|
||||
"github.com/oam-dev/kubevela/pkg/plugins"
|
||||
"github.com/oam-dev/kubevela/references/plugins"
|
||||
)
|
||||
|
||||
const BaseDir = "testdata"
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package commands
|
||||
package cli
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
|
@ -14,10 +14,10 @@ import (
|
|||
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/v1alpha2"
|
||||
"github.com/oam-dev/kubevela/apis/types"
|
||||
"github.com/oam-dev/kubevela/pkg/appfile"
|
||||
"github.com/oam-dev/kubevela/pkg/appfile/api"
|
||||
cmdutil "github.com/oam-dev/kubevela/pkg/commands/util"
|
||||
"github.com/oam-dev/kubevela/pkg/oam/util"
|
||||
cmdutil "github.com/oam-dev/kubevela/pkg/utils/util"
|
||||
"github.com/oam-dev/kubevela/references/appfile"
|
||||
"github.com/oam-dev/kubevela/references/appfile/api"
|
||||
)
|
||||
|
||||
// HealthStatus represents health status strings.
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package commands
|
||||
package cli
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
|
@ -18,9 +18,9 @@ import (
|
|||
|
||||
"github.com/oam-dev/kubevela/apis/types"
|
||||
"github.com/oam-dev/kubevela/hack/utils"
|
||||
cmdutil "github.com/oam-dev/kubevela/pkg/commands/util"
|
||||
"github.com/oam-dev/kubevela/pkg/plugins"
|
||||
"github.com/oam-dev/kubevela/pkg/utils/helm"
|
||||
cmdutil "github.com/oam-dev/kubevela/pkg/utils/util"
|
||||
"github.com/oam-dev/kubevela/references/plugins"
|
||||
)
|
||||
|
||||
// VelaRuntimeStatus enums vela-core runtime status
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
package commands
|
||||
package cli
|
||||
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/types"
|
||||
cmdutil "github.com/oam-dev/kubevela/pkg/commands/util"
|
||||
mycue "github.com/oam-dev/kubevela/pkg/cue"
|
||||
cmdutil "github.com/oam-dev/kubevela/pkg/utils/util"
|
||||
)
|
||||
|
||||
// NewTemplateCommand creates `template` command and its nested children command
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package commands
|
||||
package cli
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
|
@ -7,8 +7,8 @@ import (
|
|||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/types"
|
||||
cmdutil "github.com/oam-dev/kubevela/pkg/commands/util"
|
||||
"github.com/oam-dev/kubevela/pkg/serverlib"
|
||||
cmdutil "github.com/oam-dev/kubevela/pkg/utils/util"
|
||||
"github.com/oam-dev/kubevela/references/common"
|
||||
)
|
||||
|
||||
// NewTraitsCommand creates `traits` command
|
||||
|
|
@ -48,7 +48,7 @@ func printTraitList(workloadName *string, ioStreams cmdutil.IOStreams) error {
|
|||
table := newUITable()
|
||||
table.MaxColWidth = 120
|
||||
table.Wrap = true
|
||||
traitDefinitionList, err := serverlib.ListTraitDefinitions(workloadName)
|
||||
traitDefinitionList, err := common.ListTraitDefinitions(workloadName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package commands
|
||||
package cli
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
|
|
@ -10,8 +10,8 @@ import (
|
|||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/types"
|
||||
cmdutil "github.com/oam-dev/kubevela/pkg/commands/util"
|
||||
"github.com/oam-dev/kubevela/pkg/serverlib"
|
||||
cmdutil "github.com/oam-dev/kubevela/pkg/utils/util"
|
||||
"github.com/oam-dev/kubevela/references/common"
|
||||
)
|
||||
|
||||
func Test_printTraitList(t *testing.T) {
|
||||
|
|
@ -115,5 +115,5 @@ func TestTraitsAppliedToAllWorkloads(t *testing.T) {
|
|||
CrdName: "clonsets.alibaba",
|
||||
},
|
||||
}
|
||||
assert.Equal(t, []string{"*"}, serverlib.ConvertApplyTo(trait.AppliesTo, workloads))
|
||||
assert.Equal(t, []string{"*"}, common.ConvertApplyTo(trait.AppliesTo, workloads))
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue