Skip to content

Commit

Permalink
docs: added missing README.md, README.md.gotmpl content and implement…
Browse files Browse the repository at this point in the history
…ed note after helm deployement
  • Loading branch information
PaMarzec committed Oct 27, 2023
1 parent 63c7890 commit 91e42e8
Show file tree
Hide file tree
Showing 12 changed files with 254 additions and 13 deletions.
3 changes: 1 addition & 2 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ See the `INSTALL.md` files in the [backend](./backend/INSTALL.md) and [frontend]
```shell
cd charts/puris/

helm install backend --namespace puris --create-namespace . --set frontend.ingress.enabled=true --set backend.ingress.enabled=true
helm install puris --namespace puris --create-namespace . --set frontend.ingress.enabled=true --set backend.ingress.enabled=true
```
2. Done! The applications should be available at
- (frontend) `http://YOURIP:30000`
- (backend) `http://CLUSTERIP:30001/catena/swagger-ui/index.html`

163 changes: 163 additions & 0 deletions charts/puris/README.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions charts/puris/charts/backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ $ helm install backend --namespace puris --create-namespace .
| ingress.annotations."nginx.ingress.kubernetes.io/force-ssl-redirect" | string | `"true"` | Force redirects from HTTP to HTTPS |
| ingress.annotations."nginx.ingress.kubernetes.io/ssl-passthrough" | string | `"true"` | Pass SSL traffic to the backend ports |
| ingress.enabled | bool | `false` | Enable the Ingress |
| ingress.hosts | list | `[{"host":"home.int.demo.catena-x.net","paths":[{"path":"/","pathType":"ImplementationSpecific"}]}]` | Hosts for the Ingress controller |
| ingress.tls | list | `[{"hosts":["home.int.demo.catena-x.net"],"secretName":"tls-secret"}]` | TLS certificates for the Ingress controller |
| ingress.hosts | list | `[{"host":"puris-backend.net","paths":[{"path":"/","pathType":"ImplementationSpecific"}]}]` | Hosts for the Ingress controller |
| ingress.tls | list | `[{"hosts":["puris-backend.net"],"secretName":"tls-secret"}]` | TLS certificates for the Ingress controller |
| livenessProbe | object | `{"failureThreshold":3,"initialDelaySeconds":250,"periodSeconds":25,"successThreshold":1,"timeoutSeconds":1}` | Checks whether a pod is alive or not |
| livenessProbe.failureThreshold | int | `3` | Number of failures (threshold) for a liveness probe |
| livenessProbe.initialDelaySeconds | int | `250` | Delay in seconds after which an initial liveness probe is checked |
Expand Down
28 changes: 28 additions & 0 deletions charts/puris/charts/backend/README.md.gotmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{{ template "chart.header" . }}

{{ template "chart.deprecationWarning" . }}

{{ template "chart.badgesSection" . }}

{{ template "chart.description" . }}

{{ template "chart.homepageLine" . }}

## Prerequisites
- Kubernetes 1.19+
- Helm 3.2.0+

## TL;DR
```shell
$ helm install backend --namespace puris --create-namespace .
```

{{ template "chart.maintainersSection" . }}

{{ template "chart.sourcesSection" . }}

{{ template "chart.requirementsSection" . }}

{{ template "chart.valuesSection" . }}

{{ template "helm-docs.versionFooter" . }}
3 changes: 3 additions & 0 deletions charts/puris/charts/backend/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "puris-backend.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
Or
enable ingress by setting it to true while installation e.g.:
"helm install backend --namespace puris --create-namespace . --set ingress.enabled=true"
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "puris-backend.fullname" . }}'
Expand Down
4 changes: 2 additions & 2 deletions charts/puris/charts/backend/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,15 @@ ingress:
nginx.ingress.kubernetes.io/backend-protocol: "HTTP"
# -- Hosts for the Ingress controller
hosts:
- host: "home.int.demo.catena-x.net"
- host: "puris-backend.net"
paths:
- path: /
pathType: ImplementationSpecific
# -- TLS certificates for the Ingress controller
tls:
- secretName: tls-secret
hosts:
- home.int.demo.catena-x.net
- puris-backend.net

# -- Constrains for the node selector
nodeSelector: {}
Expand Down
2 changes: 1 addition & 1 deletion charts/puris/charts/frontend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ $ helm install frontend --namespace puris --create-namespace .
| ingress.annotations | object | `{}` | Annotations for the Ingress controller |
| ingress.className | string | `""` | Class name for the Ingress controller |
| ingress.enabled | bool | `false` | Enable the Ingress |
| ingress.hosts | list | `[{"host":"chart-example.local","paths":[{"path":"/","pathType":"ImplementationSpecific"}]}]` | Hosts for the Ingress controller |
| ingress.hosts | list | `[{"host":"puris-frontend.net","paths":[{"path":"/","pathType":"ImplementationSpecific"}]}]` | Hosts for the Ingress controller |
| ingress.tls | list | `[]` | TLS certificates for the Ingress controller |
| livenessProbe | object | `{"failureThreshold":3,"initialDelaySeconds":10,"periodSeconds":10,"successThreshold":1,"timeoutSeconds":1}` | Checks whether a pod is alive or not |
| livenessProbe.failureThreshold | int | `3` | Number of failures (threshold) for a liveness probe |
Expand Down
3 changes: 3 additions & 0 deletions charts/puris/charts/frontend/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "puris-frontend.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
Or
enable ingress by setting it to true while installation e.g.:
"helm install frontend --namespace puris --create-namespace . --set ingress.enabled=true"
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "puris-frontend.fullname" . }}'
Expand Down
2 changes: 1 addition & 1 deletion charts/puris/charts/frontend/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ ingress:
annotations: {}
# -- Hosts for the Ingress controller
hosts:
- host: chart-example.local
- host: puris-frontend.net
paths:
- path: /
pathType: ImplementationSpecific
Expand Down
45 changes: 45 additions & 0 deletions charts/puris/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
1. Get the application URL by running these commands:
{{- if and .Values.frontend.ingress.enabled .Values.backend.ingress.enabled }}
{{- range $hostF := $.Values.frontend.ingress.hosts}}
Frontend:
http{{ if $.Values.frontend.ingress.tls }}s{{ end }}://{{ $hostF.host }}{{ .path }}
{{ end }}
{{- range $hostB := $.Values.backend.ingress.hosts -}}
Backend:
http{{ if $.Values.backend.ingress.tls }}s{{ end }}://{{ $hostB.host }}{{ .path }}
{{- end }}
{{- else if and (contains "NodePort" .Values.frontend.service.type) (contains "NodePort" .Values.backend.service.type) }}
Frontend:
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "puris-frontend.fullname" . }}-frontend)
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
Backend:
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "puris-backend.fullname" . }}-backend)
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
Or
enable ingress by setting it to true while installation e.g.:
"helm install puris --namespace puris --create-namespace . --set frontend.ingress.enabled=true --set backend.ingress.enabled=true"
{{- else if and (contains "LoadBalancer" .Values.frontend.service.type) (contains "LoadBalancer" .Values.backend.service.type) }}
Frontend:
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "puris-frontend.fullname" . }}-frontend'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "puris-frontend.fullname" . }}-frontend --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ .Values.service.port }}
Backend:
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "puris-backend.fullname" . }}-backend'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "puris-backend.fullname" . }}-backend --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if and (contains "ClusterIP" .Values.frontend.service.type) (contains "ClusterIP" .Values.backend.service.type) }}
Frontend:
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "puris-frontend.name" . }}-frontend,app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
Backend:
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "puris-backend.name" . }}-backend,app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
{{- end }}
6 changes: 3 additions & 3 deletions charts/puris/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ frontend:
annotations: { }
# -- Hosts for the Ingress controller
hosts:
- host: chart-example.local
- host: puris-frontend.net
paths:
- path: /
pathType: ImplementationSpecific
Expand Down Expand Up @@ -264,15 +264,15 @@ backend:
nginx.ingress.kubernetes.io/backend-protocol: "HTTP"
# -- Hosts for the Ingress controller
hosts:
- host: "home.int.demo.catena-x.net"
- host: "puris-backend.net"
paths:
- path: /
pathType: ImplementationSpecific
# -- TLS certificates for the Ingress controller
tls:
- secretName: tls-secret
hosts:
- home.int.demo.catena-x.net
- puris-backend.net

# -- Constrains for the node selector
nodeSelector: { }
Expand Down
4 changes: 2 additions & 2 deletions frontend/INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ npm run dev
# B production
npm run build
```
5. Done! The frontend should be available at `http://YOURIP:30000/`
5. Done! The frontend should be available at `http://YOURIP:3000/`

### Running using docker (deployment)
As JS-frameworks hard-wire their environments, this project uses a workaround to make the .env variables replaceable by (docker) environment variables.
Expand All @@ -35,7 +35,7 @@ docker run -d --rm -p 3000:8080 --name frontend -e BACKEND_BASE_URL=http://YOURB
docker-compose up
```
Note: please find the available parameters in src/config.json
4. Done! The frontend should be available at `http://YOURIP:30000/`
4. Done! The frontend should be available at `http://YOURIP:3000/`

### Running using helm (deployment)
3. Run the application:
Expand Down

0 comments on commit 91e42e8

Please sign in to comment.