Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion v1/cmd/deploy/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ import (
)

var (
bizModelVersionFlag string

portFlag int

subBundlePath string
Expand Down Expand Up @@ -80,7 +82,10 @@ Scenario 2: Deploy a local pre-built bundle to local running ark container:
Scenario 3: Build and deploy a bundle at current dir to a remote running ark container in k8s cluster with default port:
arkctl deploy --pod ${namespace}/${name}

Scenario 4: Build an maven multi module project and deploy a sub module to a running ark container:
Scenario 4: Build and deploy a bundle at current dir to a remote running ark container in k8s cluster with biz model version witch is pod key from kubernetes:
arkctl deploy --pod ${namespace}/${name} --biz-model-version ${your-biz-model-version}

Scenario 5: Build an maven multi module project and deploy a sub module to a running ark container:
arkctl deploy --sub ${path/to/your/sub/module}
`,
Args: func(cmd *cobra.Command, args []string) error {
Expand Down Expand Up @@ -183,6 +188,9 @@ func execParseBizModel(ctx *contextutil.Context) bool {
pterm.Error.PrintOnError(fmt.Errorf("failed to parse bundle: %s", err))
return false
}
if bizModelVersionFlag != "" {
bizModel.BizModelVersion = bizModelVersionFlag
}

ctx.Put(ctxKeyBizModel, bizModel)
style.InfoPrefix("BizBundleInfo").Println(string(runtime.MustReturnResult(json.Marshal(*bizModel))))
Expand Down Expand Up @@ -252,6 +260,7 @@ func execInstallInKubePod(ctx *contextutil.Context) bool {
string(runtime.MustReturnResult(json.Marshal(ark.BizModel{
BizName: bizModel.BizName,
BizVersion: bizModel.BizVersion,
BizModelVersion: bizModel.BizModelVersion,
}))),
fmt.Sprintf("http://127.0.0.1:%v/uninstallBiz", portFlag),
)
Expand Down Expand Up @@ -301,6 +310,7 @@ func execInstallInKubePod(ctx *contextutil.Context) bool {
BizName: bizModel.BizName,
BizVersion: bizModel.BizVersion,
BizUrl: fileutil.FileUrl(osutil.GetLocalFileProtocol() + ctx.Value(ctxKeyArkBizBundlePathInSidePod).(string)),
BizModelVersion: bizModel.BizModelVersion,
}))),
fmt.Sprintf("http://127.0.0.1:%v/installBiz", portFlag),
)
Expand Down Expand Up @@ -456,6 +466,9 @@ If Provided, arkctl will try to build the project at current dir and deploy the

DeployCommand.Flags().IntVar(&portFlag, "port", 1238, `
The default port of ark container is 1238 if not provided.
`)
DeployCommand.Flags().StringVar(&bizModelVersionFlag, "biz-model-version", "", `
If provided, arkctl will use this biz model version to deploy the biz module.
`)

}
3 changes: 3 additions & 0 deletions v1/cmd/undeploy/undeploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ var (
hostFlag string = "127.0.0.1"
portFlag int
bizNameAndVersion string // in the format of bizName:bizVersion
bizModelVersionFlag string // biz model version, used to identify the biz model in the pod
)

var (
Expand Down Expand Up @@ -78,6 +79,7 @@ func execUnInstallLocal(ctx *contextutil.Context) error {
BizModel: ark.BizModel{
BizName: strings.Split(bizNameAndVersion, ":")[0],
BizVersion: strings.Split(bizNameAndVersion, ":")[1],
BizModelVersion: bizModelVersionFlag,
},
}); err != nil {
pterm.Error.Printfln("uninstall %s failed: %s", bizNameAndVersion, err)
Expand Down Expand Up @@ -130,6 +132,7 @@ func execUnInstallLocalWithPrompt(ctx *contextutil.Context) error {

func init() {
UnDeployCmd.Flags().IntVar(&portFlag, "port", 1238, "the port of ark container")
UnDeployCmd.Flags().StringVar(&bizModelVersionFlag, "biz-model-version", "", "the biz model version of ark container")

root.RootCmd.AddCommand(UnDeployCmd)
}
2 changes: 1 addition & 1 deletion v1/constant/constant.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@
package constant

const (
Version = "0.2.3"
Version = "0.2.5"
)
3 changes: 3 additions & 0 deletions v1/service/ark/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ type BizModel struct {

// BizUrl is the location of source code.
BizUrl fileutil.FileUrl `json:"bizUrl,omitempty"`

// BizModelVersion is the version of this model.
BizModelVersion string `json:"bizModelVersion,omitempty"`
}

type BizInfo struct {
Expand Down
Loading