Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
cjlapao committed Aug 16, 2021
1 parent a8437d8 commit 9f140a3
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 96 deletions.
21 changes: 4 additions & 17 deletions helm-charts/restapi-testapp/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -1,22 +1,9 @@
1. Get the application URL by running these commands:
{{- if .Values.ingress.virtualService.enabled }}
{{- if .Values.ingress.enabled }}
{{- range $host := .Values.ingress.hosts }}
{{- range .paths }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .route }}
{{- end }}
{{- end }}
{% comment %} {{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "restapi-testapp.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- 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 "restapi-testapp.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "restapi-testapp.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "restapi-testapp.name" . }},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 }} {% endcomment %}
{{- end }}

2 changes: 1 addition & 1 deletion helm-charts/restapi-testapp/templates/hpa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "restapi-testapp.fullname" . }}
namespace:
namespace: {{ .Values.namespace.name }}
labels:
{{- include "restapi-testapp.labels" . | nindent 4 }}
spec:
Expand Down
12 changes: 8 additions & 4 deletions helm-charts/restapi-testapp/templates/virtualservice.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
{{ $namespace := .Values.namespace.name }}
{{ $fullname := include "restapi-testapp.fullname" .}}
{{ if .Values.ingress.virtualService.enabled }}
{{ if and (eq .Values.ingress.ingressClass "istio") (.Values.ingress.enabled) }}
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
name: {{ include "restapi-testapp.fullname" .}}
labels: {{ include "restapi-testapp.labels" . | nindent 4}}
spec:
gateways:
- {{ .Values.ingress.gateway }}
hosts:
- {{ .Values.ingress.host }}
{{- range $host := .Values.ingress.hosts }}
- {{ $host.host }}
http:
{{ range $value := .Values.ingress.paths}}
{{- range $path := $host.paths }}
- name: {{ .name }}
match:
- uri:
prefix: {{ .route }}
route:
- destination:
host: {{$fullname}}.{{$namespace}}.svc.cluster.local
{{ end }}
{{- end }}
{{- end }}
{{ end }}
14 changes: 8 additions & 6 deletions helm-charts/restapi-testapp/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ autoscaling:
targetCPUUtilizationPercentage: 30
targetMemoryUtilizationPercentage: 75
ingress:
enabled: true
ingressClass: istio
gateway: proxy
tls: true
host: 'test.local-cluster.internal'
paths:
- name: "hello"
route: "/hello"
virtualService:
enabled: true
hosts:
- host: 'test.local-cluster.internal'
paths:
- name: "hello"
route: "/hello"
41 changes: 0 additions & 41 deletions ssl/local-cluster.internal.crt

This file was deleted.

27 changes: 0 additions & 27 deletions ssl/local-cluster.internal.key

This file was deleted.

0 comments on commit 9f140a3

Please sign in to comment.