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

[Enhancement] Support ImagePullPolicy #514

Merged
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
28 changes: 28 additions & 0 deletions config/crd/bases/starrocks.com_starrocksclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1056,6 +1056,13 @@ spec:
image:
description: Image for a starrocks deployment.
type: string
imagePullPolicy:
description: |-
Image pull policy.
One of Always, Never, IfNotPresent.
Defaults to IfNotPresent for compatibility.
More info: https://kubernetes.io/docs/concepts/containers/images#updating-images
type: string
imagePullSecrets:
description: |-
ImagePullSecrets is an optional list of references to secrets in the same namespace to use for pulling any of the
Expand Down Expand Up @@ -5739,6 +5746,13 @@ spec:
image:
description: Image for a starrocks deployment.
type: string
imagePullPolicy:
description: |-
Image pull policy.
One of Always, Never, IfNotPresent.
Defaults to IfNotPresent for compatibility.
More info: https://kubernetes.io/docs/concepts/containers/images#updating-images
type: string
imagePullSecrets:
description: |-
ImagePullSecrets is an optional list of references to secrets in the same namespace to use for pulling any of the
Expand Down Expand Up @@ -9626,6 +9640,13 @@ spec:
image:
description: Image for a starrocks deployment.
type: string
imagePullPolicy:
description: |-
Image pull policy.
One of Always, Never, IfNotPresent.
Defaults to IfNotPresent for compatibility.
More info: https://kubernetes.io/docs/concepts/containers/images#updating-images
type: string
imagePullSecrets:
description: |-
ImagePullSecrets is an optional list of references to secrets in the same namespace to use for pulling any of the
Expand Down Expand Up @@ -11095,6 +11116,13 @@ spec:
image:
description: Image for a starrocks deployment.
type: string
imagePullPolicy:
description: |-
Image pull policy.
One of Always, Never, IfNotPresent.
Defaults to IfNotPresent for compatibility.
More info: https://kubernetes.io/docs/concepts/containers/images#updating-images
type: string
imagePullSecrets:
description: |-
ImagePullSecrets is an optional list of references to secrets in the same namespace to use for pulling any of the
Expand Down
7 changes: 7 additions & 0 deletions config/crd/bases/starrocks.com_starrockswarehouses.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1667,6 +1667,13 @@ spec:
image:
description: Image for a starrocks deployment.
type: string
imagePullPolicy:
description: |-
Image pull policy.
One of Always, Never, IfNotPresent.
Defaults to IfNotPresent for compatibility.
More info: https://kubernetes.io/docs/concepts/containers/images#updating-images
type: string
imagePullSecrets:
description: |-
ImagePullSecrets is an optional list of references to secrets in the same namespace to use for pulling any of the
Expand Down
8 changes: 8 additions & 0 deletions deploy/starrocks.com_starrocksclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,8 @@ spec:
type: array
image:
type: string
imagePullPolicy:
type: string
imagePullSecrets:
items:
properties:
Expand Down Expand Up @@ -2806,6 +2808,8 @@ spec:
type: array
image:
type: string
imagePullPolicy:
type: string
imagePullSecrets:
items:
properties:
Expand Down Expand Up @@ -4649,6 +4653,8 @@ spec:
type: object
image:
type: string
imagePullPolicy:
type: string
imagePullSecrets:
items:
properties:
Expand Down Expand Up @@ -5365,6 +5371,8 @@ spec:
type: array
image:
type: string
imagePullPolicy:
type: string
imagePullSecrets:
items:
properties:
Expand Down
2 changes: 2 additions & 0 deletions deploy/starrocks.com_starrockswarehouses.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -857,6 +857,8 @@ spec:
type: array
image:
type: string
imagePullPolicy:
type: string
imagePullSecrets:
items:
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ spec:
{{- end }}
image: "{{ .Values.starrocksFESpec.image.repository }}:{{ include "starrockscluster.fe.image.tag" . }}"
replicas: {{ .Values.starrocksFESpec.replicas }}
imagePullPolicy: {{ .Values.starrocksFESpec.imagePullPolicy }}
{{- /*
support both resources and resource for backward compatibility
*/}}
Expand Down Expand Up @@ -222,6 +223,7 @@ spec:
{{- end }}
image: "{{ .Values.starrocksBeSpec.image.repository }}:{{ include "starrockscluster.be.image.tag" . }}"
replicas: {{ .Values.starrocksBeSpec.replicas }}
imagePullPolicy: {{ .Values.starrocksBeSpec.imagePullPolicy }}
{{- /*
support both resources and resource for backward compatibility
*/}}
Expand Down Expand Up @@ -441,6 +443,7 @@ spec:
{{- if .Values.starrocksCnSpec.replicas }}
replicas: {{ .Values.starrocksCnSpec.replicas }}
{{- end }}
imagePullPolicy: {{ .Values.starrocksCnSpec.imagePullPolicy }}
{{- if or .Values.starrocksCnSpec.serviceAccount .Values.starrocksCluster.componentValues.serviceAccount }}
serviceAccount: {{ include "starrockscluster.cn.serviceAccount" . }}
{{- end }}
Expand Down Expand Up @@ -666,6 +669,7 @@ spec:
{{- toYaml .Values.starrocksFeProxySpec.imagePullSecrets | nindent 4 }}
{{- end }}
replicas: {{ .Values.starrocksFeProxySpec.replicas }}
imagePullPolicy: {{ .Values.starrocksFeProxySpec.imagePullPolicy }}
resolver: {{ .Values.starrocksFeProxySpec.resolver }}
{{- if .Values.starrocksFeProxySpec.resources }}
{{- toYaml .Values.starrocksFeProxySpec.resources | nindent 4 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ starrocksFESpec:
# image sliced by "repository:tag"
repository: starrocks/fe-ubuntu
tag: ""
imagePullPolicy: IfNotPresent
# add annotations for fe pods. For example, if you want to config monitor for datadog, you can config the annotations.
annotations: {}
# If runAsNonRoot is true, the container is run as non-root user.
Expand Down Expand Up @@ -339,6 +340,7 @@ starrocksCnSpec:
# image sliced by "repository:tag"
repository: starrocks/cn-ubuntu
tag: ""
imagePullPolicy: IfNotPresent
# serviceAccount for cn access cloud service.
serviceAccount: ""
# add annotations for cn pods. example, if you want to config monitor for datadog, you can config the annotations.
Expand Down Expand Up @@ -577,6 +579,7 @@ starrocksBeSpec:
# image sliced by "repository:tag"
repository: starrocks/be-ubuntu
tag: ""
imagePullPolicy: IfNotPresent
# serviceAccount for be access cloud service.
serviceAccount: ""
# add annotations for be pods. example, if you want to config monitor for datadog, you can config the annotations.
Expand Down Expand Up @@ -808,6 +811,7 @@ starrocksFeProxySpec:
# specify the fe proxy deploy or not.
enabled: false
replicas: 1
imagePullPolicy: IfNotPresent
# default nginx:1.24.0
image:
repository: ""
Expand Down
4 changes: 4 additions & 0 deletions helm-charts/charts/kube-starrocks/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ starrocks:
# image sliced by "repository:tag"
repository: starrocks/fe-ubuntu
tag: ""
imagePullPolicy: IfNotPresent
# add annotations for fe pods. For example, if you want to config monitor for datadog, you can config the annotations.
annotations: {}
# If runAsNonRoot is true, the container is run as non-root user.
Expand Down Expand Up @@ -447,6 +448,7 @@ starrocks:
# image sliced by "repository:tag"
repository: starrocks/cn-ubuntu
tag: ""
imagePullPolicy: IfNotPresent
# serviceAccount for cn access cloud service.
serviceAccount: ""
# add annotations for cn pods. example, if you want to config monitor for datadog, you can config the annotations.
Expand Down Expand Up @@ -685,6 +687,7 @@ starrocks:
# image sliced by "repository:tag"
repository: starrocks/be-ubuntu
tag: ""
imagePullPolicy: IfNotPresent
# serviceAccount for be access cloud service.
serviceAccount: ""
# add annotations for be pods. example, if you want to config monitor for datadog, you can config the annotations.
Expand Down Expand Up @@ -916,6 +919,7 @@ starrocks:
# specify the fe proxy deploy or not.
enabled: false
replicas: 1
imagePullPolicy: IfNotPresent
# default nginx:1.24.0
image:
repository: ""
Expand Down
15 changes: 15 additions & 0 deletions pkg/apis/starrocks/v1/load_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ type loadInterface interface {

GetStorageVolumes() []StorageVolume
GetServiceAccount() string
GetImagePullPolicy() corev1.PullPolicy
}

type StarRocksLoadSpec struct {
Expand Down Expand Up @@ -48,6 +49,13 @@ type StarRocksLoadSpec struct {
// +optional
Image string `json:"image"`

// Image pull policy.
// One of Always, Never, IfNotPresent.
// Defaults to IfNotPresent for compatibility.
// More info: https://kubernetes.io/docs/concepts/containers/images#updating-images
// +optional
ImagePullPolicy corev1.PullPolicy `json:"imagePullPolicy,omitempty"`

// ImagePullSecrets is an optional list of references to secrets in the same namespace to use for pulling any of the
// images used by this PodSpec. If specified, these secrets will be passed to individual puller implementations for
// them to use.
Expand Down Expand Up @@ -275,3 +283,10 @@ func (spec *StarRocksLoadSpec) GetReadinessProbeFailureSeconds() *int32 {
func (spec *StarRocksLoadSpec) GetLifecycle() *corev1.Lifecycle {
return spec.Lifecycle
}

func (spec *StarRocksLoadSpec) GetImagePullPolicy() corev1.PullPolicy {
if spec.ImagePullPolicy == "" {
return corev1.PullIfNotPresent
}
return spec.ImagePullPolicy
}
2 changes: 1 addition & 1 deletion pkg/subcontrollers/be/be_pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func (be *BeController) buildPodTemplate(src *srapi.StarRocksCluster, config map
Ports: pod.Ports(beSpec, config),
Env: envs,
Resources: beSpec.ResourceRequirements,
ImagePullPolicy: corev1.PullIfNotPresent,
ImagePullPolicy: beSpec.GetImagePullPolicy(),
VolumeMounts: volumeMounts,
StartupProbe: pod.StartupProbe(beSpec.GetStartupProbeFailureSeconds(), webServerPort, pod.HEALTH_API_PATH),
LivenessProbe: pod.LivenessProbe(beSpec.GetLivenessProbeFailureSeconds(), webServerPort, pod.HEALTH_API_PATH),
Expand Down
2 changes: 1 addition & 1 deletion pkg/subcontrollers/cn/cn_pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func (cc *CnController) buildPodTemplate(ctx context.Context, object srobject.St
Ports: pod.Ports(cnSpec, config),
Env: envs,
Resources: cnSpec.ResourceRequirements,
ImagePullPolicy: corev1.PullIfNotPresent,
ImagePullPolicy: cnSpec.GetImagePullPolicy(),
VolumeMounts: volumeMounts,
StartupProbe: pod.StartupProbe(cnSpec.GetStartupProbeFailureSeconds(), webServerPort, pod.HEALTH_API_PATH),
LivenessProbe: pod.LivenessProbe(cnSpec.GetLivenessProbeFailureSeconds(), webServerPort, pod.HEALTH_API_PATH),
Expand Down
2 changes: 1 addition & 1 deletion pkg/subcontrollers/fe/fe_pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (fc *FeController) buildPodTemplate(src *srapi.StarRocksCluster, config map
Env: envs,
Resources: feSpec.ResourceRequirements,
VolumeMounts: volMounts,
ImagePullPolicy: corev1.PullIfNotPresent,
ImagePullPolicy: feSpec.GetImagePullPolicy(),
StartupProbe: pod.StartupProbe(feSpec.GetStartupProbeFailureSeconds(), httpPort, pod.HEALTH_API_PATH),
LivenessProbe: pod.LivenessProbe(feSpec.GetLivenessProbeFailureSeconds(), httpPort, pod.HEALTH_API_PATH),
ReadinessProbe: pod.ReadinessProbe(feSpec.GetReadinessProbeFailureSeconds(), httpPort, pod.HEALTH_API_PATH),
Expand Down
2 changes: 1 addition & 1 deletion pkg/subcontrollers/feproxy/feproxy_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ func (controller *FeProxyController) buildPodTemplate(src *srapi.StarRocksCluste
Image: image,
Ports: pod.Ports(feProxySpec, nil),
Resources: feProxySpec.ResourceRequirements,
ImagePullPolicy: corev1.PullIfNotPresent,
ImagePullPolicy: feProxySpec.GetImagePullPolicy(),
VolumeMounts: volumeMounts,
LivenessProbe: pod.LivenessProbe(feProxySpec.GetLivenessProbeFailureSeconds(), port, "/nginx/health"),
ReadinessProbe: pod.ReadinessProbe(feProxySpec.GetReadinessProbeFailureSeconds(), port, "/nginx/health"),
Expand Down
Loading