12 changed files with 156 additions and 85 deletions
@ -0,0 +1,10 @@ |
|||||
|
#!/bin/bash |
||||
|
|
||||
|
set -e |
||||
|
|
||||
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" |
||||
|
|
||||
|
if [ -f "$DIR/namespace" ] |
||||
|
then |
||||
|
kubectl delete namespace `cat "$DIR/namespace"` |
||||
|
fi |
@ -0,0 +1,38 @@ |
|||||
|
#!/bin/bash |
||||
|
|
||||
|
set -e |
||||
|
|
||||
|
if [ ! -d "$1" ] |
||||
|
then |
||||
|
echo "Helm dir does not exist!" |
||||
|
exit 1 |
||||
|
fi |
||||
|
|
||||
|
|
||||
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" |
||||
|
POSTFIX=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 10 | head -n 1) |
||||
|
NAMESPACE="covidok-ci-$POSTFIX" |
||||
|
HELM_PACKAGE="covid-$POSTFIX" |
||||
|
|
||||
|
printf "$NAMESPACE" > "$DIR/namespace" |
||||
|
|
||||
|
kubectl create namespace "$NAMESPACE" |
||||
|
|
||||
|
helm install -f "$DIR/ci_values.yaml" -n "$NAMESPACE" "$HELM_PACKAGE" "$1" |
||||
|
|
||||
|
i=0 |
||||
|
while [ "$(kubectl get pod -n "$NAMESPACE" -l=app.kubernetes.io/name=covidok -o jsonpath='{.items[*].status.containerStatuses[0].ready}')" != "true" ]; do |
||||
|
echo "Covidok backend is not yet ready..." |
||||
|
if [ $i -gt 10 ] |
||||
|
then |
||||
|
echo "Timeout reached while waiting for backend to start" |
||||
|
exit 1 |
||||
|
else |
||||
|
sleep 5 |
||||
|
fi |
||||
|
done |
||||
|
|
||||
|
echo "Covidok backend is up" |
||||
|
CLUSTERIP=$(kubectl get svc -n test1 -l=app.kubernetes.io/name=covidok -o jsonpath='{.items[*].spec.clusterIP}') |
||||
|
echo "ClusterIP of service is $CLUSTERIP, writing to file" |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UpLMVdEY09UK3VmOVpvNGFYOS8raVpuYjFGVE5IYwphYm44eVBxSEJFYisyenl2SHQxa0Y4NjloSUo5Q1dnQVNodzl4OVhTa3lnb3cwb2NUNmFKZm9JbHA3MDNLeGVuCms4QTdqWVVEeU40a2hQUzNVYUtIUjU2MFhHWXFBRndVYjd3Mk4wUFVneENJWlZRcEpJVlg4N2Zrby96TkZaU3UKRDlkMFpyWnRTdm4zZWhHTkw4MWkrclRRY3kwOENvNGZ5RmhPL0dydTdNTW00WS9YSmEzSHhpQVBGbUtYeEpMRwpUMTB2aVpkL1lZWFF6K0lHVnZPVnZmVHROaUVITERWWk9TU3pmVHA3bkZJNjJoQW0vQ1BSM2xLZWtyYz0KLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo= |
||||
|
server: https://192.168.0.101:6443 |
||||
|
name: kubernetes |
||||
|
contexts: |
||||
|
- context: |
||||
|
cluster: kubernetes |
||||
|
user: kubernetes-admin |
||||
|
name: kubernetes-admin@kubernetes |
||||
|
current-context: kubernetes-admin@kubernetes |
||||
|
kind: Config |
||||
|
preferences: {} |
||||
|
users: |
||||
|
- name: kubernetes-admin |
||||
|
user: |
||||
|
client-certificate-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUM4akNDQWRxZ0F3SUJBZ0lJUEZUSDI2cTVDeDh3RFFZSktvWklodmNOQVFFTEJRQXdGVEVUTUJFR0ExVUUKQXhNS2EzVmlaWEp1WlhSbGN6QWVGdzB5TURBNE1UUXhPVFV5TURoYUZ3MHlNVEE0TVRReE9UVXlNVEZhTURReApGekFWQmdOVkJBb1REbk41YzNSbGJUcHRZWE4wWlhKek1Sa3dGd1lEVlFRREV4QnJkV0psY201bGRHVnpMV0ZrCmJXbHVNSUlCSWpBTkJna3Foa2lHOXcwQkFRRUZBQU9DQVE4QU1JSUJDZ0tDQVFFQXhQSE5ieE9RUTFLZkZTSzcKbVJDOUlGMzFmaC9JVTI4Q1dvV2NmZWZ1dE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k4dmNlZFU3NnphbEUra2hqUEtzNTZKZXRHZXhkaWR5NUFESFE9PQotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQo= |
@ -0,0 +1,13 @@ |
|||||
|
import os |
||||
|
|
||||
|
|
||||
|
host_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), "host.file") |
||||
|
|
||||
|
|
||||
|
def load_host(): |
||||
|
with open(host_file) as f: |
||||
|
return f.read().strip() |
||||
|
|
||||
|
|
||||
|
def url_base(): |
||||
|
return "http://" + load_host() |
@ -1,21 +0,0 @@ |
|||||
1. Get the application URL by running these commands: |
|
||||
{{- if .Values.ingress.enabled }} |
|
||||
{{- range $host := .Values.ingress.hosts }} |
|
||||
{{- range .paths }} |
|
||||
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ . }} |
|
||||
{{- end }} |
|
||||
{{- end }} |
|
||||
{{- else if contains "NodePort" .Values.service.type }} |
|
||||
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "covidok.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 "covidok.fullname" . }}' |
|
||||
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "covidok.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 "covidok.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") |
|
||||
echo "Visit http://127.0.0.1:8080 to use your application" |
|
||||
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:80 |
|
||||
{{- end }} |
|
Loading…
Reference in new issue