Respositories & Charts

There are two ways for managing repositories and charts. Either by configuring charts by repository or chart resource.

 

manage by repository resource

 

Let’s deploy a basic repository resource at first.


---
apiVersion: yaho.soer3n.dev/v1alpha1
kind: Repository
metadata:
  name: test-repo
spec:
  name: test-repo
  url: https://soer3n.github.io/charts/testing_a
  charts: []

Nothing except the resource and indices for all charts found in downloaded index should be installed.


$ kubectl get repositories.yaho.soer3n.dev 
NAME        GROUP   SYNCED   CHARTS   AGE
test-repo           true     0        14s

$ kubectl get charts.yaho.soer3n.dev 
No resources found

$ kubectl get cm -n helm 
NAME                                  DATA   AGE
helm-test-repo-testing-index          1      7s
helm-test-repo-testing-nested-index   1      7s
kube-root-ca.crt                      1      9m25s

Let’s add a chart without specified versions.


---
apiVersion: yaho.soer3n.dev/v1alpha1
kind: Repository
metadata:
  name: test-repo
spec:
  name: test-repo
  url: https://soer3n.github.io/charts/testing_a
  charts:
  - name: testing

Adding just a chart without specified versions should install the chart resource without any configuration except ‘create dependency’ parameter is set to true.


$ kubectl get repositories.yaho.soer3n.dev 
NAME        GROUP   SYNCED   CHARTS   AGE
test-repo           true     1        97s

$ kubectl get charts.yaho.soer3n.dev
NAME                GROUP   REPO        VERSIONS   DEPS     AGE
testing-test-repo           test-repo   synced     synced   4s

$ kubectl get cm -n helm 
NAME                                  DATA   AGE
helm-test-repo-testing-index          1      97s
helm-test-repo-testing-nested-index   1      97s
kube-root-ca.crt                      1      10m

Let’s add a version to the specified chart.


---
apiVersion: yaho.soer3n.dev/v1alpha1
kind: Repository
metadata:
  name: test-repo
spec:
  name: test-repo
  url: https://soer3n.github.io/charts/testing_a
  charts:
  - name: testing
    versions:
    - 0.1.1

Adding a version to specified chart should add configmaps with related information for usage of it.


$ kubectl get repositories.yaho.soer3n.dev 
NAME        GROUP   SYNCED   CHARTS   AGE
test-repo           true     1        7m

$ kubectl get charts.yaho.soer3n.dev
NAME                GROUP   REPO        VERSIONS   DEPS     AGE
testing-test-repo           test-repo   synced     synced   5m

$ kubectl get cm -n helm 
NAME                                   DATA   AGE
helm-crds-test-repo-testing-0.1.1      0      110s
helm-default-test-repo-testing-0.1.1   1      110s
helm-test-repo-testing-index           1      70s
helm-test-repo-testing-nested-index    1      70s
helm-tmpl-test-repo-testing-0.1.1      5      110s
kube-root-ca.crt                       1      16m

And add another version.


---
apiVersion: yaho.soer3n.dev/v1alpha1
kind: Repository
metadata:
  name: test-repo
spec:
  name: test-repo
  url: https://soer3n.github.io/charts/testing_a
  charts:
  - name: testing
    versions:
    - 0.1.0
    - 0.1.1

This should create configmaps related to the second version of the chart.


$ kubectl get repositories.yaho.soer3n.dev 
NAME        GROUP   SYNCED   CHARTS   AGE
test-repo           true     1        2m

$ kubectl get charts.yaho.soer3n.dev
NAME                    GROUP   REPO        VERSIONS   DEPS     AGE
testing-test-repo               test-repo   synced     synced   1m40s

$ kubectl get cm -n helm 
NAME                                   DATA   AGE
helm-crds-test-repo-testing-0.1.0      0      30s
helm-crds-test-repo-testing-0.1.1      0      50s
helm-default-test-repo-testing-0.1.0   1      30s
helm-default-test-repo-testing-0.1.1   1      50s
helm-test-repo-testing-index           1      56s
helm-test-repo-testing-nested-index    1      56s
helm-tmpl-test-repo-testing-0.1.0      5      30s
helm-tmpl-test-repo-testing-0.1.1      5      50s
kube-root-ca.crt                       1      19m

 

manage by chart resource

 

Again let’s deploy a basic repository resource at first.


---
apiVersion: yaho.soer3n.dev/v1alpha1
kind: Repository
metadata:
  name: test-repo
spec:
  name: test-repo
  url: https://soer3n.github.io/charts/testing_a
  charts: []

Nothing except the resource and indices for all charts found in downloaded index should be installed.


$ kubectl get repositories.yaho.soer3n.dev 
NAME        GROUP   SYNCED   CHARTS   AGE
test-repo           true     0        14s

$ kubectl get charts.yaho.soer3n.dev 
No resources found

$ kubectl get cm -n helm 
NAME                                  DATA   AGE
helm-test-repo-testing-index          1      14s
helm-test-repo-testing-nested-index   1      14s
kube-root-ca.crt                      1      9m25s

Let’s create a chart resource without specified versions.


---
apiVersion: yaho.soer3n.dev/v1alpha1
kind: Chart
metadata:
  name: test-chart
spec:
  name: testing
  repo: test-repo
  versions: []
  createDeps: false

Creating just a chart resource without specified versions should install nothing else than the resource with values configured in spec.


$ kubectl get repositories.yaho.soer3n.dev 
NAME        GROUP   SYNCED   CHARTS   AGE
test-repo           true     1        26s

$ kubectl get charts.yaho.soer3n.dev 
NAME         GROUP   REPO        VERSIONS   DEPS   AGE
test-chart           test-repo                     26s

$ kubectl get cm -n helm 
NAME                                  DATA   AGE
helm-test-repo-testing-index          1      26s
helm-test-repo-testing-nested-index   1      26s
kube-root-ca.crt                      1      26m

Let’s add a version to the chart resource.


---
apiVersion: yaho.soer3n.dev/v1alpha1
kind: Chart
metadata:
  name: test-chart
spec:
  name: testing
  repository: test-repo
  versions:
  - 0.1.1
  createDeps: false

Adding a version to chart resource should add configmaps with related information for usage of it.


NAME        GROUP   SYNCED   CHARTS   AGE
test-repo           true     1        5m53s

$ kubectl get charts.yaho.soer3n.dev 
NAME         GROUP   REPO        VERSIONS   DEPS        AGE
test-chart           test-repo   synced     synced   7m57s

$ kubectl get cm -n helm 
NAME                                   DATA   AGE
helm-crds-test-repo-testing-0.1.1      0      21s
helm-default-test-repo-testing-0.1.1   1      21s
helm-test-repo-testing-index           1      8m22s
helm-test-repo-testing-nested-index    1      8m22s
helm-tmpl-test-repo-testing-0.1.1      5      21s
kube-root-ca.crt                       1      41m

 

dependencies

 

Again let’s deploy a basic repository resource at first.


---
apiVersion: yaho.soer3n.dev/v1alpha1
kind: Repository
metadata:
  name: test-repo
spec:
  name: test-repo
  url: https://soer3n.github.io/charts/testing_a
  charts: []

Nothing except the resource and indices for all charts found in downloaded index should be installed.


$ kubectl get repositories.yaho.soer3n.dev 
NAME        GROUP   SYNCED   CHARTS   AGE
test-repo           true     0        14s

$ kubectl get charts.yaho.soer3n.dev 
No resources found

$ kubectl get cm -n helm 
NAME                                  DATA   AGE
helm-test-repo-testing-index          1      14s
helm-test-repo-testing-dep-index      1      14s
helm-test-repo-testing-nested-index   1      14s
kube-root-ca.crt                      1      9m25s

Let’s create a chart resource with a specified version and dependency installation disabled.


---
apiVersion: yaho.soer3n.dev/v1alpha1
kind: Chart
metadata:
  name: test-chart
spec:
  name: testing-dep
  repository: test-repo
  versions:
  - 0.1.0
  createDeps: false

Adding a chart resource with specified version should add configmaps with related information for usage of it.


NAME        GROUP   SYNCED   CHARTS   AGE
test-repo           true     1        8m

$ kubectl get charts.yaho.soer3n.dev 
NAME              GROUP   REPO        VERSIONS   DEPS        AGE
test-chart                test-repo   synced     synced      7m

$ kubectl get cm -n helm 
NAME                                      DATA   AGE
helm-crds-test-repo-testing-dep-0.1.0     0      7m
helm-default-test-repo-testing-dep-0.1.0  1      7m
helm-test-repo-testing-index              1      7m
helm-test-repo-testing-dep-index          1      7m
helm-test-repo-testing-nested-index       1      7m
helm-tmpl-test-repo-testing-dep-0.1.0     5      7m
kube-root-ca.crt                          1      41m

Let’s enable dependency installation for the chart resource.


---
apiVersion: yaho.soer3n.dev/v1alpha1
kind: Chart
metadata:
  name: test-chart
spec:
  name: testing-dep
  repository: test-repo
  versions:
  - 0.1.0
  createDeps: true

Enable dependency installation for the chart resource should add configmaps with related information for usage of dependency charts.


NAME        GROUP   SYNCED   CHARTS   AGE
test-repo           true     2        8m

$ kubectl get charts.yaho.soer3n.dev 
NAME              GROUP   REPO        VERSIONS   DEPS        AGE
test-chart                test-repo   synced     synced      7m
testing-test-repo         test-repo   synced     synced      1m

$ kubectl get cm -n helm 
NAME                                      DATA   AGE
helm-crds-test-repo-testing-dep-0.1.0     0      7m
helm-crds-test-repo-testing-0.1.1         0      1m
helm-default-test-repo-testing-dep-0.1.0  1      7m
helm-default-test-repo-testing-0.1.1      1      1m
helm-test-repo-testing-index              1      7m
helm-test-repo-testing-dep-index          1      7m
helm-test-repo-testing-nested-index       1      7m
helm-tmpl-test-repo-testing-dep-0.1.0     5      7m
helm-tmpl-test-repo-testing-0.1.1         5      1m
kube-root-ca.crt                          1      41m

Currently charts can only find dependency charts when they are in the same repository or both repositories are in the same repogroup which means that the repositories share the label value “yaho.soer3n.dev/repoGroup”

 

repository groups

Now let’s deploy a repository group where only one chart is specified.

Remember that the ‘create dependencies’ option is automatically set to true. The specified chart has a chart from the first repository as a dependency.


apiVersion: yaho.soer3n.dev/v1alpha1
kind: RepoGroup
metadata:
  name: repogroup-sample
spec:
  labelSelector: foo
  repos:
    - name: test-repo-a
      url: https://soer3n.github.io/charts/testing_a
    - name: test-repo-b
      url: https://soer3n.github.io/charts/testing_b
      charts:
      - name: testing-dep
        versions:
        - 0.1.1

After applying the repository group resource there are two charts with related configmaps are deployed. The specified and its dependency.


$ kubectl get repogroups.yaho.soer3n.dev
NAME             AGE
repogroup-sample 8m

$ kubectl get repositories.yaho.soer3n.dev
NAME        GROUP   SYNCED   CHARTS   AGE
test-repo-a foo     true     1        8m
test-repo-b foo     true     1        8m

$ kubectl get charts.yaho.soer3n.dev 
NAME                    GROUP   REPO        VERSIONS   DEPS        AGE
testing-test-repo-a     foo     test-repo-a synced     synced      8m
testing-dep-test-repo-b foo     test-repo-b synced     synced      8m

$ kubectl get cm -n helm 
NAME                                        DATA   AGE
helm-crds-test-repo-b-testing-dep-0.1.1     0      8m
helm-crds-test-repo-a-testing-0.1.1         0      8m
helm-default-test-repo-b-testing-dep-0.1.0  1      8m
helm-default-test-repo-a-testing-0.1.1      1      8m
helm-test-repo-a-testing-index              1      8m
helm-test-repo-a-testing-dep-index          1      8m
helm-test-repo-a-testing-nested-index       1      8m
helm-test-repo-b-testing-dep-index          1      8m
helm-tmpl-test-b-repo-testing-dep-0.1.1     5      8m
helm-tmpl-test-a-repo-testing-0.1.1         5      8m
kube-root-ca.crt                            1      41m

 

filter by labels

The custom resources and related configmaps can be filtered by labels.

LabelResourceValue
yaho.soer3n.dev/chartconfigmaps, chartchart name
yaho.soer3n.dev/repoconfigmaps, repository, chartrepo name
yaho.soer3n.dev/typeconfigmapsindex,tmpl,default,crds
yaho.soer3n.dev/repoGrouprepository, chartrepo group name
yaho.soer3n.dev/unmanagedchartif chart is managed by another resource