terraform-provider-kubernetes icon indicating copy to clipboard operation
terraform-provider-kubernetes copied to clipboard

Feature/job v1 suspend field

Open marsskop opened this issue 10 months ago • 3 comments

Description

Addresses #2631

This Pull Request introduces a suspend field for the KubernetesJobV1 resource.

Changes

  • Added suspend field to the KubernetesJobV1 schema.
  • Implemented validation that suspend and wait_for_completion are not both set to true through CustomizeDiff field in KubernetesJobV1 Resource.
  • Included new field in flattenJobV1Spec, expandJobV1Spec, and patchJobV1Spec, making it a mutable parameter that can be updated in-place.
  • Added two acceptance tests that test job suspension, and validate that both suspend and wait_for_completion cannot be set to true.

Acceptance tests

  • [x] Have you added an acceptance test for the functionality being added?
  • [x] Have you run the acceptance tests on this branch?

Output from acceptance testing:

$ make testacc TESTARGS="-run ^TestAccKubernetesJobV1"
==> Checking that code complies with gofmt requirements...
go vet ./...
TF_ACC=1 go test "/Users/user/personal/terraform-provider-kubernetes/kubernetes" -v -vet=off -run ^TestAccKubernetesJobV1 -parallel 8 -timeout 3h
=== RUN   TestAccKubernetesJobV1_wait_for_completion
=== PAUSE TestAccKubernetesJobV1_wait_for_completion
=== RUN   TestAccKubernetesJobV1_basic
=== PAUSE TestAccKubernetesJobV1_basic
=== RUN   TestAccKubernetesJobV1_update
=== PAUSE TestAccKubernetesJobV1_update
=== RUN   TestAccKubernetesJobV1_ttl_seconds_after_finished
=== PAUSE TestAccKubernetesJobV1_ttl_seconds_after_finished
=== RUN   TestAccKubernetesJobV1_suspend
=== PAUSE TestAccKubernetesJobV1_suspend
=== RUN   TestAccKubernetesJobV1_suspendExpectErrors
=== PAUSE TestAccKubernetesJobV1_suspendExpectErrors
=== CONT  TestAccKubernetesJobV1_wait_for_completion
=== CONT  TestAccKubernetesJobV1_ttl_seconds_after_finished
=== CONT  TestAccKubernetesJobV1_update
=== CONT  TestAccKubernetesJobV1_suspend
=== CONT  TestAccKubernetesJobV1_suspendExpectErrors
=== CONT  TestAccKubernetesJobV1_basic
--- PASS: TestAccKubernetesJobV1_suspendExpectErrors (0.70s)
--- PASS: TestAccKubernetesJobV1_basic (16.96s)
--- PASS: TestAccKubernetesJobV1_ttl_seconds_after_finished (20.88s)
--- PASS: TestAccKubernetesJobV1_suspend (25.33s)
--- PASS: TestAccKubernetesJobV1_wait_for_completion (30.93s)
--- PASS: TestAccKubernetesJobV1_update (45.28s)
PASS
ok      github.com/hashicorp/terraform-provider-kubernetes/kubernetes   46.831s

Release Note

Release note for CHANGELOG:

...

References

  • docs for Job suspension: https://kubernetes.io/docs/concepts/workloads/controllers/job/#suspending-a-job

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

marsskop avatar Feb 03 '25 07:02 marsskop