1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-01-17 17:44:30 +02:00

Add Kubernetes flag to new command (#2263)

To remain consistent with the Gomu's generate command, we add a
Kubernetes flag to Gomu's new command as well.
This commit is contained in:
Niek den Breeje 2021-09-10 19:47:55 +02:00 committed by GitHub
parent 56d5143557
commit 5b8d22a463
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -15,11 +15,15 @@ import (
var flags []cli.Flag = []cli.Flag{
&cli.BoolFlag{
Name: "jaeger",
Usage: "generate jaeger tracer files",
Usage: "Generate Jaeger tracer files",
},
&cli.BoolFlag{
Name: "kubernetes",
Usage: "Generate Kubernetes resource files",
},
&cli.BoolFlag{
Name: "skaffold",
Usage: "generate skaffold files",
Usage: "Generate Skaffold files",
},
}
@ -128,13 +132,18 @@ func createProject(ctx *cli.Context, pt string) error {
return fmt.Errorf("%s project type not supported", pt)
}
if ctx.Bool("skaffold") {
if ctx.Bool("kubernetes") || ctx.Bool("skaffold") {
files = append(files, []generator.File{
{"plugins.go", tmpl.Plugins},
{"resources/clusterrole.yaml", tmpl.KubernetesClusterRole},
{"resources/configmap.yaml", tmpl.KubernetesEnv},
{"resources/deployment.yaml", tmpl.KubernetesDeployment},
{"resources/rolebinding.yaml", tmpl.KubernetesRoleBinding},
}...)
}
if ctx.Bool("skaffold") {
files = append(files, []generator.File{
{"skaffold.yaml", tmpl.SkaffoldCFG},
}...)
}