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

Switch to namespace-aware metadata for cron jobtemplate and sts template #2362

Merged

Conversation

wonko
Copy link
Contributor

@wonko wonko commented Dec 5, 2023

Description

Switches the metadata schema to include namespace:

  • jobTemplate for kubernetes_cron_job_v1
  • template for kubernetes_stateful_set_v1

Tests made to the best of my understanding ...

Acceptance tests

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

Output from acceptance testing:

➜ make testacc TESTARGS='-run=TestAccKubernetesCronJobV1'      
==> Checking that code complies with gofmt requirements...
go vet .
TF_ACC=1 go test "/Users/bernardgrymonpon/Repos/github.com/hashicorp/terraform-provider-kubernetes/kubernetes" -v -vet=off -run=TestAccKubernetesCronJobV1 -parallel 8 -timeout 3h
=== RUN   TestAccKubernetesCronJobV1_basic
=== PAUSE TestAccKubernetesCronJobV1_basic
=== RUN   TestAccKubernetesCronJobV1_extra
=== PAUSE TestAccKubernetesCronJobV1_extra
=== RUN   TestAccKubernetesCronJobV1Beta1_basic
=== PAUSE TestAccKubernetesCronJobV1Beta1_basic
=== RUN   TestAccKubernetesCronJobV1Beta1_extra
=== PAUSE TestAccKubernetesCronJobV1Beta1_extra
=== CONT  TestAccKubernetesCronJobV1_basic
=== CONT  TestAccKubernetesCronJobV1Beta1_basic
=== CONT  TestAccKubernetesCronJobV1Beta1_extra
=== CONT  TestAccKubernetesCronJobV1_extra
=== NAME  TestAccKubernetesCronJobV1Beta1_basic
    provider_test.go:236: This test does not run on cluster versions 1.25.0 and above
--- SKIP: TestAccKubernetesCronJobV1Beta1_basic (0.02s)
=== NAME  TestAccKubernetesCronJobV1Beta1_extra
    provider_test.go:236: This test does not run on cluster versions 1.25.0 and above
--- SKIP: TestAccKubernetesCronJobV1Beta1_extra (0.02s)
--- PASS: TestAccKubernetesCronJobV1_extra (3.99s)
--- PASS: TestAccKubernetesCronJobV1_basic (3.99s)
PASS
ok      github.com/hashicorp/terraform-provider-kubernetes/kubernetes   4.462s

 
➜ make testacc TESTARGS='-run=TestAccKubernetesStatefulSetV1'
==> Checking that code complies with gofmt requirements...
go vet .
TF_ACC=1 go test "/Users/bernardgrymonpon/Repos/github.com/hashicorp/terraform-provider-kubernetes/kubernetes" -v -vet=off -run=TestAccKubernetesStatefulSetV1 -parallel 8 -timeout 3h
=== RUN   TestAccKubernetesStatefulSetV1_minimal
=== PAUSE TestAccKubernetesStatefulSetV1_minimal
=== RUN   TestAccKubernetesStatefulSetV1_basic
=== PAUSE TestAccKubernetesStatefulSetV1_basic
=== RUN   TestAccKubernetesStatefulSetV1_basic_idempotency
=== PAUSE TestAccKubernetesStatefulSetV1_basic_idempotency
=== RUN   TestAccKubernetesStatefulSetV1_Update
=== PAUSE TestAccKubernetesStatefulSetV1_Update
=== RUN   TestAccKubernetesStatefulSetV1_waitForRollout
=== PAUSE TestAccKubernetesStatefulSetV1_waitForRollout
=== CONT  TestAccKubernetesStatefulSetV1_minimal
=== CONT  TestAccKubernetesStatefulSetV1_Update
=== CONT  TestAccKubernetesStatefulSetV1_basic_idempotency
=== CONT  TestAccKubernetesStatefulSetV1_waitForRollout
=== CONT  TestAccKubernetesStatefulSetV1_basic
--- PASS: TestAccKubernetesStatefulSetV1_minimal (18.37s)
--- PASS: TestAccKubernetesStatefulSetV1_basic (18.78s)
--- PASS: TestAccKubernetesStatefulSetV1_waitForRollout (20.06s)
--- PASS: TestAccKubernetesStatefulSetV1_basic_idempotency (29.11s)
--- PASS: TestAccKubernetesStatefulSetV1_Update (67.25s)
PASS
ok      github.com/hashicorp/terraform-provider-kubernetes/kubernetes   67.726s

Release Note

- Adds `namespace` to `jobTemplate` within `kubernetes_cron_job_v1` specs.
- Adds `namespace` to `template` within `kubernetes_stateful_set_v1` specs.

References

Fixes #2321

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

@wonko wonko requested a review from a team as a code owner December 5, 2023 17:55
@hashicorp-cla
Copy link

hashicorp-cla commented Dec 5, 2023

CLA assistant check
All committers have signed the CLA.

@BBBmau
Copy link
Contributor

BBBmau commented Dec 6, 2023

@wonko Thank you for opening this PR! This addresses the fix that you've mentioned, I'll test this myself today before approving and merging.

The only things that are missing in this PR is the inclusion of a changelog-entry and also fixing some lint errors. This can be fixed by running the command found from the workflow test:

==> Checking acceptance test terraform blocks code with terrafmt...
kubernetes/resource_kubernetes_cron_job_v1_test.go:195
kubernetes/resource_kubernetes_cron_job_v1_test.go:240

Unexpected differences in acceptance test HCL formatting.
make: *** [GNUmakefile:95: tests-lint] Error 1
To see the full differences, run: terrafmt diff ./kubernetes --pattern '*_test.go'
To automatically fix the formatting, run 'make tests-lint-fix' and commit the changes.

Signed-off-by: Bernard Grymonpon <bernard@grymonpon.be>
Signed-off-by: Bernard Grymonpon <bernard@grymonpon.be>
@wonko
Copy link
Contributor Author

wonko commented Dec 7, 2023

addressed both remarks

@BBBmau
Copy link
Contributor

BBBmau commented Dec 7, 2023

Thanks for contributing!

@BBBmau BBBmau merged commit 0d9471d into hashicorp:main Dec 7, 2023
13 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error "Invalid address to set" on kubernetes_cron_job_v1 and kubernetes_stateful_set_v1
3 participants