47 Commits

Author SHA1 Message Date
jdesouza
a5af7bb34e INS-1950: Go 1.26 and bump libs for polaris (#1172)
* Go 1.26

* Go 1.26

* Go 1.26

* Go 1.26
2026-02-24 12:22:14 -03:00
jdesouza
2b17c31957 INS-1251: Polaris: upgrade github.com/qri-io/jsonschema to v0.2.1 (#1135)
* Bump lins

* Code refactoring

* Fixign issues

* Fixing issues

* Fixing issues

* Fixing issues

* [WIP]

* [WIP]

* [WIP]

* Trying to fix tests

* Trying to fix tests

* Fixing issues

* Fixing issues

* Fixing issues

* Fixing issues

* Fixing issues

* Fixing issues

* Revert go mod

* Revert go mod

* Revert go mod

* Revert go mod

* Fixing issues

* Fixing issue

* Code refactoring

* Updating json schema version

* Updating json schema version
2025-07-24 13:46:37 -03:00
jdesouza
8d5247e501 INSIGHTS-358 Bump polaris libs (#1068)
* Bumped libs

* Bumped libs

* Fixed issues

* Fixed issues

* Fixed issues

* Fixed issues

* Fixed issues

* Fixed issues

* Fixed issues

* Fixing issue

* Fixing issue

* Fixing issue

* Fixing issue

* Fixing issue

* Fixing issue

* Fixing issue

* Fixing issue

* Fixing issue

* Fixing issue

* Fixing issue

* Fixing issue

* Fixing issue

* Fixing issue

* Fixing issue

* Fixing issue

* Fixing issue

* Fixing issue

* Fixing issue

* Fixing issue

* Fixing issue

* Fixing issue

* Fixing issues

* Fixing issues

* Fixing issues

* Fixing issues

* Trying to fix releaser

* Trying to fix releaser

* Trying to fix releaser

* Trying to fix releaser

* Trying to fix releaser

* Trying to fix releaser

* Trying to fix releaser

* Trying to fix releaser

* Trying to fix releaser

* Trying to fix releaser

* Trying to fix releaser

* Trying to fix releaser

* Trying to fix releaser

* Trying to fix releaser

* Trying to fix releaser

* Trying to fix releaser

* Trying to fix releaser

* Trying to fix releaser

* Trying to fix releaser

* Trying to fix releaser

* Trying to fix releaser

* Trying to fix releaser

* Trying to fix releaser

* Trying to fix

* Trying to fix

* Trying to fix

* Trying to fix

* Trying to fix

* Trying to fix

* Trying to fix
2024-09-18 17:07:50 -03:00
jdesouza
cb7c10d288 INSIGHTS-8 Polaris: Harden admission against rogue pods (#1064)
* INSIGHTS-8 Polaris: Harden admission against rogue pods

* INSIGHTS-8 Polaris: Harden admission against rogue pods

* INSIGHTS-8 Polaris: Harden admission against rogue pods

* Adding validation

* Adding validation

* Fixing owners
2024-09-09 11:00:06 -03:00
Robert Brennan
4ca4c8f0f5 Fix nil pointer issue with webhook (#966)
* update

* update go mod

* tidy

* revert go mod

* fix port

* move pod test case

* downgrade controller-runtime

* revert updates

* fix nil pointer

* add logs

* fix var

* remove test requirement

* fix decoder

* fix mutate

* fix test case

* fix logs

* fmt

* fix owned pods in mutate

* fix test

* add logs

* add mutations to tests

* convert to json for patch

* fix up tests

* remove nil check

* fix logs

* add logs

* add env vars to webhook tests
2023-06-22 13:22:19 -04:00
Barnabas Makonda
4d96993a18 [FWI-2357] Let Polaris modify YAML without losing comments/formatting (#821)
* added fix command implementation

* use node api

* fix tests

* added hostport mutate rule

* update mutating server

* fix array reference and add back leading slash

* added test and refactor findNodes

* more tests

* added more test and fix issue with arrays

* rename findNode function and ensure we capture exceptions

* rename findNode function

* append array value at the end and for single item remove brackets

* append array value at the end and for single item remove brackets

* create array if it does not exists

* fix tests

* handle some exceptions

* fix tests

* fix string format

* guard for PodResult

* fix flag name

* fix privilegeEscalation check

* fix up mutations for local files

* fix pod parsing

* fix object values

* remove logspam

* fix import

* update some comments for health probes

* add an option to not apply any mutations\, and just adjust yaml formatting

* add preliminary support for helm

* logspam

* change up comment strategy

* fix object comments

* format

* fix tests

* add comments

* fix key updates

* fix mutation tests

* tidy

* refactor test

* add test

* add test

* add test for object comments

Co-authored-by: Robert Brennan <accounts@rbren.io>
Co-authored-by: Robert Brennan <contact@rbren.io>
2022-09-15 12:38:22 -04:00
Barnabas Makonda
e896eec89f Expose GetValidateResults function to be used in the polaris package (#763)
* Expose GetValidateResults function to be used in the polaris package

* change to GetValidatedResults
2022-06-15 15:28:33 +03:00
Barnabas Makonda
6b7d6ab301 Added Mutation webhook (#755)
* added mutate webhook

* fix mutation operation type

* if no mutation just use valid response
2022-05-03 17:42:19 +03:00
Robert Brennan
8385fd10e5 fix webhook for top-level resources (#576)
* fix webhook for top-level resources

* delete unused code

* unused imports
2021-06-25 14:42:51 -04:00
Robert Brennan
f753fc91f2 Support multi-resource templates (#524)
* able to run multi-resource tests

* start passing resource provider through

* working end-to-end

* better support for go templating

* fix tests

* delint

* add test

* add json annotations

* remove panics

* fix annotation

* fix for groupkinds

* add comment

* add docs

* change jsonSchema field to schemaString

* rename check

* add pdb to tests

* add ingress to tests

* update deps

* fix up policy import

* update go

* fix check name

* funk it up

* better docs
2021-05-06 14:01:20 -04:00
Jordan Doig
63fd576d3e Add support for arbitrary Kinds (#505)
* Add basic flow

* Add arbitrary validator

* Pipe config through to resource provider

* Set arbitraries on resource provider

* Add arbitrary validation to fullaudit

* Add conf argument

* Fix resource setting from string

* PR updates

* Fix nil map error

* Delete lingering print, add pdb check, start implementing validator test

* move ingress to arbitrary

* fix compile

* refactor a bunch

* add tls tests

* tests passing

* resource provider helper

* refactor tests

* fix exemptions

* fix check test

* fix up resource creation from API

* fix init containers

* fix cronjob test

* fix pod tests

* combine controllers and-noncontrollers in resource provider

* delint

* add ingress backward compat

* fix tests

* reenable test

* rename a fn

* remove unused fn

* remove if

Co-authored-by: Robert Brennan <contact@rbren.io>
2021-03-26 08:29:59 -04:00
Jordan Doig
fc368485ef Add ingress schema checks 2020-12-30 21:58:48 -07:00
Jordan Doig
9d68ee2359 Merge remote-tracking branch 'origin/master' into jd/out-of-control 2020-12-28 12:40:23 -07:00
skatika
dd2976794a Implement namespace and container exemptions. Also refactoring according to gofmt 2020-12-18 09:50:04 -05:00
skatika
fdd30717e5 Remove unused parameter 2020-12-17 09:54:29 -05:00
jordandoig
717d9b2630 PodResult to pointer 2020-12-16 12:11:19 -07:00
baderbuddy
7c9f01639b Update dependencies (#400)
* Start working on updating dependencies:

* Fix webhook

* Rollback jsonschema update

* Checkin new config

* Fix run as root

* Update versions of kind

* Fix typo in kind URL

* Fix kind config

* Add csr permissions

* Fix weird image thing

* Fixed certificates

* Add to logging

* Approve cert manually

* Fix approval

* Add cert script

* Fix deployment

* Add requests/limits

* Wait if certificate doesn't exist yet

* Add check for file size

* Add variable

* Try a different imagE

* Fix command

* Update certificate logic

* Add healthz

* Don't check cert size

* Remove stat

* Fix vet

* Put in change that makes no sense

* Fix cert names

* Roll back

* Try changing config

* Add logging for each request

* Cleanup code some

* Remove bad deployments

* Fix client injection

* Update timeout

* Add logging

* Fixed e2e webhook tests

* Add permissions for approval

* Fix permissions for CSR

* Remove logging code

* Remove refresh certs file

* Fix merge issues

* Update deployments

* Try beta of admission controller config

* Target 1.15 for testing

* Add beta versions of resourceS

* Lower webhook timeout

* Refactor out a method

* Fix up PR issues

* Fix more tabs

* Remove unnecessary messageS

* Fix go.sum

* Fix go.sum
2020-09-11 08:53:14 -04:00
baderbuddy
bf6e41566d Don't assume all objects have pods. (#329)
* Don't assume all objects have pods.

* Test service is ignored

* Fix test

* Fix comment on test
2020-06-10 10:22:59 -04:00
Robert Brennan
2ac6a2b540 Change error to danger (#299)
* rename 'error' to 'danger'

* update dashboard

* fix docs

* update deploy configs
2020-05-19 08:41:07 -04:00
Robert Brennan
b557786325 Stop webhook from preventing scaling events (#293)
* test deployment scaling

* stop watching pods in the webhook

* fix check

* add pod check back

* skip webhook for owned pods
2020-05-18 15:17:21 -04:00
baderbuddy
d50d9c81f8 Add the capability for controller level checks (#285)
* Add controller level checks

* Add check for multipleReplicas

* Fixed spec

* Add controller level check

* Move controller schema checks to their own function.
2020-05-18 14:57:35 -04:00
baderbuddy
69621f7034 Improve performance (#278)
* rename root fs check

* speed up docker build

* refactor webhook to be more generic

* delete controllers pkg

* revert deploy

* fix example config

* remove controllersToScan config

* fix lint error

* fix webhook name

* FileSystem -> Filesystem

* update deps

* skip node owners

* clean up meta tracking

* Cache results of dynamic queries

* Dynamically pick types to list.

* Fix unit tests

* Fix the other tests I missed

* Fix container test

* Fix issues from PR feedback

Co-authored-by: Robert Brennan <bobby.brennan@gmail.com>
Co-authored-by: Robert Brennan <accounts@rbren.io>
2020-05-01 13:29:29 -04:00
Robert Brennan
6792fba91f Delete controllers package (#270)
* rename root fs check

* speed up docker build

* refactor webhook to be more generic

* delete controllers pkg

* revert deploy

* fix example config

* remove controllersToScan config

* fix lint error

* fix webhook name

* FileSystem -> Filesystem

* update deps

* skip node owners

* clean up meta tracking

Co-authored-by: Robert Brennan <bobby.brennan@gmail.com>
2020-04-27 10:43:02 -04:00
Bader Boland
a5828a2d3b Fix tests 2020-03-25 14:23:18 -04:00
Bader Boland
68fe23018a Feedback from PR 2020-03-23 09:27:36 -04:00
Bader Boland
bb34be7e02 Dynamically retrieve parents 2020-03-16 16:41:16 -04:00
Robert Brennan
efd0ec85b9 fix lint error 2020-02-25 21:27:53 +00:00
Robert Brennan
dad526245d don't exit if webhook registration fails 2020-02-25 21:23:31 +00:00
Robert Brennan
dfa34e1880 explicitly handle schema validation errors 2020-01-14 14:50:35 +00:00
Robert Brennan
23bf4c81b0 refactor ValidatePod, add NakedPod type 2020-01-14 14:50:34 +00:00
Robert Brennan
51cd3523fc messages -> results 2020-01-14 14:50:34 +00:00
Robert Brennan
9f7caabef4 change message type to boolean 2020-01-14 14:50:34 +00:00
Robert Brennan
2770be643f Refactor validation 2020-01-14 14:50:34 +00:00
Robert Brennan
d0dc7f4b0e simplify GetSupportedControllerFromString 2019-12-23 20:32:38 +00:00
Robert Brennan
22ab851681 skip health checks for jobs, cronjobs, and initContainers (#216) 2019-11-06 13:31:17 -05:00
Robert Brennan
2b15f11d57 Add exemptions to config (#204)
* first pass at adding exemptions

* Update config.yaml

* make config_test more reliable

* add flag to disallow exemptions in dashboard

* add disallow-exemptions flag to CLI

* add comments

* fix exemptions flag

* fix alert on dashboard

* minor style changes
2019-10-23 17:14:03 -04:00
Will Ledingham
467ab945cd Wl/webhook test (#182)
* Added testing for webhook using KIND

* fixed branching error

* added tests to CircleCI

* added tests to CircleCI

* attempt to stop failing circleci test

* moved location of testing for webhook in CircleCI

* debugging

* more debugging

* .

* .

* added download of webhook to test

* ..

* ...

* corrected sleep comand

* .

* .

* code working now, clean up

* testing smaller sleep times

* increased sleep time

* responded to comments on github

* .

* debug

* more edits

* debugging second test failing.

* debugging

* tests doing opposite of what they should be debugging.

* debugging

* .

* .

* fixing error in installation of webhook.

* .

* timeout increase

* trying to install webhook

* .

* .

* webhook still not i installing properly

* ..

* ..

* add log message

* ..

* changed order of test_k8s, removed set -e

* ..

* namespace polaris

* .

* .......

* intial testing for new strategy.

* intial testing for new strategy.

* .

* ...

* final edits, working now

* fixed files, cleaned up logs, added more detail to webhook starting documentation.

* ?

* added test files for other controller types, adding testing for them in webhook_test.sh

* increased sleep time

* testing

* finally added tests for jobs

* changed while loop condition to include webhook.

* .

* lskdfsjkl

* sd

* lskfjlskj

* .

* final

* added timeout test for dashboard to try to aleviate error

* .

* .

* install the dashboard

* ...

* initial test for new kube_dashboard_test

* initial test for new kube_dashboard_test

* ?

* deleting unused code

* final change for dashboard test

* final
2019-08-09 16:00:55 -04:00
Nick Huanca
75f70352ba Additional Pod Controller Scans (#166)
**Changes**

- Refactored the way controllers work to be an interface
- Added configurable controllers to include in scans
- Added daemonsets, jobs and cronjobs in scans
- Added `ReplicationController` type controllers to the supported list
- Adjusted logic for failed YAML parsing to bubble up errors
- Added better logic for calculating summaries on cluster wide results
- Relocated responsibilities for counting types into validators vs spreading it around more packages
- Fixed bug where cronjob parsing was using wrong KIND
- Added fixtures for mocking new controller types
- Added example yamls to test scanning files
- Added functions to NamespacedResult(s) to reduce code complexity deep set iterations
- Refactored how results get added to namespacedresults so adding more later is easier
- Minor signature changes for interface implementing structs for controllers
2019-07-31 15:56:27 -06:00
Bobby Brennan
20bd32afb6 Rename ReactiveOps to Fairwinds (#180)
* Rename ReactiveOps to Fairwinds

* Rename ReactiveOps to Fairwinds
2019-07-30 15:29:09 -04:00
Bobby Brennan
ebfb4ea9a1 Add support for stateful sets (#145) 2019-06-13 07:59:01 -06:00
Bobby Brennan
f061e0e012 Fix helm for webhook (#129)
* Log all validation attempts

* add app selector for helm deployments
2019-05-24 10:21:38 -04:00
Bobby Brennan
9bcb832bbd rename all the things 2019-05-09 15:59:23 +00:00
Bobby Brennan
1282359b04 create DeploymentResult type 2019-05-02 18:07:01 +00:00
Rob Scott
0db0e2947f some additional cleanup 2019-04-29 10:58:30 -04:00
Rob Scott
4fe39e7b74 improved logging, better webhook output, webhook deploy fixes 2019-04-26 17:35:14 -04:00
Bobby Brennan
55363fd7a8 Add categories to dashboard
add version, cluster stats to output

add comment

update UI

changes to summary aggregation

add category summaries to dash
2019-04-23 15:07:50 +00:00
Rob Scott
5d5f8c24b2 moving webhook logic into new webhook package, attempting to detect namespace fairwinds webhook is deployed in 2019-03-28 10:17:21 -04:00