Skip to content

Commit

Permalink
feat: add miniojob mc image pull policy/secret (#2177)
Browse files Browse the repository at this point in the history
  • Loading branch information
jiuker authored Jun 24, 2024
1 parent 19fb4c3 commit 917cd0f
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 7 deletions.
12 changes: 11 additions & 1 deletion helm/operator/templates/job.min.io_jobs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1025,8 +1025,18 @@ spec:
- continueOnFailure
- stopOnFailure
type: string
imagePullPolicy:
type: string
imagePullSecret:
items:
properties:
name:
type: string
type: object
x-kubernetes-map-type: atomic
type: array
mcImage:
default: minio/mc:latest
default: quay.io/minio/mc:latest
type: string
securityContext:
properties:
Expand Down
21 changes: 20 additions & 1 deletion pkg/apis/job.min.io/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,28 @@ type MinIOJobSpec struct {

// mc job image
// +optional
// +kubebuilder:default="minio/mc:latest"
// +kubebuilder:default="quay.io/minio/mc:latest"
MCImage string `json:"mcImage,omitempty"`

// *Optional* +
//
// The pull policy for the MinIO Docker image. Specify one of the following: +
//
// * `Always` +
//
// * `Never` +
//
// * `IfNotPresent` (Default) +
//
// Refer Kubernetes documentation for details https://kubernetes.io/docs/concepts/containers/images#updating-images
ImagePullPolicy corev1.PullPolicy `json:"imagePullPolicy,omitempty"`

// *Optional* +
//
// Specify the secret key to use for pulling images from a private Docker repository. +
// +optional
ImagePullSecret []corev1.LocalObjectReference `json:"imagePullSecret,omitempty"`

// *Optional* +
//
// Specify the https://kubernetes.io/docs/tasks/configure-pod-container/security-context/[Security Context] of pods in the pool. The Operator supports only the following pod security fields: +
Expand Down
9 changes: 5 additions & 4 deletions pkg/utils/miniojob/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import (

const (
// DefaultMCImage - job mc image
DefaultMCImage = "minio/mc:latest"
DefaultMCImage = "quay.io/minio/mc:latest"
// MinioJobName - job name
MinioJobName = "job.min.io/job-name"
// MinioJobCRName - job cr name
Expand Down Expand Up @@ -211,7 +211,7 @@ func (jobCommand *MinIOIntervalJobCommand) createJob(ctx context.Context, k8sCli
{
Name: "mc",
Image: mcImage,
ImagePullPolicy: corev1.PullIfNotPresent,
ImagePullPolicy: jobCR.Spec.ImagePullPolicy,
Env: jobCommand.CommandSpec.Env,
EnvFrom: baseEnvFrom,
Command: jobCommands,
Expand All @@ -220,8 +220,9 @@ func (jobCommand *MinIOIntervalJobCommand) createJob(ctx context.Context, k8sCli
Resources: jobCommand.CommandSpec.Resources,
},
},
SecurityContext: jobCR.Spec.SecurityContext,
Volumes: baseVolumes,
ImagePullSecrets: jobCR.Spec.ImagePullSecret,
SecurityContext: jobCR.Spec.SecurityContext,
Volumes: baseVolumes,
},
},
},
Expand Down
12 changes: 11 additions & 1 deletion resources/base/crds/job.min.io_miniojobs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1025,8 +1025,18 @@ spec:
- continueOnFailure
- stopOnFailure
type: string
imagePullPolicy:
type: string
imagePullSecret:
items:
properties:
name:
type: string
type: object
x-kubernetes-map-type: atomic
type: array
mcImage:
default: minio/mc:latest
default: quay.io/minio/mc:latest
type: string
securityContext:
properties:
Expand Down

0 comments on commit 917cd0f

Please sign in to comment.