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

Update deprecated/removed resource warnings #1135

Merged
merged 11 commits into from
May 20, 2020
Merged
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

### Improvements

- Update deprecated/removed resource warnings. (https://github.com/pulumi/pulumi-kubernetes/pull/1135)
- Update to client-go 1.18. (https://github.com/pulumi/pulumi-kubernetes/pull/1136)

## 2.2.0 (May 15, 2020)
Expand Down
77 changes: 45 additions & 32 deletions provider/pkg/kinds/deprecated.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,24 @@ import (
// extensions/v1beta1/ReplicaSet / 1.14 / 1.16
// apps/v1beta1/ReplicaSet / 1.14 / 1.16
// apps/v1beta2/ReplicaSet / 1.14 / 1.16
// https://git.k8s.io/kubernetes/CHANGELOG-1.14.md#deprecations
// https://git.k8s.io/kubernetes/CHANGELOG/CHANGELOG-1.14.md#deprecations
//
// scheduling/v1alpha1/PriorityClass / 1.14 / 1.17
// scheduling/v1beta1/PriorityClass / 1.14 / 1.17
// https://git.k8s.io/kubernetes/CHANGELOG-1.14.md#deprecations
// https://git.k8s.io/kubernetes/CHANGELOG/CHANGELOG-1.14.md#deprecations
//
// extensions/v1beta1/Ingress / 1.14 / 1.18
// https://git.k8s.io/kubernetes/CHANGELOG-1.14.md#deprecations
// https://git.k8s.io/kubernetes/CHANGELOG/CHANGELOG-1.14.md#deprecations
//
// admissionregistration/v1beta1/* / 1.16 / 1.19
// apiextensions/v1beta1/CustomResourceDefinition / 1.16 / 1.19
// https://git.k8s.io/kubernetes/CHANGELOG/CHANGELOG-1.16.md#deprecations-and-removals
//
// rbac/v1alpha1/* / 1.17 / 1.20
// rbac/v1beta1/* / 1.17 / 1.20
// https://git.k8s.io/kubernetes/CHANGELOG-1.17.md#deprecations-and-removals
// https://git.k8s.io/kubernetes/CHANGELOG/CHANGELOG-1.17.md#deprecations-and-removals
//
// TODO: Keep updating this list on every release.

func gvkStr(gvk schema.GroupVersionKind) string {
return gvk.GroupVersion().String() + "/" + gvk.Kind
Expand All @@ -65,21 +71,22 @@ func DeprecatedAPIVersion(gvk schema.GroupVersionKind) bool {
func RemovedInVersion(gvk schema.GroupVersionKind) *cluster.ServerVersion {
var removedIn cluster.ServerVersion

switch gvk.GroupVersion() {
case schema.GroupVersion{Group: "extensions", Version: "v1beta1"},
schema.GroupVersion{Group: "apps", Version: "v1beta1"},
schema.GroupVersion{Group: "apps", Version: "v1beta2"}:
gv, k := groupVersion(gvk.GroupVersion().String()), Kind(gvk.Kind)

if gvk.Kind == "Ingress" {
switch gv {
case AdmissionregistrationV1B1:
removedIn = cluster.ServerVersion{Major: 1, Minor: 19}
case ApiextensionsV1B1:
removedIn = cluster.ServerVersion{Major: 1, Minor: 19}
case ExtensionsV1B1, AppsV1B1, AppsV1B2:
if k == Ingress {
removedIn = cluster.ServerVersion{Major: 1, Minor: 20}
} else {
removedIn = cluster.ServerVersion{Major: 1, Minor: 16}
}
case schema.GroupVersion{Group: "rbac", Version: "v1beta1"},
schema.GroupVersion{Group: "rbac", Version: "v1alpha1"}:
case RbacV1A1, RbacV1B1:
removedIn = cluster.ServerVersion{Major: 1, Minor: 20}
case schema.GroupVersion{Group: "scheduling", Version: "v1beta1"},
schema.GroupVersion{Group: "scheduling", Version: "v1alpha1"}:
case SchedulingV1A1, SchedulingV1B1:
removedIn = cluster.ServerVersion{Major: 1, Minor: 17}
default:
return nil
Expand All @@ -102,33 +109,36 @@ func RemovedAPIVersion(gvk schema.GroupVersionKind, version cluster.ServerVersio
// SuggestedAPIVersion returns a string with the suggested apiVersion for a given GVK.
// This is used to provide useful warning messages when a user creates a resource using a deprecated GVK.
func SuggestedAPIVersion(gvk schema.GroupVersionKind) string {
switch gvk.GroupVersion() {
case schema.GroupVersion{Group: "apps", Version: "v1beta1"},
schema.GroupVersion{Group: "apps", Version: "v1beta2"}:
return "apps/v1/" + gvk.Kind
case schema.GroupVersion{Group: "extensions", Version: "v1beta1"}:
switch Kind(gvk.Kind) {
gv, k := groupVersion(gvk.GroupVersion().String()), Kind(gvk.Kind)

gvkFmt := `%s/%s`

switch gv {
case ApiextensionsV1B1:
return fmt.Sprintf(gvkFmt, ApiextensionsV1, k)
case AppsV1B1, AppsV1B2:
return fmt.Sprintf(gvkFmt, AppsV1, k)
case ExtensionsV1B1:
switch k {
case DaemonSet, Deployment, ReplicaSet:
return "apps/v1/" + gvk.Kind
return fmt.Sprintf(gvkFmt, AppsV1, k)
case Ingress:
return "networking/v1beta1/" + gvk.Kind
return fmt.Sprintf(gvkFmt, NetworkingV1B1, k)
case NetworkPolicy:
return "networking/v1/" + gvk.Kind
return fmt.Sprintf(gvkFmt, NetworkingV1, k)
case PodSecurityPolicy:
return "policy/v1beta1/" + gvk.Kind
return fmt.Sprintf(gvkFmt, PolicyV1B1, k)
default:
return gvkStr(gvk)
}
case schema.GroupVersion{Group: "rbac", Version: "v1beta1"},
schema.GroupVersion{Group: "rbac", Version: "v1alpha1"}:
return "rbac/v1/" + gvk.Kind
case schema.GroupVersion{Group: "scheduling", Version: "v1beta1"},
schema.GroupVersion{Group: "scheduling", Version: "v1alpha1"}:
return "scheduling/v1/" + gvk.Kind
case schema.GroupVersion{Group: "storage", Version: "v1beta1"}:
switch Kind(gvk.Kind) {
case RbacV1A1, RbacV1B1:
return fmt.Sprintf(gvkFmt, RbacV1, k)
case SchedulingV1A1, SchedulingV1B1:
return fmt.Sprintf(gvkFmt, SchedulingV1, k)
case StorageV1B1, "storage/v1beta1": // The storage group was renamed to storage.k8s.io, so check for both.
switch k {
case CSINode:
return "storage/v1/" + gvk.Kind
return fmt.Sprintf(gvkFmt, StorageV1, k)
default:
return gvkStr(gvk)
}
Expand All @@ -144,6 +154,9 @@ func upstreamDocsLink(version cluster.ServerVersion) string {
return "https://git.k8s.io/kubernetes/CHANGELOG/CHANGELOG-1.16.md#deprecations-and-removals"
case cluster.ServerVersion{Major: 1, Minor: 17}:
return "https://git.k8s.io/kubernetes/CHANGELOG/CHANGELOG-1.17.md#deprecations-and-removals"
case cluster.ServerVersion{Major: 1, Minor: 19}:
return "https://git.k8s.io/kubernetes/CHANGELOG/CHANGELOG-1.19.md#deprecation-1"
// TODO: 1.20
default:
return ""
}
Expand Down
40 changes: 20 additions & 20 deletions provider/pkg/kinds/deprecated_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ func TestDeprecatedApiVersion(t *testing.T) {
{GroupVersionKind{Group: "extensions", Version: "v1beta1", Kind: "NetworkPolicy"}, true},
{GroupVersionKind{Group: "extensions", Version: "v1beta1", Kind: "PodSecurityPolicy"}, true},
{GroupVersionKind{Group: "extensions", Version: "v1beta1", Kind: "ReplicaSet"}, true},
{GroupVersionKind{Group: "rbac", Version: "v1alpha1", Kind: "ClusterRole"}, true},
{GroupVersionKind{Group: "rbac", Version: "v1beta1", Kind: "ClusterRole"}, true},
{GroupVersionKind{Group: "rbac.authorization.k8s.io", Version: "v1alpha1", Kind: "ClusterRole"}, true},
{GroupVersionKind{Group: "rbac.authorization.k8s.io", Version: "v1beta1", Kind: "ClusterRole"}, true},
}
for _, tt := range tests {
t.Run(tt.gvk.String(), func(t *testing.T) {
Expand Down Expand Up @@ -68,31 +68,31 @@ func TestSuggestedApiVersion(t *testing.T) {
},
{
GroupVersionKind{Group: "extensions", Version: "v1beta1", Kind: "Ingress"},
"networking/v1beta1/Ingress",
"networking.k8s.io/v1beta1/Ingress",
},
{
GroupVersionKind{Group: "extensions", Version: "v1beta1", Kind: "NetworkPolicy"},
"networking/v1/NetworkPolicy",
"networking.k8s.io/v1/NetworkPolicy",
},
{
GroupVersionKind{Group: "extensions", Version: "v1beta1", Kind: "PodSecurityPolicy"},
"policy/v1beta1/PodSecurityPolicy",
},
{
GroupVersionKind{Group: "rbac", Version: "v1alpha1", Kind: "ClusterRole"},
"rbac/v1/ClusterRole",
GroupVersionKind{Group: "rbac.authorization.k8s.io", Version: "v1alpha1", Kind: "ClusterRole"},
"rbac.authorization.k8s.io/v1/ClusterRole",
},
{
GroupVersionKind{Group: "rbac", Version: "v1beta1", Kind: "ClusterRole"},
"rbac/v1/ClusterRole",
GroupVersionKind{Group: "rbac.authorization.k8s.io", Version: "v1beta1", Kind: "ClusterRole"},
"rbac.authorization.k8s.io/v1/ClusterRole",
},
{
GroupVersionKind{Group: "scheduling", Version: "v1beta1", Kind: "PriorityClass"},
"scheduling/v1/PriorityClass",
GroupVersionKind{Group: "scheduling.k8s.io", Version: "v1beta1", Kind: "PriorityClass"},
"scheduling.k8s.io/v1/PriorityClass",
},
{
GroupVersionKind{Group: "scheduling", Version: "v1alpha1", Kind: "PriorityClass"},
"scheduling/v1/PriorityClass",
GroupVersionKind{Group: "scheduling.k8s.io", Version: "v1alpha1", Kind: "PriorityClass"},
"scheduling.k8s.io/v1/PriorityClass",
},
// Current ApiVersions return the same version string.
{
Expand Down Expand Up @@ -124,17 +124,17 @@ func TestRemovedInVersion(t *testing.T) {
{"extensions/v1beta1:Ingress", args{
GroupVersionKind{Group: "extensions", Version: "v1beta1", Kind: "Ingress"},
}, &cluster.ServerVersion{Major: 1, Minor: 20}},
{"rbac/v1beta1:ClusterRole", args{
GroupVersionKind{Group: "rbac", Version: "v1beta1", Kind: "ClusterRole"},
{"rbac.authorization.k8s.io/v1beta1:ClusterRole", args{
GroupVersionKind{Group: "rbac.authorization.k8s.io", Version: "v1beta1", Kind: "ClusterRole"},
}, &cluster.ServerVersion{Major: 1, Minor: 20}},
{"rbac/v1alpha1:ClusterRole", args{
GroupVersionKind{Group: "rbac", Version: "v1alpha1", Kind: "ClusterRole"},
{"rbac.authorization.k8s.io/v1alpha1:ClusterRole", args{
GroupVersionKind{Group: "rbac.authorization.k8s.io", Version: "v1alpha1", Kind: "ClusterRole"},
}, &cluster.ServerVersion{Major: 1, Minor: 20}},
{"scheduling/v1beta1:PriorityClass", args{
GroupVersionKind{Group: "scheduling", Version: "v1beta1", Kind: "PriorityClass"},
{"scheduling.k8s.io/v1beta1:PriorityClass", args{
GroupVersionKind{Group: "scheduling.k8s.io", Version: "v1beta1", Kind: "PriorityClass"},
}, &cluster.ServerVersion{Major: 1, Minor: 17}},
{"scheduling/v1alpha1:PriorityClass", args{
GroupVersionKind{Group: "scheduling", Version: "v1alpha1", Kind: "PriorityClass"},
{"scheduling.k8s.io/v1alpha1:PriorityClass", args{
GroupVersionKind{Group: "scheduling.k8s.io", Version: "v1alpha1", Kind: "PriorityClass"},
}, &cluster.ServerVersion{Major: 1, Minor: 17}},
}
for _, tt := range tests {
Expand Down
4 changes: 2 additions & 2 deletions sdk/dotnet/Extensions/V1Beta1/Ingress.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
namespace Pulumi.Kubernetes.Extensions.V1Beta1
{
/// <summary>
/// DEPRECATED - extensions/v1beta1/Ingress is deprecated by networking/v1beta1/Ingress and not
/// supported by Kubernetes v1.20+ clusters.
/// DEPRECATED - extensions/v1beta1/Ingress is deprecated by networking.k8s.io/v1beta1/Ingress
/// and not supported by Kubernetes v1.20+ clusters.
///
/// Ingress is a collection of rules that allow inbound connections to reach the endpoints
/// defined by a backend. An Ingress can be configured to give services externally-reachable
Expand Down
2 changes: 1 addition & 1 deletion sdk/dotnet/Storage/V1Beta1/CSINode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
namespace Pulumi.Kubernetes.Storage.V1Beta1
{
/// <summary>
/// DEPRECATED - storage/v1beta1/CSINode is deprecated by storage/v1/CSINode.
/// DEPRECATED - storage/v1beta1/CSINode is deprecated by storage.k8s.io/v1/CSINode.
///
/// CSINode holds information about all CSI drivers installed on a node. CSI drivers do not need
/// to create the CSINode object directly. As long as they use the node-driver-registrar sidecar
Expand Down
6 changes: 3 additions & 3 deletions sdk/dotnet/Types/Input.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21545,8 +21545,8 @@ public InputList<string> Except
}

/// <summary>
/// DEPRECATED - extensions/v1beta1/Ingress is deprecated by networking/v1beta1/Ingress and not
/// supported by Kubernetes v1.20+ clusters.
/// DEPRECATED - extensions/v1beta1/Ingress is deprecated by networking.k8s.io/v1beta1/Ingress
/// and not supported by Kubernetes v1.20+ clusters.
///
/// Ingress is a collection of rules that allow inbound connections to reach the endpoints
/// defined by a backend. An Ingress can be configured to give services externally-reachable
Expand Down Expand Up @@ -29879,7 +29879,7 @@ public InputList<string> VolumeLifecycleModes
}

/// <summary>
/// DEPRECATED - storage/v1beta1/CSINode is deprecated by storage/v1/CSINode.
/// DEPRECATED - storage/v1beta1/CSINode is deprecated by storage.k8s.io/v1/CSINode.
///
/// CSINode holds information about all CSI drivers installed on a node. CSI drivers do not need
/// to create the CSINode object directly. As long as they use the node-driver-registrar sidecar
Expand Down
6 changes: 3 additions & 3 deletions sdk/dotnet/Types/Output.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24616,8 +24616,8 @@ private IPBlock(

}
/// <summary>
/// DEPRECATED - extensions/v1beta1/Ingress is deprecated by networking/v1beta1/Ingress and not
/// supported by Kubernetes v1.20+ clusters.
/// DEPRECATED - extensions/v1beta1/Ingress is deprecated by networking.k8s.io/v1beta1/Ingress
/// and not supported by Kubernetes v1.20+ clusters.
///
/// Ingress is a collection of rules that allow inbound connections to reach the endpoints
/// defined by a backend. An Ingress can be configured to give services externally-reachable
Expand Down Expand Up @@ -33700,7 +33700,7 @@ private CSIDriverSpec(

}
/// <summary>
/// DEPRECATED - storage/v1beta1/CSINode is deprecated by storage/v1/CSINode.
/// DEPRECATED - storage/v1beta1/CSINode is deprecated by storage.k8s.io/v1/CSINode.
///
/// CSINode holds information about all CSI drivers installed on a node. CSI drivers do not need
/// to create the CSINode object directly. As long as they use the node-driver-registrar sidecar
Expand Down
2 changes: 1 addition & 1 deletion sdk/go/kubernetes/extensions/v1beta1/ingress.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
// time out and mark the resource update as Failed. You can override the default timeout value
// by setting the 'customTimeouts' option on the resource.
//
// Deprecated: extensions/v1beta1/Ingress is deprecated by networking/v1beta1/Ingress and not supported by Kubernetes v1.20+ clusters.
// Deprecated: extensions/v1beta1/Ingress is deprecated by networking.k8s.io/v1beta1/Ingress and not supported by Kubernetes v1.20+ clusters.
type Ingress struct {
pulumi.CustomResourceState

Expand Down
2 changes: 1 addition & 1 deletion sdk/go/kubernetes/storage/v1beta1/csinode.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (

// CSINode holds information about all CSI drivers installed on a node. CSI drivers do not need to create the CSINode object directly. As long as they use the node-driver-registrar sidecar container, the kubelet will automatically populate the CSINode object for the CSI driver as part of kubelet plugin registration. CSINode has the same name as a node. If the object is missing, it means either there are no CSI Drivers available on the node, or the Kubelet version is low enough that it doesn't create this object. CSINode has an OwnerReference that points to the corresponding node object.
//
// Deprecated: storage/v1beta1/CSINode is deprecated by storage/v1/CSINode.
// Deprecated: storage/v1beta1/CSINode is deprecated by storage.k8s.io/v1/CSINode.
type CSINode struct {
pulumi.CustomResourceState

Expand Down
4 changes: 2 additions & 2 deletions sdk/nodejs/extensions/v1beta1/Ingress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import { getVersion } from "../../version";
* time out and mark the resource update as Failed. You can override the default timeout value
* by setting the 'customTimeouts' option on the resource.
*
* @deprecated extensions/v1beta1/Ingress is deprecated by networking/v1beta1/Ingress and not
* supported by Kubernetes v1.20+ clusters.
* @deprecated extensions/v1beta1/Ingress is deprecated by networking.k8s.io/v1beta1/Ingress and
* not supported by Kubernetes v1.20+ clusters.
*/
export class Ingress extends pulumi.CustomResource {
/**
Expand Down
2 changes: 1 addition & 1 deletion sdk/nodejs/storage/v1beta1/CSINode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { getVersion } from "../../version";
* version is low enough that it doesn't create this object. CSINode has an OwnerReference that
* points to the corresponding node object.
*
* @deprecated storage/v1beta1/CSINode is deprecated by storage/v1/CSINode.
* @deprecated storage/v1beta1/CSINode is deprecated by storage.k8s.io/v1/CSINode.
*/
export class CSINode extends pulumi.CustomResource {
/**
Expand Down
6 changes: 3 additions & 3 deletions sdk/nodejs/types/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17843,8 +17843,8 @@ export namespace extensions {
* defined by a backend. An Ingress can be configured to give services externally-reachable
* urls, load balance traffic, terminate SSL, offer name based virtual hosting etc.
*
* @deprecated extensions/v1beta1/Ingress is deprecated by networking/v1beta1/Ingress and not
* supported by Kubernetes v1.20+ clusters.
* @deprecated extensions/v1beta1/Ingress is deprecated by networking.k8s.io/v1beta1/Ingress and
* not supported by Kubernetes v1.20+ clusters.
*/
export interface Ingress {
/**
Expand Down Expand Up @@ -24617,7 +24617,7 @@ export namespace storage {
* version is low enough that it doesn't create this object. CSINode has an OwnerReference that
* points to the corresponding node object.
*
* @deprecated storage/v1beta1/CSINode is deprecated by storage/v1/CSINode.
* @deprecated storage/v1beta1/CSINode is deprecated by storage.k8s.io/v1/CSINode.
*/
export interface CSINode {
/**
Expand Down
6 changes: 3 additions & 3 deletions sdk/nodejs/types/output.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17264,8 +17264,8 @@ export namespace extensions {
* defined by a backend. An Ingress can be configured to give services externally-reachable
* urls, load balance traffic, terminate SSL, offer name based virtual hosting etc.
*
* @deprecated extensions/v1beta1/Ingress is deprecated by networking/v1beta1/Ingress and not
* supported by Kubernetes v1.20+ clusters.
* @deprecated extensions/v1beta1/Ingress is deprecated by networking.k8s.io/v1beta1/Ingress and
* not supported by Kubernetes v1.20+ clusters.
*/
export interface Ingress {
/**
Expand Down Expand Up @@ -23673,7 +23673,7 @@ export namespace storage {
* version is low enough that it doesn't create this object. CSINode has an OwnerReference that
* points to the corresponding node object.
*
* @deprecated storage/v1beta1/CSINode is deprecated by storage/v1/CSINode.
* @deprecated storage/v1beta1/CSINode is deprecated by storage.k8s.io/v1/CSINode.
*/
export interface CSINode {
/**
Expand Down
4 changes: 2 additions & 2 deletions sdk/python/pulumi_kubernetes/extensions/v1beta1/Ingress.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

class Ingress(pulumi.CustomResource):
"""
DEPRECATED - extensions/v1beta1/Ingress is deprecated by networking/v1beta1/Ingress and not
supported by Kubernetes v1.20+ clusters.
DEPRECATED - extensions/v1beta1/Ingress is deprecated by networking.k8s.io/v1beta1/Ingress and
not supported by Kubernetes v1.20+ clusters.

Ingress is a collection of rules that allow inbound connections to reach the endpoints defined
by a backend. An Ingress can be configured to give services externally-reachable urls, load
Expand Down
2 changes: 1 addition & 1 deletion sdk/python/pulumi_kubernetes/storage/v1beta1/CSINode.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

class CSINode(pulumi.CustomResource):
"""
DEPRECATED - storage/v1beta1/CSINode is deprecated by storage/v1/CSINode.
DEPRECATED - storage/v1beta1/CSINode is deprecated by storage.k8s.io/v1/CSINode.

CSINode holds information about all CSI drivers installed on a node. CSI drivers do not need to
create the CSINode object directly. As long as they use the node-driver-registrar sidecar
Expand Down
3 changes: 2 additions & 1 deletion tests/integration/go/go_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ func TestGo_YAML(t *testing.T) {
//Dependencies: []string{
// "github.com/pulumi/pulumi-kubernetes/sdk/v2",
//},
Quick: true,
Quick: true,
ExpectRefreshChanges: true,
})
}

Expand Down