-
Notifications
You must be signed in to change notification settings - Fork 0
Add Kubernetes manifests #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
515b1d2
dbe5d07
2f11346
67d03f0
cd9b668
cefa0fc
dce5314
5f252d2
0432561
2104cb4
d505992
f565123
d1512bd
6b4a85f
e90cbb6
4e962f4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| apiVersion: apps/v1 | ||
| kind: Deployment | ||
| metadata: | ||
| name: api | ||
| spec: | ||
| replicas: 1 | ||
| template: | ||
| spec: | ||
| initContainers: | ||
| - name: migrations | ||
| image: learninglocker | ||
| args: [migrations] | ||
| envFrom: | ||
| - configMapRef: | ||
| name: learninglocker-config | ||
| - secretRef: | ||
| name: learninglocker-secret | ||
| env: | ||
| - name: MONGO_HOST | ||
| value: $(LEARNINGLOCKER_MONGO_SERVICE) | ||
|
|
||
| - name: seeds | ||
| image: learninglocker | ||
| args: [seeds] | ||
| envFrom: | ||
| - configMapRef: | ||
| name: learninglocker-config | ||
| - secretRef: | ||
| name: learninglocker-secret | ||
| env: | ||
| - name: MONGO_HOST | ||
| value: $(LEARNINGLOCKER_MONGO_SERVICE) | ||
|
|
||
| containers: | ||
| - name: api | ||
| image: learninglocker | ||
| args: [api] | ||
| envFrom: | ||
| - configMapRef: | ||
| name: learninglocker-config | ||
| - secretRef: | ||
| name: learninglocker-secret | ||
| env: | ||
| - name: PATH_PREFIX | ||
| value: "/api" | ||
| - name: REDIS_HOST | ||
| value: $(LEARNINGLOCKER_REDIS_SERVICE) | ||
| - name: MONGO_HOST | ||
| value: $(LEARNINGLOCKER_MONGO_SERVICE) | ||
| ports: | ||
| - containerPort: 8080 | ||
| protocol: TCP | ||
| livenessProbe: | ||
| httpGet: | ||
| path: /api/ | ||
| port: 8080 | ||
ralf-berger marked this conversation as resolved.
Show resolved
Hide resolved
Comment on lines
+34
to
+56
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Harden security, add resources and readiness probe. Baseline best practices. - name: api
image: learninglocker
args: [api]
+ securityContext:
+ runAsNonRoot: true
+ allowPrivilegeEscalation: false
+ readOnlyRootFilesystem: true
+ seccompProfile:
+ type: RuntimeDefault
+ capabilities:
+ drop: [ "ALL" ]
+ resources:
+ requests:
+ cpu: "100m"
+ memory: "256Mi"
+ limits:
+ cpu: "500m"
+ memory: "512Mi"
+ readinessProbe:
+ httpGet:
+ path: /api/
+ port: 8080
+ initialDelaySeconds: 5
+ periodSeconds: 10
+ failureThreshold: 3
+ automountServiceAccountToken: false
🧰 Tools🪛 Checkov (3.2.334)[MEDIUM] 1-56: Containers should not run with allowPrivilegeEscalation (CKV_K8S_20) [LOW] 1-56: CPU limits should be set (CKV_K8S_11) [LOW] 1-56: CPU requests should be set (CKV_K8S_10) [LOW] 1-56: Apply security context to your containers (CKV_K8S_30) [LOW] 1-56: The default namespace should not be used (CKV_K8S_21) [LOW] 1-56: Minimize the admission of containers with the NET_RAW capability (CKV_K8S_28) [LOW] 1-56: Image should use digest (CKV_K8S_43) [LOW] 1-56: Image Tag should be fixed - not latest or blank (CKV_K8S_14) [LOW] 1-56: Memory limits should be set (CKV_K8S_13) [LOW] 1-56: Memory requests should be set (CKV_K8S_12) [LOW] 1-56: Minimize the admission of containers with capabilities assigned (CKV_K8S_37) [LOW] 1-56: Apply security context to your pods and containers (CKV_K8S_29) [LOW] 1-56: Use read-only filesystem for containers where possible (CKV_K8S_22) [LOW] 1-56: Readiness Probe Should be Configured (CKV_K8S_9) [MEDIUM] 1-56: Minimize the admission of root containers (CKV_K8S_23) [LOW] 1-56: Containers should run as a high UID to avoid host conflict (CKV_K8S_40) [LOW] 1-56: Ensure that the seccomp profile is set to docker/default or runtime/default (CKV_K8S_31) [LOW] 1-56: Prefer using secrets as files over secrets as environment variables (CKV_K8S_35) [LOW] 1-56: Ensure that Service Account Tokens are only mounted where necessary (CKV_K8S_38) 🪛 YAMLlint (1.37.1)[error] 35-35: wrong indentation: expected 8 but found 6 (indentation) [error] 39-39: wrong indentation: expected 10 but found 8 (indentation) [error] 44-44: wrong indentation: expected 10 but found 8 (indentation) [error] 51-51: wrong indentation: expected 10 but found 8 (indentation) |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| apiVersion: kustomize.config.k8s.io/v1beta1 | ||
| kind: Kustomization | ||
|
|
||
| labels: | ||
| - pairs: | ||
| app.kubernetes.io/component: api | ||
| includeSelectors: true | ||
| includeTemplates: true | ||
ralf-berger marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| resources: | ||
| - deployment.yaml | ||
| - service.yaml | ||
ralf-berger marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| apiVersion: v1 | ||
| kind: Service | ||
| metadata: | ||
| name: api | ||
| spec: | ||
| ports: | ||
| - name: http | ||
| port: 80 | ||
| targetPort: 8080 | ||
ralf-berger marked this conversation as resolved.
Show resolved
Hide resolved
ralf-berger marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,38 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| apiVersion: networking.k8s.io/v1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| kind: Ingress | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| metadata: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: learninglocker | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| annotations: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| kubernetes.io/tls-acme: "true" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| cert-manager.io/cluster-issuer: letsencrypt-prod | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| traefik.ingress.kubernetes.io/redirect-entry-point: https | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+5
to
+8
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) Legacy annotations — confirm Traefik/cert-manager versions
If you’re on Traefik v2, I can propose the v2 router.entrypoints/router.tls annotations. 🤖 Prompt for AI Agents
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @coderabbitai I'm on Traefik v3.3, please provide updated annotation for recent versions of the Traefik Ingress controller. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @coderabbitai Please propose the v2 router.entrypoints/router.tls annotations. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ralf-berger Here are the updated Traefik v3.3 annotations for your ingress: apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: learninglocker
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
traefik.ingress.kubernetes.io/router.entrypoints: web,websecure
traefik.ingress.kubernetes.io/router.tls: "true"Changes made:
The |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| spec: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| rules: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - host: $(LEARNINGLOCKER_FQDN) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| http: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| paths: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - pathType: Prefix | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| path: /api | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| backend: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| service: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: api | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| port: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: http | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - pathType: Prefix | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| path: /data | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| backend: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| service: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: xapi-service | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| port: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: http | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - pathType: Prefix | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| path: / | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| backend: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| service: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: ui | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| port: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: http | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| tls: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - hosts: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - $(LEARNINGLOCKER_FQDN) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| secretName: learninglocker-tls-crt | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+9
to
+38
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Fix indentation; add ingressClassName; modernize Traefik/cert-manager usage Current YAML is mis-indented and uses legacy annotations. Suggested minimal fix (keeping your routes) and explicit class: spec:
- rules:
- - host: $(LEARNINGLOCKER_FQDN)
- http:
- paths:
- - pathType: Prefix
- path: /api
- backend:
- service:
- name: api
- port:
- name: http
- - pathType: Prefix
- path: /data
- backend:
- service:
- name: xapi-service
- port:
- name: http
- - pathType: Prefix
- path: /
- backend:
- service:
- name: ui
- port:
- name: http
- tls:
- - hosts:
- - $(LEARNINGLOCKER_FQDN)
- secretName: learninglocker-tls-crt
+ ingressClassName: traefik
+ rules:
+ - host: $(LEARNINGLOCKER_FQDN)
+ http:
+ paths:
+ - path: /api
+ pathType: Prefix
+ backend:
+ service:
+ name: api
+ port: { name: http }
+ - path: /data
+ pathType: Prefix
+ backend:
+ service:
+ name: xapi-service
+ port: { name: http }
+ - path: /
+ pathType: Prefix
+ backend:
+ service:
+ name: ui
+ port: { name: http }
+ tls:
+ - hosts: [$(LEARNINGLOCKER_FQDN)]
+ secretName: learninglocker-tls-crt📝 Committable suggestion
Suggested change
🧰 Tools🪛 Checkov (3.2.334)[LOW] 1-38: The default namespace should not be used (CKV_K8S_21) 🪛 YAMLlint (1.37.1)[error] 11-11: wrong indentation: expected 4 but found 2 (indentation) [error] 14-14: wrong indentation: expected 8 but found 6 (indentation) [error] 36-36: wrong indentation: expected 4 but found 2 (indentation) [error] 37-37: wrong indentation: expected 6 but found 4 (indentation) 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| apiVersion: kustomize.config.k8s.io/v1beta1 | ||
| kind: Kustomization | ||
|
|
||
| namePrefix: learninglocker- | ||
ralf-berger marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| labels: | ||
| - pairs: | ||
| app.kubernetes.io/name: learninglocker | ||
| includeSelectors: true | ||
| includeTemplates: true | ||
|
|
||
| resources: | ||
| - api | ||
| - mongo | ||
| - redis | ||
| - ui | ||
| - worker | ||
| - xapi-service | ||
| - ingress.yaml | ||
|
|
||
| configMapGenerator: | ||
| - name: learninglocker-ingress | ||
| literals: | ||
| - host=example.org | ||
|
|
||
| - name: learninglocker-config | ||
| literals: | ||
| - LOG_MIN_LEVEL=warning | ||
| - QUEUE_PROVIDER=REDIS | ||
| - MONGO_DATABASE=learninglocker_v2 | ||
| - UI_HOST=ui | ||
| - UI_PORT=3000 | ||
| - API_HOST=api | ||
| - API_PORT=8080 | ||
| # - SITE_URL=http://example.org | ||
| # - SMTP_HOST="" | ||
| # - SMTP_PORT="" | ||
| # - SMTP_SECURED="" | ||
| # - SMTP_USER="" | ||
|
|
||
| secretGenerator: | ||
| - name: learninglocker-secret | ||
| literals: [] | ||
| # - APP_SECRET="i-am-not-secure-please-change-me" | ||
| # - SMTP_PASS="" | ||
| # - LL_ADMIN_EMAIL="" | ||
| # - LL_ADMIN_ORG="" | ||
| # - LL_ADMIN_PASSWORD="" | ||
|
|
||
|
Comment on lines
+40
to
+48
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Don’t generate empty Secrets in base; move secrets to overlays or external secret management. Empty secretGenerator will create an unusable Secret and encourages env-var secrets. Prefer ExternalSecrets/SealedSecrets and mount as files. -secretGenerator:
- - name: learninglocker-secret
- literals: []
+## Move secret generation to environment-specific overlays (e.g., .k8s/overlays/prod).
+# secretGenerator:
+# - name: learninglocker-secret
+# literals: []
🧰 Tools🪛 Checkov (3.2.334)[LOW] 43-44: Base64 High Entropy String (CKV_SECRET_6) 🪛 YAMLlint (1.37.1)[error] 41-41: wrong indentation: expected 2 but found 0 (indentation) 🤖 Prompt for AI Agents |
||
| vars: | ||
| - name: LEARNINGLOCKER_FQDN | ||
| objref: | ||
| apiVersion: v1 | ||
| kind: ConfigMap | ||
| name: learninglocker-ingress | ||
| fieldref: | ||
| fieldpath: data.host | ||
|
|
||
| images: | ||
| - name: learninglocker | ||
| newName: ghcr.io/ude-soco/learninglocker | ||
| newTag: master | ||
| - name: redis | ||
| newTag: '7' | ||
| - name: mongo | ||
| newTag: '4.4' | ||
| - name: xapi-service | ||
|
Comment on lines
+58
to
+66
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Pin images by digest; avoid floating tags (master, 7, 4.4). Use digests to ensure reproducible deployments and mitigate supply-chain risk. - - name: learninglocker
- newName: ghcr.io/ude-soco/learninglocker
- newTag: master
+ - name: learninglocker
+ newName: ghcr.io/ude-soco/learninglocker@sha256:<digest>
- - name: redis
- newTag: '7'
+ - name: redis
+ newName: redis@sha256:<digest>
- - name: mongo
- newTag: '4.4'
+ - name: mongo
+ newName: mongo@sha256:<digest>
- - name: xapi-service
- newName: learninglocker/xapi-service
+ - name: xapi-service
+ newName: learninglocker/xapi-service@sha256:<digest>
🧰 Tools🪛 YAMLlint (1.37.1)[error] 59-59: wrong indentation: expected 2 but found 0 (indentation) |
||
| newName: learninglocker/xapi-service | ||
|
|
||
ralf-berger marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,36 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| apiVersion: apps/v1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| kind: Deployment | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| metadata: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: mongo | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| spec: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| replicas: 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| strategy: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| type: Recreate | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| template: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| spec: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| containers: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: mongo | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| image: mongo | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) Pin image version/digest Avoid floating tags; set explicit mongo version and digest via kustomize. 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| args: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - --bind_ip | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - "0.0.0.0" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - --wiredTigerCacheSizeGB | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - "0.25" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - --quiet | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ports: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - containerPort: 27017 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| protocol: TCP | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| volumeMounts: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - mountPath: /data/db | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: mongo | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| livenessProbe: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| exec: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| command: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - mongo | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - --disableImplicitSessions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - --eval | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - "db.adminCommand('ping')" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| volumes: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: mongo | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| persistentVolumeClaim: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| claimName: mongo | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+1
to
+36
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) Use StatefulSet for MongoDB (stable identity/storage) or tighten current Deployment Mongo benefits from stable network IDs and PV binding. Prefer StatefulSet with a Headless Service. If you want to keep Deployment for now, at minimum add selector/labels, security, resources, and probe timings as below. spec:
- replicas: 1
- strategy:
- type: Recreate
- template:
- spec:
- containers:
- - name: mongo
- image: mongo
+ replicas: 1
+ strategy: { type: Recreate }
+ selector:
+ matchLabels: { app: learninglocker, component: mongo }
+ template:
+ metadata:
+ labels: { app: learninglocker, component: mongo }
+ spec:
+ automountServiceAccountToken: false
+ securityContext: { runAsNonRoot: true, fsGroup: 999 }
+ containers:
+ - name: mongo
+ image: mongo
+ imagePullPolicy: IfNotPresent
+ securityContext:
+ allowPrivilegeEscalation: false
+ readOnlyRootFilesystem: false
+ capabilities: { drop: ["ALL"] }
+ resources:
+ requests: { cpu: "100m", memory: "512Mi" }
+ limits: { cpu: "1", memory: "2Gi" }
args:
- --bind_ip
- "0.0.0.0"
- --wiredTigerCacheSizeGB
- "0.25"
- --quiet
ports:
- containerPort: 27017
protocol: TCP
volumeMounts:
- mountPath: /data/db
name: mongo
livenessProbe:
- exec:
- command:
- - mongo
- - --disableImplicitSessions
- - --eval
- - "db.adminCommand('ping')"
+ tcpSocket: { port: 27017 }
+ initialDelaySeconds: 15
+ periodSeconds: 10
+ readinessProbe:
+ exec:
+ command: ["bash","-lc","mongosh --quiet --eval \"db.adminCommand('ping')\" || exit 1"]
+ initialDelaySeconds: 10
+ periodSeconds: 10
volumes:
- - name: mongo
- persistentVolumeClaim:
- claimName: mongo
+ - name: mongo
+ persistentVolumeClaim: { claimName: mongo }Please confirm your mongo image tag provides mongosh; if not, we’ll switch the readinessProbe to tcpSocket as well. 📝 Committable suggestion
Suggested change
🧰 Tools🪛 Checkov (3.2.334)[MEDIUM] 1-36: Containers should not run with allowPrivilegeEscalation (CKV_K8S_20) [LOW] 1-36: CPU limits should be set (CKV_K8S_11) [LOW] 1-36: CPU requests should be set (CKV_K8S_10) [LOW] 1-36: Apply security context to your containers (CKV_K8S_30) [LOW] 1-36: The default namespace should not be used (CKV_K8S_21) [LOW] 1-36: Minimize the admission of containers with the NET_RAW capability (CKV_K8S_28) [LOW] 1-36: Image should use digest (CKV_K8S_43) [LOW] 1-36: Image Tag should be fixed - not latest or blank (CKV_K8S_14) [LOW] 1-36: Memory limits should be set (CKV_K8S_13) [LOW] 1-36: Memory requests should be set (CKV_K8S_12) [LOW] 1-36: Minimize the admission of containers with capabilities assigned (CKV_K8S_37) [LOW] 1-36: Apply security context to your pods and containers (CKV_K8S_29) [LOW] 1-36: Use read-only filesystem for containers where possible (CKV_K8S_22) [LOW] 1-36: Readiness Probe Should be Configured (CKV_K8S_9) [MEDIUM] 1-36: Minimize the admission of root containers (CKV_K8S_23) [LOW] 1-36: Containers should run as a high UID to avoid host conflict (CKV_K8S_40) [LOW] 1-36: Ensure that the seccomp profile is set to docker/default or runtime/default (CKV_K8S_31) [LOW] 1-36: Ensure that Service Account Tokens are only mounted where necessary (CKV_K8S_38) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,20 @@ | ||||||||||||||||||||||||||
| apiVersion: kustomize.config.k8s.io/v1beta1 | ||||||||||||||||||||||||||
| kind: Kustomization | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| labels: | ||||||||||||||||||||||||||
| - pairs: | ||||||||||||||||||||||||||
| service: mongo | ||||||||||||||||||||||||||
| includeSelectors: true | ||||||||||||||||||||||||||
| includeTemplates: true | ||||||||||||||||||||||||||
|
Comment on lines
+4
to
+8
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix YAML indentation errors. The labels section has indentation issues that will prevent proper parsing. Apply this diff to fix the indentation: labels:
-- pairs:
- service: mongo
- includeSelectors: true
- includeTemplates: true
+- pairs:
+ service: mongo
+ includeSelectors: true
+ includeTemplates: true
🧰 Tools🪛 YAMLlint (1.37.1)[error] 5-5: wrong indentation: expected at least 1 (indentation) 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| resources: | ||||||||||||||||||||||||||
| - deployment.yaml | ||||||||||||||||||||||||||
| - pvc.yaml | ||||||||||||||||||||||||||
| - service.yaml | ||||||||||||||||||||||||||
|
Comment on lines
+10
to
+13
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix resources indentation. The resources section has incorrect indentation that will cause YAML parsing errors. Apply this diff to fix the indentation: resources:
-- deployment.yaml
-- pvc.yaml
-- service.yaml
+ - deployment.yaml
+ - pvc.yaml
+ - service.yaml📝 Committable suggestion
Suggested change
🧰 Tools🪛 YAMLlint (1.37.1)[error] 11-11: wrong indentation: expected 2 but found 0 (indentation) 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| vars: | ||||||||||||||||||||||||||
| - name: LEARNINGLOCKER_MONGO_SERVICE | ||||||||||||||||||||||||||
| objref: | ||||||||||||||||||||||||||
| apiVersion: v1 | ||||||||||||||||||||||||||
| kind: Service | ||||||||||||||||||||||||||
| name: mongo | ||||||||||||||||||||||||||
|
Comment on lines
+15
to
+20
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix vars section indentation. The vars section has incorrect indentation that will cause YAML parsing errors. Apply this diff to fix the indentation: vars:
-- name: LEARNINGLOCKER_MONGO_SERVICE
- objref:
- apiVersion: v1
- kind: Service
- name: mongo
+ - name: LEARNINGLOCKER_MONGO_SERVICE
+ objref:
+ apiVersion: v1
+ kind: Service
+ name: mongo📝 Committable suggestion
Suggested change
🧰 Tools🪛 YAMLlint (1.37.1)[error] 16-16: wrong indentation: expected 2 but found 0 (indentation) 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,10 @@ | ||||||||||||||||||
| apiVersion: v1 | ||||||||||||||||||
| kind: PersistentVolumeClaim | ||||||||||||||||||
| metadata: | ||||||||||||||||||
| name: mongo | ||||||||||||||||||
| spec: | ||||||||||||||||||
| accessModes: | ||||||||||||||||||
| - ReadWriteOnce | ||||||||||||||||||
|
Comment on lines
+6
to
+7
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix YAML list indentation under accessModes. Indent list items to satisfy YAMLlint. Apply: spec:
accessModes:
- - ReadWriteOnce
+ - ReadWriteOnce
resources:
requests:
storage: 100Mi📝 Committable suggestion
Suggested change
🧰 Tools🪛 YAMLlint (1.37.1)[error] 7-7: wrong indentation: expected 4 but found 2 (indentation) 🤖 Prompt for AI Agents |
||||||||||||||||||
| resources: | ||||||||||||||||||
| requests: | ||||||||||||||||||
| storage: 100Mi | ||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) Validate capacity for MongoDB data. 100Mi is likely too small for Mongo. Consider higher defaults or document overlay overrides. 🤖 Prompt for AI Agents |
||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| apiVersion: v1 | ||
| kind: Service | ||
| metadata: | ||
| name: mongo | ||
| spec: | ||
| ports: | ||
| - name: mongo | ||
| port: 27017 | ||
| targetPort: 27017 | ||
|
Comment on lines
+1
to
+9
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) Avoid default namespace; set namespace at kustomization level. Add to .k8s/base/kustomization.yaml (or an overlay): 🧰 Tools🪛 Checkov (3.2.334)[LOW] 1-9: The default namespace should not be used (CKV_K8S_21) 🪛 YAMLlint (1.37.1)[error] 7-7: wrong indentation: expected 4 but found 2 (indentation) 🤖 Prompt for AI Agents
Comment on lines
+5
to
+9
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainService missing selector => no endpoints; clients won’t reach Mongo. Apply: spec:
- ports:
- - name: mongo
- port: 27017
- targetPort: 27017
+ selector:
+ app.kubernetes.io/name: mongo
+ ports:
+ - name: mongo
+ port: 27017
+ targetPort: 27017Run to confirm the selector key/value matches your Mongo Deployment Pod template labels: 🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
echo "Mongo Service selector:"
rg -nC2 'kind:\s*Service|name:\s*mongo|selector:' .k8s -g '**/mongo/**/service.yaml'
echo
echo "Mongo Deployment labels (metadata + pod template):"
rg -nC3 '(kind:\s*Deployment|metadata:\s*$|^ {2}labels:|^ {4}[a-zA-Z0-9\.\-]+:|template:|podTemplate|spec:)' .k8s -g '**/mongo/**/deployment.yaml'Length of output: 1475 🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
echo "Checking for any labels in the Deployment manifest:"
rg -n 'labels:' .k8s/base/mongo/deployment.yaml || echo "No 'labels:' lines found in deployment.yaml"
echo
echo "Showing context around the pod template block:"
rg -nC5 'template:' .k8s/base/mongo/deployment.yamlLength of output: 639 Add missing pod labels and service selector
🧰 Tools🪛 Checkov (3.2.334)[LOW] 1-9: The default namespace should not be used (CKV_K8S_21) 🪛 YAMLlint (1.37.1)[error] 7-7: wrong indentation: expected 4 but found 2 (indentation) 🤖 Prompt for AI Agents
Comment on lines
+6
to
+9
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) Indentation under ports is off. Apply (if not fixed by previous diff): - ports:
- - name: mongo
- port: 27017
- targetPort: 27017
+ ports:
+ - name: mongo
+ port: 27017
+ targetPort: 27017🧰 Tools🪛 Checkov (3.2.334)[LOW] 1-9: The default namespace should not be used (CKV_K8S_21) 🪛 YAMLlint (1.37.1)[error] 7-7: wrong indentation: expected 4 but found 2 (indentation) 🤖 Prompt for AI Agents |
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,31 @@ | ||||||||||||||||||||||||||||
| apiVersion: apps/v1 | ||||||||||||||||||||||||||||
| kind: Deployment | ||||||||||||||||||||||||||||
| metadata: | ||||||||||||||||||||||||||||
| name: redis | ||||||||||||||||||||||||||||
| spec: | ||||||||||||||||||||||||||||
| replicas: 1 | ||||||||||||||||||||||||||||
| template: | ||||||||||||||||||||||||||||
|
Comment on lines
+5
to
+7
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add missing selector for Deployment. The Deployment is missing the required Apply this diff to add the selector: spec:
replicas: 1
+ selector:
+ matchLabels:
+ app.kubernetes.io/name: redis
template:
+ metadata:
+ labels:
+ app.kubernetes.io/name: redis
spec:📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||
| spec: | ||||||||||||||||||||||||||||
| containers: | ||||||||||||||||||||||||||||
| - name: redis | ||||||||||||||||||||||||||||
| image: redis | ||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) Consider pinning Redis image to specific version. Using Apply this diff to pin to a specific Redis version: - image: redis
+ image: redis:7.2-alpine📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||
| args: | ||||||||||||||||||||||||||||
| - --loglevel | ||||||||||||||||||||||||||||
| - warning | ||||||||||||||||||||||||||||
| livenessProbe: | ||||||||||||||||||||||||||||
| exec: | ||||||||||||||||||||||||||||
| command: | ||||||||||||||||||||||||||||
| - redis-cli | ||||||||||||||||||||||||||||
| - ping | ||||||||||||||||||||||||||||
| initialDelaySeconds: 2 | ||||||||||||||||||||||||||||
| periodSeconds: 10 | ||||||||||||||||||||||||||||
| ports: | ||||||||||||||||||||||||||||
| - containerPort: 6379 | ||||||||||||||||||||||||||||
| protocol: TCP | ||||||||||||||||||||||||||||
| volumeMounts: | ||||||||||||||||||||||||||||
| - mountPath: /data | ||||||||||||||||||||||||||||
| name: redis | ||||||||||||||||||||||||||||
| volumes: | ||||||||||||||||||||||||||||
| - name: redis | ||||||||||||||||||||||||||||
| persistentVolumeClaim: | ||||||||||||||||||||||||||||
| claimName: redis | ||||||||||||||||||||||||||||
|
Comment on lines
+9
to
+31
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix YAML indentation errors. Multiple indentation errors will prevent the YAML from parsing correctly. Apply this diff to fix the indentation: containers:
- - name: redis
- image: redis
- args:
- - --loglevel
- - warning
- livenessProbe:
- exec:
- command:
- - redis-cli
- - ping
- initialDelaySeconds: 2
- periodSeconds: 10
- ports:
- - containerPort: 6379
- protocol: TCP
- volumeMounts:
- - mountPath: /data
- name: redis
+ - name: redis
+ image: redis
+ args:
+ - --loglevel
+ - warning
+ livenessProbe:
+ exec:
+ command:
+ - redis-cli
+ - ping
+ initialDelaySeconds: 2
+ periodSeconds: 10
+ ports:
+ - containerPort: 6379
+ protocol: TCP
+ volumeMounts:
+ - mountPath: /data
+ name: redis
volumes:
- - name: redis
- persistentVolumeClaim:
- claimName: redis
+ - name: redis
+ persistentVolumeClaim:
+ claimName: redis🧰 Tools🪛 Checkov (3.2.334)[MEDIUM] 1-31: Containers should not run with allowPrivilegeEscalation (CKV_K8S_20) [LOW] 1-31: CPU limits should be set (CKV_K8S_11) [LOW] 1-31: CPU requests should be set (CKV_K8S_10) [LOW] 1-31: Apply security context to your containers (CKV_K8S_30) [LOW] 1-31: The default namespace should not be used (CKV_K8S_21) [LOW] 1-31: Minimize the admission of containers with the NET_RAW capability (CKV_K8S_28) [LOW] 1-31: Image should use digest (CKV_K8S_43) [LOW] 1-31: Image Tag should be fixed - not latest or blank (CKV_K8S_14) [LOW] 1-31: Memory limits should be set (CKV_K8S_13) [LOW] 1-31: Memory requests should be set (CKV_K8S_12) [LOW] 1-31: Minimize the admission of containers with capabilities assigned (CKV_K8S_37) [LOW] 1-31: Apply security context to your pods and containers (CKV_K8S_29) [LOW] 1-31: Use read-only filesystem for containers where possible (CKV_K8S_22) [LOW] 1-31: Readiness Probe Should be Configured (CKV_K8S_9) [MEDIUM] 1-31: Minimize the admission of root containers (CKV_K8S_23) [LOW] 1-31: Containers should run as a high UID to avoid host conflict (CKV_K8S_40) [LOW] 1-31: Ensure that the seccomp profile is set to docker/default or runtime/default (CKV_K8S_31) [LOW] 1-31: Ensure that Service Account Tokens are only mounted where necessary (CKV_K8S_38) 🪛 YAMLlint (1.37.1)[error] 10-10: wrong indentation: expected 8 but found 6 (indentation) [error] 13-13: wrong indentation: expected 10 but found 8 (indentation) [error] 18-18: wrong indentation: expected 14 but found 12 (indentation) [error] 23-23: wrong indentation: expected 10 but found 8 (indentation) [error] 26-26: wrong indentation: expected 10 but found 8 (indentation) 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,20 @@ | ||||||||||||||||||||||
| apiVersion: kustomize.config.k8s.io/v1beta1 | ||||||||||||||||||||||
| kind: Kustomization | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| labels: | ||||||||||||||||||||||
| - pairs: | ||||||||||||||||||||||
| service: redis | ||||||||||||||||||||||
| includeSelectors: true | ||||||||||||||||||||||
| includeTemplates: true | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
Comment on lines
+4
to
+9
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix YAML indentation for labels transformer Current indentation is invalid. Patch: labels:
-- pairs:
- service: redis
- includeSelectors: true
- includeTemplates: true
+ - pairs:
+ service: redis
+ includeSelectors: true
+ includeTemplates: true📝 Committable suggestion
Suggested change
🧰 Tools🪛 YAMLlint (1.37.1)[error] 5-5: wrong indentation: expected at least 1 (indentation) 🤖 Prompt for AI Agents |
||||||||||||||||||||||
| resources: | ||||||||||||||||||||||
| - deployment.yaml | ||||||||||||||||||||||
| - pvc.yaml | ||||||||||||||||||||||
| - service.yaml | ||||||||||||||||||||||
ralf-berger marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| vars: | ||||||||||||||||||||||
| - name: LEARNINGLOCKER_REDIS_SERVICE | ||||||||||||||||||||||
| objref: | ||||||||||||||||||||||
| apiVersion: v1 | ||||||||||||||||||||||
| kind: Service | ||||||||||||||||||||||
| name: redis | ||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,10 @@ | ||||||||||||||||||
| apiVersion: v1 | ||||||||||||||||||
| kind: PersistentVolumeClaim | ||||||||||||||||||
| metadata: | ||||||||||||||||||
| name: redis | ||||||||||||||||||
| spec: | ||||||||||||||||||
| accessModes: | ||||||||||||||||||
| - ReadWriteOnce | ||||||||||||||||||
|
Comment on lines
+6
to
+7
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix YAML list indentation under accessModes. YAMLlint flags this. Indent the list item by 4 spaces under Apply: spec:
accessModes:
- - ReadWriteOnce
+ - ReadWriteOnce
resources:
requests:
storage: 100Mi📝 Committable suggestion
Suggested change
🧰 Tools🪛 YAMLlint (1.37.1)[error] 7-7: wrong indentation: expected 4 but found 2 (indentation) 🤖 Prompt for AI Agents |
||||||||||||||||||
| resources: | ||||||||||||||||||
| requests: | ||||||||||||||||||
| storage: 100Mi | ||||||||||||||||||
|
Comment on lines
+1
to
+10
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) Confirm namespace/SC handling in overlays. Base omits 🧰 Tools🪛 YAMLlint (1.37.1)[error] 7-7: wrong indentation: expected 4 but found 2 (indentation) 🤖 Prompt for AI Agents |
||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,9 @@ | ||||||||||||||||||||
| apiVersion: v1 | ||||||||||||||||||||
| kind: Service | ||||||||||||||||||||
| metadata: | ||||||||||||||||||||
| name: redis | ||||||||||||||||||||
| spec: | ||||||||||||||||||||
| ports: | ||||||||||||||||||||
| - name: redis | ||||||||||||||||||||
| port: 6379 | ||||||||||||||||||||
| targetPort: 6379 | ||||||||||||||||||||
|
Comment on lines
+5
to
+9
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainAdd a selector to bind the Service to the Redis Pods. Without a selector, this Service won’t target any Pods (unless you manage Endpoints separately). Add a selector matching the Deployment labels. Apply (adjust label keys/values to your Deployment): spec:
ports:
- name: redis
port: 6379
targetPort: 6379
+ selector:
+ app.kubernetes.io/name: redis🏁 Script executed: #!/bin/bash
# Locate the Redis Deployment YAML under .k8s/base/redis
deployment_file=$(rg -l 'kind:\s*Deployment' -g '*.yaml' .k8s/base/redis)
echo "Deployment file: $deployment_file"
# Print the metadata.labels section from the Deployment for selector alignment
rg -n 'labels:' -C5 "$deployment_file"Length of output: 266 🏁 Script executed: #!/bin/bash
# Print the first 200 lines of the Redis Deployment to inspect metadata.labels
sed -n '1,200p' .k8s/base/redis/deployment.yamlLength of output: 665 Bind Service to Redis Pods by adding labels and selector
spec:
template:
metadata:
labels:
app.kubernetes.io/name: redis
spec:
ports:
- name: redis
port: 6379
targetPort: 6379
+ selector:
+ app.kubernetes.io/name: redis🧰 Tools🪛 Checkov (3.2.334)[LOW] 1-9: The default namespace should not be used (CKV_K8S_21) 🪛 YAMLlint (1.37.1)[error] 7-7: wrong indentation: expected 4 but found 2 (indentation) 🤖 Prompt for AI Agents
Comment on lines
+6
to
+9
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix YAML list indentation under ports. Indent the list item under Apply: spec:
ports:
- - name: redis
- port: 6379
- targetPort: 6379
+ - name: redis
+ port: 6379
+ targetPort: 6379📝 Committable suggestion
Suggested change
🧰 Tools🪛 Checkov (3.2.334)[LOW] 1-9: The default namespace should not be used (CKV_K8S_21) 🪛 YAMLlint (1.37.1)[error] 7-7: wrong indentation: expected 4 but found 2 (indentation) 🤖 Prompt for AI Agents |
||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| apiVersion: apps/v1 | ||
| kind: Deployment | ||
| metadata: | ||
| name: ui | ||
| spec: | ||
| replicas: 1 | ||
| template: | ||
| spec: | ||
ralf-berger marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| containers: | ||
| - name: ui | ||
| image: learninglocker | ||
| args: | ||
| - ui | ||
| envFrom: | ||
| - configMapRef: | ||
| name: learninglocker-config | ||
| - secretRef: | ||
| name: learninglocker-secret | ||
| env: | ||
| - name: REDIS_HOST | ||
| value: $(LEARNINGLOCKER_REDIS_SERVICE) | ||
| - name: MONGO_HOST | ||
| value: $(LEARNINGLOCKER_MONGO_SERVICE) | ||
ralf-berger marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ports: | ||
| - containerPort: 3000 | ||
| protocol: TCP | ||
| livenessProbe: | ||
| httpGet: | ||
| path: / | ||
| port: 3000 | ||
| initialDelaySeconds: 15 | ||
| periodSeconds: 30 | ||
ralf-berger marked this conversation as resolved.
Show resolved
Hide resolved
Comment on lines
+27
to
+32
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Add readiness probe, security hardening, and resources. Align with API pod baseline. livenessProbe:
httpGet:
path: /
port: 3000
initialDelaySeconds: 15
periodSeconds: 30
+ readinessProbe:
+ httpGet:
+ path: /
+ port: 3000
+ initialDelaySeconds: 5
+ periodSeconds: 10
+ failureThreshold: 3
+ securityContext:
+ runAsNonRoot: true
+ allowPrivilegeEscalation: false
+ readOnlyRootFilesystem: true
+ seccompProfile:
+ type: RuntimeDefault
+ capabilities:
+ drop: [ "ALL" ]
+ resources:
+ requests:
+ cpu: "50m"
+ memory: "128Mi"
+ limits:
+ cpu: "250m"
+ memory: "256Mi"
+ automountServiceAccountToken: false
🧰 Tools🪛 Checkov (3.2.334)[MEDIUM] 1-32: Containers should not run with allowPrivilegeEscalation (CKV_K8S_20) [LOW] 1-32: CPU limits should be set (CKV_K8S_11) [LOW] 1-32: CPU requests should be set (CKV_K8S_10) [LOW] 1-32: Apply security context to your containers (CKV_K8S_30) [LOW] 1-32: The default namespace should not be used (CKV_K8S_21) [LOW] 1-32: Minimize the admission of containers with the NET_RAW capability (CKV_K8S_28) [LOW] 1-32: Image should use digest (CKV_K8S_43) [LOW] 1-32: Image Tag should be fixed - not latest or blank (CKV_K8S_14) [LOW] 1-32: Memory limits should be set (CKV_K8S_13) [LOW] 1-32: Memory requests should be set (CKV_K8S_12) [LOW] 1-32: Minimize the admission of containers with capabilities assigned (CKV_K8S_37) [LOW] 1-32: Apply security context to your pods and containers (CKV_K8S_29) [LOW] 1-32: Use read-only filesystem for containers where possible (CKV_K8S_22) [LOW] 1-32: Readiness Probe Should be Configured (CKV_K8S_9) [MEDIUM] 1-32: Minimize the admission of root containers (CKV_K8S_23) [LOW] 1-32: Containers should run as a high UID to avoid host conflict (CKV_K8S_40) [LOW] 1-32: Ensure that the seccomp profile is set to docker/default or runtime/default (CKV_K8S_31) [LOW] 1-32: Prefer using secrets as files over secrets as environment variables (CKV_K8S_35) [LOW] 1-32: Ensure that Service Account Tokens are only mounted where necessary (CKV_K8S_38) 🪛 YAMLlint (1.37.1)[error] 32-32: no new line character at the end of file (new-line-at-end-of-file) 🤖 Prompt for AI Agents |
||
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,12 @@ | ||||||||||||||
| apiVersion: kustomize.config.k8s.io/v1beta1 | ||||||||||||||
| kind: Kustomization | ||||||||||||||
|
|
||||||||||||||
| labels: | ||||||||||||||
| - pairs: | ||||||||||||||
| app.kubernetes.io/component: ui | ||||||||||||||
| includeSelectors: true | ||||||||||||||
| includeTemplates: true | ||||||||||||||
|
Comment on lines
+4
to
+8
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix YAML indentation errors. The YAML structure has indentation issues that will prevent proper parsing. Apply this diff to fix the indentation: labels:
-- pairs:
- app.kubernetes.io/component: ui
- includeSelectors: true
- includeTemplates: true
+- pairs:
+ app.kubernetes.io/component: ui
+ includeSelectors: true
+ includeTemplates: true
🧰 Tools🪛 YAMLlint (1.37.1)[error] 5-5: wrong indentation: expected at least 1 (indentation) 🤖 Prompt for AI Agents |
||||||||||||||
|
|
||||||||||||||
| resources: | ||||||||||||||
| - deployment.yaml | ||||||||||||||
| - service.yaml | ||||||||||||||
|
Comment on lines
+10
to
+12
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix resources indentation. The resources section has incorrect indentation that will cause YAML parsing errors. Apply this diff to fix the indentation: resources:
-- deployment.yaml
-- service.yaml
+ - deployment.yaml
+ - service.yaml📝 Committable suggestion
Suggested change
🧰 Tools🪛 YAMLlint (1.37.1)[error] 11-11: wrong indentation: expected 2 but found 0 (indentation) 🤖 Prompt for AI Agents |
||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,9 @@ | ||||||||||||||||||
| apiVersion: v1 | ||||||||||||||||||
| kind: Service | ||||||||||||||||||
| metadata: | ||||||||||||||||||
| name: ui | ||||||||||||||||||
| spec: | ||||||||||||||||||
| ports: | ||||||||||||||||||
| - name: http | ||||||||||||||||||
| port: 80 | ||||||||||||||||||
| targetPort: 3000 | ||||||||||||||||||
|
Comment on lines
+1
to
+9
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) Avoid default namespace; set via kustomization. Add in the appropriate kustomization: 🧰 Tools🪛 Checkov (3.2.334)[LOW] 1-9: The default namespace should not be used (CKV_K8S_21) 🪛 YAMLlint (1.37.1)[error] 7-7: wrong indentation: expected 4 but found 2 (indentation) 🤖 Prompt for AI Agents
Comment on lines
+5
to
+9
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainService missing selector => no endpoints for UI. Apply: spec:
- ports:
- - name: http
- port: 80
- targetPort: 3000
+ selector:
+ app.kubernetes.io/name: ui
+ ports:
+ - name: http
+ port: 80
+ targetPort: 3000Quick check that selectors match the Deployment labels: 🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
echo "UI Service selector:"
rg -nC2 'kind:\s*Service|name:\s*ui|selector:' .k8s -g '**/ui/**/service.yaml'
echo
echo "UI Deployment labels (metadata + pod template):"
rg -nC3 '(kind:\s*Deployment|metadata:\s*$|^ {2}labels:|^ {4}[a-zA-Z0-9\.\-]+:|template:|spec:)' .k8s -g '**/ui/**/deployment.yaml'Length of output: 1139 🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
echo "---- UI Deployment YAML (full) ----"
cat .k8s/base/ui/deployment.yamlLength of output: 850 Add pod template label and matching Service selector
This ensures the Service routes to the UI pods. 🧰 Tools🪛 Checkov (3.2.334)[LOW] 1-9: The default namespace should not be used (CKV_K8S_21) 🪛 YAMLlint (1.37.1)[error] 7-7: wrong indentation: expected 4 but found 2 (indentation) 🤖 Prompt for AI Agents
Comment on lines
+6
to
+9
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) Indentation under ports is off. Apply: - ports:
- - name: http
- port: 80
- targetPort: 3000
+ ports:
+ - name: http
+ port: 80
+ targetPort: 3000📝 Committable suggestion
Suggested change
🧰 Tools🪛 Checkov (3.2.334)[LOW] 1-9: The default namespace should not be used (CKV_K8S_21) 🪛 YAMLlint (1.37.1)[error] 7-7: wrong indentation: expected 4 but found 2 (indentation) 🤖 Prompt for AI Agents |
||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.