-
Notifications
You must be signed in to change notification settings - Fork 988
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into ds-fix-wait-for-rollout
- Loading branch information
Showing
33 changed files
with
469 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```release-note:feature | ||
New data source: `kubernetes_server_version` | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
`persistent_volume_v1`: Support PersistentVolumeLastPhaseTransitionTime feature gate in persistent volume status. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```release-note:improvement | ||
resource/resource_kubernetes_stateful_set_v1: Add support for `min_ready_seconds` | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```release-note:enhancement | ||
`resource/kubernetes_certificate_signing_request_v1`: Add argument `spec.expiration_seconds` | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--- | ||
subcategory: "core/v1" | ||
page_title: "Kubernetes: kubernetes_server_version" | ||
description: |- | ||
Retrieves and parses the server's version (git version). | ||
--- | ||
|
||
# kubernetes_server_version | ||
|
||
This data source reads the versioning information of the server and makes specific attributes available to Terraform. Read more at [version info reference](https://pkg.go.dev/k8s.io/apimachinery/pkg/version#Info) | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Read-Only | ||
|
||
- `build_date` (String) Kubernetes server build date | ||
- `compiler` (String) Compiler used to build Kubernetes | ||
- `git_commit` (String) Git commit SHA | ||
- `git_tree_state` (String) Git commit tree state | ||
- `git_version` (String) Composite version and git commit sha | ||
- `go_version` (String) Go compiler version | ||
- `id` (String) The ID of this resource. | ||
- `major` (String) Major Kubernetes version | ||
- `minor` (String) Minor Kubernetes version | ||
- `platform` (String) Platform | ||
- `version` (String) Composite Kubernetes server version | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
// Copyright (c) HashiCorp, Inc. | ||
// SPDX-License-Identifier: MPL-2.0 | ||
|
||
package kubernetes | ||
|
||
import ( | ||
"context" | ||
|
||
gversion "github.com/hashicorp/go-version" | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag" | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" | ||
) | ||
|
||
func dataSourceKubernetesServerVersion() *schema.Resource { | ||
return &schema.Resource{ | ||
ReadContext: dataSourceKubernetesServerVersionRead, | ||
Description: "This data source reads the versioning information of the server and makes specific attributes available to Terraform. Read more at [version info reference](https://pkg.go.dev/k8s.io/apimachinery/pkg/version#Info)", | ||
Schema: map[string]*schema.Schema{ | ||
"version": { | ||
Type: schema.TypeString, | ||
Description: "Composite Kubernetes server version", | ||
Computed: true, | ||
}, | ||
"build_date": { | ||
Type: schema.TypeString, | ||
Description: "Kubernetes server build date", | ||
Computed: true, | ||
}, | ||
"compiler": { | ||
Type: schema.TypeString, | ||
Description: "Compiler used to build Kubernetes", | ||
Computed: true, | ||
}, | ||
"git_commit": { | ||
Type: schema.TypeString, | ||
Description: "Git commit SHA", | ||
Computed: true, | ||
}, | ||
"git_tree_state": { | ||
Type: schema.TypeString, | ||
Description: "Git commit tree state", | ||
Computed: true, | ||
}, | ||
"git_version": { | ||
Type: schema.TypeString, | ||
Description: "Composite version and git commit sha", | ||
Computed: true, | ||
}, | ||
"major": { | ||
Type: schema.TypeString, | ||
Description: "Major Kubernetes version", | ||
Computed: true, | ||
}, | ||
"minor": { | ||
Type: schema.TypeString, | ||
Description: "Minor Kubernetes version", | ||
Computed: true, | ||
}, | ||
"platform": { | ||
Type: schema.TypeString, | ||
Description: "Platform", | ||
Computed: true, | ||
}, | ||
"go_version": { | ||
Type: schema.TypeString, | ||
Description: "Go compiler version", | ||
Computed: true, | ||
}, | ||
}, | ||
} | ||
} | ||
|
||
func dataSourceKubernetesServerVersionRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { | ||
conn, err := meta.(KubeClientsets).MainClientset() | ||
if err != nil { | ||
return diag.FromErr(err) | ||
} | ||
sv, err := conn.ServerVersion() | ||
if err != nil { | ||
return diag.FromErr(err) | ||
} | ||
|
||
gv, err := gversion.NewVersion(sv.String()) | ||
if err != nil { | ||
return diag.FromErr(err) | ||
} | ||
d.SetId(gv.String()) | ||
d.Set("version", gv.String()) | ||
d.Set("build_date", sv.BuildDate) | ||
d.Set("compiler", sv.Compiler) | ||
d.Set("git_commit", sv.GitCommit) | ||
d.Set("git_tree_state", sv.GitTreeState) | ||
d.Set("git_version", sv.GitVersion) | ||
d.Set("go_version", sv.GoVersion) | ||
d.Set("major", sv.Major) | ||
d.Set("minor", sv.Minor) | ||
d.Set("platform", sv.Platform) | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// Copyright (c) HashiCorp, Inc. | ||
// SPDX-License-Identifier: MPL-2.0 | ||
|
||
package kubernetes | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
gversion "github.com/hashicorp/go-version" | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform" | ||
) | ||
|
||
func TestAccKubernetesDataSourceServerVersion_basic(t *testing.T) { | ||
dataSourceName := "data.kubernetes_server_version.test" | ||
|
||
resource.ParallelTest(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheck(t) }, | ||
ProviderFactories: testAccProviderFactories, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccKubernetesDataSourceServerVersionConfig_basic(), | ||
Check: func(st *terraform.State) error { | ||
meta := testAccProvider.Meta() | ||
if meta == nil { | ||
return fmt.Errorf("Provider not initialized, unable to check cluster version") | ||
} | ||
conn, err := meta.(KubeClientsets).MainClientset() | ||
if err != nil { | ||
return err | ||
} | ||
ver, err := conn.ServerVersion() | ||
if err != nil { | ||
return err | ||
} | ||
gver, err := gversion.NewVersion(ver.String()) | ||
if err != nil { | ||
return err | ||
} | ||
return resource.ComposeAggregateTestCheckFunc( | ||
resource.TestCheckResourceAttr(dataSourceName, "version", gver.String()), | ||
resource.TestCheckResourceAttr(dataSourceName, "build_date", ver.BuildDate), | ||
resource.TestCheckResourceAttr(dataSourceName, "compiler", ver.Compiler), | ||
resource.TestCheckResourceAttr(dataSourceName, "git_commit", ver.GitCommit), | ||
resource.TestCheckResourceAttr(dataSourceName, "git_tree_state", ver.GitTreeState), | ||
resource.TestCheckResourceAttr(dataSourceName, "git_version", ver.GitVersion), | ||
resource.TestCheckResourceAttr(dataSourceName, "major", ver.Major), | ||
resource.TestCheckResourceAttr(dataSourceName, "minor", ver.Minor), | ||
resource.TestCheckResourceAttr(dataSourceName, "platform", ver.Platform), | ||
resource.TestCheckResourceAttr(dataSourceName, "go_version", ver.GoVersion), | ||
)(st) | ||
}, | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
func testAccKubernetesDataSourceServerVersionConfig_basic() string { | ||
return `data "kubernetes_server_version" "test" {}` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.