Skip to content

K8s#27

Open
Swayamnakshane wants to merge 38 commits intoLondheShubham153:DevOpsfrom
Swayamnakshane:k8s
Open

K8s#27
Swayamnakshane wants to merge 38 commits intoLondheShubham153:DevOpsfrom
Swayamnakshane:k8s

Conversation

@Swayamnakshane
Copy link

@Swayamnakshane Swayamnakshane commented Apr 18, 2025

kuberntes files changed

Summary by CodeRabbit

  • New Features

    • Added new Kubernetes manifests for deploying the banking application and MySQL database with refined Deployments, StatefulSets, Services, ConfigMaps, Secrets, and PersistentVolumes.
    • Introduced a multi-node Kubernetes cluster configuration for local development using kind.
    • Updated Dockerfile and docker-compose configurations for enhanced containerization and orchestration.
  • Improvements

    • Standardized resource names, namespaces, labels, and environment variable management across Kubernetes manifests.
    • Improved database connection settings and secret handling for security and consistency.
    • Enhanced storage management with updated PersistentVolume and PersistentVolumeClaim resources.
    • Upgraded container images and runtime configurations, including port and startup command adjustments.
  • Removals

    • Removed unused Kubernetes resources such as Ingress, ClusterIssuer, and HorizontalPodAutoscaler manifests.

@coderabbitai
Copy link

coderabbitai bot commented Apr 18, 2025

Walkthrough

This update introduces significant refactoring and restructuring of containerization and Kubernetes deployment resources for a banking application. The Dockerfile and docker-compose files are modernized and simplified, updating images, paths, and configuration details. Kubernetes manifests are extensively overhauled: new resources are added for deployments, services, persistent storage, config maps, and secrets, while several outdated or redundant files are removed. Notably, MySQL is now managed via StatefulSet with persistent storage, and the application deployment and service definitions are updated for improved clarity and alignment with best practices. Environment variables, namespaces, and resource names are standardized throughout.

Changes

File(s) Change Summary
Dockerfile, docker-compose.yml Refactored Dockerfile to update base images, working directories, and runtime configurations. Docker Compose file updated for environment variable syntax, image naming, service configuration, and minor formatting.
kubernetes/bank-deployment.yml, kubernetes/bank-service.yml Added new Kubernetes Deployment and Service manifests for the banking app in the bank namespace, configuring replicas, resource limits, environment variables, and service exposure.
kubernetes/bankapp-deployment.yml Updated deployment manifest: changed metadata, labels, image, container name, environment variable sources, and increased replicas. Simplified and standardized configuration.
kubernetes/bankapp-hpa.yml, kubernetes/bankapp-ingress.yml, kubernetes/letsencrypt-clusterissuer.yaml Deleted Kubernetes manifests for HorizontalPodAutoscaler, Ingress, and ClusterIssuer, removing autoscaling, ingress routing, and certificate management resources.
kubernetes/bankapp-namespace.yaml, kubernetes/bankapp-service.yaml Simplified namespace and service manifests: renamed resources, updated namespaces, changed service type and ports, and removed labels.
kubernetes/config.yml, kubernetes/configMap.yml, kubernetes/secret.yml, kubernetes/persistentVolumeClaim.yml, kubernetes/peristentVolume.yml, kubernetes/mysql-service.yml, kubernetes/mysql-statefullset.yml Added new Kubernetes resources: kind cluster config, ConfigMap, Secret, PersistentVolumeClaim, PersistentVolume, MySQL Service (headless), and MySQL StatefulSet for robust database deployment and configuration management.
kubernetes/configmap.yaml, kubernetes/secrets.yaml, kubernetes/mysql-deployment.yml, kubernetes/mysql-service.yaml, kubernetes/persistent-volume-claim.yaml, kubernetes/persistent-volume.yaml Updated existing Kubernetes manifests: renamed resources, changed namespaces, updated storage sizes and classes, adjusted environment variable sources, converted MySQL deployment to StatefulSet, and improved volume management.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant BankApp Pod
    participant MySQL Pod
    participant ConfigMap/Secret
    participant PersistentVolume

    User->>BankApp Pod: Sends request (port 8080/8081)
    BankApp Pod->>ConfigMap/Secret: Reads DB credentials/config
    BankApp Pod->>MySQL Pod: Connects to MySQL (port 3306)
    MySQL Pod->>PersistentVolume: Reads/Writes data
    MySQL Pod->>ConfigMap/Secret: Reads DB credentials/config
    BankApp Pod-->>User: Returns response
Loading

Possibly related PRs

  • Created helm chart #13: Adds Helm chart templates for Kubernetes resources of the banking application, related to deployment and configuration management.

Suggested reviewers

  • LondheShubham153

Poem

🐇
In the warren of YAML and Docker delight,
We hopped through configs, making things right.
Stateful sets for data, secrets tucked away,
Pods and services ready for a bright new day.
With clusters and claims, our app’s future is clear,
The bank is now running—let’s all give a cheer!
🥕

Tip

⚡💬 Agentic Chat (Pro Plan, General Availability)
  • We're introducing multi-step agentic chat in review comments and issue comments, within and outside of PR's. This feature enhances review and issue discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments and add commits to existing pull requests.

📜 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 61224b9 and e852e2f.

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

🪧 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 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: 17

🔭 Outside diff range comments (1)
kubernetes/mysql-deployment.yml (1)

1-19: ⚠️ Potential issue

Duplicate StatefulSet manifest detected
You now have two StatefulSet definitions for MySQL (mysql-statefullset.yml vs. this mysql-deployment.yml) with different storage sizes and names. This will cause conflicts. Please consolidate into a single manifest or remove the redundant one.

🧹 Nitpick comments (12)
kubernetes/persistent-volume-claim.yaml (1)

7-12: Review storage settings.
storageClassName is set to standard and the request was reduced to 5Gi. Ensure the standard StorageClass exists in your target cluster and that 5Gi meets the application’s persistence requirements.

kubernetes/configMap.yml (1)

9-9: Quote the JDBC URL to prevent YAML parsing issues.

Your unquoted URL value contains : and ? characters which can be misinterpreted by some YAML parsers. Wrap it in double quotes:

-  SPRING_DATASOURCE_URL: jdbc:mysql://mysql:3306/bankappdb?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=UTC
+  SPRING_DATASOURCE_URL: "jdbc:mysql://mysql:3306/bankappdb?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=UTC"
Dockerfile (1)

2-6: Optimize Maven layer caching.

Copying the entire context before downloading dependencies invalidates the cache on every code change. Consider splitting into two steps:

FROM maven:3.9.6-eclipse-temurin-17-alpine AS builder
WORKDIR /app

# Copy only pom.xml first to cache dependency download
COPY pom.xml .
RUN mvn dependency:go-offline

# Now copy the rest and build
COPY src ./src
RUN mvn clean install -DskipTests=true

This will speed up iterative builds.

kubernetes/mysql-service.yml (2)

12-12: Remove trailing whitespace.

There’s an extra space after 3306 which may trigger lint errors.

-    port: 3306 
+    port: 3306
🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 12-12: trailing spaces

(trailing-spaces)


14-15: Remove extra blank lines at EOF.

Trimming unnecessary empty lines improves YAML cleanliness and avoids lint warnings.

🧰 Tools
🪛 YAMLlint (1.35.1)

[warning] 14-14: too many blank lines

(1 > 0) (empty-lines)

kubernetes/persistentVolumeClaim.yml (1)

1-2: Inconsistent filename casing vs. repo conventions.
The filename persistentVolumeClaim.yml uses camelCase, while most manifests in this repo follow kebab-case (e.g. persistent-volume.yaml). Rename to persistent-volume-claim.yaml for consistency.

kubernetes/bankapp-service.yaml (1)

1-5: Filename and resource name mismatch.
This file is named bankapp-service.yaml but defines a Service bank-svc. For clarity, rename to bank-service.yaml or bank-svc.yaml to align the filename with the resource it contains.

kubernetes/configmap.yaml (1)

1-5: Use a descriptive filename.
configmap.yaml is generic; consider renaming to bank-configmap.yaml to reflect the ConfigMap name and improve discoverability.

kubernetes/persistent-volume.yaml (1)

8-14: Explicitly set reclaim policy and hostPath type.
It's best practice to define:

persistentVolumeReclaimPolicy: Retain

and under hostPath add:

type: DirectoryOrCreate

to ensure the directory is present and reclaim behavior is clear.

kubernetes/mysql-statefullset.yml (1)

35-48: Clean up YAML formatting
There are trailing spaces, an extra blank line, and an indentation mismatch in the volume claim section which will trigger lint errors.

Please remove trailing spaces on line 35, delete the blank line at 48, and adjust indentation under accessModes to 6 spaces:

-      accessModes:
-       - ReadWriteOnce
+      accessModes:
+        - ReadWriteOnce
🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 35-35: trailing spaces

(trailing-spaces)


[warning] 44-44: wrong indentation: expected 6 but found 7

(indentation)


[warning] 48-48: too many blank lines

(1 > 0) (empty-lines)

docker-compose.yml (1)

22-22: Quote complex URL values
The JDBC URL contains multiple colons and parameters—wrap it in quotes to ensure proper parsing by the YAML engine.

-        SPRING_DATASOURCE_URL: jdbc:mysql://mysql:3306/bankappdb?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=UTC
+        SPRING_DATASOURCE_URL: "jdbc:mysql://mysql:3306/bankappdb?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=UTC"
kubernetes/bankapp-deployment.yml (1)

45-60: Clean up trailing spaces and indentation
Several lines (e.g., trailing spaces on comments and blank lines) will fail YAML lint. Please run yamllint or remove trailing whitespace and ensure consistent indentation.

🧰 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 61224b9.

📒 Files selected for processing (23)
  • Dockerfile (1 hunks)
  • docker-compose.yml (1 hunks)
  • kubernetes/bank-deployment.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.yml (1 hunks)
  • kubernetes/configmap.yaml (1 hunks)
  • kubernetes/letsencrypt-clusterissuer.yaml (0 hunks)
  • kubernetes/mysql-deployment.yml (2 hunks)
  • kubernetes/mysql-service.yaml (1 hunks)
  • kubernetes/mysql-service.yml (1 hunks)
  • kubernetes/mysql-statefullset.yml (1 hunks)
  • kubernetes/peristentVolume.yml (1 hunks)
  • kubernetes/persistent-volume-claim.yaml (1 hunks)
  • kubernetes/persistent-volume.yaml (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-ingress.yml
  • kubernetes/letsencrypt-clusterissuer.yaml
  • kubernetes/bankapp-hpa.yml
🧰 Additional context used
🪛 YAMLlint (1.35.1)
kubernetes/secrets.yaml

[error] 11-11: trailing spaces

(trailing-spaces)

kubernetes/mysql-service.yaml

[error] 11-11: trailing spaces

(trailing-spaces)


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

(indentation)

kubernetes/mysql-service.yml

[error] 12-12: trailing spaces

(trailing-spaces)


[warning] 14-14: too many blank lines

(1 > 0) (empty-lines)

kubernetes/mysql-statefullset.yml

[warning] 30-30: too many spaces after colon

(colons)


[warning] 34-34: too many spaces after colon

(colons)


[error] 35-35: trailing spaces

(trailing-spaces)


[warning] 44-44: wrong indentation: expected 6 but found 7

(indentation)


[warning] 48-48: too many blank lines

(1 > 0) (empty-lines)

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)

🪛 Gitleaks (8.21.2)
kubernetes/secret.yml

1-9: Possible Kubernetes Secret detected, posing a risk of leaking credentials/tokens from your deployments

(kubernetes-secret-yaml)

🔇 Additional comments (6)
kubernetes/persistent-volume-claim.yaml (1)

4-5:

Details

✅ Verification successful

Verify PVC renaming consistency.
The PVC was renamed from mysql-pvc in bankapp-namespace to bank-pvc in bank. Ensure no remaining references to the old claim in StatefulSets or Services.


🏁 Script executed:

rg -n "mysql-pvc"

Length of output: 17


PVC renaming consistency verified

  • Ran rg -n "mysql-pvc" across the repo; no occurrences of the old PVC name remain.
Dockerfile (1)

11-13: Align exposed port with Kubernetes Service.

You’ve set EXPOSE 8081 here but your bank‑service manifest targets port 8080. Confirm whether your application listens on 8081, or adjust one side for consistency to avoid routing failures.

kubernetes/bank-service.yml (1)

9-12: Verify YAML list indentation under ports.

The dash (- protocol: TCP) should be indented under ports: to form a proper YAML sequence. For example:

  ports:
    - protocol: TCP
      port: 8080
      targetPort: 8080

Ensure this indentation matches in your file to prevent manifest parsing errors.

kubernetes/mysql-service.yaml (2)

11-11: Remove trailing whitespace.
There's an extra space after mysql which YAML linters flag. Remove it to avoid parsing issues.
[ suggest_nitpick ]

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 11-11: trailing spaces

(trailing-spaces)


10-11: Verify service selector matches pod labels.
The service selector is app: mysql, but ensure your MySQL StatefulSet/Deployment pods are labeled exactly app: mysql. A mismatch will cause the service to select zero endpoints.

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 11-11: trailing spaces

(trailing-spaces)

kubernetes/configmap.yaml (1)

7-10: Verify ConfigMap usage in Deployments.
Ensure that bank-configmap is referenced in your Deployment manifests (e.g., bank-deployment.yml) via envFrom or explicit env entries so these values are injected correctly.

@@ -1,6 +1,4 @@
apiVersion: v1
kind: Namespace
apiVersion: v1
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Confirm namespace renaming and manifest consistency.
The namespace was renamed from bankapp-namespace to bank and the apiVersion/kind order change is harmless. Ensure all Kubernetes manifests and tooling (Helm charts, scripts, GitOps config, etc.) reference the new namespace.

Run this from the repo root to catch any stray references:

Also applies to: 4-4


🏁 Script executed:

#!/bin/bash
rg -n "bankapp-namespace"

Length of output: 2179


Update lingering references to the old namespace
Your rename from bankapp-namespace to bank is correct, but there are still stray references in docs and Helm charts. Please update all of the following to use bank instead:

  • kubernetes/README.md
    • Line 127: --dest-namespace bankapp-namespace
    • Line 208: kubectl get certificate -n bankapp-namespace
    • Line 217: kubectl get all -n bankapp-namespace
    • Line 238: kubectl top pods -n bankapp-namespace
  • helm/bankapp/values.yaml (line 2: namespace: bankapp-namespace)
  • helm/bankapp/templates/
    • vpa.yaml (namespace default)
    • secrets.yml
    • service.yml
    • persistentVolumeClaim.yml
    • persistentVolume.yml
    • namespace.yml
    • mysqlStatefulSet.yml
    • mysqlService.yml
    • ingress.yml
    • hpa.yaml
    • deployment.yml
    • configMap.yml (including the SPRING_DATASOURCE_URL host)

Ensure every default "bankapp-namespace" and hard‑coded bankapp-namespace is replaced with bank.

name: bank-secret
namespace: bank

type: opaque
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 Secret type casing and remove trailing whitespace.
The field type: opaque is invalid; it must be capitalized as Opaque per Kubernetes API. Also remove the trailing spaces on line 11 to satisfy linting.

Apply this diff:

@@ -7,1 +7,1 @@
-type: opaque
+type: Opaque
@@ -11,1 +11,0 @@
- 

Also applies to: 11-11

@@ -0,0 +1,10 @@
kind: clster
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Correct the kind typo to Cluster.
The field kind: clster is misspelled and will prevent the kind cluster from provisioning. It should read Cluster.

Apply this diff:

@@ -1,1 +1,1 @@
-kind: clster
+kind: Cluster
📝 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
kind: clster
kind: Cluster

Comment on lines +1 to +9
apiVersion: v1
kind: Secret
metadata:
name: bank-secret
namespace: bank
type: Opaque
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

Duplicate bank-secret Secret detected.
There are two manifests (secrets.yaml and secret.yml) both defining bank-secret in the same bank namespace. This will cause a resource conflict on apply. Consolidate into a single Secret manifest or rename one to avoid collisions.

Also consider using sealed-secrets or an external secret store (Vault, AWS Secrets Manager, etc.) for more secure credentials management.

🧰 Tools
🪛 Gitleaks (8.21.2)

1-9: Possible Kubernetes Secret detected, posing a risk of leaking credentials/tokens from your deployments

(kubernetes-secret-yaml)

Comment on lines +4 to +5
name: bank-pvc
namespace: 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

Flag invalid namespace on PersistentVolume.

PersistentVolumes are cluster‐scoped resources and do not support a metadata.namespace field. Remove the namespace: bank entry to avoid manifest validation errors.

labels:
app: bankapp
spec:
replica: 3
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Correct replica field to replicas
The field replica: 3 is invalid—it should be replicas: 3—otherwise Kubernetes will ignore your replica count.

-spec:
-  replica: 3
+spec:
+  replicas: 3
📝 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
replica: 3
spec:
replicas: 3

Comment on lines +7 to +8
MYSQL_ROOT_PASSWORD: Test@123
MYSQL_DATABASE: bankappdb
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
The root password Test@123 is hard‑coded in your Compose file. This exposes sensitive data. Consider using Docker secrets or environment files (.env) to inject credentials securely.

Comment on lines 25 to +42
env:
- name: SPRING_DATASOURCE_URL
- name: SPRING_DATASOURCE_PASSWORD
valueFrom:
configMapKeyRef:
name: bankapp-config
key: SPRING_DATASOURCE_URL
secretKeyRef:
name: bank-secret
key: SPRING_DATASOURCE_PASSWORD

- name: SPRING_DATASOURCE_USERNAME
valueFrom:
configMapKeyRef:
name: bankapp-config
name: bank-configmap
key: SPRING_DATASOURCE_USERNAME
- name: MYSQL_DATABASE

- name: SPRING_DATASOURCE_URL
valueFrom:
configMapKeyRef:
name: bankapp-config
key: MYSQL_DATABASE
- name: SPRING_DATASOURCE_PASSWORD
valueFrom:
secretKeyRef:
name: mysql-secret
key: SPRING_DATASOURCE_PASSWORD
# readinessProbe:
# httpGet:
# path: /actuator/health # Update this based on your app's health endpoint
# port: 8080
# initialDelaySeconds: 10
# periodSeconds: 5
# livenessProbe:
# httpGet:
# path: /actuator/health # Update this based on your app's health endpoint
# port: 8080
# initialDelaySeconds: 30
# periodSeconds: 10
name: bank-configmap
key: SPRING_DATASOURCE_URL
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Correct Secret vs ConfigMap refs and names

  • The password is pulled via configMapKeyRef from bank-secret—this must be secretKeyRef.
  • The ConfigMap name bank-configmap doesn’t match the actual ConfigMap bank-config.

These mismatches will prevent your app from getting credentials.

-        - name: SPRING_DATASOURCE_PASSWORD
-          valueFrom:
-            configMapKeyRef:
-              name: bank-secret
-              key: SPRING_DATASOURCE_PASSWORD
+        - name: SPRING_DATASOURCE_PASSWORD
+          valueFrom:
+            secretKeyRef:
+              name: bank-secret
+              key: SPRING_DATASOURCE_PASSWORD

-        - name: SPRING_DATASOURCE_USERNAME
-          valueFrom:
-            configMapKeyRef:
-              name: bank-configmap
-              key: SPRING_DATASOURCE_USERNAME
+        - name: SPRING_DATASOURCE_USERNAME
+          valueFrom:
+            configMapKeyRef:
+              name: bank-config
+              key: SPRING_DATASOURCE_USERNAME

-        - name: SPRING_DATASOURCE_URL
-          valueFrom:
-            configMapKeyRef:
-              name: bank-configmap
-              key: SPRING_DATASOURCE_URL
+        - name: SPRING_DATASOURCE_URL
+          valueFrom:
+            configMapKeyRef:
+              name: bank-config
+              key: SPRING_DATASOURCE_URL

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

image: swayamnakshane/bank
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.

💡 Verification agent

🧩 Analysis chain

Verify container port matches Dockerfile
The containerPort is set to 8080, but the updated Dockerfile may expose 8081. Please verify and update to the correct port or adjust your Dockerfile accordingly.

Run this script to confirm the exposed port:


🏁 Script executed:

#!/bin/bash
# Check which port is exposed in the Dockerfile
rg -n '^EXPOSE' .

Length of output: 47


Update containerPort to match Dockerfile

The Dockerfile exposes port 8081, but the Kubernetes manifest still uses 8080. Please align them by updating the deployment spec.

• File: kubernetes/bankapp-deployment.yml
• Line: 22

-          - containerPort: 8080
+          - containerPort: 8081
📝 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
- containerPort: 8080
- containerPort: 8081
🧰 Tools
🪛 YAMLlint (1.35.1)

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

(indentation)

Comment on lines 31 to 35
- name: MYSQL_DATABASE
valueFrom:
configMapKeyRef:
name: bankapp-config
name: bank-configmap
key: MYSQL_DATABASE
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 ConfigMap reference name
MYSQL_DATABASE is pulled from bank-configmap, but your ConfigMap is named bank-config. This mismatch will prevent the database from being set up.

-        - name: MYSQL_DATABASE
-          valueFrom:
-            configMapKeyRef:
-              name: bank-configmap
-              key: MYSQL_DATABASE
+        - name: MYSQL_DATABASE
+          valueFrom:
+            configMapKeyRef:
+              name: bank-config
+              key: MYSQL_DATABASE
📝 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
- name: MYSQL_DATABASE
valueFrom:
configMapKeyRef:
name: bankapp-config
name: bank-configmap
key: MYSQL_DATABASE
- name: MYSQL_DATABASE
valueFrom:
configMapKeyRef:
name: bank-config
key: MYSQL_DATABASE

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