- Links Kubernetes:
- Kubernetes JSON file: https://github.com/instrumenta/kubernetes-json-schema/blob/master/v1.18.0/_definitions.json
- Kubernetes Namespace: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/
- Links Cheops:
- Cheops Git Repo: https://gitlab.inria.fr/discovery/cheops
- Cheops latest Paper: https://hal.inria.fr/hal-03770492/document
- User configs:
- YAML for a pod: https://kubernetes.io/docs/concepts/configuration/secret/#using-secrets-as-files-from-a-pod
- YAML for a deployment: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/
> dtree make -h
Generate the dependancy tree for the given .yaml config and .json struct
Usage:
dtree make [flags]
Flags:
-c, --config string The yaml config file (default "./config.yaml")
-f, --format string The format of the output (config, template or tree) (default "tree")
-h, --help help for make
-t, --template string The template definition file (default "./template.json")
go run main.go make -c ./assets/config.yaml -t ./assets/template.json
Reference template: template.json Reference config: config.yaml
Example queried config:
apiVersion: v1
kind: Pod
metadata:
name: mypod
spec:
containers:
- name: mypod
image: redis
volumeMounts:
- name: foo
mountPath: "/etc/foo"
readOnly: true
volumes:
- name: foo
secret:
secretName: mysecret
optional: false
Found template from kind: io.k8s.api.core.v1.Pod
Required field in template: None
Existing references in template:
- metadata:
"#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta"
, - spec:
"#/definitions/io.k8s.api.core.v1.PodSpec"
, - status:
"#/definitions/io.k8s.api.core.v1.PodStatus"
,
Found in Config: 1. and 2.
Referenced template: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta
Required field in template: None
Existing references in template:
- creationTimestamp:
"#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.Time"
, - deletionTimestamp:
"#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.Time"
, - managedFields:
"#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ManagedFieldsEntry"
, - ownerReferences:
"#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.OwnerReference"
Found in Config: None
Referenced template: io.k8s.api.core.v1.PodSpec
Required field in template: "containers"
Existing references in template:
- volumes > items:
"#/definitions/io.k8s.api.core.v1.Volume"
- containers > items:
"#/definitions/io.k8s.api.core.v1.Container"
- ...
Found in Config: 1. and 2.
Referenced template: io.k8s.api.core.v1.Volume
Required field in template: "name"
Existing references in template:
- secret:
io.k8s.api.core.v1.SecretVolumeSource
- ...
Found in Config: 1.
Referenced template: io.k8s.api.core.v1.SecretVolumeSource
Required field in template: None
Existing references in template:
- ...
Found in Config: None
Referenced template: io.k8s.api.core.v1.Container
Required field in template: "name"
Existing references in template:
- volumeMounts > items:
io.k8s.api.core.v1.VolumeMount
- ...
Found in Config: 1.
Referenced template: io.k8s.api.core.v1.VolumeMount
Required field in template: "name", "mountPath"
Existing references in template:
- ...
Found in Config: None
STOP
Template: dtree make -f "template"
Required fields for the given configuration:
* io.k8s.api.core.v1.PodSpec.properties.containers
* io.k8s.api.core.v1.Container.properties.name
* io.k8s.api.core.v1.VolumeMount.properties.name
* io.k8s.api.core.v1.VolumeMount.properties.mountPath
* io.k8s.api.core.v1.Volume.properties.name
Config: dtree make -f "config"
Required fields for the given configuration:
* .spec.containers = map[items:[map[image:redis name:mypod volumeMounts:map[items:[map[mountPath:/etc/foo name:foo readOnly:true]]]]]]
* .spec.volumes.name = foo
* .spec.containers.name = mypod
* .spec.containers.volumeMounts.name = foo
* .spec.containers.volumeMounts.mountPath = /etc/foo
Tree: dtree make -f "tree"
Required fields for the given configuration:
{
"spec": {
"containers": {
"name": "mypod",
"volumeMounts": {
"mountPath": "/etc/foo",
"name": "foo"
}
},
"volumes": {
"name": "foo"
}
}
}