mirror of
https://github.com/argoproj/argo-cd
synced 2026-05-23 09:18:26 +00:00
Clean-up the kube-version from Helm so that we can support GKE. (#2304)
This commit is contained in:
parent
12b45116ed
commit
41b1b0a2d5
4 changed files with 16 additions and 2 deletions
|
|
@ -16,6 +16,7 @@ import (
|
|||
argoappv1 "github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
|
||||
"github.com/argoproj/argo-cd/util/config"
|
||||
"github.com/argoproj/argo-cd/util/kube"
|
||||
"github.com/argoproj/argo-cd/util/text"
|
||||
)
|
||||
|
||||
// Helm provides wrapper functionality around the `helm` command.
|
||||
|
|
@ -55,7 +56,7 @@ func (h *helm) Template(appName, namespace, kubeVersion string, opts *argoappv1.
|
|||
templateOpts := templateOpts{
|
||||
name: appName,
|
||||
namespace: namespace,
|
||||
kubeVersion: kubeVersion,
|
||||
kubeVersion: text.SemVer(kubeVersion),
|
||||
set: map[string]string{},
|
||||
setString: map[string]string{},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -197,7 +197,7 @@ func TestHelmValues(t *testing.T) {
|
|||
slaveCount: 2
|
||||
`,
|
||||
}
|
||||
objs, err := h.Template("test", "", "", &opts)
|
||||
objs, err := h.Template("test", "", "1.4+", &opts)
|
||||
assert.NoError(t, err)
|
||||
for _, obj := range objs {
|
||||
if obj.GetKind() == "Deployment" && obj.GetName() == "test-redis-slave" {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package text
|
||||
|
||||
import "strings"
|
||||
|
||||
// truncates messages to n characters
|
||||
func Trunc(message string, n int) string {
|
||||
if len(message) > n {
|
||||
|
|
@ -7,3 +9,7 @@ func Trunc(message string, n int) string {
|
|||
}
|
||||
return message
|
||||
}
|
||||
|
||||
func SemVer(s string) string {
|
||||
return strings.ReplaceAll(s, "+", "")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ package text
|
|||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestTrunc(t *testing.T) {
|
||||
|
|
@ -26,3 +28,8 @@ func TestTrunc(t *testing.T) {
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestSemVer(t *testing.T) {
|
||||
assert.Equal(t, "1.4", SemVer("1.4"))
|
||||
assert.Equal(t, "1.4", SemVer("1.4+"))
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue