Skip to content

Add mysql db access to productpage sample.#473

Closed
saumoh wants to merge 20 commits intoistio:masterfrom
saumoh:master
Closed

Add mysql db access to productpage sample.#473
saumoh wants to merge 20 commits intoistio:masterfrom
saumoh:master

Conversation

@saumoh
Copy link
Copy Markdown
Contributor

@saumoh saumoh commented Jul 17, 2017

The sample bookinfo app has productpage as one of the micro services. This patch optionally add's a mysql db access from the productpage microservice. This could be helpful in checking out the following use cases of a service mesh:

  • Envoy tcp proxy.
  • Bypassing Envoy for mysql db access
  • hybrid use case where the db is not part of k8s infrastructure.

I'd be happy to change this pr request to make it more useful for general consumption.
One option that was discussed was to create a rev. (v2) of productpage micro service which includes the db access and leave v1 version as is.

@googlebot
Copy link
Copy Markdown
Collaborator

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If your company signed a CLA, they designated a Point of Contact who decides which employees are authorized to participate. You may need to contact the Point of Contact for your company and ask to be added to the group of authorized contributors. If you don't know who your Point of Contact is, direct the project maintainer to go/cla#troubleshoot.
  • In order to pass this check, please resolve this problem and have the pull request author add another comment and the bot will run again.

@googlebot googlebot added the cla: no Set by the Google CLA bot to indicate the author of a PR has not signed the Google CLA. label Jul 17, 2017
@istio-testing
Copy link
Copy Markdown
Collaborator

Hi @saumoh. Thanks for your PR.

I'm waiting for a istio member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@googlebot
Copy link
Copy Markdown
Collaborator

CLAs look good, thanks!

@googlebot googlebot added cla: yes and removed cla: no Set by the Google CLA bot to indicate the author of a PR has not signed the Google CLA. labels Jul 20, 2017
@saumoh
Copy link
Copy Markdown
Contributor Author

saumoh commented Jul 20, 2017

@frankbu, @rshriram I've created another version of the productpage image and a mysql container that is pre-populated with the required db entry.
let me know if i should ping other folks as well or not.

Copy link
Copy Markdown
Member

@rshriram rshriram left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is good start @saumoh . Thank you for diversifying the example with more use cases. We need e2e integration test (like the way we have for almost every task in Istio). Otherwise, these things go out of sync quickly.

The way the system is setup now, will only work in K8S. To showcase external access or hybrid deployment stuff, we need to be able to provide username, password and hostname associated with the mysql DB (so that people can point this to any hosted mysql or on-prem mysql and try it out).
I am not sure how that can be tested regularly though - but it certainly falls under the egress proxy test.

EXPOSE 9080
ARG service_version
ENV SERVICE_VERSION ${service_version:-v1}
CMD python productpage.py 9080 $MYSQLADDR
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where is this variable coming from?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MYSQLADDR comes from the spec for the productpage Deployment. It can be an IP address or a fqdn. For service_version "v2" the productpage Deployment spec would have the following environment defined for the productpage container.

    env:
    - name: MYSQLADDR
      value: "192.168.144.189"

COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt

COPY . .
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move above requirements.txt line and remove the requierments.txt copy.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops. will do.

@rshriram
Copy link
Copy Markdown
Member

So, I found this in the IBM repos..
https://github.com/IBM/microservices-traffic-management-using-istio#7-modify-sample-application-to-use-the-external-database

This basically did almost what you are trying to do.. Ratings service is talking to mysql. But it has all the necessary code to talk to either an internal or hosted mysql (hostname, password, username, etc..).

I have spoken to @Animeshsing who created this demo. May be you guys could sync up and fix this PR accordingly?

To be clear, I am mainly looking for a simple journey... most of istio tasks run with existing bookinfo.

We add a new task that talks about integrating external services (people can choose whatever mysql db they want - in k8s or outside k8s) as long as they provide all the details. We can then use route rules to switch to new version, tinker with it.

The key requirement is that we need an integration test, that would run before any PR to the master branch.

@saumoh
Copy link
Copy Markdown
Contributor Author

saumoh commented Jul 21, 2017 via email

# limitations under the License.

FROM mysql:8
ENV MYSQL_ROOT_PASSWORD "password"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any way to get a randomly generated password from env ?

@ldemailly
Copy link
Copy Markdown
Member

/ok-to-test

@animeshsingh
Copy link
Copy Markdown

animeshsingh commented Jul 22, 2017

Thanks @rshriram for connecting. @saumoh will love to collaborate. Lets connect on Tuesday after between 2-5 PST - whatever tome works for you and we can discuss cc @AnthonyAmanse. Once we agree on a time i can send the invite

@saumoh
Copy link
Copy Markdown
Contributor Author

saumoh commented Jul 24, 2017 via email

@saumoh
Copy link
Copy Markdown
Contributor Author

saumoh commented Jul 25, 2017 via email

saumoh and others added 5 commits July 26, 2017 22:19
* Enable Prow

* Fix BUILD format

* Add execution perm to the script

* Fix shell script

* Fix flag name

* Use the right k8s cluster

* Create the ~.kube dir

* Linking instead of moving

* Explicitly specify dir

* Remove debug statements

* Rename test_log_path to test_logs_path for consistency

* Adds desc + failure conditions
@istio-merge-robot
Copy link
Copy Markdown

@saumoh PR needs rebase

6 similar comments
@istio-merge-robot
Copy link
Copy Markdown

@saumoh PR needs rebase

@istio-merge-robot
Copy link
Copy Markdown

@saumoh PR needs rebase

@istio-merge-robot
Copy link
Copy Markdown

@saumoh PR needs rebase

@istio-merge-robot
Copy link
Copy Markdown

@saumoh PR needs rebase

@istio-merge-robot
Copy link
Copy Markdown

@saumoh PR needs rebase

@istio-merge-robot
Copy link
Copy Markdown

@saumoh PR needs rebase

@yutongz
Copy link
Copy Markdown
Contributor

yutongz commented Jul 31, 2017

Yes, it's a bug about merge-bot, will fix it before reopen.

@istio-merge-robot
Copy link
Copy Markdown

@saumoh PR needs rebase

3 similar comments
@istio-merge-robot
Copy link
Copy Markdown

@saumoh PR needs rebase

@istio-merge-robot
Copy link
Copy Markdown

@saumoh PR needs rebase

@istio-merge-robot
Copy link
Copy Markdown

@saumoh PR needs rebase

@yutongz
Copy link
Copy Markdown
Contributor

yutongz commented Aug 1, 2017

Sorry for all the mess, so the problem is Mungegithub wants to add a label "needs-rebase" while there is no such label existing and merge-robot is so sad that he cannot create a label in this repo, so he keeps bugging. Since I can't create labels, can any one with access add it, merge-robot will appreciate it :)

@saumoh
Copy link
Copy Markdown
Contributor Author

saumoh commented Aug 1, 2017

Closing this pull request. The plan is to work with @animeshsingh @AnthonyAmanse on a broader version of this.

@saumoh saumoh closed this Aug 1, 2017
istio-merge-robot pushed a commit that referenced this pull request Aug 28, 2017
Automatic merge from submit-queue

Add mysql db to ratings service in bookinfo app.

Tracked in #573 and discussed in #473, adding mysql db access to the ratings service.
cc @rshriram @AnthonyAmanse @ldemailly
mandarjog pushed a commit to mandarjog/istio that referenced this pull request Oct 30, 2017
This PR will add a print out of version information to the log for
istio mixer. This should ease debugging, etc., as the version info
will come along with the log.

Example:

```shell
$ ./bazel-bin/cmd/server/mixs server
Istio Mixer: version: unknown (build: 2017-03-29-84ea18c, status: Modified)
Starting gRPC server on port 9091
```
Former-commit-id: 7b4e4a37769b8132e9327333568767a013bef924
rshriram pushed a commit that referenced this pull request Oct 30, 2017
Automatic merge from submit-queue

Add mysql db to ratings service in bookinfo app.

Tracked in #573 and discussed in #473, adding mysql db access to the ratings service.
cc @rshriram @AnthonyAmanse @ldemailly

Former-commit-id: 7b5271d
mandarjog pushed a commit that referenced this pull request Oct 31, 2017
This PR will add a print out of version information to the log for
istio mixer. This should ease debugging, etc., as the version info
will come along with the log.

Example:

```shell
$ ./bazel-bin/cmd/server/mixs server
Istio Mixer: version: unknown (build: 2017-03-29-84ea18c, status: Modified)
Starting gRPC server on port 9091
```
Former-commit-id: c926e35fdd6686b270eab3799ef6670af4cb3a96
vbatts pushed a commit to vbatts/istio that referenced this pull request Oct 31, 2017
Automatic merge from submit-queue

Add mysql db to ratings service in bookinfo app.

Tracked in istio#573 and discussed in istio#473, adding mysql db access to the ratings service.
cc @rshriram @AnthonyAmanse @ldemailly

Former-commit-id: 7b5271d
mandarjog pushed a commit that referenced this pull request Oct 31, 2017
* Let MANAGER_HUB and MANAGER_TAG env vars override defaults in inject.go if present

* Remove defaults in the binary in favor of env variables

* Use test-specific hub instead of env var

* Added comments on env var name constants

* Format
mandarjog pushed a commit that referenced this pull request Nov 2, 2017
Automatic merge from submit-queue

Add mysql db to ratings service in bookinfo app.

Tracked in #573 and discussed in #473, adding mysql db access to the ratings service.
cc @rshriram @AnthonyAmanse @ldemailly

Former-commit-id: 7b5271d
kyessenov pushed a commit to kyessenov/istio that referenced this pull request Aug 13, 2018
howardjohn pushed a commit to howardjohn/istio that referenced this pull request Jan 12, 2020
* Update to latest common-files

* Address reviewer comments.
howardjohn pushed a commit to howardjohn/istio that referenced this pull request Jan 12, 2020
* Update readme for controller local debugging

* Address comment
danehans pushed a commit to danehans/istio that referenced this pull request Nov 2, 2021
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
luksa added a commit to luksa/istio that referenced this pull request Apr 29, 2022
)

If an injected annotation value contained a double-quote character, the rendered istiod-injector-configmap YAML would be invalid. Unmarshalling the inject config would fail with: update error: failed to unmarshal injection template: error converting YAML to JSON: yaml: line 10: did not find expected key
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.

10 participants