@@ -29,24 +29,34 @@ const (
29
29
30
30
// Config wraps the options for a run of the agent.
31
31
type Config struct {
32
+ // Deprecated: Schedule doesn't do anything. Use `period` instead.
32
33
Schedule string `yaml:"schedule"`
33
34
Period time.Duration `yaml:"period"`
34
- // Deprecated: Endpoint is being replaced with Server.
35
+
36
+ // Deprecated: Use `server` instead.
35
37
Endpoint Endpoint `yaml:"endpoint"`
36
- // Server is the base url for the Preflight server.
37
- // It defaults to https://preflight.jetstack.io.
38
+
39
+ // Server is the base URL for the Preflight server. It defaults to
40
+ // https://preflight.jetstack.io in Jetstack Secure OAuth and Jetstack
41
+ // Secure API Token modes, and https://api.venafi.cloud in Venafi Cloud Key
42
+ // Pair Service Account mode. It is ignored in Venafi Cloud VenafiConnection
43
+ // mode.
38
44
Server string `yaml:"server"`
39
- // OrganizationID within Preflight that will receive the data.
45
+
46
+ // OrganizationID is only used in Jetstack Secure OAuth and Jetstack Secure
47
+ // API Token modes.
40
48
OrganizationID string `yaml:"organization_id"`
41
- // ClusterID is the cluster that the agent is scanning.
42
- ClusterID string `yaml:"cluster_id"`
43
- ClusterDescription string `yaml:"cluster_description"`
44
- DataGatherers []DataGatherer `yaml:"data-gatherers"`
45
- // InputPath replaces DataGatherers with input data file
49
+
50
+ // ClusterID is the cluster that the agent is scanning. Used in all modes.
51
+ ClusterID string `yaml:"cluster_id"`
52
+ ClusterDescription string `yaml:"cluster_description"`
53
+ DataGatherers []DataGatherer `yaml:"data-gatherers"`
54
+ VenafiCloud * VenafiCloudConfig `yaml:"venafi-cloud,omitempty"`
55
+
56
+ // For testing purposes.
46
57
InputPath string `yaml:"input-path"`
47
- // OutputPath replaces Server with output data file
48
- OutputPath string `yaml:"output-path"`
49
- VenafiCloud * VenafiCloudConfig `yaml:"venafi-cloud,omitempty"`
58
+ // For testing purposes.
59
+ OutputPath string `yaml:"output-path"`
50
60
}
51
61
52
62
type Endpoint struct {
@@ -80,11 +90,9 @@ type AgentCmdFlags struct {
80
90
// precedence over the config field `period`.
81
91
Period time.Duration
82
92
83
- // OneShot (--one-shot) flag causes agent to run once.
84
- OneShot bool
85
-
86
- // VenafiCloudMode (--venafi-cloud) determines which format to load for
87
- // config and credential type.
93
+ // VenafiCloudMode (--venafi-cloud) turns on the Venafi Cloud Key Pair
94
+ // Service Account mode. Must be used in conjunction with
95
+ // --credentials-file.
88
96
VenafiCloudMode bool
89
97
90
98
// ClientID (--client-id) is the clientID in case of Venafi Cloud Key Pair
@@ -95,16 +103,27 @@ type AgentCmdFlags struct {
95
103
// private key in case of Venafi Cloud Key Pair Service Account mode.
96
104
PrivateKeyPath string
97
105
98
- // CredentialsPath (--credentials-file, -k) is the path to the credentials )
99
- // is where the agent will try to loads the credentials (Experimental).
106
+ // CredentialsPath (--credentials-file, -k) lets you specify the location of
107
+ // the credentials file. This is used for the Jetstack Secure OAuth and
108
+ // Venafi Cloud Key Pair Service Account modes. In Venafi Cloud Key Pair
109
+ // Service Account mode, you also need to pass --venafi-cloud.
100
110
CredentialsPath string
101
111
102
- // OutputPath (--output-path) is where the agent will write data to instead
103
- // of uploading to server.
112
+ // OneShot (--one-shot) is used for testing purposes. The agent will run
113
+ // once and exit. It is often used in conjunction with --output-path and/or
114
+ // --input-path.
115
+ OneShot bool
116
+
117
+ // OutputPath (--output-path) is used for testing purposes. In conjunction
118
+ // with --one-shot, it allows you to write the data readings to a file
119
+ // instead uploading them to the Venafi Cloud API.
104
120
OutputPath string
105
121
106
- // InputPath (--input-path) is where the agent will read data from instead
107
- // of gathering data from clusters.
122
+ // InputPath (--input-path) is used for testing purposes. In conjunction
123
+ // with --one-shot, it allows you to push manually crafted data readings (in
124
+ // JSON format) to the Venafi Cloud API without the need to connect to a
125
+ // Kubernetes cluster. See the jscp-testing-cli's README for more info:
126
+ // https://gitlab.com/venafi/vaas/applications/tls-protect-for-k8s/cloud-services/-/tree/master/jscp-testing-cli
108
127
InputPath string
109
128
110
129
// BackoffMaxTime (--backoff-max-time) is the maximum time for which data
@@ -114,8 +133,8 @@ type AgentCmdFlags struct {
114
133
// StrictMode (--strict) causes the agent to fail at the first attempt.
115
134
StrictMode bool
116
135
117
- // APIToken (--api-token) is meant for the old Jetstack Secure API and is an
118
- // alternative to OAuth .
136
+ // APIToken (--api-token) allows you to use the Jetstack Secure API Token
137
+ // mode. Defaults to the value of the env var API_TOKEN .
119
138
APIToken string
120
139
121
140
// VenConnName (--venafi-connection) is the name of the VenafiConnection
@@ -171,7 +190,7 @@ func InitAgentCmdFlags(c *cobra.Command, cfg *AgentCmdFlags) {
171
190
"venafi-cloud" ,
172
191
"" ,
173
192
false ,
174
- fmt .Sprintf ("Turn on the %s mode. The flag --credentials-file must also be passed." , JetstackSecureOAuth ),
193
+ fmt .Sprintf ("Turns on the %s mode. The flag --credentials-file must also be passed." , JetstackSecureOAuth ),
175
194
)
176
195
c .PersistentFlags ().StringVarP (
177
196
& cfg .ClientID ,
@@ -194,21 +213,21 @@ func InitAgentCmdFlags(c *cobra.Command, cfg *AgentCmdFlags) {
194
213
"one-shot" ,
195
214
"" ,
196
215
false ,
197
- "Runs agent a single time if true, or continously if false " ,
216
+ "For testing purposes. The agent will run once and exit. It is often used in conjunction with --output-path and/or --input-path. " ,
198
217
)
199
218
c .PersistentFlags ().StringVarP (
200
219
& cfg .OutputPath ,
201
220
"output-path" ,
202
221
"" ,
203
222
"" ,
204
- "Output file path, if used , it will write data to a local file instead of uploading to the preflight server" ,
223
+ "For testing purposes. In conjunction with --one-shot , it allows you to write the data readings to a file instead of uploading to the server. " ,
205
224
)
206
225
c .PersistentFlags ().StringVarP (
207
226
& cfg .InputPath ,
208
227
"input-path" ,
209
228
"" ,
210
229
"" ,
211
- "Input file path, if used , it will read data from a local file instead of gathering data from clusters " ,
230
+ "For testing purposes. In conjunction with --one-shot , it allows you to push manually crafted data readings (in JSON format) to the Venafi Cloud API without the need to connect to a Kubernetes cluster. " ,
212
231
)
213
232
c .PersistentFlags ().DurationVarP (
214
233
& cfg .BackoffMaxTime ,
@@ -228,14 +247,14 @@ func InitAgentCmdFlags(c *cobra.Command, cfg *AgentCmdFlags) {
228
247
& cfg .APIToken ,
229
248
"api-token" ,
230
249
os .Getenv ("API_TOKEN" ),
231
- fmt . Sprintf ( "Turns on the %s mode. Defaults to the value of the env var API_TOKEN." , JetstackSecureAPIToken ) ,
250
+ "Turns on the " + string ( JetstackSecureAPIToken ) + " mode. Defaults to the value of the env var API_TOKEN." ,
232
251
)
233
252
c .PersistentFlags ().StringVar (
234
253
& cfg .VenConnName ,
235
254
"venafi-connection" ,
236
255
"" ,
237
- fmt . Sprintf ( "Turns on the %s mode. This flag configures the name of the " +
238
- "VenafiConnection to be used." , VenafiCloudVenafiConnection ) ,
256
+ "Turns on the " + string ( VenafiCloudVenafiConnection ) + " mode. "+
257
+ "This flag configures the name of the VenafiConnection to be used." ,
239
258
)
240
259
c .PersistentFlags ().StringVar (
241
260
& cfg .VenConnNS ,
@@ -249,8 +268,9 @@ func InitAgentCmdFlags(c *cobra.Command, cfg *AgentCmdFlags) {
249
268
& cfg .InstallNS ,
250
269
"install-namespace" ,
251
270
"" ,
252
- fmt .Sprintf ("Namespace in which the agent is running. Only needed with the %s mode" +
253
- "when running the agent outside of Kubernetes. Used for testing purposes." , VenafiCloudVenafiConnection ),
271
+ "For testing purposes. Namespace in which the agent is running. " +
272
+ "Only needed with the " + string (VenafiCloudVenafiConnection )+ " mode" +
273
+ "when running the agent outside of Kubernetes." ,
254
274
)
255
275
c .PersistentFlags ().BoolVarP (
256
276
& cfg .Profiling ,
@@ -266,6 +286,7 @@ func InitAgentCmdFlags(c *cobra.Command, cfg *AgentCmdFlags) {
266
286
false ,
267
287
"Enables Prometheus metrics server on the agent (port: 8081)." ,
268
288
)
289
+
269
290
}
270
291
271
292
type AuthMode string
0 commit comments