New to Kubepack? Please start here.
Scenario-9
This docs trying to explain the behavior of Pack
This section explain, how jsonnet
appears in Pack.
If you look into dependency-list.yaml
file:
$ cat dependency-list.yaml
items:
- package: github.com/kubepack/kube-a
branch: test-9
You see, this test-case depend on branch test-9
of repository kube-a.
In branch test-9
of kube-a contains a jsonnet file.
When execute $ pack dep -f .
to get the dependencies, it’ll get all the dependencies and
convert jsonnet
file into yaml file.
If you see, jsonnet file of kube-a, will see as below
local shardTemplate = import "shard.jsonnet.TEMPLATE";
shardTemplate + {
name:: "foocorp",
namespace:: "default",
}
After $ pack dep -f .
, if you checkout manifests/vendor
’s foocorp-shard.jsonnet
file,
you’ll see as below
$ cat manifests/vendor/github.com/kubepack/kube-a/manifests/app/foocorp-shard.jsonnet
apiVersion: v1
kind: Service
metadata:
name: foocorp
namespace: default
spec:
selector:
serviceName: foocorp
Now, $ pack up -f .
will generate final outcome in manifests/output
folder.
$ tree manifests/output/
manifests/output/
└── github.com
└── kubepack
└── kube-a
└── manifests
└── app
├── foocorp-shard.jsonnet
├── nginx-deployment.yaml
└── nginx-dm.yaml
5 directories, 3 files