-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
310 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
*.env | ||
*.kube-config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
name: docker | ||
|
||
on: | ||
push: | ||
tags: | ||
- "*" | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: datadog/kubehound | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
docker-build-push: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
# https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs | ||
matrix: | ||
include: | ||
- dockerfile: ./Dockerfile | ||
component: core | ||
- dockerfile: deployments/kubehound/janusgraph/Dockerfile | ||
image: janusgraph | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- name: Harden Runner | ||
uses: step-security/harden-runner@128a63446a954579617e875aaab7d2978154e969 | ||
with: | ||
egress-policy: block | ||
allowed-endpoints: > | ||
auth.docker.io:443 | ||
dl-cdn.alpinelinux.org:443 | ||
ghcr.io:443 | ||
github.com:443 | ||
pipelines.actions.githubusercontent.com:443 | ||
pkg-containers.githubusercontent.com:443 | ||
production.cloudflare.docker.com:443 | ||
proxy.golang.org:443 | ||
registry-1.docker.io:443 | ||
storage.googleapis.com:443 | ||
- name: Checkout | ||
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Log into registry ${{ env.REGISTRY }} | ||
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 | ||
with: | ||
context: . | ||
file: ${{ matrix.dockerfile }} | ||
push: true | ||
build-args: | | ||
VERSION=${{ github.ref_name }} | ||
tags: | | ||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-${{ matrix.image }}:${{ github.ref_name }} | ||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-${{ matrix.image }}:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,3 +39,4 @@ test/setup/.kube | |
# binary for the autogen of fixtures | ||
test/system/generator/generator | ||
*.env | ||
*.kube-config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
FROM golang:1.20-alpine AS build | ||
|
||
RUN apk update && \ | ||
apk add make && \ | ||
rm -rf /var/cache/apt/* && \ | ||
go install github.com/vektra/mockery/v2@v2.30.1 | ||
|
||
WORKDIR /app | ||
|
||
COPY go.mod go.sum ./ | ||
RUN go mod download | ||
|
||
COPY Makefile ./ | ||
COPY cmd ./cmd/ | ||
COPY pkg ./pkg/ | ||
|
||
RUN make build BUILD_VERSION=${VERSION} | ||
|
||
FROM scratch | ||
LABEL org.opencontainers.image.source="https://github.com/DataDog/kubehound/" | ||
|
||
WORKDIR / | ||
COPY --from=build /app/bin/kubehound /kubehound | ||
COPY deployments/kubehound/kubehound.yaml /etc/kubehound.yaml | ||
|
||
ENTRYPOINT [ "/kubehound" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
DD_API_KEY= | ||
DD_SITE=api.datadoghq.com | ||
KUBEHOUND_ENV=prod | ||
BUILDKIT_PROGRESS=auto # (default) auto, plain, tty |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
version: "3.8" | ||
|
||
services: | ||
datadog: | ||
image: gcr.io/datadoghq/agent:7 | ||
restart: unless-stopped | ||
container_name: datadog-agent | ||
ports: | ||
- "127.0.0.1:8125:8125" | ||
environment: | ||
- DD_API_KEY="${DD_API_KEY:?error}" | ||
- DD_SITE=datadoghq.com | ||
networks: | ||
- kubenet | ||
|
||
networks: | ||
kubenet: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
version: "3.8" | ||
name: kubehound-dev | ||
services: | ||
mongodb: | ||
volumes: | ||
- mongodb_data:/data/db | ||
|
||
janusgraph: | ||
volumes: | ||
- janusgraph_data:/data | ||
|
||
mongo-express: | ||
image: mongo-express:0.54.0 | ||
restart: unless-stopped | ||
depends_on: | ||
- mongodb | ||
ports: | ||
- "127.0.0.1:8081:8081" | ||
environment: | ||
ME_CONFIG_MONGODB_URL: mongodb://mongodb:27017/ | ||
|
||
kubehound: | ||
container_name: ${COMPOSE_PROJECT_NAME}-core | ||
restart: unless-stopped | ||
build: | ||
context: ../../ | ||
dockerfile: Dockerfile | ||
environment: | ||
- KUBECONFIG=/tmp/.kube/config | ||
volumes: | ||
- ./.kube-config:/tmp/.kube/config | ||
networks: | ||
- kubenet | ||
- kind | ||
|
||
volumes: | ||
mongodb_data: | ||
janusgraph_data: | ||
|
||
networks: | ||
kind: | ||
external: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
version: "3.8" | ||
name: kubehound-prod | ||
services: | ||
mongodb: | ||
volumes: | ||
- mongodb_data:/data/db | ||
|
||
janusgraph: | ||
image: ghcr.io/datadog/kubehound/kubehound-janusgraph:latest | ||
volumes: | ||
- janusgraph_data:/data | ||
|
||
kubehound: | ||
container_name: ${COMPOSE_PROJECT_NAME}-core | ||
restart: unless-stopped | ||
image: ghcr.io/datadog/kubehound/kubehound-core:latest | ||
environment: | ||
- KUBECONFIG=/tmp/.kube/config | ||
volumes: | ||
- ./.kube-config:/tmp/.kube/config | ||
networks: | ||
- kubenet | ||
|
||
volumes: | ||
mongodb_data: | ||
janusgraph_data: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
version: "3.7" | ||
name: kubehound-testing | ||
services: | ||
mongodb: | ||
image: mongo:6.0.6 | ||
restart: unless-stopped | ||
container_name: ${COMPOSE_PROJECT_NAME}-storedb | ||
ports: | ||
- "127.0.0.1:27017:27017" | ||
networks: | ||
- kubenet | ||
depends_on: | ||
janusgraph: | ||
condition: service_healthy | ||
|
||
janusgraph: | ||
build: ./janusgraph/ | ||
restart: unless-stopped | ||
container_name: ${COMPOSE_PROJECT_NAME}-graphdb | ||
ports: | ||
- "127.0.0.1:8182:8182" | ||
networks: | ||
- kubenet | ||
environment: | ||
# Enforce strict schema constrains as per https://docs.janusgraph.org/configs/configuration-reference/#schema | ||
- janusgraph.schema.constraints=true | ||
- janusgraph.schema.default=none | ||
healthcheck: | ||
test: ["CMD", "/opt/janusgraph/bin/gremlin.sh", "-e", "/opt/janusgraph/scripts/health-check.groovy"] | ||
interval: 60s | ||
timeout: 30s | ||
retries: 1 | ||
start_period: 15s | ||
|
||
networks: | ||
kubenet: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
storage: | ||
retry_delay: 10s | ||
retry: 5 | ||
collector: | ||
type: live-k8s-api-collector | ||
live: | ||
page_size: 500 | ||
page_buffer_size: 10 | ||
rate_limit_per_second: 100 | ||
mongodb: | ||
url: "mongodb://mongodb:27017" | ||
connection_timeout: 5s | ||
janusgraph: | ||
url: "ws://janusgraph:8182/gremlin" | ||
connection_timeout: 5s | ||
telemetry: | ||
statsd: | ||
url: "datadog:8125" |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
CLUSTER_NAME=kubehound.test.local | ||
CONFIG_DIR=./test-cluster | ||
KUBECONFIG=./test/setup/.kube/config | ||
KIND_KUBECONFIG=./.kube-config | ||
KIND_KUBECONFIG_INTERNAL=./../../deployments/kubehound/.kube-config | ||
DOCKER_CMD=docker |
Oops, something went wrong.