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 PodSecurityPolicy removal note in docs #2241

Merged
merged 7 commits into from
Aug 30, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions kubernetes/resource_kubernetes_pod_security_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,34 @@ func resourceKubernetesPodSecurityPolicyCreate(ctx context.Context, d *schema.Re
return diag.FromErr(err)
}

sv, err := serverVersionGreaterThanOrEqual(conn, "1.25.0")
if err != nil {
return diag.FromErr(err)
}
if sv {
return diag.Diagnostics{
diag.Diagnostic{
Severity: diag.Error,
Summary: `"PodSecurityPolicy" was removed for Kubernetes v1.25.0 and above`,
Detail: `Starting from version 1.25.0 Kubernetes has removed PodSecurityPolicy entirely, leading to this resource being left empty.`,
},
}
}

sv, err = serverVersionGreaterThanOrEqual(conn, "1.21.0")
if err != nil {
return diag.FromErr(err)
}
if sv {
return diag.Diagnostics{
BBBmau marked this conversation as resolved.
Show resolved Hide resolved
diag.Diagnostic{
Severity: diag.Warning,
Summary: `"PodSecurityPolicy" was deprecated in Kubernetes v1.21.0`,
Detail: `Starting from version 1.21.0 Kubernetes has deprecated PodSecurityPolicy and has removed it entirely in v1.25.0`,
},
}
}

metadata := expandMetadata(d.Get("metadata").([]interface{}))
spec, err := expandPodSecurityPolicySpec(d.Get("spec").([]interface{}))

Expand Down
2 changes: 2 additions & 0 deletions website/docs/r/pod_security_policy.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ description: |-

A Pod Security Policy is a cluster-level resource that controls security sensitive aspects of the pod specification. The PodSecurityPolicy objects define a set of conditions that a pod must run with in order to be accepted into the system, as well as defaults for the related fields.

~> NOTE: With the release of Kubernetes v1.25, PodSecurityPolicy has been removed. You can read more information about the removal of PodSecurityPolicy in the [Kubernetes 1.25 release notes](https://kubernetes.io/blog/2022/08/23/kubernetes-v1-25-release/#pod-security-changes).

## Example Usage

```hcl
Expand Down
2 changes: 2 additions & 0 deletions website/docs/r/pod_security_policy_v1beta1.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ description: |-

A Pod Security Policy is a cluster-level resource that controls security sensitive aspects of the pod specification. The PodSecurityPolicy objects define a set of conditions that a pod must run with in order to be accepted into the system, as well as defaults for the related fields.

~> NOTE: With the release of Kubernetes v1.25, PodSecurityPolicy has been removed. You can read more information about the removal of PodSecurityPolicy in the [Kubernetes 1.25 release notes](https://kubernetes.io/blog/2022/08/23/kubernetes-v1-25-release/#pod-security-changes).

## Example Usage

```hcl
Expand Down