feat: support targetPort option in goctl kube (#2378)

This commit is contained in:
Kevin Wan
2022-09-12 20:42:41 +08:00
committed by GitHub
parent 66c2a28e66
commit 3e96994b7b
4 changed files with 122 additions and 5 deletions

View File

@@ -36,6 +36,7 @@ type Deployment struct {
Replicas int
Revisions int
Port int
TargetPort int
NodePort int
UseNodePort bool
RequestCpu int
@@ -81,6 +82,10 @@ func deploymentCommand(_ *cobra.Command, _ []string) error {
}
defer out.Close()
if varIntTargetPort == 0 {
varIntTargetPort = varIntPort
}
t := template.Must(template.New("deploymentTemplate").Parse(text))
err = t.Execute(out, Deployment{
Name: varStringName,
@@ -90,6 +95,7 @@ func deploymentCommand(_ *cobra.Command, _ []string) error {
Replicas: varIntReplicas,
Revisions: varIntRevisions,
Port: varIntPort,
TargetPort: varIntTargetPort,
NodePort: nodePort,
UseNodePort: nodePort > 0,
RequestCpu: varIntRequestCpu,