Bitbucket repo as helm-chart repository

Table of contents

No heading

No headings in the article.

Hosting helm charts is a common use case in devops world. Helm charts can be hosted on many open source repositories like chartmuseum, hosting on some git repository (GitHub / bitbucket) or paid solutions such as JFrog, Nexus etc.

Hosting helm charts on bitbucket can be done as follows:

  1. Create a new repo (say k8s-helm-chart-repo)--> clone that repo --> Create charts folder
utsav@mac k8s-helm-chart-repo % mkdir charts
  1. Add helm charts .tgz file to charts folder
utsav@mac k8s-helm-chart-repo % cd charts 
utsav@mac charts % ls -l
total 232
-rw-r--r--  1 utsav  staff  103142 Mar 31 17:12 keycloak-13.3.0.tgz
-rw-r--r--@ 1 utsav  staff    8545 Mar 31 17:13 nxrm-ha-aws-50.0.0.tgz
  1. Create index file from `helm repo index` command
utsav@mac k8s-helm-chart-repo % helm repo index .
utsav@mac k8s-helm-chart-repo % ls -l
total 8
drwxr-xr-x  4 utsav  staff   128 Mar 31 17:13 charts
-rw-r--r--  1 utsav  staff  2007 Mar 31 17:24 index.yaml
  1. check index file generated in last step
utsav@mac k8s-helm-chart-repo % cat index.yaml 
apiVersion: v1
entries:
  keycloak:
  - annotations:
      category: DeveloperTools
      licenses: Apache-2.0
    apiVersion: v2
    appVersion: 20.0.5
    created: "2023-03-31T17:24:10.941244+05:30"
    dependencies:
    - condition: postgresql.enabled
      name: postgresql
      repository: https://charts.bitnami.com/bitnami
      version: 12.x.x
    - name: common
      repository: https://charts.bitnami.com/bitnami
      tags:
      - bitnami-common
      version: 2.x.x
    description: Keycloak is a high performance Java-based identity and access management
      solution. It lets developers add an authentication layer to their applications
      with minimum effort.
    digest: 387c50af562ec90832f7e9a5d6f3730b94cab6cd706a1c3d94177b3c6d7583b0
    home: https://www.keycloak.org
    icon: https://bitnami.com/assets/stacks/keycloak/img/keycloak-stack-220x234.png
    keywords:
    - keycloak
    - access-management
    maintainers:
    - name: Bitnami
      url: https://github.com/bitnami/charts
    name: keycloak
    sources:
    - https://github.com/bitnami/containers/tree/main/bitnami/keycloak
    - https://github.com/keycloak/keycloak
    urls:
    - charts/keycloak-13.3.0.tgz
    version: 13.3.0
  nxrm-ha-aws:
  - apiVersion: v2
    appVersion: 3.50.0
    created: "2023-03-31T17:24:10.943409+05:30"
    description: Resilient AWS Deployment of Sonatype Nexus Repository - Universal
      Binary repository
    digest: 437d2dc803cb1f6be4b040db5862ba9f96af4a187a234bbda89e0323f2e66347
    home: https://www.sonatype.com/nexus-repository-oss
    icon: https://sonatype.github.io/helm3-charts/NexusRepo_Vertical.svg
    keywords:
    - artifacts
    - dependency
    - management
    - sonatype
    - nexus
    - repository
    - quickstart
    - ci
    - repository-manager
    - nexus3
    maintainers:
    - name: Sonatype
    name: nxrm-ha-aws
    type: application
    urls:
    - charts/nxrm-ha-aws-50.0.0.tgz
    version: 50.0.0
generated: "2023-03-31T17:24:10.930997+05:30"
  1. Push code to the git repo (repo structure).
-- k8s-helm-chart-repo
  -- index.yaml
  -- charts
    -- keycloak-13.3.0.tgz
    -- nxrm-ha-aws-50.0.0.tgz
  1. Add repo from CLI and search for helm charts
#Syntax
helm repo add {REPONAME} https://api.bitbucket.org/2.0/repositories/{USER|ORGANISATION}/{REPOSITORY}/src/{branch-name}/ --username {USER} --password {APP-PASSWORD}
#Add repo to your local
utsav@mac ~ % helm repo add bitbucket-repo https://api.bitbucket.org/2.0/repositories/utsavgarg/k8s-helm-chart-repo/src/master/ --username <bitbucket-username> --password <password>
"bitbucket-repo" has been added to your repositories

#Search repo for helm charts
utsav@mac ~ % helm search repo bitbucket-repo
NAME                          CHART VERSION    APP VERSION    DESCRIPTION                                       
bitbucket-repo/keycloak       13.3.0           20.0.5         Keycloak is a high performance Java-based ident...
bitbucket-repo/nxrm-ha-aws    50.0.0           3.50.0         Resilient AWS Deployment of Sonatype Nexus Repo...
utsav@mac k8s-helm-chart-repo % cat index.yaml 
apiVersion: v1
entries:
  keycloak:
  - annotations:
      category: DeveloperTools
      licenses: Apache-2.0
    apiVersion: v2
    appVersion: 20.0.5
    created: "2023-03-31T17:24:10.941244+05:30"
    dependencies:
    - condition: postgresql.enabled
      name: postgresql
      repository: https://charts.bitnami.com/bitnami
      version: 12.x.x
    - name: common
      repository: https://charts.bitnami.com/bitnami
      tags:
      - bitnami-common
      version: 2.x.x
    description: Keycloak is a high performance Java-based identity and access management
      solution. It lets developers add an authentication layer to their applications
      with minimum effort.
    digest: 387c50af562ec90832f7e9a5d6f3730b94cab6cd706a1c3d94177b3c6d7583b0
    home: https://www.keycloak.org
    icon: https://bitnami.com/assets/stacks/keycloak/img/keycloak-stack-220x234.png
    keywords:
    - keycloak
    - access-management
    maintainers:
    - name: Bitnami
      url: https://github.com/bitnami/charts
    name: keycloak
    sources:
    - https://github.com/bitnami/containers/tree/main/bitnami/keycloak
    - https://github.com/keycloak/keycloak
    urls:
    - charts/keycloak-13.3.0.tgz
    version: 13.3.0
  nxrm-ha-aws:
  - apiVersion: v2
    appVersion: 3.50.0
    created: "2023-03-31T17:24:10.943409+05:30"
    description: Resilient AWS Deployment of Sonatype Nexus Repository - Universal
      Binary repository
    digest: 437d2dc803cb1f6be4b040db5862ba9f96af4a187a234bbda89e0323f2e66347
    home: https://www.sonatype.com/nexus-repository-oss
    icon: https://sonatype.github.io/helm3-charts/NexusRepo_Vertical.svg
    keywords:
    - artifacts
    - dependency
    - management
    - sonatype
    - nexus
    - repository
    - quickstart
    - ci
    - repository-manager
    - nexus3
    maintainers:
    - name: Sonatype
    name: nxrm-ha-aws
    type: application
    urls:
    - charts/nxrm-ha-aws-50.0.0.tgz
    version: 50.0.0
generated: "2023-03-31T17:24:10.930997+05:30"

Happy helming!!