Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions apps/nifi/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# NiFi and Py4J type stubs are maintained source files.
!typings/**/*.pyi

# Share the K3s example and keep deployment env files private.
!/env/
/env/*
!/env/nifi.env.example

# Mutable host configuration and processor state.
conf/flow.json.gz
conf/archive/
Expand Down
4 changes: 4 additions & 0 deletions apps/opensearch/env/opensearch.env
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ OPENSEARCH_DOCKER_IMAGE=opensearchproject/opensearch:3.9.0@sha256:3b55f6b6249cfd
OPENSEARCH_K3S_REPLICA_COUNT=1
# Comma-separated Kubernetes node names to exclude.
OPENSEARCH_K3S_BLACKLIST=
# Data PVC size per replica. Use a Kubernetes quantity such as 100Gi.
OPENSEARCH_K3S_VOLUME_SIZE="${OPENSEARCH_K3S_VOLUME_SIZE:-8Gi}"
# Leave empty to use the cluster's default StorageClass.
OPENSEARCH_K3S_STORAGE_CLASS="${OPENSEARCH_K3S_STORAGE_CLASS:-}"

OPENSEARCH_LOG_LEVEL=INFO

Expand Down
8 changes: 4 additions & 4 deletions deployment/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ Run the Makefile commands below from the `deployment/` directory. [Deployment Ma

After `make setup-all` succeeds, set `NGINX_TLS_NAMES` in `env/certificates.env`
to the hostname or IP clients will use for NGINX. Set the certificate store
passwords, provide deployment credentials, and create `../apps/nifi/env/nifi.env`
if it’s missing. [Environment settings](#environment-settings)
passwords, provide deployment credentials, and copy `../apps/nifi/env/nifi.env.example`
to `../apps/nifi/env/nifi.env` if it’s missing. [Environment settings](#environment-settings)

```bash
make certs-all
Expand Down Expand Up @@ -52,9 +52,9 @@ transport certificate for K3s. If you already have a bundle, set
| `env/general.env` | `KUBE_NAMESPACE` (default `cogstack`) and `CLUSTER_DOMAIN`. |
| `env/certificates.env` | `SECURITY_DIR`, `NGINX_TLS_NAMES`, and certificate store passwords. |
| `env/authentication.env` | NiFi login and OpenSearch account passwords. |
| `env/nifi.env` | `NIFI_UID`, `NIFI_GID`, `NIFI_DOCKER_*` resources, `NIFI_K3S_WHITELIST`, and `NIFI_INTERNAL_PORT_NGINX`. |
| `env/nifi.env` | `NIFI_UID`, `NIFI_GID`, `NIFI_DOCKER_*` resources, `NIFI_INTERNAL_PORT_NGINX`, `NIFI_K3S_WHITELIST`, `NIFI_K3S_STORAGE_CLASS`, and `NIFI_K3S_*_VOLUME_SIZE`. [NiFi storage settings](charts/nifi/README.md#persistent-configuration-and-data) |
| `env/nginx.env` (optional) | `NGINX_DOCKER_*` resource overrides and `NGINX_NIFI_SERVER_NAME`. |
| `env/opensearch.env` | `OPENSEARCH_K3S_REPLICA_COUNT`, `OPENSEARCH_K3S_BLACKLIST`, `OPENSEARCH_DOCKER_*` resources, and `OPENSEARCH_LOG_LEVEL`. |
| `env/opensearch.env` | `OPENSEARCH_K3S_REPLICA_COUNT`, `OPENSEARCH_K3S_BLACKLIST`, `OPENSEARCH_K3S_VOLUME_SIZE`, `OPENSEARCH_K3S_STORAGE_CLASS`, `OPENSEARCH_DOCKER_*` resources, and `OPENSEARCH_LOG_LEVEL`. |
| `env/opensearch-dashboards.env` | `OPENSEARCH_DASHBOARDS_DOCKER_*` resources. |

`k3s-prepare-all` reads login credentials from `env/authentication.env` by
Expand Down
24 changes: 16 additions & 8 deletions deployment/charts/nifi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,22 @@ Use the NGINX `/nifi/` and `/nifi-api/` routes with HTTP Basic authentication.

## Persistent configuration and data

The chart creates one claim per replica for each of:

- `flowfile_repository`
- `content_repository`
- `provenance_repository`
- `database_repository`
- `state`
- `conf`
The chart creates six PVCs per replica. Set their sizes in
`apps/nifi/env/nifi.env` using Kubernetes quantities such as `200Gi`. For a new
deployment, copy the example to that path. [NiFi env example](../../../apps/nifi/env/nifi.env.example)
[Environment-based values](#environment-based-values)

| Volume | Environment variable | Size per replica |
| --- | --- | --- |
| `flowfile_repository` | `NIFI_K3S_FLOWFILE_VOLUME_SIZE` | `20Gi` |
| `content_repository` | `NIFI_K3S_CONTENT_VOLUME_SIZE` | `100Gi` |
| `provenance_repository` | `NIFI_K3S_PROVENANCE_VOLUME_SIZE` | `50Gi` |
| `database_repository` | `NIFI_K3S_DATABASE_VOLUME_SIZE` | `5Gi` |
| `state` | `NIFI_K3S_STATE_VOLUME_SIZE` | `5Gi` |
| `conf` | `NIFI_K3S_CONF_VOLUME_SIZE` | `5Gi` |

Set `NIFI_K3S_STORAGE_CLASS` to a named StorageClass for the claims or leave
it blank to use the cluster default.

The initialization container seeds an empty configuration claim from
`$NIFI_HOME/conf` in the image, validates the required files and records a
Expand Down
14 changes: 7 additions & 7 deletions deployment/charts/nifi/values.env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,26 @@ nifi:
persistence:
# null uses the cluster default; "" selects no StorageClass (pre-provisioned PVs).
# Select a durable production backend; Retain does not replace backups.
storageClassName: null
storageClassName: ${NIFI_K3S_STORAGE_CLASS_YAML}
accessModes: [ReadWriteOnce]
# Every volume is a separate PVC per replica. Each can override storageClassName/accessModes.
# Existing data must be restored while NiFi is stopped; no automatic migration or resizing.
# Claim templates are immutable on existing StatefulSets; plan replacement/expansion explicitly.
volumes:
flowfile_repository:
size: 20Gi
size: "${NIFI_K3S_FLOWFILE_VOLUME_SIZE}"
content_repository:
size: 100Gi
size: "${NIFI_K3S_CONTENT_VOLUME_SIZE}"
provenance_repository:
size: 50Gi
size: "${NIFI_K3S_PROVENANCE_VOLUME_SIZE}"
database_repository:
size: 5Gi
size: "${NIFI_K3S_DATABASE_VOLUME_SIZE}"
state:
size: 5Gi
size: "${NIFI_K3S_STATE_VOLUME_SIZE}"
conf:
# Seeded only when empty; image upgrades never overwrite persisted configuration.
# Existing PVCs without .nifi-bootstrap-complete require verification and explicit marking.
size: 5Gi
size: "${NIFI_K3S_CONF_VOLUME_SIZE}"

resources:
requests:
Expand Down
21 changes: 16 additions & 5 deletions deployment/charts/opensearch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,28 @@ on three nodes to tolerate one node failure.

## Storage

The StatefulSet creates one 8 GiB PVC per pod and mounts it at
`/usr/share/opensearch/data`. Set `opensearch.persistence.size` and
`opensearch.persistence.storageClass` before installing. The first command
shows the claim template. The second lists claims after installation.
The StatefulSet creates one PVC per replica and mounts it at
`/usr/share/opensearch/data`. Set `OPENSEARCH_K3S_VOLUME_SIZE` in
`apps/opensearch/env/opensearch.env` to a Kubernetes quantity such as `100Gi`.
The default is `8Gi`. Set `OPENSEARCH_K3S_STORAGE_CLASS` to a named StorageClass
or leave it empty to use the cluster default.

Render the values and inspect the claim template before installing.

```bash
make -C deployment helm-values-opensearch
helm template opensearch deployment/charts/opensearch -n cogstack \
--show-only charts/opensearch/templates/statefulset.yaml
kubectl -n cogstack get pvc
```

After installing, list claims with `kubectl -n cogstack get pvc`. For direct
Helm installs, set `opensearch.persistence.size` and
`opensearch.persistence.storageClass` in your values file.

Kubernetes treats the StatefulSet claim template as immutable. To grow an
existing volume, update its PVC's storage request if the StorageClass supports
expansion. [PVC expansion](https://kubernetes.io/docs/concepts/storage/persistent-volumes/#expanding-persistent-volumes-claims)

## Configuration

`helm-install-opensearch` loads the bundled configuration with `--set-file` and
Expand Down
5 changes: 3 additions & 2 deletions deployment/charts/opensearch/values.env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ opensearch:
protocol: http
antiAffinity: hard
nodeAffinity: ${OPENSEARCH_K3S_NODE_AFFINITY}
# Each StatefulSet pod gets its own claim from the cluster's default StorageClass.
# Each StatefulSet pod gets its own claim. An empty storageClass uses the cluster default.
persistence:
enabled: true
size: 8Gi
size: "${OPENSEARCH_K3S_VOLUME_SIZE}"
storageClass: "${OPENSEARCH_K3S_STORAGE_CLASS}"
# Supply opensearch.yml with --set-file as shown in the README.
extraEnvs:
- name: DISABLE_INSTALL_DEMO_CONFIG
Expand Down
5 changes: 3 additions & 2 deletions deployment/charts/opensearch/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ opensearch:
protocol: http
antiAffinity: hard
nodeAffinity: {}
# Each StatefulSet pod gets its own claim from the cluster's default StorageClass.
# Each StatefulSet pod gets its own claim. An empty storageClass uses the cluster default.
persistence:
enabled: true
size: 8Gi
size: "8Gi"
storageClass: ""
# Supply opensearch.yml with --set-file as shown in the README.
extraEnvs:
- name: DISABLE_INSTALL_DEMO_CONFIG
Expand Down
20 changes: 18 additions & 2 deletions deployment/make/helm.mk
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,23 @@ helm-values-nifi helm-values-nginx helm-values-opensearch helm-values-opensearch
. "$$env_file"; \
set +a; \
case "$$service" in \
nifi) node_setting=NIFI_K3S_WHITELIST; export NIFI_K3S_ALLOWED_NODES='[]';; \
opensearch) node_setting=OPENSEARCH_K3S_BLACKLIST; export OPENSEARCH_K3S_NODE_AFFINITY='{}';; \
nifi) \
node_setting=NIFI_K3S_WHITELIST; \
export NIFI_K3S_ALLOWED_NODES='[]'; \
export NIFI_K3S_FLOWFILE_VOLUME_SIZE="$${NIFI_K3S_FLOWFILE_VOLUME_SIZE:-20Gi}"; \
export NIFI_K3S_CONTENT_VOLUME_SIZE="$${NIFI_K3S_CONTENT_VOLUME_SIZE:-100Gi}"; \
export NIFI_K3S_PROVENANCE_VOLUME_SIZE="$${NIFI_K3S_PROVENANCE_VOLUME_SIZE:-50Gi}"; \
export NIFI_K3S_DATABASE_VOLUME_SIZE="$${NIFI_K3S_DATABASE_VOLUME_SIZE:-5Gi}"; \
export NIFI_K3S_STATE_VOLUME_SIZE="$${NIFI_K3S_STATE_VOLUME_SIZE:-5Gi}"; \
export NIFI_K3S_CONF_VOLUME_SIZE="$${NIFI_K3S_CONF_VOLUME_SIZE:-5Gi}"; \
export NIFI_K3S_STORAGE_CLASS_YAML=null; \
if [ -n "$${NIFI_K3S_STORAGE_CLASS:-}" ]; then \
printf -v NIFI_K3S_STORAGE_CLASS_YAML '"%s"' "$$NIFI_K3S_STORAGE_CLASS"; \
fi;; \
opensearch) \
node_setting=OPENSEARCH_K3S_BLACKLIST; \
export OPENSEARCH_K3S_NODE_AFFINITY='{}'; \
export OPENSEARCH_K3S_VOLUME_SIZE="$${OPENSEARCH_K3S_VOLUME_SIZE:-8Gi}";; \
*) node_setting=;; \
esac; \
if [ -n "$$node_setting" ]; then \
Expand All @@ -49,6 +64,7 @@ helm-values-nifi helm-values-nginx helm-values-opensearch helm-values-opensearch
template="$$chart/values.env.yaml"; \
variables=$$(envsubst --variables "$$(cat "$$template")"); \
for name in $$variables; do \
if [ "$$name" = OPENSEARCH_K3S_STORAGE_CLASS ]; then continue; fi; \
value="$${!name:?Set $$name in $$env_file before rendering}"; \
if [[ "$$name" == *_DOCKER_RAM && "$$value" =~ ^([0-9]+([.][0-9]+)?)([kmgtp])[bB]?$$ ]]; then \
unit=$$(printf '%s' "$${BASH_REMATCH[3]}" | tr kmgtp KMGTP); \
Expand Down