|
|
@ -16,47 +16,23 @@ const (
|
|
|
|
portLimit = 32767
|
|
|
|
portLimit = 32767
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
var errUnknownServiceType = errors.New("unknown service type")
|
|
|
|
type Deployment struct {
|
|
|
|
|
|
|
|
Name string
|
|
|
|
type (
|
|
|
|
Namespace string
|
|
|
|
ServiceType string
|
|
|
|
Image string
|
|
|
|
|
|
|
|
Secret string
|
|
|
|
KubeRequest struct {
|
|
|
|
Replicas int
|
|
|
|
Env string
|
|
|
|
Revisions int
|
|
|
|
ServiceName string
|
|
|
|
Port int
|
|
|
|
ServiceType ServiceType
|
|
|
|
NodePort int
|
|
|
|
Namespace string
|
|
|
|
UseNodePort bool
|
|
|
|
Schedule string
|
|
|
|
RequestCpu int
|
|
|
|
Replicas int
|
|
|
|
RequestMem int
|
|
|
|
RevisionHistoryLimit int
|
|
|
|
LimitCpu int
|
|
|
|
Port int
|
|
|
|
LimitMem int
|
|
|
|
LimitCpu int
|
|
|
|
MinReplicas int
|
|
|
|
LimitMem int
|
|
|
|
MaxReplicas int
|
|
|
|
RequestCpu int
|
|
|
|
}
|
|
|
|
RequestMem int
|
|
|
|
|
|
|
|
SuccessfulJobsHistoryLimit int
|
|
|
|
|
|
|
|
HpaMinReplicas int
|
|
|
|
|
|
|
|
HpaMaxReplicas int
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Deployment struct {
|
|
|
|
|
|
|
|
Name string
|
|
|
|
|
|
|
|
Namespace string
|
|
|
|
|
|
|
|
Image string
|
|
|
|
|
|
|
|
Secret string
|
|
|
|
|
|
|
|
Replicas int
|
|
|
|
|
|
|
|
Revisions int
|
|
|
|
|
|
|
|
Port int
|
|
|
|
|
|
|
|
NodePort int
|
|
|
|
|
|
|
|
UseNodePort bool
|
|
|
|
|
|
|
|
RequestCpu int
|
|
|
|
|
|
|
|
RequestMem int
|
|
|
|
|
|
|
|
LimitCpu int
|
|
|
|
|
|
|
|
LimitMem int
|
|
|
|
|
|
|
|
MinReplicas int
|
|
|
|
|
|
|
|
MaxReplicas int
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func DeploymentCommand(c *cli.Context) error {
|
|
|
|
func DeploymentCommand(c *cli.Context) error {
|
|
|
|
nodePort := c.Int("nodePort")
|
|
|
|
nodePort := c.Int("nodePort")
|
|
|
@ -96,9 +72,33 @@ func DeploymentCommand(c *cli.Context) error {
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func Category() string {
|
|
|
|
|
|
|
|
return category
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func Clean() error {
|
|
|
|
|
|
|
|
return util.Clean(category)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func GenTemplates(_ *cli.Context) error {
|
|
|
|
func GenTemplates(_ *cli.Context) error {
|
|
|
|
return util.InitTemplates(category, map[string]string{
|
|
|
|
return util.InitTemplates(category, map[string]string{
|
|
|
|
deployTemplateFile: deploymentTemplate,
|
|
|
|
deployTemplateFile: deploymentTemplate,
|
|
|
|
jobTemplateFile: jobTmeplate,
|
|
|
|
jobTemplateFile: jobTmeplate,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func RevertTemplate(name string) error {
|
|
|
|
|
|
|
|
return util.CreateTemplate(category, name, deploymentTemplate)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func Update() error {
|
|
|
|
|
|
|
|
err := Clean()
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
return err
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return util.InitTemplates(category, map[string]string{
|
|
|
|
|
|
|
|
deployTemplateFile: deploymentTemplate,
|
|
|
|
|
|
|
|
jobTemplateFile: jobTmeplate,
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|