Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
alexnuttinck committed Sep 22, 2020
2 parents 58c84ff + fc90139 commit 60e8cfb
Show file tree
Hide file tree
Showing 17 changed files with 498 additions and 67 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
*.tgz

# Helm Charts dependencies
/charts
/charts/*.tgz
*.lock

.idea
5 changes: 4 additions & 1 deletion Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
apiVersion: v2
name: nifi
version: 0.5.1
version: 0.5.2
appVersion: 1.11.4
description: Apache NiFi is a software project from the Apache Software Foundation designed to automate the flow of data between software systems.
keywords:
Expand All @@ -26,3 +26,6 @@ dependencies:
version: 0.1.0
repository: https://dysnix.github.io/charts/
condition: registry.enabled
- name: ca
version: 1.0.0
condition: ca.enabled
37 changes: 29 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

This [Helm](https://github.com/kubernetes/helm) chart installs [nifi](https://nifi.apache.org/) in a Kubernetes cluster.

:warning: As explained in several issues, this helm chart does not allow TLS configurations and secure Admin access. We are currently working on this feature, but any help is welcome.

## Prerequisites

- Kubernetes cluster 1.10+
Expand Down Expand Up @@ -39,6 +37,13 @@ The following items can be set via `--set` flag during installation or configure
- **Disable**: The data does not survive the termination of a pod.
- **Persistent Volume Claim(default)**: A default `StorageClass` is needed in the Kubernetes cluster to dynamic provision the volumes. Specify another StorageClass in the `storageClass` or set `existingClaim` if you have already existing persistent volumes to use.

#### Configure authentication:

- You first need a secure cluster which can be accomplished by enabling the built-in CA nifi-toolkit container (`ca.enabled` to true). By default, a secure nifi cluster uses certificate based authentication but you can optionally enable `ldap` or `oidc`. See the configuration section for more details.

:warning: This feature is quite new. Please open an issue if you encounter a problem.
We are currently working on the `ldap` authentication. Also, any help is welcome to add other authentication methods.

### Install the chart

Install the nifi helm chart with a release name `my-release`:
Expand Down Expand Up @@ -104,10 +109,16 @@ The following table lists the configurable parameters of the nifi chart and the
| `properties.siteToSite.authorizer` | | `managed-authorizer` |
| `properties.safetyValve` | Map of explicit 'property: value' pairs that overwrite other configuration | `nil` |
| **nifi user authentication** |
| `auth.admin` | Default admin identity | ` CN=admin, OU=NIFI` |
| `auth.ldap.enabled` | Enable User auth via ldap | `false` |
| `auth.ldap.host` | ldap hostname | `ldap://<hostname>:<port>` |
| `auth.ldap.searchBase` | ldap searchBase | `CN=Users,DC=example,DC=com` |
| `auth.ldap.searchFilter` | ldap searchFilter | `CN=john` |
| `auth.oidc.enabled` | Enable User auth via oidc | `false` |
| `auth.oidc.discoveryUrl` | oidc discover url | `https://<provider>/.well-known/openid-configuration` |
| `auth.oidc.clientId` | oidc clientId | `nil` |
| `auth.oidc.clientSecret` | oidc clientSecret | `nil` |
| `auth.oidc.claimIdentifyingUser` | oidc claimIdentifyingUser | `email` |
| **postStart** |
| `postStart` | Include additional libraries in the Nifi containers by using the postStart handler | `nil` |
| **Headless Service** |
Expand All @@ -132,6 +143,8 @@ The following table lists the configurable parameters of the nifi chart and the
| `persistence.enabled` | Use persistent volume to store data | `false` |
| `persistence.storageClass` | Storage class name of PVCs (use the default type if unset) | `nil` |
| `persistence.accessMode` | ReadWriteOnce or ReadOnly | `[ReadWriteOnce]` |
| `persistence.configStorage.size` | Size of persistent volume claim | `100Mi` |
| `persistence.authconfStorage.size` | Size of persistent volume claim | `100Mi` |
| `persistence.dataStorage.size` | Size of persistent volume claim | `1Gi` |
| `persistence.flowfileRepoStorage.size` | Size of persistent volume claim | `10Gi` |
| `persistence.contentRepoStorage.size` | Size of persistent volume claim | `10Gi` |
Expand Down Expand Up @@ -164,18 +177,26 @@ The following table lists the configurable parameters of the nifi chart and the
| **extraContainers** |
| `extraContainers` | Additional container-specifications that should run within the pod (see [spec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#container-v1-core) for details) | `[]` |
| **zookeeper** |
|`zookeeper.enabled` | If true, deploy Zookeeper | `true` |
|`zookeeper.url` | If the Zookeeper Chart is disabled a URL and port are required to connect | `nil` |
|`zookeeper.port` | If the Zookeeper Chart is disabled a URL and port are required to connect | `2181` |
| `zookeeper.enabled` | If true, deploy Zookeeper | `true` |
| `zookeeper.url` | If the Zookeeper Chart is disabled a URL and port are required to connect | `nil` |
| `zookeeper.port` | If the Zookeeper Chart is disabled a URL and port are required to connect | `2181` |
| **registry** |
|`registry.enabled` | If true, deploy Nifi Registry | `true` |
|`registry.url` | If the Nifi Registry Chart is disabled a URL and port are required to connect | `nil` |
|`registry.port` | If the Nifi Registry Chart is disabled a URL and port are required to connect | `80` |
| `registry.enabled` | If true, deploy Nifi Registry | `true` |
| `registry.url` | If the Nifi Registry Chart is disabled a URL and port are required to connect | `nil` |
| `registry.port` | If the Nifi Registry Chart is disabled a URL and port are required to connect | `80` |
| **ca** |
| `ca.enabled` | If true, deploy Nifi Toolkit as CA | `false` |
| `ca.server` | CA server dns name | `nil` |
| `ca.port` | CA server port number | `9090` |
| `ca.token` | The token to use to prevent MITM | `80` |
| `ca.admin.cn` | CN for admin certificate | `admin` |

## Credits

Initially inspired from https://github.com/YolandaMDavis/apache-nifi.

TLS work/inspiration from https://github.com/sushilkm/nifi-chart.git.

## Contributing

Feel free to contribute by making a [pull request](https://github.com/cetic/helm-nifi/pull/new/master).
Expand Down
23 changes: 23 additions & 0 deletions charts/ca/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# 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
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
12 changes: 12 additions & 0 deletions charts/ca/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v2
name: ca
version: 1.0.0
# We are using the nifi version as appVersion
appVersion: 1.11.4
description: A Helm chart to deploy ca server to generate self-signed certificates using nifi-toolkit.
keywords:
- nifi-toolkit
- ca
- self-signed certs
home: https://nifi.apache.org/
icon: https://svn.apache.org/repos/asf/nifi/site/trunk/images/niFi-logo-horizontal-scaled.png
6 changes: 6 additions & 0 deletions charts/ca/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
The release is named {{ .Release.Name }}.

To learn more about the release, try:

helm -n {{ .Release.Namespace }} status {{ .Release.Name }}
helm -n {{ .Release.Namespace }} get all {{ .Release.Name }}
25 changes: 25 additions & 0 deletions charts/ca/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "ca.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 "ca.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 -}}
81 changes: 81 additions & 0 deletions charts/ca/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "ca.fullname" . }}
labels:
app: {{ template "ca.name" . }}-ca
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: {{ .Release.Name | quote }}
heritage: {{ .Release.Service | quote }}
spec:
replicas: 1
selector:
matchLabels:
app: {{ template "ca.name" . }}-ca
release: {{ .Release.Name }}
template:
metadata:
labels:
app: {{ template "ca.name" . }}-ca
release: {{ .Release.Name }}
spec:
containers:
- name: ca
imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
command:
- sh
- -c
- |
if [ -f config.json ]; then
OPTIONS="--configJson config.json --useConfigJson"
fi
exec ${NIFI_TOOLKIT_HOME}/bin/tls-toolkit.sh server -c "{{ template "ca.fullname" . }}" -t {{ .Values.token }} -p {{ .Values.app_port }} ${OPTIONS}
resources:
{{ toYaml .Values.resources | indent 10 }}
ports:
- containerPort: {{ .Values.app_port }}
livenessProbe:
initialDelaySeconds: 90
periodSeconds: 60
tcpSocket:
port: {{ .Values.app_port }}
{{- if .Values.persistence.enabled }}
volumeMounts:
- mountPath: /ca
name: nifi-ca
subPath: ca
workingDir: /ca
{{- end }}
terminationGracePeriodSeconds: 0
{{- if .Values.persistence.enabled }}
initContainers:
- command:
- sh
- -c
- chown -R 1000:1000 /ca
image: busybox
imagePullPolicy: IfNotPresent
name: volume-permissions
resources: {}
securityContext:
allowPrivilegeEscalation: false
capabilities: {}
privileged: false
readOnlyRootFilesystem: false
runAsNonRoot: false
stdin: true
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
tty: true
volumeMounts:
- mountPath: /ca
name: nifi-ca
subPath: ca

volumes:
- name: nifi-ca
persistentVolumeClaim:
claimName: nifi-ca
{{- end }}
18 changes: 18 additions & 0 deletions charts/ca/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: v1
kind: Service
metadata:
name: {{ template "ca.fullname" . }}
labels:
app: {{ template "ca.name" . }}-ca
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: {{ .Release.Name | quote }}
heritage: {{ .Release.Service | quote }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: {{ .Values.app_port }}
name: ca-server
selector:
app: {{ template "ca.name" . }}-ca
release: {{ .Release.Name }}
15 changes: 15 additions & 0 deletions charts/ca/templates/volume.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{{- if .Values.persistence.enabled }}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: nifi-ca
spec:
accessModes:
{{- range .Values.persistence.accessModes }}
- {{ . | quote }}
{{- end }}
storageClassName: {{ .Values.persistence.storageClass | quote }}
resources:
requests:
storage: {{ .Values.persistence.caStorage.size }}
{{- end }}
47 changes: 47 additions & 0 deletions charts/ca/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Default values for ca.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

replicaCount: 1

image:
repository: apache/nifi-toolkit
pullPolicy: IfNotPresent
tag: "1.11.4"

service:
type: ClusterIP
port: 9090

## Enable persistence using Persistent Volume Claims
## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/
##
persistence:
enabled: false

# When creating persistent storage, the NiFi helm chart can either reference an already-defined
# storage class by name, such as "standard" or can define a custom storage class by specifying
# customStorageClass: true and providing the "storageClass", "storageProvisioner" and "storageType".
# For example, to use SSD storage on Google Compute Engine see values-gcp.yaml
#
# To use a storage class that already exists on the Kubernetes cluster, we can simply reference it by name.
# For example:
# storageClass: standard
#
# The default storage class is used if this variable is not set.

accessModes: [ReadWriteOnce]

## Storage Capacities for persistent volumes
# Storage capacity for the 'data' directory, which is used to hold things such as the flow.xml.gz, configuration, state, etc.
caStorage:
size: 1Gi

resources:
requests:
memory: "250Mi"
cpu: "0.1"

app_port: 9090

token: sixteenCharacters
Loading

0 comments on commit 60e8cfb

Please sign in to comment.