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 Kubernetes support to Kubernetes v1.24.0 #1911

Merged
merged 3 commits into from
May 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
## Unreleased
(None)

## 3.19.0 (May 3, 2022)
- Update Kubernetes support to Kubernetes v1.24.0 (https://github.com/pulumi/pulumi-kubernetes/pull/1911)

## 3.18.3 (April 21, 2022)
- Fix fetching remote yaml files (https://github.com/pulumi/pulumi-kubernetes/pull/1962)
- Support attach
Expand Down
4 changes: 2 additions & 2 deletions 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/v3
VERSION_PATH := ${PROVIDER_PATH}/pkg/version.Version

KUBE_VERSION ?= v1.23.0
KUBE_VERSION ?= v1.24.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 All @@ -32,7 +32,7 @@ ensure::
cd tests && go mod tidy

k8sgen::
(cd provider && CGO_ENABLED=0 go build -o $(WORKING_DIR)/bin/${CODEGEN} -ldflags "-X ${PROJECT}/${VERSION_PATH}=${VERSION}" ${PROJECT}/${PROVIDER_PATH}/cmd/$(CODEGEN))
(cd provider && CGO_ENABLED=1 go build -o $(WORKING_DIR)/bin/${CODEGEN} -ldflags "-X ${PROJECT}/${VERSION_PATH}=${VERSION}" ${PROJECT}/${PROVIDER_PATH}/cmd/$(CODEGEN))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the github.com/rjeczalik/notify CGO switch is also affecting us here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will need to update goreleaser here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we pull this out and make the fixes to the build system separately rather than getting stuck behind the 1.24.0 release?


schema:: k8sgen
@echo "Generating Pulumi schema..."
Expand Down
1,377 changes: 719 additions & 658 deletions provider/cmd/pulumi-resource-kubernetes/schema.json

Large diffs are not rendered by default.

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
10 changes: 10 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,7 @@ 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 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 +240,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 +296,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
4 changes: 0 additions & 4 deletions sdk/dotnet/Apps/V1/Inputs/DaemonSetUpdateStrategyArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ public class DaemonSetUpdateStrategyArgs : Pulumi.ResourceArgs

/// <summary>
/// Type of daemon set update. Can be "RollingUpdate" or "OnDelete". Default is RollingUpdate.
///
/// Possible enum values:
/// - `"OnDelete"` Replace the old daemons only when it's killed
/// - `"RollingUpdate"` Replace the old daemons by new ones using rolling update i.e replace them on each node one after the other.
/// </summary>
[Input("type")]
public Input<string>? Type { get; set; }
Expand Down
4 changes: 0 additions & 4 deletions sdk/dotnet/Apps/V1/Inputs/DeploymentStrategyArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ public class DeploymentStrategyArgs : Pulumi.ResourceArgs

/// <summary>
/// Type of deployment. Can be "Recreate" or "RollingUpdate". Default is RollingUpdate.
///
/// Possible enum values:
/// - `"Recreate"` Kill all existing pods before creating new ones.
/// - `"RollingUpdate"` Replace the old ReplicaSets by new one using rolling update i.e gradually scale down the old ReplicaSets and scale up the new one.
/// </summary>
[Input("type")]
public Input<string>? Type { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@ namespace Pulumi.Kubernetes.Types.Inputs.Apps.V1
public class RollingUpdateStatefulSetStrategyArgs : Pulumi.ResourceArgs
{
/// <summary>
/// Partition indicates the ordinal at which the StatefulSet should be partitioned. Default value is 0.
/// The maximum number of pods that can be unavailable during the update. Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%). Absolute number is calculated from percentage by rounding up. This can not be 0. Defaults to 1. This field is alpha-level and is only honored by servers that enable the MaxUnavailableStatefulSet feature. The field applies to all pods in the range 0 to Replicas-1. That means if there is any unavailable pod in the range 0 to Replicas-1, it will be counted towards MaxUnavailable.
/// </summary>
[Input("maxUnavailable")]
public InputUnion<int, string>? MaxUnavailable { get; set; }

/// <summary>
/// Partition indicates the ordinal at which the StatefulSet should be partitioned for updates. During a rolling update, all pods from ordinal Replicas-1 to Partition are updated. All pods from ordinal Partition-1 to 0 remain untouched. This is helpful in being able to do a canary based deployment. The default value is 0.
/// </summary>
[Input("partition")]
public Input<int>? Partition { get; set; }
Expand Down
4 changes: 0 additions & 4 deletions sdk/dotnet/Apps/V1/Inputs/StatefulSetSpecArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ public class StatefulSetSpecArgs : Pulumi.ResourceArgs

/// <summary>
/// podManagementPolicy controls how pods are created during initial scale up, when replacing pods on nodes, or when scaling down. The default policy is `OrderedReady`, where pods are created in increasing order (pod-0, then pod-1, etc) and the controller will wait until each pod is ready before continuing. When scaling down, the pods are removed in the opposite order. The alternative policy is `Parallel` which will create pods in parallel to match the desired scale without waiting, and on scale down will delete all pods at once.
///
/// Possible enum values:
/// - `"OrderedReady"` will create pods in strictly increasing order on scale up and strictly decreasing order on scale down, progressing only when the previous pod is ready or terminated. At most one pod will be changed at any time.
/// - `"Parallel"` will create and delete pods as soon as the stateful set replica count is changed, and will not wait for pods to be ready or complete termination.
/// </summary>
[Input("podManagementPolicy")]
public Input<string>? PodManagementPolicy { get; set; }
Expand Down
4 changes: 2 additions & 2 deletions sdk/dotnet/Apps/V1/Inputs/StatefulSetStatusArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ public class StatefulSetStatusArgs : Pulumi.ResourceArgs
/// <summary>
/// Total number of available pods (ready for at least minReadySeconds) targeted by this statefulset. This is a beta field and enabled/disabled by StatefulSetMinReadySeconds feature gate.
/// </summary>
[Input("availableReplicas", required: true)]
public Input<int> AvailableReplicas { get; set; } = null!;
[Input("availableReplicas")]
public Input<int>? AvailableReplicas { get; set; }

/// <summary>
/// collisionCount is the count of hash collisions for the StatefulSet. The StatefulSet controller uses this field as a collision avoidance mechanism when it needs to create the name for the newest ControllerRevision.
Expand Down
4 changes: 0 additions & 4 deletions sdk/dotnet/Apps/V1/Inputs/StatefulSetUpdateStrategyArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ public class StatefulSetUpdateStrategyArgs : Pulumi.ResourceArgs

/// <summary>
/// Type indicates the type of the StatefulSetUpdateStrategy. Default is RollingUpdate.
///
/// Possible enum values:
/// - `"OnDelete"` triggers the legacy behavior. Version tracking and ordered rolling restarts are disabled. Pods are recreated from the StatefulSetSpec when they are manually deleted. When a scale operation is performed with this strategy,specification version indicated by the StatefulSet's currentRevision.
/// - `"RollingUpdate"` indicates that update will be applied to all Pods in the StatefulSet with respect to the StatefulSet ordering constraints. When a scale operation is performed with this strategy, new Pods will be created from the specification version indicated by the StatefulSet's updateRevision.
/// </summary>
[Input("type")]
public Input<string>? Type { get; set; }
Expand Down
4 changes: 0 additions & 4 deletions sdk/dotnet/Apps/V1/Outputs/DaemonSetUpdateStrategy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ public sealed class DaemonSetUpdateStrategy
public readonly Pulumi.Kubernetes.Types.Outputs.Apps.V1.RollingUpdateDaemonSet RollingUpdate;
/// <summary>
/// Type of daemon set update. Can be "RollingUpdate" or "OnDelete". Default is RollingUpdate.
///
/// Possible enum values:
/// - `"OnDelete"` Replace the old daemons only when it's killed
/// - `"RollingUpdate"` Replace the old daemons by new ones using rolling update i.e replace them on each node one after the other.
/// </summary>
public readonly string Type;

Expand Down
4 changes: 0 additions & 4 deletions sdk/dotnet/Apps/V1/Outputs/DeploymentStrategy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ public sealed class DeploymentStrategy
public readonly Pulumi.Kubernetes.Types.Outputs.Apps.V1.RollingUpdateDeployment RollingUpdate;
/// <summary>
/// Type of deployment. Can be "Recreate" or "RollingUpdate". Default is RollingUpdate.
///
/// Possible enum values:
/// - `"Recreate"` Kill all existing pods before creating new ones.
/// - `"RollingUpdate"` Replace the old ReplicaSets by new one using rolling update i.e gradually scale down the old ReplicaSets and scale up the new one.
/// </summary>
public readonly string Type;

Expand Down
12 changes: 10 additions & 2 deletions sdk/dotnet/Apps/V1/Outputs/RollingUpdateStatefulSetStrategy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,21 @@ namespace Pulumi.Kubernetes.Types.Outputs.Apps.V1
public sealed class RollingUpdateStatefulSetStrategy
{
/// <summary>
/// Partition indicates the ordinal at which the StatefulSet should be partitioned. Default value is 0.
/// The maximum number of pods that can be unavailable during the update. Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%). Absolute number is calculated from percentage by rounding up. This can not be 0. Defaults to 1. This field is alpha-level and is only honored by servers that enable the MaxUnavailableStatefulSet feature. The field applies to all pods in the range 0 to Replicas-1. That means if there is any unavailable pod in the range 0 to Replicas-1, it will be counted towards MaxUnavailable.
/// </summary>
public readonly Union<int, string> MaxUnavailable;
/// <summary>
/// Partition indicates the ordinal at which the StatefulSet should be partitioned for updates. During a rolling update, all pods from ordinal Replicas-1 to Partition are updated. All pods from ordinal Partition-1 to 0 remain untouched. This is helpful in being able to do a canary based deployment. The default value is 0.
/// </summary>
public readonly int Partition;

[OutputConstructor]
private RollingUpdateStatefulSetStrategy(int partition)
private RollingUpdateStatefulSetStrategy(
Union<int, string> maxUnavailable,

int partition)
{
MaxUnavailable = maxUnavailable;
Partition = partition;
}
}
Expand Down
4 changes: 0 additions & 4 deletions sdk/dotnet/Apps/V1/Outputs/StatefulSetSpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ public sealed class StatefulSetSpec
public readonly Pulumi.Kubernetes.Types.Outputs.Apps.V1.StatefulSetPersistentVolumeClaimRetentionPolicy PersistentVolumeClaimRetentionPolicy;
/// <summary>
/// podManagementPolicy controls how pods are created during initial scale up, when replacing pods on nodes, or when scaling down. The default policy is `OrderedReady`, where pods are created in increasing order (pod-0, then pod-1, etc) and the controller will wait until each pod is ready before continuing. When scaling down, the pods are removed in the opposite order. The alternative policy is `Parallel` which will create pods in parallel to match the desired scale without waiting, and on scale down will delete all pods at once.
///
/// Possible enum values:
/// - `"OrderedReady"` will create pods in strictly increasing order on scale up and strictly decreasing order on scale down, progressing only when the previous pod is ready or terminated. At most one pod will be changed at any time.
/// - `"Parallel"` will create and delete pods as soon as the stateful set replica count is changed, and will not wait for pods to be ready or complete termination.
/// </summary>
public readonly string PodManagementPolicy;
/// <summary>
Expand Down
4 changes: 0 additions & 4 deletions sdk/dotnet/Apps/V1/Outputs/StatefulSetUpdateStrategy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ public sealed class StatefulSetUpdateStrategy
public readonly Pulumi.Kubernetes.Types.Outputs.Apps.V1.RollingUpdateStatefulSetStrategy RollingUpdate;
/// <summary>
/// Type indicates the type of the StatefulSetUpdateStrategy. Default is RollingUpdate.
///
/// Possible enum values:
/// - `"OnDelete"` triggers the legacy behavior. Version tracking and ordered rolling restarts are disabled. Pods are recreated from the StatefulSetSpec when they are manually deleted. When a scale operation is performed with this strategy,specification version indicated by the StatefulSet's currentRevision.
/// - `"RollingUpdate"` indicates that update will be applied to all Pods in the StatefulSet with respect to the StatefulSet ordering constraints. When a scale operation is performed with this strategy, new Pods will be created from the specification version indicated by the StatefulSet's updateRevision.
/// </summary>
public readonly string Type;

Expand Down
11 changes: 6 additions & 5 deletions sdk/dotnet/Batch/V1/Inputs/CronJobSpecArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ public class CronJobSpecArgs : Pulumi.ResourceArgs
{
/// <summary>
/// Specifies how to treat concurrent executions of a Job. Valid values are: - "Allow" (default): allows CronJobs to run concurrently; - "Forbid": forbids concurrent runs, skipping next run if previous run hasn't finished yet; - "Replace": cancels currently running job and replaces it with a new one
///
/// Possible enum values:
/// - `"Allow"` allows CronJobs to run concurrently.
/// - `"Forbid"` forbids concurrent runs, skipping next run if previous hasn't finished yet.
/// - `"Replace"` cancels currently running job and replaces it with a new one.
/// </summary>
[Input("concurrencyPolicy")]
public Input<string>? ConcurrencyPolicy { get; set; }
Expand Down Expand Up @@ -62,6 +57,12 @@ public class CronJobSpecArgs : Pulumi.ResourceArgs
[Input("suspend")]
public Input<bool>? Suspend { get; set; }

/// <summary>
/// The time zone for the given schedule, see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones. If not specified, this will rely on the time zone of the kube-controller-manager process. ALPHA: This field is in alpha and must be enabled via the `CronJobTimeZone` feature gate.
/// </summary>
[Input("timeZone")]
public Input<string>? TimeZone { get; set; }

public CronJobSpecArgs()
{
}
Expand Down
5 changes: 0 additions & 5 deletions sdk/dotnet/Batch/V1/Inputs/JobConditionArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,6 @@ public class JobConditionArgs : Pulumi.ResourceArgs

/// <summary>
/// Type of job condition, Complete or Failed.
///
/// Possible enum values:
/// - `"Complete"` means the job has completed its execution.
/// - `"Failed"` means the job has failed its execution.
/// - `"Suspended"` means the job has been suspended.
/// </summary>
[Input("type", required: true)]
public Input<string> Type { get; set; } = null!;
Expand Down
4 changes: 1 addition & 3 deletions sdk/dotnet/Batch/V1/Inputs/JobSpecArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class JobSpecArgs : Pulumi.ResourceArgs
///
/// `Indexed` means that the Pods of a Job get an associated completion index from 0 to (.spec.completions - 1), available in the annotation batch.kubernetes.io/job-completion-index. The Job is considered complete when there is one successfully completed Pod for each index. When value is `Indexed`, .spec.completions must be specified and `.spec.parallelism` must be less than or equal to 10^5. In addition, The Pod name takes the form `$(job-name)-$(index)-$(random-string)`, the Pod hostname takes the form `$(job-name)-$(index)`.
///
/// This field is beta-level. More completion modes can be added in the future. If the Job controller observes a mode that it doesn't recognize, the controller skips updates for the Job.
/// More completion modes can be added in the future. If the Job controller observes a mode that it doesn't recognize, which is possible during upgrades due to version skew, the controller skips updates for the Job.
/// </summary>
[Input("completionMode")]
public Input<string>? CompletionMode { get; set; }
Expand Down Expand Up @@ -65,8 +65,6 @@ public class JobSpecArgs : Pulumi.ResourceArgs

/// <summary>
/// Suspend specifies whether the Job controller should create Pods or not. If a Job is created with suspend set to true, no Pods are created by the Job controller. If a Job is suspended after creation (i.e. the flag goes from false to true), the Job controller will delete all active Pods associated with this Job. Users must design their workload to gracefully handle this. Suspending a Job will reset the StartTime field of the Job, effectively resetting the ActiveDeadlineSeconds timer too. Defaults to false.
///
/// This field is beta-level, gated by SuspendJob feature flag (enabled by default).
/// </summary>
[Input("suspend")]
public Input<bool>? Suspend { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion sdk/dotnet/Batch/V1/Inputs/JobStatusArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public InputList<Pulumi.Kubernetes.Types.Inputs.Batch.V1.JobConditionArgs> Condi
/// <summary>
/// The number of pods which have a Ready condition.
///
/// This field is alpha-level. The job controller populates the field when the feature gate JobReadyPods is enabled (disabled by default).
/// This field is beta-level. The job controller populates the field when the feature gate JobReadyPods is enabled (enabled by default).
/// </summary>
[Input("ready")]
public Input<int>? Ready { get; set; }
Expand Down
Loading