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

add resource_kubernetes_endpointslice #2086

Merged
merged 29 commits into from
Jun 20, 2023
Merged

add resource_kubernetes_endpointslice #2086

merged 29 commits into from
Jun 20, 2023

Conversation

BBBmau
Copy link
Contributor

@BBBmau BBBmau commented Apr 26, 2023

Description

adds support of resource_kubernetes_endpointslice

Fixes #2050

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 TestAccKubernetesEndpointSlice_basic"
==> Checking that code complies with gofmt requirements...
go vet .
TF_ACC=1 go test "/Users/mau/Dev/terraform-provider-kubernetes/kubernetes" -v -run TestAccKubernetesEndpointSlice_basic -timeout 3h
=== RUN   TestAccKubernetesEndpointSlice_basic
--- PASS: TestAccKubernetesEndpointSlice_basic (11.66s)
PASS
ok      github.com/hashicorp/terraform-provider-kubernetes/kubernetes     12.881s

Release Note

Release note for CHANGELOG:

`kubernetes/resource_kubernetes_endpointslice.go`: Add kubernetes_endpoint_slice resource

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

@github-actions github-actions bot added size/XL and removed size/L labels May 2, 2023
kubernetes/resource_kubernetes_endpointslice.go Outdated Show resolved Hide resolved
kubernetes/resource_kubernetes_endpointslice.go Outdated Show resolved Hide resolved
kubernetes/resource_kubernetes_endpointslice.go Outdated Show resolved Hide resolved
kubernetes/schema_endpointslice.go Outdated Show resolved Hide resolved
kubernetes/provider.go Outdated Show resolved Hide resolved
@BBBmau BBBmau marked this pull request as ready for review June 7, 2023 18:10
@BBBmau BBBmau requested a review from a team as a code owner June 7, 2023 18:10
@BBBmau
Copy link
Contributor Author

BBBmau commented Jun 7, 2023

resource is up and running but found an edge case in the docs

When a port is defined with a nil port value, it indicates "all ports".

also setting the limits on how many ports and addresses a user can set.

@BBBmau BBBmau closed this Jun 7, 2023
@BBBmau BBBmau reopened this Jun 7, 2023
@jrhouston
Copy link
Collaborator

When a port is defined with a nil port value, it indicates "all ports".

This is tricky because the number type doesnt differentiate between 0 and empty, but 0 is a valid value to send for port. We will have to change this attribute to be a string and if the value is "" don't set it in the request payload.

@BBBmau
Copy link
Contributor Author

BBBmau commented Jun 10, 2023

I had to also change app_protocol from Optional to Required due to this error that I came across:

│ Error: Failed to create endpoint_slice because: EndpointSlice.discovery.k8s.io "test" is invalid: [ports[0].appProtocol: Invalid value: "": name part must be non-empty, ports[0].appProtocol: Invalid value: "": name part must consist of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character (e.g. 'MyName',  or 'my.name',  or '123-abc', regex used for validation is '([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]')]
│ 
│   with kubernetes_endpoint_slice_v1.test,
│   on main.tf line 1, in resource "kubernetes_endpoint_slice_v1" "test":
│    1: resource "kubernetes_endpoint_slice_v1" "test" {

Copy link
Collaborator

@jrhouston jrhouston left a comment

Choose a reason for hiding this comment

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

Couple things

kubernetes/resource_kubernetes_endpointslice.go Outdated Show resolved Hide resolved
kubernetes/schema_endpointslice.go Show resolved Hide resolved
kubernetes/structure_endpointslice.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@jrhouston jrhouston left a comment

Choose a reason for hiding this comment

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

I think this one's good to go 🚀

@BBBmau BBBmau merged commit a59120c into main Jun 20, 2023
@BBBmau BBBmau deleted the add-endpointSlice-resource branch June 20, 2023 14:02
BBBmau added a commit that referenced this pull request Jun 22, 2023
* initial resource creation

* initial structures commit

* add flatteners and expanders

* initial create/read functions

* update read function

* add to provider.go

* add finished schema with working tfplan

* fix expand on SliceEndpoints

* update to TypeList

* update to using TypeList

* update endpoints expander

* fix flattener errors

* add expander for objectref and flattener for conditions

* add changelog-entry

* initial tests

* add missing port change check and use proper read function

* get update working as well as adding ForceNew to address_type attribute

* finish endpoint_slice_v1_test.go

* add descriptions to attributes

* add docs

* website-lint-fix

* add validator functions to port, hostname, and addresstype

* add int check

* fix test format

* refactor validate functions

* set to correct port
BBBmau added a commit that referenced this pull request Jun 23, 2023
* add data source and tests

* add docs

* add changelog-entry

* add copyright headers

* make spec block optional

* fix formatting in docs

* update tests

* add changelog-entry

* remove sidebar current

* Fix field_manager attribute name in node_taint docs (#2138)

* bump actions/stale (#2142)

* add `resource_kubernetes_endpointslice` (#2086)

* initial resource creation

* initial structures commit

* add flatteners and expanders

* initial create/read functions

* update read function

* add to provider.go

* add finished schema with working tfplan

* fix expand on SliceEndpoints

* update to TypeList

* update to using TypeList

* update endpoints expander

* fix flattener errors

* add expander for objectref and flattener for conditions

* add changelog-entry

* initial tests

* add missing port change check and use proper read function

* get update working as well as adding ForceNew to address_type attribute

* finish endpoint_slice_v1_test.go

* add descriptions to attributes

* add docs

* website-lint-fix

* add validator functions to port, hostname, and addresstype

* add int check

* fix test format

* refactor validate functions

* set to correct port

* Add `tls_server_name` provider options. (#1638)

* Add `tls_server_name` provider options.

* Restore accidentally removed `client_certificate` parameter.

* Fixed description

* add changelog-entry

---------

Co-authored-by: Mauricio Alvarez Leon <[email protected]>
Co-authored-by: BBBmau <[email protected]>

* Add GHA for running AKS (#2056)

Co-authored-by: Alex Somesan <[email protected]>

* Fix go version in AKS GHA (#2153)

* add v1

* update docs

---------

Co-authored-by: Stano Bocinec <[email protected]>
Co-authored-by: Bartosz Janda <[email protected]>
Co-authored-by: Sheneska Williams <[email protected]>
Co-authored-by: Alex Somesan <[email protected]>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

EndpointSlice Resource
2 participants