Configuring a user identity with access policies
The User custom resource creates and manages a user in a NiFi instance. Cloudera Flow Management Operator for Kubernetes reconciles the user in the NiFi API and optionally provisions a client certificate and access policies for that user.
Each User resource targets a single Nifi instance. When
created, the operator registers the user in the NiFi API and writes the NiFi-assigned UUID
back to status.identifier, which indicates the User was created
successfully. Future reconciliations will update user identity, if it is changed, and keep
access policies in sync. When the resource is deleted, the operator removes the user from
NiFi and from all of its access policies before releasing the finalizer.
Spec fields
| Field | Type | Required | Description |
|---|---|---|---|
instanceTarget |
InstanceTarget |
Yes | The Nifi instance to manage the user in |
identity |
string |
Yes | The username displayed in NiFi and used as the certificate CN / DNS SAN |
certificate |
CertificateSpec |
No | Controls client certificate generation; omit to disable |
accessPolicies |
[]AccessPolicy |
No | Inline access policies granted to this user |
accessPolicyProfileRef |
[]ObjectReference |
No | References to AccessPolicyProfile resources |
instanceTarget
| Field | Type | Required | Description |
|---|---|---|---|
kind |
Nifi |
Yes | Kind of the target resource |
name |
string |
Yes | Name of the target resource |
namespace |
string |
No | Namespace of the target; defaults to the User's namespace |
accessPolicies
Each entry specifies one or more NiFi resource paths and the actions to grant on them.
| Field | Type | Description |
|---|---|---|
resources |
[]string |
NiFi resource paths, e.g. /process-groups/root,
/flow, /policies |
resourceRefs |
[]ResourceRef |
References to Kubernetes resources whose NiFi identifier is resolved at
reconcile time; Cloudera Flow Management Operator for Kubernetes accepts at most 500 per policy
(an operator-side bound, not a NiFi limit). See resourceRefs
below. |
actions |
[]string |
read, write, or both |
At least one of resources or resourceRefs must be set.
When both are set, the resolved /process-groups/<id> paths are
combined with the literal resources into one policy sharing the entry's
actions.
Policies specified inline in accessPolicies take precedence over any
conflicting policy for the same resource inherited from an
AccessPolicyProfile.
Each entry in resourceRefs references a ProcessGroup by
name instead of a literal NiFi path, so a user can be granted access to a flow without first
looking up the NiFi-assigned identifier. Cloudera Flow Management Operator for Kubernetes resolves the
reference to /process-groups/<status.identifier> at reconcile
time.
| Field | Type | Required | Description |
|---|---|---|---|
kind |
string |
Yes | Must be ProcessGroup. |
name |
string |
Yes | Name of the ProcessGroup resource. |
namespace |
string |
No | Namespace of the ProcessGroup; defaults to the
User's namespace. |
resourceRefs behaves as follows:
-
Each reference resolves to a single NiFi component policy at
/process-groups/<id>with theactionsrequested on the reference. -
The referenced
ProcessGroupmust target the sameNifiinstance as theUser. -
If a referenced
ProcessGroupdoes not exist or has not yet been assigned a NiFi identifier, that reference is skipped for the current reconcile; the policies that do resolve are still applied, and theUserre-reconciles automatically once theProcessGroupis ready. -
The
CompleteAccessPoliciesstatus condition reports the outcome:Truewhen all references resolved,Falsewith reasonProcessGroupRefNotResolvedwhile a reference is still pending,Falsewith reasonProcessGroupTargetsDifferentNiFiwhen a reference points at aProcessGroupon anotherNifi(which requires a spec fix), and absent when noresourceRefsare declared. It does not gateUserReady. -
Cloudera Flow Management Operator for Kubernetes lists unresolved references in the condition message as
namespace/name, naming at most 20 per category so the message stays under the Kubernetes 32768-character limit. Longer lists end with, and N more.
Examples
- Minimal user
-
apiVersion: cfm.cloudera.com/v1alpha1 kind: User metadata: name: alice spec: instanceTarget: kind: Nifi name: my-nifi identity: alice - User with read access to the root process group
-
apiVersion: cfm.cloudera.com/v1alpha1 kind: User metadata: name: alice spec: instanceTarget: kind: Nifi name: my-nifi identity: alice accessPolicies: - resources: - /process-groups/root - /flow actions: - read - User with a generated client certificate
-
Requires the target
Nifito havespec.security.nodeCertGenconfigured. The operator creates a cert-managerCertificatein the same namespace, usingspec.identityas both the CommonName and DNS SAN. The resulting Secret will contain a valid client certificate that can be used to authenticate as the user to the NiFi API.apiVersion: cfm.cloudera.com/v1alpha1 kind: User metadata: name: alice spec: instanceTarget: kind: Nifi name: my-nifi identity: alice certificate: generate: true - User with access to a ProcessGroup
-
apiVersion: cfm.cloudera.com/v1alpha1 kind: User metadata: name: alice spec: instanceTarget: kind: Nifi name: my-nifi identity: alice accessPolicies: - actions: - read - write resourceRefs: - kind: ProcessGroup name: my-flow - User with policies from an AccessPolicyProfile
-
apiVersion: cfm.cloudera.com/v1alpha1 kind: User metadata: name: alice spec: instanceTarget: kind: Nifi name: my-nifi identity: alice accessPolicyProfileRef: - name: read-only-profile namespace: default
Lifecycle
- Creation
-
The operator registers the user in the NiFi API. The NiFi-assigned UUID is written to
status.identifierand used by the operator when making additional changes. - Identity rename
-
Updating
spec.identityrenames the user in the NiFi API on the next reconciliation. Thestatus.identifieris preserved, so NiFi-internal references (policy memberships, group memberships) are not affected. - Access policy changes
-
On each reconciliation the operator computes the desired policy set by merging inline
accessPolicieswith any referenced profiles and diffs it against the current NiFi state. Missing policies are added and stale policies are removed. Removing a policy only removes the user from that policy; the policy itself is never deleted. - Deletion
-
Deleting the
Userresource removes the user from the NiFi API and from all access policies, then deletes the generated client certificate (if any) before releasing the finalizer. If the targetNifiresource is not found at deletion time, the NiFi-side cleanup is skipped and the finalizer is still removed.
Relationship to UserGroup
Users can be collected into UserGroup resources by direct reference
(spec.userRefs). This will assign those users to the relevant user group
in NiFi.
