Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- (Feature) Helm Lint
- (Bugfix) Helm Lint Indent fix
- (Feature) Add CA Certificates
- (Feature) Chart By Tag filter

## [1.3.0](https://github.com/arangodb/kube-arangodb/tree/1.3.0) (2025-08-01)
- (Feature) (Platform) Storage Debug
Expand Down
2 changes: 2 additions & 0 deletions pkg/util/constants/helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,6 @@ const (

// HelmLabelArangoDBType set to platform or service
HelmLabelArangoDBType = HelmLabelInstallationBase + "/type"

HelmLabelTag = HelmLabelBase + "/tag"
)
32 changes: 32 additions & 0 deletions pkg/util/k8sutil/helm/chart_manager_repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,16 @@ import (
"sort"

"helm.sh/helm/v3/pkg/repo"

"github.com/arangodb/kube-arangodb/pkg/util"
"github.com/arangodb/kube-arangodb/pkg/util/constants"
)

type ChartManagerRepo interface {
Versions() []string

Get(version string) (ChartManagerRepoVersion, bool)
GetByTag(version string) (ChartManagerRepoVersion, bool)
Latest() (ChartManagerRepoVersion, bool)
}

Expand Down Expand Up @@ -63,6 +67,34 @@ func (c chartManagerRepo) Versions() []string {
return s
}

func (c chartManagerRepo) GetByTag(version string) (ChartManagerRepoVersion, bool) {
r, ok := c.manager.index.Entries[c.name]
if !ok {
return nil, false
}

r = util.FilterList(r, func(v *repo.ChartVersion) bool {
if v, ok := v.Annotations[constants.HelmLabelTag]; ok && v == version {
return true
}
return false
})

r = util.Sort(r, func(i, j *repo.ChartVersion) bool {
return i.Created.After(j.Created)
})

if len(r) == 0 {
return nil, false
}

return chartManagerRepoVersion{
version: r[0].Version,
manager: c.manager,
chart: r[0],
}, true
}

func (c chartManagerRepo) Get(version string) (ChartManagerRepoVersion, bool) {
if version == "latest" {
return c.Latest()
Expand Down
10 changes: 10 additions & 0 deletions pkg/util/k8sutil/helm/chart_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,13 @@ func Test_Manager(t *testing.T) {

require.NoError(t, mgr.Reload(context.Background()))
}

func Test_Manager_Tag(t *testing.T) {
mgr, err := NewChartManager(context.Background(), nil, "https://arangodb-platform-dev-chart-registry.s3.amazonaws.com/index.yaml")
require.NoError(t, err)

repo, ok := mgr.Get("platform_test_example")
require.True(t, ok)

repo.GetByTag("dev")
}