Skip to content
This repository has been archived by the owner on May 2, 2018. It is now read-only.

Commit

Permalink
Helm and Jenkins integration
Browse files Browse the repository at this point in the history
  • Loading branch information
Tamas Molnar committed Jul 13, 2017
1 parent d51b977 commit 94aaf14
Show file tree
Hide file tree
Showing 11 changed files with 206 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*.html
*coverage.*
*.iml
v1-brands-transformer
/v1-brands-transformer
.idea/
*.db
*.lock
Expand Down
7 changes: 7 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@Library('k8s-pipeline-lib') _

import com.ft.jenkins.BuildConfig
import com.ft.jenkins.Cluster

BuildConfig config = new BuildConfig()
entryPointForReleaseAndDev(config)
21 changes: 21 additions & 0 deletions helm/v1-brands-transformer/.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/v1-brands-transformer/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
description: v1-brands-transformer Helm chart for Kubernetes
name: v1-brands-transformer
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,14 @@
# Values used for the deployed application.
replicaCount: 1
service:
name: v1-brands-transformer
cache:
size: 5Gi
nfsServer: fs-6330fcaa.efs.eu-west-1.amazonaws.com
path: "/"
env:
PORT: 8080
BASE_URL: "http://v1-brands-transformer:8080/transformers/brands/"
CACHE_FILE_NAME: "/cache/v1-brands-transformer.db"
BERTHA_SOURCE_URL: "http://bertha.ig.ft.com/republish/publish/gss/1wEdVRLtayZ6-XBfYM3vKAGaOV64cNJD3L8MlLM8-uFY/TestBrands"
LOG_METRICS: false
16 changes: 16 additions & 0 deletions helm/v1-brands-transformer/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 -}}
82 changes: 82 additions & 0 deletions helm/v1-brands-transformer/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: {{ .Values.service.name }}
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
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: TME_BASE_URL
valueFrom:
configMapKeyRef:
name: global-config
key: tme.url
- name: TME_USERNAME
valueFrom:
secretKeyRef:
name: global-secrets
key: tme.username
- name: TME_PASSWORD
valueFrom:
secretKeyRef:
name: global-secrets
key: tme.password
- name: TOKEN
valueFrom:
secretKeyRef:
name: global-secrets
key: tme.token
- name: GRAPHITE_ADDRESS
valueFrom:
configMapKeyRef:
name: global-config
key: graphite.address
- name: PORT
value: "{{ .Values.env.PORT }}"
- name: BASE_URL
value: {{ .Values.env.BASE_URL }}
- name: CACHE_FILE_NAME
value: {{ .Values.env.CACHE_FILE_NAME }}
- name: BERTHA_SOURCE_URL
value: {{ .Values.env.BERTHA_SOURCE_URL }}
- name: GRAPHITE_PREFIX
value: "coco.services.k8s.{{ .Values.service.name }}"
- name: LOG_METRICS
value: "{{ .Values.env.LOG_METRICS }}"
volumeMounts:
- name: "{{ .Values.service.name }}-cache"
mountPath: /cache
ports:
- containerPort: 8080
livenessProbe:
tcpSocket:
port: 8080
initialDelaySeconds: 5
readinessProbe:
httpGet:
path: "/__gtg"
port: 8080
initialDelaySeconds: 5
periodSeconds: 30
resources:
{{ toYaml .Values.resources | indent 12 }}
volumes:
- name: "{{ .Values.service.name }}-cache"
persistentVolumeClaim:
claimName: "{{ .Values.service.name }}-cache-pvc"
12 changes: 12 additions & 0 deletions helm/v1-brands-transformer/templates/pv.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
kind: PersistentVolume
apiVersion: v1
metadata:
name: "{{ .Values.service.name }}-cache-pv"
spec:
capacity:
storage: {{ .Values.cache.size }}
accessModes:
- ReadWriteMany
nfs:
server: {{ .Values.cache.nfsServer }}
path: {{ .Values.cache.path }}
10 changes: 10 additions & 0 deletions helm/v1-brands-transformer/templates/pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: {{ .Values.service.name }}-cache-pvc
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: {{ .Values.cache.size }}
16 changes: 16 additions & 0 deletions helm/v1-brands-transformer/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
kind: Service
apiVersion: v1
metadata:
name: {{.Values.service.name}}
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
app: {{.Values.service.name}}
visualize: "true"
hasHealthcheck: "{{ .Values.service.hasHealthcheck }}"
spec:
ports:
- port: 8080
# name: # The name of this port within the service. Optional if only one port is defined on this service
targetPort: 8080
selector:
app: {{ .Values.service.name }}
23 changes: 23 additions & 0 deletions helm/v1-brands-transformer/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Default values for v1-brands-transformer.
# 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: 1
image:
repository: coco/v1-brands-transformer
pullPolicy: IfNotPresent
resources:
limits:
memory: 1536Mi
cache:
size: 5Gi
nfsServer: ""
path: ""
env:
PORT: 8080
BASE_URL: ""
CACHE_FILE_NAME: ""
BERTHA_SOURCE_URL: ""
LOG_METRICS: false

0 comments on commit 94aaf14

Please sign in to comment.