optimize dockerfile generation (#284)

This commit is contained in:
Kevin Wan
2020-12-12 16:53:06 +08:00
committed by GitHub
parent f919bc6713
commit acd48f0abb
5 changed files with 23 additions and 13 deletions

View File

@@ -47,9 +47,9 @@ spec:
volumeMounts:
- name: timezone
mountPath: /etc/localtime
imagePullSecrets:
{{if .Secret}}imagePullSecrets:
- name: {{.Secret}}
volumes:
{{end}}volumes:
- name: timezone
hostPath:
path: /usr/share/zoneinfo/Asia/Shanghai

View File

@@ -2,8 +2,10 @@ package kube
import (
"errors"
"fmt"
"text/template"
"github.com/logrusorgru/aurora"
"github.com/tal-tech/go-zero/tools/goctl/util"
"github.com/urfave/cli"
)
@@ -53,7 +55,7 @@ func DeploymentCommand(c *cli.Context) error {
defer out.Close()
t := template.Must(template.New("deploymentTemplate").Parse(text))
return t.Execute(out, Deployment{
err = t.Execute(out, Deployment{
Name: c.String("name"),
Namespace: c.String("namespace"),
Image: c.String("image"),
@@ -70,6 +72,12 @@ func DeploymentCommand(c *cli.Context) error {
MinReplicas: c.Int("minReplicas"),
MaxReplicas: c.Int("maxReplicas"),
})
if err != nil {
return err
}
fmt.Println(aurora.Green("Done."))
return nil
}
func Category() string {