Page
4 systems with 13 parts
4 systems and 13 parts
At this point, you have four systems with 13 parts similar to Figure 6.
Under the covers, unseen on the OpenShift dashboard, are dozens of other objects like replica sets, image streams, and more. To get a glimpse of these, run the following command:
oc get all --output name --selector sandbox=labels
You’ll see a long list of objects. Here’s an example:
pod/countryui-6c9dcff4c6-krv64
pod/customerviewer-5f9574cf95-lmh5c
pod/getcountrieslist-867588bc6c-hkgnc
pod/getcustomerlist-69ff4597db-c5zdv
pod/getquoteslistforu-57898b5544-g4ml2
pod/quote-7b7ddb47f7-2hbnh
pod/rsgetalbumslist-5c75477cbd-x568s
pod/thestones-5c8fd4bf66-sstb8
pod/triviahhh-api-gateway-645c6c9f75-nlq8d
pod/triviahhh-web-7c65458485-twq9t
replicationcontroller/countries-1
replicationcontroller/customersdb-1
replicationcontroller/rsalbums-1
service/countries
service/countryui
service/customersdb
service/customerviewer
service/getcountrieslist
service/getcustomerlist
service/getquoteslistforu
service/quote
service/rsalbums
service/rsgetalbumslist
service/thestones
service/triviahhh-api-gateway
service/triviahhh-web
deployment.apps/countryui
deployment.apps/customerviewer
deployment.apps/getcountrieslist
deployment.apps/getcustomerlist
deployment.apps/getquoteslistforu
deployment.apps/quote
deployment.apps/rsgetalbumslist
deployment.apps/thestones
deployment.apps/triviahhh-api-gateway
deployment.apps/triviahhh-web
replicaset.apps/countryui-59d46b76c5
replicaset.apps/countryui-6c9dcff4c6
replicaset.apps/customerviewer-5f9574cf95
replicaset.apps/customerviewer-749cf84d8d
replicaset.apps/customerviewer-78b4fbd95d
replicaset.apps/getcountrieslist-867588bc6c
replicaset.apps/getcountrieslist-df8944ff5
replicaset.apps/getcustomerlist-69ff4597db
replicaset.apps/getcustomerlist-7c4c8947f5
replicaset.apps/getcustomerlist-7cbc9698d5
replicaset.apps/getquoteslistforu-57898b5544
replicaset.apps/getquoteslistforu-5f4568c7cf
replicaset.apps/quote-7b7ddb47f7
replicaset.apps/rsgetalbumslist-5c75477cbd
replicaset.apps/rsgetalbumslist-5fbcf8f869
replicaset.apps/thestones-5c8fd4bf66
replicaset.apps/thestones-858ddbc648
replicaset.apps/triviahhh-api-gateway-645c6c9f75
replicaset.apps/triviahhh-api-gateway-6df4c9687d
replicaset.apps/triviahhh-web-7c65458485
replicaset.apps/triviahhh-web-f7c78f974
deploymentconfig.apps.openshift.io/countries
deploymentconfig.apps.openshift.io/customersdb
deploymentconfig.apps.openshift.io/rsalbums
buildconfig.build.openshift.io/customerviewer
buildconfig.build.openshift.io/getcountrieslist
buildconfig.build.openshift.io/getcustomerlist
buildconfig.build.openshift.io/getquoteslistforu
buildconfig.build.openshift.io/thestones
build.build.openshift.io/customerviewer-1
build.build.openshift.io/getcountrieslist-1
build.build.openshift.io/getcustomerlist-1
build.build.openshift.io/getquoteslistforu-1
build.build.openshift.io/thestones-1
imagestream.image.openshift.io/countryui
imagestream.image.openshift.io/customerviewer
imagestream.image.openshift.io/getcountrieslist
imagestream.image.openshift.io/getcustomerlist
imagestream.image.openshift.io/getquoteslistforu
imagestream.image.openshift.io/rsgetalbumslist
imagestream.image.openshift.io/thestones
imagestream.image.openshift.io/triviahhh-api-gateway
imagestream.image.openshift.io/triviahhh-web
route.route.openshift.io/countryui
route.route.openshift.io/customerviewer
route.route.openshift.io/thestones
route.route.openshift.io/triviahhh-api-gateway
route.route.openshift.io/triviahhh-web
[dschenck@PF3KBGN5-W10E customersdb]$ oc get all --output name --selector sandbox=labels
pod/countryui-6c9dcff4c6-krv64
pod/customerviewer-5f9574cf95-lmh5c
pod/getcountrieslist-867588bc6c-hkgnc
pod/getcustomerlist-69ff4597db-c5zdv
pod/getquoteslistforu-57898b5544-g4ml2
pod/quote-7b7ddb47f7-2hbnh
pod/rsgetalbumslist-5c75477cbd-x568s
pod/thestones-5c8fd4bf66-sstb8
pod/triviahhh-api-gateway-645c6c9f75-nlq8d
pod/triviahhh-web-7c65458485-twq9t
replicationcontroller/countries-1
replicationcontroller/customersdb-1
replicationcontroller/rsalbums-1
service/countries
service/countryui
service/customersdb
service/customerviewer
service/getcountrieslist
service/getcustomerlist
service/getquoteslistforu
service/quote
service/rsalbums
service/rsgetalbumslist
service/thestones
service/triviahhh-api-gateway
service/triviahhh-web
deployment.apps/countryui
deployment.apps/customerviewer
deployment.apps/getcountrieslist
deployment.apps/getcustomerlist
deployment.apps/getquoteslistforu
deployment.apps/quote
deployment.apps/rsgetalbumslist
deployment.apps/thestones
deployment.apps/triviahhh-api-gateway
deployment.apps/triviahhh-web
replicaset.apps/countryui-59d46b76c5
replicaset.apps/countryui-6c9dcff4c6
replicaset.apps/customerviewer-5f9574cf95
replicaset.apps/customerviewer-749cf84d8d
replicaset.apps/customerviewer-78b4fbd95d
replicaset.apps/getcountrieslist-867588bc6c
replicaset.apps/getcountrieslist-df8944ff5
replicaset.apps/getcustomerlist-69ff4597db
replicaset.apps/getcustomerlist-7c4c8947f5
replicaset.apps/getcustomerlist-7cbc9698d5
replicaset.apps/getquoteslistforu-57898b5544
replicaset.apps/getquoteslistforu-5f4568c7cf
replicaset.apps/quote-7b7ddb47f7
replicaset.apps/rsgetalbumslist-5c75477cbd
replicaset.apps/rsgetalbumslist-5fbcf8f869
replicaset.apps/thestones-5c8fd4bf66
replicaset.apps/thestones-858ddbc648
replicaset.apps/triviahhh-api-gateway-645c6c9f75
replicaset.apps/triviahhh-api-gateway-6df4c9687d
replicaset.apps/triviahhh-web-7c65458485
replicaset.apps/triviahhh-web-f7c78f974
deploymentconfig.apps.openshift.io/countries
deploymentconfig.apps.openshift.io/customersdb
deploymentconfig.apps.openshift.io/rsalbums
buildconfig.build.openshift.io/customerviewer
buildconfig.build.openshift.io/getcountrieslist
buildconfig.build.openshift.io/getcustomerlist
buildconfig.build.openshift.io/getquoteslistforu
buildconfig.build.openshift.io/thestones
build.build.openshift.io/customerviewer-1
build.build.openshift.io/getcountrieslist-1
build.build.openshift.io/getcustomerlist-1
build.build.openshift.io/getquoteslistforu-1
build.build.openshift.io/thestones-1
imagestream.image.openshift.io/countryui
imagestream.image.openshift.io/customerviewer
imagestream.image.openshift.io/getcountrieslist
imagestream.image.openshift.io/getcustomerlist
imagestream.image.openshift.io/getquoteslistforu
imagestream.image.openshift.io/rsgetalbumslist
imagestream.image.openshift.io/thestones
imagestream.image.openshift.io/triviahhh-api-gateway
imagestream.image.openshift.io/triviahhh-web
route.route.openshift.io/countryui
route.route.openshift.io/customerviewer
route.route.openshift.io/thestones
route.route.openshift.io/triviahhh-api-gateway
route.route.openshift.io/triviahhh-web
By running the oc get all
command with the label selector option, you can select a subset of objects. For example, let’s see where MariaDB is used:
oc get all -o name -l database=mariadb
replicationcontroller/countries-1
replicationcontroller/rsalbums-1
service/countries
service/rsalbums
deploymentconfig.apps.openshift.io/countries
deploymentconfig.apps.openshift.io/rsalbums
How about all of the parts that comprise the Quotes for U system:
oc get all -o name -l systemname=quotesforu
replicationcontroller/countries-1
replicationcontroller/rsalbums-1
service/countries
service/rsalbums
deploymentconfig.apps.openshift.io/countries
deploymentconfig.apps.openshift.io/rsalbums
[dschenck@PF3KBGN5-W10E customersdb]$ oc get all -o name -l systemname=quotesforu
pod/getquoteslistforu-57898b5544-g4ml2
pod/quote-7b7ddb47f7-2hbnh
pod/triviahhh-web-7c65458485-twq9t
service/getquoteslistforu
service/quote
service/triviahhh-web
deployment.apps/getquoteslistforu
deployment.apps/quote
deployment.apps/triviahhh-web
replicaset.apps/getquoteslistforu-57898b5544
replicaset.apps/getquoteslistforu-5f4568c7cf
replicaset.apps/quote-7b7ddb47f7
replicaset.apps/triviahhh-web-7c65458485
replicaset.apps/triviahhh-web-f7c78f974
buildconfig.build.openshift.io/getquoteslistforu
build.build.openshift.io/getquoteslistforu-1
imagestream.image.openshift.io/getquoteslistforu
imagestream.image.openshift.io/triviahhh-web
route.route.openshift.io/triviahhh-web
As you can see by now, you can use labels to “slice and dice” your OpenShift objects any way you wish to view. You can use multiple labels as well, such as this command:
oc get all -o name -l database=mariadb -l dbtype=ephemeral
Using the dashboard to visualize labels
One way to visualize this is by using the labels option in the OpenShift dashboard. To do this, open the dashboard in your browser and switch to the Developer/Topology view (Figure 7).
You can enter a label near the top as highlighted in Figure 8.
When you enter a label, the resulting objects are highlighted in the dashboard. For example, you can view the data access microservices by entering tier=dataaccess
as the label (Figure 9).
At this point in the activity, feel free to experiment with the dashboard and command line.
Is this magic?
This is absolutely not magic. This is not AI. This functionality is 100 percent tied to your ability to devise a labeling scheme and apply it consistently. In other words, this is a management tool, and like any tool, the results can be great or terrible.
Every object we created included a sandbox=labels
label to denote their association with the labels sandbox activity. This brings with it a great power, the ability to delete everything with one command.
For maximum visual impact, put your dashboard in the background and your command line in the foreground, so that you can see all four systems you created. Figure 10 shows an example of this.
Now, run the following command and watch the objects disappear as everything is deleted:
oc delete all -l sandbox=labels
That’s the power of labels. With great power comes … Well, you know the rest.
Developer Notes
This activity was purposely designed to use several technologies without any coding.
- The “quotes” database is a MongoDB database.
- The “getquoteslistforu” data access microservice, that reads quotes from the MongoDB database, is written in C#.
- The “triviahhh-api-gateway” API gateway, that all of the systems use, is written in Quarkus (Java).
- The “triviahhh-web” frontend application (to view quotes) is written in React.js.
- The “customers” database is a PostgreSQL database.
- The “getcustomerlist” data access microservice is written in Node.js.
- The “customerviewer” frontend application is written in Blazor/C#.
- The “rsalbums” database is a MariaDB database.
- The “rsgetalbumslist” data access microservice is written in Python.
- The “thestones” frontend application is written in HTML with AJAX.
- The “countries” database is a MariaDB database.
- The “getcountrieslist” data access microservice is written in Go.
- The “countryui” frontend application is written in Ruby on Rails.
Move it, Remove it, Improve it
Here are some ways you can move, remove and improve the skills you learned in this exercise.
Move
You can download all of the YAML files associated with this application and use them to move it to another OpenShift instance by using the export application button in the upper right corner of the OpenShift dashboard.
Remove
You can remove parts of this activity as follows:
- To remove only the “customers” system:
oc delete all -l systemname=customers
Improve
Some ideas to improve or alter this activity:
- Use your own labeling scheme.
- Improve the frontend applications.
- Create a separate API gateway for each system.
- Add the Circuit Breaker pattern to the API gateway.