Add JWT test to helm chart

This commit is contained in:
stefanprodan
2019-08-06 21:08:54 +03:00
parent 67578338c9
commit c907163073
4 changed files with 15 additions and 10 deletions
+3 -3
View File
@@ -27,11 +27,11 @@ build-container:
docker build -t $(DOCKER_IMAGE_NAME):$(VERSION) .
test-container:
@docker rm -f podinfo || true
@docker run -dp 9898:9898 --name=podinfo $(DOCKER_IMAGE_NAME):$(VERSION)
@docker ps
@TOKEN=$$(curl -sd 'test' localhost:9898/token) && \
JWT=$$(echo $$TOKEN | jq -r .token) && \
curl -H "Authorization: Bearer $${JWT}" localhost:9898/token/validate | grep test
@TOKEN=$$(curl -sd 'test' localhost:9898/token | jq -r .token) && \
curl -sH "Authorization: Bearer $${TOKEN}" localhost:9898/token/validate | grep test
push-container:
docker push $(DOCKER_IMAGE_NAME):$(VERSION)
+4 -1
View File
@@ -1,6 +1,6 @@
# podinfo
[![Build Status](https://travis-ci.org/stefanprodan/podinfo.svg?branch=master)](https://travis-ci.org/stefanprodan/podinfo)
[![CircleCI](https://circleci.com/gh/stefanprodan/podinfo.svg?style=svg)](https://circleci.com/gh/stefanprodan/podinfo)
[![Docker Pulls](https://img.shields.io/docker/pulls/stefanprodan/podinfo)](https://hub.docker.com/r/stefanprodan/podinfo)
Podinfo is a tiny web application made with Go
@@ -57,9 +57,12 @@ helm repo add sp https://stefanprodan.github.io/podinfo
helm upgrade --install --wait frontend \
--namespace test \
--set replicaCount=2 \
--set backend=http://backend-podinfo:9898/echo \
sp/podinfo
helm test frontend --cleanup
helm upgrade --install --wait backend \
--namespace test \
--set hpa.enabled=true \
+2 -2
View File
@@ -58,7 +58,7 @@ spec:
- check
- http
- localhost:{{ .Values.service.containerPort }}/healthz
initialDelaySeconds: 5
initialDelaySeconds: 1
timeoutSeconds: 5
readinessProbe:
exec:
@@ -67,7 +67,7 @@ spec:
- check
- http
- localhost:{{ .Values.service.containerPort }}/readyz
initialDelaySeconds: 5
initialDelaySeconds: 1
timeoutSeconds: 5
volumeMounts:
- name: data
@@ -1,7 +1,7 @@
apiVersion: v1
kind: Pod
metadata:
name: {{ template "podinfo.fullname" . }}-storage-test-{{ randAlphaNum 5 | lower }}
name: {{ template "podinfo.fullname" . }}-jwt-test-{{ randAlphaNum 5 | lower }}
labels:
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
@@ -13,7 +13,7 @@ spec:
containers:
- name: tools
image: giantswarm/tiny-tools
command: ["/bin/sh", "/scripts/ping.sh"]
command: ["/bin/sh", "/scripts/test.sh"]
env:
- name: PODINFO_SVC
value: {{ template "podinfo.fullname" . }}:{{ .Values.service.externalPort }}
@@ -36,6 +36,8 @@ metadata:
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
app: {{ template "podinfo.name" . }}
data:
ping.sh: |
test.sh: |
#!/bin/sh
curl -sS ${PODINFO_SVC}/store/$(curl -sSd 'test' ${PODINFO_SVC}/store | jq -r .hash) |grep test
echo "testing ${PODINFO_SVC}/token"
TOKEN=$(curl -sd 'test' ${PODINFO_SVC}/token | jq -r .token) && \
curl -H "Authorization: Bearer ${TOKEN}" ${PODINFO_SVC}/token/validate | grep test