Skip to content

Commit

Permalink
add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
erdrix committed Mar 8, 2020
1 parent ee66286 commit c2cee45
Show file tree
Hide file tree
Showing 6 changed files with 276 additions and 18 deletions.
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,12 @@ endif

release: tag image publish

# Install CRDS and Deploy controller in
# the configured Kubernetes cluster in ~/.kube/config
deploy: generate
kubectl apply -f deploy/crds/nifi.orange.com_nificlusters_crd.yaml
kubectl apply -f deploy/.

# golint is not fully supported by modules yet - https://github.com/golang/lint/issues/409
go-lint:
$(GO_LINT_CMD)
Expand Down
187 changes: 187 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
<p align="center"><img src="docs/img/nifi_logo.png" width="160"></p>

<p align="center">
<a href="https://hub.docker.com/r/orangeopensource/nifikop/">
<img src="https://img.shields.io/docker/cloud/automated/orangeopensource/nifikop.svg" alt="Docker Automated build">
</a>

<a href="https://circleci.com/gh/orangeopensource/nifikop">
<img src="https://circleci.com/gh/orangeopensource/nifikopr/tree/master.svg?style=shield" alt="CircleCI">
</a>

<a href="https://goreportcard.com/report/github.com/orangeopensource/nifikop">
<img src="https://goreportcard.com/badge/github.com/orangeopensource/nifikop" alt="Go Report Card">
</a>

<a href="https://github.com/orangeopensource/nifikop/">
<img src="https://img.shields.io/badge/license-Apache%20v2-orange.svg" alt="license">
</a>
</p>

# NiFiKop

The Orange NiFi operator is a Kubernetes operator to automate provisioning, management, autoscaling and operations of [Apache NiFi](https://nifi.apache.org/) clusters deployed to K8s.

## Overview

Apache NiFi is an open-source solution that support powerful and scalable directed graphs of data routing, transformation, and system mediation logic.
Some of the high-level capabilities and objectives of Apache NiFi include, and some of the main features of the **NiFiKop** are:

- **Fine grained** node configuration support
- Graceful rolling upgrade
- graceful NiFi cluster **scaling**

Some of the roadmap features :

- Monitoring via **Prometheus**
- Automatic reaction and self healing based on alerts (plugin system, with meaningful default alert plugins)
- Encrypted communication using SSL
- graceful NiFi cluster **scaling and rebalancing**
- Advanced Dataflow and user management via CRD
- the provisioning of secure NiFi clusters

## Motivation

At [Orange](https://opensource.orange.com/fr/accueil/) we are building some [Kubernetes operator](https://github.com/Orange-OpenSource?utf8=%E2%9C%93&q=operator&type=&language=), that operate NiFi and Cassandra clusters (among other types) for our business cases.

There are already some approaches to operating NiFi on Kubernetes, however, we did not find them appropriate for use in a highly dynamic environment, nor capable of meeting our needs.

- [Helm chart](https://github.com/cetic/helm-nifi)
- [Cloudera Nifi Operator](https://blog.cloudera.com/cloudera-flow-management-goes-cloud-native-with-apache-nifi-on-red-hat-openshift-kubernetes-platform/)

Finally, our motivation is to build an open source solution and a community which drives the innovation and features of this operator.


## Installation

The operator installs the 1.11.2 version of Apache NiFi, and can run on Minikube v0.33.1+ and Kubernetes 1.12.0+.

> The operator supports NiFi 1.11.0+
As a pre-requisite it needs a Kubernetes cluster. Also, NiFi requires Zookeeper so you need to first have a Zookeeper cluster if you don't already have one.

> We believe in the `separation of concerns` principle, thus the NiFi operator does not install nor manage Zookeeper.
### Install Zookeeper

To install Zookeeper we recommend using the [Pravega's Zookeeper Operator](https://github.com/pravega/zookeeper-operator).
You can deploy Zookeeper by using the Helm chart.

```bash
helm repo add banzaicloud-stable https://kubernetes-charts.banzaicloud.com/
# Using helm3
# You have to create the namespace before executing following command
helm install zookeeper-operator --namespace=zookeeper banzaicloud-stable/zookeeper-operator
# Using previous versions of helm
helm install --name zookeeper-operator --namespace=zookeeper banzaicloud-stable/zookeeper-operator
kubectl create --namespace zookeeper -f - <<EOF
apiVersion: zookeeper.pravega.io/v1beta1
kind: ZookeeperCluster
metadata:
name:zookeepercluster
namespace: zookeeper
spec:
replicas: 3
EOF
```

### Installation

We recommend to use a **custom StorageClass** to leverage the volume binding mode `WaitForFirstConsumer`

```bash
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: exampleStorageclass
parameters:
type: pd-standard
provisioner: kubernetes.io/gce-pd
reclaimPolicy: Delete
volumeBindingMode: WaitForFirstConsumer
```
> Remember to set your NiFiCluster CR properly to use the newly created StorageClass.
1. Set `KUBECONFIG` pointing towards your cluster
2. Run `make deploy` (deploys the operator in the current namespace into the cluster)
3. Set your NiFi configurations in a Kubernetes custom resource (sample: `config/samples/simplenificluster.yaml`) and run this command to deploy the NiFi components:

```bash
# Add your zookeeper svc name to the configuration
kubectl create -n nifi -f config/samples/simplenificluster.yaml
```

### Easy way: installing with Helm

Alternatively, if you are using Helm, you can deploy the operator using a Helm chart [Helm chart](https://github.com/orangeopensource/nifikop/tree/master/helm):

> To install the an other version of the operator use `helm install --name=nifikop --namespace=nifi --set operator.image.tag=x.y.z orange-incubator/nifikop`
```bash
helm repo add orange-incubator https://orange-kubernetes-charts-incubator.storage.googleapis.com/

# Using helm3
# You have to create the namespace before executing following command
helm install nifikop --namespace=nifi orange-incubator/nifikop
# Using previous versions of helm
helm install --name=nifikop --namespace=nifi orange-incubator/nifikop

# Add your zookeeper svc name to the configuration
kubectl create -n nifi -f config/samples/simplenificluster.yaml
```

## Test Your Deployment

## Development

Checkout out the [developer docs](docs/developer.md)

## Features

Check out the [supported features](docs/features.md)

## Issues, feature requests and roadmap

Please note that the NiFi operator is constantly under development and new releases might introduce breaking changes. We are striving to keep backward compatibility as much as possible while adding new features at a fast pace. Issues, new features or bugs are tracked on the projects [GitHub page](https://github.com/orangeopensource/nifikop/issues) - please feel free to add yours!

To track some of the significant features and future items from the roadmap please visit the [roadmap doc](docs/roadmap.md).

## Contributing

If you find this project useful here's how you can help:

- Send a pull request with your new features and bug fixes
- Help new users with issues they may encounter
- Support the development of this project and star this repo!

## Community

If you have any questions about the NiFi operator, and would like to talk to us and the other members of the community, please join our [Slack](https://slack.nifikop.io/).

If you find this project useful, help us:

- Support the development of this project and star this repo! :star:
- If you use the Nifi operator in a production environment, add yourself to the list of production [adopters](https://github.com/orangeopensource/nifikop/blob/master/ADOPTERS.md). :metal: <br>
- Help new users with issues they may encounter :muscle:
- Send a pull request with your new features and bug fixes :rocket:

## Credits

- Operator implementation based on [banzaicloud/kafka-operator](https://github.com/banzaicloud/kafka-operator)
- NiFi kubernetes setup configuration inspired from [cetic/helm-nifi](https://github.com/cetic/helm-nifi)

## License

Copyright (c) 2019 [Orange, Inc.](https://opensource.orange.com)

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

[http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
1 change: 1 addition & 0 deletions cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ func printVersion() {
}

func main() {

// Add the zap logger flag set to the CLI. The flag set must
// be added before calling pflag.Parse().
pflag.CommandLine.AddFlagSet(zap.FlagSet())
Expand Down
46 changes: 28 additions & 18 deletions config/samples/nifi.orange.com_v1alpha1_nificluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ spec:
# A comma separated list of allowed HTTP Host header values to consider when NiFi
# is running securely and will be receiving requests to a different host[:port] than it is bound to.
# https://nifi.apache.org/docs/nifi-docs/html/administration-guide.html#web-properties
# webProxyHost:
# webProxyHost:
# Nifi security client auth
needClientAuth: false
# Indicates which of the configured authorizers in the authorizers.xml file to use
# https://nifi.apache.org/docs/nifi-docs/html/administration-guide.html#authorizer-configuration
# authorizer:
# authorizer:
# ZookeeperProperties configuration that will be applied to the node.
zookeeperProperties:
# Additionnals zookeeper.properties configuration that will override the one produced based
Expand Down Expand Up @@ -70,13 +70,13 @@ spec:
isNode: true
# Docker image used by the operator to create the node associated
# https://hub.docker.com/r/apache/nifi/
# image: "apache/nifi:1.11.2"
# image: "apache/nifi:1.11.2"
# nodeAffinity can be specified, operator populates this value if new pvc added later to node
# https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#node-affinity
# nodeAffinity:
# nodeAffinity:
# storageConfigs specifies the node log related configs
storageConfigs:
# Name of the storage config, used to name PV to reuse into sidecars for example.
# Name of the storage config, used to name PV to reuse into sidecars for example.
- name: provenance-repository
# Path where the volume will be mount into the main nifi container inside the pod.
mountPath: "/opt/nifi/provenance_repository"
Expand All @@ -103,22 +103,28 @@ spec:
# resourceRequirements works exactly like Container resources, the user can specify the limit and the requests
# through this property
# https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/
# resourcesRequirements:
resourcesRequirements:
limits:
cpu: "2"
memory: 3Gi
requests:
cpu: "1"
memory: 1Gi
# imagePullSecrets specifies the secret to use when using private registry
# https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.11/#localobjectreference-v1-core
# imagePullSecrets:
# imagePullSecrets:
# nodeSelector can be specified, which set the pod to fit on a node
# https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector
# nodeSelector:
# nodeSelector:
# tolerations can be specified, which set the pod's tolerations
# https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/#concepts
# tolerations:
# tolerations:
# Additionnal annotation to attach to the pod associated
# https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/#syntax-and-character-set
# nodeAnnotations:
# nodeAnnotations:
# all node requires an image, unique id, and storageConfigs settings
nodes:
# Unique Node id
# Unique Node id
- id: 0
# nodeConfigGroup can be used to ease the node configuration, if set no only the id is required
nodeConfigGroup: "default_group"
Expand All @@ -129,7 +135,7 @@ spec:
overrideConfigs: |
nifi.ui.banner.text=NiFiKop by Orange - Node 0
# node configuration
# nodeConfig:
# nodeConfig:
- id: 2
# readOnlyConfig can be used to pass Nifi node config
# which has type read-only these config changes will trigger rolling upgrade
Expand All @@ -138,6 +144,13 @@ spec:
nifi.ui.banner.text=NiFiKop by Orange - Node 2
# node configuration
nodeConfig:
resourcesRequirements:
limits:
cpu: "2"
memory: 3Gi
requests:
cpu: "1"
memory: 1Gi
storageConfigs:
# Name of the storage config, used to name PV to reuse into sidecars for example.
- name: provenance-repository
Expand All @@ -152,9 +165,6 @@ spec:
resources:
requests:
storage: 8Gi
- id: 12
# nodeConfigGroup can be used to ease the node configuration, if set no only the id is required
nodeConfigGroup: "default_group"
# rollingUpgradeConfig specifies the rolling upgrade config for the cluster
rollingUpgradeConfig:
# failureThreshold states that how many errors can the cluster tolerate during rolling upgrade
Expand All @@ -170,12 +180,12 @@ spec:
# If set to true, we will enable ldap usage into nifi.properties configuration.
enabled: false
# Space-separated list of URLs of the LDAP servers (i.e. ldap://<hostname>:<port>).
# url:
# url:
# Base DN for searching for users (i.e. CN=Users,DC=example,DC=com).
# searchBase:
# searchBase:
# Filter for searching for users against the 'User Search Base'.
# (i.e. sAMAccountName={0}). The user specified name is inserted into '{0}'.
# searchFilter:
# searchFilter:
# NifiClusterTaskSpec specifies the configuration of the nifi cluster Tasks
nifiClusterTaskSpec:
# retryDurationMinutes describes the amount of time the Operator waits for the task
Expand Down
54 changes: 54 additions & 0 deletions config/samples/simplenificluster.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
apiVersion: nifi.orange.com/v1alpha1
kind: NifiCluster
metadata:
name: simplenifi
spec:
headlessServiceEnabled: true
zkAddresse: "zookeepercluster-client.zookeeper:2181"
zkPath: "/simplenifi"
clusterImage: "apache/nifi:1.11.2"
oneNifiNodePerNode: false
nodeConfigGroups:
default_group:
isNode: true
storageConfigs:
- mountPath: "/opt/nifi/nifi-current/logs"
name: logs
pvcSpec:
accessModes:
- ReadWriteOnce
storageClassName: "standard"
resources:
requests:
storage: 10Gi
serviceAccountName: "default"
resourcesRequirements:
limits:
cpu: "2"
memory: 3Gi
requests:
cpu: "1"
memory: 1Gi
nodes:
- id: 0
nodeConfigGroup: "default_group"
- id: 1
nodeConfigGroup: "default_group"
- id: 2
nodeConfigGroup: "default_group"
rollingUpgradeConfig:
failureThreshold: 10
propagateLabels: true
nifiClusterTaskSpec:
retryDurationMinutes: 10
listenersConfig:
internalListeners:
- type: "http"
name: "http"
containerPort: 8080
- type: "cluster"
name: "cluster"
containerPort: 6007
- type: "s2s"
name: "s2s"
containerPort: 10000
Binary file added docs/img/nifi_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit c2cee45

Please sign in to comment.