From b105b5bbef5df022b3df0c96bb6af39b19691fa1 Mon Sep 17 00:00:00 2001 From: Joe Gresock Date: Wed, 26 Jun 2024 10:40:22 -0400 Subject: [PATCH] NIFI-13454 Renamed FileParameterProvider to KubernetesSecretParameterProvider This closes #9008 Signed-off-by: David Handermann --- ...ava => KubernetesSecretParameterProvider.java} | 8 +++++--- .../org.apache.nifi.parameter.ParameterProvider | 2 +- .../additionalDetails.html | 15 ++++++++------- .../edit-parameter-provider.component.spec.ts | 4 ++-- ...arameter-provider-parameters.component.spec.ts | 4 ++-- 5 files changed, 18 insertions(+), 15 deletions(-) rename nifi-extension-bundles/nifi-standard-bundle/nifi-standard-parameter-providers/src/main/java/org/apache/nifi/parameter/{FileParameterProvider.java => KubernetesSecretParameterProvider.java} (95%) rename nifi-extension-bundles/nifi-standard-bundle/nifi-standard-parameter-providers/src/main/resources/docs/{org.apache.nifi.parameter.FileParameterProvider => org.apache.nifi.parameter.KubernetesSecretParameterProvider}/additionalDetails.html (80%) diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-parameter-providers/src/main/java/org/apache/nifi/parameter/FileParameterProvider.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-parameter-providers/src/main/java/org/apache/nifi/parameter/KubernetesSecretParameterProvider.java similarity index 95% rename from nifi-extension-bundles/nifi-standard-bundle/nifi-standard-parameter-providers/src/main/java/org/apache/nifi/parameter/FileParameterProvider.java rename to nifi-extension-bundles/nifi-standard-bundle/nifi-standard-parameter-providers/src/main/java/org/apache/nifi/parameter/KubernetesSecretParameterProvider.java index 959bf944a2..67a6e75ac1 100644 --- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-parameter-providers/src/main/java/org/apache/nifi/parameter/FileParameterProvider.java +++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-parameter-providers/src/main/java/org/apache/nifi/parameter/KubernetesSecretParameterProvider.java @@ -53,8 +53,10 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; @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. " + - "The content of the file becomes the parameter value.") +@CapabilityDescription("Fetches parameters from files, in the format provided by Kubernetes mounted secrets. " + + "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( 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.") } ) -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 Charset DEFAULT_CHARSET = StandardCharsets.UTF_8; diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-parameter-providers/src/main/resources/META-INF/services/org.apache.nifi.parameter.ParameterProvider b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-parameter-providers/src/main/resources/META-INF/services/org.apache.nifi.parameter.ParameterProvider index 4c7481fb03..98a30c2106 100644 --- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-parameter-providers/src/main/resources/META-INF/services/org.apache.nifi.parameter.ParameterProvider +++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-parameter-providers/src/main/resources/META-INF/services/org.apache.nifi.parameter.ParameterProvider @@ -13,6 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. org.apache.nifi.parameter.EnvironmentVariableParameterProvider -org.apache.nifi.parameter.FileParameterProvider +org.apache.nifi.parameter.KubernetesSecretParameterProvider org.apache.nifi.parameter.DatabaseParameterProvider org.apache.nifi.parameter.OnePasswordParameterProvider diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-parameter-providers/src/main/resources/docs/org.apache.nifi.parameter.FileParameterProvider/additionalDetails.html b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-parameter-providers/src/main/resources/docs/org.apache.nifi.parameter.KubernetesSecretParameterProvider/additionalDetails.html similarity index 80% rename from nifi-extension-bundles/nifi-standard-bundle/nifi-standard-parameter-providers/src/main/resources/docs/org.apache.nifi.parameter.FileParameterProvider/additionalDetails.html rename to nifi-extension-bundles/nifi-standard-bundle/nifi-standard-parameter-providers/src/main/resources/docs/org.apache.nifi.parameter.KubernetesSecretParameterProvider/additionalDetails.html index db62562264..31197cbb6f 100644 --- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-parameter-providers/src/main/resources/docs/org.apache.nifi.parameter.FileParameterProvider/additionalDetails.html +++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-parameter-providers/src/main/resources/docs/org.apache.nifi.parameter.KubernetesSecretParameterProvider/additionalDetails.html @@ -16,23 +16,24 @@ --> - FileParameterProvider + KubernetesSecretParameterProvider -

Deriving Parameters from Files

+

Deriving Parameters from mounted Kubernetes Secret files

- 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 becomes the value. Hidden files and nested directories are ignored.

- While this provider can be useful in a range of cases, it particularly matches the mounted volume secret - structure in Kubernetes. A full discussion of Kubernetes secrets is beyond the scope of this document, - but a brief overview can illustrate how these secrets can be mapped to parameter groups. + While this provider can be useful in a range of cases since it simply reads parameter values from local files, it + particularly matches the mounted volume secret structure in Kubernetes. A full discussion of Kubernetes secrets + is beyond the scope of this document, but a brief overview can illustrate how these secrets can be mapped to + parameter groups.

Kubernetes Mounted Secrets Example

@@ -82,7 +83,7 @@ sys.access.key sys.admin.password sys.admin.username

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: