furiko-io / furiko

Kubernetes cron and batch job platform
https://furiko.io
Apache License 2.0
483 stars 21 forks source link

fix(webhook): Add default values for parallelism.completionStrategy #88

Closed irvinlim closed 2 years ago

irvinlim commented 2 years ago

Bug Reproduction

Trying to apply the following YAML results in not being able to save:

apiVersion: execution.furiko.io/v1alpha1
kind: JobConfig
metadata:
  name: jobconfig-parallel-sleep
spec:
  concurrency:
    policy: Forbid
  schedule:
    cron:
      expression: "H/15 * * * *"
      timezone: Asia/Singapore
    disabled: false
  template:
    spec:
      parallelism:
        withKeys:
          - "30"
          - "60"
          - "120"
      taskTemplate:
        pod:
          spec:
            containers:
              - name: job-container
                args:
                  - bash
                  - -c
                  - "echo Sleeping for ${task.index_key}; sleep ${task.index_key}"
                image: bash

The following error is displayed:

$ k apply -f jobconfig-parallel-sleep.yaml
The JobConfig "jobconfig-parallel-sleep" is invalid: spec.template.spec.parallelism.completionStrategy: Required value

Bugfix

By right, we should also add default values for JobTemplate in JobConfigSpec. The default value should be set to AllSuccessful.

codecov[bot] commented 2 years ago

Codecov Report

Merging #88 (ad6a910) into main (25d2757) will increase coverage by 0.01%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main      #88      +/-   ##
==========================================
+ Coverage   62.87%   62.88%   +0.01%     
==========================================
  Files         200      200              
  Lines       10334    10342       +8     
==========================================
+ Hits         6497     6504       +7     
- Misses       3489     3490       +1     
  Partials      348      348              
Impacted Files Coverage Δ
pkg/execution/mutation/mutation.go 89.09% <100.00%> (+5.35%) :arrow_up:
...kg/execution/controllers/croncontroller/metrics.go 14.28% <0.00%> (-85.72%) :arrow_down:
pkg/runtime/reconciler/metrics.go 42.10% <0.00%> (-26.32%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 25d2757...ad6a910. Read the comment docs.