Skip to content

Commit

Permalink
Add support for k8s 1.21 (#1449)
Browse files Browse the repository at this point in the history
  • Loading branch information
lblackstone committed Apr 8, 2021
1 parent 8afa202 commit 80656f0
Show file tree
Hide file tree
Showing 276 changed files with 22,154 additions and 1,085 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## HEAD (Unreleased)

## 2.9.0 (April 8, 2021)

- Add support for k8s v1.21.0. (https://github.com/pulumi/pulumi-kubernetes/pull/1449)
- [sdk/go] Fix plugin versioning for invoke calls (https://github.com/pulumi/pulumi-kubernetes/pull/1520)

## 2.8.4 (March 29, 2021)
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ VERSION ?= $(shell pulumictl get version)
PROVIDER_PATH := provider/v2
VERSION_PATH := ${PROVIDER_PATH}/pkg/version.Version

KUBE_VERSION ?= v1.20.0
KUBE_VERSION ?= v1.21.0
SWAGGER_URL ?= https://github.com/kubernetes/kubernetes/raw/${KUBE_VERSION}/api/openapi-spec/swagger.json
OPENAPI_DIR := provider/pkg/gen/openapi-specs
OPENAPI_FILE := ${OPENAPI_DIR}/swagger-${KUBE_VERSION}.json
Expand Down
2,612 changes: 2,182 additions & 430 deletions provider/cmd/pulumi-resource-kubernetes/schema.json

Large diffs are not rendered by default.

52 changes: 51 additions & 1 deletion provider/pkg/kinds/deprecated.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ import (
// storage/v1beta1/* / 1.19 / _
// https://git.k8s.io/kubernetes/CHANGELOG/CHANGELOG-1.19.md#deprecation-1
//
// batch/v2alpha1/CronJob / 1.21 / 1.21
// discovery/v1beta1/EndpointSlice / 1.21 / 1.25
// */PodSecurityPolicy / 1.21 / 1.25
// https://git.k8s.io/kubernetes/CHANGELOG/CHANGELOG-1.21.md#deprecation-1
// TODO: Keep updating this list on every release.

var v18 = cluster.ServerVersion{Major: 1, Minor: 8}
Expand All @@ -79,7 +83,9 @@ var v117 = cluster.ServerVersion{Major: 1, Minor: 17}
var v118 = cluster.ServerVersion{Major: 1, Minor: 18}
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 v125 = cluster.ServerVersion{Major: 1, Minor: 25}

func gvkStr(gvk schema.GroupVersionKind) string {
return gvk.GroupVersion().String() + "/" + gvk.Kind
Expand Down Expand Up @@ -147,6 +153,11 @@ func AddedInVersion(gvk *schema.GroupVersionKind) *cluster.ServerVersion {
case HorizontalPodAutoscaler, HorizontalPodAutoscalerList:
return &v112
}
case BatchV1:
switch k {
case CronJob, CronJobList:
return &v121
}
case CoordinationV1B1:
switch k {
case Lease, LeaseList:
Expand All @@ -157,11 +168,21 @@ func AddedInVersion(gvk *schema.GroupVersionKind) *cluster.ServerVersion {
case Lease, LeaseList:
return &v114
}
case CoreV1:
switch k {
case EphemeralContainers:
return &v121
}
case DiscoveryV1B1:
switch k {
case EndpointSlice, EndpointSliceList:
return &v117
}
case DiscoveryV1:
switch k {
case EndpointSlice, EndpointSliceList:
return &v121
}
case FlowcontrolV1A1:
switch k {
case FlowSchema, FlowSchemaList, PriorityLevelConfiguration, PriorityLevelConfigurationList:
Expand All @@ -184,6 +205,11 @@ func AddedInVersion(gvk *schema.GroupVersionKind) *cluster.ServerVersion {
case PodSecurityPolicy, PodSecurityPolicyList:
return &v110
}
case PolicyV1:
switch k {
case PodDisruptionBudget, PodDisruptionBudgetList:
return &v121
}
case SchedulingV1B1:
switch k {
case PriorityClass, PriorityClassList:
Expand All @@ -194,12 +220,19 @@ func AddedInVersion(gvk *schema.GroupVersionKind) *cluster.ServerVersion {
case PriorityClass, PriorityClassList:
return &v114
}
case StorageV1A1:
switch k {
case CSIStorageCapacity, CSIStorageCapacityList:
return &v121
}
case StorageV1B1:
switch k {
case VolumeAttachment, VolumeAttachmentList:
return &v110
case CSIDriver, CSIDriverList, CSINode, CSINodeList:
return &v114
case CSIStorageCapacity, CSIStorageCapacityList:
return &v121
}
case StorageV1:
switch k {
Expand Down Expand Up @@ -232,6 +265,11 @@ func ExistsInVersion(gvk *schema.GroupVersionKind, version *cluster.ServerVersio
func RemovedInVersion(gvk schema.GroupVersionKind) *cluster.ServerVersion {
gv, k := groupVersion(gvk.GroupVersion().String()), Kind(gvk.Kind)

switch k {
case PodSecurityPolicy, PodSecurityPolicyList:
return &v125
}

switch gv {
case AdmissionregistrationV1B1:
return &v122
Expand All @@ -241,8 +279,12 @@ func RemovedInVersion(gvk schema.GroupVersionKind) *cluster.ServerVersion {
return &v122
case AuthorizationV1B1:
return &v122
case BatchV2A1:
return &v121
case CoordinationV1B1:
return &v122
case DiscoveryV1B1:
return &v125
case ExtensionsV1B1, AppsV1B1, AppsV1B2:
if k == Ingress || k == IngressList {
return &v120
Expand Down Expand Up @@ -290,8 +332,12 @@ func SuggestedAPIVersion(gvk schema.GroupVersionKind) string {
return fmt.Sprintf(gvkFmt, AuthorizationV1, k)
case AutoscalingV2B1:
return fmt.Sprintf(gvkFmt, AutoscalingV1, k)
case BatchV2A1:
return fmt.Sprintf(gvkFmt, BatchV1B1, k) // TODO: update this to batch/v1 at v1.25
case CoordinationV1B1:
return fmt.Sprintf(gvkFmt, CoordinationV1, k)
case DiscoveryV1B1:
return fmt.Sprintf(gvkFmt, DiscoveryV1, k)
case ExtensionsV1B1:
switch k {
case DaemonSet, DaemonSetList, Deployment, DeploymentList, ReplicaSet, ReplicaSetList:
Expand Down Expand Up @@ -325,7 +371,11 @@ func upstreamDocsLink(version cluster.ServerVersion) string {
return "https://git.k8s.io/kubernetes/CHANGELOG/CHANGELOG-1.17.md#deprecations-and-removals"
case v119:
return "https://git.k8s.io/kubernetes/CHANGELOG/CHANGELOG-1.19.md#deprecation-1"
// TODO: 1.20
case v120:
return "https://git.k8s.io/kubernetes/CHANGELOG/CHANGELOG-1.20.md#deprecation"
case v121:
return "https://git.k8s.io/kubernetes/CHANGELOG/CHANGELOG-1.21.md#deprecation"
// TODO: 1.22
default:
return ""
}
Expand Down
8 changes: 8 additions & 0 deletions provider/pkg/kinds/deprecated_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ func TestDeprecatedApiVersion(t *testing.T) {
{toGVK(AuthorizationV1B1, SelfSubjectRulesReview), nil, true},
{toGVK(AuthorizationV1B1, SubjectAccessReview), nil, true},
{toGVK(AutoscalingV2B1, HorizontalPodAutoscaler), nil, true},
{toGVK(BatchV2A1, CronJob), &v121, true},
{toGVK(CoordinationV1B1, Lease), nil, true},
{toGVK(DiscoveryV1B1, EndpointSlice), &v121, true},
{toGVK(ExtensionsV1B1, DaemonSet), nil, true},
{toGVK(ExtensionsV1B1, Deployment), nil, true},
{toGVK(ExtensionsV1B1, Ingress), nil, true},
Expand Down Expand Up @@ -155,7 +157,9 @@ func TestSuggestedApiVersion(t *testing.T) {
{toGVK(AuthenticationV1B1, TokenReview), wantStr(AuthenticationV1, TokenReview)},
{toGVK(AuthorizationV1B1, LocalSubjectAccessReview), wantStr(AuthorizationV1, LocalSubjectAccessReview)},
{toGVK(AutoscalingV2B1, HorizontalPodAutoscaler), wantStr(AutoscalingV1, HorizontalPodAutoscaler)},
{toGVK(BatchV2A1, CronJob), wantStr(BatchV1B1, CronJob)},
{toGVK(CoordinationV1B1, Lease), wantStr(CoordinationV1, Lease)},
{toGVK(DiscoveryV1B1, EndpointSlice), wantStr(DiscoveryV1, EndpointSlice)},
{toGVK(ExtensionsV1B1, DaemonSet), wantStr(AppsV1, DaemonSet)},
{toGVK(ExtensionsV1B1, Deployment), wantStr(AppsV1, Deployment)},
{toGVK(ExtensionsV1B1, DeploymentList), wantStr(AppsV1, DeploymentList)},
Expand Down Expand Up @@ -198,11 +202,15 @@ func TestRemovedInVersion(t *testing.T) {
{toGVK(AppsV1B2, Deployment), &v116},
{toGVK(AuthenticationV1B1, TokenReview), &v122},
{toGVK(AuthorizationV1B1, LocalSubjectAccessReview), &v122},
{toGVK(BatchV2A1, CronJob), &v121},
{toGVK(CoordinationV1B1, Lease), &v122},
{toGVK(DiscoveryV1B1, EndpointSlice), &v125},
{toGVK(ExtensionsV1B1, Deployment), &v116},
{toGVK(ExtensionsV1B1, DeploymentList), &v116},
{toGVK(ExtensionsV1B1, Ingress), &v120},
{toGVK(ExtensionsV1B1, IngressList), &v120},
{toGVK(ExtensionsV1B1, PodSecurityPolicy), &v125},
{toGVK(PolicyV1B1, PodSecurityPolicy), &v125},
{toGVK(RbacV1A1, ClusterRole), &v122},
{toGVK(RbacV1B1, ClusterRole), &v122},
{toGVK(SchedulingV1A1, PriorityClass), &v117},
Expand Down
5 changes: 5 additions & 0 deletions provider/pkg/kinds/kinds.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ const (
CSIDriverList Kind = "CSIDriverList"
CSINode Kind = "CSINode"
CSINodeList Kind = "CSINodeList"
CSIStorageCapacity Kind = "CSIStorageCapacity"
CSIStorageCapacityList Kind = "CSIStorageCapacityList"
CertificateSigningRequest Kind = "CertificateSigningRequest"
CertificateSigningRequestList Kind = "CertificateSigningRequestList"
ClusterRole Kind = "ClusterRole"
Expand All @@ -58,6 +60,7 @@ const (
EndpointSliceList Kind = "EndpointSliceList"
Endpoints Kind = "Endpoints"
EndpointsList Kind = "EndpointsList"
EphemeralContainers Kind = "EphemeralContainers"
Event Kind = "Event"
EventList Kind = "EventList"
FlowSchema Kind = "FlowSchema"
Expand Down Expand Up @@ -229,6 +232,7 @@ const (
CoordinationV1 groupVersion = "coordination.k8s.io/v1"
CoordinationV1B1 groupVersion = "coordination.k8s.io/v1beta1"
CoreV1 groupVersion = "core/v1"
DiscoveryV1 groupVersion = "discovery.k8s.io/v1"
DiscoveryV1B1 groupVersion = "discovery.k8s.io/v1beta1"
EventsV1 groupVersion = "events.k8s.io/v1"
EventsV1B1 groupVersion = "events.k8s.io/v1beta1"
Expand All @@ -241,6 +245,7 @@ const (
NodeV1 groupVersion = "node.k8s.io/v1"
NodeV1A1 groupVersion = "node.k8s.io/v1alpha1"
NodeV1B1 groupVersion = "node.k8s.io/v1beta1"
PolicyV1 groupVersion = "policy/v1"
PolicyV1B1 groupVersion = "policy/v1beta1"
RbacV1 groupVersion = "rbac.authorization.k8s.io/v1"
RbacV1A1 groupVersion = "rbac.authorization.k8s.io/v1alpha1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public InputList<Pulumi.Kubernetes.Types.Inputs.AdmissionRegistration.V1.RuleWit
}

/// <summary>
/// SideEffects states whether this webhook has side effects. Acceptable values are: None, NoneOnDryRun (webhooks created via v1beta1 may also specify Some or Unknown). Webhooks with side effects MUST implement a reconciliation system, since a request may be rejected by a future step in the admission change and the side effects therefore need to be undone. Requests with the dryRun attribute will be auto-rejected if they match a webhook with sideEffects == Unknown or Some.
/// SideEffects states whether this webhook has side effects. Acceptable values are: None, NoneOnDryRun (webhooks created via v1beta1 may also specify Some or Unknown). Webhooks with side effects MUST implement a reconciliation system, since a request may be rejected by a future step in the admission chain and the side effects therefore need to be undone. Requests with the dryRun attribute will be auto-rejected if they match a webhook with sideEffects == Unknown or Some.
/// </summary>
[Input("sideEffects", required: true)]
public Input<string> SideEffects { get; set; } = null!;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public InputList<Pulumi.Kubernetes.Types.Inputs.AdmissionRegistration.V1.RuleWit
}

/// <summary>
/// SideEffects states whether this webhook has side effects. Acceptable values are: None, NoneOnDryRun (webhooks created via v1beta1 may also specify Some or Unknown). Webhooks with side effects MUST implement a reconciliation system, since a request may be rejected by a future step in the admission change and the side effects therefore need to be undone. Requests with the dryRun attribute will be auto-rejected if they match a webhook with sideEffects == Unknown or Some.
/// SideEffects states whether this webhook has side effects. Acceptable values are: None, NoneOnDryRun (webhooks created via v1beta1 may also specify Some or Unknown). Webhooks with side effects MUST implement a reconciliation system, since a request may be rejected by a future step in the admission chain and the side effects therefore need to be undone. Requests with the dryRun attribute will be auto-rejected if they match a webhook with sideEffects == Unknown or Some.
/// </summary>
[Input("sideEffects", required: true)]
public Input<string> SideEffects { get; set; } = null!;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public sealed class MutatingWebhook
/// </summary>
public readonly ImmutableArray<Pulumi.Kubernetes.Types.Outputs.AdmissionRegistration.V1.RuleWithOperations> Rules;
/// <summary>
/// SideEffects states whether this webhook has side effects. Acceptable values are: None, NoneOnDryRun (webhooks created via v1beta1 may also specify Some or Unknown). Webhooks with side effects MUST implement a reconciliation system, since a request may be rejected by a future step in the admission change and the side effects therefore need to be undone. Requests with the dryRun attribute will be auto-rejected if they match a webhook with sideEffects == Unknown or Some.
/// SideEffects states whether this webhook has side effects. Acceptable values are: None, NoneOnDryRun (webhooks created via v1beta1 may also specify Some or Unknown). Webhooks with side effects MUST implement a reconciliation system, since a request may be rejected by a future step in the admission chain and the side effects therefore need to be undone. Requests with the dryRun attribute will be auto-rejected if they match a webhook with sideEffects == Unknown or Some.
/// </summary>
public readonly string SideEffects;
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public sealed class ValidatingWebhook
/// </summary>
public readonly ImmutableArray<Pulumi.Kubernetes.Types.Outputs.AdmissionRegistration.V1.RuleWithOperations> Rules;
/// <summary>
/// SideEffects states whether this webhook has side effects. Acceptable values are: None, NoneOnDryRun (webhooks created via v1beta1 may also specify Some or Unknown). Webhooks with side effects MUST implement a reconciliation system, since a request may be rejected by a future step in the admission change and the side effects therefore need to be undone. Requests with the dryRun attribute will be auto-rejected if they match a webhook with sideEffects == Unknown or Some.
/// SideEffects states whether this webhook has side effects. Acceptable values are: None, NoneOnDryRun (webhooks created via v1beta1 may also specify Some or Unknown). Webhooks with side effects MUST implement a reconciliation system, since a request may be rejected by a future step in the admission chain and the side effects therefore need to be undone. Requests with the dryRun attribute will be auto-rejected if they match a webhook with sideEffects == Unknown or Some.
/// </summary>
public readonly string SideEffects;
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public InputList<Pulumi.Kubernetes.Types.Inputs.AdmissionRegistration.V1Beta1.Ru
}

/// <summary>
/// SideEffects states whether this webhook has side effects. Acceptable values are: Unknown, None, Some, NoneOnDryRun Webhooks with side effects MUST implement a reconciliation system, since a request may be rejected by a future step in the admission change and the side effects therefore need to be undone. Requests with the dryRun attribute will be auto-rejected if they match a webhook with sideEffects == Unknown or Some. Defaults to Unknown.
/// SideEffects states whether this webhook has side effects. Acceptable values are: Unknown, None, Some, NoneOnDryRun Webhooks with side effects MUST implement a reconciliation system, since a request may be rejected by a future step in the admission chain and the side effects therefore need to be undone. Requests with the dryRun attribute will be auto-rejected if they match a webhook with sideEffects == Unknown or Some. Defaults to Unknown.
/// </summary>
[Input("sideEffects")]
public Input<string>? SideEffects { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public InputList<Pulumi.Kubernetes.Types.Inputs.AdmissionRegistration.V1Beta1.Ru
}

/// <summary>
/// SideEffects states whether this webhook has side effects. Acceptable values are: Unknown, None, Some, NoneOnDryRun Webhooks with side effects MUST implement a reconciliation system, since a request may be rejected by a future step in the admission change and the side effects therefore need to be undone. Requests with the dryRun attribute will be auto-rejected if they match a webhook with sideEffects == Unknown or Some. Defaults to Unknown.
/// SideEffects states whether this webhook has side effects. Acceptable values are: Unknown, None, Some, NoneOnDryRun Webhooks with side effects MUST implement a reconciliation system, since a request may be rejected by a future step in the admission chain and the side effects therefore need to be undone. Requests with the dryRun attribute will be auto-rejected if they match a webhook with sideEffects == Unknown or Some. Defaults to Unknown.
/// </summary>
[Input("sideEffects")]
public Input<string>? SideEffects { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public sealed class MutatingWebhook
/// </summary>
public readonly ImmutableArray<Pulumi.Kubernetes.Types.Outputs.AdmissionRegistration.V1Beta1.RuleWithOperations> Rules;
/// <summary>
/// SideEffects states whether this webhook has side effects. Acceptable values are: Unknown, None, Some, NoneOnDryRun Webhooks with side effects MUST implement a reconciliation system, since a request may be rejected by a future step in the admission change and the side effects therefore need to be undone. Requests with the dryRun attribute will be auto-rejected if they match a webhook with sideEffects == Unknown or Some. Defaults to Unknown.
/// SideEffects states whether this webhook has side effects. Acceptable values are: Unknown, None, Some, NoneOnDryRun Webhooks with side effects MUST implement a reconciliation system, since a request may be rejected by a future step in the admission chain and the side effects therefore need to be undone. Requests with the dryRun attribute will be auto-rejected if they match a webhook with sideEffects == Unknown or Some. Defaults to Unknown.
/// </summary>
public readonly string SideEffects;
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public sealed class ValidatingWebhook
/// </summary>
public readonly ImmutableArray<Pulumi.Kubernetes.Types.Outputs.AdmissionRegistration.V1Beta1.RuleWithOperations> Rules;
/// <summary>
/// SideEffects states whether this webhook has side effects. Acceptable values are: Unknown, None, Some, NoneOnDryRun Webhooks with side effects MUST implement a reconciliation system, since a request may be rejected by a future step in the admission change and the side effects therefore need to be undone. Requests with the dryRun attribute will be auto-rejected if they match a webhook with sideEffects == Unknown or Some. Defaults to Unknown.
/// SideEffects states whether this webhook has side effects. Acceptable values are: Unknown, None, Some, NoneOnDryRun Webhooks with side effects MUST implement a reconciliation system, since a request may be rejected by a future step in the admission chain and the side effects therefore need to be undone. Requests with the dryRun attribute will be auto-rejected if they match a webhook with sideEffects == Unknown or Some. Defaults to Unknown.
/// </summary>
public readonly string SideEffects;
/// <summary>
Expand Down
Loading

0 comments on commit 80656f0

Please sign in to comment.