Skip to content

Commit

Permalink
Merge branch 'hashicorp:main' into validating-admission-policy
Browse files Browse the repository at this point in the history
  • Loading branch information
aayushsss1 authored Nov 18, 2024
2 parents 93654c5 + 507a1f3 commit 2eebbb1
Show file tree
Hide file tree
Showing 38 changed files with 1,049 additions and 187 deletions.
3 changes: 3 additions & 0 deletions .changelog/2592.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
`kubernetes_manifest` - handling "404 Not Found" errors during the deletion of Kubernetes resources, particularly in cases where the resource may have already been deleted by an operator managing the CRD before Terraform attempts to delete it.
```
3 changes: 3 additions & 0 deletions .changelog/2595.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:improvement
resource/kubernetes_deployment_v1: Fix validation of `restart_policy` values
```
3 changes: 3 additions & 0 deletions .changelog/2596.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
Properly handle Kubernetes Jobs with ttl_seconds_after_finished = 0 to prevent unnecessary recreation.
```
3 changes: 3 additions & 0 deletions .changelog/2604.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
Adding the `kubernetes_secret_v1_data` resource to the kubernetes provider. This resource will allow users to manage kubernetes secrets
```
3 changes: 3 additions & 0 deletions .changelog/2612.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
Added `conditions` attribute to `kubernetes_nodes` data source, which will provide detailed node health and status information
```
1 change: 1 addition & 0 deletions .github/workflows/acceptance_test_dfa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
pull_request:
branches:
- main
- v3-major-release
paths:
- "manifest/**/*.go"
- 'kubernetes/**/*.go'
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/acceptance_tests_kind.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ on:
pull_request:
branches:
- main
- v3-major-release
paths:
- 'kubernetes/*.go'
- 'go.mod'
Expand All @@ -41,12 +42,19 @@ jobs:
matrix:
kubernetes_version:
# kind images: https://github.com/kubernetes-sigs/kind/releases (note the images are kind release specific)
- v1.31.2@sha256:33034c0a75dd82b2f2f22bdf0a30ea2a42b2c3547a6d56c52c7ea9c1b5fb89b9
- v1.30.0@sha256:047357ac0cfea04663786a612ba1eaba9702bef25227a794b52890dd8bcd692e
- v1.29.0@sha256:eaa1450915475849a73a9227b8f201df25e55e268e5d619312131292e324d570
- v1.28.0@sha256:b7a4cad12c197af3ba43202d3efe03246b3f0793f162afb40a33c923952d5b31
- v1.27.3@sha256:3966ac761ae0136263ffdb6cfd4db23ef8a83cba8a463690e98317add2c9ba72
- v1.26.6@sha256:6e2d8b28a5b601defe327b98bd1c2d1930b49e5d8c512e1895099e4504007adb
- v1.25.11@sha256:227fa11ce74ea76a0474eeefb84cb75d8dad1b08638371ecf0e86259b35be0c8
- v1.23.17@sha256:59c989ff8a517a93127d4a536e7014d28e235fb3529d9fba91b3951d461edfdb
isMain:
- ${{ contains(github.ref, 'main') }}
exclude:
- isMain: true
kubernetes_version: v1.31.2@sha256:33034c0a75dd82b2f2f22bdf0a30ea2a42b2c3547a6d56c52c7ea9c1b5fb89b9
steps:
- name: Checkout repository
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/check_examples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ on:
push:
branches:
- main
- v3-major-release
paths:
- "_examples/kubernetes_manifest/**"
- "**.go"
pull_request:
branches:
- main
- v3-major-release
paths:
- "_examples/kubernetes_manifest/**"
- "**.go"
Expand Down
64 changes: 32 additions & 32 deletions .github/workflows/documentation-check.yaml
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
name: "Documentation Updates"
# name: "Documentation Updates"

on:
pull_request:
paths:
- 'docs/**'
types: [opened, synchronize, labeled]
# on:
# pull_request:
# paths:
# - 'docs/**'
# types: [opened, synchronize, labeled]

push:
branches:
- main
# push:
# branches:
# - main

jobs:
check-docs:
runs-on: ubuntu-latest
# jobs:
# check-docs:
# runs-on: ubuntu-latest

if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-documentation') }}
# if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-documentation') }}

steps:
- name: Checkout repository
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
# steps:
# - name: Checkout repository
# uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4

- name: Set up Go
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version-file: 'go.mod'
# - name: Set up Go
# uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
# with:
# go-version-file: 'go.mod'

- name: Install tfplugindocs command
run: go install github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs@latest
# - name: Install tfplugindocs command
# run: go install github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs@latest

- name: Run tfplugindocs command
run: tfplugindocs generate
# - name: Run tfplugindocs command
# run: tfplugindocs generate

- name: Check for changes
run: |
git diff --exit-code
# - name: Check for changes
# run: |
# git diff --exit-code

- name: Undocumented changes
run: |
echo "Documentation is not up to date. Please refer to the `Making Changes` in the Contribution Guide on how to properly update documentation."
exit 1
if: failure()
# - name: Undocumented changes
# run: |
# echo 'Documentation is not up to date. Please refer to the `Making Changes` in the Contribution Guide on how to properly update documentation.'
# exit 1
# if: failure()
1 change: 1 addition & 0 deletions .github/workflows/golangci-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
pull_request:
branches:
- main
- v3-major-release
paths:
- '**/*.go'
- '**/go.mod'
Expand Down
16 changes: 14 additions & 2 deletions .github/workflows/manifest_acc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ on:
push:
branches:
- main
- v3-major-release
paths:
- "manifest/**/*.go"
- "manifest/**/go.mod"
pull_request:
branches:
- main
- v3-major-release
paths:
- "manifest/**/*.go"
- "manifest/**/go.mod"
Expand All @@ -27,14 +29,23 @@ jobs:
fail-fast: false
matrix:
kubernetes_version:
# kind images: https://github.com/kubernetes-sigs/kind/releases
# kind images: https://github.com/kubernetes-sigs/kind/releases (note the images are kind release specific)
- v1.31.2@sha256:33034c0a75dd82b2f2f22bdf0a30ea2a42b2c3547a6d56c52c7ea9c1b5fb89b9
- v1.30.0@sha256:047357ac0cfea04663786a612ba1eaba9702bef25227a794b52890dd8bcd692e
- v1.29.0@sha256:eaa1450915475849a73a9227b8f201df25e55e268e5d619312131292e324d570
- v1.28.0@sha256:b7a4cad12c197af3ba43202d3efe03246b3f0793f162afb40a33c923952d5b31
- v1.27.3@sha256:3966ac761ae0136263ffdb6cfd4db23ef8a83cba8a463690e98317add2c9ba72
- v1.26.6@sha256:6e2d8b28a5b601defe327b98bd1c2d1930b49e5d8c512e1895099e4504007adb
- v1.25.11@sha256:227fa11ce74ea76a0474eeefb84cb75d8dad1b08638371ecf0e86259b35be0c8
- v1.23.17@sha256:59c989ff8a517a93127d4a536e7014d28e235fb3529d9fba91b3951d461edfdb
isMain:
- ${{ contains(github.ref, 'main') }}
exclude:
- isMain: true
kubernetes_version: v1.31.2@sha256:33034c0a75dd82b2f2f22bdf0a30ea2a42b2c3547a6d56c52c7ea9c1b5fb89b9

terraform_version:
- 1.9.8
- 1.8.5
- 1.6.6
- 1.5.7
Expand All @@ -43,6 +54,7 @@ jobs:
- 1.2.9
- 1.1.9
- 1.0.11

steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- name: Set up Go
Expand All @@ -52,7 +64,7 @@ jobs:
- name: Setup kind
uses: helm/kind-action@0025e74a8c7512023d06dc019c617aa3cf561fde # v1.10.0
with:
version: v0.20.0
version: v0.21.0
node_image: kindest/node:${{ matrix.kubernetes_version }}
# By default, this action creates a cluster with the name 'chart-testing'
cluster_name: manifest
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/manifest_unit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ on:
push:
branches:
- main
- v3-major-release
paths:
- "manifest/**/*.go"
- "manifest/**/go.mod"
pull_request:
branches:
- main
- v3-major-release
paths:
- "manifest/**/*.go"
- "manifest/**/go.mod"
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/provider_functions_unit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ on:
push:
branches:
- main
- v3-major-release
paths:
- "internal/framework/provider/functions/**/*.go"
pull_request:
branches:
- main
- v3-major-release
paths:
- "internal/framework/provider/functions/**/*.go"
workflow_dispatch:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ on:
push:
branches:
- main
- v3-major-release
pull_request:
branches:
- main
- v3-major-release
paths:
- 'kubernetes/*.go'
workflow_dispatch:
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## 2.33.0 (Oct 10, 2024)

ENHANCEMENTS:

* Add `backoff_per_limit_index` and `max_failed_indexes` fields in `structure_job.go` [[GH-2421](https://github.com/hashicorp/terraform-provider-kubernetes/issues/2421)]
* Added support for `namespace_selector` field in `PodAffinityTerm` to enhance pod affinity and anti-affinity rules, allowing selection of namespaces based on label selectors. [[GH-2577](https://github.com/hashicorp/terraform-provider-kubernetes/issues/2577)]
* `kubernetes_manifest` - handling "404 Not Found" errors during the deletion of Kubernetes resources, particularly in cases where the resource may have already been deleted by an operator managing the CRD before Terraform attempts to delete it. [[GH-2592](https://github.com/hashicorp/terraform-provider-kubernetes/issues/2592)]
* `schema_container.go`: Add VolumeDevices [[GH-2573](https://github.com/hashicorp/terraform-provider-kubernetes/issues/2573)]

## 2.32.0 (Aug 14, 2024)

FEATURES:
Expand Down
44 changes: 23 additions & 21 deletions _about/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ If you want to learn more about developing a Terraform provider, please refer to

[Install](https://go.dev/doc/install) the version of Golang as indicated in the [go.mod](../go.mod) file.

1. Fork this repo
2. Fork this repo

[Fork](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/fork-a-repo) the provider repository and clone it on your computer.

Expand All @@ -23,7 +23,7 @@ If you want to learn more about developing a Terraform provider, please refer to

From now on, we are going to assume that you have a copy of the repository on your computer and work within the `terraform-provider-kubernetes` directory.

1. Prepare a Kubernetes Cluster
3. Prepare a Kubernetes Cluster

While our preference is to use [KinD](https://kind.sigs.k8s.io/) for setting up a Kubernetes cluster for development and test purposes, feel free to opt for the solution that best suits your preferences. Please bear in mind that some acceptance tests might require specific cluster settings, which we maintain in the KinD [configuration file](../.github/config/acceptance_tests_kind_config.yaml).

Expand Down Expand Up @@ -55,30 +55,32 @@ If you want to learn more about developing a Terraform provider, please refer to
This quick guide covers best practices for adding a new Resource.

1. Ensure all dependncies are installed.
1. Add an SDK Client.
1. Add Resource Schema and define attributes [see Kubernetes Documentation](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs). A best and recommended practice is reuse constants from the Kuberentes packages as a default value in an attribute or within a validation function.
1. Scaffold an empty/new resource.
1. Add Acceptance Tests(s) for the resource.
1. Run Acceptance Tests(s) for this resource.
1. Add Documentation for this resource by editing the `.md.tmpl` file to include the appropriate [Data Fields](https://pkg.go.dev/text/template) and executing `tfplugindocs generate` command [see Terraform PluginDocs](https://github.com/hashicorp/terraform-plugin-docs#data-fields) then inspecting the corresponding `.md` file in the `/docs` to see all changes. The Data Fields that are currently apart of the templates are those for the Schema ({{ .SchemaMarkdown }}), Name ({{ .Name }}) and ({{ .Description }}).
1. Execute `make docs-lint` and `make tests-lint` commands
1. Create a Pull Request for your changes.
2. Add an SDK Client.
3. Add Resource Schema and define attributes [see Kubernetes Documentation](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs). A best and recommended practice is reuse constants from the Kuberentes packages as a default value in an attribute or within a validation function.
4. Scaffold an empty/new resource.
5. Add Acceptance Tests(s) for the resource.
6. Run Acceptance Tests(s) for this resource.
7. Add documentation for this resource in the appropriate `docs/resources/<TYPE>_<VERSION>.go.md` file.
<!-- 7. Add Documentation for this resource by editing the `.md.tmpl` file to include the appropriate [Data Fields](https://pkg.go.dev/text/template) and executing `tfplugindocs generate` command [see Terraform PluginDocs](https://github.com/hashicorp/terraform-plugin-docs#data-fields) then inspecting the corresponding `.md` file in the `/docs` to see all changes. The Data Fields that are currently apart of the templates are those for the Schema ({{ .SchemaMarkdown }}), Name ({{ .Name }}) and ({{ .Description }}). -->
8. Execute `make docs-lint` and `make tests-lint` commands
9. Create a Pull Request for your changes.

### Adding a New Data Source

1. Ensure all dependncies are installed.
1. Add an SDK Client.
1. Add Data Source Schema and define attributes [see Kubernetes Documentation](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs).
2. Add an SDK Client.
3. Add Data Source Schema and define attributes [see Kubernetes Documentation](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs).
A best and recommended practice is reuse constants from the Kuberentes packages as a default value in an attribute or within a validation function.
1. Scaffold an empty/new resource.
1. Add Acceptance Tests(s) for the data source.
1. Run Acceptance Tests(s) for this data source.
1. Add Documentation for this data source by editing the `.md.tmpl` file to include the appropriate [Data Fields](https://pkg.go.dev/text/template) and executing `tfplugindocs generate` command [see Terraform PluginDocs](https://github.com/hashicorp/terraform-plugin-docs#data-fields) then inspecting the corresponding `.md` file in the `/docs` to see all changes. The Data Fields that are currently apart of the templates are those for the Schema ({{ .SchemaMarkdown }}), Name ({{ .Name }}) and ({{ .Description }}).
1. Execute `make docs-lint` and `make tests-lint` commands
1. Create a Pull Request for your changes.

### Adding/Editing Documentation
All Documentation is edited in the `.md.tmpl` file. Please note that the `tfplugindocs generate` command should be executed to ensure it is updated and reflected in the `.md` files.
4. Scaffold an empty/new resource.
5. Add Acceptance Tests(s) for the data source.
6. Run Acceptance Tests(s) for this data source.
7. Add documentation for this data source in the appropriate `docs/data-sources/<TYPE>_<VERSION>.md` file.
<!-- 7. Add Documentation for this data source by editing the `.md.tmpl` file to include the appropriate [Data Fields](https://pkg.go.dev/text/template) and executing `tfplugindocs generate` command [see Terraform PluginDocs](https://github.com/hashicorp/terraform-plugin-docs#data-fields) then inspecting the corresponding `.md` file in the `/docs` to see all changes. The Data Fields that are currently apart of the templates are those for the Schema ({{ .SchemaMarkdown }}), Name ({{ .Name }}) and ({{ .Description }}). -->
8. Execute `make docs-lint` and `make tests-lint` commands
9. Create a Pull Request for your changes.

<!-- ### Adding/Editing Documentation
All Documentation is edited in the `.md.tmpl` file. Please note that the `tfplugindocs generate` command should be executed to ensure it is updated and reflected in the `.md` files. -->

## Testing

Expand Down
12 changes: 11 additions & 1 deletion docs/data-sources/nodes.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ Read-Only:
- `allocatable` (Map of String)
- `capacity` (Map of String)
- `node_info` (List of Object) (see [below for nested schema](#nestedobjatt--nodes--status--node_info))

- `conditions` (List of Object) (see [below for nested schema](#nestedobjatt--nodes--status--conditions))
<a id="nestedobjatt--nodes--status--addresses"></a>
### Nested Schema for `nodes.status.addresses`

Expand All @@ -108,7 +108,17 @@ Read-Only:
- `os_image` (String)
- `system_uuid` (String)

<a id="nestedobjatt--nodes--status--conditions"></a>
### Nested Schema for `nodes.status.conditions`

Read-Only:

- `type` (String)
- `status` (String)
- `last_heartbeat_time` (String)
- `last_transition_time` (String)
- `reason` (String)
- `message` (String)



Expand Down
2 changes: 1 addition & 1 deletion docs/resources/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Optional:
Required:

- `metadata` (Block List, Min: 1, Max: 1) Standard pod's metadata. More info: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#metadata (see [below for nested schema](#nestedblock--spec--template--metadata))
- `spec` (Block List, Min: 1, Max: 1) Spec defines the specification of the desired behavior of the deployment. More info: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.9/#deployment-v1-apps (see [below for nested schema](#nestedblock--spec--template--spec))
- `spec` (Block List, Min: 1, Max: 1) Spec defines the specification of the desired behavior of the deployment. More info: https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/deployment-v1/ (see [below for nested schema](#nestedblock--spec--template--spec))

<a id="nestedblock--spec--template--metadata"></a>
### Nested Schema for `spec.template.metadata`
Expand Down
Loading

0 comments on commit 2eebbb1

Please sign in to comment.