-
-
Notifications
You must be signed in to change notification settings - Fork 122
GCI1024 [Team OSER][2025] - Amar salhi code add iac rules 1 #398
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: main
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 |
|---|---|---|
|
|
@@ -18,7 +18,11 @@ Some are applicable for different technologies. | |
| - ❓ Rule to analyze for applicability | ||
| - 🚫 Non applicable rule | ||
|
|
||
| | Rule key | Name | Description | Reference/Validation | Java | Php | JS | Python | Rust | C# | HTML | | ||
| | Rule key | Name | Description | Reference/Validation | Docker | Kuberenetes | Ansible| Terrafomr |CloudFormation | | ||
|
Contributor
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. Typo on Terraform (Terrafomr)
Contributor
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. Maybe add the table after the existing one, to avoid modify the header |
||
| |----------|-------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------|-----|----|--------|------|----|------| | ||
| | GCI1024 | Liveness and readiness probes shuld be defined | | ❓ | 🚧 | ❓ | ❓ | ❓ | | ||
|
|
||
| | Rule key | Name | Description | Reference/Validation | Java | Php | JS | Python | Rust | C# | HTML | | ||
| |----------|-------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------|-----|----|--------|------|----|------| | ||
| | CRJVM205 | Force usage of FetchType LAZY for collections on JPA entities | | | 🚧 | ❓ | ❓ | ❓ | ❓ | ❓ | 🚫 | | ||
| | CRJVM206 | Avoid N+1 selects problem | | | 🚧 | ❓ | ❓ | ❓ | ❓ | ❓ | 🚫 | | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| <assembly xmlns="http://maven.apache.org/ASSEMBLY/2.1.1" | ||
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.1.1 https://maven.apache.org/xsd/assembly-2.1.1.xsd"> | ||
| <id>kubernetes</id> | ||
| <formats> | ||
| <format>jar</format> | ||
| </formats> | ||
| <includeBaseDirectory>false</includeBaseDirectory> | ||
| <fileSets> | ||
| <fileSet> | ||
| <directory>${project.build.outputDirectory}</directory> | ||
| <includes> | ||
| <include>org/green-code-initiative/rules/kubernetes/*.*</include> | ||
| </includes> | ||
| <outputDirectory/> | ||
| </fileSet> | ||
| </fileSets> | ||
| </assembly> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| { | ||
| "title": "Liveness and liveness detection should be avoided", | ||
| "type": "CODE_SMELL", | ||
| "status": "ready", | ||
| "remediation": { | ||
| "func": "Constant\/Issue", | ||
| "constantCost": "5 min" | ||
| }, | ||
| "tags": [ | ||
| "performance", | ||
| "iac", | ||
| "eco-design", | ||
| "creedengo" | ||
| ], | ||
| "defaultSeverity": "Minor" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| == Why this rule is important ? | ||
|
|
||
| The absence of liveness or readiness probes in a Kubernetes deployment can cause undesirable effects: | ||
|
|
||
| - Unstable containers that unnecessarily consume CPU/memory resources. | ||
| - Unready applications receiving traffic, increasing errors and client-side retries. | ||
| - More frequent redeployments or crash-loops. | ||
| - Increased carbon footprint due to inefficient use of resources. | ||
|
|
||
| Defining these probes ensures that the pod is properly supervised by Kubernetes, limiting wasted resources and promoting a leaner, more stable cluster. | ||
|
|
||
| Additional information available on: | ||
|
|
||
| * Research articles: | ||
|
Contributor
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. Theses articles do not seems to talk about probe (did not read it entirely) |
||
| ** https://arxiv.org/html/2504.10702v1[Container-level Energy Observability in Kubernetes Clusters] | ||
| ** https://arxiv.org/pdf/2503.08641[A Comprehensive Experimentation Framework for Energy-Efficient Design of Cloud-Native Applications] | ||
| * Official Kubernetes documentation: https://kubernetes.io/docs/concepts/configuration/liveness-readiness-startup-probes/[Liveness, Readiness, and Startup Probes] | ||
|
|
||
| == Non Compliant Code Example | ||
|
|
||
|
|
||
|
|
||
| [source,yml] | ||
| ---- | ||
| # Liveness et readiness probes absentes | ||
| apiVersion: apps/v1 | ||
| kind: Deployment | ||
| metadata: | ||
| name: my-app | ||
| spec: | ||
| replicas: 2 | ||
| template: | ||
| spec: | ||
| containers: | ||
| - name: my-app | ||
| image: my-image:latest | ||
|
|
||
| ---- | ||
|
|
||
| == Compliant Code Example | ||
|
|
||
| [source,yml] | ||
| ---- | ||
|
|
||
| livenessProbe: | ||
| httpGet: | ||
| path: /health | ||
| port: 8080 | ||
| initialDelaySeconds: 10 | ||
| periodSeconds: 5 | ||
|
|
||
| readinessProbe: | ||
| httpGet: | ||
| path: /ready | ||
| port: 8080 | ||
| initialDelaySeconds: 5 | ||
| periodSeconds: 10 | ||
|
|
||
|
|
||
| ---- | ||
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.
Don't change the Unreleased, it will be update by CI