Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kevin/eng 2029 use agent version specified in deployment settings from cli #508

Merged
Show file tree
Hide file tree
Changes from all commits
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
13 changes: 9 additions & 4 deletions cmd/plural/cd.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package plural
import (
"fmt"
"os"
"strings"

"github.com/pluralsh/plural-cli/pkg/cd"
"github.com/pluralsh/plural-cli/pkg/config"
Expand Down Expand Up @@ -123,12 +124,16 @@ func (p *Plural) doInstallOperator(url, token, values string) error {

vals := map[string]interface{}{}
globalVals := map[string]interface{}{}
version := ""

if p.ConsoleClient != nil {
settings, err := p.ConsoleClient.GetGlobalSettings()
if err == nil && settings != nil && settings.AgentHelmValues != nil {
if err := yaml.Unmarshal([]byte(*settings.AgentHelmValues), &globalVals); err != nil {
return err
if err == nil && settings != nil {
version = strings.Trim(settings.AgentVsn, "v")
if settings.AgentHelmValues != nil {
if err := yaml.Unmarshal([]byte(*settings.AgentHelmValues), &globalVals); err != nil {
return err
}
}
}
}
Expand All @@ -139,7 +144,7 @@ func (p *Plural) doInstallOperator(url, token, values string) error {
}
}
vals = algorithms.Merge(vals, globalVals)
err = console.InstallAgent(url, token, console.OperatorNamespace, vals)
err = console.InstallAgent(url, token, console.OperatorNamespace, version, vals)
if err == nil {
utils.Success("deployment operator installed successfully\n")
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ require (
github.com/packethost/packngo v0.29.0
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8
github.com/pluralsh/cluster-api-migration v0.2.15
github.com/pluralsh/console-client-go v0.1.17
github.com/pluralsh/console-client-go v0.5.3
github.com/pluralsh/gqlclient v1.11.0
github.com/pluralsh/plural-operator v0.5.5
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 @@ -1426,6 +1426,8 @@ github.com/pluralsh/cluster-api-migration v0.2.15 h1:TIfusD+wnhZTGmwNfIlKlKJOT2d
github.com/pluralsh/cluster-api-migration v0.2.15/go.mod h1:J6lEvC/70KouikX16mE331cxc3y3sBwtmfHGwZqu06w=
github.com/pluralsh/console-client-go v0.1.17 h1:QMtnWdRvV13/sND/CFjFBUR8nyg3JJgwXReSyM6bK7A=
github.com/pluralsh/console-client-go v0.1.17/go.mod h1:eyCiLA44YbXiYyJh8303jk5JdPkt9McgCo5kBjk4lKo=
github.com/pluralsh/console-client-go v0.5.3 h1:RB4XtKlvh8+BM5o1o0h+W6zHculBGbL6q5lI/yRnqJE=
github.com/pluralsh/console-client-go v0.5.3/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/gqlclient v1.11.0 h1:FfXW7FiEJLHOfTAa7NxDb8jb3aMZNIpCAcG+bg8uHYA=
Expand Down
5 changes: 4 additions & 1 deletion pkg/console/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const (
OperatorNamespace = "plrl-deploy-operator"
)

func InstallAgent(url, token, namespace string, values map[string]interface{}) error {
func InstallAgent(url, token, namespace, version string, values map[string]interface{}) error {
settings := cli.New()
vals := map[string]interface{}{
"secrets": map[string]string{
Expand All @@ -39,6 +39,9 @@ func InstallAgent(url, token, namespace string, values map[string]interface{}) e
return err
}

newInstallAction := action.NewInstall(helmConfig)
newInstallAction.ChartPathOptions.Version = version

cp, err := action.NewInstall(helmConfig).ChartPathOptions.LocateChart(fmt.Sprintf("%s/%s", ReleaseName, ChartName), settings)
if err != nil {
return err
Expand Down
Loading