Skip to content

Commit 832487c

Browse files
Merge pull request #186 from ecordell/rm-rf-helm
chore(deps): remove helm as a dependency
2 parents 0100512 + ebe6044 commit 832487c

File tree

316 files changed

+3295
-25748
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

316 files changed

+3295
-25748
lines changed

go.mod

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ require (
2525
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45
2626
google.golang.org/grpc v1.24.0
2727
gopkg.in/yaml.v2 v2.2.4
28-
helm.sh/helm/v3 v3.0.1
2928
k8s.io/api v0.0.0
3029
k8s.io/apiextensions-apiserver v0.0.0
3130
k8s.io/apimachinery v0.0.0
@@ -35,7 +34,6 @@ require (
3534
)
3635

3736
replace (
38-
github.com/docker/docker => github.com/moby/moby v0.7.3-0.20190826074503-38ab9da00309 // Required by Helm
3937
k8s.io/api => k8s.io/api v0.0.0-20190918155943-95b840bb6a1f
4038
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.0.0-20190918161926-8f644eb6e783
4139
k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20190913080033-27d36303b655

go.sum

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03
2222
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
2323
github.com/GoogleCloudPlatform/k8s-cloud-provider v0.0.0-20190822182118-27a4ced34534/go.mod h1:iroGtC8B3tQiqtds1l+mgk/BBOrxbqjH+eUfFQYRc14=
2424
github.com/JeffAshton/win_pdh v0.0.0-20161109143554-76bb4ee9f0ab/go.mod h1:3VYc5hodBMJ5+l/7J4xAyMeuM2PNuepvHlGs8yilUCA=
25+
github.com/MakeNowJust/heredoc v0.0.0-20170808103936-bb23615498cd h1:sjQovDkwrZp8u+gxLtPgKGjk5hCxuy2hrRejBTA9xFU=
2526
github.com/MakeNowJust/heredoc v0.0.0-20170808103936-bb23615498cd/go.mod h1:64YHyfSL2R96J44Nlwm39UHepQbyR5q10x7iYa1ks2E=
2627
github.com/MakeNowJust/heredoc v0.0.0-20171113091838-e9091a26100e h1:eb0Pzkt15Bm7f2FFYv7sjY7NPFi3cPkS3tv1CcrFBWA=
2728
github.com/MakeNowJust/heredoc v0.0.0-20171113091838-e9091a26100e/go.mod h1:64YHyfSL2R96J44Nlwm39UHepQbyR5q10x7iYa1ks2E=
@@ -152,6 +153,10 @@ github.com/docker/distribution v2.7.0+incompatible/go.mod h1:J2gT2udsDAN96Uj4Kfc
152153
github.com/docker/distribution v2.7.1-0.20190205005809-0d3efadf0154+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
153154
github.com/docker/distribution v2.7.1+incompatible h1:a5mlkVzth6W5A4fOsS3D2EO5BUmsJpcB+cRlLU7cSug=
154155
github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
156+
github.com/docker/docker v0.7.3-0.20190103212154-2b7e084dc98b/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
157+
github.com/docker/docker v0.7.3-0.20190327010347-be7ac8be2ae0/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
158+
github.com/docker/docker v0.7.3-0.20190817195342-4760db040282 h1:mzrx39dGtGq0VEnTHjnakmczd4uFbhx2cZU3BJDsLdc=
159+
github.com/docker/docker v0.7.3-0.20190817195342-4760db040282/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
155160
github.com/docker/docker-credential-helpers v0.6.1/go.mod h1:WRaJzqw3CTB9bk10avuGsjVBZsD05qeibJ1/TYlvc0Y=
156161
github.com/docker/go-connections v0.3.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec=
157162
github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec=
@@ -160,6 +165,7 @@ github.com/docker/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDD
160165
github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
161166
github.com/docker/libnetwork v0.0.0-20180830151422-a9cd636e3789/go.mod h1:93m0aTqz6z+g32wla4l4WxTrdtvBRmVzYRkYvasA5Z8=
162167
github.com/docker/libtrust v0.0.0-20160708172513-aabc10ec26b7/go.mod h1:cyGadeNEkKy96OOhEzfZl+yxihPEzKnqJwvfuSUqbZE=
168+
github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96 h1:cenwrSVm+Z7QLSV/BsnenAOcDXdX4cMv4wP0B/5QbPg=
163169
github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM=
164170
github.com/docker/spdystream v0.0.0-20181023171402-6480d4af844c h1:ZfSZ3P3BedhKGUhzj7BQlPSU4OvT6tfOKe3DVHzOA7s=
165171
github.com/docker/spdystream v0.0.0-20181023171402-6480d4af844c/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM=

vendor/helm.sh/helm/v3/pkg/chart/metadata.go renamed to pkg/lib/bundle/chartutil.go

Lines changed: 74 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
/*
22
Copyright The Helm Authors.
3+
34
Licensed under the Apache License, Version 2.0 (the "License");
45
you may not use this file except in compliance with the License.
56
You may obtain a copy of the License at
67
7-
http://www.apache.org/licenses/LICENSE-2.0
8+
http://www.apache.org/licenses/LICENSE-2.0
89
910
Unless required by applicable law or agreed to in writing, software
1011
distributed under the License is distributed on an "AS IS" BASIS,
@@ -13,7 +14,18 @@ See the License for the specific language governing permissions and
1314
limitations under the License.
1415
*/
1516

16-
package chart
17+
// Adapted from https://github.com/helm/helm/blob/b49db9e6e6fb1913a125b8cf9b31f81199c6753c/pkg/chartutil/chartfile.go
18+
19+
package bundle
20+
21+
import (
22+
"io/ioutil"
23+
"os"
24+
"path/filepath"
25+
26+
"github.com/pkg/errors"
27+
"gopkg.in/yaml.v2"
28+
)
1729

1830
// Maintainer describes a Chart maintainer.
1931
type Maintainer struct {
@@ -25,6 +37,38 @@ type Maintainer struct {
2537
URL string `json:"url,omitempty"`
2638
}
2739

40+
// Dependency describes a chart upon which another chart depends.
41+
//
42+
// Dependencies can be used to express developer intent, or to capture the state
43+
// of a chart.
44+
type Dependency struct {
45+
// Name is the name of the dependency.
46+
//
47+
// This must mach the name in the dependency's Chart.yaml.
48+
Name string `json:"name"`
49+
// Version is the version (range) of this chart.
50+
//
51+
// A lock file will always produce a single version, while a dependency
52+
// may contain a semantic version range.
53+
Version string `json:"version,omitempty"`
54+
// The URL to the repository.
55+
//
56+
// Appending `index.yaml` to this string should result in a URL that can be
57+
// used to fetch the repository index.
58+
Repository string `json:"repository"`
59+
// A yaml path that resolves to a boolean, used for enabling/disabling charts (e.g. subchart1.enabled )
60+
Condition string `json:"condition,omitempty"`
61+
// Tags can be used to group charts for enabling/disabling together
62+
Tags []string `json:"tags,omitempty"`
63+
// Enabled bool determines if chart should be loaded
64+
Enabled bool `json:"enabled,omitempty"`
65+
// ImportValues holds the mapping of source values to parent key to be imported. Each item can be a
66+
// string or pair of child/parent sublist items.
67+
ImportValues []interface{} `json:"import-values,omitempty"`
68+
// Alias usable alias to be used for the chart
69+
Alias string `json:"alias,omitempty"`
70+
}
71+
2872
// Metadata for a Chart file. This models the structure of a Chart.yaml file.
2973
type Metadata struct {
3074
// The name of the chart
@@ -64,31 +108,38 @@ type Metadata struct {
64108
Type string `json:"type,omitempty"`
65109
}
66110

67-
// Validate checks the metadata for known issues, returning an error if metadata is not correct
68-
func (md *Metadata) Validate() error {
69-
if md == nil {
70-
return ValidationError("chart.metadata is required")
111+
// IsChartDir validates a chart directory.
112+
//
113+
// Checks for a valid Chart.yaml.
114+
func IsChartDir(dirName string) (bool, error) {
115+
const ChartfileName = "Chart.yaml"
116+
117+
if fi, err := os.Stat(dirName); err != nil {
118+
return false, err
119+
} else if !fi.IsDir() {
120+
return false, errors.Errorf("%q is not a directory", dirName)
71121
}
72-
if md.APIVersion == "" {
73-
return ValidationError("chart.metadata.apiVersion is required")
122+
123+
chartYaml := filepath.Join(dirName, ChartfileName)
124+
if _, err := os.Stat(chartYaml); os.IsNotExist(err) {
125+
return false, errors.Errorf("no %s exists in directory %q", ChartfileName, dirName)
74126
}
75-
if md.Name == "" {
76-
return ValidationError("chart.metadata.name is required")
127+
128+
chartYamlContent, err := ioutil.ReadFile(chartYaml)
129+
if err != nil {
130+
return false, errors.Errorf("cannot read %s in directory %q", ChartfileName, dirName)
77131
}
78-
if md.Version == "" {
79-
return ValidationError("chart.metadata.version is required")
132+
133+
chartContent := new(Metadata)
134+
if err := yaml.Unmarshal(chartYamlContent, &chartContent); err != nil {
135+
return false, err
80136
}
81-
if !isValidChartType(md.Type) {
82-
return ValidationError("chart.metadata.type must be application or library")
137+
if chartContent == nil {
138+
return false, errors.Errorf("chart metadata (%s) missing", ChartfileName)
83139
}
84-
// TODO validate valid semver here?
85-
return nil
86-
}
87-
88-
func isValidChartType(in string) bool {
89-
switch in {
90-
case "", "application", "library":
91-
return true
140+
if chartContent.Name == "" {
141+
return false, errors.Errorf("invalid chart (%s): name must not be empty", ChartfileName)
92142
}
93-
return false
143+
144+
return true, nil
94145
}

pkg/lib/bundle/chartutil_test.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package bundle
2+
3+
import "testing"
4+
5+
func TestIsChartDir(t *testing.T) {
6+
validChartDir, err := IsChartDir("testdata/frobnitz")
7+
if !validChartDir {
8+
t.Errorf("unexpected error while reading chart-directory: (%v)", err)
9+
return
10+
}
11+
validChartDir, err = IsChartDir("testdata")
12+
if validChartDir || err == nil {
13+
t.Errorf("expected error but did not get any")
14+
return
15+
}
16+
}

pkg/lib/bundle/generate.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@ import (
88
"strings"
99

1010
log "github.com/sirupsen/logrus"
11-
1211
"gopkg.in/yaml.v2"
13-
"helm.sh/helm/v3/pkg/chartutil"
14-
1512
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
1613
k8syaml "k8s.io/apimachinery/pkg/util/yaml"
1714
)
@@ -131,7 +128,7 @@ func GetMediaType(directory string) (string, error) {
131128
}
132129

133130
// Validate if bundle is helm chart type
134-
if _, err := chartutil.IsChartDir(directory); err == nil {
131+
if _, err := IsChartDir(directory); err == nil {
135132
return HelmType, nil
136133
}
137134

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
apiVersion: v1
2+
name: frobnitz
3+
description: This is a frobnitz.
4+
version: "1.2.3"
5+
keywords:
6+
- frobnitz
7+
- sprocket
8+
- dodad
9+
maintainers:
10+
- name: The Helm Team
11+
12+
- name: Someone Else
13+
14+
sources:
15+
- https://example.com/foo/bar
16+
home: http://example.com
17+
icon: https://example.com/64x64.png
18+
annotations:
19+
extrakey: extravalue
20+
anotherkey: anothervalue
21+
dependencies:
22+
- name: alpine
23+
version: "0.1.0"
24+
repository: https://example.com/charts
25+
- name: mariner
26+
version: "4.3.2"
27+
repository: https://example.com/charts

vendor/github.com/MakeNowJust/heredoc/heredoc.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/Masterminds/semver/v3/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

vendor/github.com/Masterminds/semver/v3/.golangci.yml

Lines changed: 0 additions & 26 deletions
This file was deleted.

vendor/github.com/Masterminds/semver/v3/.travis.yml

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)