Skip to content

Commit

Permalink
Support plumbing helm release name into agent
Browse files Browse the repository at this point in the history
The api now has this as an available attribute, we need to let the agent respect it as well.
  • Loading branch information
michaeljguarino committed Apr 26, 2024
1 parent 74bb034 commit 517da6a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ require (
github.com/orcaman/concurrent-map/v2 v2.0.1
github.com/osteele/liquid v1.3.2
github.com/pkg/errors v0.9.1
github.com/pluralsh/console-client-go v0.1.15
github.com/pluralsh/console-client-go v0.5.2
github.com/pluralsh/controller-reconcile-helper v0.0.4
github.com/pluralsh/gophoenix v0.1.3-0.20231201014135-dff1b4309e34
github.com/pluralsh/polly v0.1.7
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,8 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE
github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg=
github.com/pluralsh/console-client-go v0.1.15 h1:1N8FxSkHbu29P7AtzF/tQbXlztM43CMATSNTxCulLhw=
github.com/pluralsh/console-client-go v0.1.15/go.mod h1:eyCiLA44YbXiYyJh8303jk5JdPkt9McgCo5kBjk4lKo=
github.com/pluralsh/console-client-go v0.5.2 h1:vDiKzZ/vPFivr9TIXSSi/6Q1nOrH4y1huE5XkrCJ3D0=
github.com/pluralsh/console-client-go v0.5.2/go.mod h1:eyCiLA44YbXiYyJh8303jk5JdPkt9McgCo5kBjk4lKo=
github.com/pluralsh/controller-reconcile-helper v0.0.4 h1:1o+7qYSyoeqKFjx+WgQTxDz4Q2VMpzprJIIKShxqG0E=
github.com/pluralsh/controller-reconcile-helper v0.0.4/go.mod h1:AfY0gtteD6veBjmB6jiRx/aR4yevEf6K0M13/pGan/s=
github.com/pluralsh/gophoenix v0.1.3-0.20231201014135-dff1b4309e34 h1:ab2PN+6if/Aq3/sJM0AVdy1SYuMAnq4g20VaKhTm/Bw=
Expand Down
11 changes: 8 additions & 3 deletions pkg/manifests/template/helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,12 @@ func (h *helm) Render(svc *console.GetServiceDeploymentForAgent_ServiceDeploymen
}
}

rel, err := h.templateHelm(config, svc.Name, svc.Namespace, values)
release := svc.Name
if svc.Helm.Release != nil {
release = *svc.Helm.Release
}

rel, err := h.templateHelm(config, release, svc.Namespace, values)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -200,7 +205,7 @@ func (h *helm) valuesFile(svc *console.GetServiceDeploymentForAgent_ServiceDeplo
return currentMap, nil
}

func (h *helm) templateHelm(conf *action.Configuration, name, namespace string, values map[string]interface{}) (*release.Release, error) {
func (h *helm) templateHelm(conf *action.Configuration, release, namespace string, values map[string]interface{}) (*release.Release, error) {
// load chart from the path
chart, err := loader.Load(h.dir)
if err != nil {
Expand All @@ -212,7 +217,7 @@ func (h *helm) templateHelm(conf *action.Configuration, name, namespace string,
if !DisableHelmTemplateDryRunServer {
client.DryRunOption = "server"
}
client.ReleaseName = name
client.ReleaseName = release
client.Replace = true // Skip the name check
client.ClientOnly = true
client.Namespace = namespace
Expand Down

0 comments on commit 517da6a

Please sign in to comment.