Unverified Commit 38fe7e39 authored by Bryan Liles's avatar Bryan Liles Committed by GitHub
Browse files

Merge pull request #668 from bryanl/664-helm-component-prototype

Create prototypes for helm packages
parents 29268140 c7fe9fd7
......@@ -4,8 +4,8 @@
[[projects]]
name = "cloud.google.com/go"
packages = ["compute/metadata"]
revision = "050b16d2314d5fc3d4c9a51e4cd5c7468e77f162"
version = "v0.17.0"
revision = "777200caa7fb8936aed0f12b1fd79af64cc83ec9"
version = "v0.24.0"
[[projects]]
branch = "master"
......@@ -24,8 +24,14 @@
"autorest/azure",
"autorest/date"
]
revision = "c2a68353555b68de3ee8455a4fd3e890a0ac6d99"
version = "v9.8.1"
revision = "fc3b03a2d2d1f43fad3007038bd16f044f870722"
version = "v9.10.0"
[[projects]]
name = "github.com/BurntSushi/toml"
packages = ["."]
revision = "b26d9c308763d68093482582cea63d69be07a0f0"
version = "v0.3.0"
[[projects]]
name = "github.com/GeertJohan/go.rice"
......@@ -41,6 +47,18 @@
packages = ["."]
revision = "e9091a26100e9cfb2b6a8f470085bfa541931a91"
[[projects]]
name = "github.com/Masterminds/semver"
packages = ["."]
revision = "c7af12943936e8c39859482e61f0574c2fd7fc75"
version = "v1.4.2"
[[projects]]
name = "github.com/Masterminds/sprig"
packages = ["."]
revision = "6b2a58267f6a8b1dc8e2eb5519b984008fa85e8c"
version = "v2.15.0"
[[projects]]
name = "github.com/PuerkitoBio/purell"
packages = ["."]
......@@ -52,6 +70,12 @@
packages = ["."]
revision = "de5bf2ad457846296e2031421a34e2568e304e35"
[[projects]]
name = "github.com/aokoli/goutils"
packages = ["."]
revision = "3391d3790d23d03408670993e957e8f408993c34"
version = "v1.0.1"
[[projects]]
name = "github.com/asaskevich/govalidator"
packages = ["."]
......@@ -79,8 +103,8 @@
[[projects]]
name = "github.com/cpuguy83/go-md2man"
packages = ["md2man"]
revision = "1d903dcb749992f3741d744c0f8376b4bd7eb3e1"
version = "v1.0.7"
revision = "20f5889cbdc3c73dbd2862796665e7c465ade7d1"
version = "v1.0.8"
[[projects]]
branch = "master"
......@@ -97,8 +121,8 @@
[[projects]]
name = "github.com/dgrijalva/jwt-go"
packages = ["."]
revision = "dbeaa9332f19a944acb5736b4456cfcc02140e29"
version = "v3.1.0"
revision = "06ea1031745cb8b3dab3f6a236daf2b0aa468b7e"
version = "v3.2.0"
[[projects]]
name = "github.com/docker/distribution"
......@@ -154,8 +178,8 @@
".",
"log"
]
revision = "777bb3f19bcafe2575ffb2a3e46af92509ae9594"
version = "v1.2"
revision = "3eb9738c1697594ea6e71a7156a9bb32ed216cf0"
version = "v2.8.0"
[[projects]]
name = "github.com/emicklei/go-restful-swagger12"
......@@ -183,8 +207,8 @@
[[projects]]
name = "github.com/fatih/color"
packages = ["."]
revision = "570b54cabe6b8eb0bc2dfce68d964677d63b5260"
version = "v1.5.0"
revision = "5b77d2a35fb0ede96d138fc9a99f5c9b6aef11b4"
version = "v1.7.0"
[[projects]]
name = "github.com/fsnotify/fsnotify"
......@@ -201,13 +225,13 @@
branch = "master"
name = "github.com/go-openapi/analysis"
packages = ["."]
revision = "863ac7f90e00e88e507095639a8457bbbf3c2ec9"
revision = "a16e8fe5efba14fcd21e6efdc103ae7f9fb057c2"
[[projects]]
branch = "master"
name = "github.com/go-openapi/errors"
packages = ["."]
revision = "7bcb96a367bac6b76e6e42fa84155bb5581dcff8"
revision = "b2b2befaf267d082d779bcef52d682a47c779517"
[[projects]]
branch = "master"
......@@ -219,7 +243,7 @@
branch = "master"
name = "github.com/go-openapi/jsonreference"
packages = ["."]
revision = "36d33bfe519efae5632669801b180bf1a245da3b"
revision = "3fb327e6747da3043567ee86abd02bb6376b6be2"
[[projects]]
branch = "master"
......@@ -231,7 +255,7 @@
branch = "master"
name = "github.com/go-openapi/runtime"
packages = ["."]
revision = "c0cae94704c76c8643896d8054080f91e920105b"
revision = "9a3091f566c0811ef4d54b535179bc0fc484a11f"
[[projects]]
name = "github.com/go-openapi/spec"
......@@ -242,13 +266,13 @@
branch = "master"
name = "github.com/go-openapi/strfmt"
packages = ["."]
revision = "481808443b00a14745fada967cb5eeff0f9b1df2"
revision = "913ee058e387ac83a67e2d9f13acecdcd5769fc6"
[[projects]]
branch = "master"
name = "github.com/go-openapi/swag"
packages = ["."]
revision = "84f4bee7c0a6db40e3166044c7983c1c32125429"
revision = "2b0bd4f193d011c203529df626a65d63cb8a79e8"
[[projects]]
branch = "support-int-or-string"
......@@ -257,14 +281,29 @@
revision = "ee132525d544756f5bd2c6ad352789dd1c8c65de"
source = "github.com/heptio/validate"
[[projects]]
name = "github.com/gobwas/glob"
packages = [
".",
"compiler",
"match",
"syntax",
"syntax/ast",
"syntax/lexer",
"util/runes",
"util/strings"
]
revision = "5ccd90ef52e1e632236f7326478d4faa74f99438"
version = "v0.2.3"
[[projects]]
name = "github.com/gogo/protobuf"
packages = [
"proto",
"sortkeys"
]
revision = "342cbe0a04158f6dcb03ca0079991a51a4248c02"
version = "v0.5"
revision = "1adfc126b41513cc696b209667c8656ea7aac67c"
version = "v1.0.0"
[[projects]]
branch = "master"
......@@ -279,7 +318,6 @@
revision = "24b0969c4cb722950103eed87108c8d291a8df00"
[[projects]]
branch = "master"
name = "github.com/golang/protobuf"
packages = [
"proto",
......@@ -288,7 +326,8 @@
"ptypes/duration",
"ptypes/timestamp"
]
revision = "1e59b77b52bf8e4b449a57e6f79f21226d571845"
revision = "b4deda0973fb4c70b50d226b1af49f3da59f5265"
version = "v1.1.0"
[[projects]]
branch = "master"
......@@ -322,6 +361,12 @@
packages = ["."]
revision = "24818f796faf91cd76ec7bddd72458fbced7a6c1"
[[projects]]
name = "github.com/google/uuid"
packages = ["."]
revision = "064e2069ce9c359c118179501254f67d7d37ba24"
version = "0.2"
[[projects]]
name = "github.com/googleapis/gnostic"
packages = [
......@@ -343,7 +388,7 @@
"openstack/utils",
"pagination"
]
revision = "4a3f5ae58624b68283375060dad06a214b05a32b"
revision = "4d8e78ba7b0e1017a7a37401105df42ac7d498c1"
[[projects]]
branch = "master"
......@@ -378,7 +423,7 @@
"json/scanner",
"json/token"
]
revision = "23c074d0eceb2b8a5bfdbb271ab780cde70f05a8"
revision = "ef8a98b0bbce4a65b5aa4c368430a80ddc533168"
[[projects]]
branch = "master"
......@@ -386,11 +431,17 @@
packages = ["."]
revision = "bf9dde6d0d2c004a008c27aaee91170c786f6db8"
[[projects]]
name = "github.com/huandu/xstrings"
packages = ["."]
revision = "2bf18b218c51864a87384c06996e40ff9dcff8e1"
version = "v1.0.0"
[[projects]]
name = "github.com/imdario/mergo"
packages = ["."]
revision = "7fe0c75c13abdee74b09fcacef5ea1c6bba6a874"
version = "0.2.4"
revision = "9316a62528ac99aaecb4e47eadd6dc8aa6533d58"
version = "v0.3.5"
[[projects]]
name = "github.com/inconshreveable/mousetrap"
......@@ -407,8 +458,8 @@
[[projects]]
name = "github.com/json-iterator/go"
packages = ["."]
revision = "ca39e5af3ece67bbcda3d0f4f56a8e24d9f2dad4"
version = "1.1.3"
revision = "ab8a2e0c74be9d3be70b3184d9acc634935ded82"
version = "1.1.4"
[[projects]]
branch = "master"
......@@ -428,14 +479,13 @@
"ksonnet-gen/printer"
]
revision = "83f20ee933bcd13fcf4ad1b49a40c92135c5569c"
source = "github.com/bryanl/ksonnet-lib"
version = "v0.1.10"
[[projects]]
name = "github.com/magiconair/properties"
packages = ["."]
revision = "c3beff4c2358b44d0493c7dda585e7db7ff28ae6"
version = "v1.7.6"
revision = "c2353362d570a7bfa228149c62842019201cfb71"
version = "v1.8.0"
[[projects]]
branch = "master"
......@@ -445,7 +495,7 @@
"jlexer",
"jwriter"
]
revision = "32fa128f234d041f196a9f3e0fea5ac9772c08e1"
revision = "3fdea8d05856a0c8df22ed4bc71b3219245e4485"
[[projects]]
name = "github.com/mattn/go-colorable"
......@@ -456,13 +506,14 @@
[[projects]]
name = "github.com/mattn/go-isatty"
packages = ["."]
revision = "fc9e8d8ef48496124e79ae0df75490096eccf6fe"
revision = "0360b2af4f38e8d38c7fce2a9f4e702702d73a39"
version = "v0.0.3"
[[projects]]
name = "github.com/matttproud/golang_protobuf_extensions"
packages = ["pbutil"]
revision = "3247c84500bff8d9fb6d579d800f20b3e091582c"
version = "v1.0.0"
revision = "c12348ce28de40eed0136aa2b644d0ee0650e56c"
version = "v1.0.1"
[[projects]]
branch = "master"
......@@ -474,7 +525,7 @@
branch = "master"
name = "github.com/mitchellh/mapstructure"
packages = ["."]
revision = "00c29f56e2386353d58c599509e8dc3801b0d716"
revision = "bb74f1db0675b241733089d5a1faa5dd8b0ef57b"
[[projects]]
name = "github.com/modern-go/concurrent"
......@@ -485,8 +536,8 @@
[[projects]]
name = "github.com/modern-go/reflect2"
packages = ["."]
revision = "1df9eeb2bb81f327b96228865c5687bc2194af3f"
version = "1.0.0"
revision = "4b7aa43c6742a2c18fdef89dd197aaae7dac7ccd"
version = "1.0.1"
[[projects]]
name = "github.com/onsi/ginkgo"
......@@ -554,8 +605,8 @@
[[projects]]
name = "github.com/pelletier/go-toml"
packages = ["."]
revision = "acdc4509485b587f5e675510c4f2c63e90ff68a8"
version = "v1.1.0"
revision = "c01d1270ff3e442a8a57cddc1c92dc1138598194"
version = "v1.2.0"
[[projects]]
branch = "master"
......@@ -601,7 +652,7 @@
"internal/bitbucket.org/ww/goautoneg",
"model"
]
revision = "d811d2e9bf898806ecfb6ef6296774b13ffc314c"
revision = "7600349dcfe1abd18d72d3a1770870d9800a7801"
[[projects]]
branch = "master"
......@@ -612,13 +663,13 @@
"nfs",
"xfs"
]
revision = "8b1c2da0d56deffdbb9e48d4414b4e674bd8083e"
revision = "40f013a808ec4fa79def444a1a56de4d1727efcb"
[[projects]]
name = "github.com/russross/blackfriday"
packages = ["."]
revision = "4048872b16cc0fc2c5fd9eacf0ed2c2fedaa0c8c"
version = "v1.5"
revision = "55d61fa8aa702f59229e6cff85793c22e580eaf5"
version = "v1.5.1"
[[projects]]
branch = "master"
......@@ -681,8 +732,8 @@
[[projects]]
name = "github.com/stretchr/objx"
packages = ["."]
revision = "facf9a85c22f48d2f52f2380e4efce1768749a89"
version = "v0.1"
revision = "477a77ecc69700c7cdeb1fa9e129548e1c1c393c"
version = "v0.1.1"
[[projects]]
name = "github.com/stretchr/testify"
......@@ -694,13 +745,16 @@
revision = "f6abca593680b2315d2075e0f5e2a9751e3f431a"
[[projects]]
branch = "master"
name = "golang.org/x/crypto"
packages = [
"ed25519",
"ed25519/internal/edwards25519",
"pbkdf2",
"scrypt",
"ssh/terminal"
]
revision = "0fe963104e9d1877082f8fb38f816fcd97eb1d10"
revision = "a49355c7e3f8fe157a85be2f77e6e269a0f89602"
[[projects]]
branch = "master"
......@@ -711,12 +765,12 @@
"html",
"html/atom",
"html/charset",
"http/httpguts",
"http2",
"http2/hpack",
"idna",
"lex/httplex"
"idna"
]
revision = "d866cfc389cec985d6fda2859936a575a55a3ab6"
revision = "ed29d75add3d7c4bf7ca65aac0c6df3d1420216f"
[[projects]]
name = "golang.org/x/oauth2"
......@@ -732,11 +786,13 @@
[[projects]]
branch = "master"
name = "golang.org/x/sys"
packages = ["unix"]
revision = "a3f2cbd54cf5dfe3fbaccf76375fdb12f67654c8"
packages = [
"unix",
"windows"
]
revision = "7138fd3d9dc8335c567ca206f4333fb75eb05d56"
[[projects]]
branch = "master"
name = "golang.org/x/text"
packages = [
"collate",
......@@ -767,7 +823,8 @@
"unicode/rangetable",
"width"
]
revision = "e19ae1496984b1c655b8044a65c0300a3c878dd3"
revision = "f21a4dfb5e38f5895301dc265a8def02365cc3d0"
version = "v0.3.0"
[[projects]]
branch = "master"
......@@ -789,14 +846,14 @@
"internal/urlfetch",
"urlfetch"
]
revision = "150dc57a1b433e64154302bdc40b6bb8aefa313a"
version = "v1.0.0"
revision = "b1f26356af11148e710935ed1ac8a7f5702c7612"
version = "v1.1.0"
[[projects]]
name = "gopkg.in/inf.v0"
packages = ["."]
revision = "3887ee99ecf07df5b447e9b00d9c0b2adaa9f3e4"
version = "v0.9.0"
revision = "d2d2541c53f18d2a059457998ce2876cc8e67cbf"
version = "v0.9.1"
[[projects]]
branch = "v2"
......@@ -864,7 +921,7 @@
branch = "master"
name = "k8s.io/apiextensions-apiserver"
packages = ["pkg/features"]
revision = "8d2dca0b4e6ad410ebdefa9e524872cf0f67177a"
revision = "95624737254b66ecad68d6cb420ce7f4e7e90ba2"
[[projects]]
name = "k8s.io/apimachinery"
......@@ -1091,6 +1148,20 @@
revision = "23781f4d6632d88e869066eaebb743857aa1ef9b"
version = "v7.0.0"
[[projects]]
name = "k8s.io/helm"
packages = [
"pkg/chartutil",
"pkg/engine",
"pkg/ignore",
"pkg/proto/hapi/chart",
"pkg/proto/hapi/version",
"pkg/sympath",
"pkg/version"
]
revision = "20adb27c7c5868466912eebdf6664e7390ebe710"
version = "v2.9.1"
[[projects]]
branch = "master"
name = "k8s.io/kube-openapi"
......@@ -1098,7 +1169,7 @@
"pkg/util/proto",
"pkg/util/proto/validation"
]
revision = "b3f03f55328800731ce03a164b80973014ecd455"
revision = "d83b052f768a50a309c692a9c271da3f3276ff88"
[[projects]]
name = "k8s.io/kubernetes"
......@@ -1268,14 +1339,14 @@
"pkg/volume/util/recyclerclient",
"pkg/volume/util/types"
]
revision = "5ca598b4ba5abb89bb773071ce452e33fb66339d"
version = "v1.10.4"
revision = "32ac1c9073b132b8ba18aa830f46b77dcceb0723"
version = "v1.10.5"
[[projects]]
branch = "master"
name = "k8s.io/utils"
packages = ["exec"]
revision = "258e2a2fa64568210fbd6267cf1d8fd87c3cb86e"
revision = "733eca437aa39379e4bcc25e726439dfca40fcff"
[[projects]]
branch = "master"
......@@ -1286,6 +1357,6 @@
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "7085a6b676bdad1130181c8b9936f298d07fa0b220f848e1ad40094eb311051b"
inputs-digest = "00a7b3ca0ae8687861d1b197155f8fe44d4b36df2672a581ab59be63d36beb1c"
solver-name = "gps-cdcl"
solver-version = 1
......@@ -110,10 +110,19 @@ required = ["k8s.io/kubernetes/pkg/kubectl/cmd/util"]
name = "k8s.io/client-go"
version = "v7.0.0"
# required by client-go v7.0.0
[[override]]
name = "github.com/Azure/go-autorest"
version = "v9.8.1"
[[constraint]]
name = "k8s.io/kubernetes"
version = "v1.10.4"
[[constraint]]
name = "k8s.io/helm"
version = "v2.9.1"
[[constraint]]
name = "github.com/GeertJohan/go.rice"
revision = "c02ca9a983da5807ddf7d796784928f5be4afd09"
......@@ -146,6 +155,8 @@ required = ["k8s.io/kubernetes/pkg/kubectl/cmd/util"]
[[override]]
name = "github.com/json-iterator/go"
version = "1.1.3"
[[constraint]]
branch = "fix-unknown-flag-panic"
name = "github.com/shomron/pflag"
......@@ -52,7 +52,7 @@ ks apply dev --dry-run
ks apply dev -c guestbook-ui
# Create or update multiple components in a ksonnet application (e.g. 'guestbook-ui'
# and 'ngin-depl') for the 'dev' environment. Does not create resources that are
# and 'nginx-depl') for the 'dev' environment. Does not create resources that are
# not already present on the cluster.
#
# This essentially deploys 'components/guestbook-ui.jsonnet' and
......
......@@ -112,6 +112,17 @@ func (ra *RegistryAdd) protocol() (registryDetails, error) {
return rd, nil
}
_, err := url.Parse(ra.uri)
if err == nil {
// assuming uri is a helm repository URL
rd := registryDetails{
URI: ra.uri,
Protocol: registry.ProtocolHelm,
}
return rd, nil
}
return registryDetails{}, errors.Errorf("could not detect registry type for %s", ra.uri)
}
......
......@@ -68,6 +68,12 @@ func TestRegistryAdd(t *testing.T) {
expectedURI: "/path",
protocol: registry.ProtocolFilesystem,
},
{
name: "URL",
uri: "https://kubernetes-charts.storage.googleapis.com",
expectedURI: "https://kubernetes-charts.storage.googleapis.com",
protocol: registry.ProtocolHelm,
},
}
for _, tc := range cases {
......
......@@ -20,6 +20,7 @@ import (
"fmt"
"path/filepath"
"github.com/ksonnet/ksonnet/pkg/helm"
utilio "github.com/ksonnet/ksonnet/pkg/util/io"
"github.com/ksonnet/ksonnet/pkg/app"
......@@ -127,6 +128,7 @@ func evaluateMain(a app.App, envName, snippet, components, paramsStr string, opt
}
vm := jsonnet.NewVM(opts...)
vm.AddJPath(componentJPaths...)
vm.AddJPath(
filepath.Join(a.Root(), envRootName),
......@@ -136,6 +138,9 @@ func evaluateMain(a app.App, envName, snippet, components, paramsStr string, opt
libPath,
)
helmRenderer := helm.NewRenderer(a)
vm.AddFunctions(helmRenderer.JsonnetNativeFunc())
// Re-vendor versioned packages, such that import paths will remain path-agnostic.
// TODO Where should packagemanager come from?
pm := registry.NewPackageManager(a)
......@@ -260,7 +265,7 @@ func buildPackagePaths(pm registry.PackageManager, e *app.EnvironmentConfig) (ma
for _, v := range pkgList {
if v.Version() == "" {
log.Debugf("skipping unversioned packaged: %v", v)
log.Debugf("skipping unversioned packaged: %s/%s", v.RegistryName(), v.Name())
continue
}
k := fmt.Sprintf("%s/%s", v.RegistryName(), v.Name())
......
// Copyright 2018 The ksonnet 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package helm
import (
"path/filepath"
"github.com/blang/semver"
"github.com/ksonnet/ksonnet/pkg/app"
"github.com/pkg/errors"
"github.com/spf13/afero"
)
// LatestChartVersion finds the latest vendored version of a chart.
func LatestChartVersion(a app.App, repoName, chartName string) (string, error) {
path := filepath.Join(a.Root(), "vendor", repoName, chartName, "helm")
fis, err := afero.ReadDir(a.Fs(), path)
if err != nil {
return "", errors.Wrapf(err, "reading dir %q", path)
}
var versions semver.Versions
for _, fi := range fis {
if !fi.IsDir() {
continue
}
v, err := semver.Make(fi.Name())
if err != nil {
continue
}
versions = append(versions, v)
}
if len(versions) == 0 {
return "", errors.Errorf("chart %s/%s doesn't have any releases", repoName, chartName)
}
semver.Sort(versions)
return versions[0].String(), nil
}