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

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

Closed
ctison opened this issue Oct 25, 2023 · 16 comments · Fixed by #2653
Closed
Assignees
Labels
impact/regression Something that used to work, but is now broken kind/bug Some behavior is incorrect or out of spec p1 A bug severe enough to be the next item assigned to an engineer resolution/fixed This issue was fixed

Comments

@ctison
Copy link

ctison commented Oct 25, 2023

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).

@ctison ctison added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Oct 25, 2023
@bitofsky
Copy link

bitofsky commented Oct 25, 2023

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
Copy link

Additional Findings:

  • The issue occurs when I provide a provider directly in the ComponentResourceOptions while creating a helm.v3.Chart.
  • Removing the provider injection and using the kubernetes default provider's context to up on the same cluster doesn't result in a helm template error.

@bitofsky
Copy link

Further Update on My Case:

  • I've identified the root cause in my scenario.
  • The issue appears to be with the kubernetes config information in the provider. When it fails to connect to the actual kubernetes cluster, instead of a cluster connection failure, this erroneous version message (v1.20) is displayed.
  • After correcting the cluster information, the error no longer occurs.
  • The error message seems to be misleading.

@rhuanbarreto
Copy link

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

@rhuanbarreto
Copy link

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 mikhailshilkov added p1 A bug severe enough to be the next item assigned to an engineer impact/regression Something that used to work, but is now broken and removed needs-triage Needs attention from the triage team labels Oct 26, 2023
@mikhailshilkov
Copy link
Member

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

@dominikzogg
Copy link

  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
Copy link

MrTolerant commented Oct 31, 2023

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
Copy link

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
Copy link

yeah, bitten by this bug - can confirm 4.3.0 works

@rhuanbarreto
Copy link

v4.4.0 still works.

Tested until v4.5.3 . Not working yet.

@omidraha
Copy link

omidraha commented Nov 7, 2023

I have same issue, longhorn/longhorn#4788 (comment)
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
Copy link
Member

I'm sorry for the trouble everyone - we are working on a fix in #2653 and will land it soon, then cut a new version of the provider.

EronWright added a commit that referenced this issue Nov 8, 2023
…2653)

<!--Thanks for your contribution. See [CONTRIBUTING](CONTRIBUTING.md)
    for Pulumi's contribution guidelines.

    Help us merge your changes more quickly by adding more details such
    as labels, milestones, and reviewers.-->

### Proposed changes

This PR passes kubeVersion and apiVersions info from the server to Helm
to fix a regression that occurred in
#2568.

### Related issues (optional)

<!--Refer to related PRs or issues: #1234, or 'Fixes #1234' or 'Closes
#1234'.
Or link to full URLs to issues or pull requests in other GitHub
repositories. -->
Fixes: #2631
@pulumi-bot pulumi-bot added the resolution/fixed This issue was fixed label Nov 8, 2023
@EronWright
Copy link
Contributor

EronWright commented Nov 13, 2023

Update: the fix was shipped in v4.5.4:
#2653

@johnsonp57
Copy link

@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
Copy link
Contributor

@johnsonp57 thanks for the help, I filed an issue based on your observation and will prioritize:
#2739

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
impact/regression Something that used to work, but is now broken kind/bug Some behavior is incorrect or out of spec p1 A bug severe enough to be the next item assigned to an engineer resolution/fixed This issue was fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.