Skip to content
This repository has been archived by the owner on Nov 15, 2022. It is now read-only.

Add support for defining Job controller #52

Closed
surajssd opened this issue Jun 21, 2017 · 4 comments
Closed

Add support for defining Job controller #52

surajssd opened this issue Jun 21, 2017 · 4 comments

Comments

@surajssd
Copy link
Member

Right now we by default create Deployment as the controller, so come up with a way to define the Job controller.

Read more about job:

@kadel
Copy link
Member

kadel commented Jun 28, 2017

Cron jobs are still alpha feature. I don't think we should add support for it until they are out of alpha.

But Jobs are in stable v1, and we should definetly support that.

@concaf
Copy link
Collaborator

concaf commented Jul 3, 2017

Talking with @kadel, we thought that -

  • JobSpec is a lot similar to DeploymentSpec, in the sense that there are top level fields and then there is PodTemplateSpec, so maybe we can treat this similar to how we reuse the PodSpec.

So, we can do something like this with jobs -

type JobSpecMod struct {
	Name                string
	api_v1.PodSpec      `json:",inline"`
	ext_v1beta1.JobSpec `json:",inline"`
}

type App struct {
	Name              string             `json:"name"`
        ...
        ...
	Jobs              []JobSpecMod       `json:"jobs,omitempty"`
}

This lets us defining jobs like -

name: httpd
containers:
- image: centos/httpd
services:
  - name: httpd
    type: NodePort
    ports:
    - port: 8080
      targetPort: 80
jobs:
- name: piStuff
  activeDeadlineSeconds: 100 # part of JobSpec
  containers: # part of PodSpec
  - name: pi
    image: perl
    command: ["perl",  "-Mbignum=bpi", "-wle", "print bpi(2000)"]
  restartPolicy: Never

This also means, that defining solo jobs will be possible like -

name: httpd
jobs:
- name: piStuff
  activeDeadlineSeconds: 100 # part of JobSpec
  containers: # part of PodSpec
  - name: pi
    image: perl
    command: ["perl",  "-Mbignum=bpi", "-wle", "print bpi(2000)"]
  restartPolicy: Never

How does this look @kedgeproject/maintainers?
Lazy consensus in effect! 😋

@concaf
Copy link
Collaborator

concaf commented Jul 3, 2017

@kadel also, about the name auto generation part, I think it's safe to auto generate names for any number of jobs specified in the spec, since there are no services, etc associated with these, and no one talks to them (which is sad) but they need to communicate outside.

@surajssd
Copy link
Member Author

Since #253 is merged closing this one!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants