Red Hat Bugzilla – Bug 1479660
MYSQL_DATABASE environment variable not available to other pods
Last modified: 2017-11-09 13:50:26 EST
Description of problem:
When adding a mysql datastore, the MYSQL_DATABASE environment variable is only available to the MYSQL deployment - it is not available as an environment variable to other deployments. It would be useful for it to be.
Version-Release number of selected component (if applicable):
Robin, we've added a service catalog tech preview feature in 3.6. It allows you to bind to services like mysql, which puts connection information into a secret that you can use as environment variables to your pods. Is this what you're looking for?
Have a look at
That sounds good - I had a quick look at the documentation, but it's about a million times easier to make sense of it by actually playing with it.
MYSQL_USER and MYSQL_PASSWORD are already automatically set up as secrets, but MYSQL_DATABASE was not. Will it now be added in 3.6?
And do you have an idea of when 3.6 is likely to be deployed to Online [Starter]?
Really appreciate your response.
Thanks very much
The service catalog is still in technology preview for 3.6. I'd have to defer to email@example.com on when it might be enabled for Online.
> MYSQL_USER and MYSQL_PASSWORD are already automatically set up as secrets, but MYSQL_DATABASE was not.
Ah, so you are saying the secret from the template here should also include the database?
@bparees, do you know what database is not included?
Changing the component to templates.
No particular reason, we can add it.
Commit pushed to master at https://github.com/openshift/origin
add db name to the provided secret
(In reply to Samuel Padgett from comment #3)
> The service catalog is still in technology preview for 3.6. I'd have to
> defer to firstname.lastname@example.org on when it might be enabled for Online.
We don't have a time yet when we'll enable it for Online. Though I expect starter to have it before OCP 3.7 ships and Pro to get it some point shortly after OCP 3.7 ships, pending upgrade schedule.
This is fixed, not sure when it'll make it into online, but the templates have been updated.
One question, the comment #0 said:
MYSQL_DATABASE environment variable is not available as an environment variable to other deployments.
Could I understand that app which is create from cakephp-mysql-example template, cakephp-mysql-example-*** pod also should have MYSQL_DATABASE shown?
No, the "all-in-one" templates don't need that information.
I have no idea how to test this bug, could you give some suggesion?
DB templates only create db pods, if create other deployments, no DB related env vars shown in other pods.
XiuJuan you can just confirm that the "database-name" is now a valid key in the db secret (along with database-user and database-password).
By virtue of it being available as a key in the secret, pods can reference the value as an environment variable via the downward api.
@Ben, thanks for your advice.
db secret has been exposed with database-name.
$ oc get secret mysql
NAME TYPE DATA AGE
mysql Opaque 4 1m
$ oc get secret mysql -o yaml