kabanero-io / kabanero-command-line-services

This repo will be archived soon.
Apache License 2.0
3 stars 7 forks source link

Support multiple versions of the same Stack #101

Closed kaczyns closed 4 years ago

kaczyns commented 4 years ago

The Collection CRD v1alpha1 has recently been extended to support a versions array in the spec section. See: https://github.com/kabanero-io/kabanero-operator/blob/88d5ac9139f9fcec09762c46ad6bb8d9a47b1d29/deploy/crds/kabanero_v1alpha1_collection_crd.yaml

Here is a sample usage:

apiVersion: kabanero.io/v1alpha1
kind: Collection
metadata:
  name: java-microprofile
  namespace: kabanero
spec:
  name: java-microprofile
  versions:
    - version: "0.2.5"
      repositoryUrl: "https://github.com/kabanero-io/collections/blah/blah/kabanero-index.yaml"
      desiredState: "active"
    - version: "0.2.6"
      repositoryUrl: "https://github.com/kabanero-io/collections/blah/new/kabanero-index.yaml"
      desiredState: "active"

The CLI service needs to be able to parse this information and return multiple versions of the collection back to the CLI on a list command. On a deactivate, a good place to start is probably deactivating all versions of the collection, but ideally the CLI would let the user specify which version, and the CLI service would just deactivate the specific version of the collection that the user asked for.

On a sync command, it may be necessary to parse multiple repositories. The Kabanero CRD already supports multiple repositories, but the CLI currently only uses the first one that it finds. The only way currently that there can be multiple versions of the same collection, is to have multiple repositories. For example:

apiVersion: kabanero.io/v1alpha1
kind: Kabanero
metadata:
  name: kabanero
  namespace: kabanero
spec:
  collections:
    repositories:
      - activateDefaultCollections: true
        name: incubator
        url: >-
          https://github.com/kabanero-io/collections/releases/download/0.4.0/kabanero-index.yaml
      - activateDefaultCollections: true
        name: incubator-old
        url: >-
          https://github.com/kabanero-io/collections/releases/download/0.2.1/kabanero-index.yaml

Note the second repository, which is pointing to and older version of the collections.

kaczyns commented 4 years ago

I just want to point out, that the CLI service is not currently broken - the Kabanero operator continues to support the old way of setting a single version of a collection. However our intention is to deprecate the v1alpha1 API in favor of a v1alpha2 API which only supports the multiple version syntax. The v1alpha2 API will be available soon, but the v1alpha1 API will not be removed for several releases. The CLI service should be converted as soon as is feasible.

kaczyns commented 4 years ago

Just to be clear - for Kabanero 0.6.0 the Collection CR instance is no longer supported, so some of what I said earlier about being backwards compatible is no longer true. 0.6.0 uses the Stack CR which only supports the versions array.

tseelbach commented 4 years ago

Should we close this issue as "won't do" for the v1alpha1 and open new issue for similar implemenation for stacks in v1alpha2? If we don't close it, the examples should be updated to be stacks

davco01a commented 4 years ago

completed