Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 565e4e5

Browse files
[Feature] Chart By Tag filter (#1958)
1 parent a7fa674 commit 565e4e5

File tree

4 files changed

+45
-0
lines changed

4 files changed

+45
-0
lines changed

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
- (Feature) Helm Lint
77
- (Bugfix) Helm Lint Indent fix
88
- (Feature) Add CA Certificates
9+
- (Feature) Chart By Tag filter
910

1011
## [1.3.0](https://github.com/arangodb/kube-arangodb/tree/1.3.0) (2025年08月01日)
1112
- (Feature) (Platform) Storage Debug

‎pkg/util/constants/helm.go‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,6 @@ const (
3434

3535
// HelmLabelArangoDBType set to platform or service
3636
HelmLabelArangoDBType = HelmLabelInstallationBase + "/type"
37+
38+
HelmLabelTag = HelmLabelBase + "/tag"
3739
)

‎pkg/util/k8sutil/helm/chart_manager_repo.go‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,16 @@ import (
2525
"sort"
2626

2727
"helm.sh/helm/v3/pkg/repo"
28+
29+
"github.com/arangodb/kube-arangodb/pkg/util"
30+
utilConstants "github.com/arangodb/kube-arangodb/pkg/util/constants"
2831
)
2932

3033
type ChartManagerRepo interface {
3134
Versions() []string
3235

3336
Get(version string) (ChartManagerRepoVersion, bool)
37+
GetByTag(version string) (ChartManagerRepoVersion, bool)
3438
Latest() (ChartManagerRepoVersion, bool)
3539
}
3640

@@ -63,6 +67,34 @@ func (c chartManagerRepo) Versions() []string {
6367
return s
6468
}
6569

70+
func (c chartManagerRepo) GetByTag(version string) (ChartManagerRepoVersion, bool) {
71+
r, ok := c.manager.index.Entries[c.name]
72+
if !ok {
73+
return nil, false
74+
}
75+
76+
r = util.FilterList(r, func(v *repo.ChartVersion) bool {
77+
if v, ok := v.Annotations[utilConstants.HelmLabelTag]; ok && v == version {
78+
return true
79+
}
80+
return false
81+
})
82+
83+
r = util.Sort(r, func(i, j *repo.ChartVersion) bool {
84+
return i.Created.After(j.Created)
85+
})
86+
87+
if len(r) == 0 {
88+
return nil, false
89+
}
90+
91+
return chartManagerRepoVersion{
92+
version: r[0].Version,
93+
manager: c.manager,
94+
chart: r[0],
95+
}, true
96+
}
97+
6698
func (c chartManagerRepo) Get(version string) (ChartManagerRepoVersion, bool) {
6799
if version == "latest" {
68100
return c.Latest()

‎pkg/util/k8sutil/helm/chart_manager_test.go‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,13 @@ func Test_Manager(t *testing.T) {
9292

9393
require.NoError(t, mgr.Reload(context.Background()))
9494
}
95+
96+
func Test_Manager_Tag(t *testing.T) {
97+
mgr, err := NewChartManager(context.Background(), nil, "https://arangodb-platform-dev-chart-registry.s3.amazonaws.com/index.yaml")
98+
require.NoError(t, err)
99+
100+
repo, ok := mgr.Get("platform_test_example")
101+
require.True(t, ok)
102+
103+
repo.GetByTag("dev")
104+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /