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 support for k8s 1.20 #1330

Merged
merged 8 commits into from
Dec 8, 2020
Merged
Show file tree
Hide file tree
Changes from 7 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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## HEAD (Unreleased)

## 2.7.4 (December 8, 2020)

- Add support for k8s v1.20.0. (https://github.com/pulumi/pulumi-kubernetes/pull/1330)

## 2.7.3 (December 3, 2020)

- Replace workload resources if any field in `.spec.selector` changes. (https://github.com/pulumi/pulumi-kubernetes/pull/1387)
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.19.0
KUBE_VERSION ?= v1.20.0-rc.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
1,910 changes: 1,733 additions & 177 deletions provider/cmd/pulumi-resource-kubernetes/schema.json

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions provider/pkg/gen/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ func PulumiSchema(swagger map[string]interface{}) pschema.PackageSpec {
definitions := swagger["definitions"].(map[string]interface{})
groupsSlice := createGroups(definitions)
for _, group := range groupsSlice {
if group.Group() == "apiserverinternal" {
continue
}
for _, version := range group.Versions() {
for _, kind := range version.Kinds() {
tok := fmt.Sprintf(`kubernetes:%s:%s`, kind.apiVersion, kind.kind)
Expand Down
2 changes: 2 additions & 0 deletions provider/pkg/kinds/kinds.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,11 @@ const (
EventsV1B1 groupVersion = "events.k8s.io/v1beta1"
ExtensionsV1B1 groupVersion = "extensions/v1beta1"
FlowcontrolV1A1 groupVersion = "flowcontrol.apiserver.k8s.io/v1alpha1"
FlowcontrolV1B1 groupVersion = "flowcontrol.apiserver.k8s.io/v1beta1"
MetaV1 groupVersion = "meta/v1"
NetworkingV1 groupVersion = "networking.k8s.io/v1"
NetworkingV1B1 groupVersion = "networking.k8s.io/v1beta1"
NodeV1 groupVersion = "node.k8s.io/v1"
NodeV1A1 groupVersion = "node.k8s.io/v1alpha1"
NodeV1B1 groupVersion = "node.k8s.io/v1beta1"
PolicyV1B1 groupVersion = "policy/v1beta1"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// *** WARNING: this file was generated by pulumigen. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***

using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
using Pulumi.Serialization;

namespace Pulumi.Kubernetes.Types.Inputs.Autoscaling.V2Beta1
{

/// <summary>
/// ContainerResourceMetricSource indicates how to scale on a resource metric known to Kubernetes, as specified in requests and limits, describing each pod in the current scale target (e.g. CPU or memory). The values will be averaged together before being compared to the target. Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the "pods" source. Only one "target" type should be set.
/// </summary>
public class ContainerResourceMetricSourceArgs : Pulumi.ResourceArgs
{
/// <summary>
/// container is the name of the container in the pods of the scaling target
/// </summary>
[Input("container", required: true)]
public Input<string> Container { get; set; } = null!;

/// <summary>
/// name is the name of the resource in question.
/// </summary>
[Input("name", required: true)]
public Input<string> Name { get; set; } = null!;

/// <summary>
/// targetAverageUtilization is the target value of the average of the resource metric across all relevant pods, represented as a percentage of the requested value of the resource for the pods.
/// </summary>
[Input("targetAverageUtilization")]
public Input<int>? TargetAverageUtilization { get; set; }

/// <summary>
/// targetAverageValue is the target value of the average of the resource metric across all relevant pods, as a raw value (instead of as a percentage of the request), similar to the "pods" metric source type.
/// </summary>
[Input("targetAverageValue")]
public Input<string>? TargetAverageValue { get; set; }

public ContainerResourceMetricSourceArgs()
{
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// *** WARNING: this file was generated by pulumigen. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***

using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
using Pulumi.Serialization;

namespace Pulumi.Kubernetes.Types.Inputs.Autoscaling.V2Beta1
{

/// <summary>
/// ContainerResourceMetricStatus indicates the current value of a resource metric known to Kubernetes, as specified in requests and limits, describing a single container in each pod in the current scale target (e.g. CPU or memory). Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the "pods" source.
/// </summary>
public class ContainerResourceMetricStatusArgs : Pulumi.ResourceArgs
{
/// <summary>
/// container is the name of the container in the pods of the scaling target
/// </summary>
[Input("container", required: true)]
public Input<string> Container { get; set; } = null!;

/// <summary>
/// currentAverageUtilization is the current value of the average of the resource metric across all relevant pods, represented as a percentage of the requested value of the resource for the pods. It will only be present if `targetAverageValue` was set in the corresponding metric specification.
/// </summary>
[Input("currentAverageUtilization")]
public Input<int>? CurrentAverageUtilization { get; set; }

/// <summary>
/// currentAverageValue is the current value of the average of the resource metric across all relevant pods, as a raw value (instead of as a percentage of the request), similar to the "pods" metric source type. It will always be set, regardless of the corresponding metric specification.
/// </summary>
[Input("currentAverageValue", required: true)]
public Input<string> CurrentAverageValue { get; set; } = null!;

/// <summary>
/// name is the name of the resource in question.
/// </summary>
[Input("name", required: true)]
public Input<string> Name { get; set; } = null!;

public ContainerResourceMetricStatusArgs()
{
}
}
}
8 changes: 7 additions & 1 deletion sdk/dotnet/Autoscaling/V2Beta1/Inputs/MetricSpecArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ namespace Pulumi.Kubernetes.Types.Inputs.Autoscaling.V2Beta1
/// </summary>
public class MetricSpecArgs : Pulumi.ResourceArgs
{
/// <summary>
/// container resource refers to a resource metric (such as those specified in requests and limits) known to Kubernetes describing a single container in each pod of the current scale target (e.g. CPU or memory). Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the "pods" source. This is an alpha feature and can be enabled by the HPAContainerMetrics feature flag.
/// </summary>
[Input("containerResource")]
public Input<Pulumi.Kubernetes.Types.Inputs.Autoscaling.V2Beta1.ContainerResourceMetricSourceArgs>? ContainerResource { get; set; }

/// <summary>
/// external refers to a global metric that is not associated with any Kubernetes object. It allows autoscaling based on information coming from components running outside of cluster (for example length of queue in cloud messaging service, or QPS from loadbalancer running outside of cluster).
/// </summary>
Expand All @@ -40,7 +46,7 @@ public class MetricSpecArgs : Pulumi.ResourceArgs
public Input<Pulumi.Kubernetes.Types.Inputs.Autoscaling.V2Beta1.ResourceMetricSourceArgs>? Resource { get; set; }

/// <summary>
/// type is the type of metric source. It should be one of "Object", "Pods" or "Resource", each mapping to a matching field in the object.
/// type is the type of metric source. It should be one of "ContainerResource", "External", "Object", "Pods" or "Resource", each mapping to a matching field in the object. Note: "ContainerResource" type is available on when the feature-gate HPAContainerMetrics is enabled
/// </summary>
[Input("type", required: true)]
public Input<string> Type { get; set; } = null!;
Expand Down
8 changes: 7 additions & 1 deletion sdk/dotnet/Autoscaling/V2Beta1/Inputs/MetricStatusArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ namespace Pulumi.Kubernetes.Types.Inputs.Autoscaling.V2Beta1
/// </summary>
public class MetricStatusArgs : Pulumi.ResourceArgs
{
/// <summary>
/// container resource refers to a resource metric (such as those specified in requests and limits) known to Kubernetes describing a single container in each pod in the current scale target (e.g. CPU or memory). Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the "pods" source.
/// </summary>
[Input("containerResource")]
public Input<Pulumi.Kubernetes.Types.Inputs.Autoscaling.V2Beta1.ContainerResourceMetricStatusArgs>? ContainerResource { get; set; }

/// <summary>
/// external refers to a global metric that is not associated with any Kubernetes object. It allows autoscaling based on information coming from components running outside of cluster (for example length of queue in cloud messaging service, or QPS from loadbalancer running outside of cluster).
/// </summary>
Expand All @@ -40,7 +46,7 @@ public class MetricStatusArgs : Pulumi.ResourceArgs
public Input<Pulumi.Kubernetes.Types.Inputs.Autoscaling.V2Beta1.ResourceMetricStatusArgs>? Resource { get; set; }

/// <summary>
/// type is the type of metric source. It will be one of "Object", "Pods" or "Resource", each corresponds to a matching field in the object.
/// type is the type of metric source. It will be one of "ContainerResource", "External", "Object", "Pods" or "Resource", each corresponds to a matching field in the object. Note: "ContainerResource" type is available on when the feature-gate HPAContainerMetrics is enabled
/// </summary>
[Input("type", required: true)]
public Input<string> Type { get; set; } = null!;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// *** WARNING: this file was generated by pulumigen. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***

using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
using Pulumi.Serialization;

namespace Pulumi.Kubernetes.Types.Outputs.Autoscaling.V2Beta1
{

[OutputType]
public sealed class ContainerResourceMetricSource
{
/// <summary>
/// container is the name of the container in the pods of the scaling target
/// </summary>
public readonly string Container;
/// <summary>
/// name is the name of the resource in question.
/// </summary>
public readonly string Name;
/// <summary>
/// targetAverageUtilization is the target value of the average of the resource metric across all relevant pods, represented as a percentage of the requested value of the resource for the pods.
/// </summary>
public readonly int TargetAverageUtilization;
/// <summary>
/// targetAverageValue is the target value of the average of the resource metric across all relevant pods, as a raw value (instead of as a percentage of the request), similar to the "pods" metric source type.
/// </summary>
public readonly string TargetAverageValue;

[OutputConstructor]
private ContainerResourceMetricSource(
string container,

string name,

int targetAverageUtilization,

string targetAverageValue)
{
Container = container;
Name = name;
TargetAverageUtilization = targetAverageUtilization;
TargetAverageValue = targetAverageValue;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// *** WARNING: this file was generated by pulumigen. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***

using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
using Pulumi.Serialization;

namespace Pulumi.Kubernetes.Types.Outputs.Autoscaling.V2Beta1
{

[OutputType]
public sealed class ContainerResourceMetricStatus
{
/// <summary>
/// container is the name of the container in the pods of the scaling target
/// </summary>
public readonly string Container;
/// <summary>
/// currentAverageUtilization is the current value of the average of the resource metric across all relevant pods, represented as a percentage of the requested value of the resource for the pods. It will only be present if `targetAverageValue` was set in the corresponding metric specification.
/// </summary>
public readonly int CurrentAverageUtilization;
/// <summary>
/// currentAverageValue is the current value of the average of the resource metric across all relevant pods, as a raw value (instead of as a percentage of the request), similar to the "pods" metric source type. It will always be set, regardless of the corresponding metric specification.
/// </summary>
public readonly string CurrentAverageValue;
/// <summary>
/// name is the name of the resource in question.
/// </summary>
public readonly string Name;

[OutputConstructor]
private ContainerResourceMetricStatus(
string container,

int currentAverageUtilization,

string currentAverageValue,

string name)
{
Container = container;
CurrentAverageUtilization = currentAverageUtilization;
CurrentAverageValue = currentAverageValue;
Name = name;
}
}
}
9 changes: 8 additions & 1 deletion sdk/dotnet/Autoscaling/V2Beta1/Outputs/MetricSpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ namespace Pulumi.Kubernetes.Types.Outputs.Autoscaling.V2Beta1
[OutputType]
public sealed class MetricSpec
{
/// <summary>
/// container resource refers to a resource metric (such as those specified in requests and limits) known to Kubernetes describing a single container in each pod of the current scale target (e.g. CPU or memory). Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the "pods" source. This is an alpha feature and can be enabled by the HPAContainerMetrics feature flag.
/// </summary>
public readonly Pulumi.Kubernetes.Types.Outputs.Autoscaling.V2Beta1.ContainerResourceMetricSource ContainerResource;
/// <summary>
/// external refers to a global metric that is not associated with any Kubernetes object. It allows autoscaling based on information coming from components running outside of cluster (for example length of queue in cloud messaging service, or QPS from loadbalancer running outside of cluster).
/// </summary>
Expand All @@ -30,12 +34,14 @@ public sealed class MetricSpec
/// </summary>
public readonly Pulumi.Kubernetes.Types.Outputs.Autoscaling.V2Beta1.ResourceMetricSource Resource;
/// <summary>
/// type is the type of metric source. It should be one of "Object", "Pods" or "Resource", each mapping to a matching field in the object.
/// type is the type of metric source. It should be one of "ContainerResource", "External", "Object", "Pods" or "Resource", each mapping to a matching field in the object. Note: "ContainerResource" type is available on when the feature-gate HPAContainerMetrics is enabled
/// </summary>
public readonly string Type;

[OutputConstructor]
private MetricSpec(
Pulumi.Kubernetes.Types.Outputs.Autoscaling.V2Beta1.ContainerResourceMetricSource containerResource,

Pulumi.Kubernetes.Types.Outputs.Autoscaling.V2Beta1.ExternalMetricSource external,

Pulumi.Kubernetes.Types.Outputs.Autoscaling.V2Beta1.ObjectMetricSource @object,
Expand All @@ -46,6 +52,7 @@ public sealed class MetricSpec

string type)
{
ContainerResource = containerResource;
External = external;
Object = @object;
Pods = pods;
Expand Down
9 changes: 8 additions & 1 deletion sdk/dotnet/Autoscaling/V2Beta1/Outputs/MetricStatus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ namespace Pulumi.Kubernetes.Types.Outputs.Autoscaling.V2Beta1
[OutputType]
public sealed class MetricStatus
{
/// <summary>
/// container resource refers to a resource metric (such as those specified in requests and limits) known to Kubernetes describing a single container in each pod in the current scale target (e.g. CPU or memory). Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the "pods" source.
/// </summary>
public readonly Pulumi.Kubernetes.Types.Outputs.Autoscaling.V2Beta1.ContainerResourceMetricStatus ContainerResource;
/// <summary>
/// external refers to a global metric that is not associated with any Kubernetes object. It allows autoscaling based on information coming from components running outside of cluster (for example length of queue in cloud messaging service, or QPS from loadbalancer running outside of cluster).
/// </summary>
Expand All @@ -30,12 +34,14 @@ public sealed class MetricStatus
/// </summary>
public readonly Pulumi.Kubernetes.Types.Outputs.Autoscaling.V2Beta1.ResourceMetricStatus Resource;
/// <summary>
/// type is the type of metric source. It will be one of "Object", "Pods" or "Resource", each corresponds to a matching field in the object.
/// type is the type of metric source. It will be one of "ContainerResource", "External", "Object", "Pods" or "Resource", each corresponds to a matching field in the object. Note: "ContainerResource" type is available on when the feature-gate HPAContainerMetrics is enabled
/// </summary>
public readonly string Type;

[OutputConstructor]
private MetricStatus(
Pulumi.Kubernetes.Types.Outputs.Autoscaling.V2Beta1.ContainerResourceMetricStatus containerResource,

Pulumi.Kubernetes.Types.Outputs.Autoscaling.V2Beta1.ExternalMetricStatus external,

Pulumi.Kubernetes.Types.Outputs.Autoscaling.V2Beta1.ObjectMetricStatus @object,
Expand All @@ -46,6 +52,7 @@ public sealed class MetricStatus

string type)
{
ContainerResource = containerResource;
External = external;
Object = @object;
Pods = pods;
Expand Down
Loading