pulumi / pulumi-kubernetes

A Pulumi resource provider for Kubernetes to manage API resources and workloads in running clusters
https://www.pulumi.com/docs/reference/clouds/kubernetes/
Apache License 2.0
407 stars 117 forks source link

v4.5.1: chart requires kubeVersion: >=1.23.0-0 which is incompatible with Kubernetes v1.20.0 #2631

Closed ctison closed 11 months ago

ctison commented 1 year ago

What happened?

When upgrading to @pulumi/kubernetes@4.5.1, the passed Kubernetes version seems to be stucked to v1.20.0, which makes failing Helm charts installation with Kubernetes version requirement.

Example

new k8s.helm.v3.Release(
  'dragonfly',
  {
    chart: 'oci://ghcr.io/dragonflydb/dragonfly/helm/dragonfly',
    name: 'dragonfly',
    version: 'v1.11.0',
  },
  { parent: this },
);
$ pulumi up
[...]
Diagnostics:
  kubernetes:helm.sh/v3:Release (dragonfly):
    error: kubernetes:helm.sh/v3:Release resource 'dragonfly': property chart value {oci://ghcr.io/dragonflydb/dragonfly/helm/dragonfly} has a problem: chart requires kubeVersion: >=1.23.0-0 which is incompatible with Kubernetes v1.20.0; check the chart name and repository configuration.

Output of pulumi about

CLI
Version 3.90.1 Go Version go1.21.3 Go Compiler gc

Plugins NAME VERSION nodejs unknown

Host
OS darwin Version 14.0 Arch arm64

Additional context

Reverting to @pulumi/kubernetes@4.4.0 fixed my issue.

Contributing

Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

bitofsky commented 1 year ago

I'm also experiencing a similar issue, but while using helm.v3.Chart instead of helm.v3.Release. After upgrading to v4.5.1, I installed the Helm chart on k8s v1.22.0, and my current cluster version remains unchanged. I'm not sure where the v1.20.0 version is coming from.

error: Error: invocation of kubernetes:helm:template returned an error: failed to generate YAML for specified Helm chart: failed to create chart from template: chart requires kubeVersion: >=1.21.0-0 which is incompatible with Kubernetes v1.20.0

I wonder if this issue is related to PR #2593.

If there were zero k8s contexts --> this field was unset meaning helm would default to some old version (1.20.0 at the time of writing) if it couldn't connect to the k8s context 1+ k8s contexts --> would always try to contact the API server to get the version leading to an error if the API server was unreachable.

bitofsky commented 1 year ago

Additional Findings:

bitofsky commented 1 year ago

Further Update on My Case:

rhuanbarreto commented 1 year ago

It happens the same to me. But if I switch version back to 4.3.0 it works normally.

rhuanbarreto commented 1 year ago

My helm release:

export const certManager = new k8s.helm.v3.Release("cert-manager", {
  chart: "cert-manager",
  version: "v1.12.2",
  repositoryOpts: {
    repo: "https://charts.jetstack.io",
  },
  name: "cert-manager",
  createNamespace: true,
  namespace: "cert-manager",
  values: {
    installCRDs: true,
  },
});
mikhailshilkov commented 1 year ago

@EronWright This sounds like a regression, could you please take a look?

dominikzogg commented 12 months ago
  kubernetes:helm.sh/v3:Release (helm-cert-manager):
    error: kubernetes:helm.sh/v3:Release resource 'helm-cert-manager': property chart value {cert-manager} has a problem: chart requires kubeVersion: >= 1.22.0-0 which is incompatible with Kubernetes v1.20.0; check the chart name and repository configuration.
new k8s.helm.v3.Release(
    'helm-cert-manager',
    {
      chart: 'cert-manager',
      version: '1.13.2',
      repositoryOpts: {
        repo: 'https://charts.jetstack.io',
      },
      namespace: 'cert-manager',
      createNamespace: true,
      values: {
        installCRDs: true,
        prometheus: {
          enabled: false,
        },
      },
    },
    { provider: k8sProvider },
  );
MrTolerant commented 12 months ago

When i use Chart, ChartOpts, FetchOpts - everything works fine. But when using Release, ReleaseArgs, RepositoryOptsArgs i receive error:

Diagnostics: kubernetes:helm.sh/v3:Release (sonarqube-test): error: kubernetes:helm.sh/v3:Release resource 'sonarqube-test': property chart value {sonarqube} has a problem: chart requires kubeVersion: >= 1.24.0-0 which is incompatible with Kubernetes v1.20.0; check the chart name and repository configuration.

Code for repeate:

from pulumi_kubernetes.helm.v3 import Chart, ChartOpts, FetchOpts

Chart(
        "sonarqube-test",
        ChartOpts(
            chart="sonarqube",
            namespace="test",
            version="10.2.1",
            fetch_opts=FetchOpts(
                repo="https://sonarSource.github.io/helm-chart-sonarqube",
            ),
            # atomic=True,
            # create_namespace=True,
        ),
    )

# from pulumi_kubernetes.helm.v3 import Release, ReleaseArgs, RepositoryOptsArgs

# Release(
#         "sonarqube-test",
#         args=ReleaseArgs(
#             chart="sonarqube",
#             namespace="test",
#             version="10.2.1",
#             repository_opts=RepositoryOptsArgs(
#                 repo="https://sonarSource.github.io/helm-chart-sonarqube",
#             ),
#             atomic=True,
#             create_namespace=True,
#         ),
#     )
 poetry show
arpeggio               2.0.2     Packrat parser interpreter
aspy-refactor-imports  3.0.2     Utilities for refactoring imports in python-like syntax.
attrs                  23.1.0    Classes Without Boilerplate
bandit                 1.7.5     Security oriented static analyser for python code.
black                  22.8.0    The uncompromising code formatter.
certifi                2023.7.22 Python package for providing Mozilla's CA Bundle.
cfgv                   3.4.0     Validate configuration and produce human readable error messages.
charset-normalizer     3.3.0     The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet.
click                  8.1.7     Composable command line interface toolkit
dill                   0.3.7     serialize all of Python
distlib                0.3.7     Distribution utilities
filelock               3.12.4    A platform independent file lock.
flake8                 6.1.0     the modular source code checker: pep8 pyflakes and co
flake8-bugbear         23.9.16   A plugin for flake8 finding likely bugs and design problems in your program. Contains warnings that don't belong in pyflakes an...
gitdb                  4.0.10    Git Object Database
gitpython              3.1.37    GitPython is a Python library used to interact with Git repositories
grpcio                 1.51.3    HTTP/2-based RPC framework
identify               2.5.30    File identification library for Python
idna                   3.4       Internationalized Domain Names in Applications (IDNA)
iniconfig              2.0.0     brain-dead simple config-ini parsing
isort                  5.12.0    A Python utility / library to sort Python imports.
jinja2                 3.1.2     A very fast and expressive template engine.
markdown-it-py         3.0.0     Python port of markdown-it. Markdown parsing, done right!
markupsafe             2.1.3     Safely add untrusted strings to HTML/XML markup.
mccabe                 0.7.0     McCabe checker, plugin for flake8
mdurl                  0.1.2     Markdown URL utilities
mergedeep              1.3.4     A deep merge function for 🐍.
mock                   5.1.0     Rolling backport of unittest.mock for all Pythons
mypy-extensions        1.0.0     Type system extensions for programs checked with the mypy type checker.
mysql-connector-python 8.1.0     MySQL driver written in Python
netaddr                0.8.0     A network address manipulation library for Python
nodeenv                1.8.0     Node.js virtual environment builder
packaging              23.2      Core utilities for Python packages
parver                 0.5       Parse and manipulate version numbers.
pathspec               0.11.2    Utility library for gitignore style pattern matching of file paths.
pbr                    5.11.1    Python Build Reasonableness
platformdirs           3.11.0    A small Python package for determining appropriate platform-specific dirs, e.g. a "user data dir".
pluggy                 1.3.0     plugin and hook calling mechanisms for python
pre-commit             3.4.0     A framework for managing and maintaining multi-language pre-commit hooks.
protobuf               4.21.12   Protocol Buffers
pulumi                 3.68.0    Pulumi's Python SDK
pulumi-aws             5.41.0    A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
pulumi-aws-iam         0.2.0     
pulumi-aws-native      0.11.0    A native Pulumi package for creating and managing Amazon Web Services (AWS) resources.
pulumi-kubernetes      4.4.0     A Pulumi package for creating and managing Kubernetes resources.
pulumi-mongodbatlas    3.11.0    A Pulumi package for creating and managing mongodbatlas cloud resources.
pulumi-mysql           3.1.0     A Pulumi package for creating and managing mysql cloud resources.
pulumi-postgresql      3.10.0    A Pulumi package for creating and managing postgresql cloud resources.
pulumi-rabbitmq        3.3.0     A Pulumi package for creating and managing RabbitMQ resources.
pulumi-random          4.14.0    A Pulumi package to safely use randomness in Pulumi programs.
pulumi-tls             4.11.0    A Pulumi package to create TLS resources in Pulumi programs.
pycodestyle            2.11.1    Python style guide checker
pyflakes               3.1.0     passive checker of Python programs
pygments               2.16.1    Pygments is a syntax highlighting package written in Python.
pytest                 7.4.2     pytest: simple powerful testing with Python
pytest-dotenv          0.5.2     A py.test plugin that parses environment files before running tests
python-dotenv          1.0.0     Read key-value pairs from a .env file and set them as environment variables
pyyaml                 6.0.1     YAML parser and emitter for Python
requests               2.31.0    Python HTTP for Humans.
rich                   13.6.0    Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal
seed-isort-config      2.2.0     Statically populate the `known_third_party` `isort` setting.
semver                 2.13.0    Python helper for Semantic Versioning (http://semver.org/)
setuptools             68.2.2    Easily download, build, install, upgrade, and uninstall Python packages
six                    1.16.0    Python 2 and 3 compatibility utilities
smmap                  5.0.1     A pure Python implementation of a sliding window memory map manager
stevedore              5.1.0     Manage dynamic plugins for Python applications
strenum                0.4.15    An Enum that inherits from str.
urllib3                2.0.6     HTTP library with thread-safe connection pooling, file post, and more.
virtualenv             20.24.5   Virtual Python Environment builder
MrTolerant commented 12 months ago

After downgrading version to pulumi_kubernetes 4.3.0 everything started working fine!

poetry add pulumi_kubernetes=4.3.0

Updating dependencies
Resolving dependencies... (0.4s)

Package operations: 0 installs, 11 updates, 0 removals

  • Downgrading charset-normalizer (3.3.1 -> 3.3.0)
  • Downgrading urllib3 (2.0.7 -> 2.0.6)
  • Downgrading filelock (3.13.0 -> 3.12.4)
  • Downgrading gitdb (4.0.11 -> 4.0.10)
  • Downgrading gitpython (3.1.40 -> 3.1.37)
  • Downgrading identify (2.5.31 -> 2.5.30)
  • Downgrading pulumi-kubernetes (4.5.2 -> 4.3.0)
  • Downgrading pytest (7.4.3 -> 7.4.2)
  • Downgrading virtualenv (20.24.6 -> 20.24.5)
  • Downgrading mysql-connector-python (8.2.0 -> 8.1.0)
  • Downgrading pre-commit (3.5.0 -> 3.4.0)

pulumi up -s sonar-test
Previewing update (sonar-test):
Downloading plugin: 37.07 MiB / 37.07 MiB [=========================] 100.00% 2s
                                                                                [resource plugin kubernetes-4.3.0] installing
     Type                              Name                   Plan       
 +   pulumi:pulumi:Stack               sonar-test-sonar-test  create     
 +   └─ kubernetes:helm.sh/v3:Release  sonarqube-test         create     

 Resources:
    + 2 to create

Do you want to perform this update? no
confirmation declined, not proceeding with the update
bhavitsharma commented 12 months ago

yeah, bitten by this bug - can confirm 4.3.0 works

rhuanbarreto commented 12 months ago

v4.4.0 still works.

Tested until v4.5.3 . Not working yet.

omidraha commented 11 months ago

I have same issue, https://github.com/longhorn/longhorn/issues/4788#issuecomment-1792937587 I fixed the version pulumi-kubernetes==4.3.0 but how about other packages ?

The pip can't determine which version is compatible with other requirements.

The requirements.txt file:

pulumi
pulumi-aws
pulumi-aws-native
pulumi-awsx
pulumi-cloudflare
pulumi-docker
pulumi-eks
pulumi-kubernetes==4.3.0
mikhailshilkov commented 11 months ago

I'm sorry for the trouble everyone - we are working on a fix in https://github.com/pulumi/pulumi-kubernetes/pull/2653 and will land it soon, then cut a new version of the provider.

EronWright commented 11 months ago

Update: the fix was shipped in v4.5.4: https://github.com/pulumi/pulumi-kubernetes/pull/2653

johnsonp57 commented 9 months ago

@EronWright I am still getting the kubeVersion error post v4.5.4 on deployment of cert-manager - noticed that the JsonNames (lines 400/402) are transposed here: https://github.com/pulumi/pulumi-kubernetes/blob/master/provider/pkg/gen/dotnet-templates/helm/v3/Chart.cs

EronWright commented 9 months ago

@johnsonp57 thanks for the help, I filed an issue based on your observation and will prioritize: https://github.com/pulumi/pulumi-kubernetes/issues/2739