/
datree.ts
190 lines (189 loc) · 4.59 KB
/
datree.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
const testOptions: Fig.Option[] = [
{
name: ["--help", "-h"],
description: "Help for 'test'",
},
{
name: "--ignore-missing-schemas",
description: "Ignore missing schemas when executing schema validation step",
},
{
name: "--no-record",
description: "Do not send policy checks metadata to the backend",
},
{
name: "--only-k8s-files",
description:
"Evaluate only valid yaml files with the properties 'apiVersion' and 'kind'. Ignore everything else",
},
{
name: ["-o", "--output"],
description: "Define output format (simple, yaml, json, xml, JUnit)",
args: {
name: "output",
description: "Output format",
suggestions: [
{
name: "simple",
description: "Simple output without colors",
},
{
name: "yaml",
description: "YAML output",
},
{
name: "json",
description: "JSON output",
},
{
name: "xml",
description: "XML output",
},
{
name: "junit",
description: "JUnit output",
},
],
},
},
{
name: ["-p", "--policy"],
description: "Policy name to run against",
args: {
name: "policy",
description: "String",
},
},
{
name: "--policy-config",
description: "Path for local policies configuration file",
args: {
template: "filepaths",
},
},
{
name: "--schema-location",
description:
"Override schemas location search path (can be specified multiple times)",
args: {
name: "stringArray",
description: "String array",
},
},
{
name: ["-s", "--schema-version"],
description:
"Set kubernetes version to validate against. Defaults to 1.19.0",
},
{
name: "--verbose",
description: "Display 'How to Fix' link",
},
];
const datreeSpec: Fig.Spec = {
name: "datree",
description:
"Datree can be used on the command line to run policies against Kubernetes manifests YAML files or Helm charts",
subcommands: [
{
name: "completion",
description: "Generate completion script for bash,zsh,fish,powershell",
},
{
name: "config",
description: "Internal configuration management for datree config file",
subcommands: [
{
name: "get",
description: "Get configuration value",
options: [
{
name: ["-h", "--help"],
description:
"Get value for specific key from datree config.yaml file. Defaults to $HOME/.datree/config.yaml",
},
],
},
{
name: "set",
description: "Set configuration value",
options: [
{
name: ["-h", "--help"],
description:
"Apply value for specific key in datree config.yaml file. Defaults to $HOME/.datree/config.yaml",
},
],
},
],
options: [
{
name: ["-h", "--help"],
description: "Help for config",
},
],
},
{
name: "help",
description: "Help about any command",
args: {
template: "help",
},
},
{
name: "kustomize",
description: "Generate kustomization files from manifests",
subcommands: [
{
name: "test",
description: "Test kustomization files",
options: testOptions,
},
],
options: [
{
name: ["-h", "--help"],
description: "Help for kustomize",
},
],
},
{
name: "publish",
description:
"Publish policies configuration for given <fileName>. Input should be the path to the Policy-as-Code yaml configuration file. ## Note You need to first enable Policy-as-Code (PaC) on the settings page in the dashboard",
options: [
{
name: ["-h", "--help"],
description: "Help for publish",
},
],
args: {
name: "file path",
template: "filepaths",
},
},
{
name: "test",
description:
"Trigger a policy check, provide a Kubernetes configuration file path or a glob pattern",
args: {
name: "file path",
template: "filepaths",
},
options: testOptions,
},
{
name: "version",
description: "Print the version number",
},
],
options: [
{
name: ["--help", "-h"],
description: "Show help for datree",
},
],
// Only uncomment if datree takes an argument
// args: {}
};
export default datreeSpec;