Skip to content

Final#31

Open
Swayamnakshane wants to merge 41 commits intoLondheShubham153:DevOpsfrom
Swayamnakshane:final
Open

Final#31
Swayamnakshane wants to merge 41 commits intoLondheShubham153:DevOpsfrom
Swayamnakshane:final

Conversation

@Swayamnakshane
Copy link

@Swayamnakshane Swayamnakshane commented Apr 26, 2025

Summary by CodeRabbit

  • New Features

    • Added Kubernetes manifests for deploying a bank application and MySQL database, including namespaces, deployments, services, persistent storage, config maps, and secrets.
    • Introduced local Kubernetes cluster configuration for multi-node setup.
  • Improvements

    • Updated Docker and Docker Compose configurations for optimized images, simplified structure, and improved environment variable handling.
    • Enhanced Kubernetes manifests for clarity, consistency, and secure credential management.
    • Increased replicas for bank application deployment and refined environment variable sourcing.
    • Converted MySQL deployment to StatefulSet with persistent volume templates.
  • Removals

    • Removed legacy Kubernetes resources for autoscaling, ingress, and certificate management.

@coderabbitai
Copy link

coderabbitai bot commented Apr 26, 2025

Walkthrough

This update introduces a comprehensive refactor and expansion of containerization and Kubernetes deployment resources for a banking application. The Dockerfile and docker-compose.yml are modernized for efficiency and clarity, including updated base images, environment variable handling, and port mappings. A full Kubernetes deployment suite is added, featuring Namespaces, Deployments, StatefulSets, Services (including headless services), PersistentVolumes, PersistentVolumeClaims, ConfigMaps, and Secrets. The manifests are standardized, with resource names and namespaces unified under "bank." Several legacy or redundant Kubernetes resources (such as Ingress, HPA, and ClusterIssuer) are removed, and configuration is streamlined for local and production-like environments.

Changes

File(s) Change Summary
Dockerfile Refactored: updated base images to slimmer variants, changed working directories, simplified copy commands, updated JAR naming, changed exposed port, removed metadata, and switched ENTRYPOINT to CMD.
docker-compose.yml Reformatted environment variables, changed MySQL DB name, exposed MySQL port, updated image references, simplified depends_on, removed healthchecks, and improved formatting.
kube/Namespace.yml, kubernetes/Namespace.yml Added new Kubernetes Namespace resource named "bank".
kube/bank-deployement.yml, kubernetes/bank-deployement.yml Added new Deployment manifest for the bank application, using image from Docker registry, environment variables from ConfigMap/Secret, and three replicas.
kube/bank-service.yml, kubernetes/bank-service.yml Added new Service manifest for the bank app, using NodePort type, exposing port 30080/30081 externally, with appropriate selectors.
kube/config.yml, kubernetes/config.yml Added new kind cluster configuration with one control-plane and two worker nodes.
kube/configmap.yml, kubernetes/configmap.yml, kubernetes/configmap.yaml Added/updated ConfigMap for database connection settings, unified under "bank-configmap" and namespace "bank".
kube/mysql-deployment.yml, kubernetes/mysql-deployment.yml Added/updated StatefulSet for MySQL with two replicas, persistent storage, and environment sourced from Secret/ConfigMap.
kube/mysql-service.yml, kubernetes/mysql-service.yml, kubernetes/mysql-service.yaml Added/updated headless Service for MySQL, renamed and moved to "bank" namespace.
kube/persistentvolume.yml, kubernetes/persistentvolume.yml, kubernetes/persistent-volume.yaml Added/updated PersistentVolume for MySQL, unified under "bank" namespace, reduced size, and simplified hostPath.
kube/persistentvolumeclaim.yml, kubernetes/persistentvolumeclaim.yml, kubernetes/persistent-volume-claim.yaml Added/updated PersistentVolumeClaim for MySQL, unified under "bank" namespace, reduced size.
kube/secret.yml, kubernetes/secret.yml, kubernetes/secrets.yaml Added/updated Secret for database credentials, unified under "bank" namespace, standardized field names and encoding.
kubernetes/bankapp-deployment.yml Updated deployment: new metadata, increased replicas, new image, new environment variable sources, and updated probes (commented).
kubernetes/bankapp-service.yaml Renamed Service, changed namespace and selector, switched to NodePort, updated ports, removed labels.
kubernetes/bankapp-namespace.yaml Changed namespace name to "bank", removed labels, reordered fields.
kubernetes/bankapp-ingress.yml, kubernetes/bankapp-hpa.yml, kubernetes/letsencrypt-clusterissuer.yaml Deleted Ingress, HPA, and ClusterIssuer resources.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Browser
    participant Bank Service (Pod)
    participant MySQL (StatefulSet Pod)
    participant Kubernetes Cluster

    User->>Browser: Access NodePort 30080/30081
    Browser->>Kubernetes Cluster: Route request to bank-svc
    Kubernetes Cluster->>Bank Service (Pod): Forward to port 8081
    Bank Service (Pod)->>MySQL (StatefulSet Pod): Connect via JDBC using env from ConfigMap/Secret
    MySQL (StatefulSet Pod)-->>Bank Service (Pod): Respond with data
    Bank Service (Pod)-->>Browser: Return response
    Browser-->>User: Display result
Loading

Poem

🐇
In the warren of YAML and Docker delight,
New namespaces and secrets now take flight.
With ConfigMaps and volumes, our data’s secure,
StatefulSets and services robust and pure.
From Docker to Kube, the journey’s complete—
The bank app now hops on nimble feet!
🥕


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c0fcac6 and 37f9e69.

📒 Files selected for processing (1)
  • kube/mysql-deployment.yml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • kube/mysql-deployment.yml

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 20

♻️ Duplicate comments (3)
kubernetes/bankapp-namespace.yaml (1)

1-4: Duplicate Namespace definition detected
This file declares the bank Namespace that already exists in kube/Namespace.yml. To avoid duplication and potential inconsistencies, consolidate to a single Namespace manifest.

kubernetes/persistentvolumeclaim.yml (1)

1-14: Duplicate resource: mysql-pvc.

As highlighted in kubernetes/persistent-volume-claim.yaml, this PVC duplicates the MySQL storage claim. Remove or merge this manifest to avoid resource conflicts.

kube/persistentvolumeclaim.yml (1)

1-14: Duplicate resource in different directory.

This mysql-pvc in the kube/ folder duplicates the PVC defined under kubernetes/. Consolidate resources into one location and remove the redundant manifest to maintain clarity.

🧹 Nitpick comments (19)
kube/secret.yml (1)

1-2: Align field ordering for consistency
Unlike other manifests in this PR (e.g., kube/config.yml), this file places apiVersion before kind. Consider reordering to kindapiVersion for uniformity:

-apiVersion: v1
-kind: Secret
+kind: Secret
+apiVersion: v1
kubernetes/secrets.yaml (2)

2-7: Ensure consistent manifest ordering
In kube/secret.yml, apiVersion precedes kind, whereas here it’s reversed. Standardize the ordering of kind and apiVersion across all YAML files for readability.


11-11: Remove trailing whitespace
The blank line at the end contains trailing spaces, which may trigger lint errors. Please trim them.

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 11-11: trailing spaces

(trailing-spaces)

Dockerfile (1)

7-12: Optional: use ENTRYPOINT for Java runtime.
Using ENTRYPOINT instead of CMD improves signal handling and allows argument overrides more cleanly:

- CMD ["java","-jar","/app/target/bank.jar"]
+ ENTRYPOINT ["java","-jar","/app/target/bank.jar"]
kubernetes/persistentvolume.yml (1)

14-15: Consider storage best practices.
Using a hostPath ties the PV to the node’s local filesystem, which isn’t portable or durable across nodes. For production, evaluate a network-backed solution (e.g., NFS, a CSI driver) or a dynamic provisioning StorageClass.

kubernetes/bankapp-service.yaml (1)

10-14: Evaluate service exposure method.

Using type: NodePort (nodePort: 30080) may work for testing, but for production consider a LoadBalancer or Ingress to control external access, simplify traffic routing, and improve security.

kubernetes/persistent-volume.yaml (1)

4-5: Remove unsupported namespace and specify reclaim policy
Like other PVs, metadata.namespace is ignored for PersistentVolumes—please remove it. Explicitly declare a persistentVolumeReclaimPolicy to avoid relying on cluster defaults.

Example:

 metadata:
   name: bank-pv
-  namespace: bank
 spec:
+  persistentVolumeReclaimPolicy: Retain
   capacity:
     storage: 5Gi
   accessModes:
     - ReadWriteOnce
   storageClassName: standard
   hostPath:
     path: "/mnt/data"
kube/mysql-deployment.yml (3)

21-38: Add health probes for the MySQL container.
Defining readinessProbe and livenessProbe (for example, using exec: ["mysqladmin","ping","-h","localhost"]) helps Kubernetes detect when the database is ready or needs restarting, improving overall reliability.


39-49: Specify storageClassName and resource limits for the PVC.
To align with best practices and support different storage backends, explicitly set a storageClassName on the volumeClaimTemplates. Also consider documenting or enforcing resource requests/limits to prevent unbounded storage claims.


9-13: Consider adding a PodDisruptionBudget for the StatefulSet.
A PDB ensures at least one replica of the MySQL StatefulSet remains available during voluntary disruptions, improving cluster stability during upgrades or maintenance.

kubernetes/mysql-service.yaml (1)

13-15: Fix YAML indentation and remove trailing spaces.
Line 13 (- protocol: TCP) is indented by 3 spaces instead of 4, and there are trailing spaces at the selector value. Align to 2 spaces under ports: and remove extra whitespace.

 spec:
   ports:
-  - protocol: TCP
+    - protocol: TCP
🧰 Tools
🪛 YAMLlint (1.35.1)

[warning] 13-13: wrong indentation: expected 4 but found 3

(indentation)

kube/bank-deployement.yml (1)

6-7: Consider a more descriptive label.
The label app: app is very generic and deviates from other manifests that use app: bankapp. Standardizing to app: bankapp will improve selector clarity and consistency across the bank namespace.

kubernetes/bank-deployement.yml (1)

6-7: Align labels with convention.
This manifest uses app: app whereas other resources rely on app: bankapp. Harmonizing labels ensures Services and selectors correctly match your pods.

docker-compose.yml (1)

19-19: Use lowercase container names.
Docker container names must conform to DNS-1123 (lowercase). Change "Bankapp" to bankapp to avoid startup errors.

kubernetes/bankapp-deployment.yml (5)

2-2: YAML key ordering is unconventional.
Kubernetes community style usually lists apiVersion before kind. While not strictly required, swapping lines 1–2 improves readability.


4-5: Align resource name with filename.
The manifest is named bankapp-deployment.yml but its metadata.name is bank-deployment. Either rename the resource to bankapp-deployment or update the filename to match for clarity.


19-20: Standardize container naming & versioning.
This container is named bank-pod here but is bank-cont elsewhere. Also avoid :latest on swayamnakshane/mybank; pin a specific tag (e.g., :v1.0.0) for repeatable deployments.


23-23: Remove trailing whitespace.
Trailing spaces on these lines can break YAML parsing and clutter diffs. Please trim them.

Also applies to: 49-50, 55-55, 57-58

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 23-23: trailing spaces

(trailing-spaces)


45-60: Review commented-out health probes.
The readiness/liveness sections are fully commented and inconsistently indented. Either remove these placeholders or enable properly formatted probes to improve pod resilience.

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 49-49: trailing spaces

(trailing-spaces)


[error] 50-50: trailing spaces

(trailing-spaces)


[error] 55-55: trailing spaces

(trailing-spaces)


[error] 57-57: trailing spaces

(trailing-spaces)


[error] 58-58: trailing spaces

(trailing-spaces)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 66c677d and c0fcac6.

📒 Files selected for processing (33)
  • Dockerfile (1 hunks)
  • docker-compose.yml (1 hunks)
  • kube/Namespace.yml (1 hunks)
  • kube/bank-deployement.yml (1 hunks)
  • kube/bank-service.yml (1 hunks)
  • kube/config.yml (1 hunks)
  • kube/configmap.yml (1 hunks)
  • kube/mysql-deployment.yml (1 hunks)
  • kube/mysql-service.yml (1 hunks)
  • kube/persistentvolume.yml (1 hunks)
  • kube/persistentvolumeclaim.yml (1 hunks)
  • kube/secret.yml (1 hunks)
  • kubernetes/Namespace.yml (1 hunks)
  • kubernetes/bank-deployement.yml (1 hunks)
  • kubernetes/bank-service.yml (1 hunks)
  • kubernetes/bankapp-deployment.yml (1 hunks)
  • kubernetes/bankapp-hpa.yml (0 hunks)
  • kubernetes/bankapp-ingress.yml (0 hunks)
  • kubernetes/bankapp-namespace.yaml (1 hunks)
  • kubernetes/bankapp-service.yaml (1 hunks)
  • kubernetes/config.yml (1 hunks)
  • kubernetes/configmap.yaml (1 hunks)
  • kubernetes/configmap.yml (1 hunks)
  • kubernetes/letsencrypt-clusterissuer.yaml (0 hunks)
  • kubernetes/mysql-deployment.yml (1 hunks)
  • kubernetes/mysql-service.yaml (1 hunks)
  • kubernetes/mysql-service.yml (1 hunks)
  • kubernetes/persistent-volume-claim.yaml (1 hunks)
  • kubernetes/persistent-volume.yaml (1 hunks)
  • kubernetes/persistentvolume.yml (1 hunks)
  • kubernetes/persistentvolumeclaim.yml (1 hunks)
  • kubernetes/secret.yml (1 hunks)
  • kubernetes/secrets.yaml (1 hunks)
💤 Files with no reviewable changes (3)
  • kubernetes/bankapp-hpa.yml
  • kubernetes/letsencrypt-clusterissuer.yaml
  • kubernetes/bankapp-ingress.yml
🧰 Additional context used
🪛 YAMLlint (1.35.1)
kubernetes/mysql-service.yaml

[error] 11-11: trailing spaces

(trailing-spaces)


[warning] 13-13: wrong indentation: expected 4 but found 3

(indentation)

kubernetes/secrets.yaml

[error] 11-11: trailing spaces

(trailing-spaces)

kubernetes/bankapp-deployment.yml

[warning] 22-22: wrong indentation: expected 8 but found 10

(indentation)


[error] 23-23: trailing spaces

(trailing-spaces)


[error] 49-49: trailing spaces

(trailing-spaces)


[error] 50-50: trailing spaces

(trailing-spaces)


[error] 55-55: trailing spaces

(trailing-spaces)


[error] 57-57: trailing spaces

(trailing-spaces)


[error] 58-58: trailing spaces

(trailing-spaces)

🔇 Additional comments (14)
kube/config.yml (2)

1-2: Validate cluster resource definition.
The kind: Cluster and apiVersion: kind.x-k8s.io/v1alpha4 fields adhere to Kind's configuration schema.


3-9: Verify Kind node image version compatibility.
Confirm that your local kind CLI supports kindest/node:v1.31.2. Mismatches between the node image version and the installed kind version may lead to cluster creation errors.

Dockerfile (1)

1-6: Update to Maven builder stage approved.
Switching to maven:3.9.6-eclipse-temurin-17-alpine, standardizing WORKDIR /app, and simplifying the copy directive keeps the build lean and efficient.

kubernetes/Namespace.yml (1)

1-5: Namespace definition looks good.
The bank Namespace is correctly declared and will scope your resources consistently.

kubernetes/config.yml (1)

1-9: Kind cluster configuration is valid.
Defines one control-plane and two worker nodes for local testing using kind v1.31.2. No issues detected.

kubernetes/secret.yml (1)

3-6:

Details

✅ Verification successful

Verify that the bank-secret is consumed by all workloads.

Ensure every Deployment and StatefulSet in the bank namespace references this secret (via secretKeyRef or envFrom) so pods receive the correct credentials. You can run:


🏁 Script executed:

#!/usr/bin/env bash
# Search for references to the secret
rg "bank-secret" -n .
rg "secretKeyRef" -n .

Length of output: 996


bank-secret consumption verified across all workloads
The bank-secret is referenced via secretKeyRef or envFrom in every Deployment and StatefulSet:

• kube/mysql-deployment.yml (line 27–28)
• kube/bank-deployement.yml (line 36–37)
• kubernetes/mysql-deployment.yml (line 27–28)
• kubernetes/bankapp-deployment.yml (line 28–29)
• helm/bankapp/templates/mysqlStatefulSet.yml (line 27)
• helm/bankapp/templates/deployment.yml (line 40)

All workloads in the bank namespace consume the bank-secret. No further changes required.

kubernetes/bankapp-service.yaml (1)

8-9: Ensure service selector matches deployment labels.

The Service targets pods with app: bankapp. Please verify that your Deployment manifests use exactly the same app: bankapp label so traffic is routed correctly.

kube/mysql-service.yml (1)

1-17: Headless service definition looks correct.
The clusterIP: None configuration and selector app: bankapp align with the StatefulSet. This headless Service will provide stable network identities for the MySQL pods.

kube/configmap.yml (1)

1-9: ConfigMap correctly centralizes database configuration.
Keys MYSQL_DATABASE, SPRING_DATASOURCE_USERNAME, and SPRING_DATASOURCE_URL are properly scoped to the bank namespace, and this resource follows best practices for separating configuration from code.

kubernetes/mysql-service.yml (1)

1-17: Service specification is correct once deduplicated.
Assuming consolidation and proper selectors, the clusterIP: None headless Service will provide stable DNS entries for each StatefulSet pod.

kube/bank-deployement.yml (1)

19-23: Environment variable sourcing is correctly configured.
The SPRING_DATASOURCE_* variables are appropriately loaded from the bank-configmap and bank-secret, following best practices for dynamic configuration and secret management.

kubernetes/bank-deployement.yml (2)

1-7: Consolidate duplicate manifests.
You have two near-identical deployment files (kube/bank-deployement.yml and kubernetes/bank-deployement.yml). Consider merging them into a single manifest to prevent configuration drift.


19-23: Configuration references look good.
The container environment correctly pulls credentials from bank-configmap and bank-secret, securing sensitive data and enabling flexible configuration.

kubernetes/mysql-deployment.yml (1)

39-49: Confirm volumeClaimTemplates placement.
Ensure the volumeClaimTemplates section is correctly indented under spec of the StatefulSet. Misaligned templates can prevent your persistent volumes from provisioning.

Comment on lines +1 to +4
kind: Namespace
apiVersion: v1
metadata:
name: bank
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Consolidate duplicate Namespace manifests
It looks like the bank Namespace is defined here and also in kubernetes/bankapp-namespace.yaml. Maintaining two separate definitions can lead to drift and confusion—please consolidate into a single manifest.

Comment on lines +7 to +9
data:
MYSQL_ROOT_PASSWORD: VGVzdEAxMjM=
SPRING_DATASOURCE_PASSWORD: VGVzdEAxMjM=
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Avoid committing plaintext credentials
Storing base64-encoded passwords (Test@123) directly in version control poses a security risk. Consider using a sealed Secret (e.g., SealedSecret), an external vault, or Git-encrypted secrets to manage sensitive data.

Comment on lines 1 to +10
kind: Secret
apiVersion: v1
metadata:
name: mysql-secret
namespace: bankapp-namespace
type: Opaque
name: bank-secret
namespace: bank

type: opaque
data:
MYSQL_ROOT_PASSWORD: VGVzdEAxMjM= # Base64 for "Test@123"
SPRING_DATASOURCE_PASSWORD: VGVzdEAxMjM= # Base64 for "Test@123"
MYSQL_ROOT_PASSWORD: VGVzdEAxMjM=
SPRING_DATASOURCE_PASSWORD: VGVzdEAxMjM=
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Consolidate duplicate Secret manifests
The bank-secret is defined in both kube/secret.yml and this file. Managing parallel secret manifests increases the risk of drift. Please converge to a single location for secret definitions.

Comment on lines +13 to +16
- protocol: TCP
targetPort: 8080
port: 8081
nodePort: 30080
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Critical: Service targetPort mismatch with container port.
Your Service maps nodePort: 30080 and port: 8081 to targetPort: 8080, but the application listens on 8081 (per your Dockerfile). This mismatch will break traffic routing.

Apply this diff to correct it:

 spec:
   type: NodePort
   selector:
     app: app
   ports:
     - protocol: TCP
-      targetPort: 8080
+      targetPort: 8081
       port: 8081
       nodePort: 30080
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- protocol: TCP
targetPort: 8080
port: 8081
nodePort: 30080
spec:
type: NodePort
selector:
app: app
ports:
- protocol: TCP
targetPort: 8081
port: 8081
nodePort: 30080

Comment on lines +4 to +7
name: mysql-pv
namespace: bank
labels:
app: bankapp
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Remove namespace from PersistentVolume.
PersistentVolumes are cluster-scoped — specifying a namespace will cause the manifest to be rejected.

Apply this diff:

 metadata:
   name: mysql-pv
-  namespace: bank
   labels:
     app: bankapp

@@ -4,43 +4,34 @@ services:
image: mysql:latest
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Pin Docker image versions for stability.
Using mysql:latest and bankapp:latest may introduce breaking changes when upstream images update. Specify exact tags (e.g., mysql:8.0.33, bankapp:1.2.0) to ensure reproducible builds.

Also applies to: 18-18

Comment on lines +7 to +9
MYSQL_ROOT_PASSWORD: Test@123
MYSQL_DATABASE: bankappdb
ports:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Quote environment variable values.
Unquoted strings containing special characters (like @ in passwords or ? and & in URLs) can be misinterpreted by YAML parsers. For example:

MYSQL_ROOT_PASSWORD: "Test@123"
SPRING_DATASOURCE_URL: "jdbc:mysql://mysql:3306/bankappdb?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=UTC"

Comment on lines +22 to +23
SPRING_DATASOURCE_URL: jdbc:mysql://mysql:3306/bankappdb?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=UTC
SPRING_DATASOURCE_PASSWORD: Test@123
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Ensure port mapping matches the app’s exposed port.
The application now listens on port 8081 (per your Dockerfile and Kubernetes manifests), but this maps "8080:8080". Update to:

- - "8080:8080"
+ - "8081:8081"

Committable suggestion skipped: line range outside the PR's diff.

containers:
- name: mysql
image: mysql:8.0 # Use a specific, stable version for production
image: mysql:latest
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Avoid floating latest image tags.
Referencing mysql:latest in a StatefulSet can lead to unpredictable upgrades. Pin to a specific, tested version (e.g., mysql:8.0.33) for consistency across environments.

image: swayamnakshane/mybank:latest
ports:
- containerPort: 8080
- containerPort: 8080
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix ports indentation and port value.
Line 22 is misindented and declares containerPort: 8080, conflicting with other manifests that expose port 8081. Adjust indentation (8 spaces under containers:) and change to 8081.

🧰 Tools
🪛 YAMLlint (1.35.1)

[warning] 22-22: wrong indentation: expected 8 but found 10

(indentation)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments