Merge pull request #71 from dvdliao/respect-imagepullpolicy
add config to respect image pull policy
This commit is contained in:
		
						commit
						ba8f61141b
					
				| 
						 | 
					@ -250,8 +250,8 @@ spec:
 | 
				
			||||||
        operator: Exists
 | 
					        operator: Exists
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      repository: mumoshu/actions-runner-controller-ci
 | 
					      repository: mumoshu/actions-runner-controller-ci
 | 
				
			||||||
      ImagePullPolicy: Always
 | 
					 | 
				
			||||||
      image: custom-image/actions-runner:latest
 | 
					      image: custom-image/actions-runner:latest
 | 
				
			||||||
 | 
					      imagePullPolicy: Always
 | 
				
			||||||
      resources:
 | 
					      resources:
 | 
				
			||||||
        limits:
 | 
					        limits:
 | 
				
			||||||
          cpu: "4.0"
 | 
					          cpu: "4.0"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -48,6 +48,8 @@ type RunnerSpec struct {
 | 
				
			||||||
	// +optional
 | 
						// +optional
 | 
				
			||||||
	Image string `json:"image"`
 | 
						Image string `json:"image"`
 | 
				
			||||||
	// +optional
 | 
						// +optional
 | 
				
			||||||
 | 
						ImagePullPolicy corev1.PullPolicy `json:"imagePullPolicy,omitempty"`
 | 
				
			||||||
 | 
						// +optional
 | 
				
			||||||
	Env []corev1.EnvVar `json:"env,omitempty"`
 | 
						Env []corev1.EnvVar `json:"env,omitempty"`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// +optional
 | 
						// +optional
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3019,6 +3019,10 @@ spec:
 | 
				
			||||||
                      type: array
 | 
					                      type: array
 | 
				
			||||||
                    image:
 | 
					                    image:
 | 
				
			||||||
                      type: string
 | 
					                      type: string
 | 
				
			||||||
 | 
					                    imagePullPolicy:
 | 
				
			||||||
 | 
					                      description: PullPolicy describes a policy for if/when to pull
 | 
				
			||||||
 | 
					                        a container image
 | 
				
			||||||
 | 
					                      type: string
 | 
				
			||||||
                    imagePullSecrets:
 | 
					                    imagePullSecrets:
 | 
				
			||||||
                      items:
 | 
					                      items:
 | 
				
			||||||
                        description: LocalObjectReference contains enough information
 | 
					                        description: LocalObjectReference contains enough information
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3006,6 +3006,10 @@ spec:
 | 
				
			||||||
                      type: array
 | 
					                      type: array
 | 
				
			||||||
                    image:
 | 
					                    image:
 | 
				
			||||||
                      type: string
 | 
					                      type: string
 | 
				
			||||||
 | 
					                    imagePullPolicy:
 | 
				
			||||||
 | 
					                      description: PullPolicy describes a policy for if/when to pull
 | 
				
			||||||
 | 
					                        a container image
 | 
				
			||||||
 | 
					                      type: string
 | 
				
			||||||
                    imagePullSecrets:
 | 
					                    imagePullSecrets:
 | 
				
			||||||
                      items:
 | 
					                      items:
 | 
				
			||||||
                        description: LocalObjectReference contains enough information
 | 
					                        description: LocalObjectReference contains enough information
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2815,6 +2815,10 @@ spec:
 | 
				
			||||||
              type: array
 | 
					              type: array
 | 
				
			||||||
            image:
 | 
					            image:
 | 
				
			||||||
              type: string
 | 
					              type: string
 | 
				
			||||||
 | 
					            imagePullPolicy:
 | 
				
			||||||
 | 
					              description: PullPolicy describes a policy for if/when to pull a container
 | 
				
			||||||
 | 
					                image
 | 
				
			||||||
 | 
					              type: string
 | 
				
			||||||
            imagePullSecrets:
 | 
					            imagePullSecrets:
 | 
				
			||||||
              items:
 | 
					              items:
 | 
				
			||||||
                description: LocalObjectReference contains enough information to let
 | 
					                description: LocalObjectReference contains enough information to let
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -261,6 +261,11 @@ func (r *RunnerReconciler) newPod(runner v1alpha1.Runner) (corev1.Pod, error) {
 | 
				
			||||||
		runnerImage = r.RunnerImage
 | 
							runnerImage = r.RunnerImage
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						runnerImagePullPolicy := runner.Spec.ImagePullPolicy
 | 
				
			||||||
 | 
						if runnerImagePullPolicy == "" {
 | 
				
			||||||
 | 
							runnerImagePullPolicy = corev1.PullAlways
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	env := []corev1.EnvVar{
 | 
						env := []corev1.EnvVar{
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			Name:  "RUNNER_NAME",
 | 
								Name:  "RUNNER_NAME",
 | 
				
			||||||
| 
						 | 
					@ -298,7 +303,7 @@ func (r *RunnerReconciler) newPod(runner v1alpha1.Runner) (corev1.Pod, error) {
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
					Name:            containerName,
 | 
										Name:            containerName,
 | 
				
			||||||
					Image:           runnerImage,
 | 
										Image:           runnerImage,
 | 
				
			||||||
					ImagePullPolicy: "Always",
 | 
										ImagePullPolicy: runnerImagePullPolicy,
 | 
				
			||||||
					Env:             env,
 | 
										Env:             env,
 | 
				
			||||||
					EnvFrom:         runner.Spec.EnvFrom,
 | 
										EnvFrom:         runner.Spec.EnvFrom,
 | 
				
			||||||
					VolumeMounts: []corev1.VolumeMount{
 | 
										VolumeMounts: []corev1.VolumeMount{
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue