Skip to content

Commit 73a8380

Browse files
authored
(chore): Admission controller for pod validation (#27)
* (chore): Admission controller for pod validation Signed-off-by: Shubham Chaudhary <[email protected]> * add the self managed certs Signed-off-by: Shubham Chaudhary <[email protected]> --------- Signed-off-by: Shubham Chaudhary <[email protected]>
1 parent d77485f commit 73a8380

File tree

1,966 files changed

+2291
-760509
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,966 files changed

+2291
-760509
lines changed

.circleci/config.yml

Lines changed: 0 additions & 142 deletions
This file was deleted.

.github/workflows/build.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: build-pipeline
2+
on:
3+
pull_request:
4+
branches: [master]
5+
types: [opened, synchronize, reopened]
6+
7+
jobs:
8+
pre-checks:
9+
runs-on: ubuntu-latest
10+
steps:
11+
# Install golang
12+
- uses: actions/setup-go@v2
13+
with:
14+
go-version: 1.20.0
15+
16+
# Checkout to the latest commit
17+
# On specific directory/path
18+
- name: Checkout
19+
uses: actions/checkout@v2
20+
21+
- name: gofmt check
22+
run: make gofmt-check
23+
24+
- name: golangci-lint
25+
uses: reviewdog/action-golangci-lint@v2
26+
27+
- name: unused-package check
28+
run: make unused-package-check
29+
30+
trivy:
31+
needs: pre-checks
32+
runs-on: ubuntu-latest
33+
steps:
34+
- uses: actions/checkout@v2
35+
with:
36+
ref: ${{ github.event.pull_request.head.sha }}
37+
38+
- name: Build an image from Dockerfile
39+
run: |
40+
docker build -f build/Dockerfile -t docker.io/litmuschaos/admission-controller:${{ github.sha }} . --build-arg TARGETPLATFORM=linux/amd64
41+
42+
- name: Run Trivy vulnerability scanner
43+
uses: aquasecurity/trivy-action@master
44+
with:
45+
image-ref: 'docker.io/litmuschaos/admission-controller:${{ github.sha }}'
46+
format: 'table'
47+
exit-code: '1'
48+
ignore-unfixed: true
49+
vuln-type: 'os,library'
50+
severity: 'CRITICAL,HIGH'
51+
52+
gitleaks-scan:
53+
runs-on: ubuntu-latest
54+
steps:
55+
- uses: actions/checkout@v3
56+
with:
57+
fetch-depth: 0
58+
- name: Run GitLeaks
59+
run: |
60+
wget https://github.com/gitleaks/gitleaks/releases/download/v8.18.2/gitleaks_8.18.2_linux_x64.tar.gz && \
61+
tar -zxvf gitleaks_8.18.2_linux_x64.tar.gz && \
62+
sudo mv gitleaks /usr/local/bin && gitleaks detect --source . -v
63+
64+
image-build:
65+
runs-on: ubuntu-latest
66+
needs: pre-checks
67+
steps:
68+
# Checkout to the latest commit
69+
# On specific directory/path
70+
- name: Checkout
71+
uses: actions/checkout@v2
72+
73+
- name: Build Docker Image
74+
env:
75+
DOCKER_REPO: litmuschaos
76+
DOCKER_IMAGE: admission-controller
77+
DOCKER_TAG: ci
78+
run: |
79+
make build-amd64

.github/workflows/push.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: push-pipeline
2+
on:
3+
push:
4+
branches:
5+
- master
6+
tags-ignore:
7+
- '**'
8+
9+
jobs:
10+
pre-checks:
11+
runs-on: ubuntu-latest
12+
steps:
13+
# Install golang
14+
- uses: actions/setup-go@v2
15+
with:
16+
go-version: 1.20.0
17+
18+
# Checkout to the latest commit
19+
# On specific directory/path
20+
- name: Checkout
21+
uses: actions/checkout@v2
22+
23+
- name: gofmt check
24+
run: make gofmt-check
25+
26+
- name: golangci-lint
27+
uses: reviewdog/action-golangci-lint@v2
28+
29+
- name: unused-package check
30+
run: make unused-package-check
31+
32+
image-build:
33+
runs-on: ubuntu-latest
34+
needs: pre-checks
35+
steps:
36+
# Checkout to the latest commit
37+
# On specific directory/path
38+
- name: Checkout
39+
uses: actions/checkout@v2
40+
41+
- name: Set up QEMU
42+
uses: docker/setup-qemu-action@v1
43+
with:
44+
platforms: all
45+
46+
- name: Set up Docker Buildx
47+
id: buildx
48+
uses: docker/setup-buildx-action@v1
49+
with:
50+
version: latest
51+
52+
- name: login to GitHub Container Registry
53+
run: echo ${{ secrets.DPASS }} | docker login -u ${{ secrets.DNAME }} --password-stdin
54+
55+
- name: Build & Push Docker Image
56+
env:
57+
DOCKER_REPO: ${{ secrets.DOCKER_REPO }}
58+
DOCKER_IMAGE: ${{ secrets.DOCKER_IMAGE }}
59+
DOCKER_TAG: ci
60+
DNAME: ${{ secrets.DNAME }}
61+
DPASS: ${{ secrets.DPASS }}
62+
run: make push-admission-controller

.github/workflows/release.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: release-pipeline
2+
on:
3+
create:
4+
tags:
5+
- '**'
6+
7+
jobs:
8+
pre-checks:
9+
runs-on: ubuntu-latest
10+
steps:
11+
# Install golang
12+
- uses: actions/setup-go@v2
13+
with:
14+
go-version: 1.20.0
15+
16+
# Checkout to the latest commit
17+
# On specific directory/path
18+
- name: Checkout
19+
uses: actions/checkout@v2
20+
21+
- name: gofmt check
22+
run: make gofmt-check
23+
24+
- name: golangci-lint
25+
uses: reviewdog/action-golangci-lint@v2
26+
27+
- name: unused-package check
28+
run: make unused-package-check
29+
30+
image-build:
31+
runs-on: ubuntu-latest
32+
needs: pre-checks
33+
steps:
34+
# Checkout to the latest commit
35+
# On specific directory/path
36+
- name: Checkout
37+
uses: actions/checkout@v2
38+
39+
- name: Set up QEMU
40+
uses: docker/setup-qemu-action@v1
41+
with:
42+
platforms: all
43+
44+
- name: Set up Docker Buildx
45+
id: buildx
46+
uses: docker/setup-buildx-action@v1
47+
with:
48+
version: latest
49+
50+
- name: login to GitHub Container Registry
51+
run: echo ${{ secrets.DPASS }} | docker login -u ${{ secrets.DNAME }} --password-stdin
52+
53+
- name: Set Tag
54+
run: |
55+
TAG="${GITHUB_REF#refs/*/}"
56+
echo "TAG=${TAG}" >> $GITHUB_ENV
57+
echo "RELEASE_TAG=${TAG}" >> $GITHUB_ENV
58+
59+
- name: Build & Push Docker Image with version tag
60+
env:
61+
DOCKER_REPO: ${{ secrets.DOCKER_REPO }}
62+
DOCKER_IMAGE: ${{ secrets.DOCKER_IMAGE }}
63+
DOCKER_TAG: ${RELEASE_TAG}
64+
DNAME: ${{ secrets.DNAME }}
65+
DPASS: ${{ secrets.DPASS }}
66+
run: make push-admission-controller
67+
68+
- name: Build & Push Docker Image with latest
69+
env:
70+
DOCKER_REPO: ${{ secrets.DOCKER_REPO }}
71+
DOCKER_IMAGE: ${{ secrets.DOCKER_IMAGE }}
72+
DOCKER_TAG: latest
73+
DNAME: ${{ secrets.DNAME }}
74+
DPASS: ${{ secrets.DPASS }}
75+
run: make push-admission-controller

.gitignore

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1-
/bin/
2-
/.idea/
1+
build/_output
2+
*.swp
3+
*.orig
34
coverage.txt
5+
6+
*.vscode/
7+
*.idea/

0 commit comments

Comments
 (0)