@@ -54,8 +54,9 @@ type ExecResult struct {
54
54
55
55
// ContainerOptions describes a container to be started in a pod
56
56
type ContainerOptions struct {
57
- Name string // name of the container
58
- Image string // image to be attached
57
+ Name string // name of the container
58
+ Image string // image to be attached
59
+ PullPolicy k8sTypes.PullPolicy
59
60
Command []string // command to be executed by the container
60
61
Capabilities []string // capabilities to be added to the container's security context
61
62
}
@@ -70,9 +71,10 @@ type Pods struct {
70
71
71
72
// PodOptions describe a Pod to be executed
72
73
type PodOptions struct {
73
- Namespace string // namespace where the pod will be executed
74
- Name string // name of the pod
75
- Image string // image to be executed by the pod's container
74
+ Namespace string // namespace where the pod will be executed
75
+ Name string // name of the pod
76
+ Image string // image to be executed by the pod's container
77
+ PullPolicy k8sTypes.PullPolicy
76
78
Command []string // command to be executed by the pod's container and its arguments
77
79
RestartPolicy k8sTypes.RestartPolicy // policy for restarting containers in the pod [Always|OnFailure|Never]
78
80
Wait string // timeout for waiting until the pod is running
@@ -124,9 +126,10 @@ func (obj *Pods) IsTerminating(name, namespace string) (bool, error) {
124
126
// Create runs a pod specified by the options
125
127
func (obj * Pods ) Create (options PodOptions ) (k8sTypes.Pod , error ) {
126
128
container := k8sTypes.Container {
127
- Name : options .Name ,
128
- Image : options .Image ,
129
- Command : options .Command ,
129
+ Name : options .Name ,
130
+ Image : options .Image ,
131
+ ImagePullPolicy : options .PullPolicy ,
132
+ Command : options .Command ,
130
133
}
131
134
132
135
containers := []k8sTypes.Container {
@@ -312,11 +315,12 @@ func generateEphemeralContainer(o ContainerOptions) *k8sTypes.EphemeralContainer
312
315
313
316
return & k8sTypes.EphemeralContainer {
314
317
EphemeralContainerCommon : k8sTypes.EphemeralContainerCommon {
315
- Name : o .Name ,
316
- Image : o .Image ,
317
- Command : o .Command ,
318
- TTY : true ,
319
- Stdin : true ,
318
+ Name : o .Name ,
319
+ Image : o .Image ,
320
+ ImagePullPolicy : o .PullPolicy ,
321
+ Command : o .Command ,
322
+ TTY : true ,
323
+ Stdin : true ,
320
324
SecurityContext : & k8sTypes.SecurityContext {
321
325
Capabilities : & k8sTypes.Capabilities {
322
326
Add : capabilities ,
0 commit comments