@@ -240,12 +240,7 @@ cat services.json | jq -c '.' | while read -r service; do
240240 if [ " $current_image " != " $image " ]; then
241241 echo " ⚠ Image mismatch detected!"
242242 echo " Updating deployment with new image..."
243-
244- # Generate full deployment manifest (includes managed-by label)
245- create_deployment_yaml " $name " " $image " " $ports " " $env_vars " " $env_file "
246-
247- # Apply deployment manifest (this updates labels too)
248- kubectl apply -f " deployment-${name} .yaml"
243+ kubectl set image deployment/" $name " " $name =$image " -n " $NAMESPACE "
249244
250245 echo " Waiting for rollout to complete (timeout: 5 minutes)..."
251246 if kubectl rollout status deployment/" $name " -n " $NAMESPACE " --timeout=300s; then
@@ -256,20 +251,6 @@ cat services.json | jq -c '.' | while read -r service; do
256251 fi
257252 else
258253 echo " ✓ Image is up to date, no action needed"
259-
260- # Ensure deployment has proper labels even if image hasn't changed
261- echo " Ensuring deployment has proper labels..."
262- create_deployment_yaml " $name " " $image " " $ports " " $env_vars " " $env_file "
263- kubectl apply -f " deployment-${name} .yaml"
264- echo " ✓ Labels synchronized"
265- fi
266-
267- # Ensure service exists and has proper configuration (ports may have changed)
268- if [ ! -z " $ports " ] && [ " $ports " != " null" ]; then
269- echo " Ensuring service exists with correct ports..."
270- create_service_yaml " $name " " $ports "
271- kubectl apply -f " service-${name} .yaml"
272- echo " ✓ Service synchronized"
273254 fi
274255 else
275256 echo " ⚡ Deployment '$name ' does not exist, creating new deployment..."
0 commit comments