Skip to content

Commit

Permalink
Address deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
lblackstone committed Apr 21, 2022
1 parent c33e6d5 commit 9e90714
Show file tree
Hide file tree
Showing 12 changed files with 36 additions and 4 deletions.
6 changes: 6 additions & 0 deletions provider/cmd/pulumi-resource-kubernetes/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -46293,6 +46293,9 @@
"aliases": [
{
"type": "kubernetes:storage.k8s.io/v1beta1:CSIStorageCapacity"
},
{
"type": "kubernetes:storage.k8s.io/v1alpha1:CSIStorageCapacity"
}
]
},
Expand Down Expand Up @@ -47195,6 +47198,9 @@
"aliases": [
{
"type": "kubernetes:storage.k8s.io/v1:CSIStorageCapacity"
},
{
"type": "kubernetes:storage.k8s.io/v1alpha1:CSIStorageCapacity"
}
]
},
Expand Down
5 changes: 5 additions & 0 deletions provider/pkg/gen/typegen.go
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,11 @@ func createGroups(definitionsJSON map[string]interface{}) []GroupConfig {
}
results = append(results, aliasString)

switch kind {
case "CSIStorageCapacity":
results = append(results, "kubernetes:storage.k8s.io/v1alpha1:CSIStorageCapacity")
}

// "apiregistration.k8s.io" was previously called "apiregistration", so create aliases for backward compat
if strings.Contains(apiVersion, "apiregistration.k8s.io") {
parts := strings.Split(aliasString, ":")
Expand Down
11 changes: 11 additions & 0 deletions provider/pkg/kinds/deprecated.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ import (
// discovery/v1beta1/EndpointSlice / 1.21 / 1.25
// */PodSecurityPolicy / 1.21 / 1.25
// https://git.k8s.io/kubernetes/CHANGELOG/CHANGELOG-1.21.md#deprecation-1
//
// storage/v1alpha1/CSIStorageCapacity / 1.24 / 1.24
// TODO: Keep updating this list on every release.

var v18 = cluster.ServerVersion{Major: 1, Minor: 8}
Expand All @@ -85,6 +87,8 @@ var v119 = cluster.ServerVersion{Major: 1, Minor: 19}
var v120 = cluster.ServerVersion{Major: 1, Minor: 20}
var v121 = cluster.ServerVersion{Major: 1, Minor: 21}
var v122 = cluster.ServerVersion{Major: 1, Minor: 22}
var v123 = cluster.ServerVersion{Major: 1, Minor: 23}
var v124 = cluster.ServerVersion{Major: 1, Minor: 24}
var v125 = cluster.ServerVersion{Major: 1, Minor: 25}

func gvkStr(gvk schema.GroupVersionKind) string {
Expand Down Expand Up @@ -237,6 +241,8 @@ func AddedInVersion(gvk *schema.GroupVersionKind) *cluster.ServerVersion {
return &v117
case CSIDriver, CSIDriverList:
return &v118
case CSIStorageCapacity, CSIStorageCapacityList:
return &v124
}
}

Expand Down Expand Up @@ -291,6 +297,11 @@ func RemovedInVersion(gvk schema.GroupVersionKind) *cluster.ServerVersion {
return &v122
case SchedulingV1A1, SchedulingV1B1:
return &v117
case StorageV1A1:
if k == CSIStorageCapacity || k == CSIStorageCapacityList {
return &v124
}
return nil
default:
return nil
}
Expand Down
2 changes: 2 additions & 0 deletions provider/pkg/kinds/deprecated_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ func TestDeprecatedApiVersion(t *testing.T) {
{toGVK(RbacV1B1, RoleBinding), nil, true},
{toGVK(SchedulingV1A1, PriorityClass), nil, true},
{toGVK(SchedulingV1B1, PriorityClass), nil, true},
{toGVK(StorageV1A1, CSIStorageCapacity), nil, true},
{toGVK(StorageV1A1, VolumeAttachment), nil, true},
{toGVK(StorageV1B1, CSIDriver), nil, true},
{toGVK(StorageV1B1, CSIDriver), &v118, true},
Expand Down Expand Up @@ -215,6 +216,7 @@ func TestRemovedInVersion(t *testing.T) {
{toGVK(RbacV1B1, ClusterRole), &v122},
{toGVK(SchedulingV1A1, PriorityClass), &v117},
{toGVK(SchedulingV1B1, PriorityClass), &v117},
{toGVK(StorageV1A1, CSIStorageCapacity), &v124},
}
for _, tt := range tests {
t.Run(tt.gvk.String(), func(t *testing.T) {
Expand Down
1 change: 1 addition & 0 deletions sdk/dotnet/Storage/V1/CSIStorageCapacity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ private static CustomResourceOptions MakeResourceOptions(CustomResourceOptions?
Aliases =
{
new Pulumi.Alias { Type = "kubernetes:storage.k8s.io/v1beta1:CSIStorageCapacity"},
new Pulumi.Alias { Type = "kubernetes:storage.k8s.io/v1alpha1:CSIStorageCapacity"},
},
};
var merged = CustomResourceOptions.Merge(defaultOptions, options);
Expand Down
1 change: 1 addition & 0 deletions sdk/dotnet/Storage/V1Beta1/CSIStorageCapacity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ private static CustomResourceOptions MakeResourceOptions(CustomResourceOptions?
Aliases =
{
new Pulumi.Alias { Type = "kubernetes:storage.k8s.io/v1:CSIStorageCapacity"},
new Pulumi.Alias { Type = "kubernetes:storage.k8s.io/v1alpha1:CSIStorageCapacity"},
},
};
var merged = CustomResourceOptions.Merge(defaultOptions, options);
Expand Down
3 changes: 3 additions & 0 deletions sdk/go/kubernetes/storage/v1/csistorageCapacity.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions sdk/go/kubernetes/storage/v1beta1/csistorageCapacity.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion sdk/nodejs/storage/v1/csistorageCapacity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export class CSIStorageCapacity extends pulumi.CustomResource {
resourceInputs["storageClassName"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const aliasOpts = { aliases: [{ type: "kubernetes:storage.k8s.io/v1beta1:CSIStorageCapacity" }] };
const aliasOpts = { aliases: [{ type: "kubernetes:storage.k8s.io/v1beta1:CSIStorageCapacity" }, { type: "kubernetes:storage.k8s.io/v1alpha1:CSIStorageCapacity" }] };
opts = pulumi.mergeOptions(opts, aliasOpts);
super(CSIStorageCapacity.__pulumiType, name, resourceInputs, opts);
}
Expand Down
2 changes: 1 addition & 1 deletion sdk/nodejs/storage/v1beta1/csistorageCapacity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export class CSIStorageCapacity extends pulumi.CustomResource {
resourceInputs["storageClassName"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const aliasOpts = { aliases: [{ type: "kubernetes:storage.k8s.io/v1:CSIStorageCapacity" }] };
const aliasOpts = { aliases: [{ type: "kubernetes:storage.k8s.io/v1:CSIStorageCapacity" }, { type: "kubernetes:storage.k8s.io/v1alpha1:CSIStorageCapacity" }] };
opts = pulumi.mergeOptions(opts, aliasOpts);
super(CSIStorageCapacity.__pulumiType, name, resourceInputs, opts);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ def _internal_init(__self__,
if storage_class_name is None and not opts.urn:
raise TypeError("Missing required property 'storage_class_name'")
__props__.__dict__["storage_class_name"] = storage_class_name
alias_opts = pulumi.ResourceOptions(aliases=[pulumi.Alias(type_="kubernetes:storage.k8s.io/v1beta1:CSIStorageCapacity")])
alias_opts = pulumi.ResourceOptions(aliases=[pulumi.Alias(type_="kubernetes:storage.k8s.io/v1beta1:CSIStorageCapacity"), pulumi.Alias(type_="kubernetes:storage.k8s.io/v1alpha1:CSIStorageCapacity")])
opts = pulumi.ResourceOptions.merge(opts, alias_opts)
super(CSIStorageCapacity, __self__).__init__(
'kubernetes:storage.k8s.io/v1:CSIStorageCapacity',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ def _internal_init(__self__,
if storage_class_name is None and not opts.urn:
raise TypeError("Missing required property 'storage_class_name'")
__props__.__dict__["storage_class_name"] = storage_class_name
alias_opts = pulumi.ResourceOptions(aliases=[pulumi.Alias(type_="kubernetes:storage.k8s.io/v1:CSIStorageCapacity")])
alias_opts = pulumi.ResourceOptions(aliases=[pulumi.Alias(type_="kubernetes:storage.k8s.io/v1:CSIStorageCapacity"), pulumi.Alias(type_="kubernetes:storage.k8s.io/v1alpha1:CSIStorageCapacity")])
opts = pulumi.ResourceOptions.merge(opts, alias_opts)
super(CSIStorageCapacity, __self__).__init__(
'kubernetes:storage.k8s.io/v1beta1:CSIStorageCapacity',
Expand Down

0 comments on commit 9e90714

Please sign in to comment.