Skip to content

Commit

Permalink
Add podinfo chart for GitOps testing
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanprodan committed Oct 1, 2018
1 parent 3a05cfa commit 26500e9
Show file tree
Hide file tree
Showing 14 changed files with 390 additions and 4 deletions.
File renamed without changes.
12 changes: 12 additions & 0 deletions charts/podinfo-steerer/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
version: 1.2.1
appVersion: 1.2.1
engine: gotpl
name: podinfo-steerer
description: Podinfo Helm chart for Steerer progressive delivery
home: https://github.com/stefanprodan/k8s-podinfo
maintainers:
- email: stefanprodan@users.noreply.github.com
name: stefanprodan
sources:
- https://github.com/stefanprodan/steerer
56 changes: 56 additions & 0 deletions charts/podinfo-steerer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Podinfo Istio

Podinfo is a tiny web application made with Go
that showcases best practices of running microservices in Kubernetes.

## Installing the Chart

Create an Istio enabled namespace:

```console
kubectl create namespace test
kubectl label namespace test istio-injection=enabled
```

Create an Istio Gateway in the `istio-system` namespace named `public-gateway`:

```yaml
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: public-gateway
namespace: istio-system
spec:
selector:
istio: ingressgateway
servers:
- port:
number: 80
name: http
protocol: HTTP
hosts:
- "*"
tls:
httpsRedirect: true
- port:
number: 443
name: https
protocol: HTTPS
hosts:
- "*"
tls:
mode: SIMPLE
privateKey: /etc/istio/ingressgateway-certs/tls.key
serverCertificate: /etc/istio/ingressgateway-certs/tls.crt
```
Create the `frontend` release by specifying the external domain name:

```console
helm upgrade frontend -i ./charts/podinfo-steerer \
--namespace=test \
--set gateway.enabled=true \
--set gateway.host=podinfo.example.com
```


1 change: 1 addition & 0 deletions charts/podinfo-steerer/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{ template "podinfo-steerer.fullname" . }} has been deployed successfully!
36 changes: 36 additions & 0 deletions charts/podinfo-steerer/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "podinfo-steerer.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
The release name is used as a full name.
*/}}
{{- define "podinfo-steerer.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}

{{- define "podinfo-steerer.primary" -}}
{{- printf "%s-%s" .Release.Name "primary" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{- define "podinfo-steerer.canary" -}}
{{- printf "%s-%s" .Release.Name "canary" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "podinfo-steerer.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

63 changes: 63 additions & 0 deletions charts/podinfo-steerer/templates/canary-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "podinfo-steerer.canary" . }}
labels:
app: {{ template "podinfo-steerer.fullname" . }}
chart: {{ template "podinfo-steerer.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 0
selector:
matchLabels:
app: {{ template "podinfo-steerer.canary" . }}
template:
metadata:
labels:
app: {{ template "podinfo-steerer.canary" . }}
annotations:
prometheus.io/scrape: "true"
spec:
terminationGracePeriodSeconds: 30
containers:
- name: podinfod
image: "{{ .Values.canary.repository }}:{{ .Values.canary.tag }}"
imagePullPolicy: {{ .Values.imagePullPolicy }}
command:
- ./podinfo
- --port={{ .Values.containerPort }}
- --level={{ .Values.logLevel }}
env:
- name: PODINFO_UI_COLOR
value: green
ports:
- name: http
containerPort: {{ .Values.containerPort }}
protocol: TCP
livenessProbe:
exec:
command:
- podcli
- check
- http
- localhost:{{ .Values.containerPort }}/healthz
readinessProbe:
exec:
command:
- podcli
- check
- http
- localhost:{{ .Values.containerPort }}/readyz
periodSeconds: 3
volumeMounts:
- name: data
mountPath: /data
resources:
{{ toYaml .Values.resources | indent 12 }}
volumes:
- name: data
emptyDir: {}
21 changes: 21 additions & 0 deletions charts/podinfo-steerer/templates/canary-hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: {{ template "podinfo-steerer.canary" . }}
labels:
app: {{ template "podinfo-steerer.fullname" . }}
chart: {{ template "podinfo-steerer.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ template "podinfo-steerer.canary" . }}
minReplicas: {{ .Values.hpa.minReplicas }}
maxReplicas: {{ .Values.hpa.maxReplicas }}
metrics:
- type: Resource
resource:
name: cpu
targetAverageUtilization: {{ .Values.hpa.targetAverageUtilization }}
18 changes: 18 additions & 0 deletions charts/podinfo-steerer/templates/canary-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: v1
kind: Service
metadata:
name: {{ template "podinfo-steerer.canary" . }}
labels:
app: {{ template "podinfo-steerer.fullname" . }}
chart: {{ template "podinfo-steerer.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
type: ClusterIP
ports:
- port: {{ .Values.containerPort }}
targetPort: http
protocol: TCP
name: http
selector:
app: {{ template "podinfo-steerer.canary" . }}
63 changes: 63 additions & 0 deletions charts/podinfo-steerer/templates/primary-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "podinfo-steerer.primary" . }}
labels:
app: {{ template "podinfo-steerer.fullname" . }}
chart: {{ template "podinfo-steerer.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 0
selector:
matchLabels:
app: {{ template "podinfo-steerer.primary" . }}
template:
metadata:
labels:
app: {{ template "podinfo-steerer.primary" . }}
annotations:
prometheus.io/scrape: "true"
spec:
terminationGracePeriodSeconds: 30
containers:
- name: podinfod
image: "quay.io/stefanprodan/podinfo:1.1.1"
imagePullPolicy: {{ .Values.imagePullPolicy }}
command:
- ./podinfo
- --port={{ .Values.containerPort }}
- --level={{ .Values.logLevel }}
env:
- name: PODINFO_UI_COLOR
value: blue
ports:
- name: http
containerPort: {{ .Values.containerPort }}
protocol: TCP
livenessProbe:
exec:
command:
- podcli
- check
- http
- localhost:{{ .Values.containerPort }}/healthz
readinessProbe:
exec:
command:
- podcli
- check
- http
- localhost:{{ .Values.containerPort }}/readyz
periodSeconds: 3
volumeMounts:
- name: data
mountPath: /data
resources:
{{ toYaml .Values.resources | indent 12 }}
volumes:
- name: data
emptyDir: {}
21 changes: 21 additions & 0 deletions charts/podinfo-steerer/templates/primary-hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: {{ template "podinfo-steerer.primary" . }}
labels:
app: {{ template "podinfo-steerer.fullname" . }}
chart: {{ template "podinfo-steerer.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ template "podinfo-steerer.primary" . }}
minReplicas: {{ .Values.hpa.minReplicas }}
maxReplicas: {{ .Values.hpa.maxReplicas }}
metrics:
- type: Resource
resource:
name: cpu
targetAverageUtilization: {{ .Values.hpa.targetAverageUtilization }}
18 changes: 18 additions & 0 deletions charts/podinfo-steerer/templates/primary-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: v1
kind: Service
metadata:
name: {{ template "podinfo-steerer.primary" . }}
labels:
app: {{ template "podinfo-steerer.fullname" . }}
chart: {{ template "podinfo-steerer.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
type: ClusterIP
ports:
- port: {{ .Values.containerPort }}
targetPort: http
protocol: TCP
name: http
selector:
app: {{ template "podinfo-steerer.primary" . }}
30 changes: 30 additions & 0 deletions charts/podinfo-steerer/templates/virtual-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: {{ template "podinfo-steerer.fullname" . }}
labels:
app: {{ template "podinfo-steerer.fullname" . }}
chart: {{ template "podinfo-steerer.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
hosts:
- {{ template "podinfo-steerer.fullname" . }}
{{- if .Values.gateway.enabled }}
- {{ .Values.gateway.host }}
gateways:
- {{ .Values.gateway.name }}
{{- end }}
http:
- route:
- destination:
host: {{ template "podinfo-steerer.primary" . }}
port:
number: {{ .Values.containerPort }}
weight: 100
- destination:
host: {{ template "podinfo-steerer.canary" . }}
port:
number: {{ .Values.containerPort }}
weight: 0
timeout: {{ .Values.timeout }}
30 changes: 30 additions & 0 deletions charts/podinfo-steerer/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Default values for podinfo-steerer.

canary:
repository: quay.io/stefanprodan/podinfo
tag: "1.2.0"

# enable the gateway when exposing the service outside the cluster
gateway:
enabled: false
name: public-gateway.istio-system.svc.cluster.local
# external domain name
host:

hpa:
minReplicas: 2
maxReplicas: 4
targetAverageUtilization: 99

timeout: 30s
logLevel: info
containerPort: 9898
imagePullPolicy: IfNotPresent

resources:
limits:
cpu: 2000m
memory: 512Mi
requests:
cpu: 100m
memory: 64Mi
Loading

0 comments on commit 26500e9

Please sign in to comment.