Add server flag for kompose down (#1260)

This commit is contained in:
Hang Yan 2020-03-08 18:40:29 +08:00 committed by GitHub
parent 671035e1f8
commit d105a77e07
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 2 deletions

View File

@ -26,7 +26,7 @@ all: bin
.PHONY: bin
bin:
CGO_ENABLED=0 go build ${BUILD_FLAGS} -o kompose main.go
CGO_ENABLED=0 GO111MODULE=off go build ${BUILD_FLAGS} -o kompose main.go
.PHONY: install
install:

View File

@ -29,6 +29,9 @@ var (
DownNamespace string
DownController string
DownOpt kobject.ConvertOptions
// DownServer allow use to choose different kubernetes server url
DownServer string
)
var downCmd = &cobra.Command{
@ -44,6 +47,7 @@ var downCmd = &cobra.Command{
Namespace: DownNamespace,
Controller: strings.ToLower(DownController),
IsNamespaceFlag: cmd.Flags().Lookup("namespace").Changed,
Server: DownServer,
}
// Validate before doing anything else.
@ -57,5 +61,6 @@ var downCmd = &cobra.Command{
func init() {
downCmd.Flags().StringVar(&DownNamespace, "namespace", "default", " Specify Namespace to deploy your application")
downCmd.Flags().StringVar(&DownController, "controller", "", `Set the output controller ("deployment"|"daemonSet"|"replicationController")`)
downCmd.Flags().StringVar(&DownServer, "server", "https://127.0.0.1:6443", "kubernetes apiserver url")
RootCmd.AddCommand(downCmd)
}

View File

@ -94,7 +94,7 @@ func init() {
upCmd.Flags().BoolVar(&UpPushImage, "push-image", true, "If we should push the docker image we built")
upCmd.Flags().BoolVar(&StoreManifest, "store-manifest", false, "Store the generated manifest (default false)")
upCmd.Flags().StringVar(&UpController, "controller", "", `Set the output controller ("deployment"|"daemonSet"|"replicationController")`)
upCmd.Flags().StringVar(&UpServer, "server", "", "kubernetes apiserver url (default https://127.0.0.1:6443)")
upCmd.Flags().StringVar(&UpServer, "server", "https://127.0.0.1:6443", "kubernetes apiserver url")
upCmd.Flags().MarkHidden("insecure-repository")
upCmd.Flags().MarkHidden("build-repo")
upCmd.Flags().MarkHidden("build-branch")

View File

@ -185,6 +185,7 @@ INFO Successfully deleted deployment: frontend
```
Note:
- You must have a running Kubernetes cluster with a pre-configured kubectl context.
- If you kubernetes api server url is different than https://127.0.0.1:6443, you can use the --server flag to customize it.
## Build and Push Docker Images