Skip to content

Commit

Permalink
fix: imagePullPolicy was ignored (#2222)
Browse files Browse the repository at this point in the history
Signed-off-by: xuqingtan <[email protected]>
  • Loading branch information
missedone authored Oct 8, 2024
1 parent 29ba4e7 commit 7fb14e6
Showing 1 changed file with 16 additions and 19 deletions.
35 changes: 16 additions & 19 deletions internal/controller/sparkapplication/submission.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,30 +197,27 @@ func dependenciesOption(app *v1beta2.SparkApplication) ([]string, error) {

func imageOption(app *v1beta2.SparkApplication) ([]string, error) {
var args []string
if app.Spec.Image == nil || *app.Spec.Image == "" {
return nil, nil
if app.Spec.Image != nil && *app.Spec.Image != "" {
args = append(args,
"--conf",
fmt.Sprintf("%s=%s", common.SparkKubernetesContainerImage, *app.Spec.Image),
)
}
args = append(args,
"--conf",
fmt.Sprintf("%s=%s", common.SparkKubernetesContainerImage, *app.Spec.Image),
)

if app.Spec.ImagePullPolicy == nil || *app.Spec.ImagePullPolicy == "" {
return nil, nil
if app.Spec.ImagePullPolicy != nil && *app.Spec.ImagePullPolicy != "" {
args = append(args,
"--conf",
fmt.Sprintf("%s=%s", common.SparkKubernetesContainerImagePullPolicy, *app.Spec.ImagePullPolicy),
)
}
args = append(args,
"--conf",
fmt.Sprintf("%s=%s", common.SparkKubernetesContainerImagePullPolicy, *app.Spec.ImagePullPolicy),
)

if len(app.Spec.ImagePullSecrets) == 0 {
return nil, nil
if len(app.Spec.ImagePullSecrets) > 0 {
secrets := strings.Join(app.Spec.ImagePullSecrets, ",")
args = append(args,
"--conf",
fmt.Sprintf("%s=%s", common.SparkKubernetesContainerImagePullSecrets, secrets),
)
}
secrets := strings.Join(app.Spec.ImagePullSecrets, ",")
args = append(args,
"--conf",
fmt.Sprintf("%s=%s", common.SparkKubernetesContainerImagePullSecrets, secrets),
)

return args, nil
}
Expand Down

0 comments on commit 7fb14e6

Please sign in to comment.