HappyTobi / cf-puppeteer

CF-Puppeteer is a zero-downtime deployment plugin bases on autopilot
https://cf-puppeteer.happytobi.com
Apache License 2.0
17 stars 4 forks source link

issue with splitting hostname from route #26

Open iKrushYou opened 4 years ago

iKrushYou commented 4 years ago

I've encountered an issue while trying various route paths (paths that used to work with the old contraband autopilot)

Here's my example:

cf zero-downtime-push armada-liquid -f pcf2/manifest.yaml --legacy-push --vars-file pcf2/vars-uat.yaml --show-crash-log

manifest.yaml

---
default_envs: &default_envs
  SPRING_PROFILES_ACTIVE: common,dev,cloud
  TZ: GMT
defaults: &defaults
  buildpacks:
    - java_buildpack_offline
  env:
    *default_envs
  timeout: 120
  services:
    - vault-service
applications:
  - name: armada-openshift
    routes:
      - route: armada-openshift((domain_suffix))
    <<: *defaults
    path: armada-openshift-1.0.0-exec.jar

I have tried two variations so far that do not work

vars-uat.yaml

domain_suffix: "-uat.apps.cf2.com"

expected: armada-openshift-uat.apps.cf2.com result: armada-uat.apps.cf2.com

check if routes should be added or switched from existing one
map routes to new application armada-openshift
map route [map-route armada-openshift apps.cf2.com --hostname armada-uat]Creating route armada-uat.apps.cf2.com for org TZU0 / space tzu0_uat as akrush...
OK
Route armada-uat.apps.cf2.com already exists
Adding route armada-uat.apps.cf2.com to app armada-openshift in org TZU0 / space tzu0_uat as akrush...

and

vars-uat.yaml

domain_suffix: ".uat.apps.cf2.com"

expected: armada-openshift.uat.apps.cf2.com result: error

check if routes should be added or switched from existing one
map routes to new application armada-openshift
map route [map-route armada-openshift apps.cf2.com --hostname armada.uat]Creating route armada.uat.apps.cf2.com for org TZU0 / space tzu0_uat as akrush...
FAILED
Error resolving route:
Server error, status code: 400, error code: 210001, message: The route is invalid: host format
could not map route armada.uat.apps.cf2.com to application%!(EXTRA string=armada-openshift)

both of these setups result in non-optimal results where the former sets all routes to armada-uat.apps.cf2.com instead of the full route name

and the latter just doesn't work at all

This does work with the following though:

vars-uat.yaml

domain_suffix: ".apps.cf2.com"

To be completely honest, I don't know if it has to do with the vars file (although my guess would be no) however I am away from my work laptop right now so I wanted to post this before going to bed.

Best, Alex

iKrushYou commented 4 years ago

~After extensive trial and error it seems like this could be in part due to a caching error where it wasn't updating the host name~

It seems like my manifest i have provided is misleading. I have discovered that the hostname is defaulting to whatever is the FIRST application listed in the manifest. I actually have two other apps above that one. It actually looks more like this:

applications:
  - name: armada-core
    routes:
      - route: armada((domain_suffix))
    <<: *defaults
    path: armada-core-1.0.0-exec.jar
  - name: armada-openshift
    routes:
      - route: armada-openshift((domain_suffix))
    <<: *defaults
    path: armada-openshift-1.0.0-exec.jar

And this seems to be why it's defaulting to armada-uat instead of the expected value

HappyTobi commented 4 years ago

Hi @iKrushYou,

thanks for the issue. What kind of version you are using? There was an issue in Version 1.2.0, so you have to use Version 1.2.1.

Kind regards

iKrushYou commented 4 years ago

~I believe~ I am using 1.2.1

Sorry for not specifying earlier

HappyTobi commented 4 years ago

@iKrushYou

thx, I will check that. And give you some feedback.

HappyTobi commented 4 years ago

@iKrushYou so I checked the issue and the problem it not the replacement / suffix, it's the multiapp manifest. I will bring that feature in 1.3.0.

iKrushYou commented 4 years ago

Oh that also makes sense. I guess I kind of assumed it would work with multiple apps. Thanks for looking into it!

HappyTobi commented 4 years ago

I'm working on it. Home I can release the new version in 2 Weeks, till then you have to split sorry.