Skip to content

Commit

Permalink
[stable/openiban] Add OpenIBAN chart (helm#7536)
Browse files Browse the repository at this point in the history
* Add OpenIBAN chart

Signed-off-by: Bart Verwilst <bart@verwilst.be>

* fix maintainer name

Signed-off-by: Bart Verwilst <bart@verwilst.be>

* make version 1.0.0

Signed-off-by: Bart Verwilst <bart@verwilst.be>
Signed-off-by: jenkin-x <jicowan@hotmail.com>
  • Loading branch information
verwilst authored and jicowan committed Oct 2, 2018
1 parent 1823c2f commit b899d72
Show file tree
Hide file tree
Showing 13 changed files with 403 additions and 0 deletions.
21 changes: 21 additions & 0 deletions stable/openiban/.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
14 changes: 14 additions & 0 deletions stable/openiban/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
appVersion: 1.0.1
description: OpenIBAN is a self-hosted, free and open-source IBAN validation API.
name: openiban
version: 1.0.0
keywords:
- iban
- golang
home: https://openiban.com
sources:
- https://github.com/fourcube/goiban-service
maintainers:
- name: verwilst
email: bart@verwilst.be
4 changes: 4 additions & 0 deletions stable/openiban/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
approvers:
- verwilst
reviewers:
- verwilst
79 changes: 79 additions & 0 deletions stable/openiban/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# OpenIBAN

[OpenIBAN](https://github.com/fourcube/goiban-service) implements a basic REST Web-service for validating IBAN account numbers in GO.

## TL;DR;

```bash
$ helm install stable/openiban
```

## Introduction

This chart bootstraps an [OpenIBAN](https://github.com/fourcube/goiban-service) deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.

## Prerequisites

- Kubernetes 1.9+ with Beta APIs enabled

## Installing the Chart

To install the chart with the release name `my-release`:

```bash
$ helm update --install my-release stable/openiban
```

The command deploys OpenIBAN on the Kubernetes cluster in the default configuration. The [configuration](#configuration) section lists the parameters that can be configured during installation.

> **Tip**: List all releases using `helm list`
## Uninstalling the Chart

To uninstall/delete the `my-release` deployment:

```bash
$ helm delete my-release
```

The command removes all the Kubernetes components associated with the chart and deletes the release.

## Configuration

The following table lists the configurable parameters of the Redmine chart and their default values.

| Parameter | Description | Default |
| --------------------------------- | ---------------------------------------- | ------------------------------------------------------- |
| `replicaCount` | Number of replicas to start | `1` |
| `image.repository` | Image name | `fourcube/openiban` |
| `image.tag` | Image tag | `1.0.1` |
| `image.pullPolicy` | Image pull policy | `IfNotPresent` |
| `service.type` | Desired service type | `ClusterIP` |
| `service.port` | Service exposed port | `8080` |
| `rbac.create` | Use Role-based Access Control | `true` |
| `serviceAccount.create` | Should we create a ServiceAccount | `true` |
| `serviceAccount.name` | Name of the ServiceAccount to use | `null` |
| `ingress.enabled` | Enable or disable the ingress | `false` |
| `ingress.hosts` | The virtual host name(s) | `{}` |
| `ingress.annotations` | An array of service annotations | `nil` |
| `ingress.tls[i].secretName` | The secret kubernetes.io/tls | `nil` |
| `ingress.tls[i].hosts[j]` | The virtual host name | `nil` |
| `resources` | Resources allocation (Requests and Limits) | `{}` |

Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,

```bash
$ helm upgrade --install my-release \
--set replicaCount=2 \
stable/openiban
```

The above command enables starts 2 replicas.

Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart. For example,

```bash
$ helm upgrade --install my-release -f values.yaml stable/openiban
```

> **Tip**: You can use the default [values.yaml](values.yaml)
19 changes: 19 additions & 0 deletions stable/openiban/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
1. Get the application URL by running these commands:
{{- if .Values.ingress.enabled }}
{{- range .Values.ingress.hosts }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ . }}{{ $.Values.ingress.path }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "openiban.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get svc -w {{ template "openiban.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "openiban.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "openiban.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl port-forward $POD_NAME 8080:80
{{- end }}
44 changes: 44 additions & 0 deletions stable/openiban/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "openiban.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).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "openiban.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}

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

{{/*
Create the name of the service account to use
*/}}
{{- define "openiban.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{ default (include "openiban.fullname" .) .Values.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}

57 changes: 57 additions & 0 deletions stable/openiban/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "openiban.fullname" . }}
labels:
app: {{ template "openiban.name" . }}
chart: {{ template "openiban.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app: {{ template "openiban.name" . }}
release: {{ .Release.Name }}
template:
metadata:
labels:
app: {{ template "openiban.name" . }}
release: {{ .Release.Name }}
spec:
{{- if .Values.securityContext.enabled }}
securityContext:
fsGroup: {{ .Values.securityContext.fsGroup }}
runAsUser: {{ .Values.securityContext.runAsUser }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: 8080
protocol: TCP
livenessProbe:
httpGet:
path: /validate/DE89370400440532013000
port: http
initialDelaySeconds: 5
readinessProbe:
httpGet:
path: /validate/DE89370400440532013000
port: http
resources:
{{ toYaml .Values.resources | indent 12 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{ toYaml . | indent 8 }}
{{- end }}
39 changes: 39 additions & 0 deletions stable/openiban/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "openiban.fullname" . -}}
{{- $servicePort := .Values.service.port -}}
{{- $ingressPath := .Values.ingress.path -}}
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: {{ $fullName }}
labels:
app: {{ template "openiban.name" . }}
chart: {{ template "openiban.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- with .Values.ingress.annotations }}
annotations:
{{ toYaml . | indent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ . }}
http:
paths:
- path: {{ $ingressPath }}
backend:
serviceName: {{ $fullName }}
servicePort: http
{{- end }}
{{- end }}
15 changes: 15 additions & 0 deletions stable/openiban/templates/role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{{- if .Values.rbac.create }}
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{ template "openiban.fullname" . }}
labels:
app: {{ template "openiban.name" . }}
chart: {{ template "openiban.chart" . }}
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
rules:
- apiGroups: [""]
resources: ["endpoints"]
verbs: ["get"]
{{- end }}
18 changes: 18 additions & 0 deletions stable/openiban/templates/rolebinding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{{- if .Values.rbac.create }}
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{ template "openiban.fullname" . }}
labels:
app: {{ template "openiban.name" . }}
chart: {{ template "openiban.chart" . }}
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
subjects:
- kind: ServiceAccount
name: {{ template "openiban.serviceAccountName" . }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: {{ template "openiban.fullname" . }}
{{- end }}
19 changes: 19 additions & 0 deletions stable/openiban/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: v1
kind: Service
metadata:
name: {{ template "openiban.fullname" . }}
labels:
app: {{ template "openiban.name" . }}
chart: {{ template "openiban.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: 8080
protocol: TCP
name: http
selector:
app: {{ template "openiban.name" . }}
release: {{ .Release.Name }}
11 changes: 11 additions & 0 deletions stable/openiban/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{ if .Values.serviceAccount.create }}
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
app: {{ template "openiban.name" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: {{ template "openiban.serviceAccountName" . }}
{{- end -}}
Loading

0 comments on commit b899d72

Please sign in to comment.