The use of ${random-word} creates a new route with every 'cf push'
If I have a manifest.yml with the following entry:
host: cloud-services-test-${random-word}
Every time I push the application (cf push), it creates a new route, instead of reusing the one that is already bound to the application.
Observed this regression (about a week or two back, cf exhibited the right behavior with the same manifest.yml) with cf version 6.1.2-6a013ca as well as today's master build 6.1.2-91a805a.
We have created an issue in Pivotal Tracker to manage this. You can view the current status of your issue at: https://www.pivotaltracker.com/story/show/71696394. This repo is managed by the 'CLI' team.
So, I understand your pain, but I don't think that's a regression. That's absolutely 100% the correct behavior as it was initially specified.
My personal belief is that ${random-word} is a harmful feature and that it shouldn't have been implemented because it's hard to understand what the cli will do with that.
Do you have a real use case for ${random-word}, or were you just pushing from a repository with a manifest.yml that you had cloned? I'm very curious if there's some real use case for this that we've ignored, because mostly we believed that this would be used in demos and testing.
My use case is indeed for demos. I expect users to clone repositories such as https://github.com/cloudfoundry-samples/spring-music, build, and push. Anything other than using ${random-word} is not going to give them good user experience (everyone will get "route taken" error).
Assuming ${random-word} continued to be supported, the current behavior isn't useful. I imagine a fix would be to check if host has ${random-word} in it. If so, check if there is a route already bound, and if there is one, then just use that.
Is there any use case that is served by the current behavior?
Well the biggest problem with the behavior you describe is that ${random-word} is not the way we expect users with "real" apps on CF to use manifests. I realize that's a loaded term, so let's maybe discuss a potential scenario. Let's suppose that we have a developer with this manifest:
---
applications:
- name: my-cool-app
- host: really-good-hostname
and they decide they need to change their hostname thusly:
---
applications:
- name: my-cool-app
- host: even-better-hostname
In this case, we absolutely need to change their hostname because the manifest is the source of truth for what the desired state of their application is.
For your use case, if you think about what the manifest description says, the behavior actually makes a lot of sense. The hostname for the app is a random word. That means that each time the manifest is evaluated (e.g.: in the context of a cf push), its hostname will be different.
really-good-hostname -> even-better-hostname use case will work just fine if you check for ${random-word} before deciding to not change the hostname (as described in my earlier reply).
I think ${random-word} serves a particular use case. Its behavior should make sense in that context. As far as my experience with it goes, it doesn't.
Perhaps I'm misunderstanding your usage scenario, but ${random-word} checking would not work if two different users were deploying to the same CF environment.
This is a longer term issue we're looking into, but I don't think we're going to change random word as it stands today.
${random-word} checking would not work if two different users were deploying to the same CF environment
Not true.
Consider:
host: spring-music-${random-word}
domain: cfapps.io
Both User1 and User2 clone the same repo and:
- User1 pushes the app and gets
spring-music-misunderstood-feature.cfapps.io - User2 pushes the same app and gets
spring-music-please-fix.cfapps.io
What am I missing?
How would cf know that User1 "owns" misunderstood-feature vs User2 "owns" please-fix?
That's the beauty of randomness. cf doesn't need to know who owns it. If it is random enough, no one will have owned it before (and that is how it has been working in practice).
And then how would you run further cf commands on that deployed application?
I think you are confusing hostname with app name.
$ cf push
...
App started
Showing health and status for app spring-music in org my-org / space development as [email protected]...
OK
requested state: started
instances: 1/1
usage: 512M x 1 instances
urls: spring-music-misunderstood-feature.cfapps.io
state since cpu memory disk
#0 running 2014-05-20 05:01:16 PM 0.0% 258.1M of 512M 110.9M of 1G
$ cf app spring-music
...
$ cf bind-service spring-music my-service
I'm trying to understand your scenario better... If you have a bunch of users push the same application (from the sample repo and manifest), yes creating a random word for the route would give different routes, but then all applications would have the same name then right? Or are you using random word there as well?
But app names are namespaced in the org and space. Aren't they?
Okay, I think I understand your scenario now. (It wasn't clear if you were using multiple spaces or not.)
This is one of the challenges with manifest processing. We're looking to make some other changes here.
I think if you follow my suggestion in https://github.com/cloudfoundry/cli/issues/173#issuecomment-43679815 that should fix this issue and make ${random-word} useful again.
David shall we move the story to your backlog?
Jesse and Alex
@d I'm inclined to keep this as wontfix because of other work going on in manifests. But if you need to move it somewhere (instead of deleting it) that's fine.
I have the same concern as ramnivas. I'm writing manifest files for samples and the ${random-word} feature presented a useful option to avoid host naming collisions when users deploy these samples. I also find the lack of concern for backward compatibility somewhat frustrating, scripts and manifest that work with one cf version often fail with the next one.
@pvanrun thanks for chiming in, it's good to hear how people are using these features. We tried really hard for v6.0 to implement as many of the features from v5 as we could -- however some of them didn't make sense to us. All of the features we dropped support for were features that did not make any sense to us, any of the previous maintainers, or anyone on vcap dev. I must say that ${random-word} was absolutely one of these features.
My personal belief is that it's dangerous to give users these magical tools that make cf push Just Work™ without having to think about what you're doing. In the context of giving demos and showing people how to use CF, it seems to me that it would be a lot better to explain pushing an app, creating a route (and then, if creating the route fails, how to work around it with the --random-word flag, or by specifying their own hostname). I'd much rather users have to think about what they are doing than be confused when something suddenly doesn't work when they try to do it on their own.
I'm sorry that you've had a hard time maintaining scripts and manifests between versions of the CLI, but I do think that's a reality we all have to live with. Software changes and is never a really truly static thing, because its requirements (and the way we understand how it is used and should be used) changes every day. What I've tried to ensure is that when we do change behavior in a way that will break someone's script or manifest, is that we provide a helpful warning and description of what changed (and how to fix it). Perhaps we were a little aggressive in deprecating some things though.
Any additional feedback, comments or anecdotes you could relate to the issue of scripts and manifests breaking would be greatly appreciated by myself and the rest of the team.
@tjarratt @ramnivas Great conversation actually. :+1:
I'm going to close this issue but please reopen if the need occurs