Skip to content
This repository has been archived by the owner on Jul 3, 2024. It is now read-only.
/ landmark Public archive

This is the repository of the landmark microservice

License

Notifications You must be signed in to change notification settings

IBM/landmark

 
 

Repository files navigation

Solution for chart per service approach with Helm Charts in Openshift

Use a Helm chart per microservice approach if you seek to achieve flexible, simple versioning and low complexity charts to package your application. Be careful, this technique might bring:

  • huge amount of duplication

  • difficulty to keep consistent many templates

  • hardship to introduce global changes

Goal of this section: deploy the landmark microservice using Helm charts.

All the below commands will be executed in a terminal window.

Preparation

Assuming that you already cloned the landmark project, execute the following:

$ git checkout solution/chart-per-service-lab
$ git pull

To login to the OpenShift cluster from the Terminal run:

$ oc login -u kubeadmin -p YOUR_SECRET_PASSWORD https://api.crc.testing:6443

Check if you already have the dev project:

$ oc get project
$ oc new-project dev

The landmark microservice will persist its data into a database, in this case a PostgreSQL database instance.

In order to install the database, the PostgreSQL Helm Charts will be used. Check if the Helm repo https://charts.bitnami.com/bitnami is added to your existing list:

$ helm repo list

If the repo is not there, please run the following set of commands:

$ helm repo add bitnami https://charts.bitnami.com/bitnami

Setup the database instance with Helm, using the following command:

$ helm install landmark-db \
--set postgresqlUsername=landmark-default,postgresqlPassword=postgres,postgresqlDatabase=landmark,persistence.enabled=false \
stable/postgresql
$ helm status landmark-db

Validate the installation via:

$ helm list
$ helm get all landmark-db

Helm chart setup for the microservice

Install your charts in dev project

$ helm install simple ./chart/landmark
$ helm status simple
$ kubectl get ns
$ kubectl get svc
$ kubectl port-forward --namespace dev svc/simple-landmark 8080

Go in a browser window and copy-paste http://localhost:8080/api/museum/museum

Congratulations, you found a landmark!

Replicate the installation in qa project

Step1

According to Openshift documentation a project is a Kubernetes namespace with additional annotations, and is the central vehicle by which access to resources for regular users is managed. This means that a project offers you the ability to deploy Helm charts without specifying the namespace.

Create qa project and install a PostgreSQL instance:

$ oc new-project qa
$ helm install landmark-db \
--set postgresqlUsername=landmark-default,postgresqlPassword=postgres,postgresqlDatabase=landmark,persistence.enabled=false \
stable/postgresql
$ helm status landmark-db
Step2

Duplicate the values.yaml and rename it to values.qa.yaml. Change the NodePort value in values.qa.yaml to 31126. Install the charts:

$ helm install simple ./chart/landmark --values ./chart/landmark/values.qa.yaml
$ helm status simple
$ kubectl get ns
$ kubectl get svc
$ kubectl port-forward --namespace qa svc/simple-landmark 8080

Go in a browser window and copy-paste http://localhost:8080/api/museum/museum

Congratulations, you found a landmark and replicated deployment process accros environments!

In order to switch back to project dev, use the below command:

$ oc project dev

Compatibility

The Java code in the repositories is compatible with Java11.


License

This code is dedicated to the public domain to the maximum extent permitted by applicable law, pursuant to CC0.

About

This is the repository of the landmark microservice

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published