NIFI-13454 Renamed FileParameterProvider to KubernetesSecretParameterProvider

This closes #9008

Signed-off-by: David Handermann <exceptionfactory@apache.org>
This commit is contained in:
Joe Gresock 2024-06-26 10:40:22 -04:00 committed by exceptionfactory
parent 5c9fb448a4
commit b105b5bbef
No known key found for this signature in database
5 changed files with 18 additions and 15 deletions

View File

@ -53,8 +53,10 @@ import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Tags({"file"}) @Tags({"file"})
@CapabilityDescription("Fetches parameters from files. Parameter groups are indicated by a set of directories, and files within the directories map to parameter names. " + @CapabilityDescription("Fetches parameters from files, in the format provided by Kubernetes mounted secrets. " +
"The content of the file becomes the parameter value.") "Parameter groups are indicated by a set of directories, and files within the directories map to parameter names. " +
"The content of the file becomes the parameter value. Since Kubernetes mounted Secrets are base64-encoded, the " +
"parameter provider defaults to Base64-decoding the value of the parameter from the file.")
@Restricted( @Restricted(
restrictions = { restrictions = {
@ -63,7 +65,7 @@ import java.util.stream.Collectors;
explanation = "Provides operator the ability to read from any file that NiFi has access to.") explanation = "Provides operator the ability to read from any file that NiFi has access to.")
} }
) )
public class FileParameterProvider extends AbstractParameterProvider implements VerifiableParameterProvider { public class KubernetesSecretParameterProvider extends AbstractParameterProvider implements VerifiableParameterProvider {
private static final int MAX_SIZE_LIMIT = 8096; private static final int MAX_SIZE_LIMIT = 8096;
private static final Charset DEFAULT_CHARSET = StandardCharsets.UTF_8; private static final Charset DEFAULT_CHARSET = StandardCharsets.UTF_8;

View File

@ -13,6 +13,6 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
org.apache.nifi.parameter.EnvironmentVariableParameterProvider org.apache.nifi.parameter.EnvironmentVariableParameterProvider
org.apache.nifi.parameter.FileParameterProvider org.apache.nifi.parameter.KubernetesSecretParameterProvider
org.apache.nifi.parameter.DatabaseParameterProvider org.apache.nifi.parameter.DatabaseParameterProvider
org.apache.nifi.parameter.OnePasswordParameterProvider org.apache.nifi.parameter.OnePasswordParameterProvider

View File

@ -16,23 +16,24 @@
--> -->
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<title>FileParameterProvider</title> <title>KubernetesSecretParameterProvider</title>
<link rel="stylesheet" href="../../../../../css/component-usage.css" type="text/css" /> <link rel="stylesheet" href="../../../../../css/component-usage.css" type="text/css" />
</head> </head>
<body> <body>
<h3>Deriving Parameters from Files</h3> <h3>Deriving Parameters from mounted Kubernetes Secret files</h3>
<p> <p>
The FileParameterProvider maps a directory to a parameter group named after the directory, and the files The KubernetesSecretParameterProvider maps a directory to a parameter group named after the directory, and the files
within the directory to parameters. Each file's name is mapped to a parameter, and the content of the file within the directory to parameters. Each file's name is mapped to a parameter, and the content of the file
becomes the value. Hidden files and nested directories are ignored. becomes the value. Hidden files and nested directories are ignored.
</p> </p>
<p> <p>
While this provider can be useful in a range of cases, it particularly matches the mounted volume secret While this provider can be useful in a range of cases since it simply reads parameter values from local files, it
structure in Kubernetes. A full discussion of Kubernetes secrets is beyond the scope of this document, particularly matches the mounted volume secret structure in Kubernetes. A full discussion of Kubernetes secrets
but a brief overview can illustrate how these secrets can be mapped to parameter groups. is beyond the scope of this document, but a brief overview can illustrate how these secrets can be mapped to
parameter groups.
</p> </p>
<h3>Kubernetes Mounted Secrets Example</h3> <h3>Kubernetes Mounted Secrets Example</h3>
@ -82,7 +83,7 @@ sys.access.key sys.admin.password sys.admin.username
<p> <p>
Therefore, to map this secret to a parameter group that will populate a Parameter Context named 'system-credentials', Therefore, to map this secret to a parameter group that will populate a Parameter Context named 'system-credentials',
you should simply provide the following configuration to the FileParameterProvider: you should simply provide the following configuration to the KubernetesSecretParameterProvider:
<ul> <ul>
<li><b>Parameter Group Directories</b> - /etc/secrets/system-credentials</li> <li><b>Parameter Group Directories</b> - /etc/secrets/system-credentials</li>

View File

@ -43,8 +43,8 @@ describe('EditParameterProvider', () => {
bulletins: [], bulletins: [],
component: { component: {
id: '369487d7-018d-1000-817a-1d8d9a8f4a91', id: '369487d7-018d-1000-817a-1d8d9a8f4a91',
name: 'Group 1 - FileParameterProvider', name: 'Group 1 - KubernetesSecretParameterProvider',
type: 'org.apache.nifi.parameter.FileParameterProvider', type: 'org.apache.nifi.parameter.KubernetesSecretParameterProvider',
bundle: { bundle: {
group: 'org.apache.nifi', group: 'org.apache.nifi',
artifact: 'nifi-standard-nar', artifact: 'nifi-standard-nar',

View File

@ -45,8 +45,8 @@ describe('FetchParameterProviderParameters', () => {
bulletins: [], bulletins: [],
component: { component: {
id: '369487d7-018d-1000-817a-1d8d9a8f4a91', id: '369487d7-018d-1000-817a-1d8d9a8f4a91',
name: 'Group 1 - FileParameterProvider', name: 'Group 1 - KubernetesSecretParameterProvider',
type: 'org.apache.nifi.parameter.FileParameterProvider', type: 'org.apache.nifi.parameter.KubernetesSecretParameterProvider',
bundle: { bundle: {
group: 'org.apache.nifi', group: 'org.apache.nifi',
artifact: 'nifi-standard-nar', artifact: 'nifi-standard-nar',