From ee250c6c9b5b20f733224daaa694912abdc2a892 Mon Sep 17 00:00:00 2001 From: Florian Schwab Date: Sun, 17 Nov 2024 06:07:51 +0100 Subject: [PATCH] [ci] fix publish of provider packages --- .github/workflows/release.yml | 20 +- provider/cluster.go | 2 + sdk/dotnet/Pulumi.K0s.csproj | 2 +- sdk/go/k0s/cluster.go | 2 +- sdk/go/k0s/config/config.go | 2 +- sdk/go/k0s/init.go | 2 +- sdk/go/k0s/provider.go | 2 +- sdk/go/k0s/pulumiTypes.go | 2 +- sdk/nodejs/package.json | 2 +- sdk/python/pulumi_k0s/_inputs.py | 435 ++++++++++++++++++++++ sdk/python/pulumi_k0s/_utilities.py | 46 ++- sdk/python/pulumi_k0s/cluster.py | 5 + sdk/python/pulumi_k0s/config/__init__.pyi | 5 + sdk/python/pulumi_k0s/config/vars.py | 5 + sdk/python/pulumi_k0s/outputs.py | 5 + sdk/python/pulumi_k0s/provider.py | 5 + sdk/python/setup.py | 5 +- 17 files changed, 520 insertions(+), 27 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3be2d4f..46fa208 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -53,24 +53,18 @@ jobs: args: -p 3 release --clean version: latest - name: Publish provider packages - uses: osiegmar/s3-publisher-action@v1 + uses: imehedi/actions-awscli-v2@latest + with: + args: s3 cp --endpoint-url="${{ secrets.AWS_ENDPOINT_URL }}" dist/ "s3://${{ secrets.AWS_S3_BUCKET }}/pulumi-k0s/" --recursive --exclude="*" --include="pulumi-resource-*.tar.gz" env: - AWS_ENDPOINT_URL: "${{ secrets.AWS_ENDPOINT_URL }}" - AWS_REGION: "${{ secrets.AWS_REGION }}" AWS_ACCESS_KEY_ID: "${{ secrets.AWS_ACCESS_KEY_ID }}" AWS_SECRET_ACCESS_KEY: "${{ secrets.AWS_SECRET_ACCESS_KEY }}" - with: - bucket: "${{ secrets.AWS_S3_BUCKET }}" - prefix: pulumi-k0s/ - dir: dist - includes: | - pulumi-resource-*.tar.gz - delete-orphaned: false + AWS_REGION: "${{ secrets.AWS_REGION }}" strategy: fail-fast: true matrix: goversion: - - 1.21.x + - 1.23.x publish_sdk: name: Publish SDKs runs-on: ubuntu-latest @@ -85,7 +79,7 @@ jobs: with: go-version: ${{ matrix.goversion }} - name: Install pulumictl - uses: jaxxstorm/action-install-gh-release@v1.5.0 + uses: jaxxstorm/action-install-gh-release@v1.13.0 with: repo: pulumi/pulumictl - name: Install Pulumi CLI @@ -121,7 +115,7 @@ jobs: - name: Compress SDK folder run: tar -zcf sdk/${{ matrix.language }}.tar.gz -C sdk/${{ matrix.language }} . - name: Upload artifacts - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: ${{ matrix.language }}-sdk.tar.gz path: ${{ github.workspace}}/sdk/${{ matrix.language }}.tar.gz diff --git a/provider/cluster.go b/provider/cluster.go index c645483..f85c428 100644 --- a/provider/cluster.go +++ b/provider/cluster.go @@ -438,6 +438,8 @@ func (c Cluster) Create( return name, olds, err } + olds.ClusterInputs = news + if news.Kubeconfig != nil { olds.Kubeconfig = news.Kubeconfig } diff --git a/sdk/dotnet/Pulumi.K0s.csproj b/sdk/dotnet/Pulumi.K0s.csproj index 5c26eb2..481f4b0 100644 --- a/sdk/dotnet/Pulumi.K0s.csproj +++ b/sdk/dotnet/Pulumi.K0s.csproj @@ -44,7 +44,7 @@ - + diff --git a/sdk/go/k0s/cluster.go b/sdk/go/k0s/cluster.go index 5b39be4..bbe57bc 100644 --- a/sdk/go/k0s/cluster.go +++ b/sdk/go/k0s/cluster.go @@ -8,7 +8,7 @@ import ( "reflect" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" - "internal" + "github.com/ydkn/pulumi-k0s/sdk/go/k0s/internal" ) type Cluster struct { diff --git a/sdk/go/k0s/config/config.go b/sdk/go/k0s/config/config.go index d2a5318..6635110 100644 --- a/sdk/go/k0s/config/config.go +++ b/sdk/go/k0s/config/config.go @@ -6,7 +6,7 @@ package config import ( "github.com/pulumi/pulumi/sdk/v3/go/pulumi" "github.com/pulumi/pulumi/sdk/v3/go/pulumi/config" - "internal" + "github.com/ydkn/pulumi-k0s/sdk/go/k0s/internal" ) var _ = internal.GetEnvOrDefault diff --git a/sdk/go/k0s/init.go b/sdk/go/k0s/init.go index 451bd11..c53b70b 100644 --- a/sdk/go/k0s/init.go +++ b/sdk/go/k0s/init.go @@ -8,7 +8,7 @@ import ( "github.com/blang/semver" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" - "internal" + "github.com/ydkn/pulumi-k0s/sdk/go/k0s/internal" ) type module struct { diff --git a/sdk/go/k0s/provider.go b/sdk/go/k0s/provider.go index e7b248e..8406910 100644 --- a/sdk/go/k0s/provider.go +++ b/sdk/go/k0s/provider.go @@ -8,7 +8,7 @@ import ( "reflect" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" - "internal" + "github.com/ydkn/pulumi-k0s/sdk/go/k0s/internal" ) type Provider struct { diff --git a/sdk/go/k0s/pulumiTypes.go b/sdk/go/k0s/pulumiTypes.go index 9fa5242..2ef990d 100644 --- a/sdk/go/k0s/pulumiTypes.go +++ b/sdk/go/k0s/pulumiTypes.go @@ -8,7 +8,7 @@ import ( "reflect" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" - "internal" + "github.com/ydkn/pulumi-k0s/sdk/go/k0s/internal" ) var _ = internal.GetEnvOrDefault diff --git a/sdk/nodejs/package.json b/sdk/nodejs/package.json index cd6726e..41035e4 100644 --- a/sdk/nodejs/package.json +++ b/sdk/nodejs/package.json @@ -13,7 +13,7 @@ "build": "tsc" }, "dependencies": { - "@pulumi/pulumi": "^3.42.0" + "@pulumi/pulumi": "^3.136.0" }, "devDependencies": { "@types/node": "^14", diff --git a/sdk/python/pulumi_k0s/_inputs.py b/sdk/python/pulumi_k0s/_inputs.py index 0cc3966..2d2742c 100644 --- a/sdk/python/pulumi_k0s/_inputs.py +++ b/sdk/python/pulumi_k0s/_inputs.py @@ -4,55 +4,116 @@ import copy import warnings +import sys import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload +if sys.version_info >= (3, 11): + from typing import NotRequired, TypedDict, TypeAlias +else: + from typing_extensions import NotRequired, TypedDict, TypeAlias from . import _utilities __all__ = [ 'ClusterFileArgs', + 'ClusterFileArgsDict', 'ClusterHooksArgs', + 'ClusterHooksArgsDict', 'ClusterHookArgs', + 'ClusterHookArgsDict', 'ClusterHostArgs', + 'ClusterHostArgsDict', 'ClusterK0sArgs', + 'ClusterK0sArgsDict', 'ClusterLocalhostArgs', + 'ClusterLocalhostArgsDict', 'ClusterMetadataArgs', + 'ClusterMetadataArgsDict', 'ClusterOpenSSHArgs', + 'ClusterOpenSSHArgsDict', 'ClusterSSHArgs', + 'ClusterSSHArgsDict', 'ClusterSpecArgs', + 'ClusterSpecArgsDict', 'ClusterWinRMArgs', + 'ClusterWinRMArgsDict', 'K0sAPIArgs', + 'K0sAPIArgsDict', 'K0sCalicoImageArgs', + 'K0sCalicoImageArgsDict', 'K0sCalicoArgs', + 'K0sCalicoArgsDict', 'K0sControllerManagerArgs', + 'K0sControllerManagerArgsDict', 'K0sDualStackArgs', + 'K0sDualStackArgsDict', 'K0sEnvoyProxyArgs', + 'K0sEnvoyProxyArgsDict', 'K0sEtcdExternalClusterArgs', + 'K0sEtcdExternalClusterArgsDict', 'K0sEtcdArgs', + 'K0sEtcdArgsDict', 'K0sFeatureGateArgs', + 'K0sFeatureGateArgsDict', 'K0sImagesArgs', + 'K0sImagesArgsDict', 'K0sImageArgs', + 'K0sImageArgsDict', 'K0sInstallConfigUserArgs', + 'K0sInstallConfigUserArgsDict', 'K0sInstallConfigArgs', + 'K0sInstallConfigArgsDict', 'K0sKineArgs', + 'K0sKineArgsDict', 'K0sKonnectivityArgs', + 'K0sKonnectivityArgsDict', 'K0sKubeProxyIPTablesArgs', + 'K0sKubeProxyIPTablesArgsDict', 'K0sKubeProxyIPVSArgs', + 'K0sKubeProxyIPVSArgsDict', 'K0sKubeProxyArgs', + 'K0sKubeProxyArgsDict', 'K0sKubeRouterImageArgs', + 'K0sKubeRouterImageArgsDict', 'K0sKubeRouterArgs', + 'K0sKubeRouterArgsDict', 'K0sMetadataArgs', + 'K0sMetadataArgsDict', 'K0sNetworkArgs', + 'K0sNetworkArgsDict', 'K0sNodeLocalLoadBalancingArgs', + 'K0sNodeLocalLoadBalancingArgsDict', 'K0sPodSecurityPolicyArgs', + 'K0sPodSecurityPolicyArgsDict', 'K0sSchedulerArgs', + 'K0sSchedulerArgsDict', 'K0sSpecArgs', + 'K0sSpecArgsDict', 'K0sStorageArgs', + 'K0sStorageArgsDict', 'K0sTelemetryArgs', + 'K0sTelemetryArgsDict', 'K0sWorkerProfileArgs', + 'K0sWorkerProfileArgsDict', 'K0sArgs', + 'K0sArgsDict', ] +MYPY = False + +if not MYPY: + class ClusterFileArgsDict(TypedDict): + dir_perm: NotRequired[pulumi.Input[str]] + dst: NotRequired[pulumi.Input[str]] + dst_dir: NotRequired[pulumi.Input[str]] + group: NotRequired[pulumi.Input[str]] + name: NotRequired[pulumi.Input[str]] + perm: NotRequired[pulumi.Input[str]] + src: NotRequired[pulumi.Input[str]] + user: NotRequired[pulumi.Input[str]] +elif False: + ClusterFileArgsDict: TypeAlias = Mapping[str, Any] + @pulumi.input_type class ClusterFileArgs: def __init__(__self__, *, @@ -154,6 +215,14 @@ def user(self, value: Optional[pulumi.Input[str]]): pulumi.set(self, "user", value) +if not MYPY: + class ClusterHooksArgsDict(TypedDict): + apply: NotRequired[pulumi.Input['ClusterHookArgsDict']] + backup: NotRequired[pulumi.Input['ClusterHookArgsDict']] + reset: NotRequired[pulumi.Input['ClusterHookArgsDict']] +elif False: + ClusterHooksArgsDict: TypeAlias = Mapping[str, Any] + @pulumi.input_type class ClusterHooksArgs: def __init__(__self__, *, @@ -195,6 +264,13 @@ def reset(self, value: Optional[pulumi.Input['ClusterHookArgs']]): pulumi.set(self, "reset", value) +if not MYPY: + class ClusterHookArgsDict(TypedDict): + after: NotRequired[pulumi.Input[Sequence[pulumi.Input[str]]]] + before: NotRequired[pulumi.Input[Sequence[pulumi.Input[str]]]] +elif False: + ClusterHookArgsDict: TypeAlias = Mapping[str, Any] + @pulumi.input_type class ClusterHookArgs: def __init__(__self__, *, @@ -224,6 +300,27 @@ def before(self, value: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]): pulumi.set(self, "before", value) +if not MYPY: + class ClusterHostArgsDict(TypedDict): + role: pulumi.Input[str] + environment: NotRequired[pulumi.Input[Mapping[str, pulumi.Input[str]]]] + files: NotRequired[pulumi.Input[Sequence[pulumi.Input['ClusterFileArgsDict']]]] + hooks: NotRequired[pulumi.Input['ClusterHooksArgsDict']] + hostname: NotRequired[pulumi.Input[str]] + install_flags: NotRequired[pulumi.Input[Sequence[pulumi.Input[str]]]] + k0s_binary_path: NotRequired[pulumi.Input[str]] + localhost: NotRequired[pulumi.Input['ClusterLocalhostArgsDict']] + no_taints: NotRequired[pulumi.Input[bool]] + open_ssh: NotRequired[pulumi.Input['ClusterOpenSSHArgsDict']] + os: NotRequired[pulumi.Input[str]] + private_address: NotRequired[pulumi.Input[str]] + private_interface: NotRequired[pulumi.Input[str]] + ssh: NotRequired[pulumi.Input['ClusterSSHArgsDict']] + upload_binary: NotRequired[pulumi.Input[bool]] + win_rm: NotRequired[pulumi.Input['ClusterWinRMArgsDict']] +elif False: + ClusterHostArgsDict: TypeAlias = Mapping[str, Any] + @pulumi.input_type class ClusterHostArgs: def __init__(__self__, *, @@ -420,6 +517,15 @@ def win_rm(self, value: Optional[pulumi.Input['ClusterWinRMArgs']]): pulumi.set(self, "win_rm", value) +if not MYPY: + class ClusterK0sArgsDict(TypedDict): + config: NotRequired[pulumi.Input['K0sArgsDict']] + dynamic_config: NotRequired[pulumi.Input[bool]] + version: NotRequired[pulumi.Input[str]] + version_channel: NotRequired[pulumi.Input[str]] +elif False: + ClusterK0sArgsDict: TypeAlias = Mapping[str, Any] + @pulumi.input_type class ClusterK0sArgs: def __init__(__self__, *, @@ -473,6 +579,12 @@ def version_channel(self, value: Optional[pulumi.Input[str]]): pulumi.set(self, "version_channel", value) +if not MYPY: + class ClusterLocalhostArgsDict(TypedDict): + enabled: NotRequired[pulumi.Input[bool]] +elif False: + ClusterLocalhostArgsDict: TypeAlias = Mapping[str, Any] + @pulumi.input_type class ClusterLocalhostArgs: def __init__(__self__, *, @@ -490,6 +602,12 @@ def enabled(self, value: Optional[pulumi.Input[bool]]): pulumi.set(self, "enabled", value) +if not MYPY: + class ClusterMetadataArgsDict(TypedDict): + name: pulumi.Input[str] +elif False: + ClusterMetadataArgsDict: TypeAlias = Mapping[str, Any] + @pulumi.input_type class ClusterMetadataArgs: def __init__(__self__, *, @@ -506,6 +624,18 @@ def name(self, value: pulumi.Input[str]): pulumi.set(self, "name", value) +if not MYPY: + class ClusterOpenSSHArgsDict(TypedDict): + address: pulumi.Input[str] + config_path: NotRequired[pulumi.Input[str]] + disable_multiplexing: NotRequired[pulumi.Input[bool]] + key: NotRequired[pulumi.Input[str]] + options: NotRequired[pulumi.Input[Mapping[str, Any]]] + port: NotRequired[pulumi.Input[int]] + user: NotRequired[pulumi.Input[str]] +elif False: + ClusterOpenSSHArgsDict: TypeAlias = Mapping[str, Any] + @pulumi.input_type class ClusterOpenSSHArgs: def __init__(__self__, *, @@ -594,6 +724,17 @@ def user(self, value: Optional[pulumi.Input[str]]): pulumi.set(self, "user", value) +if not MYPY: + class ClusterSSHArgsDict(TypedDict): + address: pulumi.Input[str] + bastion: NotRequired[pulumi.Input['ClusterSSHArgsDict']] + host_key: NotRequired[pulumi.Input[str]] + key: NotRequired[pulumi.Input[str]] + port: NotRequired[pulumi.Input[int]] + user: NotRequired[pulumi.Input[str]] +elif False: + ClusterSSHArgsDict: TypeAlias = Mapping[str, Any] + @pulumi.input_type class ClusterSSHArgs: def __init__(__self__, *, @@ -670,6 +811,13 @@ def user(self, value: Optional[pulumi.Input[str]]): pulumi.set(self, "user", value) +if not MYPY: + class ClusterSpecArgsDict(TypedDict): + hosts: pulumi.Input[Sequence[pulumi.Input['ClusterHostArgsDict']]] + k0s: NotRequired[pulumi.Input['ClusterK0sArgsDict']] +elif False: + ClusterSpecArgsDict: TypeAlias = Mapping[str, Any] + @pulumi.input_type class ClusterSpecArgs: def __init__(__self__, *, @@ -698,6 +846,23 @@ def k0s(self, value: Optional[pulumi.Input['ClusterK0sArgs']]): pulumi.set(self, "k0s", value) +if not MYPY: + class ClusterWinRMArgsDict(TypedDict): + address: pulumi.Input[str] + bastion: NotRequired[pulumi.Input['ClusterSSHArgsDict']] + ca_cert: NotRequired[pulumi.Input[str]] + cert: NotRequired[pulumi.Input[str]] + insecure: NotRequired[pulumi.Input[bool]] + key: NotRequired[pulumi.Input[str]] + password: NotRequired[pulumi.Input[str]] + port: NotRequired[pulumi.Input[int]] + tls_server_name: NotRequired[pulumi.Input[str]] + use_https: NotRequired[pulumi.Input[bool]] + use_ntlm: NotRequired[pulumi.Input[bool]] + user: NotRequired[pulumi.Input[str]] +elif False: + ClusterWinRMArgsDict: TypeAlias = Mapping[str, Any] + @pulumi.input_type class ClusterWinRMArgs: def __init__(__self__, *, @@ -846,6 +1011,17 @@ def user(self, value: Optional[pulumi.Input[str]]): pulumi.set(self, "user", value) +if not MYPY: + class K0sAPIArgsDict(TypedDict): + address: NotRequired[pulumi.Input[str]] + external_address: NotRequired[pulumi.Input[str]] + extra_args: NotRequired[pulumi.Input[Mapping[str, pulumi.Input[str]]]] + k0s_api_port: NotRequired[pulumi.Input[int]] + port: NotRequired[pulumi.Input[int]] + sans: NotRequired[pulumi.Input[Sequence[pulumi.Input[str]]]] +elif False: + K0sAPIArgsDict: TypeAlias = Mapping[str, Any] + @pulumi.input_type class K0sAPIArgs: def __init__(__self__, *, @@ -923,6 +1099,15 @@ def sans(self, value: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]): pulumi.set(self, "sans", value) +if not MYPY: + class K0sCalicoImageArgsDict(TypedDict): + cni: NotRequired[pulumi.Input['K0sImageArgsDict']] + flexvolume: NotRequired[pulumi.Input['K0sImageArgsDict']] + kubecontrollers: NotRequired[pulumi.Input['K0sImageArgsDict']] + node: NotRequired[pulumi.Input['K0sImageArgsDict']] +elif False: + K0sCalicoImageArgsDict: TypeAlias = Mapping[str, Any] + @pulumi.input_type class K0sCalicoImageArgs: def __init__(__self__, *, @@ -976,6 +1161,20 @@ def node(self, value: Optional[pulumi.Input['K0sImageArgs']]): pulumi.set(self, "node", value) +if not MYPY: + class K0sCalicoArgsDict(TypedDict): + env_vars: NotRequired[pulumi.Input[Mapping[str, pulumi.Input[str]]]] + flex_volume_driver_path: NotRequired[pulumi.Input[str]] + ip_autodetection_method: NotRequired[pulumi.Input[str]] + mode: NotRequired[pulumi.Input[str]] + mtu: NotRequired[pulumi.Input[int]] + overlay: NotRequired[pulumi.Input[str]] + vxlan_port: NotRequired[pulumi.Input[int]] + vxlan_vni: NotRequired[pulumi.Input[int]] + wireguard: NotRequired[pulumi.Input[bool]] +elif False: + K0sCalicoArgsDict: TypeAlias = Mapping[str, Any] + @pulumi.input_type class K0sCalicoArgs: def __init__(__self__, *, @@ -1089,6 +1288,12 @@ def wireguard(self, value: Optional[pulumi.Input[bool]]): pulumi.set(self, "wireguard", value) +if not MYPY: + class K0sControllerManagerArgsDict(TypedDict): + extra_args: NotRequired[pulumi.Input[Mapping[str, pulumi.Input[str]]]] +elif False: + K0sControllerManagerArgsDict: TypeAlias = Mapping[str, Any] + @pulumi.input_type class K0sControllerManagerArgs: def __init__(__self__, *, @@ -1106,6 +1311,14 @@ def extra_args(self, value: Optional[pulumi.Input[Mapping[str, pulumi.Input[str] pulumi.set(self, "extra_args", value) +if not MYPY: + class K0sDualStackArgsDict(TypedDict): + i_pv6pod_cidr: NotRequired[pulumi.Input[str]] + i_pv6service_cidr: NotRequired[pulumi.Input[str]] + enabled: NotRequired[pulumi.Input[bool]] +elif False: + K0sDualStackArgsDict: TypeAlias = Mapping[str, Any] + @pulumi.input_type class K0sDualStackArgs: def __init__(__self__, *, @@ -1147,6 +1360,15 @@ def enabled(self, value: Optional[pulumi.Input[bool]]): pulumi.set(self, "enabled", value) +if not MYPY: + class K0sEnvoyProxyArgsDict(TypedDict): + api_server_bind_port: NotRequired[pulumi.Input[int]] + image: NotRequired[pulumi.Input[str]] + image_pull_policy: NotRequired[pulumi.Input[str]] + konnectivity_server_bind_port: NotRequired[pulumi.Input[int]] +elif False: + K0sEnvoyProxyArgsDict: TypeAlias = Mapping[str, Any] + @pulumi.input_type class K0sEnvoyProxyArgs: def __init__(__self__, *, @@ -1200,6 +1422,16 @@ def konnectivity_server_bind_port(self, value: Optional[pulumi.Input[int]]): pulumi.set(self, "konnectivity_server_bind_port", value) +if not MYPY: + class K0sEtcdExternalClusterArgsDict(TypedDict): + endpoints: pulumi.Input[Sequence[pulumi.Input[str]]] + ca: NotRequired[pulumi.Input[str]] + client_cert: NotRequired[pulumi.Input[str]] + client_key: NotRequired[pulumi.Input[str]] + etcd_prefix: NotRequired[pulumi.Input[str]] +elif False: + K0sEtcdExternalClusterArgsDict: TypeAlias = Mapping[str, Any] + @pulumi.input_type class K0sEtcdExternalClusterArgs: def __init__(__self__, *, @@ -1264,6 +1496,14 @@ def etcd_prefix(self, value: Optional[pulumi.Input[str]]): pulumi.set(self, "etcd_prefix", value) +if not MYPY: + class K0sEtcdArgsDict(TypedDict): + external_cluster: NotRequired[pulumi.Input['K0sEtcdExternalClusterArgsDict']] + extra_args: NotRequired[pulumi.Input[Mapping[str, pulumi.Input[str]]]] + peer_address: NotRequired[pulumi.Input[str]] +elif False: + K0sEtcdArgsDict: TypeAlias = Mapping[str, Any] + @pulumi.input_type class K0sEtcdArgs: def __init__(__self__, *, @@ -1305,6 +1545,14 @@ def peer_address(self, value: Optional[pulumi.Input[str]]): pulumi.set(self, "peer_address", value) +if not MYPY: + class K0sFeatureGateArgsDict(TypedDict): + name: pulumi.Input[str] + components: NotRequired[pulumi.Input[Sequence[pulumi.Input[str]]]] + enabled: NotRequired[pulumi.Input[bool]] +elif False: + K0sFeatureGateArgsDict: TypeAlias = Mapping[str, Any] + @pulumi.input_type class K0sFeatureGateArgs: def __init__(__self__, *, @@ -1345,6 +1593,20 @@ def enabled(self, value: Optional[pulumi.Input[bool]]): pulumi.set(self, "enabled", value) +if not MYPY: + class K0sImagesArgsDict(TypedDict): + calico: NotRequired[pulumi.Input['K0sCalicoImageArgsDict']] + coredns: NotRequired[pulumi.Input['K0sImageArgsDict']] + default_pull_policy: NotRequired[pulumi.Input[str]] + konnectivity: NotRequired[pulumi.Input['K0sImageArgsDict']] + kubeproxy: NotRequired[pulumi.Input['K0sImageArgsDict']] + kuberouter: NotRequired[pulumi.Input['K0sKubeRouterImageArgsDict']] + metricsserver: NotRequired[pulumi.Input['K0sImageArgsDict']] + pause: NotRequired[pulumi.Input['K0sImageArgsDict']] + repository: NotRequired[pulumi.Input[str]] +elif False: + K0sImagesArgsDict: TypeAlias = Mapping[str, Any] + @pulumi.input_type class K0sImagesArgs: def __init__(__self__, *, @@ -1458,6 +1720,13 @@ def repository(self, value: Optional[pulumi.Input[str]]): pulumi.set(self, "repository", value) +if not MYPY: + class K0sImageArgsDict(TypedDict): + image: NotRequired[pulumi.Input[str]] + version: NotRequired[pulumi.Input[str]] +elif False: + K0sImageArgsDict: TypeAlias = Mapping[str, Any] + @pulumi.input_type class K0sImageArgs: def __init__(__self__, *, @@ -1487,6 +1756,16 @@ def version(self, value: Optional[pulumi.Input[str]]): pulumi.set(self, "version", value) +if not MYPY: + class K0sInstallConfigUserArgsDict(TypedDict): + etcd_user: NotRequired[pulumi.Input[str]] + kine_user: NotRequired[pulumi.Input[str]] + konnectivity_user: NotRequired[pulumi.Input[str]] + kube_apiserver_user: NotRequired[pulumi.Input[str]] + kube_scheduler_user: NotRequired[pulumi.Input[str]] +elif False: + K0sInstallConfigUserArgsDict: TypeAlias = Mapping[str, Any] + @pulumi.input_type class K0sInstallConfigUserArgs: def __init__(__self__, *, @@ -1552,6 +1831,12 @@ def kube_scheduler_user(self, value: Optional[pulumi.Input[str]]): pulumi.set(self, "kube_scheduler_user", value) +if not MYPY: + class K0sInstallConfigArgsDict(TypedDict): + users: NotRequired[pulumi.Input['K0sInstallConfigUserArgsDict']] +elif False: + K0sInstallConfigArgsDict: TypeAlias = Mapping[str, Any] + @pulumi.input_type class K0sInstallConfigArgs: def __init__(__self__, *, @@ -1569,6 +1854,12 @@ def users(self, value: Optional[pulumi.Input['K0sInstallConfigUserArgs']]): pulumi.set(self, "users", value) +if not MYPY: + class K0sKineArgsDict(TypedDict): + data_source: pulumi.Input[str] +elif False: + K0sKineArgsDict: TypeAlias = Mapping[str, Any] + @pulumi.input_type class K0sKineArgs: def __init__(__self__, *, @@ -1585,6 +1876,13 @@ def data_source(self, value: pulumi.Input[str]): pulumi.set(self, "data_source", value) +if not MYPY: + class K0sKonnectivityArgsDict(TypedDict): + admin_port: NotRequired[pulumi.Input[int]] + agent_port: NotRequired[pulumi.Input[int]] +elif False: + K0sKonnectivityArgsDict: TypeAlias = Mapping[str, Any] + @pulumi.input_type class K0sKonnectivityArgs: def __init__(__self__, *, @@ -1614,6 +1912,15 @@ def agent_port(self, value: Optional[pulumi.Input[int]]): pulumi.set(self, "agent_port", value) +if not MYPY: + class K0sKubeProxyIPTablesArgsDict(TypedDict): + masquerade_all: NotRequired[pulumi.Input[bool]] + masquerade_bit: NotRequired[pulumi.Input[int]] + min_sync_period: NotRequired[pulumi.Input[str]] + sync_period: NotRequired[pulumi.Input[str]] +elif False: + K0sKubeProxyIPTablesArgsDict: TypeAlias = Mapping[str, Any] + @pulumi.input_type class K0sKubeProxyIPTablesArgs: def __init__(__self__, *, @@ -1667,6 +1974,19 @@ def sync_period(self, value: Optional[pulumi.Input[str]]): pulumi.set(self, "sync_period", value) +if not MYPY: + class K0sKubeProxyIPVSArgsDict(TypedDict): + exclude_cidrs: NotRequired[pulumi.Input[str]] + min_sync_period: NotRequired[pulumi.Input[str]] + scheduler: NotRequired[pulumi.Input[str]] + strict_arp: NotRequired[pulumi.Input[bool]] + sync_period: NotRequired[pulumi.Input[str]] + tcp_fin_timeout: NotRequired[pulumi.Input[str]] + tcp_timeout: NotRequired[pulumi.Input[str]] + udp_timeout: NotRequired[pulumi.Input[str]] +elif False: + K0sKubeProxyIPVSArgsDict: TypeAlias = Mapping[str, Any] + @pulumi.input_type class K0sKubeProxyIPVSArgs: def __init__(__self__, *, @@ -1768,6 +2088,16 @@ def udp_timeout(self, value: Optional[pulumi.Input[str]]): pulumi.set(self, "udp_timeout", value) +if not MYPY: + class K0sKubeProxyArgsDict(TypedDict): + disabled: NotRequired[pulumi.Input[bool]] + iptables: NotRequired[pulumi.Input['K0sKubeProxyIPTablesArgsDict']] + ipvs: NotRequired[pulumi.Input['K0sKubeProxyIPVSArgsDict']] + mode: NotRequired[pulumi.Input[str]] + node_port_addresses: NotRequired[pulumi.Input[str]] +elif False: + K0sKubeProxyArgsDict: TypeAlias = Mapping[str, Any] + @pulumi.input_type class K0sKubeProxyArgs: def __init__(__self__, *, @@ -1833,6 +2163,13 @@ def node_port_addresses(self, value: Optional[pulumi.Input[str]]): pulumi.set(self, "node_port_addresses", value) +if not MYPY: + class K0sKubeRouterImageArgsDict(TypedDict): + cni: NotRequired[pulumi.Input['K0sImageArgsDict']] + cni_installer: NotRequired[pulumi.Input['K0sImageArgsDict']] +elif False: + K0sKubeRouterImageArgsDict: TypeAlias = Mapping[str, Any] + @pulumi.input_type class K0sKubeRouterImageArgs: def __init__(__self__, *, @@ -1862,6 +2199,17 @@ def cni_installer(self, value: Optional[pulumi.Input['K0sImageArgs']]): pulumi.set(self, "cni_installer", value) +if not MYPY: + class K0sKubeRouterArgsDict(TypedDict): + auto_mtu: NotRequired[pulumi.Input[bool]] + extra_args: NotRequired[pulumi.Input[Mapping[str, pulumi.Input[str]]]] + hairpin: NotRequired[pulumi.Input[str]] + ip_masq: NotRequired[pulumi.Input[bool]] + metrics_port: NotRequired[pulumi.Input[int]] + mtu: NotRequired[pulumi.Input[int]] +elif False: + K0sKubeRouterArgsDict: TypeAlias = Mapping[str, Any] + @pulumi.input_type class K0sKubeRouterArgs: def __init__(__self__, *, @@ -1939,6 +2287,12 @@ def mtu(self, value: Optional[pulumi.Input[int]]): pulumi.set(self, "mtu", value) +if not MYPY: + class K0sMetadataArgsDict(TypedDict): + name: pulumi.Input[str] +elif False: + K0sMetadataArgsDict: TypeAlias = Mapping[str, Any] + @pulumi.input_type class K0sMetadataArgs: def __init__(__self__, *, @@ -1955,6 +2309,20 @@ def name(self, value: pulumi.Input[str]): pulumi.set(self, "name", value) +if not MYPY: + class K0sNetworkArgsDict(TypedDict): + calico: NotRequired[pulumi.Input['K0sCalicoArgsDict']] + cluster_domain: NotRequired[pulumi.Input[str]] + dual_stack: NotRequired[pulumi.Input['K0sDualStackArgsDict']] + kube_proxy: NotRequired[pulumi.Input['K0sKubeProxyArgsDict']] + kuberouter: NotRequired[pulumi.Input['K0sKubeRouterArgsDict']] + node_local_load_balancing: NotRequired[pulumi.Input['K0sNodeLocalLoadBalancingArgsDict']] + pod_cidr: NotRequired[pulumi.Input[str]] + provider: NotRequired[pulumi.Input[str]] + service_cidr: NotRequired[pulumi.Input[str]] +elif False: + K0sNetworkArgsDict: TypeAlias = Mapping[str, Any] + @pulumi.input_type class K0sNetworkArgs: def __init__(__self__, *, @@ -2068,6 +2436,14 @@ def service_cidr(self, value: Optional[pulumi.Input[str]]): pulumi.set(self, "service_cidr", value) +if not MYPY: + class K0sNodeLocalLoadBalancingArgsDict(TypedDict): + enabled: NotRequired[pulumi.Input[bool]] + envoy_proxy: NotRequired[pulumi.Input['K0sEnvoyProxyArgsDict']] + type: NotRequired[pulumi.Input[str]] +elif False: + K0sNodeLocalLoadBalancingArgsDict: TypeAlias = Mapping[str, Any] + @pulumi.input_type class K0sNodeLocalLoadBalancingArgs: def __init__(__self__, *, @@ -2109,6 +2485,12 @@ def type(self, value: Optional[pulumi.Input[str]]): pulumi.set(self, "type", value) +if not MYPY: + class K0sPodSecurityPolicyArgsDict(TypedDict): + default_policy: NotRequired[pulumi.Input[str]] +elif False: + K0sPodSecurityPolicyArgsDict: TypeAlias = Mapping[str, Any] + @pulumi.input_type class K0sPodSecurityPolicyArgs: def __init__(__self__, *, @@ -2126,6 +2508,12 @@ def default_policy(self, value: Optional[pulumi.Input[str]]): pulumi.set(self, "default_policy", value) +if not MYPY: + class K0sSchedulerArgsDict(TypedDict): + extra_args: NotRequired[pulumi.Input[Mapping[str, pulumi.Input[str]]]] +elif False: + K0sSchedulerArgsDict: TypeAlias = Mapping[str, Any] + @pulumi.input_type class K0sSchedulerArgs: def __init__(__self__, *, @@ -2143,6 +2531,23 @@ def extra_args(self, value: Optional[pulumi.Input[Mapping[str, pulumi.Input[str] pulumi.set(self, "extra_args", value) +if not MYPY: + class K0sSpecArgsDict(TypedDict): + api: NotRequired[pulumi.Input['K0sAPIArgsDict']] + controller_manager: NotRequired[pulumi.Input['K0sControllerManagerArgsDict']] + feature_gates: NotRequired[pulumi.Input[Sequence[pulumi.Input['K0sFeatureGateArgsDict']]]] + images: NotRequired[pulumi.Input['K0sImagesArgsDict']] + install_config: NotRequired[pulumi.Input['K0sInstallConfigArgsDict']] + konnectivity: NotRequired[pulumi.Input['K0sKonnectivityArgsDict']] + network: NotRequired[pulumi.Input['K0sNetworkArgsDict']] + pod_security_policy: NotRequired[pulumi.Input['K0sPodSecurityPolicyArgsDict']] + scheduler: NotRequired[pulumi.Input['K0sSchedulerArgsDict']] + storage: NotRequired[pulumi.Input['K0sStorageArgsDict']] + telemetry: NotRequired[pulumi.Input['K0sTelemetryArgsDict']] + worker_profiles: NotRequired[pulumi.Input[Sequence[pulumi.Input['K0sWorkerProfileArgsDict']]]] +elif False: + K0sSpecArgsDict: TypeAlias = Mapping[str, Any] + @pulumi.input_type class K0sSpecArgs: def __init__(__self__, *, @@ -2292,6 +2697,14 @@ def worker_profiles(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['K0 pulumi.set(self, "worker_profiles", value) +if not MYPY: + class K0sStorageArgsDict(TypedDict): + etcd: NotRequired[pulumi.Input['K0sEtcdArgsDict']] + kine: NotRequired[pulumi.Input['K0sKineArgsDict']] + type: NotRequired[pulumi.Input[str]] +elif False: + K0sStorageArgsDict: TypeAlias = Mapping[str, Any] + @pulumi.input_type class K0sStorageArgs: def __init__(__self__, *, @@ -2333,6 +2746,12 @@ def type(self, value: Optional[pulumi.Input[str]]): pulumi.set(self, "type", value) +if not MYPY: + class K0sTelemetryArgsDict(TypedDict): + enabled: NotRequired[pulumi.Input[bool]] +elif False: + K0sTelemetryArgsDict: TypeAlias = Mapping[str, Any] + @pulumi.input_type class K0sTelemetryArgs: def __init__(__self__, *, @@ -2350,6 +2769,13 @@ def enabled(self, value: Optional[pulumi.Input[bool]]): pulumi.set(self, "enabled", value) +if not MYPY: + class K0sWorkerProfileArgsDict(TypedDict): + name: pulumi.Input[str] + values: pulumi.Input[Mapping[str, Any]] +elif False: + K0sWorkerProfileArgsDict: TypeAlias = Mapping[str, Any] + @pulumi.input_type class K0sWorkerProfileArgs: def __init__(__self__, *, @@ -2377,6 +2803,15 @@ def values(self, value: pulumi.Input[Mapping[str, Any]]): pulumi.set(self, "values", value) +if not MYPY: + class K0sArgsDict(TypedDict): + api_version: NotRequired[pulumi.Input[str]] + kind: NotRequired[pulumi.Input[str]] + metadata: NotRequired[pulumi.Input['K0sMetadataArgsDict']] + spec: NotRequired[pulumi.Input['K0sSpecArgsDict']] +elif False: + K0sArgsDict: TypeAlias = Mapping[str, Any] + @pulumi.input_type class K0sArgs: def __init__(__self__, *, diff --git a/sdk/python/pulumi_k0s/_utilities.py b/sdk/python/pulumi_k0s/_utilities.py index 23af5f2..37dbc2e 100644 --- a/sdk/python/pulumi_k0s/_utilities.py +++ b/sdk/python/pulumi_k0s/_utilities.py @@ -4,6 +4,7 @@ import asyncio +import functools import importlib.metadata import importlib.util import inspect @@ -11,14 +12,19 @@ import os import sys import typing +import warnings +import base64 import pulumi import pulumi.runtime from pulumi.runtime.sync_await import _sync_await +from pulumi.runtime.proto import resource_pb2 from semver import VersionInfo as SemverVersion from parver import Version as PEP440Version +C = typing.TypeVar("C", bound=typing.Callable) + def get_env(*args): for v in args: @@ -96,10 +102,6 @@ def _get_semver_version(): _version = _get_semver_version() _version_str = str(_version) - -def get_version(): - return _version_str - def get_resource_opts_defaults() -> pulumi.ResourceOptions: return pulumi.ResourceOptions( version=get_version(), @@ -262,7 +264,7 @@ def call_plain( output = pulumi.runtime.call(tok, props, res, typ) # Ingoring deps silently. They are typically non-empty, r.f() calls include r as a dependency. - result, known, secret, _ = _sync_await(asyncio.ensure_future(_await_output(output))) + result, known, secret, _ = _sync_await(asyncio.create_task(_await_output(output))) problem = None if not known: @@ -287,5 +289,39 @@ async def _await_output(o: pulumi.Output[typing.Any]) -> typing.Tuple[object, bo await o._resources, ) + +# This is included to provide an upgrade path for users who are using a version +# of the Pulumi SDK (<3.121.0) that does not include the `deprecated` decorator. +def deprecated(message: str) -> typing.Callable[[C], C]: + """ + Decorator to indicate a function is deprecated. + + As well as inserting appropriate statements to indicate that the function is + deprecated, this decorator also tags the function with a special attribute + so that Pulumi code can detect that it is deprecated and react appropriately + in certain situations. + + message is the deprecation message that should be printed if the function is called. + """ + + def decorator(fn: C) -> C: + if not callable(fn): + raise TypeError("Expected fn to be callable") + + @functools.wraps(fn) + def deprecated_fn(*args, **kwargs): + warnings.warn(message) + pulumi.warn(f"{fn.__name__} is deprecated: {message}") + + return fn(*args, **kwargs) + + deprecated_fn.__dict__["_pulumi_deprecated_callable"] = fn + return typing.cast(C, deprecated_fn) + + return decorator + def get_plugin_download_url(): return "https://repo.ydkn.io/pulumi-k0s" + +def get_version(): + return _version_str diff --git a/sdk/python/pulumi_k0s/cluster.py b/sdk/python/pulumi_k0s/cluster.py index ae9caff..7a63ffa 100644 --- a/sdk/python/pulumi_k0s/cluster.py +++ b/sdk/python/pulumi_k0s/cluster.py @@ -4,9 +4,14 @@ import copy import warnings +import sys import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload +if sys.version_info >= (3, 11): + from typing import NotRequired, TypedDict, TypeAlias +else: + from typing_extensions import NotRequired, TypedDict, TypeAlias from . import _utilities from . import outputs from ._inputs import * diff --git a/sdk/python/pulumi_k0s/config/__init__.pyi b/sdk/python/pulumi_k0s/config/__init__.pyi index 6c86a28..381325a 100644 --- a/sdk/python/pulumi_k0s/config/__init__.pyi +++ b/sdk/python/pulumi_k0s/config/__init__.pyi @@ -4,9 +4,14 @@ import copy import warnings +import sys import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload +if sys.version_info >= (3, 11): + from typing import NotRequired, TypedDict, TypeAlias +else: + from typing_extensions import NotRequired, TypedDict, TypeAlias from .. import _utilities concurrency: int diff --git a/sdk/python/pulumi_k0s/config/vars.py b/sdk/python/pulumi_k0s/config/vars.py index 195e664..63ef5c1 100644 --- a/sdk/python/pulumi_k0s/config/vars.py +++ b/sdk/python/pulumi_k0s/config/vars.py @@ -4,9 +4,14 @@ import copy import warnings +import sys import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload +if sys.version_info >= (3, 11): + from typing import NotRequired, TypedDict, TypeAlias +else: + from typing_extensions import NotRequired, TypedDict, TypeAlias from .. import _utilities import types diff --git a/sdk/python/pulumi_k0s/outputs.py b/sdk/python/pulumi_k0s/outputs.py index ff8ece3..49eb23a 100644 --- a/sdk/python/pulumi_k0s/outputs.py +++ b/sdk/python/pulumi_k0s/outputs.py @@ -4,9 +4,14 @@ import copy import warnings +import sys import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload +if sys.version_info >= (3, 11): + from typing import NotRequired, TypedDict, TypeAlias +else: + from typing_extensions import NotRequired, TypedDict, TypeAlias from . import _utilities from . import outputs diff --git a/sdk/python/pulumi_k0s/provider.py b/sdk/python/pulumi_k0s/provider.py index febc907..13b97c6 100644 --- a/sdk/python/pulumi_k0s/provider.py +++ b/sdk/python/pulumi_k0s/provider.py @@ -4,9 +4,14 @@ import copy import warnings +import sys import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload +if sys.version_info >= (3, 11): + from typing import NotRequired, TypedDict, TypeAlias +else: + from typing_extensions import NotRequired, TypedDict, TypeAlias from . import _utilities __all__ = ['ProviderArgs', 'Provider'] diff --git a/sdk/python/setup.py b/sdk/python/setup.py index 335d650..1762636 100644 --- a/sdk/python/setup.py +++ b/sdk/python/setup.py @@ -38,7 +38,8 @@ def readme(): }, install_requires=[ 'parver>=0.2.1', - 'pulumi', - 'semver>=2.8.1' + 'pulumi>=3.136.0,<4.0.0', + 'semver>=2.8.1', + 'typing-extensions>=4.11,<5; python_version < "3.11"' ], zip_safe=False)