Skip to content

Commit

Permalink
feat(docker): create docker provider (#462)
Browse files Browse the repository at this point in the history
* feat(docker): Add config for Docker provider

* feat(docker): Add Docker client constructor

* feat(docker): Implement Discoverer interface for Docker provider

* feat(docker): connect the new docker provider to the rest of the code

* feat(docker): Refactor discover targets

* feat(docker): add container and image support to target table

* feat(docker): Create volume with the target container's filesystem

* feat(docker): Create volume with the target image's filesystem

* feat(docker): remove scanconfig.yaml file

* feat(docker): implement getScanConfigFileName function

* feat(docker): start scanner container part 1

* feat(docker): set vmclarity rest backend address to host.docker.internal

* feat(docker): Fix docker client constructor

* feat(docker): Fix flag in scan container script

* fix(docker): scanner cli config marshalling

* feat(docker): Skip volume mount if volume already mounted

* feat(docker): Check if config file and scan container are already created before creation

* feat(docker): Clean up and code review changes

* feat: improve concurrency model for docker asset discovery

Signed-off-by: Ramiz Polic <ramiz.polic@hotmail.com>

* feat: standardize docker asset discovery

Signed-off-by: Ramiz Polic <ramiz.polic@hotmail.com>

* feat(docker): Create new bridge network to run scan container

* feat(docker): Code review changes

* feat(docker): Code review changes

* refactor(docker): break down entrypoint script, add comment to docker image pull

* Fix asset type switch case

* feat(docker): Add volume mount point as input in family configuration

* refactor(docker): remove docker config

* feat(docker): Clean up and remove container location

* feat(docker): Fix verification errors

* feat: simplify docker provider flow

Signed-off-by: Ramiz Polic <ramiz.polic@hotmail.com>

* feat(docker): Code review changes

* feat(docker): Fix CI verification

* feat(docker): network changes for scanner container

* feat(docker): fix create volume success return

* feat(docker): change yaml package to fix families config marshalling

* refactor(docker): parse constants with viper

* refactor(docker): move default values to constants

* fix(docker): format with gofumpt

---------

Signed-off-by: Ramiz Polic <ramiz.polic@hotmail.com>
Co-authored-by: Catarina Paralta <anacatarinaparalta@gmail.com>
Co-authored-by: Ramiz Polic <ramiz.polic@hotmail.com>
Co-authored-by: Catarina Paralta <46568597+paralta@users.noreply.github.com>
  • Loading branch information
4 people committed Jul 27, 2023
1 parent 05939b6 commit bd41dbd
Show file tree
Hide file tree
Showing 19 changed files with 1,108 additions and 219 deletions.
82 changes: 82 additions & 0 deletions api/models/models.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 51 additions & 0 deletions api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -917,6 +917,7 @@ components:
- AWS
- Azure
- GCP
- Docker
- External

Scans:
Expand Down Expand Up @@ -1509,12 +1510,16 @@ components:
- $ref: '#/components/schemas/VMInfo'
- $ref: '#/components/schemas/PodInfo'
- $ref: '#/components/schemas/DirInfo'
- $ref: '#/components/schemas/ContainerImageInfo'
- $ref: '#/components/schemas/ContainerInfo'
discriminator:
propertyName: objectType
mapping:
VMInfo: '#/components/schemas/VMInfo'
PodInfo: '#/components/schemas/PodInfo'
DirInfo: '#/components/schemas/DirInfo'
ContainerImageInfo: '#/components/schemas/ContainerImageInfo'
ContainerInfo: '#/components/schemas/ContainerInfo'

VMInfo:
type: object
Expand Down Expand Up @@ -1567,6 +1572,52 @@ components:
required:
- objectType

ContainerInfo:
type: object
properties:
objectType:
type: string
containerName:
type: string
# TODO(paralta) Check if image needs to be a required property
image:
$ref: '#/components/schemas/ContainerImageInfo'
id:
type: string
createdAt:
type: string
format: date-time
labels:
type: array
items:
$ref: '#/components/schemas/Tag'
nullable: true
required:
- objectType

ContainerImageInfo:
type: object
properties:
objectType:
type: string
id:
type: string
name:
type: string
labels:
type: array
items:
$ref: '#/components/schemas/Tag'
nullable: true
architecture:
type: string
os:
type: string
size:
type: integer
required:
- objectType

DirInfo:
type: object
properties:
Expand Down
Loading

0 comments on commit bd41dbd

Please sign in to comment.