carvel-dev/kapp-controller

Cannot install package with prerelease identifier containing `x`

mamachanko opened this issue ยท 3 comments

What steps did you take:

Install a package with prerelease identifier containing x, say test.example.com/0.1.0-experimental.

#! test.yaml

---
apiVersion: data.packaging.carvel.dev/v1alpha1
kind: Package
metadata: 
  name: test.example.com.0.1.0-experimental
  namespace: tap-cert-manager-install
spec: 
  refName: test.example.com
  version: 0.1.0-experimental
  template: 
    spec: 
      deploy: 
        - kapp: {}
      fetch: 
        - path: config
          inline: 
            paths: 
              config/config.yaml: |
                ---
                apiVersion: v1
                kind: ConfigMap
                metadata: 
                  name: test.example.com
                data: 
                  message: hello
      template: 
        - ytt: 
            paths: 
              - ./config

---
apiVersion: packaging.carvel.dev/v1alpha1
kind: PackageInstall
metadata: 
  name: test
  namespace: tap-cert-manager-install
spec: 
  packageRef: 
    refName: test.example.com
    versionSelection: 
      constraints: 0.1.0-experimental
  serviceAccountName: install-sa
ytt -f test.yaml | 'kapp d -y -c -f- --logs-all -a p

What happened:

Target cluster 'https://127.0.0.1:54217' (nodes: kind-cert-manager-control-plane)

@@ create package/test.example.com.0.1.0-experimental (data.packaging.carvel.dev/v1alpha1) namespace: tap-cert-manager-install @@
      0 + apiVersion: data.packaging.carvel.dev/v1alpha1
      1 + kind: Package
      2 + metadata:
      3 +   labels:
      4 +     kapp.k14s.io/app: "1711611146051431000"
      5 +     kapp.k14s.io/association: v1.0309736a6eed43720870e0e31bc67fee
      6 +   name: test.example.com.0.1.0-experimental
      7 +   namespace: tap-cert-manager-install
      8 + spec:
      9 +   refName: test.example.com
     10 +   template:
     11 +     spec:
     12 +       deploy:
     13 +       - kapp: {}
     14 +       fetch:
     15 +       - inline:
     16 +           paths:
     17 +             config/config.yaml: "---\napiVersion: v1\nkind: ConfigMap\nmetadata: \n
     18 +               \ name: test.example.com\ndata: \n  message: hello\n"
     19 +         path: config
     20 +       template:
     21 +       - ytt:
     22 +           paths:
     23 +           - ./config
     24 +   version: 0.1.0-experimental
     25 +
@@ create packageinstall/test (packaging.carvel.dev/v1alpha1) namespace: tap-cert-manager-install @@
      0 + apiVersion: packaging.carvel.dev/v1alpha1
      1 + kind: PackageInstall
      2 + metadata:
      3 +   labels:
      4 +     kapp.k14s.io/app: "1711611146051431000"
      5 +     kapp.k14s.io/association: v1.f8f960ff3ce5fa32671be1cf7e4aebaf
      6 +   name: test
      7 +   namespace: tap-cert-manager-install
      8 + spec:
      9 +   packageRef:
     10 +     refName: test.example.com
     11 +     versionSelection:
     12 +       constraints: 0.1.0-experimental
     13 +   serviceAccountName: install-sa
     14 +

Changes

Namespace                 Name                                 Kind            Age  Op      Op st.  Wait to    Rs  Ri
tap-cert-manager-install  test                                 PackageInstall  -    create  -       reconcile  -   -
^                         test.example.com.0.1.0-experimental  Package         -    create  -       reconcile  -   -

Op:      2 create, 0 delete, 0 update, 0 noop, 0 exists
Wait to: 2 reconcile, 0 delete, 0 noop

8:32:26AM: ---- applying 2 changes [0/2 done] ----
8:32:26AM: create packageinstall/test (packaging.carvel.dev/v1alpha1) namespace: tap-cert-manager-install
8:32:26AM: create package/test.example.com.0.1.0-experimental (data.packaging.carvel.dev/v1alpha1) namespace: tap-cert-manager-install
8:32:26AM: ---- waiting on 2 changes [0/2 done] ----
8:32:26AM: ongoing: reconcile packageinstall/test (packaging.carvel.dev/v1alpha1) namespace: tap-cert-manager-install
8:32:26AM:  ^ Waiting for generation 1 to be observed
8:32:26AM: ok: reconcile package/test.example.com.0.1.0-experimental (data.packaging.carvel.dev/v1alpha1) namespace: tap-cert-manager-install
8:32:26AM: ---- waiting on 1 changes [1/2 done] ----
8:32:26AM: fail: reconcile packageinstall/test (packaging.carvel.dev/v1alpha1) namespace: tap-cert-manager-install
8:32:26AM:  ^ Reconcile failed:  (message: Selecting versions: Parsing version constraint '0.1.0-experimental': Could not get version from string: "<")

kapp: Error: waiting on reconcile packageinstall/test (packaging.carvel.dev/v1alpha1) namespace: tap-cert-manager-install:
  Finished unsuccessfully (Reconcile failed:  (message: Selecting versions: Parsing version constraint '0.1.0-experimental': Could not get version from string: "<"))

The present x trips carvel-dev/semver into applying wildcard logic. But it's not a wildcard. There are no wildcards in prerelease identifiers.

What did you expect:

It install the package.

Anything else you would like to add:

The issue originates in github.com/carvel-dev/semver and gets exposed to kapp-controller through github.com/carvel-dev/vendir. There is the existing carvel-dev/vendir#123 which is now ~3 years old. Therefore I am bringing it up here again.

The problem is that the issue goes down so deep and the error message Parsing version constraint '0.1.0-experimental': Could not get version from string: "<" is incomprehensible unless one knows what's going on.

[Additional information that will assist in solving the issue.]

Environment:

  • kapp Controller version v0.48.2

Vote on this request

This is an invitation to the community to vote on issues, to help us prioritize our backlog. Use the "smiley face" up to the right of this comment to vote.

๐Ÿ‘ "I would like to see this addressed as soon as possible"
๐Ÿ‘Ž "There are other more important things to focus on right now"

We are also happy to receive and review Pull Requests if you want to help working on this issue.

I am now versioning that package with eggsperimental because I am upset and Easter is approaching ๐Ÿ˜†

I am now versioning that package with eggsperimental because I am upset and Easter is approaching ๐Ÿ˜†

๐Ÿคฃ

As always, thank you so much for being amazing and looking into this โค๏ธ

supposed to be fixed by #1534