Skip to content

Commit 877c805

Browse files
Support plumbing helm release name into agent (#173)
The api now has this as an available attribute, we need to let the agent respect it as well.
1 parent 74bb034 commit 877c805

3 files changed

Lines changed: 11 additions & 4 deletions

File tree

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ require (
2020
github.com/orcaman/concurrent-map/v2 v2.0.1
2121
github.com/osteele/liquid v1.3.2
2222
github.com/pkg/errors v0.9.1
23-
github.com/pluralsh/console-client-go v0.1.15
23+
github.com/pluralsh/console-client-go v0.5.2
2424
github.com/pluralsh/controller-reconcile-helper v0.0.4
2525
github.com/pluralsh/gophoenix v0.1.3-0.20231201014135-dff1b4309e34
2626
github.com/pluralsh/polly v0.1.7

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,8 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE
528528
github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg=
529529
github.com/pluralsh/console-client-go v0.1.15 h1:1N8FxSkHbu29P7AtzF/tQbXlztM43CMATSNTxCulLhw=
530530
github.com/pluralsh/console-client-go v0.1.15/go.mod h1:eyCiLA44YbXiYyJh8303jk5JdPkt9McgCo5kBjk4lKo=
531+
github.com/pluralsh/console-client-go v0.5.2 h1:vDiKzZ/vPFivr9TIXSSi/6Q1nOrH4y1huE5XkrCJ3D0=
532+
github.com/pluralsh/console-client-go v0.5.2/go.mod h1:eyCiLA44YbXiYyJh8303jk5JdPkt9McgCo5kBjk4lKo=
531533
github.com/pluralsh/controller-reconcile-helper v0.0.4 h1:1o+7qYSyoeqKFjx+WgQTxDz4Q2VMpzprJIIKShxqG0E=
532534
github.com/pluralsh/controller-reconcile-helper v0.0.4/go.mod h1:AfY0gtteD6veBjmB6jiRx/aR4yevEf6K0M13/pGan/s=
533535
github.com/pluralsh/gophoenix v0.1.3-0.20231201014135-dff1b4309e34 h1:ab2PN+6if/Aq3/sJM0AVdy1SYuMAnq4g20VaKhTm/Bw=

pkg/manifests/template/helm.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,12 @@ func (h *helm) Render(svc *console.GetServiceDeploymentForAgent_ServiceDeploymen
9595
}
9696
}
9797

98-
rel, err := h.templateHelm(config, svc.Name, svc.Namespace, values)
98+
release := svc.Name
99+
if svc.Helm != nil && svc.Helm.Release != nil {
100+
release = *svc.Helm.Release
101+
}
102+
103+
rel, err := h.templateHelm(config, release, svc.Namespace, values)
99104
if err != nil {
100105
return nil, err
101106
}
@@ -200,7 +205,7 @@ func (h *helm) valuesFile(svc *console.GetServiceDeploymentForAgent_ServiceDeplo
200205
return currentMap, nil
201206
}
202207

203-
func (h *helm) templateHelm(conf *action.Configuration, name, namespace string, values map[string]interface{}) (*release.Release, error) {
208+
func (h *helm) templateHelm(conf *action.Configuration, release, namespace string, values map[string]interface{}) (*release.Release, error) {
204209
// load chart from the path
205210
chart, err := loader.Load(h.dir)
206211
if err != nil {
@@ -212,7 +217,7 @@ func (h *helm) templateHelm(conf *action.Configuration, name, namespace string,
212217
if !DisableHelmTemplateDryRunServer {
213218
client.DryRunOption = "server"
214219
}
215-
client.ReleaseName = name
220+
client.ReleaseName = release
216221
client.Replace = true // Skip the name check
217222
client.ClientOnly = true
218223
client.Namespace = namespace

0 commit comments

Comments
 (0)