|
|
@ -16,30 +16,7 @@ const (
|
|
|
|
portLimit = 32767
|
|
|
|
portLimit = 32767
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
var errUnknownServiceType = errors.New("unknown service type")
|
|
|
|
type Deployment struct {
|
|
|
|
|
|
|
|
|
|
|
|
type (
|
|
|
|
|
|
|
|
ServiceType string
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
KubeRequest struct {
|
|
|
|
|
|
|
|
Env string
|
|
|
|
|
|
|
|
ServiceName string
|
|
|
|
|
|
|
|
ServiceType ServiceType
|
|
|
|
|
|
|
|
Namespace string
|
|
|
|
|
|
|
|
Schedule string
|
|
|
|
|
|
|
|
Replicas int
|
|
|
|
|
|
|
|
RevisionHistoryLimit int
|
|
|
|
|
|
|
|
Port int
|
|
|
|
|
|
|
|
LimitCpu int
|
|
|
|
|
|
|
|
LimitMem int
|
|
|
|
|
|
|
|
RequestCpu int
|
|
|
|
|
|
|
|
RequestMem int
|
|
|
|
|
|
|
|
SuccessfulJobsHistoryLimit int
|
|
|
|
|
|
|
|
HpaMinReplicas int
|
|
|
|
|
|
|
|
HpaMaxReplicas int
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Deployment struct {
|
|
|
|
|
|
|
|
Name string
|
|
|
|
Name string
|
|
|
|
Namespace string
|
|
|
|
Namespace string
|
|
|
|
Image string
|
|
|
|
Image string
|
|
|
@ -55,8 +32,7 @@ type (
|
|
|
|
LimitMem int
|
|
|
|
LimitMem int
|
|
|
|
MinReplicas int
|
|
|
|
MinReplicas int
|
|
|
|
MaxReplicas 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,
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|