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

ValidatingAdmissionPolicy resource support #2576

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

aayushsss1
Copy link
Contributor

Description

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=TestAccXXX'

...

Release Note

Release note for CHANGELOG:

...

References

Closes #2250

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

@BBBmau
Copy link
Contributor

BBBmau commented Aug 29, 2024

Just a heads-up @aayushsss1 since we are currently working on migrating the provider over to the plugin framework we would actually prefer to have this be supported under plugin-framework instead of SDKv2. Let me know if you have any questions, thanks again for picking this up!

@aayushsss1
Copy link
Contributor Author

@BBBmau Understood! Is it very different compared to the earlier SDKv2?

@BBBmau
Copy link
Contributor

BBBmau commented Aug 29, 2024

@BBBmau Understood! Is it very different compared to the earlier SDKv2?

@aayushsss1 You'd want to include the resource in the internal/framework/provider directory.

You can see an example of how this is currently being tested on my fork here: https://github.com/BBBmau/terraform-provider-kubernetes/tree/add-codegen/internal/framework/provider

Some plugin-framework resource docs can also be found here: https://developer.hashicorp.com/terraform/plugin/framework/resources#add-resource-to-provider

While you work on it feel free to reach out for help!

@aayushsss1
Copy link
Contributor Author

@BBBmau Understood! Is it very different compared to the earlier SDKv2?

@aayushsss1 You'd want to include the resource in the internal/framework/provider directory.

You can see an example of how this is currently being tested on my fork here: https://github.com/BBBmau/terraform-provider-kubernetes/tree/add-codegen/internal/framework/provider

Some plugin-framework resource docs can also be found here: https://developer.hashicorp.com/terraform/plugin/framework/resources#add-resource-to-provider

While you work on it feel free to reach out for help!

@BBBmau I just have a small doubt, the metadata schema uses the earlier sdk v2, do I create a new separate metadata schema based on the plugin framework for the validating_admission_policy resource?

@BBBmau
Copy link
Contributor

BBBmau commented Sep 5, 2024

@BBBmau I just have a small doubt, the metadata schema uses the earlier sdk v2, do I create a new separate metadata schema based on the plugin framework for the validating_admission_policy resource?

@aayushsss1 I'm not sure what you're referring to when it comes to the earlier sdk v2, the metadata schema would be implemented the same as how we see it in the linked fork:
https://github.com/BBBmau/terraform-provider-kubernetes/blob/218df7e4bb7d233dd07b5053e089be75cd692f36/internal/framework/provider/appsv1/deployment_schema_gen.go#L25-L85

Let me know if the link answers your question, I could've missed something in regards to metadata schema uses the earlier sdkv2

@aayushsss1
Copy link
Contributor Author

@BBBmau I just have a small doubt, the metadata schema uses the earlier sdk v2, do I create a new separate metadata schema based on the plugin framework for the validating_admission_policy resource?

@aayushsss1 I'm not sure what you're referring to when it comes to the earlier sdk v2, the metadata schema would be implemented the same as how we see it in the linked fork: https://github.com/BBBmau/terraform-provider-kubernetes/blob/218df7e4bb7d233dd07b5053e089be75cd692f36/internal/framework/provider/appsv1/deployment_schema_gen.go#L25-L85

Let me know if the link answers your question, I could've missed something in regards to metadata schema uses the earlier sdkv2

Understood! I was referring to this earlier - https://github.com/hashicorp/terraform-provider-kubernetes/blob/main/kubernetes/schema_metadata.go

@aayushsss1
Copy link
Contributor Author

@BBBmau I've updated the schema in line with the plugin framework. Please have a look at the structure, and let me know if any changes have to be made, I'll get started with the crud and model in the mean time!

},
},
},
"spec": schema.SingleNestedAttribute{
Copy link
Contributor

Choose a reason for hiding this comment

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

this looks to be good, I did notice that it's missing the status block, this can be seen from the api reference: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#validatingadmissionpolicy-v1-admissionregistration-k8s-io

Did you happen to use the code generation tool for this? Be sure to remove _gen from the end of all the files if you didn't use the generation tool.

@@ -1,39 +1,39 @@
module github.com/hashicorp/terraform-provider-kubernetes

go 1.21
Copy link
Contributor

Choose a reason for hiding this comment

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

what's the reason for the change go.mod and go.sum?

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.

add ValidatingAdmissionPolicy resource from k8s v1.28.0
2 participants