This repository has been archived by the owner on Jun 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Makefile fixes * Regenerate pb.gorm.go * Remove redundant deploy yaml * Fix deployment file * Nginx * Readme updates and namespace * Empty line at the end of file
- Loading branch information
Showing
8 changed files
with
174 additions
and
114 deletions.
There are no files selected for viewing
This file contains 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,3 +1,4 @@ | ||
bin | ||
.vscode | ||
debug | ||
vendor |
This file contains 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 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 |
---|---|---|
|
@@ -61,38 +61,64 @@ curl http://localhost:8080/atlas-contacts-app/v1/contacts -d '{"first_name": "Bo | |
|
||
``` sh | ||
curl http://localhost:8080/atlas-contacts-app/v1/contacts?_filter='first_name=="Mike"' | ||
``` | ||
|
||
#### Local Kubernetes setup | ||
|
||
Open a seperate terminal session where execute `eval $(minikube docker-env)`. This is needed to make these images available for local kubernetes without pushing them to global repo. | ||
##### Prerequisites | ||
|
||
Make sure nginx is deployed in you K8s. Otherwise you can deploy it using | ||
|
||
``` sh | ||
make nginx-up | ||
``` | ||
|
||
or by running | ||
|
||
Then: | ||
``` sh | ||
kubectl apply -f kube/nginx.yaml | ||
``` | ||
|
||
If you launching atlas-contacts-app for the first time you need to create `contacts` namespace for it in Kubernetes. This can be done by running | ||
|
||
``` sh | ||
kubectl apply -f kube/ns.yaml | ||
``` | ||
|
||
or | ||
|
||
``` sh | ||
kubectl create ns contacts | ||
``` | ||
|
||
##### Deployment | ||
|
||
To deploy atlas-contacts-app use | ||
|
||
``` sh | ||
make image | ||
make up | ||
``` | ||
|
||
To shutdown and cleanup: | ||
or as alternative you can run | ||
|
||
``` sh | ||
make down | ||
make image-clean | ||
rm -rf bin | ||
kubectl apply -f kube/kube.yaml | ||
``` | ||
|
||
#### Try local Kubernetes atlas-contacts-app | ||
##### Usage | ||
|
||
Try it out by executing following curl commangs: | ||
|
||
``` sh | ||
curl http://$(minikube ip):31500/atlas-contacts-app/v1/contacts -d '{"first_name": "Mike", "email_address": "[email protected]"}' | ||
curl https://minikube/atlas-contacts-app/v1/contacts -d '{"first_name": "Mike", "email_address": "[email protected]"}' | ||
``` | ||
|
||
``` sh | ||
curl http://$(minikube ip):31500/atlas-contacts-app/v1/contacts -d '{"first_name": "Bob", "email_address": "[email protected]"}' | ||
curl https://minikube/atlas-contacts-app/v1/contacts -d '{"first_name": "Bob", "email_address": "[email protected]"}' | ||
``` | ||
|
||
``` sh | ||
curl http://$(minikube ip):31500/atlas-contacts-app/v1/contacts?_filter='first_name=="Mike"' | ||
curl https://minikube/atlas-contacts-app/v1/contacts?_filter='first_name=="Mike"' | ||
``` | ||
|
||
## Deployment | ||
|
This file was deleted.
Oops, something went wrong.
This file contains 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 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,112 @@ | ||
kind: Service | ||
apiVersion: v1 | ||
metadata: | ||
name: nginx-default-backend | ||
labels: | ||
k8s-addon: ingress-nginx.addons.k8s.io | ||
spec: | ||
ports: | ||
- port: 80 | ||
targetPort: http | ||
selector: | ||
app: nginx-default-backend | ||
--- | ||
kind: Deployment | ||
apiVersion: extensions/v1beta1 | ||
metadata: | ||
name: nginx-default-backend | ||
labels: | ||
k8s-addon: ingress-nginx.addons.k8s.io | ||
spec: | ||
replicas: 1 | ||
template: | ||
metadata: | ||
labels: | ||
k8s-addon: ingress-nginx.addons.k8s.io | ||
app: nginx-default-backend | ||
spec: | ||
terminationGracePeriodSeconds: 60 | ||
containers: | ||
- name: default-http-backend | ||
image: gcr.io/google_containers/defaultbackend:1.0 | ||
livenessProbe: | ||
httpGet: | ||
path: /healthz | ||
port: 8080 | ||
scheme: HTTP | ||
initialDelaySeconds: 30 | ||
timeoutSeconds: 5 | ||
resources: | ||
limits: | ||
cpu: 10m | ||
memory: 20Mi | ||
requests: | ||
cpu: 10m | ||
memory: 20Mi | ||
ports: | ||
- name: http | ||
containerPort: 8080 | ||
protocol: TCP | ||
--- | ||
kind: ConfigMap | ||
apiVersion: v1 | ||
metadata: | ||
name: ingress-nginx | ||
labels: | ||
k8s-addon: ingress-nginx.addons.k8s.io | ||
data: | ||
use-proxy-protocol: "false" | ||
--- | ||
kind: Deployment | ||
apiVersion: extensions/v1beta1 | ||
metadata: | ||
name: ingress-nginx | ||
labels: | ||
k8s-addon: ingress-nginx.addons.k8s.io | ||
spec: | ||
replicas: 1 | ||
template: | ||
metadata: | ||
labels: | ||
app: ingress-nginx | ||
k8s-addon: ingress-nginx.addons.k8s.io | ||
spec: | ||
hostNetwork: true | ||
dnsPolicy: ClusterFirstWithHostNet | ||
terminationGracePeriodSeconds: 60 | ||
containers: | ||
- image: gcr.io/google_containers/nginx-ingress-controller:0.9.0-beta.14 | ||
name: ingress-nginx | ||
imagePullPolicy: Always | ||
ports: | ||
- name: http | ||
containerPort: 80 | ||
protocol: TCP | ||
- name: https | ||
containerPort: 443 | ||
protocol: TCP | ||
readinessProbe: | ||
httpGet: | ||
path: /healthz | ||
port: 10254 | ||
scheme: HTTP | ||
initialDelaySeconds: 10 | ||
livenessProbe: | ||
httpGet: | ||
path: /healthz | ||
port: 10254 | ||
scheme: HTTP | ||
initialDelaySeconds: 30 | ||
timeoutSeconds: 3 | ||
env: | ||
- name: POD_NAME | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.name | ||
- name: POD_NAMESPACE | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.namespace | ||
args: | ||
- /nginx-ingress-controller | ||
- --default-backend-service=$(POD_NAMESPACE)/nginx-default-backend |
This file contains 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,4 @@ | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: contacts |
Oops, something went wrong.