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

Crossplane function - Cannot resolve package dependencies: cannot initialize dependency graph from the packages in the lock #5564

Open
btwseeu78 opened this issue Apr 9, 2024 · 4 comments
Labels
bug Something isn't working package

Comments

@btwseeu78
Copy link

What happened?

Recently while installing function i came to know about this weird problem,
and i believe it should not be working like this,
so, to give details -
I already have one function "function-patch-and-transform" installed .
I again installed the same function(diff function metadata.name) with another function(this is fresh function).
now when i install them i see the fresh function is not healthy and the reason is the first function is duplicate, i don't think they should be related at all. some more details from status.

Spec:
  Ignore Crossplane Constraints:  false
  Package:                        xpkg.upbound.io/crossplane-contrib/function-sequencer:v0.1.2
  Package Pull Policy:            IfNotPresent
  Revision Activation Policy:     Automatic
  Revision History Limit:         1
  Runtime Config Ref:
    API Version:               pkg.crossplane.io/v1beta1
    Kind:                      DeploymentRuntimeConfig
    Name:                      default
  Skip Dependency Resolution:  false
Status:
  Conditions:
    Last Transition Time:  2024-04-09T11:18:19Z
    Message:               cannot resolve package dependencies: cannot initialize dependency graph from the packages in the lock: node xpkg.upbound.io/crossplane-contrib/function-patch-and-transform already exists
    Reason:                UnknownPackageRevisionHealth
    Status:                Unknown
    Type:                  Healthy
    Last Transition Time:  2024-04-09T11:18:14Z
    Reason:                ActivePackageRevision
    Status:                True
    Type:                  Installed
  Current Identifier:      xpkg.upbound.io/crossplane-contrib/function-sequencer:v0.1.2
  Current Revision:        function-sequencer-c3d57e50b393

How can we reproduce it?

  1. Install Crossplane function patch-and-transform.
  2. Install another function(new function) as well as another function which refers patch-and-transform.

What environment did it happen in?

Crossplane version: v1.15.1(xpkg.upbound.io/crossplane/crossplane)

Env:

cluster - kind
K8sVersionPrefix - 1.29.

Details to reproduce :-

  1. Install patch-and-transform (official Doc)
  2. Install this manifest
---
# Source: crossplane-function/templates/deployment-runtime-config.yaml
apiVersion: pkg.crossplane.io/v1beta1
kind: DeploymentRuntimeConfig
metadata:
  name: patch-and-transform-beta
spec:
  serviceAccountTemplate:
    metadata:
      name: patch-and-transform-beta
  deploymentTemplate:
    spec:
      selector:
        matchLabels:
          pkg.crossplane.io/function: patch-and-transform-beta
      replicas: 2
      template:
        spec:
          containers:
          - name: package-runtime
            image: xpkg.upbound.io/crossplane-contrib/function-patch-and-transform:v0.4.0
            args:
            - --d
...
---
# Source: crossplane-function/templates/deployment-runtime-config.yaml
apiVersion: pkg.crossplane.io/v1beta1
kind: DeploymentRuntimeConfig
metadata:
  name: function-sequencer
spec:
  deploymentTemplate:
    spec:
      selector:
        matchLabels:
          pkg.crossplane.io/function: function-sequencer
      replicas: 1
      template:
        spec:
          containers:
          - name: package-runtime
            image: xpkg.upbound.io/crossplane-contrib/function-sequencer:v0.1.2
...
---
# Source: crossplane-function/templates/function.yaml
apiVersion: pkg.crossplane.io/v1beta1
kind: Function
metadata:
  name: patch-and-transform-beta
spec:
  package: xpkg.upbound.io/crossplane-contrib/function-patch-and-transform:v0.4.0
  runtimeConfigRef:
    apiVersion: pkg.crossplane.io/v1beta1
    kind: DeploymentRuntimeConfig
    name: patch-and-transform-beta
...
---
# Source: crossplane-function/templates/function.yaml
apiVersion: pkg.crossplane.io/v1beta1
kind: Function
metadata:
  name: function-sequencer
spec:
  package: xpkg.upbound.io/crossplane-contrib/function-sequencer:v0.1.2
...

Slack Conversations realted to this : https://crossplane.slack.com/archives/CEG3T90A1/p1712662410221119

@btwseeu78 btwseeu78 added the bug Something isn't working label Apr 9, 2024
@jbw976
Copy link
Member

jbw976 commented Apr 10, 2024

Thanks for opening this issue and providing more context @btwseeu78!

I'd love to understand your scenario a bit better - is there a reason you're hoping to have more than 1 version of function-patch-and-transform installed in the control plane? what does your ideal outcome look like if your scenario worked as intended? 🤔

I think in general it's not supported to install 2 copies of the same function right now - I can essentially reproduce this same scenario just installing function-patch-and-transform twice, without function-sequencer. I think for function-sequencer, you're getting the error message about function-patch-and-transform in the lock file, which is a bit misleading, because the lock file as a whole is in an unsupported state due to the duplicated functions, and therefore the package manager can't even try to think about function-sequencer's dependencies (of which there are actually none). I think this is what's happening here 😇

Here's a repro of this scenario with just 2 function-patch-and-transform:

apiVersion: pkg.crossplane.io/v1beta1
kind: Function
metadata:
  name: function-patch-and-transform
spec:
  package: xpkg.upbound.io/crossplane-contrib/function-patch-and-transform:v0.4.0
apiVersion: pkg.crossplane.io/v1beta1
kind: Function
metadata:
  name: function-patch-and-transform-2
spec:
  package: xpkg.upbound.io/crossplane-contrib/function-patch-and-transform:v0.4.0

@jbw976 jbw976 added the package label Apr 10, 2024
@phisco
Copy link
Contributor

phisco commented Apr 10, 2024

Yes, we could probably avoid getting the lock in a knowingly inconsistent state beforehand 🤔

@btwseeu78
Copy link
Author

btwseeu78 commented Apr 12, 2024

The error about patch and transform is self explanatory and as of now i don't want two version of function,but maybe be useful in future provided we fix crd for input i don't have a use case as of now on that.

My only concern is that individual functions should be independent of each other since they don't share anything between them,function sequencer should be in healthy state irrespective of whatever happening for patch and transform.

Function should be independent of each other they use diff input crds,runs on diff pods why should it be dependent on another I don't believe that should the way it should work.

@phisco
Copy link
Contributor

phisco commented Apr 21, 2024

Related old issue: #3423

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working package
Projects
None yet
Development

No branches or pull requests

3 participants