mirror of https://github.com/kubernetes/kops.git
Merge pull request #10192 from olemarkus/updates-helm
Upgrade helm to 2.17 and use the helm.sh reference
This commit is contained in:
commit
8c9cbcaae0
|
@ -104,6 +104,7 @@ go_library(
|
|||
"//vendor/github.com/spf13/cobra/doc:go_default_library",
|
||||
"//vendor/github.com/spf13/viper:go_default_library",
|
||||
"//vendor/golang.org/x/crypto/ssh:go_default_library",
|
||||
"//vendor/helm.sh/helm/pkg/strvals:go_default_library",
|
||||
"//vendor/k8s.io/api/core/v1:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/api/errors:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||
|
@ -115,7 +116,6 @@ go_library(
|
|||
"//vendor/k8s.io/client-go/plugin/pkg/client/auth:go_default_library",
|
||||
"//vendor/k8s.io/client-go/tools/clientcmd:go_default_library",
|
||||
"//vendor/k8s.io/client-go/util/homedir:go_default_library",
|
||||
"//vendor/k8s.io/helm/pkg/strvals:go_default_library",
|
||||
"//vendor/k8s.io/klog/v2:go_default_library",
|
||||
"//vendor/k8s.io/kubectl/pkg/cmd/util:go_default_library",
|
||||
"//vendor/k8s.io/kubectl/pkg/cmd/util/editor:go_default_library",
|
||||
|
|
|
@ -27,7 +27,7 @@ import (
|
|||
|
||||
"github.com/ghodss/yaml"
|
||||
"github.com/spf13/cobra"
|
||||
"k8s.io/helm/pkg/strvals"
|
||||
"helm.sh/helm/pkg/strvals"
|
||||
"k8s.io/kubectl/pkg/util/i18n"
|
||||
"k8s.io/kubectl/pkg/util/templates"
|
||||
|
||||
|
|
2
go.mod
2
go.mod
|
@ -103,6 +103,7 @@ require (
|
|||
gopkg.in/gcfg.v1 v1.2.3
|
||||
gopkg.in/inf.v0 v0.9.1
|
||||
gopkg.in/yaml.v2 v2.3.0
|
||||
helm.sh/helm v2.17.0+incompatible
|
||||
honnef.co/go/tools v0.0.1-2020.1.4
|
||||
k8s.io/api v0.19.0
|
||||
k8s.io/apimachinery v0.19.0
|
||||
|
@ -111,7 +112,6 @@ require (
|
|||
k8s.io/cloud-provider-openstack v1.18.0
|
||||
k8s.io/component-base v0.19.0
|
||||
k8s.io/gengo v0.0.0-20200710205751-c0d492a0f3ca
|
||||
k8s.io/helm v2.9.0+incompatible
|
||||
k8s.io/klog/v2 v2.3.0
|
||||
k8s.io/kubectl v0.0.0
|
||||
k8s.io/legacy-cloud-providers v0.0.0
|
||||
|
|
4
go.sum
4
go.sum
|
@ -1266,6 +1266,8 @@ gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81
|
|||
gotest.tools/gotestsum v0.3.5/go.mod h1:Mnf3e5FUzXbkCfynWBGOwLssY7gTQgCHObK9tMpAriY=
|
||||
gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk=
|
||||
grpc.go4.org v0.0.0-20170609214715-11d0a25b4919/go.mod h1:77eQGdRu53HpSqPFJFmuJdjuHRquDANNeA4x7B8WQ9o=
|
||||
helm.sh/helm v2.17.0+incompatible h1:cSe3FaQOpRWLDXvTObQNj0P7WI98IG5yloU6tQVls2k=
|
||||
helm.sh/helm v2.17.0+incompatible/go.mod h1:0Xbc6ErzwWH9qC55X1+hE3ZwhM3atbhCm/NbFZw5i+4=
|
||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
|
@ -1304,8 +1306,6 @@ k8s.io/gengo v0.0.0-20200428234225-8167cfdcfc14/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8
|
|||
k8s.io/gengo v0.0.0-20200710205751-c0d492a0f3ca h1:/o8XeHsWWmi4lTKp3uxWAZY7Eq/v1HelCDmrKZM4SVQ=
|
||||
k8s.io/gengo v0.0.0-20200710205751-c0d492a0f3ca/go.mod h1:aG2eeomYfcUw8sE3fa7YdkjgnGtyY56TjZlaJJ0ZoWo=
|
||||
k8s.io/heapster v1.2.0-beta.1/go.mod h1:h1uhptVXMwC8xtZBYsPXKVi8fpdlYkTs6k949KozGrM=
|
||||
k8s.io/helm v2.9.0+incompatible h1:3EFDJoqKSUe1BpC9qP+YaHi2Oua9hFT+C24/LhX2G1g=
|
||||
k8s.io/helm v2.9.0+incompatible/go.mod h1:LZzlS4LQBHfciFOurYBFkCMTaZ0D1l+p0teMg7TSULI=
|
||||
k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk=
|
||||
k8s.io/klog v0.3.0/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk=
|
||||
k8s.io/klog v0.3.1/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk=
|
||||
|
|
|
@ -187,7 +187,7 @@
|
|||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright 2016 The Kubernetes Authors All Rights Reserved
|
||||
Copyright The Helm Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
|
@ -6,8 +6,8 @@ go_library(
|
|||
"doc.go",
|
||||
"parser.go",
|
||||
],
|
||||
importmap = "k8s.io/kops/vendor/k8s.io/helm/pkg/strvals",
|
||||
importpath = "k8s.io/helm/pkg/strvals",
|
||||
importmap = "k8s.io/kops/vendor/helm.sh/helm/pkg/strvals",
|
||||
importpath = "helm.sh/helm/pkg/strvals",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = ["//vendor/github.com/ghodss/yaml:go_default_library"],
|
||||
)
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
Copyright The Helm Authors.
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
Copyright The Helm Authors.
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
@ -36,7 +36,7 @@ func ToYAML(s string) (string, error) {
|
|||
return "", err
|
||||
}
|
||||
d, err := yaml.Marshal(m)
|
||||
return strings.TrimSuffix(string(d), "\n"), err
|
||||
return string(d), err
|
||||
}
|
||||
|
||||
// Parse parses a set line.
|
||||
|
@ -50,6 +50,20 @@ func Parse(s string) (map[string]interface{}, error) {
|
|||
return vals, err
|
||||
}
|
||||
|
||||
// ParseFile parses a set line, but its final value is loaded from the file at the path specified by the original value.
|
||||
//
|
||||
// A set line is of the form name1=path1,name2=path2
|
||||
//
|
||||
// When the files at path1 and path2 contained "val1" and "val2" respectively, the set line is consumed as
|
||||
// name1=val1,name2=val2
|
||||
func ParseFile(s string, runesToVal runesToVal) (map[string]interface{}, error) {
|
||||
vals := map[string]interface{}{}
|
||||
scanner := bytes.NewBufferString(s)
|
||||
t := newFileParser(scanner, vals, runesToVal)
|
||||
err := t.parse()
|
||||
return vals, err
|
||||
}
|
||||
|
||||
// ParseString parses a set line and forces a string value.
|
||||
//
|
||||
// A set line is of the form name1=value1,name2=value2
|
||||
|
@ -71,7 +85,16 @@ func ParseInto(s string, dest map[string]interface{}) error {
|
|||
return t.parse()
|
||||
}
|
||||
|
||||
// ParseIntoString parses a strvals line nad merges the result into dest.
|
||||
// ParseIntoFile parses a filevals line and merges the result into dest.
|
||||
//
|
||||
// This method always returns a string as the value.
|
||||
func ParseIntoFile(s string, dest map[string]interface{}, runesToVal runesToVal) error {
|
||||
scanner := bytes.NewBufferString(s)
|
||||
t := newFileParser(scanner, dest, runesToVal)
|
||||
return t.parse()
|
||||
}
|
||||
|
||||
// ParseIntoString parses a strvals line and merges the result into dest.
|
||||
//
|
||||
// This method always returns a string as the value.
|
||||
func ParseIntoString(s string, dest map[string]interface{}) error {
|
||||
|
@ -82,14 +105,27 @@ func ParseIntoString(s string, dest map[string]interface{}) error {
|
|||
|
||||
// parser is a simple parser that takes a strvals line and parses it into a
|
||||
// map representation.
|
||||
//
|
||||
// where sc is the source of the original data being parsed
|
||||
// where data is the final parsed data from the parses with correct types
|
||||
// where st is a boolean to figure out if we're forcing it to parse values as string
|
||||
type parser struct {
|
||||
sc *bytes.Buffer
|
||||
data map[string]interface{}
|
||||
st bool
|
||||
sc *bytes.Buffer
|
||||
data map[string]interface{}
|
||||
runesToVal runesToVal
|
||||
}
|
||||
|
||||
type runesToVal func([]rune) (interface{}, error)
|
||||
|
||||
func newParser(sc *bytes.Buffer, data map[string]interface{}, stringBool bool) *parser {
|
||||
return &parser{sc: sc, data: data, st: stringBool}
|
||||
rs2v := func(rs []rune) (interface{}, error) {
|
||||
return typedVal(rs, stringBool), nil
|
||||
}
|
||||
return &parser{sc: sc, data: data, runesToVal: rs2v}
|
||||
}
|
||||
|
||||
func newFileParser(sc *bytes.Buffer, data map[string]interface{}, runesToVal runesToVal) *parser {
|
||||
return &parser{sc: sc, data: data, runesToVal: runesToVal}
|
||||
}
|
||||
|
||||
func (t *parser) parse() error {
|
||||
|
@ -153,8 +189,12 @@ func (t *parser) key(data map[string]interface{}) error {
|
|||
set(data, string(k), "")
|
||||
return e
|
||||
case ErrNotList:
|
||||
v, e := t.val()
|
||||
set(data, string(k), typedVal(v, t.st))
|
||||
rs, e := t.val()
|
||||
if e != nil && e != io.EOF {
|
||||
return e
|
||||
}
|
||||
v, e := t.runesToVal(rs)
|
||||
set(data, string(k), v)
|
||||
return e
|
||||
default:
|
||||
return e
|
||||
|
@ -226,25 +266,43 @@ func (t *parser) listItem(list []interface{}, i int) ([]interface{}, error) {
|
|||
case io.EOF:
|
||||
return setIndex(list, i, ""), err
|
||||
case ErrNotList:
|
||||
v, e := t.val()
|
||||
return setIndex(list, i, typedVal(v, t.st)), e
|
||||
rs, e := t.val()
|
||||
if e != nil && e != io.EOF {
|
||||
return list, e
|
||||
}
|
||||
v, e := t.runesToVal(rs)
|
||||
return setIndex(list, i, v), e
|
||||
default:
|
||||
return list, e
|
||||
}
|
||||
case last == '[':
|
||||
// now we have a nested list. Read the index and handle.
|
||||
i, err := t.keyIndex()
|
||||
nextI, err := t.keyIndex()
|
||||
if err != nil {
|
||||
return list, fmt.Errorf("error parsing index: %s", err)
|
||||
}
|
||||
var crtList []interface{}
|
||||
if len(list) > i {
|
||||
// If nested list already exists, take the value of list to next cycle.
|
||||
existed := list[i]
|
||||
if existed != nil {
|
||||
crtList = list[i].([]interface{})
|
||||
}
|
||||
}
|
||||
// Now we need to get the value after the ].
|
||||
list2, err := t.listItem(list, i)
|
||||
list2, err := t.listItem(crtList, nextI)
|
||||
return setIndex(list, i, list2), err
|
||||
case last == '.':
|
||||
// We have a nested object. Send to t.key
|
||||
inner := map[string]interface{}{}
|
||||
if len(list) > i {
|
||||
inner = list[i].(map[string]interface{})
|
||||
var ok bool
|
||||
inner, ok = list[i].(map[string]interface{})
|
||||
if !ok {
|
||||
// We have indices out of order. Initialize empty value.
|
||||
list[i] = map[string]interface{}{}
|
||||
inner = list[i].(map[string]interface{})
|
||||
}
|
||||
}
|
||||
|
||||
// Recurse
|
||||
|
@ -275,7 +333,7 @@ func (t *parser) valList() ([]interface{}, error) {
|
|||
list := []interface{}{}
|
||||
stop := runeSet([]rune{',', '}'})
|
||||
for {
|
||||
switch v, last, err := runesUntil(t.sc, stop); {
|
||||
switch rs, last, err := runesUntil(t.sc, stop); {
|
||||
case err != nil:
|
||||
if err == io.EOF {
|
||||
err = errors.New("list must terminate with '}'")
|
||||
|
@ -286,10 +344,15 @@ func (t *parser) valList() ([]interface{}, error) {
|
|||
if r, _, e := t.sc.ReadRune(); e == nil && r != ',' {
|
||||
t.sc.UnreadRune()
|
||||
}
|
||||
list = append(list, typedVal(v, t.st))
|
||||
return list, nil
|
||||
v, e := t.runesToVal(rs)
|
||||
list = append(list, v)
|
||||
return list, e
|
||||
case last == ',':
|
||||
list = append(list, typedVal(v, t.st))
|
||||
v, e := t.runesToVal(rs)
|
||||
if e != nil {
|
||||
return list, e
|
||||
}
|
||||
list = append(list, v)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -321,6 +384,11 @@ func inMap(k rune, m map[rune]bool) bool {
|
|||
|
||||
func typedVal(v []rune, st bool) interface{} {
|
||||
val := string(v)
|
||||
|
||||
if st {
|
||||
return val
|
||||
}
|
||||
|
||||
if strings.EqualFold(val, "true") {
|
||||
return true
|
||||
}
|
||||
|
@ -329,8 +397,16 @@ func typedVal(v []rune, st bool) interface{} {
|
|||
return false
|
||||
}
|
||||
|
||||
// If this value does not start with zero, and not returnString, try parsing it to an int
|
||||
if !st && len(val) != 0 && val[0] != '0' {
|
||||
if strings.EqualFold(val, "null") {
|
||||
return nil
|
||||
}
|
||||
|
||||
if strings.EqualFold(val, "0") {
|
||||
return int64(0)
|
||||
}
|
||||
|
||||
// If this value does not start with zero, try parsing it to an int
|
||||
if len(val) != 0 && val[0] != '0' {
|
||||
if iv, err := strconv.ParseInt(val, 10, 64); err == nil {
|
||||
return iv
|
||||
}
|
|
@ -816,6 +816,9 @@ gopkg.in/warnings.v0
|
|||
gopkg.in/yaml.v2
|
||||
# gopkg.in/yaml.v3 v3.0.0-20190905181640-827449938966
|
||||
gopkg.in/yaml.v3
|
||||
# helm.sh/helm v2.17.0+incompatible
|
||||
## explicit
|
||||
helm.sh/helm/pkg/strvals
|
||||
# honnef.co/go/tools v0.0.1-2020.1.4
|
||||
## explicit
|
||||
honnef.co/go/tools/arg
|
||||
|
@ -1226,9 +1229,6 @@ k8s.io/gengo/generator
|
|||
k8s.io/gengo/namer
|
||||
k8s.io/gengo/parser
|
||||
k8s.io/gengo/types
|
||||
# k8s.io/helm v2.9.0+incompatible
|
||||
## explicit
|
||||
k8s.io/helm/pkg/strvals
|
||||
# k8s.io/klog v1.0.0
|
||||
k8s.io/klog
|
||||
# k8s.io/klog/v2 v2.3.0
|
||||
|
|
Loading…
Reference in New Issue