Removing pinned Capability version for custom cluster groups

When you add a Capability to a cluster group, Tanzu Platform hub pins the installed Capability to a specific version. This can cause Spaces to not be scheduled after a new version of Tanzu Platform for Kubernetes is released with new versions of the Capability.

The reconciliation of the packages to underlying clusters fails if the Capability version is pinned. The most common use case for this is for custom cluster groups. However, the issue may also occur if you have added a Capability to the default run cluster group provided by Tanzu.

The following provides the steps to unpin Capabilities installed on a cluster group from a version and allow successful reconciliation to underlying clusters. You can do this by setting the version constraint to packages in a cluster group. This is similar to how the version constraint is set in the Tanzu provided run cluster group.

The recommended way to set the version constraint is with Tanzu CLI. The steps provided here loop through all the packages and change the constraint to be >0.0.0.

Updating the version constraints using Tanzu CLI

The following steps automatically set the constraints to all packages installed on the specified cluster group to >.0.0.0. This is similar to how the Capabilities are installed in the run cluster group provided by Tanzu.

  1. Login in to the Tanzu CLI context.

    tanzu login
    
  2. Select the Tanzu project containing the cluster group to update.

    tanzu project use
    
  3. Set the cluster group.

    tanzu operations clustergroup use upgrade-test
    
  4. Export the kubeconfig for the tanzu context.

    export KUBECONFIG=/Users/$USER/.config/tanzu/kube/config
    
  5. Update all the packages in the cluster group to have a version constraint of >0.0.0.

    for package in $(kubectl get pkgi -o json | jq -r '.items[].metadata.name'); do kubectl patch packageinstalls.packaging.carvel.dev $package  --type='json' -p '[{"op": "replace", "path": "/spec/packageRef/versionSelection/constraints", "value":">0.0.0"}]'; done;
    

More information about what is happening

  1. Log in in to the Tanzu CLI context.

    tanzu login
    
  2. Select the Tanzu project containing the cluster Group to update.

    tanzu project use
    
  3. Set the cluster group.

    tanzu operations clustergroup use upgrade-test
    
  4. Export the kubeconfig for the tanzu context

    export KUBECONFIG=/Users/$USER/.config/tanzu/kube/config
    
  5. List the packages that are installed for a cluster group.

    kubectl get pkgi
    

Now, you need to change the version constraint for each package from a pinned version to specify any version. For example, when you create a cluster group manually and install packages from the UI, you end up with a version constraint of the following:

apiVersion: packaging.carvel.dev/v1alpha1
kind: PackageInstall
metadata:
  annotations:
    installationDescription: ""
    ucp.metadata.generation: "1"
  creationTimestamp: "2024-07-02T18:16:57Z"
  generation: 1
  labels:
    claimed.internal.apis.kcp.io/5PvZadmvTixTbsQIxx4aPfzgWGy8Z8dBWvQHIB: 3XGJMovyX341WJd5hgMVOQdNlCB7dKm76E5HDX
  name: crossplane.tanzu.vmware.com
  namespace: default
  resourceVersion: "21593195"
  uid: 97a6bbc3-8035-413a-9b30-d7ac0841f786
spec:
  defaultNamespace: unusable-namespace
  packageRef:
    refName: crossplane.tanzu.vmware.com
    versionSelection:
      **constraints: 0.6.1**
  serviceAccountName: pkg-installs-sa
  values:
  - secretRef:
      name: crossplane.tanzu.vmware.com
status:
  conditions:
  - lastTransitionTime: "2024-07-02T18:16:57Z"
    message: no clusters found
    reason: Ready
    status: "True"
    type: Ready
  friendlyDescription: ""
  observedGeneration: 0

When the default run cluster group has the following:

apiVersion: packaging.carvel.dev/v1alpha1
kind: PackageInstall
metadata:
  annotations:
    kapp.k14s.io/change-group: crossplane
    provided.tanzu.vmware.com: ""
    ucp.metadata.generation: "1"
  creationTimestamp: "2024-05-11T19:08:41Z"
  generation: 1
  labels:
    claimed.internal.apis.kcp.io/5PvZadmvTixTbsQIxx4aPfzgWGy8Z8dBWvQHIB: 3XGJMovyX341WJd5hgMVOQdNlCB7dKm76E5HDX
    default.cluster-group.capability/provider-ref: cluster-group.provided.tanzu.vmware.com
  name: crossplane.tanzu.vmware.com
  namespace: default
  resourceVersion: "21599344"
  uid: 3a74b8d1-0c43-41ee-87ad-60490555f047
spec:
  defaultNamespace: unusable-namespace
  packageRef:
    refName: crossplane.tanzu.vmware.com
    versionSelection:
      constraints: '>0.0.0'
      prereleases: {}
  serviceAccountName: pkg-installs-sa
status:
  conditions:
  - lastTransitionTime: "2024-07-02T18:36:20Z"
    message: '[succeeded: 9, failed: 0, reconciling: 0]'
    reason: ReconcileSucceeded
    status: "True"
    type: ReconcileSucceeded
  friendlyDescription: ""
  lastAttemptedVersion: 0.6.1
  observedGeneration: 0
  version: 0.6.1
check-circle-line exclamation-circle-line close-line
Scroll to top icon