Add an Application Dependency

There are two fundamental approaches to add a Helm dependency to your Great Bear Application Package (GBAP). You can either

Note: If you are adding a dependency to a published application package, you must subsequently follow the Update an Application Package steps.

Add a dependency from a remote repository

If you add a dependency to a GBAP from a remote repository, then during validation the packaging tool will attempt to resolve all dependencies and extract the correlating charts within the GBAP charts sub-folder.

  1. Edit the root GBAP Chart.yaml and declare a new dependency from a remote repository in the dependencies field.

    The following example adds the Logstash chart as a dependency:

    cat pathToMyGBAP/Chart.yaml
    
    apiVersion: v2
    appVersion: "1.0.0"
    description: My application
    name: my-app
    version: 0.0.1
    dependencies:
      - name: "logstash"
        version: "5.1.4"
        repository: "https://charts.bitnami.com/bitnami"
    
  2. Make sure that you have configured the local Helm client to login to the specified remote repository.

    The following example registers a public repo (bitnami), and a private repo that requires credentials.

    helm registry login https://charts.bitnami.com/bitnami
    helm registry login https://myrepo.com/charts -u <myRepoUserName> -p <myRepoPassword>
    

Add a dependency from a local filesystem path

The packaging SDK tool provides an add command, this can be used to add/update a Helm dependency from the local filesystem to an existing GBAP.

Usage:
  gbear application add PATH [flags]
  gbear app add PATH [flags]

Flags:
      --helm string   A path to existing Helm chart to add as sub-chart to the existing GBAP
  -h, --help          help for create

The command takes an optional PATH (defaults to current working directory) as a destination to create a GBAP file system tree.

The add command with the –helm flag supports the following scenarios:

Update an existing GBAP sub-chart dependency

Scenario 1: I have a GBAP with an existing sub-chart dependency, I have a newer version of the correlating sub Chart in it’s local repository and would like to update the GBAP dependency with the new Chart version.
Scenario 2: I have a GBAP with an existing sub-chart dependency, I would like to revert the sub chart dependency to an older version from it’s local repository.

Note: This correlates with the Application with existing Helm chart imported to Great Bear scenario.

Example for scenario 1:

Existing GBAP:

/pathTo/myGBAP
├── Chart.yaml     # contains dependency of myAppChart @ version 1.0.1
|── charts
|   └── myAppChart # Physical copy of myAppChart tree @ version 1.0.1
|        ├── templates
│        |    ├── _helpers.tpl
│        |    ├── deployment.yaml
│        |    ├── service.yaml
|        └── values.yaml
├── gbear
│   └── appmetadata.yaml

Run the tool to add a local repository path to myAppChart @ version 1.0.2

gbear app add /pathTo/myGBAP --helm=./pathTo/v102/myAppChart

Resulting GBAP tree:

/pathTo/myGBAP
├── Chart.yaml     # contains updated dependency of myAppChart @ version 1.0.2
|── charts
|   └── myAppChart # Physical copy of myAppChart tree @ version 1.0.2
|        ├── templates
│        |    ├── _helpers.tpl
│        |    ├── deployment.yaml
│        |    ├── service.yaml
|        └── values.yaml
├── gbear
│   └── appmetadata.yaml

Update an existing GBAP with an additional sub-chart dependency

Scenario 1: I have a GBAP with an existing sub-chart dependency, I would like to add another sub-chart dependency from it’s local repository to the GBAP.
Scenario 2: I have a GBAP without any dependencies, I would like add my first sub-chart dependency from it’s local repository to the GBAP.

Example for scenario 1:

Existing GBAP:

/pathTo/myGBAP
├── Chart.yaml     
|── charts
|   └── myAppChart 
|        ├── templates
│        |    ├── _helpers.tpl
│        |    ├── deployment.yaml
│        |    ├── service.yaml
|        └── values.yaml
├── gbear
│   └── appmetadata.yaml

Run the tool to add a local repository path to anotherAppChart @ version 1.0.1

gbear app add /pathTo/myGBAP --helm=/pathTo/v101/anotherAppChart

Resulting GBAP tree:

/pathTo/myGBAP
├── Chart.yaml     # contains an additional dependency of anotherAppChart @ version 1.0.1
|── charts
|   └── myAppChart 
|   |    ├── templates
│   |    |    ├── _helpers.tpl
│   |    |    ├── deployment.yaml
│   |    |    ├── service.yaml
|   |    └── values.yaml
|   └── anotherAppChart # physical copy of anotherAppChart tree @ version 1.0.1
|        ├── templates
│        |    ├── _helpers.tpl
│        |    ├── deployment.yaml
│        |    ├── service.yaml
|        └── values.yaml
├── gbear
│   └── appmetadata.yaml