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

Add the endpoints data source object

Open Dudesons opened this issue 3 years ago • 2 comments

Signed-off-by: Damien Goldenberg [email protected]

Description

As a Terraform user in some cases I need to read endpoints objects. An example is: I need to set a network policy on an workload and this one need to request the Kubernetes api. In this case the cluster IP doesn't work I need IPs from the endpoints object

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:

KUBE_CONFIG_PATH="~/.kube/config" make testacc TESTARGS='-run=TestAccKubernetesDataSourceEndpoints_basic'
==> Checking that code complies with gofmt requirements...
go vet .
TF_ACC=1 go test "/home/damien/go/src/github.com/hashicorp/terraform-provider-kubernetes/kubernetes" -v -run=TestAccKubernetesDataSourceEndpoints_basic -timeout 3h
=== RUN   TestAccKubernetesDataSourceEndpoints_basic
--- PASS: TestAccKubernetesDataSourceEndpoints_basic (8.73s)
PASS
ok      github.com/hashicorp/terraform-provider-kubernetes/kubernetes   8.764s

Release Note

Release note for CHANGELOG:

NEW:
  * Add `kubernetes_endpoints` data source

References

https://github.com/hashicorp/terraform-provider-kubernetes/issues/1328

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

Dudesons avatar Aug 17 '22 13:08 Dudesons

CLA assistant check
All committers have signed the CLA.

hashicorp-cla avatar Aug 17 '22 13:08 hashicorp-cla

Hi @alexsomesan , sorry to ping you but what is the process or what is missing in my PR to be reviewed and to unlock workflows ?

Dudesons avatar Sep 05 '22 14:09 Dudesons

Hi, @BBBmau @jrhouston (I try with someone else) There is something missing for reviewing this pull request ?

Dudesons avatar Oct 06 '22 08:10 Dudesons

Sorry for the long wait, this somehow fell through the cracks. We're looking into it now and will have feedback for you ASAP.

alexsomesan avatar Oct 06 '22 08:10 alexsomesan

Hi @Dudesons,

Thank you for opening this PR and adding a new data source. There are a few things that are missed in this PR to be ready for merge:

  • Could you please add documentation for a new data source? It will be a new Markdown file in website/docs/d directory.
  • We recently made changes in the release process and now for a PR, we ask you to add a changelog file in .changelog/ directory. In your case, it will be a file .changelog/1805.txt. I will clarify the content of this file in my next comment.

I am still reviewing your code and it looks great in general, with just a few minor changes. I will come back to you with my comments soon.

Thank you for your contribution! 😊

arybolovlev avatar Oct 06 '22 09:10 arybolovlev

For the changelog file, please use the tag feature, something like:

```release-note:feature
New data source: `kubernetes_endpoints_v1`
```

Looking forward to your changes!

arybolovlev avatar Oct 06 '22 09:10 arybolovlev

Hi, @arybolovlev ,

Thank you for your review, I did changes you're requested. There are 2 parts where I still calling the kubernetes_endpoints because the function I'm using from the resource is still with the "old style":

  • https://github.com/hashicorp/terraform-provider-kubernetes/pull/1805/files#diff-f9b10f8d821475b2d654788aa63d2e14e484cd3ead3dee77aff8ac99059cdcebR15
  • https://github.com/hashicorp/terraform-provider-kubernetes/pull/1805/files#diff-f9b10f8d821475b2d654788aa63d2e14e484cd3ead3dee77aff8ac99059cdcebR63

I have a question, in the long term vision this provider wants to use resources with kind and apiVersion instead only the kind ? I ask that because I'm using this provider since 3years now in production and having only the kind to manage was useful for version migration. Maybe one time we had a strange behavior when we had the hpa v2beta2 but not sure

Dudesons avatar Oct 07 '22 07:10 Dudesons

I run test again on my local cluster:

 KUBE_CONFIG_PATH="~/.kube/config" make testacc TESTARGS='-run=TestAccKubernetesDataSourceEndpointsV1_basic'
==> Checking that code complies with gofmt requirements...
go vet .
TF_ACC=1 go test "/home/damien/go/src/github.com/hashicorp/terraform-provider-kubernetes/kubernetes" -v -run=TestAccKubernetesDataSourceEndpointsV1_basic -timeout 3h
=== RUN   TestAccKubernetesDataSourceEndpointsV1_basic
--- PASS: TestAccKubernetesDataSourceEndpointsV1_basic (6.22s)
PASS
ok      github.com/hashicorp/terraform-provider-kubernetes/kubernetes   6.251s

Dudesons avatar Oct 07 '22 07:10 Dudesons

Thank you for your review, I did changes you're requested. There are 2 parts where I still calling the kubernetes_endpoints because the function I'm using from the resource is still with the "old style":

  • https://github.com/hashicorp/terraform-provider-kubernetes/pull/1805/files#diff-f9b10f8d821475b2d654788aa63d2e14e484cd3ead3dee77aff8ac99059cdcebR15
  • https://github.com/hashicorp/terraform-provider-kubernetes/pull/1805/files#diff-f9b10f8d821475b2d654788aa63d2e14e484cd3ead3dee77aff8ac99059cdcebR63

I have a question, in the long term vision this provider wants to use resources with kind and apiVersion instead only the kind ? I ask that because I'm using this provider since 3years now in production and having only the kind to manage was useful for version migration. Maybe one time we had a strange behavior when we had the hpa v2beta2 but not sure

Thank you! I am sorry, I was OOO and just came back.

No worries about resource kubernetes_endpoints, it is fine for now, we will fix that later.

To your question -- yes, that is right, but for backward compatibility, only kind resources have to stay. Although, they refer to the same function as kind + apiVersion.

arybolovlev avatar Oct 25 '22 12:10 arybolovlev

Hi @arybolovlev,

Sorry for the delay, I just did the update

Dudesons avatar Oct 31 '22 11:10 Dudesons

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

github-actions[bot] avatar Dec 02 '22 02:12 github-actions[bot]