1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 12:46:18 +01:00
Files
openshift-docs/modules/serverless-functions-secrets-configmaps-interactively.adoc
2023-10-30 10:13:25 -04:00

67 lines
2.6 KiB
Plaintext

// Module included in the following assemblies:
//
// * serverless/functions/serverless-functions-accessing-secrets-configmaps.adoc
:_mod-docs-content-type: PROCEDURE
[id="serverless-functions-secrets-configmaps-interactively_{context}"]
= Modifying function access to secrets and config maps interactively
You can manage the secrets and config maps accessed by your function by using the `kn func config` interactive utility. The available operations include listing, adding, and removing values stored in config maps and secrets as environment variables, as well as listing, adding, and removing volumes. This functionality enables you to manage what data stored on the cluster is accessible by your function.
.Prerequisites
* The {ServerlessOperatorName} and Knative Serving are installed on the cluster.
* You have installed the Knative (`kn`) CLI.
* You have created a function.
.Procedure
. Run the following command in the function project directory:
+
[source,terminal]
----
$ kn func config
----
+
Alternatively, you can specify the function project directory using the `--path` or `-p` option.
. Use the interactive interface to perform the necessary operation. For example, using the utility to list configured volumes produces an output similar to this:
+
[source,terminal]
----
$ kn func config
? What do you want to configure? Volumes
? What operation do you want to perform? List
Configured Volumes mounts:
- Secret "mysecret" mounted at path: "/workspace/secret"
- Secret "mysecret2" mounted at path: "/workspace/secret2"
----
+
This scheme shows all operations available in the interactive utility and how to navigate to them:
+
[source]
----
kn func config
├─> Environment variables
│   ├─> Add
│   │  ├─> ConfigMap: Add all key-value pairs from a config map
│   │  ├─> ConfigMap: Add value from a key in a config map
│ │  ├─> Secret: Add all key-value pairs from a secret
│ │ └─> Secret: Add value from a key in a secret
│   ├─> List: List all configured environment variables
│   └─> Remove: Remove a configured environment variable
└─> Volumes
├─> Add
│   ├─> ConfigMap: Mount a config map as a volume
│   └─> Secret: Mount a secret as a volume
├─> List: List all configured volumes
└─> Remove: Remove a configured volume
----
. Optional. Deploy the function to make the changes take effect:
+
[source,terminal]
----
$ kn func deploy -p test
----