Fixup jobs, roles...
This commit is contained in:
@@ -78,7 +78,7 @@ func buildCrontab(deployName string, deployment *helm.Deployment, s *types.Servi
|
||||
cmd = podget + cmd
|
||||
|
||||
if cron.Image == "" {
|
||||
cron.Image = "bitnami/kubectl"
|
||||
cron.Image = "bitnami/kubectl:1.20"
|
||||
}
|
||||
|
||||
name := deployName
|
||||
|
@@ -74,6 +74,7 @@ func buildDeployment(name string, s *types.ServiceConfig, linked map[string]type
|
||||
|
||||
// Add selectors
|
||||
selectors := buildSelector(name, s)
|
||||
selectors[helm.K+"/resource"] = "deployment"
|
||||
deployment.Spec.Selector = map[string]interface{}{
|
||||
"matchLabels": selectors,
|
||||
}
|
||||
|
@@ -5,8 +5,11 @@ type CronTab struct {
|
||||
Spec CronSpec `yaml:"spec"`
|
||||
}
|
||||
type CronSpec struct {
|
||||
Schedule string `yaml:"schedule"`
|
||||
JobTemplate JobTemplate `yaml:"jobTemplate"`
|
||||
Schedule string `yaml:"schedule"`
|
||||
JobTemplate JobTemplate `yaml:"jobTemplate"`
|
||||
SuccessfulJobsHistoryLimit int `yaml:"successfulJobsHistoryLimit"`
|
||||
FailedJobsHistoryLimit int `yaml:"failedJobsHistoryLimit"`
|
||||
ConcurrencyPolicy string `yaml:"concurrencyPolicy"`
|
||||
}
|
||||
type JobTemplate struct {
|
||||
Spec JobSpecDescription `yaml:"spec"`
|
||||
@@ -38,6 +41,9 @@ func NewCrontab(name, image, command, schedule string, serviceAccount *ServiceAc
|
||||
cron.K8sBase.Metadata.Name = ReleaseNameTpl + "-" + name
|
||||
cron.K8sBase.Metadata.Labels[K+"/component"] = name
|
||||
cron.Spec.Schedule = schedule
|
||||
cron.Spec.SuccessfulJobsHistoryLimit = 3
|
||||
cron.Spec.FailedJobsHistoryLimit = 3
|
||||
cron.Spec.ConcurrencyPolicy = "Forbid"
|
||||
cron.Spec.JobTemplate.Spec.Template.Metadata = Metadata{
|
||||
Labels: cron.K8sBase.Metadata.Labels,
|
||||
}
|
||||
@@ -48,7 +54,7 @@ func NewCrontab(name, image, command, schedule string, serviceAccount *ServiceAc
|
||||
{
|
||||
Name: name,
|
||||
Image: image,
|
||||
Command: []string{command},
|
||||
Command: []string{"sh", "-c", command},
|
||||
},
|
||||
},
|
||||
RestartPolicy: "OnFailure",
|
||||
|
@@ -25,6 +25,13 @@ type DepSpec struct {
|
||||
func NewDepSpec() *DepSpec {
|
||||
return &DepSpec{
|
||||
Replicas: 1,
|
||||
Template: PodTemplate{
|
||||
Metadata: Metadata{
|
||||
Labels: map[string]string{
|
||||
K + "/resource": "deployment",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -24,8 +24,13 @@ func NewCronRole(name string) *Role {
|
||||
role.Rules = []Rule{
|
||||
{
|
||||
ApiGroup: []string{""},
|
||||
Resources: []string{"pods", "pods/exec"},
|
||||
Verbs: []string{"get", "list", "create"},
|
||||
Resources: []string{"pods", "pods/log"},
|
||||
Verbs: []string{"get", "list", "watch", "create", "update", "patch", "delete"},
|
||||
},
|
||||
{
|
||||
ApiGroup: []string{""},
|
||||
Resources: []string{"pods/exec"},
|
||||
Verbs: []string{"create"},
|
||||
},
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user