add the serviceAccount of deployment (#1543)
Co-authored-by: 977231903@qq.com <>
This commit is contained in:
@@ -408,6 +408,10 @@ var commands = []cli.Command{
|
|||||||
"if they are, --remote has higher priority\n\tThe git repo directory must be consistent with the " +
|
"if they are, --remote has higher priority\n\tThe git repo directory must be consistent with the " +
|
||||||
"https://github.com/zeromicro/go-zero-template directory structure",
|
"https://github.com/zeromicro/go-zero-template directory structure",
|
||||||
},
|
},
|
||||||
|
cli.StringFlag{
|
||||||
|
Name: "serviceAccount",
|
||||||
|
Usage: "the serviceAccount of deployment",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
Action: kube.DeploymentCommand,
|
Action: kube.DeploymentCommand,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -17,7 +17,8 @@ spec:
|
|||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
app: {{.Name}}
|
app: {{.Name}}
|
||||||
spec:
|
spec:{{if .ServiceAccount}}
|
||||||
|
serviceAccountName: {{.ServiceAccount}}{{end}}
|
||||||
containers:
|
containers:
|
||||||
- name: {{.Name}}
|
- name: {{.Name}}
|
||||||
image: {{.Image}}
|
image: {{.Image}}
|
||||||
|
|||||||
@@ -11,8 +11,9 @@ spec:
|
|||||||
jobTemplate:
|
jobTemplate:
|
||||||
spec:
|
spec:
|
||||||
template:
|
template:
|
||||||
spec:
|
spec:{{if .ServiceAccount}}
|
||||||
containers:
|
serviceAccountName: {{.ServiceAccount}}{{end}}
|
||||||
|
{{end}}containers:
|
||||||
- name: {{.Name}}
|
- name: {{.Name}}
|
||||||
image: # todo image url
|
image: # todo image url
|
||||||
resources:
|
resources:
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ type Deployment struct {
|
|||||||
LimitMem int
|
LimitMem int
|
||||||
MinReplicas int
|
MinReplicas int
|
||||||
MaxReplicas int
|
MaxReplicas int
|
||||||
|
ServiceAccount string
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeploymentCommand is used to generate the kubernetes deployment yaml files.
|
// DeploymentCommand is used to generate the kubernetes deployment yaml files.
|
||||||
@@ -87,6 +88,7 @@ func DeploymentCommand(c *cli.Context) error {
|
|||||||
LimitMem: c.Int("limitMem"),
|
LimitMem: c.Int("limitMem"),
|
||||||
MinReplicas: c.Int("minReplicas"),
|
MinReplicas: c.Int("minReplicas"),
|
||||||
MaxReplicas: c.Int("maxReplicas"),
|
MaxReplicas: c.Int("maxReplicas"),
|
||||||
|
ServiceAccount: c.String("serviceAccount"),
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
Reference in New Issue
Block a user