Skip to content

Conversation

yhrn
Copy link

@yhrn yhrn commented Sep 1, 2025

Rollback Plan

If a change needs to be reverted, we will publish an updated version of the library.

Changes to Security Controls

I'm not sure if this is relevant for this section, but this change would mean that the Terraform user would no longer need CRD related permissions (unless the managed resources includes actual CRDs of course, i.e. addressing #1665).

Description

This PR changes the behavior of kubernetes_manifest schema discovery to prefer the openapi/v3 endpoint over listing CRDs and falling back to openapi/v3. More Info in #2769. I will also add information here once it is decide how this new behavior should be controlled.

Acceptance tests

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

I have not added any acceptance tests because this changes are tested by all the existing manifest acceptance tests.

Output from acceptance testing:

All manifest acceptance tests pass in my local setup against a kind cluster, with the only exception that the CertManager tests fails during cleanup. However, I get excatly the same problem when running the tests on main.

Release Note

Release note for CHANGELOG:

...I will update this once the PR is out of draft and the open questions have been resolved...

References

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

Copy link

hashicorp-cla-app bot commented Sep 1, 2025

CLA assistant check
All committers have signed the CLA.

Copy link

CLA assistant check

Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement

Learn more about why HashiCorp requires a CLA and what the CLA includes


Mattias Öhrn seems not to be a GitHub user.
You need a GitHub account to be able to sign the CLA.
If you have already a GitHub account, please add the email address used for this commit to your account.

Have you signed the CLA already but the status is still pending? Recheck it.

Comment on lines +88 to 90
if oapiV3, err := ps.getOAPIv3Foundry(gvk.GroupVersion()); err == nil {
return getTypeByGVK(gvk, status, oapiV3, "OpenAPI v3")
}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The big open question is how the new behavior would be controlled. Right now it just tries to read from /openapi/v3 and if that fails for any reason it falls back to the old behavior. This is definitely not what we want, but I don't want to spend time implementing something more robust before I know what that is.

Some options:

  1. Similar to now but ensure that the only error that causes fallback to the old behavior is if ´/openapi/v3´ doesn't exist (404, no intermittent errors)
  2. Completely remove the old behavior and say that from now on the provider only works with ´/openapi/v3´. This means that older (and unsupported since 18 months or more) k8s versions would no longer be supported by this provider. This would also make it possible to remove a fair bit on code and complexity from the provider.
  3. Make the behavior configurable through provider configuration.

@yhrn yhrn changed the title Use OpenAPI v3 endopint for manifest schema discovery [Feedback needed] Use OpenAPI v3 endopint for manifest schema discovery Sep 2, 2025
@yhrn yhrn marked this pull request as ready for review September 4, 2025 06:59
@yhrn yhrn requested a review from a team as a code owner September 4, 2025 06:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
1 participant