diff --git a/Makefile b/Makefile index b3c68ac..3d87489 100644 --- a/Makefile +++ b/Makefile @@ -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) diff --git a/README.md b/README.md index 97018f8..8dcd84e 100644 --- a/README.md +++ b/README.md @@ -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 \ diff --git a/charts/podinfo/templates/deployment.yaml b/charts/podinfo/templates/deployment.yaml index 5f37c18..f70a728 100644 --- a/charts/podinfo/templates/deployment.yaml +++ b/charts/podinfo/templates/deployment.yaml @@ -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 diff --git a/charts/podinfo/templates/tests/storage.yaml b/charts/podinfo/templates/tests/jwt.yaml similarity index 73% rename from charts/podinfo/templates/tests/storage.yaml rename to charts/podinfo/templates/tests/jwt.yaml index ae247bd..1ddbcee 100644 --- a/charts/podinfo/templates/tests/storage.yaml +++ b/charts/podinfo/templates/tests/jwt.yaml @@ -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