diff --git a/api/v1alpha1/dragonfly_types.go b/api/v1alpha1/dragonfly_types.go index b1afd5b..4a6988c 100644 --- a/api/v1alpha1/dragonfly_types.go +++ b/api/v1alpha1/dragonfly_types.go @@ -35,6 +35,12 @@ type DragonflySpec struct { // Image is the Dragonfly image to use Image string `json:"image,omitempty"` + // (Optional) imagePullPolicy to set to Dragonfly, default is Always + // +optional + // +kubebuilder:validation:Optional + // +kubebuilder:default="Always" + ImagePullPolicy corev1.PullPolicy `json:"imagePullPolicy,omitempty"` + // (Optional) Dragonfly container args to pass to the container // Refer to the Dragonfly documentation for the list of supported args // +optional diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index ff1ebee..a29946c 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -21,7 +21,7 @@ limitations under the License. package v1alpha1 import ( - v1 "k8s.io/api/core/v1" + "k8s.io/api/core/v1" runtime "k8s.io/apimachinery/pkg/runtime" ) diff --git a/config/crd/bases/dragonflydb.io_dragonflies.yaml b/config/crd/bases/dragonflydb.io_dragonflies.yaml index d97c657..fcc5328 100644 --- a/config/crd/bases/dragonflydb.io_dragonflies.yaml +++ b/config/crd/bases/dragonflydb.io_dragonflies.yaml @@ -1180,6 +1180,11 @@ spec: image: description: Image is the Dragonfly image to use type: string + imagePullPolicy: + default: Always + description: (Optional) imagePullPolicy to set to Dragonfly, default + is Always + type: string labels: additionalProperties: type: string diff --git a/internal/resources/resources.go b/internal/resources/resources.go index 3eb1608..547cc2c 100644 --- a/internal/resources/resources.go +++ b/internal/resources/resources.go @@ -148,7 +148,7 @@ func GetDragonflyResources(ctx context.Context, df *resourcesv1.Dragonfly) ([]cl SuccessThreshold: 1, TimeoutSeconds: 5, }, - ImagePullPolicy: corev1.PullAlways, + ImagePullPolicy: df.Spec.ImagePullPolicy, }, }, },