Skip to content

Conversation

asafchen-dig
Copy link

This PR addresses the connectivity issues between the PetClinic application and the FlaskDB service by:

  1. Adding proper MongoDB configuration in application.properties
  2. Providing Kubernetes deployment configuration for the FlaskDB service

Changes Made

1. Application Configuration

Created src/main/resources/application.properties with proper MongoDB connection settings:

  • Updated MongoDB host to use proper Kubernetes DNS name
  • Configured database connection properties
  • Added management endpoints for monitoring

2. Kubernetes Deployment Configuration

The following deployment configuration should be applied to create the FlaskDB service:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: petclinic-flaskdb
  labels:
    app: petclinic-flaskdb
spec:
  replicas: 1
  selector:
    matchLabels:
      app: petclinic-flaskdb
  template:
    metadata:
      labels:
        app: petclinic-flaskdb
    spec:
      containers:
      - name: mongodb
        image: mongo:4.4
        ports:
        - containerPort: 27017
        resources:
          requests:
            memory: "256Mi"
            cpu: "200m"
          limits:
            memory: "512Mi"
            cpu: "500m"
        readinessProbe:
          tcpSocket:
            port: 27017
          initialDelaySeconds: 15
          periodSeconds: 10
        livenessProbe:
          tcpSocket:
            port: 27017
          initialDelaySeconds: 30
          periodSeconds: 20
        volumeMounts:
        - name: mongodb-data
          mountPath: /data/db
      volumes:
      - name: mongodb-data
        emptyDir: {}

And the corresponding service:

apiVersion: v1
kind: Service
metadata:
  name: petclinic-flaskdb
spec:
  selector:
    app: petclinic-flaskdb
  ports:
    - protocol: TCP
      port: 27017
      targetPort: 27017
  type: ClusterIP

Testing Instructions

  1. Apply the Kubernetes configurations
  2. Deploy the updated application with new properties
  3. Test the /api/clinic-feedback/count endpoint
  4. Verify no connection errors occur

Related Issues

  • Fixes connectivity issues with the external petclinic-flaskdb service
  • Resolves RuntimeExceptions in the feedback count API

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.

1 participant