-
Notifications
You must be signed in to change notification settings - Fork 92
Add api-postgres-go and delete api-mssql-go #604
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
dedddb1
Add api-postgres-go and delete api-mssql-go
grego952 064d0d0
Small change
grego952 b022bf6
Remove hardcoded bit
grego952 a914867
Merge branch 'main' into add-api-go-folder
grego952 c7c8e16
Remove obsolete files
grego952 0253292
Rename the folder and update files
grego952 13b651a
Update Dockerfile
grego952 2875f62
Fix links
grego952 2a7b217
Fix link
grego952 24c2a17
Add note on where the sample is used
grego952 085ef4f
Fix namespace name
grego952 5c5851d
Merge branch 'main' into add-api-go-folder
grego952 b6a900a
Apply suggestions from mmitoraj review
grego952 4e73434
Apply suggestion from @mmitoraj
grego952 54ec327
Update helm-charts/helm-charts-examples.md
grego952 fc9c2a1
Merge branch 'main' into add-api-go-folder
grego952 3a313cf
Update README.md
grego952 4cae025
Renaming
grego952 a538211
Small fix
grego952 9efc6cb
Small fix
grego952 f6abdd2
Fix links
grego952 f23a258
Fix links
grego952 967d821
Remove postgres from link
grego952 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| # Deploy a Go PostgreSQL API Endpoint in SAP BTP, Kyma Runtime | ||
|
|
||
| ## Overview | ||
|
|
||
| > [!NOTE] | ||
| > This sample is used in the Deploy a Go PostgreSQL API Endpoint in SAP BTP, Kyma Runtime tutorial. | ||
|
|
||
| This sample provides a Golang API endpoint for communication with PostgreSQL databases. The API connects to a BTP-managed PostgreSQL instance using Service Binding credentials available in the Kyma cluster. | ||
|
|
||
| ## PostgreSQL Database Example | ||
|
|
||
| For the PostgreSQL example, use the `deployment.yaml` file. It provides the Deployment definition as well as an APIRule to expose the API without authentication. The Deployment references the PostgreSQL Service Binding Secret for connection credentials. | ||
|
|
||
| This sample demonstrates how to: | ||
|
|
||
| - Create a development namespace in the Kyma runtime. | ||
| - Deploy the following Kubernetes resources: | ||
| - API deployment written in GO | ||
| - API Rule | ||
| - Service | ||
| - ConfigMap | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| - SAP BTP, Kyma runtime instance | ||
| - PostgreSQL Service Instance and Service Binding in the Kyma cluster | ||
| - [Docker](https://www.docker.com/) | ||
| - [Go](https://golang.org/doc/install) | ||
| - [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/) configured to use the `KUBECONFIG` file downloaded from the Kyma runtime | ||
|
|
||
| ## Procedure | ||
|
|
||
| ### Build the Docker Image | ||
|
|
||
| 1. Build and push the image to your Docker repository: | ||
|
|
||
| ```shell script | ||
| docker build -t {your-docker-account}/api-postgresql-go -f docker/Dockerfile . | ||
| docker push {your-docker-account}/api-postgresql-go | ||
| ``` | ||
|
|
||
| ### Deploy the API | ||
|
|
||
| 1. Create a new `dev` namespace: | ||
|
|
||
| ```shell script | ||
| kubectl create namespace dev | ||
| kubectl label namespaces dev istio-injection=enabled | ||
| ``` | ||
|
|
||
| 2. Apply the ConfigMap: | ||
|
|
||
| ```shell script | ||
| kubectl -n dev apply -f ./k8s/configmap.yaml | ||
| ``` | ||
|
|
||
| 3. Apply the Deployment: | ||
|
|
||
| ```shell script | ||
| kubectl -n dev apply -f ./k8s/deployment.yaml | ||
| ``` | ||
|
|
||
| 4. Apply the APIRule: | ||
|
|
||
| ```shell script | ||
| kubectl -n dev apply -f ./k8s/apirule.yaml | ||
| ``` | ||
|
|
||
| 5. Verify that the Deployment is up and running: | ||
|
|
||
| ```shell script | ||
| kubectl -n dev get deployment api-postgresql-go | ||
| ``` | ||
|
|
||
| 6. Use the APIRule: | ||
|
|
||
| - `https://api-postgresql-go.{cluster-domain}/orders` | ||
| - `https://api-postgresql-go.{cluster-domain}/orders/10000001` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,9 @@ | ||
| module github.com/SAP-samples/kyma-runtime-extension-samples/api-mssql-go | ||
| module github.com/SAP-samples/kyma-runtime-extension-samples/api-postgresql-go | ||
|
|
||
| go 1.14 | ||
|
|
||
| require ( | ||
| github.com/denisenkom/go-mssqldb v0.0.0-20200910202707-1e08a3fab204 | ||
| github.com/gorilla/mux v1.8.0 | ||
| github.com/lib/pq v1.10.9 | ||
| github.com/vrischmann/envconfig v1.3.0 | ||
| golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 // indirect | ||
| ) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.