Skip to content

query giving a failure where some field(s) might not exist #566

Closed Answered by arlimus
joelddiaz asked this question in Q&A
Discussion options

You must be logged in to vote

Great question! I'd like to reduce the amount of if statements as much as possible, because conditionals are a bit harder to process (and aggregate data for). This also implies we don't really need the else statements.

Here is an updated version of the query:

k8s.pod
   .podSpec['containers']
   .none( 
     _['securityContext']['capabilities']['add']
       .contains(_.upcase == 'ALL' || _.upcase == 'SYS_ADMIN')
    )

It depends on the newly merged handling for contains and roughly reads as:

  1. For the k8s pod ...
  2. ... in the podSpec for containers ...
  3. ... make sure you have no container ...
  4. ... whose securityContext capabilities ...
  5. ... contain all or sys_admin

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@joelddiaz
Comment options

Answer selected by joelddiaz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants