ALPHA VERSION
May deprecated when cue modules official supported
dependency management for CUE without committing cue.mod
git
or other vcs tool supported by go for vcs downloading.
go install github.com/octohelm/cuemod/cmd/cuem@latest
mkdir -p ./demo && cd ./demo
cat << EOT > kube.cue
package kube
import (
apps_v1 "k8s.io/api/apps/v1"
)
deployment: [string]: apps_v1.#Deployment
_labels: { "app": "nginx" }
deployment: nginx: spec: selector: matchLabels: _labels
deployment: nginx: spec: template: metadata: labels: _labels
deployment: nginx: spec: template: spec: {
containers: [{
name: "nginx"
image: "nginx:1.11.10-alpine"
}]
}
EOT
cuem eval -o kube.yaml ./kube.cue
# build, will automately install deps if not exists or generator if needed.
cuem eval -o ./kube.single-file.cue ./kube.cue
# will bundle to one single cue file
# auto added deps
cuem get ./...
# upgrade deps
cuem get -u ./...
# install dep with special version
cuem get github.com/grafana/jsonnet-libs@latest
- Dependency management based on go modules
- all dependency codes will download under
$(go env GOMODCACHE)
GOPROXY
supported to speed up downloading
- all dependency codes will download under
- Extract to cue pkg from other language or schema spec.
golang
supported- k8s
crd
json supported
// module name
// for sub mod import, <module>/path/to/sub
// NOTICE: the module name should be a valid repo name
module: "github.com/octohelm/cuemod"
require: {
"dagger.io": "v0.2.8-0.20220512005159-64cb4f755695"
"k8s.io/api": "v0.24.0"
"universe.dagger.io": "v0.2.8-0.20220512005159-64cb4f755695"
}
require: {
"k8s.io/apimachinery": "v0.24.0" @indirect()
}
replace: {
// replace module with spec version
"dagger.io": "github.com/morlay/dagger/pkg/dagger.io@#release-main"
"universe.dagger.io": "github.com/morlay/dagger/pkg/universe.dagger.io@#release-main"
// **notice** only works for current mod
"github.com/x/a": "../a"
}
replace: {
"k8s.io/api": "" @import("go")
"k8s.io/apimachinery": "" @import("go")
}
Some path like github.com/istio/istio/manifests/charts/istio-operator
, the istio-operator
is not a valid identifier
in cue-lang
. Should import with github.com/istio/istio/manifests/charts/istio-operator:istio_operator