Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add miniojob mc image pull policy/secret #2177

Merged
merged 1 commit into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -212,7 +212,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 @@ -221,8 +221,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
Loading