Skip to content

Commit

Permalink
Merge pull request #13 from putcn/add-imagepullsecret-hostnetwork
Browse files Browse the repository at this point in the history
adding ImagePullSecrets and HostNetwork to training job spec
  • Loading branch information
typhoonzero authored Mar 18, 2018
2 parents c338f06 + 9f73fe4 commit 2075a28
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
8 changes: 7 additions & 1 deletion pkg/jobparser.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ func (p *DefaultJobParser) ParseToPserver(job *edlresource.TrainingJob) *v1beta1
Resources: job.Spec.Pserver.Resources,
},
},
ImagePullSecrets: job.Spec.ImagePullSecrets,
HostNetwork: job.Spec.HostNetwork,
},
},
},
Expand Down Expand Up @@ -154,7 +156,9 @@ func (p *DefaultJobParser) ParseToTrainer(job *edlresource.TrainingJob) *batchv1
Resources: job.Spec.Trainer.Resources,
},
},
RestartPolicy: "Never",
ImagePullSecrets: job.Spec.ImagePullSecrets,
HostNetwork: job.Spec.HostNetwork,
RestartPolicy: "Never",
},
},
},
Expand Down Expand Up @@ -229,6 +233,8 @@ func (p *DefaultJobParser) ParseToMaster(job *edlresource.TrainingJob) *v1beta1.
},
*getEtcdPodSpec(job),
},
ImagePullSecrets: job.Spec.ImagePullSecrets,
HostNetwork: job.Spec.HostNetwork,
},
},
},
Expand Down
26 changes: 18 additions & 8 deletions pkg/resource/training_job.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ kind: TrainingJob
metadata:
name: job-1
spec:
image: "paddlepaddle/paddlecloud-job"
port: 7164
ports_num: 1
ports_num_for_sparse: 1
fault_tolerant: true
imagePullSecrets:
name: myregistrykey
hostNetwork: true
trainer:
entrypoint: "python train.py"
workspace: "/home/job-1/"
Expand Down Expand Up @@ -109,14 +117,16 @@ type TrainingJob struct {
// +k8s:deepcopy-gen=true
type TrainingJobSpec struct {
// General job attributes.
Image string `json:"image,omitempty"`
Port int `json:"port,omitempty"`
PortsNum int `json:"ports_num,omitempty"`
PortsNumForSparse int `json:"ports_num_for_sparse,omitempty"`
FaultTolerant bool `json:"fault_tolerant,omitempty"`
Passes int `json:"passes,omitempty"`
Volumes []v1.Volume `json:"volumes"`
VolumeMounts []v1.VolumeMount `json:"VolumeMounts"`
Image string `json:"image,omitempty"`
Port int `json:"port,omitempty"`
PortsNum int `json:"ports_num,omitempty"`
PortsNumForSparse int `json:"ports_num_for_sparse,omitempty"`
FaultTolerant bool `json:"fault_tolerant,omitempty"`
Passes int `json:"passes,omitempty"`
Volumes []v1.Volume `json:"volumes"`
VolumeMounts []v1.VolumeMount `json:"VolumeMounts"`
ImagePullSecrets []v1.LocalObjectReference `json:"imagePullSecrets,omitempty"`
HostNetwork bool `josn:"hostNetwork,omitempty"`
// Job components.
Trainer TrainerSpec `json:"trainer"`
Pserver PserverSpec `json:"pserver"`
Expand Down

0 comments on commit 2075a28

Please sign in to comment.