-
Notifications
You must be signed in to change notification settings - Fork 19
update versions in bludit docker #26
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
base: master
Are you sure you want to change the base?
Changes from all commits
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 | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -69,6 +69,5 @@ $ docker rmi bludit/docker:latest | |||||||||||
| The Kubernetes manifests are basic and can be improved for better security and shared storage to support multiple replicas. | ||||||||||||
|
|
||||||||||||
| ``` | ||||||||||||
| $ kubectl apply -f kubernetes/deployment.yml | ||||||||||||
| $ kubectl apply -f kubernetes/service.yml | ||||||||||||
| $ kubectl apply -f kubernetes/ | ||||||||||||
|
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. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win 🔎 Supported by static analysis🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- README excerpt ---'
sed -n '60,80p' README.md
printf '%s\n' '--- Kubernetes files ---'
git ls-files kubernetes
printf '%s\n' '--- Manifest metadata ---'
for f in kubernetes/*.yml kubernetes/*.yaml; do
[ -f "$f" ] || continue
printf '\n### %s\n' "$f"
sed -n '1,45p' "$f"
doneRepository: bludit/docker Length of output: 2599 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- kubectl references and repository guidance ---'
rg -n -C 3 'kubectl apply|namespace\.yml|persistentvolumeclaim\.yml|deployment\.yml|service\.yml|Namespace|namespace' README.md .github kubernetes 2>/dev/null || true
printf '%s\n' '--- available kubectl ---'
if command -v kubectl >/dev/null 2>&1; then
kubectl version --client --output=yaml
else
printf '%s\n' 'kubectl is unavailable'
fiRepository: bludit/docker Length of output: 2449 🌐 Web query:
💡 Result: When using kubectl apply -f , Kubernetes does not guarantee a specific order of execution for the files within that directory [1][2]. Official documentation does not define a strict ordering mechanism, and practical experience indicates that resources are often processed based on the order of files returned by the operating system (typically alphabetical) [3][2][4]. Because there is no guaranteed execution order, applying a directory containing interdependent resources—such as a Namespace and the Pods intended to run within it—can fail if a dependent resource is processed before its required prerequisite [1][5]. To manage dependencies and ensure successful deployments, consider the following best practices: 1. Use Kustomize: The preferred official approach for managing configuration dependencies is Kustomize [6]. By using kubectl apply -k , you can define the specific order of resources within a kustomization.yaml file [7]. Kubernetes will process the resources in the exact order they are listed in the 'resources' section of that file [8][7]. 2. File Naming: While not a guaranteed feature of kubectl, some users attempt to enforce order by prefixing filenames with numbers (e.g., 01-namespace.yaml, 02-deployment.yaml) [2][4]. While this often works by relying on the OS's alphabetical file listing, it is not a robust or officially supported solution and should be avoided if possible [2]. 3. Orchestration Tools: For complex environments with strict dependency requirements, rely on orchestration tools like Helm [2]. Helm allows you to define hooks and manage lifecycle events, ensuring that resources are created in the correct sequence. In summary, kubectl apply -f is best suited for independent resources; for anything with dependencies, you should use Kustomize or Helm to ensure proper execution order [2][6]. Citations:
🌐 Web query:
💡 Result: In the Kubernetes codebase, specifically within the Citations:
Apply
Suggested commands-$ kubectl apply -f kubernetes/
+kubectl apply -f kubernetes/namespace.yml
+kubectl apply -f kubernetes/persistentvolumeclaim.yml \
+ -f kubernetes/deployment.yml \
+ -f kubernetes/service.yml📝 Committable suggestion
Suggested change
🧰 Tools🪛 markdownlint-cli2 (0.23.2)[warning] 72-72: Dollar signs used before commands without showing output (MD014, commands-show-output) 🤖 Prompt for AI Agents |
||||||||||||
| ``` | ||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,7 @@ apiVersion: apps/v1 | |
| kind: Deployment | ||
| metadata: | ||
| name: bludit | ||
| namespace: bludit | ||
| labels: | ||
| app: bludit | ||
| spec: | ||
|
|
@@ -17,8 +18,8 @@ spec: | |
| spec: | ||
| containers: | ||
| - name: bludit | ||
| image: bludit:latest | ||
| imagePullPolicy: Always | ||
| image: bludit/docker:3.22.0 | ||
| imagePullPolicy: IfNotPresent | ||
| ports: | ||
| - containerPort: 80 | ||
| resources: | ||
|
|
@@ -40,3 +41,20 @@ spec: | |
| port: 80 | ||
| initialDelaySeconds: 15 | ||
| periodSeconds: 20 | ||
| volumeMounts: | ||
| - name: bludit-content | ||
| mountPath: /usr/share/nginx/html/bl-content | ||
| - name: bludit-plugins | ||
| mountPath: /usr/share/nginx/html/bl-plugins | ||
| - name: bludit-themes | ||
| mountPath: /usr/share/nginx/html/bl-themes | ||
| volumes: | ||
| - name: bludit-content | ||
| persistentVolumeClaim: | ||
| claimName: bludit-content | ||
| - name: bludit-plugins | ||
| persistentVolumeClaim: | ||
| claimName: bludit-plugins | ||
| - name: bludit-themes | ||
| persistentVolumeClaim: | ||
| claimName: bludit-themes | ||
|
Comment on lines
+51
to
+60
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. 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win 🔎 Supported by static analysis🏁 Script executed: #!/bin/bash
set -e
printf '%s\n' '--- kubernetes/deployment.yml ---'
cat -n kubernetes/deployment.yml | sed -n '1,120p'
printf '%s\n' '--- Kubernetes manifests ---'
git ls-files kubernetes
printf '%s\n' '--- volume claims and rollout settings ---'
rg -n -C 3 'kind: (PersistentVolumeClaim|Deployment)|accessModes:|storageClassName:|strategy:|replicas:|claimName:' kubernetesRepository: bludit/docker Length of output: 5722 Prevent This single-replica Deployment uses the default Set Suggested strategy spec:
replicas: 1
+ strategy:
+ type: Recreate🧰 Tools🪛 Checkov (3.3.11)[medium] 2-60: Containers should not run with allowPrivilegeEscalation (CKV_K8S_20) [medium] 2-60: Minimize the admission of root containers (CKV_K8S_23) 🪛 Trivy (0.74.0)[error] 18-60: Default security context configured deployment bludit in bludit namespace is using the default security context, which allows root privileges Rule: KSV-0118 (IaC/Kubernetes) 🤖 Prompt for AI Agents |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| apiVersion: v1 | ||
| kind: Namespace | ||
| metadata: | ||
| name: bludit | ||
| labels: | ||
| app: bludit |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| --- | ||
| apiVersion: v1 | ||
| kind: PersistentVolumeClaim | ||
| metadata: | ||
| labels: | ||
| app: bludit | ||
| name: bludit-content | ||
| namespace: bludit | ||
| spec: | ||
| accessModes: | ||
| - ReadWriteOnce | ||
| resources: | ||
| requests: | ||
| storage: 100M | ||
| --- | ||
| apiVersion: v1 | ||
| kind: PersistentVolumeClaim | ||
| metadata: | ||
| labels: | ||
| app: bludit | ||
| name: bludit-plugins | ||
| namespace: bludit | ||
| spec: | ||
| accessModes: | ||
| - ReadWriteOnce | ||
| resources: | ||
| requests: | ||
| storage: 100M | ||
| --- | ||
| apiVersion: v1 | ||
| kind: PersistentVolumeClaim | ||
| metadata: | ||
| labels: | ||
| app: bludit | ||
| name: bludit-themes | ||
| namespace: bludit | ||
| spec: | ||
| accessModes: | ||
| - ReadWriteOnce | ||
| resources: | ||
| requests: | ||
| storage: 100M |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,7 @@ kind: Service | |
| apiVersion: v1 | ||
| metadata: | ||
| name: bludit | ||
| namespace: bludit | ||
| spec: | ||
| selector: | ||
| app: bludit | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔒 Security & Privacy | 🟠 Major | 🏗️ Heavy lift
🧩 Analysis chain
🏁 Script executed:
Repository: bludit/docker
Length of output: 4749
🏁 Script executed:
Repository: bludit/docker
Length of output: 5107
Security Misconfiguration (CWE-250)
Reachability: External · Exploitability: Difficult
Run the image with a non-root runtime identity.
The image has no
USERinstruction, so the entrypoint starts as root. It performs recursivechownoperations and starts Nginx on port 80. The Kubernetes Deployment has no security context.Add a dedicated runtime user and group. Update the entrypoint and Nginx configuration so startup does not require root for ownership, PID/log paths, or port 80. Set matching
runAsNonRoot, UID/GID, andfsGroupvalues in the Deployment.🧰 Tools
🪛 Trivy (0.74.0)
[error] 1-1: Image user should not be 'root'
Specify at least 1 USER command in Dockerfile with non-root user as argument
Rule: DS-0002
Learn more
(IaC/Dockerfile)
🤖 Prompt for AI Agents
Source: Linters/SAST tools