Skip to content

Commit eacff71

Browse files
authored
support adding a CA cert to http collector (#1624)
* add a TLS parameter for cacert * pass a ca cert into http request * test preflight * make schemas * log extra information from http request * pass a proxy into the collector spec * hitting a segfault; breakpoint * accept a dir, file, or a string-literal as CA * move tls params into get, put, post methods * test for cert untrusted response * make generate * make schemas * more test cases * make schemas * dont include system certs * make generate && make schemas * resolve gosec G402 warning * remove old check for system certs * ignore errcheck "return value not checked" linter errors
1 parent 7ed2f4b commit eacff71

17 files changed

+1561
-25
lines changed

.golangci.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ linters:
1111
- gofmt
1212
- gosec
1313
- govet
14+
disable:
15+
- errcheck

config/crds/troubleshoot.sh_collectors.yaml

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,11 +408,34 @@ spec:
408408
type: object
409409
insecureSkipVerify:
410410
type: boolean
411+
proxy:
412+
type: string
411413
timeout:
412414
description: |-
413415
Timeout is the time to wait for a server's response. Its a duration e.g 15s, 2h30m.
414416
Missing value or empty string or means no timeout.
415417
type: string
418+
tls:
419+
properties:
420+
cacert:
421+
type: string
422+
clientCert:
423+
type: string
424+
clientKey:
425+
type: string
426+
secret:
427+
properties:
428+
name:
429+
type: string
430+
namespace:
431+
type: string
432+
required:
433+
- name
434+
- namespace
435+
type: object
436+
skipVerify:
437+
type: boolean
438+
type: object
416439
url:
417440
type: string
418441
required:
@@ -430,11 +453,34 @@ spec:
430453
type: object
431454
insecureSkipVerify:
432455
type: boolean
456+
proxy:
457+
type: string
433458
timeout:
434459
description: |-
435460
Timeout is the time to wait for a server's response. Its a duration e.g 15s, 2h30m.
436461
Missing value or empty string or means no timeout.
437462
type: string
463+
tls:
464+
properties:
465+
cacert:
466+
type: string
467+
clientCert:
468+
type: string
469+
clientKey:
470+
type: string
471+
secret:
472+
properties:
473+
name:
474+
type: string
475+
namespace:
476+
type: string
477+
required:
478+
- name
479+
- namespace
480+
type: object
481+
skipVerify:
482+
type: boolean
483+
type: object
438484
url:
439485
type: string
440486
required:
@@ -450,11 +496,34 @@ spec:
450496
type: object
451497
insecureSkipVerify:
452498
type: boolean
499+
proxy:
500+
type: string
453501
timeout:
454502
description: |-
455503
Timeout is the time to wait for a server's response. Its a duration e.g 15s, 2h30m.
456504
Missing value or empty string or means no timeout.
457505
type: string
506+
tls:
507+
properties:
508+
cacert:
509+
type: string
510+
clientCert:
511+
type: string
512+
clientKey:
513+
type: string
514+
secret:
515+
properties:
516+
name:
517+
type: string
518+
namespace:
519+
type: string
520+
required:
521+
- name
522+
- namespace
523+
type: object
524+
skipVerify:
525+
type: boolean
526+
type: object
458527
url:
459528
type: string
460529
required:
@@ -17054,11 +17123,34 @@ spec:
1705417123
type: object
1705517124
insecureSkipVerify:
1705617125
type: boolean
17126+
proxy:
17127+
type: string
1705717128
timeout:
1705817129
description: |-
1705917130
Timeout is the time to wait for a server's response. Its a duration e.g 15s, 2h30m.
1706017131
Missing value or empty string or means no timeout.
1706117132
type: string
17133+
tls:
17134+
properties:
17135+
cacert:
17136+
type: string
17137+
clientCert:
17138+
type: string
17139+
clientKey:
17140+
type: string
17141+
secret:
17142+
properties:
17143+
name:
17144+
type: string
17145+
namespace:
17146+
type: string
17147+
required:
17148+
- name
17149+
- namespace
17150+
type: object
17151+
skipVerify:
17152+
type: boolean
17153+
type: object
1706217154
url:
1706317155
type: string
1706417156
required:
@@ -17074,11 +17166,34 @@ spec:
1707417166
type: object
1707517167
insecureSkipVerify:
1707617168
type: boolean
17169+
proxy:
17170+
type: string
1707717171
timeout:
1707817172
description: |-
1707917173
Timeout is the time to wait for a server's response. Its a duration e.g 15s, 2h30m.
1708017174
Missing value or empty string or means no timeout.
1708117175
type: string
17176+
tls:
17177+
properties:
17178+
cacert:
17179+
type: string
17180+
clientCert:
17181+
type: string
17182+
clientKey:
17183+
type: string
17184+
secret:
17185+
properties:
17186+
name:
17187+
type: string
17188+
namespace:
17189+
type: string
17190+
required:
17191+
- name
17192+
- namespace
17193+
type: object
17194+
skipVerify:
17195+
type: boolean
17196+
type: object
1708217197
url:
1708317198
type: string
1708417199
required:
@@ -17094,11 +17209,34 @@ spec:
1709417209
type: object
1709517210
insecureSkipVerify:
1709617211
type: boolean
17212+
proxy:
17213+
type: string
1709717214
timeout:
1709817215
description: |-
1709917216
Timeout is the time to wait for a server's response. Its a duration e.g 15s, 2h30m.
1710017217
Missing value or empty string or means no timeout.
1710117218
type: string
17219+
tls:
17220+
properties:
17221+
cacert:
17222+
type: string
17223+
clientCert:
17224+
type: string
17225+
clientKey:
17226+
type: string
17227+
secret:
17228+
properties:
17229+
name:
17230+
type: string
17231+
namespace:
17232+
type: string
17233+
required:
17234+
- name
17235+
- namespace
17236+
type: object
17237+
skipVerify:
17238+
type: boolean
17239+
type: object
1710217240
url:
1710317241
type: string
1710417242
required:

config/crds/troubleshoot.sh_hostcollectors.yaml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1400,11 +1400,34 @@ spec:
14001400
type: object
14011401
insecureSkipVerify:
14021402
type: boolean
1403+
proxy:
1404+
type: string
14031405
timeout:
14041406
description: |-
14051407
Timeout is the time to wait for a server's response. Its a duration e.g 15s, 2h30m.
14061408
Missing value or empty string or means no timeout.
14071409
type: string
1410+
tls:
1411+
properties:
1412+
cacert:
1413+
type: string
1414+
clientCert:
1415+
type: string
1416+
clientKey:
1417+
type: string
1418+
secret:
1419+
properties:
1420+
name:
1421+
type: string
1422+
namespace:
1423+
type: string
1424+
required:
1425+
- name
1426+
- namespace
1427+
type: object
1428+
skipVerify:
1429+
type: boolean
1430+
type: object
14081431
url:
14091432
type: string
14101433
required:
@@ -1420,11 +1443,34 @@ spec:
14201443
type: object
14211444
insecureSkipVerify:
14221445
type: boolean
1446+
proxy:
1447+
type: string
14231448
timeout:
14241449
description: |-
14251450
Timeout is the time to wait for a server's response. Its a duration e.g 15s, 2h30m.
14261451
Missing value or empty string or means no timeout.
14271452
type: string
1453+
tls:
1454+
properties:
1455+
cacert:
1456+
type: string
1457+
clientCert:
1458+
type: string
1459+
clientKey:
1460+
type: string
1461+
secret:
1462+
properties:
1463+
name:
1464+
type: string
1465+
namespace:
1466+
type: string
1467+
required:
1468+
- name
1469+
- namespace
1470+
type: object
1471+
skipVerify:
1472+
type: boolean
1473+
type: object
14281474
url:
14291475
type: string
14301476
required:
@@ -1440,11 +1486,34 @@ spec:
14401486
type: object
14411487
insecureSkipVerify:
14421488
type: boolean
1489+
proxy:
1490+
type: string
14431491
timeout:
14441492
description: |-
14451493
Timeout is the time to wait for a server's response. Its a duration e.g 15s, 2h30m.
14461494
Missing value or empty string or means no timeout.
14471495
type: string
1496+
tls:
1497+
properties:
1498+
cacert:
1499+
type: string
1500+
clientCert:
1501+
type: string
1502+
clientKey:
1503+
type: string
1504+
secret:
1505+
properties:
1506+
name:
1507+
type: string
1508+
namespace:
1509+
type: string
1510+
required:
1511+
- name
1512+
- namespace
1513+
type: object
1514+
skipVerify:
1515+
type: boolean
1516+
type: object
14481517
url:
14491518
type: string
14501519
required:

0 commit comments

Comments
 (0)