Skip to content

Commit 91ede0c

Browse files
wip: tested the almost everything - its working
Signed-off-by: Rahul Vishwakarma <[email protected]>
1 parent f040b61 commit 91ede0c

File tree

6 files changed

+42
-42
lines changed

6 files changed

+42
-42
lines changed

docs/trivy-manifest/deployment.yml

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,30 @@
1-
apiVersion: apps/v1
2-
kind: Deployment
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: trivy-server
5+
labels:
6+
app: trivy-server
7+
spec:
8+
replicas: 1 # You can adjust the number of replicas for high availability
9+
selector:
10+
matchLabels:
11+
app: trivy-server
12+
template:
313
metadata:
4-
name: trivy-server
514
labels:
615
app: trivy-server
716
spec:
8-
replicas: 1 # You can adjust the number of replicas for high availability
9-
selector:
10-
matchLabels:
11-
app: trivy-server
12-
template:
13-
metadata:
14-
labels:
15-
app: trivy-server
16-
spec:
17-
containers:
18-
- name: trivy-server
19-
image: aquasec/trivy:latest # Use a specific version instead of latest in production
20-
args: ["server", "--listen", "0.0.0.0:8080"] # Listen on all interfaces
21-
ports:
17+
containers:
18+
- name: trivy-server
19+
image: aquasec/trivy:latest # Use a specific version instead of latest in production
20+
args: ["server", "--listen", "0.0.0.0:8080"] # Listen on all interfaces
21+
ports:
2222
- containerPort: 8080
2323
name: http
24-
# Optional: Add resource limits and requests for better resource management
25-
# resources:
26-
# limits:
27-
# cpu: "500m"
28-
# memory: "512Mi"
29-
# requests:
30-
# cpu: "250m"
31-
# memory: "256Mi"
24+
# volumeMounts:
25+
# - name: trivy-cache
26+
# mountPath: /root/.cache/trivy
27+
# volumes:
28+
# - name: trivy-cache
29+
# persistentVolumeClaim:
30+
# claimName: trivy-cache-pvc

docs/trivy-manifest/pvc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ kind: PersistentVolumeClaim
33
metadata:
44
name: trivy-cache-pvc
55
spec:
6+
storageClassName: standard
67
accessModes:
78
- ReadWriteOnce
89
resources:

docs/trivy-manifest/service.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
apiVersion: v1
2-
kind: Service
3-
metadata:
4-
name: trivy-server-service
5-
labels:
6-
app: trivy-server
7-
spec:
8-
selector:
9-
app: trivy-server
10-
ports:
11-
- protocol: TCP
12-
port: 8080
13-
targetPort: 8080
14-
type: ClusterIP # Use ClusterIP for internal access, or NodePort/LoadBalancer for external access
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: trivy-server-service
5+
labels:
6+
app: trivy-server
7+
spec:
8+
selector:
9+
app: trivy-server
10+
ports:
11+
- protocol: TCP
12+
port: 8080
13+
targetPort: 8080
14+
type: ClusterIP # Use ClusterIP for internal access, or NodePort/LoadBalancer for external access

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ func main() {
138138
go func() {
139139
http.HandleFunc("/validate", ValidateDeployment)
140140
log.Println("Starting webhook server on :8000...")
141-
err := http.ListenAndServeTLS(":8000", "/certs/tls.crt", "/certs/tls.key", nil)
141+
err := http.ListenAndServeTLS(":8000", "certs/tls.crt", "certs/tls.key", nil)
142142
if err != nil {
143143
log.Fatalf("Failed to start webhook server: %v", err)
144144
}

manifest/deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ spec:
1414
spec:
1515
containers:
1616
- name: k8s-controller
17-
image: manzilrahul/k8s-custom-controller:1.0.9
17+
image: manzilrahul/k8s-custom-controller:latest
1818
volumeMounts:
1919
- name: webhook-certs
2020
mountPath: /certs # Your code expects "certs/tls.crt"

manifest/webhook-example/initContainerDeployment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ spec:
1919
command: ["sh", "-c", "echo Init container with CVEs"]
2020
containers:
2121
- name: main-vulnerable
22-
image: nginx:1.19 # Main container with CVEs
22+
image: cgr.dev/chainguard/nginx:latest # Main container with CVEs
2323
ports:
2424
- containerPort: 80

0 commit comments

Comments
 (0)