-
Notifications
You must be signed in to change notification settings - Fork 988
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
Make target pod state / phase configurable #2200
Conversation
return t | ||
} | ||
|
||
return []string{string(v1.PodRunning)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this rather be done with a Default:
or DefaultFunc:
attribute in the schema?
Feels like setting the default here makes it less obvious that there is a default value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might have misunderstood it a bit. This case applies when there is an explicit empty value set by the user.
A Default would be needed to cover the case where the attribute isn't configured at all by the user.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is actually what I have stuck with and ended up with the current solution:
- I can't do
Default: []string{string(corev1.PodRunning)}
. In this case,apply
ends up with the error message saying thatDefault
is not valid for lists or sets. - When I do
Default: string(corev1.PodRunning),
on theElem
level, it doesn't work too. This is whatDefault
documentation says about this Default cannot be used if the Schema is directly an implementation of an Elem field of another Schema, such as trying to set a default value for a TypeList or TypeSet. DefaultFunc
doesn't work too. I triedDefaultFunc: func() (interface{}, error) {return []string{string(corev1.PodRunning)}, nil}
on the List level andDefaultFunc: func() (interface{}, error) {return string(corev1.PodRunning), nil}
on theElem
level. In both cases,d.Get("target_state")
returns an empty slice.
Maybe I miss something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you're missing anything. The List and Set types in the SDK have always had problems with defaults.
Let's just keep it the way you did it then, it also covers the case where target_state
is set to an empty string or nil.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks for taking another look at this.
Is |
<Actions> <action id="60b545e3a7c08156b6118e64d9cdf055bc66d491f519bb73d2490ee2958a6c05"> <h3>Bump Terraform `kubernetes` provider version</h3> <details id="1d9343c012f5434ac9fe8a98135bae3667b399259be16d9b14302ea3bd424a24"> <summary>Update Terraform lock file</summary> <p>"hashicorp/kubernetes" updated from "2.23.0" to "2.23.0" in file ".terraform.lock.hcl"</p> <details> <summary>2.23.0</summary> <pre>Changelog retrieved from:
	https://github.com/hashicorp/terraform-provider-kubernetes/releases/tag/v2.23.0
FEATURES:

* `resource/kubernetes_cron_job_v1`: add a new volume type `ephemeral` to `spec.job_template.spec.template.spec.volume` to support generic ephemeral volumes. [[GH-2199](https://github.com/hashicorp/terraform-provider-kubernetes/issues/2199)]
* `resource/kubernetes_cron_job`: add a new volume type `ephemeral` to `spec.job_template.spec.template.spec.volume` to support generic ephemeral volumes. [[GH-2199](https://github.com/hashicorp/terraform-provider-kubernetes/issues/2199)]
* `resource/kubernetes_daemon_set_v1`: add a new volume type `ephemeral` to `spec.template.spec.volume` to support generic ephemeral volumes. [[GH-2199](https://github.com/hashicorp/terraform-provider-kubernetes/issues/2199)]
* `resource/kubernetes_daemonset`: add a new volume type `ephemeral` to `spec.template.spec..volume` to support generic ephemeral volumes. [[GH-2199](https://github.com/hashicorp/terraform-provider-kubernetes/issues/2199)]
* `resource/kubernetes_deployment_v1`: add a new volume type `ephemeral` to `spec.template.spec.volume` to support generic ephemeral volumes. [[GH-2199](https://github.com/hashicorp/terraform-provider-kubernetes/issues/2199)]
* `resource/kubernetes_deployment`: add a new volume type `ephemeral` to `spec.template.spec.volume` to support generic ephemeral volumes. [[GH-2199](https://github.com/hashicorp/terraform-provider-kubernetes/issues/2199)]
* `resource/kubernetes_job_v1`: add a new volume type `ephemeral` to `spec.template.spec.volume` to support generic ephemeral volumes. [[GH-2199](https://github.com/hashicorp/terraform-provider-kubernetes/issues/2199)]
* `resource/kubernetes_job`: add a new volume type `ephemeral` to `spec.template.spec.volume` to support generic ephemeral volumes. [[GH-2199](https://github.com/hashicorp/terraform-provider-kubernetes/issues/2199)]
* `resource/kubernetes_pod_v1`: add a new volume type `ephemeral` to `spec.volume` to support generic ephemeral volumes. [[GH-2199](https://github.com/hashicorp/terraform-provider-kubernetes/issues/2199)]
* `resource/kubernetes_pod`: add a new volume type `ephemeral` to `spec.volume` to support generic ephemeral volumes. [[GH-2199](https://github.com/hashicorp/terraform-provider-kubernetes/issues/2199)]

ENHANCEMENTS:

* `resource/kubernetes_endpoint_slice_v1`: make attribute `endpoint.condition` optional. If you had previously included an empty block `condition {}` in your configuration, we request you to remove it. Doing so will prevent receiving continuous _"update in-place"_ messages while performing the plan and apply operations. [[GH-2208](https://github.com/hashicorp/terraform-provider-kubernetes/issues/2208)]
* `resource/kubernetes_pod_v1`: add a new attribute `target_state` to specify the Pod phase(s) that indicate whether it was successfully created. [[GH-2200](https://github.com/hashicorp/terraform-provider-kubernetes/issues/2200)]
* `resource/kubernetes_pod`: add a new attribute `target_state` to specify the Pod phase(s) that indicate whether it was successfully created. [[GH-2200](https://github.com/hashicorp/terraform-provider-kubernetes/issues/2200)]

BUG FIXES:

* `resource/kubernetes_manifest`: update flow in `wait` block to fix timeout bug within tf apply where the resource is created and appears in Kubernetes but does not appear in TF state file after deadline. The fix would ensure that the resource has been created in the state file while also tainting the resource requiring the user to make the necessary changes in order for their to not be another timeout error. [[GH-2163](https://github.com/hashicorp/terraform-provider-kubernetes/issues/2163)]

DOCS:

* Fix external broken links in the documentation. [[GH-2221](https://github.com/hashicorp/terraform-provider-kubernetes/issues/2221)]

## Community Contributors 🙌

- @JHeilCoveo made their contribution in hashicorp/terraform-provider-kubernetes#2183 @baumandm made their contribution in hashicorp/terraform-provider-kubernetes#1026 @vastep made their contribution in hashicorp/terraform-provider-kubernetes#2193 @rafed made their contribution in hashicorp/terraform-provider-kubernetes#2214, https://github.com/hashicorp/terraform-provider-kubernetes/pull/2225


</pre> </details> </details> </action> </Actions> --- <table> <tr> <td width="77"> <img src="https://www.updatecli.io/images/updatecli.png" alt="Updatecli logo" width="50" height="50"> </td> <td> <p> Created automatically by <a href="https://www.updatecli.io/">Updatecli</a> </p> <details><summary>Options:</summary> <br /> <p>Most of Updatecli configuration is done via <a href="https://www.updatecli.io/docs/prologue/quick-start/">its manifest(s)</a>.</p> <ul> <li>If you close this pull request, Updatecli will automatically reopen it, the next time it runs.</li> <li>If you close this pull request and delete the base branch, Updatecli will automatically recreate it, erasing all previous commits made.</li> </ul> <p> Feel free to report any issues at <a href="https://github.com/updatecli/updatecli/issues">github.com/updatecli/updatecli</a>.<br /> If you find this tool useful, do not hesitate to star <a href="https://github.com/updatecli/updatecli/stargazers">our GitHub repository</a> as a sign of appreciation, and/or to tell us directly on our <a href="https://matrix.to/#/#Updatecli_community:gitter.im">chat</a>! </p> </details> </td> </tr> </table> Co-authored-by: Jenkins Infra Bot (updatecli) <[email protected]>
Description
Replace Pod resource option
legacy_lifecycle_states
totarget_state
. It allows to specify the Pod phase(s) that indicate whether it was successfully created. Default toRunning
. It allows all 5 currently available phases even though some of them may not be an indication of a successfully created pod.Links:
Acceptance tests
Release Note
Release note for CHANGELOG:
References
Enhance: #2141
Community Note