Skip to content

Commit

Permalink
Merge pull request #14 from Financial-Times/kubernetes-changes
Browse files Browse the repository at this point in the history
Helm & Jenkins integration
  • Loading branch information
nwrigh committed Sep 1, 2017
2 parents c158608 + 89dd878 commit a0dee89
Show file tree
Hide file tree
Showing 9 changed files with 141 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,7 @@ _testmain.go
*.exe
*.test
*.prof

public-people-api
vendor/*/
vendor/*/

3 changes: 3 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@Library('k8s-pipeline-lib') _

uppEntryPointForJenkinsfile()
21 changes: 21 additions & 0 deletions helm/public-people-api/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
4 changes: 4 additions & 0 deletions helm/public-people-api/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
description: public-people-api Helm chart for Kubernetes
name: public-people-api
version: 0.0.0 # this entry can be left untouched as it is automatically handled by Jenkins pipeline
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Values used for the deployed application.
replicaCount: 2
service:
name: public-people-api
16 changes: 16 additions & 0 deletions helm/public-people-api/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 24 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create a default fully qualified app name.
We truncate at 24 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "fullname" -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- printf "%s-%s" .Release.Name $name | trunc 24 | trimSuffix "-" -}}
{{- end -}}
55 changes: 55 additions & 0 deletions helm/public-people-api/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
##this is an example deployment.yaml that should be customized in order to meet the configuration for app k8s deployment

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: {{ .Values.service.name }}
labels:
chart: "{{ .Chart.Name | trunc 63 }}"
chartVersion: "{{ .Chart.Version | trunc 63 }}"
visualize: "true"
app: {{ .Values.service.name }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app: {{ .Values.service.name }}
template:
metadata:
labels:
app: {{ .Values.service.name }}
visualize: "true"
spec:
containers:
- name: {{ .Values.service.name }}
image: "{{ .Values.image.repository }}:{{ .Chart.Version }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
- name: CACHE_DURATION
value: {{ .Values.cache_duration }}
- name: NEO_URL
valueFrom:
configMapKeyRef:
name: global-config
key: neo4j.read.only.url
- name: GRAPHITE_ADDRESS
valueFrom:
configMapKeyRef:
name: global-config
key: graphite.address
- name: GRAPHITE_PREFIX
value: coco.services.k8s.public-people-api
ports:
- containerPort: 8080
livenessProbe:
tcpSocket:
port: 8080
initialDelaySeconds: 10
readinessProbe:
httpGet:
path: "/__gtg"
port: 8080
initialDelaySeconds: 15
periodSeconds: 30
resources:
{{ toYaml .Values.resources | indent 12 }}
19 changes: 19 additions & 0 deletions helm/public-people-api/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
##this is an example service.yaml that should be customized in order to meet the configuration for app service

kind: Service
apiVersion: v1
metadata:
name: {{.Values.service.name}}
labels:
chart: "{{ .Chart.Name | trunc 63 }}"
chartVersion: "{{ .Chart.Version | trunc 63 }}"
app: {{.Values.service.name}}
visualize: "true"
hasHealthcheck: "{{ .Values.service.hasHealthcheck }}"
spec:
ports:
- port: 8080
name: "app"
targetPort: 8080
selector:
app: {{ .Values.service.name }}
16 changes: 16 additions & 0 deletions helm/public-people-api/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Default values for public-people-api.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
service:
name: "" # The name of the service, should be defined in the specific app-configs folder.
hasHealthcheck: "true"
replicaCount: 2
image:
repository: coco/public-people-api
pullPolicy: IfNotPresent
cache_duration: 10m
resources:
limits:
memory: 256Mi


0 comments on commit a0dee89

Please sign in to comment.