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

Bump helm dep module version to v3.0.3 #11

Merged
merged 1 commit into from
Feb 4, 2020
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
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/mitchellh/go-homedir v1.1.0
github.com/opencontainers/runc v1.0.0-rc2.0.20190611121236-6cc515888830 // indirect
github.com/pkg/errors v0.8.1
helm.sh/helm/v3 v3.0.2
helm.sh/helm/v3 v3.0.3
k8s.io/api v0.0.0
k8s.io/apiextensions-apiserver v0.0.0 // indirect
k8s.io/apimachinery v0.0.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -711,8 +711,8 @@ gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo=
gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw=
helm.sh/helm/v3 v3.0.2 h1:BggvLisIMrAc+Is5oAHVrlVxgwOOrMN8nddfQbm5gKo=
helm.sh/helm/v3 v3.0.2/go.mod h1:KBxE6XWO57XSNA1PA9CvVLYRY0zWqYQTad84bNXp1lw=
helm.sh/helm/v3 v3.0.3 h1:FwoMFwq6evEuljmP9s08WPScb/QzVLB6ZXR2P/MZP6c=
helm.sh/helm/v3 v3.0.3/go.mod h1:KBxE6XWO57XSNA1PA9CvVLYRY0zWqYQTad84bNXp1lw=
honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
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=
Expand Down
6 changes: 0 additions & 6 deletions vendor/helm.sh/helm/v3/pkg/action/package.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,6 @@ func (p *Package) Run(path string, vals map[string]interface{}) (string, error)
return "", err
}

combinedVals, err := chartutil.CoalesceValues(ch, vals)
if err != nil {
return "", err
}
ch.Values = combinedVals

// If version is set, modify the version.
if p.Version != "" {
if err := setVersion(ch, p.Version); err != nil {
Expand Down
16 changes: 12 additions & 4 deletions vendor/helm.sh/helm/v3/pkg/action/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,21 @@ func (p *Pull) Run(chartRef string) (string, error) {
if !filepath.IsAbs(ud) {
ud = filepath.Join(p.DestDir, ud)
}
if fi, err := os.Stat(ud); err != nil {
if err := os.MkdirAll(ud, 0755); err != nil {
// Let udCheck to check conflict file/dir without replacing ud when untarDir is the current directory(.).
udCheck := ud
if udCheck == "." {
_, udCheck = filepath.Split(chartRef)
} else {
_, chartName := filepath.Split(chartRef)
udCheck = filepath.Join(udCheck, chartName)
}
if _, err := os.Stat(udCheck); err != nil {
if err := os.MkdirAll(udCheck, 0755); err != nil {
return out.String(), errors.Wrap(err, "failed to untar (mkdir)")
}

} else if !fi.IsDir() {
return out.String(), errors.Errorf("failed to untar: %s is not a directory", ud)
} else {
return out.String(), errors.Errorf("failed to untar: a file or directory with the name %s already exists", udCheck)
}

return out.String(), chartutil.ExpandFile(ud, saved)
Expand Down
12 changes: 9 additions & 3 deletions vendor/helm.sh/helm/v3/pkg/chartutil/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ fullnameOverride: ""
serviceAccount:
# Specifies whether a service account should be created
create: true
# Annotations to add to the service account
annotations: {}
# The name of the service account to use.
# If not set and create is true, a name is generated using the fullname template
name:
Expand Down Expand Up @@ -301,7 +303,11 @@ kind: ServiceAccount
metadata:
name: {{ include "<CHARTNAME>.serviceAccountName" . }}
labels:
{{ include "<CHARTNAME>.labels" . | nindent 4 }}
{{- include "<CHARTNAME>.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end -}}
`

Expand Down Expand Up @@ -398,15 +404,15 @@ kind: Pod
metadata:
name: "{{ include "<CHARTNAME>.fullname" . }}-test-connection"
labels:
{{ include "<CHARTNAME>.labels" . | nindent 4 }}
{{- include "<CHARTNAME>.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": test-success
spec:
containers:
- name: wget
image: busybox
command: ['wget']
args: ['{{ include "<CHARTNAME>.fullname" . }}:{{ .Values.service.port }}']
args: ['{{ include "<CHARTNAME>.fullname" . }}:{{ .Values.service.port }}']
restartPolicy: Never
`

Expand Down
6 changes: 3 additions & 3 deletions vendor/helm.sh/helm/v3/pkg/chartutil/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ limitations under the License.

/*Package chartutil contains tools for working with charts.

Charts are described in the protocol buffer definition (pkg/proto/charts).
This packe provides utilities for serializing and deserializing charts.
Charts are described in the chart package (pkg/chart).
This package provides utilities for serializing and deserializing charts.

A chart can be represented on the file system in one of two ways:

Expand All @@ -38,7 +38,7 @@ For accepting raw compressed tar file data from an io.Reader, the
'loader.LoadArchive()' will read in the data, uncompress it, and unpack it
into a Chart.

When creating charts in memory, use the 'helm.sh/helm/pkg/proto/chart'
When creating charts in memory, use the 'helm.sh/helm/pkg/chart'
package directly.
*/
package chartutil // import "helm.sh/helm/v3/pkg/chartutil"
31 changes: 17 additions & 14 deletions vendor/helm.sh/helm/v3/pkg/chartutil/save.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"fmt"
"os"
"path/filepath"
"time"

"github.com/pkg/errors"
"sigs.k8s.io/yaml"
Expand All @@ -49,11 +50,12 @@ func SaveDir(c *chart.Chart, dest string) error {
}

// Save values.yaml
if c.Values != nil {
vf := filepath.Join(outdir, ValuesfileName)
b, _ := yaml.Marshal(c.Values)
if err := writeFile(vf, b); err != nil {
return err
for _, f := range c.Raw {
if f.Name == ValuesfileName {
vf := filepath.Join(outdir, ValuesfileName)
if err := writeFile(vf, f.Data); err != nil {
return err
}
}
}

Expand Down Expand Up @@ -160,12 +162,12 @@ func writeTarContents(out *tar.Writer, c *chart.Chart, prefix string) error {
}

// Save values.yaml
ydata, err := yaml.Marshal(c.Values)
if err != nil {
return err
}
if err := writeToTar(out, filepath.Join(base, ValuesfileName), ydata); err != nil {
return err
for _, f := range c.Raw {
if f.Name == ValuesfileName {
if err := writeToTar(out, filepath.Join(base, ValuesfileName), f.Data); err != nil {
return err
}
}
}

// Save values.schema.json if it exists
Expand Down Expand Up @@ -207,9 +209,10 @@ func writeTarContents(out *tar.Writer, c *chart.Chart, prefix string) error {
func writeToTar(out *tar.Writer, name string, body []byte) error {
// TODO: Do we need to create dummy parent directory names if none exist?
h := &tar.Header{
Name: name,
Mode: 0644,
Size: int64(len(body)),
Name: name,
Mode: 0644,
Size: int64(len(body)),
ModTime: time.Now(),
}
if err := out.WriteHeader(h); err != nil {
return err
Expand Down
14 changes: 8 additions & 6 deletions vendor/helm.sh/helm/v3/pkg/engine/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ type renderable struct {

const warnStartDelim = "HELM_ERR_START"
const warnEndDelim = "HELM_ERR_END"
const recursionMaxNums = 1000

var warnRegex = regexp.MustCompile(warnStartDelim + `(.*)` + warnEndDelim)

Expand All @@ -93,19 +94,20 @@ func warnWrap(warn string) string {
// initFunMap creates the Engine's FuncMap and adds context-specific functions.
func (e Engine) initFunMap(t *template.Template, referenceTpls map[string]renderable) {
funcMap := funcMap()
includedNames := make([]string, 0)
includedNames := make(map[string]int)

// Add the 'include' function here so we can close over t.
funcMap["include"] = func(name string, data interface{}) (string, error) {
var buf strings.Builder
for _, n := range includedNames {
if n == name {
return "", errors.Wrapf(fmt.Errorf("unable to excute template"), "rendering template has a nested reference name: %s", name)
if v, ok := includedNames[name]; ok {
if v > recursionMaxNums {
return "", errors.Wrapf(fmt.Errorf("unable to execute template"), "rendering template has a nested reference name: %s", name)
}
includedNames[name]++
} else {
includedNames[name] = 1
}
includedNames = append(includedNames, name)
err := t.ExecuteTemplate(&buf, name, data)
includedNames = includedNames[:len(includedNames)-1]
return buf.String(), err
}

Expand Down
20 changes: 17 additions & 3 deletions vendor/helm.sh/helm/v3/pkg/kube/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
"encoding/json"
"fmt"
"io"
"log"
"strings"
"sync"
"time"
Expand Down Expand Up @@ -197,6 +196,11 @@ func (c *Client) Update(original, target ResourceList, force bool) (*Result, err
}

for _, info := range original.Difference(target) {
if info.Mapping.GroupVersionKind.Kind == "CustomResourceDefinition" {
c.Log("Skipping the deletion of CustomResourceDefinition %q", info.Name)
continue
}

c.Log("Deleting %q in %s...", info.Name, info.Namespace)
res.Deleted = append(res.Deleted, info)
if err := deleteResource(info); err != nil {
Expand All @@ -219,6 +223,11 @@ func (c *Client) Delete(resources ResourceList) (*Result, []error) {
var errs []error
res := &Result{}
err := perform(resources, func(info *resource.Info) error {
if info.Mapping.GroupVersionKind.Kind == "CustomResourceDefinition" {
c.Log("Skipping the deletion of CustomResourceDefinition %q", info.Name)
return nil
}

c.Log("Starting delete for %q %s", info.Name, info.Mapping.GroupVersionKind.Kind)
if err := c.skipIfNotFound(deleteResource(info)); err != nil {
// Collect the error and continue on
Expand Down Expand Up @@ -355,7 +364,12 @@ func createPatch(target *resource.Info, current runtime.Object) ([]byte, types.P
// returned from ConvertToVersion. Anything that's unstructured should
// use the jsonpatch.CreateMergePatch. Strategic Merge Patch is not supported
// on objects like CRDs.
if _, ok := versionedObject.(runtime.Unstructured); ok {
_, isUnstructured := versionedObject.(runtime.Unstructured)

// On newer K8s versions, CRDs aren't unstructured but has this dedicated type
_, isCRD := versionedObject.(*apiextv1beta1.CustomResourceDefinition)

if isUnstructured || isCRD {
// fall back to generic JSON merge patch
patch, err := jsonpatch.CreateMergePatch(oldData, newData)
return patch, types.MergePatchType, err
Expand Down Expand Up @@ -398,7 +412,7 @@ func updateResource(c *Client, target *resource.Info, currentObj runtime.Object,
if err != nil {
return errors.Wrap(err, "failed to replace object")
}
log.Printf("Replaced %q with kind %s for kind %s\n", target.Name, currentObj.GetObjectKind().GroupVersionKind().Kind, kind)
c.Log("Replaced %q with kind %s for kind %s\n", target.Name, currentObj.GetObjectKind().GroupVersionKind().Kind, kind)
} else {
// send patch to server
obj, err = helper.Patch(target.Namespace, target.Name, patchType, patch, nil)
Expand Down
1 change: 0 additions & 1 deletion vendor/helm.sh/helm/v3/pkg/releaseutil/kind_sorter.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ func (k *kindSorter) Less(i, j int) bool {
b := k.manifests[j]
first, aok := k.ordering[a.Head.Kind]
second, bok := k.ordering[b.Head.Kind]
// if same kind (including unknown) sub sort alphanumeric
if first == second {
// if both are unknown and of different kind sort by kind alphabetically
if !aok && !bok && a.Head.Kind != b.Head.Kind {
Expand Down
4 changes: 2 additions & 2 deletions vendor/helm.sh/helm/v3/pkg/storage/driver/cfgmaps.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,14 +217,14 @@ func (cfgmaps *ConfigMaps) Delete(key string) (rls *rspb.Release, err error) {

// newConfigMapsObject constructs a kubernetes ConfigMap object
// to store a release. Each configmap data entry is the base64
// encoded string of a release's binary protobuf encoding.
// encoded gzipped string of a release.
//
// The following labels are used within each configmap:
//
// "modifiedAt" - timestamp indicating when this configmap was last modified. (set in Update)
// "createdAt" - timestamp indicating when this configmap was created. (set in Create)
// "version" - version of the release.
// "status" - status of the release (see proto/hapi/release.status.pb.go for variants)
// "status" - status of the release (see pkg/release/status.go for variants)
// "owner" - owner of the configmap, currently "helm".
// "name" - name of the release.
//
Expand Down
4 changes: 2 additions & 2 deletions vendor/helm.sh/helm/v3/pkg/storage/driver/secrets.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,14 +198,14 @@ func (secrets *Secrets) Delete(key string) (rls *rspb.Release, err error) {

// newSecretsObject constructs a kubernetes Secret object
// to store a release. Each secret data entry is the base64
// encoded string of a release's binary protobuf encoding.
// encoded gzipped string of a release.
//
// The following labels are used within each secret:
//
// "modifiedAt" - timestamp indicating when this secret was last modified. (set in Update)
// "createdAt" - timestamp indicating when this secret was created. (set in Create)
// "version" - version of the release.
// "status" - status of the release (see proto/hapi/release.status.pb.go for variants)
// "status" - status of the release (see pkg/release/status.go for variants)
// "owner" - owner of the secret, currently "helm".
// "name" - name of the release.
//
Expand Down
11 changes: 5 additions & 6 deletions vendor/helm.sh/helm/v3/pkg/storage/driver/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var b64 = base64.StdEncoding
var magicGzip = []byte{0x1f, 0x8b, 0x08}

// encodeRelease encodes a release returning a base64 encoded
// gzipped binary protobuf encoding representation, or error.
// gzipped string representation, or error.
func encodeRelease(rls *rspb.Release) (string, error) {
b, err := json.Marshal(rls)
if err != nil {
Expand All @@ -50,10 +50,9 @@ func encodeRelease(rls *rspb.Release) (string, error) {
return b64.EncodeToString(buf.Bytes()), nil
}

// decodeRelease decodes the bytes in data into a release
// type. Data must contain a base64 encoded string of a
// valid protobuf encoding of a release, otherwise
// an error is returned.
// decodeRelease decodes the bytes of data into a release
// type. Data must contain a base64 encoded gzipped string of a
// valid release, otherwise an error is returned.
func decodeRelease(data string) (*rspb.Release, error) {
// base64 decode string
b, err := b64.DecodeString(data)
Expand All @@ -77,7 +76,7 @@ func decodeRelease(data string) (*rspb.Release, error) {
}

var rls rspb.Release
// unmarshal protobuf bytes
// unmarshal release object bytes
if err := json.Unmarshal(b, &rls); err != nil {
return nil, err
}
Expand Down
11 changes: 6 additions & 5 deletions vendor/helm.sh/helm/v3/pkg/storage/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func (s *Storage) Create(rls *rspb.Release) error {
return s.Driver.Create(makeKey(rls.Name, rls.Version), rls)
}

// Update update the release in storage. An error is returned if the
// Update updates the release in storage. An error is returned if the
// storage backend fails to update the release or if the release
// does not exist.
func (s *Storage) Update(rls *rspb.Release) error {
Expand Down Expand Up @@ -112,17 +112,18 @@ func (s *Storage) ListDeployed() ([]*rspb.Release, error) {
func (s *Storage) Deployed(name string) (*rspb.Release, error) {
ls, err := s.DeployedAll(name)
if err != nil {
if strings.Contains(err.Error(), "not found") {
return nil, errors.Errorf("%q has no deployed releases", name)
}
return nil, err
}

if len(ls) == 0 {
return nil, errors.Errorf("%q has no deployed releases", name)
}

return ls[0], err
// If executed concurrently, Helm's database gets corrupted
// and multiple releases are DEPLOYED. Take the latest.
relutil.Reverse(ls, relutil.SortByRevision)

return ls[0], nil
}

// DeployedAll returns all deployed releases with the provided name, or
Expand Down
2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ google.golang.org/grpc/test/bufconn
gopkg.in/inf.v0
# gopkg.in/yaml.v2 v2.2.4
gopkg.in/yaml.v2
# helm.sh/helm/v3 v3.0.2
# helm.sh/helm/v3 v3.0.3
helm.sh/helm/v3/internal/experimental/registry
helm.sh/helm/v3/internal/ignore
helm.sh/helm/v3/internal/resolver
Expand Down